diff --git a/data/config.ini b/data/config.ini index 1ae3f6a91..e9898cd27 100644 --- a/data/config.ini +++ b/data/config.ini @@ -99,5 +99,6 @@ freeCamera=1 # Press F7 in game to enable fastLoadingScreens=1 widescreenOverlays=1 # set 1 to see map, bars and stats aligned to screen corners driver1music=0 # put Driver 1's MUSIC.BIN as D1MUSIC.BIN to DRIVER2\SOUND folder +amberTurnSignals=0 overrideContent=0 # this enables texture and car model modding userChases=RacingFreak,Snoopi,Olanov,Vortex,Fireboyd78 \ No newline at end of file diff --git a/src_rebuild/Game/ASM/asmtest.h b/src_rebuild/Game/ASM/asmtest.h index 6192fa3eb..84b76198b 100644 --- a/src_rebuild/Game/ASM/asmtest.h +++ b/src_rebuild/Game/ASM/asmtest.h @@ -1,6 +1,6 @@ #ifndef ASMTEST_H #define ASMTEST_H -extern void Asm_PlotSprite() ; // 0x0001BEE4 +extern void Asm_PlotSprite(); // 0x0001BEE4 -#endif +#endif // ASMTEST_H diff --git a/src_rebuild/Game/ASM/compres.c b/src_rebuild/Game/ASM/compres.c index 1fa324dcb..69881b15f 100644 --- a/src_rebuild/Game/ASM/compres.c +++ b/src_rebuild/Game/ASM/compres.c @@ -21,4 +21,4 @@ char* decomp_asm(char* dest, char* src) } while (ptr >= dest); return src; -} \ No newline at end of file +} diff --git a/src_rebuild/Game/ASM/compres.h b/src_rebuild/Game/ASM/compres.h index d12169086..b8790df2a 100644 --- a/src_rebuild/Game/ASM/compres.h +++ b/src_rebuild/Game/ASM/compres.h @@ -3,4 +3,4 @@ extern char* decomp_asm(char* dest, char* src); // 0x0002D298 -#endif +#endif // COMPRES_H diff --git a/src_rebuild/Game/ASM/d2mapasm.c b/src_rebuild/Game/ASM/d2mapasm.c index 7733a33df..a0ebb3525 100644 --- a/src_rebuild/Game/ASM/d2mapasm.c +++ b/src_rebuild/Game/ASM/d2mapasm.c @@ -103,7 +103,7 @@ sdPlane* sdGetCell_alpha16(VECTOR* pos) // Alpha 1.6 code, works too; not widely tested yet //buffer = *(short**)((int)RoadMapDataRegions + (cellPos.x >> 14 & 4 ^ cellPos.y >> 13 & 8 ^ sdSelfModifyingCode)); - + plane = NULL; if (*buffer == 2) @@ -169,31 +169,31 @@ int RoadInCell_alpha16(VECTOR *pos) { int cellPos_x; int cellPos_z; - + short* check; - + sdPlane* plane; short* buffer; bool moreLevels; cellPos_x = pos->vx - 512; cellPos_z = pos->vz - 512; - + buffer = RoadMapDataRegions[(cellPos_x >> 16 & 1U) ^ (regions_across / 2 & 1) + (cellPos_z >> 15 & 2U) ^ (regions_down & 2)]; - - if (*buffer == 2) + + if (*buffer == 2) { sdPlane* planeData = (sdPlane*)((char*)buffer + buffer[1]); short* bspData = (short*)((char*)buffer + buffer[2]); sdNode* nodeData = (sdNode*)((char*)buffer + buffer[3]); - - check = &buffer[(cellPos_x >> 10 & 0x3fU) + + + check = &buffer[(cellPos_x >> 10 & 0x3fU) + (cellPos_z >> 10 & 0x3fU) * MAP_REGION_SIZE * 2 + 4]; if (*check == -1) return -1; - + if (*check & 0xE000) { if (*check & 0x2000) @@ -244,19 +244,20 @@ int RoadInCell_alpha16(VECTOR *pos) plane = NULL; } } - else + else { plane = &planeData[*check]; } - + if (plane == NULL) return -1; - if (plane->surface >= 32) + if (plane->surface >= 32) { pos->vy = sdHeightOnPlane(pos, plane) + 256; return plane->surface - 32; } } + return -1; -} \ No newline at end of file +} diff --git a/src_rebuild/Game/ASM/d2mapasm.h b/src_rebuild/Game/ASM/d2mapasm.h index 535e01f59..47e695020 100644 --- a/src_rebuild/Game/ASM/d2mapasm.h +++ b/src_rebuild/Game/ASM/d2mapasm.h @@ -9,4 +9,4 @@ extern sdPlane* sdGetCell_asm(int param_2, short** roadMapData, int pos_x, int p extern sdPlane* sdGetCell_alpha16(VECTOR* pos); extern int RoadInCell_alpha16(VECTOR* pos); -#endif +#endif // D2MAPASM_H diff --git a/src_rebuild/Game/ASM/rnc_2.c b/src_rebuild/Game/ASM/rnc_2.c index e5a8bfd82..af1abfec2 100644 --- a/src_rebuild/Game/ASM/rnc_2.c +++ b/src_rebuild/Game/ASM/rnc_2.c @@ -189,4 +189,4 @@ void UnpackRNC(char* src, char* dest) RNCunpack2((unsigned char*)src + RNC_HEADER_LENGTH, hdr->packSize, (unsigned char*)dest, hdr->unpackSize); else printError("UnpackRNC error - unsupported method %d\n", method); -} \ No newline at end of file +} diff --git a/src_rebuild/Game/ASM/rnc_2.h b/src_rebuild/Game/ASM/rnc_2.h index a8dccce19..02c059cb0 100644 --- a/src_rebuild/Game/ASM/rnc_2.h +++ b/src_rebuild/Game/ASM/rnc_2.h @@ -3,4 +3,4 @@ extern void UnpackRNC(char* src, char* dest) ; // 0x0001B434 -#endif +#endif // RNC_2_H diff --git a/src_rebuild/Game/ASM/rndrasm.c b/src_rebuild/Game/ASM/rndrasm.c index 3ed7af1ec..f07ae005c 100644 --- a/src_rebuild/Game/ASM/rndrasm.c +++ b/src_rebuild/Game/ASM/rndrasm.c @@ -107,7 +107,7 @@ int FrustrumCheck16(PACKED_CELL_OBJECT* pcop, int bounding_sphere) ang = FRUSTUM_THRESHOLD - bounding_sphere; - if (ang <= result.vx && ang <= result.vy && ang <= result.vz) + if (ang <= result.vx && ang <= result.vy && ang <= result.vz) { return 0; } @@ -130,7 +130,7 @@ int FrustrumCheck(VECTOR* pos, int bounding_sphere) ang = FRUSTUM_THRESHOLD - bounding_sphere; - if (ang <= result.vx && ang <= result.vy && ang <= result.vz) + if (ang <= result.vx && ang <= result.vy && ang <= result.vz) { return 0; } diff --git a/src_rebuild/Game/ASM/rndrasm.h b/src_rebuild/Game/ASM/rndrasm.h index 4b358453a..1fb546c00 100644 --- a/src_rebuild/Game/ASM/rndrasm.h +++ b/src_rebuild/Game/ASM/rndrasm.h @@ -1,7 +1,6 @@ #ifndef RNDRASM_H #define RNDRASM_H - extern void SetCameraVector(); // 0x0001BCD4 extern void Apply_Inv_CameraMatrix(VECTOR* v); // 0x0001BCFC @@ -12,6 +11,4 @@ extern int FrustrumCheck16(PACKED_CELL_OBJECT* pcop, int bounding_sphere); // 0x extern int FrustrumCheck(VECTOR* pos, int bounding_sphere); // 0x0001BDEC - - -#endif +#endif // RNDRASM_H diff --git a/src_rebuild/Game/C/E3stuff.c b/src_rebuild/Game/C/E3stuff.c index d82b6642f..594dcc26d 100644 --- a/src_rebuild/Game/C/E3stuff.c +++ b/src_rebuild/Game/C/E3stuff.c @@ -27,7 +27,6 @@ POLYCOORD polycoords[6] = { 512, 256, 896, 256, 128, 256 } }; - // [D] [T] void ShowHiresScreens(char **names, int delay, int wait) { @@ -62,7 +61,7 @@ void ShowHiresScreens(char **names, int delay, int wait) void FadeInHiresScreen(char *filename) { int col; - + DISPENV disp; DRAWENV draw; SPRT prims[6]; @@ -93,7 +92,7 @@ void FadeInHiresScreen(char *filename) prim = prims; // prepare polygons - for(int i = 0; i < 6; i++) + for (int i = 0; i < 6; i++) { // set primitive setSprt(prim); @@ -119,9 +118,9 @@ void FadeInHiresScreen(char *filename) SetupDefDispEnv(&disp, 0, 0, 640, 512); draw.dfe = 1; - + VSync(0); - + PutDispEnv(&disp); PutDrawEnv(&draw); @@ -144,17 +143,17 @@ void FadeInHiresScreen(char *filename) PutDispEnv(&disp); PutDrawEnv(&draw); ClearOTagR((u_long*)&ot, 1); - + poly = nulls; prim = prims; for (int i = 0; i < 6; i++) { - if (col < 129) + if (col < 129) { setRGB0(prim, col, col, col); } - else + else { setRGB0(prim, 128, 128, 128); } @@ -214,7 +213,7 @@ void ShowBonusGallery() prim = prims; // prepare polygons - for(int i = 0; i < 6; i++) + for (int i = 0; i < 6; i++) { // set primitive setSprt(prim); @@ -247,13 +246,13 @@ void ShowBonusGallery() currentImage = 0; // draw image cycle - while(currentImage <= GALLERY_IMAGES) + while (currentImage <= GALLERY_IMAGES) { - if(currentImage == 0) + if (currentImage == 0) sprintf(filename, "GFX\\GAL\\INTRO.TIM"); else sprintf(filename, "GFX\\GAL\\IMG%d.TIM", currentImage-1); - + LoadfileSeg(filename, (char*)_other_buffer, 20, 0x4ff80); LoadClut((u_long*)_other_buffer, 640, 511); @@ -301,7 +300,7 @@ void ShowBonusGallery() emscripten_sleep(0); #endif - if(Pads[0].dirnew & 0x8000) + if (Pads[0].dirnew & 0x8000) { currentImage--; if (currentImage < 0) @@ -316,14 +315,14 @@ void ShowBonusGallery() } } - if(Pads[0].dirnew & 0x2000) + if (Pads[0].dirnew & 0x2000) { FESound(3); currentImage++; break; } - if(Pads[0].dirnew & 0x10) + if (Pads[0].dirnew & 0x10) { FESound(0); currentImage = GALLERY_IMAGES+1; // quit @@ -383,7 +382,7 @@ void FadeOutHiresScreen(void) SetupDefDispEnv(&disp, 0, 0, 640, 512); draw.dfe = 1; - VSync(0); + VSync(0); PutDispEnv(&disp); PutDrawEnv(&draw); @@ -441,7 +440,7 @@ void SetupDefDrawEnv(DRAWENV *env, int x, int y, int w, int h) // [D] [T] void SetupDefDispEnv(DISPENV *env, int x, int y, int w, int h) { - if (h < 257) + if (h < 257) { SetDefDispEnv(env, x, y, w, 256); @@ -476,8 +475,8 @@ void SetPleaseWait(char *buffer) DrawSync(0); VSync(0); SetDispMask(0); - SetupDefDrawEnv(&draw,0,0,320,256); - SetupDefDispEnv(&disp,0,0, 320, 256); + SetupDefDrawEnv(&draw, 0, 0, 320, 256); + SetupDefDispEnv(&disp, 0, 0, 320, 256); draw.dfe = 1; @@ -496,7 +495,7 @@ void SetPleaseWait(char *buffer) rect.w = 320; rect.h = 512; - ClearImage(&rect,0,0,0); + ClearImage(&rect, 0, 0, 0); DrawSync(0); #ifndef PSX @@ -506,11 +505,10 @@ void SetPleaseWait(char *buffer) gShowMap = 1; SetTextColour(128, 128, 128); - PrintStringCentred(G_LTXT(GTXT_PleaseWait),128); + PrintStringCentred(G_LTXT(GTXT_PleaseWait), 128); gShowMap = 0; VSync(0); - #ifdef PSX if (lastrequesteddisc == 0) @@ -524,7 +522,7 @@ void SetPleaseWait(char *buffer) #else PsyX_EndScene(); #endif // PSX - + } // [D] [T] @@ -541,7 +539,7 @@ void CheckForCorrectDisc(int disc) discerror = 0; - if (lastrequesteddisc != disc) + if (lastrequesteddisc != disc) { lastrequesteddisc = disc; ResetCityType(); @@ -552,7 +550,7 @@ void CheckForCorrectDisc(int disc) mess = G_LTXT(GTXT_PleaseinsertDISC1); exe = ".\\SLES_029.96;1"; } - else + else { mess = G_LTXT(GTXT_PleaseinsertDISC2); exe = ".\\SLES_129.96;1"; @@ -589,7 +587,7 @@ void CheckForCorrectDisc(int disc) ret = DiscSwapped(exe); - switch (ret) + switch (ret) { case CDTYPE_NODISC: discerror = 0; @@ -620,7 +618,7 @@ void CheckForCorrectDisc(int disc) rect.x = 0; rect.w = 320; rect.h = 60; - + ClearImage(&rect, 0, 0, 0); DrawSync(0); gShowMap = 1; @@ -645,8 +643,3 @@ void CheckForCorrectDisc(int disc) ClearImage(&rect, 0, 0, 0); DrawSync(0); } - - - - - diff --git a/src_rebuild/Game/C/E3stuff.h b/src_rebuild/Game/C/E3stuff.h index 96c476a89..1c8ba34a1 100644 --- a/src_rebuild/Game/C/E3stuff.h +++ b/src_rebuild/Game/C/E3stuff.h @@ -14,4 +14,4 @@ extern void CheckForCorrectDisc(int disc); // 0x00044A40 extern void ShowBonusGallery(); -#endif +#endif // E3STUFF_H diff --git a/src_rebuild/Game/C/ai.c b/src_rebuild/Game/C/ai.c index ebd839adc..df6e1d88e 100644 --- a/src_rebuild/Game/C/ai.c +++ b/src_rebuild/Game/C/ai.c @@ -21,12 +21,12 @@ int TannerCanEnterCar(CAR_DATA *cp, int distToCarSq) { int carRange; - if (cp->controlFlags & CONTROL_FLAG_COP) + if (cp->controlFlags & CONTROL_FLAG_COP) gCopCarTheftAttempted = 1; - if ((cp->controlType == CONTROL_TYPE_CIV_AI || cp->controlType == CONTROL_TYPE_CUTSCENE) && - (cp->controlFlags & CONTROL_FLAG_COP) == 0 && - (cp->controlFlags & CONTROL_FLAG_COP_SLEEPING) == 0 && + if ((cp->controlType == CONTROL_TYPE_CIV_AI || cp->controlType == CONTROL_TYPE_CUTSCENE) && + (cp->controlFlags & CONTROL_FLAG_COP) == 0 && + (cp->controlFlags & CONTROL_FLAG_COP_SLEEPING) == 0 && cp->hd.where.m[1][1] > 99) // not flipped over { if (ABS(FIXEDH(cp->hd.wheel_speed)) < 3) @@ -35,7 +35,7 @@ int TannerCanEnterCar(CAR_DATA *cp, int distToCarSq) if (ActiveCheats.cheat13 != 0) carRange <<= 1; - + if (carRange > 5000) carRange = 5000; @@ -54,7 +54,7 @@ int TannerStuckInCar(int doSpeedCheck, int player_id) CAR_DATA *cp; PLAYER* lp; - + cp = NULL; lp = &player[player_id]; @@ -64,7 +64,7 @@ int TannerStuckInCar(int doSpeedCheck, int player_id) { playerFelony = &pedestrianFelony; } - else + else { cp = &car_data[lp->playerCarId]; playerFelony = &cp->felonyRating; @@ -94,4 +94,4 @@ int TannerStuckInCar(int doSpeedCheck, int player_id) } return 1; -} \ No newline at end of file +} diff --git a/src_rebuild/Game/C/ai.h b/src_rebuild/Game/C/ai.h index dabf4f91e..5120df89b 100644 --- a/src_rebuild/Game/C/ai.h +++ b/src_rebuild/Game/C/ai.h @@ -5,5 +5,4 @@ extern void StoreGameFlags(); // 0x0001BBB8 extern int TannerCanEnterCar(CAR_DATA *cp, int distToCarSq); // 0x0001BBE8 extern int TannerStuckInCar(int doSpeedCheck, int player_id); // 0x0001BA90 - -#endif +#endif // AI_H diff --git a/src_rebuild/Game/C/bcoll3d.c b/src_rebuild/Game/C/bcoll3d.c index 01f9dff26..81d53693a 100644 --- a/src_rebuild/Game/C/bcoll3d.c +++ b/src_rebuild/Game/C/bcoll3d.c @@ -98,19 +98,19 @@ int PointFaceCheck(CAR_DATA *cp0, CAR_DATA *cp1, int i, TestResult *least, int n int collided3d(CAR_DATA *cp0, CAR_DATA *cp1, TestResult *least) { int i; - + least->depth = 0x40000000; // check up-down first - if (PointFaceCheck(cp0, cp1, 1, least, 1) >= 0 && + if (PointFaceCheck(cp0, cp1, 1, least, 1) >= 0 && PointFaceCheck(cp1, cp0, 1, least, -1) >= 0) { least->depth = 0x40000000; - + i = 0; // check sides - while (PointFaceCheck(cp0, cp1, i, least, 1) >= 0) + while (PointFaceCheck(cp0, cp1, i, least, 1) >= 0) { if (PointFaceCheck(cp1, cp0, i, least, -1) >= 0) { @@ -118,7 +118,7 @@ int collided3d(CAR_DATA *cp0, CAR_DATA *cp1, TestResult *least) if (i <= 2) continue; - + return 1; } } @@ -138,11 +138,11 @@ int CarCarCollision3(CAR_DATA *c0, CAR_DATA *c1, int *depth, VECTOR *where, VECT if (res) { *depth = tr.depth; - + where->vx = tr.location.vx; where->vy = tr.location.vy; where->vz = tr.location.vz; - + normal->vx = tr.normal.vx; normal->vy = tr.normal.vy; normal->vz = tr.normal.vz; @@ -150,8 +150,3 @@ int CarCarCollision3(CAR_DATA *c0, CAR_DATA *c1, int *depth, VECTOR *where, VECT return res; } - - - - - diff --git a/src_rebuild/Game/C/bcoll3d.h b/src_rebuild/Game/C/bcoll3d.h index 784ae337b..8cac6e27a 100644 --- a/src_rebuild/Game/C/bcoll3d.h +++ b/src_rebuild/Game/C/bcoll3d.h @@ -3,5 +3,4 @@ extern int CarCarCollision3(CAR_DATA *c0, CAR_DATA *c1, int *depth, VECTOR *where, VECTOR *normal); // 0x0001C380 - -#endif +#endif // BCOLL3D_H diff --git a/src_rebuild/Game/C/bcollide.c b/src_rebuild/Game/C/bcollide.c index 3ca46c5e8..4822a72c8 100644 --- a/src_rebuild/Game/C/bcollide.c +++ b/src_rebuild/Game/C/bcollide.c @@ -46,8 +46,8 @@ int bcollided2d(CDATA2D *body, int* boxOverlap) } // hmmm, why? - as = RSIN(dtheta & 2047); // rcossin_tbl[(dtheta & 0x7ff) * 2]; - ac = RSIN(dtheta + 1024 & 2047); // rcossin_tbl[(dtheta + 1024 & 0x7ff) * 2]; + as = RSIN(dtheta & 2047); //rcossin_tbl[(dtheta & 0x7ff) * 2]; + ac = RSIN(dtheta + 1024 & 2047); //rcossin_tbl[(dtheta + 1024 & 0x7ff) * 2]; delta.vx = body[0].x.vx - body[1].x.vx; delta.vz = body[0].x.vz - body[1].x.vz; @@ -125,7 +125,7 @@ void bFindCollisionPoint(CDATA2D *body, CRET2D *collisionResult) carBarrierCollision = 0; smallest = body[0].limit[0] + 1; - + if (!body[0].isCameraOrTanner && !body[1].isCameraOrTanner && (body[1].length[1] >= body[1].length[0] * 4 || body[1].length[0] >= body[1].length[1] * 4)) { @@ -159,7 +159,7 @@ void bFindCollisionPoint(CDATA2D *body, CRET2D *collisionResult) k--; } while (k >= 0); - + i--; } while (i >= 0); @@ -227,7 +227,7 @@ int bFindCollisionTime(CDATA2D *cd, CRET2D *collisionResult) neverfree = 1; time = 4096; step = 2048; - + for (i = 0; i < 2; i++) original[i] = cd[i]; @@ -253,7 +253,7 @@ int bFindCollisionTime(CDATA2D *cd, CRET2D *collisionResult) } } - if (hit) + if (hit) { time -= step; } @@ -271,7 +271,7 @@ int bFindCollisionTime(CDATA2D *cd, CRET2D *collisionResult) i--; } while (i >= 0); - if (hit == 0) + if (hit == 0) { for (i = 0; i < 2; i++) { @@ -307,12 +307,12 @@ void ApplyDamage(CAR_DATA *cp, char region, int value, char fakeDamage) if (cp->controlType == CONTROL_TYPE_PLAYER || cp->controlType == CONTROL_TYPE_LEAD_AI) value *= FIXEDH(gPlayerDamageFactor); - else + else value *= 2; if (cp->controlType == CONTROL_TYPE_PURSUER_AI) { - if (gCopDifficultyLevel == 1) + if (gCopDifficultyLevel == 1) { value = value * 12 >> 4; } @@ -322,7 +322,7 @@ void ApplyDamage(CAR_DATA *cp, char region, int value, char fakeDamage) } } - if (!fakeDamage) + if (!fakeDamage) { if (cp->totalDamage < USHRT_MAX - value) cp->totalDamage += value; @@ -355,11 +355,11 @@ void ApplyDamage(CAR_DATA *cp, char region, int value, char fakeDamage) if (*pRegion < value) { - if (!fakeDamage) + if (!fakeDamage) { if (cp->totalDamage < USHRT_MAX - (value - *pRegion)) cp->totalDamage += (value - *pRegion); - else + else cp->totalDamage = USHRT_MAX; } @@ -386,7 +386,7 @@ int DamageCar3D(CAR_DATA *cp, LONGVECTOR4* delta, int strikeVel, CAR_DATA *pOthe strikeVel >>= 8; - if (strikeVel < 40960) + if (strikeVel < 40960) { if (cp->totalDamage == 0) cp->totalDamage = 1; @@ -399,16 +399,16 @@ int DamageCar3D(CAR_DATA *cp, LONGVECTOR4* delta, int strikeVel, CAR_DATA *pOthe if (door < 1) { - if(nose > lbody) + if (nose > lbody) region = 0; else if (-lbody < nose) region = 5; else region = 4; } - else + else { - if(nose > lbody) + if (nose > lbody) region = 1; else if (-lbody < nose) region = 2; @@ -416,12 +416,12 @@ int DamageCar3D(CAR_DATA *cp, LONGVECTOR4* delta, int strikeVel, CAR_DATA *pOthe region = 3; } - if (cp->controlType == CONTROL_TYPE_PLAYER) + if (cp->controlType == CONTROL_TYPE_PLAYER) { value = (strikeVel / 350 + 512) * 3; value >>= 3; - + if (value > 1143) value = 1143; } @@ -443,7 +443,7 @@ int DamageCar3D(CAR_DATA *cp, LONGVECTOR4* delta, int strikeVel, CAR_DATA *pOthe value = strikeVel / 350 + 512; value >>= 3; - + if (value > 762) value = 762; @@ -451,7 +451,7 @@ int DamageCar3D(CAR_DATA *cp, LONGVECTOR4* delta, int strikeVel, CAR_DATA *pOthe value = 0; } } - else + else { value = ((strikeVel / 400 + 1024) * 7) >> 3; } @@ -481,7 +481,6 @@ int DamageCar3D(CAR_DATA *cp, LONGVECTOR4* delta, int strikeVel, CAR_DATA *pOthe return 1; } - // [D] [T] void DamageCar(CAR_DATA *cp, CDATA2D *cd, CRET2D *collisionResult, int strikeVel) { @@ -496,7 +495,7 @@ void DamageCar(CAR_DATA *cp, CDATA2D *cd, CRET2D *collisionResult, int strikeVel lbody = cp->ap.carCos->colBox.vz / 2; impact = strikeVel / 600; - if (strikeVel >= 20480 && cp->hd.speed > 9) + if (strikeVel >= 20480 && cp->hd.speed > 9) { dx = collisionResult->hit.vx - cd->x.vx; dz = collisionResult->hit.vz - cd->x.vz; @@ -523,20 +522,20 @@ void DamageCar(CAR_DATA *cp, CDATA2D *cd, CRET2D *collisionResult, int strikeVel region = 3; } - if (strikeVel > 2048000) + if (strikeVel > 2048000) strikeVel = 2048000; value = ((strikeVel / 300) * 1024) / 1500; if (value > 2048) value = 2048; - + value -= (value * cp->ap.damage[region] >> 0xd); if (cp->controlType == CONTROL_TYPE_LEAD_AI) { if (cp->ai.l.takeDamage == 0) value = 0; - else + else value >>= 1; } @@ -569,8 +568,8 @@ int CarBuildingCollision(CAR_DATA *cp, BUILDING_BOX *building, CELL_OBJECT *cop, memset((u_char*)cd, 0, sizeof(CDATA2D)); memset((u_char*)&collisionResult, 0, sizeof(CRET2D)); #else - static CDATA2D cd[2] = { 0 }; // offset 0x0 - static CRET2D collisionResult = { 0 }; // offset 0xd0 + static CDATA2D cd[2] = { 0 }; + static CRET2D collisionResult = { 0 }; #endif model = modelpointers[cop->type]; @@ -584,8 +583,8 @@ int CarBuildingCollision(CAR_DATA *cp, BUILDING_BOX *building, CELL_OBJECT *cop, else buildingHeightY = building->height >> 1; - if (boxDiffY > buildingHeightY + (cp->hd.oBox.length[1] >> 1) || - (cop->pos.vx == OBJECT_SMASHED_MARK) || + if (boxDiffY > buildingHeightY + (cp->hd.oBox.length[1] >> 1) || + (cop->pos.vx == OBJECT_SMASHED_MARK) || (model->shape_flags & SHAPE_FLAG_NOCOLLIDE)) { return 0; @@ -608,7 +607,7 @@ int CarBuildingCollision(CAR_DATA *cp, BUILDING_BOX *building, CELL_OBJECT *cop, cd[0].x.vx = cp->hd.where.t[0]; cd[0].x.vy = cp->hd.where.t[1]; cd[0].x.vz = cp->hd.where.t[2]; - + cd[0].vel.vx = FIXEDH(cp->st.n.linearVelocity[0]); cd[0].vel.vz = FIXEDH(cp->st.n.linearVelocity[2]); @@ -620,7 +619,7 @@ int CarBuildingCollision(CAR_DATA *cp, BUILDING_BOX *building, CELL_OBJECT *cop, cd[0].x.vx = cp->hd.where.t[0]; cd[0].x.vy = cp->hd.where.t[1]; cd[0].x.vz = cp->hd.where.t[2]; - + cd[0].vel.vx = 0; cd[0].vel.vz = 0; cd[0].length[1] = 5; @@ -638,7 +637,7 @@ int CarBuildingCollision(CAR_DATA *cp, BUILDING_BOX *building, CELL_OBJECT *cop, gte_ldv0(&boxDisp); gte_rtv0tr(); gte_stlvnl(&cd[0].x); - + cd[0].vel.vx = FIXEDH(cp->st.n.linearVelocity[0]); cd[0].vel.vz = FIXEDH(cp->st.n.linearVelocity[2]); @@ -750,7 +749,7 @@ int CarBuildingCollision(CAR_DATA *cp, BUILDING_BOX *building, CELL_OBJECT *cop, } #endif - if (cp->controlType != CONTROL_TYPE_CAMERACOLLIDER) + if (cp->controlType != CONTROL_TYPE_CAMERACOLLIDER) { if (collided) { @@ -759,7 +758,7 @@ int CarBuildingCollision(CAR_DATA *cp, BUILDING_BOX *building, CELL_OBJECT *cop, #if defined(COLLISION_DEBUG) && !defined(PSX) extern int gShowCollisionDebug; - if(gShowCollisionDebug == 1) + if (gShowCollisionDebug == 1) { extern void Debug_AddLine(VECTOR& pointA, VECTOR& pointB, CVECTOR& color); extern void Debug_AddLineOfs(VECTOR& pointA, VECTOR& pointB, VECTOR& ofs, CVECTOR& color); @@ -794,7 +793,7 @@ int CarBuildingCollision(CAR_DATA *cp, BUILDING_BOX *building, CELL_OBJECT *cop, collisionResult.hit.vy = cp->hd.where.t[1] + 41; // perform error correction - if((model->flags2 & MODEL_FLAG_SMASHABLE) == 0 || gInGameCutsceneActive == 0 || cd[0].isCameraOrTanner) + if ((model->flags2 & MODEL_FLAG_SMASHABLE) == 0 || gInGameCutsceneActive == 0 || cd[0].isCameraOrTanner) { cp->hd.where.t[0] += FIXEDH(collisionResult.penetration * collisionResult.surfNormal.vx); cp->hd.where.t[2] += FIXEDH(collisionResult.penetration * collisionResult.surfNormal.vz); @@ -819,13 +818,13 @@ int CarBuildingCollision(CAR_DATA *cp, BUILDING_BOX *building, CELL_OBJECT *cop, if (strikeVel > 0) { - if (cp->controlType == CONTROL_TYPE_PLAYER) + if (cp->controlType == CONTROL_TYPE_PLAYER) { short scale; - if (strikeVel < 32) + if (strikeVel < 32) scale = ((strikeVel << 23) >> 16); - else + else scale = 4096; if (model->flags2 & MODEL_FLAG_SMASHABLE) @@ -871,7 +870,7 @@ int CarBuildingCollision(CAR_DATA *cp, BUILDING_BOX *building, CELL_OBJECT *cop, SetPlayerOwnsChannel(chan, player_id); Start3DSoundVolPitch(chan, SOUND_BANK_SFX, match->sound, - collisionResult.hit.vx, -collisionResult.hit.vy, collisionResult.hit.vz, + collisionResult.hit.vx, -collisionResult.hit.vy, collisionResult.hit.vz, match->volume, match->pitch + (((velocity.vx ^ velocity.vz) * (collisionResult.hit.vx ^ collisionResult.hit.vz) & 1023) - 512)); } @@ -902,7 +901,7 @@ int CarBuildingCollision(CAR_DATA *cp, BUILDING_BOX *building, CELL_OBJECT *cop, AddLeaf(&LeafPosition, 3, 1); } - else + else { if (gNight && (model->flags2 & MODEL_FLAG_LAMP)) { @@ -932,7 +931,7 @@ int CarBuildingCollision(CAR_DATA *cp, BUILDING_BOX *building, CELL_OBJECT *cop, { Setup_Debris(&collisionResult.hit, &velocity, 6, debris_colour << 0x10); - if(cp->controlType == CONTROL_TYPE_PLAYER) + if (cp->controlType == CONTROL_TYPE_PLAYER) SetPadVibration(*cp->ai.padid, 1); } } @@ -942,7 +941,7 @@ int CarBuildingCollision(CAR_DATA *cp, BUILDING_BOX *building, CELL_OBJECT *cop, displacement = FIXEDH(lever[0] * collisionResult.surfNormal.vx + lever[1] * collisionResult.surfNormal.vy + lever[2] * collisionResult.surfNormal.vz); displacement = FIXEDH(((lever[0] * lever[0] + lever[2] * lever[2]) - displacement * displacement) * car_cos->twistRateY) + 4096; - if (strikeVel < 0x7f001) + if (strikeVel < 0x7f001) denom = (strikeVel * 4096) / displacement; else denom = (strikeVel / displacement) * 4096; @@ -980,8 +979,3 @@ int CarBuildingCollision(CAR_DATA *cp, BUILDING_BOX *building, CELL_OBJECT *cop, return collided; } - - - - - diff --git a/src_rebuild/Game/C/bcollide.h b/src_rebuild/Game/C/bcollide.h index 28dbfcc8b..f2e321837 100644 --- a/src_rebuild/Game/C/bcollide.h +++ b/src_rebuild/Game/C/bcollide.h @@ -19,5 +19,4 @@ extern void DamageCar(CAR_DATA *cp, CDATA2D *cd, CRET2D *collisionResult, int st extern int CarBuildingCollision(CAR_DATA *cp, BUILDING_BOX *building, CELL_OBJECT *cop, int flags); // 0x0001D68C - -#endif +#endif // BCOLLIDE_H diff --git a/src_rebuild/Game/C/bomberman.c b/src_rebuild/Game/C/bomberman.c index 9e0853d68..75022ca6d 100644 --- a/src_rebuild/Game/C/bomberman.c +++ b/src_rebuild/Game/C/bomberman.c @@ -58,7 +58,7 @@ void DrawThrownBombs(void) i = 0; while (i < MAX_THROWN_BOMBS) { - if ((bomb->flags & 1) != 0) + if ((bomb->flags & 1) != 0) { InitMatrix(object_matrix); @@ -80,7 +80,7 @@ void DrawThrownBombs(void) SetFrustrumMatrix(); - if (FrustrumCheck(&pos, gBombModel->bounding_sphere) != -1) + if (FrustrumCheck(&pos, gBombModel->bounding_sphere) != -1) { PlotMDL_less_than_128(gBombModel); } @@ -90,7 +90,7 @@ void DrawThrownBombs(void) bomb++; } - if (gWantFlash != 0) + if (gWantFlash != 0) { add_haze(flashval, flashval, 7); @@ -111,7 +111,7 @@ void BombThePlayerToHellAndBack(int car) return; cp = &car_data[car]; - + cp->ap.damage[0] = 0xfff; cp->ap.damage[1] = 0xfff; cp->ap.damage[2] = 0xfff; @@ -124,7 +124,7 @@ void BombThePlayerToHellAndBack(int car) DentCar(&car_data[car]); - if (maxCivCars == 0) + if (maxCivCars == 0) { trap(7); } @@ -144,7 +144,7 @@ void BombThePlayerToHellAndBack(int car) bomb->velocity.vx = 0; bomb->velocity.vy = 0; bomb->velocity.vz = 0; - + bomb = &ThrownBombs[CurrentBomb++]; CurrentBomb = CurrentBomb % MAX_THROWN_BOMBS; @@ -158,7 +158,7 @@ void BombThePlayerToHellAndBack(int car) bomb->velocity.vx = 0; bomb->velocity.vy = 0; bomb->velocity.vz = 0; - + bomb = &ThrownBombs[CurrentBomb++]; CurrentBomb = CurrentBomb % MAX_THROWN_BOMBS; @@ -176,7 +176,7 @@ void BombThePlayerToHellAndBack(int car) // [D] [T] int BombCollisionCheck(CAR_DATA *cp, VECTOR *pPos) { - CDATA2D cd[2] = {0}; + CDATA2D cd[2] = { 0 }; cd[1].theta = cp->hd.direction; cd[1].length[0] = car_cosmetics[cp->ap.model].colBox.vz; @@ -342,7 +342,7 @@ void ExplosionCollisionCheck(CAR_DATA *cp, EXOBJECT *pE) } } - if(isCar) + if (isCar) DamageCar(cp, cd, &collisionResult, strikeVel); displacement = FIXEDH(lever[0] * collisionResult.surfNormal.vx + lever[1] * collisionResult.surfNormal.vy + lever[2] * collisionResult.surfNormal.vz); @@ -373,7 +373,7 @@ void ExplosionCollisionCheck(CAR_DATA *cp, EXOBJECT *pE) return; } - if (setUsed != 0) + if (setUsed != 0) { pE->type = BANG_USED; setUsed = 0; @@ -498,4 +498,4 @@ void HandleThrownBombs(void) } bomb++; } -} \ No newline at end of file +} diff --git a/src_rebuild/Game/C/bomberman.h b/src_rebuild/Game/C/bomberman.h index 7fb959f01..22c0aedd3 100644 --- a/src_rebuild/Game/C/bomberman.h +++ b/src_rebuild/Game/C/bomberman.h @@ -11,4 +11,4 @@ extern void DrawThrownBombs(); // 0x0001E810 extern void BombThePlayerToHellAndBack(int car); // 0x0001EA00 extern void ExplosionCollisionCheck(CAR_DATA *cp, EXOBJECT *pE); // 0x0001ED18 -#endif +#endif // BOMBERMAN_H diff --git a/src_rebuild/Game/C/camera.c b/src_rebuild/Game/C/camera.c index 9dfe2548d..c8b319e3d 100644 --- a/src_rebuild/Game/C/camera.c +++ b/src_rebuild/Game/C/camera.c @@ -23,18 +23,18 @@ VECTOR gCameraOffset = { 0}; VECTOR camera_position = { 0, 380, 0, 0 }; -SVECTOR camera_angle = { 0,0,0 }; +SVECTOR camera_angle = { 0, 0, 0 }; MATRIX camera_matrix; MATRIX face_camera_work = { - { - { 4096, 0, 0 }, + { + { 4096, 0, 0 }, { 0, 4096, 0 }, - { 0, 0, 4096 } + { 0, 0, 4096 } }, - { 0, 0, 0 } + { 0, 0, 0 } }; char old_camera_change = 0; @@ -49,7 +49,7 @@ static int baseDir = 0; char tracking_car = 0; -int gCameraAngle = 2048; // offset 0xAA104 +int gCameraAngle = 2048; int TargetCar = 0; int CameraCar = 0; @@ -106,7 +106,7 @@ void CalcCameraBasePos(PLAYER* lp) gte_rtv0tr(); gte_stlvnl(basePos); - if(gInGameCutsceneActive == 0) + if (gInGameCutsceneActive == 0) basePos[1] -= gCameraOffset.vy; baseDir = car_data[lp->cameraCarId].hd.direction; @@ -116,7 +116,7 @@ void CalcCameraBasePos(PLAYER* lp) // [D] [T] void InitCamera(PLAYER *lp) { - if (events.cameraEvent == NULL) + if (events.cameraEvent == NULL) { paddCamera = Pads[lp->padid].mapped; @@ -129,13 +129,13 @@ void InitCamera(PLAYER *lp) if (lp->cameraView == 0) { - if (FrameCnt == 0) + if (FrameCnt == 0) { lp->cameraDist = 1000; gCameraAngle = 2048; gCameraMaxDistance = 0; - + gCameraOffset.vx = 0; gCameraOffset.vy = 0; gCameraOffset.vz = 0; @@ -170,8 +170,8 @@ void InitCamera(PLAYER *lp) } // "Beat the Train" hack - if (gCurrentMissionNumber == 22 && - lp->cameraPos.vx < 0 && + if (gCurrentMissionNumber == 22 && + lp->cameraPos.vx < 0 && lp->cameraPos.vz < 793671 && lp->cameraPos.vz > 700000) { SetSpecialCamera(SPECIAL_CAMERA_SET, 0); @@ -185,7 +185,7 @@ void InitCamera(PLAYER *lp) lp->snd_cam_ang = camera_angle.vy; } - else + else { BuildWorldMatrix(); } @@ -201,7 +201,7 @@ void ModifyCamera(void) { // camera types which can be chosen during game static char inGameCamera[4] = { - 1,0,2,1 + 1, 0, 2, 1 }; PLAYER *lp; @@ -214,7 +214,7 @@ void ModifyCamera(void) if (NoPlayerControl || cameraview == 6 || events.cameraEvent != NULL) // || NumPlayers > 1) // [A] allow switching cameras in multiplayer return; - for(i = 0; i < NumPlayers; i++) + for (i = 0; i < NumPlayers; i++) { lp = &player[i]; @@ -230,7 +230,7 @@ void ModifyCamera(void) if (pNextCameraView > inGameCamera + 2) break; } - + lp->cameraView = *pNextCameraView; lp->viewChange = FrameCnt; } @@ -281,8 +281,8 @@ int CameraCollisionCheck(void) cellLevel = events.camera ? events.draw : -1; do { - cellx = (camera_position.vx + (count % 3) * MAP_REGION_SIZE*MAP_REGION_SIZE - MAP_REGION_SIZE*MAP_REGION_SIZE + units_across_halved) / MAP_CELL_SIZE; - cellz = (camera_position.vz + (count / 3) * MAP_REGION_SIZE*MAP_REGION_SIZE - MAP_REGION_SIZE*MAP_REGION_SIZE + units_down_halved) / MAP_CELL_SIZE; + cellx = (camera_position.vx + (count % 3) * (MAP_REGION_SIZE * MAP_REGION_SIZE) - (MAP_REGION_SIZE * MAP_REGION_SIZE) + units_across_halved) / MAP_CELL_SIZE; + cellz = (camera_position.vz + (count / 3) * (MAP_REGION_SIZE * MAP_REGION_SIZE) - (MAP_REGION_SIZE * MAP_REGION_SIZE) + units_down_halved) / MAP_CELL_SIZE; if (gCameraDistance > 0) { @@ -302,7 +302,7 @@ int CameraCollisionCheck(void) num_cb = *boxptr; collide = (COLLISION_PACKET *)(boxptr + 1); - if (xd * xd + zd * zd < model->bounding_sphere * model->bounding_sphere + sphere * sphere) + if (xd * xd + zd * zd < model->bounding_sphere * model->bounding_sphere + sphere * sphere) { box_loop = 0; @@ -363,7 +363,7 @@ int CameraCollisionCheck(void) void TurnHead(PLAYER *lp) { LPPEDESTRIAN pPlayerPed; - + pPlayerPed = lp->pPed; // [A] handle REDRIVER2 dedicated look back button @@ -434,7 +434,7 @@ void PlaceCameraFollowCar(PLAYER *lp) maxCameraDist = 850; carheight = -220; camExpandSpeed = 10; - + if (lp->cameraCarId >= 0) { CAR_DATA* camCar; @@ -443,7 +443,7 @@ void PlaceCameraFollowCar(PLAYER *lp) car_cos = camCar->ap.carCos; - if(car_cos) + if (car_cos) { int addDist; @@ -514,11 +514,11 @@ void PlaceCameraFollowCar(PLAYER *lp) gCameraDistance = maxCameraDist; - if (lp->cameraCarId >= 0) + if (lp->cameraCarId >= 0) jcam->ap.carCos = car_data[lp->cameraCarId].ap.carCos; jcam->hd.direction = camAngle & 0xfff; - + sdist = maxCameraDist * RSIN(camAngle) + 2048; cdist = maxCameraDist * RCOS(camAngle) + 2048; @@ -541,7 +541,7 @@ void PlaceCameraFollowCar(PLAYER *lp) camera_angle.vy = -(jcam->hd.direction + 2048); else camera_angle.vy = -ratan2(basePos[0] - lp->cameraPos.vx, basePos[2] - lp->cameraPos.vz) & 0xfff; - + camera_angle.vz = 0; SetGeomScreen(scr_z = gCameraDefaultScrZ); @@ -550,7 +550,6 @@ void PlaceCameraFollowCar(PLAYER *lp) BuildWorldMatrix(); } - // [D] [T] int PointAtTarget(VECTOR *pPosition, VECTOR *pTarget, SVECTOR *pAngleVec) { @@ -729,4 +728,4 @@ void PlaceCameraAtLocation(PLAYER* lp, int zoom) SetGeomScreen(scr_z); switch_detail_distance = 10000 + (d >> 1); BuildWorldMatrix(); -} \ No newline at end of file +} diff --git a/src_rebuild/Game/C/camera.h b/src_rebuild/Game/C/camera.h index 875dc8dca..8983ee8ba 100644 --- a/src_rebuild/Game/C/camera.h +++ b/src_rebuild/Game/C/camera.h @@ -1,7 +1,7 @@ #ifndef CAMERA_H #define CAMERA_H -#define CAMERA_COLLIDER_CARID (MAX_CARS+1) +#define CAMERA_COLLIDER_CARID (MAX_CARS + 1) #ifdef PSX #define VIEW_DRAW_DISTANCE 16000 @@ -43,12 +43,10 @@ extern void PlaceCameraFollowCar(PLAYER *lp); // 0x0002003C extern void PlaceCameraAtLocation(PLAYER *lp, int zoom); // 0x00020904 extern void PlaceCameraInCar(PLAYER *lp, int BumperCam); // 0x0002050C - -extern int PointAtTarget(VECTOR* pPosition, VECTOR* pTarget, SVECTOR* pAngleVec); +extern int PointAtTarget(VECTOR* pPosition, VECTOR* pTarget, SVECTOR* pAngleVec); // 0x00020B08 extern int OK_To_Zoom(); // 0x00020BC0 extern void SetBasePos(VECTOR *pVec); // 0x00020C70 - -#endif +#endif // CAMERA_H diff --git a/src_rebuild/Game/C/cars.c b/src_rebuild/Game/C/cars.c index bd324f9dc..b7bf867c7 100644 --- a/src_rebuild/Game/C/cars.c +++ b/src_rebuild/Game/C/cars.c @@ -37,23 +37,23 @@ struct plotCarGlobals #endif MATRIX light_matrix = -{ - { - { 4096, 0, 0 }, - { 0, 0, 0 }, +{ + { + { 4096, 0, 0 }, + { 0, 0, 0 }, { 0, 0, 0 } - }, - { 0, 0, 0 } + }, + { 0, 0, 0 } }; MATRIX colour_matrix = -{ - { - { 4032, 0, 0 }, - { 3936, 0, 0 }, +{ + { + { 4032, 0, 0 }, + { 3936, 0, 0 }, { 3520, 0, 0 } - }, - { 0, 0, 0 } + }, + { 0, 0, 0 } }; // PHYSICS @@ -70,8 +70,8 @@ MODEL* gDamWheelModelPtr; CAR_DATA* active_car_list[MAX_CARS]; u_char lightsOnDelay[MAX_CARS]; -short FrontWheelRotation[MAX_CARS]; // offset 0x0 -short BackWheelRotation[MAX_CARS]; // offset 0x30 +short FrontWheelRotation[MAX_CARS]; +short BackWheelRotation[MAX_CARS]; SVECTOR gTempCarVertDump[MAX_CARS][MAX_DENTING_VERTS]; @@ -129,7 +129,7 @@ void plotCarPolyB3(int numTris, CAR_POLY *src, SVECTOR *vlist, plotCarGlobals *p gte_stopz(&Z); gte_avsz3(); - if (Z > -1) + if (Z > -1) { *(u_int*)&prim->r0 = FT3rgb | 0x20000000; @@ -185,7 +185,7 @@ void plotCarPolyFT3(int numTris, CAR_POLY *src, SVECTOR *vlist, plotCarGlobals * gte_stopz(&Z); gte_avsz3(); - if (Z > -1) + if (Z > -1) { ofse = pg->damageLevel[src->originalindex]; *(u_int*)&prim->r0 = FT3rgb; @@ -213,8 +213,8 @@ void plotCarPolyFT3(int numTris, CAR_POLY *src, SVECTOR *vlist, plotCarGlobals * void plotCarPolyGT3(int numTris, CAR_POLY *src, SVECTOR *vlist, SVECTOR *nlist, plotCarGlobals *pg, int palette) { int Z; - int otz; - SVECTOR* v2; + int otz; + SVECTOR *v2; SVECTOR *v1; SVECTOR *v0; u_int indices; @@ -243,7 +243,7 @@ void plotCarPolyGT3(int numTris, CAR_POLY *src, SVECTOR *vlist, SVECTOR *nlist, gte_stopz(&Z); gte_avsz3(); - + gte_stotz(&otz); if (Z > -1 && otz > 0) @@ -279,7 +279,6 @@ void plotCarPolyGT3(int numTris, CAR_POLY *src, SVECTOR *vlist, SVECTOR *nlist, pg->primptr = (unsigned char*)prim; } - #ifdef DYNAMIC_LIGHTING void plotCarPolyGT3Lit(int numTris, CAR_POLY* src, SVECTOR* vlist, SVECTOR* nlist, plotCarGlobals* pg, int palette) { @@ -367,7 +366,6 @@ void plotCarPolyGT3Lit(int numTris, CAR_POLY* src, SVECTOR* vlist, SVECTOR* nlis } #endif // DYNAMIC_LIGHTING - // [D] [T] void plotCarPolyGT3nolight(int numTris, CAR_POLY *src, SVECTOR *vlist, plotCarGlobals *pg, int palette) { @@ -687,7 +685,7 @@ void DrawCarWheels(CAR_DATA *cp, MATRIX *RearMatrix, VECTOR *pos, int zclip) WheelModelBack = gFastWheelModelPtr; wheelSize = car_cosmetics[cp->ap.model].wheelSize; - + sizeScale = (wheelSize * 14142) / 10000; // rotate wheel verts @@ -740,7 +738,7 @@ void DrawCarWheels(CAR_DATA *cp, MATRIX *RearMatrix, VECTOR *pos, int zclip) BW2z = FIXEDH(RCOS(BackWheelRotation[car_id]) * sizeScale); VertPtr = GET_MODEL_DATA(SVECTOR, WheelModelBack, vertices); - + VertPtr[8].vz = BW1z; VertPtr[15].vz = BW1z; VertPtr[11].vy = BW1z; @@ -809,7 +807,7 @@ void DrawCarWheels(CAR_DATA *cp, MATRIX *RearMatrix, VECTOR *pos, int zclip) model = gDamWheelModelPtr; } - if ((wheelnum & 2) == 0) + if ((wheelnum & 2) == 0) sWheelPos.vx = 17 - wheelDisp->vx; else sWheelPos.vx = -17 - wheelDisp->vx; @@ -830,7 +828,7 @@ void DrawCarWheels(CAR_DATA *cp, MATRIX *RearMatrix, VECTOR *pos, int zclip) gte_SetTransVector(&WheelPos); - if ((wheelnum & 1) == 0) + if ((wheelnum & 1) == 0) { gte_SetRotMatrix(&FrontMatrix); } @@ -857,7 +855,7 @@ void PlayerCarFX(CAR_DATA *cp) AddIndicatorLight(cp, 1); } - if( WheelSpeed < 0 && cp->thrust > 0 || + if (WheelSpeed < 0 && cp->thrust > 0 || WheelSpeed > 0 && cp->thrust < 0) { AddBrakeLight(cp); @@ -935,7 +933,7 @@ void plotNewCarModel(CAR_MODEL* car, int palette) (gEnableDlights ? plotCarPolyGT3Lit : plotCarPolyGT3)(car->numGT3, car->pGT3, car->vlist, car->nlist, &_pg, palette); #else plotCarPolyGT3(car->numGT3, car->pGT3, car->vlist, car->nlist, &_pg, palette); -#endif +#endif // DYNAMIC_LIGHTING } current->primptr = (char*)_pg.primptr; @@ -946,7 +944,7 @@ void plotNewCarModel(CAR_MODEL* car, int palette) // [A] void startBuildNewCars(int isSpecial) { - if(isSpecial) + if (isSpecial) baseSpecCP = whichCP; else whichCP = 0; @@ -1071,7 +1069,7 @@ void buildNewCarFromModel(int index, int detail, char* polySrc, MODEL* model) cp = carPolyBuffer + newNumPolys; - switch (ptype & 0x1f) + switch (ptype & 0x1f) { case 0: case 18: @@ -1087,7 +1085,7 @@ void buildNewCarFromModel(int index, int detail, char* polySrc, MODEL* model) case 19: if (pass == 2) // F4 { - cp->vindices = M_INT_4R(polyList[4], polyList[5], polyList[6], 0); + cp->vindices = M_INT_4R(polyList[4], polyList[5], polyList[6], 0); cp->originalindex = i; cp++; @@ -1102,7 +1100,7 @@ void buildNewCarFromModel(int index, int detail, char* polySrc, MODEL* model) if (pass == 1) // FT3 { POLYFT3* pft3 = (POLYFT3*)polyList; - + cp->vindices = M_INT_4R(pft3->v0, pft3->v1, pft3->v2, 0); cp->clut_uv0 = M_INT_2(texture_cluts[pft3->texture_set][pft3->texture_id], *(ushort*)&pft3->uv0); cp->tpage_uv1 = M_INT_2(texture_pages[pft3->texture_set], *(ushort*)&pft3->uv1); @@ -1124,7 +1122,7 @@ void buildNewCarFromModel(int index, int detail, char* polySrc, MODEL* model) cp->originalindex = i; cp++; - + cp->vindices = M_INT_4R(pft4->v0, pft4->v2, pft4->v3, 0); cp->clut_uv0 = M_INT_2(texture_cluts[polyList[1]][polyList[2]], *(ushort*)&pft4->uv0); cp->tpage_uv1 = M_INT_2(texture_pages[polyList[1]], *(ushort*)&pft4->uv2); @@ -1138,12 +1136,12 @@ void buildNewCarFromModel(int index, int detail, char* polySrc, MODEL* model) if (pass == 0) // GT3 { POLYGT3* pgt3 = (POLYGT3*)polyList; - + carid = GetCarPalIndex(pgt3->texture_set); clut = (carid - 1) * 6 * 32 + pgt3->texture_id * 6; civ_clut[carid][pgt3->texture_id][0] = texture_cluts[pgt3->texture_set][pgt3->texture_id]; - + cp->vindices = M_INT_4R(pgt3->v0, pgt3->v1, pgt3->v2, 0); cp->nindices = M_INT_4R(pgt3->n0, pgt3->n1, pgt3->n2, 0); cp->clut_uv0 = M_INT_2(clut, *(ushort*)&pgt3->uv0); @@ -1187,11 +1185,11 @@ void buildNewCarFromModel(int index, int detail, char* polySrc, MODEL* model) polyList += PolySizes[ptype & 0x1f]; } - if (pass == 1) + if (pass == 1) car->numFT3 = newNumPolys - whichCP; else if (pass == 0) car->numGT3 = newNumPolys - whichCP; - else if (pass == 2) + else if (pass == 2) car->numB3 = newNumPolys - whichCP; whichCP = newNumPolys; @@ -1204,7 +1202,7 @@ void MangleWheelModels(void) UV_INFO tmpUV2; u_char tmpUV; u_int v0, v1, v2; - POLYFT4*src; + POLYFT4 *src; MODEL *m; int i, j; @@ -1219,7 +1217,7 @@ void MangleWheelModels(void) // do some fuckery swaps src = GET_MODEL_DATA(POLYFT4, m, poly_block); - + v0 = *(u_int *)&src[2].v0; v1 = *(u_int *)&src[2].uv0; v2 = *(u_int *)&src[2].uv2; @@ -1290,7 +1288,7 @@ void MangleWheelModels(void) for (j = 0; j < 2; j++) { tmpUV2 = src->uv0; - + src->uv0 = src->uv1; src->uv1 = src->uv2; src->uv2 = src->uv3; @@ -1298,11 +1296,11 @@ void MangleWheelModels(void) src++; } - } - // HACK: Show clean model only in Rio. - //if (GameLevel == 3) + // HACK: Show clean model only in Rio + // Leftover from Driver 1 used in Los Angeles + //if (GameLevel == LEVEL_RIO) // gFastWheelModelPtr = gCleanWheelModelPtr; } @@ -1320,7 +1318,7 @@ void ProcessPalletLump(char *lump_ptr, int lump_size) int clut_number; total_cluts = *(int*)lump_ptr; - + if (total_cluts == 0) return; @@ -1344,7 +1342,7 @@ void ProcessPalletLump(char *lump_ptr, int lump_size) clutValue = GetClut(clutpos.x, clutpos.y); IncrementClutNum(&clutpos); - *clutTablePtr++ = clutValue; + *clutTablePtr++ = clutValue; } else { @@ -1543,7 +1541,7 @@ void DrawCar(CAR_DATA* cp, int view) if (cp->controlType == CONTROL_TYPE_PLAYER) { - if(*cp->ai.padid >= 0 && *cp->ai.padid < 2) + if (*cp->ai.padid >= 0 && *cp->ai.padid < 2) maxDamage = MaxPlayerDamage[*cp->ai.padid]; } @@ -1631,7 +1629,7 @@ void DrawCar(CAR_DATA* cp, int view) AddNightLights(cp); } - if(CarHasSiren(cp->ap.model)) + if (CarHasSiren(cp->ap.model)) { if ((IS_ROADBLOCK_CAR(cp) || cp->controlType == CONTROL_TYPE_PURSUER_AI) || // any regular cop car including roadblock gInGameCutsceneActive && cp->controlType == CONTROL_TYPE_CUTSCENE && force_siren[CAR_INDEX(cp)] != 0 || // any car with siren in cutscene @@ -1655,4 +1653,4 @@ char GetCarPalIndex(int tpage) } return 0; -} \ No newline at end of file +} diff --git a/src_rebuild/Game/C/cars.h b/src_rebuild/Game/C/cars.h index 88902ddd7..670c4353e 100644 --- a/src_rebuild/Game/C/cars.h +++ b/src_rebuild/Game/C/cars.h @@ -1,7 +1,6 @@ #ifndef CARS_H #define CARS_H - #define CAR_INDEX(cp) (int)(cp-car_data) #define IS_ROADBLOCK_CAR(cp) (cp->controlType == CONTROL_TYPE_CIV_AI && (cp->controlFlags & CONTROL_FLAG_COP_SLEEPING)) @@ -55,5 +54,4 @@ extern void MangleWheelModels(); // 0x000230C8 extern char GetCarPalIndex(int tpage); // 0x00023390 - -#endif +#endif // CARS_H diff --git a/src_rebuild/Game/C/cd_icon.h b/src_rebuild/Game/C/cd_icon.h index 74149aaa1..0e7ef9a74 100644 --- a/src_rebuild/Game/C/cd_icon.h +++ b/src_rebuild/Game/C/cd_icon.h @@ -12,65 +12,65 @@ unsigned short cd_icon[] = 0x0, 0x0, 0xFE00, 0x7777, 0xF777, 0xE, 0x0, 0x0, 0x0, 0x0, 0x666E, 0x7777, - 0x8777, 0xE88, 0x0, 0x0 , + 0x8777, 0xE88, 0x0, 0x0, 0x0, 0x5E00, 0x6666, 0x7776, - 0x8877, 0x9888, 0xE, 0x0 , + 0x8877, 0x9888, 0xE, 0x0, 0x0, 0x55E0, 0x6666, 0x7776, - 0x8877, 0x9988, 0xE9, 0x0 , + 0x8877, 0x9988, 0xE9, 0x0, 0x0, 0x555E, 0x6665, 0x7776, - 0x8877, 0x9988, 0xE99, 0x0 , + 0x8877, 0x9988, 0xE99, 0x0, 0xE000, 0x5554, 0x6665, 0x7776, - 0x8877, 0x9998, 0xEAA9, 0x0 , + 0x8877, 0x9998, 0xEAA9, 0x0, 0x4E00, 0x5544, 0x6655, 0x7766, - 0x8877, 0x9998, 0xAAAA, 0xE , + 0x8877, 0x9998, 0xAAAA, 0xE, 0x4400, 0x5444, 0x6655, 0x7766, - 0x8877, 0x9999, 0xAAAA, 0xB , + 0x8877, 0x9999, 0xAAAA, 0xB, 0x43E0, 0x4444, 0x6555, 0x7766, - 0x8887, 0xA999, 0xBAAA, 0xEB , + 0x8887, 0xA999, 0xBAAA, 0xEB, 0x3330, 0x4443, 0x6555, 0x7766, - 0x8887, 0xAA99, 0xBBAA, 0xBB , + 0x8887, 0xAA99, 0xBBAA, 0xBB, 0x333E, 0x4433, 0x5554, 0x7766, - 0x9887, 0xAAA9, 0xBBBB, 0xEBB , + 0x9887, 0xAAA9, 0xBBBB, 0xEBB, 0x332E, 0x4333, 0x5544, 0xFFF6, - 0x99FF, 0xBAAA, 0xBBBB, 0xECB , + 0x99FF, 0xBAAA, 0xBBBB, 0xECB, 0x2222, 0x3332, 0x5443, 0xFFFF, - 0xAFFF, 0xBBAA, 0xCBBB, 0xCCC , + 0xAFFF, 0xBBAA, 0xCBBB, 0xCCC, 0x2222, 0x2222, 0xF433, 0xEEFF, - 0xFFFE, 0xCBBA, 0xCCCC, 0xCCC , - 0x2111, 0x2222, 0xF222, 0xEF , - 0xFFE0, 0xCCCC, 0xCCCC, 0xDDD , - 0x1111, 0x1111, 0xF111, 0xEF , - 0xFFE0, 0xDDDD, 0xDDDD, 0xDDD , - 0xDDDD, 0xDDDD, 0xFDDD, 0xEF , - 0xFFE0, 0x1111, 0x1111, 0x111 , - 0xCDDD, 0xCCCC, 0xFCCC, 0xEF , - 0xFFE0, 0x2222, 0x2222, 0x111 , + 0xFFFE, 0xCBBA, 0xCCCC, 0xCCC, + 0x2111, 0x2222, 0xF222, 0xEF, + 0xFFE0, 0xCCCC, 0xCCCC, 0xDDD, + 0x1111, 0x1111, 0xF111, 0xEF, + 0xFFE0, 0xDDDD, 0xDDDD, 0xDDD, + 0xDDDD, 0xDDDD, 0xFDDD, 0xEF, + 0xFFE0, 0x1111, 0x1111, 0x111, + 0xCDDD, 0xCCCC, 0xFCCC, 0xEF, + 0xFFE0, 0x2222, 0x2222, 0x111, 0xCCCC, 0xCCCC, 0xFABB, 0xEEFF, - 0xFFFE, 0x2334, 0x2222, 0x222 , + 0xFFFE, 0x2334, 0x2222, 0x222, 0xCCCC, 0xBBBB, 0xAAAB, 0xFFFF, - 0x4FFF, 0x3344, 0x2333, 0x222 , + 0x4FFF, 0x3344, 0x2333, 0x222, 0xBBCE, 0xBBBB, 0x9AAA, 0xFFF9, - 0x55FF, 0x3444, 0x3333, 0xE33 , + 0x55FF, 0x3444, 0x3333, 0xE33, 0xBBBE, 0xABBB, 0x99AA, 0x7788, - 0x5667, 0x4445, 0x3333, 0xE33 , + 0x5667, 0x4445, 0x3333, 0xE33, 0xBBB0, 0xAAAB, 0x899A, 0x7788, - 0x5667, 0x4445, 0x3344, 0x33 , + 0x5667, 0x4445, 0x3344, 0x33, 0xBBE0, 0xAAAA, 0x8999, 0x7788, - 0x6667, 0x4455, 0x3444, 0xE3 , + 0x6667, 0x4455, 0x3444, 0xE3, 0xAB00, 0x9AAA, 0x8999, 0x7778, - 0x6677, 0x4555, 0x4444, 0x3 , + 0x6677, 0x4555, 0x4444, 0x3, 0xAE00, 0x9AAA, 0x8899, 0x7778, - 0x6677, 0x4555, 0x4444, 0xE , + 0x6677, 0x4555, 0x4444, 0xE, 0xE000, 0x99AA, 0x8899, 0x7778, - 0x6677, 0x5556, 0xE444, 0x0 , + 0x6677, 0x5556, 0xE444, 0x0, 0x0, 0x999E, 0x8889, 0x7778, - 0x6677, 0x5556, 0xE45, 0x0 , + 0x6677, 0x5556, 0xE45, 0x0, 0x0, 0x99E0, 0x8889, 0x7778, - 0x6677, 0x5566, 0xE5, 0x0 , + 0x6677, 0x5566, 0xE5, 0x0, 0x0, 0x9E00, 0x8888, 0x7778, - 0x6677, 0x5566, 0xE, 0x0 , + 0x6677, 0x5566, 0xE, 0x0, 0x0, 0x0, 0x888E, 0x7777, - 0x6777, 0xE66, 0x0, 0x0 , + 0x6777, 0xE66, 0x0, 0x0, 0x0, 0x0, 0xFE00, 0x7777, - 0xF777, 0xE, 0x0, 0x0 , -}; \ No newline at end of file + 0xF777, 0xE, 0x0, 0x0, +}; diff --git a/src_rebuild/Game/C/cell.c b/src_rebuild/Game/C/cell.c index 3a7aff13c..4a293730d 100644 --- a/src_rebuild/Game/C/cell.c +++ b/src_rebuild/Game/C/cell.c @@ -38,26 +38,26 @@ PACKED_CELL_OBJECT * GetFirstPackedCop(int cellx, int cellz, CELL_ITERATOR *pci, // [A] don't draw loading region if (loading_region[index] != -1) return NULL; - + if (RoadMapRegions[index] != (cellx / MAP_REGION_SIZE) + (cellz / MAP_REGION_SIZE) * (cells_across / MAP_REGION_SIZE)) return NULL; } - cbr = (cellz % MAP_REGION_SIZE) * MAP_REGION_SIZE + index * (MAP_REGION_SIZE*MAP_REGION_SIZE) + (cellx % MAP_REGION_SIZE); - + cbr = (cellz % MAP_REGION_SIZE) * MAP_REGION_SIZE + index * (MAP_REGION_SIZE * MAP_REGION_SIZE) + (cellx % MAP_REGION_SIZE); + ptr = cell_ptrs[cbr]; - + if (ptr == 0xffff) return NULL; cell = &cells[ptr]; - if (level == -1) + if (level == -1) { if (cell->num & 0x4000) return NULL; } - else + else { /* Data looks like this: @@ -89,7 +89,7 @@ PACKED_CELL_OBJECT * GetFirstPackedCop(int cellx, int cellz, CELL_ITERATOR *pci, num = cell->num & 16383; ppco = &cell_objects[num]; - if (ppco->value == 0xffff && (ppco->pos.vy & 1)) + if (ppco->value == 0xffff && (ppco->pos.vy & 1)) { ppco = GetNextPackedCop(pci); } @@ -113,7 +113,6 @@ PACKED_CELL_OBJECT * GetFirstPackedCop(int cellx, int cellz, CELL_ITERATOR *pci, return ppco; } - // [D] [T] PACKED_CELL_OBJECT* GetNextPackedCop(CELL_ITERATOR* pci) { @@ -123,7 +122,7 @@ PACKED_CELL_OBJECT* GetNextPackedCop(CELL_ITERATOR* pci) CELL_DATA* celld; celld = pci->pcd; - + do { do { if (celld->num & 0x8000) // end of cell objects? @@ -138,7 +137,7 @@ PACKED_CELL_OBJECT* GetNextPackedCop(CELL_ITERATOR* pci) num &= 16383; ppco = &cell_objects[num]; } while (ppco->value == 0xffff && (ppco->pos.vy & 1)); - + if (!pci->use_computed) break; @@ -156,7 +155,6 @@ PACKED_CELL_OBJECT* GetNextPackedCop(CELL_ITERATOR* pci) return ppco; } - // [D] [T] CELL_OBJECT* UnpackCellObject(PACKED_CELL_OBJECT* ppco, XZPAIR* near) { @@ -172,4 +170,4 @@ CELL_OBJECT* UnpackCellObject(PACKED_CELL_OBJECT* ppco, XZPAIR* near) QuickUnpackCellObject(ppco, near, pco); return pco; -} \ No newline at end of file +} diff --git a/src_rebuild/Game/C/cell.h b/src_rebuild/Game/C/cell.h index 15767f6a2..a90af6660 100644 --- a/src_rebuild/Game/C/cell.h +++ b/src_rebuild/Game/C/cell.h @@ -20,4 +20,4 @@ inline void QuickUnpackCellObject(PACKED_CELL_OBJECT* ppco, XZPAIR* near, CELL_O pco->type = (ppco->value >> 6) | ((ppco->pos.vy & 1) << 10); } -#endif +#endif // CELL_H diff --git a/src_rebuild/Game/C/civ_ai.c b/src_rebuild/Game/C/civ_ai.c index fd6822f2e..17c9d952e 100644 --- a/src_rebuild/Game/C/civ_ai.c +++ b/src_rebuild/Game/C/civ_ai.c @@ -362,12 +362,12 @@ int GetNextRoadInfo(CAR_DATA* cp, int randomExit, int* turnAngle, int* startDist } newLane = -1; - + if (IS_JUNCTION_SURFACE(tmpNewRoad[0])) { int exitFrom, exitCnt, bestExit; int rnd; - + cp->ai.c.changeLaneCount = 0; jn = GET_JUNCTION(tmpNewRoad[0]); @@ -375,9 +375,9 @@ int GetNextRoadInfo(CAR_DATA* cp, int randomExit, int* turnAngle, int* startDist // check if road is valid for this junction // by determining connection with junction - for(exitCnt = 0; exitCnt < 4; exitCnt++) + for (exitCnt = 0; exitCnt < 4; exitCnt++) { - if(jn->ExitIdx[exitCnt] == currentRoadId) + if (jn->ExitIdx[exitCnt] == currentRoadId) { exitFrom = exitCnt; break; @@ -399,10 +399,10 @@ int GetNextRoadInfo(CAR_DATA* cp, int randomExit, int* turnAngle, int* startDist int exitSurfId, exitIdx, valid; exitIdx = (exitFrom + exitCnt + 1) % 4; - + valid = 0; exitSurfId = jn->ExitIdx[exitIdx]; - + if (exitSurfId != -1) { int turnAng; @@ -432,7 +432,7 @@ int GetNextRoadInfo(CAR_DATA* cp, int randomExit, int* turnAngle, int* startDist numLanes = ROAD_WIDTH_IN_LANES(&roadInfo); - if(roadInfo.straight) + if (roadInfo.straight) { oppDir = (roadInfo.straight->angle - turnDir) + 1024U & 2048; } @@ -444,7 +444,7 @@ int GetNextRoadInfo(CAR_DATA* cp, int randomExit, int* turnAngle, int* startDist oppDir = DIFF_ANGLES(ratan2(dx, dz), turnDir); oppDir = (oppDir < 1) * 2048; } - + if (turnAng == 0) // going forward { if (oppDir != oldOppDir) // next road is flipped @@ -497,24 +497,24 @@ int GetNextRoadInfo(CAR_DATA* cp, int randomExit, int* turnAngle, int* startDist { if (validExitIdx[2] != 42) numExits--; - + validExitIdx[2] = 42; } else if (cp->ai.c.currentLane == rightLane) { if (validExitIdx[0] != 42) numExits--; - + validExitIdx[0] = 42; } else if (validExitIdx[1] != 42) { if (validExitIdx[0] != 42) numExits--; - + if (validExitIdx[2] != 42) numExits--; - + validExitIdx[2] = 42; validExitIdx[0] = 42; } @@ -525,7 +525,7 @@ int GetNextRoadInfo(CAR_DATA* cp, int randomExit, int* turnAngle, int* startDist CIV_STATE_SET_CONFUSED(cp); return 0; } - + // randomize exit selection rnd = Random2(0) % 3; @@ -534,7 +534,7 @@ int GetNextRoadInfo(CAR_DATA* cp, int randomExit, int* turnAngle, int* startDist bestExit = validExitIdx[rnd % 3]; rnd++; } while (bestExit == 42); - + newRoad = jn->ExitIdx[bestExit]; { @@ -594,7 +594,7 @@ int GetNextRoadInfo(CAR_DATA* cp, int randomExit, int* turnAngle, int* startDist } else { - + if (!yield || *turnAngle != 0) { @@ -607,7 +607,7 @@ int GetNextRoadInfo(CAR_DATA* cp, int randomExit, int* turnAngle, int* startDist } } - if(!GetSurfaceRoadInfo(&roadInfo, newRoad)) + if (!GetSurfaceRoadInfo(&roadInfo, newRoad)) { CIV_STATE_SET_CONFUSED(cp); return 0; @@ -639,7 +639,7 @@ int GetNextRoadInfo(CAR_DATA* cp, int randomExit, int* turnAngle, int* startDist if (turnAng == 0) { //printWarning("car %d check forward lane\n", cp->id); - + if (oppDir == oldOppDir) newLane = cp->ai.c.currentLane; else @@ -690,7 +690,7 @@ int GetNextRoadInfo(CAR_DATA* cp, int randomExit, int* turnAngle, int* startDist { // road continuation using connections int roadCnt; - + if (turnAngle == NULL) { CIV_STATE_SET_CONFUSED(cp); @@ -700,10 +700,10 @@ int GetNextRoadInfo(CAR_DATA* cp, int randomExit, int* turnAngle, int* startDist *turnAngle = 0; newExit = -1; numExits = 0; - + if (tmpNewRoad[0] != -1) numExits++; - + if (tmpNewRoad[1] != -1) numExits++; @@ -720,7 +720,7 @@ int GetNextRoadInfo(CAR_DATA* cp, int randomExit, int* turnAngle, int* startDist numLanes = 0; // [A] fix lane changingg issues - if(cp->ai.c.changeLaneCount > 0) + if (cp->ai.c.changeLaneCount > 0) { GetNodePos(currentRoadInfo.straight, NULL, currentRoadInfo.curve, oldNode->distAlongSegment, NULL, &px, &pz, cp->ai.c.currentLane); } @@ -735,7 +735,7 @@ int GetNextRoadInfo(CAR_DATA* cp, int randomExit, int* turnAngle, int* startDist numLanes = ROAD_WIDTH_IN_LANES(&roadInfo); // determine new lane by old node position - if(roadInfo.straight) + if (roadInfo.straight) { dx = (px - roadInfo.straight->Midx); dz = (pz - roadInfo.straight->Midz); @@ -754,7 +754,7 @@ int GetNextRoadInfo(CAR_DATA* cp, int randomExit, int* turnAngle, int* startDist } // [A] if there are more than one connections we check the bounds strictly - if(numExits > 1) + if (numExits > 1) { if (tmpNewLane[roadCnt] < 0 || tmpNewLane[roadCnt] >= numLanes) { @@ -780,7 +780,7 @@ int GetNextRoadInfo(CAR_DATA* cp, int randomExit, int* turnAngle, int* startDist if (tmpNewLane[roadCnt] < 0) tmpNewLane[roadCnt] = 0; - + // set this a s correct exit newExit = roadCnt; } @@ -797,18 +797,18 @@ int GetNextRoadInfo(CAR_DATA* cp, int randomExit, int* turnAngle, int* startDist } newExit = (ABS(laneFit[0]) < ABS(laneFit[1])) ^ 1; - + newRoad = tmpNewRoad[newExit]; newLane = tmpNewLane[newExit]; - + if (cp->ai.c.ctrlState != 7) { // [A] removed old lane fitting code - + if (laneFit[newExit] != 0) { cp->ai.c.turnNode = GET_NODE_ID(cp, GET_NEXT_NODE(cp, oldNode)); - cp->ai.c.turnDir = ROAD_LANE_DIR(&roadInfo, laneFit[newExit]); + cp->ai.c.turnDir = ROAD_LANE_DIR(&roadInfo, laneFit[newExit]); } } } @@ -824,7 +824,7 @@ int GetNextRoadInfo(CAR_DATA* cp, int randomExit, int* turnAngle, int* startDist { if (GetSurfaceRoadInfo(&roadInfo, newRoad)) { - if(roadInfo.straight) + if (roadInfo.straight) { if (ROAD_LANE_DIR(&roadInfo, newLane)) *startDist = roadInfo.straight->length; @@ -1084,7 +1084,7 @@ int CheckChangeLanes(DRIVER2_STRAIGHT* straight, DRIVER2_CURVE* curve, int distA } newLane = currentLane + (Random2((int)straight) >> 7 & 2U) + 0xff & 0xff; - + if (tryToPark) { if (oldLane == 1) @@ -1093,7 +1093,7 @@ int CheckChangeLanes(DRIVER2_STRAIGHT* straight, DRIVER2_CURVE* curve, int distA newLane = roadWidthInLanes - 1; // [A] don't park near the road ends - if(distAlongSegment < 1024 && distAlongSegment > segLen - 1024) + if (distAlongSegment < 1024 && distAlongSegment > segLen - 1024) return currentLane; } @@ -1106,7 +1106,7 @@ int CheckChangeLanes(DRIVER2_STRAIGHT* straight, DRIVER2_CURVE* curve, int distA continue; //travelAlongRoad = (currentLane ^ 1) & 1; - + if (gCurrentMissionNumber == 33 && makeLimoPullOver) { // bypass checks @@ -1133,20 +1133,20 @@ int CheckChangeLanes(DRIVER2_STRAIGHT* straight, DRIVER2_CURVE* curve, int distA } // don't allow to change lane which in wrong direction - if (straight != NULL) + if (straight != NULL) { oldLaneDir = ROAD_LANE_DIR(straight, oldLane); if (oldLaneDir != ROAD_LANE_DIR(straight, newLane)) continue; } - else if (curve != NULL) + else if (curve != NULL) { oldLaneDir = ROAD_LANE_DIR(curve, oldLane); if (oldLaneDir != ROAD_LANE_DIR(curve, newLane)) continue; } - if (cp->ai.c.ctrlNode == NULL && cp->ai.c.turnNode == -1) + if (cp->ai.c.ctrlNode == NULL && cp->ai.c.turnNode == -1) { canProceed = true; turnRight = oldLaneDir == 0; @@ -1165,7 +1165,7 @@ int CheckChangeLanes(DRIVER2_STRAIGHT* straight, DRIVER2_CURVE* curve, int distA cd[0].length[1] = cp->ap.carCos->colBox.vx; cd[0].theta = cp->hd.direction; - lcp = &car_data[MAX_CARS-1]; + lcp = &car_data[MAX_CARS - 1]; while (lcp >= car_data) { @@ -1184,7 +1184,7 @@ int CheckChangeLanes(DRIVER2_STRAIGHT* straight, DRIVER2_CURVE* curve, int distA dx = cd[0].x.vx - cd[1].x.vx; dz = cd[0].x.vz - cd[1].x.vz; - if (ABS(dx) < length && ABS(dz) < length) + if (ABS(dx) < length && ABS(dz) < length) { if (bcollided2d(cd)) { @@ -1260,7 +1260,7 @@ int CreateNewNode(CAR_DATA * cp) travelDir = 1; else travelDir = -1; - + if (roadInfo.straight) { segmentEnd = roadInfo.straight->length; @@ -1294,7 +1294,7 @@ int CreateNewNode(CAR_DATA * cp) (travelDir < 0 && start->distAlongSegment < 1)) { cp->ai.c.currentRoad = GetNextRoadInfo(cp, 1, &turnAngle, &startDist, start); - + newNode->dir = start->dir + turnAngle & 0xfff; newNode->distAlongSegment = startDist; @@ -1311,7 +1311,7 @@ int CreateNewNode(CAR_DATA * cp) } cr = cp->ai.c.currentRoad; - + if (GetSurfaceRoadInfo(&roadInfo, cr)) { // this node is unused @@ -1327,7 +1327,7 @@ int CreateNewNode(CAR_DATA * cp) travelDir = 1; else travelDir = -1; - + if (roadInfo.curve) { int dist; @@ -1400,7 +1400,7 @@ int CreateNewNode(CAR_DATA * cp) } } } - } + } tempNode.x = newNode->x; tempNode.z = newNode->z; @@ -1479,7 +1479,7 @@ int CreateNewNode(CAR_DATA * cp) } } } - + break; } @@ -1533,10 +1533,10 @@ int InitCivState(CAR_DATA * cp, EXTRA_CIV_DATA * extraData) cp->ai.c.ctrlNode = NULL; cp->ai.c.turnNode = -1; - if(GetSurfaceRoadInfo(&roadInfo, cs->currentRoad)) + if (GetSurfaceRoadInfo(&roadInfo, cs->currentRoad)) { cp->ai.c.maxSpeed = speedLimits[ROAD_SPEED_LIMIT(&roadInfo)]; - + InitNodeList(cp, extraData); cp->ai.c.pnode = &cp->ai.c.targetRoute[0]; @@ -1575,7 +1575,7 @@ int PingOutCar(CAR_DATA * cp) // inform target that car was pinged out if (cp->inform) *cp->inform ^= TARGET_FLAG_CAR_PINGED_IN; - + cp->inform = NULL; ClearMem((char*)cp, sizeof(CAR_DATA)); @@ -1791,7 +1791,7 @@ int CreateStationaryCivCar(int direction, int orientX, int orientZ, LONGVECTOR4* LONGQUATERNION tmpQ; model = -1; - + if (MissionHeader->residentModels[0] == externalModel) model = 0; else if (MissionHeader->residentModels[1] == externalModel) @@ -1829,7 +1829,7 @@ int CreateStationaryCivCar(int direction, int orientX, int orientZ, LONGVECTOR4* if (newCar) { int dx, dz; - + civDat.thrustState = 3; civDat.ctrlState = 7; @@ -1849,7 +1849,7 @@ int CreateStationaryCivCar(int direction, int orientX, int orientZ, LONGVECTOR4* civDat.angle = direction; InitCar(newCar, direction, startPos, 2, model, 0, (char*)&civDat); - + dx = RSIN(orientZ / 2); dz = RCOS(orientZ / 2); @@ -1878,7 +1878,7 @@ int CreateStationaryCivCar(int direction, int orientX, int orientZ, LONGVECTOR4* #define PINGIN_DIST_WANTED_MULT (10) #define PINGIN_DIST_MULT (8) -// [D] [T] [A] - some register is not properly decompiled +// [D] [T] [A] some register is not properly decompiled int PingInCivCar(int minPingInDist) { #ifdef PSX @@ -1918,7 +1918,7 @@ int PingInCivCar(int minPingInDist) PingOutCivsOnly = 1; _CutRec_HandleCarRequest(); - + if (requestCopCar == 0 && numParkedCars < maxParkedCars && (gCurrentMissionNumber != 33 || numCivCars != 0)) { tryPingInParkedCars = 1; @@ -2005,7 +2005,7 @@ int PingInCivCar(int minPingInDist) // randomized pings int angle; int dx, dz; - + const int maxCookies = requestCopCar ? 55 : 43; if (requestCopCar == 0 && cookieCount > 43) @@ -2069,12 +2069,12 @@ int PingInCivCar(int minPingInDist) randomLoc.vx = baseLoc.vx + FIXEDH(dx) * 2048; randomLoc.vz = baseLoc.vz + FIXEDH(dz) * 2048; } - + roadSeg = RoadInCell(&randomLoc); } while (!IS_STRAIGHT_SURFACE(roadSeg) && !IS_CURVED_SURFACE(roadSeg)); } - + // wtf there were before? car wasn't set to 'confused' state if (!GetSurfaceRoadInfo(&roadInfo, roadSeg)) { @@ -2090,7 +2090,7 @@ int PingInCivCar(int minPingInDist) volatile int numPossibleLanes; volatile int numLanes; volatile int allowedToPark; - + if (ROAD_LANES_COUNT(&roadInfo) == 0) // BAD ROAD { //CIV_STATE_SET_CONFUSED(newCar); @@ -2108,7 +2108,7 @@ int PingInCivCar(int minPingInDist) } else { - + for (i = 0; i < numLanes; i++) { // collect the lanes. @@ -2306,7 +2306,7 @@ int PingInCivCar(int minPingInDist) civDat.distAlongSegment = (currentAngle & 0xfffU) - roadInfo.curve->start & 0xfc0; else civDat.distAlongSegment = (currentAngle & 0xfffU) - roadInfo.curve->start & 0xfe0; - + if (civDat.distAlongSegment <= minDistAlong) civDat.distAlongSegment = minDistAlong; @@ -2395,7 +2395,7 @@ int PingInCivCar(int minPingInDist) return 0; } - + civDat.angle = dir; InitCar(newCar, dir, &pos, 2, model, 0, (char*)&civDat); @@ -2435,7 +2435,6 @@ int PingInCivCar(int minPingInDist) return newCar->id + 1; } - // [D] [T] void AttemptUnPark(CAR_DATA * cp) { @@ -2445,8 +2444,8 @@ void AttemptUnPark(CAR_DATA * cp) InitCivState(cp, NULL); oldLane = cp->ai.c.currentLane; - - if(GetSurfaceRoadInfo(&roadInfo, cp->ai.c.currentRoad)) + + if (GetSurfaceRoadInfo(&roadInfo, cp->ai.c.currentRoad)) { cp->ai.c.currentLane = CheckChangeLanes(roadInfo.straight, roadInfo.curve, cp->ai.c.targetRoute[0].distAlongSegment, cp, 0); @@ -2628,12 +2627,12 @@ int CivAccelTrafficRules(CAR_DATA * cp, int* distToNode) carDir = cp->hd.direction; distToObstacle = 0x7fffff; - lcp = &car_data[MAX_CARS-1]; + lcp = &car_data[MAX_CARS - 1]; while (lcp >= car_data) { if (lcp->ai.c.thrustState != 3 && lcp->ai.c.ctrlState != 4 && // [A] don't check cars that are yielding - lcp != cp && + lcp != cp && lcp->controlType != CONTROL_TYPE_NONE) { dx = lcp->hd.where.t[0] - cp->hd.where.t[0]; @@ -2779,7 +2778,7 @@ void SetUpCivCollFlags(void) { continue; } - + cd[1].length[0] = 60; cd[1].length[1] = 60; cd[1].x.vx = player[0].pos[0]; @@ -2877,7 +2876,7 @@ void SetUpCivCollFlags(void) continue; } - for (i = 0; i < 2; i++) + for (i = 0; i < 2; i++) { if (hornchanflag[i] == 0) { @@ -2894,10 +2893,10 @@ void SetUpCivCollFlags(void) sample = cp0->ap.model - 1; // [A] use tracking sound - Start3DTrackingSound(hornchanflag[i], SOUND_BANK_CARS, sample * 3 + 2, + Start3DTrackingSound(hornchanflag[i], SOUND_BANK_CARS, sample * 3 + 2, (VECTOR*)cp0->hd.where.t, (LONGVECTOR3*)cp0->st.n.linearVelocity); - + SetChannelVolume(hornchanflag[i], -2000, 0); horncarflag[i] = cp0; @@ -3177,7 +3176,7 @@ int CivFindPointOnPath(CAR_DATA * cp, int station, VECTOR * ppoint) const int checkFrames = 20; const int maxSteer = 512; -// [D] [T] [A] - removed copying of car. Still works okay +// [D] [T] [A] removed copying of car. Still works okay int CivSteerAngle(CAR_DATA* cp) { CIV_ROUTE_ENTRY* startNode; @@ -3302,7 +3301,7 @@ void CreateRoadblock(void) // [A] use player instead of car dir = player[0].dir; - + baseLoc.vx = player[0].pos[0]; baseLoc.vy = player[0].pos[1]; baseLoc.vz = player[0].pos[2]; @@ -3313,7 +3312,7 @@ void CreateRoadblock(void) // scan for roads do { int dx, dz; - + if (requestCopCar != 0) { dx = RSIN(dir + angle) * PINGIN_DIST_WANTED_MULT; @@ -3386,7 +3385,7 @@ void CreateRoadblock(void) numLanes = ROAD_WIDTH_IN_LANES(str); } - else if(IS_CURVED_SURFACE(roadSeg)) + else if (IS_CURVED_SURFACE(roadSeg)) { int theta; int segmentLen; @@ -3398,8 +3397,8 @@ void CreateRoadblock(void) return; currentAngle = ratan2(roadblockLoc.vx - crv->Midx, roadblockLoc.vz - crv->Midz); - - if(crv->inside < 10) + + if (crv->inside < 10) minDistAlong = 128; else if (crv->inside < 20) minDistAlong = 64; @@ -3407,14 +3406,14 @@ void CreateRoadblock(void) minDistAlong = 32; theta = (currentAngle & 0xfffU) - crv->start; - - if(crv->inside < 10) + + if (crv->inside < 10) distAlongSegment = theta & 0xf80; else if (crv->inside < 20) distAlongSegment = theta & 0xfc0; else distAlongSegment = theta & 0xfe0; - + segmentLen = (crv->end - crv->start) - minDistAlong & 0xfff; if (distAlongSegment >= segmentLen) @@ -3433,11 +3432,11 @@ void CreateRoadblock(void) while (delta < numLanes * 512) { laneNo = (delta >> 9); - + currentPos.vx = startPos.vx + FIXEDH(delta * RSIN(dir2NextRow)); currentPos.vz = startPos.vz + FIXEDH(delta * RCOS(dir2NextRow)); - if((str && ROAD_IS_AI_LANE(str, laneNo) || crv && ROAD_IS_AI_LANE(crv, laneNo)) && + if ((str && ROAD_IS_AI_LANE(str, laneNo) || crv && ROAD_IS_AI_LANE(crv, laneNo)) && CellEmpty(¤tPos, lbody)) { newSlot = CreateStationaryCivCar(dir2NextRow + (Random2(0) * 0x10001 >> (laneNo) & 0x3ffU) - 512, 0, 0, (LONGVECTOR4 *)¤tPos, externalCopModel, 0, 2); @@ -3487,7 +3486,7 @@ void CreateRoadblock(void) int count; int numCarsToAdd; int px, pz; - + if (ratan2(baseLoc.vx - startPos.vx, baseLoc.vz - startPos.vz) - dir2NextRow & 0xfff < 2048) deltaAngle = -1024; else @@ -3501,7 +3500,7 @@ void CreateRoadblock(void) theta = dir2NextRow + deltaAngle; px = startPos.vx + FIXEDH(RSIN(theta) * 1500); pz = startPos.vz + FIXEDH(RCOS(theta) * 1500); - + numSpareCars = (maxCivCars - numCivCars) + 2; numSpots = numLanes / 2 - 1; @@ -3560,7 +3559,6 @@ void CreateRoadblock(void) PlaceRoadBlockCops(); } - // [D] [T] int CivControl(CAR_DATA* cp) { @@ -3587,7 +3585,7 @@ int CivControl(CAR_DATA* cp) thrust = CivAccel(cp); if (thrust != 0) // [A] reduce acceleration when steering is applied thrust = CivAccel(cp) - MAX(ABS(steer), 4) * 3; - + // [A] fix backwards crawl if (thrust < 0 && cp->hd.wheel_speed < 100) thrust = 0; @@ -3715,4 +3713,4 @@ int CivControl(CAR_DATA* cp) PassiveCopTasks(cp); return 1; -} \ No newline at end of file +} diff --git a/src_rebuild/Game/C/civ_ai.h b/src_rebuild/Game/C/civ_ai.h index 91a28aad9..5c206e40b 100644 --- a/src_rebuild/Game/C/civ_ai.h +++ b/src_rebuild/Game/C/civ_ai.h @@ -49,10 +49,8 @@ extern int CreateCivCarWotDrivesABitThenStops(int direction, LONGVECTOR4* startP extern int CreateStationaryCivCar(int direction, int orientX, int orientZ, LONGVECTOR4* startPos, int externalModel, int palette, int controlFlags); // 0x00028960 extern int CheckChangeLanes(DRIVER2_STRAIGHT* straight, DRIVER2_CURVE* curve, int distAlongSegment, CAR_DATA* cp, int tryToPark); // 0x00026F20 -extern int NotTravellingAlongCurve(int x, int z, int dir, DRIVER2_CURVE* cv); +extern int NotTravellingAlongCurve(int x, int z, int dir, DRIVER2_CURVE* cv); // 0x0002D24C extern int CivControl(CAR_DATA* cp); // 0x0002CE10 - - -#endif +#endif // CIV_AI_H diff --git a/src_rebuild/Game/C/convert.c b/src_rebuild/Game/C/convert.c index 3c5f24297..669723c7f 100644 --- a/src_rebuild/Game/C/convert.c +++ b/src_rebuild/Game/C/convert.c @@ -142,7 +142,7 @@ void Getlong(char *dest, char *source) dest[3] = source[3]; } -static int rseed[17]; // offset 0xBD510 +static int rseed[17]; static int randomindex = 0; static int randomcounter = 0; @@ -156,7 +156,7 @@ void RandomInit(int i1, int i2) int*sd; step = 0x3b1cb49; - + randomindex = 0; randomcounter = 0; rseed[0] = i1; @@ -164,11 +164,11 @@ void RandomInit(int i1, int i2) count = 14; sd = rseed + 2; - + do { *sd++ = step; step += 0x1c05e5f; - + count--; } while (count > -1); diff --git a/src_rebuild/Game/C/convert.h b/src_rebuild/Game/C/convert.h index 141f10d6d..99406bbb9 100644 --- a/src_rebuild/Game/C/convert.h +++ b/src_rebuild/Game/C/convert.h @@ -20,5 +20,4 @@ extern void Getlong(char *dest, char *source); // 0x0002D678 extern void RandomInit(int i1, int i2); // 0x0002D6A8 extern int Random2(int step); // 0x0002D724 - -#endif +#endif // CONVERT_H diff --git a/src_rebuild/Game/C/cop_ai.c b/src_rebuild/Game/C/cop_ai.c index 6e2068488..9a5e2f77d 100644 --- a/src_rebuild/Game/C/cop_ai.c +++ b/src_rebuild/Game/C/cop_ai.c @@ -89,7 +89,7 @@ void InitCopState(CAR_DATA *cp, char *extraData) if (gCopDifficultyLevel == 0) cp->hndType = 2; - else if (gCopDifficultyLevel == 1) + else if (gCopDifficultyLevel == 1) cp->hndType = 3; else cp->hndType = 4; @@ -100,7 +100,6 @@ int ReplayLog_Fnarr_He_Said_Log(int val) return 0; } - // [D] [T] int FindCost(int x, int z, int dvx, int dvz) { @@ -208,7 +207,7 @@ void WibbleDownTheRoad(VECTOR *from, int distance, VECTOR *to) to->vz = pos.vz; to->pad = pos.pad; - if (((thl[3] - thl[0]) + 200U & 0xfff) < 400) + if (((thl[3] - thl[0]) + 200U & 0xfff) < 400) { pathStraight = 1; } @@ -283,7 +282,7 @@ void InitCops(void) gCopData.autoMaxPowerScaleLimit = 0; gCopData.autoDesiredSpeedScaleLimit = 0; - if (GameType == GAME_GETAWAY) + if (GameType == GAME_GETAWAY) { gCopRespawnTime = 10000; } @@ -292,7 +291,7 @@ void InitCops(void) gCopRespawnTime = 0; gCopDesiredSpeedScale = 4596; gCopMaxPowerScale = 4596; - + gCopData.autoMaxPowerScaleLimit = 1024; gCopData.autoDesiredSpeedScaleLimit = 1024; } @@ -315,7 +314,6 @@ void InitCops(void) CarTail.vy = 0; CarTail.vz = 0; - lastKnownPosition.vx = INT_MAX; lastKnownPosition.vy = INT_MAX; lastKnownPosition.vz = INT_MAX; @@ -325,7 +323,7 @@ void InitCops(void) copsAreInPursuit = 0; } -VECTOR targetPoint = { 0,0,0 }; +VECTOR targetPoint = { 0, 0, 0 }; // [D] [T] void CopControl1(CAR_DATA *cp) @@ -371,7 +369,7 @@ void CopControl1(CAR_DATA *cp) // [A] new cop batter logic // survival setting really - if(gBatterPlayer) + if (gBatterPlayer) doBatter = 1; else doBatter = 0; @@ -382,7 +380,7 @@ void CopControl1(CAR_DATA *cp) #if ENABLE_GAME_ENCHANCEMENTS int batterTrigger; - if(gCopDifficultyLevel == 0) + if (gCopDifficultyLevel == 0) batterTrigger = 80; else if (gCopDifficultyLevel == 1) batterTrigger = 50; @@ -391,7 +389,7 @@ void CopControl1(CAR_DATA *cp) if (cp->ai.p.batterTimer > batterTrigger) doBatter = 1; - + cp->ai.p.batterTimer++; cp->ai.p.batterTimer &= 127; #else @@ -399,7 +397,7 @@ void CopControl1(CAR_DATA *cp) #endif } - if (cp->ai.p.dying != 0 || + if (cp->ai.p.dying != 0 || cp->totalDamage > 27000 && gCopData.immortal == 0) { cp->thrust = 0; @@ -419,7 +417,7 @@ void CopControl1(CAR_DATA *cp) dx = ABS(cp->hd.where.t[0] - gStopCops.pos.vx); dz = ABS(cp->hd.where.t[2] - gStopCops.pos.vz); - if (dx + dz < gStopCops.radius * 3 / 2 && + if (dx + dz < gStopCops.radius * 3 / 2 && SquareRoot0(dx * dx + dz * dz) < gStopCops.radius) { cp->thrust = 0; @@ -505,11 +503,11 @@ void CopControl1(CAR_DATA *cp) dvx = targetVehicle->st.n.linearVelocity[0] - cp->st.n.linearVelocity[0]; dvz = targetVehicle->st.n.linearVelocity[2] - cp->st.n.linearVelocity[2]; - + dist = FindCost(x, z, dvx, dvz); cp->ai.p.close_pursuit = (dist < 2800); - + targetFound = 0; if (cp->ai.p.recoveryTimer < 1) @@ -517,13 +515,13 @@ void CopControl1(CAR_DATA *cp) if (dist < 8400) { int dd; - + dx = x - targetVehicle->hd.where.t[0]; dz = targetVehicle->hd.where.t[2] - z; - + idvx = FIXEDH(dvx); idvz = FIXEDH(dvz); - + dd = (dx * idvx - dz * idvz) / (idvx * idvx + idvz * idvz + 1); if (doBatter == 0) @@ -531,7 +529,7 @@ void CopControl1(CAR_DATA *cp) if (dd < 0) dd = 0; - else if (dd > 60) + else if (dd > 60) dd = 60; dvz = targetVehicle->hd.where.t[0] + FIXEDH(targetVehicle->st.n.linearVelocity[0] * dd); @@ -542,23 +540,23 @@ void CopControl1(CAR_DATA *cp) CarTail.vx = dvz - (targetVehicle->hd.where.m[0][2] * 5 >> 7); CarTail.vz = dvx - (targetVehicle->hd.where.m[2][2] * 5 >> 7); } - else + else { CarTail.vx = dvz + (targetVehicle->hd.where.m[0][0] * 5 >> 8); CarTail.vz = dvx + (targetVehicle->hd.where.m[2][0] * 5 >> 8); } } - else + else { CarTail.vx = targetVehicle->hd.where.t[0]; CarTail.vz = targetVehicle->hd.where.t[2]; } - if (cp->ai.p.close_pursuit == 0) + if (cp->ai.p.close_pursuit == 0) { WibbleDownTheRoad((VECTOR*)cp->hd.where.t, cp->hd.speed * 10 + 680, &targetPoint); } - else + else { targetPoint.vx = CarTail.vx; targetPoint.vz = CarTail.vz; @@ -587,42 +585,42 @@ void CopControl1(CAR_DATA *cp) cp->ai.p.targetHistory[0].vx = targetPoint.vx; cp->ai.p.targetHistory[0].vz = targetPoint.vz; } - else + else { cp->ai.p.recoveryTimer--; } - //if (gTimeInWater == 0) + //if (gTimeInWater == 0) // targetFound = 0; - if (targetFound) + if (targetFound) { slidevel = FIXEDH(cp->hd.where.m[0][0] * cp->st.n.linearVelocity[0] + cp->hd.where.m[2][0] * cp->st.n.linearVelocity[2]); path[1].t = dvx = FIXEDH((x - targetPoint.vx) * cp->hd.where.m[2][0] + (targetPoint.vz - z) * cp->hd.where.m[0][0]); path[1].n = steeringFac = FIXEDH((targetPoint.vx - x) * cp->hd.where.m[0][0] + (targetPoint.vz - z) * cp->hd.where.m[2][0]) - slidevel / 140; - if (path[1].n < 1) + if (path[1].n < 1) { if (path[1].n * -2 >= path[1].t || cp->ai.p.frontLClear == 0) { targetZone = zoneLeft; targetFound = -path[1].n < (path[1].t << 2); - if (targetFound && cp->ai.p.close_pursuit != 0) + if (targetFound && cp->ai.p.close_pursuit != 0) targetZone = zoneBack; } else targetZone = zoneFrnt; } - else + else { - if (path[1].n * 2 >= path[1].t || cp->ai.p.frontRClear == 0) + if (path[1].n * 2 >= path[1].t || cp->ai.p.frontRClear == 0) { targetZone = zoneRght; targetFound = path[1].n < (path[1].t << 2); - - if (targetFound && cp->ai.p.close_pursuit != 0) + + if (targetFound && cp->ai.p.close_pursuit != 0) targetZone = zoneBack; } else @@ -632,7 +630,7 @@ void CopControl1(CAR_DATA *cp) steerDif = path[1].n + slidevel / 140; if (targetZone == zoneFrnt) - { + { if (pathStraight == 0) cp->ai.p.desiredSpeed = speed1[gCopDifficultyLevel]; else @@ -648,7 +646,7 @@ void CopControl1(CAR_DATA *cp) if ((gPuppyDogCop || player[0].playerType == 2) && cp->ai.p.close_pursuit) { plcrspd = targetVehicle->hd.speed + 10; - + if (dist > 4000) { speedDif = (cp->ai.p.desiredSpeed - plcrspd) * (dist - 4000); @@ -665,8 +663,8 @@ void CopControl1(CAR_DATA *cp) else if (targetZone == zoneBack) { cp->ai.p.desiredSpeed = -70; - - if ((steerDif ^ currentSpeed) < 0) + + if ((steerDif ^ currentSpeed) < 0) desiredSteerAngle = -284; else desiredSteerAngle = 284; @@ -679,7 +677,7 @@ void CopControl1(CAR_DATA *cp) { cp->ai.p.desiredSpeed = -120; } - else if ((targetZone == zoneLeft && cp->st.n.angularVelocity[1] > -130) || + else if ((targetZone == zoneLeft && cp->st.n.angularVelocity[1] > -130) || (targetZone == zoneRght && cp->st.n.angularVelocity[1] < 130)) { cp->wheelspin = 1; @@ -691,7 +689,7 @@ void CopControl1(CAR_DATA *cp) desiredSteerAngle = 512; } } - else if (cp->ai.p.recoveryTimer < 1) + else if (cp->ai.p.recoveryTimer < 1) { cp->ai.p.desiredSpeed = 0; desiredSteerAngle = 0; @@ -729,7 +727,7 @@ void CopControl1(CAR_DATA *cp) else cp->thrust = (currentSpeed * maxPower) / 50; - if (cp->hd.speed < 48) + if (cp->hd.speed < 48) cp->thrust = (cp->thrust * (cp->hd.speed + 80) >> 7); if (handlingType[cp->hndType].fourWheelDrive == 1) @@ -778,7 +776,7 @@ void ControlCopDetection(void) UpdateCopSightData(); - if (player_position_known < 1) + if (player_position_known < 1) player_position_known = 1; else player_position_known = 2; @@ -794,7 +792,7 @@ void ControlCopDetection(void) dz = ABS(roadblockLoc.vz - vec.vz) >> 8; distanceToPlayer = dx * dx + dz * dz; - + if (distanceToPlayer < 1640 && newPositionVisible(&roadblockLoc, CopWorkMem, ccx, ccz) != 0) { @@ -807,11 +805,11 @@ void ControlCopDetection(void) if (!CopsCanSeePlayer && !((gCurrentMissionNumber == 24 || gCurrentMissionNumber == 30) && CameraCnt-frameStart < 100)) { - cp = &car_data[MAX_CARS-1]; + cp = &car_data[MAX_CARS - 1]; while (car_data <= cp) { - if (cp->controlType == CONTROL_TYPE_PURSUER_AI && cp->ai.p.dying == 0 || + if (cp->controlType == CONTROL_TYPE_PURSUER_AI && cp->ai.p.dying == 0 || (cp->controlFlags & CONTROL_FLAG_COP)) { dx = ABS(cp->hd.where.t[0] - vec.vx) >> 8; @@ -826,7 +824,7 @@ void ControlCopDetection(void) { cp->ai.p.DistanceToPlayer = distanceToPlayer; - if(cp->ai.p.close_pursuit) + if (cp->ai.p.close_pursuit) { CopsCanSeePlayer = 1; break; @@ -836,8 +834,8 @@ void ControlCopDetection(void) if (newPositionVisible(&vec, CopWorkMem, ccx, ccz) ) { spotted = false; - - if (distanceToPlayer < copSightData.surroundViewDistance) + + if (distanceToPlayer < copSightData.surroundViewDistance) { spotted = true; } @@ -849,8 +847,8 @@ void ControlCopDetection(void) dx = vec.vz - cp->hd.where.t[2]; theta = ABS(ratan2(dz, dx) - cp->hd.direction); - - if (theta < copSightData.frontViewAngle || + + if (theta < copSightData.frontViewAngle || (theta + 512 & 0xfff) < copSightData.frontViewAngle + 512) { spotted = true; @@ -858,11 +856,11 @@ void ControlCopDetection(void) } // [A] also check player elevation from cops (block cops vision from bridges, tunnels etc) - if (spotted + if (spotted #if ENABLE_GAME_ENCHANCEMENTS && ABS(cp->hd.where.t[1] - vec.vy) < 1000 #endif - ) + ) { CopsCanSeePlayer = 1; break; @@ -875,16 +873,16 @@ void ControlCopDetection(void) #if ENABLE_GAME_ENCHANCEMENTS // [A] if Tanner is outside car, cops can arrest him if they are too close - if(player[0].playerType == 2 && minDistanceToPlayer < 2048 && !player[0].dying && pedestrianFelony > FELONY_PURSUIT_MIN_VALUE) + if (player[0].playerType == 2 && minDistanceToPlayer < 2048 && !player[0].dying && pedestrianFelony > FELONY_PURSUIT_MIN_VALUE) { player[0].dying = 1; - - SetMissionMessage(G_LTXT(GTXT_YouveBeenCaught),3,2); + + SetMissionMessage(G_LTXT(GTXT_YouveBeenCaught), 3, 2); SetMissionFailed(FAILED_MESSAGESET); } #endif - if (numActiveCops == 0 && OutOfSightCount < 256 && CameraCnt > 8) + if (numActiveCops == 0 && OutOfSightCount < 256 && CameraCnt > 8) { OutOfSightCount = 256; } @@ -892,11 +890,11 @@ void ControlCopDetection(void) // if cops can't see player - get out of pursued state if (!CopsCanSeePlayer) { - if (OutOfSightCount <= 255) + if (OutOfSightCount <= 255) { OutOfSightCount++; } - else if (OutOfSightCount == 256) + else if (OutOfSightCount == 256) { player_position_known = -1; OutOfSightCount = 257; @@ -907,19 +905,19 @@ void ControlCopDetection(void) FunkUpDaBGMTunez(0); } } - else + else { player_position_known = 0; } } - else + else { OutOfSightCount = 0; } if (player_position_known < 1) { - cp = &car_data[MAX_CARS-1]; + cp = &car_data[MAX_CARS - 1]; do { if (cp->controlType == CONTROL_TYPE_PURSUER_AI) @@ -941,7 +939,7 @@ void ControlCopDetection(void) } while (car_data <= cp); } - if (player_position_known == 1 && first_offence == 0) + if (player_position_known == 1 && first_offence == 0) { heading = GetCarDirectionOfTravel(&car_data[player[0].playerCarId]); @@ -956,7 +954,7 @@ void ControlCopDetection(void) { said_picked_up = 0; } - else if (!first_offence && !said_picked_up) + else if (!first_offence && !said_picked_up) { int rnd; rnd = Random2(2); @@ -978,7 +976,7 @@ void PassiveCopTasks(CAR_DATA *cp) if (player[0].playerCarId < 0) playerFelony = &pedestrianFelony; - else + else playerFelony = &car_data[player[0].playerCarId].felonyRating; if (*playerFelony <= FELONY_PURSUIT_MIN_VALUE) @@ -1012,14 +1010,14 @@ void ControlNumberOfCops(void) pTrigger = gCopData.trigger; numWantedCops = 0; - while( true ) + while (true) { if (player[0].playerCarId < 0) playerFelony = &pedestrianFelony; else playerFelony = &car_data[player[0].playerCarId].felonyRating; - if (*playerFelony < *pTrigger) + if (*playerFelony < *pTrigger) break; pTrigger++; @@ -1031,11 +1029,11 @@ void ControlNumberOfCops(void) if (numWantedCops > maxCopCars) numWantedCops = maxCopCars; - + if (numCopCars < numWantedCops && gDontPingInCops == 0) { respawnTime = gCopRespawnTime; - + if (Roadblock.status == 2) respawnTime = Roadblock.copRespawnTime; @@ -1048,13 +1046,13 @@ void ControlNumberOfCops(void) return; } - if (numCopCars <= numWantedCops) + if (numCopCars <= numWantedCops) { gCopData.cutOffDistance = INT_MAX; cop_respawn_timer = 0; return; } - + gCopData.cutOffDistance = INT_MAX; do { @@ -1063,15 +1061,15 @@ void ControlNumberOfCops(void) num_closer = 0; do { - if (lcp->controlType == CONTROL_TYPE_PURSUER_AI) + if (lcp->controlType == CONTROL_TYPE_PURSUER_AI) { tempDist = lcp->ai.p.DistanceToPlayer; - + if (tempDist < gCopData.cutOffDistance) { - if(cutOffDistance < tempDist) + if (cutOffDistance < tempDist) cutOffDistance = tempDist; - + num_closer++; } } @@ -1154,8 +1152,8 @@ void ControlCops(void) // play the phrases about direction if (first_offence == 0 && CopsCanSeePlayer && numActiveCops != 0) { - if (*playerFelony > FELONY_PURSUIT_MIN_VALUE && - TimeSinceLastSpeech > 720 && + if (*playerFelony > FELONY_PURSUIT_MIN_VALUE && + TimeSinceLastSpeech > 720 && targetVehicle->hd.speed > 20) { int rnd; @@ -1240,4 +1238,4 @@ void CopControl(CAR_DATA* cp) numActiveCops--; numCopCars--; } -} \ No newline at end of file +} diff --git a/src_rebuild/Game/C/cop_ai.h b/src_rebuild/Game/C/cop_ai.h index a5905cfdd..20d273653 100644 --- a/src_rebuild/Game/C/cop_ai.h +++ b/src_rebuild/Game/C/cop_ai.h @@ -41,4 +41,4 @@ extern void PassiveCopTasks(CAR_DATA *cp); // 0x0002F6FC extern int ReplayLog_Fnarr_He_Said_Log(int val); -#endif +#endif // COP_AI_H diff --git a/src_rebuild/Game/C/cosmetic.c b/src_rebuild/Game/C/cosmetic.c index 31131eba2..afdb67958 100644 --- a/src_rebuild/Game/C/cosmetic.c +++ b/src_rebuild/Game/C/cosmetic.c @@ -9,6 +9,7 @@ #include "camera.h" #include "director.h" #include "main.h" +#include "draw.h" char* CosmeticFiles[] = { "LEVELS\\CHICAGO.LCF", @@ -58,19 +59,19 @@ void ProcessCosmeticsLump(char *lump_ptr, int lump_size) { model = 10 - (MissionHeader->residentModels[0] + MissionHeader->residentModels[1] + MissionHeader->residentModels[2]); - if (model < 1) + if (model < 1) model = 1; - else if (model > 4) + else if (model > 4) model = 4; } - if (model != -1) + if (model != -1) { offset = *(int*)(lump_ptr + model * sizeof(int)); car_cosmetics[i] = *(CAR_COSMETICS*)((u_char*)lump_ptr + offset); #if USE_PC_FILESYSTEM - if(gContentOverride) + if (gContentOverride) LoadCustomCarCosmetics(&car_cosmetics[i], model); #endif FixCarCos(&car_cosmetics[i], model); @@ -106,10 +107,12 @@ void LoadCosmetics(int level) void AddReverseLight(CAR_DATA *cp) { CAR_COSMETICS *car_cos; + CVECTOR *life2; SVECTOR v1; CVECTOR col; car_cos = cp->ap.carCos; + life2 = &cp->ap.life2; col.r = 100; col.g = 90; @@ -123,12 +126,29 @@ void AddReverseLight(CAR_DATA *cp) if (cp->ap.damage[4] < 500) { +#ifdef DYNAMIC_LIGHTING + if (gEnableDlights) { + life2->r += col.r >> 3; + life2->g += col.g >> 3; + life2->b += col.b >> 3; + } +#endif // DYNAMIC_LIGHTING + ShowCarlight(&v1, cp, &col, REVERSELIGHT_SIZE, REVERSELIGHT_SIZE * 3, &light_texture, 0); } - if (cp->ap.damage[3] < 500) + if (cp->ap.damage[3] < 500) { v1.vx = car_cos->cog.vx * 2 - v1.vx; + +#ifdef DYNAMIC_LIGHTING + if (gEnableDlights) { + life2->r += col.r >> 3; + life2->g += col.g >> 3; + life2->b += col.b >> 3; + } +#endif // DYNAMIC_LIGHTING + ShowCarlight(&v1, cp, &col, REVERSELIGHT_SIZE, REVERSELIGHT_SIZE * 3, &light_texture, 0); } } @@ -155,18 +175,20 @@ void SetupSpecCosmetics(char *loadbuffer) FixCarCos(&car_cosmetics[4], model); } +int gAmberTurnSignals = 0; + // [D] [T] void AddIndicatorLight(CAR_DATA *cp, int Type) { u_int brightness; char *life; CAR_COSMETICS *car_cos; - char *life2; + CVECTOR *life2; CVECTOR col; SVECTOR vfrnt; SVECTOR vback; - //if (cp->controlType != CONTROL_TYPE_CIV_AI) // [A] weird way to disable it here + //if (cp->controlType != CONTROL_TYPE_CIV_AI) // [A] weird way to disable it here // return; life = &cp->ap.life; @@ -178,10 +200,12 @@ void AddIndicatorLight(CAR_DATA *cp, int Type) brightness = cp->ap.life << 1; col.r = brightness & 0xFF; - col.g = 0; col.b = 0; + if (gAmberTurnSignals) // [A] + col.g = col.r >> 1; + if (pauseflag == 0) *life += 8; @@ -203,11 +227,18 @@ void AddIndicatorLight(CAR_DATA *cp, int Type) { if (cp->ap.damage[4] < 500) { - *life2 += brightness >> 3; + life2->r += col.r >> 3; +#ifdef DYNAMIC_LIGHTING + if (gEnableDlights) { + life2->g += col.g >> 3; + life2->b += col.b >> 3; + } +#endif // DYNAMIC_LIGHTING + ShowCarlight(&vback, cp, &col, INDICATORLIGHT_SIZE, INDICATORLIGHT_SIZE * 4, &light_texture, 0); } - if (cp->ap.damage[0] < 500) + if (cp->ap.damage[0] < 500) { ShowCarlight(&vfrnt, cp, &col, INDICATORLIGHT_SIZE, INDICATORLIGHT_SIZE * 4, &light_texture, 1); } @@ -215,15 +246,22 @@ void AddIndicatorLight(CAR_DATA *cp, int Type) if (Type - 1U < 2) { - if (cp->ap.damage[3] < 500) + if (cp->ap.damage[3] < 500) { vback.vx = car_cos->cog.vx * 2 - vback.vx; - *life2 += brightness >> 3; + + life2->r += col.r >> 3; +#ifdef DYNAMIC_LIGHTING + if (gEnableDlights) { + life2->g += col.g >> 3; + life2->b += col.b >> 3; + } +#endif // DYNAMIC_LIGHTING ShowCarlight(&vback, cp, &col, INDICATORLIGHT_SIZE, INDICATORLIGHT_SIZE * 4, &light_texture, 0); } - if (cp->ap.damage[1] < 500) + if (cp->ap.damage[1] < 500) { vfrnt.vx = car_cos->cog.vx * 2 - vfrnt.vx; ShowCarlight(&vfrnt, cp, &col, INDICATORLIGHT_SIZE, INDICATORLIGHT_SIZE * 4, &light_texture, 1); @@ -238,8 +276,8 @@ void AddBrakeLight(CAR_DATA *cp) int damIndex; short cogOffset; CAR_COSMETICS *car_cos; + CVECTOR *life2; int offset; - char *life2; int loop; SVECTOR v1; SVECTOR v2; @@ -249,12 +287,12 @@ void AddBrakeLight(CAR_DATA *cp) short verticalFlag; car_cos = cp->ap.carCos; + life2 = &cp->ap.life2; + col.r = 200; col.g = 0; col.b = 0; - life2 = &cp->ap.life2; - if (!(car_cos->extraInfo & 8)) return; @@ -295,7 +333,18 @@ void AddBrakeLight(CAR_DATA *cp) { ShowCarlight(&v1, cp, &col, BRAKELIGHT_SIZE, BRAKELIGHT_SIZE * 4, &light_texture, 0); ShowCarlight(&v2, cp, &col, BRAKELIGHT_SIZE, BRAKELIGHT_SIZE * 4, &light_texture, 0); - *life2 += 8; + +#ifdef DYNAMIC_LIGHTING + if (gEnableDlights) { + life2->r += col.r >> 4; + life2->g += col.g >> 4; + life2->b += col.b >> 4; + } + else + life2->r += 8; +#else + life2->r += 8; +#endif // DYNAMIC_LIGHTING } } else @@ -314,7 +363,18 @@ void AddBrakeLight(CAR_DATA *cp) { ShowCarlight(&v1, cp, &col, BRAKELIGHT_SIZE, BRAKELIGHT_SIZE * 4, &light_texture, 0); ShowCarlight(&v2, cp, &col, BRAKELIGHT_SIZE, BRAKELIGHT_SIZE * 4, &light_texture, 0); - *life2 += 8; + +#ifdef DYNAMIC_LIGHTING + if (gEnableDlights) { + life2->r += col.r >> 4; + life2->g += col.g >> 4; + life2->b += col.b >> 4; + } + else + life2->r += 8; +#else + life2->r += 8; +#endif // DYNAMIC_LIGHTING } } } @@ -325,12 +385,23 @@ void AddBrakeLight(CAR_DATA *cp) if (cp->ap.damage[damIndex] < 500) { ShowCarlight(&v1, cp, &col, BRAKELIGHT_SIZE, BRAKELIGHT_SIZE * 4, &light_texture, 0); - *life2 += 8; + +#ifdef DYNAMIC_LIGHTING + if (gEnableDlights) { + life2->r += col.r >> 4; + life2->g += col.g >> 4; + life2->b += col.b >> 4; + } + else + life2->r += 8; +#else + life2->r += 8; +#endif // DYNAMIC_LIGHTING } } offset = -offset; - + vec.vx = car_cos->cog.vx * 2 - vec.vx; loop++; @@ -362,7 +433,7 @@ void AddCopCarLight(CAR_DATA *cp) if (CameraCar == CAR_INDEX(cp) && cameraview == 2) return; - if (FastForward != 0) + if (FastForward != 0) return; // don't display on flipped cars @@ -372,21 +443,21 @@ void AddCopCarLight(CAR_DATA *cp) car_cos = cp->ap.carCos; // configure - if (GameLevel == 1 || GameLevel == 3) + if (GameLevel == LEVEL_HAVANA || GameLevel == LEVEL_RIO) { side = 1; num_lights = 2; pos = 3; count_speed = 48; } - else if (GameLevel == 0) + else if (GameLevel == LEVEL_CHICAGO) { side = 2; num_lights = 2; pos = 3; count_speed = 16; } - else + else { side = 2; num_lights = 3; @@ -404,11 +475,11 @@ void AddCopCarLight(CAR_DATA *cp) light = num_lights; - while (light-- >= 0) + while (light-- >= 0) { v1.vx = car_cos->cog.vx; - if (GameLevel != 1 && GameLevel != 3) + if (GameLevel != LEVEL_HAVANA && GameLevel != LEVEL_RIO) v1.vx += (xpos1[pos] + car_cos->policeLight.vx) * sign; col.g = 90; @@ -417,7 +488,7 @@ void AddCopCarLight(CAR_DATA *cp) if (gNight != 0) col.g = 50; - if (pauseflag == 0 && (CameraCnt & 1U) != 0 && GameLevel == 2) + if (pauseflag == 0 && (CameraCnt & 1U) != 0 && GameLevel == LEVEL_VEGAS) pos++; v1.vz = car_cos->policeLight.vz + car_cos->cog.vz; @@ -425,23 +496,23 @@ void AddCopCarLight(CAR_DATA *cp) size = *coplife >> 1; // switch colours if needed - if (GameLevel == 1 || GameLevel == 3 || GameLevel == 2 && side == 0) + if (GameLevel == LEVEL_HAVANA || GameLevel == LEVEL_RIO || GameLevel == LEVEL_VEGAS && side == 0) { col.b = 255; col.r = col.g; } - else + else { col.r = 255; col.b = col.g; } - if (pauseflag == 0) + if (pauseflag == 0) cp->ap.coplife += count_speed; - ShowCarlight(&v1, cp, &col, size, size*3, &light_texture, 0xff); + ShowCarlight(&v1, cp, &col, size, size * 3, &light_texture, 0xff); - if (pauseflag == 0 && (CameraCnt & 1U) != 0 && GameLevel == 2) + if (pauseflag == 0 && (CameraCnt & 1U) != 0 && GameLevel == LEVEL_VEGAS) pos++; pos = pos & 7; @@ -463,13 +534,13 @@ void AddNightLights(CAR_DATA *cp) char lights; int damIndex; CAR_COSMETICS *car_cos; + CVECTOR *life2; SVECTOR Position1; SVECTOR Position2; SVECTOR vec; CVECTOR col; CVECTOR col2; int lit; - char *life2; short loop; short doubleFlag; short verticalFlag; @@ -529,7 +600,7 @@ void AddNightLights(CAR_DATA *cp) Position1.vz = vec.vz + (cp->ap.damage[loop] >> 6); Position2.vz = vec.vz + (cp->ap.damage[loop] >> 6); - ShowCarlight(&Position1, cp, &col, HEADLIGHT_SIZE, HEADLIGHT_SIZE*4, &light_texture, lightFlag & 0xff | 1); + ShowCarlight(&Position1, cp, &col, HEADLIGHT_SIZE, HEADLIGHT_SIZE * 4, &light_texture, lightFlag & 0xff | 1); lights = 1; lit++; @@ -631,7 +702,17 @@ void AddNightLights(CAR_DATA *cp) ShowCarlight(&Position1, cp, &col, BACKLIGHT_SIZE, BACKLIGHT_SIZE * 3, &light_texture, lightFlag & 0xff); } - *life2 += 16; +#ifdef DYNAMIC_LIGHTING + if (gEnableDlights) { + life2->r += col.r >> 3; + life2->g += col.g >> 3; + life2->b += col.b >> 3; + } + else + life2->r += 16; +#else + life2->r += 16; +#endif // DYNAMIC_LIGHTING } vec.vx = cogOffset * 2 - vec.vx; @@ -652,14 +733,18 @@ void AddNightLights(CAR_DATA *cp) } // back lights pool - col.r = *life2; - if (col.r) - { - col.b = 0; - col.g = 0; + // [A] no longer hard coded to red + col.r = life2->r; + col.g = life2->g; + col.b = life2->b; + if (col.r || col.g || col.b) + { PlacePoolForCar(cp, &col, 0, 0); - *life2 = 0; + + life2->r = 0; + life2->g = 0; + life2->b = 0; } } @@ -671,7 +756,7 @@ void AddSmokingEngine(CAR_DATA *cp, int black_smoke, int WheelSpeed) VECTOR Drift; SVECTOR svec; - if((CameraCnt & 3U) == (CAR_INDEX(cp) & 3U) && pauseflag == 0) + if ((CameraCnt & 3U) == (CAR_INDEX(cp) & 3U) && pauseflag == 0) { car_cos = cp->ap.carCos; @@ -682,10 +767,10 @@ void AddSmokingEngine(CAR_DATA *cp, int black_smoke, int WheelSpeed) SmokePos.vx = cp->hd.where.t[0]; SmokePos.vy = -cp->hd.where.t[1]; SmokePos.vz = cp->hd.where.t[2]; - + if (black_smoke != 0) SmokePos.vy -= 50; - + gte_SetRotMatrix(cp->hd.drawCarMat.m); InitFXPos(&SmokePos, &svec, cp); @@ -772,6 +857,7 @@ void AddFlamingEngine(CAR_DATA *cp) SetRotMatrix(&(cp->hd).drawCarMat); InitFXPos(&SmokePos, &svec, cp); + Drift.vx = 0; Drift.vy = 0; Drift.vz = 0; @@ -779,8 +865,3 @@ void AddFlamingEngine(CAR_DATA *cp) Setup_Smoke(&SmokePos, 50, 100, SMOKE_FIRE, 0, &Drift, 0); } } - - - - - diff --git a/src_rebuild/Game/C/cosmetic.h b/src_rebuild/Game/C/cosmetic.h index 2e12158ab..75400b3b1 100644 --- a/src_rebuild/Game/C/cosmetic.h +++ b/src_rebuild/Game/C/cosmetic.h @@ -4,6 +4,8 @@ extern CAR_COSMETICS car_cosmetics[MAX_CAR_MODELS]; extern CAR_COSMETICS dummyCosmetics; +extern int gAmberTurnSignals; + extern int gcar_num; extern void LoadCosmetics(int level); // 0x00031160 @@ -19,5 +21,4 @@ extern void AddSmokingEngine(CAR_DATA *cp, int black_smoke, int WheelSpeed); // extern void AddExhaustSmoke(CAR_DATA *cp, int black_smoke, int WheelSpeed); extern void AddFlamingEngine(CAR_DATA *cp); // 0x00030FAC - -#endif +#endif // COSMETIC_H diff --git a/src_rebuild/Game/C/cutrecorder.c b/src_rebuild/Game/C/cutrecorder.c index 44c1acc84..b713d89ba 100644 --- a/src_rebuild/Game/C/cutrecorder.c +++ b/src_rebuild/Game/C/cutrecorder.c @@ -64,7 +64,7 @@ void CutRec_Reset() gAutoTestStats[gCutsceneChaseAutoTest].stuck = 0; gAutoTestStats[gCutsceneChaseAutoTest].saved = 0; gChaseStuckTimer = 0; - + return; } @@ -99,9 +99,9 @@ int CutRec_GotoChase(int number) if (number > 15) return 0; - + gCutsceneChaseAutoTest = number; - + // load next replay and restart if (LoadCutsceneAsReplay(gCutsceneChaseAutoTest)) { @@ -112,7 +112,7 @@ int CutRec_GotoChase(int number) CurrentGameMode = GAMEMODE_REPLAY; SetState(STATE_GAMELAUNCH); - + return 1; } return 0; @@ -180,12 +180,12 @@ void CutRec_Draw() SetTextColour(128, 128, 128); - if(gCutsceneChaseAutoTest) + if (gCutsceneChaseAutoTest) { sprintf(text, "Auto-test - chase %d %s", gCutsceneChaseAutoTest, gAutoTestStats[gCutsceneChaseAutoTest].saved ? "-SAVED-" : ""); PrintString(text, 5, 10); - - if(gCutsceneAsReplay_ReChaseLoaded) + + if (gCutsceneAsReplay_ReChaseLoaded) { SetTextColour(32, 128, 32); PrintString("Re-recorded", 5, 20); @@ -197,12 +197,12 @@ void CutRec_Draw() } SetTextColour(128, 128, 128); - + sprintf(text, "Frame %d of %d", CameraCnt, ReplayParameterPtr->RecordingEnd); PrintString(text, 5, 215); } - if(PingBufferPos >= MAX_REPLAY_PINGS-1) + if (PingBufferPos >= MAX_REPLAY_PINGS-1) SetTextColour(128, 0, 0); sprintf(text, "Pings: %d", PingBufferPos); @@ -211,15 +211,15 @@ void CutRec_Draw() SetTextColour(128, 128, 128); if (gAutoTestStats[gCutsceneChaseAutoTest].numHitCars > 0) - SetTextColour(128, 0, 0); + SetTextColour(128, 0, 0); sprintf(text, "Hit cars: %d", gAutoTestStats[gCutsceneChaseAutoTest].numHitCars); PrintString(text, 120, 205); - if(gAutoTestStats[gCutsceneChaseAutoTest].stuck) + if (gAutoTestStats[gCutsceneChaseAutoTest].stuck) { SetTextColour(128, 0, 0); - + sprintf(text, "Car is stuck!"); PrintString(text, 5, 60); } @@ -277,11 +277,11 @@ int LoadCutsceneAsReplay(int subindex) // Try loading existing ReChase sprintf(filename, "REPLAYS\\ReChases\\CUT%d_N.R", gCutsceneAsReplay); - if(!FileExists(filename)) + if (!FileExists(filename)) { gCutsceneAsReplay_ReChaseLoaded = 0; printWarning("--- NO re-recorded chases available! ---\n"); - + if (gCutsceneAsReplay < 21) sprintf(filename, "REPLAYS\\CUT%d.R", gCutsceneAsReplay); else @@ -351,11 +351,11 @@ void InitCutsceneRecorder(char* configFilename) if (loadExistingCutscene) { - if(gCutsceneChaseAutoTest != 0) + if (gCutsceneChaseAutoTest != 0) { subindex = gCutsceneChaseAutoTest; } - + if (!LoadCutsceneAsReplay(subindex)) { ini_free(config); @@ -434,8 +434,6 @@ int CutRec_StorePingInfo(int cookieCount, int carId) packet->carId = -1; packet->cookieCount = -1; - - return 1; } @@ -499,7 +497,7 @@ int CutRec_InitMission(char* filename) if (gCutsceneAsReplay == 0) return 0; - + LoadfileSeg(filename, (char*)&header, gCutsceneAsReplay * 4, 4); if (header == 0) @@ -515,7 +513,7 @@ int CutRec_InitMission(char* filename) MissionHeader->weather = missionTempHeader.weather; MissionHeader->cops = missionTempHeader.cops; - if(gCutsceneChaseAutoTest == 0) + if (gCutsceneChaseAutoTest == 0) ClearMem((char*)gAutoTestStats, sizeof(gAutoTestStats)); return 1; @@ -637,7 +635,7 @@ int CutRec_LoadCutsceneAsReplayFromBuffer(char* buffer) memcpy((u_char*)PingBuffer, (u_char*)pt, sizeof(PING_PACKET) * MAX_REPLAY_PINGS); memcpy((u_char*)NewPingBuffer, (u_char*)pt, sizeof(PING_PACKET) * MAX_REPLAY_PINGS); pt += sizeof(PING_PACKET) * MAX_REPLAY_PINGS; - + replayptr = (char*)(PingBuffer + MAX_REPLAY_PINGS); if (header->HaveStoredData == 0x91827364) // -0x6e7d8c9c @@ -679,7 +677,7 @@ int CutRec_SaveReplayToBuffer(char* buffer) header->wantedCar[1] = wantedCar[1]; memcpy((u_char*)&header->SavedData, (u_char*)&MissionEndData, sizeof(MISSION_DATA)); - + // write each stream data for (int i = 0; i < NumReplayStreams; i++) { @@ -762,13 +760,13 @@ int CutRec_SaveChase() return 0; - if(CutRec_SaveReplayToFile(filename)) + if (CutRec_SaveReplayToFile(filename)) { printInfo("Chase replay '%s' saved\n", filename); if (gCutsceneChaseAutoTest != 0) gAutoTestStats[gCutsceneChaseAutoTest].saved = 1; - + return 1; } @@ -837,4 +835,4 @@ int CutRec_IsPlaying() return CurrentGameMode == GAMEMODE_REPLAY; } -#endif // CUTSCENE_RECORDER \ No newline at end of file +#endif // CUTSCENE_RECORDER diff --git a/src_rebuild/Game/C/cutrecorder.h b/src_rebuild/Game/C/cutrecorder.h index 4863b529e..a5e78b6d7 100644 --- a/src_rebuild/Game/C/cutrecorder.h +++ b/src_rebuild/Game/C/cutrecorder.h @@ -69,5 +69,4 @@ extern int CutRec_SaveChase(); #endif - -#endif // CUTRECORDER_H \ No newline at end of file +#endif // CUTRECORDER_H diff --git a/src_rebuild/Game/C/cutscene.c b/src_rebuild/Game/C/cutscene.c index 5828e9dba..06bb3d321 100644 --- a/src_rebuild/Game/C/cutscene.c +++ b/src_rebuild/Game/C/cutscene.c @@ -34,7 +34,7 @@ struct CUTSCENE_BUFFER int bytesFree; int reservedSize; - // char buffer[32*1024]; // was 8192, but we have some free mem now even for PSX. Using malloc. + //char buffer[32 * 1024]; // was 8192, but we have some free mem now even for PSX. Using malloc. }; int gSkipInGameCutscene = 0; @@ -85,7 +85,6 @@ int LoadCutsceneInformation(int cutscene); void FreeCutsceneBuffer(); int IsCutsceneResident(int cutscene); - // [D] [T] void InitInGameCutsceneVariables(void) { @@ -116,7 +115,7 @@ void InitInGameCutsceneVariables(void) // [D] [T] void HandleInGameCutscene(void) { - if (gInGameCutsceneDelay != 0) + if (gInGameCutsceneDelay != 0) { BlackBorderHeight = gInGameCutsceneDelay; gInGameCutsceneDelay++; @@ -138,14 +137,14 @@ void HandleInGameCutscene(void) if (CameraCnt < 2) BlackBorderHeight = 28; - if (CutsceneLength-28 < CutsceneFrameCnt) + if (CutsceneLength-28 < CutsceneFrameCnt) { gSkipInGameCutscene = 0; - + if (BlackBorderHeight > 0) BlackBorderHeight--; } - else + else { if (BlackBorderHeight < 28) BlackBorderHeight++; @@ -159,7 +158,7 @@ void HandleInGameCutscene(void) UnprepareXA(); } - if (CutsceneFrameCnt == CutsceneLength) + if (CutsceneFrameCnt == CutsceneLength) { gSkipInGameCutscene = 0; gHaveInGameCutscene = 0; @@ -180,7 +179,7 @@ void DrawInGameCutscene(void) #ifndef PSX PrintXASubtitles(SCREEN_H - 28); #endif - + if (gInGameCutsceneActive == 0 && gInGameCutsceneDelay == 0) { return; @@ -298,7 +297,7 @@ void TriggerInGameCutscene(int cutscene) gInGameCutsceneActive = TriggerInGameCutsceneSystem(cutscene); - if (gInGameCutsceneActive) + if (gInGameCutsceneActive) { TerminateSkidding(0); TerminateSkidding(1); @@ -306,13 +305,13 @@ void TriggerInGameCutscene(int cutscene) gStopPadReads = 1; scr_z = 256; - if (gCSDestroyPlayer) + if (gCSDestroyPlayer) { DestroyPlayer(0, 1); } } } - else + else { gCutsceneAtEnd = 1; gInGameCutsceneDelay = gInGameCutsceneDelay + 1; @@ -358,9 +357,9 @@ int CalcInGameCutsceneSize(void) { ClearMem((char*)&CutsceneHeader, sizeof(CUTSCENE_HEADER)); ClearMem((char*)&ChaseHeader, sizeof(CUTSCENE_HEADER)); - + // init user/re-chases and load cutscene file header - if(SelectCutsceneFile(filename, 1, 0)) + if (SelectCutsceneFile(filename, 1, 0)) LoadfileSeg(filename, (char*)&CutsceneHeader, 0, sizeof(CUTSCENE_HEADER)); // load re-chase file header @@ -390,7 +389,7 @@ void ReleaseInGameCutscene(void) { int i; - if (gInGameChaseActive && Mission.ChaseTarget) + if (gInGameChaseActive && Mission.ChaseTarget) { player[1].padid = -128; } @@ -426,7 +425,7 @@ void ReleaseInGameCutscene(void) DestroyPlayer(i, 0); } - else + else { DestroyPlayer(i, 1); } @@ -445,7 +444,7 @@ void ReleaseInGameCutscene(void) player[0].spoolXZ = SavedSpoolXZ; player[0].cameraCarId = SavedCameraCarId; - if (i != -1) + if (i != -1) { car_data[i].ai.padid = &player[0].padid; car_data[i].controlType = CONTROL_TYPE_PLAYER; @@ -462,7 +461,7 @@ void ReleaseInGameCutscene(void) CutsceneEventTrigger = 0; } - if (CutsceneReplayStart != NULL) + if (CutsceneReplayStart != NULL) replayptr = CutsceneReplayStart; NumReplayStreams -= NumCutsceneStreams; @@ -470,7 +469,7 @@ void ReleaseInGameCutscene(void) CutsceneReplayStart = NULL; CutsceneStreamIndex = 0; - + PreLoadedCutscene = -1; gHaveInGameCutscene = 0; gCSDestroyPlayer = 0; @@ -502,15 +501,15 @@ int CutsceneCameraChange(int cameracnt) { cameracnt -= CutsceneCameraOffset; - if (CutNextChange->FrameCnt != cameracnt) + if (CutNextChange->FrameCnt != cameracnt) { - if (CutNextChange->FrameCnt > cameracnt) + if (CutNextChange->FrameCnt > cameracnt) { IsMovingCamera(CutLastChange, CutNextChange, cameracnt); return 0; } - if (CutNextChange->next == 254) + if (CutNextChange->next == 254) return 0; } @@ -519,7 +518,7 @@ int CutsceneCameraChange(int cameracnt) SetPlaybackCamera(CutNextChange); - if (cameracnt > -1) + if (cameracnt > -1) { InvalidCamera(player[0].cameraCarId); @@ -565,11 +564,11 @@ int TriggerInGameCutsceneSystem(int cutscene) bDamageOverride = 0; - if(cutscene > -1) + if (cutscene > -1) { gHaveInGameCutscene = LoadCutsceneInformation(cutscene); - if (gHaveInGameCutscene != 0) + if (gHaveInGameCutscene != 0) { PingOutAllCivCarsAndCopCars(); InitCivCars(); @@ -583,7 +582,7 @@ int TriggerInGameCutsceneSystem(int cutscene) SavedSpoolXZ = player[0].spoolXZ; } - if (CutsceneEventTrigger != 0) + if (CutsceneEventTrigger != 0) { TriggerEvent(CutsceneEventTrigger); } @@ -627,14 +626,14 @@ int TriggerInGameCutsceneSystem(int cutscene) cp = &car_data[player_id]; InitPlayer(&player[player_id], cp, - stream->SourceType.controlType, + stream->SourceType.controlType, stream->SourceType.rotation, (LONGVECTOR4* )&stream->SourceType.position, stream->SourceType.model, stream->SourceType.palette, &padid[player_id]); - if (bDamageOverride) + if (bDamageOverride) { slot = player[0].playerCarId; @@ -652,14 +651,14 @@ int TriggerInGameCutsceneSystem(int cutscene) DentCar(cp); } } - else + else { - slot = CreateStationaryCivCar(stream->SourceType.rotation, 0, 1024, + slot = CreateStationaryCivCar(stream->SourceType.rotation, 0, 1024, (LONGVECTOR4* )&stream->SourceType.position, - stream->SourceType.model, + stream->SourceType.model, stream->SourceType.palette, 0); - if (slot != -1) + if (slot != -1) { player[player_id].playerCarId = slot; SetNullPlayer(player_id); @@ -668,12 +667,12 @@ int TriggerInGameCutsceneSystem(int cutscene) if (player_id == CutsceneStreamIndex) { - if (gStartOnFoot == 0) + if (gStartOnFoot == 0) { player[0].spoolXZ = (VECTOR *)car_data[player_id].hd.where.t; player[0].worldCentreCarId = CutsceneStreamIndex; } - else + else { player[0].worldCentreCarId = -1; player[0].spoolXZ = (VECTOR *)&player[player_id].pPed->position; @@ -697,8 +696,6 @@ int TriggerInGameCutsceneSystem(int cutscene) } } - - ShowCutsceneError(); return 0; } @@ -708,7 +705,7 @@ void SetNullPlayer(int plr) { int carId = player[plr].playerCarId; - if (carId != -1) + if (carId != -1) { car_data[carId].controlType = CONTROL_TYPE_CIV_AI; car_data[carId].ai.c.thrustState = 3; @@ -748,12 +745,12 @@ void DestroyPlayer(int plr, int fully) return; } - if (fully) + if (fully) { - if (player[plr].playerType == 1 && player[plr].playerCarId != gThePlayerCar) + if (player[plr].playerType == 1 && player[plr].playerCarId != gThePlayerCar) PingOutCar(&car_data[player[plr].playerCarId]); - if (player[plr].pPed != NULL) + if (player[plr].pPed != NULL) DestroyPedestrian(player[plr].pPed); } @@ -774,7 +771,7 @@ void FindNextCutChange(int cameracnt) count = 0; do { - if (cameracnt <= CutsceneCamera[count].FrameCnt && + if (cameracnt <= CutsceneCamera[count].FrameCnt && CutsceneCamera[count].FrameCnt < nextframe) { found = true; @@ -798,8 +795,8 @@ int LoadCutsceneToReplayBuffer(int residentCutscene) rheader = (REPLAY_SAVE_HEADER *)CutsceneBuffer.residentPointers[residentCutscene]; - if (rheader == NULL || - rheader && (rheader->magic != DRIVER2_REPLAY_MAGIC && + if (rheader == NULL || + rheader && (rheader->magic != DRIVER2_REPLAY_MAGIC && rheader->magic != REDRIVER2_CHASE_MAGIC || // [A] rheader->NumReplayStreams == 0) ) { @@ -809,12 +806,12 @@ int LoadCutsceneToReplayBuffer(int residentCutscene) CutsceneStreamIndex = NumReplayStreams; //rheader->NumReplayStreams; NumCutsceneStreams = rheader->NumReplayStreams; - + CutsceneReplayStart = replayptr; CutsceneEventTrigger = rheader->CutsceneEvent; pt = (char *)(rheader + 1); - + // add to existing replay streams for (int i = NumReplayStreams; i < (NumReplayStreams + rheader->NumReplayStreams); i++) { @@ -875,9 +872,9 @@ int LoadCutsceneToBuffer(int subindex) CUTSCENE_HEADER header; char filename[64]; - + SelectCutsceneFile(filename, 0, subindex); - + printInfo("Loading cutscene '%s' (%d)\n", filename, subindex); if (FileExists(filename)) @@ -892,7 +889,7 @@ int LoadCutsceneToBuffer(int subindex) // [A] if starting game - allocate new buffer if (CutsceneBuffer.currentPointer == NULL) { - if(CutsceneInReplayBuffer) + if (CutsceneInReplayBuffer) { CutsceneBuffer.currentPointer = CutsceneBuffer.buffer; CutsceneBuffer.bytesFree = CutsceneBuffer.reservedSize; @@ -920,7 +917,7 @@ int LoadCutsceneToBuffer(int subindex) pathAILoaded = 0; CutsceneBuffer.currentPointer = (char*)_other_buffer2; - CutsceneBuffer.bytesFree = 0xC000; + CutsceneBuffer.bytesFree = 0xC000; }*/ LoadfileSeg(filename, CutsceneBuffer.currentPointer, offset, size); @@ -928,7 +925,7 @@ int LoadCutsceneToBuffer(int subindex) CutsceneBuffer.residentCutscenes[CutsceneBuffer.numResident] = subindex; CutsceneBuffer.residentPointers[CutsceneBuffer.numResident] = CutsceneBuffer.currentPointer; CutsceneBuffer.numResident++; - + CutsceneBuffer.currentPointer += size; CutsceneBuffer.bytesFree -= size; @@ -955,7 +952,7 @@ void ShowCutsceneError(void) rect.w = 320; rect.h = 256; - ClearImage2(&rect, 0,0,0); + ClearImage2(&rect, 0, 0, 0); DrawSync(0); SetTextColour(128, 0, 0); @@ -972,7 +969,7 @@ int LoadCutsceneInformation(int cutscene) { int i; - if (cutscene == PreLoadedCutscene) + if (cutscene == PreLoadedCutscene) { PreLoadedCutscene = -1; return 1; @@ -980,7 +977,7 @@ int LoadCutsceneInformation(int cutscene) ReleaseInGameCutscene(); - for(i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { if (cutscene == CutsceneBuffer.residentCutscenes[i]) { @@ -1028,8 +1025,3 @@ int IsCutsceneResident(int cutscene) return 0; } - - - - - diff --git a/src_rebuild/Game/C/cutscene.h b/src_rebuild/Game/C/cutscene.h index 20fa8b74a..5c6c0a6ca 100644 --- a/src_rebuild/Game/C/cutscene.h +++ b/src_rebuild/Game/C/cutscene.h @@ -42,5 +42,4 @@ extern void ReleaseInGameCutscene(); // 0x000316EC extern int CutsceneCameraChange(int cameracnt); // 0x000328E8 - -#endif +#endif // CUTSCENE_H diff --git a/src_rebuild/Game/C/debris.c b/src_rebuild/Game/C/debris.c index 2c3833f1b..8f2d2b21a 100644 --- a/src_rebuild/Game/C/debris.c +++ b/src_rebuild/Game/C/debris.c @@ -118,11 +118,11 @@ struct LAMP_STREAK TEXTURE_DETAILS digit_texture; -TRI_POINT debris_rot1[32]; // offset 0xC0A60 -TRI_POINT debris_rot2[32]; // offset 0xC0BE0 -TRI_POINT debris_rot3[32]; // offset 0xC0D60 -TRI_POINT leaf_rot[32]; // offset 0xC1DC0 -TRI_POINT litter_rot[32]; // offset 0xC08D0 +TRI_POINT debris_rot1[32]; +TRI_POINT debris_rot2[32]; +TRI_POINT debris_rot3[32]; +TRI_POINT leaf_rot[32]; +TRI_POINT litter_rot[32]; TRI_POINT* debris_rot_table[5] = { debris_rot1, @@ -266,46 +266,46 @@ CVECTOR debris_colour[4][31] = }; u_char grassColour[4][3] = { - {110, 115, 67}, - {64, 55, 49}, - {91, 104, 56}, - {118, 108, 89} + { 110, 115, 67 }, + { 64, 55, 49 }, + { 91, 104, 56 }, + { 118, 108, 89 } }; TRI_POINT_LONG debris1_vert = { - {-16,0,0}, - {0,-16,0}, - {16,16,0} + { -16, 0, 0 }, + { 0, -16, 0 }, + { 16, 16, 0 } }; TRI_POINT_LONG debris2_vert = { - {-4,4,0}, - {0,-4,0}, - {4,4,0} + { -4, 4, 0 }, + { 0, -4, 0 }, + { 4, 4, 0 } }; TRI_POINT_LONG debris3_vert = { - {-80,0,15}, - {0, 0,15}, - {80,0,-15} + { -80, 0, 15 }, + { 0, 0, 15 }, + { 80, 0, -15 } }; TRI_POINT_LONG leaf_vert = { - {-30,5,7}, - {0,0,10}, - {0,0,-7} + { -30, 5, 7 }, + { 0, 0, 10 }, + { 0, 0, -7 } }; TRI_POINT_LONG litter_vert = { - {-25,0,25}, - {25,0,25}, - {-25,0,-25} + { -25, 0, 25 }, + { 25, 0, 25 }, + { -25, 0, -25 } }; TRI_POINT_LONG* debris_data[5] = { @@ -341,7 +341,6 @@ short gRainAlloc[MAX_RAIN_DROPS]; RAIN_TYPE gRain[MAX_RAIN_DROPS]; char PoolPrimData[16] = { - 0x0, 0x8, 0x2, 0x9, 0x8, 0x1, 0x9, 0x3, 0x4, 0xA, 0x6, 0xB, @@ -401,7 +400,7 @@ DAMAGED_LAMP damaged_lamp[MAX_DAMAGED_LAMPS]; MATRIX debris_mat; MATRIX leaf_mat; -#define LAMP_STREAK_ID(x,y) (((x) & 0xffff) | (((y) & 0xffff) << 16)) +#define LAMP_STREAK_ID(x, y) (((x) & 0xffff) | (((y) & 0xffff) << 16)) // [D] [T] void PlacePoolForCar(CAR_DATA *cp, CVECTOR *col, int front, int in_car) @@ -427,14 +426,14 @@ void PlacePoolForCar(CAR_DATA *cp, CVECTOR *col, int front, int in_car) // [A] there was check that prevented in_car lights in game, but it was working in quick replays... - if (front) + if (front) { s1[3].vz = -(car_cos->colBox.vz + 50); s1[8].vz = s1[3].vz - 1160; s1[6].vz = s1[3].vz; s1[7].vz = s1[3].vz; - if (in_car) + if (in_car) { // slightly shifted vertices to make it look more beautiful s1[1].vz = s1[8].vz + 600; @@ -458,10 +457,10 @@ void PlacePoolForCar(CAR_DATA *cp, CVECTOR *col, int front, int in_car) s1[11].vz = s1[9].vz; LightSortCorrect = -800; - + sub_level = 3; } - else + else { s1[1].vz = s1[8].vz + 100; s1[0].vx = 136; @@ -493,7 +492,7 @@ void PlacePoolForCar(CAR_DATA *cp, CVECTOR *col, int front, int in_car) else { // back light - + s1[0].vx = -204; s1[1].vx = 204; s1[2].vx = -204; @@ -520,14 +519,14 @@ void PlacePoolForCar(CAR_DATA *cp, CVECTOR *col, int front, int in_car) mid_position.vz += pos->vz; car_road_height = MapHeight(&mid_position); - + if (sub_level == 3) count = 12; else count = 4; // adjust height and poisition for each vertex - for(i = 0; i < count; i++) + for (i = 0; i < count; i++) { int temp_y; @@ -550,13 +549,13 @@ void PlacePoolForCar(CAR_DATA *cp, CVECTOR *col, int front, int in_car) } if (FIXEDH(s[0].vy * s[1].vz - s[0].vz * s[1].vy) * s[2].vx + - FIXEDH(s[0].vz * s[1].vx - s[0].vx * s[1].vz) * s[2].vy + + FIXEDH(s[0].vz * s[1].vx - s[0].vx * s[1].vz) * s[2].vy + FIXEDH(s[0].vx * s[1].vy - s[0].vy * s[1].vx) * s[2].vz >= 0) { gte_SetRotMatrix(&inv_camera_matrix); gte_SetTransVector(&dummy); - if (sub_level == 0) + if (sub_level == 0) { gte_ldv3(&s[0], &s[1], &s[2]); gte_rtpt(); @@ -598,7 +597,7 @@ void PlacePoolForCar(CAR_DATA *cp, CVECTOR *col, int front, int in_car) } else if (sub_level == 3) { - for(i = 0; i < 12; i++) + for (i = 0; i < 12; i++) { gte_ldv0(&s[i]); gte_rtv0tr(); @@ -606,10 +605,10 @@ void PlacePoolForCar(CAR_DATA *cp, CVECTOR *col, int front, int in_car) } // draw front light quads - for(i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { char* VertIdx; - + VertIdx = PoolPrimData + i * 4; gte_SetRotMatrix(&identity); @@ -628,7 +627,7 @@ void PlacePoolForCar(CAR_DATA *cp, CVECTOR *col, int front, int in_car) color.g = MIN(255, col->g * brightness >> 4); color.b = MIN(255, col->b * brightness >> 4); - if (i & 1) + if (i & 1) { sQuad(sout + VertIdx[0], sout + VertIdx[2], @@ -677,15 +676,16 @@ void AddLeaf(VECTOR *Position, int num_leaves, int Type) Position->vy = -Position->vy; Position->pad = MapHeight(Position); + for (i = 0; i < num_leaves; i++) { num = AllocateLeaf(); - + if (num == -1) return; - + LEAF* myleaf = &leaf[num]; - + temprand = rand(); myleaf->position.vx = Position->vx + (temprand & 0xfe); @@ -695,16 +695,16 @@ void AddLeaf(VECTOR *Position, int num_leaves, int Type) myleaf->position.vy = -Position->vy; else myleaf->position.vy = -Position->pad; - + myleaf->position.pad = Position->pad; myleaf->life = 600; myleaf->flags = 0x2; - + myleaf->direction.vx = 0; myleaf->direction.vy = 0; myleaf->direction.vz = 0; - + myleaf->pos = (temprand >> 7) & 0xff; myleaf->step = (temprand & 7) + 1; @@ -750,7 +750,7 @@ void AddLeaf(VECTOR *Position, int num_leaves, int Type) myleaf->sin_index2 = temprand >> 4 & 0xfff; myleaf->sin_addition2 = -(temprand >> 8 & 7); myleaf->sin_addition1 = -(temprand & 3); - + myleaf->type = Type; } } @@ -777,7 +777,7 @@ void SwirlLeaves(CAR_DATA *cp) XDiff = plpos.vx - lpLeaf->position.vx; ZDiff = plpos.vz - lpLeaf->position.vz; - if ((lpLeaf->flags & 0x2) && + if ((lpLeaf->flags & 0x2) && lpLeaf->position.vy + plpos.vy > -180 && XDiff > -360 && XDiff < 360 && ZDiff > -360 && ZDiff < 360) { @@ -785,7 +785,7 @@ void SwirlLeaves(CAR_DATA *cp) lpLeaf->direction.vy = -25 - (rand() & 0x1f); lpLeaf->position.vy -= 1; } - + lpLeaf++; } } @@ -936,7 +936,7 @@ void InitDebris(void) for (i = 0; i < MAX_SMOKE; i++) { smoke_alloc[i] = i; - + smoke[i].pos = 0; smoke[i].flags = 0; smoke[i].num = i; @@ -975,7 +975,6 @@ void ReleaseDebris(short num) debris_alloc[--next_debris] = num; } - // [D] [T] int AllocateSmoke(void) { @@ -1035,7 +1034,7 @@ void AddGroundDebris(void) { type = 1; // ground leaves } - else + else { number = seed & 3; type = 2; // paper @@ -1098,7 +1097,7 @@ void DrawSmashable_sprites(void) { plotContext.colour = NightAmbient << 0x10 | NightAmbient << 8 | NightAmbient | 0x2c000000; } - else + else { plotContext.colour = 0x2c808080; } @@ -1113,13 +1112,12 @@ void DrawSmashable_sprites(void) } } } - + count++; dam++; } while (count < MAX_SMASHED_OBJECTS); } - // [D] [T] int MoveSmashable_object(void) { @@ -1130,12 +1128,12 @@ int MoveSmashable_object(void) count = 0; do { - if (dam->active) + if (dam->active) { - if (dam->cop.pos.vy < 50 - player[0].pos[1]) + if (dam->cop.pos.vy < 50 - player[0].pos[1]) { dam->vx += dam->velocity.vx; - + dam->cop.pos.vy += dam->velocity.vy; dam->cop.pos.vz += dam->velocity.vz; @@ -1143,7 +1141,7 @@ int MoveSmashable_object(void) dam->damage++; } - else + else { dam->active = 0; } @@ -1169,7 +1167,7 @@ void DisplayLightReflections(VECTOR* v1, CVECTOR* col, short size, TEXTURE_DETAI thiscol.r = col->r * wetness >> 16; thiscol.g = col->g * wetness >> 16; thiscol.b = col->b * wetness >> 16; - + gte_SetTransVector(v1); Apply_Inv_CameraMatrix(v1); @@ -1259,8 +1257,6 @@ int find_lamp_streak(int LampId) return -1; } - - // [D] [T] void AddSmallStreetLight(CELL_OBJECT *cop, int x, int y, int z, int type) { @@ -1273,12 +1269,12 @@ void AddSmallStreetLight(CELL_OBJECT *cop, int x, int y, int z, int type) CVECTOR col, col1; dam = damaged_lamp; - col = {140, 140, 140}; - col1 = {45, 45, 45}; + col = { 140, 140, 140 }; + col1 = { 45, 45, 45 }; angle = cop->yang; - if (type == 0) + if (type == 0) { halo_size = 25; size = 150; @@ -1295,11 +1291,11 @@ void AddSmallStreetLight(CELL_OBJECT *cop, int x, int y, int z, int type) } count = 0; - for(count = 0; count < 4; count++) + for (count = 0; count < 4; count++) { - if (dam->index == cop->pos.vx + cop->pos.vz) + if (dam->index == cop->pos.vx + cop->pos.vz) { - if (dam->damage > 2) + if (dam->damage > 2) return; // do flicker @@ -1308,6 +1304,7 @@ void AddSmallStreetLight(CELL_OBJECT *cop, int x, int y, int z, int type) break; } + dam++; } @@ -1369,11 +1366,11 @@ void AddSmallStreetLight(CELL_OBJECT *cop, int x, int y, int z, int type) v3 = v1; - LightIndex = find_lamp_streak(LAMP_STREAK_ID(cop->pos.vx + x, cop->pos.vz)); // [A] was pointer. + LightIndex = find_lamp_streak(LAMP_STREAK_ID(cop->pos.vx + x, cop->pos.vz)); // [A] was pointer if (LightIndex > -1) col.cd = 0x60; - + ShowLight(&v3, &col, halo_size, &light_texture); ShowLight1(&v3, &col1, size, &light_texture); @@ -1403,8 +1400,8 @@ void AddLightEffect(CELL_OBJECT *cop, int x, int y, int z, int type, int colour) dpos.vx = cop->pos.vx - camera_position.vx; dpos.vy = cop->pos.vy - camera_position.vy; dpos.vz = cop->pos.vz - camera_position.vz; - - if (yang & 0xf) + + if (yang & 0xf) { pos.vx = x; pos.vy = y; @@ -1430,7 +1427,7 @@ void AddLightEffect(CELL_OBJECT *cop, int x, int y, int z, int type, int colour) v1.vx = dpos.vx + x; v1.vz = dpos.vz + z; } - else if (yang == 1) + else if (yang == 1) { v1.vx = dpos.vx + z; v1.vz = dpos.vz - x; @@ -1455,7 +1452,7 @@ void AddLightEffect(CELL_OBJECT *cop, int x, int y, int z, int type, int colour) col.g = 10; col.b = 0; } - else if (colour == 1) + else if (colour == 1) { col.r = 0; col.g = 40; @@ -1553,7 +1550,7 @@ int damage_lamp(CELL_OBJECT *cop) old_damage = dam->damage; dam->damage++; - if (old_damage < 3) + if (old_damage < 3) return ((old_damage + 1) < 3) ^ 1; return 0; @@ -1582,7 +1579,7 @@ int damage_object(CELL_OBJECT *cop, VECTOR *velocity) dam = &damaged_object[NextDamagedPmeter]; SmashablesHit++; - + if (NextDamagedPmeter < MAX_SMASHED_OBJECTS-1) NextDamagedPmeter++; else @@ -1604,7 +1601,7 @@ int damage_object(CELL_OBJECT *cop, VECTOR *velocity) if (dam->velocity.vx < 0) dam->velocity.vy = velocity->vx; - else + else dam->velocity.vy = -velocity->vx; if (dam->velocity.vz < 0) @@ -1722,14 +1719,14 @@ void AddTrafficLight(CELL_OBJECT *cop, int x, int y, int z, int flag, int yang) v1.vz = (cop->pos.vz - camera_position.vz) + FIXEDH(RCOS(yang) * z - RSIN(yang) * x); a.cd = 0; - - if (flag & 0x200) + + if (flag & 0x200) { a.r = 255; a.g = 25; a.b = 25; } - else if (flag & 0x400) + else if (flag & 0x400) { a.r = 255; a.g = 100; @@ -1742,7 +1739,7 @@ void AddTrafficLight(CELL_OBJECT *cop, int x, int y, int z, int flag, int yang) a.b = 25; } - lDiffAnglesX = DIFF_ANGLES(0, camera_angle.vx);// (camera_angle.vx + 2048) & 0xfff) - 2048; + lDiffAnglesX = DIFF_ANGLES(0, camera_angle.vx); //(camera_angle.vx + 2048) & 0xfff) - 2048; AbsX = ABS(lDiffAnglesX); lDiffAnglesY = DIFF_ANGLES(yang, -camera_angle.vy & 4095); //((-camera_angle.vy & 0xfffU) - yang + 2048 & 0xfff) - 2048; @@ -1759,7 +1756,7 @@ void AddTrafficLight(CELL_OBJECT *cop, int x, int y, int z, int flag, int yang) if (gNight) ShowGroundLight(&v2, &c, 300); - + if (AbsY < 1000) { if (AbsX + AbsY < 1000) @@ -1774,7 +1771,7 @@ void AddTrafficLight(CELL_OBJECT *cop, int x, int y, int z, int flag, int yang) a.g = (a.g * tempfade) >> 10; LightSortCorrect = -140; - LightIndex = find_lamp_streak(LAMP_STREAK_ID(cop->pos.vx + x, cop->pos.vz + y)); // [A] was pointer. + LightIndex = find_lamp_streak(LAMP_STREAK_ID(cop->pos.vx + x, cop->pos.vz + y)); // [A] was pointer if (LightIndex < 0) a.cd = 0; @@ -1793,7 +1790,6 @@ void AddTrafficLight(CELL_OBJECT *cop, int x, int y, int z, int flag, int yang) DisplayLightReflections(&v2, &a, 50, &lightref_texture); } - LightSortCorrect = -10; } } @@ -1822,13 +1818,13 @@ void FindCarLightFade(MATRIX *carToCamera) int zz; zz = carToCamera->m[2][2] / 4; - + CarLightFadeFront = zz - 124; CarLightFadeBack = -124 - zz; } // [D] [T] -void ShowCarlight(SVECTOR *v1, CAR_DATA *cp, CVECTOR *col, short size, short flare_size, TEXTURE_DETAILS *texture,int flag) +void ShowCarlight(SVECTOR *v1, CAR_DATA *cp, CVECTOR *col, short size, short flare_size, TEXTURE_DETAILS *texture, int flag) { int CarLightFade; VECTOR v1t; @@ -1863,7 +1859,7 @@ void ShowCarlight(SVECTOR *v1, CAR_DATA *cp, CVECTOR *col, short size, short fla InitFXPos(&v1l, v1, cp); - if (wetness > 9) + if (wetness > 9) { v1t.vx = v1l.vx; v1t.vz = v1l.vz; @@ -1944,7 +1940,7 @@ void ShowLight1(VECTOR *v1, CVECTOR *col, short size, TEXTURE_DETAILS *texture) z = (z >> 3) + LightSortCorrect; - if (z < 0) + if (z < 0) z = 0; gte_stsxy(&poly->x3); @@ -2045,28 +2041,28 @@ void ShowLight(VECTOR *v1, CVECTOR *col, short size, TEXTURE_DETAILS *texture) else return; - if ((col->cd & 0x20) && gLightsOn) + if ((col->cd & 0x20) && gLightsOn) { trails = Known_Lamps[LightIndex].light_trails; clock = &Known_Lamps[LightIndex].clock; } - else + else { // get light index by flag - if (col->cd & 0x2) + if (col->cd & 0x2) index = 0; - else if (col->cd & 0x4) + else if (col->cd & 0x4) index = 1; - else if (col->cd & 0x8) + else if (col->cd & 0x8) index = 2; - else if (col->cd & 0x10) + else if (col->cd & 0x10) index = 3; else index = -1; if (index == -1) return; - + trails = car_data[gcar_num].ap.light_trails[index]; clock = &car_data[gcar_num].ap.old_clock[index]; } @@ -2078,7 +2074,7 @@ void ShowLight(VECTOR *v1, CVECTOR *col, short size, TEXTURE_DETAILS *texture) x = (poly->x0 + poly->x3) / 2; y = (poly->y0 + poly->y3) / 2; #endif - + // unified drawing both for car and lamps if (CameraChanged == 0 && *clock == (FrameCnt & 0xffffU) - 1) { @@ -2133,19 +2129,19 @@ void ShowLight(VECTOR *v1, CVECTOR *col, short size, TEXTURE_DETAILS *texture) trail->x3 = old_x - dx; trail->y3 = old_y - dy; - if (col->cd & 0x18) + if (col->cd & 0x18) { trail->r0 = trail->r1 = col->r / 2; trail->g0 = trail->g1 = col->g / 2; trail->b0 = trail->b1 = col->b / 2; } - else + else { trail->r0 = trail->r1 = col->r; trail->g0 = trail->g1 = col->g; trail->b0 = trail->b1 = col->b; } - + trail->r2 = trail->r3 = 0; trail->g2 = trail->g3 = 0; trail->b2 = trail->b3 = 0; @@ -2219,7 +2215,7 @@ void ShowGroundLight(VECTOR *v1, CVECTOR *col, short size) gte_stsz(&z); - if (z - 150 < 9851) + if (z - 150 < 9851) { poly = (POLY_FT4 *)current->primptr; @@ -2329,7 +2325,7 @@ void DisplayWater(SMOKE *smoke) POLY_FT4* poly; VECTOR v; SVECTOR vert[4]; - + int size; int z; int z1; @@ -2438,7 +2434,7 @@ void DisplaySpark(SMOKE *spark) setPolyG3(poly); - if (spark->start_w == 2) + if (spark->start_w == 2) { colorind = spark->drift.vy * 3 & 3; @@ -2457,7 +2453,7 @@ void DisplaySpark(SMOKE *spark) poly->g2 = grassColour[colorind][1]; poly->b2 = grassColour[colorind][2]; } - else + else { poly->r0 = 0; poly->g0 = (spark->transparency >> 3); @@ -2553,7 +2549,7 @@ void Setup_Debris(VECTOR *ipos, VECTOR *ispeed, int num_debris, int type) if ((type & 0xffffU) < 8) { seed = rand(); - + mydebris->step = seed; mydebris->rgb.r = debris_colour[GameLevel][col].r; mydebris->rgb.g = debris_colour[GameLevel][col].g; @@ -2565,15 +2561,15 @@ void Setup_Debris(VECTOR *ipos, VECTOR *ispeed, int num_debris, int type) mydebris->rgb.g >>= 1; mydebris->rgb.b >>= 1; } - + mydebris->direction.vx = FIXED((ispeed->vx + ((seed & 0x7f) - 64) * num_debris) * 1024); mydebris->direction.vy = -FIXED((seed & 0x7f00) * num_debris * 2); mydebris->direction.vz = FIXED(ispeed->vz + ((rand() & 0x7fff) - 16384) * num_debris * 2); } - else + else { mydebris->step = 2; - + mydebris->rgb.b = 60; mydebris->rgb.g = 60; mydebris->rgb.r = 60; @@ -2603,7 +2599,7 @@ void Setup_Smoke(VECTOR *ipos, int start_w, int end_w, int SmokeType, int WheelS mysmoke = &smoke[num]; - if (SmokeType == SMOKE_FIRE) + if (SmokeType == SMOKE_FIRE) { mysmoke->position.vx = ipos->vx; mysmoke->position.vy = ipos->vy; @@ -2629,7 +2625,7 @@ void Setup_Smoke(VECTOR *ipos, int start_w, int end_w, int SmokeType, int WheelS mysmoke->position.vx = ipos->vx + (rand() & 9); mysmoke->position.vy = ipos->vy; mysmoke->position.vz = ipos->vz + (rand() & 9); - + mysmoke->flags = 0x2000 | 0x4 | 0x2; mysmoke->transparency = 140; mysmoke->t_step = 5; @@ -2645,14 +2641,14 @@ void Setup_Smoke(VECTOR *ipos, int start_w, int end_w, int SmokeType, int WheelS mysmoke->transparency = (800000 - WheelSpeed >> 0xb); else mysmoke->transparency = 255; - + mysmoke->t_step = end_w - start_w >> 5; mysmoke->step = (end_w - start_w) / 128 * 4; } mysmoke->start_w = start_w; mysmoke->final_w = end_w; - + mysmoke->flags = 0x2000 | 0x4 | 0x2; mysmoke->life = 40; mysmoke->halflife = 20; @@ -2728,7 +2724,7 @@ void Setup_Smoke(VECTOR *ipos, int start_w, int end_w, int SmokeType, int WheelS mysmoke->halflife = 64; } - if (Exhaust != 0) + if (Exhaust != 0) { mysmoke->drift.vx = Drift->vx; mysmoke->drift.vy = Drift->vy; @@ -2750,7 +2746,7 @@ void Setup_Smoke(VECTOR *ipos, int start_w, int end_w, int SmokeType, int WheelS mysmoke->drift_change.vy = 1; mysmoke->drift_change.vz = 0; } - else + else { mysmoke->drift_change.vx = Drift->vx; mysmoke->drift_change.vy = Drift->vy; @@ -2777,7 +2773,7 @@ void Setup_Sparks(VECTOR *ipos, VECTOR *ispeed, int num_sparks, char SparkType) for (i = 0; i < num_sparks; i++) { num = AllocateSmoke(); - + if (num == -1) return; @@ -2791,7 +2787,7 @@ void Setup_Sparks(VECTOR *ipos, VECTOR *ispeed, int num_sparks, char SparkType) mysmoke->pos = (i << 2); mysmoke->step = seed & 0x3f; - + mysmoke->drift.vx = 2; mysmoke->flags = 0x8 | 0x2; @@ -2843,8 +2839,8 @@ void DisplayDebris(DEBRIS *debris, char type) debrisvec.vy = debris->position.vy - camera_position.vy; debrisvec.vz = debris->position.vz - camera_position.vz; - if (debrisvec.vx >= -10000 && - debrisvec.vz >= -10000 && + if (debrisvec.vx >= -10000 && + debrisvec.vz >= -10000 && debrisvec.vx <= 10000 && debrisvec.vz <= 10000) { @@ -2865,7 +2861,7 @@ void DisplayDebris(DEBRIS *debris, char type) gte_ldv3(&v[0], &v[1], &v[2]); gte_rtpt(); - if (type - 1U < 2) + if (type - 1U < 2) { poly1 = (POLY_GT4 *)current->primptr; @@ -2891,7 +2887,7 @@ void DisplayDebris(DEBRIS *debris, char type) gte_stsxy(&poly1->x3); - if (type == 2) + if (type == 2) uVar3 = (debris->rgb.b + combointensity) * 0x10000 | (debris->rgb.g + combointensity) * 0x100 | 0x3c000000 | debris->rgb.r + combointensity; else uVar3 = debris->rgb.b << 0x10 | debris->rgb.g << 8 | 0x3c000000 | debris->rgb.r; @@ -3131,7 +3127,7 @@ void HandleDebris(void) LEAF *lf; int i; VECTOR Drift; - + GetSmokeDrift(&Drift); MoveHubcap(); @@ -3148,10 +3144,10 @@ void HandleDebris(void) if (db->flags & 0x2) { DisplayDebris(db, 0); - + if (pauseflag == 0) { - if (--db->life == 0 || db->position.vy > 0) + if (--db->life == 0 || db->position.vy > 0) { db->flags = 0; ReleaseDebris(db->num); @@ -3163,7 +3159,7 @@ void HandleDebris(void) db->position.vz += db->direction.vz; db->pos += db->step; - if (db->type == 3) + if (db->type == 3) db->direction.vy += 1; else db->direction.vy += 6; @@ -3180,13 +3176,13 @@ void HandleDebris(void) // Move leaves while (i > 0) { - if (lf->flags & 0x2) + if (lf->flags & 0x2) { DisplayDebris((DEBRIS *)lf, lf->type); - + if (pauseflag == 0) { - if (lf->life == 1) + if (lf->life == 1) { lf->flags = 0; ReleaseLeaf(lf->num); @@ -3259,7 +3255,7 @@ void HandleDebris(void) if (sm->flags & 0x2 && pauseflag == 0) { - if (sm->flags & 0x8000) + if (sm->flags & 0x8000) { // OBSOLETE DRIVER 1 CODE /* @@ -3267,7 +3263,7 @@ void HandleDebris(void) ROADS_GetRouteData(sm->position.vx - sm->start_w, sm->position.vz - sm->start_w, &routeData); ROADS_GetRouteData(sm->position.vx + sm->start_w, sm->position.vz + sm->start_w, &routeData); - if (sm->start_w < 800 && (modelpointers[routeData.type]->shape_flags & MODEL_FLAG_ALLEY)) + if (sm->start_w < 800 && (modelpointers[routeData.type]->shape_flags & MODEL_FLAG_ALLEY)) sm->start_w += sm->step; else*/ sm->start_w -= sm->step; @@ -3297,7 +3293,7 @@ void HandleDebris(void) continue; } } - else + else { if (sm->start_w < 800) sm->start_w += sm->step; @@ -3305,7 +3301,7 @@ void HandleDebris(void) sm->position.vx += sm->drift.vx; sm->position.vy += sm->drift.vy; sm->position.vz += sm->drift.vz; - + if (sm->halflife < sm->life) { sm->drift.vx -= sm->drift_change.vx; @@ -3338,7 +3334,7 @@ void HandleDebris(void) main_cop_light_pos++; main_cop_light_pos &= 7; - variable_weather = 1; + variable_weather = 1; if (variable_weather != 0) { @@ -3402,14 +3398,12 @@ void add_haze(int top_col, int bot_col, short ot_pos) } } - // [D] [T] void SetupRain(void) { gNextRainDrop = 0; do { - gRainAlloc[gNextRainDrop] = gNextRainDrop; gRain[gNextRainDrop].oldposition.pad = gNextRainDrop; @@ -3469,7 +3463,7 @@ void DisplaySplashes(void) CamGnd.vy = -camera_position.vy - MapHeight(&CamGnd); ang = FrAng - camera_angle.vy; - + Gnd1.vx = (RSIN(ang) >> 1) + camera_position.vx; Gnd1.vy = CamGnd.vy; Gnd1.vz = (RCOS(ang) >> 1) + camera_position.vz; @@ -3544,14 +3538,14 @@ void DrawRainDrops(void) Count = gNextRainDrop-1; poly = (POLY_GT3 *)current->primptr; - - while (Count > 0) + + while (Count > 0) { v.vx = RainPtr->position.vx - camera_position.vx; v.vy = RainPtr->position.vy - camera_position.vy; v.vz = RainPtr->position.vz - camera_position.vz; - if (pauseflag) + if (pauseflag) { // [A] old position imitation // works effectively when player not moving @@ -3581,17 +3575,17 @@ void DrawRainDrops(void) setPolyGT3(poly); setSemiTrans(poly, 1); - + gte_stsxy(&poly->x2); gte_stsz(&z); - if (z - 151U < 2000 && - poly->x2 > -101 && poly->x2 < 421 && - poly->y2 > -51 && poly->y2 < 257) + if (z - 151U < 2000 && + poly->x2 > -101 && poly->x2 < 421 && + poly->y2 > -51 && poly->y2 < 257) { - if (*(u_int *)&RainPtr->oldposition != 0) - { + if (*(u_int *)&RainPtr->oldposition != 0) + { poly->x1 = poly->x2 - ((z >> 10) - 1); poly->x2 = poly->x2 + ((z >> 10) - 1); poly->y1 = poly->y2; @@ -3623,7 +3617,6 @@ void DrawRainDrops(void) current->primptr = (char*)poly; } - // [D] [T] void AddRainDrops(void) { @@ -3653,7 +3646,7 @@ void AddRainDrops(void) gte_SetTransVector(&camera_position); i = 0; - while (i < count) + while (i < count) { i++; @@ -3664,18 +3657,18 @@ void AddRainDrops(void) tmp = RAND(rand); v.vz = (tmp >> 20 & 511) + 400; - + tmp = RAND(tmp); v.vy = -((tmp >> 20) & 511); - + rand = RAND(tmp); v.vx = ((rand >> 20) & 511) - 256; - if (v.vz > 512) + if (v.vz > 512) { int depth; depth = (v.vz >> 8) + 1; - + v.vx *= depth; v.vy *= depth; } @@ -3694,7 +3687,7 @@ void AddRainDrops(void) // OBSOLETE DRIVER 1 CODE /* - if(first) + if (first) { ROADS_GetRouteData(rt->position.vx, rt->position.vz, &routeData); @@ -3718,20 +3711,20 @@ void DoLightning(void) if (pauseflag != 0) return; - if (LightningTimer < -10) + if (LightningTimer < -10) LightningTimer = rand() & 0xff; - else + else LightningTimer--; - + if (LightningTimer < 0 && (rand() & 1) == 0) { RequestThunder(); - if ((rand() & 1) == 0) + if ((rand() & 1) == 0) { NightAmbient = NightAmbient << 1; - if (NightAmbient > 128) + if (NightAmbient > 128) NightAmbient = 128; lightning = 2; @@ -3744,7 +3737,6 @@ void DoLightning(void) lightning = 0; } - // [D] [T] void InitThunder(void) { @@ -3752,7 +3744,6 @@ void InitThunder(void) ThunderDistance = rand() % 5000; } - // [D] [T] void RequestThunder(void) { @@ -3762,7 +3753,6 @@ void RequestThunder(void) ThunderTimer = 1; } - // [D] [T] void DoThunder(void) { @@ -3774,30 +3764,29 @@ void DoThunder(void) if (ThunderDistance < 250) ThunderDistance = 250; - if (ThunderDistance > 5000) + if (ThunderDistance > 5000) ThunderDistance = 5000; if (ThunderTimer > -1) { ThunderTimer--; - - if(ThunderTimer == 0) + + if (ThunderTimer == 0) StartSound(-1, SOUND_BANK_SFX, 8, -ThunderDistance, (rand() % 2048) + 3072); } } - // [D] [T] void DoWeather(int weather) { if (weather != WEATHER_RAIN) return; - if(pauseflag == 0) + if (pauseflag == 0) { - if (gEffectsTimer < 41) + if (gEffectsTimer < 41) { - if ((FrameCnt & 7U) == 0) + if ((FrameCnt & 7U) == 0) gEffectsTimer++; } else @@ -3825,13 +3814,8 @@ int GetDebrisColour(CAR_DATA *cp) if (car_model == 0) return 1; - if(car_model < 8) + if (car_model < 8) return (car_model-1) * 6 + cp->ap.palette + 7; return car_model - 6; } - - - - - diff --git a/src_rebuild/Game/C/debris.h b/src_rebuild/Game/C/debris.h index 6a19fd43f..4e8d4c0a9 100644 --- a/src_rebuild/Game/C/debris.h +++ b/src_rebuild/Game/C/debris.h @@ -95,7 +95,6 @@ extern void HandleDebris(); // 0x00038008 extern void add_haze(int top_col, int bot_col, short ot_pos); // 0x00038CB4 - extern void SetupRain(); // 0x00039DF8 extern void DrawRainDrops(); // 0x00038E08 extern void DoLightning(); // 0x00039B78 @@ -104,9 +103,4 @@ extern void RequestThunder(); // 0x0003A120 extern void DoThunder(); // 0x0003A144 extern void DoWeather(int weather); // 0x0003A000 - - -extern void add_haze(int top_col, int bot_col, short ot_pos); // 0x00038CB4 - - -#endif +#endif // DEBRIS_H diff --git a/src_rebuild/Game/C/denting.c b/src_rebuild/Game/C/denting.c index de95e2927..53e8ba16a 100644 --- a/src_rebuild/Game/C/denting.c +++ b/src_rebuild/Game/C/denting.c @@ -87,7 +87,7 @@ void DentCar(CAR_DATA *cp) pCleanModel = gCarCleanModelPtr[model]; // collect vertices from zones - if (pCleanModel != NULL) + if (pCleanModel != NULL) { for (VertNo = 0; VertNo < pCleanModel->num_vertices; VertNo++) tempDamage[VertNo] = 0; @@ -105,14 +105,14 @@ void DentCar(CAR_DATA *cp) { if (tempDamage[*DamPtr] == 0) tempDamage[*DamPtr] += Damage; - else + else tempDamage[*DamPtr] += Damage / 2; } - } + } } // update vertices positon - if (gCarCleanModelPtr[model] != NULL && gCarDamModelPtr[model] != NULL) + if (gCarCleanModelPtr[model] != NULL && gCarDamModelPtr[model] != NULL) { DamVertPtr = GET_MODEL_DATA(SVECTOR, gCarDamModelPtr[model], vertices); CleanVertPtr = GET_MODEL_DATA(SVECTOR, gCarCleanModelPtr[model], vertices); @@ -126,19 +126,19 @@ void DentCar(CAR_DATA *cp) } // update polygon UVs - if (pCleanModel != NULL) + if (pCleanModel != NULL) { dentptr = gTempHDCarUVDump[cp->id]; // reset UV coordinates - + for (Poly = 0; Poly < pCleanModel->num_polys; Poly++) { dentptr->u3 = 0; dentptr++; } - for(Zone = 0; Zone < NUM_DAMAGE_ZONES; Zone++) + for (Zone = 0; Zone < NUM_DAMAGE_ZONES; Zone++) { Damage = cp->ap.damage[Zone]; @@ -164,7 +164,7 @@ void DentCar(CAR_DATA *cp) for (Poly = 0; Poly < pCleanModel->num_polys; Poly++, DamPtr++, dentptr++) { // calculate the UV offset with strange XORs - if(dentptr->u3 > 0) + if (dentptr->u3 > 0) dentptr->u3 = (*DamPtr ^ 1 ^ (*DamPtr ^ 1 | dentptr->u3)) * 64; } } @@ -190,7 +190,7 @@ void CreateDentableCar(CAR_DATA *cp) vcount = srcModel->num_vertices; - while (vcount-- != -1) + while (vcount-- != -1) *dst++ = *src++; for (count = 0; count < srcModel->num_polys; count++) @@ -216,7 +216,7 @@ void CreateDentableCar(CAR_DATA *cp) printError("gCarLowModelPtr is NULL in CreateDentableCar\n"); } - if (gDontResetCarDamage == 0) + if (gDontResetCarDamage == 0) { for (count = 0; count < NUM_DAMAGE_ZONES; count++) { @@ -236,7 +236,6 @@ void InitHubcap(void) gHubcapTime = Random2(1) & 0x7ff; } - // [D] [T] void LoseHubcap(int car, int Hubcap, int Velocity) { @@ -244,7 +243,7 @@ void LoseHubcap(int car, int Hubcap, int Velocity) CAR_DATA* cp; SVECTOR* wheelDisp; - + cp = &car_data[car]; // check speed and if hubcap lost @@ -268,7 +267,7 @@ void LoseHubcap(int car, int Hubcap, int Velocity) gHubcap.Orientation = cp->hd.where; gHubcap.Rotation = 0; - + if (Hubcap > 1) { gHubcap.Orientation.m[0][0] = -gHubcap.Orientation.m[0][0]; @@ -282,13 +281,12 @@ void LoseHubcap(int car, int Hubcap, int Velocity) } gHubcap.Duration = 100; - + gHubcap.Direction.vx = FIXEDH(FIXEDH(cp->st.n.angularVelocity[1]) * wheelDisp->vz) + FIXEDH(cp->st.n.linearVelocity[0]); gHubcap.Direction.vy = FIXEDH(cp->st.n.linearVelocity[1]); gHubcap.Direction.vz = FIXEDH(-FIXEDH(cp->st.n.angularVelocity[1]) * wheelDisp->vx) + FIXEDH(cp->st.n.linearVelocity[2]); } - // [A] void HandlePlayerHubcaps(int playerId) { @@ -333,18 +331,18 @@ void MoveHubcap() VECTOR ShadowPos; VECTOR Position; MATRIX Orientation; - CVECTOR col = {72,72,72}; + CVECTOR col = { 72, 72, 72 }; InitMatrix(Orientation); if (pauseflag == 0) { - if(gHubcapTime > 0) + if (gHubcapTime > 0) gHubcapTime--; } // draw current hubcap - if (gHubcap.Duration > 0) + if (gHubcap.Duration > 0) { if (pauseflag == 0 && CurrentPlayerView == 0) { @@ -416,13 +414,13 @@ void ProcessDentLump(char *lump_ptr, int lump_size) { model = 10 - (MissionHeader->residentModels[0] + MissionHeader->residentModels[1] + MissionHeader->residentModels[2]); - if (model < 1) + if (model < 1) model = 1; - else if(model > 4) + else if (model > 4) model = 4; } - if (model != -1) + if (model != -1) { offset = *(int *)(lump_ptr + model * 4); mem = (u_char*)lump_ptr; @@ -441,16 +439,15 @@ void ProcessDentLump(char *lump_ptr, int lump_size) memcpy((u_char*)gCarDamageZoneVerts[i], mem + offset, NUM_DAMAGE_ZONES * MAX_FILE_DAMAGE_ZONE_VERTS); offset += NUM_DAMAGE_ZONES * MAX_FILE_DAMAGE_ZONE_VERTS; - + memcpy((u_char*)gHDCarDamageZonePolys[i], mem + offset, NUM_DAMAGE_ZONES * MAX_FILE_DAMAGE_ZONE_POLYS); offset += NUM_DAMAGE_ZONES * MAX_FILE_DAMAGE_ZONE_POLYS; - + memcpy((u_char*)gHDCarDamageLevels[i], mem + offset, MAX_FILE_DAMAGE_LEVELS); } } } - // [D] [T] void SetupSpecDenting(char *loadbuffer) { @@ -467,7 +464,7 @@ void SetupSpecDenting(char *loadbuffer) if (newDenting) loadbuffer = newDenting; } - + #endif // [A] this is better @@ -486,6 +483,3 @@ void LoadDenting(int level) LoadfileSeg(DentingFiles[level], (char*)_other_buffer, 0, 12727); ProcessDentLump((char*)_other_buffer, 0); } - - - diff --git a/src_rebuild/Game/C/denting.h b/src_rebuild/Game/C/denting.h index 54d5fedc7..dcaabd8fc 100644 --- a/src_rebuild/Game/C/denting.h +++ b/src_rebuild/Game/C/denting.h @@ -1,7 +1,6 @@ #ifndef DENTING_H #define DENTING_H - extern void InitialiseDenting(); // 0x0003B1C0 extern void LoadDenting(int level); // 0x0003B1F0 @@ -14,5 +13,4 @@ extern void MoveHubcap(); // 0x0003AB4C extern void SetupSpecDenting(char *loadbuffer); // 0x0003B240 - -#endif +#endif // DENTING_H diff --git a/src_rebuild/Game/C/director.c b/src_rebuild/Game/C/director.c index 22d8448b0..fdc9e1785 100644 --- a/src_rebuild/Game/C/director.c +++ b/src_rebuild/Game/C/director.c @@ -27,26 +27,26 @@ struct REPLAY_ICON short tx, ty; }; -TEXTURE_DETAILS icon_delcam; // address 0xC0EE0 -TEXTURE_DETAILS icon_incar; // address 0xBF950 -TEXTURE_DETAILS icon_lenschan; // address 0xC1DB0 -TEXTURE_DETAILS icon_lookcar; // address 0xC1CB0 -TEXTURE_DETAILS icon_movecam; // address 0xC1C18 -TEXTURE_DETAILS icon_movecampos; // address 0xC08C0 -TEXTURE_DETAILS icon_ok; // address 0xC1BD8 -TEXTURE_DETAILS icon_pause; // address 0xBF970 -TEXTURE_DETAILS icon_playpause; // address 0xC2A28 -TEXTURE_DETAILS icon_clock; // address 0xBF940 -TEXTURE_DETAILS icon_choosecar; // address 0xC2A08 -TEXTURE_DETAILS icon_chasecar; // address 0xC1D60 -TEXTURE_DETAILS icon_addcam; // address 0xC0A50 -TEXTURE_DETAILS icon_autocam; // address 0xC1CA0 -TEXTURE_DETAILS icon_playcam; // address 0xC1C08 -TEXTURE_DETAILS icon_restart; // address 0xC1CD0 -TEXTURE_DETAILS icon_save2card; // address 0xC1F40 -TEXTURE_DETAILS icon_editcam; // address 0xC1BE8 -TEXTURE_DETAILS icon_fixedcam; // address 0xC1D70 -TEXTURE_DETAILS icon_frameadv; // address 0xC1D80 +TEXTURE_DETAILS icon_delcam; +TEXTURE_DETAILS icon_incar; +TEXTURE_DETAILS icon_lenschan; +TEXTURE_DETAILS icon_lookcar; +TEXTURE_DETAILS icon_movecam; +TEXTURE_DETAILS icon_movecampos; +TEXTURE_DETAILS icon_ok; +TEXTURE_DETAILS icon_pause; +TEXTURE_DETAILS icon_playpause; +TEXTURE_DETAILS icon_clock; +TEXTURE_DETAILS icon_choosecar; +TEXTURE_DETAILS icon_chasecar; +TEXTURE_DETAILS icon_addcam; +TEXTURE_DETAILS icon_autocam; +TEXTURE_DETAILS icon_playcam; +TEXTURE_DETAILS icon_restart; +TEXTURE_DETAILS icon_save2card; +TEXTURE_DETAILS icon_editcam; +TEXTURE_DETAILS icon_fixedcam; +TEXTURE_DETAILS icon_frameadv; REPLAY_ICON replay_icons[] = { @@ -119,7 +119,6 @@ int CursorX = 0; int ClearCameras = 0; int DirectorMenuActive = 0; - void setCamera(PLAYBACKCAMERA* Change); void deleteCamera(int count); PLAYBACKCAMERA* FindFreeCamera(); @@ -129,7 +128,6 @@ int NoMoreCamerasErrorMessage(); int FirstCamera(); void SetCameraReturnedFromCutscene(int CameraCnt); - // [D] [T] void InitDirectorVariables(void) { @@ -190,13 +188,13 @@ void setCamera(PLAYBACKCAMERA* Change) scr_z = Change->scr_z; gCameraMaxDistance = Change->gCameraMaxDistance; - + gCameraAngle = Change->gCameraAngle; cameraview = Change->cameraview & 7; tracking_car = (Change->cameraview & 8) >> 3; - if(cameraview != 0 && cameraview != 2) + if (cameraview != 0 && cameraview != 2) { player[0].cameraPos.vx = Change->position.vx; player[0].cameraPos.vy = Change->position.vy; @@ -372,17 +370,17 @@ int CheckCameraChange(int CameraCnt) SetCameraReturnedFromCutscene(CameraCnt); } - if(CameraCnt != -1) + if (CameraCnt != -1) { DoAutoDirect(); - if(gStopPadReads == 0 && InvalidCamera(player[0].cameraCarId) != 0) + if (gStopPadReads == 0 && InvalidCamera(player[0].cameraCarId) != 0) { RecordCamera(CameraCnt); return 0; } } - + if (NextChange->FrameCnt != CameraCnt) { if (CameraCnt < NextChange->FrameCnt) @@ -415,7 +413,6 @@ int CheckCameraChange(int CameraCnt) return 1; } - // [D] [T] void SetPlaybackCamera(PLAYBACKCAMERA* camera) { @@ -424,9 +421,9 @@ void SetPlaybackCamera(PLAYBACKCAMERA* camera) camera_angle.vy = camera->angle.vy; camera_angle.vz = camera->angle.vz; - if(gInGameCutsceneActive == 0) // [A] previously it was gCameraDistance so we don't change it in cutscenes + if (gInGameCutsceneActive == 0) // [A] previously it was gCameraDistance so we don't change it in cutscenes scr_z = camera->scr_z; - + gCameraMaxDistance = camera->gCameraMaxDistance; gCameraAngle = camera->gCameraAngle; cameraview = camera->cameraview & 7; @@ -435,7 +432,7 @@ void SetPlaybackCamera(PLAYBACKCAMERA* camera) CameraChanged = 1; - if(cameraview != 0 && cameraview != 2) + if (cameraview != 0 && cameraview != 2) { player[0].cameraPos.vx = camera->position.vx; player[0].cameraPos.vy = camera->position.vy; @@ -445,7 +442,6 @@ void SetPlaybackCamera(PLAYBACKCAMERA* camera) player[0].cameraCarId = camera->angle.pad; } - // [D] [T] int IsMovingCamera(PLAYBACKCAMERA* lastcam, PLAYBACKCAMERA* nextcam, int cameracnt) { @@ -475,7 +471,7 @@ int IsMovingCamera(PLAYBACKCAMERA* lastcam, PLAYBACKCAMERA* nextcam, int camerac s = (cameracnt * 2048) / f; t = (RCOS(s*3) - RCOS(s) * 9 >> 4) + 2048; - + xdist = FixHalfRound((nextcam->position.vx - lastcam->position.vx) * 64 * t, 18); ydist = FixHalfRound((nextcam->position.vy - lastcam->position.vy) * 64 * t, 18); zdist = FixHalfRound((nextcam->position.vz - lastcam->position.vz) * 64 * t, 18); @@ -517,7 +513,6 @@ int IsMovingCamera(PLAYBACKCAMERA* lastcam, PLAYBACKCAMERA* nextcam, int camerac return 1; } - // [D] [T] void CameraBar(int CameraCnt) { @@ -646,7 +641,7 @@ void CameraBar(int CameraCnt) bar_x += 32; } - switch(PlaybackCamera[idx].cameraview & 7) + switch (PlaybackCamera[idx].cameraview & 7) { case 1: { @@ -676,7 +671,7 @@ void CameraBar(int CameraCnt) green = 255; blue = 255; } - + break; } case 5: @@ -699,7 +694,7 @@ void CameraBar(int CameraCnt) camera->r2 = (red >> 2); camera->g2 = (green >> 2); camera->b2 = (blue >> 2); - + camera->r0 = red; camera->g0 = green; camera->b0 = blue; @@ -707,7 +702,7 @@ void CameraBar(int CameraCnt) camera->r3 = (red >> 2); camera->g3 = (green >> 2); camera->b3 = (blue >> 2); - + idx = PlaybackCamera[idx].next; if (min_x > 290) @@ -742,7 +737,6 @@ void CameraBar(int CameraCnt) } while (idx < MAX_REPLAY_CAMERAS); } - // [D] [T] PLAYBACKCAMERA* FindFreeCamera(void) { @@ -789,7 +783,6 @@ void DeleteAllCameras(void) LastChange->next = -2; } - // [D] [T] void ShowIcons(unsigned char* menu, int selected, int x_offset) { @@ -968,7 +961,7 @@ void ShowReplayMenu(void) { ShowIcons(menu6, 99, MenuOffset); } - } + } } if (DirectorMenuActive == 3) @@ -1018,8 +1011,8 @@ void ShowReplayOptions(void) // [D] [T] void ControlReplay(void) { - static int debounce; // offset 0x70 - static int first_time; // offset 0x74 + static int debounce; + static int first_time; PLAYBACKCAMERA* pCam; GAMEMODE new_mode; @@ -1030,7 +1023,7 @@ void ControlReplay(void) int move; move = 0; - + if (gInGameCutsceneActive) return; @@ -1048,7 +1041,7 @@ void ControlReplay(void) time_taken = vblcounter; return; } - + //pauseflag = 0; return; } @@ -1103,7 +1096,7 @@ void ControlReplay(void) { move = 0; speed = 1; - + if (padd & MPAD_R1) speed = 8; @@ -1199,14 +1192,14 @@ void ControlReplay(void) { EVENT* ev; ev = events.track[-2 - cameraCar]; - + basePos.vx = ev->position.vx; basePos.vz = ev->position.vz; } dx = basePos.vx - player[0].cameraPos.vx; dz = basePos.vz - player[0].cameraPos.vz; - + old_camera.vx = player[0].cameraPos.vx; old_camera.vz = player[0].cameraPos.vz; old_camera.vy = player[0].cameraPos.vy; @@ -1245,7 +1238,7 @@ void ControlReplay(void) if (tracking_car == 0) { d = z; - + z = x; x = -d; } @@ -1257,7 +1250,7 @@ void ControlReplay(void) tmpPos.vy = -player[0].cameraPos.vy; tmpPos.vz = player[0].cameraPos.vz; - if ( dist(player[0].spoolXZ, &player[0].cameraPos) < 18433) + if (dist(player[0].spoolXZ, &player[0].cameraPos) < 18433) { if (QuickBuildingCollisionCheck(&tmpPos, dir, 10, 10, 10) != 0) { @@ -1271,15 +1264,15 @@ void ControlReplay(void) player[0].cameraPos.vx = old_camera.vx; player[0].cameraPos.vz = old_camera.vz; } - + if (padd & MPAD_L1) player[0].cameraPos.vy -= speed * 16; if (padd & MPAD_L2) - player[0].cameraPos.vy += speed * 16; + player[0].cameraPos.vy += speed * 16; height = -MapHeight(&tmpPos); - + if (player[0].cameraPos.vy > height - MIN_TRIPOD_CAMERA_HEIGHT) player[0].cameraPos.vy = height - MIN_TRIPOD_CAMERA_HEIGHT; @@ -1303,12 +1296,12 @@ void ControlReplay(void) else if (EditMode == 4) { // Tripod camera angle - - if(padd & MPAD_D_UP) + + if (padd & MPAD_D_UP) { camera_angle.vx += speed * 4; - if((camera_angle.vx - 300U & 0xffff) < 1749) + if ((camera_angle.vx - 300U & 0xffff) < 1749) camera_angle.vx = 300; } @@ -1316,7 +1309,7 @@ void ControlReplay(void) { camera_angle.vx -= speed * 4; - if((camera_angle.vx - 0x800U & 0xffff) < 1853) + if ((camera_angle.vx - 0x800U & 0xffff) < 1853) camera_angle.vx = 3900; } @@ -1332,7 +1325,7 @@ void ControlReplay(void) } else if (EditMode == 5) { - if(padd & MPAD_D_UP) + if (padd & MPAD_D_UP) { scr_z += speed * 4; @@ -1343,7 +1336,7 @@ void ControlReplay(void) if (padd & MPAD_D_DOWN) { scr_z -= speed * 4; - + if (scr_z < 256) scr_z = 256; } @@ -1355,9 +1348,9 @@ void ControlReplay(void) { CursorX++; - if(CameraCnt < ReplayParameterPtr->RecordingEnd || DirectorMenuActive != 1 || CursorX != 5) + if (CameraCnt < ReplayParameterPtr->RecordingEnd || DirectorMenuActive != 1 || CursorX != 5) { - if(FindFreeCamera() == NULL && DirectorMenuActive == 1 && CursorX == 5) + if (FindFreeCamera() == NULL && DirectorMenuActive == 1 && CursorX == 5) { CursorX = 6; } @@ -1418,7 +1411,7 @@ void ControlReplay(void) DirectorMenuActive = 0; return; } - + first_time = 1; DirectorMenuActive = 0; return; @@ -1482,7 +1475,7 @@ void ControlReplay(void) vblcounter = 0; break; } - + first_time = 0; CursorY = 0; ReplayContinue = 0; @@ -1566,7 +1559,7 @@ void ControlReplay(void) ReplayContinue = 0; break; } - + if (frame_advance_count == 0) { first_time = 0; @@ -1576,12 +1569,12 @@ void ControlReplay(void) ReplayContinue = 1; break; } - + first_time = 0; CursorY = 0; ReplayContinue = 0; frame_advance_count = frame_advance_count + -1; - + break; case 4: new_mode = GAMEMODE_DIRECTOR; @@ -1592,10 +1585,10 @@ void ControlReplay(void) ReplayContinue = 0; break; } - + EndGame(new_mode); PlayMode = 0; - + break; case 5: if (ReplayParameterPtr->RecordingEnd <= CameraCnt) @@ -1667,14 +1660,14 @@ void ControlReplay(void) // force pause NoPlayerControl = 0; pauseflag = 0; - + EnablePause((PAUSEMODE)gMissionCompletionState); pauseflag = 1; NoPlayerControl = 1; PlayMode = 0; quick_replay = 1; - + break; default: first_time = 0; @@ -1719,11 +1712,11 @@ void ControlReplay(void) { DirectorMenuActive = 4; gCameraAngle = 2048; - + gCameraDistance = 1600; gCameraMaxDistance = 1600; cameraview = 0; - + gCameraOffset.vx = 0; gCameraOffset.vy = 0; gCameraOffset.vz = 0; @@ -1844,7 +1837,7 @@ void ControlReplay(void) case 3: { CursorY = 1; - + if (CursorX == 5) DirectorMenuActive = 2; else if (CursorX == 6 && move == 5) @@ -1852,7 +1845,7 @@ void ControlReplay(void) if (CursorX > 6) CursorX = 6; - + break; } case 4: @@ -1872,7 +1865,7 @@ void ControlReplay(void) if (CursorX > 6) CursorX = 6; - + break; } case 5: @@ -1913,7 +1906,7 @@ void ControlReplay(void) case 9: if (tracking_car != 0) { - if(move == 5) + if (move == 5) { if (cameraview == 1) cameraview = 5; @@ -1923,7 +1916,7 @@ void ControlReplay(void) } else { - if(move == 5) + if (move == 5) { if (EditMode != 0) EditMode = 0; @@ -1931,7 +1924,7 @@ void ControlReplay(void) EditMode = 5; } } - + break; } @@ -2185,7 +2178,7 @@ int InvalidCamera(int car_num) // [A] bug fix of invalid player camera if (CameraCnt < 3) return 0; - + // check if camera is not too far if (cameraview != 2) { @@ -2297,7 +2290,6 @@ int FirstCamera(void) return 1; } - // [D] [T] int dist(VECTOR* pos1, VECTOR* pos2) { @@ -2310,7 +2302,6 @@ int dist(VECTOR* pos1, VECTOR* pos2) return SquareRoot0(dx * dx + dz * dz) << 4; } - // [D] [T] void SetCameraReturnedFromCutscene(int CameraCnt) { @@ -2321,9 +2312,9 @@ void SetCameraReturnedFromCutscene(int CameraCnt) next = &PlaybackCamera[0]; // how the fuck I'm supposed to untangle this logic? - while (NextChange = next, - count < MAX_REPLAY_CAMERAS && - (NextChange = &PlaybackCamera[count], CameraCnt < NextChange->FrameCnt || NextChange->next != 254 && + while (NextChange = next, + count < MAX_REPLAY_CAMERAS && + (NextChange = &PlaybackCamera[count], CameraCnt < NextChange->FrameCnt || NextChange->next != 254 && (next = &PlaybackCamera[NextChange->next], next->FrameCnt <= CameraCnt))) { count++; @@ -2334,8 +2325,3 @@ void SetCameraReturnedFromCutscene(int CameraCnt) SetPlaybackCamera(NextChange); FindNextChange(CameraCnt + 1); } - - - - - diff --git a/src_rebuild/Game/C/director.h b/src_rebuild/Game/C/director.h index 4432dae0e..951ed2a72 100644 --- a/src_rebuild/Game/C/director.h +++ b/src_rebuild/Game/C/director.h @@ -37,8 +37,8 @@ extern int InvalidCamera(int car_num); // 0x0003E53C extern void FindNextChange(int CameraCnt); // 0x0003E94C extern int CheckCameraChange(int CameraCnt); // 0x0003B794 -extern int dist(VECTOR* pos1, VECTOR* pos2); +extern int dist(VECTOR* pos1, VECTOR* pos2); // 0x0003EB9C extern int IsMovingCamera(PLAYBACKCAMERA* lastcam, PLAYBACKCAMERA* nextcam, int cameracnt); // 0x0003B8C8 -#endif +#endif // DIRECTOR_H diff --git a/src_rebuild/Game/C/dr2roads.c b/src_rebuild/Game/C/dr2roads.c index bade3a62b..c05aa3495 100644 --- a/src_rebuild/Game/C/dr2roads.c +++ b/src_rebuild/Game/C/dr2roads.c @@ -98,7 +98,7 @@ int GetSurfaceRoadInfo(DRIVER2_ROAD_INFO* outRoadInfo, int surfId) ClearMem((char*)outRoadInfo, sizeof(DRIVER2_ROAD_INFO)); outRoadInfo->surfId = surfId; - if(IS_CURVED_SURFACE(surfId)) + if (IS_CURVED_SURFACE(surfId)) { outRoadInfo->curve = curve = GET_CURVE(surfId); outRoadInfo->ConnectIdx = curve->ConnectIdx; @@ -148,13 +148,13 @@ int GetLaneByPositionOnRoad(DRIVER2_ROAD_INFO* roadInfo, VECTOR* pos) if (lane_count <= lane) lane = lane_count - 1; } - else if(roadInfo->curve) + else if (roadInfo->curve) { dx = pos->vx - roadInfo->curve->Midx; dz = pos->vz - roadInfo->curve->Midz; lane = (SquareRoot0(dx * dx + dz * dz) >> 9) - roadInfo->curve->inside * 2; - + if (lane < 0) lane = 0; @@ -172,7 +172,7 @@ void ProcessStraightsDriver2Lump(char *lump_file, int lump_size) Driver2StraightsPtr = (DRIVER2_STRAIGHT *)(lump_file + 4); // [A] patch Chicago & Vegas roads - if (GameLevel == 0 && gDisableChicagoBridges) + if (GameLevel == LEVEL_CHICAGO && gDisableChicagoBridges) { DRIVER2_STRAIGHT* str; int grp, i, j; @@ -181,7 +181,7 @@ void ProcessStraightsDriver2Lump(char *lump_file, int lump_size) for (grp = 0; grp < 3; grp++) { // don't activate those roads in Caine's Compound - if(grp == 0 && gCurrentMissionNumber == 7) + if (grp == 0 && gCurrentMissionNumber == 7) continue; i = 0; @@ -201,7 +201,7 @@ void ProcessStraightsDriver2Lump(char *lump_file, int lump_size) } } } - else if (GameLevel == 2) + else if (GameLevel == LEVEL_VEGAS) { #if ENABLE_GAME_FIXES int i; @@ -250,7 +250,7 @@ void ProcessJunctionsDriver2Lump(char *lump_file, int lump_size, int fix) } // [A] patch Vegas roads - if (GameLevel == 2) + if (GameLevel == LEVEL_VEGAS) { Driver2JunctionsPtr[8244 & 0x1fff].ExitIdx[1] = 348; Driver2JunctionsPtr[8244 & 0x1fff].ExitIdx[3] = 347; @@ -270,7 +270,7 @@ int sdHeightOnPlane(VECTOR *pos, sdPlane *plane) { d = plane->d; - if ((d >> 1 ^ d) & 0x40000000) + if ((d >> 1 ^ d) & 0x40000000) return d ^ 0x40000000; if ((plane->surface & 0xE000) == 0x4000 && plane->b == 0) @@ -312,7 +312,7 @@ short* sdGetBSP(sdNode *node, XYPAIR *pos) node++; else node += node->n.offset; - } + } return (short *)node; } @@ -343,22 +343,22 @@ sdPlane* sdGetCell(VECTOR *pos) cell.x = cellPos.x & 1023; cell.y = cellPos.y & 1023; - buffer = RoadMapDataRegions[(cellPos.x >> 16 & 1) ^ (regions_across / 2 & 1) + + buffer = RoadMapDataRegions[(cellPos.x >> 16 & 1) ^ (regions_across / 2 & 1) + (cellPos.y >> 15 & 2) ^ (regions_down & 2)]; // Alpha 1.6 code, works too; not widely tested yet //buffer = *(short**)((int)RoadMapDataRegions + (cellPos.x >> 14 & 4 ^ cellPos.y >> 13 & 8 ^ sdSelfModifyingCode)); plane = GetSeaPlane(); - + if (*buffer != 2) return &default_plane; - + sdPlane* planeData = (sdPlane*)((char*)buffer + buffer[1]); short* bspData = (short*)((char*)buffer + buffer[2]); sdNode* nodeData = (sdNode*)((char*)buffer + buffer[3]); - - surface = &buffer[(cellPos.x >> 10 & 63) + + + surface = &buffer[(cellPos.x >> 10 & 63) + (cellPos.y >> 10 & 63) * 64 + 4]; // initial surface @@ -370,7 +370,7 @@ sdPlane* sdGetCell(VECTOR *pos) { surface = &bspData[*surface & 0x1fff]; do { - if(-256 - pos->vy > *surface) + if (-256 - pos->vy > *surface) { surface += 2; sdLevel++; @@ -378,7 +378,7 @@ sdPlane* sdGetCell(VECTOR *pos) else break; } while (*surface != -0x8000); // end flag - + surface += 1; } @@ -389,7 +389,7 @@ sdPlane* sdGetCell(VECTOR *pos) // check if it's has BSP properties // basically it determines surface bounds if (*surface & 0x4000) - { + { // get closest surface by BSP lookup BSPSurface = sdGetBSP(&nodeData[*surface & 0x3fff], &cell); @@ -397,7 +397,7 @@ sdPlane* sdGetCell(VECTOR *pos) { sdLevel++; nextLevel = 1; - + BSPSurface = surface + 2; // get to the next node } @@ -407,12 +407,12 @@ sdPlane* sdGetCell(VECTOR *pos) plane = &planeData[*surface]; - if (((int)plane & 3) == 0 && *(int *)plane != -1) + if (((int)plane & 3) == 0 && *(int *)plane != -1) { if (plane->surface - 16U < 16) plane = EventSurface(pos, plane); } - else + else plane = GetSeaPlane(); return plane; @@ -460,15 +460,13 @@ int RoadInCell(VECTOR *pos) #ifndef PSX if (gDemoLevel) - { return RoadInCell_alpha16(pos); - } #endif cellPos.x = pos->vx - 512; cellPos.y = pos->vz - 512; - buffer = RoadMapDataRegions[(cellPos.x >> 16 & 1) ^ (regions_across / 2 & 1) + + buffer = RoadMapDataRegions[(cellPos.x >> 16 & 1) ^ (regions_across / 2 & 1) + (cellPos.y >> 15 & 2) ^ (regions_down & 2)]; if (*buffer == 2) @@ -569,4 +567,4 @@ void FindSurfaceD2(VECTOR *pos, VECTOR *normal, VECTOR *out, sdPlane **plane) normal->vy = (int)pl->b >> 2; normal->vz = (int)pl->c >> 2; } -} \ No newline at end of file +} diff --git a/src_rebuild/Game/C/dr2roads.h b/src_rebuild/Game/C/dr2roads.h index 27bdb39d4..47ce56c02 100644 --- a/src_rebuild/Game/C/dr2roads.h +++ b/src_rebuild/Game/C/dr2roads.h @@ -84,6 +84,6 @@ extern void FindSurfaceD2(VECTOR *pos, VECTOR *normal, VECTOR *out, sdPlane **pl extern int GetSurfaceIndex(VECTOR *pos); // 0x0001380C extern int RoadInCell(VECTOR *pos); // 0x0001322C -extern sdPlane* sdGetCell(VECTOR *pos); +extern sdPlane* sdGetCell(VECTOR *pos); // 0x0001346C -#endif +#endif // DR2ROADS_H diff --git a/src_rebuild/Game/C/draw.c b/src_rebuild/Game/C/draw.c index 1c1ae2229..4d786aee6 100644 --- a/src_rebuild/Game/C/draw.c +++ b/src_rebuild/Game/C/draw.c @@ -55,34 +55,34 @@ int PolySizes[56] = { SVECTOR day_vectors[4] = { - { -3132, 2520, 783, 0 }, - { -3132, 2520, 783, 0 }, - { -2364, 2364, 2364, 0 }, - { -3132, 2520, 783, 0 } + { -3132, 2520, 783, 0 }, + { -3132, 2520, 783, 0 }, + { -2364, 2364, 2364, 0 }, + { -3132, 2520, 783, 0 } }; SVECTOR night_vectors[4] = { - { 3132, 2520, 783, 0 }, - { 3132, 2520, 783, 0 }, - { -2364, 2364, -2364, 0 }, - { 3132, 2520, 783, 0 } + { 3132, 2520, 783, 0 }, + { 3132, 2520, 783, 0 }, + { -2364, 2364, -2364, 0 }, + { 3132, 2520, 783, 0 } }; SVECTOR day_colours[4] = { - { 3200, 3200, 3200, 0 }, - { 3200, 3200, 3200, 0 }, - { 3200, 3200, 3200, 0 }, - { 3200, 3200, 3200, 0 } + { 3200, 3200, 3200, 0 }, + { 3200, 3200, 3200, 0 }, + { 3200, 3200, 3200, 0 }, + { 3200, 3200, 3200, 0 } }; SVECTOR night_colours[4] = { - { 880, 880, 905, 0 }, - { 880, 880, 905, 0 }, - { 880, 880, 905, 0 }, - { 880, 880, 905, 0 } + { 880, 880, 905, 0 }, + { 880, 880, 905, 0 }, + { 880, 880, 905, 0 }, + { 880, 880, 905, 0 } }; void* model_object_ptrs[MAX_DRAWN_BUILDINGS]; @@ -196,7 +196,7 @@ void DrawSprites(PACKED_CELL_OBJECT** sprites, int numFound) } if (gTimeOfDay == TIME_NIGHT) { - if (GameLevel == 0) + if (GameLevel == LEVEL_CHICAGO) lightLevel *= 2; // [A] level bug - Chicago trees lit wrong else lightLevel /= 3; @@ -204,7 +204,7 @@ void DrawSprites(PACKED_CELL_OBJECT** sprites, int numFound) spriteColour = lightLevel << 0x10 | lightLevel << 8 | lightLevel | 0x2c000000; - for (i = 0; i < 3; i++) + for (i = 0; i < 3; i++) { shadowMatrix.m[i][0] = inv_camera_matrix.m[i][2]; shadowMatrix.m[i][1] = -inv_camera_matrix.m[i][0]; @@ -297,9 +297,9 @@ void DrawSprites(PACKED_CELL_OBJECT** sprites, int numFound) #else #define MAX_TREE_SHADOW_DISTANCE 14000 #endif - + if (wetness == 0 && gTimeOfDay != TIME_NIGHT && - (pco->value & 32) == 0 && + (pco->value & 32) == 0 && z < MAX_TREE_SHADOW_DISTANCE && numShadows < 40) { @@ -330,7 +330,7 @@ void SetupPlaneColours(u_int ambient) b = ambient & 255; g = ambient >> 8 & 255; r = ambient >> 16 & 255; - + plotContext.planeColours[1] = (r * 120 >> 7) << 16 | (g * 120 >> 7) << 8 | b * 120 >> 7; plotContext.planeColours[2] = (r * 103 >> 7) << 16 | (g * 103 >> 7) << 8 | b * 103 >> 7; plotContext.planeColours[3] = (r * 13 >> 5) << 16 | (g * 13 >> 5) << 8 | b * 13 >> 5; @@ -363,10 +363,8 @@ void SetupPlaneColours(u_int ambient) plotContext.planeColours[7] = ambient + 0x10101; } - int current_pvs_cell; - // [D] [T] void SetupDrawMapPSX(void) { @@ -448,7 +446,6 @@ void Set_Inv_CameraMatrix(void) gte_SetColorMatrix(&inv_camera_matrix); } - // [D] [T] [A] void CalcObjectRotationMatrices(void) { @@ -488,7 +485,7 @@ int num_cars_drawn = 0; // [D] [T] void DrawAllTheCars(int view) { - static int car_distance[MAX_CARS]; // offset 0x0 + static int car_distance[MAX_CARS]; CAR_DATA* cars_to_draw[MAX_CARS]; int dx, dz; @@ -497,14 +494,14 @@ void DrawAllTheCars(int view) CAR_DATA* cp; int num_cars_to_draw; int spacefree; - + num_cars_drawn = 0; num_cars_to_draw = 0; cp = &car_data[MAX_CARS - 1]; do { - if (cp->controlType != CONTROL_TYPE_NONE && + if (cp->controlType != CONTROL_TYPE_NONE && PositionVisible((VECTOR*)cp->hd.where.t)) { // XZ distance estimation @@ -545,7 +542,7 @@ void DrawAllTheCars(int view) cars_to_draw[i] = cars_to_draw[j]; j--; } - + cars_to_draw[j+1] = cp; car_distance[j+1] = dist; } @@ -566,13 +563,12 @@ void DrawAllTheCars(int view) gForceLowDetailCars = 0; DrawCar(cars_to_draw[i], view); - + spacefree -= 2000; } } } - // [D] [T] u_int normalIndex(SVECTOR* verts, u_int vidx) { @@ -651,7 +647,7 @@ void ConvertPolygonTypes(MODEL* model, _pct* pc) { return; } - + model->tri_verts |= 0x80; srcVerts = GET_MODEL_DATA(SVECTOR, model, vertices); @@ -790,7 +786,7 @@ void PlotBuildingModelSubdivNxN(MODEL* model, int rot, _pct* pc, int n) SVECTOR* srcVerts; int combo; -#if 0//def PSX +#if 0 //def PSX MVERTEX5x5& subdiVerts = *(MVERTEX5x5*)(u_char*)getScratchAddr(0); #else MVERTEX5x5 subdiVerts; @@ -860,7 +856,7 @@ void PlotBuildingModelSubdivNxN(MODEL* model, int rot, _pct* pc, int n) ushort uv0, uv1, uv2, uv3; // [A] special case - if(ptype == 23) + if (ptype == 23) { POLYGT4* pgt4 = (POLYGT4*)polys; uv0 = *(ushort*)&pgt4->uv0; @@ -940,7 +936,6 @@ void PlotBuildingModelSubdivNxN(MODEL* model, int rot, _pct* pc, int n) } } - // [D] [T] int DrawAllBuildings(CELL_OBJECT** objects, int num_buildings) { @@ -952,7 +947,7 @@ int DrawAllBuildings(CELL_OBJECT** objects, int num_buildings) CELL_OBJECT* cop; prev_mat = -1; - + for (i = 0; i < 8; i++) { plotContext.f4colourTable[i * 4 + 0] = plotContext.planeColours[i] | 0x2C000000; @@ -993,7 +988,7 @@ int DrawAllBuildings(CELL_OBJECT** objects, int num_buildings) plotContext.ot = ot + zbias * 4; - if(Z <= DRAW_LOD_DIST_HIGH) + if (Z <= DRAW_LOD_DIST_HIGH) PlotBuildingModelSubdivNxN(model, cop->yang, &plotContext, 1); else PlotBuildingModel(model, cop->yang, &plotContext); @@ -1011,7 +1006,6 @@ int DrawAllBuildings(CELL_OBJECT** objects, int num_buildings) return 0; } - // [D] [T] [A] custom void PlotModelSubdivNxN(MODEL* model, int rot, _pct* pc, int n) { @@ -1024,7 +1018,7 @@ void PlotModelSubdivNxN(MODEL* model, int rot, _pct* pc, int n) SVECTOR* srcVerts; int combo; -#if 0//def PSX +#if 0 //def PSX MVERTEX5x5& subdiVerts = *(MVERTEX5x5*)(u_char*)getScratchAddr(0); #else MVERTEX5x5 subdiVerts; @@ -1195,7 +1189,6 @@ void PlotModelSubdivNxN(MODEL* model, int rot, _pct* pc, int n) } } - // [D] [T] void RenderModel(MODEL* model, MATRIX* matrix, VECTOR* pos, int zBias, int flags, int subdiv, int nrot) { @@ -1231,7 +1224,7 @@ void RenderModel(MODEL* model, MATRIX* matrix, VECTOR* pos, int zBias, int flags plotContext.polySizes = PolySizes; plotContext.flags = flags; plotContext.current = current; - + plotContext.primptr = plotContext.current->primptr; if ((current->primtab - (current->primptr - PRIMTAB_SIZE)) > 56000) @@ -1340,7 +1333,7 @@ void DrawMapPSX(int* comp_val) drawData.current_object_computed_value = (*comp_val & 4095) | drawData.cellLevel << 16; drawData.other_models_found = 0; drawData.anim_objs_found = 0; - + drawData.cellzpos = current_cell_z; drawData.cellxpos = current_cell_x; @@ -1432,7 +1425,7 @@ void DrawMapPSX(int* comp_val) *(MATRIX*)cmat = inv_camera_matrix; } - if ((model->shape_flags & (SHAPE_FLAG_WATER | SHAPE_FLAG_TILE)) || + if ((model->shape_flags & (SHAPE_FLAG_WATER | SHAPE_FLAG_TILE)) || (model->flags2 & (MODEL_FLAG_PATH | MODEL_FLAG_GRASS))) { if (model->flags2 & MODEL_FLAG_ALLEY) @@ -1501,7 +1494,7 @@ void DrawMapPSX(int* comp_val) //PVS_ptr -= pvs_square; dir = (hloop == --vloop) ? 0 : dir; } - }while (i-- > 0); + } while (i-- > 0); #if 0 char tempBuf[512]; @@ -1608,4 +1601,4 @@ void GetDLightLevel(SVECTOR* position, u_int* inOutColor) *inOutColor = MIN(lightB, 255) << 16 | MIN(lightG, 255) << 8 | MIN(lightR, 255) | (*inOutColor & 0xFF000000); } -#endif // DYNAMIC_LIGHTING \ No newline at end of file +#endif // DYNAMIC_LIGHTING diff --git a/src_rebuild/Game/C/draw.h b/src_rebuild/Game/C/draw.h index 862974f69..bda4235cb 100644 --- a/src_rebuild/Game/C/draw.h +++ b/src_rebuild/Game/C/draw.h @@ -110,5 +110,4 @@ extern void DrawAllTheCars(int view); // 0x000407D8 extern void RenderModel(MODEL *model, MATRIX *matrix, VECTOR *pos, int zBias, int flags, int subdiv, int nrot); // 0x0004143C - -#endif +#endif // DRAW_H diff --git a/src_rebuild/Game/C/drivinggames.c b/src_rebuild/Game/C/drivinggames.c index 821206391..3d8855b37 100644 --- a/src_rebuild/Game/C/drivinggames.c +++ b/src_rebuild/Game/C/drivinggames.c @@ -35,7 +35,7 @@ struct SMASHED_CONE u_char side : 1; }; -MODEL* gTrailblazerConeModel; +MODEL* gTrailblazerConeModel; SMASHED_CONE smashed_cones[MAX_SMASHED_CONES]; TRAILBLAZER_DATA *gTrailblazerData; @@ -55,18 +55,18 @@ void InitDrivingGames(void) if (NewLevel) gTrailblazerData = NULL; - + gPlayerScore.time = 0; gPlayerScore.items = 0; gPlayerScore.P2time = 0; gPlayerScore.P2items = 0; - if (GameType == GAME_GATERACE || GameType == GAME_TRAILBLAZER) + if (GameType == GAME_GATERACE || GameType == GAME_TRAILBLAZER) { gTrailblazerConeCount = 0; gTrailblazerConeIndex = 0; - if(NewLevel) + if (NewLevel) { gTrailblazerData = (TRAILBLAZER_DATA*)D_MALLOC(sizeof(TRAILBLAZER_DATA) * 100); // [A] use malloc @@ -95,14 +95,13 @@ void InitDrivingGames(void) gTrailblazerPrevConeDelay = 0; } - // [D] [T] int CarConeCollision(VECTOR *pPos, int car) { int model; CDATA2D cd[2]; CAR_DATA* cp1; - + cd[0].x.vx = pPos->vx; cd[0].x.vz = pPos->vz; cd[0].length[0] = 40; @@ -111,7 +110,7 @@ int CarConeCollision(VECTOR *pPos, int car) cp1 = &car_data[car]; - if (cp1->controlType == CONTROL_TYPE_NONE) + if (cp1->controlType == CONTROL_TYPE_NONE) return 0; model = cp1->ap.model; @@ -140,7 +139,7 @@ void SetSmashedCone(int cone, VECTOR *velocity, int player, int side) if (current_smashed_cone > MAX_SMASHED_CONES-1) current_smashed_cone = 0; - + sc->rot_speed = 256; sc->side = side; sc->cone = cone; @@ -152,14 +151,14 @@ void SetSmashedCone(int cone, VECTOR *velocity, int player, int side) if (sc->velocity.vx < 0) sc->velocity.vy = velocity->vx; - else + else sc->velocity.vy = -velocity->vx; if (sc->velocity.vz < 0) sc->velocity.vy += velocity->vz; else sc->velocity.vy -= velocity->vz; - + sc->velocity.vy /= 2; if ((rand() & 1) == 0) @@ -172,9 +171,9 @@ void SetSmashedCone(int cone, VECTOR *velocity, int player, int side) chan = GetFreeChannel(); - if (chan != -1) + if (chan != -1) { - if (NumPlayers > 1 && NoPlayerControl == 0) + if (NumPlayers > 1 && NoPlayerControl == 0) SetPlayerOwnsChannel(chan, player); tbd = &gTrailblazerData[cone]; @@ -182,7 +181,6 @@ void SetSmashedCone(int cone, VECTOR *velocity, int player, int side) } } - // [D] [T] void MoveSmashedCones(void) { @@ -197,7 +195,7 @@ void MoveSmashedCones(void) for (i = 0; i < MAX_SMASHED_CONES; i++) { - if (sc->cone != -1) + if (sc->cone != -1) { tbd = &gTrailblazerData[sc->cone]; @@ -217,7 +215,7 @@ void MoveSmashedCones(void) sc->active = 0; } } - + sc++; } } @@ -233,7 +231,7 @@ void DrawCone(VECTOR *position, int cone) if (PositionVisible(position) == 0 || FrustrumCheck(position, gTrailblazerConeModel->bounding_sphere) == -1) return; - + InitMatrix(matrix); _RotMatrixY(&matrix, gTrailblazerData[cone].rot); @@ -290,20 +288,20 @@ void GetConePos(int cone, VECTOR *pos, int side) pos->vz = tbd->z; pos->pad = tbd->rot; // [A] store cone rotation } - else + else { radius = cone * -4 + 600; x = radius * RCOS(tbd->rot); z = -radius * RSIN(tbd->rot); - if (side == 0) + if (side == 0) { pos->vx = tbd->x - FIXED(x); pos->vy = tbd->y; pos->vz = tbd->z - FIXED(z); } - else + else { pos->vx = tbd->x + FIXED(x); pos->vy = tbd->y; @@ -392,7 +390,7 @@ void HandleDrivingGames(void) int radius; tbd = &gTrailblazerData[cone]; - + radius = (600 - (gTrailblazerConeIndex * 400 + i) / 100) * 4096; sn = RSIN(tbd->rot); @@ -546,6 +544,3 @@ void DrawDrivingGames(void) DrawSmashedCones(); } - - - diff --git a/src_rebuild/Game/C/drivinggames.h b/src_rebuild/Game/C/drivinggames.h index eeaf509ea..4fa639fb8 100644 --- a/src_rebuild/Game/C/drivinggames.h +++ b/src_rebuild/Game/C/drivinggames.h @@ -10,5 +10,4 @@ extern void DrawDrivingGames(); // 0x000438DC extern void MoveSmashedCones(); // 0x00043CE0 extern void DrawSmashedCones(); // 0x00044168 - -#endif +#endif // DRIVINGGAMES_H diff --git a/src_rebuild/Game/C/envsound.c b/src_rebuild/Game/C/envsound.c index 5fd469bed..c31414dd6 100644 --- a/src_rebuild/Game/C/envsound.c +++ b/src_rebuild/Game/C/envsound.c @@ -8,7 +8,7 @@ void AddEnvSounds(int level, int time) if (time == 3) level += 4; - switch (level) + switch (level) { case 0: // Chicago Day AddEnvSnd(1, 0, SOUND_BANK_ENVIRONMENT, 2, 0, -225275, 674800, -207350, 657910); @@ -75,8 +75,3 @@ void AddEnvSounds(int level, int time) break; } } - - - - - diff --git a/src_rebuild/Game/C/envsound.h b/src_rebuild/Game/C/envsound.h index ecab3f9bb..328d0b609 100644 --- a/src_rebuild/Game/C/envsound.h +++ b/src_rebuild/Game/C/envsound.h @@ -3,4 +3,4 @@ extern void AddEnvSounds(int level, int time); // 0x00044F60 -#endif +#endif // ENVSOUND_H diff --git a/src_rebuild/Game/C/event.c b/src_rebuild/Game/C/event.c index a063a284b..32c61fc56 100644 --- a/src_rebuild/Game/C/event.c +++ b/src_rebuild/Game/C/event.c @@ -197,7 +197,7 @@ int LiftingBridges[55] = { 0x100, // goose island start // 2 - -312832, -305664, -298496, + -312832, -305664, -298496, 1, 324096, // 3 @@ -227,7 +227,6 @@ int LiftingBridges[55] = { 3, 4137, 27648, 128000 }; - int ChicagoCameraHack[3] = { -208006, 198, 657039 }; @@ -259,273 +258,272 @@ MissionTrain missionTrain[2] = FixedEvent chicagoDoor[3] = { - { - NULL, - { -207616, 0, 659706, 0 }, - 0, - 0, - 80, - 0, - 0, - 800u, - 0u, - 25u, - 50u, - "WRGFLDDOOR" - }, - { - NULL, - { -209152, -512, 668928, 0 }, - 0, - 0, - 64, - 0, - 0, - 2496u, - 4096u, - 25u, - 50u, - "DOOR01" - }, - { - NULL, - { 195264, -3728, 74752, 0 }, - 0, - 0, - 1088, - 0, - 0, - 0u, - 0u, - 0u, - 0u, - "FRAME" - } + { + NULL, + { -207616, 0, 659706, 0 }, + 0, + 0, + 80, + 0, + 0, + 800u, + 0u, + 25u, + 50u, + "WRGFLDDOOR" + }, + { + NULL, + { -209152, -512, 668928, 0 }, + 0, + 0, + 64, + 0, + 0, + 2496u, + 4096u, + 25u, + 50u, + "DOOR01" + }, + { + NULL, + { 195264, -3728, 74752, 0 }, + 0, + 0, + 1088, + 0, + 0, + 0u, + 0u, + 0u, + 0u, + "FRAME" + } }; FixedEvent havanaFixed[3] = { - { - NULL, - { -183296, -273, -41720, 0 }, - 0, - 0, - 64, - 0, - 0, - 800, - 0, - 25, - 50, - "DOOR" - }, - { - NULL, - { -455168, 1529, -125440, 0 }, - 0, - 0, - 1536, - 0, - 0, - 0u, - 0u, - 0u, - 0u, - "LIFT_SHAFT" - }, - { - NULL, - { -487936, 0, -136689, 0 }, - 0, - 0, - 80, - 0, - 0, - 1152u, - 0u, - 10u, - 20u, - "BASEDOOR" - } + { + NULL, + { -183296, -273, -41720, 0 }, + 0, + 0, + 64, + 0, + 0, + 800, + 0, + 25, + 50, + "DOOR" + }, + { + NULL, + { -455168, 1529, -125440, 0 }, + 0, + 0, + 1536, + 0, + 0, + 0u, + 0u, + 0u, + 0u, + "LIFT_SHAFT" + }, + { + NULL, + { -487936, 0, -136689, 0 }, + 0, + 0, + 80, + 0, + 0, + 1152u, + 0u, + 10u, + 20u, + "BASEDOOR" + } }; FixedEvent vegasDoor[5] = { - { - NULL, - { -11851, 0, 844163, 0 }, - 0, - 0, - 80, - 0, - 0, - 1700u, - 3072u, - 25u, - 50u, - "DOOR" - }, - { - NULL, - { -106242, -239, -216960, 0 }, - 0, - 0, - 96, - 0, - 0, - 800u, - 0u, - 25u, - 50u, - "DOOR01" - }, - { - NULL, - { 63058, -231, 501184, 0 }, - 0, - 0, - 96, - 0, - 0, - 3200u, - 4096u, - 25u, - 50u, - "DOOR02" - }, - { - NULL, - { -159356, -176, 647024, 0 }, - 0, - 0, - 64, - 0, - 0, - 3200u, - 4096u, - 25u, - 50u, - "DOOR03" - }, - { - NULL, - { 123936, -170, 4928, 0 }, - 0, - 0, - 80, - 0, - 0, - 3200u, - 4096u, - 25u, - 50u, - "GATE01" - } + { + NULL, + { -11851, 0, 844163, 0 }, + 0, + 0, + 80, + 0, + 0, + 1700u, + 3072u, + 25u, + 50u, + "DOOR" + }, + { + NULL, + { -106242, -239, -216960, 0 }, + 0, + 0, + 96, + 0, + 0, + 800u, + 0u, + 25u, + 50u, + "DOOR01" + }, + { + NULL, + { 63058, -231, 501184, 0 }, + 0, + 0, + 96, + 0, + 0, + 3200u, + 4096u, + 25u, + 50u, + "DOOR02" + }, + { + NULL, + { -159356, -176, 647024, 0 }, + 0, + 0, + 64, + 0, + 0, + 3200u, + 4096u, + 25u, + 50u, + "DOOR03" + }, + { + NULL, + { 123936, -170, 4928, 0 }, + 0, + 0, + 80, + 0, + 0, + 3200u, + 4096u, + 25u, + 50u, + "GATE01" + } }; - FixedEvent rioDoor[6] = { - { - NULL, - { -123328, -177, -254720, 0 }, - 0, - 0, - 96, - 0, - 0, - 3200u, - 4096u, - 25u, - 50u, - "DOOR1" - }, - { - NULL, - { -125248, -17, -256208, 0 }, - 0, - 0, - 80, - 0, - 0, - 1600u, - 0u, - 25u, - 50u, - "DOOR2" - }, - { - NULL, - { -274000, -17, -321408, 0 }, - 0, - 0, - 80, - 0, - 0, - 1748u, - 3072u, - 25u, - 50u, - "GATE01" - }, - { - NULL, - { -274000, -17, -322432, 0 }, - 0, - 0, - 80, - 0, + { + NULL, + { -123328, -177, -254720, 0 }, + 0, + 0, + 96, + 0, + 0, + 3200u, + 4096u, + 25u, + 50u, + "DOOR1" + }, + { + NULL, + { -125248, -17, -256208, 0 }, + 0, + 0, + 80, + 0, + 0, + 1600u, + 0u, + 25u, + 50u, + "DOOR2" + }, + { + NULL, + { -274000, -17, -321408, 0 }, + 0, + 0, + 80, + 0, + 0, + 1748u, + 3072u, + 25u, + 50u, + "GATE01" + }, + { + NULL, + { -274000, -17, -322432, 0 }, + 0, + 0, + 80, + 0, + 0, + 2348u, + 1024u, + 25u, + 50u, + "GATE01" + }, + { + NULL, + { -40432, -17, 383328, 0 }, + 0, + 0, + 80, + 0, + 0, + 700u, + 2048u, + 25u, + 50u, + "GATE03" + }, + { + NULL, + { -39424, -17, 383328, 0 }, + 0, + 0, + 80, + 0, + 0, + 900u, + 0u, + 25u, + 50u, + "GATE03" + } +}; + +Helicopter HelicopterData = +{ + 400, 0, - 2348u, - 1024u, - 25u, - 50u, - "GATE01" - }, - { - NULL, - { -40432, -17, 383328, 0 }, 0, 0, - 80, 0, 0, - 700u, - 2048u, - 25u, - 50u, - "GATE03" - }, - { - NULL, - { -39424, -17, 383328, 0 }, 0, + { { 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u }, 0u, 0u, 0, 0 }, 0, - 80, 0, 0, - 900u, - 0u, - 25u, - 50u, - "GATE03" - } -}; - -Helicopter HelicopterData = -{ - 400, - 0, - 0, - 0, - 0, - 0, - 0, - { { 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u }, 0u, 0u, 0, 0 }, - 0, - 0, - 0, - 0 + 0 }; static Foam foam; @@ -636,19 +634,17 @@ int GetVisValue(int index, int zDir) return pos.vx; } - - static unsigned short* xVis; static unsigned short* zVis; // [D] [T] void VisibilityLists(VisType type, int i) { - static unsigned short xList[128]; // offset 0x0 - static unsigned short zList[128]; // offset 0x100 - static unsigned short(*firstX[2]); // offset 0x0 - static unsigned short(*firstZ[2]); // offset 0x8 - static int count; // offset 0x10 + static unsigned short xList[128]; + static unsigned short zList[128]; + static unsigned short(*firstX[2]); + static unsigned short(*firstZ[2]); + static int count; static unsigned short(*list[2]) = { xList, zList @@ -802,7 +798,6 @@ void SetElTrainRotation(EVENT* ev) ev->rotation += 2048; } - // [D] [T] void InitTrain(EVENT* ev, int count, int type) { @@ -825,7 +820,7 @@ void InitTrain(EVENT* ev, int count, int type) } else if (type == 1) { - if(ev->data == VegasMonorailData) // [A] + if (ev->data == VegasMonorailData) // [A] { length = 1850; height = -1100; @@ -922,7 +917,7 @@ int OnBoat(VECTOR* pos, EVENT* ev, int* dist) int halfBoatLength; int halfBoatWidth; - if (GameLevel == 1) + if (GameLevel == LEVEL_HAVANA) { halfBoatWidth = 853; halfBoatLength = 2431; @@ -992,7 +987,7 @@ void SetUpEvents(int full) evt = event; cEvents = 0; // TODO: use D_MALLOC for each event? - if (GameLevel == 0) + if (GameLevel == LEVEL_CHICAGO) { int count; int cBridges; @@ -1178,7 +1173,7 @@ void SetUpEvents(int full) cEvents += 7; } - else if (GameLevel == 1) + else if (GameLevel == LEVEL_HAVANA) { evt = event; @@ -1240,7 +1235,7 @@ void SetUpEvents(int full) foam.model = FindModelPtrWithName("FOAM"); } } - else if (GameLevel == 2) + else if (GameLevel == LEVEL_VEGAS) { int cCarriages; @@ -1299,7 +1294,7 @@ void SetUpEvents(int full) trainModel = FindModelIdxWithName("MONORAIL"); evt = &event[cEvents]; - + // [A] add monorail. More than two for some unknown reason are not visible cCarriages = 2; @@ -1370,7 +1365,7 @@ void SetUpEvents(int full) cEvents += 3; } } - else if (GameLevel == 3) + else if (GameLevel == LEVEL_RIO) { evt = event; @@ -1558,7 +1553,7 @@ void SetCamera(EVENT* ev) offset = boatOffset; - if (GameLevel == 1) + if (GameLevel == LEVEL_HAVANA) pivot.vy = 111; else pivot.vy = 256; @@ -1817,7 +1812,7 @@ void StepFromToEvent(EVENT* ev) { SetSpecialCamera(SPECIAL_CAMERA_RESET, 0); - if(direction == 16384) + if (direction == 16384) { SetMSoundVar(3, NULL); } @@ -1825,7 +1820,6 @@ void StepFromToEvent(EVENT* ev) } } - // [D] [T] void StepPathEvent(EVENT* ev) { @@ -1853,9 +1847,9 @@ void StepPathEvent(EVENT* ev) do { - if(!(ev->data[2] & 0x10000)) + if (!(ev->data[2] & 0x10000)) NextNode(ev); - + flags = ev->flags; ev = ev->next; @@ -1883,13 +1877,12 @@ void StepPathEvent(EVENT* ev) if (speed == 0 && (flags & 0x400) == 0) return; - // // [A] completely custom code for Luxor Monorail because OG code for handling trains SUCKS!!! - if(ev->data[2] & 0x10000) + if (ev->data[2] & 0x10000) { from = ev->node; to = &from[2]; - + if (flags & 0x8000) curr = &ev->position.vz; else @@ -1926,7 +1919,7 @@ void StepPathEvent(EVENT* ev) int dist = (*to - *curr) * dir; - if(dist < (-dir)*2048 && ev->flags & 0x400) + if (dist < (-dir)*2048 && ev->flags & 0x400) { EVENT* _evit = ev; @@ -1950,15 +1943,15 @@ void StepPathEvent(EVENT* ev) _evit = _evit->next; } while (_evit); - + } return; } - + from = ev->node; to = &from[2]; - + if (*from == PATH_NODE_STATION) { station = EVENT_LEAVING; @@ -2152,7 +2145,7 @@ void StepPathEvent(EVENT* ev) *curr += speed * dir; int dist = (*to - *curr) * dir; - + if (station == EVENT_NO_STATION && (ev->flags & 0x7000)) { if (dist < 2048) @@ -2163,7 +2156,7 @@ void StepPathEvent(EVENT* ev) ev->flags |= 0x1000; } } - + return; } @@ -2174,8 +2167,8 @@ void StepPathEvent(EVENT* ev) // [A] preserve direction flag or train will get stuck // i might have been decompiled it wrong but now it works dir = ev->flags & 0x400; - - InitTrain(ev, 0, GameLevel == 0 ? 0 : 1); + + InitTrain(ev, 0, (GameLevel == LEVEL_CHICAGO) ? 0 : 1); if (dir) ev->flags |= 0x400; @@ -2187,7 +2180,6 @@ void StepPathEvent(EVENT* ev) } } - // [D] [T] int GetBridgeRotation(int timer) { @@ -2220,7 +2212,7 @@ void StepHelicopter(EVENT* ev) int vx, vz; XZPAIR vel; VECTOR pos; - VECTOR drift = { 2,3,2 }; + VECTOR drift = { 2, 3, 2 }; if (ev->timer >= 0) { @@ -2677,6 +2669,7 @@ void StepEvents(void) evt->flags |= 0x4; } + z++; } } @@ -2721,8 +2714,8 @@ void DrawFerrisWheel(MATRIX* matrix, VECTOR* pos) return; VECTOR spoke[2] = { - {0, 0, 2677}, - {0, 2677, 0} + { 0, 0, 2677 }, + { 0, 2677, 0 } }; rotation = 0; @@ -2769,11 +2762,11 @@ void DrawRotor(VECTOR pos, MATRIX* matrix) int z; SVECTOR v[5] = { - {0,-470,-120}, - {1024,0,0 }, - {0,0,1024 }, - {0,0,0}, - {0,0,0}, + { 0, -470, -120 }, + { 1024, 0, 0 }, + { 0, 0, 1024 }, + { 0, 0, 0 }, + { 0, 0, 0 } }; InitMatrix(localMat); @@ -2872,8 +2865,8 @@ void DrawRotor(VECTOR pos, MATRIX* matrix) // [D] [T] void DrawEvents(int camera) { - static EVENT* nearestTrain; // offset 0x28 - static int distanceFromNearestTrain; // offset 0x2c + static EVENT* nearestTrain; + static int distanceFromNearestTrain; int reflection; int i; @@ -3216,7 +3209,7 @@ sdPlane* EventSurface(VECTOR* pos, sdPlane* plane) ev = &event[i]; // chicago bridge plane - if (GameLevel == 0) + if (GameLevel == LEVEL_CHICAGO) { int dist; int end; @@ -3271,14 +3264,14 @@ sdPlane* EventSurface(VECTOR* pos, sdPlane* plane) plane->d ^= 0x40000000; } - else if (GameLevel == 1 || GameLevel == 3) + else if (GameLevel == LEVEL_HAVANA || GameLevel == LEVEL_RIO) { // make secret base solid due to we use surface Ids // Havana 3D occlusion was made simpler in Rev 1.1 // this change was very sneaky if (i > 8) return plane; - + // Havana and Rio boats floating if (ev->flags & 0x800) { @@ -3288,7 +3281,7 @@ sdPlane* EventSurface(VECTOR* pos, sdPlane* plane) if (OnBoat(pos, ev, &dist) == 0) return GetSeaPlane(); - if (GameLevel == 3) + if (GameLevel == LEVEL_RIO) height = 256; else height = 200; @@ -3301,7 +3294,7 @@ sdPlane* EventSurface(VECTOR* pos, sdPlane* plane) offset = dist * -4096 + cos * -3328; - if (GameLevel == 3 && offset > 0) + if (GameLevel == LEVEL_RIO && offset > 0) { int sin2; d = 160 - ev->data[1]; @@ -3403,7 +3396,7 @@ VECTOR* TriggerEvent(int i) return NULL; } - if (GameLevel >= 2 && i > 0 && i < 4) // Vegas and Rio detonators + if ((GameLevel == LEVEL_VEGAS || GameLevel == LEVEL_RIO) && i > 0 && i < 4) // Vegas and Rio detonators { if (stage[i] == 0) { @@ -3420,7 +3413,7 @@ VECTOR* TriggerEvent(int i) } else { - if (GameLevel == 0) + if (GameLevel == LEVEL_CHICAGO) { switch (i) { @@ -3429,9 +3422,9 @@ VECTOR* TriggerEvent(int i) if (stage[i] == 0) { int offset, nodePos; - + ev = missionTrain[i].engine; - + MakeEventTrackable(ev); ev->flags |= 0x180; @@ -3464,7 +3457,7 @@ VECTOR* TriggerEvent(int i) ev->node = missionTrain[i].node; ev->data = &missionTrain[i].cornerSpeed; ev->timer = 0; - + ev->flags &= ~0x7000; ev->flags |= 0x3000; @@ -3477,9 +3470,9 @@ VECTOR* TriggerEvent(int i) else { ev = missionTrain[i].engine; - + pos = &ev->position; - + if (ev->timer != 0) ev->timer = 1; @@ -3500,7 +3493,7 @@ VECTOR* TriggerEvent(int i) ev->timer = 2600; else ev->timer = 1000; - + ev++; } @@ -3524,7 +3517,7 @@ VECTOR* TriggerEvent(int i) TriggerDoor(&chicagoDoor[i - 5], &stage[i], 1); } } - else if (GameLevel == 1) + else if (GameLevel == LEVEL_HAVANA) { switch (i) { @@ -3534,16 +3527,16 @@ VECTOR* TriggerEvent(int i) case 1: event->position.vx = HavanaFerryData[9]; event->position.vz = HavanaFerryData[10]; - + event->timer = 1; - + event->node = &HavanaFerryData[10]; event->data = &HavanaFerryData[6]; // [A] reset Ferry angles event->data[1] = RSIN(CameraCnt * 32) >> 9; event->data[2] = RCOS(CameraCnt * 16) + 4096 >> 7; - + break; case 2: TriggerDoor(&havanaFixed[0], &stage[i], 1); @@ -3566,7 +3559,7 @@ VECTOR* TriggerEvent(int i) events.cameraEvent = &event[1]; } } - else if (GameLevel == 2) + else if (GameLevel == LEVEL_VEGAS) { switch (i) { @@ -3578,9 +3571,9 @@ VECTOR* TriggerEvent(int i) ev = &event[loop]; ev->data = VegasTrainData; - + InitTrain(ev, loop, 1); - + ev->flags |= 0x200; if (loop > 1) @@ -3610,7 +3603,7 @@ VECTOR* TriggerEvent(int i) SetMSoundVar(5, NULL); } } - else if (GameLevel == 3) + else if (GameLevel == LEVEL_RIO) { switch (i) { @@ -3646,10 +3639,10 @@ VECTOR* TriggerEvent(int i) case 8: // open gate to secret car PingOutAllSpecialCivCars(); - + TriggerDoor(&rioDoor[4], &stage[i], 0); TriggerDoor(&rioDoor[5], &stage[i], 0); - + events.cameraEvent = (EVENT*)&rioDoor[4]; } } @@ -3672,7 +3665,7 @@ void OffsetTarget(VECTOR* target) //[D] [T] void SetSpecialCamera(SpecialCamera type, int change) { - static int rememberCamera[3]; // offset 0x230 + static int rememberCamera[3]; static short boatCamera[6] = { -1000, 2100, 6000, -5000, 3584, -5000 @@ -3717,11 +3710,11 @@ void SetSpecialCamera(SpecialCamera type, int change) rememberCamera[1] = camera_angle.vy; rememberCamera[2] = camera_position.vz; - if (GameLevel == 0) + if (GameLevel == LEVEL_CHICAGO) { hackCamera = &ChicagoCameraHack[0]; } - else if (GameLevel == 1) + else if (GameLevel == LEVEL_HAVANA) { if (gCurrentMissionNumber == 15) { @@ -3746,7 +3739,7 @@ void SetSpecialCamera(SpecialCamera type, int change) } } } - else if (GameLevel == 2) + else if (GameLevel == LEVEL_VEGAS) { hackCamera = &VegasCameraHack[0]; @@ -3774,7 +3767,7 @@ void SetSpecialCamera(SpecialCamera type, int change) hackCamera += 3; } } - else if (GameLevel == 3) + else if (GameLevel == LEVEL_RIO) { if (gCurrentMissionNumber == 35) { @@ -3815,7 +3808,7 @@ void SetSpecialCamera(SpecialCamera type, int change) { Havana3DLevelDraw = -1; camera_change = 1; - + VisibilityLists(VIS_SORT, 0); } } @@ -3834,8 +3827,8 @@ void ScreenShake(int count, SVECTOR* ang) // [D] [T] int DetonatorTimer(void) { - static SVECTOR rememberCameraAngle; // offset 0x30 - static int count = 0; // offset 0x38 + static SVECTOR rememberCameraAngle; + static int count = 0; int cnt; EVENT* ev; @@ -3869,9 +3862,9 @@ int DetonatorTimer(void) AddExplosion(pos, HEY_MOMMA); rememberCameraAngle = camera_angle; - + Mission.timer[0].flags &= ~TIMER_FLAG_BOMB_COUNTDOWN; - + SetMissionComplete(); } else @@ -3946,7 +3939,7 @@ int DetonatorTimer(void) else if (detonator.timer == 160) { - if (GameLevel == 3) + if (GameLevel == LEVEL_RIO) { event->flags &= ~0x1; event->flags |= 0x20; @@ -3982,7 +3975,7 @@ int DetonatorTimer(void) pos.vy = ev->position.vy; pos.vz = ev->position.vz; - if (GameLevel == 3) + if (GameLevel == LEVEL_RIO) { pos.vx -= boatOffset.vx; pos.vy -= boatOffset.vy; @@ -4011,7 +4004,7 @@ void MultiCarEvent(MS_TARGET* target) // [A] validate if (target->type != Target_MultiCar) return; - + firstEvent = multiCar.event + multiCar.count; for (i = 0; i < 5; i++) @@ -4020,16 +4013,16 @@ void MultiCarEvent(MS_TARGET* target) if (mcd->x == 0x80000000) break; - + n = (multiCar.event - event) + multiCar.count; ev = event + n; ev->position.vx = mcd->x; ev->position.vz = mcd->z; - + ev->position.vy = -312; // MapHeight may not be available due to region is not yet loaded - + ev->rotation = mcd->rot; VisibilityLists(VIS_ADD, n); @@ -4039,4 +4032,4 @@ void MultiCarEvent(MS_TARGET* target) //firstEvent->next = first; // [A] bug fix multiCar.event[multiCar.count - 1].next = first; -} \ No newline at end of file +} diff --git a/src_rebuild/Game/C/event.h b/src_rebuild/Game/C/event.h index 6c1dc54a6..5a4c24bfd 100644 --- a/src_rebuild/Game/C/event.h +++ b/src_rebuild/Game/C/event.h @@ -41,7 +41,7 @@ extern int carsOnBoat; extern void InitEvents(); // 0x0004BBD4 extern void SetUpEvents(int full); // 0x00046258 -extern VECTOR* TriggerEvent(int i); +extern VECTOR* TriggerEvent(int i); // 0x0004AA78 extern void EventCollisions(CAR_DATA *cp, int type); // 0x0004BC50 @@ -61,5 +61,4 @@ extern int DetonatorTimer(); // 0x0004B5FC extern void MultiCarEvent(MS_TARGET *target); // 0x0004BAB0 - -#endif +#endif // EVENT_H diff --git a/src_rebuild/Game/C/felony.c b/src_rebuild/Game/C/felony.c index 13c388408..e06c4620b 100644 --- a/src_rebuild/Game/C/felony.c +++ b/src_rebuild/Game/C/felony.c @@ -42,7 +42,6 @@ int FelonyDecreaseTime = 0; int FelonyIncreaseTimer = 0; int FelonyDecreaseTimer = 0; - // [D] [T] void InitFelonyDelayArray(FELONY_DELAY *pFelonyDelay, short *pMaximum, int count) { @@ -61,7 +60,7 @@ void InitFelonyDelayArray(FELONY_DELAY *pFelonyDelay, short *pMaximum, int count // [D] [T] void InitFelonyData(FELONY_DATA *pFelonyData) -{ +{ InitFelonyDelayArray(pFelonyData->occurrenceDelay, initialOccurrenceDelay, numberOf(initialOccurrenceDelay)); InitFelonyDelayArray(pFelonyData->reoccurrenceDelay, initialReccurrenceDelay, numberOf(initialOccurrenceDelay)); @@ -81,7 +80,7 @@ char GetCarDirectionOfTravel(CAR_DATA *cp) direction = GetCarHeading(cp->hd.direction);; - if (cp->hd.wheel_speed < 0) + if (cp->hd.wheel_speed < 0) direction = direction + 2 & 3; return direction; @@ -161,7 +160,7 @@ void NoteFelony(FELONY_DATA *pFelonyData, char type, short scale) *felony += (additionalFelonyPoints * scale >> 12); - if (*felony > FELONY_MAX_VALUE) + if (*felony > FELONY_MAX_VALUE) *felony = FELONY_MAX_VALUE; // KILL PEDESTRIAN FELONY HERE @@ -226,7 +225,6 @@ void NoteFelony(FELONY_DATA *pFelonyData, char type, short scale) } } - // [D] [T] void AdjustFelony(FELONY_DATA *pFelonyData) { @@ -247,7 +245,7 @@ void AdjustFelony(FELONY_DATA *pFelonyData) FelonyDecreaseTimer = 0; } } - else if (CopsCanSeePlayer) + else if (CopsCanSeePlayer) { if (*felony > FELONY_PURSUIT_MIN_VALUE && FelonyIncreaseTimer++ == FelonyIncreaseTime) { @@ -262,7 +260,7 @@ void AdjustFelony(FELONY_DATA *pFelonyData) pFelonyDelay = pFelonyData->reoccurrenceDelay; - while (pFelonyDelay <= &pFelonyData->reoccurrenceDelay[11]) + while (pFelonyDelay <= &pFelonyData->reoccurrenceDelay[11]) { if (pFelonyDelay->current != 0) pFelonyDelay->current--; @@ -289,8 +287,8 @@ void CheckPlayerMiscFelonies(void) CAR_DATA* cp; // Do not register felony if player does not have a car - if (player[0].playerType == 2 || - player[0].playerCarId < 0 || + if (player[0].playerType == 2 || + player[0].playerCarId < 0 || FelonyBar.active == 0) return; @@ -304,7 +302,7 @@ void CheckPlayerMiscFelonies(void) { jn = GET_JUNCTION(surfInd); - if( (IS_CURVED_SURFACE(playerLastRoad) || IS_STRAIGHT_SURFACE(playerLastRoad)) && (jn->flags & 0x1)) + if ((IS_CURVED_SURFACE(playerLastRoad) || IS_STRAIGHT_SURFACE(playerLastRoad)) && (jn->flags & 0x1)) { exitId = 0; i = 0; @@ -327,14 +325,14 @@ void CheckPlayerMiscFelonies(void) playerLastRoad = surfInd; goingWrongWay = false; - if(GetSurfaceRoadInfo(&roadInfo, surfInd)) + if (GetSurfaceRoadInfo(&roadInfo, surfInd)) { int lane; int crd; lane = GetLaneByPositionOnRoad(&roadInfo, carPos); - if(roadInfo.straight) + if (roadInfo.straight) crd = (roadInfo.straight->angle - cp->hd.direction) + 1024U >> 0xb & 1; else crd = NotTravellingAlongCurve(carPos->vx, carPos->vz, cp->hd.direction, roadInfo.curve); @@ -408,7 +406,7 @@ void CheckPlayerMiscFelonies(void) // check the speed limit if (speedLimits[2] == maxSpeed) limit = (maxSpeed * 19) >> 4; - else + else limit = (maxSpeed * 3) >> 1; if (FIXEDH(cp->hd.wheel_speed) > limit) @@ -441,16 +439,16 @@ void CarHitByPlayer(CAR_DATA *victim, int howHard) victim->totalDamage = 0xffff; #endif - if (howHard > 0 && victim->controlType != CONTROL_TYPE_PURSUER_AI) + if (howHard > 0 && victim->controlType != CONTROL_TYPE_PURSUER_AI) { if ((victim->controlFlags & 1) == 0) { - if (howHard < 32) + if (howHard < 32) { NoteFelony(&felonyData, 4, (howHard << 0x17) >> 0x10); return; } - + type = 4; } else @@ -460,15 +458,10 @@ void CarHitByPlayer(CAR_DATA *victim, int howHard) NoteFelony(&felonyData, 5, (howHard << 0x18) >> 0x10); return; } - + type = 5; } NoteFelony(&felonyData, type, 4096); } } - - - - - diff --git a/src_rebuild/Game/C/felony.h b/src_rebuild/Game/C/felony.h index 5dd1c5d86..4876dadb3 100644 --- a/src_rebuild/Game/C/felony.h +++ b/src_rebuild/Game/C/felony.h @@ -23,4 +23,4 @@ extern void CarHitByPlayer(CAR_DATA* victim, int howHard); // 0x0004D2B8 extern void NoteFelony(FELONY_DATA *pFelonyData, char type, short scale); // 0x0004C330 extern void AdjustFelony(FELONY_DATA *pFelonyData); // 0x0004C8B4 -#endif +#endif // FELONY_H diff --git a/src_rebuild/Game/C/fmv_font.h b/src_rebuild/Game/C/fmv_font.h index 442bc4151..0017e81c0 100644 --- a/src_rebuild/Game/C/fmv_font.h +++ b/src_rebuild/Game/C/fmv_font.h @@ -1,468 +1,468 @@ u_char fmvFont[] = { - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00, - 0x00, 0x00, 0x51, 0x46, 0x08, 0x21, 0x5A, 0x6B, 0x63, 0x0C, 0xBD, 0x77, 0xFF, 0x7F, 0x00, 0x00, 0xD6, 0x5A, 0xCD, 0x35, - 0xA5, 0x14, 0xDE, 0x7B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x40, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x66, 0x26, 0x00, 0x68, 0x66, 0x08, 0x00, 0x90, 0x6B, 0x2B, 0x00, - 0x68, 0x66, 0x08, 0x00, 0x62, 0x66, 0x26, 0x00, 0x62, 0x66, 0x06, 0x52, 0xB6, 0x01, 0x00, 0x69, 0x96, 0x66, 0x00, 0x66, - 0x09, 0x00, 0x90, 0x66, 0x00, 0x68, 0x88, 0x16, 0x00, 0x68, 0x08, 0x00, 0x62, 0x86, 0x90, 0x66, 0x06, 0x66, 0x03, 0x66, - 0x00, 0x39, 0x66, 0x01, 0x00, 0x69, 0x66, 0x93, 0x00, 0x52, 0x66, 0x08, 0x00, 0x69, 0x66, 0x93, 0x00, 0x90, 0x6B, 0x93, - 0x00, 0x68, 0x66, 0x26, 0x00, 0x63, 0x83, 0x86, 0x00, 0x69, 0x06, 0x68, 0x08, 0x61, 0x06, 0x66, 0x08, 0x66, 0x00, 0x69, - 0x03, 0x61, 0x09, 0x66, 0x01, 0x61, 0x09, 0x60, 0x66, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6A, 0x06, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x62, 0x06, 0x00, 0x00, 0x00, 0x00, 0xA0, 0x6B, 0x08, 0x00, 0x00, 0x00, 0x00, 0x90, 0x66, 0x96, 0x00, - 0x68, 0x53, 0x16, 0x00, 0x6A, 0x86, 0x56, 0x00, 0x68, 0x55, 0x86, 0x00, 0x6A, 0x16, 0x41, 0x00, 0x62, 0x16, 0x09, 0x6B, - 0x68, 0xA6, 0x00, 0x69, 0x96, 0x66, 0x00, 0x66, 0x01, 0x00, 0x90, 0x66, 0x00, 0x68, 0xB8, 0x96, 0x00, 0x68, 0x08, 0x00, - 0x6A, 0x66, 0x90, 0x66, 0x06, 0x66, 0x06, 0x66, 0x00, 0x6B, 0x68, 0x96, 0x00, 0x69, 0x36, 0x66, 0x00, 0x6B, 0x68, 0x96, - 0x00, 0x69, 0x36, 0x56, 0x00, 0x6A, 0x86, 0x56, 0x00, 0x89, 0x66, 0x49, 0x00, 0x68, 0x88, 0x86, 0x00, 0x69, 0xA6, 0x6B, - 0x09, 0x6A, 0x26, 0x66, 0x28, 0x86, 0x00, 0x60, 0x46, 0x66, 0x00, 0x68, 0x03, 0x63, 0x0A, 0x90, 0x69, 0x86, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x62, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x06, 0x00, 0x00, 0x00, 0x00, 0x90, 0x36, 0x0A, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x66, 0x86, 0x00, 0x68, 0x88, 0x86, 0x00, 0x62, 0x96, 0x66, 0x00, 0x68, 0x88, 0x86, 0x00, - 0x62, 0x26, 0x00, 0x00, 0x62, 0x26, 0x00, 0x66, 0x69, 0x26, 0x00, 0x69, 0x96, 0x66, 0x00, 0x66, 0x09, 0x00, 0x90, 0x66, - 0x00, 0x68, 0x66, 0x06, 0x00, 0x68, 0x08, 0x00, 0x62, 0x66, 0x8A, 0x66, 0x06, 0x66, 0x96, 0x66, 0x00, 0x66, 0x69, 0x96, - 0x00, 0x69, 0x96, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, 0x61, 0x96, 0x66, 0x00, 0x62, 0x16, 0x66, 0x00, 0x90, 0x66, 0x00, - 0x00, 0x68, 0x88, 0x36, 0x00, 0x62, 0x26, 0x66, 0x09, 0x62, 0x96, 0x66, 0x96, 0x86, 0x00, 0x30, 0x16, 0x16, 0x00, 0x62, - 0x96, 0xB6, 0x00, 0x00, 0x64, 0x96, 0x00, 0x90, 0x83, 0x02, 0x00, 0x62, 0x86, 0xA8, 0x00, 0x1A, 0x18, 0x0A, 0x89, 0x68, - 0x06, 0x90, 0x88, 0x01, 0x00, 0x5A, 0x56, 0x09, 0x10, 0x18, 0x98, 0x00, 0x30, 0x66, 0x86, 0x00, 0x68, 0x88, 0x86, 0x00, - 0x62, 0x96, 0x66, 0x00, 0x68, 0x88, 0x86, 0x00, 0x62, 0xA6, 0x00, 0x00, 0x62, 0x26, 0x00, 0x66, 0x69, 0x26, 0x00, 0x69, - 0x96, 0x66, 0x00, 0x66, 0x09, 0x00, 0x90, 0x66, 0x00, 0x68, 0x66, 0x03, 0x00, 0x68, 0x08, 0x00, 0x6A, 0x66, 0xB2, 0x66, - 0x06, 0x66, 0x16, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x96, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x96, 0x66, - 0x00, 0x62, 0x16, 0x88, 0x00, 0x90, 0x66, 0x00, 0x00, 0x68, 0x88, 0x86, 0x00, 0x64, 0x26, 0x66, 0x09, 0x60, 0x86, 0x66, - 0x96, 0x16, 0x00, 0x90, 0x66, 0x96, 0x00, 0x60, 0x66, 0x96, 0x00, 0x00, 0x69, 0x46, 0x00, 0x69, 0x68, 0xA6, 0x00, 0x6A, - 0x86, 0x86, 0x00, 0x6B, 0x68, 0x05, 0x66, 0x68, 0x06, 0x6A, 0x86, 0x86, 0x00, 0x84, 0x36, 0x09, 0x69, 0x53, 0x96, 0x00, - 0x30, 0x66, 0x36, 0x00, 0x68, 0x55, 0x96, 0x00, 0x6A, 0x26, 0x00, 0x00, 0x68, 0x88, 0x86, 0x00, 0x62, 0x86, 0x09, 0x00, - 0x62, 0x86, 0x02, 0x66, 0x09, 0x00, 0x00, 0x69, 0x86, 0x66, 0x00, 0x66, 0x09, 0x00, 0x90, 0x66, 0x00, 0x68, 0x66, 0x09, - 0x00, 0x63, 0x08, 0x00, 0x62, 0x66, 0x69, 0x66, 0x06, 0x66, 0x36, 0x66, 0x00, 0x66, 0x61, 0x96, 0x00, 0x69, 0x96, 0x66, - 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x36, 0x96, 0x00, 0x30, 0x66, 0x09, 0x00, 0x90, 0x66, 0x00, 0x00, 0x68, 0x88, 0x86, - 0x00, 0x60, 0x96, 0x66, 0x02, 0x60, 0x86, 0x66, 0x36, 0x96, 0x00, 0x20, 0x66, 0x46, 0x00, 0x10, 0x66, 0xA6, 0x00, 0x00, - 0x68, 0x03, 0x00, 0x69, 0x61, 0x26, 0x00, 0x62, 0x96, 0x86, 0x00, 0x66, 0x69, 0x06, 0x66, 0x69, 0x06, 0x6A, 0x96, 0x86, - 0x00, 0x90, 0x86, 0x00, 0x69, 0x88, 0x96, 0x00, 0x60, 0x96, 0x66, 0x00, 0x68, 0x65, 0xA3, 0x00, 0x62, 0x26, 0x00, 0x00, - 0x68, 0x88, 0x86, 0x00, 0x62, 0x86, 0x08, 0x00, 0x62, 0x86, 0x01, 0x66, 0x21, 0x02, 0x00, 0x69, 0x36, 0x66, 0x00, 0x66, - 0x09, 0x00, 0x90, 0x66, 0x00, 0x68, 0x66, 0x09, 0x00, 0x68, 0x08, 0x00, 0x62, 0x63, 0x66, 0x63, 0x06, 0x66, 0x63, 0x66, - 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x86, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x56, 0x9B, 0x00, 0xA0, 0x6B, 0xA5, - 0x00, 0x90, 0x66, 0x00, 0x00, 0x68, 0x88, 0x86, 0x00, 0x60, 0x86, 0x66, 0x02, 0x80, 0x66, 0x56, 0x66, 0x26, 0x00, 0x90, - 0x66, 0x06, 0x00, 0x20, 0x66, 0x03, 0x00, 0x00, 0x66, 0x01, 0x00, 0x89, 0x61, 0x26, 0x00, 0x62, 0x96, 0x86, 0x00, 0x66, - 0x69, 0x06, 0x66, 0x69, 0x06, 0x62, 0x96, 0x86, 0x00, 0x90, 0x86, 0x00, 0x69, 0x38, 0x96, 0x00, 0x6A, 0x86, 0x66, 0x0A, - 0x68, 0x88, 0x86, 0x00, 0x62, 0x26, 0x22, 0x00, 0x68, 0x88, 0x86, 0x00, 0x62, 0x26, 0x00, 0x00, 0x62, 0x26, 0x00, 0x66, - 0x68, 0x26, 0x00, 0x69, 0x16, 0x66, 0x00, 0x66, 0x09, 0x20, 0x92, 0x66, 0x00, 0x68, 0x66, 0x08, 0x00, 0x68, 0x08, 0x00, - 0x62, 0x61, 0x66, 0x68, 0x06, 0x66, 0x61, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x66, 0x95, 0x00, 0x66, 0x69, 0x96, - 0x00, 0x69, 0x96, 0xB6, 0x00, 0x20, 0xB9, 0xB6, 0x00, 0x90, 0x66, 0x00, 0x00, 0x68, 0x88, 0x86, 0x00, 0x80, 0x86, 0x66, - 0x00, 0x80, 0x66, 0x86, 0x66, 0x26, 0x00, 0x80, 0x66, 0x96, 0x00, 0x00, 0x66, 0x09, 0x00, 0x90, 0x66, 0x02, 0x00, 0x10, - 0x66, 0x26, 0x00, 0x62, 0x96, 0x36, 0x00, 0x66, 0xA9, 0x02, 0x66, 0x69, 0x06, 0x6A, 0x66, 0x86, 0x00, 0x90, 0x86, 0x00, - 0x69, 0x88, 0x96, 0x00, 0x62, 0x86, 0x66, 0x02, 0x68, 0x88, 0x86, 0x00, 0x62, 0x96, 0x66, 0x00, 0x68, 0x88, 0x86, 0x00, - 0x62, 0x26, 0x00, 0x00, 0x62, 0x26, 0x00, 0x66, 0x61, 0x26, 0x00, 0x69, 0x96, 0x66, 0x00, 0x66, 0x09, 0x62, 0x96, 0x66, - 0x00, 0x68, 0x66, 0x06, 0x00, 0x68, 0x08, 0x00, 0x62, 0x39, 0x66, 0x69, 0x06, 0x66, 0x69, 0x66, 0x00, 0x66, 0x69, 0x96, - 0x00, 0x69, 0x06, 0x00, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x96, 0x66, 0x00, 0x62, 0x96, 0x66, 0x02, 0x10, 0x66, 0x00, - 0x00, 0x63, 0x88, 0x86, 0x00, 0x80, 0x36, 0x66, 0x00, 0x90, 0x66, 0x88, 0x66, 0x06, 0x00, 0x50, 0xB6, 0x16, 0x00, 0x00, - 0x66, 0x09, 0x00, 0x10, 0x56, 0x00, 0x00, 0x61, 0x61, 0x26, 0x00, 0x62, 0x96, 0x86, 0x00, 0x66, 0x69, 0x06, 0x66, 0x69, - 0x06, 0x62, 0x16, 0x18, 0x00, 0x90, 0x86, 0x00, 0x69, 0x88, 0x96, 0x00, 0x69, 0x06, 0x66, 0x09, 0x68, 0x88, 0x86, 0x00, - 0x62, 0x96, 0x66, 0x00, 0x68, 0x88, 0x86, 0x00, 0x62, 0x26, 0x00, 0x00, 0x62, 0x26, 0x00, 0x66, 0x69, 0x26, 0x00, 0x69, - 0x96, 0x66, 0x00, 0x66, 0x09, 0x62, 0x96, 0x66, 0x00, 0x68, 0x68, 0x96, 0x00, 0x68, 0x08, 0x00, 0x62, 0x19, 0x66, 0x62, - 0x06, 0x66, 0x64, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x06, 0x00, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x96, 0x66, - 0x00, 0x62, 0x26, 0x66, 0x02, 0x90, 0x66, 0x00, 0x00, 0x68, 0x88, 0x86, 0x00, 0x10, 0x66, 0x36, 0x00, 0x90, 0x66, 0x98, - 0x66, 0x06, 0x00, 0x62, 0x95, 0x56, 0x00, 0x00, 0x66, 0x09, 0x00, 0x50, 0x16, 0x00, 0x00, 0x68, 0x69, 0x26, 0x00, 0x62, - 0x96, 0x86, 0x00, 0x66, 0x61, 0x06, 0x66, 0x69, 0x06, 0x62, 0x96, 0x86, 0x00, 0x90, 0x86, 0x00, 0x69, 0x88, 0x96, 0x00, - 0x69, 0x06, 0x66, 0x09, 0x68, 0x53, 0x16, 0x00, 0x6A, 0x16, 0x66, 0x00, 0x68, 0x53, 0x16, 0x00, 0x62, 0x16, 0x49, 0x00, - 0x62, 0x26, 0x00, 0x66, 0x61, 0x26, 0x00, 0x69, 0x96, 0x66, 0x00, 0x66, 0x09, 0x62, 0x16, 0x66, 0x00, 0x68, 0x38, 0x16, - 0x00, 0x68, 0x93, 0x02, 0x62, 0x99, 0x36, 0x6A, 0x06, 0x66, 0x30, 0x66, 0x00, 0x66, 0x61, 0x96, 0x00, 0x69, 0x06, 0x00, - 0x00, 0x66, 0x61, 0x96, 0x00, 0x69, 0x96, 0x66, 0x00, 0x62, 0x96, 0x66, 0x0A, 0x90, 0x66, 0x00, 0x00, 0x63, 0x33, 0x86, - 0x00, 0x90, 0x66, 0x86, 0x00, 0x90, 0x66, 0x98, 0x66, 0x08, 0x00, 0x61, 0xA8, 0x66, 0x02, 0x00, 0x66, 0x09, 0x00, 0x62, - 0x86, 0x99, 0x00, 0x68, 0x61, 0x26, 0x00, 0x6A, 0x86, 0x86, 0x00, 0x66, 0x61, 0x06, 0x66, 0x61, 0x06, 0x62, 0x16, 0x86, - 0x00, 0x90, 0x86, 0x00, 0x69, 0x83, 0x96, 0x00, 0x68, 0x08, 0x63, 0x03, 0x68, 0x66, 0x48, 0x00, 0x80, 0x66, 0x16, 0x00, - 0x63, 0x66, 0x03, 0x00, 0x6A, 0x66, 0x26, 0x00, 0x62, 0x26, 0x00, 0x61, 0x86, 0x26, 0x00, 0x69, 0x96, 0x66, 0x00, 0x66, - 0x09, 0x80, 0x66, 0x96, 0x00, 0x68, 0x18, 0x56, 0x00, 0x68, 0x66, 0x09, 0x62, 0x29, 0x16, 0x62, 0x06, 0x66, 0x10, 0x66, - 0x00, 0x61, 0x66, 0x03, 0x00, 0x69, 0x06, 0x00, 0x00, 0x69, 0x66, 0x03, 0x00, 0x69, 0x26, 0x66, 0x02, 0x80, 0x66, 0x16, - 0x00, 0x90, 0x66, 0x00, 0x00, 0x52, 0x66, 0xA5, 0x00, 0x90, 0x66, 0x16, 0x00, 0x20, 0x66, 0x28, 0x66, 0x08, 0x00, 0x63, - 0x02, 0x63, 0x01, 0x00, 0x66, 0x09, 0x00, 0x62, 0x66, 0x66, 0x00, 0x62, 0x56, 0xA6, 0x00, 0x62, 0x53, 0x95, 0x00, 0x59, - 0x56, 0x02, 0x61, 0x55, 0x06, 0x10, 0x66, 0xA3, 0x00, 0x90, 0x86, 0x00, 0x5A, 0x55, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0, - 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x93, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x90, 0x59, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x88, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x08, 0x00, 0x00, 0x69, 0x08, 0x90, 0x36, - 0x00, 0x66, 0x02, 0x00, 0x00, 0x66, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x29, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8A, 0x66, 0xA8, 0x00, 0x20, 0x66, 0x00, 0x52, 0xB6, 0x09, 0x00, 0x10, 0x66, 0xA8, 0x00, 0x00, - 0x65, 0x16, 0x00, 0x66, 0x66, 0x46, 0x00, 0x10, 0x66, 0xA8, 0x00, 0x68, 0x66, 0x26, 0x00, 0x80, 0x66, 0xA8, 0x00, 0x39, - 0xB6, 0x01, 0x00, 0x69, 0x03, 0x80, 0x66, 0x01, 0x00, 0x69, 0x08, 0x10, 0x86, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x69, 0x08, 0x00, 0x00, 0x92, 0x09, 0x20, 0x29, 0x00, 0x66, 0x02, 0x00, 0x00, 0x66, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x33, 0x86, 0x00, 0xBA, 0x66, 0x00, 0x6B, - 0x68, 0x06, 0x00, 0x69, 0x33, 0x86, 0x00, 0x20, 0x66, 0x96, 0x00, 0x66, 0x91, 0x09, 0x00, 0x69, 0x36, 0x16, 0x00, 0x92, - 0x68, 0x26, 0x00, 0x69, 0x36, 0x86, 0x00, 0x6B, 0x68, 0x96, 0x00, 0x69, 0x08, 0x69, 0x38, 0x96, 0x00, 0x92, 0x09, 0xB0, - 0x11, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x85, 0x08, 0x00, 0x89, 0x01, 0x90, 0x18, 0x00, 0x66, 0x89, 0x08, - 0x00, 0x66, 0x02, 0x8A, 0x18, 0x98, 0x31, 0x02, 0x89, 0x88, 0x01, 0x00, 0x10, 0x88, 0x09, 0x00, 0x89, 0x81, 0x01, 0x00, - 0x90, 0x98, 0x13, 0x00, 0x8A, 0x18, 0xA8, 0x00, 0x20, 0x88, 0x02, 0x00, 0x59, 0x36, 0x01, 0x8A, 0x98, 0x98, 0x00, 0x89, - 0x01, 0x38, 0x0A, 0x88, 0x90, 0x98, 0x80, 0x08, 0x81, 0x92, 0x98, 0x00, 0x89, 0x09, 0x81, 0x0A, 0x82, 0x88, 0x08, 0x00, - 0x68, 0x83, 0x86, 0x00, 0x3A, 0x66, 0x00, 0x66, 0x69, 0x26, 0x00, 0x69, 0x88, 0x86, 0x00, 0x90, 0x66, 0x96, 0x00, 0x66, - 0x02, 0x00, 0x00, 0x69, 0x86, 0x86, 0x00, 0x00, 0x61, 0x05, 0x00, 0x69, 0x86, 0x86, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, - 0x08, 0x69, 0x89, 0x96, 0x00, 0x69, 0x08, 0x6A, 0x54, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x33, 0x96, 0x00, - 0x69, 0x08, 0x90, 0x86, 0x00, 0x66, 0x63, 0x03, 0x00, 0x66, 0x02, 0x62, 0x36, 0x66, 0x63, 0x06, 0x69, 0x55, 0x96, 0x00, - 0x69, 0x53, 0x16, 0x00, 0x69, 0x35, 0x16, 0x00, 0x62, 0x36, 0x86, 0x00, 0x62, 0xB6, 0x86, 0x00, 0x6A, 0x35, 0xA6, 0x00, - 0x32, 0x86, 0x02, 0x62, 0x96, 0x86, 0x00, 0x62, 0x26, 0x66, 0x00, 0x68, 0x82, 0x86, 0x62, 0x03, 0x69, 0x88, 0x46, 0x00, - 0x6A, 0x03, 0x66, 0x00, 0x89, 0x65, 0x05, 0x00, 0x68, 0x88, 0x86, 0x00, 0x90, 0x66, 0x00, 0x66, 0x61, 0x26, 0x00, 0x69, - 0x38, 0x86, 0x00, 0x80, 0x66, 0x96, 0x00, 0x66, 0x99, 0x02, 0x00, 0x69, 0x96, 0xA9, 0x00, 0x00, 0x63, 0x08, 0x00, 0x69, - 0x86, 0x86, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x08, 0x69, 0x89, 0x96, 0x00, 0x69, 0x08, 0x92, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x69, 0x88, 0x96, 0x00, 0x69, 0x08, 0x90, 0x86, 0x00, 0x66, 0x66, 0x09, 0x00, 0x66, 0x02, 0x62, - 0x26, 0x66, 0x62, 0x06, 0x69, 0x88, 0x96, 0x00, 0x69, 0x88, 0x96, 0x00, 0x69, 0x88, 0x96, 0x00, 0x62, 0x96, 0x86, 0x00, - 0x62, 0x96, 0x86, 0x00, 0x62, 0x88, 0x26, 0x00, 0x80, 0x96, 0x00, 0x62, 0x96, 0x86, 0x00, 0x6A, 0x26, 0x56, 0x00, 0x61, - 0x39, 0x86, 0x69, 0x01, 0x64, 0x6B, 0x03, 0x00, 0x50, 0x26, 0x36, 0x00, 0x00, 0x68, 0x01, 0x00, 0x68, 0x83, 0x86, 0x00, - 0x90, 0x66, 0x00, 0x00, 0x61, 0x0B, 0x00, 0x00, 0x5A, 0x96, 0x00, 0x60, 0x63, 0x96, 0x00, 0x66, 0x66, 0x46, 0x00, 0x69, - 0x66, 0x96, 0x00, 0xA0, 0x66, 0x09, 0x00, 0x54, 0x36, 0x96, 0x00, 0x66, 0x61, 0x96, 0x00, 0x69, 0x08, 0x92, 0x52, 0x96, - 0x00, 0x69, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x88, 0x16, 0x00, 0x69, 0x08, 0x90, 0x86, - 0x00, 0x66, 0x66, 0x00, 0x00, 0x66, 0x02, 0x62, 0x26, 0x66, 0x62, 0x06, 0x61, 0x83, 0x96, 0x00, 0x69, 0x88, 0x96, 0x00, - 0x69, 0x88, 0x96, 0x00, 0x62, 0x96, 0x86, 0x00, 0x62, 0x96, 0x86, 0x00, 0x62, 0x85, 0xA8, 0x00, 0x80, 0x96, 0x00, 0x62, - 0x96, 0x86, 0x00, 0x60, 0x16, 0x86, 0x00, 0x69, 0x61, 0x66, 0x61, 0x01, 0x80, 0x66, 0x09, 0x00, 0x80, 0x86, 0x16, 0x00, - 0x40, 0x66, 0x0A, 0x00, 0x68, 0x88, 0x86, 0x00, 0x90, 0x66, 0x00, 0x40, 0x66, 0x09, 0x00, 0x00, 0x69, 0xA3, 0x00, 0x62, - 0x68, 0x16, 0x00, 0x88, 0x69, 0xA6, 0x00, 0x69, 0x36, 0x86, 0x00, 0x10, 0x66, 0x04, 0x00, 0x30, 0x56, 0xA3, 0x00, 0x61, - 0x66, 0x96, 0x00, 0x69, 0x08, 0x00, 0x61, 0x08, 0x00, 0x69, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x69, 0x88, 0x96, 0x00, 0x69, 0x08, 0x90, 0x86, 0x00, 0x66, 0xB6, 0x00, 0x00, 0x66, 0x02, 0x62, 0x26, 0x66, 0x62, 0x06, - 0x69, 0x88, 0x96, 0x00, 0x69, 0x88, 0x96, 0x00, 0x69, 0x88, 0x96, 0x00, 0x62, 0x96, 0x86, 0x00, 0x62, 0x06, 0x00, 0x00, - 0x10, 0x66, 0x01, 0x00, 0x80, 0x96, 0x00, 0x62, 0x96, 0x86, 0x00, 0x30, 0x86, 0x16, 0x00, 0x62, 0x63, 0x66, 0x63, 0x02, - 0x90, 0x66, 0x02, 0x00, 0x90, 0x66, 0x96, 0x00, 0x10, 0x36, 0x00, 0x00, 0x68, 0x88, 0x86, 0x00, 0x90, 0x66, 0x00, 0x10, - 0xB6, 0x00, 0x00, 0x92, 0x89, 0x86, 0x00, 0x61, 0x69, 0x96, 0x00, 0x99, 0x61, 0x26, 0x00, 0x69, 0x86, 0x86, 0x00, 0x80, - 0x36, 0x00, 0x00, 0x69, 0x86, 0x86, 0x00, 0x89, 0x69, 0x96, 0x00, 0x69, 0x08, 0x40, 0x66, 0x0A, 0x00, 0x69, 0x08, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x88, 0x96, 0x00, 0x69, 0x08, 0x90, 0x86, 0x00, 0x66, 0x66, 0x09, - 0x00, 0x66, 0x0A, 0x62, 0x26, 0x66, 0x62, 0x06, 0x69, 0x88, 0x96, 0x00, 0x69, 0x83, 0x96, 0x00, 0x69, 0x88, 0x96, 0x00, - 0x62, 0x96, 0x86, 0x00, 0x62, 0x06, 0x00, 0x00, 0x92, 0x68, 0x96, 0x00, 0x80, 0x16, 0x00, 0x62, 0x96, 0x86, 0x00, 0x80, - 0xB6, 0x96, 0x00, 0x64, 0x66, 0x66, 0x66, 0x04, 0x30, 0x66, 0x09, 0x00, 0x20, 0x66, 0x26, 0x00, 0x30, 0x96, 0x00, 0x00, - 0x68, 0x88, 0x86, 0x00, 0x90, 0x66, 0x00, 0xB0, 0x16, 0x00, 0x00, 0x69, 0x88, 0x86, 0x00, 0x63, 0x6A, 0x96, 0x00, 0x66, - 0x68, 0x26, 0x00, 0x69, 0x86, 0x86, 0x00, 0x60, 0x16, 0x00, 0x00, 0x69, 0x86, 0x86, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, - 0x08, 0x90, 0x86, 0x00, 0x00, 0x69, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x88, 0x16, 0x00, - 0x69, 0x08, 0x90, 0x36, 0x00, 0x66, 0x63, 0x03, 0x00, 0x66, 0x02, 0x62, 0x26, 0x66, 0x62, 0x06, 0x69, 0x88, 0x96, 0x00, - 0x69, 0x88, 0x96, 0x00, 0x69, 0x88, 0x96, 0x00, 0x6A, 0x96, 0x86, 0x00, 0x62, 0x06, 0x00, 0x00, 0x69, 0x88, 0x96, 0x00, - 0x80, 0x96, 0x00, 0x62, 0x96, 0x86, 0x00, 0x90, 0x66, 0x26, 0x00, 0x60, 0x66, 0x61, 0x66, 0x00, 0x64, 0x66, 0x03, 0x00, - 0x00, 0x66, 0x06, 0x00, 0x69, 0x46, 0x00, 0x00, 0x63, 0x38, 0x86, 0x00, 0x90, 0x66, 0x00, 0x69, 0x46, 0x00, 0x00, 0x69, - 0x88, 0x86, 0x00, 0x66, 0x66, 0x66, 0x08, 0x66, 0x68, 0x26, 0x00, 0x69, 0x86, 0x86, 0x00, 0x62, 0x26, 0x00, 0x00, 0x69, - 0x86, 0x86, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x08, 0x90, 0x86, 0x00, 0x00, 0x69, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x69, 0x88, 0x96, 0x00, 0x69, 0x08, 0x90, 0x86, 0x00, 0x66, 0x61, 0x46, 0x00, 0x66, 0x02, 0x62, - 0x26, 0x66, 0x6A, 0x06, 0x69, 0x88, 0x96, 0x00, 0x69, 0x38, 0x96, 0x00, 0x69, 0x83, 0x96, 0x00, 0x62, 0x16, 0x86, 0x00, - 0x62, 0x06, 0x00, 0x00, 0x69, 0x83, 0x96, 0x00, 0x80, 0x86, 0x09, 0x62, 0x86, 0x86, 0x00, 0x90, 0x66, 0x26, 0x00, 0x80, - 0x66, 0x6A, 0x86, 0x00, 0x61, 0x69, 0xA6, 0x00, 0x00, 0x68, 0x03, 0x00, 0x68, 0x93, 0x49, 0x00, 0x68, 0x83, 0x86, 0x00, - 0x90, 0x66, 0x00, 0x65, 0x9B, 0x49, 0x00, 0x69, 0x38, 0x16, 0x00, 0x99, 0x69, 0x86, 0x09, 0x66, 0x63, 0x26, 0x00, 0x69, - 0x36, 0x86, 0x00, 0x61, 0x06, 0x00, 0x00, 0x69, 0x36, 0x86, 0x00, 0x66, 0x61, 0x96, 0x00, 0x92, 0x09, 0x20, 0x29, 0x00, - 0x00, 0x69, 0x08, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x99, 0x00, 0x00, 0x69, 0x88, 0x96, 0x00, 0x69, 0x08, 0x90, 0x86, - 0x00, 0x66, 0x5A, 0x16, 0x00, 0x66, 0x02, 0x62, 0x26, 0x66, 0x62, 0x06, 0x69, 0x88, 0x96, 0x00, 0x80, 0x66, 0x08, 0x00, - 0x69, 0x55, 0xA5, 0x00, 0x30, 0x56, 0x86, 0x00, 0x6A, 0x06, 0x00, 0x00, 0x30, 0x66, 0x01, 0x00, 0x90, 0x66, 0x08, 0x30, - 0x36, 0x36, 0x00, 0x20, 0x66, 0x06, 0x00, 0x80, 0x66, 0x50, 0x16, 0x00, 0x68, 0x8A, 0x16, 0x00, 0x00, 0x69, 0x08, 0x00, - 0x68, 0x66, 0x26, 0x00, 0x5A, 0x66, 0xA5, 0x00, 0x90, 0x66, 0x00, 0x66, 0x66, 0x26, 0x00, 0x34, 0x66, 0x25, 0x00, 0x00, - 0x60, 0x96, 0x00, 0x69, 0x66, 0x01, 0x00, 0x54, 0x66, 0x25, 0x00, 0x63, 0x08, 0x00, 0x00, 0x34, 0x66, 0x25, 0x00, 0x61, - 0x66, 0x43, 0x00, 0x69, 0x08, 0x90, 0x86, 0x00, 0x00, 0x69, 0x08, 0x00, 0x00, 0x00, 0x00, 0x66, 0x00, 0x66, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x08, 0x00, 0x00, 0x00, 0x90, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x90, 0x68, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xA2, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x40, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0xA8, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0x09, 0x00, 0x00, - 0x00, 0x90, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x08, 0x00, 0x00, 0x00, 0xA0, 0x26, 0x00, 0xA0, 0xA6, 0x9B, 0x00, 0x80, 0x08, - 0x00, 0x90, 0x08, 0x00, 0x18, 0x00, 0x80, 0x08, 0x00, 0x95, 0x00, 0x00, 0x00, 0x80, 0x08, 0x00, 0x10, 0x98, 0x05, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x6A, 0x02, 0x00, 0xB0, 0x89, 0x01, 0x00, 0x90, 0x56, 0x63, 0x0A, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x09, 0x00, 0x00, 0x00, 0x20, - 0x09, 0x00, 0x00, 0x09, 0xA9, 0x00, 0x40, 0x09, 0x00, 0x90, 0x09, 0x00, 0x94, 0x00, 0x90, 0x04, 0x00, 0x92, 0x00, 0x00, - 0x00, 0x90, 0x04, 0x00, 0x90, 0xA2, 0x09, 0x00, 0x00, 0x00, 0x90, 0x04, 0x00, 0x92, 0x00, 0x00, 0x90, 0x2A, 0x02, 0x00, - 0x80, 0x11, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x69, 0x96, 0x00, 0x66, 0x0B, 0x00, 0x69, 0x61, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6A, - 0x08, 0x00, 0x63, 0x36, 0x00, 0x00, 0x00, 0x66, 0x16, 0x00, 0x90, 0x66, 0x96, 0x00, 0x66, 0x66, 0x09, 0x66, 0x66, 0x09, - 0x66, 0x09, 0x69, 0x06, 0x8A, 0x66, 0xA8, 0x00, 0x90, 0x6B, 0x9B, 0x00, 0x8A, 0x66, 0xA8, 0x00, 0x90, 0x6B, 0x66, 0x00, - 0x69, 0x96, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x26, 0x61, 0x01, 0x10, 0x66, 0xA8, 0x00, 0x90, 0x05, 0x00, 0x00, - 0x6A, 0x02, 0x00, 0x6A, 0xBA, 0x01, 0x00, 0x95, 0x00, 0x00, 0x00, 0x6A, 0x0A, 0x00, 0x59, 0x00, 0x10, 0x08, 0x00, 0x95, - 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x50, 0x89, 0x08, 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x6A, 0xBA, - 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x02, 0x68, 0x48, 0x00, 0x69, 0x26, 0x00, 0x31, 0x69, 0x04, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x04, 0x00, 0x66, 0x66, 0x00, 0x00, 0x20, 0x66, 0x86, 0x00, 0x90, 0x66, - 0x96, 0x00, 0x66, 0x98, 0x02, 0x66, 0x98, 0x02, 0x66, 0x09, 0x61, 0x06, 0x61, 0x35, 0x16, 0x00, 0x6A, 0x86, 0x66, 0x0A, - 0x61, 0x35, 0x86, 0x00, 0x6A, 0x86, 0x66, 0x0A, 0x69, 0x96, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x16, 0x69, 0x09, - 0x69, 0x86, 0x86, 0x00, 0x00, 0x49, 0x00, 0x00, 0x92, 0x00, 0x00, 0x90, 0x10, 0x0A, 0x00, 0x92, 0x00, 0x00, 0x00, 0x92, - 0x00, 0x00, 0x90, 0x04, 0x90, 0x04, 0x00, 0x92, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x90, 0x9A, 0x02, 0x00, 0x00, 0x22, - 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x90, 0x90, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x68, 0x09, 0x00, - 0x60, 0x26, 0x00, 0x95, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x40, 0x66, 0x66, - 0x04, 0x00, 0x20, 0x66, 0x36, 0x00, 0x10, 0x66, 0x16, 0x00, 0x66, 0x09, 0x00, 0x66, 0x09, 0x00, 0x66, 0x09, 0x69, 0x06, - 0x63, 0x88, 0x86, 0x00, 0x62, 0x96, 0x66, 0x02, 0x68, 0x88, 0x86, 0x00, 0x62, 0x96, 0x66, 0x02, 0x69, 0x96, 0x66, 0x00, - 0x66, 0x69, 0x96, 0x00, 0x69, 0x36, 0x69, 0x09, 0x69, 0x96, 0x86, 0x00, 0x10, 0x88, 0x0A, 0x20, 0x88, 0x09, 0x00, 0x10, - 0x18, 0x0A, 0x90, 0x88, 0x09, 0x00, 0x90, 0x88, 0x09, 0x00, 0x82, 0x01, 0x89, 0x01, 0x90, 0x83, 0x01, 0x00, 0x10, 0x88, - 0x09, 0x00, 0x10, 0x18, 0x09, 0x00, 0x89, 0x89, 0xA8, 0x00, 0x89, 0x89, 0xA8, 0x00, 0x88, 0x89, 0x03, 0x1A, 0x13, 0x0A, - 0x00, 0x00, 0x00, 0x11, 0x00, 0x68, 0x09, 0x00, 0x60, 0x26, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x66, 0x66, 0x0A, 0x00, 0x90, 0x66, 0x66, 0x00, 0x30, 0x66, 0x86, 0x00, 0x66, 0x09, - 0x00, 0x66, 0x09, 0x00, 0x66, 0x09, 0x61, 0x06, 0x68, 0x88, 0x86, 0x00, 0x6A, 0x96, 0x66, 0x02, 0x68, 0x88, 0x86, 0x00, - 0x62, 0x86, 0x66, 0x02, 0x69, 0x96, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, 0x61, 0x66, 0x61, 0x09, 0x69, 0x96, 0x86, 0x00, - 0x61, 0x68, 0x05, 0x6A, 0x35, 0x96, 0x00, 0x68, 0x68, 0x05, 0x69, 0x35, 0x96, 0x00, 0x69, 0x33, 0x96, 0x00, 0x69, 0x08, - 0x69, 0x08, 0x69, 0x53, 0x16, 0x00, 0x68, 0x63, 0xA6, 0x00, 0x68, 0x68, 0xA6, 0x00, 0x68, 0x69, 0x26, 0x00, 0x63, 0x69, - 0x26, 0x00, 0x66, 0x69, 0x06, 0x6B, 0x68, 0x05, 0x00, 0x00, 0x00, 0x25, 0x00, 0x68, 0x09, 0x00, 0x60, 0x26, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x90, 0x66, 0x66, 0x09, 0x00, 0x10, 0x66, - 0x66, 0x04, 0x30, 0x66, 0xB6, 0x00, 0x66, 0x98, 0x04, 0x66, 0x98, 0x04, 0x66, 0x09, 0x69, 0x06, 0x68, 0x88, 0x86, 0x00, - 0x62, 0x96, 0x66, 0x02, 0x68, 0x88, 0x86, 0x00, 0x62, 0xB6, 0x66, 0x02, 0x69, 0x96, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, - 0x69, 0x66, 0x63, 0x09, 0x61, 0x06, 0x00, 0x00, 0x68, 0x69, 0x06, 0x62, 0x38, 0x96, 0x00, 0x68, 0x69, 0x06, 0x61, 0x88, - 0x96, 0x00, 0x69, 0x88, 0x96, 0x00, 0x69, 0x08, 0x69, 0x08, 0x69, 0x88, 0x96, 0x00, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, - 0xA6, 0x00, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, 0xA6, 0x00, 0x66, 0x69, 0x06, 0x66, 0x69, 0x06, 0x00, 0x00, 0x90, 0x06, - 0x00, 0x68, 0x09, 0x00, 0x60, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA4, 0x00, 0x00, 0x88, 0x00, 0x00, - 0x00, 0x90, 0x86, 0x68, 0x09, 0x00, 0x80, 0x96, 0x66, 0x02, 0x60, 0x96, 0x66, 0x00, 0x66, 0x83, 0x0A, 0x66, 0x85, 0x0A, - 0x66, 0x09, 0x69, 0x06, 0x68, 0x88, 0x86, 0x00, 0x62, 0x96, 0x66, 0x02, 0x68, 0x88, 0x86, 0x00, 0x62, 0x66, 0x66, 0x02, - 0x69, 0x96, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x63, 0x66, 0x09, 0x69, 0x06, 0x00, 0x00, 0x89, 0x68, 0x06, 0x8A, - 0x38, 0x96, 0x00, 0x81, 0x68, 0x06, 0x69, 0x88, 0x96, 0x00, 0x69, 0x88, 0x96, 0x00, 0x69, 0x08, 0x69, 0x08, 0x69, 0x88, - 0x96, 0x00, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, 0x26, 0x00, 0x63, 0x69, 0x26, 0x00, 0x66, 0x69, - 0x06, 0x66, 0x69, 0x06, 0x00, 0x00, 0x10, 0x08, 0x00, 0x68, 0x09, 0x00, 0x60, 0xA6, 0x00, 0x00, 0x00, 0x00, 0x68, 0x26, - 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xB6, 0x63, 0x01, 0x00, 0x50, 0x86, 0x66, 0x09, 0x6A, 0x86, - 0x66, 0x0A, 0x66, 0x09, 0x00, 0x66, 0x09, 0x00, 0x66, 0x09, 0x61, 0x06, 0x68, 0x88, 0x86, 0x00, 0x62, 0x96, 0x66, 0x02, - 0x68, 0x88, 0x86, 0x00, 0x62, 0xB6, 0x66, 0x02, 0x69, 0x96, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x61, 0x66, 0x09, - 0x69, 0x46, 0xAA, 0x00, 0x8A, 0x66, 0x06, 0x90, 0x65, 0x96, 0x00, 0x8A, 0x66, 0x06, 0x69, 0x66, 0x96, 0x00, 0x69, 0x66, - 0x96, 0x00, 0x69, 0x08, 0x69, 0x08, 0x69, 0x88, 0x16, 0x00, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, - 0x26, 0x00, 0x68, 0x69, 0x26, 0x00, 0x66, 0x69, 0x06, 0x66, 0x29, 0x02, 0x00, 0x00, 0x30, 0x02, 0x00, 0x68, 0x09, 0x00, - 0x60, 0x26, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x02, 0x00, 0x24, 0x31, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x36, 0x65, - 0x08, 0x00, 0x60, 0x36, 0x65, 0x09, 0x62, 0x86, 0x66, 0x02, 0x66, 0x09, 0x00, 0x66, 0x09, 0x00, 0x66, 0x09, 0x69, 0x06, - 0x68, 0x88, 0x86, 0x00, 0x62, 0x96, 0x66, 0x02, 0x68, 0x88, 0x86, 0x00, 0x62, 0x16, 0x66, 0x02, 0x69, 0x96, 0x66, 0x00, - 0x66, 0x69, 0x96, 0x00, 0x61, 0xB9, 0x66, 0x09, 0x69, 0x96, 0x86, 0x00, 0x63, 0x68, 0x06, 0x69, 0x83, 0x96, 0x00, 0x63, - 0x68, 0x06, 0x69, 0x88, 0x98, 0x00, 0x61, 0x13, 0x98, 0x00, 0x69, 0x08, 0x69, 0x08, 0x69, 0x88, 0x96, 0x00, 0x68, 0x69, - 0x26, 0x00, 0x68, 0x61, 0x26, 0x00, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, 0x26, 0x00, 0x66, 0x69, 0x06, 0x66, 0x69, 0x06, - 0x00, 0x00, 0x6A, 0x00, 0x00, 0x68, 0x09, 0x00, 0x60, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x66, 0x86, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x96, 0x69, 0x0B, 0x00, 0x6A, 0x26, 0x68, 0x08, 0x69, 0x06, 0x66, 0x09, 0x66, 0x09, - 0x00, 0x66, 0x09, 0x00, 0x66, 0x01, 0x69, 0x06, 0x68, 0x88, 0x86, 0x00, 0x62, 0x96, 0x66, 0x02, 0x68, 0x88, 0x86, 0x00, - 0x62, 0x16, 0x66, 0x02, 0x69, 0x96, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x19, 0x66, 0x09, 0x69, 0x16, 0x86, 0x00, - 0x66, 0x69, 0x06, 0x69, 0x88, 0x96, 0x00, 0x66, 0x69, 0x06, 0x69, 0x88, 0x96, 0x00, 0x69, 0x88, 0x96, 0x00, 0x69, 0x03, - 0x69, 0x08, 0x69, 0x83, 0x96, 0x00, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, 0xA6, 0x00, 0x63, 0x69, 0xA6, 0x00, 0x68, 0x69, - 0x26, 0x00, 0x66, 0x69, 0x06, 0x66, 0x69, 0x06, 0x99, 0x00, 0x81, 0x00, 0x00, 0x68, 0x48, 0x00, 0x62, 0x26, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x60, 0x96, 0x69, 0x06, 0x00, 0x62, 0x26, - 0x68, 0x08, 0x69, 0x06, 0x66, 0x09, 0x66, 0x98, 0x02, 0x66, 0x18, 0x0A, 0x66, 0x09, 0x69, 0x06, 0x68, 0x33, 0x86, 0x00, - 0x62, 0x86, 0x66, 0x02, 0x68, 0x38, 0x86, 0x00, 0x6A, 0x16, 0x66, 0x02, 0x69, 0x16, 0x66, 0x00, 0x66, 0x61, 0x96, 0x00, - 0x69, 0x99, 0x66, 0x09, 0x69, 0x16, 0x86, 0x00, 0x66, 0x61, 0x06, 0x69, 0x88, 0x96, 0x00, 0x66, 0x61, 0x06, 0x69, 0x83, - 0x96, 0x00, 0x69, 0x33, 0x96, 0x00, 0x61, 0x08, 0x69, 0x08, 0x69, 0x33, 0x16, 0x00, 0x68, 0x61, 0x26, 0x00, 0x68, 0x61, - 0x26, 0x00, 0x68, 0x61, 0x26, 0x00, 0x68, 0x61, 0x26, 0x00, 0x66, 0x61, 0x06, 0x66, 0x61, 0x06, 0x66, 0x00, 0x13, 0x00, - 0x00, 0x52, 0x96, 0x00, 0x66, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x66, 0x00, 0x00, - 0x00, 0x62, 0x96, 0x69, 0x26, 0x00, 0x69, 0x06, 0x61, 0x06, 0x68, 0x03, 0x63, 0x08, 0x66, 0x66, 0x09, 0x66, 0x66, 0x01, - 0x66, 0x01, 0x69, 0x06, 0x52, 0x66, 0xA5, 0x00, 0x80, 0x66, 0x16, 0x00, 0x59, 0x66, 0xA5, 0x00, 0x60, 0x66, 0x86, 0x00, - 0x34, 0x66, 0x96, 0x00, 0x69, 0x66, 0x08, 0x00, 0x69, 0x09, 0x66, 0x09, 0x34, 0x66, 0x95, 0x00, 0x61, 0x65, 0x06, 0x5A, - 0x56, 0x96, 0x00, 0x61, 0x65, 0x06, 0x80, 0x66, 0x08, 0x00, 0x80, 0x66, 0x08, 0x00, 0x69, 0x08, 0x69, 0x08, 0x10, 0x66, - 0x08, 0x00, 0x3A, 0x66, 0x01, 0x00, 0x3A, 0x66, 0x01, 0x00, 0x69, 0x63, 0xA6, 0x00, 0x69, 0x65, 0x26, 0x00, 0x61, 0x63, - 0x06, 0x39, 0x56, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x2A, 0x04, 0x00, - 0x00, 0x2A, 0x00, 0x00, 0x8A, 0x24, 0x04, 0x00, 0x00, 0x2A, 0x00, 0x00, 0x00, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x93, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA2, 0x00, 0x00, 0x2A, 0x00, 0x00, 0x00, - 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x1B, 0x44, 0x00, 0xA0, 0x0A, 0x42, - 0x00, 0x00, 0x24, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x30, 0x63, 0x02, 0x20, 0xB6, 0x08, 0x00, 0x10, 0x55, 0x09, 0x00, 0x60, 0x66, 0x86, 0x00, 0x00, 0x68, 0x09, 0x00, 0x68, - 0x09, 0x59, 0xB8, 0x29, 0x00, 0x61, 0x66, 0x26, 0x00, 0x00, 0x55, 0x05, 0x00, 0x00, 0x00, 0x69, 0x09, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9A, 0x94, 0x09, 0x90, 0x49, 0xA9, 0x00, 0x90, 0x22, 0x09, 0x00, 0x60, - 0x16, 0x65, 0x09, 0x00, 0x99, 0x02, 0x00, 0x99, 0x02, 0x22, 0x44, 0x64, 0x00, 0x99, 0x9A, 0x09, 0x00, 0x20, 0x09, 0x29, - 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x13, 0x0A, 0x90, - 0x88, 0x09, 0x00, 0x81, 0x82, 0xA8, 0x00, 0x60, 0x26, 0x68, 0x09, 0x00, 0x68, 0x09, 0x00, 0x68, 0x09, 0x81, 0x81, 0x09, - 0x00, 0x89, 0x81, 0x09, 0x00, 0x20, 0x81, 0x01, 0x00, 0x00, 0x00, 0x95, 0x00, 0x90, 0x81, 0x11, 0x18, 0x0A, 0x1A, 0x88, - 0x81, 0xA1, 0x00, 0x10, 0x66, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x68, 0x68, 0x05, 0x69, 0x53, 0x96, 0x00, 0x68, 0x61, 0xA6, 0x00, 0x60, 0x26, 0x68, 0x09, 0x00, - 0x63, 0x09, 0x00, 0x68, 0x09, 0x68, 0x63, 0x26, 0x00, 0x63, 0x6B, 0x26, 0x00, 0x6A, 0x86, 0x86, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x6A, 0x86, 0x66, 0x68, 0x08, 0x61, 0x61, 0x86, 0x16, 0x00, 0x60, 0xAA, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x69, 0x06, 0x69, 0x88, 0x96, 0x00, 0x68, - 0x69, 0x26, 0x00, 0x60, 0x96, 0x55, 0x0A, 0xA0, 0x66, 0x04, 0x00, 0x68, 0x09, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, 0xA6, - 0x00, 0x6A, 0x96, 0x86, 0x00, 0x8A, 0x01, 0x00, 0x00, 0x6A, 0x96, 0x66, 0x69, 0x08, 0x68, 0x62, 0x96, 0x36, 0x00, 0x60, - 0x1A, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x81, 0x68, 0x06, 0x69, 0x88, 0x96, 0x00, 0x68, 0x69, 0x26, 0x00, 0x60, 0x96, 0x86, 0x00, 0x30, 0x16, 0x00, 0x00, 0x68, - 0x09, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, 0x26, 0x00, 0x62, 0x16, 0x86, 0x00, 0x8A, 0x01, 0x00, 0x00, 0x62, 0x96, 0x66, - 0x69, 0x08, 0x81, 0x61, 0x96, 0x86, 0x00, 0x6A, 0x61, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8A, 0x66, 0x06, 0x69, 0x66, 0x96, 0x00, 0x68, 0x69, 0xA6, 0x00, 0x60, - 0x26, 0x68, 0x01, 0x62, 0x25, 0x98, 0x00, 0x68, 0x09, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, 0x26, 0x00, 0x62, 0x96, 0x86, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x6A, 0x96, 0x66, 0x66, 0x08, 0x3A, 0x66, 0x66, 0x86, 0x00, 0x61, 0x16, 0xA1, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6B, 0x68, 0x06, 0x69, - 0x13, 0x28, 0x00, 0x68, 0x69, 0x26, 0x00, 0x60, 0x26, 0x68, 0x09, 0x69, 0x98, 0x96, 0x00, 0x68, 0x09, 0x68, 0x69, 0x26, - 0x00, 0x68, 0x69, 0x26, 0x00, 0x62, 0x96, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x96, 0x66, 0x99, 0x09, 0x6B, 0x69, - 0x96, 0x99, 0x00, 0x16, 0x6A, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x66, 0x69, 0x06, 0x69, 0x88, 0x96, 0x00, 0x68, 0x69, 0x26, 0x00, 0x60, 0x26, 0x68, 0x09, 0x69, - 0x98, 0x16, 0x00, 0x63, 0x09, 0x68, 0x69, 0xA6, 0x00, 0x68, 0x61, 0x26, 0x00, 0x62, 0x96, 0x86, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x6A, 0x96, 0x66, 0x69, 0x08, 0x66, 0x6A, 0x96, 0x86, 0x00, 0xA6, 0xA0, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x61, 0x06, 0x69, 0x33, 0x96, 0x00, 0x68, - 0x61, 0xA6, 0x00, 0x69, 0x26, 0x63, 0x09, 0x69, 0x83, 0x96, 0x00, 0x68, 0x09, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, 0x26, - 0x00, 0x62, 0x16, 0x86, 0x00, 0x94, 0x09, 0x00, 0x00, 0x62, 0x16, 0x66, 0x68, 0x01, 0x66, 0x69, 0x16, 0x86, 0x00, 0x16, - 0x1A, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x61, 0x65, 0x06, 0x80, 0x66, 0x08, 0x00, 0x69, 0x63, 0x26, 0x00, 0x68, 0x28, 0x16, 0x00, 0x10, 0x66, 0x08, 0x00, 0x68, - 0x09, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, 0x26, 0x00, 0x10, 0x65, 0xA3, 0x00, 0x62, 0x08, 0x00, 0x00, 0x90, 0x65, 0x53, - 0x36, 0x0A, 0x61, 0x86, 0x63, 0xA3, 0x00, 0x61, 0x66, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x90, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x51, 0x46, 0x08, 0x21, 0x5A, 0x6B, 0x63, 0x0C, 0xBD, 0x77, 0xFF, 0x7F, 0x00, 0x00, 0xD6, 0x5A, 0xCD, 0x35, + 0xA5, 0x14, 0xDE, 0x7B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x40, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x66, 0x26, 0x00, 0x68, 0x66, 0x08, 0x00, 0x90, 0x6B, 0x2B, 0x00, + 0x68, 0x66, 0x08, 0x00, 0x62, 0x66, 0x26, 0x00, 0x62, 0x66, 0x06, 0x52, 0xB6, 0x01, 0x00, 0x69, 0x96, 0x66, 0x00, 0x66, + 0x09, 0x00, 0x90, 0x66, 0x00, 0x68, 0x88, 0x16, 0x00, 0x68, 0x08, 0x00, 0x62, 0x86, 0x90, 0x66, 0x06, 0x66, 0x03, 0x66, + 0x00, 0x39, 0x66, 0x01, 0x00, 0x69, 0x66, 0x93, 0x00, 0x52, 0x66, 0x08, 0x00, 0x69, 0x66, 0x93, 0x00, 0x90, 0x6B, 0x93, + 0x00, 0x68, 0x66, 0x26, 0x00, 0x63, 0x83, 0x86, 0x00, 0x69, 0x06, 0x68, 0x08, 0x61, 0x06, 0x66, 0x08, 0x66, 0x00, 0x69, + 0x03, 0x61, 0x09, 0x66, 0x01, 0x61, 0x09, 0x60, 0x66, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6A, 0x06, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x62, 0x06, 0x00, 0x00, 0x00, 0x00, 0xA0, 0x6B, 0x08, 0x00, 0x00, 0x00, 0x00, 0x90, 0x66, 0x96, 0x00, + 0x68, 0x53, 0x16, 0x00, 0x6A, 0x86, 0x56, 0x00, 0x68, 0x55, 0x86, 0x00, 0x6A, 0x16, 0x41, 0x00, 0x62, 0x16, 0x09, 0x6B, + 0x68, 0xA6, 0x00, 0x69, 0x96, 0x66, 0x00, 0x66, 0x01, 0x00, 0x90, 0x66, 0x00, 0x68, 0xB8, 0x96, 0x00, 0x68, 0x08, 0x00, + 0x6A, 0x66, 0x90, 0x66, 0x06, 0x66, 0x06, 0x66, 0x00, 0x6B, 0x68, 0x96, 0x00, 0x69, 0x36, 0x66, 0x00, 0x6B, 0x68, 0x96, + 0x00, 0x69, 0x36, 0x56, 0x00, 0x6A, 0x86, 0x56, 0x00, 0x89, 0x66, 0x49, 0x00, 0x68, 0x88, 0x86, 0x00, 0x69, 0xA6, 0x6B, + 0x09, 0x6A, 0x26, 0x66, 0x28, 0x86, 0x00, 0x60, 0x46, 0x66, 0x00, 0x68, 0x03, 0x63, 0x0A, 0x90, 0x69, 0x86, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x62, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x06, 0x00, 0x00, 0x00, 0x00, 0x90, 0x36, 0x0A, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x66, 0x86, 0x00, 0x68, 0x88, 0x86, 0x00, 0x62, 0x96, 0x66, 0x00, 0x68, 0x88, 0x86, 0x00, + 0x62, 0x26, 0x00, 0x00, 0x62, 0x26, 0x00, 0x66, 0x69, 0x26, 0x00, 0x69, 0x96, 0x66, 0x00, 0x66, 0x09, 0x00, 0x90, 0x66, + 0x00, 0x68, 0x66, 0x06, 0x00, 0x68, 0x08, 0x00, 0x62, 0x66, 0x8A, 0x66, 0x06, 0x66, 0x96, 0x66, 0x00, 0x66, 0x69, 0x96, + 0x00, 0x69, 0x96, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, 0x61, 0x96, 0x66, 0x00, 0x62, 0x16, 0x66, 0x00, 0x90, 0x66, 0x00, + 0x00, 0x68, 0x88, 0x36, 0x00, 0x62, 0x26, 0x66, 0x09, 0x62, 0x96, 0x66, 0x96, 0x86, 0x00, 0x30, 0x16, 0x16, 0x00, 0x62, + 0x96, 0xB6, 0x00, 0x00, 0x64, 0x96, 0x00, 0x90, 0x83, 0x02, 0x00, 0x62, 0x86, 0xA8, 0x00, 0x1A, 0x18, 0x0A, 0x89, 0x68, + 0x06, 0x90, 0x88, 0x01, 0x00, 0x5A, 0x56, 0x09, 0x10, 0x18, 0x98, 0x00, 0x30, 0x66, 0x86, 0x00, 0x68, 0x88, 0x86, 0x00, + 0x62, 0x96, 0x66, 0x00, 0x68, 0x88, 0x86, 0x00, 0x62, 0xA6, 0x00, 0x00, 0x62, 0x26, 0x00, 0x66, 0x69, 0x26, 0x00, 0x69, + 0x96, 0x66, 0x00, 0x66, 0x09, 0x00, 0x90, 0x66, 0x00, 0x68, 0x66, 0x03, 0x00, 0x68, 0x08, 0x00, 0x6A, 0x66, 0xB2, 0x66, + 0x06, 0x66, 0x16, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x96, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x96, 0x66, + 0x00, 0x62, 0x16, 0x88, 0x00, 0x90, 0x66, 0x00, 0x00, 0x68, 0x88, 0x86, 0x00, 0x64, 0x26, 0x66, 0x09, 0x60, 0x86, 0x66, + 0x96, 0x16, 0x00, 0x90, 0x66, 0x96, 0x00, 0x60, 0x66, 0x96, 0x00, 0x00, 0x69, 0x46, 0x00, 0x69, 0x68, 0xA6, 0x00, 0x6A, + 0x86, 0x86, 0x00, 0x6B, 0x68, 0x05, 0x66, 0x68, 0x06, 0x6A, 0x86, 0x86, 0x00, 0x84, 0x36, 0x09, 0x69, 0x53, 0x96, 0x00, + 0x30, 0x66, 0x36, 0x00, 0x68, 0x55, 0x96, 0x00, 0x6A, 0x26, 0x00, 0x00, 0x68, 0x88, 0x86, 0x00, 0x62, 0x86, 0x09, 0x00, + 0x62, 0x86, 0x02, 0x66, 0x09, 0x00, 0x00, 0x69, 0x86, 0x66, 0x00, 0x66, 0x09, 0x00, 0x90, 0x66, 0x00, 0x68, 0x66, 0x09, + 0x00, 0x63, 0x08, 0x00, 0x62, 0x66, 0x69, 0x66, 0x06, 0x66, 0x36, 0x66, 0x00, 0x66, 0x61, 0x96, 0x00, 0x69, 0x96, 0x66, + 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x36, 0x96, 0x00, 0x30, 0x66, 0x09, 0x00, 0x90, 0x66, 0x00, 0x00, 0x68, 0x88, 0x86, + 0x00, 0x60, 0x96, 0x66, 0x02, 0x60, 0x86, 0x66, 0x36, 0x96, 0x00, 0x20, 0x66, 0x46, 0x00, 0x10, 0x66, 0xA6, 0x00, 0x00, + 0x68, 0x03, 0x00, 0x69, 0x61, 0x26, 0x00, 0x62, 0x96, 0x86, 0x00, 0x66, 0x69, 0x06, 0x66, 0x69, 0x06, 0x6A, 0x96, 0x86, + 0x00, 0x90, 0x86, 0x00, 0x69, 0x88, 0x96, 0x00, 0x60, 0x96, 0x66, 0x00, 0x68, 0x65, 0xA3, 0x00, 0x62, 0x26, 0x00, 0x00, + 0x68, 0x88, 0x86, 0x00, 0x62, 0x86, 0x08, 0x00, 0x62, 0x86, 0x01, 0x66, 0x21, 0x02, 0x00, 0x69, 0x36, 0x66, 0x00, 0x66, + 0x09, 0x00, 0x90, 0x66, 0x00, 0x68, 0x66, 0x09, 0x00, 0x68, 0x08, 0x00, 0x62, 0x63, 0x66, 0x63, 0x06, 0x66, 0x63, 0x66, + 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x86, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x56, 0x9B, 0x00, 0xA0, 0x6B, 0xA5, + 0x00, 0x90, 0x66, 0x00, 0x00, 0x68, 0x88, 0x86, 0x00, 0x60, 0x86, 0x66, 0x02, 0x80, 0x66, 0x56, 0x66, 0x26, 0x00, 0x90, + 0x66, 0x06, 0x00, 0x20, 0x66, 0x03, 0x00, 0x00, 0x66, 0x01, 0x00, 0x89, 0x61, 0x26, 0x00, 0x62, 0x96, 0x86, 0x00, 0x66, + 0x69, 0x06, 0x66, 0x69, 0x06, 0x62, 0x96, 0x86, 0x00, 0x90, 0x86, 0x00, 0x69, 0x38, 0x96, 0x00, 0x6A, 0x86, 0x66, 0x0A, + 0x68, 0x88, 0x86, 0x00, 0x62, 0x26, 0x22, 0x00, 0x68, 0x88, 0x86, 0x00, 0x62, 0x26, 0x00, 0x00, 0x62, 0x26, 0x00, 0x66, + 0x68, 0x26, 0x00, 0x69, 0x16, 0x66, 0x00, 0x66, 0x09, 0x20, 0x92, 0x66, 0x00, 0x68, 0x66, 0x08, 0x00, 0x68, 0x08, 0x00, + 0x62, 0x61, 0x66, 0x68, 0x06, 0x66, 0x61, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x66, 0x95, 0x00, 0x66, 0x69, 0x96, + 0x00, 0x69, 0x96, 0xB6, 0x00, 0x20, 0xB9, 0xB6, 0x00, 0x90, 0x66, 0x00, 0x00, 0x68, 0x88, 0x86, 0x00, 0x80, 0x86, 0x66, + 0x00, 0x80, 0x66, 0x86, 0x66, 0x26, 0x00, 0x80, 0x66, 0x96, 0x00, 0x00, 0x66, 0x09, 0x00, 0x90, 0x66, 0x02, 0x00, 0x10, + 0x66, 0x26, 0x00, 0x62, 0x96, 0x36, 0x00, 0x66, 0xA9, 0x02, 0x66, 0x69, 0x06, 0x6A, 0x66, 0x86, 0x00, 0x90, 0x86, 0x00, + 0x69, 0x88, 0x96, 0x00, 0x62, 0x86, 0x66, 0x02, 0x68, 0x88, 0x86, 0x00, 0x62, 0x96, 0x66, 0x00, 0x68, 0x88, 0x86, 0x00, + 0x62, 0x26, 0x00, 0x00, 0x62, 0x26, 0x00, 0x66, 0x61, 0x26, 0x00, 0x69, 0x96, 0x66, 0x00, 0x66, 0x09, 0x62, 0x96, 0x66, + 0x00, 0x68, 0x66, 0x06, 0x00, 0x68, 0x08, 0x00, 0x62, 0x39, 0x66, 0x69, 0x06, 0x66, 0x69, 0x66, 0x00, 0x66, 0x69, 0x96, + 0x00, 0x69, 0x06, 0x00, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x96, 0x66, 0x00, 0x62, 0x96, 0x66, 0x02, 0x10, 0x66, 0x00, + 0x00, 0x63, 0x88, 0x86, 0x00, 0x80, 0x36, 0x66, 0x00, 0x90, 0x66, 0x88, 0x66, 0x06, 0x00, 0x50, 0xB6, 0x16, 0x00, 0x00, + 0x66, 0x09, 0x00, 0x10, 0x56, 0x00, 0x00, 0x61, 0x61, 0x26, 0x00, 0x62, 0x96, 0x86, 0x00, 0x66, 0x69, 0x06, 0x66, 0x69, + 0x06, 0x62, 0x16, 0x18, 0x00, 0x90, 0x86, 0x00, 0x69, 0x88, 0x96, 0x00, 0x69, 0x06, 0x66, 0x09, 0x68, 0x88, 0x86, 0x00, + 0x62, 0x96, 0x66, 0x00, 0x68, 0x88, 0x86, 0x00, 0x62, 0x26, 0x00, 0x00, 0x62, 0x26, 0x00, 0x66, 0x69, 0x26, 0x00, 0x69, + 0x96, 0x66, 0x00, 0x66, 0x09, 0x62, 0x96, 0x66, 0x00, 0x68, 0x68, 0x96, 0x00, 0x68, 0x08, 0x00, 0x62, 0x19, 0x66, 0x62, + 0x06, 0x66, 0x64, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x06, 0x00, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x96, 0x66, + 0x00, 0x62, 0x26, 0x66, 0x02, 0x90, 0x66, 0x00, 0x00, 0x68, 0x88, 0x86, 0x00, 0x10, 0x66, 0x36, 0x00, 0x90, 0x66, 0x98, + 0x66, 0x06, 0x00, 0x62, 0x95, 0x56, 0x00, 0x00, 0x66, 0x09, 0x00, 0x50, 0x16, 0x00, 0x00, 0x68, 0x69, 0x26, 0x00, 0x62, + 0x96, 0x86, 0x00, 0x66, 0x61, 0x06, 0x66, 0x69, 0x06, 0x62, 0x96, 0x86, 0x00, 0x90, 0x86, 0x00, 0x69, 0x88, 0x96, 0x00, + 0x69, 0x06, 0x66, 0x09, 0x68, 0x53, 0x16, 0x00, 0x6A, 0x16, 0x66, 0x00, 0x68, 0x53, 0x16, 0x00, 0x62, 0x16, 0x49, 0x00, + 0x62, 0x26, 0x00, 0x66, 0x61, 0x26, 0x00, 0x69, 0x96, 0x66, 0x00, 0x66, 0x09, 0x62, 0x16, 0x66, 0x00, 0x68, 0x38, 0x16, + 0x00, 0x68, 0x93, 0x02, 0x62, 0x99, 0x36, 0x6A, 0x06, 0x66, 0x30, 0x66, 0x00, 0x66, 0x61, 0x96, 0x00, 0x69, 0x06, 0x00, + 0x00, 0x66, 0x61, 0x96, 0x00, 0x69, 0x96, 0x66, 0x00, 0x62, 0x96, 0x66, 0x0A, 0x90, 0x66, 0x00, 0x00, 0x63, 0x33, 0x86, + 0x00, 0x90, 0x66, 0x86, 0x00, 0x90, 0x66, 0x98, 0x66, 0x08, 0x00, 0x61, 0xA8, 0x66, 0x02, 0x00, 0x66, 0x09, 0x00, 0x62, + 0x86, 0x99, 0x00, 0x68, 0x61, 0x26, 0x00, 0x6A, 0x86, 0x86, 0x00, 0x66, 0x61, 0x06, 0x66, 0x61, 0x06, 0x62, 0x16, 0x86, + 0x00, 0x90, 0x86, 0x00, 0x69, 0x83, 0x96, 0x00, 0x68, 0x08, 0x63, 0x03, 0x68, 0x66, 0x48, 0x00, 0x80, 0x66, 0x16, 0x00, + 0x63, 0x66, 0x03, 0x00, 0x6A, 0x66, 0x26, 0x00, 0x62, 0x26, 0x00, 0x61, 0x86, 0x26, 0x00, 0x69, 0x96, 0x66, 0x00, 0x66, + 0x09, 0x80, 0x66, 0x96, 0x00, 0x68, 0x18, 0x56, 0x00, 0x68, 0x66, 0x09, 0x62, 0x29, 0x16, 0x62, 0x06, 0x66, 0x10, 0x66, + 0x00, 0x61, 0x66, 0x03, 0x00, 0x69, 0x06, 0x00, 0x00, 0x69, 0x66, 0x03, 0x00, 0x69, 0x26, 0x66, 0x02, 0x80, 0x66, 0x16, + 0x00, 0x90, 0x66, 0x00, 0x00, 0x52, 0x66, 0xA5, 0x00, 0x90, 0x66, 0x16, 0x00, 0x20, 0x66, 0x28, 0x66, 0x08, 0x00, 0x63, + 0x02, 0x63, 0x01, 0x00, 0x66, 0x09, 0x00, 0x62, 0x66, 0x66, 0x00, 0x62, 0x56, 0xA6, 0x00, 0x62, 0x53, 0x95, 0x00, 0x59, + 0x56, 0x02, 0x61, 0x55, 0x06, 0x10, 0x66, 0xA3, 0x00, 0x90, 0x86, 0x00, 0x5A, 0x55, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0, + 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x93, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x90, 0x59, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x88, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x08, 0x00, 0x00, 0x69, 0x08, 0x90, 0x36, + 0x00, 0x66, 0x02, 0x00, 0x00, 0x66, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x29, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x8A, 0x66, 0xA8, 0x00, 0x20, 0x66, 0x00, 0x52, 0xB6, 0x09, 0x00, 0x10, 0x66, 0xA8, 0x00, 0x00, + 0x65, 0x16, 0x00, 0x66, 0x66, 0x46, 0x00, 0x10, 0x66, 0xA8, 0x00, 0x68, 0x66, 0x26, 0x00, 0x80, 0x66, 0xA8, 0x00, 0x39, + 0xB6, 0x01, 0x00, 0x69, 0x03, 0x80, 0x66, 0x01, 0x00, 0x69, 0x08, 0x10, 0x86, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x69, 0x08, 0x00, 0x00, 0x92, 0x09, 0x20, 0x29, 0x00, 0x66, 0x02, 0x00, 0x00, 0x66, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x33, 0x86, 0x00, 0xBA, 0x66, 0x00, 0x6B, + 0x68, 0x06, 0x00, 0x69, 0x33, 0x86, 0x00, 0x20, 0x66, 0x96, 0x00, 0x66, 0x91, 0x09, 0x00, 0x69, 0x36, 0x16, 0x00, 0x92, + 0x68, 0x26, 0x00, 0x69, 0x36, 0x86, 0x00, 0x6B, 0x68, 0x96, 0x00, 0x69, 0x08, 0x69, 0x38, 0x96, 0x00, 0x92, 0x09, 0xB0, + 0x11, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x85, 0x08, 0x00, 0x89, 0x01, 0x90, 0x18, 0x00, 0x66, 0x89, 0x08, + 0x00, 0x66, 0x02, 0x8A, 0x18, 0x98, 0x31, 0x02, 0x89, 0x88, 0x01, 0x00, 0x10, 0x88, 0x09, 0x00, 0x89, 0x81, 0x01, 0x00, + 0x90, 0x98, 0x13, 0x00, 0x8A, 0x18, 0xA8, 0x00, 0x20, 0x88, 0x02, 0x00, 0x59, 0x36, 0x01, 0x8A, 0x98, 0x98, 0x00, 0x89, + 0x01, 0x38, 0x0A, 0x88, 0x90, 0x98, 0x80, 0x08, 0x81, 0x92, 0x98, 0x00, 0x89, 0x09, 0x81, 0x0A, 0x82, 0x88, 0x08, 0x00, + 0x68, 0x83, 0x86, 0x00, 0x3A, 0x66, 0x00, 0x66, 0x69, 0x26, 0x00, 0x69, 0x88, 0x86, 0x00, 0x90, 0x66, 0x96, 0x00, 0x66, + 0x02, 0x00, 0x00, 0x69, 0x86, 0x86, 0x00, 0x00, 0x61, 0x05, 0x00, 0x69, 0x86, 0x86, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, + 0x08, 0x69, 0x89, 0x96, 0x00, 0x69, 0x08, 0x6A, 0x54, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x33, 0x96, 0x00, + 0x69, 0x08, 0x90, 0x86, 0x00, 0x66, 0x63, 0x03, 0x00, 0x66, 0x02, 0x62, 0x36, 0x66, 0x63, 0x06, 0x69, 0x55, 0x96, 0x00, + 0x69, 0x53, 0x16, 0x00, 0x69, 0x35, 0x16, 0x00, 0x62, 0x36, 0x86, 0x00, 0x62, 0xB6, 0x86, 0x00, 0x6A, 0x35, 0xA6, 0x00, + 0x32, 0x86, 0x02, 0x62, 0x96, 0x86, 0x00, 0x62, 0x26, 0x66, 0x00, 0x68, 0x82, 0x86, 0x62, 0x03, 0x69, 0x88, 0x46, 0x00, + 0x6A, 0x03, 0x66, 0x00, 0x89, 0x65, 0x05, 0x00, 0x68, 0x88, 0x86, 0x00, 0x90, 0x66, 0x00, 0x66, 0x61, 0x26, 0x00, 0x69, + 0x38, 0x86, 0x00, 0x80, 0x66, 0x96, 0x00, 0x66, 0x99, 0x02, 0x00, 0x69, 0x96, 0xA9, 0x00, 0x00, 0x63, 0x08, 0x00, 0x69, + 0x86, 0x86, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x08, 0x69, 0x89, 0x96, 0x00, 0x69, 0x08, 0x92, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x69, 0x88, 0x96, 0x00, 0x69, 0x08, 0x90, 0x86, 0x00, 0x66, 0x66, 0x09, 0x00, 0x66, 0x02, 0x62, + 0x26, 0x66, 0x62, 0x06, 0x69, 0x88, 0x96, 0x00, 0x69, 0x88, 0x96, 0x00, 0x69, 0x88, 0x96, 0x00, 0x62, 0x96, 0x86, 0x00, + 0x62, 0x96, 0x86, 0x00, 0x62, 0x88, 0x26, 0x00, 0x80, 0x96, 0x00, 0x62, 0x96, 0x86, 0x00, 0x6A, 0x26, 0x56, 0x00, 0x61, + 0x39, 0x86, 0x69, 0x01, 0x64, 0x6B, 0x03, 0x00, 0x50, 0x26, 0x36, 0x00, 0x00, 0x68, 0x01, 0x00, 0x68, 0x83, 0x86, 0x00, + 0x90, 0x66, 0x00, 0x00, 0x61, 0x0B, 0x00, 0x00, 0x5A, 0x96, 0x00, 0x60, 0x63, 0x96, 0x00, 0x66, 0x66, 0x46, 0x00, 0x69, + 0x66, 0x96, 0x00, 0xA0, 0x66, 0x09, 0x00, 0x54, 0x36, 0x96, 0x00, 0x66, 0x61, 0x96, 0x00, 0x69, 0x08, 0x92, 0x52, 0x96, + 0x00, 0x69, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x88, 0x16, 0x00, 0x69, 0x08, 0x90, 0x86, + 0x00, 0x66, 0x66, 0x00, 0x00, 0x66, 0x02, 0x62, 0x26, 0x66, 0x62, 0x06, 0x61, 0x83, 0x96, 0x00, 0x69, 0x88, 0x96, 0x00, + 0x69, 0x88, 0x96, 0x00, 0x62, 0x96, 0x86, 0x00, 0x62, 0x96, 0x86, 0x00, 0x62, 0x85, 0xA8, 0x00, 0x80, 0x96, 0x00, 0x62, + 0x96, 0x86, 0x00, 0x60, 0x16, 0x86, 0x00, 0x69, 0x61, 0x66, 0x61, 0x01, 0x80, 0x66, 0x09, 0x00, 0x80, 0x86, 0x16, 0x00, + 0x40, 0x66, 0x0A, 0x00, 0x68, 0x88, 0x86, 0x00, 0x90, 0x66, 0x00, 0x40, 0x66, 0x09, 0x00, 0x00, 0x69, 0xA3, 0x00, 0x62, + 0x68, 0x16, 0x00, 0x88, 0x69, 0xA6, 0x00, 0x69, 0x36, 0x86, 0x00, 0x10, 0x66, 0x04, 0x00, 0x30, 0x56, 0xA3, 0x00, 0x61, + 0x66, 0x96, 0x00, 0x69, 0x08, 0x00, 0x61, 0x08, 0x00, 0x69, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x69, 0x88, 0x96, 0x00, 0x69, 0x08, 0x90, 0x86, 0x00, 0x66, 0xB6, 0x00, 0x00, 0x66, 0x02, 0x62, 0x26, 0x66, 0x62, 0x06, + 0x69, 0x88, 0x96, 0x00, 0x69, 0x88, 0x96, 0x00, 0x69, 0x88, 0x96, 0x00, 0x62, 0x96, 0x86, 0x00, 0x62, 0x06, 0x00, 0x00, + 0x10, 0x66, 0x01, 0x00, 0x80, 0x96, 0x00, 0x62, 0x96, 0x86, 0x00, 0x30, 0x86, 0x16, 0x00, 0x62, 0x63, 0x66, 0x63, 0x02, + 0x90, 0x66, 0x02, 0x00, 0x90, 0x66, 0x96, 0x00, 0x10, 0x36, 0x00, 0x00, 0x68, 0x88, 0x86, 0x00, 0x90, 0x66, 0x00, 0x10, + 0xB6, 0x00, 0x00, 0x92, 0x89, 0x86, 0x00, 0x61, 0x69, 0x96, 0x00, 0x99, 0x61, 0x26, 0x00, 0x69, 0x86, 0x86, 0x00, 0x80, + 0x36, 0x00, 0x00, 0x69, 0x86, 0x86, 0x00, 0x89, 0x69, 0x96, 0x00, 0x69, 0x08, 0x40, 0x66, 0x0A, 0x00, 0x69, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x88, 0x96, 0x00, 0x69, 0x08, 0x90, 0x86, 0x00, 0x66, 0x66, 0x09, + 0x00, 0x66, 0x0A, 0x62, 0x26, 0x66, 0x62, 0x06, 0x69, 0x88, 0x96, 0x00, 0x69, 0x83, 0x96, 0x00, 0x69, 0x88, 0x96, 0x00, + 0x62, 0x96, 0x86, 0x00, 0x62, 0x06, 0x00, 0x00, 0x92, 0x68, 0x96, 0x00, 0x80, 0x16, 0x00, 0x62, 0x96, 0x86, 0x00, 0x80, + 0xB6, 0x96, 0x00, 0x64, 0x66, 0x66, 0x66, 0x04, 0x30, 0x66, 0x09, 0x00, 0x20, 0x66, 0x26, 0x00, 0x30, 0x96, 0x00, 0x00, + 0x68, 0x88, 0x86, 0x00, 0x90, 0x66, 0x00, 0xB0, 0x16, 0x00, 0x00, 0x69, 0x88, 0x86, 0x00, 0x63, 0x6A, 0x96, 0x00, 0x66, + 0x68, 0x26, 0x00, 0x69, 0x86, 0x86, 0x00, 0x60, 0x16, 0x00, 0x00, 0x69, 0x86, 0x86, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, + 0x08, 0x90, 0x86, 0x00, 0x00, 0x69, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x88, 0x16, 0x00, + 0x69, 0x08, 0x90, 0x36, 0x00, 0x66, 0x63, 0x03, 0x00, 0x66, 0x02, 0x62, 0x26, 0x66, 0x62, 0x06, 0x69, 0x88, 0x96, 0x00, + 0x69, 0x88, 0x96, 0x00, 0x69, 0x88, 0x96, 0x00, 0x6A, 0x96, 0x86, 0x00, 0x62, 0x06, 0x00, 0x00, 0x69, 0x88, 0x96, 0x00, + 0x80, 0x96, 0x00, 0x62, 0x96, 0x86, 0x00, 0x90, 0x66, 0x26, 0x00, 0x60, 0x66, 0x61, 0x66, 0x00, 0x64, 0x66, 0x03, 0x00, + 0x00, 0x66, 0x06, 0x00, 0x69, 0x46, 0x00, 0x00, 0x63, 0x38, 0x86, 0x00, 0x90, 0x66, 0x00, 0x69, 0x46, 0x00, 0x00, 0x69, + 0x88, 0x86, 0x00, 0x66, 0x66, 0x66, 0x08, 0x66, 0x68, 0x26, 0x00, 0x69, 0x86, 0x86, 0x00, 0x62, 0x26, 0x00, 0x00, 0x69, + 0x86, 0x86, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x08, 0x90, 0x86, 0x00, 0x00, 0x69, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x69, 0x88, 0x96, 0x00, 0x69, 0x08, 0x90, 0x86, 0x00, 0x66, 0x61, 0x46, 0x00, 0x66, 0x02, 0x62, + 0x26, 0x66, 0x6A, 0x06, 0x69, 0x88, 0x96, 0x00, 0x69, 0x38, 0x96, 0x00, 0x69, 0x83, 0x96, 0x00, 0x62, 0x16, 0x86, 0x00, + 0x62, 0x06, 0x00, 0x00, 0x69, 0x83, 0x96, 0x00, 0x80, 0x86, 0x09, 0x62, 0x86, 0x86, 0x00, 0x90, 0x66, 0x26, 0x00, 0x80, + 0x66, 0x6A, 0x86, 0x00, 0x61, 0x69, 0xA6, 0x00, 0x00, 0x68, 0x03, 0x00, 0x68, 0x93, 0x49, 0x00, 0x68, 0x83, 0x86, 0x00, + 0x90, 0x66, 0x00, 0x65, 0x9B, 0x49, 0x00, 0x69, 0x38, 0x16, 0x00, 0x99, 0x69, 0x86, 0x09, 0x66, 0x63, 0x26, 0x00, 0x69, + 0x36, 0x86, 0x00, 0x61, 0x06, 0x00, 0x00, 0x69, 0x36, 0x86, 0x00, 0x66, 0x61, 0x96, 0x00, 0x92, 0x09, 0x20, 0x29, 0x00, + 0x00, 0x69, 0x08, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x99, 0x00, 0x00, 0x69, 0x88, 0x96, 0x00, 0x69, 0x08, 0x90, 0x86, + 0x00, 0x66, 0x5A, 0x16, 0x00, 0x66, 0x02, 0x62, 0x26, 0x66, 0x62, 0x06, 0x69, 0x88, 0x96, 0x00, 0x80, 0x66, 0x08, 0x00, + 0x69, 0x55, 0xA5, 0x00, 0x30, 0x56, 0x86, 0x00, 0x6A, 0x06, 0x00, 0x00, 0x30, 0x66, 0x01, 0x00, 0x90, 0x66, 0x08, 0x30, + 0x36, 0x36, 0x00, 0x20, 0x66, 0x06, 0x00, 0x80, 0x66, 0x50, 0x16, 0x00, 0x68, 0x8A, 0x16, 0x00, 0x00, 0x69, 0x08, 0x00, + 0x68, 0x66, 0x26, 0x00, 0x5A, 0x66, 0xA5, 0x00, 0x90, 0x66, 0x00, 0x66, 0x66, 0x26, 0x00, 0x34, 0x66, 0x25, 0x00, 0x00, + 0x60, 0x96, 0x00, 0x69, 0x66, 0x01, 0x00, 0x54, 0x66, 0x25, 0x00, 0x63, 0x08, 0x00, 0x00, 0x34, 0x66, 0x25, 0x00, 0x61, + 0x66, 0x43, 0x00, 0x69, 0x08, 0x90, 0x86, 0x00, 0x00, 0x69, 0x08, 0x00, 0x00, 0x00, 0x00, 0x66, 0x00, 0x66, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x08, 0x00, 0x00, 0x00, 0x90, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x90, 0x68, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xA2, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x40, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0xA8, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0x09, 0x00, 0x00, + 0x00, 0x90, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x08, 0x00, 0x00, 0x00, 0xA0, 0x26, 0x00, 0xA0, 0xA6, 0x9B, 0x00, 0x80, 0x08, + 0x00, 0x90, 0x08, 0x00, 0x18, 0x00, 0x80, 0x08, 0x00, 0x95, 0x00, 0x00, 0x00, 0x80, 0x08, 0x00, 0x10, 0x98, 0x05, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x6A, 0x02, 0x00, 0xB0, 0x89, 0x01, 0x00, 0x90, 0x56, 0x63, 0x0A, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x09, 0x00, 0x00, 0x00, 0x20, + 0x09, 0x00, 0x00, 0x09, 0xA9, 0x00, 0x40, 0x09, 0x00, 0x90, 0x09, 0x00, 0x94, 0x00, 0x90, 0x04, 0x00, 0x92, 0x00, 0x00, + 0x00, 0x90, 0x04, 0x00, 0x90, 0xA2, 0x09, 0x00, 0x00, 0x00, 0x90, 0x04, 0x00, 0x92, 0x00, 0x00, 0x90, 0x2A, 0x02, 0x00, + 0x80, 0x11, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x69, 0x96, 0x00, 0x66, 0x0B, 0x00, 0x69, 0x61, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6A, + 0x08, 0x00, 0x63, 0x36, 0x00, 0x00, 0x00, 0x66, 0x16, 0x00, 0x90, 0x66, 0x96, 0x00, 0x66, 0x66, 0x09, 0x66, 0x66, 0x09, + 0x66, 0x09, 0x69, 0x06, 0x8A, 0x66, 0xA8, 0x00, 0x90, 0x6B, 0x9B, 0x00, 0x8A, 0x66, 0xA8, 0x00, 0x90, 0x6B, 0x66, 0x00, + 0x69, 0x96, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x26, 0x61, 0x01, 0x10, 0x66, 0xA8, 0x00, 0x90, 0x05, 0x00, 0x00, + 0x6A, 0x02, 0x00, 0x6A, 0xBA, 0x01, 0x00, 0x95, 0x00, 0x00, 0x00, 0x6A, 0x0A, 0x00, 0x59, 0x00, 0x10, 0x08, 0x00, 0x95, + 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x50, 0x89, 0x08, 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x6A, 0xBA, + 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x02, 0x68, 0x48, 0x00, 0x69, 0x26, 0x00, 0x31, 0x69, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x04, 0x00, 0x66, 0x66, 0x00, 0x00, 0x20, 0x66, 0x86, 0x00, 0x90, 0x66, + 0x96, 0x00, 0x66, 0x98, 0x02, 0x66, 0x98, 0x02, 0x66, 0x09, 0x61, 0x06, 0x61, 0x35, 0x16, 0x00, 0x6A, 0x86, 0x66, 0x0A, + 0x61, 0x35, 0x86, 0x00, 0x6A, 0x86, 0x66, 0x0A, 0x69, 0x96, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x16, 0x69, 0x09, + 0x69, 0x86, 0x86, 0x00, 0x00, 0x49, 0x00, 0x00, 0x92, 0x00, 0x00, 0x90, 0x10, 0x0A, 0x00, 0x92, 0x00, 0x00, 0x00, 0x92, + 0x00, 0x00, 0x90, 0x04, 0x90, 0x04, 0x00, 0x92, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x90, 0x9A, 0x02, 0x00, 0x00, 0x22, + 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x90, 0x90, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x68, 0x09, 0x00, + 0x60, 0x26, 0x00, 0x95, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x40, 0x66, 0x66, + 0x04, 0x00, 0x20, 0x66, 0x36, 0x00, 0x10, 0x66, 0x16, 0x00, 0x66, 0x09, 0x00, 0x66, 0x09, 0x00, 0x66, 0x09, 0x69, 0x06, + 0x63, 0x88, 0x86, 0x00, 0x62, 0x96, 0x66, 0x02, 0x68, 0x88, 0x86, 0x00, 0x62, 0x96, 0x66, 0x02, 0x69, 0x96, 0x66, 0x00, + 0x66, 0x69, 0x96, 0x00, 0x69, 0x36, 0x69, 0x09, 0x69, 0x96, 0x86, 0x00, 0x10, 0x88, 0x0A, 0x20, 0x88, 0x09, 0x00, 0x10, + 0x18, 0x0A, 0x90, 0x88, 0x09, 0x00, 0x90, 0x88, 0x09, 0x00, 0x82, 0x01, 0x89, 0x01, 0x90, 0x83, 0x01, 0x00, 0x10, 0x88, + 0x09, 0x00, 0x10, 0x18, 0x09, 0x00, 0x89, 0x89, 0xA8, 0x00, 0x89, 0x89, 0xA8, 0x00, 0x88, 0x89, 0x03, 0x1A, 0x13, 0x0A, + 0x00, 0x00, 0x00, 0x11, 0x00, 0x68, 0x09, 0x00, 0x60, 0x26, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x66, 0x66, 0x0A, 0x00, 0x90, 0x66, 0x66, 0x00, 0x30, 0x66, 0x86, 0x00, 0x66, 0x09, + 0x00, 0x66, 0x09, 0x00, 0x66, 0x09, 0x61, 0x06, 0x68, 0x88, 0x86, 0x00, 0x6A, 0x96, 0x66, 0x02, 0x68, 0x88, 0x86, 0x00, + 0x62, 0x86, 0x66, 0x02, 0x69, 0x96, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, 0x61, 0x66, 0x61, 0x09, 0x69, 0x96, 0x86, 0x00, + 0x61, 0x68, 0x05, 0x6A, 0x35, 0x96, 0x00, 0x68, 0x68, 0x05, 0x69, 0x35, 0x96, 0x00, 0x69, 0x33, 0x96, 0x00, 0x69, 0x08, + 0x69, 0x08, 0x69, 0x53, 0x16, 0x00, 0x68, 0x63, 0xA6, 0x00, 0x68, 0x68, 0xA6, 0x00, 0x68, 0x69, 0x26, 0x00, 0x63, 0x69, + 0x26, 0x00, 0x66, 0x69, 0x06, 0x6B, 0x68, 0x05, 0x00, 0x00, 0x00, 0x25, 0x00, 0x68, 0x09, 0x00, 0x60, 0x26, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x90, 0x66, 0x66, 0x09, 0x00, 0x10, 0x66, + 0x66, 0x04, 0x30, 0x66, 0xB6, 0x00, 0x66, 0x98, 0x04, 0x66, 0x98, 0x04, 0x66, 0x09, 0x69, 0x06, 0x68, 0x88, 0x86, 0x00, + 0x62, 0x96, 0x66, 0x02, 0x68, 0x88, 0x86, 0x00, 0x62, 0xB6, 0x66, 0x02, 0x69, 0x96, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, + 0x69, 0x66, 0x63, 0x09, 0x61, 0x06, 0x00, 0x00, 0x68, 0x69, 0x06, 0x62, 0x38, 0x96, 0x00, 0x68, 0x69, 0x06, 0x61, 0x88, + 0x96, 0x00, 0x69, 0x88, 0x96, 0x00, 0x69, 0x08, 0x69, 0x08, 0x69, 0x88, 0x96, 0x00, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, + 0xA6, 0x00, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, 0xA6, 0x00, 0x66, 0x69, 0x06, 0x66, 0x69, 0x06, 0x00, 0x00, 0x90, 0x06, + 0x00, 0x68, 0x09, 0x00, 0x60, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA4, 0x00, 0x00, 0x88, 0x00, 0x00, + 0x00, 0x90, 0x86, 0x68, 0x09, 0x00, 0x80, 0x96, 0x66, 0x02, 0x60, 0x96, 0x66, 0x00, 0x66, 0x83, 0x0A, 0x66, 0x85, 0x0A, + 0x66, 0x09, 0x69, 0x06, 0x68, 0x88, 0x86, 0x00, 0x62, 0x96, 0x66, 0x02, 0x68, 0x88, 0x86, 0x00, 0x62, 0x66, 0x66, 0x02, + 0x69, 0x96, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x63, 0x66, 0x09, 0x69, 0x06, 0x00, 0x00, 0x89, 0x68, 0x06, 0x8A, + 0x38, 0x96, 0x00, 0x81, 0x68, 0x06, 0x69, 0x88, 0x96, 0x00, 0x69, 0x88, 0x96, 0x00, 0x69, 0x08, 0x69, 0x08, 0x69, 0x88, + 0x96, 0x00, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, 0x26, 0x00, 0x63, 0x69, 0x26, 0x00, 0x66, 0x69, + 0x06, 0x66, 0x69, 0x06, 0x00, 0x00, 0x10, 0x08, 0x00, 0x68, 0x09, 0x00, 0x60, 0xA6, 0x00, 0x00, 0x00, 0x00, 0x68, 0x26, + 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xB6, 0x63, 0x01, 0x00, 0x50, 0x86, 0x66, 0x09, 0x6A, 0x86, + 0x66, 0x0A, 0x66, 0x09, 0x00, 0x66, 0x09, 0x00, 0x66, 0x09, 0x61, 0x06, 0x68, 0x88, 0x86, 0x00, 0x62, 0x96, 0x66, 0x02, + 0x68, 0x88, 0x86, 0x00, 0x62, 0xB6, 0x66, 0x02, 0x69, 0x96, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x61, 0x66, 0x09, + 0x69, 0x46, 0xAA, 0x00, 0x8A, 0x66, 0x06, 0x90, 0x65, 0x96, 0x00, 0x8A, 0x66, 0x06, 0x69, 0x66, 0x96, 0x00, 0x69, 0x66, + 0x96, 0x00, 0x69, 0x08, 0x69, 0x08, 0x69, 0x88, 0x16, 0x00, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, + 0x26, 0x00, 0x68, 0x69, 0x26, 0x00, 0x66, 0x69, 0x06, 0x66, 0x29, 0x02, 0x00, 0x00, 0x30, 0x02, 0x00, 0x68, 0x09, 0x00, + 0x60, 0x26, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x02, 0x00, 0x24, 0x31, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x36, 0x65, + 0x08, 0x00, 0x60, 0x36, 0x65, 0x09, 0x62, 0x86, 0x66, 0x02, 0x66, 0x09, 0x00, 0x66, 0x09, 0x00, 0x66, 0x09, 0x69, 0x06, + 0x68, 0x88, 0x86, 0x00, 0x62, 0x96, 0x66, 0x02, 0x68, 0x88, 0x86, 0x00, 0x62, 0x16, 0x66, 0x02, 0x69, 0x96, 0x66, 0x00, + 0x66, 0x69, 0x96, 0x00, 0x61, 0xB9, 0x66, 0x09, 0x69, 0x96, 0x86, 0x00, 0x63, 0x68, 0x06, 0x69, 0x83, 0x96, 0x00, 0x63, + 0x68, 0x06, 0x69, 0x88, 0x98, 0x00, 0x61, 0x13, 0x98, 0x00, 0x69, 0x08, 0x69, 0x08, 0x69, 0x88, 0x96, 0x00, 0x68, 0x69, + 0x26, 0x00, 0x68, 0x61, 0x26, 0x00, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, 0x26, 0x00, 0x66, 0x69, 0x06, 0x66, 0x69, 0x06, + 0x00, 0x00, 0x6A, 0x00, 0x00, 0x68, 0x09, 0x00, 0x60, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x66, 0x86, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x96, 0x69, 0x0B, 0x00, 0x6A, 0x26, 0x68, 0x08, 0x69, 0x06, 0x66, 0x09, 0x66, 0x09, + 0x00, 0x66, 0x09, 0x00, 0x66, 0x01, 0x69, 0x06, 0x68, 0x88, 0x86, 0x00, 0x62, 0x96, 0x66, 0x02, 0x68, 0x88, 0x86, 0x00, + 0x62, 0x16, 0x66, 0x02, 0x69, 0x96, 0x66, 0x00, 0x66, 0x69, 0x96, 0x00, 0x69, 0x19, 0x66, 0x09, 0x69, 0x16, 0x86, 0x00, + 0x66, 0x69, 0x06, 0x69, 0x88, 0x96, 0x00, 0x66, 0x69, 0x06, 0x69, 0x88, 0x96, 0x00, 0x69, 0x88, 0x96, 0x00, 0x69, 0x03, + 0x69, 0x08, 0x69, 0x83, 0x96, 0x00, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, 0xA6, 0x00, 0x63, 0x69, 0xA6, 0x00, 0x68, 0x69, + 0x26, 0x00, 0x66, 0x69, 0x06, 0x66, 0x69, 0x06, 0x99, 0x00, 0x81, 0x00, 0x00, 0x68, 0x48, 0x00, 0x62, 0x26, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x60, 0x96, 0x69, 0x06, 0x00, 0x62, 0x26, + 0x68, 0x08, 0x69, 0x06, 0x66, 0x09, 0x66, 0x98, 0x02, 0x66, 0x18, 0x0A, 0x66, 0x09, 0x69, 0x06, 0x68, 0x33, 0x86, 0x00, + 0x62, 0x86, 0x66, 0x02, 0x68, 0x38, 0x86, 0x00, 0x6A, 0x16, 0x66, 0x02, 0x69, 0x16, 0x66, 0x00, 0x66, 0x61, 0x96, 0x00, + 0x69, 0x99, 0x66, 0x09, 0x69, 0x16, 0x86, 0x00, 0x66, 0x61, 0x06, 0x69, 0x88, 0x96, 0x00, 0x66, 0x61, 0x06, 0x69, 0x83, + 0x96, 0x00, 0x69, 0x33, 0x96, 0x00, 0x61, 0x08, 0x69, 0x08, 0x69, 0x33, 0x16, 0x00, 0x68, 0x61, 0x26, 0x00, 0x68, 0x61, + 0x26, 0x00, 0x68, 0x61, 0x26, 0x00, 0x68, 0x61, 0x26, 0x00, 0x66, 0x61, 0x06, 0x66, 0x61, 0x06, 0x66, 0x00, 0x13, 0x00, + 0x00, 0x52, 0x96, 0x00, 0x66, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x66, 0x00, 0x00, + 0x00, 0x62, 0x96, 0x69, 0x26, 0x00, 0x69, 0x06, 0x61, 0x06, 0x68, 0x03, 0x63, 0x08, 0x66, 0x66, 0x09, 0x66, 0x66, 0x01, + 0x66, 0x01, 0x69, 0x06, 0x52, 0x66, 0xA5, 0x00, 0x80, 0x66, 0x16, 0x00, 0x59, 0x66, 0xA5, 0x00, 0x60, 0x66, 0x86, 0x00, + 0x34, 0x66, 0x96, 0x00, 0x69, 0x66, 0x08, 0x00, 0x69, 0x09, 0x66, 0x09, 0x34, 0x66, 0x95, 0x00, 0x61, 0x65, 0x06, 0x5A, + 0x56, 0x96, 0x00, 0x61, 0x65, 0x06, 0x80, 0x66, 0x08, 0x00, 0x80, 0x66, 0x08, 0x00, 0x69, 0x08, 0x69, 0x08, 0x10, 0x66, + 0x08, 0x00, 0x3A, 0x66, 0x01, 0x00, 0x3A, 0x66, 0x01, 0x00, 0x69, 0x63, 0xA6, 0x00, 0x69, 0x65, 0x26, 0x00, 0x61, 0x63, + 0x06, 0x39, 0x56, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x2A, 0x04, 0x00, + 0x00, 0x2A, 0x00, 0x00, 0x8A, 0x24, 0x04, 0x00, 0x00, 0x2A, 0x00, 0x00, 0x00, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x93, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA2, 0x00, 0x00, 0x2A, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x1B, 0x44, 0x00, 0xA0, 0x0A, 0x42, + 0x00, 0x00, 0x24, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x30, 0x63, 0x02, 0x20, 0xB6, 0x08, 0x00, 0x10, 0x55, 0x09, 0x00, 0x60, 0x66, 0x86, 0x00, 0x00, 0x68, 0x09, 0x00, 0x68, + 0x09, 0x59, 0xB8, 0x29, 0x00, 0x61, 0x66, 0x26, 0x00, 0x00, 0x55, 0x05, 0x00, 0x00, 0x00, 0x69, 0x09, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9A, 0x94, 0x09, 0x90, 0x49, 0xA9, 0x00, 0x90, 0x22, 0x09, 0x00, 0x60, + 0x16, 0x65, 0x09, 0x00, 0x99, 0x02, 0x00, 0x99, 0x02, 0x22, 0x44, 0x64, 0x00, 0x99, 0x9A, 0x09, 0x00, 0x20, 0x09, 0x29, + 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x13, 0x0A, 0x90, + 0x88, 0x09, 0x00, 0x81, 0x82, 0xA8, 0x00, 0x60, 0x26, 0x68, 0x09, 0x00, 0x68, 0x09, 0x00, 0x68, 0x09, 0x81, 0x81, 0x09, + 0x00, 0x89, 0x81, 0x09, 0x00, 0x20, 0x81, 0x01, 0x00, 0x00, 0x00, 0x95, 0x00, 0x90, 0x81, 0x11, 0x18, 0x0A, 0x1A, 0x88, + 0x81, 0xA1, 0x00, 0x10, 0x66, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x68, 0x68, 0x05, 0x69, 0x53, 0x96, 0x00, 0x68, 0x61, 0xA6, 0x00, 0x60, 0x26, 0x68, 0x09, 0x00, + 0x63, 0x09, 0x00, 0x68, 0x09, 0x68, 0x63, 0x26, 0x00, 0x63, 0x6B, 0x26, 0x00, 0x6A, 0x86, 0x86, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x6A, 0x86, 0x66, 0x68, 0x08, 0x61, 0x61, 0x86, 0x16, 0x00, 0x60, 0xAA, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x69, 0x06, 0x69, 0x88, 0x96, 0x00, 0x68, + 0x69, 0x26, 0x00, 0x60, 0x96, 0x55, 0x0A, 0xA0, 0x66, 0x04, 0x00, 0x68, 0x09, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, 0xA6, + 0x00, 0x6A, 0x96, 0x86, 0x00, 0x8A, 0x01, 0x00, 0x00, 0x6A, 0x96, 0x66, 0x69, 0x08, 0x68, 0x62, 0x96, 0x36, 0x00, 0x60, + 0x1A, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x81, 0x68, 0x06, 0x69, 0x88, 0x96, 0x00, 0x68, 0x69, 0x26, 0x00, 0x60, 0x96, 0x86, 0x00, 0x30, 0x16, 0x00, 0x00, 0x68, + 0x09, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, 0x26, 0x00, 0x62, 0x16, 0x86, 0x00, 0x8A, 0x01, 0x00, 0x00, 0x62, 0x96, 0x66, + 0x69, 0x08, 0x81, 0x61, 0x96, 0x86, 0x00, 0x6A, 0x61, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8A, 0x66, 0x06, 0x69, 0x66, 0x96, 0x00, 0x68, 0x69, 0xA6, 0x00, 0x60, + 0x26, 0x68, 0x01, 0x62, 0x25, 0x98, 0x00, 0x68, 0x09, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, 0x26, 0x00, 0x62, 0x96, 0x86, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x6A, 0x96, 0x66, 0x66, 0x08, 0x3A, 0x66, 0x66, 0x86, 0x00, 0x61, 0x16, 0xA1, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6B, 0x68, 0x06, 0x69, + 0x13, 0x28, 0x00, 0x68, 0x69, 0x26, 0x00, 0x60, 0x26, 0x68, 0x09, 0x69, 0x98, 0x96, 0x00, 0x68, 0x09, 0x68, 0x69, 0x26, + 0x00, 0x68, 0x69, 0x26, 0x00, 0x62, 0x96, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x96, 0x66, 0x99, 0x09, 0x6B, 0x69, + 0x96, 0x99, 0x00, 0x16, 0x6A, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x66, 0x69, 0x06, 0x69, 0x88, 0x96, 0x00, 0x68, 0x69, 0x26, 0x00, 0x60, 0x26, 0x68, 0x09, 0x69, + 0x98, 0x16, 0x00, 0x63, 0x09, 0x68, 0x69, 0xA6, 0x00, 0x68, 0x61, 0x26, 0x00, 0x62, 0x96, 0x86, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x6A, 0x96, 0x66, 0x69, 0x08, 0x66, 0x6A, 0x96, 0x86, 0x00, 0xA6, 0xA0, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x61, 0x06, 0x69, 0x33, 0x96, 0x00, 0x68, + 0x61, 0xA6, 0x00, 0x69, 0x26, 0x63, 0x09, 0x69, 0x83, 0x96, 0x00, 0x68, 0x09, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, 0x26, + 0x00, 0x62, 0x16, 0x86, 0x00, 0x94, 0x09, 0x00, 0x00, 0x62, 0x16, 0x66, 0x68, 0x01, 0x66, 0x69, 0x16, 0x86, 0x00, 0x16, + 0x1A, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x61, 0x65, 0x06, 0x80, 0x66, 0x08, 0x00, 0x69, 0x63, 0x26, 0x00, 0x68, 0x28, 0x16, 0x00, 0x10, 0x66, 0x08, 0x00, 0x68, + 0x09, 0x68, 0x69, 0x26, 0x00, 0x68, 0x69, 0x26, 0x00, 0x10, 0x65, 0xA3, 0x00, 0x62, 0x08, 0x00, 0x00, 0x90, 0x65, 0x53, + 0x36, 0x0A, 0x61, 0x86, 0x63, 0xA3, 0x00, 0x61, 0x66, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x90, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; struct UVWH @@ -537,4 +537,4 @@ UVWH fmvFontUV[256] = { 58, 54, 6, 18 }, { 0, 0, 0, 0 }, { 220, 36, 6, 18 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 228, 36, 6, 18 }, { 236, 36, 6, 18 }, { 14, 54, 6, 18 }, { 244, 36, 5, 18 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 } -}; \ No newline at end of file +}; diff --git a/src_rebuild/Game/C/fmvplay.c b/src_rebuild/Game/C/fmvplay.c index 28fa50920..e8cdc6b9d 100644 --- a/src_rebuild/Game/C/fmvplay.c +++ b/src_rebuild/Game/C/fmvplay.c @@ -7,7 +7,6 @@ #include "E3stuff.h" #include "main.h" - // FMV int gSubtitles = 1; int gNoFMV = 0; @@ -51,7 +50,7 @@ void PlayRender(RENDER_ARGS *args) #ifdef PSX #if 0 - + if (Loadfile("FMV\\FMV.EXE", (char*)_fmv_memory) != 0) { oldsp = GetSp(); @@ -62,7 +61,7 @@ void PlayRender(RENDER_ARGS *args) SetSp(oldsp); } #endif - + #else if (gNoFMV == 0) @@ -96,4 +95,4 @@ void PlayFMV(unsigned char render) if ((render - 1 & 0xff) < 98) SetPleaseWait(NULL); -} \ No newline at end of file +} diff --git a/src_rebuild/Game/C/fmvplay.h b/src_rebuild/Game/C/fmvplay.h index 903d0a084..68957d22a 100644 --- a/src_rebuild/Game/C/fmvplay.h +++ b/src_rebuild/Game/C/fmvplay.h @@ -22,6 +22,6 @@ extern int gNoFMV; extern void ReInitSystem(); // 0x0004D478 extern void PlayFMV(unsigned char render); // 0x0004D518 -extern void PlayRender(RENDER_ARGS* args); +extern void PlayRender(RENDER_ARGS* args); // 0x0004D5D0 -#endif +#endif // FMVPLAY_H diff --git a/src_rebuild/Game/C/gamesnd.c b/src_rebuild/Game/C/gamesnd.c index 707114e00..4d0c72844 100644 --- a/src_rebuild/Game/C/gamesnd.c +++ b/src_rebuild/Game/C/gamesnd.c @@ -167,17 +167,17 @@ int CarHasSiren(int index) { if (index == 4) { - if (GameLevel == 0) + if (GameLevel == LEVEL_CHICAGO) { if (MissionHeader->residentModels[4] == 8) return M_SHRT_2(SOUND_BANK_SFX, 12); } - else if (GameLevel == 2) + else if (GameLevel == LEVEL_VEGAS) { if (MissionHeader->residentModels[4] == 9) return M_SHRT_2(SOUND_BANK_SFX, 12); } - else if (GameLevel == 3) + else if (GameLevel == LEVEL_RIO) { if (MissionHeader->residentModels[4] == 10) return M_SHRT_2(SOUND_BANK_SFX, 12); @@ -206,7 +206,7 @@ int ResidentModelsBodge(void) int i; int j; - if (gCurrentMissionNumber == 24 || + if (gCurrentMissionNumber == 24 || gCurrentMissionNumber == 27 || gCurrentMissionNumber == 29 || gCurrentMissionNumber == 30 || @@ -222,26 +222,26 @@ int ResidentModelsBodge(void) return 5; } - if (GameLevel == 0) + if (GameLevel == LEVEL_CHICAGO) { i = 11; if (j != 9 && j != i) return 3; } - else if (GameLevel == 1) + else if (GameLevel == LEVEL_HAVANA) { - if (j - 8U > 1) + if (j - 8U > 1) return 3; } - else if (GameLevel == 2) + else if (GameLevel == LEVEL_VEGAS) { i = 8; if (j != i) return 3; } - else if (GameLevel == 3) + else if (GameLevel == LEVEL_RIO) { i = 11; @@ -259,10 +259,10 @@ int MapCarIndexToBank(int index) { static char car_banks[4][9] = { - {12, 4, 13, 5, 16, 9, 2, 15, 10}, - {10, 11, 7, 6, 17, 17, 2, 5, 4}, - {14, 3, 4, 6, 11, 9, 2, 17, 10}, - {8, 7, 13, 9, 2, 17, 17, 11, 16}, + { 12, 4, 13, 5, 16, 9, 2, 15, 10 }, + { 10, 11, 7, 6, 17, 17, 2, 5, 4 }, + { 14, 3, 4, 6, 11, 9, 2, 17, 10 }, + { 8, 7, 13, 9, 2, 17, 17, 11, 16 } }; int* RM; @@ -339,7 +339,7 @@ void LoadLevelSFX(int missionNum) missionNum != 40) { // first bank - directions - // second bank - + // second bank - if (GameLevel & 2) { LoadBankFromLump(SOUND_BANK_VOICES, SBK_COP_PHRASES_START + (GameLevel & 1) * 8 + (GameLevel & 1) * 2); @@ -357,13 +357,13 @@ void LoadLevelSFX(int missionNum) // load ambient effects if (NumPlayers < 2 || NoPlayerControl != 0) { - if (GameLevel == 0) + if (GameLevel == LEVEL_CHICAGO) LoadBankFromLump(SOUND_BANK_ENVIRONMENT, SBK_CITY_EFFECTS_START + city_night_fx); - else if (GameLevel == 1) + else if (GameLevel == LEVEL_HAVANA) LoadBankFromLump(SOUND_BANK_ENVIRONMENT, SBK_CITY_EFFECTS_START + city_night_fx + 2); - else if (GameLevel == 2) + else if (GameLevel == LEVEL_VEGAS) LoadBankFromLump(SOUND_BANK_ENVIRONMENT, SBK_CITY_EFFECTS_START + city_night_fx + 4); - else if (GameLevel == 3) + else if (GameLevel == LEVEL_RIO) LoadBankFromLump(SOUND_BANK_ENVIRONMENT, SBK_CITY_EFFECTS_START + city_night_fx + 6); } @@ -460,14 +460,14 @@ void LoadLevelSFX(int missionNum) index = 0; } - // mission bank + // mission bank if (index != 0) LoadBankFromLump(SOUND_BANK_MISSION, index); // special siren bank - if (GameLevel == 0 || GameLevel == 3) + if (GameLevel == LEVEL_CHICAGO || GameLevel == LEVEL_RIO) LoadBankFromLump(SOUND_BANK_SFX, SBK_ID_SPECIAL_SIREN1); - else if (GameLevel == 2) + else if (GameLevel == LEVEL_VEGAS) LoadBankFromLump(SOUND_BANK_SFX, SBK_ID_SPECIAL_SIREN2); // [A] padding? @@ -534,11 +534,11 @@ void StartPlayerCarSounds(int playerId, int model, VECTOR* pos) siren = CarHasSiren(model); // rev sound - channel = playerId * 3; + channel = playerId * 3; Start3DSoundVolPitch(channel, SOUND_BANK_CARS, carSampleId * 3, pos->vx, pos->vy, pos->vz, -10000, 4096); // idle sound - channel = playerId * 3 + 1; + channel = playerId * 3 + 1; Start3DSoundVolPitch(channel, SOUND_BANK_CARS, carSampleId * 3 + 1, pos->vx, pos->vy, pos->vz, -10000, 4096); if (siren) @@ -597,7 +597,7 @@ void StartGameSounds(void) } InitEnvSnd(MAX_LEVEL_ENVSOUNDS); - + if (NumPlayers < 2 || NoPlayerControl != 0) AddEnvSounds(GameLevel, gTimeOfDay); @@ -778,7 +778,6 @@ void ControlCarRevs(CAR_DATA* cp) } } - // [D] [T] void DoSpeech(int chan, int sound) { @@ -895,11 +894,11 @@ void CopSay(int phrase, int direction) if (phrase != 15) return; - if (cop_bank != 1) + if (cop_bank != 1) { if (cop_bank == 2) return; - + if (cop_bank == 3) return; @@ -911,7 +910,6 @@ void CopSay(int phrase, int direction) PlaySpeech(&gSpeechQueue, direction + 1); } - // [D] [T] void BodSay(int phrase) { @@ -1056,8 +1054,8 @@ void DoDopplerSFX(void) // play car music // vans in 'Caine's Compound' should not listen to it - if (gCurrentMissionNumber != 7 && - car_ptr->controlType == CONTROL_TYPE_CIV_AI && + if (gCurrentMissionNumber != 7 && + car_ptr->controlType == CONTROL_TYPE_CIV_AI && car_ptr->ap.model > 0 && car_ptr->ap.model < 3 && indexlist[i] == 1) { @@ -1230,8 +1228,8 @@ void DoDopplerSFX(void) else sample = bank * 3; - car_noise[j].chan = Start3DTrackingSound(-1, SOUND_BANK_CARS, sample, - (VECTOR*)car_data[car].hd.where.t, + car_noise[j].chan = Start3DTrackingSound(-1, SOUND_BANK_CARS, sample, + (VECTOR*)car_data[car].hd.where.t, (LONGVECTOR3*)car_data[car].st.n.linearVelocity); LockChannel(car_noise[j].chan); @@ -1287,7 +1285,7 @@ void DoDopplerSFX(void) sample = bank * 3; car_noise[j].chan = Start3DTrackingSound(-1, SOUND_BANK_CARS, sample, (VECTOR*)cp->hd.where.t, (LONGVECTOR3*)cp->st.n.linearVelocity); - + LockChannel(car_noise[j].chan); } @@ -1363,10 +1361,10 @@ void DoPoliceLoudhailer(int cars, ushort* indexlist, u_int* dist) if (car_ptr->controlType == CONTROL_TYPE_PURSUER_AI && car_ptr->ai.p.dying == 0 && time < loudhail_time && rnd == (rnd / 31) * 31) { - Start3DTrackingSound(-1, SOUND_BANK_VOICES, rnd % 2 + 13, - (VECTOR*)car_ptr->hd.where.t, + Start3DTrackingSound(-1, SOUND_BANK_VOICES, rnd % 2 + 13, + (VECTOR*)car_ptr->hd.where.t, (LONGVECTOR3*)car_ptr->st.n.linearVelocity); - + loudhail_time = 0; break; } @@ -1376,7 +1374,6 @@ void DoPoliceLoudhailer(int cars, ushort* indexlist, u_int* dist) loudhail_time++; } - // [D] [T] void CollisionSound(char player_id, CAR_DATA* cp, int impact, int car_car) { @@ -1451,7 +1448,7 @@ void CollisionSound(char player_id, CAR_DATA* cp, int impact, int car_car) player[playerid].crash_timer = 2; - if ((impact & 5) && + if ((impact & 5) && GetPlayerId(cp) == 0 && (gCurrentMissionNumber - 2 <= 2 || gCurrentMissionNumber == 9 || gCurrentMissionNumber == 10 || gCurrentMissionNumber == 27)) { @@ -1530,7 +1527,6 @@ void ExplosionSound(VECTOR* pos, int type) sc1 = 1; sc2 = 3; } - P.vx = pos->vx * sc1 + player[0].cameraPos.vx * sc2; P.vy = pos->vy * sc1 + player[0].cameraPos.vy * sc2; @@ -1541,7 +1537,6 @@ void ExplosionSound(VECTOR* pos, int type) 0, ((FrameCnt * pos->vx ^ rnd * pos->vz) & 0x3ffU) + 3584); } - // [D] [T] void JerichoSpeak(void) { @@ -1606,7 +1601,7 @@ void SoundTasks(void) UpdateEnvSounds[EStags.func_cnt++](envsnd, ESdata, 0); EStags.func_cnt %= 4; - + lcp = player; i = 0; while (i < NumPlayers) @@ -1655,7 +1650,7 @@ void SoundTasks(void) chan = i * 3; SetChannelPosition3(chan, position, velocity, vol, cp->hd.revs / 4 + lcp->revsvol / 64 + 1500, 0); - + if (lcp->car_is_sounding == 0) vol = lcp->idlevol; else @@ -1727,16 +1722,15 @@ void SoundTasks(void) // [D] [T] void InitMusic(int musicnum) { - static char* music_pt; // offset 0xc - static char* sample_pt; // offset 0x10 - static char xm_samples; // offset 0x4 + static char* music_pt; + static char* sample_pt; + static char xm_samples; int sample_len; int music_len; char* name; char* addr; int musicpos[3]; - char* musicname = "SOUND\\MUSIC.BIN"; #ifndef PSX @@ -1770,7 +1764,7 @@ void InitMusic(int musicnum) if (NewLevel) { printInfo("NewLevel in InitMusic()\n"); - + music_pt = D_MALLOC(music_len + 3U & ~3); sample_pt = D_TEMPALLOC(sample_len); @@ -1821,7 +1815,6 @@ void InitTunnels(char n) tunnels.tunnel_cnt = 0; } - // [D] [T] int AddTunnel(int x1, int y1, int z1, int x2, int y2, int z2) { @@ -1941,7 +1934,6 @@ void AddTunnels(int level) } } - // [D] [T] void InitEnvSnd(int num_envsnds) { @@ -2102,10 +2094,10 @@ void IdentifyZone(envsound* ep, envsoundinfo* E, int pl) float ldx, ldz, ndx, ndz, dist, l_inv_len, offset; ldx = ep[i].pos2.vx - ep[i].pos.vx; ldz = ep[i].pos2.vz - ep[i].pos.vz; - + // find inverse length of line l_inv_len = rsqrtf(ldx * ldx + ldz * ldz); - + // find normal (perpendicular) by using cross product and normalize ndx = ldz * l_inv_len; ndz = -ldx * l_inv_len; @@ -2133,7 +2125,7 @@ void IdentifyZone(envsound* ep, envsoundinfo* E, int pl) zones.h |= 1 << (i & 31); tmp[j] = i; - + // also store length _g[j] = l_inv_len; j++; @@ -2212,7 +2204,6 @@ void IdentifyZone(envsound* ep, envsoundinfo* E, int pl) } } - // [D] [T] void CalcEffPos(envsound* ep, envsoundinfo* E, int pl) { @@ -2223,11 +2214,11 @@ void CalcEffPos(envsound* ep, envsoundinfo* E, int pl) for (i = 0; i < 4; i++) { int snd; - + E->flags &= ~(1 << (i & 0x1f)); - + snd = E->thisS[i]; - + if (snd == -1) continue; @@ -2237,7 +2228,7 @@ void CalcEffPos(envsound* ep, envsoundinfo* E, int pl) // clamp to bounds when outside minX = MIN(ep[snd].pos.vx, ep[snd].pos2.vx); maxX = MAX(ep[snd].pos.vx, ep[snd].pos2.vx); - + if (minX > E->cam_pos.vx) E->eff_pos[i].vx = minX; else if (maxX < E->cam_pos.vx) @@ -2262,7 +2253,7 @@ void CalcEffPos(envsound* ep, envsoundinfo* E, int pl) if ((ep[snd].flags & 1) != 0) { E->eff_pos[i].vx = ep[snd].pos.vx; - + minZ = MIN(ep[snd].pos.vz, ep[snd].pos2.vz); maxZ = MAX(ep[snd].pos.vz, ep[snd].pos2.vz); @@ -2343,7 +2334,7 @@ void CalcEffPos2(envsound* ep, envsoundinfo* E, int pl) if (ep[snd].type == 2) { int minX, maxX, minZ, maxZ; - + maxX = MAX(ep[snd].pos.vx, ep[snd].pos2.vx); minX = MIN(ep[snd].pos.vx, ep[snd].pos2.vx); @@ -2367,17 +2358,17 @@ void CalcEffPos2(envsound* ep, envsoundinfo* E, int pl) { E->eff_pos[i].vz = minZ; } - + E->flags |= 1 << (i & 0x1f); } else if (ep[snd].type == 4) { - if ((ep[snd].flags & 8) == 0) + if ((ep[snd].flags & 8) == 0) { int minX, maxX, maxZ; maxZ = MAX(ep[snd].pos.vz, ep[snd].pos2.vz); - + if (E->cam_pos.vz > maxZ) { E->eff_pos[i].vz = maxZ; @@ -2396,7 +2387,7 @@ void CalcEffPos2(envsound* ep, envsoundinfo* E, int pl) { E->eff_pos[i].vx = maxX; } - else if (E->cam_pos.vx > E->eff_pos[i].vx) + else if (E->cam_pos.vx > E->eff_pos[i].vx) { E->eff_pos[i].vx = (E->cam_pos).vx; } @@ -2404,7 +2395,7 @@ void CalcEffPos2(envsound* ep, envsoundinfo* E, int pl) else { minX = MIN(ep[snd].pos.vx, ep[snd].pos2.vx); - + if (minX > E->cam_pos.vx) { E->eff_pos[i].vx = minX; @@ -2420,7 +2411,7 @@ void CalcEffPos2(envsound* ep, envsoundinfo* E, int pl) int minX, maxX, minZ; minZ = MIN(ep[snd].pos.vz, ep[snd].pos2.vz); - + if (E->cam_pos.vz < minZ) { E->eff_pos[i].vz = minZ; @@ -2439,7 +2430,7 @@ void CalcEffPos2(envsound* ep, envsoundinfo* E, int pl) { E->eff_pos[i].vx = maxX; } - else if (E->cam_pos.vx > E->eff_pos[i].vx) + else if (E->cam_pos.vx > E->eff_pos[i].vx) { E->eff_pos[i].vx = E->cam_pos.vx; } @@ -2447,7 +2438,7 @@ void CalcEffPos2(envsound* ep, envsoundinfo* E, int pl) else { minX = MIN(ep[snd].pos.vx, ep[snd].pos2.vx); - + if (E->cam_pos.vx < minX) { E->eff_pos[i].vx = minX; @@ -2459,14 +2450,14 @@ void CalcEffPos2(envsound* ep, envsoundinfo* E, int pl) } } - + } } else { E->eff_pos[i].vx = ep[snd].pos.vx; E->eff_pos[i].vz = ep[snd].pos.vz; - + E->flags |= (1 << i); } } @@ -2517,7 +2508,7 @@ void UpdateEnvSnd(envsound* ep, envsoundinfo* E, int pl) { StopChannel(E->chan[i]); UnlockChannel(E->chan[i]); - + E->playing_sound[i] = -1; } } @@ -2543,7 +2534,6 @@ void InitLeadHorn(void) } } - // [D] [T] void LeadHorn(CAR_DATA* cp) { @@ -2576,15 +2566,10 @@ void LeadHorn(CAR_DATA* cp) else carBank = cp->ap.model - 1; - Start3DTrackingSound(-1, SOUND_BANK_CARS, carBank * 3 + 2, - (VECTOR*)cp->hd.where.t, + Start3DTrackingSound(-1, SOUND_BANK_CARS, carBank * 3 + 2, + (VECTOR*)cp->hd.where.t, (LONGVECTOR3*)cp->st.n.linearVelocity); horn_time = 0; } } - - - - - diff --git a/src_rebuild/Game/C/gamesnd.h b/src_rebuild/Game/C/gamesnd.h index 9c7915eac..ff02dbc59 100644 --- a/src_rebuild/Game/C/gamesnd.h +++ b/src_rebuild/Game/C/gamesnd.h @@ -12,12 +12,12 @@ enum SoundBankIds { - SBK_ID_MENU = 0, // frontend, alpha 1.6 used it in ingame menu as well + SBK_ID_MENU = 0, // frontend, alpha 1.6 used it in ingame menu as well SBK_ID_SFX = 1, SBK_CAR_SOUNDS_START = 2, - SBK_ID_JERICHO = 19, // jericho_in_back + SBK_ID_JERICHO = 19, // jericho_in_back SBK_ID_JONES = 20, SBK_CITY_EFFECTS_START = 21, @@ -28,26 +28,26 @@ enum SoundBankIds // Mission banks start // Jones banks - SBK_ID_MISSION_2 = 45, // Chase the witness - SBK_ID_MISSION_3 = 46, // Train pursuit + SBK_ID_MISSION_2 = 45, // Chase the witness + SBK_ID_MISSION_3 = 46, // Train pursuit SBK_ID_MISSION_4 = 47, SBK_ID_MISSION_10 = 48, - SBK_ID_MISSION_11 = 49, // Hijack the truck - SBK_ID_MISSION_13 = 50, // Steal the truck - SBK_ID_FERRY = 51, // Escape to ferry / To the docks - SBK_ID_MISSION_18 = 52, // Tail Jericho - SBK_ID_MISSION_22 = 53, // Beat the train - SBK_ID_MISSION_23 = 54, // Car bomb - SBK_ID_MISSION_24 = 55, // Stake out + SBK_ID_MISSION_11 = 49, // Hijack the truck + SBK_ID_MISSION_13 = 50, // Steal the truck + SBK_ID_FERRY = 51, // Escape to ferry / To the docks + SBK_ID_MISSION_18 = 52, // Tail Jericho + SBK_ID_MISSION_22 = 53, // Beat the train + SBK_ID_MISSION_23 = 54, // Car bomb + SBK_ID_MISSION_24 = 55, // Stake out SBK_ID_MISSION_27 = 56, - SBK_ID_MISSION_29 = 57, // C4 deal - SBK_ID_MISSION_30 = 58, // Destroy the yard - SBK_ID_MISSION_32 = 59, // Steal the cop car - SBK_ID_MISSION_33 = 60, // Caine's cash - UNUSED - SBK_ID_MISSION_35 = 61, // Boat jump - SBK_ID_MISSION_39 = 62, // Lenny escaping - UNUSED - SBK_ID_MISSION_40 = 63, // Lenny gets caught + SBK_ID_MISSION_29 = 57, // C4 deal + SBK_ID_MISSION_30 = 58, // Destroy the yard + SBK_ID_MISSION_32 = 59, // Steal the cop car + SBK_ID_MISSION_33 = 60, // Caine's cash - UNUSED + SBK_ID_MISSION_35 = 61, // Boat jump + SBK_ID_MISSION_39 = 62, // Lenny escaping - UNUSED + SBK_ID_MISSION_40 = 63, // Lenny gets caught SBK_ID_HAVANA_TAKEADRIVE = 64, SBK_ID_VEGAS_TAKEADRIVE = 65, @@ -128,5 +128,4 @@ extern int AddEnvSnd(int type, char flags, int bank, int sample, int vol, int px extern void InitLeadHorn(); // 0x00052948 extern void LeadHorn(CAR_DATA *cp); // 0x00052954 - -#endif +#endif // GAMESND_H diff --git a/src_rebuild/Game/C/glaunch.c b/src_rebuild/Game/C/glaunch.c index f4dd417af..e704c6d9b 100644 --- a/src_rebuild/Game/C/glaunch.c +++ b/src_rebuild/Game/C/glaunch.c @@ -135,7 +135,7 @@ ACTIVE_CHEATS gCheatsBackup; void RestoreGameVars() { _CutRec_Reset(); - + gLoadedReplay = 0; gVibration = gOldVibrationMode; gCopDifficultyLevel = gSurvivalCopSettingsBackup; @@ -157,7 +157,7 @@ void State_GameStart(void* param) FreeXM(); SsSetSerialVol(0, 0, 0); - + gInFrontend = 0; AttractMode = 0; NewLevel = 1; @@ -169,10 +169,12 @@ void State_GameStart(void* param) switch (GameType) { case GAME_MISSION: + { RunMissionLadder(1); break; + } case GAME_TAKEADRIVE: - + { if (NumPlayers == 1) gCurrentMissionNumber = 50; else @@ -181,9 +183,10 @@ void State_GameStart(void* param) gCurrentMissionNumber += GameLevel * 2 + gWantNight + gSubGameNumber * 440; SetState(STATE_GAMELAUNCH); - break; + } case GAME_IDLEDEMO: + { if (LoadAttractReplay(gCurrentMissionNumber)) { gVibration = 0; @@ -192,44 +195,55 @@ void State_GameStart(void* param) SetState(STATE_GAMELAUNCH); } - break; + } case GAME_PURSUIT: + { gCurrentMissionNumber = 70 + GameLevel * 8 + gWantNight * 4 + gSubGameNumber; - SetState(STATE_GAMELAUNCH); + SetState(STATE_GAMELAUNCH); break; + } case GAME_GETAWAY: + { gCurrentMissionNumber = 102 + GameLevel * 8 + gWantNight * 4 + gSubGameNumber; - SetState(STATE_GAMELAUNCH); + SetState(STATE_GAMELAUNCH); break; + } case GAME_GATERACE: + { if (NumPlayers == 1) gCurrentMissionNumber = 134; else gCurrentMissionNumber = 164; gCurrentMissionNumber += GameLevel * 8 + gWantNight * 4 + gSubGameNumber; + SetState(STATE_GAMELAUNCH); - break; + } case GAME_CHECKPOINT: + { if (NumPlayers == 1) gCurrentMissionNumber = 196; else gCurrentMissionNumber = 228; gCurrentMissionNumber += GameLevel * 8 + gWantNight * 4 + gSubGameNumber; - SetState(STATE_GAMELAUNCH); + SetState(STATE_GAMELAUNCH); break; + } case GAME_TRAILBLAZER: + { gCurrentMissionNumber = GameLevel * 8 + 260 + gWantNight * 4 + gSubGameNumber; - SetState(STATE_GAMELAUNCH); + SetState(STATE_GAMELAUNCH); break; + } case GAME_SURVIVAL: + { gCopDifficultyLevel = 2; if (NumPlayers == 1) @@ -241,48 +255,59 @@ void State_GameStart(void* param) SetState(STATE_GAMELAUNCH); break; + } case GAME_REPLAYMISSION: + { GameType = GAME_MISSION; if (FindMissionLadderPos(gCurrentMissionNumber)) RunMissionLadder(0); //GameType = GAME_REPLAYMISSION; - break; + } case GAME_COPSANDROBBERS: + { gCurrentMissionNumber = 420 + GameLevel * 8 + gWantNight * 4 + gSubGameNumber; - SetState(STATE_GAMELAUNCH); + SetState(STATE_GAMELAUNCH); break; + } case GAME_CAPTURETHEFLAG: + { gCurrentMissionNumber = 352 + GameLevel * 8 + gSubGameNumber; - SetState(STATE_GAMELAUNCH); + SetState(STATE_GAMELAUNCH); break; + } case GAME_SECRET: + { if (NumPlayers == 1) gCurrentMissionNumber = 480; else gCurrentMissionNumber = 484; gCurrentMissionNumber += gWantNight + gSubGameNumber; - SetState(STATE_GAMELAUNCH); + SetState(STATE_GAMELAUNCH); break; + } case GAME_CONTINUEMISSION: + { GameType = GAME_MISSION; - RunMissionLadder(0); + RunMissionLadder(0); break; + } case GAME_LOADEDREPLAY: + { CurrentGameMode = GAMEMODE_DIRECTOR; gLoadedReplay = 1; GameType = StoredGameType; SetState(STATE_GAMELAUNCH); - break; + } } } @@ -340,7 +365,7 @@ void ReInitFrontend(int returnToMain) LoadSoundBankDynamic((char*)0x0, 0, 0); LoadBankFromLump(1, 0); - + // load frontend LOAD_OVERLAY("FRONTEND.BIN", _overlay_buffer); @@ -357,7 +382,7 @@ void ReInitFrontend(int returnToMain) LoadFrontendScreens(1); ReInitScreens(returnToMain); - + DrawSync(0); VSync(0); @@ -401,10 +426,10 @@ void State_MissionLadder(void* param) if (RenderArgs.nRenders == 4) { SetPleaseWait(NULL); - + PlayRender(&RenderArgs); RenderArgs.nRenders = 0; - + SetPleaseWait(NULL); } @@ -418,10 +443,10 @@ void State_MissionLadder(void* param) } SetPleaseWait(NULL); - + gCurrentMissionNumber = CurrentStep->data; SetState(STATE_GAMELAUNCH); - + quit = 1; } else if (CurrentStep->flags == DML_FMV) // any render @@ -444,12 +469,12 @@ void State_MissionLadder(void* param) SetPleaseWait(NULL); AvailableCheats.cheat5 = true; - + SetState(STATE_INITFRONTEND); quit = 1; } - + CurrentStep++; gMissionLadderPos = CurrentStep - MissionLadder; } while (!quit); @@ -460,7 +485,7 @@ void RunMissionLadder(int newgame) { if (newgame) gMissionLadderPos = 0; - + SetState(STATE_LADDER, (void*)newgame); } @@ -529,9 +554,9 @@ MISSION_DATA MissionEndData; void State_LaunchGame(void* param) { int quit; - + // STATE_GAMELAUNCH - + ResetGraph(1); SetVideoMode(video_mode); @@ -644,31 +669,31 @@ void State_GameComplete(void* param) FadeScreen(255); - if(GameType == GAME_MISSION) + if (GameType == GAME_MISSION) { nextState = STATE_LADDER; stateParam = 2; // don't do recap } else nextState = STATE_INITFRONTEND; - + NoPlayerControl = 0; quick_replay = 0; AutoDirect = 0; } } - + CurrentGameMode = WantedGameMode; SetState(nextState, (void*)stateParam); - if(nextState == STATE_INITFRONTEND) + if (nextState == STATE_INITFRONTEND) { RestoreGameVars(); - + lead_car = 0; NoPlayerControl = 0; - + SetDispMask(0); EnableDisplay(); @@ -740,4 +765,4 @@ int FindMissionLadderPos(int mission) } while (!end); return 0; -} \ No newline at end of file +} diff --git a/src_rebuild/Game/C/glaunch.h b/src_rebuild/Game/C/glaunch.h index f85cdefa3..df1016f64 100644 --- a/src_rebuild/Game/C/glaunch.h +++ b/src_rebuild/Game/C/glaunch.h @@ -51,5 +51,4 @@ extern int FindPrevMissionFromLadderPos(int pos); // 0x000536D8 extern int FindMissionLadderPos(int mission); // 0x00053740 - -#endif +#endif // GLAUNCH_H diff --git a/src_rebuild/Game/C/handling.c b/src_rebuild/Game/C/handling.c index 538e0a798..fe6165b14 100644 --- a/src_rebuild/Game/C/handling.c +++ b/src_rebuild/Game/C/handling.c @@ -102,7 +102,6 @@ void InitCarPhysics(CAR_DATA* cp, LONGVECTOR4* startpos, int direction) cp->hd.wheel_speed = 0; } - // [D] [T] void TempBuildHandlingMatrix(CAR_DATA* cp, int init) { @@ -129,7 +128,6 @@ void TempBuildHandlingMatrix(CAR_DATA* cp, int init) RebuildCarMatrix(&cp->st, cp); } - SVECTOR delta = { 0 }; int doWheels = 1; @@ -278,9 +276,9 @@ int playerhitcopsanyway = 0; // [D] [T] void GlobalTimeStep(void) { - static RigidBodyState _tp[MAX_CARS]; // offset 0x0 - static RigidBodyState _d0[MAX_CARS]; // offset 0x410 - static RigidBodyState _d1[MAX_CARS]; // offset 0x820 + static RigidBodyState _tp[MAX_CARS]; + static RigidBodyState _d0[MAX_CARS]; + static RigidBodyState _d1[MAX_CARS]; int mayBeCollidingBits; int tmp; @@ -389,7 +387,7 @@ void GlobalTimeStep(void) } // do collision interactions - for(subframe = 0; subframe < 4; subframe++) + for (subframe = 0; subframe < 4; subframe++) { for (RKstep = 0; RKstep < 2; RKstep++) { @@ -459,12 +457,12 @@ void GlobalTimeStep(void) { continue; } - + if (RKstep > 0) thisState_j = &_tp[j]; else thisState_j = &c1->st; - + int c1InfiniteMass; int c2InfiniteMass; @@ -515,8 +513,8 @@ void GlobalTimeStep(void) c1->ai.c.carMustDie = 1; } - // wake up cops if they've ben touched - // [A] check player felony. + // wake up cops if they've been touched + // [A] check player felony // If player touch them without felony player will be charged with felony (hit cop car) if (numCopCars < 4 && numActiveCops < maxCopCars && GameType != GAME_GETAWAY && *felony >= FELONY_PURSUIT_MIN_VALUE) { @@ -849,7 +847,6 @@ void initOBox(CAR_DATA* cp) gte_stsv(&cp->hd.oBox.radii[2]); } - // [D] [T] void RebuildCarMatrix(RigidBodyState* st, CAR_DATA* cp) { @@ -891,7 +888,6 @@ void RebuildCarMatrix(RigidBodyState* st, CAR_DATA* cp) initOBox(cp); } - // [D] [T] void StepCarPhysics(CAR_DATA* cp) { @@ -946,7 +942,6 @@ void StepCarPhysics(CAR_DATA* cp) } } - // [D] [T] void InitialiseCarHandling(void) { @@ -980,7 +975,7 @@ void CheckCarToCarCollisions(void) cp->controlType == CONTROL_TYPE_PLAYER && playerghost && !playerhitcopsanyway) // [A] required as game crashing { bb->y1 = INT_MAX; - + cp++; bb++; loop1++; @@ -1127,7 +1122,7 @@ void ProcessCarPad(CAR_DATA* cp, u_int pad, char PadSteer, char use_analogue) { if (player[player_id].dying == 0) { - if (ActiveCheats.cheat12 && (GameLevel == 1 || GameLevel == 2)) // [A] play as Jericho cheat + if (ActiveCheats.cheat12 && (GameLevel == LEVEL_HAVANA || GameLevel == LEVEL_VEGAS)) // [A] play as Jericho cheat whoExit = OTHER_MODEL; ActivatePlayerPedestrian(cp, NULL, 0, NULL, whoExit); @@ -1356,13 +1351,12 @@ void ProcessCarPad(CAR_DATA* cp, u_int pad, char PadSteer, char use_analogue) cp->lastPad = pad; } - // [D] [T] void InitSkidding(void) { int i; - for(i = 0; i < 2; i++) + for (i = 0; i < 2; i++) { player[i].wheelnoise.sound = -1; player[i].wheelnoise.chan = -1; @@ -1371,7 +1365,6 @@ void InitSkidding(void) } } - // [D] [T] void TerminateSkidding(int player_id) { @@ -1423,7 +1416,7 @@ void jump_debris(CAR_DATA* cp) wheel = cp->hd.wheel; - for(count = 0; count < 4; count++) + for (count = 0; count < 4; count++) { if (wheel->susCompression != 0) { @@ -1473,8 +1466,8 @@ void CheckCarEffects(CAR_DATA* cp, int player_id) char tracks_and_smoke; char channel, desired_skid, desired_wheel; - if (cp->controlType != CONTROL_TYPE_PLAYER && - cp->controlType != CONTROL_TYPE_LEAD_AI && + if (cp->controlType != CONTROL_TYPE_PLAYER && + cp->controlType != CONTROL_TYPE_LEAD_AI && cp->controlType != CONTROL_TYPE_CUTSCENE) { TerminateSkidding(player_id); @@ -1520,7 +1513,7 @@ void CheckCarEffects(CAR_DATA* cp, int player_id) if (skidsound > 13000) skidsound = 13000; } - + if ((wheels_on_ground & 5) && front_vel > 15000) { lay_down_tracks |= 2; @@ -1566,7 +1559,7 @@ void CheckCarEffects(CAR_DATA* cp, int player_id) } // update skidding sound - if (player[player_id].skidding.sound > -1 && + if (player[player_id].skidding.sound > -1 && player[player_id].skidding.chan > -1) { SetChannelPosition3(player[player_id].skidding.chan, @@ -1626,7 +1619,7 @@ void CheckCarEffects(CAR_DATA* cp, int player_id) } // update wheel noise - if (player[player_id].wheelnoise.sound > -1 && + if (player[player_id].wheelnoise.sound > -1 && player[player_id].wheelnoise.chan > -1) { int pitch, spd; @@ -1641,7 +1634,7 @@ void CheckCarEffects(CAR_DATA* cp, int player_id) pitch = 3584; SetChannelPosition3(player[player_id].wheelnoise.chan, - (VECTOR*)cp->hd.where.t, + (VECTOR*)cp->hd.where.t, (LONGVECTOR3*)cp->st.n.linearVelocity, spd * 50 - 10000, pitch + player_id * 8, 0); @@ -1714,8 +1707,3 @@ int GetPlayerId(CAR_DATA* cp) return -1; } - - - - - diff --git a/src_rebuild/Game/C/handling.h b/src_rebuild/Game/C/handling.h index 381d9c532..558e8afcd 100644 --- a/src_rebuild/Game/C/handling.h +++ b/src_rebuild/Game/C/handling.h @@ -32,5 +32,4 @@ extern void CheckCarEffects(CAR_DATA *cp, int player_id); // 0x00056350 extern int GetPlayerId(CAR_DATA *cp); // 0x00056CEC - -#endif +#endif // HANDLING_H diff --git a/src_rebuild/Game/C/job_fx.c b/src_rebuild/Game/C/job_fx.c index f8919b30c..7a3eb565e 100644 --- a/src_rebuild/Game/C/job_fx.c +++ b/src_rebuild/Game/C/job_fx.c @@ -39,7 +39,7 @@ void AddExplosion(VECTOR pos, int type) i = 0; newExplosion = explosion; - while (newExplosion->time != -1 && i < MAX_EXPLOSION_OBJECTS) + while (newExplosion->time != -1 && i < MAX_EXPLOSION_OBJECTS) { newExplosion++; i++; @@ -49,7 +49,7 @@ void AddExplosion(VECTOR pos, int type) newExplosion->pos = pos; newExplosion->type = (ExplosionType)type; - if (type == LITTLE_BANG) + if (type == LITTLE_BANG) { newExplosion->speed = 192; newExplosion->hscale = 1024; @@ -70,7 +70,6 @@ void AddExplosion(VECTOR pos, int type) } - // [D] [T] void HandleExplosion(void) { @@ -89,7 +88,7 @@ void HandleExplosion(void) for (i = 0; i < MAX_EXPLOSION_OBJECTS; i++) { - if (exp->time != -1 && exp->type != BANG_USED) + if (exp->time != -1 && exp->type != BANG_USED) { cp = car_data; @@ -115,7 +114,7 @@ void HandleExplosion(void) } // [A] add smoke to explosions - if(exp->time > 1500 && (CameraCnt & 0x3) == 0) + if (exp->time > 1500 && (CameraCnt & 0x3) == 0) { smokePos = exp->pos; smokePos.vy -= 120; @@ -142,7 +141,7 @@ void initExplosion(void) // generate half-globe mesh vert = globemesh; - + d1 = 0; d2 = 128; @@ -158,13 +157,13 @@ void initExplosion(void) vert[1].vz = FIXEDH(RSIN(d2) * 490); vert += 2; - + d1 += 2; d2 += 512; } vert = globemesh + 18; - + d1 = 0x1280; d2 = 0x1300; @@ -175,7 +174,7 @@ void initExplosion(void) vert[0].vx = FIXEDH(RCOS(d1) * 490); vert[0].vz = FIXEDH(RSIN(d1) * 490); - + vert[1].vx = FIXEDH(RCOS(d2) * 330); vert[1].vz = FIXEDH(RSIN(d2) * 330); @@ -202,24 +201,23 @@ void initExplosion(void) vert[1].vz = FIXEDH(RSIN(d1) * 100); vert += 2; - + d1 += 512; d2 += 512; } } - // [D] [T] void DrawExplosion(int time, VECTOR position, int hscale, int rscale) { int j; POLY_FT4 *poly; SVECTOR *src; - + int rgb, transparency; int red, green, blue; int sf, sf1, sf2; - + u_int u0, u1,u2,u3; int i; VECTOR v; @@ -237,8 +235,8 @@ void DrawExplosion(int time, VECTOR position, int hscale, int rscale) transparency = 255 - (time >> 4); rgb = (transparency * transparency >> 10 << 8 | - (255 - transparency) * (transparency >> 2) + transparency * (transparency >> 1) >> 8) << 8 | - transparency | + (255 - transparency) * (transparency >> 2) + transparency * (transparency >> 1) >> 8) << 8 | + transparency | 0x2e000000; Apply_Inv_CameraMatrix(&v); @@ -327,14 +325,14 @@ void DrawExplosion(int time, VECTOR position, int hscale, int rscale) transparency = 255 - (time >> 4); rgb = transparency >> 1; - rgb = (rgb + (transparency * transparency >> 10) >> 1 << 8 | - rgb + ((255 - transparency) * (transparency >> 2) + transparency * rgb >> 8) >> 1) << 8 | + rgb = (rgb + (transparency * transparency >> 10) >> 1 << 8 | + rgb + ((255 - transparency) * (transparency >> 2) + transparency * rgb >> 8) >> 1) << 8 | rgb | 0x2e000000; for (i = 0; i < 2; i++) { sf = CameraCnt * (i * -90 + 64); - + SS.m[1][1] = FIXED(sf2 * hscale); SS.m[0][0] = FIXEDH(FIXED(sf2 * rscale) * RCOS(sf)); SS.m[2][0] = FIXEDH(FIXED(sf2 * rscale) * RSIN(sf)); @@ -401,7 +399,6 @@ void DrawExplosion(int time, VECTOR position, int hscale, int rscale) } } - // [D] [T] void DrawAllExplosions(void) { @@ -413,7 +410,3 @@ void DrawAllExplosions(void) DrawExplosion(explosion[i].time, explosion[i].pos, explosion[i].hscale, explosion[i].rscale); } } - - - - diff --git a/src_rebuild/Game/C/job_fx.h b/src_rebuild/Game/C/job_fx.h index 8af645d60..b6869d83b 100644 --- a/src_rebuild/Game/C/job_fx.h +++ b/src_rebuild/Game/C/job_fx.h @@ -9,4 +9,4 @@ extern void AddExplosion(VECTOR pos, int type); // 0x00056D54 extern void HandleExplosion(); // 0x00056E44 extern void DrawAllExplosions(); // 0x00057B50 -#endif +#endif // JOB_FX_H diff --git a/src_rebuild/Game/C/leadai.c b/src_rebuild/Game/C/leadai.c index 63e7406e7..6746ca69e 100644 --- a/src_rebuild/Game/C/leadai.c +++ b/src_rebuild/Game/C/leadai.c @@ -161,7 +161,7 @@ void InitLead(CAR_DATA* cp) InitLeadHorn(); } -// [D] [T] - needless to say, the AI isn't very smart :D +// [D] [T] needless to say, the AI isn't very smart :D void LeadUpdateState(CAR_DATA* cp) { volatile int dx, dz; @@ -235,7 +235,7 @@ void LeadUpdateState(CAR_DATA* cp) } avel = FIXEDH(cp->st.n.angularVelocity[1]); - end = DIFF_ANGLES(cp->ai.l.targetDir, cp->hd.direction);// (cp->hd.direction - cp->ai.l.targetDir) + 2048U & 0xfff) - 2048; + end = DIFF_ANGLES(cp->ai.l.targetDir, cp->hd.direction); //(cp->hd.direction - cp->ai.l.targetDir) + 2048U & 0xfff) - 2048; switch (cp->ai.l.dstate) { @@ -284,7 +284,7 @@ void LeadUpdateState(CAR_DATA* cp) case LeadDrive_NormalDrive: { volatile int dist; - + if (cp->ai.l.recoverTime > 40) --cp->ai.l.recoverTime; @@ -389,7 +389,7 @@ u_int LeadPadResponse(CAR_DATA* cp) volatile int deltaTh; volatile int avel; - + t0 = 0; deltaTh = DIFF_ANGLES(cp->ai.l.targetDir, cp->hd.direction); // ((cp->hd.direction - cp->ai.l.targetDir) + 2048U & 0xfff) - 2048; @@ -425,22 +425,22 @@ u_int LeadPadResponse(CAR_DATA* cp) }; SetTextColour(120, 15, 15); - + char text[256]; sprintf(text, "%s", LeadDebugStateNames[cp->ai.l.dstate]); PrintString(text, 20, 180); SetTextColour(128, 128, 64); - + sprintf(text, "dir: %d, fwd: %d, pos: %d, width: %d", cp->ai.l.targetDir, cp->ai.l.roadForward, cp->ai.l.roadPosition, cp->ai.l.width); PrintString(text, 20, 195); - + sprintf(text, "panic: %d, boring: %d, nextTurn: %d", cp->ai.l.panicCount, cp->ai.l.boringness, cp->ai.l.nextTurn); PrintString(text, 20, 210); sprintf(text, "currentRoad: %d", cp->ai.l.currentRoad); PrintString(text, 20, 230); - + Debug_AddLineOfs(_zero, _up, pos, yycv); } #endif @@ -450,10 +450,10 @@ u_int LeadPadResponse(CAR_DATA* cp) case LeadDrive_Handbrake: { int deltaAVel; - + // [A] check angular velocity when making this maneuver with handbrake deltaAVel = ABS(avel); - + t0 = (deltaAVel < 200 ? CAR_PAD_HANDBRAKE : 0) | ((deltaTh < 0) ? CAR_PAD_RIGHT : CAR_PAD_LEFT); break; case 1: @@ -474,7 +474,7 @@ u_int LeadPadResponse(CAR_DATA* cp) volatile int maxDist; volatile int deltaVel; volatile int steerDelta; - + dx = -RCOS(cp->ai.l.targetDir) * (cp->hd.where.t[0] - cp->ai.l.targetX); dz = RSIN(cp->ai.l.targetDir) * (cp->hd.where.t[2] - cp->ai.l.targetZ); @@ -496,7 +496,7 @@ u_int LeadPadResponse(CAR_DATA* cp) + pathParams[3] * deltaTh) - cp->wheel_angle; t0 = CAR_PAD_ACCEL; - + if (steerDelta > 32) t0 |= CAR_PAD_RIGHT; else if (steerDelta < -32) @@ -504,7 +504,7 @@ u_int LeadPadResponse(CAR_DATA* cp) if (ABS(steerDelta) > 64) t0 |= CAR_PAD_FASTSTEER; - + if (steerDelta + 31U <= 62 && ABS(avel) <= 5) { if (t0 & CAR_PAD_ACCEL) @@ -516,7 +516,7 @@ u_int LeadPadResponse(CAR_DATA* cp) case LeadDrive_Unstuck: { volatile int deltaPos; - + t0 = CAR_PAD_WHEELSPIN; deltaPos = DIFF_ANGLES(cp->hd.direction, cp->ai.l.roadPosition);// ((cp->ai.l.roadPosition - cp->hd.direction) + 2048U & 0xfff) - 2048; @@ -539,7 +539,7 @@ u_int LeadPadResponse(CAR_DATA* cp) case LeadDrive_Panic: { volatile int deltaAVel; - + deltaAVel = ABS(avel); if (ABS(cp->ai.l.panicCount) < 2 || deltaAVel > 150) @@ -592,7 +592,7 @@ u_int LeadPadResponse(CAR_DATA* cp) { t0 = (avel < 0) ? CAR_PAD_RIGHT : CAR_PAD_LEFT; //t0 |= ((deltaTh < 0) ? CAR_PAD_RIGHT : CAR_PAD_LEFT); - + if (cp->ai.l.roadForward < 0 && cp->hd.speed > 100) t0 |= CAR_PAD_BRAKE; else @@ -631,7 +631,7 @@ void FakeMotion(CAR_DATA* cp) int currentRoad; int nextJunction; int temp; - + currentRoad = cp->ai.l.currentRoad; if (IS_JUNCTION_SURFACE(currentRoad)) @@ -643,7 +643,7 @@ void FakeMotion(CAR_DATA* cp) else if (IS_STRAIGHT_SURFACE(currentRoad)) { int dx, dz; - + volatile int angle; volatile int c, s, d; volatile int toGo; @@ -653,7 +653,7 @@ void FakeMotion(CAR_DATA* cp) dz = cp->hd.where.t[2] - straight->Midz; angle = straight->angle & 0xfff; - + nextJunction = (straight->ConnectIdx[1]); if (nextJunction == -1) @@ -672,7 +672,7 @@ void FakeMotion(CAR_DATA* cp) angle ^= 2048; nextJunction = (straight->ConnectIdx[3]); - + if (nextJunction == -1) nextJunction = (straight->ConnectIdx[2]); } @@ -682,7 +682,7 @@ void FakeMotion(CAR_DATA* cp) s = RCOS(angle); d = FIXEDH(c * dx + s * dz); - + toGo = (straight->length / 2) - d; if (toGo > -1) @@ -712,9 +712,9 @@ void FakeMotion(CAR_DATA* cp) dx = cp->hd.where.t[0] - curve->Midx; dz = cp->hd.where.t[2] - curve->Midz; - + angle = ratan2(dx, dz); - + if (cp->ai.l.direction == 0) { if (angle - cp->ai.l.targetDir & 0x800U) @@ -728,13 +728,13 @@ void FakeMotion(CAR_DATA* cp) // move car in desired direction if (cp->ai.l.direction == 1) { - - if (DIFF_ANGLES(angle, curve->end) >= 0) // ((curve->end - angle & 0xfff) + 2048 & 0xfff) - 2048 > -1) + + if (DIFF_ANGLES(angle, curve->end) >= 0) // ((curve->end - angle & 0xfff) + 2048 & 0xfff) - 2048 > -1) { dir = angle + 0x13193 / radius; cp->ai.l.targetDir = (dir + 1024) & 0xfff; - + cp->hd.where.t[0] = FIXEDH(RSIN(dir)* radius) + curve->Midx; cp->hd.where.t[2] = FIXEDH(RCOS(dir) * radius) + curve->Midz; return; @@ -751,7 +751,7 @@ void FakeMotion(CAR_DATA* cp) dir = angle - 0x13193 / radius; cp->ai.l.targetDir = (dir - 1024) & 0xfff; - + cp->hd.where.t[0] = FIXEDH(RSIN(dir) * radius) + curve->Midx; cp->hd.where.t[2] = FIXEDH(RCOS(dir) * radius) + curve->Midz; @@ -762,8 +762,8 @@ void FakeMotion(CAR_DATA* cp) if (nextJunction == -1) nextJunction = (curve->ConnectIdx[2]); } - - if(!IS_JUNCTION_SURFACE(nextJunction)) + + if (!IS_JUNCTION_SURFACE(nextJunction)) { cp->ai.l.currentRoad = nextJunction; cp->ai.l.direction = 0; @@ -789,15 +789,15 @@ void PosToIndex(int* normal, int* tangent, int intention, CAR_DATA* cp) volatile int t80; if (intention - 4U < 3) - { + { *normal = DIFF_ANGLES(0, *normal); //(*normal + 2048U & 0xfff) - 2048; if (intention == 6 && ABS(*normal) < 240) { int dist; - + dist = FIXEDH(*tangent * RSIN(*normal)); - + if (dist > 125) { *normal = 23; @@ -825,7 +825,7 @@ void PosToIndex(int* normal, int* tangent, int intention, CAR_DATA* cp) *normal = 20; return; } - + *normal *= 21; if (intention == 4) @@ -845,24 +845,24 @@ void PosToIndex(int* normal, int* tangent, int intention, CAR_DATA* cp) volatile int myspeed; volatile int temp; volatile int w80; - + myspeed = cp->hd.speed; w = LeadValues.tWidth; t80 = LeadValues.tWidthMul; - + if (myspeed > 100) { w = LeadValues.hWidth; t80 = LeadValues.hWidthMul; } - + w = w + myspeed * t80; - + if (myspeed > 100) w80 = LeadValues.hWidth80 + myspeed * LeadValues.hWidth80Mul; else w80 = LeadValues.tWidth80 + myspeed / LeadValues.tWidth80Mul; - + if (myspeed > 100) t = LeadValues.hDist + (myspeed - 100) * LeadValues.hDistMul; else @@ -876,14 +876,14 @@ void PosToIndex(int* normal, int* tangent, int intention, CAR_DATA* cp) if (w < *normal) { temp = *tangent; - + *tangent = (t + *normal) - w; *normal = t - temp; } else if (w80 < *normal) { temp = ((*normal - w80) * (t - t80)) / (w - w80) + t80; - + *normal = temp - *tangent; *tangent = temp; } @@ -902,7 +902,7 @@ void PosToIndex(int* normal, int* tangent, int intention, CAR_DATA* cp) *normal = t80 + 21; } -// [D] [T] - seems to be working as expected +// [D] [T] seems to be working as expected void BlockToMap(MAP_DATA* data) { volatile int carLength, carWidth; @@ -1138,7 +1138,7 @@ void BlockToMap(MAP_DATA* data) if (tangent < 2000 || data->intention == 6) { volatile int quad1, quad2; - + corners[0][0] = dx + data->size->vx; corners[0][1] = dz + data->size->vz; corners[2][0] = dx - data->size->vx; @@ -1212,7 +1212,7 @@ void BlockToMap(MAP_DATA* data) { int vx, vz; int theta; - + dx = corners[left][1] - corners[right][1]; dy = corners[left][0] - corners[right][0]; @@ -1250,7 +1250,7 @@ void BlockToMap(MAP_DATA* data) printError("\nunknwn intention in leadai.c LOCKUP!!\n"); } } - + switch (data->intention) { case 2: @@ -1276,7 +1276,7 @@ void BlockToMap(MAP_DATA* data) { int tdist; int temp; - + *ndist += carLength * 2; *fdist = ABS(*fdist + carLength * -2); @@ -1304,7 +1304,7 @@ void BlockToMap(MAP_DATA* data) int localld = 0; int localr = 0; int localrd = 0; - + locall = left; localr = right; localld = ldist; @@ -1411,7 +1411,7 @@ int IsOnMap(int x, int z, VECTOR* basePos, int intention, CAR_DATA* cp) dx = x - curve->Midx; dz = z - curve->Midz; - tangent = DIFF_ANGLES(cp->ai.l.base_Angle, ratan2(dx, dz)) // (((ratan2(dx, dz) - cp->ai.l.base_Angle) + 2048U & 0xfff) - 2048) * + tangent = DIFF_ANGLES(cp->ai.l.base_Angle, ratan2(dx, dz)) // (((ratan2(dx, dz) - cp->ai.l.base_Angle) + 2048U & 0xfff) - 2048) * * cp->ai.l.base_Dir * ((curve->inside * 45056) / 28672); normal = (cp->ai.l.base_Normal - hypot(dx, dz)) * cp->ai.l.base_Dir; @@ -1449,8 +1449,8 @@ int IsOnMap(int x, int z, VECTOR* basePos, int intention, CAR_DATA* cp) return 0; } -int roadAhead[42]; // offset 0x000ecde8 -int localMap[42]; // offset 0x000ecd40 +int roadAhead[42]; +int localMap[42]; // [D] [A] overlapping stack variables - might be incorrect (i've tried to resolve them so far) void UpdateRoadPosition(CAR_DATA* cp, VECTOR* basePos, int intention) @@ -1474,24 +1474,24 @@ void UpdateRoadPosition(CAR_DATA* cp, VECTOR* basePos, int intention) volatile int laneAvoid; volatile int newTarget = 21; volatile int sindex = 0; - + volatile int cell_x, cell_z; volatile int initial_cell_x, initial_cell_z; volatile int x1, z1; - for(i = 0; i < 41; i++) + for (i = 0; i < 41; i++) roadAhead[i] = 20480; for (i = 0; i < 41; i++) localMap[i] = (cp->hd.speed + 100) * 10; - + laneAvoid = -1; - + road_s = RSIN(cp->ai.l.targetDir); road_c = RCOS(cp->ai.l.targetDir); ClearCopUsage(); - + initial_cell_x = ((basePos->vx + units_across_halved - 1024) / MAP_CELL_SIZE) - 5; initial_cell_z = ((basePos->vz + units_down_halved - 1024) / MAP_CELL_SIZE) - 5; @@ -1536,7 +1536,7 @@ void UpdateRoadPosition(CAR_DATA* cp, VECTOR* basePos, int intention) int num_cb; QuickUnpackCellObject(ppco, &ci.nearCell, &tempCO); - + num_cb = *GET_MODEL_DATA(int, model, collision_block); collide = GET_MODEL_DATA_OFS(COLLISION_PACKET, model, collision_block, sizeof(int)); @@ -1545,7 +1545,7 @@ void UpdateRoadPosition(CAR_DATA* cp, VECTOR* basePos, int intention) int yang; int theta; int xsize, zsize; - + yang = -tempCO.yang & 0x3f; if (collide->type == 0) @@ -1569,7 +1569,7 @@ void UpdateRoadPosition(CAR_DATA* cp, VECTOR* basePos, int intention) theta = 0; xsize = 1; zsize = 1; - + printError("\nERROR! unknown collision box type in leadai.c\n"); } @@ -1679,7 +1679,7 @@ void UpdateRoadPosition(CAR_DATA* cp, VECTOR* basePos, int intention) { int lbody; int wbody; - + car_cos = lcp->ap.carCos; wbody = car_cos->colBox.vx / 2; @@ -1765,7 +1765,7 @@ void UpdateRoadPosition(CAR_DATA* cp, VECTOR* basePos, int intention) if (intention < 2) { int smallest; - + smallest = roadAhead[24]; for (i = 24; i < 41; i++) { @@ -2142,9 +2142,9 @@ void UpdateRoadPosition(CAR_DATA* cp, VECTOR* basePos, int intention) // [D] [T] void CheckCurrentRoad(CAR_DATA* cp) { - volatile int heading = 0; // offset 0x1c - int nextJunction = 0; // offset 0x50 - VECTOR basePosition = {0}; // offset 0x60 + volatile int heading = 0; + int nextJunction = 0; + VECTOR basePosition = { 0 }; volatile int checkNext = -1; volatile int currentRoad = -1; @@ -2165,7 +2165,7 @@ void CheckCurrentRoad(CAR_DATA* cp) { cp->ai.l.offRoad = 0; - if (currentRoad != cp->ai.l.lastRoad && + if (currentRoad != cp->ai.l.lastRoad && currentRoad != cp->ai.l.currentRoad) { cp->ai.l.direction = 0; @@ -2184,11 +2184,11 @@ void CheckCurrentRoad(CAR_DATA* cp) } else if (IS_STRAIGHT_SURFACE(currentRoad)) { - volatile int d; // offset 0x70 - volatile int toGo; // offset 0x74 - volatile int angle; // offset 0x78 - volatile int s; // offset 0x7c - volatile int c; // offset 0x80 + volatile int d; + volatile int toGo; + volatile int angle; + volatile int s; + volatile int c; volatile int fixedThresh; volatile int dx, dz; @@ -2197,7 +2197,7 @@ void CheckCurrentRoad(CAR_DATA* cp) dx = cp->hd.where.t[0] - straight->Midx; dz = cp->hd.where.t[2] - straight->Midz; - + if (straight->ConnectIdx[1] == -1) nextJunction = straight->ConnectIdx[0]; else @@ -2214,20 +2214,20 @@ void CheckCurrentRoad(CAR_DATA* cp) if (cp->ai.l.direction == -1) { angle ^= 2048; - + if (straight->ConnectIdx[3] == -1) nextJunction = straight->ConnectIdx[2]; else nextJunction = straight->ConnectIdx[3]; } - + s = RSIN(angle); c = RCOS(angle); - + d = FIXEDH(s * dx + c * dz); toGo = (straight->length / 2) - d; - + if (cp->hd.speed > 100) fixedThresh = LeadValues.hDist + (cp->hd.speed - 100) * LeadValues.hDistMul; else @@ -2254,11 +2254,11 @@ void CheckCurrentRoad(CAR_DATA* cp) } else if (IS_CURVED_SURFACE(currentRoad)) { - volatile int angle; // offset 0x84 - volatile int radius; // offset 0x88 - volatile int dx; // offset 0x8c - volatile int dz; // offset 0x90 - volatile int fixedThresh; // offset 0x94 + volatile int angle; + volatile int radius; + volatile int dx; + volatile int dz; + volatile int fixedThresh; curve = GET_CURVE(currentRoad); dx = cp->hd.where.t[0] - curve->Midx; @@ -2348,19 +2348,19 @@ void CheckCurrentRoad(CAR_DATA* cp) if (checkNext) { int diff; - + currentRoad = nextJunction; if (IS_JUNCTION_SURFACE(nextJunction)) { junction = GET_JUNCTION(nextJunction); - + if (nextJunction != cp->ai.l.nextJunction) { SelectExit(cp, junction); cp->ai.l.nextJunction = nextJunction; } - + currentRoad = junction->ExitIdx[cp->ai.l.nextExit]; heading = (cp->ai.l.nextExit & 3) << 10; } @@ -2379,14 +2379,14 @@ void CheckCurrentRoad(CAR_DATA* cp) else if (IS_CURVED_SURFACE(nextJunction)) { int angle; - int dx; // offset 0x9c - int dz; // offset 0xa0 + int dx; + int dz; curve = GET_CURVE(nextJunction); dx = cp->hd.where.t[0] - curve->Midx; dz = cp->hd.where.t[2] - curve->Midz; - + angle = ratan2(dx, dz); if ((angle - cp->hd.direction & 2048U) != 0) @@ -2401,28 +2401,28 @@ void CheckCurrentRoad(CAR_DATA* cp) if (IS_STRAIGHT_SURFACE(currentRoad)) { int cs, sn; - int dx; // offset 0xa4 - int dz; // offset 0xa8 - int dist; // offset 0xac - int offx; // offset 0xb0 - int offz; // offset 0xb4 + int dx; + int dz; + int dist; + int offx; + int offz; straight = GET_STRAIGHT(currentRoad); sn = RSIN(heading); cs = RCOS(heading); - + offx = straight->Midx - cp->hd.where.t[0]; offz = straight->Midz - cp->hd.where.t[2]; - + dist = -FIXEDH(offx * sn + offz * cs); - + cp->ai.l.d = FIXEDH(cs * offx - sn * offz); cp->ai.l.width = ROAD_LANES_COUNT(straight) * 512; - + dx = FIXEDH(sn * dist); dz = FIXEDH(cs * dist); - + basePosition.vx = straight->Midx + dx; basePosition.vy = cp->hd.where.t[1]; basePosition.vz = straight->Midz + dz; @@ -2430,19 +2430,19 @@ void CheckCurrentRoad(CAR_DATA* cp) else if (IS_CURVED_SURFACE(currentRoad)) { int radius; - int angle; // offset 0xb8 - int dx; // offset 0xbc - int dz; // offset 0xc0 - int basex; // offset 0xc4 - int basez; // offset 0xc8 - int dist; // offset 0xcc - int offx; // offset 0xd0 - int offz; // offset 0xd4 + int angle; + int dx; + int dz; + int basex; + int basez; + int dist; + int offx; + int offz; curve = GET_CURVE(currentRoad); dx = cp->hd.where.t[0] - curve->Midx; dz = cp->hd.where.t[2] - curve->Midz; - + radius = curve->inside * 1024 + ROAD_LANES_COUNT(curve) * 512; angle = ratan2(dx, dz); @@ -2471,11 +2471,11 @@ void CheckCurrentRoad(CAR_DATA* cp) cp->ai.l.width = ROAD_LANES_COUNT(curve) * 512; offx = basex - cp->hd.where.t[0]; offz = basez - cp->hd.where.t[2]; - + dist = -FIXEDH(offx * RSIN(heading) + offz * RCOS(heading)); dx = FIXEDH(RSIN(heading) * dist); dz = FIXEDH(RCOS(heading) * dist); - + basePosition.vx = basex + dx; basePosition.vy = cp->hd.where.t[1]; basePosition.vz = basez + dz; @@ -2516,8 +2516,8 @@ void CheckCurrentRoad(CAR_DATA* cp) // check for grass surface // or if AI is too far from road - if (cp->ai.l.width + 2048 >= ABS(cp->ai.l.d) || - (cp->hd.wheel[1].surface & 7) == 3 || + if (cp->ai.l.width + 2048 >= ABS(cp->ai.l.d) || + (cp->hd.wheel[1].surface & 7) == 3 || (cp->hd.wheel[3].surface & 7) == 3) { cp->ai.l.currentRoad = currentRoad; @@ -2545,7 +2545,7 @@ void CheckCurrentRoad(CAR_DATA* cp) { cp->ai.l.offRoad = 1; cp->ai.l.nextJunction = -1; - + UpdateRoadPosition(cp, &basePosition, 4); SetTarget(cp, currentRoad, cp->hd.direction, &nextJunction); } @@ -2555,7 +2555,7 @@ void CheckCurrentRoad(CAR_DATA* cp) // [D] [T] void SetTarget(CAR_DATA* cp, int curRoad, int heading, int* nextJunction) { - volatile int dx, dz; // offset 0xd8 + volatile int dx, dz; sdPlane* pl; VECTOR pos; @@ -2565,7 +2565,7 @@ void SetTarget(CAR_DATA* cp, int curRoad, int heading, int* nextJunction) if (cp->ai.l.offRoad == 1) { int dir = cp->ai.l.roadPosition; - + // get the road dx = FIXEDH(RCOS(dir) * cp->ai.l.roadForward); dz = FIXEDH(RSIN(dir) * cp->ai.l.roadForward); @@ -2574,7 +2574,7 @@ void SetTarget(CAR_DATA* cp, int curRoad, int heading, int* nextJunction) cp->ai.l.targetZ = cp->hd.where.t[2] + dz; cp->ai.l.targetDir = dir; - + return; } @@ -2585,7 +2585,7 @@ void SetTarget(CAR_DATA* cp, int curRoad, int heading, int* nextJunction) volatile int d; volatile int angle; volatile int mul; - + straight = GET_STRAIGHT(curRoad); cp->ai.l.targetDir = straight->angle & 0xfff; @@ -2594,11 +2594,11 @@ void SetTarget(CAR_DATA* cp, int curRoad, int heading, int* nextJunction) else *nextJunction = straight->ConnectIdx[1]; - if (cp->ai.l.direction == -1 || + if (cp->ai.l.direction == -1 || cp->ai.l.direction == 0 && (heading - cp->ai.l.targetDir + 1024U & 2048) != 0) { cp->ai.l.targetDir ^= 2048; - + if (straight->ConnectIdx[3] == -1) *nextJunction = straight->ConnectIdx[2]; else @@ -2609,7 +2609,7 @@ void SetTarget(CAR_DATA* cp, int curRoad, int heading, int* nextJunction) dz = straight->Midz - cp->hd.where.t[2]; angle = cp->ai.l.targetDir; - + rx = FIXEDH(RSIN(angle) * cp->ai.l.roadForward); rz = FIXEDH(RCOS(angle) * cp->ai.l.roadForward); @@ -2622,28 +2622,28 @@ void SetTarget(CAR_DATA* cp, int curRoad, int heading, int* nextJunction) // [A] it's obviously bugged somewhere as car always tends to be on left lanes // on curves it's even WORSE mul = FIXEDH(ux * dx + uz * dz) - ROAD_LANES_COUNT(straight) * 512 + cp->ai.l.roadPosition; - + ux = FIXEDH(mul * ux); uz = FIXEDH(mul * uz); - + cp->ai.l.targetX = cp->hd.where.t[0] + rx + ux; cp->ai.l.targetZ = cp->hd.where.t[2] + rz + uz; pos.vx = cp->ai.l.targetX; pos.vy = cp->hd.where.t[1]; pos.vz = cp->ai.l.targetZ; - + pl = sdGetCell(&pos); } else if (IS_CURVED_SURFACE(curRoad)) { volatile int angle; volatile int radius; - + curve = GET_CURVE(curRoad); angle = ratan2(cp->hd.where.t[0] - curve->Midx, cp->hd.where.t[2] - curve->Midz); - if (cp->ai.l.direction == 1 || + if (cp->ai.l.direction == 1 || cp->ai.l.direction == 0 && (angle - heading & 2048U) != 0) { radius = (curve->inside + ROAD_LANES_COUNT(curve)) * 1024 - cp->ai.l.roadPosition + cp->hd.speed * 2; @@ -2690,7 +2690,7 @@ void SelectExit(CAR_DATA* cp, DRIVER2_JUNCTION* junction) total = 0; onward = (cp->ai.l.targetDir + 512U & 0xfff) >> 10; - + // [A] was weird loop for (i = 0; i < 4; i++) { @@ -2702,7 +2702,7 @@ void SelectExit(CAR_DATA* cp, DRIVER2_JUNCTION* junction) } // [A] was unrolled - for(i = 0; i < 3; i++) + for (i = 0; i < 3; i++) { int d; @@ -2714,7 +2714,7 @@ void SelectExit(CAR_DATA* cp, DRIVER2_JUNCTION* junction) d = 0; tmp = onward + d & 3; - + road = junction->ExitIdx[tmp]; if (IS_CURVED_SURFACE(road) || IS_STRAIGHT_SURFACE(road)) { @@ -2732,19 +2732,19 @@ void SelectExit(CAR_DATA* cp, DRIVER2_JUNCTION* junction) el[numExits][1] = 1; numExits++; } - + rnd = leadRand(); rnd = ABS(rnd); // [A] again, was a strange loop. Hope it works tmp = 0; - for(i = 0; i < numExits; i++) + for (i = 0; i < numExits; i++) { tmp += el[i][1]; cp->ai.l.nextTurn = el[i][0]; - - if(tmp > rnd % total) + + if (tmp > rnd % total) break; } @@ -2765,7 +2765,7 @@ u_int FreeRoamer(CAR_DATA* cp) CAR_DATA* pCar; LeadHorn(cp); - + DamageBar.position = cp->totalDamage; if (cp->ai.l.dstate != LeadDrive_FakeMotion) @@ -2783,7 +2783,7 @@ u_int FreeRoamer(CAR_DATA* cp) // re-randomize if (CameraCnt == 100) { - if(player[0].playerCarId >= 0) + if (player[0].playerCarId >= 0) { pCar = &car_data[player[0].playerCarId]; seed = (pCar->hd.where.t[0] + pCar->hd.where.t[2]) / (pCar->hd.speed + 1); @@ -2833,8 +2833,3 @@ u_int hypot(int x, int y) return t; } - - - - - diff --git a/src_rebuild/Game/C/leadai.h b/src_rebuild/Game/C/leadai.h index a46abef95..da6d3d3cf 100644 --- a/src_rebuild/Game/C/leadai.h +++ b/src_rebuild/Game/C/leadai.h @@ -1,7 +1,7 @@ #ifndef LEADAI_H #define LEADAI_H -extern void InitLead(CAR_DATA *cp); +extern void InitLead(CAR_DATA *cp); extern u_int FreeRoamer(CAR_DATA *cp); -#endif +#endif // LEADAI_H diff --git a/src_rebuild/Game/C/loadsave.c b/src_rebuild/Game/C/loadsave.c index d62f17e83..ee8662b1b 100644 --- a/src_rebuild/Game/C/loadsave.c +++ b/src_rebuild/Game/C/loadsave.c @@ -112,7 +112,7 @@ void LoadCurrentProfile(int init) { int error; - if(init) + if (init) { RECT16 rect; @@ -135,10 +135,10 @@ void LoadCurrentProfile(int init) char filePath[2048]; int fileSize; - + GetGameProfilePath(filePath); strcat(filePath, "/config.dat"); - + // load config FILE* fp = fopen(filePath, "rb"); if (fp) @@ -319,10 +319,10 @@ int LoadReplayFromFile(char* fileName) sub = fileName; do { - tmp = strchr(sub+1, '/'); + tmp = strchr(sub + 1, '/'); if (tmp) - sub = tmp+1; - }while(tmp); + sub = tmp + 1; + } while (tmp); strcpy(gCurrentReplayFilename, sub); @@ -375,7 +375,6 @@ int SaveReplayData(char* buffer) return SaveReplayToBuffer(buffer); } - // [D] [T] int LoadReplayData(char* buffer) { @@ -399,7 +398,7 @@ int SaveGameData(char* buffer) saveHeader->magic = 0x54876421; saveHeader->gMissionLadderPos = gMissionLadderPos; - + saveHeader->SavedData = MissionEndData; return sizeof(GAME_SAVE_HEADER); @@ -409,7 +408,7 @@ int SaveGameData(char* buffer) int LoadGameData(char* buffer) { GAME_SAVE_HEADER* header; - + header = (GAME_SAVE_HEADER*)buffer; if (header->magic != 0x54876421) @@ -435,7 +434,7 @@ int CalcConfigDataSize(void) int SaveConfigData(char* buffer) { CONFIG_SAVE_HEADER* header; - + header = (CONFIG_SAVE_HEADER*)buffer; ClearMem((char*)buffer, sizeof(CONFIG_SAVE_HEADER)); @@ -447,7 +446,7 @@ int SaveConfigData(char* buffer) header->gVibration = gVibration; header->gCopDifficultyLevel = gCopDifficultyLevel; header->gFurthestMission = gFurthestMission; - + header->PALAdjustX = draw_mode_pal.framex; header->PALAdjustY = draw_mode_pal.framey; header->NTSCAdjustX = draw_mode_ntsc.framex; @@ -494,8 +493,3 @@ int LoadConfigData(char* buffer) return 1; } - - - - - diff --git a/src_rebuild/Game/C/loadsave.h b/src_rebuild/Game/C/loadsave.h index 347859788..7836dfaa4 100644 --- a/src_rebuild/Game/C/loadsave.h +++ b/src_rebuild/Game/C/loadsave.h @@ -30,5 +30,4 @@ extern int CalcConfigDataSize(); // 0x00058164 extern int SaveConfigData(char *buffer); // 0x00057BF0 extern int LoadConfigData(char *buffer); // 0x00057DF0 - -#endif +#endif // LOADSAVE_H diff --git a/src_rebuild/Game/C/loadview.c b/src_rebuild/Game/C/loadview.c index 0a500a5ae..6a98e3bce 100644 --- a/src_rebuild/Game/C/loadview.c +++ b/src_rebuild/Game/C/loadview.c @@ -27,7 +27,7 @@ void ShowLoading(void) return; int col = (VERTTYPE)(++loading_bar_pos * load_steps); - + if (col > 120) col = 120; @@ -76,8 +76,8 @@ void SetupScreenFade(int start, int end, int speed) // [D] [T] void FadeGameScreen(int flag) { - static POLY_F4 poly; // offset 0x0 - static POLY_FT4 p; // offset 0x20 + static POLY_F4 poly; + static POLY_FT4 p; bool do_fade; @@ -90,7 +90,7 @@ void FadeGameScreen(int flag) { int val = screen_fade_value; - if (val < 0) + if (val < 0) { val = 0; } @@ -151,7 +151,7 @@ void ShowLoadingScreen(char *screen_name, int effect, int loading_steps) POLY_FT3 nulls[4]; int fade_step; - if (effect == 1) + if (effect == 1) SetDispMask(0); SetupDefDrawEnv(&load_draw, 0, 0, 320, 512); @@ -182,9 +182,9 @@ void ShowLoadingScreen(char *screen_name, int effect, int loading_steps) DrawSync(0); done = 0; - + tp = 320; - + null = nulls; sprt = prims; @@ -208,7 +208,7 @@ void ShowLoadingScreen(char *screen_name, int effect, int loading_steps) null->x2 = -1; null->y2 = -1; null->tpage = getTPage(1, 0, tp, 0); - + null++; sprt++; @@ -242,15 +242,15 @@ void ShowLoadingScreen(char *screen_name, int effect, int loading_steps) null++; sprt++; - + tp += 128; - + i++; } #define FADE_STEP 2 - if (effect == 1) + if (effect == 1) { fade = 8; fade_step = FADE_STEP; @@ -271,7 +271,7 @@ void ShowLoadingScreen(char *screen_name, int effect, int loading_steps) if (i == 2) SetDispMask(1); - + i++; for (j = 0; j < 4; j++) @@ -286,13 +286,13 @@ void ShowLoadingScreen(char *screen_name, int effect, int loading_steps) DrawPrim(&nulls[j]); DrawPrim(&prims[j]); } - + DrawSync(0); // [A] - if(gFastLoadingScreens == 0) + if (gFastLoadingScreens == 0) VSync(0); - + #ifndef PSX PsyX_EndScene(); #endif @@ -301,29 +301,28 @@ void ShowLoadingScreen(char *screen_name, int effect, int loading_steps) PutDrawEnv(&load_draw); fade += fade_step; - - if (effect == 1) + + if (effect == 1) { if (fade > 127) done = 1; } else if (effect == 2) { - if(fade < 0) + if (fade < 0) done = 1; } - + } while (!done); load_steps = 24; - if (gInFrontend == 0) + if (gInFrontend == 0) load_steps = 20; loading_bar_pos = 0; } - // [D] [T] void CloseShutters(int speed, int width, int height) { @@ -394,10 +393,10 @@ void SetupFadePolys(void) // [D] [T] void DrawFadePoly(void) { - if (fadeVal < 0) + if (fadeVal < 0) { bMissionTitleFade = 0; - + if (!gInGameCutsceneActive) gStopPadReads = 0; @@ -425,22 +424,22 @@ void DrawFadePoly(void) // [D] [T] void DisplayMissionTitle(void) { - if (bWantFade && CameraCnt == 1) + if (bWantFade && CameraCnt == 1) { bWantFade = 0; bMissionTitleFade = CameraCnt; } - if (bMissionTitleFade && !pauseflag) + if (bMissionTitleFade && !pauseflag) { fadeVal -= 6; if (NoPlayerControl != 0) { - if (fadeVal < 0) + if (fadeVal < 0) { bMissionTitleFade = 0; - + if (gInGameCutsceneActive == 0) gStopPadReads = 0; @@ -448,9 +447,9 @@ void DisplayMissionTitle(void) fadeVal = 0; } } - else + else { - if (gMissionTitle) + if (gMissionTitle) { #ifdef PSX gShowMap = 1; @@ -467,8 +466,3 @@ void DisplayMissionTitle(void) } } } - - - - - diff --git a/src_rebuild/Game/C/loadview.h b/src_rebuild/Game/C/loadview.h index c4250e1a3..99d5cd2b2 100644 --- a/src_rebuild/Game/C/loadview.h +++ b/src_rebuild/Game/C/loadview.h @@ -17,5 +17,4 @@ extern void DrawFadePoly(); // 0x00058824 extern void DisplayMissionTitle(); // 0x00058B08 - -#endif +#endif // LOADVIEW_H diff --git a/src_rebuild/Game/C/main.c b/src_rebuild/Game/C/main.c index 6405104c5..f5c1b0a32 100644 --- a/src_rebuild/Game/C/main.c +++ b/src_rebuild/Game/C/main.c @@ -60,17 +60,17 @@ #include "state.h" #include "cutrecorder.h" -int levelstartpos[8][4] = { - { 4785, -1024, -223340, 0}, - { -223276, 2048, -235167, 0}, - { 230347, -1024, 704030, 0}, - { 91631, -1024, -347175, 0}, - - // what? - { 148808, 6163, -112000, 0}, - { -170000, 6163, 361000, 0}, - { -10500, -6163, -22144, 0}, - { -8995, -6163, 63655, 0}, +int levelstartpos[4][4] = { + { 4785, -1024, -223340, 0 }, // CHICAGO + { -223276, 2048, -235167, 0 }, // HAVANA + { 230347, -1024, 704030, 0 }, // VEGAS + { 91631, -1024, -347175, 0 }, // RIO + + // [A] UNUSED - Driver 1 leftover + //{ 148808, 6163, -112000, 0 }, + //{ -170000, 6163, 361000, 0 }, + //{ -10500, -6163, -22144, 0 }, + //{ -8995, -6163, 63655, 0 }, }; XZPAIR gStartPos = { 0 }; @@ -112,7 +112,7 @@ enum LevLumpType LUMP_CURVES2 = 41, LUMP_JUNCTIONS2 = 42, // previously LUMP_JUNCTIONS2 - LUMP_JUNCTIONS2_NEW = 43, // Only appear in release Driver2 + LUMP_JUNCTIONS2_NEW = 43, // only appear in release Driver 2 }; int gStopPadReads = 0; @@ -131,8 +131,8 @@ int FrameCnt = 0; static int WantPause = 0; static PAUSEMODE PauseMode = PAUSEMODE_PAUSE; -u_char defaultPlayerModel[2] = { 0 }; // offset 0xAA604 -u_char defaultPlayerPalette = 0; // offset 0xAA606 +u_char defaultPlayerModel[2] = { 0 }; +u_char defaultPlayerPalette = 0; u_int* transparent_buffer; @@ -161,10 +161,11 @@ void InitModelNames(void) gCleanWheelModelPtr = FindModelPtrWithName("CLEANWHEEL"); gFastWheelModelPtr = FindModelPtrWithName("FASTWHEEL"); gDamWheelModelPtr = FindModelPtrWithName("DAMWHEEL"); + gPed1HeadModelPtr = FindModelPtrWithName("PEDHEAD1"); - gPed2HeadModelPtr = FindModelPtrWithName("HEAD"); - gPed3HeadModelPtr = FindModelPtrWithName("HEAD"); - gPed4HeadModelPtr = FindModelPtrWithName("HEAD"); + //gPed2HeadModelPtr = FindModelPtrWithName("HEAD"); + //gPed3HeadModelPtr = FindModelPtrWithName("HEAD"); + //gPed4HeadModelPtr = FindModelPtrWithName("HEAD"); //gBoxModelPtr = FindModelPtrWithName("CRATE"); //gRotorPtr = FindModelPtrWithName("ROTOR"); @@ -188,6 +189,7 @@ void ProcessLumps(char* lump_ptr, int lump_size) int* ptr; int numLumps = -1; + int i; quit = 0; do { @@ -195,176 +197,152 @@ void ProcessLumps(char* lump_ptr, int lump_size) seg_size = *(int*)(lump_ptr + 4); ptr = (int*)(lump_ptr + 8); - if (lump_type == LUMP_LOWDETAILTABLE) - { - printInfo("LUMP_LOWDETAILTABLE: size: %d\n", seg_size); - ProcessLowDetailTable((char*)ptr, seg_size); - } - else if (lump_type == LUMP_CHAIR) - { - printInfo("LUMP_CHAIR: size: %d\n", seg_size); - ProcessChairLump((char*)ptr, seg_size); - } - else if (lump_type == LUMP_MOTIONCAPTURE) - { - printInfo("LUMP_MOTIONCAPTURE: size: %d\n", seg_size); - ProcessMotionLump((char*)ptr, seg_size); - gLoadedMotionCapture = 1; - } - else if (lump_type == LUMP_OVERLAYMAP) - { - printInfo("LUMP_OVERLAYMAP: size: %d\n", seg_size); - ProcessOverlayLump((char*)ptr, seg_size); - gLoadedOverlay = 1; - } - else if (lump_type == LUMP_MAP) + switch (lump_type) { - map_lump = (char*)ptr; - } - else if (lump_type == LUMP_SPOOLINFO) - { - printInfo("LUMP_SPOOLINFO: size: %d\n", seg_size); - ProcessSpoolInfoLump((char*)ptr, lump_size); - ProcessMapLump(map_lump, 0); + case LUMP_MODELS: + printInfo("LUMP_MODELS: size: %d\n", seg_size); + ProcessMDSLump((char*)ptr, seg_size); + ProcessCarModelLump(car_models_lump, 0); - // [A] only used in alpha 1.6 - region_buffer_xor = (cells_down >> 5 & 2U | cells_across >> 6 & 1U) << 2; - sdSelfModifyingCode = sdSelfModifyingCode ^ (sdSelfModifyingCode ^ region_buffer_xor) & 12; - } - else if (lump_type == LUMP_CURVES2) - { - printInfo("LUMP_CURVES2: size: %d\n", seg_size); - ProcessCurvesDriver2Lump((char*)ptr, seg_size); - } - else if (lump_type == LUMP_TEXTURENAMES) - { - printInfo("LUMP_TEXTURENAMES: size: %d\n", seg_size); + InitModelNames(); + + SetUpEvents(1); + break; + + case LUMP_MAP: + map_lump = (char*)ptr; + break; + + case LUMP_TEXTURENAMES: + printInfo("LUMP_TEXTURENAMES: size: %d\n", seg_size); #ifndef PSX - // we need to copy texture names - texturename_buffer = D_MALLOC(seg_size); - memcpy(texturename_buffer, ptr, seg_size); + // we need to copy texture names + texturename_buffer = D_MALLOC(seg_size); + memcpy(texturename_buffer, ptr, seg_size); #else - // we need to copy texture names - texturename_buffer = (char*)ptr; + // we need to copy texture names + texturename_buffer = (char*)ptr; #endif - } - else if (lump_type == LUMP_PALLET) - { - printInfo("LUMP_PALLET: size: %d\n", seg_size); - palette_lump = (char*)ptr; - } - else if (lump_type == LUMP_TEXTUREINFO) - { - printInfo("LUMP_TEXTUREINFO: size: %d\n", seg_size); - ProcessTextureInfo((char*)ptr); - } - else if (lump_type == LUMP_STRAIGHTS2) - { - printInfo("LUMP_STRAIGHTS2: size: %d\n", seg_size); - ProcessStraightsDriver2Lump((char*)ptr, seg_size); - } - else if (lump_type == LUMP_JUNCTIONS2_NEW) - { - int cnt; + break; - printInfo("LUMP_JUNCTIONS2_NEW: size: %d\n", seg_size); - ProcessJunctionsDriver2Lump((char*)ptr, seg_size, 0); + case LUMP_ROADMAP: + printInfo("LUMP_ROADMAP: size: %d\n", seg_size); + NewProcessRoadMapLump(&roadMapLumpData, (char*)ptr); + break; - // put junction flags if any - cnt = 0; + case LUMP_ROADS: + printInfo("LUMP_ROADS: size: %d\n", seg_size); + ProcessRoadsLump((char*)ptr, seg_size); + break; - while (cnt < NumTempJunctions) - { - Driver2JunctionsPtr[cnt].flags = Driver2TempJunctionsPtr[cnt]; - cnt++; - } + case LUMP_JUNCTIONS: + printInfo("LUMP_JUNCTIONS: size: %d\n", seg_size); + ProcessJunctionsLump((char*)ptr, seg_size); + break; - gDemoLevel = 0; // [A] - } - else if (lump_type == LUMP_JUNCTIONS2) - { - int cnt; + case LUMP_ROADSURF: + printInfo("LUMP_ROADSURF: size: %d\n", seg_size); + break; + + case LUMP_MODELNAMES: + printInfo("LUMP_MODELNAMES: size: %d\n", seg_size); + modelname_buffer = (char*)ptr; + break; - printInfo("LUMP_JUNCTIONS2: size: %d\n", seg_size); - ProcessJunctionsDriver2Lump((char*)ptr, seg_size, 1); + case LUMP_ROADBOUNDS: + printInfo("LUMP_ROADBOUNDS: size: %d\n", seg_size); + ProcessRoadBoundsLump((char*)ptr, seg_size); + break; - // put junction flags if any - cnt = 0; + case LUMP_JUNCBOUNDS: + printInfo("LUMP_JUNCBOUNDS: size: %d\n", seg_size); + ProcessJuncBoundsLump((char*)ptr, seg_size); + break; - while (cnt < NumTempJunctions) - { - Driver2JunctionsPtr[cnt].flags = Driver2TempJunctionsPtr[cnt]; - cnt++; - } + case LUMP_SUBDIVISION: + printInfo("LUMP_SUBDIVISION: size: %d\n", seg_size); + ProcessSubDivisionLump((char*)ptr, seg_size); + break; - gDemoLevel = 1; // [A] - gLoadedMotionCapture = 0; - } - else if (lump_type == LUMP_JUNCTIONS) - { - printInfo("LUMP_JUNCTIONS: size: %d\n", seg_size); - ProcessJunctionsLump((char*)ptr, seg_size); - } - else if (lump_type == LUMP_CAR_MODELS) - { - printInfo("LUMP_CAR_MODELS: size: %d\n", seg_size); - car_models_lump = (char*)ptr; - } - else if (lump_type == LUMP_MODELS) - { - printInfo("LUMP_MODELS: size: %d\n", seg_size); - ProcessMDSLump((char*)ptr, seg_size); - ProcessCarModelLump(car_models_lump, 0); - - InitModelNames(); + case LUMP_LOWDETAILTABLE: + printInfo("LUMP_LOWDETAILTABLE: size: %d\n", seg_size); + ProcessLowDetailTable((char*)ptr, seg_size); + break; - SetUpEvents(1); - } - else if (lump_type == LUMP_ROADMAP) - { - printInfo("LUMP_ROADMAP: size: %d\n", seg_size); - NewProcessRoadMapLump(&roadMapLumpData, (char*)ptr); - } - else if (lump_type == LUMP_ROADS) - { - printInfo("LUMP_ROADS: size: %d\n", seg_size); - ProcessRoadsLump((char*)ptr, seg_size); - } - else if (lump_type == LUMP_ROADBOUNDS) - { - printInfo("LUMP_ROADBOUNDS: size: %d\n", seg_size); - ProcessRoadBoundsLump((char*)ptr, seg_size); - } - else if (lump_type == LUMP_JUNCBOUNDS) - { - printInfo("LUMP_JUNCBOUNDS: size: %d\n", seg_size); - ProcessJuncBoundsLump((char*)ptr, seg_size); - } - else if (lump_type == LUMP_SUBDIVISION) - { - printInfo("LUMP_SUBDIVISION: size: %d\n", seg_size); - ProcessSubDivisionLump((char*)ptr, seg_size); - } - else if (lump_type == LUMP_ROADSURF) - { - printInfo("LUMP_ROADSURF: size: %d\n", seg_size); - } - else if (lump_type == LUMP_MODELNAMES) - { - printInfo("LUMP_MODELNAMES: size: %d\n", seg_size); - modelname_buffer = (char*)ptr; - } - else if (lump_type == 0xff) - { - quit = true; - } - else - { - printInfo("ERROR - unknown lump type %d\n", lump_type); - numLumps = lump_type; + case LUMP_MOTIONCAPTURE: + printInfo("LUMP_MOTIONCAPTURE: size: %d\n", seg_size); + ProcessMotionLump((char*)ptr, seg_size); + gLoadedMotionCapture = 1; + break; - lump_ptr += 4; - continue; + case LUMP_OVERLAYMAP: + printInfo("LUMP_OVERLAYMAP: size: %d\n", seg_size); + ProcessOverlayLump((char*)ptr, seg_size); + gLoadedOverlay = 1; + break; + + case LUMP_PALLET: + printInfo("LUMP_PALLET: size: %d\n", seg_size); + palette_lump = (char*)ptr; + break; + + case LUMP_SPOOLINFO: + printInfo("LUMP_SPOOLINFO: size: %d\n", seg_size); + ProcessSpoolInfoLump((char*)ptr, lump_size); + ProcessMapLump(map_lump, 0); + + // [A] only used in alpha 1.6 + region_buffer_xor = (cells_down >> 5 & 2U | cells_across >> 6 & 1U) << 2; + sdSelfModifyingCode = sdSelfModifyingCode ^ (sdSelfModifyingCode ^ region_buffer_xor) & 12; + break; + + case LUMP_CAR_MODELS: + printInfo("LUMP_CAR_MODELS: size: %d\n", seg_size); + car_models_lump = (char*)ptr; + break; + + case LUMP_CHAIR: + printInfo("LUMP_CHAIR: size: %d\n", seg_size); + ProcessChairLump((char*)ptr, seg_size); + break; + + case LUMP_TEXTUREINFO: + printInfo("LUMP_TEXTUREINFO: size: %d\n", seg_size); + ProcessTextureInfo((char*)ptr); + break; + + case LUMP_STRAIGHTS2: + printInfo("LUMP_STRAIGHTS2: size: %d\n", seg_size); + ProcessStraightsDriver2Lump((char*)ptr, seg_size); + break; + + case LUMP_CURVES2: + printInfo("LUMP_CURVES2: size: %d\n", seg_size); + ProcessCurvesDriver2Lump((char*)ptr, seg_size); + break; + + case LUMP_JUNCTIONS2: + case LUMP_JUNCTIONS2_NEW: + printInfo("LUMP_JUNCTIONS2: size: %d\n", seg_size); + ProcessJunctionsDriver2Lump((char*)ptr, seg_size, + gDemoLevel = (lump_type == LUMP_JUNCTIONS2) // [A] + ); + + // put junction flags if any + for (i = 0; i < NumTempJunctions; i++) + Driver2JunctionsPtr[i].flags = Driver2TempJunctionsPtr[i]; + break; + + case 0xff: + quit = 1; + break; + + default: + printInfo("ERROR - unknown lump type %d\n", lump_type); + numLumps = lump_type; + + lump_ptr += 4; + continue; } lump_ptr = (char*)ptr + ((seg_size + 3) & ~0x3); // aligned to 4-byte boundary @@ -412,7 +390,7 @@ void LoadGameLevel(void) // CITYLUMP_DATA1 - load-time lump ProcessLumps((char*)_primTab1 + 8, nsectors * CDSECTOR_SIZE); - + // CITYLUMP_TPAGE is right next after DATA1 LoadPermanentTPages(§or); @@ -426,17 +404,17 @@ void LoadGameLevel(void) loadsectors(malloc_lump, sector, nsectors); sector += nsectors; - + // CITYLUMP_DATA2 - in-memory lump - ProcessLumps(malloc_lump + 8, (nsectors * CDSECTOR_SIZE)); + ProcessLumps(malloc_lump + 8, (nsectors * CDSECTOR_SIZE)); SpoolLumpOffset = citylumps[GameLevel][CITYLUMP_SPOOL].x; - //Init_Reflection_Mapping(); // [A] I know that this is obsolete and used NOWHERE + //Init_Reflection_Mapping(); // [A] UNUSED - Driver 1 leftover InitDebrisNames(); InitShadow(); - //InitTextureNames(); // [A] I know that this is obsolete and used NOWHERE - + //InitTextureNames(); // [A] UNUSED - Driver 1 leftover + #if USE_PC_FILESYSTEM extern int gContentOverride; @@ -446,7 +424,7 @@ void LoadGameLevel(void) LoadPermanentTPagesFromTIM(); } #endif - + ReportMode(1); } @@ -463,7 +441,7 @@ void State_GameInit(void* param) sys_freeall(); malloctab = D_MALLOC(0x200000); #endif // USE_CRT_MALLOC - + mallocptr = (char*)malloctab; // 4 regions, 1024 packed cell pointers @@ -538,13 +516,13 @@ void State_GameInit(void* param) { if (GameType == GAME_TAKEADRIVE) { - if(GameLevel == 0) + if (GameLevel == LEVEL_CHICAGO) musicType = 0 + (gCurrentMissionNumber & 1); - else if (GameLevel == 1) + else if (GameLevel == LEVEL_HAVANA) musicType = 5 + (gCurrentMissionNumber & 1); - else if (GameLevel == 2) + else if (GameLevel == LEVEL_VEGAS) musicType = 2 + (gCurrentMissionNumber & 1) * 5; - else if (GameLevel == 3) + else if (GameLevel == LEVEL_RIO) musicType = 3 + (gCurrentMissionNumber & 1); } else @@ -552,30 +530,30 @@ void State_GameInit(void* param) musicType = gCurrentMissionNumber % 8; } } - else + else #endif - if (GameLevel == 1) + if (GameLevel == LEVEL_CHICAGO) { - musicType = 1; + musicType = 2; if ((gCurrentMissionNumber & 1U) != 0) - musicType = 5; + musicType = 6; } - else if (GameLevel == 0) + else if (GameLevel == LEVEL_HAVANA) { - musicType = 2; + musicType = 1; if ((gCurrentMissionNumber & 1U) != 0) - musicType = 6; + musicType = 5; } - else if (GameLevel == 2) + else if (GameLevel == LEVEL_VEGAS) { musicType = 0; if ((gCurrentMissionNumber & 1U) == 0) musicType = 3; } - else if (GameLevel == 3) + else if (GameLevel == LEVEL_RIO) { musicType = 4; @@ -701,7 +679,7 @@ void State_GameInit(void* param) if (gTimeOfDay == TIME_DUSK) { - for ( i = 0; i < MAX_CARS; i++) + for (i = 0; i < MAX_CARS; i++) lightsOnDelay[i] = (i * 11); } @@ -794,7 +772,7 @@ void State_GameInit(void* param) ReadControllers(); VSync(0); } - + #ifdef PSX inittimer(120); Clock_SystemStartUp(); @@ -835,9 +813,9 @@ VECTOR leadcar_pos; // [D] [T] void StepSim(void) { - static u_int t0; // offset 0x0 - static char t1; // offset 0x4 - static char t2; // offset 0x5 + static u_int t0; + static char t1; + static char t2; char padAcc; short* playerFelony; @@ -994,7 +972,7 @@ void StepSim(void) t2 = Pads[*cp->ai.padid].type & 4; // [A] handle REDRIVER2 dedicated car exit button - if(t0 & CAR_PAD_LEAVECAR_DED) + if (t0 & CAR_PAD_LEAVECAR_DED) { t0 &= ~CAR_PAD_LEAVECAR_DED; t0 |= CAR_PAD_LEAVECAR; @@ -1049,7 +1027,7 @@ void StepSim(void) case CONTROL_TYPE_CUTSCENE: if (!_CutRec_RecordCarPad(cp, &t0, &t1, &t2)) cjpPlay(-*cp->ai.padid, &t0, &t1, &t2); - + ProcessCarPad(cp, t0, t1, t2); } @@ -1082,7 +1060,7 @@ void StepSim(void) // walk back if (padAcc < -64) { - if(padAcc < -100) + if (padAcc < -100) Pads[stream].mapped |= 0x1000; else Pads[stream].mapped |= 0x1008; @@ -1132,7 +1110,7 @@ void StepSim(void) if (!game_over) { - if(pathAILoaded) + if (pathAILoaded) ControlCops(); if (gLoadedMotionCapture) @@ -1186,6 +1164,7 @@ void StepSim(void) DealWithHorn(&pl->horn.request, i); } + pl++; } @@ -1230,7 +1209,7 @@ void StepSim(void) { CheckCarEffects(&car_data[stupid_logic[car]], i); SwirlLeaves(&car_data[stupid_logic[car]]); - + i++; } } @@ -1304,6 +1283,7 @@ void StepGame(void) for (i = 0; i < NumPlayers; i++) { pl = &player[i]; + if (pl->horn.time == 0 || pl->horn.on == 0) pl->horn.time = 0; else @@ -1422,7 +1402,7 @@ void StepGame(void) else EnablePause(PAUSEMODE_PAUSE); } - else if(quick_replay && !paused) + else if (quick_replay && !paused) { WantPause = 1; PauseMode = PAUSEMODE_GAMEOVER; @@ -1497,7 +1477,7 @@ void CheckForPause(void) } } } - + if (WantPause) { WantPause = 0; @@ -1513,24 +1493,24 @@ void CheckForPause(void) switch (ret) { - case MENU_QUIT_CONTINUE: - pauseflag = 0; - break; - case MENU_QUIT_QUIT: - EndGame(GAMEMODE_QUIT); - break; - case MENU_QUIT_RESTART: - EndGame(GAMEMODE_RESTART); - break; - case MENU_QUIT_DIRECTOR: - EndGame(GAMEMODE_DIRECTOR); - break; - case MENU_QUIT_QUICKREPLAY: - EndGame(GAMEMODE_REPLAY); - break; - case MENU_QUIT_NEXTMISSION: - EndGame(GAMEMODE_NEXTMISSION); - break; + case MENU_QUIT_CONTINUE: + pauseflag = 0; + break; + case MENU_QUIT_QUIT: + EndGame(GAMEMODE_QUIT); + break; + case MENU_QUIT_RESTART: + EndGame(GAMEMODE_RESTART); + break; + case MENU_QUIT_DIRECTOR: + EndGame(GAMEMODE_DIRECTOR); + break; + case MENU_QUIT_QUICKREPLAY: + EndGame(GAMEMODE_REPLAY); + break; + case MENU_QUIT_NEXTMISSION: + EndGame(GAMEMODE_NEXTMISSION); + break; } if (ret != 0 && !game_over) @@ -1584,7 +1564,7 @@ void State_GameLoop(void* param) while (--cnt >= 0) { - if(cnt != 0) + if (cnt != 0) InitCamera(&player[0]); StepGame(); @@ -1597,7 +1577,7 @@ void State_GameLoop(void* param) _CutRec_Draw(); DrawGame(); - + if (game_over) SetState(STATE_GAMECOMPLETE); @@ -1626,7 +1606,7 @@ void DrawGame(void) ObjectDrawnValue += 16; DrawPauseMenus(); - + RenderGame2(1); SwapDrawBuffers2(1); } @@ -1639,7 +1619,6 @@ void DrawGame(void) FrameCnt++; } - // [D] [T] void EndGame(GAMEMODE mode) { @@ -1647,7 +1626,6 @@ void EndGame(GAMEMODE mode) game_over = 1; } - // [D] [T] void EnablePause(PAUSEMODE mode) { @@ -1721,7 +1699,7 @@ void PrintCommandLineArguments() " -nointro : disable intro screens\n" " -nofmv : disable all FMVs\n"; - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "REDRIVER 2 command line arguments", argumentsMessage, NULL); + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "REDRIVER2 command line arguments", argumentsMessage, NULL); } #endif @@ -1732,8 +1710,8 @@ extern "C" u_long memTab_org; extern "C" u_long mallocTab_org; // TODO: mapping in Linker script -//volatile u_char _memoryTab_org[0x50400] __attribute__((aligned(0x10))); // 0xE7000 -//volatile u_char _mallocTab_org[0xD47BC /*0xC37BC*/] __attribute__((aligned(0x10))); // 0x137400 +//volatile u_char _memoryTab_org[0x50400] __attribute__((aligned(0x10))); // 0xE7000 +//volatile u_char _mallocTab_org[0xD47BC /*0xC37BC*/] __attribute__((aligned(0x10))); // 0x137400 volatile u_char* _memoryTab_org = (u_char*)&memTab_org; volatile u_char* _mallocTab_org = (u_char*)&mallocTab_org; @@ -1757,16 +1735,16 @@ int redriver2_main(int argc, char** argv) #endif // PSX { char** ScreenNames; - + char* PALScreenNames[4] = { // [A] don't show publisher logo - // "GFX\\SPLASH2.TIM", - // "GFX\\SPLASH3.TIM", + //"GFX\\SPLASH2.TIM", + //"GFX\\SPLASH3.TIM", "GFX\\SPLASH1P.TIM", NULL }; - char* NTSCScreenNames[4] = { // [A] don't show publisher logo - // "GFX\\SPLASH2.TIM", + char* NTSCScreenNames[4] = { // [A] don't show publisher logo + //"GFX\\SPLASH2.TIM", //"GFX\\SPLASH3.TIM", "GFX\\SPLASH1N.TIM", NULL @@ -1785,14 +1763,14 @@ int redriver2_main(int argc, char** argv) #ifdef PSX printf("------REDRIVER2 STARTUP------\n"); - volatile u_char* _path_org = &_memoryTab_org[0]; // 0xE7000 - volatile u_char* _otag1_org = &_memoryTab_org[0xC000]; // 0xF3000 - volatile u_char* _otag2_org = &_memoryTab_org[0x10200]; // 0xF7200 - volatile u_char* _primTab1_org = &_memoryTab_org[0x14400]; // 0xFB400 - volatile u_char* _primTab2_org = &_memoryTab_org[0x32400]; // 0x119400 - volatile u_char* _sbnk_org = &_mallocTab_org[0x48C00]; // 0x180000 - volatile u_char* _frnt_org = &_mallocTab_org[0x88C00]; // 0x1C0000 - volatile u_char* _repl_org = &_mallocTab_org[0xC47BC]; // 0x1FABBC + volatile u_char* _path_org = &_memoryTab_org[0]; // 0xE7000 + volatile u_char* _otag1_org = &_memoryTab_org[0xC000]; // 0xF3000 + volatile u_char* _otag2_org = &_memoryTab_org[0x10200]; // 0xF7200 + volatile u_char* _primTab1_org = &_memoryTab_org[0x14400]; // 0xFB400 + volatile u_char* _primTab2_org = &_memoryTab_org[0x32400]; // 0x119400 + volatile u_char* _sbnk_org = &_mallocTab_org[0x48C00]; // 0x180000 + volatile u_char* _frnt_org = &_mallocTab_org[0x88C00]; // 0x1C0000 + volatile u_char* _repl_org = &_mallocTab_org[0xC47BC]; // 0x1FABBC _frontend_buffer = (char*)_otag1_org; _other_buffer = (char*)_otag1_org; @@ -1806,14 +1784,14 @@ int redriver2_main(int argc, char** argv) _sbank_buffer = (char*)_sbnk_org; malloctab = (char*)_mallocTab_org; - printf("path_org = %x\n", _path_org); // 0xE7000 - printf("otag1_org = %x\n", _otag1_org); // 0xF3000 - printf("otag2_org = %x\n", _otag2_org); // 0xF7200 - printf("primTab1_org = %x\n", _primTab1_org); // 0xFB400 - printf("primTab2_org = %x\n", _primTab2_org); // 0x119400 - printf("sbnk_org = %x\n", _sbnk_org); // 0x180000 - printf("frnt_org = %x\n", _frnt_org); // 0x1C0000 - printf("repl_org = %x\n", _repl_org); // 0x1FABBC + printf("path_org = %x\n", _path_org); // 0xE7000 + printf("otag1_org = %x\n", _otag1_org); // 0xF3000 + printf("otag2_org = %x\n", _otag2_org); // 0xF7200 + printf("primTab1_org = %x\n", _primTab1_org); // 0xFB400 + printf("primTab2_org = %x\n", _primTab2_org); // 0x119400 + printf("sbnk_org = %x\n", _sbnk_org); // 0x180000 + printf("frnt_org = %x\n", _frnt_org); // 0x1C0000 + printf("repl_org = %x\n", _repl_org); // 0x1FABBC printf("malloctab = %x\n", malloctab); #endif @@ -1840,8 +1818,8 @@ int redriver2_main(int argc, char** argv) InitControllers(); Init_FileSystem(); InitSound(); - - // [A] REDRIVER 2 version auto-detection + + // [A] REDRIVER2 version auto-detection // this is the only difference between the files on CD #ifdef DEMO_VERSION ScreenNames = OPMScreenNames; @@ -1875,22 +1853,22 @@ int redriver2_main(int argc, char** argv) } // TODO: divide game by the states, place main loop here. - + if (argc <= 1) #elif !defined(PSX) - + InitStringMng(); - + #endif { //PlayFMV(99); // [A] don't show publisher logo - ShowHiresScreens(ScreenNames, 300, 0); // [A] + ShowHiresScreens(ScreenNames, 300, 0); // [A] screens can be skiped PlayFMV(0); // play intro movie } CheckForCorrectDisc(0); - + // Init frontend LOAD_OVERLAY("FRONTEND.BIN", _overlay_buffer); @@ -1905,14 +1883,14 @@ int redriver2_main(int argc, char** argv) SetState(STATE_INITFRONTEND, (void*)2); LoadCurrentProfile(1); - -#ifndef PSX + +#ifndef PSX int commandLinePropsShown; commandLinePropsShown = 0; for (int i = 1; i < argc; i++) { - if (!strcmp(argv[i], "-ini") || + if (!strcmp(argv[i], "-ini") || !strcmp(argv[i], "-cdimage")) { i++; @@ -2036,7 +2014,7 @@ int redriver2_main(int argc, char** argv) { CurrentGameMode = GAMEMODE_REPLAY; gLoadedReplay = 1; - + SetState(STATE_GAMELAUNCH); } else @@ -2114,7 +2092,6 @@ void FadeScreen(int end_value) pauseflag = tmp2; } - // [D] [T] void UpdatePlayerInformation(void) { @@ -2173,12 +2150,12 @@ void UpdatePlayerInformation(void) // [A] if all wheels above the water surface and we are falling down // fade out and end the game - if(wheelsAboveWaterToDieWithFade > 0 && cp->hd.where.t[1] < -1000 && gDieWithFade == 0) + if (wheelsAboveWaterToDieWithFade > 0 && cp->hd.where.t[1] < -1000 && gDieWithFade == 0) { - // fix for Havana tunnels and Chicago freeway - if (GameLevel <= 1) + // fix for Chicago freeway and Havana tunnels + if (GameLevel == LEVEL_CHICAGO || GameLevel == LEVEL_HAVANA) { - if(wheelsAboveWaterToDieWithFade == 4) + if (wheelsAboveWaterToDieWithFade == 4) gDieWithFade = 1; } else // car drown as usual @@ -2263,7 +2240,7 @@ void RenderGame2(int view) SetCameraVector(); SetupDrawMapPSX(); - + DrawDrivingGames(); DrawThrownBombs(); AddGroundDebris(); @@ -2355,7 +2332,7 @@ void RenderGame2(int view) notInDreaAndStevesEvilLair = Havana3DOcclusion(DrawMapPSX, (int*)&ObjectDrawnValue); if (notInDreaAndStevesEvilLair) - { + { DrawSkyDome(); if (current->primtab - (current->primptr - PRIMTAB_SIZE) > 40000) @@ -2383,7 +2360,6 @@ void RenderGame2(int view) #endif } - // [D] [T] void RenderGame(void) { @@ -2392,7 +2368,7 @@ void RenderGame(void) } int Havana3DLevelDraw = -1; -int Havana3DLevelMode = -1; // 0 = uses 1.0 LEV file, 1 = uses v1.1 LEV file +int Havana3DLevelMode = -1; // 0 = uses 1.0 LEV file, 1 = uses v1.1 LEV file // [D] [T] void InitGameVariables(void) @@ -2523,9 +2499,9 @@ void DealWithHorn(char* hr, int i) channel = i != 0 ? 5 : 2; - SetChannelPosition3(channel, - (VECTOR*)car->hd.where.t, - (LONGVECTOR3*)car->st.n.linearVelocity, + SetChannelPosition3(channel, + (VECTOR*)car->hd.where.t, + (LONGVECTOR3*)car->st.n.linearVelocity, -2000, i * 8 + 4096, 0); } @@ -2549,12 +2525,12 @@ int Havana3DOcclusion(occlFunc func, int* param) } #endif - if (GameLevel == 1 && - camera_position.vx <= -430044 && camera_position.vx >= -480278 && + if (GameLevel == LEVEL_HAVANA && + camera_position.vx <= -430044 && camera_position.vx >= -480278 && camera_position.vz <= -112814 && camera_position.vz >= -134323) { // TODO: Hardcode into different builds for PSX version - if(Havana3DLevelMode == -1) + if (Havana3DLevelMode == -1) { // try autodetecting tempPos.vy = -3823; @@ -2567,7 +2543,7 @@ int Havana3DOcclusion(occlFunc func, int* param) Havana3DLevelMode = 0; } - if(Havana3DLevelMode == 0) + if (Havana3DLevelMode == 0) { // v1.0 method outside = 1; @@ -2598,7 +2574,7 @@ int Havana3DOcclusion(occlFunc func, int* param) else { draw = 15; - + if (camera_position.vy >= 1730) { draw = 14; @@ -2607,7 +2583,7 @@ int Havana3DOcclusion(occlFunc func, int* param) { draw = 13; - if(camera_position.vz < -120000) + if (camera_position.vz < -120000) { draw = 12; @@ -2627,7 +2603,7 @@ int Havana3DOcclusion(occlFunc func, int* param) if (loop < 10) loop = 10; } - else if(Havana3DLevelMode == 1) + else if (Havana3DLevelMode == 1) { // v1.1 method - simpler one outside = 0; @@ -2687,7 +2663,7 @@ int Havana3DOcclusion(occlFunc func, int* param) if (loop < 9) loop = 9; } - + otAltered = 0; while (true) @@ -2697,18 +2673,18 @@ int Havana3DOcclusion(occlFunc func, int* param) events.camera = 0; return outside; } - - if (loop == 16) + + if (loop == 16) break; - + if (draw != loop) { otAltered = 200; } - + events.draw = loop; current->ot += otAltered; - + (*func)(param); if (otAltered != 0) @@ -2716,18 +2692,18 @@ int Havana3DOcclusion(occlFunc func, int* param) current->ot -= otAltered; otAltered = 0; } - + loop++; } events.camera = 0; - + if (draw == 15 && camera_position.vx > -458001) { events.camera = 0; return outside; } - + (*func)(param); return 1; } @@ -2736,8 +2712,3 @@ int Havana3DOcclusion(occlFunc func, int* param) return 1; } - - - - - diff --git a/src_rebuild/Game/C/main.h b/src_rebuild/Game/C/main.h index f07ec1320..abf47801b 100644 --- a/src_rebuild/Game/C/main.h +++ b/src_rebuild/Game/C/main.h @@ -26,7 +26,7 @@ extern int ObjectDrawnValue; extern int Havana3DLevelDraw; -extern void SsSetSerialVol(short s_num, short voll, short volr); // TEMPORARY +extern void SsSetSerialVol(short s_num, short voll, short volr); // 0x00092B3C (TEMPORARY) extern void State_GameInit(void* param); // 0x00059330 extern void State_GameLoop(void* param); // 0x0005A8DC @@ -54,4 +54,4 @@ extern void DealWithHorn(char *hr, int i); // 0x0005BF74 typedef void(*occlFunc)(int* comp_val); extern int Havana3DOcclusion(occlFunc func, int *param); // 0x0005C16C -#endif +#endif // MAIN_H diff --git a/src_rebuild/Game/C/map.c b/src_rebuild/Game/C/map.c index be17294d9..e6672b803 100644 --- a/src_rebuild/Game/C/map.c +++ b/src_rebuild/Game/C/map.c @@ -80,13 +80,13 @@ void ProcessMapLump(char* lump_ptr, int lump_size) num_regions = cell_header.num_regions; #ifdef PSX - if(num_regions > MAX_REGIONS) + if (num_regions > MAX_REGIONS) { printError("MAX_REGIONS is too small , allocate at least %d !", num_regions); trap(0x400); } - if(cell_header.cell_size != MAP_CELL_SIZE) + if (cell_header.cell_size != MAP_CELL_SIZE) { printError("Error LevEdit cellsize %d whilst PSX cellsize %d\n", cell_header.cell_size, MAP_CELL_SIZE); trap(0x400); @@ -116,7 +116,6 @@ void ProcessMapLump(char* lump_ptr, int lump_size) memcpy((u_char*)cell_objects, (u_char*)lump_ptr + 4, num_straddlers * sizeof(PACKED_CELL_OBJECT)); } - // [D] [T] void NewProcessRoadMapLump(ROAD_MAP_LUMP_DATA *pRoadMapLumpData, char *pLumpFile) { @@ -133,7 +132,6 @@ void ProcessJunctionsLump(char *lump_file, int lump_size) return; } - // [D] [T] void ProcessRoadsLump(char *lump_file, int lump_size) { @@ -155,10 +153,10 @@ void ProcessJuncBoundsLump(char *lump_file, int lump_size) // [D] [T] int newPositionVisible(VECTOR *pos, char *pvs, int ccx, int ccz) { - int dx; // $a2 - int dz; // $a0 - int cellx; // $v1 - int cellz; // $v0 + int dx; + int dz; + int cellx; + int cellz; dx = pos->vx + units_across_halved; dz = pos->vz + units_down_halved; @@ -171,7 +169,7 @@ int newPositionVisible(VECTOR *pos, char *pvs, int ccx, int ccz) cellz = MIN(MAX(cellz, -9), PVS_CELL_COUNT / 2); #endif // PSX - if (ABS(cellx) <= view_dist && + if (ABS(cellx) <= view_dist && ABS(cellz) <= view_dist) { return pvs[cellx + 10 + (cellz + 10) * pvs_square] != 0; @@ -211,7 +209,7 @@ int CheckUnpackNewRegions(void) topbottom_unpack = 0; num_regions_to_unpack = 0; - if (saved_leadcar_pos != 0) + if (saved_leadcar_pos != 0) return 0; force_load_boundary = 13; @@ -221,7 +219,7 @@ int CheckUnpackNewRegions(void) if (current_barrel_region_xcell < force_load_boundary) { - if (region_x != 0) + if (region_x != 0) { leftright_unpack = 1; num_regions_to_unpack = 1; @@ -242,7 +240,7 @@ int CheckUnpackNewRegions(void) if (current_barrel_region_zcell < force_load_boundary) { - if (region_z != 0) + if (region_z != 0) { topbottom_unpack = 1; regions_to_unpack[num_regions_to_unpack].xoffset = 0; @@ -273,11 +271,11 @@ int CheckUnpackNewRegions(void) regions_to_unpack[2].zoffset = -1; } } - else + else { if (leftright_unpack == 1) regions_to_unpack[2].xoffset = -1; - else + else regions_to_unpack[2].xoffset = 1; regions_to_unpack[2].zoffset = 1; @@ -302,7 +300,7 @@ int CheckUnpackNewRegions(void) { regions_unpacked[target_region] = region_to_unpack; } - else + else { Spool *spoolptr = (Spool*)(RegionSpoolInfo + spoolinfo_offsets[region_to_unpack]); @@ -326,7 +324,7 @@ int CheckUnpackNewRegions(void) srcsort = sortorder + i; destsort = sortorder + (i + 1); - for (j = sortcount - (i + 1); j > 0; --j) + for (j = sortcount - (i + 1); j > 0; --j) { sort = *srcsort; if (sortregions[*destsort].vz < sortregions[*srcsort].vz) @@ -366,7 +364,7 @@ void ControlMap(void) UnpackRegion(region_to_unpack, region_x & 1U | (region_z & 1U) * 2); current_region = region_to_unpack; - + CheckLoadAreaData(current_barrel_region_xcell, current_barrel_region_zcell); CheckUnpackNewRegions(); @@ -545,7 +543,7 @@ void PVSDecode(char *output, char *celldata, ushort sz, int havanaCorruptCellBod } } - if (havanaCorruptCellBodge == 0) + if (havanaCorruptCellBodge == 0) decodebuf[pvs_square_sq-1] ^= 1; size = pvs_square - 2; @@ -589,7 +587,6 @@ void PVSDecode(char *output, char *celldata, ushort sz, int havanaCorruptCellBod memcpy((u_char*)output, decodebuf, pvs_square_sq-1); // 110*4 } - // [D] [T] void GetPVSRegionCell2(int source_region, int region, int cell, char *output) { @@ -610,7 +607,7 @@ void GetPVSRegionCell2(int source_region, int region, int cell, char *output) } #endif - if (regions_unpacked[source_region] == region && loading_region[source_region] == -1) + if (regions_unpacked[source_region] == region && loading_region[source_region] == -1) { bp = PVS_Buffers[source_region]; PVSEncodeTable = (u_char *)(bp + 0x802); @@ -618,27 +615,22 @@ void GetPVSRegionCell2(int source_region, int region, int cell, char *output) length = M_SHRT_2((u_char)tbp[2], (u_char)tbp[3]) - M_SHRT_2((u_char)tbp[0], (u_char)tbp[1]) & 0xffff; - if (length != 0) + if (length != 0) { havanaCorruptCellBodge = (regions_unpacked[source_region] == 158 && cell == 168); PVSDecode(output, bp + M_SHRT_2((u_char)tbp[0], (u_char)tbp[1]), length, havanaCorruptCellBodge); } - else + else { for (k = 0; k < pvs_square_sq; k++) output[k] = 1; } } - else + else { // don't draw non-loaded regions for (k = 0; k < pvs_square_sq; k++) output[k] = 0; } } - - - - - diff --git a/src_rebuild/Game/C/map.h b/src_rebuild/Game/C/map.h index d9f2242a4..6848dbcd2 100644 --- a/src_rebuild/Game/C/map.h +++ b/src_rebuild/Game/C/map.h @@ -24,8 +24,8 @@ extern OUT_CELL_FILE_HEADER cell_header; #endif -extern int cells_across; // offset 0xAA67C -extern int cells_down; // offset 0xAA680 +extern int cells_across; +extern int cells_down; extern int current_region; extern int old_region; @@ -80,5 +80,4 @@ extern void ControlMap(); // 0x0005CC00 extern void GetVisSetAtPosition(VECTOR *pos, char *tgt, int *ccx, int *ccz); // 0x0005D6E4 extern void GetPVSRegionCell2(int source_region, int region, int cell, char *output); // 0x0005D224 - -#endif +#endif // MAP_H diff --git a/src_rebuild/Game/C/mc_snd.c b/src_rebuild/Game/C/mc_snd.c index 22ac154ff..78869807e 100644 --- a/src_rebuild/Game/C/mc_snd.c +++ b/src_rebuild/Game/C/mc_snd.c @@ -35,91 +35,91 @@ char missionstarts[42] = { io id_map[49] = { - {0, 0},{0, 1}, - - {2, 0}, - {3, 1}, - {4, 0}, - {5, 1}, - {4, 0}, - {5, 1}, - {11, 0}, - - {12, 0},{12, 1}, - - {11, 2}, - - {14, 0},{14, 0}, - - {15, 0}, - - {16, 1},{16, 2}, - - {18, 3},{18, 4}, - - {11, 0},{11, 0}, - - {20, 0}, - - {12, 1}, - - {13, 2}, - - {21, 0}, - {31, 1},{31, 0}, - {11, 1}, - {23, 0}, - {24, 1}, - {26, 0}, - {27, 1}, - {28, 2}, - {34, 0}, - - {29, 1}, {29, 2}, - - {20, 3}, - {31, 0}, - {11, 1}, - {31, 0}, - {33, 1}, - {34, 0}, - {36, 1}, - {29, 2}, - {29, 3}, - {20, 4}, - {37, 0}, - {38, 1}, - {39, 0}, + { 0, 0 }, { 0, 1 }, + + { 2, 0 }, + { 3, 1 }, + { 4, 0 }, + { 5, 1 }, + { 4, 0 }, + { 5, 1 }, + { 11, 0 }, + + { 12, 0 }, { 12, 1 }, + + { 11, 2 }, + + { 14, 0 }, { 14, 0 }, + + { 15, 0 }, + + { 16, 1 }, { 16, 2 }, + + { 18, 3 }, { 18, 4 }, + + { 11, 0 }, { 11, 0 }, + + { 20, 0 }, + + { 12, 1 }, + + { 13, 2 }, + + { 21, 0 }, + { 31, 1 }, { 31, 0 }, + { 11, 1 }, + { 23, 0 }, + { 24, 1 }, + { 26, 0 }, + { 27, 1 }, + { 28, 2 }, + { 34, 0 }, + + { 29, 1 }, { 29, 2 }, + + { 20, 3 }, + { 31, 0 }, + { 11, 1 }, + { 31, 0 }, + { 33, 1 }, + { 34, 0 }, + { 36, 1 }, + { 29, 2 }, + { 29, 3 }, + { 20, 4 }, + { 37, 0 }, + { 38, 1 }, + { 39, 0 } }; xa_request xa_data[26] = { - {16, 0, 0, 1, 0}, - {25, 0, 1, 2, 0}, - {30, 0, 2, 3, 0}, - {38, 0, 3, 4, 0}, - {16, 0, 4, 9, 0}, - {130, 0, 5, 10, 0}, - {90, 0, 6, 13, 0}, - {16, 0, 7, 14, 0}, - {640, 1, 0, 18, 1}, - {16, 1, 1, 22, 0}, - {450, 1, 2, 23, 0}, - {16, 1, 3, 25, 0}, - {16, 1, 4, 26, 0}, - {20, 1, 5, 27, 0}, - {40, 1, 6, 28, 0}, - {350, 1, 7, 29, 1}, - {16, 2, 0, 29, 0}, - {16, 2, 1, 30, 0}, - {150, 2, 2, 31, 0}, - {16, 2, 3, 32, 0}, - {16, 2, 4, 34, 0}, - {25, 2, 5, 35, 0}, - {16, 2, 6, 37, 0}, - {16, 2, 7, 39, 0}, - {750, 3, 0, 33, 1}, - - {0, 0, 0, 0xFF, 0}, + { 16, 0, 0, 1, 0 }, + { 25, 0, 1, 2, 0 }, + { 30, 0, 2, 3, 0 }, + { 38, 0, 3, 4, 0 }, + { 16, 0, 4, 9, 0 }, + { 130, 0, 5, 10, 0 }, + { 90, 0, 6, 13, 0 }, + { 16, 0, 7, 14, 0 }, + { 640, 1, 0, 18, 1 }, + { 16, 1, 1, 22, 0 }, + { 450, 1, 2, 23, 0 }, + { 16, 1, 3, 25, 0 }, + { 16, 1, 4, 26, 0 }, + { 20, 1, 5, 27, 0 }, + { 40, 1, 6, 28, 0 }, + { 350, 1, 7, 29, 1 }, + { 16, 2, 0, 29, 0 }, + { 16, 2, 1, 30, 0 }, + { 150, 2, 2, 31, 0 }, + { 16, 2, 3, 32, 0 }, + { 16, 2, 4, 34, 0 }, + { 25, 2, 5, 35, 0 }, + { 16, 2, 6, 37, 0 }, + { 16, 2, 7, 39, 0 }, + { 750, 3, 0, 33, 1 }, + + { 0, 0, 0, 255, 0 } }; int cutscene_timer = 0; @@ -145,25 +145,26 @@ char GetMissionSound(char id) c++; } while (end == 0xff); - while (start < end) + while (start < end) { c = start + 1; - - if (id_map[start].in == id) + + if (id_map[start].in == id) { if (c == end) return id_map[start].out + phrase_top; - - if(id_map[c].in == id) + + if (id_map[c].in == id) return id_map[start + (rnd % 2 & 0xffU)].out + phrase_top; return id_map[start].out + phrase_top; } - + start = c; } } + return -1; } @@ -224,7 +225,6 @@ void InitializeCutsceneSound(int cutscene) } } - int jericho_in_back = 0; static int rio_alarm = 0; @@ -287,7 +287,7 @@ void DoCutsceneSound(void) if (cutscene_timer == 206) Start3DSoundVolPitch(-1, SOUND_BANK_TANNER, 4, car_data[2].hd.where.t[0], -car_data[2].hd.where.t[1], car_data[2].hd.where.t[2], -2500, 3072); } - + if (gInGameCutsceneID == 1 && cutscene_timer == 6) { PrepareXA(); @@ -344,7 +344,7 @@ void DoCutsceneSound(void) if (cutscene_timer == 180) { Start3DTrackingSound(-1, SOUND_BANK_MISSION, - GetMissionSound(26), + GetMissionSound(26), (VECTOR*)car_data[2].hd.where.t, (LONGVECTOR3*)car_data[2].st.n.linearVelocity); } @@ -384,11 +384,11 @@ void InitializeMissionSound(void) jericho_in_back = 0; - if (GameLevel == 0) + if (GameLevel == LEVEL_CHICAGO) { es_mobile[0] = AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 4, -10000, 0, 0, 0, 0); } - else if (GameLevel == 1) + else if (GameLevel == LEVEL_HAVANA) { if (gCurrentMissionNumber - 15U < 2) { @@ -399,7 +399,7 @@ void InitializeMissionSound(void) jericho_in_back = 1; } } - else if (GameLevel == 2) + else if (GameLevel == LEVEL_VEGAS) { if (gCurrentMissionNumber == 22) { @@ -410,7 +410,7 @@ void InitializeMissionSound(void) AddEnvSnd(3, 0x20, SOUND_BANK_MISSION, GetMissionSound(31), 3000, -37000, 270500, 0, 0); } } - else if (GameLevel == 3) + else if (GameLevel == LEVEL_RIO) { if (gCurrentMissionNumber == 32) { @@ -449,7 +449,7 @@ void DoMissionSound(void) if (bodgevar == 1) { channel = GetFreeChannel(); - + Start3DSoundVolPitch(channel, SOUND_BANK_MISSION, GetMissionSound(11), pos[0], pos[1], pos[2], -1000, 0x1000); bodgevar = 2; } @@ -501,9 +501,9 @@ void DoMissionSound(void) chan = GetFreeChannel(); StartSound(chan, SOUND_BANK_MISSION, GetMissionSound(20), -1500, 4096); - SetChannelPosition3(chan, - (VECTOR*)car_data[carId].hd.where.t, - (LONGVECTOR3*)car_data[carId].st.n.linearVelocity, + SetChannelPosition3(chan, + (VECTOR*)car_data[carId].hd.where.t, + (LONGVECTOR3*)car_data[carId].st.n.linearVelocity, -1500, 4096 - Mission.timer[0].count / 750, 0); } } @@ -597,9 +597,9 @@ void DoMissionSound(void) case 35: { VECTOR Q[3] = { - {201520, -177, 385248}, - {201392, -177, 389200}, - {199376, -177, 389200} + { 201520, -177, 385248 }, + { 201392, -177, 389200 }, + { 199376, -177, 389200 } }; if (bodgevar > 0 && bodgevar < 4) @@ -692,9 +692,9 @@ void DoMissionSound(void) Start3DSoundVolPitch(channel, SOUND_BANK_MISSION, 0, pos[0], pos[1], pos[2], -1000, 4096); bodgevar = 2; } - else if(bodgevar == 2) + else if (bodgevar == 2) { - if(channel > -1) + if (channel > -1) SetChannelPosition3(channel, (VECTOR*)pos, NULL, -1000, 4096, 0 ); } else if (bodgevar == 3) @@ -925,7 +925,6 @@ char SilenceThisCar(int car) return 0; } - // [D] [T] void AdjustPlayerCarVolume(void) { @@ -943,8 +942,3 @@ void AdjustPlayerCarVolume(void) player[0].idlevol = -8000; } } - - - - - diff --git a/src_rebuild/Game/C/mc_snd.h b/src_rebuild/Game/C/mc_snd.h index 4db57e6d3..c16225843 100644 --- a/src_rebuild/Game/C/mc_snd.h +++ b/src_rebuild/Game/C/mc_snd.h @@ -20,5 +20,4 @@ extern void SetMSoundVar(intptr_t var, VECTOR *V); // 0x0005F25C extern char SilenceThisCar(int car); // 0x0005EE00 extern void AdjustPlayerCarVolume(); // 0x0005F294 - -#endif +#endif // MC_SND_H diff --git a/src_rebuild/Game/C/mdraw.c b/src_rebuild/Game/C/mdraw.c index 7b23e3977..60d0e205d 100644 --- a/src_rebuild/Game/C/mdraw.c +++ b/src_rebuild/Game/C/mdraw.c @@ -46,7 +46,6 @@ void DrawTimer(MR_TIMER* timer) } } - // [D] [T] void DisplayPlayerPosition(void) { @@ -70,7 +69,6 @@ void DrawMessage(int y, char* string) PrintStringBoxed(string, 24, y - 10); } - // [D] [T] void DrawMission(void) { @@ -81,23 +79,23 @@ void DrawMission(void) if (gDisplayPosition) DisplayPlayerPosition(); - + if (MissionHeader->type & 4) { SetTextColour(128, 128, 64); if (g321GoDelay < 32) string = "3"; - else if(g321GoDelay < 64) + else if (g321GoDelay < 64) string = "2"; else string = "1"; - if (NumPlayers == 1) + if (NumPlayers == 1) { PrintScaledString(96, string, 32 - (g321GoDelay & 0x1f)); } - else + else { PrintScaledString(SCREEN_H / 4, string, 32 - (g321GoDelay & 0x1f)); PrintScaledString(SCREEN_H / 2 + SCREEN_H / 4, string, 32 - (g321GoDelay & 0x1f)); @@ -148,7 +146,7 @@ void DrawOverheadTarget(MS_TARGET *target) if (!(target->s.target_flags & TARGET_FLAG_VISIBLE_ALLP)) return; - switch(target->type) + switch (target->type) { case Target_Point: // point or car target case Target_Car: @@ -183,7 +181,7 @@ void DrawFullscreenTarget(MS_TARGET *target) if (!(target->s.target_flags & TARGET_FLAG_VISIBLE_ALLP)) return; - switch(target->type) + switch (target->type) { case Target_Point: // point or car target case Target_Car: @@ -222,8 +220,8 @@ void DrawWorldTarget(MS_TARGET *target) gDraw3DArrowBlue = 0; flags = 0x2; - - switch(target->type) + + switch (target->type) { case Target_Point: { @@ -232,14 +230,14 @@ void DrawWorldTarget(MS_TARGET *target) tv.vy = 10000; // Capture the Flag target properties - switch(target->s.target_flags & (TARGET_FLAG_POINT_CTF_BASE_P1 | TARGET_FLAG_POINT_CTF_BASE_P2 | TARGET_FLAG_POINT_CTF_FLAG)) + switch (target->s.target_flags & (TARGET_FLAG_POINT_CTF_BASE_P1 | TARGET_FLAG_POINT_CTF_BASE_P2 | TARGET_FLAG_POINT_CTF_FLAG)) { case TARGET_FLAG_POINT_CTF_BASE_P1: { // [A] - if(CurrentPlayerView != 0) + if (CurrentPlayerView != 0) flags = 0x10; - + gDraw3DArrowBlue = 0; break; } @@ -248,20 +246,20 @@ void DrawWorldTarget(MS_TARGET *target) // [A] if (CurrentPlayerView != 1) flags = 0x10; - + gDraw3DArrowBlue = 1; break; } case TARGET_FLAG_POINT_CTF_FLAG: { - if (gPlayerWithTheFlag == -1) + if (gPlayerWithTheFlag == -1) { if (CurrentPlayerView == 1) gDraw3DArrowBlue = 1; } else { - if (CurrentPlayerView == gPlayerWithTheFlag) + if (CurrentPlayerView == gPlayerWithTheFlag) return; tv.vx = player[gPlayerWithTheFlag].pos[0]; @@ -277,9 +275,9 @@ void DrawWorldTarget(MS_TARGET *target) if (target->s.point.height != 0) tv.vy = target->s.point.posY; - else + else tv.vy = -MapHeight(&tv); - + break; } case Target_Car: @@ -306,7 +304,7 @@ void DrawWorldTarget(MS_TARGET *target) if (gMultiplayerLevels && doSpooling == 0 || Long2DDistance(player[0].spoolXZ, &tv) <= 15900) { - if((flags & 0x10) == 0) + if ((flags & 0x10) == 0) { if (target->s.display_flags & 0x20) flags |= 0x1; @@ -315,7 +313,7 @@ void DrawWorldTarget(MS_TARGET *target) flags |= 0x20; } - if (flags) + if (flags) Draw3DTarget(&tv, flags); } } @@ -342,20 +340,20 @@ void DrawMultiplayerTarget(MS_TARGET *target) g = 64; b = 64; - if(activeTargets == 1) + if (activeTargets == 1) { r = 128; g = 0; b = 0; } - else if(activeTargets == 2) + else if (activeTargets == 2) { r = 0; g = 128; b = 0; } - switch(target->type) + switch (target->type) { case Target_Point: { @@ -364,7 +362,7 @@ void DrawMultiplayerTarget(MS_TARGET *target) tv.vy = 10000; // Capture the Flag target properties - switch(target->s.target_flags & (TARGET_FLAG_POINT_CTF_BASE_P1 | TARGET_FLAG_POINT_CTF_BASE_P2 | TARGET_FLAG_POINT_CTF_FLAG)) + switch (target->s.target_flags & (TARGET_FLAG_POINT_CTF_BASE_P1 | TARGET_FLAG_POINT_CTF_BASE_P2 | TARGET_FLAG_POINT_CTF_FLAG)) { case TARGET_FLAG_POINT_CTF_BASE_P1: { @@ -382,10 +380,23 @@ void DrawMultiplayerTarget(MS_TARGET *target) } case TARGET_FLAG_POINT_CTF_FLAG: { - if(gPlayerWithTheFlag != -1) + if (gPlayerWithTheFlag != -1) { tv.vx = player[gPlayerWithTheFlag].pos[0]; tv.vz = player[gPlayerWithTheFlag].pos[2]; + + if (gPlayerWithTheFlag == 0) + { + r = 128; + g = 0; + b = 0; + } + else if (gPlayerWithTheFlag == 1) + { + r = 0; + g = 128; + b = 0; + } } break; @@ -394,7 +405,7 @@ void DrawMultiplayerTarget(MS_TARGET *target) if (target->s.point.height != 0) tv.vy = target->s.point.posY; - else + else tv.vy = -MapHeight(&tv); break; @@ -427,7 +438,6 @@ void DrawMultiplayerTarget(MS_TARGET *target) } } - // [D] [T] void DrawWorldTargets(void) { @@ -440,7 +450,6 @@ void DrawWorldTargets(void) DrawWorldTarget(&MissionTargets[i]); } - // [D] [T] void DrawOverheadTargets(void) { @@ -453,7 +462,6 @@ void DrawOverheadTargets(void) DrawOverheadTarget(&MissionTargets[i]); } - // [D] [T] void DrawFullscreenTargets(void) { @@ -476,4 +484,4 @@ void DrawMultiplayerTargets(void) for (i = 0; i < MAX_MISSION_TARGETS; i++) DrawMultiplayerTarget(&MissionTargets[i]); -} \ No newline at end of file +} diff --git a/src_rebuild/Game/C/mdraw.h b/src_rebuild/Game/C/mdraw.h index fbb4c242b..082fcb78b 100644 --- a/src_rebuild/Game/C/mdraw.h +++ b/src_rebuild/Game/C/mdraw.h @@ -1,7 +1,6 @@ #ifndef MDRAW_H #define MDRAW_H - extern void DrawMission(); // 0x0005F2FC extern void DrawWorldTargets(); // 0x0005FC3C @@ -10,4 +9,4 @@ extern void DrawOverheadTargets(); // 0x0005FC8C extern void DrawFullscreenTargets(); // 0x0005FCDC extern void DrawMultiplayerTargets(); // 0x0005FD2C -#endif +#endif // MDRAW_H diff --git a/src_rebuild/Game/C/mgeneric.c b/src_rebuild/Game/C/mgeneric.c index 20b2d3492..666b76f05 100644 --- a/src_rebuild/Game/C/mgeneric.c +++ b/src_rebuild/Game/C/mgeneric.c @@ -28,7 +28,7 @@ void StorePlayerPosition(SAVED_PLAYER_POS *data) data->totaldamage = cp->totalDamage; data->felony = cp->felonyRating; - + data->damage[0] = cp->ap.damage[0]; data->damage[1] = cp->ap.damage[1]; data->damage[2] = cp->ap.damage[2]; @@ -47,7 +47,7 @@ void StorePlayerPosition(SAVED_PLAYER_POS *data) data->totaldamage = 0; data->felony = pedestrianFelony; - + data->damage[0] = 0; data->damage[1] = 0; data->damage[2] = 0; @@ -62,20 +62,19 @@ void StorePlayerPosition(SAVED_PLAYER_POS *data) } } - // [D] [T] void RestorePlayerPosition(SAVED_PLAYER_POS *data) { - if ((data->type & 0xf) == 1) + if ((data->type & 0xf) == 1) { PlayerStartInfo[0]->type = 1; PlayerStartInfo[0]->model = (data->type >> 4) & 15; PlayerStartInfo[0]->palette = (data->type >> 8) & 15; } - else + else PlayerStartInfo[0]->type = 2; - if (gCurrentMissionNumber != 16) + if (gCurrentMissionNumber != 16) { PlayerStartInfo[0]->position.vx = data->vx; PlayerStartInfo[0]->position.vy = data->vy; @@ -132,21 +131,20 @@ void StoreCarPosition(MS_TARGET *target, SAVED_CAR_POS *data) data->direction = cp->hd.direction; data->active = 1; - + if (target->s.target_flags & TARGET_FLAG_CAR_SWAPPED) data->active |= 0x80; } - // [D] [T] void RestoreCarPosition(SAVED_CAR_POS *data) { REPLAY_STREAM* stream; STREAM_SOURCE* playerStart; - if(!data->active) + if (!data->active) return; - + stream = &ReplayStreams[numPlayersToCreate]; stream->InitialPadRecordBuffer = (PADRECORD*)ReplayStart; @@ -158,7 +156,7 @@ void RestoreCarPosition(SAVED_CAR_POS *data) PlayerStartInfo[numPlayersToCreate] = &stream->SourceType; - if (data->active & 0x80) + if (data->active & 0x80) { memcpy((u_char*)PlayerStartInfo[numPlayersToCreate], (u_char*)PlayerStartInfo[0], sizeof(STREAM_SOURCE)); @@ -186,7 +184,7 @@ void RestoreCarPosition(SAVED_CAR_POS *data) playerStart->damage[4] = data->damage[4]; playerStart->damage[5] = data->damage[5]; } - else + else { playerStart = &stream->SourceType; @@ -207,6 +205,7 @@ void RestoreCarPosition(SAVED_CAR_POS *data) playerStart->damage[4] = data->damage[4]; playerStart->damage[5] = data->damage[5]; } + numPlayersToCreate++; } @@ -219,25 +218,25 @@ void StoreEndData(void) SAVED_CAR_POS* carpos; ClearMem((char*)&MissionEndData, sizeof(MissionEndData)); - + if (gCurrentMissionNumber > 40) return; numStored = 0; StorePlayerPosition(&MissionEndData.PlayerPos); - for(i = 0; i < MAX_MISSION_TARGETS && numStored < 6; i++) + for (i = 0; i < MAX_MISSION_TARGETS && numStored < 6; i++) { target = &MissionTargets[i]; carpos = &MissionEndData.CarPos[numStored]; if (target->type == Target_Car && - (target->s.target_flags & TARGET_FLAG_CAR_SAVED) && + (target->s.target_flags & TARGET_FLAG_CAR_SAVED) && (target->s.target_flags & TARGET_FLAG_CAR_PINGED_IN)) { StoreCarPosition(target, carpos); - if(carpos->active) + if (carpos->active) numStored++; } } diff --git a/src_rebuild/Game/C/mgeneric.h b/src_rebuild/Game/C/mgeneric.h index 98bc1df5b..2fd2da3ed 100644 --- a/src_rebuild/Game/C/mgeneric.h +++ b/src_rebuild/Game/C/mgeneric.h @@ -1,8 +1,7 @@ #ifndef MGENERIC_H #define MGENERIC_H - extern void StoreEndData(); // 0x00060740 extern void RestoreStartData(); // 0x000607E4 -#endif +#endif // MGENERIC_H diff --git a/src_rebuild/Game/C/mission.c b/src_rebuild/Game/C/mission.c index 4f419bd6d..6d0fa785a 100644 --- a/src_rebuild/Game/C/mission.c +++ b/src_rebuild/Game/C/mission.c @@ -92,7 +92,7 @@ GAMEMODE WantedGameMode = GAMEMODE_NORMAL; GAMETYPE StoredGameType; -int GameLevel = 0; +int GameLevel = LEVEL_CHICAGO; int gInvincibleCar = 0; int gPlayerImmune = 0; u_char NumPlayers = 1; @@ -117,7 +117,7 @@ int gMinimumCops = 0; int gCopDesiredSpeedScale = 4096; int gCopMaxPowerScale = 4096; int gCurrentResidentSlot = 0; -int gPuppyDogCop = 0; // Driver 1 leftover +int gPuppyDogCop = 0; // Driver 1 leftover int CopsAllowed = 0; int MaxPlayerDamage[2] = { 0x1f40 }; @@ -296,7 +296,7 @@ void InitialiseMissionDefaults(void) ClearMem((char *)reservedSlots, sizeof(reservedSlots)); _CutRec_ReserveSlots(); - + cop_adjust = 0; playercollected[0] = 0; @@ -336,13 +336,13 @@ void SetupResidentModels() MissionHeader->residentModels[4] = PlayerStartInfo[0]->model; } - for(i = 0; i < 2; i++) + for (i = 0; i < 2; i++) { if (wantedCar[i] != -1) { int foundRM = -1; int singlePal; - + for (j = 0; j < 5; j++) { if (MissionHeader->residentModels[j] == wantedCar[i]) @@ -351,24 +351,24 @@ void SetupResidentModels() break; } } - + PlayerStartInfo[i]->model = wantedCar[i]; singlePal = (wantedCar[i] == 0 || wantedCar[i] > 4); - + // check if chosen cop car or special car if (wantedCar[i] > 4)// && NumPlayers == 1) - { + { MissionHeader->residentModels[4] = wantedCar[i]; } - else if(foundRM == -1) + else if (foundRM == -1) { MissionHeader->residentModels[takenSlots++] = wantedCar[i]; } else { // this can make things ugly - takenSlots = foundRM+1; + takenSlots = foundRM + 1; } // force palette @@ -415,7 +415,7 @@ void LoadMission(int missionnum) length = header >> 19; } - if (header == 0) + if (header == 0) { #if !defined(PSX) && !defined(__EMSCRIPTEN__) char errPrint[1024]; @@ -432,14 +432,14 @@ void LoadMission(int missionnum) { MissionLoadAddress = (MS_MISSION*)mallocptr; } - + LoadfileSeg(filename, (char *)MissionLoadAddress, offset, sizeof(MS_MISSION)); MissionHeader = MissionLoadAddress; MissionTargets = (MS_TARGET *)((char*)MissionLoadAddress + MissionLoadAddress->size); MissionScript = (u_int *)(MissionTargets + MAX_MISSION_TARGETS); MissionStrings = (char*)(MissionScript + MissionLoadAddress->strings); - + if (MissionLoadAddress->route && !NewLevel) loadsize = (u_int)((char*)MissionStrings + ((char*)MissionLoadAddress->route - (char*)MissionLoadAddress)); else @@ -477,26 +477,26 @@ void LoadMission(int missionnum) GameLevel = MissionHeader->city; // player start position init - if(!_CutRec_InitMission(filename)) + if (!_CutRec_InitMission(filename)) { PlayerStartInfo[0]->rotation = MissionHeader->playerStartRotation; PlayerStartInfo[0]->position.vx = MissionHeader->playerStartPosition.x; PlayerStartInfo[0]->position.vz = MissionHeader->playerStartPosition.y; - + #ifdef DEBUG_OPTIONS - if(gStartPos.x != 0 && gStartPos.z != 0) + if (gStartPos.x != 0 && gStartPos.z != 0) { PlayerStartInfo[0]->rotation = 0; PlayerStartInfo[0]->position.vx = gStartPos.x; PlayerStartInfo[0]->position.vz = gStartPos.z; } #endif - + PlayerStartInfo[0]->model = MissionHeader->playerCarModel; PlayerStartInfo[0]->palette = MissionHeader->playerCarColour; } - if (MissionHeader->maxDamage != 0) + if (MissionHeader->maxDamage != 0) { MaxPlayerDamage[1] = MissionHeader->maxDamage; MaxPlayerDamage[0] = MissionHeader->maxDamage; @@ -507,7 +507,7 @@ void LoadMission(int missionnum) gWeather = MissionHeader->weather; // [A] custom time of day - if(wantedTimeOfDay > -1) + if (wantedTimeOfDay > -1) gTimeOfDay = wantedTimeOfDay; // [A] custom weather @@ -516,7 +516,7 @@ void LoadMission(int missionnum) if (gTimeOfDay >= TIME_NIGHT) gNight = 1; - else + else gNight = 0; // setup weather @@ -525,7 +525,7 @@ void LoadMission(int missionnum) gRainCount = 30; gEffectsTimer = 41; } - else + else { gRainCount = 0; gEffectsTimer = 0; @@ -537,7 +537,7 @@ void LoadMission(int missionnum) Mission.timer[0].x = Mission.timer[1].x = 124; Mission.timer[0].y = 16; Mission.timer[1].y = SCREEN_H / 2 + 8; - + if (MissionHeader->timer || (MissionHeader->timerFlags & MISSIONTIMER_FLAG_COUNTER)) { int flag; @@ -546,7 +546,7 @@ void LoadMission(int missionnum) if (MissionHeader->timerFlags & MISSIONTIMER_FLAG_COUNTER) flag |= TIMER_FLAG_COUNTER; - + if (MissionHeader->timerFlags & MISSIONTIMER_FLAG_COMPLETE_ON_OUT) flag |= TIMER_FLAG_COMPLETE_ON_OUT; @@ -566,7 +566,7 @@ void LoadMission(int missionnum) if (maxCopCars == 4) { - if (GameType == GAME_SURVIVAL) + if (GameType == GAME_SURVIVAL) { gDontPingInCops = 0; gBatterPlayer = 1; @@ -578,7 +578,7 @@ void LoadMission(int missionnum) gBatterPlayer = 0; } } - else + else { gDontPingInCops = 0; gBatterPlayer = 0; @@ -622,18 +622,18 @@ void LoadMission(int missionnum) } // load specific AI for mission - if (NewLevel) + if (NewLevel) { if (MissionHeader->route == 0) { mallocptr += (missionSize + 3U & ~3); - if(LOAD_OVERLAY("PATH.BIN", _other_buffer2)) + if (LOAD_OVERLAY("PATH.BIN", _other_buffer2)) pathAILoaded = 1; leadAILoaded = 0; } - else + else { rinfo = (ROUTE_INFO *)(MissionStrings + MissionHeader->route); @@ -641,10 +641,10 @@ void LoadMission(int missionnum) NumTempJunctions = rinfo->nJunctions; memcpy((u_char*)Driver2TempJunctionsPtr, (u_char*)rinfo->data, NumTempJunctions << 2); LeadValues = rinfo->parameters; - + mallocptr = MissionStrings + MissionHeader->route; - if(LOAD_OVERLAY("LEAD.BIN", _other_buffer2)) + if (LOAD_OVERLAY("LEAD.BIN", _other_buffer2)) leadAILoaded = 1; #ifdef DEBUG @@ -695,7 +695,7 @@ void LoadMission(int missionnum) if (titleId > 11) titleId--; - + if (titleId > 7) titleId--; @@ -1035,7 +1035,7 @@ void LoadMission(int missionnum) printWarning("MR: function MRProcessTarget %d\n", val1); } - + break; } } @@ -1044,7 +1044,6 @@ void LoadMission(int missionnum) } } #endif - MRInitialiseThread(&MissionThreads[0], MissionScript, 0); } @@ -1065,7 +1064,7 @@ void HandleTimer(MR_TIMER *timer) if (timer->count > 10799999) timer->count = 10799999; } - else + else { timer->count -= 100; @@ -1078,14 +1077,14 @@ void HandleTimer(MR_TIMER *timer) timer->count = 9000; timer->flags |= 0x28; } - else + else { // do expolosions if (timer->flags & TIMER_FLAG_COMPLETE_ON_OUT) { if (Mission.gameover_delay == -1) { - SetMissionComplete(); + SetMissionComplete(); } timer->count = 0; @@ -1115,15 +1114,14 @@ void HandleTimer(MR_TIMER *timer) timer->frac = (timer->count % 3000) / 30; } - // [D] [T] void RegisterChaseHit(int car1, int car2) { int player_id; - if (Mission.ChaseTarget && Mission.ChaseHitDelay == 0) + if (Mission.ChaseTarget && Mission.ChaseHitDelay == 0) { - if (gPlayerWithTheFlag == -1) + if (gPlayerWithTheFlag == -1) { if (car1 == Mission.ChaseTarget->s.car.slot || car2 == Mission.ChaseTarget->s.car.slot) { @@ -1132,7 +1130,7 @@ void RegisterChaseHit(int car1, int car2) DamageBar.position++; } } - else + else { player_id = 1 - gPlayerWithTheFlag; gPlayerWithTheFlag = player_id; @@ -1141,21 +1139,20 @@ void RegisterChaseHit(int car1, int car2) Mission.ChaseHitDelay = 20; player[1 - player_id].targetCarId = gPlayerWithTheFlag; - SetPlayerMessage(player_id, G_LTXT(GTXT_YouGotTheFlag),2,1); + SetPlayerMessage(player_id, G_LTXT(GTXT_YouGotTheFlag), 2, 1); } } } - // [D] [T] void PauseMissionTimer(int pause) { - if (pause == 0) + if (pause == 0) { Mission.timer[0].flags &= ~TIMER_FLAG_PAUSED; Mission.timer[1].flags &= ~TIMER_FLAG_PAUSED; } - else + else { Mission.timer[0].flags |= TIMER_FLAG_PAUSED; Mission.timer[1].flags |= TIMER_FLAG_PAUSED; @@ -1176,12 +1173,12 @@ void SetMissionMessage(char *message, int priority, int seconds) { Mission.message_string[i] = message; Mission.message_priority[i] = priority; - - if (seconds == 0) + + if (seconds == 0) { Mission.message_timer[i] = 5; } - else + else { Mission.message_timer[i] = seconds * 30; } @@ -1208,7 +1205,7 @@ int TargetComplete(MS_TARGET *target, int player) { u_int flag; - if (player == 0) + if (player == 0) flag = TARGET_FLAG_COMPLETED_P1; else if (player == 1) flag = TARGET_FLAG_COMPLETED_P2; @@ -1218,7 +1215,6 @@ int TargetComplete(MS_TARGET *target, int player) return (target->s.target_flags & flag) == flag; } - // [D] [T] int TargetActive(MS_TARGET *target, int player) { @@ -1264,12 +1260,12 @@ int Swap2Cars(int curslot, int newslot) if (cp->ai.c.ctrlNode == NULL) ctrlNodeCurId = -1; else - ctrlNodeCurId = cp->ai.c.ctrlNode - cp->ai.c.targetRoute; // [A] + ctrlNodeCurId = cp->ai.c.ctrlNode - cp->ai.c.targetRoute; // [A] if (cp->ai.c.pnode == NULL) pnodeCurId = -1; - else - pnodeCurId = cp->ai.c.pnode - cp->ai.c.targetRoute; // [A] + else + pnodeCurId = cp->ai.c.pnode - cp->ai.c.targetRoute; // [A] } cp->lowDetail = -1; @@ -1283,12 +1279,12 @@ int Swap2Cars(int curslot, int newslot) if (cp->ai.c.ctrlNode == NULL) ctrlNodeNewId = -1; else - ctrlNodeNewId = cp->ai.c.ctrlNode - cp->ai.c.targetRoute; // [A] + ctrlNodeNewId = cp->ai.c.ctrlNode - cp->ai.c.targetRoute; // [A] if (cp->ai.c.pnode == NULL) pnodeNewId = -1; else - pnodeNewId = cp->ai.c.pnode - cp->ai.c.targetRoute; // [A] + pnodeNewId = cp->ai.c.pnode - cp->ai.c.targetRoute; // [A] } cp->lowDetail = -1; @@ -1309,7 +1305,7 @@ int Swap2Cars(int curslot, int newslot) if (carsOnBoat & (1 << curslot)) carsOnBoat |= (1 << newslot); - if(tmp) + if (tmp) carsOnBoat |= (1 << curslot); // swap ids @@ -1335,7 +1331,7 @@ int Swap2Cars(int curslot, int newslot) player[0].playerCarId = newslot; // swap world center car - if (player[0].worldCentreCarId == newslot) + if (player[0].worldCentreCarId == newslot) { player[0].spoolXZ = (VECTOR *)car_data[curslot].hd.where.t; player[0].worldCentreCarId = curslot; @@ -1351,14 +1347,14 @@ int Swap2Cars(int curslot, int newslot) // setup old slot nodes and reinit car cp = &car_data[curslot]; - if (ctrlNodeNewId == -1) + if (ctrlNodeNewId == -1) cp->ai.c.ctrlNode = 0; - else + else cp->ai.c.ctrlNode = &cp->ai.c.targetRoute[ctrlNodeNewId]; - if (pnodeNewId == -1) + if (pnodeNewId == -1) cp->ai.c.pnode = 0; - else + else cp->ai.c.pnode = &cp->ai.c.targetRoute[pnodeNewId]; CreateDentableCar(cp); @@ -1398,7 +1394,7 @@ int Swap2Cars(int curslot, int newslot) swapTgt->s.car.slot = newslot; else if (swapTgt->s.car.slot == newslot) swapTgt->s.car.slot = curslot; - } + } } #endif @@ -1422,7 +1418,6 @@ void SetConfusedCar(int slot) } } - // [D] [T] void HandleMissionThreads(void) { @@ -1446,24 +1441,24 @@ void HandleMissionThreads(void) switch (value & 0xff000000) { - case 0x0: - case 0x2000000: - case 0xff000000: - MR_DebugPrint("MR: push %d\n", value); - MRPush(thread, value); - break; - case 0x1000000: - MR_DebugPrint("MR: command %x\n", value); - running = MRCommand(thread, value); - break; - case 0x3000000: - MR_DebugPrint("MR: operator %x\n", value); - running = MROperator(thread, value); - break; - case 0x4000000: - MR_DebugPrint("MR: function %x\n", value); - running = MRFunction(thread, value); - break; + case 0x0: + case 0x2000000: + case 0xff000000: + MR_DebugPrint("MR: push %d\n", value); + MRPush(thread, value); + break; + case 0x1000000: + MR_DebugPrint("MR: command %x\n", value); + running = MRCommand(thread, value); + break; + case 0x3000000: + MR_DebugPrint("MR: operator %x\n", value); + running = MROperator(thread, value); + break; + case 0x4000000: + MR_DebugPrint("MR: function %x\n", value); + running = MRFunction(thread, value); + break; } } @@ -1707,13 +1702,13 @@ int MROperator(MR_THREAD *thread, u_int op) int val1; int val2; int result; - + result = 0; val1 = MRGetParam(thread); val2 = MRGetParam(thread); - switch(op) + switch (op) { case 0x3000003: // AND if (val1 != 0 && val2 != 0) @@ -1732,7 +1727,7 @@ int MROperator(MR_THREAD *thread, u_int op) result = 1; break; case 0x3000007: // GT - if(val1 > val2) + if (val1 > val2) result = 1; break; case 0x3000008: // LT @@ -1755,7 +1750,7 @@ int MRFunction(MR_THREAD *thread, u_int fnc) { int value; - if (fnc == 0x4000020) + if (fnc == 0x4000020) { value = MRPop(thread); value = MRProcessTarget(thread, &MissionTargets[value]); @@ -1777,7 +1772,6 @@ void MRInitialiseThread(MR_THREAD *thread, u_int *pc, u_char player) thread->sp = thread->initial_sp; } - // [D] [T] void MRStartThread(MR_THREAD *callingthread, u_int addr, unsigned char player) { @@ -1846,7 +1840,7 @@ int MRGetParam(MR_THREAD *thread) case 0x2000000: return MRGetVariable(thread, value); } - + return 0; } @@ -1855,7 +1849,7 @@ int MRGetVariable(MR_THREAD *thread, u_int var) { switch (var) { - case 0x2000008: + case 0x2000008: return Mission.timer[thread->player].count / 3000; case 0x2000100: return gCopDesiredSpeedScale; @@ -1866,7 +1860,7 @@ int MRGetVariable(MR_THREAD *thread, u_int var) case 0x2000103: return maxCopCars; } - + return 0; } @@ -1875,43 +1869,43 @@ void MRSetVariable(MR_THREAD *thread, u_int var, int value) { switch (var) { - case 0x2000008: - Mission.timer[thread->player].count = value * 3000; - break; - case 0x2000100: - gCopDesiredSpeedScale = value; - break; - case 0x2000101: - gCopMaxPowerScale = value; - break; - case 0x2000102: - gMinimumCops = value; - break; - case 0x2000103: - if (value == 4) - { - if (GameType == GAME_SURVIVAL) + case 0x2000008: + Mission.timer[thread->player].count = value * 3000; + break; + case 0x2000100: + gCopDesiredSpeedScale = value; + break; + case 0x2000101: + gCopMaxPowerScale = value; + break; + case 0x2000102: + gMinimumCops = value; + break; + case 0x2000103: + if (value == 4) { - gDontPingInCops = 0; - gBatterPlayer = 1; + if (GameType == GAME_SURVIVAL) + { + gDontPingInCops = 0; + gBatterPlayer = 1; + } + else + { + gDontPingInCops = 1; + gBatterPlayer = 0; + } } else { - gDontPingInCops = 1; + gDontPingInCops = 0; gBatterPlayer = 0; } - } - else - { - gDontPingInCops = 0; - gBatterPlayer = 0; - } - if (value > 0) - CopsAllowed = 1; + if (value > 0) + CopsAllowed = 1; - maxCopCars = value; - break; + maxCopCars = value; + break; } } @@ -1930,12 +1924,12 @@ int MRProcessTarget(MR_THREAD *thread, MS_TARGET *target) ret = 0; - if (TargetComplete(target, thread->player)) + if (TargetComplete(target, thread->player)) return 1; - if (thread->player == 0) + if (thread->player == 0) target->s.target_flags |= (TARGET_FLAG_VISIBLE_P1 | TARGET_FLAG_ACTIVE_P1); - else + else target->s.target_flags |= (TARGET_FLAG_VISIBLE_P2 | TARGET_FLAG_ACTIVE_P2); playerId = thread->player; @@ -1943,7 +1937,7 @@ int MRProcessTarget(MR_THREAD *thread, MS_TARGET *target) pv.vy = player[playerId].pos[1]; pv.vz = player[playerId].pos[2]; - switch(target->type) + switch (target->type) { case Target_Point: // point target { @@ -1972,7 +1966,7 @@ int MRProcessTarget(MR_THREAD *thread, MS_TARGET *target) tv.vz = target->s.point.posZ; tv.vy = 0; } - + if (Long2DDistance(&tv, &pv) <= target->s.point.radius) { if (target->s.point.height != 0) // if target is at height (Train pursuit) @@ -1983,7 +1977,7 @@ int MRProcessTarget(MR_THREAD *thread, MS_TARGET *target) if (GameType == GAME_SECRET) { - switch(target->s.target_flags & (TARGET_FLAG_POINT_SECRET_POINT1 | TARGET_FLAG_POINT_SECRET_POINT2 | TARGET_FLAG_POINT_SECRET_STARTFINISH)) + switch (target->s.target_flags & (TARGET_FLAG_POINT_SECRET_POINT1 | TARGET_FLAG_POINT_SECRET_POINT2 | TARGET_FLAG_POINT_SECRET_STARTFINISH)) { case 0: // TARGET_FLAG_POINT_SECRET_POINT0 { @@ -2030,7 +2024,7 @@ int MRProcessTarget(MR_THREAD *thread, MS_TARGET *target) break; } } - + return 0; } @@ -2101,7 +2095,7 @@ int MRProcessTarget(MR_THREAD *thread, MS_TARGET *target) correctZone = (target->s.target_flags & TARGET_FLAG_POINT_CTF_BASE_P1) && thread->player == 0 || (target->s.target_flags & TARGET_FLAG_POINT_CTF_BASE_P2) && thread->player == 1; - if(correctZone) + if (correctZone) { if (thread->player == 0) { @@ -2153,7 +2147,7 @@ int MRProcessTarget(MR_THREAD *thread, MS_TARGET *target) tv.vx = target->s.car.posX; tv.vz = target->s.car.posZ; tv.vy = 0; - + dist = Long2DDistance(&tv, &pv); slot = target->s.car.slot; @@ -2163,7 +2157,7 @@ int MRProcessTarget(MR_THREAD *thread, MS_TARGET *target) MRRequestCar(target); else MRCancelCarRequest(target); - + break; } @@ -2204,9 +2198,9 @@ int MRProcessTarget(MR_THREAD *thread, MS_TARGET *target) } else if (target->s.car.type == 3) { - if((target->s.target_flags & TARGET_FLAG_CAR_PLAYERCONTROLLED) == 0) + if ((target->s.target_flags & TARGET_FLAG_CAR_PLAYERCONTROLLED) == 0) { - if(target->s.car.flags & CARTARGET_FLAG_RANDOMCHASE) + if (target->s.car.flags & CARTARGET_FLAG_RANDOMCHASE) { if (target->s.car.cutscene == -1) { @@ -2282,7 +2276,7 @@ int MRProcessTarget(MR_THREAD *thread, MS_TARGET *target) } } - switch(target->s.car.flags & 0xf0) + switch (target->s.car.flags & 0xf0) { case 0: { @@ -2371,7 +2365,7 @@ int MRProcessTarget(MR_THREAD *thread, MS_TARGET *target) { lastsay = -1; } - + break; } case CATTARGET_FLAG_PROXIMITY_TARGET: // proximity extended messages @@ -2464,7 +2458,7 @@ int MRProcessTarget(MR_THREAD *thread, MS_TARGET *target) { lastsay = -1; } - + break; } case 0x20: @@ -2492,7 +2486,7 @@ int MRProcessTarget(MR_THREAD *thread, MS_TARGET *target) } // check if target car is damaged - if(failIfDamaged && cp->totalDamage >= MaxPlayerDamage[0]) + if (failIfDamaged && cp->totalDamage >= MaxPlayerDamage[0]) { message = MissionStrings + MissionHeader->msgCarWrecked; @@ -2510,7 +2504,7 @@ int MRProcessTarget(MR_THREAD *thread, MS_TARGET *target) } case CARTARGET_FLAG_CnR_TARGET: { - if(target->s.target_flags & TARGET_FLAG_CAR_PLAYERCONTROLLED) + if (target->s.target_flags & TARGET_FLAG_CAR_PLAYERCONTROLLED) { MaxPlayerDamage[1] = target->s.car.chasing.maxDamage; @@ -2559,7 +2553,7 @@ int MRProcessTarget(MR_THREAD *thread, MS_TARGET *target) SetMissionFailed(FAILED_MESSAGESET); } } - + break; } case Target_Event: // event target @@ -2588,7 +2582,7 @@ int MRProcessTarget(MR_THREAD *thread, MS_TARGET *target) { // keep only those flags target->s.target_flags &= ~TARGET_FLAG_COMPLETED_ALLP; - + if (thread->player == 0) target->s.target_flags |= TARGET_FLAG_COMPLETED_P1; else @@ -2613,7 +2607,7 @@ int MRRequestCar(MS_TARGET *target) return 0; Mission.CarTarget = target; - + return 1; } @@ -2629,7 +2623,7 @@ void MRHandleCarRequests(void) { if (_CutRec_IsOn()) return; - + if (Mission.CarTarget) MRCreateCar(Mission.CarTarget); } @@ -2693,7 +2687,7 @@ int MRCreateCar(MS_TARGET *target) target->s.car.slot = curslot; target->s.target_flags |= TARGET_FLAG_CAR_PINGED_IN; - + car_data[curslot].inform = &target->s.target_flags; // make fully damaged (Car bomb escape) @@ -2715,7 +2709,6 @@ int MRCreateCar(MS_TARGET *target) return 1; } - // [D] [T] void PreProcessTargets(void) { @@ -2731,7 +2724,7 @@ void PreProcessTargets(void) { target = &MissionTargets[i]; - if (target->type == Target_Player2Start || + if (target->type == Target_Player2Start || target->type == Target_Car && (target->s.target_flags & TARGET_FLAG_CAR_PLAYERCONTROLLED)) { PlayerStartInfo[1] = &ReplayStreams[1].SourceType; @@ -2748,7 +2741,7 @@ void PreProcessTargets(void) if (target->s.car.type & 0x3) target->s.car.cutscene = -1; - + target->s.car.slot = 1; target->s.target_flags |= TARGET_FLAG_CAR_PINGED_IN; } @@ -2784,11 +2777,11 @@ extern int gStopPadReads; // [D] [T] int Handle321Go(void) { - if (MissionHeader->type & 0x4) + if (MissionHeader->type & 0x4) { gStopPadReads = 1; - - if (++g321GoDelay == 96) + + if (++g321GoDelay == 96) { gStopPadReads = 0; MissionHeader->type &= ~0x4; @@ -2799,7 +2792,6 @@ int Handle321Go(void) return 0; } - extern int test42; // why 42? // [D] [T] @@ -2811,7 +2803,7 @@ int HandleGameOver(void) PLAYER* lp; CAR_DATA *cp; - if (Mission.gameover_delay != -1) + if (Mission.gameover_delay != -1) { gStopPadReads = 1; @@ -2822,15 +2814,15 @@ int HandleGameOver(void) return 0; } - if (Mission.message_timer[0] == 0) + if (Mission.message_timer[0] == 0) { - if (Mission.message_timer[1] == 0) + if (Mission.message_timer[1] == 0) { if (Mission.gameover_mode == PAUSEMODE_COMPLETE) { StoreEndData(); #ifndef PSX - if(GameType == GAME_MISSION) + if (GameType == GAME_MISSION) SaveCurrentGame(); #endif } @@ -2856,11 +2848,11 @@ int HandleGameOver(void) if (lp->playerType == 1) { - if ((Mission.timer[0].flags & TIMER_FLAG_BOMB_COUNTDOWN) || + if ((Mission.timer[0].flags & TIMER_FLAG_BOMB_COUNTDOWN) || TannerStuckInCar(0, player_id)) { cp = &car_data[lp->playerCarId]; - + if (MaxPlayerDamage[player_id] <= cp->totalDamage && lp->dying == 0) { lp->dying = 1; @@ -2874,11 +2866,11 @@ int HandleGameOver(void) { cp->totalDamage = MaxPlayerDamage[player_id]; - if(lp->dying < 30) + if (lp->dying < 30) lp->dying = 30; } } - else + else { lp->upsideDown = 0; } @@ -2906,9 +2898,9 @@ int HandleGameOver(void) if (Mission.timer[player_id].flags & TIMER_FLAG_BOMB_COUNTDOWN) BombThePlayerToHellAndBack(gCarWithABerm); - if (lp->playerType == 2) + if (lp->playerType == 2) SetPlayerMessage(player_id, MissionStrings + MissionHeader->msgDrowned, 2, 2); - else + else SetPlayerMessage(player_id, MissionStrings + MissionHeader->msgCarWrecked, 2, 2); lp->dying++; @@ -2931,7 +2923,7 @@ int HandleGameOver(void) { if (playersdead == NumPlayers) SetMissionOver(PAUSEMODE_GAMEOVER); - + return 0; } } @@ -2951,7 +2943,7 @@ void CompleteAllActiveTargets(int player) int flag2; int flag1; - if (player == 0) + if (player == 0) { flag1 = TARGET_FLAG_ACTIVE_P1; flag2 = TARGET_FLAG_COMPLETED_P1; @@ -2966,7 +2958,7 @@ void CompleteAllActiveTargets(int player) { pTarget = &MissionTargets[i]; - if (pTarget->type >= Target_Point && + if (pTarget->type >= Target_Point && pTarget->type <= Target_Event && (pTarget->s.target_flags & flag1)) { pTarget->s.target_flags &= ~flag1; @@ -2978,12 +2970,12 @@ void CompleteAllActiveTargets(int player) // [D] [T] void SetMissionComplete(void) { - switch (GameType) + switch (GameType) { case GAME_CHECKPOINT: case GAME_CAPTURETHEFLAG: case GAME_SECRET: - if (NumPlayers < 2) + if (NumPlayers < 2) { SetMissionMessage(MissionStrings + MissionHeader->msgComplete, 3, 2); break; @@ -3011,7 +3003,7 @@ void SetMissionComplete(void) SetPlayerMessage(0, MissionStrings + MissionHeader->msgDrowned, 3, 2); SetPlayerMessage(1, MissionStrings + MissionHeader->msgComplete, 3, 2); } - else + else { SetPlayerMessage(0, MissionStrings + MissionHeader->msgComplete, 3, 2); SetPlayerMessage(1, MissionStrings + MissionHeader->msgDrowned, 3, 2); @@ -3021,7 +3013,7 @@ void SetMissionComplete(void) if (Mission.timer[0].flags & TIMER_FLAG_BOMB_COUNTDOWN) { Mission.timer[0].flags |= TIMER_FLAG_BOMB_TRIGGERED; - + DetonatorTimer(); return; } @@ -3037,24 +3029,22 @@ void SetMissionComplete(void) SetMissionOver(PAUSEMODE_COMPLETE); } - // [D] [T] void SetMissionFailed(FAIL_REASON reason) { - if (reason == FAILED_CnR_LOSTHIM) + if (reason == FAILED_CnR_LOSTHIM) { - SetPlayerMessage(0,MissionStrings + MissionHeader->msgDrowned,3,2); - SetPlayerMessage(1,MissionStrings + MissionHeader->msgComplete,3,2); + SetPlayerMessage(0,MissionStrings + MissionHeader->msgDrowned, 3, 2); + SetPlayerMessage(1,MissionStrings + MissionHeader->msgComplete, 3, 2); } - else if(reason == FAILED_OUTOFTIME) + else if (reason == FAILED_OUTOFTIME) { - SetMissionMessage(MissionStrings + MissionHeader->msgOutOfTime,3,2); + SetMissionMessage(MissionStrings + MissionHeader->msgOutOfTime, 3, 2); } SetMissionOver(PAUSEMODE_GAMEOVER); } - // [D] [T] void SetMissionOver(PAUSEMODE mode) { @@ -3081,7 +3071,7 @@ void ActivateNextFlag(void) MissionTargets[last_flag].s.target_flags |= TARGET_FLAG_COMPLETED_ALLP; j = last_flag; - + for (i = 0; i < MAX_MISSION_TARGETS; i++) { j++; @@ -3169,15 +3159,15 @@ void HandleMission(void) switch (MissionHeader->type & 0x30) { - case 0x20: - FelonyBar.flags |= 0x2; - case 0: - FelonyBar.active = 0x1; - break; - case 0x10: - FelonyBar.active = 0; - default: - FelonyBar.active = 0; + case 0x20: + FelonyBar.flags |= 0x2; + case 0: + FelonyBar.active = 0x1; + break; + case 0x10: + FelonyBar.active = 0; + default: + FelonyBar.active = 0; } } @@ -3218,4 +3208,4 @@ void HandleMission(void) SetMissionMessage(MissionStrings + MissionHeader->msgDoorsLocked, 2, 1); gLockPickingAttempted = 0; } -} \ No newline at end of file +} diff --git a/src_rebuild/Game/C/mission.h b/src_rebuild/Game/C/mission.h index 6a9d9df74..d6271132c 100644 --- a/src_rebuild/Game/C/mission.h +++ b/src_rebuild/Game/C/mission.h @@ -96,8 +96,8 @@ extern void HandleMission(); // 0x00061274 extern void RegisterChaseHit(int car1, int car2); // 0x00061684 -extern void SetMissionComplete(void); -extern void SetMissionFailed(FAIL_REASON reason); +extern void SetMissionComplete(void); // 0x00063F84 +extern void SetMissionFailed(FAIL_REASON reason); // 0x00064B38 extern void SetMissionMessage(char *message, int priority, int seconds); // 0x000642A8 extern void SetPlayerMessage(int player, char *message, int priority, int seconds); // 0x00064348 @@ -110,4 +110,4 @@ extern void SetConfusedCar(int slot); // 0x0006444C extern void DrawMission(void); -#endif +#endif // MISSION_H diff --git a/src_rebuild/Game/C/models.c b/src_rebuild/Game/C/models.c index 72cd576f3..ff5bc39bf 100644 --- a/src_rebuild/Game/C/models.c +++ b/src_rebuild/Game/C/models.c @@ -38,9 +38,9 @@ int CleanSpooledModelSlots() for (i = 0; i < MAX_MODEL_SLOTS; i++) // [A] bug fix. Init with dummyModel { // if bit does not indicate usage - reset to dummy model - if((permanentModelSlotBitfield[i >> 5] & 1 << (i & 31)) == 0) + if ((permanentModelSlotBitfield[i >> 5] & 1 << (i & 31)) == 0) { - if(modelpointers[i] != &dummyModel) + if (modelpointers[i] != &dummyModel) { modelpointers[i] = &dummyModel; pLodModels[i] = &dummyModel; @@ -106,7 +106,7 @@ void ProcessMDSLump(char *lump_file, int lump_size) { // add the usage bit permanentModelSlotBitfield[i >> 5] |= 1 << (i & 31); - + model = (MODEL*)mdsfile; modelpointers[i] = model; @@ -120,7 +120,7 @@ void ProcessMDSLump(char *lump_file, int lump_size) for (i = 0; i < modelAmts; i++) { model = modelpointers[i]; - if (model->instance_number != -1) + if (model->instance_number != -1) { parentmodel = modelpointers[model->instance_number]; #if MODEL_RELOCATE_POINTERS @@ -144,7 +144,7 @@ void ProcessMDSLump(char *lump_file, int lump_size) model = modelpointers[i]; model->poly_block += (int)(char*)model; - if (model->instance_number == -1) + if (model->instance_number == -1) { model->vertices += (int)model; model->normals += (int)model; @@ -241,7 +241,7 @@ int ProcessCarModelLump(char *lump_ptr, int lump_size) // next model offset? size = (offsets[3] - lowOfs) + 2048; - if(size > specMemReq) + if (size > specMemReq) specMemReq = size; } } @@ -319,7 +319,7 @@ int ProcessCarModelLump(char *lump_ptr, int lump_size) } } #endif - + if (cleanOfs != -1) { D_MALLOC_BEGIN(); @@ -341,7 +341,7 @@ int ProcessCarModelLump(char *lump_ptr, int lump_size) gCarDamModelPtr[i] = model; D_MALLOC_END(); } - + if (lowOfs != -1) { D_MALLOC_BEGIN(); diff --git a/src_rebuild/Game/C/models.h b/src_rebuild/Game/C/models.h index 3f735713b..313dd38de 100644 --- a/src_rebuild/Game/C/models.h +++ b/src_rebuild/Game/C/models.h @@ -33,4 +33,4 @@ extern MODEL* FindModelPtrWithName(char *name); // 0x0005D40C extern int FindModelIdxWithName(char *name); // 0x0005D4C4 -#endif +#endif // MODELS_H diff --git a/src_rebuild/Game/C/motion_c.c b/src_rebuild/Game/C/motion_c.c index 3841e7266..4ef94b0b9 100644 --- a/src_rebuild/Game/C/motion_c.c +++ b/src_rebuild/Game/C/motion_c.c @@ -113,7 +113,7 @@ LIMBS lRoutes[5][8] = { PED_DATA MainPed[NUM_BONES] = { - { 0, 68u, &chest1_texture, CHEST_PAL }, + { 0, 68u, &chest1_texture, CHEST_PAL }, { 1, 68u, &chest1_texture, CHEST_PAL }, { 17, 36u, &chest1_texture, CHEST_PAL }, { 6, 68u, &forearm1_texture, ARM_PAL }, @@ -138,7 +138,6 @@ PED_DATA MainPed[NUM_BONES] = { 2, 68u, &jeans_texture, JEANS_PAL } }; - // FIXME: could be incorrect BONE Skel[NUM_BONES] = { @@ -431,9 +430,6 @@ TEXTURE_DETAILS chest1_texture; TEXTURE_DETAILS head1_texture; MODEL* gPed1HeadModelPtr; -MODEL* gPed2HeadModelPtr; -MODEL* gPed3HeadModelPtr; -MODEL* gPed4HeadModelPtr; char* MotionCaptureData[MAX_MOTION_CAPTURE]; // [A] actually, pointers int ThisMotion; @@ -469,7 +465,6 @@ void SetupPedMotionData(LPPEDESTRIAN pPed) pPed->motion = MotionCaptureData[pPed->type]; } - // [D] [T] void SetupPedestrian(LPPEDESTRIAN pedptr) { @@ -526,7 +521,7 @@ void DrawBodySprite(LPPEDESTRIAN pDrawingPed, int boneId, VERTTYPE v1[2], VERTTY bone = (LIMBS)(boneId & 127); body_texture = MainPed[bone].ptd; - + if (bDoingShadow) z = sz + (scr_z / 2); else @@ -558,7 +553,7 @@ void DrawBodySprite(LPPEDESTRIAN pDrawingPed, int boneId, VERTTYPE v1[2], VERTTY } if (bDoingShadow && - (bone == RKNEE || bone == LKNEE || + (bone == RKNEE || bone == LKNEE || bone == LFOOT || bone == RFOOT)) { width -= 5; @@ -568,7 +563,7 @@ void DrawBodySprite(LPPEDESTRIAN pDrawingPed, int boneId, VERTTYPE v1[2], VERTTY y = v1[1] - v2[1]; angle = -ratan2(y, x); - + cs = FIXEDH(z2 * RSIN(angle) * (width & 0x3f) * 2); sn = FIXEDH(z2 * RCOS(angle) * (width & 0x3f) * 2); @@ -585,7 +580,7 @@ void DrawBodySprite(LPPEDESTRIAN pDrawingPed, int boneId, VERTTYPE v1[2], VERTTY else { tmp2 = MainPed[bone].cAdj >> 4; - + dx1 = x >>tmp2; dy1 = y >> tmp2; } @@ -712,7 +707,7 @@ void DrawBodySprite(LPPEDESTRIAN pDrawingPed, int boneId, VERTTYPE v1[2], VERTTY if (pal != 0) clut = civ_clut[0][body_texture->texture_number][pal]; } - else if(bone == HEAD) + else if (bone == HEAD) { pal = (pDrawingPed->pallet & 0xf); @@ -826,7 +821,7 @@ void StoreVertexLists(void) cTannerVNumbers[i] = -1; continue; } - + // store start index cTannerVNumbers[i] = counter; @@ -1003,7 +998,7 @@ void SetupTannerSkeleton(LPPEDESTRIAN pDrawingPed) #endif } -// [A] - was inlined in newShowTanner +// [A] was inlined in newShowTanner void DrawSprite(LPPEDESTRIAN pDrawingPed, BONE* pBone, SVECTOR* vJPos) { VERTTYPE t0[2], t1[2]; // [A] was two longs @@ -1132,7 +1127,7 @@ void newShowTanner(LPPEDESTRIAN pDrawingPed) } } - if(bDoingShadow || draw) + if (bDoingShadow || draw) { if (pDrawingPed->pedType < OTHER_SPRITE) { @@ -1169,7 +1164,7 @@ void newShowTanner(LPPEDESTRIAN pDrawingPed) bias = 1; else if (id == HEAD) bias = 0; - + RenderModel(model, NULL, &v, bias, PLOT_NO_SHADE, 0, 0); } @@ -1424,7 +1419,6 @@ void newRotateBones(LPPEDESTRIAN pDrawingPed, BONE* poBone) }; } - // [D] [T] void DrawCiv(LPPEDESTRIAN pPed) { @@ -1508,7 +1502,7 @@ void DrawCiv(LPPEDESTRIAN pPed) rot.vz = pPed->dir.vz & 0xfff; RotMatrixYXZ(&rot, &workmatrix); - + gte_MulMatrix0(&inv_camera_matrix, &workmatrix, &workmatrix); gte_SetRotMatrix(&workmatrix); @@ -1540,7 +1534,7 @@ void DrawCiv(LPPEDESTRIAN pPed) } boneId = boneIdvals[i]; - + if (boneId == HEAD && szList[0] <= switch_detail_distance / 2) bHeadModel = 1; else @@ -1614,7 +1608,6 @@ void SetSkelModelPointers(int type) } } - int iCurrBone = 0; // [D] [T] @@ -1640,7 +1633,7 @@ void DrawTanner(LPPEDESTRIAN pPed) v.vx = pPed->position.vx; v.vy = -pPed->position.vy; v.vz = pPed->position.vz; - + v.vy = -camera_position.vy - MapHeight(&v);// - camera_position.vy; v.vx = (pPed->position.vx - camera_position.vx) + Skel[ROOT].pvOrigPos->vx; @@ -1732,14 +1725,13 @@ int DrawCharacter(LPPEDESTRIAN pPed) size = -phase + 96; cv.b = cv.g = cv.r = 40; - + RoundShadow(&pos, &cv, size); } return 1; } - POLY_FT4 ft4TannerShadow[2]; TILE tileTannerClear[2]; extern TEXTURE_DETAILS tannerShadow_texture; @@ -1760,7 +1752,7 @@ void InitTannerShadow(void) poly = ft4TannerShadow; tile = tileTannerClear; - + rectTannerWindow.w = 64; rectTannerWindow.h = 128; rectTannerWindow.x = tpagepos[nperms + 1].x; @@ -1769,15 +1761,15 @@ void InitTannerShadow(void) for (i = 0; i < 2; i++) { int offs = 0; - if(GameLevel == 2) // [A] bug fix for vegas + if (GameLevel == LEVEL_VEGAS) // [A] bug fix for Vegas offs = 18; - + poly->u0 = tannerShadow_texture.coords.u1 / 4 - 1; poly->v0 = tannerShadow_texture.coords.v1 + offs; - + poly->u1 = tannerShadow_texture.coords.u0 / 4 + 1; poly->v1 = tannerShadow_texture.coords.v0 + offs; - + poly->u2 = tannerShadow_texture.coords.u3 / 4 - 1; poly->v2 = tannerShadow_texture.coords.v3 + offs - 18; @@ -1914,7 +1906,7 @@ void TannerShadow(LPPEDESTRIAN pDrawingPed, VECTOR* pPedPos, SVECTOR* pLightPos, addPrim(current->ot + (z0 * 2 + z3 * 6 >> 6), &ft4TannerShadow[current->id]); //SubdivShadow(z0, z1, z2, z3, ft4TannerShadow + current->id); - + { // store vectors cp = camera_position; @@ -1949,7 +1941,7 @@ void TannerShadow(LPPEDESTRIAN pDrawingPed, VECTOR* pPedPos, SVECTOR* pLightPos, SetGeomScreen(scr_z); BuildWorldMatrix(); } - + SetDefDrawEnv(&drEnv, rectTannerWindow.x, rectTannerWindow.y, rectTannerWindow.w, rectTannerWindow.h); drEnv.dfe = 0; // we're drawing into VRAM - don't draw on screen drEnv.dtd = 0; // [A] no need in dithering @@ -1961,7 +1953,7 @@ void TannerShadow(LPPEDESTRIAN pDrawingPed, VECTOR* pPedPos, SVECTOR* pLightPos, current->primptr += sizeof(DR_ENV); } -// [A] - totally custom function but it works pretty much same as original +// [A] totally custom function but it works pretty much same as original void DoCivHead(LPPEDESTRIAN pPed, SVECTOR* vert1, SVECTOR* vert2) { SVECTOR spos; @@ -2020,5 +2012,3 @@ void DoCivHead(LPPEDESTRIAN pPed, SVECTOR* vert1, SVECTOR* vert2) combointensity = oldcombointensity; } - - diff --git a/src_rebuild/Game/C/motion_c.h b/src_rebuild/Game/C/motion_c.h index 9dbf6ee72..4a9058ef5 100644 --- a/src_rebuild/Game/C/motion_c.h +++ b/src_rebuild/Game/C/motion_c.h @@ -8,9 +8,6 @@ extern TEXTURE_DETAILS chest1_texture; extern TEXTURE_DETAILS head1_texture; extern MODEL* gPed1HeadModelPtr; -extern MODEL* gPed2HeadModelPtr; -extern MODEL* gPed3HeadModelPtr; -extern MODEL* gPed4HeadModelPtr; extern int ThisMotion; @@ -32,5 +29,4 @@ extern void TannerShadow(LPPEDESTRIAN pDrawingPed, VECTOR *pPedPos, SVECTOR *pLi extern void DoCivHead(LPPEDESTRIAN pPed, SVECTOR *vert1, SVECTOR *vert2); // 0x00068B2C - -#endif +#endif // MOTION_C_H diff --git a/src_rebuild/Game/C/objanim.c b/src_rebuild/Game/C/objanim.c index 039363c44..ba5f64646 100644 --- a/src_rebuild/Game/C/objanim.c +++ b/src_rebuild/Game/C/objanim.c @@ -41,18 +41,19 @@ struct CYCLE_OBJECT short start2, stop2, speed2; }; -CYCLE_OBJECT Lev0[2] = -{ +// Chicago +CYCLE_OBJECT Lev0[2] = { { "REDRVR", 0, 0, 6, 10, 2, 11, 15, 2 }, { "NAVPIR34", 0, 0, 0, 6, 0, 7, 13, 0 } }; -CYCLE_OBJECT Lev1[] = { - { "DOOR11", 0, 0, 1, 7, 2, 8, 14, 3 }, +// Havana +CYCLE_OBJECT Lev1[1] = { + { "DOOR11", 0, 0, 1, 7, 2, 8, 14, 3 } }; -CYCLE_OBJECT Lev2[12] = -{ +// Vegas +CYCLE_OBJECT Lev2[12] = { { "DTSYN01", 0, 0, 0, 3, 0, 4, 14, 0 }, { "DTSYN02", 0, 0, 0, 15, 0, -1, -1, 0 }, { "F-MTSYN2", 0, 0, 0, 3, 0, 10, 14, 0 }, @@ -67,11 +68,11 @@ CYCLE_OBJECT Lev2[12] = { "CYCLE-04", 0, 0, 0, 6, 15, 7, 13, 15 } }; -CYCLE_OBJECT Lev3[] = { +// Rio +CYCLE_OBJECT Lev3[1] = { { "FWING11", 0, 0, 1, 7, 2, 8, 14, 3 } }; - CYCLE_OBJECT* Lev_CycleObjPtrs[] = { Lev0, Lev1, @@ -81,6 +82,7 @@ CYCLE_OBJECT* Lev_CycleObjPtrs[] = { int Num_LevCycleObjs[] = { numberOf(Lev0), 0, numberOf(Lev2), 0 }; +// Chicago ANIMATED_OBJECT Lev0AnimObjects[9] = { { 0, 0, "TLIGHT01", 0 }, @@ -94,6 +96,7 @@ ANIMATED_OBJECT Lev0AnimObjects[9] = { 8, 0, "TLIGHT02_LOW", 0 } }; +// Havana ANIMATED_OBJECT Lev1AnimObjects[5] = { { 0, 0, "TLIGHT1", 0 }, @@ -103,6 +106,7 @@ ANIMATED_OBJECT Lev1AnimObjects[5] = { 4, 0, "DLIGHT1", 1 } }; +// Vegas ANIMATED_OBJECT Lev2AnimObjects[5] = { { 0, 0, "TLIGHT01", 0 }, @@ -112,6 +116,7 @@ ANIMATED_OBJECT Lev2AnimObjects[5] = { 4, 0, "SLIGHT02", 1 } }; +// Rio ANIMATED_OBJECT Lev3AnimObjects[4] = { { 0, 0, "TLIGHT01", 0 }, @@ -137,7 +142,7 @@ int Level_NumAnimatedObjects[] = { // sound ids for SOUND_BANK_SFX SMASHABLE_OBJECT smashable[] = { - { 0, "", 1, 0, 800 }, // default + { 0, "", 1, 0, 800 }, // default { 0, "CONE_TASTIC", 1, 0, 1400 }, { 0, "CONE1_TASTIC", 1, 0, 1400 }, { 0, "CONE2_TASTIC", 1, 0, 1400 }, @@ -196,7 +201,7 @@ void InitCyclingPals(void) num_cycle_obj = 0; return; } - + num_cycle_obj = Num_LevCycleObjs[GameLevel]; CYCLE_OBJECT* cyc = Lev_CycleObjPtrs[GameLevel]; @@ -238,7 +243,7 @@ void ColourCycle(void) vram.w = 16; vram.h = 1; cyc = Lev_CycleObjPtrs[GameLevel]; - + for (i = 0; i < num_cycle_obj; i++, cyc++) { TEXTURE_DETAILS* cycTex = &cycle_tex[i]; @@ -302,7 +307,6 @@ void ColourCycle(void) } } - // [D] [T] void FindSmashableObjects(void) { @@ -413,9 +417,10 @@ void InitSpooledAnimObj(int model_number) // [A] store animated object number in normals pointer // after all it was always unused modelPtr->tri_verts = i; - + break; } + aop++; } } @@ -434,7 +439,7 @@ void DrawAllAnimatingObjects(CELL_OBJECT** objects, int num_animated) ANIMATED_OBJECT* aop; CELL_OBJECT* cop; MODEL* model; - int i, j; + int i; int type; aop = Level_AnimatingObjectPtrs[GameLevel]; @@ -450,7 +455,6 @@ void DrawAllAnimatingObjects(CELL_OBJECT** objects, int num_animated) } } - // [D] [T] void animate_object(CELL_OBJECT* cop, int type) { @@ -459,7 +463,7 @@ void animate_object(CELL_OBJECT* cop, int type) yang = cop->yang * 64; - if (GameLevel == 0) + if (GameLevel == LEVEL_CHICAGO) { switch (type) { @@ -527,7 +531,7 @@ void animate_object(CELL_OBJECT* cop, int type) AddLightEffect(cop, -234, -1146, 0, 0, 3); } } - else if (GameLevel == 1) + else if (GameLevel == LEVEL_HAVANA) { switch (type) { @@ -569,13 +573,13 @@ void animate_object(CELL_OBJECT* cop, int type) break; } } - else if (GameLevel == 2) + else if (GameLevel == LEVEL_VEGAS) { switch (type) { case 0: phase = junctionLightsPhase[yang + 128 >> 10 & 1]; - + if (phase == 1) { AddTrafficLight(cop, -2135, -1112, -68, 0x200, yang); @@ -634,18 +638,18 @@ void animate_object(CELL_OBJECT* cop, int type) AddSmallStreetLight(cop, -620, -101, 0, 0); break; } - + AddLightEffect(cop, -620, -1618, 0, 0, 3); break; } } - else if (GameLevel == 3) + else if (GameLevel == LEVEL_RIO) { switch (type) { case 0: phase = junctionLightsPhase[yang + 128 >> 10 & 1]; - + if (phase == 1) { AddTrafficLight(cop, -719, -906, -22, 0x200, yang); @@ -687,7 +691,7 @@ void animate_object(CELL_OBJECT* cop, int type) break; AddLightEffect(cop, 0, -2727, 0, 0, 3); - + break; case 4: if (gLightsOn == 0) @@ -699,7 +703,6 @@ void animate_object(CELL_OBJECT* cop, int type) } } - // [D] [T] void animate_garage_door(void) { @@ -747,8 +750,3 @@ void animate_garage_door(void) } } } - - - - - diff --git a/src_rebuild/Game/C/objanim.h b/src_rebuild/Game/C/objanim.h index 1a4d48d6b..a88414197 100644 --- a/src_rebuild/Game/C/objanim.h +++ b/src_rebuild/Game/C/objanim.h @@ -21,4 +21,4 @@ extern void animate_object(CELL_OBJECT *cop, int type); // 0x00013DF8 extern void animate_garage_door(); // 0x000146A4 -#endif +#endif // OBJANIM_H diff --git a/src_rebuild/Game/C/objcoll.c b/src_rebuild/Game/C/objcoll.c index b2ee3b3d2..3cab8a2a8 100644 --- a/src_rebuild/Game/C/objcoll.c +++ b/src_rebuild/Game/C/objcoll.c @@ -28,7 +28,7 @@ char CellEmpty(VECTOR *pPosition, int radius) int xs, zs; int ypos; COLLISION_PACKET* collide; - + int cell_x, cell_z; int type; @@ -102,7 +102,7 @@ char CellEmpty(VECTOR *pPosition, int radius) xs = ((collide->xsize + 10) * 2048 + radius * 4096); ypos = pPosition->vy + (tempCO.pos.vy + collide->ypos); // [A] removed excessive height - + #if defined(COLLISION_DEBUG) && !defined(PSX) int result = 0; @@ -200,7 +200,6 @@ char CellEmpty(VECTOR *pPosition, int radius) return 1; } - // [D] [T] int GlobalPositionToCellNumber(VECTOR *pPosition) { @@ -208,9 +207,9 @@ int GlobalPositionToCellNumber(VECTOR *pPosition) int cbrX, cbrZ; int cbr; - cellX = (pPosition->vx + units_across_halved - (MAP_REGION_SIZE*MAP_REGION_SIZE)) / MAP_CELL_SIZE; - cellZ = (pPosition->vz + units_down_halved - (MAP_REGION_SIZE*MAP_REGION_SIZE)) / MAP_CELL_SIZE; - + cellX = (pPosition->vx + units_across_halved - (MAP_REGION_SIZE * MAP_REGION_SIZE)) / MAP_CELL_SIZE; + cellZ = (pPosition->vz + units_down_halved - (MAP_REGION_SIZE * MAP_REGION_SIZE)) / MAP_CELL_SIZE; + cbrX = cellX / MAP_REGION_SIZE; cbrZ = cellZ / MAP_REGION_SIZE; @@ -219,10 +218,9 @@ int GlobalPositionToCellNumber(VECTOR *pPosition) if (RoadMapRegions[cbr] != cbrX + cbrZ * regions_across) return -1; - return cell_ptrs[(cellZ - cbrZ * MAP_REGION_SIZE) * MAP_REGION_SIZE + cbr * (MAP_REGION_SIZE*MAP_REGION_SIZE) + cellX - cbrX * MAP_REGION_SIZE]; + return cell_ptrs[(cellZ - cbrZ * MAP_REGION_SIZE) * MAP_REGION_SIZE + cbr * (MAP_REGION_SIZE * MAP_REGION_SIZE) + cellX - cbrX * MAP_REGION_SIZE]; } - // [D] [T] char CellAtPositionEmpty(VECTOR *pPosition, int radius) { @@ -232,7 +230,6 @@ char CellAtPositionEmpty(VECTOR *pPosition, int radius) return CellEmpty(pPosition, radius); } - struct tRay { LONGVECTOR4 org, dir; @@ -248,7 +245,6 @@ struct tAABB tRange slab[3]; }; - // [D] [T] int RaySlabsIntersection(tRay *ray, tAABB *bbox) { @@ -268,10 +264,10 @@ int RaySlabsIntersection(tRay *ray, tAABB *bbox) dir = ray->dir[i]; - if (dir > -1) + if (dir > -1) d = (dir != 0); - if (d == 0) + if (d == 0) { if (cabbage.lower > 0) return 0; @@ -351,12 +347,12 @@ char lineClear(VECTOR *v1, VECTOR *v2) for (we = 0; we < 2; we++) { - if (we == 0) + if (we == 0) { cell_x = (v2->vx + units_across_halved) / MAP_CELL_SIZE; cell_z = (v2->vz + units_down_halved) / MAP_CELL_SIZE; } - else + else { cell_x = (v1->vx + units_across_halved) / MAP_CELL_SIZE; cell_z = (v1->vz + units_down_halved) / MAP_CELL_SIZE; @@ -375,7 +371,7 @@ char lineClear(VECTOR *v1, VECTOR *v2) sphere_sq = pModel->bounding_sphere + 800; if ((uint)pModel->collision_block > 0 && - (pModel->flags2 & (MODEL_FLAG_CHAIR | MODEL_FLAG_SMASHABLE)) == 0 && + (pModel->flags2 & (MODEL_FLAG_CHAIR | MODEL_FLAG_SMASHABLE)) == 0 && (xd*xd + zd*zd < sphere_sq*sphere_sq)) { num_cb = *GET_MODEL_DATA(int, pModel, collision_block); @@ -395,7 +391,7 @@ char lineClear(VECTOR *v1, VECTOR *v2) dx = va.vx - (tempCO.pos.vx + FIXEDH(collide->xpos * mat->m[0][0] + collide->zpos * mat->m[2][0])); dz = va.vz - (tempCO.pos.vz + FIXEDH(collide->xpos * mat->m[0][2] + collide->zpos * mat->m[2][2])); - + box.slab[0].upper = collide->xsize / 2 + testRadius; box.slab[0].lower = -box.slab[0].upper; @@ -435,7 +431,7 @@ char lineClear(VECTOR *v1, VECTOR *v2) cd[0].axis[0].vx = RSIN(dtheta); cd[0].axis[0].vz = RCOS(dtheta); - cd[0].axis[1].vz = -RSIN(dtheta); + cd[0].axis[1].vz = -RSIN(dtheta); cd[0].axis[1].vx = RCOS(dtheta); extern void Debug_AddLine(VECTOR & pointA, VECTOR & pointB, CVECTOR & color); @@ -522,20 +518,20 @@ void CollisionCopList(XZPAIR* pos, int* count) #else CELL_ITERATOR ci; #endif - + cellLevel = events.camera ? events.draw : -1; if (pos == NULL) { cnt = *count; - + cell.x = initial.x; for (i = 0; i < 2; i++) { cbr.x = cell.x / MAP_REGION_SIZE; - + cell.z = initial.z; - for (j = 0; j < 2; j++) + for (j = 0; j < 2; j++) { cbr.z = cell.z / MAP_REGION_SIZE; @@ -581,7 +577,6 @@ void CollisionCopList(XZPAIR* pos, int* count) } } - // [D] [T] void SetCopListCell(int x, int z) { @@ -619,7 +614,7 @@ void CheckScenaryCollisions(CAR_DATA *cp) int extraDist; int sphereSq; int dx, dz; - + if (cp->controlType == CONTROL_TYPE_CAMERACOLLIDER || cp->ap.carCos == NULL) lbody = 360; else @@ -642,14 +637,14 @@ void CheckScenaryCollisions(CAR_DATA *cp) else extraDist = 580; - cell.x = (player_pos.vx + units_across_halved - (MAP_REGION_SIZE*MAP_REGION_SIZE)) / MAP_CELL_SIZE; - cell.z = (player_pos.vz + units_down_halved - (MAP_REGION_SIZE*MAP_REGION_SIZE)) / MAP_CELL_SIZE; + cell.x = (player_pos.vx + units_across_halved - (MAP_REGION_SIZE * MAP_REGION_SIZE)) / MAP_CELL_SIZE; + cell.z = (player_pos.vz + units_down_halved - (MAP_REGION_SIZE * MAP_REGION_SIZE)) / MAP_CELL_SIZE; SetCopListCell(cell.x, cell.z); mdcount = 0; Havana3DOcclusion(BuildCollisionCopList, &mdcount); - + count = 0; while (count < mdcount + event_models_active) { @@ -674,14 +669,14 @@ void CheckScenaryCollisions(CAR_DATA *cp) dx = cop->pos.vx - player_pos.vx; dz = cop->pos.vz - player_pos.vz; - + sphereSq = model->bounding_sphere + extraDist + cp->hd.speed; if (dx * dx + dz * dz < sphereSq * sphereSq) { collide = GET_MODEL_DATA_OFS(COLLISION_PACKET, model, collision_block, sizeof(int)); - while(num_cb--) + while (num_cb--) { yang = -cop->yang & 63; @@ -738,7 +733,7 @@ void CheckScenaryCollisions(CAR_DATA *cp) gCameraBoxOverlap = -1; minDist = lbody / 2; - + while (coll_test_count > 0 && gCameraDistance > minDist && CarBuildingCollision(cp, &bbox, cop, 0)) { gCameraDistance = MAX(minDist, gCameraDistance - gCameraBoxOverlap); @@ -781,13 +776,13 @@ void CheckScenaryCollisions(CAR_DATA *cp) } } } + count++; } EventCollisions(cp, 1); } - // [D] [T] int QuickBuildingCollisionCheck(VECTOR *pPos, int dir, int l, int w, int extra) { @@ -816,9 +811,9 @@ int QuickBuildingCollisionCheck(VECTOR *pPos, int dir, int l, int w, int extra) player_pos.vx = pPos->vx; player_pos.vz = pPos->vz; - cell.x = (player_pos.vx + units_across_halved - (MAP_REGION_SIZE*MAP_REGION_SIZE)) / MAP_CELL_SIZE; - cell.z = (player_pos.vz + units_down_halved - (MAP_REGION_SIZE*MAP_REGION_SIZE)) / MAP_CELL_SIZE; - + cell.x = (player_pos.vx + units_across_halved - (MAP_REGION_SIZE * MAP_REGION_SIZE)) / MAP_CELL_SIZE; + cell.z = (player_pos.vz + units_down_halved - (MAP_REGION_SIZE * MAP_REGION_SIZE)) / MAP_CELL_SIZE; + SetCopListCell(cell.x, cell.z); mdcount = 0; @@ -838,12 +833,12 @@ int QuickBuildingCollisionCheck(VECTOR *pPos, int dir, int l, int w, int extra) model = modelpointers[cop->type]; if ((uint)model->collision_block > 0 /*&& - model->num_vertices - 3 < 300 && - model->num_point_normals < 300 && + model->num_vertices - 3 < 300 && + model->num_point_normals < 300 && model->num_polys < 300*/) { sphereSq = model->bounding_sphere + extra; - + dx = cop->pos.vx - player_pos.vx; dz = cop->pos.vz - player_pos.vz; @@ -852,10 +847,10 @@ int QuickBuildingCollisionCheck(VECTOR *pPos, int dir, int l, int w, int extra) num_cb = *GET_MODEL_DATA(int, model, collision_block); collide = GET_MODEL_DATA_OFS(COLLISION_PACKET, model, collision_block, sizeof(int)); - while(num_cb--) + while (num_cb--) { yang = -cop->yang & 0x3f; - + bbox.pos.vy = cop->pos.vy + collide->ypos; if (ABS(pPos->vy + bbox.pos.vy) < collide->ysize / 2) @@ -886,7 +881,7 @@ int QuickBuildingCollisionCheck(VECTOR *pPos, int dir, int l, int w, int extra) cd[1].avel = 0; int res = bcollided2d(cd); - + #if defined(COLLISION_DEBUG) && !defined(PSX) extern int gShowCollisionDebug; if (gShowCollisionDebug == 1) @@ -966,16 +961,16 @@ int QuickBuildingCollisionCheck(VECTOR *pPos, int dir, int l, int w, int extra) } } #endif - if(res) + if (res) return 1; } collide++; - } } } } + return 0; } @@ -990,7 +985,7 @@ void DoScenaryCollisions(void) if (cp->controlType != CONTROL_TYPE_NONE) { // civ AI and dead cop cars perform less collision detection frames - if (cp->controlType == CONTROL_TYPE_CIV_AI || + if (cp->controlType == CONTROL_TYPE_CIV_AI || cp->controlType == CONTROL_TYPE_PURSUER_AI && cp->ai.p.dying > 85) { if (cp->totalDamage != 0 && (cp->hd.speed > 10 || (cp->id + CameraCnt & 3) == 0)) @@ -1006,8 +1001,3 @@ void DoScenaryCollisions(void) cp--; } while (cp >= car_data); } - - - - - diff --git a/src_rebuild/Game/C/objcoll.h b/src_rebuild/Game/C/objcoll.h index 6dd8ecefc..ff62ef7cc 100644 --- a/src_rebuild/Game/C/objcoll.h +++ b/src_rebuild/Game/C/objcoll.h @@ -10,4 +10,4 @@ extern int QuickBuildingCollisionCheck(VECTOR *pPos, int dir, int l, int w, int extern void DoScenaryCollisions(); // 0x0006B220 -#endif +#endif // OBJCOLL_H diff --git a/src_rebuild/Game/C/overlay.c b/src_rebuild/Game/C/overlay.c index 3fbfd6cdd..9f5115ef2 100644 --- a/src_rebuild/Game/C/overlay.c +++ b/src_rebuild/Game/C/overlay.c @@ -117,7 +117,7 @@ void InitOverlays(void) { PlayerDamageBar.active = 0; Player2DamageBar.active = 0; - + gInvincibleCar = 1; } } @@ -174,24 +174,24 @@ void DrawPercentageBar(PERCENTAGE_BAR *bar) if (bar->active == 0) return; - if (bar->max < bar->position) + if (bar->max < bar->position) { bar->position = bar->max; } - if (bar->max == 0) + if (bar->max == 0) { min_x = bar->xpos; max_x = min_x; } - else + else { - if (bar->flags & 1) + if (bar->flags & 1) { max_x = bar->xpos + bar->width; min_x = max_x - ((bar->width * bar->position) / bar->max); } - else + else { min_x = bar->xpos; max_x = min_x + ((bar->width * bar->position) / bar->max); @@ -202,7 +202,7 @@ void DrawPercentageBar(PERCENTAGE_BAR *bar) max_y = bar->ypos + bar->height; // draw the colour band that fills the bar - if ((bar->flags & 2) == 0) + if ((bar->flags & 2) == 0) { poly = (POLY_G4 *)current->primptr; setPolyG4(poly); @@ -212,15 +212,15 @@ void DrawPercentageBar(PERCENTAGE_BAR *bar) poly->r0 = temp.r; poly->g0 = temp.g; poly->b0 = temp.b; - + poly->r1 = temp.r; poly->g1 = temp.g; poly->b1 = temp.b; - + temp.r = temp.r / 4; temp.g = temp.g / 4; temp.b = temp.b / 4; - + poly->r2 = temp.r; poly->g2 = temp.g; poly->b2 = temp.b; @@ -293,7 +293,7 @@ void DrawPercentageBar(PERCENTAGE_BAR *bar) addPrim(current->ot + 1, lineF4); current->primptr += sizeof(LINE_F4); - + LINE_F2* lineF2 = (LINE_F2*)current->primptr; setLineF2(lineF2); lineF2->r0 = 80; @@ -332,15 +332,15 @@ void DrawProximityBar(PERCENTAGE_BAR *bar) int min_y; int max_y; int half_width; - + if (bar->active == 0) return; total = bar->position; - + if (total < TAIL_TOOCLOSE) total = TAIL_TOOCLOSE; - + if (total > TAIL_TOOFAR) total = TAIL_TOOFAR; @@ -465,7 +465,7 @@ void DrawProximityBar(PERCENTAGE_BAR *bar) if ((bar->flags & 1U) == 0) PrintString(bar->tag, min_x + 8, min_y - 11); - else + else PrintStringRightAligned(bar->tag, max_x - 8, min_y - 11); } } @@ -519,16 +519,16 @@ void UpdateFlashValue(void) int size; int flash; - if (gShowMap != 0) + if (gShowMap != 0) size = FrameCnt; else size = CameraCnt; - + flash = size % 16; - if (flash > 7) + if (flash > 7) flash = 16 - flash; - + OverlayFlashValue = flash; } @@ -543,7 +543,7 @@ void DrawDrivingGameOverlays(void) SetTextColour(128, 128, 64); - switch (GameType) + switch (GameType) { case GAME_GETAWAY: table = &ScoreTables.GetawayTable[GameLevel][gSubGameNumber][0]; @@ -551,9 +551,10 @@ void DrawDrivingGameOverlays(void) x = PrintString(G_LTXT(GTXT_Best), gOverlayXPos, 60); PrintScoreTableTime(x + 3, 60, table->time); break; + case GAME_CHECKPOINT: - if (NumPlayers == 1) + if (NumPlayers == 1) { table = &ScoreTables.CheckpointTable[GameLevel][gSubGameNumber][0]; x = PrintStringRightAligned(G_LTXT(GTXT_Checks), gOverlayXOppPos + 70, 16); @@ -576,8 +577,9 @@ void DrawDrivingGameOverlays(void) sprintf(string, "%d/5", gPlayerScore.P2items); PrintString(string, x + 3, SCREEN_H / 2 + 22); } - + break; + case GAME_GATERACE: if (NumPlayers == 1) @@ -591,7 +593,7 @@ void DrawDrivingGameOverlays(void) x = PrintString(G_LTXT(GTXT_Best), gOverlayXPos, 36); PrintScoreTableTime(x + 3, 36, table->time); - sprintf(string, table->items != -1 ? "%s: %d" : "%s: -", G_LTXT(GTXT_Gates), table->items); + sprintf(string, (table->items != -1) ? "%s: %d" : "%s: -", G_LTXT(GTXT_Gates), table->items); PrintString(string, gOverlayXPos, 52); } else @@ -605,55 +607,57 @@ void DrawDrivingGameOverlays(void) sprintf(string, "%d / %d", gPlayerScore.P2items, 100); PrintString(string, x + 3, SCREEN_H / 2 + 22); } + break; + case GAME_TRAILBLAZER: - table = &ScoreTables.TrailblazerTable[GameLevel][gSubGameNumber][0]; x = PrintStringRightAligned(G_LTXT(GTXT_Cone), gOverlayXOppPos + 55, 16); - + sprintf(string, "%d / %d", gPlayerScore.items, 100); PrintString(string, x + 3, 16); - + x = PrintString(G_LTXT(GTXT_Best), gOverlayXPos, 36); PrintScoreTableTime(x + 3, 36, table->time); - sprintf(string, table->items != -1 ? "%s: %d" : "%s: -", G_LTXT(GTXT_Cones), table->items); + sprintf(string, (table->items != -1) ? "%s: %d" : "%s: -", G_LTXT(GTXT_Cones), table->items); PrintString(string, gOverlayXPos, 52); - break; + case GAME_SURVIVAL: table = &ScoreTables.SurvivalTable[GameLevel][gSubGameNumber][0]; x = PrintString(G_LTXT(GTXT_Best), gOverlayXPos, 36); PrintScoreTableTime(x + 3, 36, table->time); break; + case GAME_CAPTURETHEFLAG: x = PrintString(G_LTXT(GTXT_Flags), gOverlayXPos, 16); sprintf(string, "%d", gPlayerScore.items); PrintString(string, x + 3, 16); - - x = PrintString(G_LTXT(GTXT_Flags), gOverlayXPos, 132); + + x = PrintString(G_LTXT(GTXT_Flags), gOverlayXPos, SCREEN_H / 2 + 12); sprintf(string, "%d", gPlayerScore.P2items); - PrintString(string, x + 3, SCREEN_H / 2 + 4); + PrintString(string, x + 3, SCREEN_H / 2 + 12); break; + case GAME_SECRET: y = 36; for (i = 0; i < gNumRaceTrackLaps; i++) { sprintf(string, "%s %d:", G_LTXT(GTXT_Lap), i+1); - + x = PrintString(string, gOverlayXPos, y); PrintScoreTableTime(x + 3, y, gLapTimes[0][i]); - + y += 16; } - if (NumPlayers > 1) { y = SCREEN_H / 2 + 22; - - for(i = 0; i < gNumRaceTrackLaps; i++) + + for (i = 0; i < gNumRaceTrackLaps; i++) { sprintf(string, "%s %d:", G_LTXT(GTXT_Lap), i+1); @@ -663,11 +667,11 @@ void DrawDrivingGameOverlays(void) y += 16; } } + break; } } - // [D] [T] void DisplayOverlays(void) { @@ -714,7 +718,7 @@ void DisplayOverlays(void) if (!gDoOverlays) return; - if(!gInvincibleCar || ActiveCheats.cheat3) + if (!gInvincibleCar || ActiveCheats.cheat3) { DrawPercentageBar(&PlayerDamageBar); DrawPercentageBar(&Player2DamageBar); @@ -746,4 +750,4 @@ void DisplayOverlays(void) FastForward = 1; DrawFullscreenMap(); } -} \ No newline at end of file +} diff --git a/src_rebuild/Game/C/overlay.h b/src_rebuild/Game/C/overlay.h index bddde693f..9667d8254 100644 --- a/src_rebuild/Game/C/overlay.h +++ b/src_rebuild/Game/C/overlay.h @@ -41,10 +41,9 @@ extern void SetFullscreenDrawing(int ofs); // 0x00015E70 extern void InitPercentageBar(PERCENTAGE_BAR *bar, int size, COLOUR_BAND *pColourBand, char *tag); // 0x00015F20 extern void EnablePercentageBar(PERCENTAGE_BAR *bar, int max); // 0x00015F58 -extern void DrawProximityBar(PERCENTAGE_BAR* bar); +extern void DrawProximityBar(PERCENTAGE_BAR* bar); // 0x000152D4 extern void SetColourByValue(COLOUR_BAND *pColourBand, int value, CVECTOR *pOut); // 0x00015F6C extern void TransparencyOn(void *potz, unsigned short tpage); // 0x00016098 - -#endif +#endif // OVERLAY_H diff --git a/src_rebuild/Game/C/overmap.c b/src_rebuild/Game/C/overmap.c index 5c0de75ca..13e12d37c 100644 --- a/src_rebuild/Game/C/overmap.c +++ b/src_rebuild/Game/C/overmap.c @@ -41,18 +41,18 @@ OVERMAP overlaidmaps[4] = SXYPAIR MapSegmentPos[16]; -XYPAIR NVertex[4] = { - { -2, 3 }, - { -2, -3 }, - { 2, 3 }, - { 2, -3 } +XYPAIR NVertex[4] = { + { -2, 3 }, + { -2, -3 }, + { 2, 3 }, + { 2, -3 } }; -XYPAIR north[4] = { +XYPAIR north[4] = { { 0, 20 }, - { 0, 20 }, - { 0, 20 }, - { 0, 20 } + { 0, 20 }, + { 0, 20 }, + { 0, 20 } }; static short big_north[] = @@ -83,7 +83,6 @@ static int map_z_offset = 0; int map_x_shift = 0; int map_z_shift = 0; - static unsigned short MapTPage = 0; static int gUseRotatedMap = 0; @@ -105,13 +104,13 @@ void DrawTargetBlip(VECTOR *pos, u_char r, u_char g, u_char b, int flags) int map_minX, map_maxX; int map_minY, map_maxY; - + map_minX = gMapXOffset; map_maxX = gMapXOffset + MAP_SIZE_W; map_minY = gMapYOffset; map_maxY = gMapYOffset + MAP_SIZE_H; - if (flags & 0x20) + if (flags & 0x20) { WorldToMultiplayerMap(pos, &vec); @@ -132,20 +131,20 @@ void DrawTargetBlip(VECTOR *pos, u_char r, u_char g, u_char b, int flags) return; } } - else + else { WorldToFullscreenMap2(pos, &vec); } - if ((flags & 1) == 0) + if ((flags & 1) == 0) { vec.vx += map_x_offset; vec.vz += map_z_offset; } - if (flags & 0x10) + if (flags & 0x10) ysize = OverlayFlashValue / 2; - else if (flags & 0x2) + else if (flags & 0x2) ysize = 3; else ysize = 4; @@ -170,7 +169,7 @@ void DrawTargetBlip(VECTOR *pos, u_char r, u_char g, u_char b, int flags) poly->r0 = r; poly->g0 = g; poly->b0 = b; - + *(ushort*)&poly->u0 = *(ushort*)&light_texture.coords.u0; *(ushort*)&poly->u1 = *(ushort*)&light_texture.coords.u1; *(ushort*)&poly->u2 = *(ushort*)&light_texture.coords.u2; @@ -204,7 +203,7 @@ void DrawTargetArrow(VECTOR *pos, int flags) VECTOR vec; VECTOR vec2; - if (flags & 0x8) + if (flags & 0x8) { vec.vx = pos->vx; vec.vz = pos->vz; @@ -213,16 +212,16 @@ void DrawTargetArrow(VECTOR *pos, int flags) { WorldToOverheadMapPositions(pos, &vec, 1, 0, 0); } - else + else { WorldToFullscreenMap2(pos, &vec); } - if (flags & 0x1) + if (flags & 0x1) { WorldToOverheadMapPositions((VECTOR *)player, &vec2, 1, '\0', 0); } - else + else { vec.vx = vec.vx + map_x_offset; vec.vz = vec.vz + map_z_offset; @@ -250,7 +249,7 @@ void DrawTargetArrow(VECTOR *pos, int flags) poly->x0 = vec2.vx + dy; poly->y0 = vec2.vz - dx; - + poly->x1 = vec2.vx - dy; poly->y1 = vec2.vz + dx; @@ -270,7 +269,7 @@ void DrawTargetArrow(VECTOR *pos, int flags) null->y2 = -1; null->tpage = 0x40; - + if (flags & 0x4) { // fullscreen map @@ -295,16 +294,16 @@ void DrawPlayerDot(VECTOR *pos, short rot, u_char r, u_char g, u_char b, int fla VECTOR opos[3]; VECTOR vec; - if (flags & 0x20) + if (flags & 0x20) { WorldToMultiplayerMap(pos, &vec); - + vec.vx += gMapXOffset; vec.vz += gMapYOffset; } - else + else { - if (flags & 0x8) + if (flags & 0x8) { vec.vx = pos->vx; vec.vz = pos->vz; @@ -312,7 +311,7 @@ void DrawPlayerDot(VECTOR *pos, short rot, u_char r, u_char g, u_char b, int fla else if (flags & 0x1) { WorldToOverheadMapPositions(pos, &vec, 1, 0, 0); - + if (vec.vx - 233U > 94) return; @@ -325,7 +324,7 @@ void DrawPlayerDot(VECTOR *pos, short rot, u_char r, u_char g, u_char b, int fla } } - if ((flags & 0x1) == 0) + if ((flags & 0x1) == 0) { vec.vx += map_x_offset; vec.vz += map_z_offset; @@ -355,18 +354,18 @@ void DrawPlayerDot(VECTOR *pos, short rot, u_char r, u_char g, u_char b, int fla poly->x0 = opos[0].vx; poly->y0 = opos[0].vz; - + poly->x1 = opos[1].vx; poly->y1 = opos[1].vz; - + poly->x2 = opos[2].vx; poly->y2 = opos[2].vz; - if (flags & 0x4) + if (flags & 0x4) { DrawPrim(poly); } - else + else { addPrim(current->ot + 1, poly); current->primptr += sizeof(POLY_F3); @@ -408,7 +407,6 @@ void ProcessOverlayLump(char *lump_ptr, int lump_size) DrawSync(0); } - // [D] [T] void LoadMapTile(int tpage, int x, int y) { @@ -417,7 +415,7 @@ void LoadMapTile(int tpage, int x, int y) MapSegment.w = 8; MapSegment.h = 32; - + MapSegment.x = MapRect.x + (MapSegmentPos[tpage].x >> 2); MapSegment.y = MapRect.y + MapSegmentPos[tpage].y; @@ -824,12 +822,12 @@ void DrawSightCone(COP_SIGHT_DATA *pCopSightData, VECTOR *pPosition, int directi addPrim(current->ot + 1, poly); current->primptr += sizeof(POLY_G3); - + pVertex++; } // draw center - if(flags & 0x1) + if (flags & 0x1) { tile1 = (TILE_1*)current->primptr; setTile1(tile1); @@ -863,15 +861,15 @@ u_int Long2DDistance(VECTOR *pPoint1, VECTOR *pPoint2) tempTheta = RSIN(theta); result = delta.vz; } - else + else { tempTheta = RCOS(theta); result = delta.vx; } - if (result < 512 * 1024) + if (result < 512 * 1024) result = (result << 12) / tempTheta; - else + else result = (result << 9) / tempTheta << 3; return result; @@ -915,7 +913,7 @@ void InitOverheadMap(void) else gMapYOffset = SCREEN_H - MAP_SIZE_H - 15; - if (gMultiplayerLevels) + if (gMultiplayerLevels) { InitMultiplayerMap(); return; @@ -925,8 +923,8 @@ void InitOverheadMap(void) tilehnum = overlaidmaps[GameLevel].width / 32; tpage = 0; - - for (c = 0; c < 4; c++) + + for (c = 0; c < 4; c++) { for (d = 0; d < 4; d++) { @@ -941,7 +939,6 @@ void InitOverheadMap(void) old_y_mod = y_map & 0x1f; } - // [D] [T] void FlashOverheadMap(int r, int g, int b) { @@ -961,7 +958,6 @@ void FlashOverheadMap(int r, int g, int b) prim->w = MAP_SIZE_W; prim->h = MAP_SIZE_H; - addPrim(current->ot + 1, prim); current->primptr += sizeof(TILE); @@ -984,7 +980,6 @@ void FlashOverheadMap(int r, int g, int b) current->primptr += sizeof(POLY_FT3); } - // [D] [T] void DrawMultiplayerMap(void) { @@ -1008,7 +1003,7 @@ void DrawMultiplayerMap(void) r = 255; g = 0; - for (i = 0; i < NumPlayers; i++) + for (i = 0; i < NumPlayers; i++) { pl = &player[i]; @@ -1086,7 +1081,7 @@ void DrawOverheadMap(void) SVECTOR MapMesh[5][5]; VECTOR MapMeshO[5][5]; MAPTEX MapTex[4]; - + SVECTOR direction; RECT16 clipped_size; VECTOR vec; @@ -1109,7 +1104,7 @@ void DrawOverheadMap(void) static u_char ptab2[] = { 255, 255, 240, 170, 120, 80, 55, 38, - 23, 13, 10, 0, + 23, 13, 10, 0, 0 }; @@ -1118,7 +1113,7 @@ void DrawOverheadMap(void) DrawMultiplayerMap(); return; } - + if (NumPlayers > 1) return; @@ -1133,27 +1128,27 @@ void DrawOverheadMap(void) map_minY + MAP_SIZE_H/2 }; - SetMapPos(); + SetMapPos(); draw_box(map_minY, MAP_SIZE_H); // flash the overhead map - if (player_position_known > 0) + if (player_position_known > 0) { if (player[0].playerCarId < 0) playerFelony = &pedestrianFelony; - else + else playerFelony = &car_data[player[0].playerCarId].felonyRating; if (*playerFelony > FELONY_PURSUIT_MIN_VALUE) FlashOverheadMap(ptab[CameraCnt & 0xf], 0, ptab[CameraCnt + 8U & 0xf]); } - else + else { if (player_position_known == -1) { if (flashtimer == 0) { - if (player[0].playerCarId < 0) + if (player[0].playerCarId < 0) playerFelony = &pedestrianFelony; else playerFelony = &car_data[player[0].playerCarId].felonyRating; @@ -1162,7 +1157,7 @@ void DrawOverheadMap(void) flashtimer = 48; } } - + if (flashtimer) { flashtimer--; @@ -1178,8 +1173,8 @@ void DrawOverheadMap(void) WorldToOverheadMapPositions((VECTOR *)player->pos, &vec, 1, 0, 0); // draw map center - if (vec.vx > map_minX && vec.vx < map_maxX && - vec.vz > map_minY && vec.vz < map_maxY) + if (vec.vx > map_minX && vec.vx < map_maxX && + vec.vz > map_minY && vec.vz < map_maxY) { tile1 = (TILE_1 *)current->primptr; setTile1(tile1); @@ -1196,7 +1191,7 @@ void DrawOverheadMap(void) } DrawTargetBlip((VECTOR *)player->pos, 64, 64, 64, 3); - + DrawCompass(); DrawOverheadTargets(); @@ -1214,7 +1209,7 @@ void DrawOverheadMap(void) y_mod = y_map & 31; // next code loads map tiles depending on player position changes - + // X axis if (x_mod < 16 && old_x_mod > 16) { @@ -1232,7 +1227,7 @@ void DrawOverheadMap(void) } } - if (x_mod > 16 && old_x_mod < 16) + if (x_mod > 16 && old_x_mod < 16) { // right for (i = 0; i < 4; i++) @@ -1280,7 +1275,7 @@ void DrawOverheadMap(void) LoadMapTile(tmp, (x_map >> 5) + i, (y_map >> 5)); } } - + old_x_mod = x_mod; old_y_mod = y_mod; @@ -1308,13 +1303,13 @@ void DrawOverheadMap(void) MapTex[1].h = MapTex[2].h = tile_size; MapTex[1].v = MapTex[2].v = MapTex[3].v = 0; - + MapTex[0].u = 32 - ABS(MapMesh[0][0].vx - MapMesh[1][0].vx); MapTex[0].w = ABS(MapMesh[0][0].vx - MapMesh[1][0].vx); MapTex[3].w = ABS(MapMesh[3][0].vx - MapMesh[4][0].vx); MapTex[0].v = 32 - ABS(MapMesh[0][0].vz - MapMesh[0][1].vz); - + MapTex[0].h = ABS(MapMesh[0][0].vz - MapMesh[0][1].vz); MapTex[3].h = ABS(MapMesh[0][3].vz - MapMesh[0][4].vz); @@ -1334,7 +1329,7 @@ void DrawOverheadMap(void) // transform the map mesh for (i = 0; i <= MeshWidth; i++) { - for(j = 0; j <= MeshHeight; j++) + for (j = 0; j <= MeshHeight; j++) { RotTrans(&MapMesh[i][j], &MapMeshO[i][j], &flag); } @@ -1346,7 +1341,7 @@ void DrawOverheadMap(void) for (j = 0; j < MeshWidth; j++) { int tile, px, py; - + tile = maptile[j][i]; tw = MapTex[j].w - 1; th = MapTex[i].h - 1; @@ -1363,7 +1358,7 @@ void DrawOverheadMap(void) setPolyFT4(spt); setSemiTrans(spt, 1); - + if (gTimeOfDay == TIME_NIGHT) spt->r0 = spt->g0 = spt->b0 = 50; else @@ -1371,7 +1366,7 @@ void DrawOverheadMap(void) spt->clut = MapClut; spt->tpage = MapTPage; - + spt->x0 = MapMeshO[j][i].vx; spt->y0 = MapMeshO[j][i].vz; @@ -1491,7 +1486,7 @@ void DrawFullscreenMap(void) int tw, th; // toggle rotated map - if (Pads[0].dirnew & 0x20) + if (Pads[0].dirnew & 0x20) { map_x_offset = 0; map_z_offset = 0; @@ -1523,7 +1518,7 @@ void DrawFullscreenMap(void) polys->r0 = 0; polys->g0 = 0; polys->b0 = 0; - + polys->x0 = 0; polys->y0 = 0; polys->w = 320; @@ -1539,14 +1534,14 @@ void DrawFullscreenMap(void) WorldToFullscreenMap((VECTOR *)player->pos, &player_position); // do map movement - if (gUseRotatedMap) + if (gUseRotatedMap) { if (Pads[0].direct & 0x8000) map_x_offset += 8; else if (Pads[0].direct & 0x2000) map_x_offset -= 8; - - if (Pads[0].direct & 0x1000) + + if (Pads[0].direct & 0x1000) map_z_offset += 8; else if (Pads[0].direct & 0x4000) map_z_offset -= 8; @@ -1568,11 +1563,11 @@ void DrawFullscreenMap(void) } else { - if(player_position.vx + 160 <= width) + if (player_position.vx + 160 <= width) { map_x_offset = player_position.vx - 160; - - if(map_x_offset > -1) + + if (map_x_offset > -1) map_x_offset = 0; } else @@ -1580,11 +1575,11 @@ void DrawFullscreenMap(void) map_x_offset = (player_position.vx + 160) - width; } - if(player_position.vz + 128 <= height) + if (player_position.vz + 128 <= height) { map_z_offset = player_position.vz - 128; - - if (map_z_offset > -1) + + if (map_z_offset > -1) map_z_offset = 0; } else @@ -1594,12 +1589,12 @@ void DrawFullscreenMap(void) if (Pads[0].direct & 0x8000) { - if (player_position.vx - map_x_offset - 160 - map_x_shift > 0) + if (player_position.vx - map_x_offset - 160 - map_x_shift > 0) { map_x_shift += 8; } } - else if(Pads[0].direct & 0x2000) + else if (Pads[0].direct & 0x2000) { if (player_position.vx - map_x_offset + 160 - map_x_shift < width) { @@ -1607,14 +1602,14 @@ void DrawFullscreenMap(void) } } - if (Pads[0].direct & 0x1000) + if (Pads[0].direct & 0x1000) { if (player_position.vz - map_z_offset - 128 - map_z_shift > 0) { map_z_shift += 8; } } - else if(Pads[0].direct & 0x4000) + else if (Pads[0].direct & 0x4000) { if (player_position.vz - map_z_offset + 128 - map_z_shift < height) { @@ -1652,10 +1647,10 @@ void DrawFullscreenMap(void) #endif ntiles = 0; - - for(x = 0; x < width; x++) + + for (x = 0; x < width; x++) { - for(y = 0; y < height; y++) + for (y = 0; y < height; y++) { mesh[0].vy = 0; mesh[1].vy = 0; @@ -1695,9 +1690,9 @@ void DrawFullscreenMap(void) #endif } - if(clipped == 4) + if (clipped == 4) continue; - + LoadMapTile(ntiles & 15, x, y); back = (POLY_FT4 *)current->primptr; @@ -1707,13 +1702,13 @@ void DrawFullscreenMap(void) back->x0 = meshO[0].vx; back->y0 = meshO[0].vz; - + back->x1 = meshO[1].vx; back->y1 = meshO[1].vz; - + back->x2 = meshO[2].vx; back->y2 = meshO[2].vz; - + back->x3 = meshO[3].vx; back->y3 = meshO[3].vz; @@ -1731,7 +1726,7 @@ void DrawFullscreenMap(void) back->u3 = MIN(255, px + tw); back->v3 = MIN(255, py + th); - + back->clut = MapClut; back->tpage = MapTPage; #ifdef PSX @@ -1751,11 +1746,12 @@ void DrawFullscreenMap(void) DrawSync(0); // draw all polys - while(prevback <= back) + while (prevback <= back) DrawPrim(prevback++); DrawSync(0); } + ntiles++; #endif } @@ -1768,7 +1764,7 @@ void DrawFullscreenMap(void) if (gUseRotatedMap) DrawBigCompass(&target, player[0].dir); - else + else DrawBigCompass(&target, 0); DrawTargetBlip(&target, 64, 64, 64, 14); @@ -1828,7 +1824,7 @@ void DrawCopIndicators(void) p = FIXEDH(dx * cc - dz * cs) * 3 >> 2; q = -FIXEDH(dx * cs + dz * cc); - + if (ABS(p) < q) { CopIndicator((p * 266) / q + 160, 0x3fff0 / ((q >> 3) + 600)); @@ -1874,13 +1870,13 @@ void WorldToOverheadMapPositions(VECTOR *pGlobalPosition, VECTOR *pOverheadMapPo tempMatrix.m[1][0] = 0; tempMatrix.m[1][2] = 0; tempMatrix.m[2][1] = 0; - + tempMatrix.m[0][0] = cs; tempMatrix.m[2][2] = cs; tempMatrix.m[2][0] = -sn; tempMatrix.m[0][2] = sn; - + tempMatrix.t[1] = 0; if (outputRelative == 0) @@ -1902,15 +1898,15 @@ void WorldToOverheadMapPositions(VECTOR *pGlobalPosition, VECTOR *pOverheadMapPo playerPos.z = player[0].pos[2]; count--; - while (count >= 0) + while (count >= 0) { tempVector.vy = 0; - if (inputRelative) + if (inputRelative) { tempVector.vx = pGlobalPosition->vx / scale; tempVector.vz = -pGlobalPosition->vz / scale; } - else + else { tempVector.vx = (pGlobalPosition->vx - playerPos.x) / scale; tempVector.vz = (playerPos.z - pGlobalPosition->vz) / scale; @@ -1919,8 +1915,8 @@ void WorldToOverheadMapPositions(VECTOR *pGlobalPosition, VECTOR *pOverheadMapPo RotTrans(&tempVector, pOverheadMapPosition, &flag); // might be faster on OG hardware... but not sure. - // pOverheadMapPosition->vx = tempMatrix.t[0] + (cs * tempVector.vx + sn * tempVector.vz >> 12); - // pOverheadMapPosition->vz = tempMatrix.t[2] + (cs * tempVector.vz - sn * tempVector.vx >> 12); + //pOverheadMapPosition->vx = tempMatrix.t[0] + (cs * tempVector.vx + sn * tempVector.vz >> 12); + //pOverheadMapPosition->vz = tempMatrix.t[2] + (cs * tempVector.vz - sn * tempVector.vx >> 12); count--; pGlobalPosition++; @@ -1954,8 +1950,3 @@ void WorldToFullscreenMap2(VECTOR *in, VECTOR *out) RotTrans(&pos, out, &flag); } - - - - - diff --git a/src_rebuild/Game/C/overmap.h b/src_rebuild/Game/C/overmap.h index 18c3bcefc..d76e5f2bf 100644 --- a/src_rebuild/Game/C/overmap.h +++ b/src_rebuild/Game/C/overmap.h @@ -23,4 +23,4 @@ extern void DrawFullscreenMap(); extern u_int Long2DDistance(VECTOR *pPoint1, VECTOR *pPoint2); // 0x00016C0C -#endif +#endif // OVERMAP_H diff --git a/src_rebuild/Game/C/pad.c b/src_rebuild/Game/C/pad.c index 35153250b..dc36be834 100644 --- a/src_rebuild/Game/C/pad.c +++ b/src_rebuild/Game/C/pad.c @@ -96,14 +96,13 @@ void CloseControllers(void) } while (i < 2); } - // [D] [T] void SetPadVibration(int pad, unsigned char type) { if (pad < 0) return; - if(Pads[pad].dualshock && gInGameCutsceneActive == 0) + if (Pads[pad].dualshock && gInGameCutsceneActive == 0) { Pads[pad].shake_type = type; Pads[pad].vibrate = 6; @@ -135,7 +134,7 @@ void StopDualShockMotors(void) // [D] [T] void SetDuplicatePadData(char *buffer, int size) { - if (size - 1U < PADBUFFER_SIZE) + if (size - 1U < PADBUFFER_SIZE) { DuplicatePadData.buffer = buffer; DuplicatePadData.size = size; @@ -149,8 +148,6 @@ void SetDuplicatePadData(char *buffer, int size) // [D] [T] void MapPad(int pad, PADRAW *pData) { - unsigned char uVar1; - ushort i; ushort buttons; ushort mapped; @@ -165,7 +162,7 @@ void MapPad(int pad, PADRAW *pData) { Pads[pad].type = 2; } - else if(pData->id >> 4 == 7) + else if (pData->id >> 4 == 7) { Pads[pad].type = 4; } @@ -201,7 +198,7 @@ void MapPad(int pad, PADRAW *pData) Pads[pad].mapnew = mapped & ~Pads[pad].mapped; Pads[pad].mapped = mapped; - + if (Pads[pad].mappings.swap_analog == 0) { @@ -210,7 +207,7 @@ void MapPad(int pad, PADRAW *pData) Pads[pad].mapanalog[3] = Pads[pad].diranalog[3]; Pads[pad].mapanalog[0] = Pads[pad].diranalog[0]; } - else + else { Pads[pad].mapanalog[1] = Pads[pad].diranalog[3]; Pads[pad].mapanalog[2] = Pads[pad].diranalog[0]; @@ -251,11 +248,11 @@ void HandleDualShock(void) for (pad = 0; pad < 2; pad++) { pPad = &Pads[pad]; - + port = pPad->port; HandlePadVibration(pad); - if (pPad->active == 0) + if (pPad->active == 0) { pPad->motors[0] = 0; pPad->motors[1] = 0; @@ -264,7 +261,7 @@ void HandleDualShock(void) state = PadGetState(port); - switch (state) + switch (state) { case PadStateDiscon: case PadStateReqInfo: @@ -317,7 +314,7 @@ void HandleDualShock(void) pPad->delay = 0; } - else + else { pPad->delay++; } @@ -332,17 +329,17 @@ void HandleDualShock(void) pPad->motors[0] = 0; pPad->motors[1] = 0; } - else + else { if (pPad->vibrate > 0 || pPad->alarmShakeCounter != 0) { - if (gVibration == 0) + if (gVibration == 0) { PadSetAct(port, dummymotors, 2); } else { - if (pPad->motors[0] != 0) + if (pPad->motors[0] != 0) dsload += 10; if (pPad->motors[1] != 0) @@ -352,7 +349,7 @@ void HandleDualShock(void) } } - if (pPad->vibrate != 0) + if (pPad->vibrate != 0) pPad->vibrate--; } } @@ -364,7 +361,7 @@ void HandlePadVibration(int pad) { int speed; PAD* pPad; - + pPad = &Pads[pad]; speed = 0; @@ -374,20 +371,20 @@ void HandlePadVibration(int pad) return; } - if (player[pad].onGrass) + if (player[pad].onGrass) { speed = ABS(car_data[player[pad].playerCarId].st.n.angularVelocity[1] >> 0xf); speed += car_data[player[pad].playerCarId].hd.speed; if (speed > 60) speed = 60; - + pPad->vibrate = 6; } if (pPad->shake_type != 0) { - if (pPad->shakeptr == NULL) + if (pPad->shakeptr == NULL) pPad->shakeptr = shake_data[pPad->shake_type - 1]; } @@ -395,7 +392,7 @@ void HandlePadVibration(int pad) { speed += *pPad->shakeptr++; - if (*pPad->shakeptr == 0) + if (*pPad->shakeptr == 0) pPad->shakeptr = NULL; } @@ -405,7 +402,7 @@ void HandlePadVibration(int pad) pPad->shake_type = 0; pPad->motors[1] = (speed * (gDualShockMax + 256) >> 9); - if (pPad->alarmShakeCounter != 0) + if (pPad->alarmShakeCounter != 0) { if (pPad->alarmShakeCounter-- == 1) pPad->motors[0] = 0; @@ -414,7 +411,6 @@ void HandlePadVibration(int pad) } } - // [D] [T] void ReadControllers(void) { @@ -466,4 +462,4 @@ void ReadControllers(void) if (Pads[1].type == 1) pad_connected = -1; } -} \ No newline at end of file +} diff --git a/src_rebuild/Game/C/pad.h b/src_rebuild/Game/C/pad.h index cf1b879a9..fb75918c6 100644 --- a/src_rebuild/Game/C/pad.h +++ b/src_rebuild/Game/C/pad.h @@ -123,4 +123,4 @@ extern void StopDualShockMotors(); // 0x0006BEEC extern void SetDuplicatePadData(char *buffer, int size); // 0x0006BEF4 -#endif +#endif // PAD_H diff --git a/src_rebuild/Game/C/pathfind.c b/src_rebuild/Game/C/pathfind.c index a4848217d..fab93a8c1 100644 --- a/src_rebuild/Game/C/pathfind.c +++ b/src_rebuild/Game/C/pathfind.c @@ -21,7 +21,7 @@ struct tNode { int vx, vy, vz; u_short dist; - u_short ptoey; // just a padding. + u_short ptoey; // just a padding. }; struct XZDIR @@ -50,54 +50,38 @@ u_int numHeapEntries = 0; XZDIR ends[6][2] = { { - {0, 0}, - {512, 0} + { 0, 0 }, + { 512, 0 } }, - { - {0, 0}, - {256, 512 } + { 0, 0 }, + { 256, 512 } }, - { - {256, 512}, - {512, 0} + { 256, 512 }, + { 512, 0 } }, - { - {256, 512}, - {-256, 512} + { 256, 512 }, + { -256, 512 } }, - { - {256, 512}, - {0, 1024} + { 256, 512}, + { 0, 1024} }, { - {256, 512 }, - {512, 1024} + { 256, 512 }, + { 512, 1024 } } }; XZDIR dirs[6] = { - { - 512,0 - }, - { - 256,-512 - }, - { - -256,-512 - }, - { - -512,0 - }, - { - -256,512 - }, - { - 256,512 - }, + { 512, 0 }, + { 256, -512 }, + { -256, -512 }, + { -512, 0 }, + { -256, 512 }, + { 256, 512 } }; // cx, cz in range of 0..128 @@ -221,19 +205,19 @@ void popNode(tNode* __return_storage_ptr__) here = 1; res = heap[here]; - if (numHeapEntries > 1) + if (numHeapEntries > 1) { lastDist = heap[numHeapEntries].dist; - while (true) + while (true) { child = here * 2; - + // [A] not sure yet but skipping this check causes memory overflow // it doesn't makes much sense to increase heap size either as it works the same. if (child + 1 >= 201) break; - + d = heap[child].dist; if (child >= numHeapEntries - 2 || d > heap[child + 1].dist) @@ -310,7 +294,7 @@ void WunCell(VECTOR* pbase) pbase->vz = pbase->vz - 512; v[1].vy = v[0].vy; - for (i = 0; i < 2; i++) + for (i = 0; i < 2; i++) { if (i != 0) pbase->vx += 512; @@ -350,11 +334,11 @@ void InvalidateMapEnds() pos.x = (player[0].pos[0] & ~1023) >> 10; pos.z = (player[0].pos[2] & ~1023) >> 10; - for(i = 0; i < 32; i++) + for (i = 0; i < 32; i++) { x = pos.x + 15 + i; z = pos.z + 16; - + tile = DONEMAP_V(x, z); DONEMAP_V(x, z) = tile ^ DONEMAP_GETVALUE(x, z, tile, 3); @@ -383,16 +367,16 @@ void InvalidateMap(void) bPos.vx = player[0].pos[0] & ~1023; bPos.vz = player[0].pos[2] & ~1023; - for(count = 0; count < 1024; count++) + for (count = 0; count < 1024; count++) { px = bPos.vx >> 10; pz = bPos.vz >> 10; - + tile = DONEMAP_V(px, pz); i = DONEMAP_GETVALUE(px, pz, tile, 3); DONEMAP_V(px, pz) = tile ^ i; - + if (dir == 0) { bPos.vx += MAP_CELL_SIZE / 2; @@ -416,7 +400,6 @@ void InvalidateMap(void) } } - u_int cellsThisFrame; u_int cellsPerFrame = 4; @@ -432,7 +415,7 @@ void BloodyHell(void) int tile, i; cellsThisFrame = 0; - + // [A] really it should be based on player's height bPos.vy = player[0].pos[1]; bPos.vx = player[0].pos[0] & ~1023; @@ -442,7 +425,7 @@ void BloodyHell(void) if (CameraCnt < 4) howMany = cellsPerFrame + 20; - + if (CameraCnt < 8) howMany += 4; @@ -512,7 +495,7 @@ int blocked(tNode* v1, tNode* v2) int prev = DONEMAP_V(x >> 2, z >> 2); int val = DONEMAP_GETVALUE(x >> 2, z >> 2, prev, 0); - + if (val != 0) return 1; @@ -554,7 +537,7 @@ int iterate(void) nbr = pathNodes; // check directions - for(dir = 0; dir < 6; dir++, nbr++) + for (dir = 0; dir < 6; dir++, nbr++) { nbr->vx = itHere.vx + dirs[dir].dx; nbr->vy = itHere.vy; @@ -574,7 +557,7 @@ int iterate(void) continue; } } - + nbr->dist = 1; } else if (dist <= itHere.dist - 288) @@ -582,9 +565,9 @@ int iterate(void) nbr->dist = 1; } } - + // now we have distance let's compute the rest of the map - for(dir = 0; dir < 6; dir++) + for (dir = 0; dir < 6; dir++) { // visited? if (pathNodes[dir].dist != 0) @@ -713,7 +696,7 @@ int getInterpolatedDistance(VECTOR* pos) n.dist = DISTMAP_V(n.vx, n.vy, n.vz); b = n.dist; - + if (a < b) min = a; else @@ -723,7 +706,7 @@ int getInterpolatedDistance(VECTOR* pos) { n.vx = sp.vx + 256; n.vz = sp.vz - 512; - + if (OMAP_GETVALUE(n.vx >> 8, n.vz >> 8) != 0) { n.vy = MapHeight((VECTOR*)&n); @@ -733,16 +716,16 @@ int getInterpolatedDistance(VECTOR* pos) { n.vy = 0; } - + dist = DISTMAP_V(n.vx, n.vy, n.vz); - + if (min < dist) c = min; else c = dist; - + c += 341; - + if (c > 0xffff) c = 0xffff; else if (a > c) @@ -752,13 +735,13 @@ int getInterpolatedDistance(VECTOR* pos) b = c; x = dist - a; - + if (c < dist) { x = c - a; dist = c; } - + x = x * fx; res = (b - dist) * fz; } @@ -778,7 +761,7 @@ int getInterpolatedDistance(VECTOR* pos) } dist = DISTMAP_V(n.vx, n.vy, n.vz); - + if (min < dist) c = min; else @@ -795,19 +778,19 @@ int getInterpolatedDistance(VECTOR* pos) b = c; x = dist - a; - + if (c < dist) { x = c - a; dist = c; } - + x = x * fz; res = (b - dist) * fx; } a = a + (x + res >> 9); - + lastDistanceFound = a ^ (a & 1 ^ a) & 1; return lastDistanceFound; @@ -828,10 +811,10 @@ void addCivs(void) { rx = cp->hd.oBox.radii[2].vx; rz = cp->hd.oBox.radii[2].vz; - + x = cp->hd.oBox.location.vx; z = cp->hd.oBox.location.vz; - + vx = x + rx >> 8; vz = z + rz >> 8; @@ -842,8 +825,8 @@ void addCivs(void) vx2 = x - rx >> 8; vz2 = z - rz >> 8; - - if ((vx ^ (vz & 0x7e) << 8) == vx2 && + + if ((vx ^ (vz & 0x7e) << 8) == vx2 && (vz2 & 0x7e) != 0 || (vz2 & 0x7e << 8) != 1) { bits = 3 << (vz2 & 6); @@ -954,12 +937,12 @@ void UpdateCopMap(void) } DebugDisplayObstacleMap(); - + // remove cars addCivs(); } - - if(pathFrames == 0) + + if (pathFrames == 0) { // restart from new search target position if (player[0].playerType == 1 && (CopsCanSeePlayer != 0 || numActiveCops == 0)) @@ -991,15 +974,15 @@ void UpdateCopMap(void) distanceCache[i] = d; } - + startNode.vx = ((searchTarget.vx + (searchTarget.vz >> 1 & 511)) >> 9) * 512 - ((searchTarget.vz & 512) >> 1); startNode.vz = (searchTarget.vz >> 9) << 9; startNode.vy = searchTarget.vy; - + numHeapEntries = 0; // pick the height - if(OMAP_GETVALUE(startNode.vx >> 8, startNode.vz >> 8) != 0) + if (OMAP_GETVALUE(startNode.vx >> 8, startNode.vz >> 8) != 0) { res = MapHeight((VECTOR*)&startNode); startNode.vy = res ^ (res ^ sdLevel) & 3; @@ -1018,7 +1001,7 @@ void UpdateCopMap(void) startNode.vx += 256; startNode.vz += 512; - + pushSeedNode(&startNode); startNode.vx += 256; @@ -1032,11 +1015,11 @@ void UpdateCopMap(void) startNode.vx += 256; startNode.vz += 512; - + pushSeedNode(&startNode); - + startNode.vx -= 512; - + pushSeedNode(&startNode); } } @@ -1044,14 +1027,14 @@ void UpdateCopMap(void) pathFrames++; maxret = 0; - for(i = 0; i < 8; i++) + for (i = 0; i < 8; i++) { if (distanceReturnedLog[i] > maxret) maxret = distanceReturnedLog[i]; } if (pathFrames > 250 || // [A] was (pathFrames < pathFrames) - heap[1].dist - maxret > 3000) + heap[1].dist - maxret > 3000) { pathFrames = 0; } diff --git a/src_rebuild/Game/C/pathfind.h b/src_rebuild/Game/C/pathfind.h index e590b08bc..b17852acb 100644 --- a/src_rebuild/Game/C/pathfind.h +++ b/src_rebuild/Game/C/pathfind.h @@ -9,4 +9,4 @@ extern void UpdateCopMap(); // 0x000E836C extern int getHeadingToPlayer(int vx, int vy, int vz); // 0x000E8F00 -#endif +#endif // PATHFIND_H diff --git a/src_rebuild/Game/C/pause.c b/src_rebuild/Game/C/pause.c index 9242a33e6..a397300c6 100644 --- a/src_rebuild/Game/C/pause.c +++ b/src_rebuild/Game/C/pause.c @@ -91,7 +91,7 @@ void SkipCutscene(int direction); void EnterScoreName(); void CreateScoreNames(SCORE_ENTRY *table, PLAYER_SCORE *score, int position); -void DrawHighScoreMenu(int selection); +void DrawHighScoreMenu(int selection); char EnterScoreText[32] = { 0 }; @@ -425,7 +425,6 @@ MENU_ITEM InvalidMultiPadItems[] = { NULL, PAUSE_TYPE_ENDITEMS, 0u, NULL, MENU_QUIT_NONE, NULL } }; - MENU_HEADER PauseMenuHeader = { G_LTXT_ID(GTXT_Paused), { 0, 0, 0, 0 }, 0u, MainPauseItems }; @@ -485,7 +484,6 @@ MENU_HEADER InvalidMultiPadHeader = InvalidMultiPadItems }; - u_char gCurrentTextChar = 0; typedef void(*OnEntryComplete)(void* data, char* text); @@ -527,7 +525,7 @@ char* WaitForTextEntry(char* textBufPtr, int maxLength) if (!FilterFrameTime()) continue; - + ReadControllers(); npad = Pads[0].dirnew; @@ -712,7 +710,7 @@ void SaveReplay(int direction) #else #ifdef CUTSCENE_RECORDER - if(_CutRec_IsOn()) + if (_CutRec_IsOn()) { if (CutRec_SaveChase()) { @@ -735,7 +733,7 @@ void SaveReplay(int direction) _mkdir("Replays"); ClearMem(EnterNameText, REPLAY_NAME_LEN); - + // detect the best file name // TODO: if replay is loaded - set the loaded replay filename if (gLoadedReplay) @@ -812,7 +810,7 @@ int MaxMenuStringLength(MENU_HEADER *pMenu) { temp = StringWidth(GET_GAME_TXT(pItems->Text)); - if (pItems->Type & (PAUSE_TYPE_SFXVOLUME | PAUSE_TYPE_MUSICVOLUME)) + if (pItems->Type & (PAUSE_TYPE_SFXVOLUME | PAUSE_TYPE_MUSICVOLUME)) temp = temp + StringWidth(" 100"); if (temp > max) @@ -824,7 +822,6 @@ int MaxMenuStringLength(MENU_HEADER *pMenu) return max; } - // [D] [T] void SetupMenu(MENU_HEADER *menu, int back) { @@ -875,24 +872,24 @@ void InitaliseMenu(PAUSEMODE mode) allownameentry = 0; - switch (mode) + switch (mode) { case PAUSEMODE_PAUSE: case PAUSEMODE_PAUSEP1: case PAUSEMODE_PAUSEP2: - if (NumPlayers == 1 && gMultiplayerLevels == 0) + if (NumPlayers == 1 && gMultiplayerLevels == 0) { if (gInGameCutsceneActive == 0) pNewMenu = &PauseMenuHeader; - else + else pNewMenu = &CutscenePauseMenuHeader; } - else + else pNewMenu = &MultiplayerPauseHeader; break; case PAUSEMODE_GAMEOVER: - switch (GameType) + switch (GameType) { case GAME_PURSUIT: pNewMenu = &ChaseGameFinishedHeader; @@ -942,7 +939,7 @@ void InitaliseMenu(PAUSEMODE mode) break; case PAUSEMODE_COMPLETE: - switch (GameType) + switch (GameType) { case GAME_MISSION: pNewMenu = &MissionCompleteHeader; @@ -955,7 +952,7 @@ void InitaliseMenu(PAUSEMODE mode) case GAME_SURVIVAL: case GAME_COPSANDROBBERS: case GAME_CAPTURETHEFLAG: - if (NumPlayers == 1) + if (NumPlayers == 1) { pNewMenu = &DrivingGameFinishedHeader; gMissionCompletionState = mode; @@ -986,9 +983,9 @@ void InitaliseMenu(PAUSEMODE mode) } break; case PAUSEMODE_PADERROR: - if (pad_connected < 0) + if (pad_connected < 0) { - if (NumPlayers == 1) + if (NumPlayers == 1) pNewMenu = &InvalidPadHeader; else pNewMenu = &InvalidMultiPadHeader; @@ -998,9 +995,9 @@ void InitaliseMenu(PAUSEMODE mode) else pNewMenu->Title = G_LTXT(GTXT_IncorrectController2); } - else + else { - if (NumPlayers == 1) + if (NumPlayers == 1) pNewMenu = &NoPadHeader; else pNewMenu = &NoMultiPadHeader; @@ -1014,7 +1011,7 @@ void InitaliseMenu(PAUSEMODE mode) } // [A] - if(pNewMenu) + if (pNewMenu) { VisibleMenu = 0; VisibleMenus[VisibleMenu] = pNewMenu; @@ -1055,7 +1052,7 @@ void DrawVisibleMenus(void) int i; int xpos, ypos; int menuWidth; - + int x1, x2, y1, y2; static int maxPercentageWidth = StringWidth(" 100"); @@ -1069,7 +1066,7 @@ void DrawVisibleMenus(void) xpos = pActive->Bound.x; ypos = pActive->Bound.y; menuWidth = pActive->Bound.w; - + if (pActive->Title) { OutputString(GET_GAME_TXT(pActive->Title), 2, xpos, ypos, menuWidth, 128, 32, 32); @@ -1084,7 +1081,7 @@ void DrawVisibleMenus(void) if (!pItem->Text) continue; - + if (pItem == ActiveItem[VisibleMenu]) { r = 0; @@ -1096,14 +1093,14 @@ void DrawVisibleMenus(void) r = 128; } - if(pItem->Type & (PAUSE_TYPE_SFXVOLUME | PAUSE_TYPE_MUSICVOLUME)) + if (pItem->Type & (PAUSE_TYPE_SFXVOLUME | PAUSE_TYPE_MUSICVOLUME)) { width = StringWidth(GET_GAME_TXT(pItem->Text)); itemXpos = xpos + ((menuWidth - width) - maxPercentageWidth) / 2; OutputString(GET_GAME_TXT(pItem->Text), 1, itemXpos, ypos, menuWidth, r, 128, b); - + if (pItem->Type & PAUSE_TYPE_SFXVOLUME) OutputString(SfxVolumeText, 1, itemXpos + width + 10, ypos, menuWidth, r, 128, b); else if (pItem->Type & PAUSE_TYPE_MUSICVOLUME) @@ -1120,7 +1117,7 @@ void DrawVisibleMenus(void) poly = (POLY_F4*)current->primptr; ypos = pActive->Bound.y; - + setPolyF4(poly); x1 = xpos - 5; x2 = xpos + menuWidth + 5; @@ -1189,7 +1186,7 @@ void ControlMenu(void) { paddata = Pads[0].dirnew; paddirect = Pads[0].direct; - + if (NumPlayers == 2) { paddata = Pads[1].dirnew | Pads[0].dirnew; @@ -1251,7 +1248,7 @@ void ControlMenu(void) { // go up ActiveMenuItem--; - + if (ActiveMenuItem < 0) ActiveMenuItem = ActiveMenu->NumItems - 1; @@ -1261,7 +1258,7 @@ void ControlMenu(void) { // go down ActiveMenuItem++; - + if (ActiveMenuItem > ActiveMenu->NumItems - 1) ActiveMenuItem = 0; @@ -1273,10 +1270,10 @@ void ControlMenu(void) if (pItem->Type & PAUSE_TYPE_SUBMENU) { menu = pItem->SubMenu; - + VisibleMenu++; VisibleMenus[VisibleMenu] = menu; - + SetupMenu(menu, 0); return; } @@ -1284,7 +1281,7 @@ void ControlMenu(void) // function flag if (pItem->Type & PAUSE_TYPE_FUNC) (*pItem->func)(0); - + if (pItem->ExitValue == MENU_QUIT_NONE) return; @@ -1304,7 +1301,7 @@ void ControlMenu(void) { #ifndef PSX // hack for keyboard swap - if(!(paddata & MPAD_START)) + if (!(paddata & MPAD_START)) return; #endif for (i = 0; i < ActiveMenu->NumItems; i++) @@ -1321,7 +1318,7 @@ void ControlMenu(void) else { // only triangle - if(paddata & 0x10) + if (paddata & 0x10) { VisibleMenu--; SetupMenu(VisibleMenus[VisibleMenu], 1); @@ -1347,15 +1344,15 @@ void PauseMap(int direction) // [D] [T] void SfxVolume(int direction) { - if (direction < 0) + if (direction < 0) gMasterVolume = gMasterVolume + -100; else if (0 < direction) gMasterVolume = gMasterVolume + 100; - if (gMasterVolume < -10000) + if (gMasterVolume < -10000) gMasterVolume = -10000; - if (gMasterVolume > 0) + if (gMasterVolume > 0) gMasterVolume = 0; sprintf(SfxVolumeText, "%d", (10000 + gMasterVolume) / 100); @@ -1368,13 +1365,13 @@ void MusicVolume(int direction) { if (direction < 0) gMusicVolume = gMusicVolume + -100; - else if (0 < direction) + else if (0 < direction) gMusicVolume = gMusicVolume + 100; if (gMusicVolume < -10000) gMusicVolume = -10000; - if (gMusicVolume > 0) + if (gMusicVolume > 0) gMusicVolume = 0; sprintf(MusicVolumeText, "%d", (10000 + gMusicVolume) / 100); @@ -1394,11 +1391,11 @@ void EnterScoreName(void) username = NULL; - if (!gScoreEntered) + if (!gScoreEntered) { gScorePosition = OnScoreTable(&table); - if (gScorePosition != -1) + if (gScorePosition != -1) username = ScoreName[gScorePosition]; CreateScoreNames(table, &gPlayerScore, gScorePosition); @@ -1503,8 +1500,8 @@ void DrawHighScoreMenu(int selection) i = 0; do { - - if (i == selection) + + if (i == selection) { r = 0; b = 0; @@ -1571,7 +1568,7 @@ int mytolower(int ch) else return ch; } - + void strlower(char* str) { while (*str != '\0') @@ -1588,7 +1585,7 @@ void CreateScoreNames(SCORE_ENTRY* table, PLAYER_SCORE* score, int position) char* text; int i; - switch (GameType) + switch (GameType) { case GAME_PURSUIT: case GAME_GETAWAY: @@ -1627,7 +1624,7 @@ void CreateScoreNames(SCORE_ENTRY* table, PLAYER_SCORE* score, int position) ClearMem(ScoreName[i], 7); } - else + else { time = table->time; @@ -1644,7 +1641,7 @@ void CreateScoreNames(SCORE_ENTRY* table, PLAYER_SCORE* score, int position) strlower(ScoreItems[i]); } - sprintf(ScoreName[i], "%s", table->name); + sprintf(ScoreName[i], "%s", table->name); table++; } @@ -1661,7 +1658,7 @@ int UpdatePauseMenu(PAUSEMODE mode) if (mode == PAUSEMODE_PADERROR) mode = PAUSEMODE_PAUSE; - + if (passed_mode == PAUSEMODE_PADERROR) { if (pad_connected == 1) @@ -1720,7 +1717,7 @@ void ShowPauseMenu(PAUSEMODE mode) InitaliseMenu(mode); gDrawPauseMenus = 1; - + PauseReturnValue = 0; } @@ -1744,7 +1741,7 @@ void DrawPauseMenus(void) { DisplayMenuMessage(gDisplayedMessage.header, gDisplayedMessage.text); - if(gDisplayedMessage.show > 0) + if (gDisplayedMessage.show > 0) gDisplayedMessage.show--; } else if (gEnteringScore) @@ -1752,4 +1749,4 @@ void DrawPauseMenus(void) else DrawVisibleMenus(); } -} \ No newline at end of file +} diff --git a/src_rebuild/Game/C/pause.h b/src_rebuild/Game/C/pause.h index b2514e667..1ec1b2bfb 100644 --- a/src_rebuild/Game/C/pause.h +++ b/src_rebuild/Game/C/pause.h @@ -26,5 +26,4 @@ extern void ControlMenu(); void SaveReplay(int direction); - -#endif +#endif // PAUSE_H diff --git a/src_rebuild/Game/C/pedest.c b/src_rebuild/Game/C/pedest.c index 2160b00dd..eece96874 100644 --- a/src_rebuild/Game/C/pedest.c +++ b/src_rebuild/Game/C/pedest.c @@ -266,7 +266,6 @@ void DestroyCivPedestrians(void) } } - // [D] [T] void DestroyPedestrian(LPPEDESTRIAN pPed) { @@ -353,7 +352,6 @@ LPPEDESTRIAN CreatePedestrian(void) return NULL; } - // [D] [T] void PlaceRoadBlockCops(void) { @@ -473,7 +471,6 @@ int CreatePedAtLocation(LONGVECTOR4* pPos, int pedType) return 1; } - // [D] [T] void DrawAllPedestrians(void) { @@ -602,7 +599,6 @@ void ControlPedestrians(void) } } - // [D] [T] void AnimatePed(LPPEDESTRIAN pPed) { @@ -671,9 +667,9 @@ void AnimatePed(LPPEDESTRIAN pPed) surfId = PedSurfaceType(&vec); // play footstep sounds - if (surfId != SURF_GRASS && - surfId != SURF_WATER && - surfId != SURF_SAND && + if (surfId != SURF_GRASS && + surfId != SURF_WATER && + surfId != SURF_SAND && surfId != SURF_DEEPWATER) { if (pPed->frame1 == 3) @@ -695,7 +691,6 @@ void AnimatePed(LPPEDESTRIAN pPed) } } - // [D] [T] void SetupDoNowt(LPPEDESTRIAN pPed) { @@ -1100,7 +1095,6 @@ void PedGetOutCar(LPPEDESTRIAN pPed) } } - int lastCarCameraView = 0; // [D] [T] @@ -1149,7 +1143,6 @@ void SetupGetOutCar(LPPEDESTRIAN pPed, CAR_DATA* pCar, int side) carToGetIn = pCar; } - // [D] [T] void SetupGetInCar(LPPEDESTRIAN pPed) { @@ -1269,7 +1262,6 @@ void PedPressButton(LPPEDESTRIAN pPed) } } - // [D] [T] void SetupTannerSitDown(LPPEDESTRIAN pPed) { @@ -1329,8 +1321,6 @@ void TannerCameraHandler(LPPEDESTRIAN pPed) // [A] old non-functioning code bloat removed } - - // [D] [T] void TannerSitDown(LPPEDESTRIAN pPed) { @@ -1631,7 +1621,6 @@ int FindPointOfCollision(CAR_DATA* pCar, LPPEDESTRIAN pPed) } #endif - dx = FIXED((collisionResult.hit.vx - cd[1].x.vx) * RCOS(cd[1].theta)) - FIXED((collisionResult.hit.vz - cd[1].x.vz) * RSIN(cd[1].theta)); @@ -1665,7 +1654,7 @@ int TannerCarCollisionCheck(VECTOR* pPos, int dir, int bQuick) CAR_COSMETICS* car_cos; CAR_DATA* pcdTanner; - CRET2D collisionResult; // offset 0x30 + CRET2D collisionResult; CDATA2D cd[2]; pcdTanner = &car_data[TANNER_COLLIDER_CARID]; @@ -1725,7 +1714,7 @@ int TannerCarCollisionCheck(VECTOR* pPos, int dir, int bQuick) pointVel[0] = FIXEDH(pcdTanner->st.n.angularVelocity[1] * lever[2] - pcdTanner->st.n.angularVelocity[2] * lever[1]) + pcdTanner->st.n.linearVelocity[0]; pointVel[2] = FIXEDH(pcdTanner->st.n.angularVelocity[0] * lever[1] - pcdTanner->st.n.angularVelocity[1] * lever[0]) + pcdTanner->st.n.linearVelocity[2]; - strikeVel = (pointVel[0] / 256) * (-collisionResult.surfNormal.vx / 16) + + strikeVel = (pointVel[0] / 256) * (-collisionResult.surfNormal.vx / 16) + (pointVel[2] / 256) * (-collisionResult.surfNormal.vz / 16); if (strikeVel < 0) @@ -1736,7 +1725,7 @@ int TannerCarCollisionCheck(VECTOR* pPos, int dir, int bQuick) int twistRateY; twistRateY = car_cos->twistRateY; - + lever_dot_n = FIXEDH(lever[0] * -collisionResult.surfNormal.vx + lever[2] * -collisionResult.surfNormal.vz); displacementsquared = FIXEDH(((lever[0] * lever[0] + lever[2] * lever[2]) - lever_dot_n * lever_dot_n) * twistRateY) + ONE; @@ -1746,10 +1735,10 @@ int TannerCarCollisionCheck(VECTOR* pPos, int dir, int bQuick) denom = -strikeVel / displacementsquared * ONE; denom /= 64; - + reaction[0] = denom * (-collisionResult.surfNormal.vx / 64); reaction[2] = denom * (-collisionResult.surfNormal.vz / 64); - + pcdTanner->st.n.linearVelocity[0] += pcdTanner->st.n.linearVelocity[0] + reaction[0]; pcdTanner->st.n.linearVelocity[2] += pcdTanner->st.n.linearVelocity[2] + reaction[2]; @@ -1826,7 +1815,7 @@ void SetupCivJump(LPPEDESTRIAN pPed, CAR_DATA* cp) else { int d; - + dx = player[0].pPed->position.vx - pPed->position.vx; dz = player[0].pPed->position.vz - pPed->position.vz; @@ -1834,7 +1823,7 @@ void SetupCivJump(LPPEDESTRIAN pPed, CAR_DATA* cp) dir[0] = player[0].pPed->speed * RCOS(d); dir[2] = player[0].pPed->speed * RSIN(d); - + // [A] fuck.... if (FIXED(-dir[0]) * dx + FIXED(dir[2]) * dz + 2048 < 0) angle = -1024; @@ -1853,7 +1842,7 @@ void SetupCivJump(LPPEDESTRIAN pPed, CAR_DATA* cp) { int carVelDisp; carVelDisp = (cp->st.n.linearVelocity[2] * dx - cp->st.n.linearVelocity[0] * dz + 2048); - + angle = ((short)~(ushort)(carVelDisp >> 0x1c) >> 0xf & 0x800U) - ratan2(cp->st.n.linearVelocity[2], cp->st.n.linearVelocity[0]); } else @@ -2028,7 +2017,6 @@ void CorrectPathPosition(LPPEDESTRIAN pedestrian, VECTOR* position) { } - // [D] [T] int CalcPedestrianDirection(int last_dir, int wx, int wz, VECTOR* target) { @@ -2038,7 +2026,7 @@ int CalcPedestrianDirection(int last_dir, int wx, int wz, VECTOR* target) int dir; int mask; int cnt; - + mask = pedestrian_roads.west == -20; dir = mask; @@ -2064,7 +2052,7 @@ int CalcPedestrianDirection(int last_dir, int wx, int wz, VECTOR* target) if (num == 0) { - if(dir > 1) + if (dir > 1) { num = 16; @@ -2156,7 +2144,7 @@ void SetPedestrianTurn(LPPEDESTRIAN pedestrian, int turn) pedestrian->position.vx -= pedestrian->velocity.vx; speed = pedestrian->speed; - + pedestrian->velocity.vx = FIXEDH(speed * RSIN(dir)); pedestrian->velocity.vz = FIXEDH(speed * RCOS(dir)); } @@ -2194,8 +2182,8 @@ SEATEDPTR FindSeated(void) if (seatedptr->index == 0) { count1--; - - if((dx * dx + dz * dz) - 11U < 29) + + if ((dx * dx + dz * dz) - 11U < 29) { add_seated(seatedptr, seated_count); return seatedptr; @@ -2215,7 +2203,7 @@ SEATEDPTR FindTannerASeat(LPPEDESTRIAN pPed) int bestSqr; SEATEDPTR seatedptr; SEATEDPTR theOne; - + theOne = NULL; bestSqr = 4096; seated_count = 0; @@ -2229,14 +2217,14 @@ SEATEDPTR FindTannerASeat(LPPEDESTRIAN pPed) { dx = ABS(seatedptr->x - pPed->position.vx); dz = ABS(seatedptr->z - pPed->position.vz); - + seated_count++; if (dx < 900 && dz < 900) { distSqr = FIXED(dx * dx + dz * dz); - - if(distSqr < bestSqr) + + if (distSqr < bestSqr) { theOne = seatedptr; bestSqr = distSqr; @@ -2273,7 +2261,7 @@ void add_seated(SEATEDPTR seatedptr, int seat_index) return; seatedptr->index = 2; - + pedptr->type = PED_ACTION_CIVSIT; pedptr->speed = 0; pedptr->velocity.vx = 0; @@ -2283,13 +2271,13 @@ void add_seated(SEATEDPTR seatedptr, int seat_index) pedptr->position.vx = seatedptr->x; pedptr->position.vz = seatedptr->z; pedptr->position.vy = player[0].pos[1]; - + pedptr->position.vy = -75 - MapHeight((VECTOR*)&pedptr->position); pedptr->index = 1; pedptr->seat_index = seat_index; pedptr->pedType = CIVILIAN; - + SetupPedestrian(pedptr); pedptr->fpAgitatedState = NULL; @@ -2320,7 +2308,7 @@ void set_coll_box(int index, CAR_DATA* cp, int offset) boxSize = 400; isPlayerCar = (cp == &car_data[player[0].playerCarId]); - + if (player[0].horn.on) { if (isPlayerCar) @@ -2385,7 +2373,7 @@ void BuildCarCollisionBox(void) vx = FIXED(player[0].pPed->speed * RSIN(dir) * 4); vz = FIXED(player[0].pPed->speed * RCOS(dir) * 4); - + tanner_collision_box.min_x = player[0].pPed->position.vx + vx - 148; tanner_collision_box.max_x = player[0].pPed->position.vx + vx + 148; tanner_collision_box.min_z = player[0].pPed->position.vz + vz - 148; @@ -2394,14 +2382,14 @@ void BuildCarCollisionBox(void) num_extra_boxes_set = 0; expl = explosion; - + index = 4; do { if (expl->time >= 2048) { cbox = extra_collision_boxes + num_extra_boxes_set; - + cbox->min_x = expl->pos.vx - 1952; cbox->max_x = expl->pos.vx + 1952; @@ -2453,9 +2441,9 @@ CAR_DATA* CheckForCar(LPPEDESTRIAN pedestrian) // [D] [T] int CheckForPlayerCar(LPPEDESTRIAN pedestrian, CAR_COLLISION_BOX* collision_box) { - if (pedestrian->position.vx >= collision_box->min_x && + if (pedestrian->position.vx >= collision_box->min_x && pedestrian->position.vx <= collision_box->max_x && - pedestrian->position.vz >= collision_box->min_z && + pedestrian->position.vz >= collision_box->min_z && pedestrian->position.vz <= collision_box->max_z) { return 1; @@ -2524,15 +2512,14 @@ void ProcessChairLump(char* lump_file, int lump_size) seated_pedestrian = (SEATEDPTR)lump_file; } -// [D] [T] -// Havana easter egg. +// [D] [T] Havana easter egg void IHaveThePower(void) { CAR_DATA* cp; LONGVECTOR4 force = { 0x9000, 0, 0, 0 }; LONGVECTOR4 point = { 0, 0, 90, 0 }; - if (GameLevel != 1) + if (GameLevel != LEVEL_HAVANA) return; if (player[0].pos[0] > -231749 || player[0].pos[0] < -232147 || @@ -2649,13 +2636,13 @@ void ProcessTannerPad(LPPEDESTRIAN pPed, u_int pad, char PadSteer, char use_anal { switch (SurfacePtr->surface) { - case -32: - break; + case -32: + break; //case 6: // water. We allow to walk on water in Rio a little bit. Then he drowns - case 9: // water with fade out - default: - diff = -1; - break; + case 9: // water with fade out + default: + diff = -1; + break; } } } @@ -2688,14 +2675,14 @@ void ProcessTannerPad(LPPEDESTRIAN pPed, u_int pad, char PadSteer, char use_anal // attempt to push a button switch (pPed->type) { - case PED_ACTION_GETINCAR: - case PED_ACTION_GETOUTCAR: - // do not attempt - break; - default: - // hey, wait -- TANNER! - SetupPressButton(pPed); - break; + case PED_ACTION_GETINCAR: + case PED_ACTION_GETOUTCAR: + // do not attempt + break; + default: + // hey, wait -- TANNER! + SetupPressButton(pPed); + break; } } else @@ -2704,36 +2691,36 @@ void ProcessTannerPad(LPPEDESTRIAN pPed, u_int pad, char PadSteer, char use_anal // attempt to get into a car switch (pPed->type) { - case PED_ACTION_GETINCAR: - case PED_ACTION_GETOUTCAR: - // do not attempt - break; - default: - // enter the nearest car if possible - if (!gCantDrive) - { - DeActivatePlayerPedestrian(pPed); + case PED_ACTION_GETINCAR: + case PED_ACTION_GETOUTCAR: + // do not attempt break; - } + default: + // enter the nearest car if possible + if (!gCantDrive) + { + DeActivatePlayerPedestrian(pPed); + break; + } - break; + break; } // attempt to sit down switch (pPed->type) { - case PED_ACTION_GETINCAR: - case PED_ACTION_GETOUTCAR: - case PED_ACTION_SIT: - // do not attempt - break; - default: - // sit his ass down - if (FindTannerASeat(pPed) != NULL) - { - SetupTannerSitDown(pPed); + case PED_ACTION_GETINCAR: + case PED_ACTION_GETOUTCAR: + case PED_ACTION_SIT: + // do not attempt break; - } + default: + // sit his ass down + if (FindTannerASeat(pPed) != NULL) + { + SetupTannerSitDown(pPed); + break; + } } } } @@ -2759,7 +2746,7 @@ void ProcessTannerPad(LPPEDESTRIAN pPed, u_int pad, char PadSteer, char use_anal TannerCollision(pPed); // chicago bridge slope - if (GameLevel == 0) + if (GameLevel == LEVEL_CHICAGO) { FindSurfaceD2((VECTOR*)lcp->pos, &normal, &out, &plane); @@ -2772,7 +2759,6 @@ void ProcessTannerPad(LPPEDESTRIAN pPed, u_int pad, char PadSteer, char use_anal } } - // [D] [T] int ActivatePlayerPedestrian(CAR_DATA* pCar, char* padId, int direction, LONGVECTOR4* position, PED_MODEL_TYPES playerType) { @@ -2848,7 +2834,7 @@ int ActivatePlayerPedestrian(CAR_DATA* pCar, char* padId, int direction, LONGVEC if (pCar != NULL) { - if (QuickBuildingCollisionCheck(&v, dir, 10, 10, 10) || + if (QuickBuildingCollisionCheck(&v, dir, 10, 10, 10) || TannerCarCollisionCheck(&v, d, 1)) { side = 1; @@ -2860,7 +2846,7 @@ int ActivatePlayerPedestrian(CAR_DATA* pCar, char* padId, int direction, LONGVEC if (QuickBuildingCollisionCheck(&v, dir, 10, 10, 10)) return 0; - + if (TannerCarCollisionCheck(&v, d, 1)) return 0; } @@ -2943,7 +2929,7 @@ int ActivatePlayerPedestrian(CAR_DATA* pCar, char* padId, int direction, LONGVEC { int rnd1 = Random2(0); int rnd2 = Random2(0); - + pedptr->pallet = rnd1 - rnd1 / 3 * 3 + (rnd2 - rnd2 / 3 * 3) * 16; } } diff --git a/src_rebuild/Game/C/pedest.h b/src_rebuild/Game/C/pedest.h index b0d3af7e9..b8727b174 100644 --- a/src_rebuild/Game/C/pedest.h +++ b/src_rebuild/Game/C/pedest.h @@ -79,4 +79,4 @@ extern CAR_DATA* CheckForCar(LPPEDESTRIAN pedestrian); // 0x00072738 extern void CalculatePedestrianInterest(LPPEDESTRIAN pPed); // 0x00071E0C -#endif +#endif // PEDEST_H diff --git a/src_rebuild/Game/C/players.c b/src_rebuild/Game/C/players.c index 1ef118c0f..48e700296 100644 --- a/src_rebuild/Game/C/players.c +++ b/src_rebuild/Game/C/players.c @@ -32,9 +32,9 @@ void InitPlayer(PLAYER *locPlayer, CAR_DATA *cp, char carCtrlType, int direction { model = 0xFF; - if (MissionHeader->residentModels[0] == playerType) + if (MissionHeader->residentModels[0] == playerType) model = 0; - else if(MissionHeader->residentModels[1] == playerType) + else if (MissionHeader->residentModels[1] == playerType) model = 1; else if (MissionHeader->residentModels[2] == playerType) model = 2; @@ -48,7 +48,7 @@ void InitPlayer(PLAYER *locPlayer, CAR_DATA *cp, char carCtrlType, int direction ResetTyreTracks(cp, playerId); cp->controlFlags |= CONTROL_FLAG_WAS_PARKED | CONTROL_FLAG_PLAYER_START_CAR; // [A] car is owned by player - + locPlayer->worldCentreCarId = cp->id; locPlayer->cameraView = 0;// (NumPlayers == 2) << 1; // [A] locPlayer->playerCarId = cp->id; @@ -56,10 +56,10 @@ void InitPlayer(PLAYER *locPlayer, CAR_DATA *cp, char carCtrlType, int direction locPlayer->spoolXZ = (VECTOR *)cp->hd.where.t; locPlayer->cameraCarId = cp->id; locPlayer->car_is_sounding = 0; - + locPlayer->pos[1] = cp->hd.where.t[1]; } - else + else { LPPEDESTRIAN pPlayerPed; ActivatePlayerPedestrian(NULL, padid, direction, startPos, (PED_MODEL_TYPES)playerType); @@ -71,7 +71,7 @@ void InitPlayer(PLAYER *locPlayer, CAR_DATA *cp, char carCtrlType, int direction locPlayer->playerCarId = -1; locPlayer->car_is_sounding = 2; locPlayer->cameraView = 0; - + locPlayer->pos[1] = -pPlayerPed->position.vy; } @@ -97,7 +97,7 @@ void ChangeCarPlayerToPed(int playerID) { PLAYER* locPlayer; CAR_DATA* lcp; - + locPlayer = &player[playerID]; lcp = &car_data[locPlayer->playerCarId]; @@ -169,8 +169,8 @@ void ChangePedPlayerToCar(int playerID, CAR_DATA *newCar) lPlayer = &player[playerID]; - if (newCar->controlType == CONTROL_TYPE_CIV_AI && - newCar->ai.c.thrustState == 3 && (newCar->ai.c.ctrlState == 7 || newCar->ai.c.ctrlState == 5) || + if (newCar->controlType == CONTROL_TYPE_CIV_AI && + newCar->ai.c.thrustState == 3 && (newCar->ai.c.ctrlState == 7 || newCar->ai.c.ctrlState == 5) || newCar->controlType == CONTROL_TYPE_CUTSCENE) { carParked = 1; @@ -203,13 +203,13 @@ void ChangePedPlayerToCar(int playerID, CAR_DATA *newCar) lPlayer->pPed = NULL; // only allow non-cutscene players to get into cars - if(lPlayer->padid >= 0) + if (lPlayer->padid >= 0) { newCar->controlType = CONTROL_TYPE_PLAYER; newCar->ai.padid = &lPlayer->padid; newCar->hndType = 0; - if (playerID == 0 + if (playerID == 0 #if ENABLE_GAME_FIXES && !(newCar->controlFlags & CONTROL_FLAG_PLAYER_START_CAR) // [A] bug fix: don't give felony if player owns his cop car #endif @@ -318,8 +318,3 @@ void MakeTheCarShutUp(char player_id) player[player_id].car_is_sounding = 1; player[player_id].car_sound_timer = -1; } - - - - - diff --git a/src_rebuild/Game/C/players.h b/src_rebuild/Game/C/players.h index b418cbe78..2ff23fb19 100644 --- a/src_rebuild/Game/C/players.h +++ b/src_rebuild/Game/C/players.h @@ -15,5 +15,4 @@ extern void HaveCarSoundStraightAway(char player_id); // 0x00073C54 extern void MakeTheCarShutUp(char player_id); // 0x00073C8C - -#endif +#endif // PLAYERS_H diff --git a/src_rebuild/Game/C/pres.c b/src_rebuild/Game/C/pres.c index d266cc840..f81fe7f6c 100644 --- a/src_rebuild/Game/C/pres.c +++ b/src_rebuild/Game/C/pres.c @@ -32,7 +32,7 @@ void InitHiresFonts() u_char* data; // init digits - if(!gHiresDigitsTexture) + if (!gHiresDigitsTexture) { int width, height, bpp; @@ -51,7 +51,7 @@ void InitHiresFonts() } // init font2 - if(!gHiresFontTexture) + if (!gHiresFontTexture) { gHiresFontRangeCount = 0; @@ -63,7 +63,7 @@ void InitHiresFonts() FS_FixPathSlashes(namebuffer); fp = fopen(namebuffer, "rb"); - if (fp) + if (fp) { int i; @@ -109,7 +109,7 @@ void SetHiresFontTexture(int enabled) else SetPsyXTexture(tex, 0, 0, 0); - if (gShowMap == 0) + if (gShowMap == 0) { addPrim(current->ot, tex); current->primptr += sizeof(DR_PSYX_TEX); @@ -187,6 +187,7 @@ int StrighWidthHires(char* string) GetHiresBakedQuad(chr, &fx, &fy, &q); width += fx; } + return width; } @@ -210,7 +211,7 @@ int PrintStringHires(char* string, int x, int y) { if (chr >= 128 && chr <= 138) { - if(showMap) + if (showMap) SetHiresFontTexture(0); else SetHiresFontTexture(1); @@ -280,7 +281,7 @@ int PrintStringHires(char* string, int x, int y) } SetHiresFontTexture(showMap == 0); - if(showMap) + if (showMap) DrawSync(0); return width; @@ -384,18 +385,18 @@ int StringWidth(char *pString) int w; w = 0; - + while (true) { let = *pString++; if (!let) break; - + if (let == 32) w += 4; - else if ((let + 128 & 0xff) < 11) + else if ((let + 128 & 0xff) < 11) w += 24; - else if (AsciiTable[let] != -1) + else if (AsciiTable[let] != -1) w += fontinfo[AsciiTable[let]].width; } @@ -409,7 +410,7 @@ int OutputString(char *pString, int formatting, int x, int y, int xw, int r, int SetTextColour(r, g, b); - if (formatting & 1) + if (formatting & 1) { PrintString(pString, x, y); } @@ -418,7 +419,7 @@ int OutputString(char *pString, int formatting, int x, int y, int xw, int r, int xpos = (xw - StringWidth(pString)) / 2; PrintString(pString, x + xpos, y); } - else if (formatting & 4) + else if (formatting & 4) { PrintString(pString, x - StringWidth(pString), y); } @@ -451,7 +452,7 @@ void LoadFont(char *buffer) fontclutpos.y = 256; fontclutpos.w = 16; fontclutpos.h = 1; - + if (buffer != NULL) file = buffer; else @@ -483,7 +484,7 @@ void LoadFont(char *buffer) setRECT(&dest, 960, 466, 64, 46); - fonttpage = GetTPage(0,0, dest.x, dest.y); + fonttpage = GetTPage(0, 0, dest.x, dest.y); LoadImage(&fontclutpos, (u_long*)clut); // upload clut LoadImage(&dest, (u_long*)(file + 32)); // upload font image @@ -524,20 +525,20 @@ void SetCLUT16Flags(ushort clutID, ushort mask, char transparent) pCurrent = buffer; ctr = 1; - while (pCurrent < &buffer[16]) + while (pCurrent < &buffer[16]) { - if ((mask >> ctr) & 1 != 0) + if ((mask >> ctr) & 1 != 0) *pCurrent |= 0x8000; else *pCurrent &= ~0x8000; buffer[transparent] = 0; - + pCurrent++; ctr++; } - LoadClut2((u_long*)buffer, x,y); + LoadClut2((u_long*)buffer, x, y); } // [D] [T] @@ -561,7 +562,7 @@ int PrintString(char *string, int x, int y) #endif font = (SPRT *)current->primptr; - + if (showMap != 0) { font = (SPRT*)SetFontTPage(font); @@ -577,7 +578,7 @@ int PrintString(char *string, int x, int y) continue; } - if (chr < 32 || chr > 138 || chr < 128) + if (chr < 32 || chr > 138 || chr < 128) { if (AsciiTable[chr] == -1) index = AsciiTable[63]; // place a question mark @@ -590,22 +591,22 @@ int PrintString(char *string, int x, int y) font->r0 = gFontColour.r; font->g0 = gFontColour.g; font->b0 = gFontColour.b; - + font->x0 = width; font->y0 = fontinfo[index].offy + y; font->u0 = fontinfo[index].x; font->v0 = fontinfo[index].y - 46; - + font->w = fontinfo[index].width; font->h = fontinfo[index].height; - + font->clut = fontclutid; if (showMap == 0) { addPrim(current->ot, font); } - else + else { DrawPrim(font); } @@ -662,24 +663,24 @@ short PrintDigit(int x, int y, char *string) { if (chr == 58) index = 11; - else if (chr == 47) + else if (chr == 47) index = 10; - else + else index = chr - 48 & 0xff; pDigit = &fontDigit[index]; - - if (chr == 58) + + if (chr == 58) fixedWidth = 8; else fixedWidth = 16; - if (index < 6) + if (index < 6) { vOff = 0; h = 28; } - else + else { vOff = 28; h = 31; @@ -694,9 +695,9 @@ short PrintDigit(int x, int y, char *string) font->x0 = width + (fixedWidth - pDigit->width) / 2; font->y0 = y; - + #ifdef HIRES_FONTS - if (gHiresDigitsTexture) + if (gHiresDigitsTexture) { font->u0 = pDigit->xOffset; font->v0 = vOff; @@ -714,7 +715,7 @@ short PrintDigit(int x, int y, char *string) font->clut = digit_texture.clutid; addPrim(current->ot, font); - + width += fixedWidth; font++; @@ -733,7 +734,7 @@ short PrintDigit(int x, int y, char *string) null->x2 = -1; null->y2 = -1; null->tpage = digit_texture.tpageid; - + addPrim(current->ot, null); current->primptr += sizeof(POLY_FT3); @@ -772,7 +773,7 @@ void PrintStringBoxed(char *string, int ix, int iy) font = (SPRT *)current->primptr; wordcount = 1; - + x = ix; y = iy; @@ -789,10 +790,10 @@ void PrintStringBoxed(char *string, int ix, int iy) wpt = word; u_char c = 0; - - while ((c = *wpt++) != 0) + + while ((c = *wpt++) != 0) { - if (c == ' ') + if (c == ' ') { x += 4; continue; @@ -800,7 +801,7 @@ void PrintStringBoxed(char *string, int ix, int iy) index = AsciiTable[c]; - if (index != -1) + if (index != -1) { OUT_FONTINFO *pFontInfo = &fontinfo[index]; @@ -810,7 +811,7 @@ void PrintStringBoxed(char *string, int ix, int iy) setXY0(font, x, y + pFontInfo->offy); setUV0(font, pFontInfo->x, pFontInfo->y - 46); setWH(font, pFontInfo->width, pFontInfo->height); - + font->clut = fontclutid; addPrim(current->ot, font); @@ -988,7 +989,7 @@ void* DrawButton(u_char button, void *prim, int x, int y) btn = &button_textures[button - 128]; sprt = (SPRT*)prim; - + setSprt(sprt); sprt->r0 = 128; @@ -1019,7 +1020,7 @@ void* DrawButton(u_char button, void *prim, int x, int y) addPrim(current->ot, sprt); addPrim(current->ot, null); } - else + else { DrawPrim(null); DrawPrim(sprt); @@ -1044,19 +1045,14 @@ void* SetFontTPage(void *prim) null->y2 = -1; null->tpage = fonttpage; - if (gShowMap == 0) + if (gShowMap == 0) { addPrim(current->ot, null); } - else + else { DrawPrim(prim); } return null+1; } - - - - - diff --git a/src_rebuild/Game/C/pres.h b/src_rebuild/Game/C/pres.h index 4c95890f6..c42ea665b 100644 --- a/src_rebuild/Game/C/pres.h +++ b/src_rebuild/Game/C/pres.h @@ -35,5 +35,4 @@ extern void* DrawButton(u_char button, void *prim, int x, int y); // 0x00074858 extern void* SetFontTPage(void *prim); // 0x00074D94 - -#endif +#endif // PRES_H diff --git a/src_rebuild/Game/C/replays.c b/src_rebuild/Game/C/replays.c index 247f76b57..5c5139f47 100644 --- a/src_rebuild/Game/C/replays.c +++ b/src_rebuild/Game/C/replays.c @@ -12,7 +12,7 @@ #include "civ_ai.h" #include "cutrecorder.h" -char AnalogueUnpack[16] = { +char AnalogueUnpack[16] = { 0, -51, -63, -75, -87, -99, -111, -123, 0, 51, 63, 75, 87, 99, 111, 123 }; @@ -55,7 +55,7 @@ void InitPadRecording(void) gOutOfTape = 0; - if (gLoadedReplay == 0 && + if (gLoadedReplay == 0 && CurrentGameMode != GAMEMODE_REPLAY && CurrentGameMode != GAMEMODE_DIRECTOR) { @@ -89,7 +89,7 @@ void InitPadRecording(void) { // reset stream count as cutscene/chase can increase it NumReplayStreams = NumPlayers; - + for (i = 0; i < NumReplayStreams; i++) { ReplayStreams[i].playbackrun = 0; @@ -105,7 +105,6 @@ void InitPadRecording(void) InitInGameCutsceneVariables(); } - // [D] [T] int SaveReplayToBuffer(char *buffer) { @@ -124,11 +123,11 @@ int SaveReplayToBuffer(char *buffer) header->GameType = GameType; header->MissionNumber = gCurrentMissionNumber; - header->NumReplayStreams = NumReplayStreams - NumCutsceneStreams; + header->NumReplayStreams = NumReplayStreams - NumCutsceneStreams; header->NumPlayers = NumPlayers; header->CutsceneEvent = -1; header->RandomChase = gRandomChase; - + header->gCopDifficultyLevel = gCopDifficultyLevel; header->ActiveCheats = ActiveCheats; @@ -225,12 +224,12 @@ int LoadReplayFromBuffer(char *buffer) pt += sizeof(REPLAY_STREAM_HEADER); REPLAY_STREAM* destStream = &ReplayStreams[i]; - + // copy source type destStream->SourceType = sheader->SourceType; int size = (sheader->Size + sizeof(PADRECORD)) & -4; - + // init buffers destStream->InitialPadRecordBuffer = (PADRECORD*)replayptr; destStream->PadRecordBuffer = (PADRECORD*)replayptr; @@ -257,7 +256,7 @@ int LoadReplayFromBuffer(char *buffer) PlayerWayRecordPtr = (SXYPAIR *)(ReplayParameterPtr + 1); memcpy((u_char*)PlayerWayRecordPtr, (u_char*)pt, sizeof(SXYPAIR) * MAX_REPLAY_WAYPOINTS); pt += sizeof(SXYPAIR) * MAX_REPLAY_WAYPOINTS; - + PlaybackCamera = (PLAYBACKCAMERA *)(PlayerWayRecordPtr + MAX_REPLAY_WAYPOINTS); memcpy((u_char*)PlaybackCamera, (u_char*)pt, sizeof(PLAYBACKCAMERA) * MAX_REPLAY_CAMERAS); pt += sizeof(PLAYBACKCAMERA) * MAX_REPLAY_CAMERAS; @@ -305,11 +304,11 @@ char GetPingInfo(char *cookieCount) if (PingBuffer && PingBufferPos < MAX_REPLAY_PINGS) { pp = &PingBuffer[PingBufferPos]; - + // accept only valid car pings if (pp->frame != 0xFFFF) { - if (CameraCnt - frameStart < pp->frame) + if (CameraCnt - frameStart < pp->frame) return -1; retCarId = pp->carId; @@ -327,7 +326,7 @@ int IsPingInfoAvailable() { if (!_CutRec_IsPlaying() && (gUseStoredPings == 0 || gInGameChaseActive == 0))// && gLoadedReplay == 0) return 0; - + return PingBuffer != NULL && PingBufferPos < MAX_REPLAY_PINGS; } @@ -341,8 +340,8 @@ int valid_region(int x, int z) region_coords.x = (x >> 16) + regions_across / 2; region_coords.y = (z >> 16) + regions_down / 2; - if (region_coords.x >= 0 && region_coords.x <= regions_across && - region_coords.y >= 0 && region_coords.y <= regions_down) + if (region_coords.x >= 0 && region_coords.x <= regions_across && + region_coords.y >= 0 && region_coords.y <= regions_down) { region = region_coords.x + region_coords.y * regions_across; @@ -459,12 +458,12 @@ int cjpPlay(int stream, u_int *ppad, char *psteer, char *ptype) *ppad = t0 & 0xF0FC; - if (t1 == 0) + if (t1 == 0) { *psteer = 0; *ptype = 0; } - else + else { *psteer = AnalogueUnpack[t1]; *ptype = 4; @@ -480,17 +479,17 @@ void cjpRecord(int stream, u_int *ppad, char *psteer, char *ptype) int t1; u_int t0; - if (stream > -1 && stream < NumReplayStreams) + if (stream > -1 && stream < NumReplayStreams) { RecordWaypoint(); - if ((*ptype & 4U) == 0) + if ((*ptype & 4U) == 0) { t1 = 0; } - else + else { - if (*psteer < -45) + if (*psteer < -45) { tmp = -45 - *psteer >> 0x1f; // [A] still need to figure out this t1 = (((-45 - *psteer) / 6 + tmp >> 1) - tmp) + 1; @@ -512,7 +511,7 @@ void cjpRecord(int stream, u_int *ppad, char *psteer, char *ptype) { gOutOfTape = 1; } - else if(NoPlayerControl == 0) + else if (NoPlayerControl == 0) { ClearCameras = 1; @@ -525,12 +524,12 @@ void cjpRecord(int stream, u_int *ppad, char *psteer, char *ptype) t1 = (t0 >> 8) & 0xF; - if (t1 == 0) + if (t1 == 0) { *psteer = 0; *ptype = 0; } - else + else { *psteer = AnalogueUnpack[t1]; *ptype = 4; diff --git a/src_rebuild/Game/C/replays.h b/src_rebuild/Game/C/replays.h index 15b91bcc7..fad666e01 100644 --- a/src_rebuild/Game/C/replays.h +++ b/src_rebuild/Game/C/replays.h @@ -37,5 +37,4 @@ extern void cjpRecord(int stream, u_int*ppad, char *psteer, char *ptype); // 0x0 extern void AllocateReplayStream(REPLAY_STREAM *stream, int maxpad); // 0x0001B17C extern void RecordWaypoint(); // 0x0001B364 - -#endif +#endif // REPLAYS_H diff --git a/src_rebuild/Game/C/roadbits.c b/src_rebuild/Game/C/roadbits.c index f966aab4e..3b89b03e5 100644 --- a/src_rebuild/Game/C/roadbits.c +++ b/src_rebuild/Game/C/roadbits.c @@ -7,8 +7,3 @@ char ROADS_GetRouteData(int x, int z, ROUTE_DATA *pRouteData) pRouteData->type = 0; return 1; } - - - - - diff --git a/src_rebuild/Game/C/roadbits.h b/src_rebuild/Game/C/roadbits.h index 7db80f678..8d57925c6 100644 --- a/src_rebuild/Game/C/roadbits.h +++ b/src_rebuild/Game/C/roadbits.h @@ -1,8 +1,6 @@ #ifndef ROADBITS_H #define ROADBITS_H - extern char ROADS_GetRouteData(int x, int z, ROUTE_DATA *pRouteData); // 0x00074EB4 - -#endif +#endif // ROADBITS_H diff --git a/src_rebuild/Game/C/scores.c b/src_rebuild/Game/C/scores.c index f8e3490c8..346a00b25 100644 --- a/src_rebuild/Game/C/scores.c +++ b/src_rebuild/Game/C/scores.c @@ -37,7 +37,6 @@ void InitialiseScoreTables(void) strcpy(gPlayerScore.name, "Mr.X"); } - // [D] [T] void AddScoreToTable(SCORE_ENTRY *table, int entry) { @@ -68,7 +67,7 @@ int CheckGetawayPlacing(SCORE_ENTRY *table) int i; i = 0; - while (gPlayerScore.time == -1 || table->time != -1 && table->time <= gPlayerScore.time) + while (gPlayerScore.time == -1 || table->time != -1 && table->time <= gPlayerScore.time) { i++; table++; @@ -86,18 +85,16 @@ int CheckTrailblazerPlacing(SCORE_ENTRY *table) int i; i = 0; - do { - if (gPlayerScore.items == -1) + if (gPlayerScore.items == -1) { - if (gPlayerScore.time != -1) + if (gPlayerScore.time != -1) { - if (table->time == -1) + if (table->time == -1) return i; if (table->time < gPlayerScore.time) return i; - } } else if (table->items == -1 || table->items < gPlayerScore.items) @@ -120,7 +117,7 @@ int CheckCheckpointPlacing(SCORE_ENTRY *table) int i; i = 0; - while (gPlayerScore.time == -1 || table->time != -1 && table->time <= gPlayerScore.time) + while (gPlayerScore.time == -1 || table->time != -1 && table->time <= gPlayerScore.time) { i++; table++; @@ -128,6 +125,7 @@ int CheckCheckpointPlacing(SCORE_ENTRY *table) if (i > 4) return -1; } + return i; } @@ -137,13 +135,15 @@ int CheckSurvivalPlacing(SCORE_ENTRY *table) int i; i = 0; - while (gPlayerScore.time == -1 || table->time != -1 && gPlayerScore.time <= table->time) + while (gPlayerScore.time == -1 || table->time != -1 && gPlayerScore.time <= table->time) { i++; table++; - if (i > 4) + + if (i > 4) return -1; } + return i; } @@ -155,28 +155,28 @@ int OnScoreTable(SCORE_ENTRY **tablept) switch (GameType) { - case GAME_GETAWAY: - table = ScoreTables.GetawayTable[GameLevel][gSubGameNumber]; - position = CheckGetawayPlacing(table); - break; - case GAME_GATERACE: - table = ScoreTables.GateRaceTable[GameLevel][gSubGameNumber]; - position = CheckTrailblazerPlacing(table); - break; - case GAME_CHECKPOINT: - table = ScoreTables.CheckpointTable[GameLevel][gSubGameNumber]; - position = CheckCheckpointPlacing(table); - break; - case GAME_TRAILBLAZER: - table = ScoreTables.TrailblazerTable[GameLevel][gSubGameNumber]; - position = CheckTrailblazerPlacing(table); - break; - case GAME_SURVIVAL: - table = ScoreTables.SurvivalTable[GameLevel][gSubGameNumber]; - position = CheckSurvivalPlacing(table); - break; - default: - return -1; + case GAME_GETAWAY: + table = ScoreTables.GetawayTable[GameLevel][gSubGameNumber]; + position = CheckGetawayPlacing(table); + break; + case GAME_GATERACE: + table = ScoreTables.GateRaceTable[GameLevel][gSubGameNumber]; + position = CheckTrailblazerPlacing(table); + break; + case GAME_CHECKPOINT: + table = ScoreTables.CheckpointTable[GameLevel][gSubGameNumber]; + position = CheckCheckpointPlacing(table); + break; + case GAME_TRAILBLAZER: + table = ScoreTables.TrailblazerTable[GameLevel][gSubGameNumber]; + position = CheckTrailblazerPlacing(table); + break; + case GAME_SURVIVAL: + table = ScoreTables.SurvivalTable[GameLevel][gSubGameNumber]; + position = CheckSurvivalPlacing(table); + break; + default: + return -1; } if (tablept != NULL) @@ -200,8 +200,3 @@ void ResetTable(SCORE_ENTRY *table) i++; } } - - - - - diff --git a/src_rebuild/Game/C/scores.h b/src_rebuild/Game/C/scores.h index 3615c9742..d4a4707f2 100644 --- a/src_rebuild/Game/C/scores.h +++ b/src_rebuild/Game/C/scores.h @@ -11,5 +11,4 @@ extern int OnScoreTable(SCORE_ENTRY **tablept); // 0x0007503C extern void AddScoreToTable(SCORE_ENTRY *table, int entry); // 0x000751F8 extern void ResetTable(SCORE_ENTRY *table); // 0x000753D8 - -#endif +#endif // SCORES_H diff --git a/src_rebuild/Game/C/search.c b/src_rebuild/Game/C/search.c index 3b38f178b..81232159b 100644 --- a/src_rebuild/Game/C/search.c +++ b/src_rebuild/Game/C/search.c @@ -5,8 +5,3 @@ void InitTextureNames(void) { return; } - - - - - diff --git a/src_rebuild/Game/C/search.h b/src_rebuild/Game/C/search.h index e369a58bb..5013c9290 100644 --- a/src_rebuild/Game/C/search.h +++ b/src_rebuild/Game/C/search.h @@ -3,4 +3,4 @@ extern void InitTextureNames(); // 0x0001BA88 -#endif +#endif // SEARCH_H diff --git a/src_rebuild/Game/C/shadow.c b/src_rebuild/Game/C/shadow.c index 66336ec0f..f4587e0a7 100644 --- a/src_rebuild/Game/C/shadow.c +++ b/src_rebuild/Game/C/shadow.c @@ -45,6 +45,7 @@ TYRE_TRACK track_buffer[MAX_TYRE_TRACK_PLAYERS][MAX_TYRE_TRACK_WHEELS][64]; void InitTyreTracks(void) { int i; + for (i = 0; i < MAX_TYRE_TRACK_PLAYERS; i++) { ClearMem((char*)num_tyre_tracks[i], sizeof(num_tyre_tracks[0])); @@ -82,7 +83,7 @@ void GetTyreTrackPositions(CAR_DATA *cp, int player_id) for (loop = (2 / MAX_TYRE_TRACK_WHEELS); loop < 4; loop += (4 / MAX_TYRE_TRACK_WHEELS), track++) { WheelPos.vx = car_cos->wheelDisp[loop].vx; - if (loop & 2) + if (loop & 2) WheelPos.vx += 17; else WheelPos.vx -= 17; @@ -102,7 +103,6 @@ void GetTyreTrackPositions(CAR_DATA *cp, int player_id) } } - // [D] [T] void SetTyreTrackOldPositions(int player_id) { @@ -129,14 +129,13 @@ void AddTyreTrack(int wheel, int tracksAndSmoke, int player_id, int continuous_t newtp = &tyre_new_positions[player_id][wheel]; // [A] disabled due to MP and SP bugs - /* - if (newtp->vx - camera_position.vx + 20480 > 40960) + /*if (newtp->vx - camera_position.vx + 20480 > 40960) return; if (newtp->vz - camera_position.vz + 20480 > 40960) return;*/ - if (tracksAndSmoke != 0) + if (tracksAndSmoke != 0) { oldtp = &tyre_save_positions[player_id][wheel]; @@ -145,7 +144,7 @@ void AddTyreTrack(int wheel, int tracksAndSmoke, int player_id, int continuous_t SurfaceDataPtr = sdGetCell(newtp); // check surface type - if (SurfaceDataPtr != NULL) + if (SurfaceDataPtr != NULL) { if (SurfaceDataPtr->surface == SURF_WATER) return; @@ -160,7 +159,7 @@ void AddTyreTrack(int wheel, int tracksAndSmoke, int player_id, int continuous_t tt_p->surface = 1; } } - else + else { tt_p->surface = 1; } @@ -178,7 +177,7 @@ void AddTyreTrack(int wheel, int tracksAndSmoke, int player_id, int continuous_t if (SurfaceDataPtr->surface == SURF_GRASS) trackSurface = 2; } - + SmokePosition.vx = newtp->vx; SmokePosition.vz = newtp->vz; SmokePosition.vy = -50 - newtp->vy; @@ -188,7 +187,7 @@ void AddTyreTrack(int wheel, int tracksAndSmoke, int player_id, int continuous_t { GetSmokeDrift(&SmokeDrift); - if (trackSurface == 2) + if (trackSurface == 2) { grass_vector.vx = 0; grass_vector.vy = 50; @@ -198,7 +197,7 @@ void AddTyreTrack(int wheel, int tracksAndSmoke, int player_id, int continuous_t Setup_Smoke(&SmokePosition, 50, 500, SMOKE_BROWN, 0, &SmokeDrift, 0); Setup_Sparks(&SmokePosition, &grass_vector, 5, 2); } - else if (wetness == 0) + else if (wetness == 0) { Setup_Smoke(&SmokePosition, 50, 500, SMOKE_WHITE, 0, &SmokeDrift, 0); } @@ -212,7 +211,7 @@ void AddTyreTrack(int wheel, int tracksAndSmoke, int player_id, int continuous_t x = FixHalfRound(RSIN(dir) * 35, 13); z = FixHalfRound(RCOS(dir) * 35, 13); - + New1.vy = oldtp->vy + 10; New3.vy = newtp->vy + 10; New2.vx = oldtp->vx; @@ -233,7 +232,7 @@ void AddTyreTrack(int wheel, int tracksAndSmoke, int player_id, int continuous_t tyre_track_offset[player_id][wheel]++; tyre_track_offset[player_id][wheel] &= 63; } - else + else { num_tyre_tracks[player_id][wheel]++; } @@ -248,15 +247,15 @@ void AddTyreTrack(int wheel, int tracksAndSmoke, int player_id, int continuous_t tt_p->p1.vx = New1.vx; tt_p->p1.vy = New1.vy; tt_p->p1.vz = New1.vz; - + tt_p->p2.vx = New2.vx; tt_p->p2.vy = New1.vy; tt_p->p2.vz = New2.vz; - + tt_p->p3.vx = New3.vx; tt_p->p3.vy = New3.vy; tt_p->p3.vz = New3.vz; - + tt_p->p4.vx = New4.vx; tt_p->p4.vy = New3.vy; tt_p->p4.vz = New4.vz; @@ -394,7 +393,6 @@ void DrawTyreTracks(void) } } } - } // [D] [T] [A] now better shadow code @@ -417,7 +415,7 @@ void InitShadow(void) shadowuv.v3 = texinf->y + texinf->height - 1; shadowuv.v0 = texinf->y; - if (GameLevel == 3) + if (GameLevel == LEVEL_RIO) { shadowuv.v1 += 1; shadowuv.v0 += 1; @@ -438,7 +436,7 @@ void InitShadow(void) *(ushort*)&shadowpoly.uv3 = *(ushort*)&shadowuv.u2; } -// [D] [A] - this is a fuckery +// [D] [A] this is a fuckery void SubdivShadow(int z0, int z1, int z2, int z3, POLY_FT4 *sps) { // [A] we already have better car shadow code. This is UNUSED anyway @@ -452,12 +450,11 @@ void SubdivShadow(int z0, int z1, int z2, int z3, POLY_FT4 *sps) addPrim(current->ot + (z0 * 2 + z3 * 6 >> 6), spd); } - extern VECTOR dummy; // [D] [T] [A] better shadow code void PlaceShadowForCar(VECTOR *shadowPoints, int subdiv, int zOfs, int flag) -{ +{ MVERTEX subdivVerts[5][5]; SVECTOR points[4]; @@ -515,7 +512,7 @@ static int numcv; static int lastcv; static SVECTOR cv[12]; -// [D] - refactored - NOT TESTED YET +// [D] refactored - NOT TESTED YET int clipAgainstZ(void) { SVECTOR *curr; @@ -539,7 +536,7 @@ int clipAgainstZ(void) do { - if (srccount < 0) + if (srccount < 0) { numcv = dstcount; lastcv = lastcv + 2; @@ -551,10 +548,10 @@ int clipAgainstZ(void) if (curr->vz > 0) flags |= 2; - if (flags == 1) + if (flags == 1) { d = prev->vz - curr->vz; - + dst->vx = (curr->vx * prev->vz - prev->vx * curr->vz) / d; dst->vy = (curr->vy * prev->vz - prev->vy * curr->vz) / d; dst->pad = (curr->pad * prev->vz - prev->pad * curr->vz) / d; @@ -599,9 +596,8 @@ int clipAgainstZ(void) } while (true); } - // decompiled code -// original method signature: +// original method signature: // void /*$ra*/ clippedPoly() // line 1081, offset 0x00076cd4 /* begin block 1 */ @@ -787,13 +783,12 @@ void clippedPoly(void) return;*/ } - // [D] [T] void sQuad(SVECTOR *v0, SVECTOR *v1, SVECTOR *v2, SVECTOR *v3, CVECTOR* light_col, int LightSortCorrect) { int z1; int z[4]; - + POLY_G4 *poly; poly = (POLY_G4*)current->primptr; @@ -861,12 +856,12 @@ void sQuad(SVECTOR *v0, SVECTOR *v1, SVECTOR *v2, SVECTOR *v3, CVECTOR* light_co gte_stsxy(&poly->x3); gte_stsz(&z[3]); - + z1 = (z[0] + z[1] + z[2] + z[3] >> 2) + LightSortCorrect; if (z1 < 0) z1 = 0; - + z1 >>= 3; addPrim(current->ot + z1, poly); @@ -887,8 +882,3 @@ void sQuad(SVECTOR *v0, SVECTOR *v1, SVECTOR *v2, SVECTOR *v3, CVECTOR* light_co current->primptr += sizeof(POLY_FT3); } } - - - - - diff --git a/src_rebuild/Game/C/shadow.h b/src_rebuild/Game/C/shadow.h index e0cbf4cb9..41863aaa3 100644 --- a/src_rebuild/Game/C/shadow.h +++ b/src_rebuild/Game/C/shadow.h @@ -15,11 +15,9 @@ extern void SetTyreTrackOldPositions(int player_id); // 0x00077558 extern void AddTyreTrack(int wheel, int tracksAndSmoke, int player_id, int continuous_track); // 0x00075540 extern void DrawTyreTracks(); // 0x000759E0 - extern void SubdivShadow(int z0, int z1, int z2, int z3, POLY_FT4 *sps); // 0x00076108 extern void PlaceShadowForCar(VECTOR *shadowPoints, int subdiv, int zOfs, int flag); // 0x000766CC extern void sQuad(SVECTOR *v0, SVECTOR *v1, SVECTOR *v2, SVECTOR *v3, CVECTOR* light_col, int LightSortCorrect); // 0x00077138 - -#endif +#endif // SHADOW_H diff --git a/src_rebuild/Game/C/sky.c b/src_rebuild/Game/C/sky.c index 4ed0c087f..ea7d91c37 100644 --- a/src_rebuild/Game/C/sky.c +++ b/src_rebuild/Game/C/sky.c @@ -25,10 +25,10 @@ struct FLAREREC int sky_y_offset[4] = { -17, -17, -17, -17 }; unsigned char HorizonLookup[4][4] = { - {0, 0, 20, 20}, - {20, 20, 0, 0}, - {0, 0, 20, 20}, - {0, 0, 20, 20}, + { 0, 0, 20, 20 }, + { 20, 20, 0, 0 }, + { 0, 0, 20, 20 }, + { 0, 0, 20, 20 } }; unsigned char HorizonTextures[40] = { @@ -38,19 +38,18 @@ unsigned char HorizonTextures[40] = { 16, 17, 18, 19 }; - SVECTOR sun_position[4] = { - {-32000,-11000,-5000}, - {-32000,-11000,-5000}, - {-32000,-11000,-5000}, - {-32000,-11000,-5000} + { -32000, -11000, -5000 }, + { -32000, -11000, -5000 }, + { -32000, -11000, -5000 }, + { -32000, -11000, -5000 } }; SVECTOR moon_position[4] = { - {-32000,-11500,-18000}, - {-32000,-11500,-18000,}, - {-32000,-11500,-18000,}, - {-32000,-11500,-18000,} + { -32000, -11500, -18000 }, + { -32000, -11500, -18000 }, + { -32000, -11500, -18000 }, + { -32000, -11500, -18000 } }; SVECTOR moon_shadow_position[4] = @@ -64,36 +63,35 @@ SVECTOR moon_shadow_position[4] = FLAREREC flare_info[8] = { { - {0,0,90},16, 48 + { 0, 0, 90 }, 16, 48 }, { - {80,40,4},48,72 + { 80, 40, 4 }, 48, 72 }, { - {90,0,0},48,96 + { 90, 0, 0 }, 48, 96 }, { - {0,90,0},16,144 + { 0, 90, 0 }, 16, 144 }, { - {0,0,90},64,160 + { 0, 0, 90 }, 64, 160 }, { - {90,90,0},32,184 + { 90, 90, 0 }, 32, 184 }, { - {90,0,0},32,208 + { 90, 0, 0 }, 32, 208 }, { - {0,0,90},48,15 + { 0, 0, 90 }, 48, 15 } }; -int tunnelDir[3][2] = -{ - {2000, 3064}, - {2048, 0}, - {2048, 4095} +int tunnelDir[3][2] = { + { 2000, 3064 }, + { 2048, 0 }, + { 2048, 4095 } }; VECTOR tunnelPos[3][2] = @@ -106,7 +104,6 @@ VECTOR tunnelPos[3][2] = { 272800, 0, 41200, 0 }, { 271963, 2000, 168187, 0 } }, - { { -115100, 0, -193200, 0 }, { -113300, -400, -132501, 0 } @@ -124,13 +121,13 @@ void LoadSky(void) int skyNum; RECT16 rect; - + int offset; int flipped; int single; - int u,v,x,y,ry; + int u, v, x, y, ry; int tp_x, clut_x, i; i = 0; @@ -139,9 +136,9 @@ void LoadSky(void) flipped = 1; do { - if (flipped) + if (flipped) { - switch(y) + switch (y) { default: ry = 0; @@ -197,7 +194,7 @@ void LoadSky(void) do { u = x * 128; - + if (single) { skytexuv[i].u0 = u; @@ -209,7 +206,7 @@ void LoadSky(void) skytexuv[i].u3 = u; skytexuv[i].v3 = v; } - else if (flipped) + else if (flipped) { skytexuv[i].u0 = u; skytexuv[i].v0 = v + 83; @@ -231,9 +228,9 @@ void LoadSky(void) skytexuv[i].u3 = u + 127; skytexuv[i].v3 = v + 83; } - - skytpage[i] = GetTPage(0,0,tp_x & ~0x3f, ry * 84 & 768); - skyclut[i] = GetClut(clut_x,ry + 252); + + skytpage[i] = GetTPage(0, 0, tp_x & ~0x3f, ry * 84 & 768); + skyclut[i] = GetClut(clut_x, ry + 252); tp_x += 32; clut_x += 16; @@ -241,16 +238,16 @@ void LoadSky(void) x++; i++; } while (x < 4); - + flipped = (y < 7); - + } while (y < 7); - if (GameLevel == 1) + if (GameLevel == LEVEL_HAVANA) skyNum = 1; - else if (GameLevel == 2) + else if (GameLevel == LEVEL_VEGAS) skyNum = 2; - else if (GameLevel == 3) + else if (GameLevel == LEVEL_RIO) skyNum = 3; else skyNum = 0; @@ -353,8 +350,8 @@ void DisplaySun(DVECTOR* pos, CVECTOR* col, int flare_col) addPrim(current->ot + 0x1079, polys); current->primptr += sizeof(POLY_FT4); - cs = RCOS(camera_angle.vy); //rcossin_tbl[(camera_angle.vy & 0x1ffe) + 1]; - sn = RSIN(camera_angle.vy); //rcossin_tbl[camera_angle.vy & 0x1ffe]; + cs = RCOS(camera_angle.vy); //rcossin_tbl[(camera_angle.vy & 0x1ffe) + 1]; + sn = RSIN(camera_angle.vy); //rcossin_tbl[camera_angle.vy & 0x1ffe]; sz = -(((flare_texture.coords.u1 - (flare_texture.coords.u0 - 1)) / 2) * 3) / 4; @@ -401,10 +398,10 @@ void DisplayMoon(DVECTOR* pos, CVECTOR* col, int flip) { short width; short height; - + POLY_FT3* null; POLY_FT4* polys; - + null = (POLY_FT3*)current->primptr; setPolyFT3(null); @@ -462,19 +459,19 @@ void DisplayMoon(DVECTOR* pos, CVECTOR* col, int flip) extern VECTOR dummy; RECT16 sun_source = { - 1008, - 456, - 16, - 10 + 1008, + 456, + 16, + 10 }; // [D] [T] void DrawLensFlare(void) { - static char last_attempt_failed; // offset 0x0 - static ushort buffer[16*10]; + static char last_attempt_failed; + static ushort buffer[16 * 10]; - RECT16 viewp = { -1,-1,321,257 }; + RECT16 viewp = { -1, -1, 321, 257 }; int flarez; int distance_to_sun; @@ -489,7 +486,7 @@ void DrawLensFlare(void) int xgap; int flare_col; int flaresize; - + int haze_col; #if USE_PGXP @@ -497,7 +494,7 @@ void DrawLensFlare(void) #else DVECTOR sun_pers_conv_position; #endif - + RECT16 source; CVECTOR col; @@ -505,7 +502,7 @@ void DrawLensFlare(void) if (gWeather - 1U <= 1 || (M_BIT(gTimeOfDay) & (M_BIT(TIME_DAWN) | M_BIT(TIME_DUSK)))) return; - + if (gTimeOfDay == TIME_NIGHT) col.r = 128; else @@ -560,12 +557,12 @@ void DrawLensFlare(void) gte_stsxy(&sun_pers_conv_position); gte_stszotz(&flarez); - + xgap = sun_pers_conv_position.vx - 160; ygap = sun_pers_conv_position.vy - 128; //sun_pers_conv_position.vy = (short)((u_int)sun_pers_conv_position >> 0x10); - + distance_to_sun = SquareRoot0(xgap * xgap + ygap * ygap); if (gTimeOfDay == TIME_NIGHT) @@ -576,7 +573,7 @@ void DrawLensFlare(void) col.r = 64; col.b = 64; col.g = 64; - + gte_ldv0(&moon_shadow_position[GameLevel]); gte_rtps(); gte_stsxy(&sun_pers_conv_position); @@ -589,23 +586,23 @@ void DrawLensFlare(void) if (flarez > 0 && distance_to_sun < 500) { DisplaySun(&sun_pers_conv_position, &col, flare_col); - + haze_col = (60 - (distance_to_sun / 2)) * flare_col; - + add_haze((haze_col / 6 + (haze_col >> 0x1f) >> 3) - (haze_col >> 0x1f), haze_col >> 6, 7); shade = flare_col / 3 - (distance_to_sun * 80) / 500; - + if (shade > -1 && flare_col != 0) { pFlareInfo = flare_info; - + do { int xpos, ypos, gapmod; - + gapmod = (128 - pFlareInfo->gapmod) * 2; flaresize = (pFlareInfo->size / 2); - + xpos = (xgap * gapmod) / 256; ypos = (ygap * gapmod) / 256; @@ -622,7 +619,7 @@ void DrawLensFlare(void) poly->r0 = (pFlareInfo->transparency.r * shade >> 6); poly->g0 = (pFlareInfo->transparency.g * shade >> 6); poly->b0 = (pFlareInfo->transparency.b * shade >> 6); - + poly->u0 = lensflare_texture.coords.u0; poly->v0 = lensflare_texture.coords.v0; poly->u1 = lensflare_texture.coords.u1; @@ -631,7 +628,7 @@ void DrawLensFlare(void) poly->v2 = lensflare_texture.coords.v2 - 4; poly->u3 = lensflare_texture.coords.u3; poly->v3 = lensflare_texture.coords.v3 - 4; - + poly->clut = lensflare_texture.clutid; poly->tpage = lensflare_texture.tpageid | 0x20; @@ -649,10 +646,10 @@ void DrawLensFlare(void) PsyX_GetPSXWidescreenMappedViewport(&viewp); sun_pers_conv_position.vx = RemapVal(sun_pers_conv_position.vx, float(viewp.x), float(viewp.w), 0.0f, 320.0f); #endif - + sun_pers_conv_position.vx = sun_pers_conv_position.vx - 8; sun_pers_conv_position.vy = sun_pers_conv_position.vy - 4; - + // store framebuffer image of sun separately in VRAM if (sun_pers_conv_position.vx > -1 && sun_pers_conv_position.vy > -1 && @@ -664,7 +661,7 @@ void DrawLensFlare(void) source.x = sun_pers_conv_position.vx; source.y = sun_pers_conv_position.vy + last->disp.disp.y; -#if 1//def PSX +#if 1 //def PSX sample_sun = (DR_MOVE*)current->primptr; SetDrawMove(sample_sun, &source, 1008, 456); @@ -695,7 +692,7 @@ void TunnelSkyFade(void) int tun; int px, pz; - if (GameLevel != 3 && gTunnelNum < 3) + if (GameLevel != LEVEL_RIO && gTunnelNum < 3) tun = gTunnelNum; else tun = 2; @@ -715,7 +712,7 @@ void TunnelSkyFade(void) px = player[0].pos[0]; pz = player[0].pos[2]; - if(v1 && v2) + if (v1 && v2) { dX = (v1->vx - px) >> 5; // [A] smooth sky fade dZ = (v1->vz - pz) >> 5; @@ -729,14 +726,14 @@ void TunnelSkyFade(void) if (l2 <= len) len = l2; } - else if(v2) + else if (v2) { diffX = (v2->vx - px) >> 5; diffZ = (v2->vz - pz) >> 5; len = (diffX * diffX + diffZ * diffZ); } - else if(v1) + else if (v1) { diffX = (v1->vx - px) >> 5; diffZ = (v1->vz - pz) >> 5; @@ -764,7 +761,7 @@ void calc_sky_brightness(RGB16* skycolor) int dawn; dawn = DawnCount >> 5; - if(M_BIT(gTimeOfDay) & (M_BIT(TIME_DAWN) | M_BIT(TIME_DUSK))) + if (M_BIT(gTimeOfDay) & (M_BIT(TIME_DAWN) | M_BIT(TIME_DUSK))) { if (gTimeOfDay == TIME_DAWN) { @@ -795,12 +792,12 @@ void calc_sky_brightness(RGB16* skycolor) skycolor->g = 128; skycolor->r = 128; } - - if (gTunnelNum == -1 || - GameLevel == 0 || - GameLevel == 1 && gTunnelNum == 2 || - GameLevel == 2 || - GameLevel == 3 && gTunnelNum != 1) + + if (gTunnelNum == -1 || + GameLevel == LEVEL_CHICAGO || + GameLevel == LEVEL_HAVANA && gTunnelNum == 2 || + GameLevel == LEVEL_VEGAS || + GameLevel == LEVEL_RIO && gTunnelNum != 1) return; TunnelSkyFade(); @@ -853,12 +850,12 @@ void PlotSkyPoly(POLYFT4* polys, int skytexnum, unsigned char r, unsigned char g *(u_int*)&poly->x1 = *(u_int*)&outpoints[src->v1].vx; *(u_int*)&poly->x2 = *(u_int*)&outpoints[src->v3].vx; *(u_int*)&poly->x3 = *(u_int*)&outpoints[src->v2].vx; - + *(ushort*)&poly->u0 = *(ushort*)&skytexuv[skytexnum].u2; *(ushort*)&poly->u1 = *(ushort*)&skytexuv[skytexnum].u3; *(ushort*)&poly->u2 = *(ushort*)&skytexuv[skytexnum].u0; *(ushort*)&poly->u3 = *(ushort*)&skytexuv[skytexnum].u1; - + poly->clut = skyclut[skytexnum]; poly->tpage = skytpage[skytexnum]; @@ -866,7 +863,7 @@ void PlotSkyPoly(POLYFT4* polys, int skytexnum, unsigned char r, unsigned char g #if USE_PGXP && USE_EXTENDED_PRIM_POINTERS poly->pgxp_index = outpoints[src->v0].pgxp_index; -#endif +#endif current->primptr += sizeof(POLY_FT4); } @@ -903,7 +900,7 @@ void PlotHorizonMDL(MODEL* model, int horizontaboffset, RGB16* skycolor) gte_rtpt(); gte_stsxy3(dv, dv+1, dv+2); - if(count == 15) + if (count == 15) gte_stszotz(&z); #if USE_PGXP @@ -930,7 +927,7 @@ void PlotHorizonMDL(MODEL* model, int horizontaboffset, RGB16* skycolor) red = skycolor->r; green = skycolor->g; blue = skycolor->b; - + // draw sky count = model->num_polys; do @@ -955,7 +952,7 @@ void PlotHorizonMDL(MODEL* model, int horizontaboffset, RGB16* skycolor) // [D] [T] void DrawSkyDome(void) { - RGB16 skycolor = { 128,128,128 }; + RGB16 skycolor = { 128, 128, 128 }; VECTOR skyOfs = dummy; calc_sky_brightness(&skycolor); @@ -984,6 +981,4 @@ void DrawSkyDome(void) PlotHorizonMDL(modelpointers[3], HorizonLookup[GameLevel][2], &skycolor); PlotHorizonMDL(modelpointers[1], HorizonLookup[GameLevel][3], &skycolor); #endif - } - diff --git a/src_rebuild/Game/C/sky.h b/src_rebuild/Game/C/sky.h index 66998d760..1a64e8fa1 100644 --- a/src_rebuild/Game/C/sky.h +++ b/src_rebuild/Game/C/sky.h @@ -13,4 +13,4 @@ extern void DrawLensFlare(); // 0x00077A8C extern void TunnelSkyFade(); // 0x000787B0 -#endif +#endif // SKY_H diff --git a/src_rebuild/Game/C/sound.c b/src_rebuild/Game/C/sound.c index b295be632..ec8e5b984 100644 --- a/src_rebuild/Game/C/sound.c +++ b/src_rebuild/Game/C/sound.c @@ -44,7 +44,7 @@ int banksize[2] = { 88064, 412672 }; char banks[24] = { 0 }; SAMPLE_DATA samples[LSB_BANK_COUNT][35]; -CHANNEL_DATA channels[MAX_SFX_CHANNELS]; // offset 0xDE480 +CHANNEL_DATA channels[MAX_SFX_CHANNELS]; int master_volume = 0; // why need two? @@ -63,7 +63,7 @@ int music_paused = 0; SpuCommonAttr sound_attr; -int vblcounter = 0; // vblank counter +int vblcounter = 0; // vblank counter // [D] [T] void SoundHandler(void) @@ -102,7 +102,7 @@ void VsyncProc(void) if (Song_ID != -1) { - if (Song_SetPos != -1) + if (Song_SetPos != -1) { XM_SetSongPos(Song_ID, Song_SetPos); Song_SetPos = -1; @@ -154,7 +154,7 @@ void ClearChannelFields(int channel) CHANNEL_DATA* chan; chan = &channels[channel]; - + chan->flags = 0; chan->time = 0; chan->samplerate = 0; @@ -186,7 +186,7 @@ void ResetSound(void) SpuSetCommonAttr(&sound_attr); - for (ct = 0; ct < MAX_SFX_CHANNELS; ct++) + for (ct = 0; ct < MAX_SFX_CHANNELS; ct++) { chan = &channels[ct]; memset((u_char*)chan, 0, sizeof(CHANNEL_DATA)); @@ -198,7 +198,7 @@ void ResetSound(void) ClearChannelFields(ct); } - for (ct = 0; ct < MAX_SFX_CHANNELS; ct++) + for (ct = 0; ct < MAX_SFX_CHANNELS; ct++) { SpuSetVoiceRR(ct, 6); SpuSetVoiceAR(ct, 35); @@ -478,14 +478,14 @@ int CompleteSoundSetup(int channel, int bank, int sample, int pitch, int proximi bpf /= 60; #endif - if (bpf == 0) + if (bpf == 0) { return -1; } chan = &channels[channel]; - - if (gSoundMode == 1 && proximity != -1) + + if (gSoundMode == 1 && proximity != -1) UpdateVolumeAttributesS(channel, proximity); else UpdateVolumeAttributesM(channel); @@ -516,7 +516,6 @@ int CompleteSoundSetup(int channel, int bank, int sample, int pitch, int proximi return channel; } - // [D] [T] void ComputeDoppler(CHANNEL_DATA *ch) { @@ -560,7 +559,6 @@ void ComputeDoppler(CHANNEL_DATA *ch) ch->dopplerScale = 0; } - // [D] [T] int StartSound(int channel, int bank, int sample, int volume, int pitch) { @@ -580,7 +578,7 @@ int StartSound(int channel, int bank, int sample, int volume, int pitch) int Start3DTrackingSound(int channel, int bank, int sample, VECTOR *position, LONGVECTOR3* velocity) { CHANNEL_DATA* chan; - + if (channel < 0) channel = GetFreeChannel(); @@ -634,7 +632,6 @@ int Start3DSoundVolPitch(int channel, int bank, int sample, int x, int y, int z, SetChannelPitch(channel, pitch); return channel; - } // [D] [T] @@ -648,7 +645,7 @@ void SetChannelPitch(int channel, int pitch) if (sound_paused) return; - + chan = &channels[channel]; if (chan->time != 0 && pitch > 128) @@ -700,14 +697,14 @@ void SetChannelPosition3(int channel, VECTOR *position, LONGVECTOR3* velocity, i return; chan = &channels[channel]; - + chan->srcposition = position; chan->srcvelocity = velocity ? velocity : (LONGVECTOR3*)dummylong; chan->srcvolume = volume; if (gSoundMode == 1) UpdateVolumeAttributesS(channel, proximity); - else + else UpdateVolumeAttributesM(channel); chan->attr.mask = SPU_VOICE_VOLL | SPU_VOICE_VOLR | SPU_VOICE_VOLMODEL | SPU_VOICE_VOLMODER; @@ -719,7 +716,6 @@ void SetChannelPosition3(int channel, VECTOR *position, LONGVECTOR3* velocity, i SetChannelPitch(channel, pitch); } - static int music_pause_max; // [D] [T] @@ -742,7 +738,6 @@ void PauseXM(void) music_paused = 1; } - // [D] [T] void PauseSFX(void) { @@ -761,7 +756,7 @@ void PauseSFX(void) vl = MAX(pause.voll[i], pause.volr[i]); - if (pause.max < vl) + if (pause.max < vl) pause.max = vl; pause.lev = gMasterVolume + 10000; @@ -803,7 +798,7 @@ void PauseSound(void) void UnPauseXM(void) { int fade; - + if (Song_ID == -1) return; @@ -858,7 +853,7 @@ void UnPauseSFX(void) fade += 96; } - + sound_paused = 0; } @@ -877,7 +872,7 @@ void StopChannel(int channel) u_char lock; int vsync; - if (channel < 0 || channel >= MAX_SFX_CHANNELS) + if (channel < 0 || channel >= MAX_SFX_CHANNELS) return; c = &channels[channel]; @@ -899,7 +894,7 @@ void StopChannel(int channel) lock = c->flags & CHAN_LOCKED; ClearChannelFields(channel); - + c->flags = lock; } @@ -914,7 +909,7 @@ void StopAllChannels(void) VSync(0); } } - + // [D] [T] void LockChannel(int channel) { @@ -954,10 +949,10 @@ int LoadSoundBank(char *address, int length, int bank) SpuSetTransferStartAddr(spuaddress); SpuWrite((u_char*)address + slength, length - slength); - + SpuIsTransferCompleted(SPU_TRANSFER_WAIT); - for(ct = 0; ct < num_samples; ct++) + for (ct = 0; ct < num_samples; ct++) { samples[bank][ct].address += spuaddress; } @@ -980,7 +975,7 @@ int LoadSoundBankDynamic(char *address, int length, int dbank) int slength; int num_samples; - if (address == NULL) + if (address == NULL) { switch (length) { @@ -1013,13 +1008,13 @@ int LoadSoundBankDynamic(char *address, int length, int dbank) } // init bank samples - if (lsbTabs.append == 0) + if (lsbTabs.append == 0) { lsbTabs.addr = bankaddr[1]; - - for(i = 0; i < 7; i++) + + for (i = 0; i < 7; i++) lsbTabs.count[i] = 0; - + lsbTabs.append = 1; } @@ -1036,12 +1031,12 @@ int LoadSoundBankDynamic(char *address, int length, int dbank) SpuIsTransferCompleted(SPU_TRANSFER_WAIT); // set proper address for samples - for(i = 0; i < num_samples; i++) + for (i = 0; i < num_samples; i++) { samples[dbank][lsbTabs.count[dbank]].address += lsbTabs.addr; lsbTabs.count[dbank]++; } - + lsbTabs.addr += length - slength; return num_samples; @@ -1068,11 +1063,11 @@ void StartXM(int reverb) if (Song_ID == -1) return; - + XM_PlayStart(Song_ID, -1); SpuSetReverb(1); - for(ct = MAX_SFX_CHANNELS; ct < SPU_CHANNEL_COUNT; ct++) + for (ct = MAX_SFX_CHANNELS; ct < SPU_CHANNEL_COUNT; ct++) { SpuSetReverbVoice(reverb, SPU_VOICECH(ct)); } @@ -1093,7 +1088,7 @@ int GetFreeChannel(int force) int least; char status[SPU_CHANNEL_COUNT]; - + SpuGetAllKeysStatus(status); channel = 0; @@ -1109,17 +1104,17 @@ int GetFreeChannel(int force) if (!force) return -1; - + // if not found free channels - free already playing one channel = -1; least = 0; - + c = &channels[0]; for (it = 0; it < MAX_SFX_CHANNELS; it++, c++) { if (c->flags & (CHAN_LOCKED | CHAN_LOOP)) continue; - + if (channel == -1 || c->time < least) { channel = it; @@ -1127,7 +1122,7 @@ int GetFreeChannel(int force) } } - if (channel != -1) + if (channel != -1) StopChannel(channel); return channel; @@ -1201,5 +1196,3 @@ int jsqrt(u_int a) return b1; } - - diff --git a/src_rebuild/Game/C/sound.h b/src_rebuild/Game/C/sound.h index ee22c2750..17769f86c 100644 --- a/src_rebuild/Game/C/sound.h +++ b/src_rebuild/Game/C/sound.h @@ -88,4 +88,4 @@ extern int FESound(int sample); // 0x0007A534 extern int jsqrt(u_int a); // 0x0005270C -#endif +#endif // SOUND_H diff --git a/src_rebuild/Game/C/spool.c b/src_rebuild/Game/C/spool.c index a075bc397..45c1753bb 100644 --- a/src_rebuild/Game/C/spool.c +++ b/src_rebuild/Game/C/spool.c @@ -74,10 +74,10 @@ int date_date = 0xA11; int date_time = 0x27220B; int SpecialByRegion[4][20] = { - {5, 1, 3, 3, 2, 2, 2, 3, 3, 3, 3, 1, 1, 1, 2, 3, 2, 2, 3, 0}, - {2, 4, 1, 1, 4, 4, 3, 3, 3, 3, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 4, 1, 1, 1, 1, 1, 1, 4, 2, 3, 3, 5, 0, 0, 0, 0, 0, 0, 0}, - {2, 5, 4, 1, 2, 1, 4, 3, 2, 2, 2, 2, 3, 3, 3, 0, 0, 0, 0, 0}, + { 5, 1, 3, 3, 2, 2, 2, 3, 3, 3, 3, 1, 1, 1, 2, 3, 2, 2, 3, 0 }, + { 2, 4, 1, 1, 4, 4, 3, 3, 3, 3, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 2, 4, 1, 1, 1, 1, 1, 1, 4, 2, 3, 3, 5, 0, 0, 0, 0, 0, 0, 0 }, + { 2, 5, 4, 1, 2, 1, 4, 3, 2, 2, 2, 2, 3, 3, 3, 0, 0, 0, 0, 0 } }; SPOOLQ spooldata[48]; @@ -182,10 +182,11 @@ int check_regions_present(void) topbottom_unpack = 0; num_regions_to_unpack = 0; - if (current_barrel_region_xcell < 9) + if (current_barrel_region_xcell < 9) { regions_to_unpack[0].xoffset = -1; - if (region_x != 0) + + if (region_x != 0) { leftright_unpack = 1; num_regions_to_unpack = 1; @@ -212,7 +213,7 @@ int check_regions_present(void) regions_to_unpack[num_regions_to_unpack].zoffset = -1; num_regions_to_unpack++; } - else if(current_barrel_region_zcell > 23 && region_z != 0) + else if (current_barrel_region_zcell > 23 && region_z != 0) { topbottom_unpack = 2; @@ -221,28 +222,28 @@ int check_regions_present(void) num_regions_to_unpack++; } - if (num_regions_to_unpack == 2) + if (num_regions_to_unpack == 2) { num_regions_to_unpack = 3; - if (topbottom_unpack == 1) + if (topbottom_unpack == 1) { if (leftright_unpack == 1) { regions_to_unpack[2].xoffset = -1; regions_to_unpack[2].zoffset = -1; } - else + else { regions_to_unpack[2].xoffset = 1; regions_to_unpack[2].zoffset = -1; } } - else + else { - if (leftright_unpack == 1) + if (leftright_unpack == 1) regions_to_unpack[2].xoffset = -1; - else + else regions_to_unpack[2].xoffset = 1; regions_to_unpack[2].zoffset = 1; @@ -250,7 +251,7 @@ int check_regions_present(void) } retval = 0; - while (num_regions_to_unpack != 0) + while (num_regions_to_unpack != 0) { x = regions_to_unpack[retval].xoffset; z = regions_to_unpack[retval].zoffset; @@ -263,10 +264,11 @@ int check_regions_present(void) { retval++; } + num_regions_to_unpack--; } - if (LoadingArea != 0) + if (LoadingArea != 0) { if (new_area_location == 0) { @@ -283,9 +285,9 @@ int check_regions_present(void) if (current_barrel_region_xcell < 6) retval++; } - else if(new_area_location == 3) + else if (new_area_location == 3) { - if(current_barrel_region_zcell < 6) + if (current_barrel_region_zcell < 6) retval++; } } @@ -399,23 +401,23 @@ void RequestSpool(int type, int data, int offset, int loadsize, char *address, s char* nameType; switch (next->type) { - case 0: // regions - nameType = "REGION"; - break; - case 1: // textures - nameType = "TPAGE"; - break; - case 2: // sbk - nameType = "SBK"; - break; - case 3: // misc - nameType = "MISC"; - break; - } - + case 0: // regions + nameType = "REGION"; + break; + case 1: // textures + nameType = "TPAGE"; + break; + case 2: // sbk + nameType = "SBK"; + break; + case 3: // misc + nameType = "MISC"; + break; + } + SPOOL_WARNING("spool type=%s cb=%d sec=%d cnt=%d id=%d\n", nameType, next->func ? 1 : 0, next->sector, next->nsectors, spoolcounter); #endif - + #ifdef _DEBUG next->requestby = requestby; next->requestbyline = line; @@ -469,7 +471,7 @@ void SendTPage(void) if (tpage2send == 0xFF || slot == 0xFF) // [A] bug fix return; - if (nTPchunks == 0) + if (nTPchunks == 0) { // Send palettes if (slot != tpageloaded[tpage2send] - 1) @@ -508,9 +510,9 @@ void SendTPage(void) texture_pages[tpage2send] = getTPage(0, 0, tpage.x, tpage.y); } } - else + else { - if (slot != tpageloaded[tpage2send] - 1) + if (slot != tpageloaded[tpage2send] - 1) { LoadImage(&tpage, (u_long*)(model_spool_buffer + 0xA000 + (loadbank_write & 1) * 256 * 32)); tpage.y = tpage.y + tpage.h; @@ -521,7 +523,7 @@ void SendTPage(void) old = tpageslots[slot]; tpageslots[slot] = tpage2send; - if(old != 0xFF) // [A] bug fix + if (old != 0xFF) // [A] bug fix tpageloaded[old] = 0; tpageloaded[tpage2send] = slot + 1; @@ -535,7 +537,7 @@ void SendTPage(void) } #if USE_PC_FILESYSTEM - if(gContentOverride) + if (gContentOverride) { // [A] try override LoadTPageFromTIMs(tpage2send); @@ -716,7 +718,7 @@ void CheckValidSpoolData(void) { if (models_ready) init_spooled_models(); - + #ifdef PSX if (spoolactive && check_regions_present()) { @@ -791,21 +793,13 @@ void CheckLoadAreaData(int cellx, int cellz) // [A] bounds? if (load == 0 && (cellz > BOUNDARY_MAX)) - { break; - } else if (load == 1 && (cellx > BOUNDARY_MAX)) - { break; - } else if (load == 2 && (cellz < BOUNDARY_MIN)) - { break; - } else if (load == 3 && (cellx < BOUNDARY_MIN)) - { break; - } } } @@ -892,7 +886,7 @@ void ProcessSpoolInfoLump(char *lump_ptr, int lump_size) ptr += music_and_ambients_size; NumAreas = getIntAdv(ptr); - AreaData = (AreaDataStr *)ptr; + AreaData = (AreaDataStr *)ptr; ptr += sizeof(AreaDataStr) * NumAreas; AreaTPages = (unsigned char *)ptr; @@ -916,7 +910,7 @@ void ProcessSpoolInfoLump(char *lump_ptr, int lump_size) // set last totals cell_objects_add[i] = cell_objects_add[4]; cell_slots_add[i] = cell_slots_add[4]; - + // increment totals cell_slots_add[4] += slots_count; cell_objects_add[4] += objects_count; @@ -939,8 +933,8 @@ void ProcessSpoolInfoLump(char *lump_ptr, int lump_size) int spoolinfo_size = getIntAdv(ptr); RegionSpoolInfo = ptr; - // [A] bug fix for VEGAS. This doesn't happen in OpenDriverEngine since region loading is better - if (GameLevel == 2) + // [A] bug fix for Vegas (this doesn't happen in OpenDriverEngine since region loading is better) + if (GameLevel == LEVEL_VEGAS) { Spool* spoolptr; spoolptr = (Spool*)(RegionSpoolInfo + spoolinfo_offsets[624]); @@ -959,7 +953,7 @@ void WaitCloseLid(void) old = (void(*)())CdReadyCallback(NULL); stopgame(); - while (loop = CdDiskReady(1), loop != 2) + while (loop = CdDiskReady(1), loop != 2) { DrawCDicon(); VSync(0); @@ -1081,7 +1075,7 @@ void ready_cb_textures(unsigned char intr, unsigned char *result) sectors_this_chunk = intr; } } - else + else { sectors_this_chunk = 4; target_address = spooldata[spoolpos_reading].addr + (loadbank_read & 1U) * 0x2000; @@ -1104,7 +1098,7 @@ void ready_cb_regions(unsigned char intr, unsigned char *result) current_sector++; sectors_to_read--; - if (sectors_this_chunk == 0) + if (sectors_this_chunk == 0) { spoolpos_reading++; chunk_complete = intr; @@ -1114,7 +1108,7 @@ void ready_cb_regions(unsigned char intr, unsigned char *result) endchunk = intr; test_changemode(); } - else + else { target_address = spooldata[spoolpos_reading].addr; sectors_this_chunk = spooldata[spoolpos_reading].nsectors; @@ -1144,7 +1138,7 @@ void data_cb_regions(void) CdDataCallback(NULL); - if (spoolpos_writing == spoolcounter) + if (spoolpos_writing == spoolcounter) { SPOOL_WARNING("All SPOOL requests (%d) completed successfully on REGIONS\n", spoolcounter); // [A] @@ -1153,13 +1147,12 @@ void data_cb_regions(void) spoolpos_reading = 0; spoolactive = 0; } - else + else { UpdateSpool(); } } - // [D] [T] void data_cb_misc(void) { @@ -1178,7 +1171,7 @@ void data_cb_misc(void) CHECK_SWITCHSPOOL(); CdDataCallback(NULL); - + if (spoolpos_writing == spoolcounter) { SPOOL_WARNING("All SPOOL requests (%d) completed successfully on MISC\n", spoolcounter); // [A] @@ -1197,7 +1190,7 @@ void data_cb_misc(void) // [D] [T] void ready_cb_misc(unsigned char intr, unsigned char *result) { - if (intr == 1) + if (intr == 1) { CdGetSector(target_address, SECTOR_SIZE); @@ -1205,14 +1198,14 @@ void ready_cb_misc(unsigned char intr, unsigned char *result) sectors_to_read--; current_sector++; - if (sectors_to_read == 0) + if (sectors_to_read == 0) { spoolpos_reading++; chunk_complete = intr; test_changemode(); } } - else + else { FoundError("ready_cb_misc", intr, result); } @@ -1278,20 +1271,14 @@ void changemode(SPOOLQ *current) switch (current->type) { case 0: - { CdDataCallback(data_cb_regions); break; - } case 1: - { CdDataCallback(data_cb_textures); break; - } case 3: - { CdDataCallback(data_cb_misc); break; - } } } @@ -1300,7 +1287,7 @@ void StartSpooling(void) { static u_char param[8]; static u_char result[8]; - + if (spoolcounter == 0 || spoolactive) return; @@ -1312,7 +1299,7 @@ void StartSpooling(void) if (*result & (CdlStatError | CdlStatShellOpen)) WaitCloseLid(); - + spoolactive = 1; UpdateSpool(); @@ -1320,7 +1307,7 @@ void StartSpooling(void) SpoolSYNC(); } -// [D] [T] [A] - altered declaration +// [D] [T] [A] altered declaration void unpack_cellpointers(int region_to_unpack, int target_barrel_region, char* cell_addr) { ushort cell; @@ -1384,7 +1371,7 @@ void unpack_cellpointers(int region_to_unpack, int target_barrel_region, char* c } } } - else + else { printError("BAD PACKED CELL POINTER DATA, region = %d, packtype = %d\n", region_to_unpack, packtype); @@ -1455,18 +1442,18 @@ int UpdateSpoolPC(void) char* nameType; switch (current->type) { - case 0: // regions - nameType = "REGION"; - break; - case 1: // textures - nameType = "TPAGE"; - break; - case 2: // sbk - nameType = "SBK"; - break; - case 3: // misc - nameType = "MISC"; - break; + case 0: // regions + nameType = "REGION"; + break; + case 1: // textures + nameType = "TPAGE"; + break; + case 2: // sbk + nameType = "SBK"; + break; + case 3: // misc + nameType = "MISC"; + break; } SPOOL_WARNING("spool type=%s cb=%d sec=%d cnt=%d id=%d\n", nameType, current->func ? 1 : 0, current->sector, current->nsectors, spoolpos_reading); @@ -1477,35 +1464,35 @@ int UpdateSpoolPC(void) switch (current->type) { - case 0: // regions - case 3: // misc - SPL_READ(current->addr, current->nsectors); + case 0: // regions + case 3: // misc + SPL_READ(current->addr, current->nsectors); - if (current->func) - current->func(); + if (current->func) + current->func(); - break; - case 1: // textures - // read cluts - nTPchunks = 0; - SPL_READ(current->addr + CDSECTOR_SIZE * 2 * 4, 1); - SendTPage(); - - nTPchunks++; - - // read tpage (4 sectors 4 times = 16) - for (int i = 0; i < 4; i++) - { - SPL_READ(current->addr + (loadbank_write & 1) * 256 * 32, 4); + break; + case 1: // textures + // read cluts + nTPchunks = 0; + SPL_READ(current->addr + CDSECTOR_SIZE * 2 * 4, 1); SendTPage(); - loadbank_write++; nTPchunks++; - } - break; - default: - break; + // read tpage (4 sectors 4 times = 16) + for (int i = 0; i < 4; i++) + { + SPL_READ(current->addr + (loadbank_write & 1) * 256 * 32, 4); + SendTPage(); + + loadbank_write++; + nTPchunks++; + } + + break; + default: + break; } #undef SPL_READ @@ -1654,7 +1641,6 @@ void UnpackRegion(int region_to_unpack, int target_barrel_region) RoadMapRegions[target_barrel_region] = region_to_unpack; } - //--------------------------------------------------------------------- // Special car spooling @@ -1723,7 +1709,7 @@ void SpecClutsSpooled(void) slot_tpagepos[index].vy = tpagepos[index].y; texture_pages[tpage] = GetTPage(0, 0, slot_tpagepos[index].vx, slot_tpagepos[index].vy); - + for (int j = 0; j < tpage_texamts[tpage]; j++) { LoadImage2(&specCluts, (u_long*)loadaddr); @@ -1750,8 +1736,8 @@ void CleanModelSpooled(void) int* polyBlock; loadaddr = (int *)specLoadBuffer; - - if (specBlocksToLoad == lastCleanBlock-1) + + if (specBlocksToLoad == lastCleanBlock-1) { loadaddr = (int *)(specLoadBuffer + 12); gCarCleanModelPtr[4] = (MODEL *)modelMemory; @@ -1764,7 +1750,7 @@ void CleanModelSpooled(void) polyBlock = GET_RELOC_MODEL_DATA(int, gCarCleanModelPtr[4], poly_block); if (specBlocksToLoad == 0 || modelMemory > polyBlock) - { + { specBlocksToLoad = 0; modelMemory = polyBlock; @@ -1793,12 +1779,12 @@ void DamagedModelSpooled(void) loadaddr = (int *)specLoadBuffer; - if (specBlocksToLoad == lengthDamBlock-1) + if (specBlocksToLoad == lengthDamBlock-1) { loadaddr = (int *)(specLoadBuffer + damOffset); gCarDamModelPtr[4] = (MODEL *)modelMemory; } - + // memcpy while (loadaddr < (int*)(specLoadBuffer + CDSECTOR_SIZE)) *modelMemory++ = *loadaddr++; @@ -1806,7 +1792,7 @@ void DamagedModelSpooled(void) polyBlock = GET_RELOC_MODEL_DATA(int, gCarDamModelPtr[4], poly_block); if (specBlocksToLoad == 0 || modelMemory > polyBlock) - { + { specBlocksToLoad = 0; modelMemory = polyBlock; @@ -1833,12 +1819,12 @@ void LowModelSpooled(void) loadaddr = (int *)specLoadBuffer; - if (specBlocksToLoad == lengthLowBlock - 1) + if (specBlocksToLoad == lengthLowBlock - 1) { loadaddr = (int *)(specLoadBuffer + lowOffset); gCarLowModelPtr[4] = (MODEL *)modelMemory; } - + // memcpy while (loadaddr < (int*)(specLoadBuffer + CDSECTOR_SIZE)) *modelMemory++ = *loadaddr++; @@ -1865,7 +1851,6 @@ void LowModelSpooled(void) DrawSyncCallback(SpecialStartNextBlock); } - // [D] [T] [A] void CleanSpooled(void) { @@ -1928,7 +1913,7 @@ void CleanSpooled(void) { gCarDamModelPtr[4] = (MODEL*)modelMemory; model = GetCarModel(mem, (char**)&modelMemory, 0); - + specBlocksToLoad = 0; specialState = SpecSpool_DamagedModel; } @@ -1949,7 +1934,7 @@ void CleanSpooled(void) // Spooled clean car models are guaranteed to be split in two instances // this one is polygons only - if (specBlocksToLoad == 7 - lastCleanBlock) + if (specBlocksToLoad == 7 - lastCleanBlock) { specBlocksToLoad = 0; model = (MODEL*)(specmallocptr + sizeof(int) * 3); @@ -1969,13 +1954,12 @@ void CleanSpooled(void) DrawSyncCallback(SpecialStartNextBlock); } - // [D] [T] void LowSpooled(void) { MODEL *model; - if (specBlocksToLoad == 0) + if (specBlocksToLoad == 0) { model = (MODEL *)(specmallocptr + lowOffset); buildNewCarFromModel(4, 0, (char*)model, model); @@ -1988,11 +1972,10 @@ void LowSpooled(void) #endif } - if (quickSpool != 1) + if (quickSpool != 1) DrawSyncCallback(SpecialStartNextBlock); } - // [D] [T] void Tada(void) { @@ -2044,7 +2027,7 @@ void SpecialStartNextBlock(void) if (specBlocksToLoad == 0) { specialState++; - switch (specialState) + switch (specialState) { case SpecSpool_Tpage1: case SpecSpool_Tpage2: @@ -2138,7 +2121,7 @@ void CheckSpecialSpool(void) int iVar2; CAR_DATA *lcp; - if (startSpecSpool != -1 && startSpecSpool+400 < CameraCnt) + if (startSpecSpool != -1 && startSpecSpool+400 < CameraCnt) { while (specSpoolComplete == 0) { @@ -2157,12 +2140,12 @@ void CheckSpecialSpool(void) startSpecSpool = -1; } - if (allowSpecSpooling && - specSpoolComplete != 1 && + if (allowSpecSpooling && + specSpoolComplete != 1 && specialState == SpecSpool_None && GameType != GAME_PURSUIT && LoadedArea != -1 && - SpecialByRegion[GameLevel][LoadedArea] != MissionHeader->residentModels[4]-7) + SpecialByRegion[GameLevel][LoadedArea] != MissionHeader->residentModels[4]-7) { lcp = car_data; @@ -2235,7 +2218,7 @@ void InitSpecSpool(void) { switch (gCurrentMissionNumber) { - case 2: + case 2: case 4: case 6: case 7: @@ -2317,7 +2300,7 @@ void InitSpecSpool(void) } #ifndef PSX - if(gDemoLevel) + if (gDemoLevel) allowSpecSpooling = 0; #endif @@ -2328,8 +2311,3 @@ void InitSpecSpool(void) specSpoolComplete = 0; startSpecSpool = -1; } - - - - - diff --git a/src_rebuild/Game/C/spool.h b/src_rebuild/Game/C/spool.h index 98aee7b71..ff0515500 100644 --- a/src_rebuild/Game/C/spool.h +++ b/src_rebuild/Game/C/spool.h @@ -71,4 +71,4 @@ extern void QuickSpoolSpecial(); // 0x0007E84C extern void PrepareSecretCar(); // 0x0007E8DC -#endif +#endif // SPOOL_H diff --git a/src_rebuild/Game/C/state.c b/src_rebuild/Game/C/state.c index 0d5c3fa8a..c215129b8 100644 --- a/src_rebuild/Game/C/state.c +++ b/src_rebuild/Game/C/state.c @@ -58,4 +58,4 @@ void SetState(GameStates newState, void* param) { gCurrentState = gStates[newState]; gCurrentStateParam = param; -} \ No newline at end of file +} diff --git a/src_rebuild/Game/C/state.h b/src_rebuild/Game/C/state.h index 684cb2877..9695ed1df 100644 --- a/src_rebuild/Game/C/state.h +++ b/src_rebuild/Game/C/state.h @@ -16,4 +16,4 @@ enum GameStates extern void SetState(GameStates newState, void* param = NULL); // does the state loop -extern void DoStateLoop(); \ No newline at end of file +extern void DoStateLoop(); diff --git a/src_rebuild/Game/C/sysclock.c b/src_rebuild/Game/C/sysclock.c index 5f299eed7..2de7961ea 100644 --- a/src_rebuild/Game/C/sysclock.c +++ b/src_rebuild/Game/C/sysclock.c @@ -56,7 +56,7 @@ long tmrint(void) ptmr++; } - + g_currentthread = 0; restoregp(_saved_gp); @@ -69,7 +69,7 @@ void timedwait(int ms) int oldTick; oldTick = gettick(); - + while (gettick() - (oldTick + ms) < 0) systemtask(0); @@ -115,11 +115,11 @@ void inittimer(int hz) if (timerflag == 0) { memset((u_char*)&tmrsub, 0, sizeof(tmrsub)); - + timerevent = OpenEvent(RCntCNT2, 2, RCntMdINTR, tmrint); EnableEvent(timerevent); timerflag = 1; - + //addexit(restoretimer); } @@ -131,7 +131,7 @@ void inittimer(int hz) if ((hz == -1) && (false)) { trap(0x1800); } - + reentryflag = 0; timerhz = hz; @@ -157,7 +157,7 @@ void Clock_MasterInterruptHandler(void) savegp(&oldgp); - if (stopClock == 0) + if (stopClock == 0) { clock_realTime.time128Hz++; generic128HzClock++; @@ -169,12 +169,12 @@ void Clock_MasterInterruptHandler(void) if ((clock_realTime.time64Hz & 1U) == 0) { clock_realTime.time32Hz++; - - if ((clock_realTime.time32Hz & 1U) == 0) + + if ((clock_realTime.time32Hz & 1U) == 0) { //Input_Update__Fv(); } - + //Input_Store__Fv(); } } @@ -191,11 +191,11 @@ void Clock_SystemStartUp(void) if (clock_InterruptStarted == 0) { clock_InterruptStarted = 1; - + addtimer(Clock_MasterInterruptHandler); - + clock_realTime.time128Hz = 0; clock_realTime.time64Hz = 0; clock_realTime.time32Hz = 0; } -} \ No newline at end of file +} diff --git a/src_rebuild/Game/C/sysclock.h b/src_rebuild/Game/C/sysclock.h index 77bea19b0..355f264bb 100644 --- a/src_rebuild/Game/C/sysclock.h +++ b/src_rebuild/Game/C/sysclock.h @@ -22,5 +22,4 @@ extern void addtimer(tmr_func func); extern void Clock_SystemStartUp(void); - -#endif // SYSCLOCK_H \ No newline at end of file +#endif // SYSCLOCK_H diff --git a/src_rebuild/Game/C/system.c b/src_rebuild/Game/C/system.c index 505d5c563..d9b083e35 100644 --- a/src_rebuild/Game/C/system.c +++ b/src_rebuild/Game/C/system.c @@ -37,7 +37,6 @@ _repl_org | 0x1FABBC | 0x3444 | probably inside mallocTab */ - #else // Initialized in redriver2_main @@ -54,8 +53,6 @@ volatile char* _replay_buffer = NULL; // 0x1FABBC #endif - - #if defined(USE_CRT_MALLOC) volatile char* mallocptr = NULL; @@ -234,7 +231,7 @@ void Init_FileSystem(void) CdInit(); VSync(3); - // Driver 1 were looking up level files on CD... + // Driver 1 was looking up level files on CD... } int gNumCDRetries = 0; @@ -251,8 +248,7 @@ void DoCDRetry(void) } } -// loads whole file into buffer -// [D] [T] +// [D] [T] loads whole file into buffer int Loadfile(char* name, char* addr) { int nread; @@ -291,7 +287,7 @@ int Loadfile(char* name, char* addr) int FileExists(char* filename) { char namebuffer[128]; - + if (*filename == '\0') return 0; @@ -326,17 +322,16 @@ int FileExists(char* filename) #else // don't retry or we'll have problems - if(CdSearchFile(&cdfile, namebuffer) != NULL) + if (CdSearchFile(&cdfile, namebuffer) != NULL) return 1; #endif - + #endif // USE_CD_FILESYSTEM return 0; } -// loads file partially into buffer -// [D] [T] +// [D] [T] loads file partially into buffer int LoadfileSeg(char* name, char* addr, int offset, int loadsize) { char namebuffer[64]; @@ -397,9 +392,9 @@ int LoadfileSeg(char* name, char* addr, int offset, int loadsize) // seek to the sector sector = offset / CDSECTOR_SIZE + CdPosToInt(¤tfileinfo.pos); - + // start reading sectors from CD - while(remainingBytes > 0) + while (remainingBytes > 0) { // start reading if we getting to desired offset CdIntToPos(sector, &pos); @@ -422,7 +417,7 @@ int LoadfileSeg(char* name, char* addr, int offset, int loadsize) CdReadSync(0, result) != 0); // non-direct reads must be handled - if(sectorPtr == sectorbuffer) + if (sectorPtr == sectorbuffer) { // fetch readPtr = sectorbuffer + remainingOffset; @@ -446,7 +441,7 @@ int LoadfileSeg(char* name, char* addr, int offset, int loadsize) // go to next sector sector++; } - + return loadsize; #elif USE_PC_FILESYSTEM && !defined(__EMSCRIPTEN__) char errPrint[1024]; @@ -456,7 +451,6 @@ int LoadfileSeg(char* name, char* addr, int offset, int loadsize) #endif } - // [D] [T] void ReportMode(int on) { @@ -486,9 +480,9 @@ void data_ready(void) } } -static int current_sector = 0; // offset 0xAB27C -static char* current_address = NULL; // offset 0xAB288 -static int sectors_left = 0; // offset 0xAB280 +static int current_sector = 0; +static char* current_address = NULL; +static int sectors_left = 0; // [D] [T] void sector_ready(u_char intr, u_char* result) @@ -507,7 +501,7 @@ void sector_ready(u_char intr, u_char* result) if (sectors_left == 0) { endread = 1; - + CdReadyCallback(NULL); CdControlF(CdlPause, 0); } @@ -517,7 +511,7 @@ void sector_ready(u_char intr, u_char* result) if (*result & CdlStatShellOpen) { CdReadyCallback(NULL); - + do { } while (CdDiskReady(1) != CdlComplete); @@ -668,7 +662,7 @@ void SwapDrawBuffers2(int player) DrawSync(0); - if (player == 0) + if (player == 0) { PutDispEnv(¤t->disp); } @@ -700,7 +694,7 @@ short padd; // [D] [T] void UpdatePadData(void) -{ +{ ReadControllers(); paddp = Pads[0].mapnew; @@ -776,7 +770,7 @@ void SetupDrawBufferData(int num_players) x[0] = 0; y[0] = 0; x[1] = 0; - y[1] = SCREEN_H / 2; // 120 on NTSC + y[1] = SCREEN_H / 2; // 120 on NTSC } else { @@ -797,7 +791,7 @@ void SetupDrawBufferData(int num_players) if (toggle) { otpt = (u_int*)_OT2; - primpt = (u_char*)_primTab2; // _primTab1 + PRIMTAB_SIZE + primpt = (u_char*)_primTab2; //_primTab1 + PRIMTAB_SIZE } else { @@ -807,7 +801,7 @@ void SetupDrawBufferData(int num_players) toggle ^= 1; InitaliseDrawEnv(MPBuff[j], x[j], y[j], 320, height); - + MPBuff[j][i].primtab = (char*)primpt; MPBuff[j][i].primptr = (char*)primpt; MPBuff[j][i].ot = (OTTYPE*)otpt; @@ -837,7 +831,7 @@ void InitaliseDrawEnv(DB* pBuff, int x, int y, int w, int h) #if USE_PGXP // extend clip rectangles for widscreen - if(NumPlayers == 2) + if (NumPlayers == 2) { pBuff[0].draw.clip.x -= 256; pBuff[0].draw.clip.w += 512; @@ -885,18 +879,18 @@ void SetCityType(CITYTYPE type) // PC code switch (type) { - case CITYTYPE_NIGHT: - format = "%sN%s"; - break; - case CITYTYPE_MULTI_DAY: - format = "%sM%s"; - break; - case CITYTYPE_MULTI_NIGHT: - format = "%sMN%s"; - break; - default: - format = "%s%s"; - break; + case CITYTYPE_NIGHT: + format = "%sN%s"; + break; + case CITYTYPE_MULTI_DAY: + format = "%sM%s"; + break; + case CITYTYPE_MULTI_NIGHT: + format = "%sMN%s"; + break; + default: + format = "%s%s"; + break; } sprintf(filename, format, gDataFolder, LevelFiles[GameLevel]); @@ -927,7 +921,7 @@ void SetCityType(CITYTYPE type) int i; int sector; int* data; - + switch (type) { case CITYTYPE_NIGHT: @@ -965,7 +959,6 @@ void SetCityType(CITYTYPE type) do { do { - if (CdDiskReady(0) != CdlComplete) DoCDRetry(); @@ -975,7 +968,7 @@ void SetCityType(CITYTYPE type) } while (CdReadSync(0, result) != 0); data = (int*)_OT1 + 2; - + for (i = 0; i < 4; i++) { citylumps[GameLevel][i].x = data[0] + sector * CDSECTOR_SIZE; @@ -994,17 +987,17 @@ void SetCityType(CITYTYPE type) // [D] [T] CDTYPE DiscSwapped(char* filename) { -#if 1//ndef PSX +#if 1 //ndef PSX return CDTYPE_CORRECTDISC; #else CDTYPE ret; CdlFILE cdfile; - switch(CdDiskReady(1)) + switch (CdDiskReady(1)) { case CdlStatStandby: { - switch(CdGetDiskType()) + switch (CdGetDiskType()) { case CdlStatNoDisk: ret = CDTYPE_NODISC; @@ -1018,7 +1011,7 @@ CDTYPE DiscSwapped(char* filename) ret = CDTYPE_CORRECTDISC; else ret = CDTYPE_DISCERROR; - + break; } } diff --git a/src_rebuild/Game/C/system.h b/src_rebuild/Game/C/system.h index 477c4b77d..d8aa2618f 100644 --- a/src_rebuild/Game/C/system.h +++ b/src_rebuild/Game/C/system.h @@ -26,7 +26,6 @@ enum CITYTYPE CITYTYPE_MULTI_NIGHT = 3, }; - extern volatile char* _overlay_buffer; // 0x1C0000 extern volatile char* _frontend_buffer; // 0xFB400 extern volatile char* _other_buffer; // 0xF3000 @@ -84,13 +83,13 @@ extern void sys_freeall(); #ifdef __GNUC__ #define D_MALLOC_END() \ D_TEMPFREE();\ - if(mallocptr > _oldmalloc)\ + if (mallocptr > _oldmalloc)\ DMalloc_DebugPrint("malloc(%d) in %s, line %d. Malloc usage: %d\n", mallocptr-_oldmalloc, FUNCNAME, __LINE__, (mallocptr-malloctab));\ } // D_MALLOC_BEGIN block #else #define D_MALLOC_END() \ D_TEMPFREE();\ - if(mallocptr > _oldmalloc)\ + if (mallocptr > _oldmalloc)\ DMalloc_DebugPrint("malloc(%d) in " FUNCNAME ", line %d. Malloc usage: %d\n", mallocptr-_oldmalloc, __LINE__, (mallocptr-malloctab));\ } // D_MALLOC_BEGIN block #endif @@ -132,7 +131,7 @@ extern DRAW_MODE draw_mode_ntsc; #define video_mode MODE_NTSC #endif // PAL -// ordering table size +// ordering table size #ifdef PSX #define OTSIZE 0x1080 #else @@ -190,5 +189,4 @@ extern void SetCityType(CITYTYPE type); // 0x0007F118 extern CITYTYPE GetCityType(); extern CDTYPE DiscSwapped(char *filename); // 0x0007F640 - -#endif +#endif // SYSTEM_H diff --git a/src_rebuild/Game/C/targets.c b/src_rebuild/Game/C/targets.c index c8f0722e6..be9081c90 100644 --- a/src_rebuild/Game/C/targets.c +++ b/src_rebuild/Game/C/targets.c @@ -18,7 +18,7 @@ struct TARGET_ARROW_MODEL char numTris; }; -SVECTOR targetArrowVerts[] = +SVECTOR targetArrowVerts[] = { { -45, -270, 0, 0 }, { 45, -270, 0, 0 }, @@ -142,7 +142,7 @@ void DrawTargetArrowModel(TARGET_ARROW_MODEL *pTargetArrowModel, VECTOR *pPositi { poly = (POLY_F3 *)current->primptr; - if (invert == 0) + if (invert == 0) { gte_ldv3(&pVerts[tri_indices[0]], &pVerts[tri_indices[1]], &pVerts[tri_indices[2]]); } @@ -172,7 +172,7 @@ void DrawTargetArrowModel(TARGET_ARROW_MODEL *pTargetArrowModel, VECTOR *pPositi setPolyF3(poly); - if (gDraw3DArrowBlue == 0) + if (gDraw3DArrowBlue == 0) { poly->r0 = 255; poly->g0 = 0; @@ -198,7 +198,7 @@ void DrawTargetArrowModel(TARGET_ARROW_MODEL *pTargetArrowModel, VECTOR *pPositi current->primptr += sizeof(POLY_F3); } - if (shadow != 0) + if (shadow != 0) DrawStopZone(pPosition); } @@ -286,10 +286,10 @@ void DrawStopZone(VECTOR *pPosition) int height; VECTOR pStopZonePt[4] = { - {-256, 0, 256}, - {256, 0, 256}, - {-256, 0, -256}, - {256, 0, -256}, + { -256, 0, 256 }, + { 256, 0, 256 }, + { -256, 0, -256 }, + { 256, 0, -256 } }; flash = -CameraCnt % 16; @@ -358,9 +358,3 @@ void DrawStopZone(VECTOR *pPosition) current->primptr += sizeof(POLY_FT4); } - - - - - - diff --git a/src_rebuild/Game/C/targets.h b/src_rebuild/Game/C/targets.h index b36c588a1..2c210b412 100644 --- a/src_rebuild/Game/C/targets.h +++ b/src_rebuild/Game/C/targets.h @@ -6,4 +6,4 @@ extern int gDraw3DArrowBlue; extern void Draw3DTarget(VECTOR *position, int flags); // 0x0007FB44 extern void DrawStopZone(VECTOR *pPosition); // 0x000800F8 -#endif +#endif // TARGETS_H diff --git a/src_rebuild/Game/C/texture.c b/src_rebuild/Game/C/texture.c index 5101df2e5..0c46ae68a 100644 --- a/src_rebuild/Game/C/texture.c +++ b/src_rebuild/Game/C/texture.c @@ -85,7 +85,7 @@ void IncrementClutNum(RECT16 *clut) { clut->x += 16; - if (clut->x >= 1024) + if (clut->x >= 1024) { clut->x = 960; clut->y += 1; @@ -100,7 +100,7 @@ void IncrementTPageNum(RECT16 *tpage) while (++i) { // proper tpage position? - if ((tpage->x == tpagepos[i - 1].x) && + if ((tpage->x == tpagepos[i - 1].x) && (tpage->y == tpagepos[i - 1].y)) { if (tpagepos[i].x == -1) @@ -128,7 +128,7 @@ void IncrementTPageNum(RECT16 *tpage) } #ifndef PSX -// [A] - loads TIM files as level textures +// [A] loads TIM files as level textures void LoadTPageFromTIMs(int tpage2send) { int i, j; @@ -136,7 +136,7 @@ void LoadTPageFromTIMs(int tpage2send) RECT16 tmpclut; SXYPAIR tpage; int tpn; - + char filename[64]; TEXINF* details = tpage_ids[tpage2send]; @@ -144,9 +144,9 @@ void LoadTPageFromTIMs(int tpage2send) tpage.x = tpn << 6 & 0x3c0; tpage.y = (tpn << 4 & 0x100) + (tpn >> 2 & 0x200); - + // try loading TIMs directly - for(i = 0; i < tpage_texamts[tpage2send]; i++) + for (i = 0; i < tpage_texamts[tpage2send]; i++) { TIMIMAGEHDR* timClut; TIMIMAGEHDR* timData; @@ -177,9 +177,9 @@ void LoadTPageFromTIMs(int tpage2send) if (!FileExists(filename)) sprintf(filename, "LEVELS\\%s\\PAGE_%d\\%s_%d.TIM", LevelNames[GameLevel], tpage2send, textureName, i); - if(!FileExists(filename)) + if (!FileExists(filename)) continue; - + Loadfile(filename, (char*)_other_buffer); // get TIM data @@ -211,7 +211,7 @@ void LoadTPageFromTIMs(int tpage2send) // FIXME: // this is a wasteful way handling multiple palettes // we just allocate new palettes to ensure that it would not glitch - if(clutN == 0 || j > 0 && cpal > 0) + if (clutN == 0 || j > 0 && cpal > 0) { // add new CLUT clutN = GetClut(clutpos.x, clutpos.y); @@ -219,7 +219,7 @@ void LoadTPageFromTIMs(int tpage2send) civ_clut[cpal][i][j] = clutN; } #endif - + tmpclut.x = (clutN & 0x3f) << 4; tmpclut.y = (clutN >> 6); tmpclut.w = 16; @@ -249,7 +249,7 @@ int LoadTPageAndCluts(RECT16 *tpage, RECT16 *cluts, int tpage2send, char *tpagea tpageaddress += 32; texture_cluts[tpage2send][i] = GetClut(cluts->x, cluts->y); - + IncrementClutNum(cluts); } @@ -291,7 +291,7 @@ int Find_TexID(MODEL *model, int t_id) polylist += PolySizes[*polylist]; } - + return 0; } @@ -398,7 +398,7 @@ void LoadPermanentTPagesFromTIM() for (slot = 0; slot < 19; slot++) { - if(tpageslots[slot] != 0xFF) + if (tpageslots[slot] != 0xFF) { int tpage = tpageslots[slot]; LoadTPageFromTIMs(tpage); @@ -407,17 +407,16 @@ void LoadPermanentTPagesFromTIM() // initialize ALL texture palettes // this makes damaged textures appear properly int pal = GetCarPalIndex(tpage); - + if (pal) { int carpal = GetCarPalIndex(tpage); - if(carpal > 0) + if (carpal > 0) { for (int i = 0; i < 32; i++) civ_clut[carpal][i][0] = texture_cluts[tpage][i]; } - } #endif } @@ -472,7 +471,7 @@ void LoadPermanentTPages(int *sector) IncrementClutNum(&clutpos); fontclutpos = clutpos; - + IncrementClutNum(&clutpos); ProcessPalletLump(palette_lump, 0); @@ -499,7 +498,7 @@ void LoadPermanentTPages(int *sector) tpagebuffer += (permlist[i].y + 2047) & -CDSECTOR_SIZE; } - + tpagebuffer = (char*)mallocptr; slot_clutpos[slotsused].vx = clutpos.x; @@ -519,7 +518,7 @@ void LoadPermanentTPages(int *sector) if (nspecpages != 0) { int temp, clutsloaded; - + temp = 0; clutsloaded = 0; @@ -531,7 +530,7 @@ void LoadPermanentTPages(int *sector) loadsectors(tpagebuffer, *sector, nsectors); *sector += nsectors; - + for (i = 0; i < nspecpages; i++) { int tp, npalettes; @@ -569,7 +568,7 @@ void LoadPermanentTPages(int *sector) } } - if (clutpos.x != 960) + if (clutpos.x != 960) { clutpos.x = 960; clutpos.y++; @@ -605,7 +604,7 @@ void GetTextureDetails(char *name, TEXTURE_DETAILS *info) int texamt; char *nametable; TEXINF *texinf; - + nametable = texturename_buffer; for (i = 0; i < tpage_amount; i++) @@ -634,8 +633,3 @@ void GetTextureDetails(char *name, TEXTURE_DETAILS *info) GetTextureDetails("SEA", info); // weird but ok, ok... } - - - - - diff --git a/src_rebuild/Game/C/texture.h b/src_rebuild/Game/C/texture.h index 9e1fde9c8..6a6f18b76 100644 --- a/src_rebuild/Game/C/texture.h +++ b/src_rebuild/Game/C/texture.h @@ -50,9 +50,9 @@ extern void LoadPermanentTPages(int *sector); // 0x00080688 extern void ReloadIcons(); // 0x00081118 #ifndef PSX - // [A] - loads TIM files as level textures +// [A] loads TIM files as level textures void LoadTPageFromTIMs(int tpage2send); void LoadPermanentTPagesFromTIM(); #endif -#endif +#endif // TEXTURE_H diff --git a/src_rebuild/Game/C/tile.c b/src_rebuild/Game/C/tile.c index 28a647713..90a4b7791 100644 --- a/src_rebuild/Game/C/tile.c +++ b/src_rebuild/Game/C/tile.c @@ -113,7 +113,7 @@ void Tile1x1Lit(MODEL* model) // done plotContext.current->primptr = plotContext.primptr; } -#endif +#endif // DYNAMIC_LIGHTING // [D] [T] [A] void Tile1x1(MODEL *model) @@ -160,7 +160,7 @@ void Tile1x1(MODEL *model) *(uint*)&prims->r0 = plotContext.colour; setPolyFT4(prims); - + // retrieve first three verts gte_stsxy3(&prims->x0, &prims->x1, &prims->x2); @@ -209,7 +209,6 @@ inline int fst_div_3(int x) return x * 171 >> 9; } - // [D] [T] void DrawTILES(PACKED_CELL_OBJECT** tiles, int tile_amount) { @@ -219,7 +218,7 @@ void DrawTILES(PACKED_CELL_OBJECT** tiles, int tile_amount) int previous_matrix, yang, dofse, Z; int model_number; - if (gTimeOfDay > -1) + if (gTimeOfDay > -1) { int combo = combointensity; if (gTimeOfDay < TIME_NIGHT) @@ -230,11 +229,11 @@ void DrawTILES(PACKED_CELL_OBJECT** tiles, int tile_amount) { #ifdef DYNAMIC_LIGHTING int t; - t = GameLevel == 2 && gEnableDlights == 1; + t = (GameLevel == LEVEL_VEGAS && gEnableDlights == 1); plotContext.colour = fst_div_lut_3_5(combo >> 16 & 255, t) << 16 | fst_div_lut_3_5(combo >> 8 & 255, t) << 8 | fst_div_lut_3_5(combo & 255, t) | 0x2C000000U; #else plotContext.colour = fst_div_3(combo >> 16 & 255) << 16 | fst_div_3(combo >> 8 & 255) << 8 | fst_div_3(combo & 255) | 0x2C000000U; -#endif +#endif // DYNAMIC_LIGHTING } } @@ -260,11 +259,11 @@ void DrawTILES(PACKED_CELL_OBJECT** tiles, int tile_amount) while (tile_amount--) { ppco = *tilePointers++; - + plotContext.scribble[0] = ppco->pos.vx; plotContext.scribble[1] = (ppco->pos.vy << 0x10) >> 0x11; plotContext.scribble[2] = ppco->pos.vz; - + yang = ppco->value & 0x3f; model_number = (ppco->value >> 6) | (ppco->pos.vy & 1) << 10; @@ -292,7 +291,7 @@ void DrawTILES(PACKED_CELL_OBJECT** tiles, int tile_amount) else { pModel = Z > DRAW_LOD_DIST_LOW ? pLodModels[model_number] : modelpointers[model_number]; - + #ifdef DYNAMIC_LIGHTING (gEnableDlights ? Tile1x1Lit : Tile1x1)(pModel); #else @@ -300,6 +299,7 @@ void DrawTILES(PACKED_CELL_OBJECT** tiles, int tile_amount) #endif // DYNAMIC_LIGHTING } } + current->primptr = plotContext.primptr; } @@ -388,7 +388,6 @@ void makeMesh(MVERTEX(*VSP)[5][5], int m, int n) SetVec(&e5, e5.vx >> 1, e5.vy >> 1, e5.vz >> 1); - VecAdd(&p5, &e5, &p1); // e5 * 0.5f + p1; p5.uv.s.u0 = e5.uv.s.u0 + p1.uv.s.u0; p5.uv.s.v0 = e5.uv.s.v0 + p1.uv.s.v0; @@ -416,7 +415,6 @@ void makeMesh(MVERTEX(*VSP)[5][5], int m, int n) (*VSP)[3][3] = p2; } - // [A] custom implemented function void drawMesh(MVERTEX(*VSP)[5][5], int m, int n, _pct *pc) { @@ -448,7 +446,7 @@ void drawMesh(MVERTEX(*VSP)[5][5], int m, int n, _pct *pc) gte_stopz(&opz); gte_avsz3(); - + gte_stotz(&z); if (pc->flags & (PLOT_NO_CULL | PLOT_INV_CULL)) @@ -589,7 +587,7 @@ void SubdivNxM(char *polys, int n, int m, int ofse) SVECTOR* verts = plotContext.verts; POLYFT4* pft4 = (POLYFT4*)polys; - + plotContext.clut = (u_int)(*plotContext.ptexture_cluts)[pft4->texture_set][pft4->texture_id]; plotContext.tpage = (u_int)(*plotContext.ptexture_pages)[pft4->texture_set]; @@ -612,7 +610,7 @@ void SubdivNxM(char *polys, int n, int m, int ofse) (gEnableDlights ? drawMeshLit : drawMesh)((MVERTEX(*)[5][5])subdivVerts, m, n, &plotContext); #else drawMesh((MVERTEX(*)[5][5])subdivVerts, m, n, &plotContext); -#endif +#endif // DYNAMIC_LIGHTING plotContext.ot -= ofse; } @@ -632,7 +630,7 @@ void TileNxN(MODEL *model, int levels, int Dofse) tileTypes = *(u_int *)(model + 1) >> 2; // grass should be under pavements and other things - if((model->shape_flags & SHAPE_FLAG_WATER) || (model->flags2 & MODEL_FLAG_GRASS)) + if ((model->shape_flags & SHAPE_FLAG_WATER) || (model->flags2 & MODEL_FLAG_GRASS)) ofse = 229; else ofse = 133; @@ -646,21 +644,22 @@ void TileNxN(MODEL *model, int levels, int Dofse) i = model->num_polys; ttype = 0; + while (i--) { #if USE_PGXP switch (ttype) { - case 0: - case 1: - PGXP_SetZOffsetScale(0.0f, ofse > 200 ? 1.008f : 0.995f); - break; - case 3: - PGXP_SetZOffsetScale(0.0f, ofse < 40 ? 1.0f : 0.991f); - break; - case 4: - PGXP_SetZOffsetScale(0.0f, 1.0f); - break; + case 0: + case 1: + PGXP_SetZOffsetScale(0.0f, ofse > 200 ? 1.008f : 0.995f); + break; + case 3: + PGXP_SetZOffsetScale(0.0f, ofse < 40 ? 1.0f : 0.991f); + break; + case 4: + PGXP_SetZOffsetScale(0.0f, 1.0f); + break; } #endif @@ -677,12 +676,11 @@ void TileNxN(MODEL *model, int levels, int Dofse) #endif } +// UNUSED - Driver 1 leftover void ProcessSubDivisionLump(char *lump_ptr, int lump_size) { - // Driver 1 leftover... UNIMPLEMENTED(); - /* - SubDivisionArrays = lump_ptr; + /*SubDivisionArrays = lump_ptr; return;*/ } @@ -702,8 +700,3 @@ void ProcessLowDetailTable(char *lump_ptr, int lump_size) pLodModels[i] = modelpointers[i]; } } - - - - - diff --git a/src_rebuild/Game/C/tile.h b/src_rebuild/Game/C/tile.h index 8c6a927ca..1ac1d1bf4 100644 --- a/src_rebuild/Game/C/tile.h +++ b/src_rebuild/Game/C/tile.h @@ -11,8 +11,8 @@ struct MVERTEX struct { u_char u0; u_char v0; - }s; - }uv; + } s; + } uv; }; struct VERTEX @@ -35,5 +35,4 @@ extern void TileNxN(MODEL *model, int levels, int Dofse); // 0x00042F40 extern void ProcessSubDivisionLump(char *lump_ptr, int lump_size); // 0x00042F34 extern void ProcessLowDetailTable(char *lump_ptr, int lump_size); // 0x00043090 - -#endif +#endif // TILE_H diff --git a/src_rebuild/Game/C/time.c b/src_rebuild/Game/C/time.c index 9d34614be..fbffc4284 100644 --- a/src_rebuild/Game/C/time.c +++ b/src_rebuild/Game/C/time.c @@ -7,8 +7,3 @@ void GetTimeStamp(char *buffer) if (buffer) sprintf(buffer, "%s %s", __DATE__, __TIME__); } - - - - - diff --git a/src_rebuild/Game/C/time.h b/src_rebuild/Game/C/time.h index eb95d73e9..afc9550dd 100644 --- a/src_rebuild/Game/C/time.h +++ b/src_rebuild/Game/C/time.h @@ -1,8 +1,6 @@ #ifndef TIME_H #define TIME_H - extern void GetTimeStamp(char *buffer); // 0x00081140 - -#endif +#endif // TIME_H diff --git a/src_rebuild/Game/C/wheelforces.c b/src_rebuild/Game/C/wheelforces.c index f6abdb75e..74bb0d003 100644 --- a/src_rebuild/Game/C/wheelforces.c +++ b/src_rebuild/Game/C/wheelforces.c @@ -186,7 +186,6 @@ void ConvertTorqueToAngularAcceleration(CAR_DATA* cp, CAR_LOCALS* cl) } } - // [D] [T] void AddWheelForcesDriver1(CAR_DATA* cp, CAR_LOCALS* cl) { @@ -323,7 +322,7 @@ void AddWheelForcesDriver1(CAR_DATA* cp, CAR_LOCALS* cl) if (ABS(newCompression - oldCompression) > 12 && (i & 1U) != 0) { chan = GetFreeChannel(0); - if(chan > -1) + if (chan > -1) { if (NumPlayers > 1 && NoPlayerControl == 0) SetPlayerOwnsChannel(chan, player_id); @@ -412,7 +411,7 @@ void AddWheelForcesDriver1(CAR_DATA* cp, CAR_LOCALS* cl) if (slidevel < -12500) slidevel = -12500; } - + if ((i & 1U) != 0) { // rear wheels @@ -438,13 +437,13 @@ void AddWheelForcesDriver1(CAR_DATA* cp, CAR_LOCALS* cl) { // front wheels sidevel = frontFS * slidevel + 2048 >> 12; - + if (wheel->locked) { sidevel = (frontFS * slidevel + 2048 >> 13) + sidevel >> 1; - + forcefac = FixHalfRound(FIXEDH(-sidevel * lfx) * sdz - FIXEDH(-sidevel * lfz) * sdx, 11); - + force.vx = forcefac * sdz; force.vz = -forcefac * sdx; } @@ -505,7 +504,7 @@ void AddWheelForcesDriver1(CAR_DATA* cp, CAR_LOCALS* cl) cp->hd.acc[0] += force.vx; cp->hd.acc[1] += force.vy; cp->hd.acc[2] += force.vz; - + cp->hd.aacc[0] += FIXEDH(wheelPos[1] * force.vz - wheelPos[2] * force.vy); cp->hd.aacc[1] += FIXEDH(wheelPos[2] * force.vx - wheelPos[0] * force.vz); cp->hd.aacc[2] += FIXEDH(wheelPos[0] * force.vy - wheelPos[1] * force.vx); @@ -564,7 +563,7 @@ void StepOneCar(CAR_DATA* cp) { _cl.vel[i] = cp->st.n.linearVelocity[i]; _cl.avel[i] = cp->st.n.angularVelocity[i]; - + cp->st.n.fposition[i] = (cp->st.n.fposition[i] & 0xF) + cp->hd.where.t[i] * 16; } @@ -593,7 +592,7 @@ void StepOneCar(CAR_DATA* cp) if (cp->hd.where.m[1][1] > 2048) { - if(cp->controlType == CONTROL_TYPE_CIV_AI) + if (cp->controlType == CONTROL_TYPE_CIV_AI) count = (cp->totalDamage != 0) * 4; else count = 4; @@ -756,4 +755,4 @@ void StepOneCar(CAR_DATA* cp) ConvertTorqueToAngularAcceleration(cp, &_cl); cp->hd.mayBeColliding = 0; -} \ No newline at end of file +} diff --git a/src_rebuild/Game/C/wheelforces.h b/src_rebuild/Game/C/wheelforces.h index c38f55412..c8b8fe303 100644 --- a/src_rebuild/Game/C/wheelforces.h +++ b/src_rebuild/Game/C/wheelforces.h @@ -6,5 +6,4 @@ extern HANDLING_TYPE handlingType[7]; extern void StepCars(); // 0x00082BD0 extern void StepOneCar(CAR_DATA *cp); // 0x00081178 - -#endif +#endif // WHEELFORCES_H diff --git a/src_rebuild/Game/C/xaplay.c b/src_rebuild/Game/C/xaplay.c index c8e972172..1f2874453 100644 --- a/src_rebuild/Game/C/xaplay.c +++ b/src_rebuild/Game/C/xaplay.c @@ -1,7 +1,6 @@ #include "driver2.h" #include "xaplay.h" - #include "camera.h" #include "fmvplay.h" #include "pause.h" @@ -61,7 +60,6 @@ static int StartPos; static CdlLOC pause_loc; static u_int buffer[8]; - #ifndef PSX struct XA_SUBTITLE { @@ -102,7 +100,7 @@ void StoreXASubtitles() for (int i = 0; i < numSubtitles; i++) { CUESubtitle_t* sub = &tmpWav.m_subtitles[i]; - + strcpy(subtitles[i].text, sub->text); subtitles[i].startframe = sub->sampleStart; subtitles[i].endframe = sub->sampleStart + sub->sampleLength; @@ -127,21 +125,21 @@ void PrintXASubtitles(int yPos) { if (gSubtitles == 0 || pauseflag) return; - + if (gPlaying == 0 || g_wavData == NULL) return; int curTime = (VSync(-1) - gXASubtitleTime) * 17; // find subtitles - for(int i = 0; i < gNumXASubtitles; i++) + for (int i = 0; i < gNumXASubtitles; i++) { XA_SUBTITLE* sub = &gXASubtitles[i]; int subStartFrame = sub->startframe; int subEndFrame = sub->endframe; - if(curTime >= subStartFrame && curTime <= subEndFrame) + if (curTime >= subStartFrame && curTime <= subEndFrame) { SetTextColour(120, 120, 120); PrintStringCentred(sub->text, yPos); @@ -158,7 +156,7 @@ void GetMissionXAData(int number) char filename[64]; sprintf(filename, XANames[number], gDataFolder); - + CdSearchFile(&fp, XANames[number]); XAMissionMessages[number].start = CdPosToInt((CdlLOC *)&fp); #endif @@ -176,7 +174,7 @@ void GetXAData(int number) GetMissionXAData(i++); } while (i < 4); } - else + else { GetMissionXAData(number); } @@ -196,7 +194,6 @@ void SetXAVolume(int volume) #endif } - CdlCB oldreadycallback; void* olddatacallback; @@ -261,7 +258,7 @@ void PlayXA(int num, int index) CdlLOC loc; u_char res[8]; - if (xa_prepared && gPlaying != 1) + if (xa_prepared && gPlaying != 1) { filt.chan = index; StartPos = XAMissionMessages[num].start; @@ -368,7 +365,7 @@ void UnprepareXA(void) { delete g_wavData; g_wavData = NULL; - + delete g_XAWave; g_XAWave = NULL; } @@ -400,14 +397,14 @@ void cbready(int intr, unsigned char *result) { UNIMPLEMENTED(); #if 0 - if (intr == 1) + if (intr == 1) { CdGetSector(buffer, 8); ID = buffer[3]; CurrentChannel = ((u_int)buffer[3] & 0x7c00) >> 10; // there is buffer[3]+2 bytes - if (buffer[3] == 0x160) + if (buffer[3] == 0x160) { finished_count = finished_count | 1 << (CurrentChannel + 1 & 0x1f); @@ -485,8 +482,3 @@ void PauseXA(void) } #endif } - - - - - diff --git a/src_rebuild/Game/C/xaplay.h b/src_rebuild/Game/C/xaplay.h index fee156d96..127c18df3 100644 --- a/src_rebuild/Game/C/xaplay.h +++ b/src_rebuild/Game/C/xaplay.h @@ -17,5 +17,4 @@ extern void StopXA(); // 0x00082F78 extern void ResumeXA(); // 0x00082FC4 extern void PauseXA(); // 0x00083078 - -#endif +#endif // XAPLAY_H diff --git a/src_rebuild/Game/C/xmcalls.h b/src_rebuild/Game/C/xmcalls.h index 4d6b336fb..811c89731 100644 --- a/src_rebuild/Game/C/xmcalls.h +++ b/src_rebuild/Game/C/xmcalls.h @@ -1,14 +1,14 @@ #ifndef XMCALLS #define XMCALLS -#define XM_UseXMPanning 0 /* S3M Panning switches */ +#define XM_UseXMPanning 0 /* S3M Panning switches */ #define XM_UseS3MPanning 1 -#define XM_Loop 1 /* Looping song */ -#define XM_NoLoop 0 /* Once off song */ -#define XM_STOPPED 0 /* Song/SFX Status */ +#define XM_Loop 1 /* Looping song */ +#define XM_NoLoop 0 /* Once off song */ +#define XM_STOPPED 0 /* Song/SFX Status */ #define XM_PLAYING 1 #define XM_PAUSED 2 #define XM_NO_SONG_ALLOCATED 3 #define XM_NOT_INIT 4 -#endif \ No newline at end of file +#endif // XMCALLS diff --git a/src_rebuild/Game/C/xmplay.c b/src_rebuild/Game/C/xmplay.c index c0d95611a..c5bb76d44 100644 --- a/src_rebuild/Game/C/xmplay.c +++ b/src_rebuild/Game/C/xmplay.c @@ -15,19 +15,20 @@ XMPLAY.C #include "xmplay.h" #include "xmcalls.h" + /**** PSX SPECIFIC ****/ SpuVoiceAttr xm_g_s_attr; /* Structure for individual voice attributes*/ SpuVoiceAttr uxm_g_s_attr; /* Structure for individual voice attributes*/ SpuReverbAttr xm_r_attr; /* Structure for reverb */ -unsigned int xm_l_vag_spu_addr[8][128]; /* Address in memory for first sound file */ +unsigned int xm_l_vag_spu_addr[8][128]; /* Address in memory for first sound file */ /**** XM SPECIFIC ****/ int JP_Do_Nothing; -#define NTSCBPMLIMIT 150 //150 //750/5 //750/5 +#define NTSCBPMLIMIT 150 //150 //750/5 //750/5 int BPMLimit; int PALType; @@ -36,41 +37,42 @@ int JPError = 0; char MonoMode = XM_STEREO; -XMCHANNEL *XMCU; -XMCHANNEL *XMC; +XMCHANNEL *XMCU; +XMCHANNEL *XMC; //XMHEADER XM_Header[8]; /* MAX 8 XM's files in memory at once */ -XMHEADER *mh; /* Pointer used by internal routines */ -XMHEADER *mhu; /* Pointer used by User routines */ +XMHEADER *mh; /* Pointer used by internal routines */ +XMHEADER *mhu; /* Pointer used by User routines */ //XMSONG XM_Song[24]; /* MAX 24 XM's playing at once */ -XMSONG *ms; /* Pointer used by internal routines */ -XMSONG *mu; /* Pointer used by User routines */ - +XMSONG *ms; /* Pointer used by internal routines */ +XMSONG *mu; /* Pointer used by User routines */ -int XM_NSA = 0; // NEXT SONG ADDRESS +int XM_NSA = 0; // NEXT SONG ADDRESS int XM_HA = 0; // NEXT HEADER Address; u_char *XM_SngAddress[32]; u_char *XM_HeaderAddress[8]; //XMSONG *XM_SngAddress[24]; -//#define getSWord(mpp) ((short)((u_char)(*(mpp))+(u_char)((*((mpp)+1))<<8))) -//#define getWord(mpp) ((u_short)((u_char)(*(mpp))+(u_char)((*((mpp)+1))<<8))) +//#define getSWord(mpp) ((short)((u_char)(*(mpp)) + (u_char)((*((mpp) + 1)) << 8))) +//#define getWord(mpp) ((u_short)((u_char)(*(mpp)) + (u_char)((*((mpp) + 1)) << 8))) #define getWord(mpp) ((u_short)((*(u_char *)(mpp)) + ((*((u_char *)(mpp) + 1)) << 8))) #define getSWord(mpp) ((short)((*(u_char *)(mpp)) + ((*((u_char *)(mpp) + 1)) << 8))) int CurrentCh; - short iVABID[8] = { -1,-1,-1,-1,-1,-1,-1,-1 }; -short XMSongIDs[24] = -{ -1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1}; +short XMSongIDs[24] = { + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1 +}; + +short XMSPU_SFX[24] = { + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1 +}; -short XMSPU_SFX[24] = -{ -1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1}; /***************************************************************************** LINEAR FREQUENCY TABLE used to calculate final SPU pitch @@ -181,22 +183,22 @@ u_short lintab[768] = { AMIGA FREQUENCY TABLE *****************************************************************************/ -#define LOGFAC 2*16 +#define LOGFAC 2 * 16 u_short logtab[] = { - LOGFAC * 907,LOGFAC * 900,LOGFAC * 894,LOGFAC * 887,LOGFAC * 881,LOGFAC * 875,LOGFAC * 868,LOGFAC * 862, - LOGFAC * 856,LOGFAC * 850,LOGFAC * 844,LOGFAC * 838,LOGFAC * 832,LOGFAC * 826,LOGFAC * 820,LOGFAC * 814, - LOGFAC * 808,LOGFAC * 802,LOGFAC * 796,LOGFAC * 791,LOGFAC * 785,LOGFAC * 779,LOGFAC * 774,LOGFAC * 768, - LOGFAC * 762,LOGFAC * 757,LOGFAC * 752,LOGFAC * 746,LOGFAC * 741,LOGFAC * 736,LOGFAC * 730,LOGFAC * 725, - LOGFAC * 720,LOGFAC * 715,LOGFAC * 709,LOGFAC * 704,LOGFAC * 699,LOGFAC * 694,LOGFAC * 689,LOGFAC * 684, - LOGFAC * 678,LOGFAC * 675,LOGFAC * 670,LOGFAC * 665,LOGFAC * 660,LOGFAC * 655,LOGFAC * 651,LOGFAC * 646, - LOGFAC * 640,LOGFAC * 636,LOGFAC * 632,LOGFAC * 628,LOGFAC * 623,LOGFAC * 619,LOGFAC * 614,LOGFAC * 610, - LOGFAC * 604,LOGFAC * 601,LOGFAC * 597,LOGFAC * 592,LOGFAC * 588,LOGFAC * 584,LOGFAC * 580,LOGFAC * 575, - LOGFAC * 570,LOGFAC * 567,LOGFAC * 563,LOGFAC * 559,LOGFAC * 555,LOGFAC * 551,LOGFAC * 547,LOGFAC * 543, - LOGFAC * 538,LOGFAC * 535,LOGFAC * 532,LOGFAC * 528,LOGFAC * 524,LOGFAC * 520,LOGFAC * 516,LOGFAC * 513, - LOGFAC * 508,LOGFAC * 505,LOGFAC * 502,LOGFAC * 498,LOGFAC * 494,LOGFAC * 491,LOGFAC * 487,LOGFAC * 484, - LOGFAC * 480,LOGFAC * 477,LOGFAC * 474,LOGFAC * 470,LOGFAC * 467,LOGFAC * 463,LOGFAC * 460,LOGFAC * 457, - LOGFAC * 453,LOGFAC * 450,LOGFAC * 447,LOGFAC * 443,LOGFAC * 440,LOGFAC * 437,LOGFAC * 434,LOGFAC * 431 + LOGFAC * 907, LOGFAC * 900, LOGFAC * 894, LOGFAC * 887, LOGFAC * 881, LOGFAC * 875, LOGFAC * 868, LOGFAC * 862, + LOGFAC * 856, LOGFAC * 850, LOGFAC * 844, LOGFAC * 838, LOGFAC * 832, LOGFAC * 826, LOGFAC * 820, LOGFAC * 814, + LOGFAC * 808, LOGFAC * 802, LOGFAC * 796, LOGFAC * 791, LOGFAC * 785, LOGFAC * 779, LOGFAC * 774, LOGFAC * 768, + LOGFAC * 762, LOGFAC * 757, LOGFAC * 752, LOGFAC * 746, LOGFAC * 741, LOGFAC * 736, LOGFAC * 730, LOGFAC * 725, + LOGFAC * 720, LOGFAC * 715, LOGFAC * 709, LOGFAC * 704, LOGFAC * 699, LOGFAC * 694, LOGFAC * 689, LOGFAC * 684, + LOGFAC * 678, LOGFAC * 675, LOGFAC * 670, LOGFAC * 665, LOGFAC * 660, LOGFAC * 655, LOGFAC * 651, LOGFAC * 646, + LOGFAC * 640, LOGFAC * 636, LOGFAC * 632, LOGFAC * 628, LOGFAC * 623, LOGFAC * 619, LOGFAC * 614, LOGFAC * 610, + LOGFAC * 604, LOGFAC * 601, LOGFAC * 597, LOGFAC * 592, LOGFAC * 588, LOGFAC * 584, LOGFAC * 580, LOGFAC * 575, + LOGFAC * 570, LOGFAC * 567, LOGFAC * 563, LOGFAC * 559, LOGFAC * 555, LOGFAC * 551, LOGFAC * 547, LOGFAC * 543, + LOGFAC * 538, LOGFAC * 535, LOGFAC * 532, LOGFAC * 528, LOGFAC * 524, LOGFAC * 520, LOGFAC * 516, LOGFAC * 513, + LOGFAC * 508, LOGFAC * 505, LOGFAC * 502, LOGFAC * 498, LOGFAC * 494, LOGFAC * 491, LOGFAC * 487, LOGFAC * 484, + LOGFAC * 480, LOGFAC * 477, LOGFAC * 474, LOGFAC * 470, LOGFAC * 467, LOGFAC * 463, LOGFAC * 460, LOGFAC * 457, + LOGFAC * 453, LOGFAC * 450, LOGFAC * 447, LOGFAC * 443, LOGFAC * 440, LOGFAC * 437, LOGFAC * 434, LOGFAC * 431 }; @@ -205,10 +207,10 @@ VIBRATO SINE TABLE *****************************************************************************/ static u_char VibratoTable[32] = { - 0,24,49,74,97,120,141,161, - 180,197,212,224,235,244,250,253, - 255,253,250,244,235,224,212,197, - 180,161,141,120,97,74,49,24 + 0, 24, 49, 74, 97, 120, 141, 161, + 180, 197, 212, 224, 235, 244, 250, 253, + 255, 253, 250, 244, 235, 224, 212, 197, + 180, 161, 141, 120, 97, 74, 49, 24 }; @@ -226,17 +228,17 @@ short Interpolate(short p, short p1, short p2, short v1, short v2) { short dp, dv, di; - if (p1 == p2) return v1; + if (p1 == p2) + return v1; dv = v2 - v1; dp = p2 - p1; di = p - p1; - return v1 + ((int)(di*dv) / dp); + return v1 + ((int)(di * dv) / dp); } - /***************************************************************************** GetLogPeriod Returns AMIGA period, calculated from note and fine. @@ -253,7 +255,7 @@ u_short GetLogPeriod(u_char note, u_short fine) o = (note / 12); i = fine >> 4; - i += (n << 3); /* n*8 + fine/16 */ + i += (n << 3); /* n*8 + fine/16 */ p1 = logtab[i]; p2 = logtab[i + 1]; @@ -261,12 +263,9 @@ u_short GetLogPeriod(u_char note, u_short fine) j = (Interpolate(fine / 16, 0, 15, p1, p2) >> o); if (j == 0) - { f = 1; - } - - return(j); + return (j); } @@ -276,11 +275,10 @@ JPGetPeriod *****************************************************************************/ u_short JPGetPeriod(u_char note, short fine) { - return((10L * 12 * 16 * 4) - ((u_short)note * 16 * 4) - (fine / 2) + 64); + return ((10L * 12 * 16 * 4) - ((u_short)note * 16 * 4) - (fine / 2) + 64); } - /***************************************************************************** GetPeriod Returns period using either linear or Amiga(log) frequency @@ -289,7 +287,9 @@ GetPeriod u_short GetPeriod(u_char note, u_short c2spd) { int a; + a = mh->flags; + if (ms->NotAmiga == 1) return (JPGetPeriod(note, c2spd)); // Linear Freq table else @@ -297,7 +297,6 @@ u_short GetPeriod(u_char note, u_short c2spd) } - /***************************************************************************** XM_Exit Stop all tunes. @@ -307,18 +306,18 @@ XM_Exit void XM_Exit(void) { int i; + for (i = 0; i < XM_NSA; i++) { XM_Quit(i); } + for (i = 0; i < 8; i++) { XM_CloseVAB(i); } } - - void XM_CloseVAB(int VabID) { if (iVABID[VabID] != -1) @@ -328,8 +327,6 @@ void XM_CloseVAB(int VabID) } } - - void XM_CloseVAB2(int VabID) { int Amount, i; @@ -337,16 +334,17 @@ void XM_CloseVAB2(int VabID) if (iVABID[VabID] != -1) { Amount = iVABID[VabID]; + for (i = 0; i < (Amount); i++) { xm_l_vag_spu_addr[VabID][i] = 0; } + iVABID[VabID] = -1; } } - /***************************************************************************** XM_Update Updates all songs and SFX. @@ -354,15 +352,14 @@ XM_Update void XM_Update(void) { - //XM_SCAN=VSync(1); + //XM_SCAN = VSync(1); - if (JP_Do_Nothing) /* Failsafe switch - if called on interrupt */ + if (JP_Do_Nothing) /* Failsafe switch - if called on interrupt */ return; UpdateXMData(); - //XM_SCAN=VSync(1)-XM_SCAN; - + //XM_SCAN = VSync(1) - XM_SCAN; } @@ -377,17 +374,17 @@ void XM_PlayStart(int Song_ID, int PlayMask) { if (XMSongIDs[Song_ID] == -1) return; + if (PlayMask != 0) { mu = (XMSONG*)(XM_SngAddress[Song_ID]); - // mu=&XM_Song[Song_ID]; + //mu = &XM_Song[Song_ID]; mu->PlayMask = PlayMask; mu->XMPlay = XM_PLAYING; } } - /***************************************************************************** XM_PlayStop Stops a currently playing song. @@ -400,9 +397,11 @@ void XM_PlayStop(int Song_ID) return; mu = (XMSONG*)(XM_SngAddress[Song_ID]); - // mu=&XM_Song[Song_ID]; + //mu = &XM_Song[Song_ID]; + if (!mu->XMPlay) return; + mu->XMPlay = XM_STOPPED; SilenceXM(Song_ID); } @@ -426,8 +425,7 @@ int InitXMData(u_char *mpp, int XM_ID, int S3MPan) u_int b; u_short b2; - - // mhu=&XM_Header[XM_ID]; + //mhu = &XM_Header[XM_ID]; mhu = (XMHEADER*)(XM_HeaderAddress[XM_ID]); mhu->S3MPanning = S3MPan; @@ -443,6 +441,7 @@ int InitXMData(u_char *mpp, int XM_ID, int S3MPan) mhu->tempo = getWord(mpp + MD_tempo); mhu->bpm = getWord(mpp + MD_bpm); mhu->XMPSXChannels = mhu->XMChannels; + if (mhu->XMPSXChannels > 24) mhu->XMPSXChannels = 24; @@ -456,19 +455,21 @@ int InitXMData(u_char *mpp, int XM_ID, int S3MPan) for (t = 0; t < c; t++) { - mhu->JAP_PAT_ADDR[t] = (u_int*)(mpp + a); /* Store Pattern Addr's */ + mhu->JAP_PAT_ADDR[t] = (u_int*)(mpp + a); /* Store Pattern Addr's */ b = GetLong(mpp + a); - mhu->JAP_PAT_ADDR2[t] = (u_int*)(mpp + a + b); /* Store Pattern Addr's */ + mhu->JAP_PAT_ADDR2[t] = (u_int*)(mpp + a + b); /* Store Pattern Addr's */ b2 = getWord(mpp + a + 7); b += b2; a += b; } c = mhu->numins; + for (t = 0; t < c; t++) { b = GetLong(mpp + a); b2 = getWord(mpp + a + 27); + if (b2 != 0) { mhu->JAP_SampAddr[t] = (u_int*)(mpp + 29 + a); @@ -477,13 +478,15 @@ int InitXMData(u_char *mpp, int XM_ID, int S3MPan) } else { - mhu->JAP_SampAddr[t] = (u_int*)0xcdcdcdcd; //(u_int *)(mpp+29+a); - mhu->JAP_SampHdrAddr[t] = (u_int*)0x01234567; //(u_int *)(mpp+b+a); + mhu->JAP_SampAddr[t] = (u_int*)0xcdcdcdcd; //(u_int *)(mpp + 29 + a); + mhu->JAP_SampHdrAddr[t] = (u_int*)0x01234567; //(u_int *)(mpp + b + a); } - mhu->JAP_InstrumentOffset[t] = (u_int*)(mpp + a); /* Store Instrument Addr's*/ + + mhu->JAP_InstrumentOffset[t] = (u_int*)(mpp + a); /* Store Instrument Addr's*/ a += b; } - return(mhu->XMPSXChannels); + + return (mhu->XMPSXChannels); } @@ -507,11 +510,10 @@ u_int GetLong(u_char *mpp) e = a + (b << 8) + (c << 16) + (d << 24); - return(e); + return (e); } - /***************************************************************************** XM_OnceOffInit Initialises system. Sets up for 50 or 60 fps playback @@ -521,24 +523,26 @@ void XM_OnceOffInit(int PAL) { XM_NSA = 0; JP_Do_Nothing = 0; /* Allow XM_Update to process */ -// for (i=0;i<24;i++) -// { -// mu=&XM_Song[i]; -// mu->Status=0; /* Turn off every song */ -// } + + //for (i = 0; i < 24; i++) + //{ + // mu = &XM_Song[i]; + // mu->Status = 0; /* Turn off every song */ + //} + BPMLimit = NTSCBPMLIMIT; /* Set Max limit for BPM */ + if (PAL == XM_NTSC) PALType = 0; else if (PAL == XM_PAL) { - PALType = 1; /* Set if PAL or NTSC */ -// PALType=0; /* Set if PAL or NTSC */ -// BPMLimit=125; + PALType = 1; /* Set if PAL or NTSC */ + //PALType = 0; /* Set if PAL or NTSC */ + //BPMLimit = 125; } } - /***************************************************************************** XM_Init Initialise a song or SFX. @@ -552,8 +556,8 @@ XM_Init SFXNum Pattern number to play, if XM_SFX *****************************************************************************/ -int XM_Init(int VabID,int XM_ID,int SongID, int FirstCh, - int Loop,int PlayMask,int PlayType,int SFXNum) +int XM_Init(int VabID, int XM_ID, int SongID, int FirstCh, + int Loop, int PlayMask, int PlayType, int SFXNum) { int i; int pmsk; @@ -562,152 +566,164 @@ int XM_Init(int VabID,int XM_ID,int SongID, int FirstCh, int SngID; int fr; - if (SongID==-1) + if (SongID == -1) { - SngID=GetFreeSongID(); - if (SngID==-1) - return(-1); + SngID = GetFreeSongID(); + + if (SngID == -1) + return (-1); } else { - if (SongID>=XM_NSA) - return(-1); // Not enough malloc'd song structures.. + if (SongID >= XM_NSA) + return (-1); // Not enough malloc'd song structures.. + XM_Quit(SongID); - XMSongIDs[SongID]=0; - SngID=SongID; - } - - JP_Do_Nothing=1; - mu=(XMSONG*)(XM_SngAddress[SngID]); - -// mhu=&XM_Header[XM_ID]; - mhu=(XMHEADER*)(XM_HeaderAddress[XM_ID]); - -// mu=&XM_Song[SngID]; - mu->XMPlay=XM_STOPPED; - - mu->JUp=0; - - mu->VabID=VabID; - mu->SongLoop=Loop; - mu->PlayMask=PlayMask; - mu->SFXNum=SFXNum; - - mu->Status=PlayType&0x7f; - mu->HeaderNum=XM_ID; - mu->JBPM=0; - mu->PCounter=3; - mu->reppos=mhu->restart; - mu->repcnt=0; - mu->CurPos=0; - mu->SongPos=0; - if ((PlayType&0x7f)==XM_Music) - { - mu->SongPos=SFXNum; - mu->CurrentStart=SFXNum; - } - mu->SongSpeed=mhu->tempo; - mu->vbtick=mu->SongSpeed; - mu->SongBPM=mhu->bpm; - - mu->NotAmiga=mhu->flags; - mu->patdly=0; - mu->patdly2=0; - mu->SongVolume=128; - mu->MasterVolume=128; - mu->FirstCh=FirstCh; - mu->PatternPos=0; - mu->posjmp=1; /* <- make sure the player fetches the first note */ - mu->patbrk=0; - mu->PlayNext=-1; - mu->BPlayNext=-1; - mu->BPlayFlag=0; - mu->UserPan=0; /* Default Middle */ - mu->MaxChans=0; - if (FirstCh!=-1) - { - Chn=FirstCh; - for(i=0;iXMPSXChannels;i++) + XMSongIDs[SongID] = 0; + SngID = SongID; + } + + JP_Do_Nothing = 1; + mu = (XMSONG*)(XM_SngAddress[SngID]); + + //mhu = &XM_Header[XM_ID]; + mhu = (XMHEADER*)(XM_HeaderAddress[XM_ID]); + + //mu = &XM_Song[SngID]; + mu->XMPlay = XM_STOPPED; + + mu->JUp = 0; + + mu->VabID = VabID; + mu->SongLoop = Loop; + mu->PlayMask = PlayMask; + mu->SFXNum = SFXNum; + + mu->Status = PlayType & 0x7f; + mu->HeaderNum = XM_ID; + mu->JBPM = 0; + mu->PCounter = 3; + mu->reppos = mhu->restart; + mu->repcnt = 0; + mu->CurPos = 0; + mu->SongPos = 0; + + if ((PlayType & 0x7f) == XM_Music) + { + mu->SongPos = SFXNum; + mu->CurrentStart = SFXNum; + } + + mu->SongSpeed = mhu->tempo; + mu->vbtick = mu->SongSpeed; + mu->SongBPM = mhu->bpm; + + mu->NotAmiga = mhu->flags; + mu->patdly = 0; + mu->patdly2 = 0; + mu->SongVolume = 128; + mu->MasterVolume = 128; + mu->FirstCh = FirstCh; + mu->PatternPos = 0; + mu->posjmp = 1; /* <- make sure the player fetches the first note */ + mu->patbrk = 0; + mu->PlayNext = -1; + mu->BPlayNext = -1; + mu->BPlayFlag = 0; + mu->UserPan = 0; /* Default Middle */ + mu->MaxChans = 0; + + if (FirstCh != -1) + { + Chn = FirstCh; + + for (i = 0; i < mhu->XMPSXChannels; i++) { - pmsk=mu->PlayMask; - pmsk&=(1<PlayMask; + pmsk &= (1 << i); + + if (pmsk != 0) { - XMCU=&mu->XM_Chnl[i]; /* Build list of SPU Channels to use */ - XMCU->SPUChannel=Chn; /* Depending on bitmask */ + XMCU = &mu->XM_Chnl[i]; /* Build list of SPU Channels to use */ + XMCU->SPUChannel = Chn; /* Depending on bitmask */ mu->MaxChans++; - if (Chn<24) + + if (Chn < 24) InitSPUChannel(Chn); + Chn++; } } } else { - for(i=0;iXMPSXChannels;i++) + for (i = 0; i < mhu->XMPSXChannels; i++) { - pmsk=mu->PlayMask; - pmsk&=(1<PlayMask; + pmsk &= (1 << i); + + if (pmsk != 0) { - XMCU=&mu->XM_Chnl[i]; /* Build list of SPU Channels to use */ - fr=0; - for (t=0;t<24;t++) + XMCU = &mu->XM_Chnl[i]; /* Build list of SPU Channels to use */ + fr = 0; + + for (t = 0; t < 24; t++) { - if (XMSPU_SFX[t]==0) + if (XMSPU_SFX[t] == 0) { - XMSPU_SFX[t]=SngID+1; - XMCU->SPUChannel=t; /* Depending on bitmask */ + XMSPU_SFX[t] = SngID + 1; + XMCU->SPUChannel = t; /* Depending on bitmask */ mu->MaxChans++; InitSPUChannel(t); - fr=1; + fr = 1; break; } } - if (fr==0) + + if (fr == 0) { - JPClearSPUFlags(SngID+1); - XMSongIDs[SngID]=-1; - JP_Do_Nothing=0; - return (-2); /* NOT ENOUGH FREE CHANNELS */ + JPClearSPUFlags(SngID + 1); + XMSongIDs[SngID] = -1; + JP_Do_Nothing = 0; + return (-2); /* NOT ENOUGH FREE CHANNELS */ } } } } - for(i=0;iXMChannels;i++) - { - mu->XM_Chnl[i].UserVol=0; - mu->XM_Chnl[i].kick=0; - mu->XM_Chnl[i].tmpvolume=0+64; - mu->XM_Chnl[i].retrig=0; - mu->XM_Chnl[i].wavecontrol=0; - mu->XM_Chnl[i].glissando=0; - mu->XM_Chnl[i].panning=128; - mu->XM_Chnl[i].note=0; - mu->XM_Chnl[i].vol=0; - mu->XM_Chnl[i].eff=0; - mu->XM_Chnl[i].dat=0; - mu->XM_Chnl[i].ins=0; - mu->XM_Chnl[i].ChDead=1; - mu->XM_Chnl[i].nothing=1; - mu->XM_Chnl[i].OldLVol=-1; - mu->XM_Chnl[i].OldRVol=-1; - mu->XM_Chnl[i].OldPeriod=0; - mu->XM_Chnl[i].sample=254; - mu->XM_Chnl[i].OldSample=-1; - mu->XM_Chnl[i].Dolby=XM_DOLBY_OFF; - } - if (PlayType<0x80) - mu->XMPlay=XM_PLAYING; + for (i = 0; i < mhu->XMChannels; i++) + { + mu->XM_Chnl[i].UserVol = 0; + mu->XM_Chnl[i].kick = 0; + mu->XM_Chnl[i].tmpvolume = 0 + 64; + mu->XM_Chnl[i].retrig = 0; + mu->XM_Chnl[i].wavecontrol = 0; + mu->XM_Chnl[i].glissando = 0; + mu->XM_Chnl[i].panning = 128; + mu->XM_Chnl[i].note = 0; + mu->XM_Chnl[i].vol = 0; + mu->XM_Chnl[i].eff = 0; + mu->XM_Chnl[i].dat = 0; + mu->XM_Chnl[i].ins = 0; + mu->XM_Chnl[i].ChDead = 1; + mu->XM_Chnl[i].nothing = 1; + mu->XM_Chnl[i].OldLVol = -1; + mu->XM_Chnl[i].OldRVol = -1; + mu->XM_Chnl[i].OldPeriod = 0; + mu->XM_Chnl[i].sample = 254; + mu->XM_Chnl[i].OldSample = -1; + mu->XM_Chnl[i].Dolby = XM_DOLBY_OFF; + } + + if (PlayType < 0x80) + mu->XMPlay = XM_PLAYING; - JP_Do_Nothing=0; + JP_Do_Nothing = 0; - return(SngID); + return (SngID); } - /***************************************************************************** JPlayNote Decode Pattern data. @@ -730,7 +746,7 @@ int JPlayNote(u_char *j, int pmsk) if (b == 0x80) { XMC->nothing = 1; - return(ret); + return (ret); } j++; @@ -745,6 +761,7 @@ int JPlayNote(u_char *j, int pmsk) note = *(j); SetNote(note - 1); } + j++; ret++; } @@ -756,9 +773,11 @@ int JPlayNote(u_char *j, int pmsk) XMC->ins = *(j); SetInstr(XMC->ins - 1); } + j++; ret++; } + if (((b & 3) != 0) && (note != 97) && (pmsk != 0)) SetPer(); /* Set Pitch if new instrument/note */ @@ -766,6 +785,7 @@ int JPlayNote(u_char *j, int pmsk) { XMC->nothing = 0; XMC->vol = *(j); + j++; ret++; } @@ -774,15 +794,17 @@ int JPlayNote(u_char *j, int pmsk) { XMC->nothing = 0; XMC->eff = *(j); + j++; ret++; } + if ((b & 16) != 0) { XMC->dat = *(j); + ret++; } - } else { @@ -794,17 +816,20 @@ int JPlayNote(u_char *j, int pmsk) SetNote(note - 1); XMC->ins = *(j); SetInstr(XMC->ins - 1); + if (note != 97) SetPer(); + XMC->vol = *(j + 1); XMC->eff = *(j + 2); XMC->dat = *(j + 3); } + ret = 5; } - return(ret); -} + return (ret); +} /***************************************************************************** @@ -815,288 +840,300 @@ JPlayEffects void JPlayEffects(void) { -u_char note=0; -u_char ins=0; -u_char vol=0; -u_char eff=0; -u_char dat=0; + u_char note = 0; + u_char ins = 0; + u_char vol = 0; + u_char eff = 0; + u_char dat = 0; - note=XMC->note; - vol=XMC->vol; - eff=XMC->eff; - dat=XMC->dat; - ins=XMC->ins; + note = XMC->note; + vol = XMC->vol; + eff = XMC->eff; + dat = XMC->dat; + ins = XMC->ins; - XMC->ownper=0; - XMC->ownvol=0; + XMC->ownper = 0; + XMC->ownvol = 0; - switch(vol>>4) + switch (vol >> 4) { case 0x6: - if(vol&0xf) - SPE(0xa,vol&0xf); /* Volume slide down */ + if (vol & 0xf) + SPE(0xa, vol & 0xf); /* Volume slide down */ break; - + case 0x7: - if(vol&0xf) - SPE(0xa,vol<<4); /* Volume slide up */ + if (vol & 0xf) + SPE(0xa, vol << 4); /* Volume slide up */ break; - + case 0x8: - SPE (0xe,0xb0 | (vol&0xf)); /* Fine volume slide down */ + SPE(0xe, 0xb0 | (vol & 0xf)); /* Fine volume slide down */ break; - case 0x9: - SPE (0xe,0xa0 | (vol&0xf)); /* Fine volume slide up */ + case 0x9: + SPE(0xe, 0xa0 | (vol & 0xf)); /* Fine volume slide up */ break; case 0xa: - SPE (0x4,vol<<4); /* Set Vibrato speed */ + SPE(0x4, vol << 4); /* Set Vibrato speed */ break; case 0xb: - SPE (0x4,vol&0xf); /* Vibrato */ + SPE(0x4, vol & 0xf); /* Vibrato */ break; case 0xc: - XMC->panning=(vol&0xf)<<4; /* Set Panning */ + XMC->panning = (vol & 0xf) << 4; /* Set Panning */ break; case 0xd: - if(vol&0xf) - DoXMPanSlide(vol&0xf); /* Pan slide left */ + if (vol & 0xf) + DoXMPanSlide(vol & 0xf); /* Pan slide left */ break; case 0xe: - if(vol&0xf) - DoXMPanSlide(vol<<4); /* Pan slide right */ + if (vol & 0xf) + DoXMPanSlide(vol << 4); /* Pan slide right */ break; case 0xf: - SPE (0x3,vol<<4); /* Portamento */ + SPE(0x3, vol << 4); /* Portamento */ break; default: - if(vol>=0x10 && vol<=0x50) - { - SPE (0xc,vol-0x10); /* Set volume */ - } + if (vol >= 0x10 && vol <= 0x50) + SPE(0xc, vol - 0x10); /* Set volume */ } -// if (eff!=0) -// { - switch(eff) - { - case 'G'-55: /* G - set global volume */ - ms->SongVolume=dat*2; + + //if (eff != 0) + //{ + switch (eff) + { + case 'G'-55: /* G - set global volume */ + ms->SongVolume = dat * 2; break; - case 'H'-55: /* H - global volume slide */ + case 'H'-55: /* H - global volume slide */ break; - case 'K'-55: /* K - keyoff */ - SetNote(96); + case 'K'-55: /* K - keyoff */ + SetNote(96); break; - case 'L'-55: /* L - set envelope position */ + case 'L'-55: /* L - set envelope position */ break; - case 'P'-55: /* P - panning slide */ - XMC->panning=dat; -// DoXMPanSlide(dat); + case 'P'-55: /* P - panning slide */ + XMC->panning = dat; + //DoXMPanSlide(dat); break; - case 'R'-55: /* R - multi retrig note */ + case 'R'-55: /* R - multi retrig note */ DoS3MRetrig(dat); break; case 'T'-55: - SPE (0x6,dat); + SPE(0x6, dat); break; case 'X'-55: break; default: - if(eff<=0xf) - SPE (eff,dat); /* Do most of the effects */ + if (eff <= 0xf) + SPE(eff, dat); /* Do most of the effects */ break; } -// } + //} - if(!XMC->ownper) - { - XMC->period=XMC->tmpperiod; - } + if (!XMC->ownper) + XMC->period = XMC->tmpperiod; - if(!XMC->ownvol) - { - XMC->volume=XMC->tmpvolume; - } + if (!XMC->ownvol) + XMC->volume = XMC->tmpvolume; } - /***************************************************************************** SPE This is the bit that does most of the updating of effects *****************************************************************************/ -void SPE (u_char eff,u_char dat) +void SPE (u_char eff, u_char dat) { -int hi; -int lo; + int hi; + int lo; - switch(eff) + switch (eff) { - case XMEF_APPREGIO: /* 0 */ + case XMEF_APPREGIO: /* 0 */ Arpeggio(dat); break; - case XMEF_PORTUP: /* 1 */ - if(dat!=0) - XMC->slidespeed=((u_short)(dat))<<2; - if(ms->vbtick) - { - XMC->tmpperiod-=XMC->slidespeed; - } + case XMEF_PORTUP: /* 1 */ + if (dat != 0) + XMC->slidespeed = ((u_short)(dat)) << 2; + if (ms->vbtick) + XMC->tmpperiod -= XMC->slidespeed; break; - case XMEF_PORTDOWN: /* 2 */ - if(dat!=0) - XMC->slidespeed=(u_short)(dat)<<2; - if(ms->vbtick) - { - XMC->tmpperiod+=XMC->slidespeed; - } + case XMEF_PORTDOWN: /* 2 */ + if (dat != 0) + XMC->slidespeed = (u_short)(dat) << 2; + if (ms->vbtick) + XMC->tmpperiod += XMC->slidespeed; break; - case XMEF_TONEPORT: /* 3 */ - XMC->kick=0; - if(dat!=0) + case XMEF_TONEPORT: /* 3 */ + XMC->kick = 0; + + if (dat != 0) { - XMC->portspeed=dat; - XMC->portspeed<<=2; + XMC->portspeed = dat; + XMC->portspeed <<= 2; } + DoToneSlide(); - XMC->ownper=1; + XMC->ownper = 1; break; - case XMEF_VIBRATO: /* 4 */ - if(dat&0x0f) XMC->vibdepth=dat&0x0f; - if(dat&0xf0) XMC->vibspd=(dat&0xf0)>>2; + case XMEF_VIBRATO: /* 4 */ + if (dat & 0x0f) + XMC->vibdepth = dat & 0x0f; + if (dat & 0xf0) + XMC->vibspd = (dat & 0xf0) >> 2; + DoVibrato(); - XMC->ownper=1; + XMC->ownper = 1; break; - case XMEF_PORT_VOLSLD: /* 5 */ - XMC->kick=0; + case XMEF_PORT_VOLSLD: /* 5 */ + XMC->kick = 0; DoToneSlide(); - if (dat==0) - dat=XMC->oldvslide; - XMC->oldvslide=dat; + + if (dat == 0) + dat = XMC->oldvslide; + + XMC->oldvslide = dat; DoVolSlide(dat); - XMC->ownper=1; + XMC->ownper = 1; break; - case XMEF_VIB_VOLSLD: /* 6 */ + case XMEF_VIB_VOLSLD: /* 6 */ DoVibrato(); - if (dat==0) - dat=XMC->oldvslide; - XMC->oldvslide=dat; + + if (dat == 0) + dat = XMC->oldvslide; + + XMC->oldvslide = dat; DoVolSlide(dat); - XMC->ownper=1; + XMC->ownper = 1; break; - case XMEF_TREMELO: /* 7 */ - if(dat&0x0f) XMC->trmdepth=dat&0xf; - if(dat&0xf0) XMC->trmspd=(dat&0xf0)>>2; + case XMEF_TREMELO: /* 7 */ + if (dat & 0x0f) + XMC->trmdepth = dat & 0xf; + if (dat & 0xf0) + XMC->trmspd = (dat & 0xf0) >> 2; + DoTremolo(); - XMC->ownvol=1; + XMC->ownvol = 1; break; - case XMEF_PANPOS: /* 8 */ - XMC->panning=dat; + case XMEF_PANPOS: /* 8 */ + XMC->panning = dat; break; - case XMEF_SAMPOFFSET: /* 9 */ - if(ms->vbtick) + case XMEF_SAMPOFFSET: /* 9 */ + if (ms->vbtick) break; - if(dat==0) + + if (dat == 0) break; - XMC->SOffset=dat; - XMC->SOffset*=256; - XMC->SOffset*=2; - XMC->SOffset/=7; - XMC->SOffset*=2; - XMC->SOffset&=(~31); + XMC->SOffset = dat; + XMC->SOffset *= 256; + XMC->SOffset *= 2; + XMC->SOffset /= 7; + XMC->SOffset *= 2; + XMC->SOffset &= (~31); break; - case XMEF_VOLSLD: /* A */ - if (dat==0) - dat=XMC->oldvslide; - XMC->oldvslide=dat; + case XMEF_VOLSLD: /* A */ + if (dat == 0) + dat = XMC->oldvslide; + + XMC->oldvslide = dat; DoVolSlide(dat); break; - case XMEF_POSJMP: /* B */ - if(ms->patdly2) + case XMEF_POSJMP: /* B */ + if (ms->patdly2) break; - ms->patbrk=0; - ms->SongPos=dat-1; - ms->posjmp=2; + + ms->patbrk = 0; + ms->SongPos = dat - 1; + ms->posjmp = 2; break; - case XMEF_VOLUME: /* C */ - if(ms->vbtick) + case XMEF_VOLUME: /* C */ + if (ms->vbtick) break; - if (dat==0xff) // 0xff = set user jump flag - ms->BPlayFlag=1; - else if (dat==0xfe) // 0xfe = clear user jump flag - ms->BPlayFlag=0; - else if (dat==0xfd) // 0xfd = force tune to end. - ms->BPlayFlag=2; - else if (dat==0xfc) - XMC->Dolby=XM_DOLBY_OFF; - else if (dat==0xfb) - XMC->Dolby=XM_DOLBY_LEFT; - else if (dat==0xfa) - XMC->Dolby=XM_DOLBY_RIGHT; + + if (dat == 0xff) // 0xff = set user jump flag + ms->BPlayFlag = 1; + else if (dat == 0xfe) // 0xfe = clear user jump flag + ms->BPlayFlag = 0; + else if (dat == 0xfd) // 0xfd = force tune to end. + ms->BPlayFlag = 2; + else if (dat == 0xfc) + XMC->Dolby = XM_DOLBY_OFF; + else if (dat == 0xfb) + XMC->Dolby = XM_DOLBY_LEFT; + else if (dat == 0xfa) + XMC->Dolby = XM_DOLBY_RIGHT; else { - if(dat>64) dat=64; - XMC->tmpvolume=dat+64; + if (dat > 64) + dat = 64; + + XMC->tmpvolume = dat + 64; } break; - case XMEF_PATBREAK: /* D */ - if(ms->patdly2) + case XMEF_PATBREAK: /* D */ + if (ms->patdly2) break; - hi=(dat&0xf0)>>4; - lo=(dat&0xf); - ms->patbrk=((hi*10)+lo)+1; - if(ms->patbrk>(ms->numrow+1)) - ms->patbrk=ms->numrow+1; - ms->posjmp=2; + hi = (dat & 0xf0) >> 4; + lo = (dat & 0xf); + + ms->patbrk = ((hi * 10) + lo) + 1; + + if (ms->patbrk > (ms->numrow + 1)) + ms->patbrk = ms->numrow + 1; + + ms->posjmp = 2; break; - case XMEF_E: /* E */ + case XMEF_E: /* E */ DoEEffects(dat); break; - case XMEF_SETSPEED: /* F */ - if(ms->vbtick || ms->patdly2) + case XMEF_SETSPEED: /* F */ + if (ms->vbtick || ms->patdly2) break; - if(dat<0x20) + + if (dat < 0x20) { - ms->SongSpeed=dat; // Speed - ms->vbtick=0; + ms->SongSpeed = dat; // Speed + ms->vbtick = 0; } else { - ms->SongBPM=dat; // BPM - ms->vbtick=0; + ms->SongBPM = dat; // BPM + ms->vbtick = 0; } break; @@ -1106,7 +1143,6 @@ int lo; } - /***************************************************************************** DoEEffects Process effects if 0xe command used. @@ -1120,140 +1156,135 @@ void DoEEffects(u_char dat) switch (dat >> 4) { - case 0x0: /* 0 filter toggle */ - break; - - case XMEF_E_FINESLD_UP: /* 1 Fineslide up */ - if (!ms->vbtick) - { - if (nib == 0) - nib = XMC->oldfslide; - XMC->oldfslide = nib; - XMC->tmpperiod += (nib << 2); - } - break; - - case XMEF_E_FINESLD_DOWN: /* 2 Fineslide down */ - if (!ms->vbtick) - { - if (nib == 0) - nib = XMC->oldfslide; - XMC->oldfslide = nib; - XMC->tmpperiod -= (nib << 2); - } + case 0x0: /* 0 filter toggle */ + break; - break; + case XMEF_E_FINESLD_UP: /* 1 Fineslide up */ + if (!ms->vbtick) + { + if (nib == 0) + nib = XMC->oldfslide; + XMC->oldfslide = nib; + XMC->tmpperiod += (nib << 2); + } + break; - case XMEF_E_GLISSANDO: /* 3 Glissando ctrl */ - XMC->glissando = nib; - break; + case XMEF_E_FINESLD_DOWN: /* 2 Fineslide down */ + if (!ms->vbtick) + { + if (nib == 0) + nib = XMC->oldfslide; - case XMEF_E_VIB_WAVE: /* 4 Set vibrato waveform */ - XMC->wavecontrol &= 0xf0; - XMC->wavecontrol |= nib; - break; + XMC->oldfslide = nib; + XMC->tmpperiod -= (nib << 2); + } + break; - case XMEF_E_FINETUNE: /* 5 Set finetune */ - break; + case XMEF_E_GLISSANDO: /* 3 Glissando ctrl */ + XMC->glissando = nib; + break; - case XMEF_E_PATLOOP: /* 6 Set patternloop */ + case XMEF_E_VIB_WAVE: /* 4 Set vibrato waveform */ + XMC->wavecontrol &= 0xf0; + XMC->wavecontrol |= nib; + break; - if (ms->vbtick) + case XMEF_E_FINETUNE: /* 5 Set finetune */ break; - if (nib) - { - if (ms->repcnt > 0) - ms->repcnt--; /* already looping, decrease counter */ - else - ms->repcnt = nib; /* not yet looping, so set repcnt */ - if (ms->repcnt) /* jump to reppos if repcnt>0 */ - ms->PatternPos = ms->reppos; - } - else - { - ms->reppos = ms->PatternPos - 1; /* set reppos */ - } - break; + case XMEF_E_PATLOOP: /* 6 Set patternloop */ + if (ms->vbtick) + break; - case XMEF_E_TREM_WAVE: /* 7 Set tremolo waveform */ - XMC->wavecontrol &= 0x0f; - XMC->wavecontrol |= nib << 4; - break; + if (nib) + { + if (ms->repcnt > 0) + ms->repcnt--; /* already looping, decrease counter */ + else + ms->repcnt = nib; /* not yet looping, so set repcnt */ - case XMEF_E_NOTUSED: /* 8 Not used */ - XMC->panning = nib << 4; - break; + if (ms->repcnt) /* jump to reppos if repcnt>0 */ + ms->PatternPos = ms->reppos; + } + else + ms->reppos = ms->PatternPos - 1; /* set reppos */ + break; - case XMEF_E_RETRIG: /* 9 Retrig note */ + case XMEF_E_TREM_WAVE: /* 7 Set tremolo waveform */ + XMC->wavecontrol &= 0x0f; + XMC->wavecontrol |= nib << 4; + break; - /* only retrigger if - data nibble > 0 */ + case XMEF_E_NOTUSED: /* 8 Not used */ + XMC->panning = nib << 4; + break; - if (nib > 0) - { - if (XMC->retrig == 0) + case XMEF_E_RETRIG: /* 9 Retrig note */ + if (nib > 0) /* only retrigger if data nibble > 0 */ { - XMC->kick = 1; - XMC->retrig = nib; - } - XMC->retrig--; /* countdown */ - } - break; + if (XMC->retrig == 0) + { + XMC->kick = 1; + XMC->retrig = nib; + } - case XMEF_E_FINEVOL_UP: /* A - Fine volume slide up */ - if (ms->vbtick) + XMC->retrig--; /* countdown */ + } break; - if (nib == 0) - nib = XMC->oldfvslide; - XMC->oldfvslide = nib; - XMC->tmpvolume += nib; - if (XMC->tmpvolume > 128) XMC->tmpvolume = 128; - break; + case XMEF_E_FINEVOL_UP: /* A - Fine volume slide up */ + if (ms->vbtick) + break; + + if (nib == 0) + nib = XMC->oldfvslide; - case XMEF_E_FINEVOL_DOWN: /* B - Fine volume slide down */ - if (ms->vbtick) + XMC->oldfvslide = nib; + XMC->tmpvolume += nib; + + if (XMC->tmpvolume > 128) + XMC->tmpvolume = 128; break; - if (nib == 0) - nib = XMC->oldfvslide; - XMC->oldfvslide = nib; - XMC->tmpvolume -= nib; - if (XMC->tmpvolume < 64) XMC->tmpvolume = 64; - break; + case XMEF_E_FINEVOL_DOWN: /* B - Fine volume slide down */ + if (ms->vbtick) + break; - case XMEF_E_CUTNOTE: /* C - Cut note */ + if (nib == 0) + nib = XMC->oldfvslide; - if (ms->vbtick >= nib) - { - XMC->tmpvolume = 64; - } - break; + XMC->oldfvslide = nib; + XMC->tmpvolume -= nib; - case XMEF_E_NOTEDELAY: /* D - Note delay */ + if (XMC->tmpvolume < 64) + XMC->tmpvolume = 64; + break; - if (ms->vbtick == nib) - { - XMC->kick = 1; - } - else XMC->kick = 0; - break; + case XMEF_E_CUTNOTE: /* C - Cut note */ + if (ms->vbtick >= nib) + XMC->tmpvolume = 64; + break; - case XMEF_E_PATDELAY: /* E - Pattern delay */ - if (ms->vbtick) + case XMEF_E_NOTEDELAY: /* D - Note delay */ + if (ms->vbtick == nib) + XMC->kick = 1; + else + XMC->kick = 0; break; - if (!ms->patdly2) - ms->patdly = nib + 1; /* only once (when vbtick=0) */ - break; - case 0xf: /* invert loop, not supported */ - break; + case XMEF_E_PATDELAY: /* E - Pattern delay */ + if (ms->vbtick) + break; + if (!ms->patdly2) + ms->patdly = nib + 1; /* only once (when vbtick=0) */ + break; + + case 0xf: /* invert loop, not supported */ + break; } } - /***************************************************************************** SetNote Set note if a new note is to processed @@ -1270,18 +1301,16 @@ void SetNote(u_char note) if (note == 96) { XMC->keyon = 0; + if (XMC->sample == 254) - { XMC->tmpvolume = 64; /* Force 0 vol if no envelope used */ - } else { j = (u_char*)mh->JAP_InstrumentOffset[XMC->sample]; vf = *((u_char*)j + 233); + if (!(vf & EF_ON)) - { - XMC->tmpvolume = 64; /* Force 0 vol if no envelope used */ - } + XMC->tmpvolume = 64; /* Force 0 vol if no envelope used */ } } else @@ -1289,15 +1318,15 @@ void SetNote(u_char note) XMC->note = note; XMC->kick = 1; - if (!(XMC->wavecontrol & 0x80)) /* retrig tremolo and vibrato waves ? */ + if (!(XMC->wavecontrol & 0x80)) /* retrig tremolo and vibrato waves ? */ XMC->trmpos = 0; + if (!(XMC->wavecontrol & 0x08)) XMC->vibpos = 0; } } - /***************************************************************************** SetInstr Set instrument if new one to be processed @@ -1310,40 +1339,37 @@ void SetInstr(u_char inst) u_char j2; short ddd; - // if (ms->SongPos==4) - // { - // inst+=0; - // } + //if (ms->SongPos == 4) + // inst += 0; if (CurrentCh > 23) return; if (!XMC->kick) - return; // Instrument but no note... + return; // Instrument but no note... if (inst == 255) - { - inst = XMC->sample; // If instrument=0, use last instrument. - } + inst = XMC->sample; // If instrument = 0, use last instrument - if (inst >= mh->numins) return; // No Instrument available + if (inst >= mh->numins) + return; // No Instrument available XMC->sample = inst; /* - j=mh->JAP_InstrumentOffset[inst]; - j2=*((u_char*)j+(XMC->note+33)); - j3=*((u_char*)j); + j = mh->JAP_InstrumentOffset[inst]; + j2 = *((u_char*)j + (XMC->note + 33)); + j3 = *((u_char*)j); - if (j2!=0) - { - ddd=243*j2; // Not using instrument 0 - } - // if (j2>=j3) - // return; + if (j2 != 0) + ddd = 243 * j2; // Not using instrument 0 + + if (j2 >= j3) + return; */ j = mh->JAP_SampHdrAddr[inst]; + if (j == (u_int*)0x01234567) return; @@ -1361,7 +1387,6 @@ void SetInstr(u_char inst) ddd += 128; XMC->c2spd = ddd; XMC->c2spd &= 255; - } @@ -1376,25 +1401,25 @@ void SetPer(void) u_int *j; u_short period; u_char a; + if (CurrentCh > 23) return; a = XMC->note; a += XMC->transpose; - - // a+=jtt; + //a += jtt; period = GetPeriod(a, XMC->c2spd); - //if (XMC->sample==5) - //FntPrint("%d,%d,%d=%d\n",XMC->note,XMC->transpose,a,period); + //if (XMC->sample == 5) + // FntPrint("%d, %d, %d = %d\n", XMC->note, XMC->transpose, a, period); XMC->wantedperiod = period; XMC->tmpperiod = period; XMC->OldPeriod = 0; XMC->SOffset = 0; - // XMC->OldLVol=-1; - // XMC->OldRVol=-1; + //XMC->OldLVol = -1; + //XMC->OldRVol = -1; if (XMC->OldSample != XMC->sample) { @@ -1404,6 +1429,7 @@ void SetPer(void) XMC->keyoffspd = *((u_char*)j + 239); XMC->keyoffspd; //*=1; //4; XMC->envflg = *((u_char*)j + 233); + if (XMC->envflg & EF_ON) { XMC->envpts = *((u_char*)j + 225); @@ -1411,7 +1437,9 @@ void SetPer(void) XMC->envbeg = *((u_char*)j + 228); XMC->envend = *((u_char*)j + 229); } + XMC->panenvflg = *((u_char*)j + 234); + if (XMC->panenvflg & EF_ON) { XMC->panenvpts = *((u_char*)j + 226); @@ -1420,12 +1448,14 @@ void SetPer(void) XMC->panenvend = *((u_char*)j + 232); } } + if (XMC->panenvflg & EF_ON) { XMC->panenvp = 0; XMC->panenva = 0; XMC->panenvb = 1; } + if (XMC->envflg & EF_ON) { XMC->envp = 0; @@ -1435,7 +1465,6 @@ void SetPer(void) } - /***************************************************************************** Arpeggio EFFECT - Modify pitch @@ -1451,20 +1480,20 @@ void Arpeggio(u_char dat) { switch (ms->vbtick % 3) { - case 1: - note += (dat >> 4); - break; - case 2: - note += (dat & 0xf); - break; + case 1: + note += (dat >> 4); + break; + case 2: + note += (dat & 0xf); + break; } + XMC->period = GetPeriod(note + XMC->transpose, XMC->c2spd); XMC->ownper = 1; } } - /***************************************************************************** DoVolSlide EFFECT - Either +/- 0-0xf to volume @@ -1472,14 +1501,19 @@ DoVolSlide void DoVolSlide(u_char dat) { - if (!ms->vbtick) return; /* do not update when vbtick==0 */ + if (!ms->vbtick) /* do not update when vbtick == 0 */ + return; + + XMC->tmpvolume += dat >> 4; /* volume slide */ + + if (XMC->tmpvolume > 128) + XMC->tmpvolume = 128; - XMC->tmpvolume += dat >> 4; /* volume slide */ - if (XMC->tmpvolume > 128) XMC->tmpvolume = 128; XMC->tmpvolume -= dat & 0xf; - if (XMC->tmpvolume < 64) XMC->tmpvolume = 64; -} + if (XMC->tmpvolume < 64) + XMC->tmpvolume = 64; +} /***************************************************************************** @@ -1492,10 +1526,13 @@ void DoXMPanSlide(u_char inf) u_char lo, hi; short pan; - if (inf != 0) XMC->pansspd = inf; - else inf = XMC->pansspd; + if (inf != 0) + XMC->pansspd = inf; + else + inf = XMC->pansspd; - if (!ms->vbtick) return; + if (!ms->vbtick) + return; lo = inf & 0xf; hi = inf >> 4; @@ -1510,14 +1547,16 @@ void DoXMPanSlide(u_char inf) pan -= lo; pan += hi; - if (pan < 0) pan = 0; - if (pan > 255) pan = 255; + if (pan < 0) + pan = 0; + + if (pan > 255) + pan = 255; XMC->panning = pan; } - /***************************************************************************** DoS3MRetrig EFFECT - Pan slide @@ -1525,56 +1564,52 @@ DoS3MRetrig void DoS3MRetrig(u_char inf) { - u_char hi,lo; + u_char lo, hi; - hi=inf>>4; - lo=inf&0xf; + hi = inf >> 4; + lo = inf & 0xf; - if(lo) + if (lo) { - XMC->s3mrtgslide=hi; - XMC->s3mrtgspeed=lo; + XMC->s3mrtgslide = hi; + XMC->s3mrtgspeed = lo; } - if(hi) - { - XMC->s3mrtgslide=hi; - } + if (hi) + XMC->s3mrtgslide = hi; /* only retrigger if lo nibble > 0 */ - if(XMC->s3mrtgspeed>0) + if (XMC->s3mrtgspeed > 0) { - if(XMC->retrig==0) + if (XMC->retrig == 0) { - /* when retrig counter reaches 0, reset counter and restart the sample */ - XMC->kick=1; - XMC->retrig=XMC->s3mrtgspeed; + XMC->kick = 1; + XMC->retrig = XMC->s3mrtgspeed; - if(ms->vbtick) - { /* don't slide on first retrig */ - switch(XMC->s3mrtgslide) + if (ms->vbtick) + { /* don't slide on first retrig */ + switch (XMC->s3mrtgslide) { - case 1: case 2: case 3: case 4: case 5: - XMC->tmpvolume-=(1<<(XMC->s3mrtgslide-1)); + XMC->tmpvolume -= (1 << (XMC->s3mrtgslide - 1)); break; case 6: - XMC->tmpvolume=(2*XMC->tmpvolume)/3; + XMC->tmpvolume = (2 * XMC->tmpvolume) / 3; break; case 7: - XMC->tmpvolume=XMC->tmpvolume>>1; - if (XMC->tmpvolume<64) - XMC->tmpvolume=64; + XMC->tmpvolume = XMC->tmpvolume >> 1; + if (XMC->tmpvolume < 64) + XMC->tmpvolume = 64; break; case 9: @@ -1582,27 +1617,31 @@ void DoS3MRetrig(u_char inf) case 0xb: case 0xc: case 0xd: - XMC->tmpvolume+=(1<<(XMC->s3mrtgslide-9)); + XMC->tmpvolume += (1 << (XMC->s3mrtgslide - 9)); break; case 0xe: - XMC->tmpvolume=(3*XMC->tmpvolume)/2; + XMC->tmpvolume = (3 * XMC->tmpvolume) / 2; break; case 0xf: - XMC->tmpvolume=XMC->tmpvolume<<1; + XMC->tmpvolume = XMC->tmpvolume << 1; break; } - if(XMC->tmpvolume<64) XMC->tmpvolume=64; - if(XMC->tmpvolume>128) XMC->tmpvolume=128; + + if (XMC->tmpvolume < 64) + XMC->tmpvolume = 64; + + if (XMC->tmpvolume > 128) + XMC->tmpvolume = 128; } } - XMC->retrig--; /* countdown */ + + XMC->retrig--; /* countdown */ } } - /***************************************************************************** DoToneSlide EFFECT @@ -1610,30 +1649,24 @@ DoToneSlide void DoToneSlide(void) { -int dist; + int dist; /* We have to slide XMC->period towards XMC->wantedperiod, so compute the difference between those two values */ - dist=XMC->period-XMC->wantedperiod; - - if(dist==0 || XMC->portspeed>ABS(dist))/* if they are equal */ - { /* or if portamentospeed is too big */ + dist = XMC->period - XMC->wantedperiod; - XMC->period=XMC->wantedperiod; /* make tmpperiod equal tperiod */ - } - else if(dist>0) - { /* dist>0 ? */ - XMC->period-=XMC->portspeed; /* then slide up */ - } + if (dist == 0 || XMC->portspeed > ABS(dist)) /* if they are equal or if portamentospeed is too big */ + XMC->period = XMC->wantedperiod; /* make tmpperiod equal tperiod */ + else if (dist > 0) /* dist > 0 ? */ + XMC->period -= XMC->portspeed; /* then slide up */ else - XMC->period+=XMC->portspeed; /* dist<0 -> slide down */ + XMC->period += XMC->portspeed; /* dist < 0 -> slide down */ - XMC->tmpperiod=XMC->period; /* Store new period */ + XMC->tmpperiod = XMC->period; /* Store new period */ } - /***************************************************************************** DoVibrato EFFECT @@ -1641,44 +1674,43 @@ DoVibrato void DoVibrato(void) { -u_char q; -u_short temp=0; + u_char q; + u_short temp = 0; - q=(XMC->vibpos>>2)&0x1f; + q = (XMC->vibpos >> 2) & 0x1f; - switch(XMC->wavecontrol&3) + switch (XMC->wavecontrol & 3) { - case 0: /* sine */ - temp=VibratoTable[q]; + temp = VibratoTable[q]; break; case 1: /* ramp down */ - q<<=3; - if(XMC->vibpos>127) - q=255-q; - temp=q; + q <<= 3; + if (XMC->vibpos > 127) + q = 255 - q; + temp = q; break; case 2: /* square wave */ - temp=255; + temp = 255; break; } - temp*=XMC->vibdepth; - temp>>=7; - temp<<=2; + temp *= XMC->vibdepth; + temp >>= 7; + temp <<= 2; - if(XMC->vibpos<128) - XMC->period=XMC->tmpperiod+temp; + if (XMC->vibpos < 128) + XMC->period = XMC->tmpperiod + temp; else - XMC->period=XMC->tmpperiod-temp; + XMC->period = XMC->tmpperiod - temp; - if(ms->vbtick) XMC->vibpos+=XMC->vibspd; /* do not update when vbtick==0 */ + if (ms->vbtick) + XMC->vibpos += XMC->vibspd; /* do not update when vbtick == 0 */ } - /***************************************************************************** DoTremelo EFFECT @@ -1693,20 +1725,20 @@ void DoTremolo(void) switch ((XMC->wavecontrol >> 4) & 3) { + case 0: /* sine */ + temp = VibratoTable[q]; + break; - case 0: /* sine */ - temp = VibratoTable[q]; - break; - - case 1: /* ramp down */ - q <<= 3; - if (XMC->trmpos > 127) q = 255 - q; - temp = q; - break; + case 1: /* ramp down */ + q <<= 3; + if (XMC->trmpos > 127) + q = 255 - q; + temp = q; + break; - case 2: /* square wave */ - temp = 255; - break; + case 2: /* square wave */ + temp = 255; + break; } temp *= XMC->trmdepth; @@ -1715,31 +1747,32 @@ void DoTremolo(void) if (XMC->trmpos < 128) { XMC->volume = XMC->tmpvolume + temp; - if (XMC->volume > 128) XMC->volume = 128; + if (XMC->volume > 128) + XMC->volume = 128; } else { XMC->volume = XMC->tmpvolume - temp; - if (XMC->volume < 64) XMC->volume = 64; + if (XMC->volume < 64) + XMC->volume = 64; } - if (ms->vbtick) XMC->trmpos += XMC->trmspd; /* do not update when vbtick==0 */ + if (ms->vbtick) + XMC->trmpos += XMC->trmspd; /* do not update when vbtick == 0 */ } - /***************************************************************************** DoPan Calculate panning using current envelope panning and instrument pan *****************************************************************************/ -short DoPan(short envpan,short pan) +short DoPan(short envpan, short pan) { - return(pan + (((envpan-128)*(128- ABS(pan-128)))/128)); + return (pan + (((envpan - 128) * (128 - ABS(pan - 128))) / 128)); } - /***************************************************************************** DoVol Calculate volume using @@ -1749,16 +1782,15 @@ DoVol c Instrument volume *****************************************************************************/ -short DoVol(u_int a,short b,short c) +short DoVol(u_int a, short b, short c) { - a*=b; - a*=c; - a>>=23; - return(a); + a *= b; + a *= c; + a >>= 23; + return (a); } - /***************************************************************************** UpdateXMData This does everything @@ -1768,77 +1800,79 @@ void UpdateXMData(void) { int SC; - if(JP_Do_Nothing) /* Failsafe switch - if called on interrupt */ + if (JP_Do_Nothing) /* Failsafe switch - if called on interrupt */ return; - for (SC=0;SCPCounter==5) + + if (ms->PCounter == 5) { UpdateWithTimer(SC); - ms->PCounter=0; + ms->PCounter = 0; } } } +int tt = 0; +int aa = 0; - -int tt=0; -int aa=0; void UpdateWithTimer(int SC) { aa++; ms=(XMSONG*)(XM_SngAddress[SC]); - if (ms->XMPlay!=XM_PLAYING) + + if (ms->XMPlay != XM_PLAYING) return; - if (PALType==1) + if (PALType == 1) ms->PCounter++; /* PAL Mode stuff...bodge timer */ - mh=(XMHEADER*)(XM_HeaderAddress[ms->HeaderNum]); - - ms->JBPM+=ms->SongBPM; + mh = (XMHEADER*)(XM_HeaderAddress[ms->HeaderNum]); + ms->JBPM += ms->SongBPM; - if (ms->JBPMJBPM < BPMLimit) /* Time to process data ? */ { - if ((ms->JUp==0)&&(PALType!=0)) + if ((ms->JUp == 0) && (PALType != 0)) { ms->JUp=1; UpdateEffs(); /* If nothing else to do for a frame */ ApplyEffs(); /* (spread out processing time */ UpdateHardware(); /* Update SPU */ } + return; } - ms->JBPM-=BPMLimit; /* YES! Update song/hardware */ + + ms->JBPM -= BPMLimit; /* YES! Update song/hardware */ XM_DoFullUpdate(SC); } - - void XM_DoFullUpdate(int SC) { ms = (XMSONG*)(XM_SngAddress[SC]); - // ms=&XM_Song[SC]; + //ms = &XM_Song[SC]; + if (ms->XMPlay == XM_PLAYING) { - // mh=&XM_Header[ms->HeaderNum]; + //mh = &XM_Header[ms->HeaderNum]; mh = (XMHEADER*)(XM_HeaderAddress[ms->HeaderNum]); if (ms->JUp == 0) { - // UpdatePatternData(SC); + //UpdatePatternData(SC); UpdateEffs(); /* Do this if not done before in spare frame*/ ApplyEffs(); } - ms->JUp = 0; /* Clear update flag */ + ms->JUp = 0; /* Clear update flag */ UpdateHardware(); /* Update SPU */ + if (ms->vbtick == 1) /* Check for zero volume,keyed off channels*/ CurrentKeyStat(); /* BUT not on first tick - wait for keyons */ @@ -1851,10 +1885,9 @@ void XM_DoFullUpdate(int SC) UpdatePatternData(SC); } - // UpdateHardware(); /* Update SPU */ -} - + //UpdateHardware(); /* Update SPU */ +} void UpdatePatternData(int SC) { @@ -1893,7 +1926,6 @@ void UpdatePatternData(int SC) if (ms->PatternPos == ms->numrow) ms->posjmp = 2; - if (ms->BPlayFlag == 2) { XM_Quit(SC); @@ -1904,10 +1936,10 @@ void UpdatePatternData(int SC) { if ((ms->posjmp == 2) && (ms->Status == XM_SFX)) /* SFX ? */ { + //t = ms->posjmp; + //t = ms->patbrk; + //ms->posjmp--; - // t=ms->posjmp; - // t=ms->patbrk; - // ms->posjmp--; if (ms->patbrk == 0) { XM_Quit(SC); @@ -1921,14 +1953,15 @@ void UpdatePatternData(int SC) ms->PatternPos = 0; ms->CurPos = ms->PatternPos; + if (ms->CurPos != 0) FindOffset = 1; - // if (ms->BPlayFlag==2) - // { - // XM_Quit(SC); - // return; - // } + /*if (ms->BPlayFlag == 2) + { + XM_Quit(SC); + return; + }*/ if ((ms->BPlayNext != -1) && (ms->BPlayFlag != 0)) { @@ -1944,13 +1977,14 @@ void UpdatePatternData(int SC) ms->CurrentStart = ms->SongPos; ms->PlayNext = -1; } - else // if (ms->Status==XM_Music) + else //if (ms->Status == XM_Music) { ms->SongPos += (ms->posjmp - 1); t = ms->SongPos; } ms->patbrk = ms->posjmp = 0; + if (ms->SongPos >= mh->songlength) /* End of song data ? */ { if (!ms->SongLoop) @@ -1958,22 +1992,27 @@ void UpdatePatternData(int SC) ms->XMPlay = XM_STOPPED; /* Once off tune */ return; } + ms->SongPos = ms->reppos; /* Loop to loop point */ } + if (ms->SongPos < 0) ms->SongPos = mh->songlength - 1; + if (ms->Status == XM_Music) SP = mh->jorders[ms->SongPos]; /* Pattern from song data*/ else SP = ms->SFXNum; /* Pattern from user SFX */ -// SP+=0; + //SP += 0; + ms->CurrentPattern = SP; ms->PatAdr = mh->JAP_PAT_ADDR[SP]; /* Addr of pat header */ ms->PatAdr2 = mh->JAP_PAT_ADDR2[SP]; /* Addr of pat data */ ms->numrow = getWord((u_char*)ms->PatAdr + 5); /* Number of rows */ ms->PatSize = getWord((u_char*)ms->PatAdr + 7); /* pattern size */ } + if (!ms->patdly2) { if (ms->PatSize > 0) @@ -1982,22 +2021,24 @@ void UpdatePatternData(int SC) { if (FindOffset != 0) ms->CurPos = PACKEDCalcPlayPos(ms->CurPos); + SP = ms->CurPos; + for (t = 0; t < mh->XMPSXChannels; t++) { XMC = &ms->XM_Chnl[t]; /* Decode pattern data */ XMC->eff = 0; XMC->vol = 0; XMC->dat = 0; - // XMC->nothing=1; + //XMC->nothing = 1; } while (1) { - pataddr = ((u_char*)ms->PatAdr2 + SP); patdat = *pataddr++; /* Channel or 0xff for end */ SP++; + if (patdat == 0xff) break; @@ -2007,16 +2048,16 @@ void UpdatePatternData(int SC) pmsk &= (1 << patdat); SP += JPlayNote((u_char*)ms->PatAdr2 + SP, pmsk); } - ms->CurPos = SP; + ms->CurPos = SP; } else { - - if (FindOffset != 0) /**** ORIGNAL XM FILE ****/ ms->CurPos = CalcPlayPos(ms->CurPos); + SP = ms->CurPos; + for (t = 0; t < mh->XMChannels; t++) { CurrentCh = t; @@ -2025,6 +2066,7 @@ void UpdatePatternData(int SC) pmsk &= (1 << t); SP += JPlayNote((u_char*)ms->PatAdr2 + SP, pmsk); } + ms->CurPos = SP; } } @@ -2032,8 +2074,6 @@ void UpdatePatternData(int SC) } } - - int CalcPlayPos(int StartPos) { int SP = 0; @@ -2048,10 +2088,9 @@ int CalcPlayPos(int StartPos) SP += JCalcPat((u_char*)ms->PatAdr2 + SP); } } - return(SP); -} - + return (SP); +} int PACKEDCalcPlayPos(int StartPos) { @@ -2067,6 +2106,7 @@ int PACKEDCalcPlayPos(int StartPos) pataddr = ((u_char*)ms->PatAdr2 + SP); patdat = *pataddr++; /* Channel or 0xff for end */ SP++; + if (patdat == 0xff) break; @@ -2075,10 +2115,9 @@ int PACKEDCalcPlayPos(int StartPos) SP += JCalcPat((u_char*)ms->PatAdr2 + SP); } } - return(SP); -} - + return (SP); +} int JCalcPat(u_char *j) { @@ -2088,7 +2127,8 @@ int JCalcPat(u_char *j) b = *j; if (b == 0x80) - return(ret); + return (ret); + j++; if ((b & 0x80) != 0) @@ -2123,9 +2163,9 @@ int JCalcPat(u_char *j) } else ret = 5; - return(ret); -} + return (ret); +} /***************************************************************************** @@ -2143,79 +2183,86 @@ void ApplyEffs(void) short Pn; u_char MaxChans; - ms->XMActiveVoices=0; - MaxChans=ms->MaxChans; - for(t=0;tXMPSXChannels;t++) + ms->XMActiveVoices = 0; + MaxChans = ms->MaxChans; + + for (t = 0; t < mh->XMPSXChannels; t++) { - if (MaxChans==0) + if (MaxChans == 0) return; - pmsk=ms->PlayMask; - pmsk&=(1<PlayMask; + pmsk &= (1 << t); + + if (pmsk != 0) { MaxChans--; - XMC=&ms->XM_Chnl[t]; + XMC = &ms->XM_Chnl[t]; - if(XMC->kick) /* New note keyed on ? */ + if (XMC->kick) /* New note keyed on ? */ { - XMC->keyon=1; - XMC->fadevol=32767; - XMC->ChDead=0; + XMC->keyon = 1; + XMC->fadevol = 32767; + XMC->ChDead = 0; } + if (!XMC->ChDead) /* Update envelope/pitch/vol */ { /* If channel not dead */ ms->XMActiveVoices++; - if(XMC->period<1) /* Cap period */ - XMC->period=1; - else if(XMC->period>32768) - XMC->period=32768; + if (XMC->period < 1) /* Cap period */ + XMC->period = 1; + else if (XMC->period > 32768) + XMC->period = 32768; - if(XMC->envflg & EF_ON) - envvol=ProcessEnvelope(256,XMC->keyon,XMC->sample); + if (XMC->envflg & EF_ON) + envvol = ProcessEnvelope(256, XMC->keyon, XMC->sample); else - envvol=256; - if(XMC->panenvflg & EF_ON) - envpan=ProcessPanEnvelope(128,XMC->keyon,XMC->sample); + envvol = 256; + + if (XMC->panenvflg & EF_ON) + envpan = ProcessPanEnvelope(128, XMC->keyon, XMC->sample); else - envpan=128; + envpan = 128; -// vlm=XMC->volume-XMC->UserVol; - vlm=((XMC->volume-64)*(64-XMC->UserVol))/64; - vlm+=64; - if (vlm<=64) + //vlm = XMC->volume - XMC->UserVol; + vlm = ((XMC->volume - 64) * (64-XMC->UserVol)) / 64; + vlm += 64; + + if (vlm <= 64) { - XMC->LVol=XMC->RVol=0; + XMC->LVol = XMC->RVol = 0; } else { - vlm=((DoVol(XMC->fadevol,envvol,vlm-64)*ms->SongVolume)/128); - vlm*=ms->MasterVolume; - vlm/=128; - - Pn=XMC->panning; - Pn+=ms->UserPan; - if (Pn<0) - Pn=0; - else if (Pn>255) - Pn=255; - Pn=DoPan(envpan,Pn); - - XMC->LVol=(vlm*(255-Pn)); // /128; - XMC->RVol=(vlm*Pn); // /128; + vlm = ((DoVol(XMC->fadevol, envvol, vlm - 64) * ms->SongVolume) / 128); + vlm *= ms->MasterVolume; + vlm /= 128; + + Pn = XMC->panning; + Pn += ms->UserPan; + + if (Pn < 0) + Pn = 0; + else if (Pn > 255) + Pn = 255; + + Pn = DoPan(envpan, Pn); + + XMC->LVol = (vlm * (255 - Pn)); // /128; + XMC->RVol = (vlm * Pn); // /128; } - if ((!XMC->LVol)&&(!XMC->RVol)&&(!XMC->keyon)) - { + if ((!XMC->LVol) && (!XMC->RVol) && (!XMC->keyon)) + { StpCh(XMC->SPUChannel); - XMC->ChDead=1; /* Released & 0vol - so kill channel */ - } - else if(!XMC->keyon) /* Key off? - do release on envelope */ + XMC->ChDead = 1; /* Released & 0vol - so kill channel */ + } + else if (!XMC->keyon) /* Key off? - do release on envelope */ { - XMC->fadevol-=XMC->keyoffspd; - if(XMC->fadevol<0) - XMC->fadevol=0; + XMC->fadevol -= XMC->keyoffspd; + if (XMC->fadevol < 0) + XMC->fadevol = 0; } } } @@ -2223,7 +2270,6 @@ void ApplyEffs(void) } - /***************************************************************************** UpdateEffs Play any effects if required @@ -2236,6 +2282,7 @@ void UpdateEffs(void) u_char MaxChans; MaxChans = ms->MaxChans; + for (t = 0; t < mh->XMPSXChannels; t++) { if (MaxChans == 0) @@ -2244,62 +2291,60 @@ void UpdateEffs(void) XMC = &ms->XM_Chnl[t]; pmsk = ms->PlayMask; pmsk &= (1 << t); + if (pmsk != 0) { MaxChans--; + if (!XMC->nothing) /* Any note/vol/eff's to process? */ - { JPlayEffects(); - } } } } - - #define JPPIT 2682522 - int DVL; int DVR; void DoDolbySS(void) { - if (MonoMode==XM_MONO) + if (MonoMode == XM_MONO) { - DVL=(XMC->OldLVol+XMC->OldRVol)/2; - DVR=DVL; + DVL = (XMC->OldLVol + XMC->OldRVol) / 2; + DVR = DVL; return; } - if (XMC->Dolby==XM_DOLBY_LEFT) + if (XMC->Dolby == XM_DOLBY_LEFT) { - DVL=XMC->OldLVol; - if (XMC->OldRVol>XMC->OldLVol) + DVL = XMC->OldLVol; + + if (XMC->OldRVol > XMC->OldLVol) { - DVR=-XMC->OldRVol; - DVL=XMC->OldRVol; + DVR = -XMC->OldRVol; + DVL = XMC->OldRVol; } else - DVR=-XMC->OldRVol; + DVR = -XMC->OldRVol; } - else if (XMC->Dolby==XM_DOLBY_RIGHT) + else if (XMC->Dolby == XM_DOLBY_RIGHT) { - DVR=XMC->OldLVol; - if (XMC->OldRVol>XMC->OldLVol) + DVR = XMC->OldLVol; + + if (XMC->OldRVol > XMC->OldLVol) { - DVL=-XMC->OldRVol; - DVR=XMC->OldRVol; + DVL = -XMC->OldRVol; + DVR = XMC->OldRVol; } else - DVL=-XMC->OldRVol; + DVL = -XMC->OldRVol; } else { - DVL=XMC->OldLVol; - DVR=XMC->OldRVol; + DVL = XMC->OldLVol; + DVR = XMC->OldRVol; } - } int dd = 0; @@ -2308,13 +2353,13 @@ int de = 0; // [D] [T] int GetEmpty(int old) { - unsigned char bVar1; - XMCHANNEL *j; int i; + XMCHANNEL *j; + int Chn; de++; - if (mh->XMPSXChannels <= de) + if (mh->XMPSXChannels <= de) de = 0; dd = de; @@ -2329,43 +2374,48 @@ int GetEmpty(int old) if (j->kick == 0 && j->ChDead == 1) { - bVar1 = j->SPUChannel; + Chn = j->SPUChannel; j->SPUChannel = old; - return bVar1; + return Chn; } } + return -1; } + /***************************************************************************** UpdateHardware Update SPU if needed *****************************************************************************/ // [D] [A] Half-source, half-decomp -void UpdateHardware(void) +void UpdateHardware(void) { int t; int prd; int SPUKeyOn = 0; int pmsk; - int Chnl; + int Chnl; int Ch2; u_char MaxChans; - MaxChans=ms->MaxChans; - for(t=0;tXMPSXChannels;t++) + MaxChans = ms->MaxChans; + + for (t = 0; t < mh->XMPSXChannels; t++) { - if (MaxChans==0) + if (MaxChans == 0) break; - pmsk=ms->PlayMask; - pmsk&=(1<PlayMask; + pmsk &= (1 << t); + + if (pmsk != 0) { MaxChans--; - XMC=&ms->XM_Chnl[t]; - if(XMC->kick) + XMC = &ms->XM_Chnl[t]; + + if (XMC->kick) { Chnl = XMC->SPUChannel; @@ -2375,89 +2425,95 @@ void UpdateHardware(void) if (Ch2 != -1) Chnl = Ch2; - + XMC->SPUChannel = Chnl; - prd=XMC->period; - if (ms->NotAmiga==0) - prd=((JPPIT<<2)/prd)>>3; /* Using AMIGA freq table */ + prd = XMC->period; + if (ms->NotAmiga == 0) + prd = ((JPPIT << 2) / prd) >> 3; /* Using AMIGA freq table */ else - prd=GetFreq2(prd); /* Using LINEAR freq table */ + prd = GetFreq2(prd); /* Using LINEAR freq table */ - XMC->OldLVol=XMC->LVol; - XMC->OldRVol=XMC->RVol; - DoDolbySS(); - SPUKeyOn|=(1<< Chnl); - XMC->SPUPitch=prd; - XMC->OldPeriod=XMC->period; + XMC->OldLVol = XMC->LVol; + XMC->OldRVol = XMC->RVol; + DoDolbySS(); + SPUKeyOn |= (1 << Chnl); + XMC->SPUPitch = prd; + XMC->OldPeriod = XMC->period; - PlaySFX(ms->VabID,Chnl,XMC->sample,prd,DVL,DVR); - } - } - } - if (SPUKeyOn!=0) + PlaySFX(ms->VabID, Chnl, XMC->sample, prd, DVL, DVR); + } + } + } + + if (SPUKeyOn != 0) { //XMTime1 = 1; SpuSetKey(1, SPUKeyOn); SpuFlush(SPU_EVENT_ALL); aa = 0; - } + } + + MaxChans = ms->MaxChans; - MaxChans=ms->MaxChans; - for(t=0;tXMPSXChannels;t++) + for (t = 0; t < mh->XMPSXChannels; t++) { - if (MaxChans==0) + if (MaxChans == 0) return; - pmsk=ms->PlayMask; - pmsk&=(1<PlayMask; + pmsk &= (1 << t); + + if (pmsk != 0) { MaxChans--; - XMC=&ms->XM_Chnl[t]; - if (!XMC->ChDead) - { - Ch2=XMC->SPUChannel; + XMC = &ms->XM_Chnl[t]; - if (XMC->kick==0) + if (!XMC->ChDead) + { + Ch2 = XMC->SPUChannel; + + if (XMC->kick == 0) { - if ((XMC->LVol!=XMC->OldLVol)||(XMC->RVol!=XMC->OldRVol)) + if ((XMC->LVol != XMC->OldLVol) || (XMC->RVol != XMC->OldRVol)) { - if (XMC->OldLVol!=XMC->LVol) - XMC->OldLVol=IntVols(XMC->LVol,XMC->OldLVol); - -// if (XMC->LVol==XMC->RVol) -// XMC->OldRVol=XMC->OldLVol; /* Mono sound */ -// else -// { - if (XMC->OldRVol!=XMC->RVol) - XMC->OldRVol=IntVols(XMC->RVol,XMC->OldRVol); -// } + if (XMC->OldLVol != XMC->LVol) + XMC->OldLVol = IntVols(XMC->LVol, XMC->OldLVol); + + //if (XMC->LVol == XMC->RVol) + // XMC->OldRVol = XMC->OldLVol; /* Mono sound */ + //else + //{ + if (XMC->OldRVol != XMC->RVol) + XMC->OldRVol = IntVols(XMC->RVol, XMC->OldRVol); + //} DoDolbySS(); -// SetVol(Ch2,XMC->OldLVol,XMC->OldRVol); /* Update volumes */ - SetVol(Ch2,DVL,DVR); /* Update volumes */ + //SetVol(Ch2, XMC->OldLVol, XMC->OldRVol); /* Update volumes */ + SetVol(Ch2, DVL, DVR); /* Update volumes */ + } + if (XMC->period != XMC->OldPeriod) + { + XMC->OldPeriod = XMC->period; + prd = XMC->period; + + if (ms->NotAmiga == 0) + prd = ((JPPIT << 2) / prd) >> 3; /* Using AMIGA freq table */ + else + prd = GetFreq2(prd); + + XMC->SPUPitch = prd; + SetFrq(Ch2, prd); /* Update periods */ } - if (XMC->period!=XMC->OldPeriod) - { - XMC->OldPeriod=XMC->period; - prd=XMC->period; - if(ms->NotAmiga==0) - prd=((JPPIT<<2)/prd)>>3; /* Using AMIGA freq table */ - else - prd=GetFreq2(prd); - XMC->SPUPitch=prd; - SetFrq(Ch2,prd); /* Update periods */ - } } else - XMC->kick=0; + XMC->kick = 0; } } } } - /***************************************************************************** IntVols Calculates point between Current volume and Required volume. @@ -2476,13 +2532,12 @@ int IntVols(int Vol1, int Vol2) a += 1; if (Vol1 < Vol2) - return(Vol1 + a); + return (Vol1 + a); else - return(Vol2 + a); + return (Vol2 + a); } - /***************************************************************************** GetFreq2 Returns SPU pitch. @@ -2490,86 +2545,84 @@ GetFreq2 *****************************************************************************/ #define joc 8 -//int JPPer = 6578; //6578 D1 has this value and game were shipped with broken soundtrack -int JPPer = 7350; //6578 +int JPPer = 7350; //6578; D1 has this value and game was shipped with broken soundtrack int GetFreq2(int period) { int okt; int frequency; - //FntPrint("period %d\n",period); + //FntPrint("period %d\n", period); period = JPPer - period; okt = period / 768; - //FntPrint("octave %d\n",okt); + //FntPrint("octave %d\n", okt); frequency = lintab[period % 768]; - //FntPrint("freq %d\n",frequency); + //FntPrint("freq %d\n", frequency); - //if (XMC->sample==5) - //printf("aa %d aa\n",frequency>>(joc-okt)); + //if (XMC->sample == 5) + // printf("aa %d aa\n", frequency >> (joc-okt)); - return(frequency >> (joc - okt)); /* Final SPU pitch */ + return (frequency >> (joc - okt)); /* Final SPU pitch */ } - /***************************************************************************** ProcessEnvelope Updates amplitude envelope *****************************************************************************/ -short ProcessEnvelope(short v,u_char keyon,int JSmp) +short ProcessEnvelope(short v, u_char keyon, int JSmp) { + u_char a2,b; + u_short p; -u_char a2,b; -u_short p; - -u_int* j; -short apos; -short aval; -short bpos; -short bval; + u_int* j; + short apos; + short aval; + short bpos; + short bval; - a2=XMC->enva; - b=XMC->envb; - p=XMC->envp; + a2 = XMC->enva; + b = XMC->envb; + p = XMC->envp; /* compute the envelope value between points a and b */ - j=mh->JAP_InstrumentOffset[JSmp]; - aval=(getSWord((u_char*)j+129+2+(a2*4)))<<2; - bval=(getSWord((u_char*)j+129+2+(b*4)))<<2; - apos=getSWord((u_char*)j+129+(a2*4)); - bpos=getSWord((u_char*)j+129+(b*4)); + j = mh->JAP_InstrumentOffset[JSmp]; + aval = (getSWord((u_char*)j + 129 + 2 + (a2 * 4))) << 2; + bval = (getSWord((u_char*)j + 129 + 2 + (b * 4))) << 2; + apos = getSWord((u_char*)j + 129 + (a2 * 4)); + bpos = getSWord((u_char*)j + 129 + (b * 4)); - v=Interpolate(p,apos,bpos,aval,bval); + v = Interpolate(p, apos, bpos, aval, bval); - /* Should we sustain? (sustain flag on, key-on, point a is the sustain - point, and the pointer is exactly on point a) */ + /* Should we sustain? (sustain flag on, key-on, point a is the sustain + point, and the pointer is exactly on point a) */ - if((XMC->envflg & EF_SUSTAIN) && keyon && a2==XMC->envsus && p==apos) + if ((XMC->envflg & EF_SUSTAIN) && keyon && a2 == XMC->envsus && p == apos) { /* do nothing */ } else { p++; /* don't sustain, so increase pointer. */ - if(p >= bpos) /* pointer reached point b? */ + + if (p >= bpos) /* pointer reached point b? */ { - a2=b; b++; /* shift points a and b */ - if(XMC->envflg & EF_LOOP) + a2 = b; b++; /* shift points a and b */ + if (XMC->envflg & EF_LOOP) { - if(b > XMC->envend) + if (b > XMC->envend) { - a2=XMC->envbeg; - b=a2+1; - p=getSWord((u_char*)j+129+(a2*4)); + a2 = XMC->envbeg; + b = a2 + 1; + p = getSWord((u_char*)j + 129 + (a2 * 4)); } } else { - if(b >= XMC->envpts) + if (b >= XMC->envpts) { b--; p--; @@ -2577,15 +2630,15 @@ short bval; } } } - XMC->enva=a2; - XMC->envb=b; - XMC->envp=p; + + XMC->enva = a2; + XMC->envb = b; + XMC->envp = p; return v; } - /***************************************************************************** ProcessPanEnvelope Updates panning envelope @@ -2593,7 +2646,6 @@ ProcessPanEnvelope short ProcessPanEnvelope(short v, u_char keyon, int JSmp) { - u_char a2, b; u_short p; @@ -2603,7 +2655,6 @@ short ProcessPanEnvelope(short v, u_char keyon, int JSmp) short bpos; short bval; - a2 = XMC->panenva; b = XMC->panenvb; p = XMC->panenvp; @@ -2651,51 +2702,53 @@ short ProcessPanEnvelope(short v, u_char keyon, int JSmp) } } } + XMC->panenva = a2; XMC->panenvb = b; XMC->panenvp = p; + return v; } - /***************************************************************************** XM_SetSongPos User Call. Set song position to requested value. *****************************************************************************/ -void XM_SetSongPos(int Song_ID,u_short pos) +void XM_SetSongPos(int Song_ID, u_short pos) { -int t; - if (XMSongIDs[Song_ID]==-1) + int t; + + if (XMSongIDs[Song_ID] == -1) return; - mu=(XMSONG*)(XM_SngAddress[Song_ID]); -// mu=&XM_Song[Song_ID]; -// mhu=&XM_Header[mu->HeaderNum]; - mhu=(XMHEADER*)(XM_HeaderAddress[mu->HeaderNum]); + mu = (XMSONG*)(XM_SngAddress[Song_ID]); + //mu = &XM_Song[Song_ID]; + //mhu = &XM_Header[mu->HeaderNum]; + mhu = (XMHEADER*)(XM_HeaderAddress[mu->HeaderNum]); - if (pos>=mhu->songlength) + if (pos >= mhu->songlength) return; - JP_Do_Nothing=1; /* Incase user using interrupt to call player */ + JP_Do_Nothing = 1; /* Incase user using interrupt to call player */ - for(t=0;tXMChannels;t++) + for (t = 0; t < mhu->XMChannels; t++) { - XMCU=&mu->XM_Chnl[t]; - XMCU->keyon=0; - XMCU->tmpvolume=64; + XMCU = &mu->XM_Chnl[t]; + XMCU->keyon = 0; + XMCU->tmpvolume = 64; - //if(XMCU->sample!=254) - // XMCU->kick=1; // [A] temporary fix + //if (XMCU->sample != 254) + // XMCU->kick = 1; // [A] temporary fix } - mu->posjmp=1; - mu->patbrk=0; - mu->SongPos=pos; - mu->vbtick=mu->SongSpeed; -// mu->JBPM=0; - JP_Do_Nothing=0; + mu->posjmp = 1; + mu->patbrk = 0; + mu->SongPos = pos; + mu->vbtick = mu->SongSpeed; + //mu->JBPM = 0; + JP_Do_Nothing = 0; } @@ -2712,29 +2765,30 @@ PlaySFX (To be added) Reverb 0-1 1=Use reverb ****************************************************************************/ -void PlaySFX(int VBID,int Channel,int Inst,int Pitch,int LV,int RV) + +void PlaySFX(int VBID, int Channel, int Inst, int Pitch, int LV, int RV) { int a; /* Mask which specific voice attributes are to be set */ xm_g_s_attr.mask = (SPU_VOICE_VOLL | - SPU_VOICE_VOLR | + SPU_VOICE_VOLR | SPU_VOICE_PITCH | SPU_VOICE_WDSA | SPU_VOICE_LSAX); - xm_g_s_attr.voice = SPU_VOICECH(Channel); //(1<SOffset; + xm_g_s_attr.voice = SPU_VOICECH(Channel); //(1 << Channel); + xm_g_s_attr.volume.left = LV; + xm_g_s_attr.volume.right = RV; + xm_g_s_attr.pitch = Pitch; + a = xm_l_vag_spu_addr[VBID][Inst]; + a = xm_l_vag_spu_addr[VBID][Inst] + XMC->SOffset; - xm_g_s_attr.addr = xm_l_vag_spu_addr[VBID][Inst]+XMC->SOffset; - xm_g_s_attr.loop_addr = xm_l_vag_spu_addr[VBID][Inst]+XMC->SOffset; - SpuSetVoiceAttr(&xm_g_s_attr); -} + xm_g_s_attr.addr = xm_l_vag_spu_addr[VBID][Inst] + XMC->SOffset; + xm_g_s_attr.loop_addr = xm_l_vag_spu_addr[VBID][Inst] + XMC->SOffset; + SpuSetVoiceAttr(&xm_g_s_attr); +} /***************************************************************************** @@ -2744,7 +2798,7 @@ InitSPUChannel *****************************************************************************/ void InitSPUChannel(int Channel) -{ +{ xm_g_s_attr.mask = (SPU_VOICE_WDSA | SPU_VOICE_ADSR_AMODE | @@ -2757,7 +2811,7 @@ void InitSPUChannel(int Channel) SPU_VOICE_ADSR_SL ); - xm_g_s_attr.voice = SPU_VOICECH(Channel); //(1<HeaderNum]; + //mu = &XM_Song[Song_ID]; + //mhu = &XM_Header[mu->HeaderNum]; mhu = (XMHEADER*)(XM_HeaderAddress[mu->HeaderNum]); + i = 0; for (t = 0; t < mhu->XMPSXChannels; t++) { pmsk = mu->PlayMask; pmsk &= (1 << t); + if (pmsk != 0) { XMC = &mu->XM_Chnl[t]; @@ -2873,16 +2928,19 @@ XM_Pause void XM_Pause(int Song_ID) { int t; + if (XMSongIDs[Song_ID] == -1) return; mu = (XMSONG*)(XM_SngAddress[Song_ID]); - // mu=&XM_Song[Song_ID]; - // mhu=&XM_Header[mu->HeaderNum]; + //mu = &XM_Song[Song_ID]; + //mhu = &XM_Header[mu->HeaderNum]; mhu = (XMHEADER*)(XM_HeaderAddress[mu->HeaderNum]); + if (mu->XMPlay == XM_PLAYING) { mu->XMPlay = XM_PAUSED; + for (t = 0; t < mhu->XMPSXChannels; t++) { XMCU = &mu->XM_Chnl[t]; @@ -2892,8 +2950,6 @@ void XM_Pause(int Song_ID) } - - /***************************************************************************** XM_Restart User Call. Restarts Song_ID @@ -2908,15 +2964,18 @@ void XM_Restart(int Song_ID) return; mu = (XMSONG*)(XM_SngAddress[Song_ID]); - // mu=&XM_Song[Song_ID]; - // mhu=&XM_Header[mu->HeaderNum]; + //mu = &XM_Song[Song_ID]; + //mhu = &XM_Header[mu->HeaderNum]; mhu = (XMHEADER*)(XM_HeaderAddress[mu->HeaderNum]); + if (mu->XMPlay == XM_PAUSED) { mu->XMPlay = XM_PLAYING; + for (t = 0; t < mhu->XMPSXChannels; t++) { XMCU = &mu->XM_Chnl[t]; + if (!XMCU->ChDead) { SetFrq(XMCU->SPUChannel, XMCU->SPUPitch); @@ -2934,15 +2993,17 @@ XM_SetMasterVol Song ID Volume; *****************************************************************************/ + void XM_SetMasterVol(int Song_ID, u_char Vol) { if (XMSongIDs[Song_ID] == -1) return; + if (Vol <= 128) { mu = (XMSONG*)(XM_SngAddress[Song_ID]); - // mu=&XM_Song[Song_ID]; - // mu->SongVolume=Vol; + //mu = &XM_Song[Song_ID]; + //mu->SongVolume = Vol; mu->MasterVolume = Vol; } } @@ -2953,19 +3014,20 @@ ClearSPU Free up malloc'ed blocks. Call between exiting game/loading menus fx etc. (same sort of thing as closevab). ****************************************************************************/ + void ClearSPU(int VBID) { -int i; -int Amount; + int i; + int Amount; - Amount=iVABID[VBID]; + Amount = iVABID[VBID]; - for (i=0;i<(Amount);i++) + for (i = 0; i < Amount; i++) { - if(xm_l_vag_spu_addr[VBID][i]!=0) + if (xm_l_vag_spu_addr[VBID][i] != 0) { XM_FreeVAG(xm_l_vag_spu_addr[VBID][i]); - xm_l_vag_spu_addr[VBID][i]=0; + xm_l_vag_spu_addr[VBID][i] = 0; } } } @@ -2982,10 +3044,10 @@ void XM_FreeVAG(int addr) SpuFree(addr); } - int GetFreeSongID(void) { int i; + for (i = 0; i < XM_NSA; i++) { if (XMSongIDs[i] == -1) @@ -2994,20 +3056,17 @@ int GetFreeSongID(void) return i; } } - return(-1); -} - + return (-1); +} void XM_Quit(int SongID) { XM_PlayStop(SongID); - XMSongIDs[SongID]=-1; - JPClearSPUFlags(SongID+1); + XMSongIDs[SongID] = -1; + JPClearSPUFlags(SongID + 1); } - - void JPClearSPUFlags(int SongID) { int i; @@ -3019,21 +3078,18 @@ void JPClearSPUFlags(int SongID) } } - - int XM_GetFreeVAB(void) { -int i; + int i; - for (i=0;i<8;i++) + for (i = 0; i < 8; i++) { - if (iVABID[i]==-1) - return(i); /* Free VAB slot */ + if (iVABID[i] == -1) + return (i); /* Free VAB slot */ } - return(-1); /* No Free VAB slots */ -} - + return (-1); /* No Free VAB slots */ +} void XM_SetVAGAddress(int VabID, int slot, int addr) { @@ -3041,20 +3097,19 @@ void XM_SetVAGAddress(int VabID, int slot, int addr) iVABID[VabID] = slot + 1; } - - int XM_GetSongSize(void) { - return(sizeof(XMSONG)); + return (sizeof(XMSONG)); } - void XM_SetSongAddress(u_char *Address) { XM_SngAddress[XM_NSA] = Address; + mu = ((XMSONG*)(Address)); mu->Status = 0; /* Turn off song */ mu->XMPlay = XM_STOPPED; + XM_NSA++; } @@ -3063,25 +3118,16 @@ void XM_FreeAllSongIDs(void) XM_NSA = 0; } - - int XM_GetFileHeaderSize(void) { - return(sizeof(XMHEADER)); + return (sizeof(XMHEADER)); } - - void XM_SetFileHeaderAddress(u_char *Address) { - if (XM_HA<8) + if (XM_HA < 8) { XM_HeaderAddress[XM_HA]=Address; XM_HA++; } } - - - - - diff --git a/src_rebuild/Game/C/xmplay.h b/src_rebuild/Game/C/xmplay.h index 41d5ca130..ca17a51d0 100644 --- a/src_rebuild/Game/C/xmplay.h +++ b/src_rebuild/Game/C/xmplay.h @@ -1,7 +1,7 @@ #ifndef XMPLAY_H #define XMPLAY_H -#define XM_NTSC 0 /* Machine type */ +#define XM_NTSC 0 /* Machine type */ #define XM_PAL 1 #define XM_MONO 0 @@ -11,50 +11,49 @@ #define XM_DOLBY_LEFT 1 #define XM_DOLBY_RIGHT 2 -#define XM_Loop 1 /* Looping song */ +#define XM_Loop 1 /* Looping song */ #define XM_NoLoop 0 /* Once off song */ #define XM_Music 0 /* Playback as music */ -#define XM_SFX 1 /* Playback as SFX */ +#define XM_SFX 1 /* Playback as SFX */ #define MD_id 0 -#define MD_sngname 17 -#define MD_trkname 21+17 -#define MD_version 20+21+17 -#define MD_hdsize 20+21+17+2 -#define MD_snglen 20+21+17+2+4 -#define MD_restart 20+21+17+2+4+2 -#define MD_numchan 20+21+17+2+4+2+2 -#define MD_numpat 20+21+17+2+4+2+2+2 -#define MD_numins 20+21+17+2+4+2+2+2+2 -#define MD_flags 20+21+17+2+4+2+2+2+2+2 -#define MD_tempo 20+21+17+2+4+2+2+2+2+2+2 -#define MD_bpm 20+21+17+2+4+2+2+2+2+2+2+2 -#define MD_orders 20+21+17+2+4+2+2+2+2+2+2+2+2 -#define MD_patstrt 20+21+17+2+4+2+2+2+2+2+2+2+2+256 +#define MD_sngname 17 +#define MD_trkname 21 + 17 +#define MD_version 20 + 21 + 17 +#define MD_hdsize 20 + 21 + 17 + 2 +#define MD_snglen 20 + 21 + 17 + 2 + 4 +#define MD_restart 20 + 21 + 17 + 2 + 4 + 2 +#define MD_numchan 20 + 21 + 17 + 2 + 4 + 2 + 2 +#define MD_numpat 20 + 21 + 17 + 2 + 4 + 2 + 2 + 2 +#define MD_numins 20 + 21 + 17 + 2 + 4 + 2 + 2 + 2 + 2 +#define MD_flags 20 + 21 + 17 + 2 + 4 + 2 + 2 + 2 + 2 + 2 +#define MD_tempo 20 + 21 + 17 + 2 + 4 + 2 + 2 + 2 + 2 + 2 + 2 +#define MD_bpm 20 + 21 + 17 + 2 + 4 + 2 + 2 + 2 + 2 + 2 + 2 + 2 +#define MD_orders 20 + 21 + 17 + 2 + 4 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 +#define MD_patstrt 20 + 21 + 17 + 2 + 4 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 256 typedef struct _XMHEADER { u_short version; - u_short songlength; /* (word) Song length (in patten order table) */ - u_short restart; /* (word) Restart position */ - u_short numchn; /* (word) Number of channels (2,4,6,8,10,...,32) */ - u_short numpat; /* (word) Number of patterns (max 256) */ - u_short numins; /* (word) Number of instruments (max 128) */ - u_short flags; /* (word) Flags: bit 0: 0 = Amiga freq */ - u_short tempo; /* (word) Default tempo */ + u_short songlength; /* (word) Song length (in patten order table) */ + u_short restart; /* (word) Restart position */ + u_short numchn; /* (word) Number of channels (2,4,6,8,10,...,32) */ + u_short numpat; /* (word) Number of patterns (max 256) */ + u_short numins; /* (word) Number of instruments (max 128) */ + u_short flags; /* (word) Flags: bit 0: 0 = Amiga freq */ + u_short tempo; /* (word) Default tempo */ u_short bpm; u_short XMChannels; u_short XMPSXChannels; - u_int *JAP_PAT_ADDR[256]; /* Pattern Start Addresses (maxpatt*chnls)*/ - u_int *JAP_PAT_ADDR2[256]; /* Pattern Start Addresses (maxpatt*chnls)*/ + u_int *JAP_PAT_ADDR[256]; /* Pattern Start Addresses (maxpatt * chnls)*/ + u_int *JAP_PAT_ADDR2[256]; /* Pattern Start Addresses (maxpatt * chnls)*/ u_int *JAP_InstrumentOffset[128]; u_int *JAP_SampAddr[128]; u_int *JAP_SampHdrAddr[128]; - u_char jorders[256]; /* list of patterns */ - int S3MPanning; + u_char jorders[256]; /* list of patterns */ + int S3MPanning; } XMHEADER; - typedef struct _XMCHANNEL { u_short Octave; short LVol; @@ -67,23 +66,23 @@ typedef struct _XMCHANNEL { u_int SOffset; u_char nothing; u_char ChDead; - u_char panenvflg; /* envelope flag */ - u_char panenvpts; /* number of envelope points */ - u_char panenvsus; /* envelope sustain index */ - u_char panenvbeg; /* envelope loop begin */ - u_char panenvend; /* envelope loop end */ - short panenvp; /* current envelope counter */ - u_short panenva; /* envelope index a */ - u_short panenvb; /* envelope index b */ + u_char panenvflg; /* envelope flag */ + u_char panenvpts; /* number of envelope points */ + u_char panenvsus; /* envelope sustain index */ + u_char panenvbeg; /* envelope loop begin */ + u_char panenvend; /* envelope loop end */ + short panenvp; /* current envelope counter */ + u_short panenva; /* envelope index a */ + u_short panenvb; /* envelope index b */ u_short keyoffspd; - u_char envflg; /* envelope flag */ - u_char envpts; /* number of envelope points */ - u_char envsus; /* envelope sustain index */ - u_char envbeg; /* envelope loop begin */ - u_char envend; /* envelope loop end */ - short envp; /* current envelope counter */ - u_short enva; /* envelope index a */ - u_short envb; /* envelope index b */ + u_char envflg; /* envelope flag */ + u_char envpts; /* number of envelope points */ + u_char envsus; /* envelope sustain index */ + u_char envbeg; /* envelope loop begin */ + u_char envend; /* envelope loop end */ + short envp; /* current envelope counter */ + u_short enva; /* envelope index a */ + u_short envb; /* envelope index b */ u_char ins; u_char vol; @@ -94,93 +93,91 @@ typedef struct _XMCHANNEL { u_char oldvslide; u_char oldfvslide; u_char oldfslide; - short fadevol; /* fading volume */ - u_char keyon; /* if 1=key is pressed. */ - u_char kick; /* if 1=sample has to be restarted */ - u_char kick2; /* if 1=sample has to be restarted */ - u_char sample; /* which sample number (0-31) */ - short handle; /* which sample-handle */ - u_int start; /* The start byte index in the sample */ - u_char panning; /* panning position */ - u_char pansspd; /* panslide speed */ - u_char volume; /* volume (0 - 64) to play the sample at */ - u_short period; /* period to play the sample at */ - u_short SPUPitch; /* period to play the sample at */ + short fadevol; /* fading volume */ + u_char keyon; /* if 1=key is pressed. */ + u_char kick; /* if 1=sample has to be restarted */ + u_char kick2; /* if 1=sample has to be restarted */ + u_char sample; /* which sample number (0-31) */ + short handle; /* which sample-handle */ + u_int start; /* The start byte index in the sample */ + u_char panning; /* panning position */ + u_char pansspd; /* panslide speed */ + u_char volume; /* volume (0 - 64) to play the sample at */ + u_short period; /* period to play the sample at */ + u_short SPUPitch; /* period to play the sample at */ char transpose; u_char note; short ownper; short ownvol; short UserVol; - char retrig; /* retrig value (0 means don't retrig) */ - u_short c2spd; /* what finetune to use */ - u_char tmpvolume; /* tmp volume JAP */ - u_short tmpperiod; /* tmp period */ - u_short wantedperiod; /* period to slide to (with effect 3 or 5) */ - u_short slidespeed; /* */ - u_short portspeed; /* noteslide speed (toneportamento) */ - u_char s3mtremor; /* s3m tremor (effect I) counter */ - u_char s3mvolslide; /* last used volslide */ - u_char s3mrtgspeed; /* last used retrig speed */ - u_char s3mrtgslide; /* last used retrig slide */ - u_char glissando; /* glissando (0 means off) */ - u_char wavecontrol; /* */ - u_char vibpos; /* current vibrato position */ - u_char vibspd; /* "" speed */ - u_char vibdepth; /* "" depth */ - u_char trmpos; /* current tremolo position */ - u_char trmspd; /* "" speed */ - u_char trmdepth; /* "" depth */ - u_char SPUChannel; /* SPU Channel to play sound on */ + char retrig; /* retrig value (0 means don't retrig) */ + u_short c2spd; /* what finetune to use */ + u_char tmpvolume; /* tmp volume JAP */ + u_short tmpperiod; /* tmp period */ + u_short wantedperiod; /* period to slide to (with effect 3 or 5) */ + u_short slidespeed; /* */ + u_short portspeed; /* noteslide speed (toneportamento) */ + u_char s3mtremor; /* s3m tremor (effect I) counter */ + u_char s3mvolslide; /* last used volslide */ + u_char s3mrtgspeed; /* last used retrig speed */ + u_char s3mrtgslide; /* last used retrig slide */ + u_char glissando; /* glissando (0 means off) */ + u_char wavecontrol; /* */ + u_char vibpos; /* current vibrato position */ + u_char vibspd; /* "" speed */ + u_char vibdepth; /* "" depth */ + u_char trmpos; /* current tremolo position */ + u_char trmspd; /* "" speed */ + u_char trmdepth; /* "" depth */ + u_char SPUChannel; /* SPU Channel to play sound on */ u_char Dolby; -//108 + //108 } XMCHANNEL; - typedef struct _XMSONG { u_char Status; - int HeaderNum; - int CurPos; /* Index into pattern data */ - u_short reppos; /* patternloop position */ - u_short repcnt; /* times to loop */ - u_short vbtick; /* tick counter */ - u_short patbrk; /* position where to start a new pattern */ - u_char patdly; /* patterndelay counter */ - u_char patdly2; /* patterndelay counter */ - u_short numrow; /* number of rows on current pattern */ - short posjmp; /* flag to indicate a position jump is needed*/ - u_short PatternPos; /* current row number (0-255) */ - short SongPos; /* current song position */ + int HeaderNum; + int CurPos; /* Index into pattern data */ + u_short reppos; /* patternloop position */ + u_short repcnt; /* times to loop */ + u_short vbtick; /* tick counter */ + u_short patbrk; /* position where to start a new pattern */ + u_char patdly; /* patterndelay counter */ + u_char patdly2; /* patterndelay counter */ + u_short numrow; /* number of rows on current pattern */ + short posjmp; /* flag to indicate a position jump is needed*/ + u_short PatternPos; /* current row number (0-255) */ + short SongPos; /* current song position */ u_short CurrentPattern; - u_short SongSpeed; /* current songspeed */ + u_short SongSpeed; /* current songspeed */ u_short SongBPM; - int SongLoop; /* loop module ? */ - u_char SongVolume; /* song volume (0-128) */ - u_char MasterVolume; /* song volume (0-128) */ - int XMActiveVoices; /* number of voices currently playing */ - int NotAmiga; - u_char XMPlay; - int FirstCh; /* First SPU channel to playback on */ - int JBPM; - int PCounter; + int SongLoop; /* loop module ? */ + u_char SongVolume; /* song volume (0-128) */ + u_char MasterVolume; /* song volume (0-128) */ + int XMActiveVoices; /* number of voices currently playing */ + int NotAmiga; + u_char XMPlay; + int FirstCh; /* First SPU channel to playback on */ + int JBPM; + int PCounter; u_short PatSize; u_int *PatAdr; u_int *PatAdr2; - int PlayMask; - int SFXNum; - XMCHANNEL XM_Chnl[24]; /* max 32 channels per song*/ + int PlayMask; + int SFXNum; + XMCHANNEL XM_Chnl[24]; /* max 32 channels per song*/ int JUp; - short PlayNext; + short PlayNext; short BPlayNext; short BPlayFlag; - int CurrentStart; - u_char VabID; - short UserPan; - u_char MaxChans; + int CurrentStart; + u_char VabID; + short UserPan; + u_char MaxChans; //2689 -}XMSONG; +} XMSONG; - -#define XMEF_APPREGIO 0 /* Effects */ +#define XMEF_APPREGIO 0 /* Effects */ #define XMEF_PORTUP 1 #define XMEF_PORTDOWN 2 #define XMEF_TONEPORT 3 @@ -201,7 +198,7 @@ typedef struct _XMSONG { #define XMEF_XM_VOLSLD 23 #define XMEF_XM_PANSLD 24 -#define XMEF_E_FINESLD_UP 1 /* Effects from above E command */ +#define XMEF_E_FINESLD_UP 1 /* Effects from above E command */ #define XMEF_E_FINESLD_DOWN 2 #define XMEF_E_GLISSANDO 3 #define XMEF_E_VIB_WAVE 4 @@ -216,7 +213,7 @@ typedef struct _XMSONG { #define XMEF_E_NOTEDELAY 13 #define XMEF_E_PATDELAY 14 -/*Envelope flags*/ +/* Envelope flags */ #define EF_ON 1 #define EF_SUSTAIN 2 @@ -224,31 +221,31 @@ typedef struct _XMSONG { typedef struct _XM_HeaderInfo { - u_short BPM; - u_short Speed; + u_short BPM; + u_short Speed; } XM_HeaderInfo; typedef struct _XM_VABInfo { - u_char* Address; - u_int Size; + u_char* Address; + u_int Size; } XM_VABInfo; typedef struct _XM_Feedback { - u_char Volume; - short Panning; - int CurrentStart; - short PlayNext; - u_short SongLength; - u_char Status; - u_short PatternPos; - short SongPos; - u_short CurrentPattern; - u_short SongSpeed; - u_short SongBPM; - int SongLoop; - int ActiveVoices; + u_char Volume; + short Panning; + int CurrentStart; + short PlayNext; + u_short SongLength; + u_char Status; + u_short PatternPos; + short SongPos; + u_short CurrentPattern; + u_short SongSpeed; + u_short SongBPM; + int SongLoop; + int ActiveVoices; } XM_Feedback; short Interpolate(short p, short p1, short p2, short v1, short v2); // 0x000869EC @@ -389,5 +386,4 @@ int XM_GetFileHeaderSize(); // 0x000863E4 void XM_SetFileHeaderAddress(u_char *Address); // 0x000863B0 - -#endif +#endif // XMPLAY_H diff --git a/src_rebuild/Game/Frontend/FEmain.c b/src_rebuild/Game/Frontend/FEmain.c index 1e1b9e38a..3d72f4acd 100644 --- a/src_rebuild/Game/Frontend/FEmain.c +++ b/src_rebuild/Game/Frontend/FEmain.c @@ -80,7 +80,7 @@ void InitHiresFEFont() // load TGA file sprintf(namebuffer, "%s%s", gDataFolder, "GFX\\HQ\\fefont.tga"); FS_FixPathSlashes(namebuffer); - + if (LoadTGAImage(namebuffer, &data, width, height, bpp)) { if (bpp == 32) @@ -568,21 +568,20 @@ char cutUnlock[] = { }; int CarAvailability[4][10] = { - {1,1,1,1,0,0,0,0,0,0}, - {1,1,1,1,0,0,0,0,0,0}, - {1,1,1,1,0,0,0,0,0,0}, - {1,1,1,1,0,0,0,0,0,0}, + { 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 }, + { 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 }, + { 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 }, + { 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 } }; char carNumLookup[4][10] = { - {1, 2, 3, 4, 0, 8, 9, 10, 11, 12}, - {1, 2, 3, 4, 0, 8, 9, 10, 11, 12}, - {1, 2, 3, 4, 0, 8, 9, 10, 11, 12}, - {1, 2, 3, 4, 0, 8, 9, 10, 11, 12}, + { 1, 2, 3, 4, 0, 8, 9, 10, 11, 12 }, + { 1, 2, 3, 4, 0, 8, 9, 10, 11, 12 }, + { 1, 2, 3, 4, 0, 8, 9, 10, 11, 12 }, + { 1, 2, 3, 4, 0, 8, 9, 10, 11, 12 } }; int minmaxSelections[4][2] = { - { 0, 8 }, { 8, 18 }, { 18, 28 }, @@ -590,44 +589,44 @@ int minmaxSelections[4][2] = { }; BOTCH botch[38] = { - { 1, &MissionName[0]}, - { 2, &MissionName[1]}, - { 3, &MissionName[2]}, - { 4, &MissionName[3]}, - { 5, &MissionName[4]}, - { 6, &MissionName[5]}, - { 7, &MissionName[6]}, - { 9, &MissionName[7]}, - { 10, &MissionName[8]}, - { 11, &MissionName[9]}, - { 13, &MissionName[10]}, - { 14, &MissionName[11]}, - { 15, &MissionName[12]}, - { 16, &MissionName[13]}, - { 17, &MissionName[14]}, - { 18, &MissionName[15]}, - { 19, &MissionName[16]}, - { 20, &MissionName[17]}, - { 21, &MissionName[18]}, - { 22, &MissionName[19]}, - { 23, &MissionName[20]}, - { 24, &MissionName[21]}, - { 25, &MissionName[22]}, - { 26, &MissionName[23]}, - { 27, &MissionName[24]}, - { 28, &MissionName[25]}, - { 29, &MissionName[26]}, - { 30, &MissionName[27]}, - { 31, &MissionName[28]}, - { 32, &MissionName[29]}, - { 33, &MissionName[30]}, - { 34, &MissionName[31]}, - { 35, &MissionName[32]}, - { 37, &MissionName[33]}, - { 38, &MissionName[34]}, - { 39, &MissionName[35]}, - { 40, &MissionName[36]}, - { 0,NULL} + { 1, &MissionName[0] }, + { 2, &MissionName[1] }, + { 3, &MissionName[2] }, + { 4, &MissionName[3] }, + { 5, &MissionName[4] }, + { 6, &MissionName[5] }, + { 7, &MissionName[6] }, + { 9, &MissionName[7] }, + { 10, &MissionName[8] }, + { 11, &MissionName[9] }, + { 13, &MissionName[10] }, + { 14, &MissionName[11] }, + { 15, &MissionName[12] }, + { 16, &MissionName[13] }, + { 17, &MissionName[14] }, + { 18, &MissionName[15] }, + { 19, &MissionName[16] }, + { 20, &MissionName[17] }, + { 21, &MissionName[18] }, + { 22, &MissionName[19] }, + { 23, &MissionName[20] }, + { 24, &MissionName[21] }, + { 25, &MissionName[22] }, + { 26, &MissionName[23] }, + { 27, &MissionName[24] }, + { 28, &MissionName[25] }, + { 29, &MissionName[26] }, + { 30, &MissionName[27] }, + { 31, &MissionName[28] }, + { 32, &MissionName[29] }, + { 33, &MissionName[30] }, + { 34, &MissionName[31] }, + { 35, &MissionName[32] }, + { 37, &MissionName[33] }, + { 38, &MissionName[34] }, + { 39, &MissionName[35] }, + { 40, &MissionName[36] }, + { 0, NULL } }; char ScreenTitle[128]; @@ -746,13 +745,13 @@ void SetVariable(int var) pScreenStack[ScreenDepth] = pCurrScreen; pButtonStack[ScreenDepth] = pCurrButton; - if (value == 1) + if (value == 1) { #ifdef PSX #else // [A] temporary // TODO: Do menu with the replays - if(LoadReplayFromFile("Replays/CHASE.D2RP")) + if (LoadReplayFromFile("Replays/CHASE.D2RP")) { StoredGameType = GameType; GameType = GAME_LOADEDREPLAY; @@ -780,15 +779,15 @@ void SetVariable(int var) pButtonStack[ScreenDepth] = pCurrButton; #ifndef PSX - if (value == 0) + if (value == 0) { // [A] save configuration SaveCurrentProfile(1); } - else + else { // [A] load progress - if(LoadCurrentGame()) + if (LoadCurrentGame()) { GameType = GAME_CONTINUEMISSION; SetState(STATE_GAMESTART); @@ -812,7 +811,7 @@ void SetVariable(int var) ActiveCheats.cheat4 = value; break; case 12: - GameLevel = 3; + GameLevel = LEVEL_RIO; gSubGameNumber = (value == 0) ? 2 : 0; break; case 13: @@ -906,19 +905,19 @@ void SetupScreenSprts(PSXSCREEN *pScr) if (pScr->userFunctionNum == 0 || pScr->userFunctionNum == 128) { - if (pNewButton != NULL) + if (pNewButton != NULL) { pCurrButton = pNewButton; pNewButton = NULL; } - else + else pCurrButton = pScr->buttons; } else { if ((fpUserFunctions[pScr->userFunctionNum - 1])(1) == 0) { - if (pNewButton != NULL) + if (pNewButton != NULL) { pCurrButton = pNewButton; pNewButton = NULL; @@ -933,8 +932,6 @@ DR_MOVE In; DR_MOVE Out; RECT16 storeRect = { 768, 475, 255, 36 }; - - // [D] [T] void DisplayOnScreenText(void) { @@ -1057,7 +1054,7 @@ void DrawScreen(PSXSCREEN *pScr) // hide the Director's Cut button numBtnsToDraw = pScr->numButtons - 1; } - else + else { numBtnsToDraw = pScr->numButtons; } @@ -1066,7 +1063,7 @@ void DrawScreen(PSXSCREEN *pScr) for (i = 0; i < numBtnsToDraw; i++) DrawButton(&pScr->buttons[i], i); #else - if(bQuitToSystem) + if (bQuitToSystem) { int len; int quitLen; @@ -1076,7 +1073,7 @@ void DrawScreen(PSXSCREEN *pScr) if (quitLen < 100) quitLen = 100; - + len = FEStringWidth(G_LTXT(GTXT_YES)); FEPrintString(G_LTXT(GTXT_YES), 320 - quitLen / 4 - len / 2, 288, 0, 128, 128, bQuitToSystemSel ? 0 : 128); @@ -1086,7 +1083,7 @@ void DrawScreen(PSXSCREEN *pScr) else { NewSelection(0); - + for (i = 0; i < numBtnsToDraw; i++) DrawButton(&pScr->buttons[i], i); } @@ -1101,8 +1098,8 @@ void DrawScreen(PSXSCREEN *pScr) SetTextColour(128, 0, 0); DisplayOnScreenText(); - - if (bDrawExtra) + + if (bDrawExtra) { #ifdef PSX addPrim(current->ot + 2, &extraSprt); @@ -1110,7 +1107,7 @@ void DrawScreen(PSXSCREEN *pScr) #else SPRT* extrSprt; POLY_FT3* extrDummy; - + extrSprt = (SPRT*)current->primptr; current->primptr += sizeof(SPRT); *extrSprt = extraSprt; @@ -1126,7 +1123,7 @@ void DrawScreen(PSXSCREEN *pScr) } #ifdef PSX - else + else { EndFrame(); } @@ -1146,7 +1143,7 @@ void FEDrawCDicon(void) int i; RECT16 dest; - if(!bCdIconSetup) + if (!bCdIconSetup) return; cd_icon[23] = cd_icon[11]; @@ -1186,13 +1183,13 @@ void SetupExtraPoly(char *fileName, int offset, int offset2) rect.y = 256; rect.w = 64; rect.h = 219; - + LoadImage(&rect, (u_long*)(_frontend_buffer + offset2 + offset * 0x8000)); - + DrawSync(0); VSync(0); - if(bDrawExtra == 0) + if (bDrawExtra == 0) { setSprt(&extraSprt); setPolyFT3(&extraDummy); @@ -1209,7 +1206,7 @@ void SetupExtraPoly(char *fileName, int offset, int offset2) bDrawExtra = 1; - if (strcmp(fileName, "DATA\\CITY.RAW") == 0) + if (strcmp(fileName, "DATA\\CITY.RAW") == 0) { loaded[0] = 1; loaded[1] = -1; @@ -1227,7 +1224,7 @@ void SetupExtraPoly(char *fileName, int offset, int offset2) for (i = 0; i < 4; i++) { - if (strcmp(fileName, cutGfxNames[i]) == 0) + if (strcmp(fileName, cutGfxNames[i]) == 0) { loaded[1] = -1; loaded[2] = i; @@ -1348,7 +1345,7 @@ void LoadFrontendScreens(int full) // [A] optimized. Before it was to wasteful to load 16 sectors int loadSize = i == 0 ? 0x8000 : (36 * 128); rect.h = i == 0 ? 256 : 36; - + ShowLoading(); LoadfileSeg("DATA\\GFX.RAW", (char*)_other_buffer, 0x30000 + (i * 0x8000), loadSize); @@ -1383,7 +1380,7 @@ void ReInitScreens(int returnToMain) #ifndef PSX bReturnToMain = returnToMain; - if(bReturnToMain) + if (bReturnToMain) { bCdIconSetup = 0; iScreenSelect = SCREEN_NONE; @@ -1402,7 +1399,7 @@ void ReInitScreens(int returnToMain) loaded[0] = -1; loaded[1] = -1; loaded[2] = -1; - + padsConnected[0] = 1; padsConnected[1] = 0; @@ -1444,7 +1441,7 @@ void ReInitScreens(int returnToMain) LoadBackgroundFile("DATA\\GFX.RAW"); } } - else + else { bReturnToMain = 1; } @@ -1549,7 +1546,7 @@ int HandleKeyPress(void) } if (feNewPad & MPAD_CROSS) - { + { int action = pCurrButton->action >> 8; if (action != BTN_DISABLED) @@ -1608,7 +1605,7 @@ int HandleKeyPress(void) { if (!bDoneAllready) FESound(0); - else + else bDoneAllready = 0; if (--ScreenDepth == 0) @@ -1641,7 +1638,6 @@ int HandleKeyPress(void) return 1; } - // [D] [T] void PadChecks(void) { @@ -1651,18 +1647,18 @@ void PadChecks(void) int oldnum = numPadsConnected; ReadControllers(); - + numPadsConnected = 0; feNewPad = Pads[0].mapnew; fePad = Pads[0].mapped; - for (int i = 0; i < 2; i++) + for (int i = 0; i < 2; i++) { - if (Pads[i].type < 2) + if (Pads[i].type < 2) { padsConnected[i] = 0; } - else + else { padsConnected[i] = 1; numPadsConnected++; @@ -1671,20 +1667,20 @@ void PadChecks(void) #ifndef PSX // [A] quit to system - if(feNewPad & MPAD_TRIANGLE) + if (feNewPad & MPAD_TRIANGLE) { - if(ScreenDepth == 0) + if (ScreenDepth == 0) { bQuitToSystem ^= 1; FESound(0); } } - if(bQuitToSystem) + if (bQuitToSystem) { if (feNewPad & MPAD_CROSS) { - if(bQuitToSystemSel == 1) + if (bQuitToSystemSel == 1) bQuitToSystem = 2; else bQuitToSystem = 0; @@ -1703,16 +1699,16 @@ void PadChecks(void) } #endif - if (oldnum != numPadsConnected && (oldnum == 2 || numPadsConnected == 2) && ScreenDepth == 0) + if (oldnum != numPadsConnected && (oldnum == 2 || numPadsConnected == 2) && ScreenDepth == 0) { bRedrawFrontend = 1; MainScreen(1); } if ((Pads[0].dualshock == 0 || padsConnected[0] == 0) && - (Pads[1].dualshock == 0 || padsConnected[1] == 0)) + (Pads[1].dualshock == 0 || padsConnected[1] == 0)) { - if(allowVibration == 1) + if (allowVibration == 1) { allowVibration = 0; @@ -1723,7 +1719,7 @@ void PadChecks(void) } } } - else + else { if (allowVibration == 0) { @@ -1737,22 +1733,22 @@ void PadChecks(void) } } - if (oldnum != numPadsConnected && NumPlayers == 2 && numPadsConnected != NumPlayers || - numPadsConnected == 0 || - padsConnected[0] == 0) + if (oldnum != numPadsConnected && NumPlayers == 2 && numPadsConnected != NumPlayers || + numPadsConnected == 0 || + padsConnected[0] == 0) { bReturnToMain = 1; bRedrawFrontend = 1; feNewPad = 0x10; - if (pCurrScreen->userFunctionNum != 0) + if (pCurrScreen->userFunctionNum != 0) { (fpUserFunctions[pCurrScreen->userFunctionNum - 1])(0); } feNewPad = 0; - if (ScreenDepth != 0) + if (ScreenDepth != 0) { ReInitScreens(bReturnToMain); } @@ -1803,7 +1799,7 @@ void SetFEDrawMode(void) PutDrawEnv(¤t->draw); } -// [A] - was inlined in State_FrontEnd +// [A] was inlined in State_FrontEnd void InitFrontend(void) { InitCdIcon(); @@ -1828,7 +1824,7 @@ void InitFrontend(void) LoadBankFromLump(SOUND_BANK_SFX, SBK_ID_MENU); } -// [A] - was inlined in State_FrontEnd +// [A] was inlined in State_FrontEnd void InitFrontendDisplay(void) { SetDispMask(0); @@ -1867,7 +1863,7 @@ void State_FrontEnd(void* param) { feNewPad = ((feNewPad & MPAD_TRIANGLE) != 0) ? MPAD_TRIANGLE : 0; } - else + else { feNewPad = Pads[1].mapnew; } @@ -1907,7 +1903,7 @@ void State_FrontEnd(void* param) GameType = GAME_IDLEDEMO; gCurrentMissionNumber = gIdleReplay + 400; - + if (++gIdleReplay == 4) gIdleReplay = 0; @@ -1926,7 +1922,7 @@ void State_FrontEnd(void* param) idle_timer = VSync(-1); } - if(bQuitToSystem == 2) + if (bQuitToSystem == 2) SetState(STATE_NONE); } @@ -2056,7 +2052,6 @@ int FEPrintString(char *string, int x, int y, int justification, int r, int g, i return x; } - // [D] [T] int FEPrintStringSized(char *string, int x, int y, int scale, int transparent, int r, int g, int b) { @@ -2119,7 +2114,6 @@ int FEPrintStringSized(char *string, int x, int y, int scale, int transparent, i return x; } - SCREEN_LIMITS screen_limits[2] = { // min(x/y), max(x/y) { -27, 5, 35, 37 }, @@ -2210,7 +2204,6 @@ int CentreScreen(int bSetup) return 0; } - // [D] [T] int CarSelectScreen(int bSetup) { @@ -2261,7 +2254,7 @@ int CarSelectScreen(int bSetup) // unlock the cop car only int unlocked = (i == 4) && gFurthestMission == 40; - CarAvailability[0][i] = unlocked; + CarAvailability[0][i] = unlocked; CarAvailability[1][i] = unlocked; CarAvailability[2][i] = unlocked; CarAvailability[3][i] = unlocked; @@ -2269,7 +2262,7 @@ int CarSelectScreen(int bSetup) } #ifdef PSX - if (currPlayer != 1) + if (currPlayer != 1) return 0; #endif @@ -2384,7 +2377,7 @@ int CarSelectScreen(int bSetup) return 0; } - + rect = extraRect; LoadImage(&rect, (u_long*)(_frontend_buffer + carSelection * 0x8000)); DrawSync(0); @@ -2413,7 +2406,7 @@ int CarSelectScreen(int bSetup) // [D] [T] int CopDiffLevelScreen(int bSetup) { - if (bSetup) + if (bSetup) { pCurrButton = &pCurrScreen->buttons[gCopDifficultyLevel]; return 1; @@ -2438,7 +2431,7 @@ int CopDiffLevelScreen(int bSetup) // [D] [T] int VibroOnOffScreen(int bSetup) { - if (bSetup) + if (bSetup) { currSelIndex = (gVibration ^ 1); pCurrButton = &pCurrScreen->buttons[currSelIndex]; @@ -2461,13 +2454,12 @@ int VibroOnOffScreen(int bSetup) return 0; } - // [D] [T] int MissionSelectScreen(int bSetup) { int i; - if (bSetup) + if (bSetup) { iScreenSelect = SCREEN_MISSION; @@ -2480,7 +2472,7 @@ int MissionSelectScreen(int bSetup) LoadBackgroundFile("DATA\\CITYBACK.RAW"); } - if (feVariableSave[0] != -1) + if (feVariableSave[0] != -1) { currMission = feVariableSave[0]; currSelIndex = feVariableSave[1]; @@ -2497,7 +2489,7 @@ int MissionSelectScreen(int bSetup) { if (botch[currMission + i].missNum > gFurthestMission || currMission + i >= minmaxSelections[currCity][1] || - currMission + i > 36) + currMission + i > 36) { done = true; } @@ -2509,50 +2501,50 @@ int MissionSelectScreen(int bSetup) switch (usedB) { - case 1: - pCurrScreen->buttons[1].u = 2; - pCurrScreen->buttons[1].d = 2; - sprintf(pCurrScreen->buttons[1].Name, GET_MISSION_TXT(MissionName[currMission])); - sprintf(pCurrScreen->buttons[2].Name, NullStr); - sprintf(pCurrScreen->buttons[3].Name, NullStr); - sprintf(pCurrScreen->buttons[4].Name, NullStr); - break; - case 2: - pCurrScreen->buttons[1].u = 3; - pCurrScreen->buttons[1].d = 3; - pCurrScreen->buttons[2].u = 2; - pCurrScreen->buttons[2].d = 2; - sprintf(pCurrScreen->buttons[1].Name, GET_MISSION_TXT(MissionName[currMission])); - sprintf(pCurrScreen->buttons[2].Name, GET_MISSION_TXT(MissionName[currMission + 1])); - sprintf(pCurrScreen->buttons[3].Name, NullStr); - sprintf(pCurrScreen->buttons[4].Name, NullStr); - break; - case 3: - pCurrScreen->buttons[1].u = 4; - pCurrScreen->buttons[1].d = 3; - pCurrScreen->buttons[2].u = 2; - pCurrScreen->buttons[2].d = 4; - pCurrScreen->buttons[3].u = 3; - pCurrScreen->buttons[3].d = 2; - sprintf(pCurrScreen->buttons[1].Name, GET_MISSION_TXT(MissionName[currMission])); - sprintf(pCurrScreen->buttons[2].Name, GET_MISSION_TXT(MissionName[currMission + 1])); - sprintf(pCurrScreen->buttons[3].Name, GET_MISSION_TXT(MissionName[currMission + 2])); - sprintf(pCurrScreen->buttons[4].Name, NullStr); - break; - case 4: - pCurrScreen->buttons[1].u = 5; - pCurrScreen->buttons[1].d = 3; - pCurrScreen->buttons[2].u = 2; - pCurrScreen->buttons[2].d = 4; - pCurrScreen->buttons[3].u = 3; - pCurrScreen->buttons[3].d = 5; - pCurrScreen->buttons[4].u = 4; - pCurrScreen->buttons[4].d = 2; - sprintf(pCurrScreen->buttons[1].Name, GET_MISSION_TXT(MissionName[currMission])); - sprintf(pCurrScreen->buttons[2].Name, GET_MISSION_TXT(MissionName[currMission + 1])); - sprintf(pCurrScreen->buttons[3].Name, GET_MISSION_TXT(MissionName[currMission + 2])); - sprintf(pCurrScreen->buttons[4].Name, GET_MISSION_TXT(MissionName[currMission + 3])); - break; + case 1: + pCurrScreen->buttons[1].u = 2; + pCurrScreen->buttons[1].d = 2; + sprintf(pCurrScreen->buttons[1].Name, GET_MISSION_TXT(MissionName[currMission])); + sprintf(pCurrScreen->buttons[2].Name, NullStr); + sprintf(pCurrScreen->buttons[3].Name, NullStr); + sprintf(pCurrScreen->buttons[4].Name, NullStr); + break; + case 2: + pCurrScreen->buttons[1].u = 3; + pCurrScreen->buttons[1].d = 3; + pCurrScreen->buttons[2].u = 2; + pCurrScreen->buttons[2].d = 2; + sprintf(pCurrScreen->buttons[1].Name, GET_MISSION_TXT(MissionName[currMission])); + sprintf(pCurrScreen->buttons[2].Name, GET_MISSION_TXT(MissionName[currMission + 1])); + sprintf(pCurrScreen->buttons[3].Name, NullStr); + sprintf(pCurrScreen->buttons[4].Name, NullStr); + break; + case 3: + pCurrScreen->buttons[1].u = 4; + pCurrScreen->buttons[1].d = 3; + pCurrScreen->buttons[2].u = 2; + pCurrScreen->buttons[2].d = 4; + pCurrScreen->buttons[3].u = 3; + pCurrScreen->buttons[3].d = 2; + sprintf(pCurrScreen->buttons[1].Name, GET_MISSION_TXT(MissionName[currMission])); + sprintf(pCurrScreen->buttons[2].Name, GET_MISSION_TXT(MissionName[currMission + 1])); + sprintf(pCurrScreen->buttons[3].Name, GET_MISSION_TXT(MissionName[currMission + 2])); + sprintf(pCurrScreen->buttons[4].Name, NullStr); + break; + case 4: + pCurrScreen->buttons[1].u = 5; + pCurrScreen->buttons[1].d = 3; + pCurrScreen->buttons[2].u = 2; + pCurrScreen->buttons[2].d = 4; + pCurrScreen->buttons[3].u = 3; + pCurrScreen->buttons[3].d = 5; + pCurrScreen->buttons[4].u = 4; + pCurrScreen->buttons[4].d = 2; + sprintf(pCurrScreen->buttons[1].Name, GET_MISSION_TXT(MissionName[currMission])); + sprintf(pCurrScreen->buttons[2].Name, GET_MISSION_TXT(MissionName[currMission + 1])); + sprintf(pCurrScreen->buttons[3].Name, GET_MISSION_TXT(MissionName[currMission + 2])); + sprintf(pCurrScreen->buttons[4].Name, GET_MISSION_TXT(MissionName[currMission + 3])); + break; } if (usedB == 4 && @@ -2790,7 +2782,7 @@ int MissionCityScreen(int bSetup) EndFrame(); #endif } - + return 0; } @@ -2916,8 +2908,6 @@ int CutSceneSelectScreen(int bSetup) return 0; } - - // [D] [T] int CutSceneCitySelectScreen(int bSetup) { @@ -2947,7 +2937,7 @@ int CutSceneCitySelectScreen(int bSetup) pCurrScreen->buttons[0].u = 4; pCurrScreen->buttons[3].d = 1; - if (gFurthestMission == 0) + if (gFurthestMission == 0) { pCurrScreen->buttons[0].action = FE_MAKEVAR(BTN_DISABLED, 0); pCurrScreen->buttons[1].action = FE_MAKEVAR(BTN_DISABLED, 0); @@ -2968,14 +2958,14 @@ int CutSceneCitySelectScreen(int bSetup) pCurrScreen->buttons[2].action = FE_MAKEVAR(BTN_DISABLED, 0); pCurrScreen->buttons[3].action = FE_MAKEVAR(BTN_DISABLED, 0); } - else if (gFurthestMission < 31) + else if (gFurthestMission < 31) { pCurrScreen->buttons[0].action = FE_MAKEVAR(BTN_NEXT_SCREEN, 22); pCurrScreen->buttons[1].action = FE_MAKEVAR(BTN_NEXT_SCREEN, 22); pCurrScreen->buttons[2].action = FE_MAKEVAR(BTN_NEXT_SCREEN, 22); pCurrScreen->buttons[3].action = FE_MAKEVAR(BTN_DISABLED, 0); } - else + else { pCurrScreen->buttons[0].action = FE_MAKEVAR(BTN_NEXT_SCREEN, 22); pCurrScreen->buttons[1].action = FE_MAKEVAR(BTN_NEXT_SCREEN, 22); @@ -2996,10 +2986,10 @@ int CutSceneCitySelectScreen(int bSetup) else { bDrawExtra = 1; - - if (currCity == 4) + + if (currCity == 4) LoadImage(&rect, (u_long*)_frontend_buffer); - else + else LoadImage(&rect, (u_long*)(_frontend_buffer + currCity * 0x8000)); DrawSync(0); @@ -3076,8 +3066,6 @@ int CutSceneCitySelectScreen(int bSetup) return 0; } - - // [D] [T] int SetVolumeScreen(int bSetup) { @@ -3089,7 +3077,7 @@ int SetVolumeScreen(int bSetup) static int masterVolumeHold = 0; static int musicVolumeHold = 0; - if (bSetup) + if (bSetup) { currSelIndex = 0; @@ -3152,72 +3140,72 @@ int SetVolumeScreen(int bSetup) { switch (currSelIndex) { - case 0: - gMasterVolume -= 100; + case 0: + gMasterVolume -= 100; - if (gMasterVolume < -10000) - { - gMasterVolume = -10000; - dir = 0; - } - else - { - dir = 1; - } + if (gMasterVolume < -10000) + { + gMasterVolume = -10000; + dir = 0; + } + else + { + dir = 1; + } - last = gMasterVolume; - break; - case 1: - gMusicVolume -= 100; + last = gMasterVolume; + break; + case 1: + gMusicVolume -= 100; - if (gMusicVolume < -10000) - { - gMusicVolume = -10000; - dir = 0; - } - else - { - dir = 1; - } + if (gMusicVolume < -10000) + { + gMusicVolume = -10000; + dir = 0; + } + else + { + dir = 1; + } - last = gMusicVolume; - break; + last = gMusicVolume; + break; } } else if (fePad & MPAD_D_RIGHT) { switch (currSelIndex) { - case 0: - gMasterVolume += 100; + case 0: + gMasterVolume += 100; - if (gMasterVolume > 0) - { - gMasterVolume = 0; - dir = 0; - } - else - { - dir = 1; - } + if (gMasterVolume > 0) + { + gMasterVolume = 0; + dir = 0; + } + else + { + dir = 1; + } - last = gMasterVolume; - break; - case 1: - gMusicVolume += 100; + last = gMasterVolume; + break; + case 1: + gMusicVolume += 100; - if (gMusicVolume > 0) - { - gMusicVolume = 0; - dir = 0; - } - else - { - dir = 1; - } + if (gMusicVolume > 0) + { + gMusicVolume = 0; + dir = 0; + } + else + { + dir = 1; + } - last = gMusicVolume; - break; + last = gMusicVolume; + break; } } @@ -3252,7 +3240,7 @@ int SetVolumeScreen(int bSetup) int GameNum = 0; CVECTOR scoreCol = { 120, 120, 120 }; -CVECTOR otherCol = {125, 115, 34}; +CVECTOR otherCol = { 125, 115, 34 }; // [D] [T] void DisplayScoreTable(void) @@ -3291,22 +3279,22 @@ void DisplayScoreTable(void) else offset = (GameType - 4U) * 8; - if (GameType != GAME_PURSUIT && GameType != GAME_SURVIVAL) + if (GameType != GAME_PURSUIT && GameType != GAME_SURVIVAL) { sprintf(text, "%s", GAMEMODE_AREA_NAME(GameLevel, offset, GameNum)); FEPrintStringSized(text, 420, 206, 3072, 2, otherCol.r, otherCol.g, otherCol.b); } offset = 240; - + for (i = 0; i < 5; i++) { sprintf(text, pSE[i].name); FEPrintString(text, 20, offset, 2, scoreCol.r, scoreCol.g, scoreCol.b); - if (GameType == GAME_GATERACE || GameType == GAME_TRAILBLAZER) + if (GameType == GAME_GATERACE || GameType == GAME_TRAILBLAZER) { - if (pSE[i].items != -1) + if (pSE[i].items != -1) { sprintf(text, "%d", pSE[i].items); FEPrintString(text, 140, offset, 2, scoreCol.r, scoreCol.g, scoreCol.b); @@ -3315,10 +3303,10 @@ void DisplayScoreTable(void) time = pSE[i].time; - if (time != -1) + if (time != -1) { sprintf(text, "%d:%02d.%02d", time / 180000, time / 3000 - (time / 180000) * 60, (time % 3000) / 30); - + FEPrintString(text, 280, offset, 2, scoreCol.r, scoreCol.g, scoreCol.b); } @@ -3326,13 +3314,12 @@ void DisplayScoreTable(void) } } - // [D] [T] int ScoreScreen(int bSetup) { if (bSetup) { - GameLevel = 0; + GameLevel = LEVEL_CHICAGO; DisplayScoreTable(); @@ -3348,8 +3335,8 @@ int ScoreScreen(int bSetup) { if (GameType == GAME_SURVIVAL || GameType == GAME_PURSUIT) { - if (--GameLevel < 0) - GameLevel = 3; + if (--GameLevel < LEVEL_CHICAGO) + GameLevel = LEVEL_RIO; GameNum = 0; } @@ -3359,8 +3346,8 @@ int ScoreScreen(int bSetup) if (GameNum == 1) { - if (--GameLevel < 0) - GameLevel = 3; + if (--GameLevel < LEVEL_CHICAGO) + GameLevel = LEVEL_RIO; } } } @@ -3368,8 +3355,8 @@ int ScoreScreen(int bSetup) { if (GameType == GAME_SURVIVAL || GameType == GAME_PURSUIT) { - if (++GameLevel > 3) - GameLevel = 0; + if (++GameLevel > LEVEL_RIO) + GameLevel = LEVEL_CHICAGO; GameNum = 0; } @@ -3379,8 +3366,8 @@ int ScoreScreen(int bSetup) if (GameNum == 0) { - if (++GameLevel > 3) - GameLevel = 0; + if (++GameLevel > LEVEL_RIO) + GameLevel = LEVEL_CHICAGO; } } } @@ -3416,7 +3403,7 @@ int SubtitlesOnOffScreen(int bSetup) { pCurrButton = pCurrScreen->buttons + 1; } - else + else { pCurrButton = pCurrScreen->buttons; } @@ -3426,7 +3413,6 @@ int SubtitlesOnOffScreen(int bSetup) return 0; } - // [D] [T] int CityCutOffScreen(int bSetup) { @@ -3510,7 +3496,6 @@ int CityCutOffScreen(int bSetup) return 0; } - char* contNames[2] = { "DATA\\CARCONT.RAW", "DATA\\TANCONT.RAW" @@ -3519,7 +3504,7 @@ char* contNames[2] = { // [D] [T] int ControllerScreen(int bSetup) { - if (bSetup ) + if (bSetup ) { iScreenSelect = SCREEN_SCORES; currSelIndex = 0; @@ -3549,13 +3534,13 @@ int ControllerScreen(int bSetup) // [D] [T] int MainScreen(int bSetup) { - if (bSetup) + if (bSetup) { - if (numPadsConnected == 2) + if (numPadsConnected == 2) { pCurrScreen->buttons[3].action = FE_MAKEVAR(BTN_NEXT_SCREEN, 6); } - else + else { pCurrScreen->buttons[3].action = FE_MAKEVAR(BTN_DISABLED, 0); } @@ -3607,16 +3592,16 @@ int CheatScreen(int bSetup) return 0; } - if (gFurthestMission == 40) + if (gFurthestMission == 40) numOpen = 4 + ENABLE_BONUS_CONTENT * 2; // [A] now 5 elements as "Bonus gallery" is open - else + else numOpen = AvailableCheats.cheat1 + AvailableCheats.cheat2 + AvailableCheats.cheat3 + AvailableCheats.cheat4; - + // "Sorry no secrets" if (numOpen == 0) { pCurrScreen->numButtons = 1; - + pCurrScreen->buttons[0].u = 1; pCurrScreen->buttons[0].d = 1; pCurrScreen->buttons[0].action = FE_MAKEVAR(BTN_PREVIOUS_SCREEN, 0); @@ -3652,22 +3637,22 @@ int CheatScreen(int bSetup) } } - if (numOpen == 2) + if (numOpen == 2) { pCurrScreen->buttons[0].action = hackLookup1[cheatOn[0]]; pCurrScreen->buttons[1].action = hackLookup1[cheatOn[1]]; - + pCurrScreen->buttons[0].var = hackLookup2[cheatOn[0]]; pCurrScreen->buttons[1].var = hackLookup2[cheatOn[1]]; - + pCurrScreen->buttons[0].d = 2; pCurrScreen->buttons[0].u = 2; - + pCurrScreen->buttons[1].d = 1; pCurrScreen->buttons[1].u = 1; - + currSelIndex = 0; - + return 0; } @@ -3677,36 +3662,36 @@ int CheatScreen(int bSetup) pCurrScreen->buttons[0].var = hackLookup2[cheatOn[0]]; pCurrScreen->buttons[0].d = 1; pCurrScreen->buttons[0].u = 1; - + currSelIndex = 0; - + return 0; } - if (numOpen == 3) + if (numOpen == 3) { pCurrScreen->buttons[0].action = hackLookup1[cheatOn[0]]; pCurrScreen->buttons[1].action = hackLookup1[cheatOn[1]]; pCurrScreen->buttons[2].action = hackLookup1[cheatOn[2]]; - + pCurrScreen->buttons[0].var = hackLookup2[cheatOn[0]]; pCurrScreen->buttons[1].var = hackLookup2[cheatOn[1]]; pCurrScreen->buttons[2].var = hackLookup2[cheatOn[2]]; - + pCurrScreen->buttons[0].d = 2; pCurrScreen->buttons[0].u = 3; - + pCurrScreen->buttons[1].d = 3; pCurrScreen->buttons[1].u = 1; - + pCurrScreen->buttons[2].d = 1; pCurrScreen->buttons[2].u = 2; - + currSelIndex = 0; return 0; } - if (numOpen >= 4) + if (numOpen >= 4) { pCurrScreen->buttons[0].action = hackLookup1[cheatOn[0]]; pCurrScreen->buttons[1].action = hackLookup1[cheatOn[1]]; @@ -3717,21 +3702,21 @@ int CheatScreen(int bSetup) pCurrScreen->buttons[1].var = hackLookup2[cheatOn[1]]; pCurrScreen->buttons[2].var = hackLookup2[cheatOn[2]]; pCurrScreen->buttons[3].var = hackLookup2[cheatOn[3]]; - + pCurrScreen->buttons[0].d = 2; pCurrScreen->buttons[0].u = 4; - + pCurrScreen->buttons[1].d = 3; pCurrScreen->buttons[1].u = 1; - + pCurrScreen->buttons[2].d = 4; pCurrScreen->buttons[2].u = 2; - + pCurrScreen->buttons[3].d = 1; pCurrScreen->buttons[3].u = 3; // [A] adding bonus gallery - if(numOpen >= 5) + if (numOpen >= 5) { pCurrScreen->buttons[4].action = hackLookup1[cheatOn[4]]; pCurrScreen->buttons[4].var = hackLookup2[cheatOn[4]]; @@ -3740,7 +3725,7 @@ int CheatScreen(int bSetup) pCurrScreen->buttons[0].u = 5; pCurrScreen->buttons[3].d = 5; - + pCurrScreen->buttons[4].d = 1; pCurrScreen->buttons[4].u = 4; } @@ -3770,7 +3755,6 @@ int CheatScreen(int bSetup) return 0; } - // [D] [T] int ImmunityOnOffScreen(int bSetup) { @@ -3791,13 +3775,14 @@ int InvincibleOnOffScreen(int bSetup) { if (bSetup) { - if (gInvincibleCar == 0) + if (gInvincibleCar == 0) pCurrButton = pCurrScreen->buttons + 1; - else + else pCurrButton = pCurrScreen->buttons; return 1; } + return 0; } @@ -3812,6 +3797,7 @@ int MiniCarsOnOffScreen(int bSetup) return 1; } + return 0; } @@ -3831,10 +3817,9 @@ int GameNameScreen(int bSetup) { int offset; - if (bSetup) + if (bSetup) { - - if (GameType == GAME_TAKEADRIVE && NumPlayers == 2) + if (GameType == GAME_TAKEADRIVE && NumPlayers == 2) offset = 48; else if (GameType == GAME_COPSANDROBBERS) offset = 32; @@ -3851,21 +3836,24 @@ int GameNameScreen(int bSetup) return 0; } + // [D] [T] int CheatNumlayerSelect(int bSetup) { - if (bSetup) + if (bSetup) { - if (numPadsConnected == 2) + if (numPadsConnected == 2) { pCurrScreen->buttons[1].action = FE_MAKEVAR(BTN_NEXT_SCREEN, 32); } - else + else { pCurrScreen->buttons[1].action = FE_MAKEVAR(BTN_DISABLED, 0); } + return 0; } + return 0; } @@ -4085,13 +4073,9 @@ int TimeOfDaySelectScreen(int bSetup) dir = 0; if (feNewPad & MPAD_D_LEFT) - { dir = -1; - } else if (feNewPad & MPAD_D_RIGHT) - { dir = 1; - } if (dir != 0) { @@ -4102,7 +4086,7 @@ int TimeOfDaySelectScreen(int bSetup) wantedTimeOfDay += dir; wantedTimeOfDay &= 3; - gWantNight = wantedTimeOfDay == TIME_DUSK || wantedTimeOfDay == TIME_NIGHT; + gWantNight = (wantedTimeOfDay == TIME_DUSK || wantedTimeOfDay == TIME_NIGHT); } else if (i == 1) { @@ -4123,25 +4107,25 @@ int DemoScreen(int bSetup) { if (bSetup) return 0; - + if (feNewPad & MPAD_CROSS) { pScreenStack[ScreenDepth] = pCurrScreen; pButtonStack[ScreenDepth] = pCurrButton; - + FESound(2); + GameType = GAME_PURSUIT; - - GameLevel = 1; + GameLevel = LEVEL_HAVANA; gWantNight = 0; gSubGameNumber = 0; - + SetState(STATE_GAMESTART); - + return 0; } - if(mainScreenLoaded) + if (mainScreenLoaded) { if (feNewPad & MPAD_CIRCLE) { @@ -4149,11 +4133,11 @@ int DemoScreen(int bSetup) FESound(2); } } - else if(bQuitToSystem) + else if (bQuitToSystem) { bQuitToSystem = 0; LoadBackgroundFile("DATA\\GFX.RAW"); } return 0; -} \ No newline at end of file +} diff --git a/src_rebuild/Game/Frontend/FEmain.h b/src_rebuild/Game/Frontend/FEmain.h index d876e7feb..c0fd54a4c 100644 --- a/src_rebuild/Game/Frontend/FEmain.h +++ b/src_rebuild/Game/Frontend/FEmain.h @@ -13,4 +13,4 @@ extern void SetFEDrawMode(); extern void LoadFrontendScreens(int full); extern void ReInitScreens(int returnToMain); -#endif +#endif // FEMAIN_H diff --git a/src_rebuild/Game/dr2limits.h b/src_rebuild/Game/dr2limits.h index c0361c401..fdc067e32 100644 --- a/src_rebuild/Game/dr2limits.h +++ b/src_rebuild/Game/dr2limits.h @@ -1,10 +1,9 @@ -#ifndef DRLIMITS_H -#define DRLIMITS_H +#ifndef DR2LIMITS_H +#define DR2LIMITS_H // DRIVER 2 game engine limits // please populate this file only with engine limits during refactoring - #ifndef PSX #define DYNAMIC_LIGHTING #define MAX_DLIGHTS 32 @@ -83,5 +82,4 @@ #define MAX_SIREN_NOISES 2 #define MAX_CAR_NOISES 4 - -#endif // DRLIMITS_H \ No newline at end of file +#endif // DR2LIMITS_H diff --git a/src_rebuild/Game/dr2locale.c b/src_rebuild/Game/dr2locale.c index 61f8d98ae..7d98f0bda 100644 --- a/src_rebuild/Game/dr2locale.c +++ b/src_rebuild/Game/dr2locale.c @@ -38,13 +38,13 @@ int InitStringMng() sprintf(filename, "%sLANG\\%s_GAME.LTXT", gDataFolder, LanguageNames[gUserLanguage]); FS_FixPathSlashes(filename); - if(InitStringLanguage(filename, 0) == -1) + if (InitStringLanguage(filename, 0) == -1) return 0; - + sprintf(filename, "%sLANG\\%s_MISSION.LTXT", gDataFolder, LanguageNames[gUserLanguage]); FS_FixPathSlashes(filename); - - if(InitStringLanguage(filename, 1) == -1) + + if (InitStringLanguage(filename, 1) == -1) return 0; #ifdef DEBUG_OPTIONS @@ -55,7 +55,7 @@ int InitStringMng() char* file; file = (char*)_frontend_buffer; - + Loadfile("GFX\\FONT2.FNT", file); nchars = *(int *)file; @@ -124,7 +124,7 @@ int InitStringLanguage(char *filename, int mission) unsigned char *ln; int i; int size; - + FILE* fp = fopen(filename, "rb"); if (!fp) { @@ -139,7 +139,7 @@ int InitStringLanguage(char *filename, int mission) buffer = (unsigned char*)malloc(size); fread(buffer, 1, size, fp); fclose(fp); - + if (mission) gMisssionLanguageBuffer = (char*)buffer; else @@ -147,7 +147,7 @@ int InitStringLanguage(char *filename, int mission) cptr = buffer; for (i = 0; i < MAX_LANGUAGE_TEXT; i++) - { + { if (size <= 0) { if (mission) @@ -168,24 +168,24 @@ int InitStringLanguage(char *filename, int mission) { if (*cptr == '\n' || *cptr == '\r') { - while(*cptr == '\r') + while (*cptr == '\r') { *cptr++; size--; } - + break; } - + if (*cptr >= 32) ln = cptr + 1; - + size--; cptr++; } while (size > 1); - + *ln = 0; // zero on end of the line - + cptr++; size--; } @@ -193,4 +193,5 @@ int InitStringLanguage(char *filename, int mission) return i; } -#endif \ No newline at end of file + +#endif diff --git a/src_rebuild/Game/dr2locale.h b/src_rebuild/Game/dr2locale.h index 1e1449a7b..9d68d4aff 100644 --- a/src_rebuild/Game/dr2locale.h +++ b/src_rebuild/Game/dr2locale.h @@ -10,16 +10,16 @@ enum GameStrId GTXT_Proximity, GTXT_Best, - + GTXT_Cone, GTXT_Gate, GTXT_Check, - + GTXT_Cones, GTXT_Gates, GTXT_Checks, GTXT_Minus1second, - + GTXT_Flags, GTXT_Lap, GTXT_YouGotTheFlag, @@ -39,7 +39,7 @@ enum GameStrId GTXT_NoDISCinserted, GTXT_IncorrectDISCinserted, GTXT_Checking, - + GTXT_AreYouSure, GTXT_Paused, GTXT_MissionSuccessful, @@ -290,4 +290,4 @@ extern int InitStringLanguage(char* filename, int mission); #endif -#endif \ No newline at end of file +#endif // DR2LOCALE_H diff --git a/src_rebuild/Game/dr2math.h b/src_rebuild/Game/dr2math.h index e2418a7a4..74a5c9704 100644 --- a/src_rebuild/Game/dr2math.h +++ b/src_rebuild/Game/dr2math.h @@ -163,4 +163,4 @@ inline int fst_abs(int x) return (x ^ mask) - mask; } -#endif // DR2MATH_H \ No newline at end of file +#endif // DR2MATH_H diff --git a/src_rebuild/Game/dr2types.h b/src_rebuild/Game/dr2types.h index 390def56a..6b6ad1ad4 100644 --- a/src_rebuild/Game/dr2types.h +++ b/src_rebuild/Game/dr2types.h @@ -370,7 +370,7 @@ typedef struct _APPEARANCE_DATA char coplife; short qy; short qw; - char life2; + CVECTOR life2; // [A] now allows ARGB for back lights reflection at night char model; char palette; @@ -746,7 +746,7 @@ typedef struct _TARGET } chasing; }; } car; - + struct { int eventId; // data 3 @@ -788,7 +788,7 @@ enum TimerFlags TIMER_FLAG_ACTIVE = 0x1, TIMER_FLAG_COUNTER = 0x2, TIMER_FLAG_PAUSED = 0x4, - + TIMER_FLAG_COMPLETE_ON_OUT = 0x8, TIMER_FLAG_BOMB_COUNTDOWN = 0x10, TIMER_FLAG_BOMB_TRIGGERED = 0x20, @@ -1320,19 +1320,27 @@ enum GAMEMODE //--------------------------------------------------- +enum GAMELEVEL +{ + LEVEL_CHICAGO = 0, + LEVEL_HAVANA = 1, + LEVEL_VEGAS = 2, + LEVEL_RIO = 3, +}; + enum TIMEOFDAY { TIME_DAWN = 0, TIME_DAY = 1, TIME_DUSK = 2, - TIME_NIGHT = 3 + TIME_NIGHT = 3, }; enum WEATHER { WEATHER_NONE = 0, WEATHER_RAIN = 1, - WEATHER_WET = 2 + WEATHER_WET = 2, }; -#endif // DR2TYPES_H \ No newline at end of file +#endif // DR2TYPES_H diff --git a/src_rebuild/Game/driver2.h b/src_rebuild/Game/driver2.h index e9fc5ce6f..875a295f7 100644 --- a/src_rebuild/Game/driver2.h +++ b/src_rebuild/Game/driver2.h @@ -68,7 +68,7 @@ #endif // PSX -#define D_CHECK_ERROR(expr, message) if(expr){ printError("%s - %s\n", FUNCNAME, message); while (FrameCnt != 0x78654321) trap(0x400); } +#define D_CHECK_ERROR(expr, message) if (expr){ printError("%s - %s\n", FUNCNAME, message); while (FrameCnt != 0x78654321) trap(0x400); } #include "reversing.h" diff --git a/src_rebuild/Game/platform.h b/src_rebuild/Game/platform.h index 564c460d9..eca8c83b2 100644 --- a/src_rebuild/Game/platform.h +++ b/src_rebuild/Game/platform.h @@ -16,4 +16,4 @@ #define _stricmp(s1, s2) strcasecmp(s1, s2) #endif -#endif // PLATFORM_H \ No newline at end of file +#endif // PLATFORM_H diff --git a/src_rebuild/Game/psyx_compat.h b/src_rebuild/Game/psyx_compat.h index d444706c5..ce39f5f7e 100644 --- a/src_rebuild/Game/psyx_compat.h +++ b/src_rebuild/Game/psyx_compat.h @@ -39,4 +39,4 @@ typedef uintptr_t u_intptr; #endif -#endif // PSYX_COMPAT_H \ No newline at end of file +#endif // PSYX_COMPAT_H diff --git a/src_rebuild/Game/reversing.h b/src_rebuild/Game/reversing.h index 09ed9489a..2a70ed57c 100644 --- a/src_rebuild/Game/reversing.h +++ b/src_rebuild/Game/reversing.h @@ -73,12 +73,11 @@ template struct compile_time_assert_test {}; #endif #if defined(_DEBUG) -#define UNIMPLEMENTED() { static bool _stop = false; if(!_stop) printMsg("[GAME] %s - unimplemented!\n", FUNCNAME); _stop = true; } +#define UNIMPLEMENTED() { static bool _stop = false; if (!_stop) printMsg("[GAME] %s - unimplemented!\n", FUNCNAME); _stop = true; } #else #define UNIMPLEMENTED() #endif //---------------------------------------- - -#endif // REVERSTING_H \ No newline at end of file +#endif // REVERSING_H diff --git a/src_rebuild/platform/Emscripten/shell.html b/src_rebuild/platform/Emscripten/shell.html index 0716477a5..e287926d6 100644 --- a/src_rebuild/platform/Emscripten/shell.html +++ b/src_rebuild/platform/Emscripten/shell.html @@ -3,7 +3,7 @@ - REDRIVER 2 WebAssembly build + REDRIVER2 WebAssembly build @@ -25,19 +25,19 @@ } /* the canvas *must not* have any border or padding, or mouse coords will be wrong */ canvas.emscripten { - border: 0px none; + border: 0 none; background-color: black; } .spinner { height: 50px; width: 50px; - margin: 0px auto; + margin: 0 auto; -webkit-animation: rotation .8s linear infinite; -moz-animation: rotation .8s linear infinite; -o-animation: rotation .8s linear infinite; animation: rotation 0.8s linear infinite; - background-color: rgb(200,100,250); + background-color: rgb(200, 100, 250); } @-webkit-keyframes rotation { @@ -131,12 +131,12 @@ })(), canvas: (() => { var canvas = document.getElementById('canvas'); - + // As a default initial behavior, pop up an alert when webgl context is lost. To make your // application robust, you may want to override this behavior before shipping! // See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2 canvas.addEventListener("webglcontextlost", (e) => { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false); - + return canvas; })(), setStatus: (text) => { @@ -172,7 +172,7 @@ // for save config/data () => { ENV.HOME = "/userstorage"; - + // create LSFS and mount 'data' local storage item into '/data' directory FS.mkdir('/userstorage'); // for old versions use: FS.createFolder(FS.root, 'data', true, true); FS.mount(LSFS(), { key: 'userstorage' }, '/userstorage'); @@ -195,29 +195,29 @@ var data = Module._malloc(size); Module.writeArrayToMemory(new Uint8Array(reader.result), data); Module.ccall('WebLoadCDImage', 'null', ['number', 'number'], [data, size]); - + callMain(); - + var element = document.getElementById('startup_panel'); - element.style.display = "none"; - + element.style.display = "none"; + var canvas = document.getElementById('canvas'); canvas.style.display = null; }; reader.readAsArrayBuffer(event.target.files[0]); } - + function runDemo() { callMain(["-ini", "demo_config.ini"]); - + var element = document.getElementById('startup_panel'); - element.style.display = "none"; - + element.style.display = "none"; + var canvas = document.getElementById('canvas'); canvas.style.display = null; } - + {{{ SCRIPT }}} \ No newline at end of file diff --git a/src_rebuild/redriver2_psxpc.cpp b/src_rebuild/redriver2_psxpc.cpp index bb0f5ca78..a0cca629d 100644 --- a/src_rebuild/redriver2_psxpc.cpp +++ b/src_rebuild/redriver2_psxpc.cpp @@ -1,5 +1,4 @@ // redriver2_psxpc.cpp -// #include @@ -20,6 +19,7 @@ #include "C/players.h" #include "C/time.h" #include "C/draw.h" +#include "C/cosmetic.h" #include "utils/ini.h" @@ -29,7 +29,6 @@ #include "PsyX/PsyX_globals.h" - int(*GPU_printf)(const char *fmt, ...); bool CtrlModifier; @@ -40,15 +39,15 @@ void CheckModifierKeys(int nKey, bool down) { switch (nKey) { - case SDL_SCANCODE_LCTRL: - CtrlModifier = down; - break; - case SDL_SCANCODE_LSHIFT: - ShiftModifier = down; - break; - case SDL_SCANCODE_LALT: - AltModifier = down; - break; + case SDL_SCANCODE_LCTRL: + CtrlModifier = down; + break; + case SDL_SCANCODE_LSHIFT: + ShiftModifier = down; + break; + case SDL_SCANCODE_LALT: + AltModifier = down; + break; } } @@ -117,7 +116,7 @@ void FreeCameraKeyboardHandler(int nKey, char down) } } - if(!down) + if (!down) return; if (nKey == SDL_SCANCODE_F7) @@ -334,7 +333,7 @@ OTTYPE g_OT2[OTSIZE]; // 0xF7200 char g_PrimTab1[PRIMTAB_SIZE]; // 0xFB400 char g_PrimTab2[PRIMTAB_SIZE]; // 0x119400 char g_SBank_buffer[0x50000]; // 0x180000 -char g_Replay_buffer[0x50000]; // 0x1fABBC +char g_Replay_buffer[0x50000]; // 0x1FABBC #endif void ParseKeyboardMappings(ini_t* config, char* section, PsyXKeyboardMapping& outMapping) @@ -468,7 +467,7 @@ PsyXControllerMapping g_gcMenuMappings = { 0x654 }; void SwitchMappings(int menu) { - if(menu) + if (menu) { g_cfg_keyboardMapping = g_kbMenuMappings; g_cfg_controllerMapping = g_gcMenuMappings; @@ -494,8 +493,8 @@ int main(int argc, char** argv) _primTab1 = (char*)malloc(PRIMTAB_SIZE); // 0xFB400 _primTab2 = (char*)malloc(PRIMTAB_SIZE); // 0x119400 _sbank_buffer = (char*)malloc(0x80000); // 0x180000 - _replay_buffer = (char*)malloc(0x50000); // 0x1fabbc - + _replay_buffer = (char*)malloc(0x50000); // 0x1FABBC + #else _overlay_buffer = g_Overlay_buffer; // 0x1C0000 _frontend_buffer = g_Frontend_buffer; // 0xFB400 @@ -506,14 +505,14 @@ int main(int argc, char** argv) _primTab1 = g_PrimTab1; // 0xFB400 _primTab2 = g_PrimTab2; // 0x119400 _sbank_buffer = g_SBank_buffer; // 0x180000 - _replay_buffer = g_Replay_buffer; // 0x1fABBC + _replay_buffer = g_Replay_buffer; // 0x1FABBC #endif #if defined(DEBUG_OPTIONS) || defined(_DEBUG) GPU_printf = printf; #endif // _DEBUG - + #if 0 // defined(__EMSCRIPTEN__) // mount the current folder as a NODEFS instance // inside of emscripten @@ -533,7 +532,7 @@ int main(int argc, char** argv) i++; configFilename = argv[i]; } - else if(!strcmp(argv[i], "-cdimage")) + else if (!strcmp(argv[i], "-cdimage")) { i++; cdImageFileName = argv[i]; @@ -562,9 +561,9 @@ int main(int argc, char** argv) int newScrZ = gCameraDefaultScrZ; const char* dataFolderStr = ini_get(config, "fs", "dataFolder"); - if(!cdImageFileName) + if (!cdImageFileName) cdImageFileName = ini_get(config, "cdfs", "image"); - + // configure Psy-X pads ini_sget(config, "pad", "pad1device", "%d", &g_cfg_controllerToSlotMapping[0]); ini_sget(config, "pad", "pad2device", "%d", &g_cfg_controllerToSlotMapping[1]); @@ -589,14 +588,15 @@ int main(int argc, char** argv) ini_sget(config, "game", "fieldOfView", "%d", &newScrZ); ini_sget(config, "game", "freeCamera", "%d", &enableFreecamera); ini_sget(config, "game", "driver1music", "%d", &gDriver1Music); + ini_sget(config, "game", "amberTurnSignals", "%d", &gAmberTurnSignals); ini_sget(config, "game", "widescreenOverlays", "%d", &gWidescreenOverlayAlign); ini_sget(config, "game", "fastLoadingScreens", "%d", &gFastLoadingScreens); ini_sget(config, "game", "languageId", "%d", &gUserLanguage); ini_sget(config, "game", "overrideContent", "%d", &gContentOverride); - - + + gCameraDefaultScrZ = MAX(MIN(newScrZ, 384), 128); - + if (dataFolderStr) { strcpy(gDataFolder, dataFolderStr); @@ -650,7 +650,7 @@ int main(int argc, char** argv) // configure Psy-X CD image reader if (cdImageFileName) PsyX_CDFS_Init(cdImageFileName, 0, 0); - + if (config) { ParseKeyboardMappings(config, "kbcontrols_game", g_kbGameMappings); @@ -658,7 +658,7 @@ int main(int argc, char** argv) ParseControllerMappings(config, "controls_game", g_gcGameMappings); ParseControllerMappings(config, "controls_menu", g_gcMenuMappings); - + ini_free(config); } diff --git a/src_rebuild/tools/font_tool/font_tool_main.cpp b/src_rebuild/tools/font_tool/font_tool_main.cpp index 407d29161..cec748550 100644 --- a/src_rebuild/tools/font_tool/font_tool_main.cpp +++ b/src_rebuild/tools/font_tool/font_tool_main.cpp @@ -153,4 +153,4 @@ int main(int argc, char** argv) free(bitmapRGBA); free(tmpBitmap); free(data); -} \ No newline at end of file +} diff --git a/src_rebuild/utils/DebugOverlay.cpp b/src_rebuild/utils/DebugOverlay.cpp index a8b67c53d..4d5a383f4 100644 --- a/src_rebuild/utils/DebugOverlay.cpp +++ b/src_rebuild/utils/DebugOverlay.cpp @@ -30,7 +30,7 @@ void DrawDebugOverlays() { VECTOR _zerov = { 0 }; - while(gDebug_numLines > 0) + while (gDebug_numLines > 0) { LineDef_t& ld = gDebug_Lines[gDebug_numLines-1]; @@ -45,7 +45,7 @@ void DrawDebugOverlays() gte_rtpt(); gte_avsz4(); - + int z; gte_stopz(&z); @@ -66,8 +66,10 @@ void DrawDebugOverlays() current->primptr += sizeof(LINE_F2); } + gDebug_numLines--; } + gDebug_numLines = 0; DR_TPAGE* tp = (DR_TPAGE*)current->primptr; @@ -82,7 +84,7 @@ void DrawDebugOverlays() if (gDisplayDrawStats) { SetTextColour(128, 120, 0); - + sprintf(tempBuf, "Primtab: %d of %d", primTabLeft, PRIMTAB_SIZE); PrintString(tempBuf, 10, 20); @@ -111,20 +113,18 @@ void DrawDebugOverlays() PrintString(tempBuf, 10, 60); int playerCar = player[0].playerCarId; - if(playerCar >= 0) + if (playerCar >= 0) { - int speed = car_data[playerCar].hd.speed; sprintf(tempBuf, "Car speed: %d direction: %d", speed, car_data[playerCar].hd.direction); PrintString(tempBuf, 10, 80); VECTOR* carPos = (VECTOR*)car_data[playerCar].hd.where.t; - + DRIVER2_ROAD_INFO roadInfo; roadInfo.surfId = GetSurfaceIndex(carPos); - if (GetSurfaceRoadInfo(&roadInfo, roadInfo.surfId)) { int dx, dz; @@ -135,7 +135,7 @@ void DrawDebugOverlays() { dx = carPos->vx - roadInfo.straight->Midx; dz = carPos->vz - roadInfo.straight->Midz; - + segLen = roadInfo.straight->length; theta = roadInfo.straight->angle - ratan2(dx, dz); distAlongSegment = (segLen / 2) + FIXEDH(RCOS(theta) * SquareRoot0(dx * dx + dz * dz)); @@ -144,7 +144,7 @@ void DrawDebugOverlays() { dx = carPos->vx - roadInfo.curve->Midx; dz = carPos->vz - roadInfo.curve->Midz; - + theta = ratan2(dx,dz); segLen = (roadInfo.curve->end - roadInfo.curve->start & 0xfffU); // *roadInfo.curve->inside * 11 / 7; // don't use physical length @@ -155,7 +155,7 @@ void DrawDebugOverlays() else distAlongSegment = (theta & 0xfffU) - roadInfo.curve->start & 0xfe0; } - + int lane = GetLaneByPositionOnRoad(&roadInfo, carPos); sprintf(tempBuf, "%s %d PRK(%d-%d) SPD(%d) LEN(%d)", @@ -184,14 +184,14 @@ void DrawDebugOverlays() PrintString(tempBuf, 10, 205); } - else if(IS_JUNCTION_SURFACE(roadInfo.surfId)) + else if (IS_JUNCTION_SURFACE(roadInfo.surfId)) { DRIVER2_JUNCTION* junc = GET_JUNCTION(roadInfo.surfId); - + sprintf(tempBuf, "JUN %d TL(%d) YLD(%d)", - roadInfo.surfId, + roadInfo.surfId, (junc->flags & 1), (junc->flags & 2)); - + PrintString(tempBuf, 10, 180); sprintf(tempBuf, "c %d %d %d %d", @@ -199,10 +199,7 @@ void DrawDebugOverlays() PrintString(tempBuf, 10, 205); } - - } - } } @@ -233,7 +230,7 @@ void Debug_Line2D(SXYPAIR& pointA, SXYPAIR& pointB, CVECTOR& color) line->x0 = pointA.x; line->y0 = pointA.y; - + line->x1 = pointB.x; line->y1 = pointB.y; @@ -342,6 +339,4 @@ void DoFreeCamera() g_FreeCameraVelocity.vy += (inv_camera_matrix.m[0][1] * 32) * sign; g_FreeCameraVelocity.vz += (inv_camera_matrix.m[0][2] * 32) * sign; } - - -} \ No newline at end of file +} diff --git a/src_rebuild/utils/audio_source/snd_al_source.h b/src_rebuild/utils/audio_source/snd_al_source.h index 9ba2e1ba0..ebdf33950 100644 --- a/src_rebuild/utils/audio_source/snd_al_source.h +++ b/src_rebuild/utils/audio_source/snd_al_source.h @@ -32,4 +32,4 @@ class CSoundSource_OpenALCache : public ISoundSource virtual void Unload(); }; -#endif // SND_AL_SOURCE_H \ No newline at end of file +#endif // SND_AL_SOURCE_H diff --git a/src_rebuild/utils/audio_source/snd_source.h b/src_rebuild/utils/audio_source/snd_source.h index 5b3883e4e..47ee07309 100644 --- a/src_rebuild/utils/audio_source/snd_source.h +++ b/src_rebuild/utils/audio_source/snd_source.h @@ -28,4 +28,4 @@ class ISoundSource virtual void Unload () = 0; }; -#endif // SND_SOURCE_H \ No newline at end of file +#endif // SND_SOURCE_H diff --git a/src_rebuild/utils/audio_source/snd_wav_cache.cpp b/src_rebuild/utils/audio_source/snd_wav_cache.cpp index 0f36aaaf1..06437f019 100644 --- a/src_rebuild/utils/audio_source/snd_wav_cache.cpp +++ b/src_rebuild/utils/audio_source/snd_wav_cache.cpp @@ -4,11 +4,11 @@ bool CSoundSource_WaveCache::Load(const char* szFilename) { - CRIFF_Parser reader( szFilename ); + CRIFF_Parser reader(szFilename); - while ( reader.GetName( ) ) + while (reader.GetName()) { - ParseChunk( reader ); + ParseChunk(reader); reader.ChunkNext(); } @@ -29,23 +29,23 @@ void CSoundSource_WaveCache::ParseData(CRIFF_Parser &chunk) { int sample; - m_dataCache = (u_char *)malloc( chunk.GetSize( ) ); - m_cacheSize = chunk.GetSize( ); + m_dataCache = (u_char *)malloc(chunk.GetSize()); + m_cacheSize = chunk.GetSize(); m_numSamples = m_cacheSize / (m_format.channels * m_format.bitwidth / 8); // // read // - chunk.ReadChunk( m_dataCache ); + chunk.ReadChunk(m_dataCache); /* // // convert // - for ( int i = 0; i < m_numSamples; i++ ) + for (int i = 0; i < m_numSamples; i++) { - if ( m_format.bitwidth == 16 ) + if (m_format.bitwidth == 16) { sample = ((short *)m_dataCache)[i]; ((short *)m_dataCache)[i] = sample; @@ -73,36 +73,36 @@ int CSoundSource_WaveCache::GetSamples(u_char *pOutput, int nSamples, int nOffse int size = /*bLooping && */m_loopEnd ? m_loopEnd : m_cacheSize; - if ( nStart + nBytes > size) + if (nStart + nBytes > size) nBytes = size - nStart; - memcpy( (void *)pOutput, (void *)(m_dataCache+nStart), nBytes ); + memcpy((void *)pOutput, (void *)(m_dataCache + nStart), nBytes); nRemaining -= nBytes; nCompleted += nBytes; // if we still have remaining data to fill stream for loop, but stream is at EOF, read it again - while ( nRemaining && bLooping ) + while (nRemaining && bLooping) { nBytes = nRemaining; - if ( m_loopStart > 0 ) + if (m_loopStart > 0) { int loopBytes = m_loopStart * nSampleSize; - if ( loopBytes + nBytes > size) + if (loopBytes + nBytes > size) nBytes = size - loopBytes; - memcpy( (void *)(pOutput+nCompleted), (void *)(m_dataCache+loopBytes), nBytes ); + memcpy((void *)(pOutput + nCompleted), (void *)(m_dataCache + loopBytes), nBytes); nRemaining -= nBytes; nCompleted += nBytes; } else { - if ( nBytes > size) + if (nBytes > size) nBytes = size; - memcpy( (void *)(pOutput+nCompleted), (void *)m_dataCache, nBytes ); + memcpy((void *)(pOutput + nCompleted), (void *)m_dataCache, nBytes); nRemaining -= nBytes; nCompleted += nBytes; } diff --git a/src_rebuild/utils/audio_source/snd_wav_cache.h b/src_rebuild/utils/audio_source/snd_wav_cache.h index aa7190cca..70215cc0a 100644 --- a/src_rebuild/utils/audio_source/snd_wav_cache.h +++ b/src_rebuild/utils/audio_source/snd_wav_cache.h @@ -22,4 +22,4 @@ class CSoundSource_WaveCache : public CSoundSource_Wave int m_cacheSize; // in bytes }; -#endif // SND_WAV_CACHE_H \ No newline at end of file +#endif // SND_WAV_CACHE_H diff --git a/src_rebuild/utils/audio_source/snd_wav_source.cpp b/src_rebuild/utils/audio_source/snd_wav_source.cpp index 7bc83c9c3..b82aa6b11 100644 --- a/src_rebuild/utils/audio_source/snd_wav_source.cpp +++ b/src_rebuild/utils/audio_source/snd_wav_source.cpp @@ -13,11 +13,10 @@ CSoundSource_Wave::CSoundSource_Wave() : m_loopStart(0), m_loopEnd(0), m_numSamp CSoundSource_Wave::~CSoundSource_Wave() { - for(int i = 0; i < m_numSubtitles; i++) + for (int i = 0; i < m_numSubtitles; i++) { free(m_subtitles[i].text); } - } void CSoundSource_Wave::ParseChunk(CRIFF_Parser &chunk) @@ -32,22 +31,22 @@ void CSoundSource_Wave::ParseChunk(CRIFF_Parser &chunk) //printf("chunk ID %s\n", namestr); - switch ( chunk.GetName() ) + switch (chunk.GetName()) { case CHUNK_FMT: - ParseFormat( chunk ); + ParseFormat(chunk); break; case CHUNK_CUE: - ParseCue( chunk ); + ParseCue(chunk); break; case CHUNK_LIST: - ParseList( chunk ); + ParseList(chunk); break; case CHUNK_DATA: - ParseData( chunk ); + ParseData(chunk); break; case CHUNK_SAMPLE: - ParseSample( chunk ); + ParseSample(chunk); default: break; } @@ -56,7 +55,7 @@ void CSoundSource_Wave::ParseChunk(CRIFF_Parser &chunk) void CSoundSource_Wave::ParseFormat(CRIFF_Parser &chunk) { wavfmthdr_t wfx; - chunk.ReadChunk( (u_char*)&wfx, sizeof(wavfmthdr_t) ); + chunk.ReadChunk((u_char*)&wfx, sizeof(wavfmthdr_t)); m_format.format = wfx.Format; m_format.channels = wfx.Channels; @@ -70,11 +69,11 @@ void CSoundSource_Wave::ParseCue(CRIFF_Parser &chunk) chunk.ReadChunk(&count, sizeof(int)); // now read all CUEs - for(int i = 0; i < count; i++) + for (int i = 0; i < count; i++) { wavcuehdr_t cue; - chunk.ReadChunk( (u_char *)&cue, sizeof(wavcuehdr_t) ); + chunk.ReadChunk((u_char *)&cue, sizeof(wavcuehdr_t)); m_loopStart = cue.SampleOffset; //printf("CUE %d time: %d ms (%d)\n", i+1, sampleTimeMilliseconds, cue.SampleOffset); @@ -104,12 +103,12 @@ void CSoundSource_Wave::ParseList(CRIFF_Parser &chunk) { int adtl; chunk.ReadChunk(&adtl, sizeof(int)); - - if(adtl == CHUNK_ADTLLIST) + + if (adtl == CHUNK_ADTLLIST) { int remainingSize = chunk.GetSize() -4; - while(remainingSize > 0) + while (remainingSize > 0) { RIFFchunk_t listChunk; @@ -122,7 +121,7 @@ void CSoundSource_Wave::ParseList(CRIFF_Parser &chunk) memcpy(namestr, name, 4); namestr[4] = 0; - if(listChunk.Id == CHUNK_LTXT) + if (listChunk.Id == CHUNK_LTXT) { wavltxthdr_t ltxt; int read = chunk.ReadChunk(<xt, sizeof(wavltxthdr_t)); @@ -130,23 +129,21 @@ void CSoundSource_Wave::ParseList(CRIFF_Parser &chunk) m_subtitles[ltxt.CueId-1].sampleLength = float(ltxt.SampleLen) / float(m_format.frequency) * 1000.0f; } - else if(listChunk.Id == CHUNK_LABEL) + else if (listChunk.Id == CHUNK_LABEL) { char labelString[128]; - + int cueId; int stringSize = listChunk.Size - 4 + (listChunk.Size & 1); - int read = chunk.ReadChunk( &cueId, sizeof(int) ); + int read = chunk.ReadChunk(&cueId, sizeof(int)); remainingSize -= read; m_subtitles[cueId - 1].text = (char*)malloc(stringSize); - - read = chunk.ReadChunk( m_subtitles[cueId - 1].text, stringSize ); + + read = chunk.ReadChunk(m_subtitles[cueId - 1].text, stringSize); remainingSize -= read; - - //printf("Label cue = %d, size: %d, '%s'\n", cueId, stringSize, labelString); } } @@ -167,7 +164,7 @@ void CSoundSource_Wave::ParseSample(CRIFF_Parser &chunk) float CSoundSource_Wave::GetLoopPosition(float flPosition) { - while ( flPosition > m_numSamples ) + while (flPosition > m_numSamples) flPosition -= m_numSamples; return flPosition; diff --git a/src_rebuild/utils/audio_source/snd_wav_source.h b/src_rebuild/utils/audio_source/snd_wav_source.h index c6e00e048..fc662e110 100644 --- a/src_rebuild/utils/audio_source/snd_wav_source.h +++ b/src_rebuild/utils/audio_source/snd_wav_source.h @@ -24,7 +24,7 @@ class CSoundSource_Wave : public ISoundSource virtual soundFormat_t* GetFormat() { return &m_format; } virtual float GetLoopPosition(float flPosition); virtual int GetSampleCount() const { return m_numSamples; } - + CUESubtitle_t m_subtitles[128]; int m_numSubtitles; diff --git a/src_rebuild/utils/fs.cpp b/src_rebuild/utils/fs.cpp index a02048b1c..2e367ee74 100644 --- a/src_rebuild/utils/fs.cpp +++ b/src_rebuild/utils/fs.cpp @@ -56,8 +56,8 @@ char* strreplace(char** str, char* dst, char* replace) char* start, * tmp; int n; - if ((start = strstr(*str, dst)) == 0) - return(0); + if ((start = strstr(*str, dst)) == 0) + return (0); n = (start - *str) + strlen(start + strlen(dst)) + strlen(replace) + 1; @@ -148,7 +148,7 @@ void FS_FindClose(FS_FINDDATA* findData) return; #ifdef _WIN32 - if(findData->fileHandle = INVALID_HANDLE_VALUE) + if (findData->fileHandle = INVALID_HANDLE_VALUE) FindClose(findData->fileHandle); #else if (findData->index >= 0) @@ -174,4 +174,4 @@ bool FS_FindIsDirectory(FS_FINDDATA* findData) return false; #endif // _WIN32 -} \ No newline at end of file +} diff --git a/src_rebuild/utils/fs.h b/src_rebuild/utils/fs.h index c06fdacb6..b0919145d 100644 --- a/src_rebuild/utils/fs.h +++ b/src_rebuild/utils/fs.h @@ -21,4 +21,4 @@ const char* FS_FindNext(FS_FINDDATA* findData); void FS_FindClose(FS_FINDDATA* findData); bool FS_FindIsDirectory(FS_FINDDATA* findData); -#endif \ No newline at end of file +#endif // FS_H diff --git a/src_rebuild/utils/hqfont.h b/src_rebuild/utils/hqfont.h index 0c1250964..6803aaba6 100644 --- a/src_rebuild/utils/hqfont.h +++ b/src_rebuild/utils/hqfont.h @@ -24,4 +24,4 @@ struct OUT_FN2HEADER u_short range_count; }; -#endif // HQFONT_H \ No newline at end of file +#endif // HQFONT_H diff --git a/src_rebuild/utils/ini.h b/src_rebuild/utils/ini.h index 10ee15974..cead1eb5a 100644 --- a/src_rebuild/utils/ini.h +++ b/src_rebuild/utils/ini.h @@ -25,4 +25,4 @@ int ini_sget(ini_t *ini, const char *section, const char *key, const cha } #endif -#endif +#endif // INI_H diff --git a/src_rebuild/utils/riff.cpp b/src_rebuild/utils/riff.cpp index 78bd68f27..dfd5bace6 100644 --- a/src_rebuild/utils/riff.cpp +++ b/src_rebuild/utils/riff.cpp @@ -6,10 +6,10 @@ CRIFF_Parser::CRIFF_Parser(const char* szFilename) { m_pos = 0; - m_riff = fopen(szFilename, "rb" ); + m_riff = fopen(szFilename, "rb"); m_riffData = NULL; - if ( !m_riff ) + if (!m_riff) { m_curChunk.Id = 0; m_curChunk.Size = 0; @@ -19,7 +19,7 @@ CRIFF_Parser::CRIFF_Parser(const char* szFilename) RIFFhdr_t header; ReadData(&header, sizeof(header)); - if ( header.Id != RIFF_ID ) + if (header.Id != RIFF_ID) { printError("LoadRIFF: '%s' not valid RIFF file\n", szFilename); @@ -29,7 +29,7 @@ CRIFF_Parser::CRIFF_Parser(const char* szFilename) } else { - if ( header.Type != WAVE_ID ) + if (header.Type != WAVE_ID) { printError("LoadRIFF: '%s' not valid WAVE file\n", szFilename); @@ -48,7 +48,7 @@ CRIFF_Parser::CRIFF_Parser(u_char* pChunkData, int nChunkSize) m_riff = NULL; m_riffData = pChunkData; - if ( !m_riffData ) + if (!m_riffData) { m_curChunk.Id = 0; m_curChunk.Size = 0; @@ -58,7 +58,7 @@ CRIFF_Parser::CRIFF_Parser(u_char* pChunkData, int nChunkSize) RIFFhdr_t header; ReadData(&header, sizeof(header)); - if ( header.Id != RIFF_ID ) + if (header.Id != RIFF_ID) { header.Id = 0; header.Size = 0; @@ -66,7 +66,7 @@ CRIFF_Parser::CRIFF_Parser(u_char* pChunkData, int nChunkSize) } else { - if ( header.Type != WAVE_ID ) + if (header.Type != WAVE_ID) { header.Id = 0; header.Size = 0; @@ -76,23 +76,23 @@ CRIFF_Parser::CRIFF_Parser(u_char* pChunkData, int nChunkSize) ChunkSet(); } -void CRIFF_Parser::ChunkClose () +void CRIFF_Parser::ChunkClose() { - if( m_riff ) + if (m_riff) { - fclose( m_riff ); + fclose(m_riff); m_riff = NULL; } } -int CRIFF_Parser::ReadChunk( void* pOutput, int maxLen ) +int CRIFF_Parser::ReadChunk(void* pOutput, int maxLen) { int numToRead = m_curChunk.Size; if (maxLen != -1) numToRead = maxLen; - int readCount = ReadData( pOutput, numToRead); + int readCount = ReadData(pOutput, numToRead); numToRead -= readCount; /* @@ -109,16 +109,16 @@ int CRIFF_Parser::ReadChunk( void* pOutput, int maxLen ) int CRIFF_Parser::ReadData(void* dest, int len) { - if( m_riff ) + if (m_riff) { int read = fread(dest, 1, len, m_riff); m_pos += read; return read; } - else if( m_riffData ) + else if (m_riffData) { - memcpy( dest, m_riffData + m_pos, len ); + memcpy(dest, m_riffData + m_pos, len); m_pos += len; return len; } @@ -129,7 +129,7 @@ int CRIFF_Parser::ReadData(void* dest, int len) int CRIFF_Parser::ReadInt() { int i; - ReadData( &i, sizeof(i) ); + ReadData(&i, sizeof(i)); return i; } @@ -142,8 +142,8 @@ int CRIFF_Parser::SetPos(int pos) { m_pos = pos; - if ( m_riff ) - fseek(m_riff, pos, SEEK_SET ); + if (m_riff) + fseek(m_riff, pos, SEEK_SET); return m_pos; } @@ -162,8 +162,8 @@ int CRIFF_Parser::GetSize() bool CRIFF_Parser::ChunkNext() { bool result = ChunkSet(); - - if(!result) + + if (!result) { m_curChunk.Id = 0; m_curChunk.Size = 0; @@ -178,4 +178,4 @@ bool CRIFF_Parser::ChunkSet() { int n = ReadData(&m_curChunk, sizeof(m_curChunk)); return n > 0; -} \ No newline at end of file +} diff --git a/src_rebuild/utils/riff.h b/src_rebuild/utils/riff.h index 90fc36cf5..f1932f483 100644 --- a/src_rebuild/utils/riff.h +++ b/src_rebuild/utils/riff.h @@ -8,7 +8,6 @@ #define WAVE_ID (('E' << 24) | ('V' << 16) | ('A' << 8) | 'W' ) #define CDXA_ID (('A' << 24) | ('X' << 16) | ('D' << 8) | 'C' ) - #define CHUNK_FMT ((' ' << 24) | ('t' << 16) | ('m' << 8) | 'f' ) #define CHUNK_CUE ((' ' << 24) | ('e' << 16) | ('u' << 8) | 'c' ) #define CHUNK_DATA (('a' << 24) | ('t' << 16) | ('a' << 8) | 'd' ) @@ -62,8 +61,8 @@ typedef struct // CHUNK_SAMPLE uint End; uint Fraction; uint Count; - }Loop[1]; -}wavsamplehdr_t; + } Loop[1]; +} wavsamplehdr_t; typedef struct // CHUNK_CUE { @@ -106,4 +105,4 @@ class CRIFF_Parser u_char* m_riffData; }; -#endif // SND_RIFF_H \ No newline at end of file +#endif // SND_RIFF_H diff --git a/src_rebuild/utils/targa.cpp b/src_rebuild/utils/targa.cpp index ffecd628c..62a2ec775 100644 --- a/src_rebuild/utils/targa.cpp +++ b/src_rebuild/utils/targa.cpp @@ -234,4 +234,4 @@ bool SaveTGAImage(const char* filename, u_char* data, int width, int height, int fclose(fp); return true; -} \ No newline at end of file +} diff --git a/src_rebuild/utils/targa.h b/src_rebuild/utils/targa.h index 8190f9031..0f1160974 100644 --- a/src_rebuild/utils/targa.h +++ b/src_rebuild/utils/targa.h @@ -26,4 +26,4 @@ struct TGAHeader bool LoadTGAImage(const char* filename, u_char** data, int& width, int& height, int& bpp); bool SaveTGAImage(const char* filename, u_char* data, int width, int height, int bpp); -#endif // TARGA_H \ No newline at end of file +#endif // TARGA_H diff --git a/src_rebuild/utils/video_source/ReadAVI.cpp b/src_rebuild/utils/video_source/ReadAVI.cpp index 78b5ebe81..18dff0c9c 100644 --- a/src_rebuild/utils/video_source/ReadAVI.cpp +++ b/src_rebuild/utils/video_source/ReadAVI.cpp @@ -49,15 +49,15 @@ using namespace std; #define DBG_LVL_DEF 0 #ifdef VERBOSE -#define MSG_DBG(dl, format, ...) {if(dl <= DBG_LVL_DEF ) fprintf(stdout, format ,##__VA_ARGS__);} +#define MSG_DBG(dl, format, ...) {if (dl <= DBG_LVL_DEF ) fprintf(stdout, format ,##__VA_ARGS__);} #else #define MSG_DBG(dl, format, ...) #endif ReadAVI::chunk_type_int_t ReadAVI::chunk_types[ChunkTypesCnt] = { - {"db", ctype_uncompressed_video_frame }, + {"db", ctype_uncompressed_video_frame }, {"dc", ctype_compressed_video_frame }, - {"pc", ctype_palette_change }, + {"pc", ctype_palette_change }, {"wb", ctype_audio_data } }; ReadAVI::ReadAVI(const char* filename) @@ -72,7 +72,6 @@ ReadAVI::ReadAVI(const char* filename) inFile.close(); inFile.open(filename, ios_base::in | ios_base::binary); - try { parse_riff(); } @@ -115,6 +114,7 @@ int ReadAVI::GetFrameFromIndex(frame_entry_t* frame_entry) MSG_DBG(2, "Pointer out of range\n"); return -5; } + for (unsigned i = frame_entry->pointer; i < index_entries.size(); i++) { if (index_entries[i].type & frame_entry->type) { check_data_buf(index_entries[i].dwChunkLength); @@ -132,6 +132,7 @@ int ReadAVI::GetFrameFromIndex(frame_entry_t* frame_entry) return index_entries[i].dwChunkLength; } } + MSG_DBG(2, "No more frames\n"); return -1; } @@ -179,12 +180,14 @@ int ReadAVI::hex_dump_chunk(int chunk_len) int ReadAVI::decodeCkid(char* ckid, chunk_type_t* chunk_type) { int stream = (ckid[0] - '0') * 10 + (ckid[1] - '0'); + for (int i = 0; i < ChunkTypesCnt; i++) { if (chunk_types[i].type_id[0] == ckid[2] && chunk_types[i].type_id[1] == ckid[3]) { *chunk_type = chunk_types[i].type; return stream; } } + return -1; } @@ -514,7 +517,7 @@ int ReadAVI::parse_movi(int size) index_entries.push_back(index_entry); } - MSG_DBG(3, " AVI Movi Chunk ( id=%s(%d-%d) chunk_size=%d offset=0x%lx)\n", chunk_id, index_entry.type, + MSG_DBG(3, " AVI Movi Chunk (id=%s(%d-%d) chunk_size=%d offset=0x%lx)\n", chunk_id, index_entry.type, index_entry.stream_num, index_entry.dwChunkLength, offset); MSG_DBG(3, " {\n"); @@ -646,10 +649,14 @@ int ReadAVI::parse_riff() else if (strcmp("idx1", chunk_id) == 0) { inFile.seekg(inFile.tellg() - std::streamoff(4), ios_base::beg); parse_idx1(chunk_size); - }/* else if (strcmp("indx", chunk_id) == 0) { - inFile.seekg(inFile.tellg() - 4L, ios_base::beg); - parse_indx(chunk_size); - }*/else { + } + /* + else if (strcmp("indx", chunk_id) == 0) { + inFile.seekg(inFile.tellg() - 4L, ios_base::beg); + parse_indx(chunk_size); + } + */ + else { MSG_DBG(2, " Unknown chunk at %d (%4s)\n", (int)inFile.tellg() - 8, chunk_type); if (chunk_size == 0) break; diff --git a/src_rebuild/utils/video_source/VideoPlayer.cpp b/src_rebuild/utils/video_source/VideoPlayer.cpp index 666b105e4..0846a5950 100644 --- a/src_rebuild/utils/video_source/VideoPlayer.cpp +++ b/src_rebuild/utils/video_source/VideoPlayer.cpp @@ -54,11 +54,11 @@ void PrintFMVText(char *str, int x, short y, int brightness) str_w = 0; - if (brightness > 128) + if (brightness > 128) brightness = 128; i = 0; - while (chr = str[i], chr != 0) + while (chr = str[i], chr != 0) { if (chr == 32) str_w += 4; @@ -72,14 +72,14 @@ void PrintFMVText(char *str, int x, short y, int brightness) drawnChars = 0; ptr = (char *)str; - while( true ) + while (true) { chr = *ptr; ptr++; - - if (chr == 0 || drawnChars > 511) + + if (chr == 0 || drawnChars > 511) break; - + if (chr == 32) // space { x_ofs += 4; @@ -87,7 +87,7 @@ void PrintFMVText(char *str, int x, short y, int brightness) else { setPolyFT4(poly); - + poly->x0 = x_ofs; poly->y0 = y; poly->x1 = x_ofs + fmvFontUV[chr].w; @@ -104,7 +104,7 @@ void PrintFMVText(char *str, int x, short y, int brightness) poly->v2 = fmvFontUV[chr].v + fmvFontUV[chr].h; poly->u3 = fmvFontUV[chr].u + fmvFontUV[chr].w; poly->v3 = fmvFontUV[chr].v + fmvFontUV[chr].h; - poly->tpage = getTPage(0,0, 960, 0); + poly->tpage = getTPage(0, 0, 960, 0); poly->clut = getClut(960, 72); poly->r0 = brightness; @@ -112,7 +112,7 @@ void PrintFMVText(char *str, int x, short y, int brightness) poly->b0 = brightness; addPrim(&ot, poly); - + x_ofs += fmvFontUV[chr].w; drawnChars++; poly++; @@ -138,8 +138,8 @@ int UnpackJPEG(unsigned char* src_buf, unsigned src_length, unsigned bpp, unsign width = cinfo.image_width; height = cinfo.image_height; - for (u_char* curr_scanline = dst_buf; - cinfo.output_scanline < cinfo.output_height; + for (u_char* curr_scanline = dst_buf; + cinfo.output_scanline < cinfo.output_height; curr_scanline += cinfo.output_width * cinfo.num_components) { jpeg_read_scanlines(&cinfo, &curr_scanline, 1); @@ -161,12 +161,12 @@ void SetupMovieRectangle(int image_w, int image_h) const float video_aspect = float(image_w) / float(image_h); const float psx_aspect = (psxScreenH / psxScreenW); - + const float image_to_screen_w = float(psxScreenW) / float(windowWidth);// * psx_aspect; const float image_to_screen_h = float(psxScreenH) / float(windowHeight);// * psx_aspect; const float image_scale = float(windowHeight) / psxScreenH * video_aspect; - + float clipRectX = 0; float clipRectY = 0; float clipRectW = image_to_screen_w * image_scale; @@ -174,7 +174,7 @@ void SetupMovieRectangle(int image_w, int image_h) clipRectX -= clipRectW * 0.5f; clipRectY -= clipRectH * 0.5f; - + u_char l = 0; u_char t = 0; u_char r = 1; @@ -188,7 +188,7 @@ void SetupMovieRectangle(int image_w, int image_h) { clipRectX+ clipRectW, clipRectY + clipRectH, 0, 0, 0, 0, 0, 0, r, t, 0, 0, }, { clipRectX, clipRectY, 0, 0, 0, 0, 0, 0, l, b, 0, 0, }, { clipRectX, clipRectY + clipRectH, 0, 0, 0, 0, 0, 0, l, t, 0, 0, }, - + { clipRectX + clipRectW, clipRectY, 0, 0, 0, 0, 0, 0, r, b, 0, 0, }, { clipRectX, clipRectY, 0, 0, 0, 0, 0, 0, l, b, 0, 0, }, { clipRectX + clipRectW, clipRectY + clipRectH, 0, 0, 0, 0, 0, 0, r, t, 0, 0, }, @@ -260,10 +260,10 @@ u_char* g_FMVDecodedImageBuffer = NULL; void FMVPlayerInitGL() { - g_FMVDecodedImageBuffer = (u_char*)malloc(DECODE_BUFFER_ALLOC); + g_FMVDecodedImageBuffer = (u_char*)malloc(DECODE_BUFFER_ALLOC); memset(g_FMVDecodedImageBuffer, 0, DECODE_BUFFER_ALLOC); // FIXME: double buffering? - + #if defined(RENDERER_OGL) || defined(RENDERER_OGLES) glGenTextures(1, &g_FMVTexture); @@ -276,7 +276,7 @@ void FMVPlayerInitGL() glBindTexture(GL_TEXTURE_2D, 0); - if(!g_FMVShader) + if (!g_FMVShader) { g_FMVShader = GR_Shader_Compile(fmv_shader); } @@ -293,7 +293,7 @@ void FMVPlayerShutdownGL() free(g_FMVDecodedImageBuffer); g_FMVDecodedImageBuffer = NULL; - + ClearImage(&rect, 0, 0, 0); GR_SwapWindow(); @@ -334,7 +334,7 @@ char* g_CreditsLines[512]; void InitCredits(const char* filename) { memset(g_CreditsLines, 0, sizeof(g_CreditsLines)); - + FILE* credFile = fopen(filename, "rb"); if (credFile) { @@ -350,30 +350,30 @@ void InitCredits(const char* filename) fclose(credFile); } - if(g_CreditsBuffer) + if (g_CreditsBuffer) { // make credits into lines char* str = g_CreditsBuffer; int numCreditsLines = 0; - while(*str) + while (*str) { - if(!g_CreditsLines[numCreditsLines]) + if (!g_CreditsLines[numCreditsLines]) g_CreditsLines[numCreditsLines] = str; - - if(*str == '\r') + + if (*str == '\r') { *str = '\0'; - + if (*++str == '\n') numCreditsLines++; } - else if(*str == '\n') + else if (*str == '\n') { *str = '\0'; numCreditsLines++; } - + str++; } } @@ -396,7 +396,7 @@ void DisplaySubtitles(int frame_number) // draw subtitie text for (int i = 0; i < g_NumSubtitles; i++) { - if(frame_number >= g_Subtitles[i].startframe && frame_number <= g_Subtitles[i].endframe) + if (frame_number >= g_Subtitles[i].startframe && frame_number <= g_Subtitles[i].endframe) PrintSubtitleText(&g_Subtitles[i]); } } @@ -413,7 +413,7 @@ void DisplayCredits(int frame_number) if (frame > CREDITS_STOP_FRAME) frame = CREDITS_STOP_FRAME; - + int height = (frame - CREDITS_START_FRAME) * 30 >> 5; int fade = 0; @@ -424,16 +424,16 @@ void DisplayCredits(int frame_number) fade = 128; } - for(i = 0; i < 512; i++) + for (i = 0; i < 512; i++) { int text_h = 250 - height + i * 16; - + if (text_h < -20 || text_h > 260) continue; - + char* str = g_CreditsLines[i]; - if(str) + if (str) PrintFMVText(str, 256, text_h, 128 - fade); } } @@ -448,7 +448,7 @@ void DrawFrame(ReadAVI::stream_format_t& stream_format, int frame_number, int cr PsyX_BeginScene(); GR_Clear(0, 0, windowWidth, windowHeight, 0, 0, 0); - + glBindTexture(GL_TEXTURE_2D, g_FMVTexture); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, image_w, image_h, 0, GL_RGB, GL_UNSIGNED_BYTE, g_FMVDecodedImageBuffer); glBindTexture(GL_TEXTURE_2D, 0); @@ -460,18 +460,18 @@ void DrawFrame(ReadAVI::stream_format_t& stream_format, int frame_number, int cr GR_EnableDepth(0); GR_SetStencilMode(0); GR_SetBlendMode(BM_NONE); - + SetupMovieRectangle(stream_format.image_width, stream_format.image_height); GR_DrawTriangles(0, 2); DisplaySubtitles(frame_number); - if(credits && frame_number >= CREDITS_START_FRAME) + if (credits && frame_number >= CREDITS_START_FRAME) { DisplayCredits(frame_number); } - + PsyX_EndScene(); } @@ -486,13 +486,13 @@ void DoPlayFMV(RENDER_ARG* arg, int subtitles) FS_FixPathSlashes(filename); ReadAVI readAVI(filename); - + // also load subtitle file if (subtitles) { sprintf(filename, "%sFMV\\%d\\RENDER%d.SBN", gDataFolder, fd, arg->render); FS_FixPathSlashes(filename); - + InitSubtitles(filename); } else @@ -500,11 +500,11 @@ void DoPlayFMV(RENDER_ARG* arg, int subtitles) g_NumSubtitles = 0; } - if(arg->credits) + if (arg->credits) { sprintf(filename, "%sDATA\\CREDITS.ENG", gDataFolder); FS_FixPathSlashes(filename); - + InitCredits(filename); } @@ -513,7 +513,7 @@ void DoPlayFMV(RENDER_ARG* arg, int subtitles) ReadAVI::stream_format_t stream_format = readAVI.GetVideoFormat(); ReadAVI::stream_format_auds_t audio_format = readAVI.GetAudioFormat(); - if (strcmp(stream_format.compression_type, "MJPG")) + if (strcmp(stream_format.compression_type, "MJPG")) { printf("Only MJPG supported\n"); return; @@ -549,7 +549,7 @@ void DoPlayFMV(RENDER_ARG* arg, int subtitles) int done_frames = 0; Util_GetHPCTime(&fmvTimer, 1); - + // main loop while (true) { @@ -574,7 +574,7 @@ void DoPlayFMV(RENDER_ARG* arg, int subtitles) break; // handle recap - if(arg->recap && done_frames > arg->recap) + if (arg->recap && done_frames > arg->recap) break; // fade out sound and stop playback @@ -593,7 +593,7 @@ void DoPlayFMV(RENDER_ARG* arg, int subtitles) { int real_frame_width; int real_frame_height; - + // Do video frame int ret = UnpackJPEG(frame_entry.buf, frame_size, stream_format.bits_per_pixel, g_FMVDecodedImageBuffer, real_frame_width, real_frame_height); @@ -607,7 +607,7 @@ void DoPlayFMV(RENDER_ARG* arg, int subtitles) nextFrameDelay += double(avi_header.TimeBetweenFrames) / 1000000.0; else nextFrameDelay = 0.0; - + done_frames++; } else if (frame_entry.type == ReadAVI::ctype_audio_data) @@ -635,7 +635,7 @@ void DoPlayFMV(RENDER_ARG* arg, int subtitles) // restart queue_counter = 0; } - else if(numProcessed && queue_counter > 3) + else if (numProcessed && queue_counter > 3) { // dequeue one buffer alSourceUnqueueBuffers(audioStreamSource, 1, &qbuffer); @@ -647,7 +647,7 @@ void DoPlayFMV(RENDER_ARG* arg, int subtitles) if (queue_counter < 4) QueueAudioBuffer(audioStreamBuffers[queue_counter++], audioStreamSource, frame_entry, audio_format, 0, frame_size); - if((queue_counter > 1 || numProcessed == -1) && state != AL_PLAYING) + if ((queue_counter > 1 || numProcessed == -1) && state != AL_PLAYING) alSourcePlay(audioStreamSource); } } @@ -683,7 +683,7 @@ int FMV_main(RENDER_ARGS* args) draw.clip.w = 1200; draw.clip.y = -1; draw.clip.h = 512; - + disp.isinter = 0; PutDrawEnv(&draw); @@ -704,4 +704,3 @@ int FMV_main(RENDER_ARGS* args) return 0; } -