From db073a7287bd13e3b4d034394f0b04ee0727e984 Mon Sep 17 00:00:00 2001 From: Ilya Shurumov Date: Sat, 9 Apr 2022 22:09:10 +0600 Subject: [PATCH] - few optimizations --- src_rebuild/Game/C/draw.c | 3 ++- src_rebuild/Game/C/handling.c | 14 +++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src_rebuild/Game/C/draw.c b/src_rebuild/Game/C/draw.c index f98457bc..7b2f9880 100644 --- a/src_rebuild/Game/C/draw.c +++ b/src_rebuild/Game/C/draw.c @@ -1300,10 +1300,11 @@ void DrawMapPSX(int* comp_val) int cellx, cellz; int hloop, vloop; -#if 0 //def PSX +#ifdef PSX CELL_ITERATOR& ci = *(CELL_ITERATOR*)(u_char*)getScratchAddr(0); MATRIX& mRotStore = *(MATRIX*)((u_char*)getScratchAddr(0) + sizeof(CELL_ITERATOR)); DrawMapData& drawData = *(DrawMapData*)((u_char*)getScratchAddr(0) + sizeof(CELL_ITERATOR) + sizeof(MATRIX)); + static_assert(sizeof(CELL_ITERATOR) + sizeof(MATRIX) + sizeof(DrawMapData) < 1024, "scratchpad overflow"); #else CELL_ITERATOR ci; MATRIX mRotStore; diff --git a/src_rebuild/Game/C/handling.c b/src_rebuild/Game/C/handling.c index 77959c0d..84124ea8 100644 --- a/src_rebuild/Game/C/handling.c +++ b/src_rebuild/Game/C/handling.c @@ -751,9 +751,6 @@ void GlobalTimeStep(void) void SetShadowPoints(CAR_DATA* c0, VECTOR* outpoints) { int i; - SVECTOR disp; - VECTOR pointPos; - VECTOR surfaceNormal; CAR_COSMETICS* car_cos; sdPlane* surfacePtr; @@ -766,15 +763,10 @@ void SetShadowPoints(CAR_DATA* c0, VECTOR* outpoints) for (i = 0; i < 4; i++) { - disp = car_cos->cPoints[i]; - - gte_ldv0(&disp); - + gte_ldv0(&car_cos->cPoints[i]); gte_rtv0tr(); - - gte_stlvnl(&pointPos); - - FindSurfaceD2(&pointPos, &surfaceNormal, &outpoints[i], &surfacePtr); + gte_stlvnl(&outpoints[i]); + outpoints[i].vy = MapHeight(&outpoints[i]); } }