From 94b876a708c996ea172d5fd178309f1c555afe6a Mon Sep 17 00:00:00 2001 From: Ilya Shurumov Date: Sun, 23 May 2021 15:15:38 +0600 Subject: [PATCH] - added "Draw!" string to language - fix non-translated string - misc code changes --- data/DRIVER2/LANG/EN_GAME.LTXT | 1 + data/DRIVER2/LANG/FR_GAME.LTXT | 1 + data/DRIVER2/LANG/GE_GAME.LTXT | 1 + data/DRIVER2/LANG/IT_GAME.LTXT | 1 + data/DRIVER2/LANG/SP_GAME.LTXT | 1 + src_rebuild/Game/C/cars.c | 3 -- src_rebuild/Game/C/civ_ai.c | 66 +++++++++++++++++----------------- src_rebuild/Game/C/handling.c | 44 ++++++++--------------- src_rebuild/Game/C/main.c | 42 +++++++--------------- src_rebuild/Game/C/mission.c | 10 ++---- src_rebuild/Game/C/mission.h | 5 +-- src_rebuild/Game/C/pad.c | 9 ++--- src_rebuild/Game/C/roadbits.c | 1 + src_rebuild/Game/dr2locale.h | 1 + 14 files changed, 74 insertions(+), 112 deletions(-) diff --git a/data/DRIVER2/LANG/EN_GAME.LTXT b/data/DRIVER2/LANG/EN_GAME.LTXT index fd40de71..3cef4294 100644 --- a/data/DRIVER2/LANG/EN_GAME.LTXT +++ b/data/DRIVER2/LANG/EN_GAME.LTXT @@ -12,6 +12,7 @@ Checks Flags Lap You got the flag! +Draw! Well done! You've been caught! Out of tape diff --git a/data/DRIVER2/LANG/FR_GAME.LTXT b/data/DRIVER2/LANG/FR_GAME.LTXT index 2a2dbc7d..1ac7ce42 100644 --- a/data/DRIVER2/LANG/FR_GAME.LTXT +++ b/data/DRIVER2/LANG/FR_GAME.LTXT @@ -12,6 +12,7 @@ Contr Drapeaux Tour Vous avez le drapeau! +Dessiner! Bien joué! Vous avez été attrapé! Fin de bande diff --git a/data/DRIVER2/LANG/GE_GAME.LTXT b/data/DRIVER2/LANG/GE_GAME.LTXT index fd97a058..60abb4d6 100644 --- a/data/DRIVER2/LANG/GE_GAME.LTXT +++ b/data/DRIVER2/LANG/GE_GAME.LTXT @@ -12,6 +12,7 @@ Checks Flaggen Runde Du hast sie! +Zeichnen! Gut Gemacht! Du wurdest erwischt! Kein weiterer Film mehr diff --git a/data/DRIVER2/LANG/IT_GAME.LTXT b/data/DRIVER2/LANG/IT_GAME.LTXT index cbaf304a..f865fec0 100644 --- a/data/DRIVER2/LANG/IT_GAME.LTXT +++ b/data/DRIVER2/LANG/IT_GAME.LTXT @@ -12,6 +12,7 @@ Tappe Bandiere Giro Hai preso la bandiera! +Disegnare! Ben fatto! Sei stato preso! Nastro esaurito diff --git a/data/DRIVER2/LANG/SP_GAME.LTXT b/data/DRIVER2/LANG/SP_GAME.LTXT index 0632d7c7..20db8b53 100644 --- a/data/DRIVER2/LANG/SP_GAME.LTXT +++ b/data/DRIVER2/LANG/SP_GAME.LTXT @@ -12,6 +12,7 @@ Control Banderas Vuelta ¡Lo has conseguido! +¡Dibujar! ¡Bien hecho! ¡Te atraparon! No hay mas cinta diff --git a/src_rebuild/Game/C/cars.c b/src_rebuild/Game/C/cars.c index 5412326c..50da0a78 100644 --- a/src_rebuild/Game/C/cars.c +++ b/src_rebuild/Game/C/cars.c @@ -1425,9 +1425,6 @@ void DrawCar(CAR_DATA* cp, int view) AddExhaustSmoke(cp, doSmoke > 1, WheelSpeed); - //gTimeInWater = 25; - //gSinkingTimer = 100; - SetShadowPoints(cp, corners); PlaceShadowForCar(corners, 4, 10, yVal < 0 ? 0 : 2); diff --git a/src_rebuild/Game/C/civ_ai.c b/src_rebuild/Game/C/civ_ai.c index 43793b4a..de1d8320 100644 --- a/src_rebuild/Game/C/civ_ai.c +++ b/src_rebuild/Game/C/civ_ai.c @@ -119,42 +119,42 @@ int InitCar(CAR_DATA* cp, int direction, LONGVECTOR4* startPos, unsigned char co switch (control) { - case 1: - case 7: - // player car or cutscene car - cp->ai.padid = extraData; + case CONTROL_TYPE_PLAYER: + case CONTROL_TYPE_CUTSCENE: + // player car or cutscene car + cp->ai.padid = extraData; - player[cp->id].worldCentreCarId = cp->id; - cp->hndType = 0; - break; - case 2: - cp->hndType = 1; + player[cp->id].worldCentreCarId = cp->id; + cp->hndType = 0; + break; + case CONTROL_TYPE_CIV_AI: + cp->hndType = 1; - if (extraData == NULL) - { - cp->controlFlags = 0; + if (extraData == NULL) + { + cp->controlFlags = 0; + cp->ap.palette = 0; + } + else + { + cp->controlFlags = ((EXTRA_CIV_DATA*)extraData)->controlFlags; + cp->ap.palette = ((EXTRA_CIV_DATA*)extraData)->palette; + } + + InitCivState(cp, (EXTRA_CIV_DATA*)extraData); + + break; + case CONTROL_TYPE_PURSUER_AI: + InitCopState(cp, extraData); cp->ap.palette = 0; - } - else - { - cp->controlFlags = ((EXTRA_CIV_DATA*)extraData)->controlFlags; - cp->ap.palette = ((EXTRA_CIV_DATA*)extraData)->palette; - } - - InitCivState(cp, (EXTRA_CIV_DATA*)extraData); - - break; - case 3: - InitCopState(cp, extraData); - cp->ap.palette = 0; - numCopCars++; - break; - case 4: - // free roamer lead car - InitLead(cp); - leadCarId = cp->id; - cp->hndType = 5; - break; + numCopCars++; + break; + case CONTROL_TYPE_LEAD_AI: + // free roamer lead car + InitLead(cp); + leadCarId = cp->id; + cp->hndType = 5; + break; } CreateDentableCar(cp); diff --git a/src_rebuild/Game/C/handling.c b/src_rebuild/Game/C/handling.c index 6c77008d..04883b27 100644 --- a/src_rebuild/Game/C/handling.c +++ b/src_rebuild/Game/C/handling.c @@ -130,27 +130,23 @@ void UpdateCarPoints(CAR_COSMETICS* carCos) groundCollPoints = carCos->cPoints; wheelPoints = carCos->wheelDisp; - i = 0; - - do { + for (i = 0; i < 12; i++) + { groundCollPoints->vx += delta.vx; groundCollPoints->vy -= delta.vy; groundCollPoints->vz += delta.vz; groundCollPoints++; - i++; - } while (i < 12); + } if (doWheels) { - i = 0; - - do { + for (i = 0; i < 4; i++) + { wheelPoints->vx += delta.vx; wheelPoints->vy -= delta.vy; wheelPoints->vz += delta.vz; wheelPoints++; - i++; - } while (i < 4); + } } carCos->cog.vx += delta.vx; @@ -761,10 +757,10 @@ void SetShadowPoints(CAR_DATA* c0, VECTOR* outpoints) gte_SetRotMatrix(&c0->hd.where); gte_SetTransMatrix(&c0->hd.where); - i = 0; car_cos = &car_cosmetics[c0->ap.model]; - do { + for (i = 0; i < 4; i++) + { disp = car_cos->cPoints[i]; gte_ldv0(&disp); @@ -774,9 +770,7 @@ void SetShadowPoints(CAR_DATA* c0, VECTOR* outpoints) gte_stlvnl(&pointPos); FindSurfaceD2(&pointPos, &surfaceNormal, &outpoints[i], &surfacePtr); - - i++; - } while (i < 4); + } } // [D] [T] @@ -1385,15 +1379,13 @@ void InitSkidding(void) { int i; - i = 2; - do + for(i = 0; i < 2; i++) { player[i].wheelnoise.sound = -1; player[i].wheelnoise.chan = -1; player[i].skidding.sound = -1; player[i].skidding.chan = -1; - i--; - } while (i >= 0); + } } @@ -1450,12 +1442,10 @@ void jump_debris(CAR_DATA* cp) VECTOR position; VECTOR velocity; - count = 0; wheel = cp->hd.wheel; - do + for(count = 0; count < 4; count++) { - if (wheel->susCompression != 0) { DebrisTimer = 0; @@ -1464,8 +1454,7 @@ void jump_debris(CAR_DATA* cp) } wheel++; - count++; - } while (count < 4); + } if (cp->wasOnGround == 1) { @@ -1525,14 +1514,11 @@ void CheckCarEffects(CAR_DATA* cp, int player_id) // [A] do hubcaps here HandlePlayerHubcaps(player_id); - cnt = 0; - do + for (cnt = 0; cnt < 4; cnt++) { if (cp->hd.wheel[cnt].susCompression != 0) wheels_on_ground = 1; - - cnt++; - } while (cnt < 4); + } skidsound = 0; diff --git a/src_rebuild/Game/C/main.c b/src_rebuild/Game/C/main.c index 85d6a51d..e5fcc582 100644 --- a/src_rebuild/Game/C/main.c +++ b/src_rebuild/Game/C/main.c @@ -681,9 +681,6 @@ void State_GameInit(void* param) IconsLoaded = 0; } - InWater = 0; - - gBobIndex = 0; SetupRain(); InitExObjects(); @@ -1161,13 +1158,11 @@ void StepSim(void) SetSp(oldsp); CameraCnt++; - gBobIndex = gBobIndex + 0x3cU & 0xfff; - i = 0; pl = player; // deal with car horns - while (i < NumPlayers) + for (i = 0; i < NumPlayers; i++) { int playerCarId; @@ -1190,10 +1185,7 @@ void StepSim(void) { int spuKeys; - if (i != 0) - spuKeys = 0x20; - else - spuKeys = 0x4; + spuKeys = SPU_KEYCH(i != 0 ? 5 : 2); if (SpuGetKeyStatus(spuKeys) == 0) { @@ -1207,8 +1199,6 @@ void StepSim(void) DealWithHorn(&pl->horn.request, i); } - - i++; pl++; } @@ -1216,43 +1206,35 @@ void StepSim(void) static int stupid_logic[4]; - if (gInGameCutsceneActive == 0 || gCurrentMissionNumber != 23 || gInGameCutsceneID != 0) - stupid_logic[0] = player[0].playerCarId; - else + // "Car Bomb"? + if (gInGameCutsceneActive != 0 && gCurrentMissionNumber == 23 && gInGameCutsceneID == 0) stupid_logic[0] = 2; - - i = 0; + else + stupid_logic[0] = player[0].playerCarId; stupid_logic[1] = player[1].playerCarId; stupid_logic[2] = gThePlayerCar; stupid_logic[3] = leadCarId; - while (i < 3) + for (i = 0; i < 3; i++) { - j = i + 1; - while (j < 4) + for (j = i+1; j < 4; j++) { if (stupid_logic[i] == stupid_logic[j]) stupid_logic[j] = -1; - - j++; } - i++; } - car = 0; - i = 0; - - do { + for (car = 0, i = 0; car < 4 && i < 2; car++) + { if (stupid_logic[car] != -1 && SilenceThisCar(car) == 0) { CheckCarEffects(&car_data[stupid_logic[car]], i); SwirlLeaves(&car_data[stupid_logic[car]]); + i++; } - - car++; - } while (car < 4 && i < 2); + } // save car positions if (gStopPadReads == 1 && lead_car != 0) diff --git a/src_rebuild/Game/C/mission.c b/src_rebuild/Game/C/mission.c index d5060840..37276d5a 100644 --- a/src_rebuild/Game/C/mission.c +++ b/src_rebuild/Game/C/mission.c @@ -151,10 +151,6 @@ MS_MISSION* MissionHeader; STREAM_SOURCE* PlayerStartInfo[8]; int numPlayersToCreate = 0; int gStartOnFoot = 0; -//int gSinkingTimer = 100; -//int gTimeInWater = 25; -char InWater = 0; -int gBobIndex = 0; int gWeather = 0; int gTimeOfDay = 0; int gShowPlayerDamage = 0; @@ -1140,7 +1136,7 @@ void RegisterChaseHit(int car1, int car2) Mission.ChaseHitDelay = 20; player[1 - player_id].targetCarId = gPlayerWithTheFlag; - SetPlayerMessage(player_id, "You've got the flag!",2,1); + SetPlayerMessage(player_id, G_LTXT(GTXT_YouGotTheFlag),2,1); } } } @@ -2978,8 +2974,8 @@ void SetMissionComplete(void) { if (gPlayerScore.P2items == gPlayerScore.items) { - SetPlayerMessage(0, "Draw!", 3, 2); - SetPlayerMessage(1, "Draw!", 3, 2); + SetPlayerMessage(0, G_LTXT(GTXT_Draw), 3, 2); + SetPlayerMessage(1, G_LTXT(GTXT_Draw), 3, 2); break; } diff --git a/src_rebuild/Game/C/mission.h b/src_rebuild/Game/C/mission.h index 9c44b1d4..6a9d9df7 100644 --- a/src_rebuild/Game/C/mission.h +++ b/src_rebuild/Game/C/mission.h @@ -17,10 +17,7 @@ extern MS_MISSION*MissionHeader; extern STREAM_SOURCE* PlayerStartInfo[8]; extern int numPlayersToCreate; extern int gStartOnFoot; -//extern int gSinkingTimer; -//extern int gTimeInWater; -extern char InWater; -extern int gBobIndex; + extern int gWeather; extern int gTimeOfDay; extern int gShowPlayerDamage; diff --git a/src_rebuild/Game/C/pad.c b/src_rebuild/Game/C/pad.c index 50f1baca..c051e099 100644 --- a/src_rebuild/Game/C/pad.c +++ b/src_rebuild/Game/C/pad.c @@ -189,17 +189,14 @@ void MapPad(int pad, PADRAW *pData) if (Pads[pad].active) { mapped = 0; - i = 0; - do { + for (i = 0; i < 16; i++) + { if (((buttons >> i) & 1) != 0) { mapped |= Pads[pad].mappings.button_lookup[i]; } - - i++; - } while (i < 16); - + } Pads[pad].mapnew = mapped & ~Pads[pad].mapped; Pads[pad].mapped = mapped; diff --git a/src_rebuild/Game/C/roadbits.c b/src_rebuild/Game/C/roadbits.c index fc5b9731..f966aab4 100644 --- a/src_rebuild/Game/C/roadbits.c +++ b/src_rebuild/Game/C/roadbits.c @@ -3,6 +3,7 @@ char ROADS_GetRouteData(int x, int z, ROUTE_DATA *pRouteData) { + // Driver 2 roads don't support model numbers. Driver 1 does. pRouteData->type = 0; return 1; } diff --git a/src_rebuild/Game/dr2locale.h b/src_rebuild/Game/dr2locale.h index 7077a503..6653f7d4 100644 --- a/src_rebuild/Game/dr2locale.h +++ b/src_rebuild/Game/dr2locale.h @@ -23,6 +23,7 @@ enum GameStrId GTXT_Flags, GTXT_Lap, GTXT_YouGotTheFlag, + GTXT_Draw, GTXT_WellDone, GTXT_YouveBeenCaught,