From bbf52f580b0db18474237dc8a8d86a6bd73d8900 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Fri, 9 Sep 2022 17:19:48 +1000 Subject: [PATCH] Add support for non-matching ntsc-final builds --- Makefile | 3 +- src/game/bg.c | 1857 +++++++------- src/game/bodyreset.c | 170 +- src/game/bondgun.c | 938 +++---- src/game/camdraw.c | 626 ++--- src/game/camera.c | 94 +- src/game/chr.c | 546 +++-- src/game/chraction.c | 1384 +++++------ src/game/chraicommands.c | 518 ++-- src/game/dlights.c | 232 +- src/game/file.c | 4088 ++++++++++++++++--------------- src/game/game_1531a0.c | 183 +- src/game/gunfx.c | 608 ++--- src/game/menugfx.c | 911 +++---- src/game/menuitem.c | 328 +-- src/game/nbomb.c | 832 +++---- src/game/pak.c | 84 +- src/game/playermgr.c | 122 +- src/game/propobj.c | 590 ++--- src/game/propsnd.c | 566 ++--- src/game/sight.c | 292 +-- src/game/sky.c | 288 +-- src/game/sparkstick.c | 160 +- src/game/stars.c | 232 +- src/game/tex.c | 680 ++--- src/game/title.c | 1194 ++++----- src/game/wallhit.c | 390 +-- src/game/weather.c | 2264 ++++++++--------- src/include/bss.h | 2 +- src/include/game/body.h | 2 +- src/include/types.h | 2 +- src/lib/anim.c | 134 +- src/lib/collision.c | 378 +-- src/lib/mema.c | 160 +- src/lib/music.c | 304 +-- src/lib/ultra/libc/llcvt.c | 12 +- src/lib/ultra/libc/sprintf.c | 35 +- src/lib/ultra/os/getmemsize.c | 4 +- src/lib/ultra/os/syncputchars.c | 54 +- src/lib/vi.c | 312 +-- src/lib/vm.c | 256 +- 41 files changed, 10982 insertions(+), 10853 deletions(-) diff --git a/Makefile b/Makefile index 4ee2d2644..07449a178 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ # User configurable ROMID ?= ntsc-final +MATCHING ?= 1 PIRACYCHECKS ?= 1 # In PD, some code is compiled with IDO 5.3 and some is IDO 7.1. @@ -54,7 +55,7 @@ ifeq ($(ROMID),jpn-final) COPYLEN=4 endif -DEFINES := VERSION=$(VERSION) PAL=$(PAL) PIRACYCHECKS=$(PIRACYCHECKS) _FINALROM=1 +DEFINES := VERSION=$(VERSION) MATCHING=$(MATCHING) PAL=$(PAL) PIRACYCHECKS=$(PIRACYCHECKS) _FINALROM=1 C_DEFINES := $(foreach d,$(DEFINES),-D$(d)) AS_DEFINES := $(foreach d,$(DEFINES),--defsym $(d)) --defsym _LANGUAGE_ASSEMBLY=1 diff --git a/src/game/bg.c b/src/game/bg.c index eed05e0bd..38250a172 100644 --- a/src/game/bg.c +++ b/src/game/bg.c @@ -414,6 +414,7 @@ Gfx *func0f158400(Gfx *gdl, struct xraydata *xraydata, s16 vertices1[3], s16 ver return gdl; } +#if MATCHING GLOBAL_ASM( glabel bgChooseXrayVtxColour .late_rodata @@ -774,76 +775,77 @@ glabel var7f1b75c0 /* f158d94: 03e00008 */ jr $ra /* f158d98: 00000000 */ nop ); - +#else // Mismatch: Reordered statements in the last else block. Goal saves player and // alphafrac to the stack after the division. The code below does it before. -//void bgChooseXrayVtxColour(bool *inrange, s16 vertex[3], u32 *colour, struct xraydata *xraydata) -//{ -// f32 sp2c[3]; -// f32 f12; -// f32 alphafrac; // 24 -// f32 f0; -// struct player *player = g_Vars.currentplayer; // 1c -// f32 tmp; -// -// *inrange = false; -// -// sp2c[0] = (f32) vertex[0] - (f32) xraydata->unk000; -// sp2c[0] = sp2c[0] * sp2c[0]; -// -// if (sp2c[0] < xraydata->unk010) { -// sp2c[2] = (f32) vertex[2] - (f32) xraydata->unk008; -// sp2c[2] = sp2c[2] * sp2c[2]; -// -// if (sp2c[2] < xraydata->unk010) { -// sp2c[1] = (f32) vertex[1] - (f32) xraydata->unk004; -// sp2c[1] = sp2c[1] * sp2c[1]; -// -// if (sp2c[1] < xraydata->unk010) { -// f0 = sqrtf(sp2c[0] + sp2c[1] + sp2c[2]); -// -// if (f0 < xraydata->unk00c) { -// *inrange = true; -// -// f12 = f0 / xraydata->unk00c; -// -// if (xraydata->unk014 < f12) { -// alphafrac = 1.0f - (f12 - xraydata->unk014) / (1.0f - xraydata->unk014); -// } else { -// alphafrac = 1.0f; -// } -// -// // 9e0 -// if (f12 < xraydata->unk01c) { -// f32 f0 = f12 / xraydata->unk01c; -// -// f0 = sinf((1.0f - f0) * 1.5707964f); -// -// *colour = (u32)(f0 * 255.0f) << player->ecol_1 -// | (u32)((1.0f - f0) * 255.0f) << player->ecol_2 -// | (u32)(alphafrac * 128.0f); -// } else { -// // bec -// f32 f0; -// -// f0 = (f12 - xraydata->unk01c) / (1.0f - xraydata->unk01c); -// f0 = 0.65f * f0 + 0.35f; -// -// tmp = sinf(f0 * 1.5707964f); -// -// *colour = (u32)(tmp * 255.0f) << player->ecol_3 -// | 0xff << player->ecol_2 -// | (u32)(alphafrac * 128.0f); -// } -// } -// } -// } -// } -// -// if (*inrange == false) { -// *colour = 0x0000ff00; -// } -//} +void bgChooseXrayVtxColour(bool *inrange, s16 vertex[3], u32 *colour, struct xraydata *xraydata) +{ + f32 sp2c[3]; + f32 f12; + f32 alphafrac; // 24 + f32 f0; + struct player *player = g_Vars.currentplayer; // 1c + f32 tmp; + + *inrange = false; + + sp2c[0] = (f32) vertex[0] - (f32) xraydata->unk000; + sp2c[0] = sp2c[0] * sp2c[0]; + + if (sp2c[0] < xraydata->unk010) { + sp2c[2] = (f32) vertex[2] - (f32) xraydata->unk008; + sp2c[2] = sp2c[2] * sp2c[2]; + + if (sp2c[2] < xraydata->unk010) { + sp2c[1] = (f32) vertex[1] - (f32) xraydata->unk004; + sp2c[1] = sp2c[1] * sp2c[1]; + + if (sp2c[1] < xraydata->unk010) { + f0 = sqrtf(sp2c[0] + sp2c[1] + sp2c[2]); + + if (f0 < xraydata->unk00c) { + *inrange = true; + + f12 = f0 / xraydata->unk00c; + + if (xraydata->unk014 < f12) { + alphafrac = 1.0f - (f12 - xraydata->unk014) / (1.0f - xraydata->unk014); + } else { + alphafrac = 1.0f; + } + + // 9e0 + if (f12 < xraydata->unk01c) { + f32 f0 = f12 / xraydata->unk01c; + + f0 = sinf((1.0f - f0) * 1.5707964f); + + *colour = (u32)(f0 * 255.0f) << player->ecol_1 + | (u32)((1.0f - f0) * 255.0f) << player->ecol_2 + | (u32)(alphafrac * 128.0f); + } else { + // bec + f32 f0; + + f0 = (f12 - xraydata->unk01c) / (1.0f - xraydata->unk01c); + f0 = 0.65f * f0 + 0.35f; + + tmp = sinf(f0 * 1.5707964f); + + *colour = (u32)(tmp * 255.0f) << player->ecol_3 + | 0xff << player->ecol_2 + | (u32)(alphafrac * 128.0f); + } + } + } + } + } + + if (*inrange == false) { + *colour = 0x0000ff00; + } +} +#endif Gfx *func0f158d9c(Gfx *gdl, struct xraydata *xraydata, s16 arg2[3], s16 arg3[3], s16 arg4[3], s32 arg5, s32 arg6, s32 arg7, s32 arg8, s32 arg9, s32 arg10) { @@ -1017,6 +1019,7 @@ bool g_BgCmdStack[20] = {0}; s32 g_BgCmdStackIndex = 0; u32 g_BgCmdResult = BGRESULT_TRUE; +#if MATCHING GLOBAL_ASM( glabel bg0f1598b4 .late_rodata @@ -1447,102 +1450,103 @@ glabel var7f1b75c4 /* f159f14: 03e00008 */ jr $ra /* f159f18: 27bd03d8 */ addiu $sp,$sp,0x3d8 ); - +#else // Mismatch: Regalloc and some reordered instructions -//Gfx *bg0f1598b4(Gfx *gdl, Gfx *gdl2, struct gfxvtx *vertices, s16 arg3[3]) -//{ -// s32 i; -// s32 stack; -// struct xraydata xraydata; -// struct stagetableentry *stage = stageGetCurrent(); -// s16 sp120[16][3]; -// s32 colours[16]; -// bool inrange[16]; -// -// xraydata.unk00c = g_Vars.currentplayer->eraserbgdist; -// xraydata.unk010 = xraydata.unk00c * xraydata.unk00c; -// xraydata.unk018 = xraydata.unk00c * 0.25f; -// xraydata.unk01c = g_Vars.currentplayer->eraserpropdist / xraydata.unk00c; -// -// if (xraydata.unk01c > 0.7f) { -// xraydata.unk01c = 0.7f; -// } -// -// xraydata.unk014 = 0.250f; -// xraydata.unk020 = stage->unk2c; -// xraydata.unk024 = xraydata.unk020 * xraydata.unk020; -// xraydata.unk000 = arg3[0]; -// xraydata.unk004 = arg3[1]; -// xraydata.unk008 = arg3[2]; -// xraydata.numtris = 0; -// xraydata.numvertices = 0; -// -// while (true) { -// if (gdl2->dma.cmd == G_ENDDL) { -// break; -// } -// -// if (gdl2->dma.cmd == G_MTX) { -// // empty -// } else if (gdl2->dma.cmd == G_VTX) { -// s32 index = gdl2->bytes[1] & 0xf; -// s32 numvertices = (((u32)gdl2->bytes[1] >> 4)) + 1; -// s32 offset = (gdl2->words.w1 & 0xffffff); -// struct gfxvtx *vtx = (struct gfxvtx *)((u32)vertices + offset); -// u32 stack[4]; -// -// for (i = 0; i < numvertices; i++) { -// sp120[index + i][0] = vtx->x; -// sp120[index + i][1] = vtx->y; -// sp120[index + i][2] = vtx->z; -// -// bgChooseXrayVtxColour(&inrange[i], sp120[index + i], &colours[index + i], &xraydata); -// -// vtx++; -// } -// } else if (gdl2->dma.cmd == G_TRI1) { -// s16 x = gdl2->tri.tri.v[0] / 10; -// s16 y = gdl2->tri.tri.v[1] / 10; -// s16 z = gdl2->tri.tri.v[2] / 10; -// -// gdl = func0f158d9c(gdl, &xraydata, sp120[x], sp120[y], sp120[z], colours[x], colours[y], colours[z], inrange[x], inrange[y], inrange[z]); -// } else if (gdl2->dma.cmd == G_TRI4) { -// s16 x; -// s16 y; -// s16 z; -// -// x = gdl2->tri4.x1; -// y = gdl2->tri4.y1; -// z = gdl2->tri4.z1; -// -// gdl = func0f158d9c(gdl, &xraydata, sp120[x], sp120[y], sp120[z], colours[x], colours[y], colours[z], inrange[x], inrange[y], inrange[z]); -// -// x = gdl2->tri4.x2; -// y = gdl2->tri4.y2; -// z = gdl2->tri4.z2; -// -// gdl = func0f158d9c(gdl, &xraydata, sp120[x], sp120[y], sp120[z], colours[x], colours[y], colours[z], inrange[x], inrange[y], inrange[z]); -// -// x = gdl2->tri4.x3; -// y = gdl2->tri4.y3; -// z = gdl2->tri4.z3; -// -// gdl = func0f158d9c(gdl, &xraydata, sp120[x], sp120[y], sp120[z], colours[x], colours[y], colours[z], inrange[x], inrange[y], inrange[z]); -// -// x = gdl2->tri4.x4; -// y = gdl2->tri4.y4; -// z = gdl2->tri4.z4; -// -// gdl = func0f158d9c(gdl, &xraydata, sp120[x], sp120[y], sp120[z], colours[x], colours[y], colours[z], inrange[x], inrange[y], inrange[z]); -// } -// -// gdl2++; -// } -// -// gdl = bg0f158184(gdl, &xraydata); -// -// return gdl; -//} +Gfx *bg0f1598b4(Gfx *gdl, Gfx *gdl2, struct gfxvtx *vertices, s16 arg3[3]) +{ + s32 i; + s32 stack; + struct xraydata xraydata; + struct stagetableentry *stage = stageGetCurrent(); + s16 sp120[16][3]; + u32 colours[16]; + bool inrange[16]; + + xraydata.unk00c = g_Vars.currentplayer->eraserbgdist; + xraydata.unk010 = xraydata.unk00c * xraydata.unk00c; + xraydata.unk018 = xraydata.unk00c * 0.25f; + xraydata.unk01c = g_Vars.currentplayer->eraserpropdist / xraydata.unk00c; + + if (xraydata.unk01c > 0.7f) { + xraydata.unk01c = 0.7f; + } + + xraydata.unk014 = 0.250f; + xraydata.unk020 = stage->unk2c; + xraydata.unk024 = xraydata.unk020 * xraydata.unk020; + xraydata.unk000 = arg3[0]; + xraydata.unk004 = arg3[1]; + xraydata.unk008 = arg3[2]; + xraydata.numtris = 0; + xraydata.numvertices = 0; + + while (true) { + if (gdl2->dma.cmd == G_ENDDL) { + break; + } + + if (gdl2->dma.cmd == G_MTX) { + // empty + } else if (gdl2->dma.cmd == G_VTX) { + s32 index = gdl2->bytes[1] & 0xf; + s32 numvertices = (((u32)gdl2->bytes[1] >> 4)) + 1; + s32 offset = (gdl2->words.w1 & 0xffffff); + struct gfxvtx *vtx = (struct gfxvtx *)((u32)vertices + offset); + u32 stack[4]; + + for (i = 0; i < numvertices; i++) { + sp120[index + i][0] = vtx->x; + sp120[index + i][1] = vtx->y; + sp120[index + i][2] = vtx->z; + + bgChooseXrayVtxColour(&inrange[i], sp120[index + i], &colours[index + i], &xraydata); + + vtx++; + } + } else if (gdl2->dma.cmd == G_TRI1) { + s16 x = gdl2->tri.tri.v[0] / 10; + s16 y = gdl2->tri.tri.v[1] / 10; + s16 z = gdl2->tri.tri.v[2] / 10; + + gdl = func0f158d9c(gdl, &xraydata, sp120[x], sp120[y], sp120[z], colours[x], colours[y], colours[z], inrange[x], inrange[y], inrange[z]); + } else if (gdl2->dma.cmd == G_TRI4) { + s16 x; + s16 y; + s16 z; + + x = gdl2->tri4.x1; + y = gdl2->tri4.y1; + z = gdl2->tri4.z1; + + gdl = func0f158d9c(gdl, &xraydata, sp120[x], sp120[y], sp120[z], colours[x], colours[y], colours[z], inrange[x], inrange[y], inrange[z]); + + x = gdl2->tri4.x2; + y = gdl2->tri4.y2; + z = gdl2->tri4.z2; + + gdl = func0f158d9c(gdl, &xraydata, sp120[x], sp120[y], sp120[z], colours[x], colours[y], colours[z], inrange[x], inrange[y], inrange[z]); + + x = gdl2->tri4.x3; + y = gdl2->tri4.y3; + z = gdl2->tri4.z3; + + gdl = func0f158d9c(gdl, &xraydata, sp120[x], sp120[y], sp120[z], colours[x], colours[y], colours[z], inrange[x], inrange[y], inrange[z]); + + x = gdl2->tri4.x4; + y = gdl2->tri4.y4; + z = gdl2->tri4.z4; + + gdl = func0f158d9c(gdl, &xraydata, sp120[x], sp120[y], sp120[z], colours[x], colours[y], colours[z], inrange[x], inrange[y], inrange[z]); + } + + gdl2++; + } + + gdl = bg0f158184(gdl, &xraydata); + + return gdl; +} +#endif Gfx *bgRenderRoomXrayPass(Gfx *gdl, s32 roomnum, struct roomgfxdata18 *arg2, bool recurse, s16 arg4[3]) { @@ -4379,6 +4383,7 @@ struct gfxvtx *room0f15dbb4(s32 roomnum, Gfx *gdl) return NULL; } +#if MATCHING #if VERSION >= VERSION_NTSC_1_0 GLOBAL_ASM( glabel bgLoadRoom @@ -5542,228 +5547,230 @@ const char var7f1b1a2cnb[] = "bg.c"; const char var7f1b1a34nb[] = "bg.c: roominf[room].allocsize > calculated!"; const char var7f1b1a60nb[] = "bg.c"; #endif +#else // Mismatch: The below stores len * 4 into s1 which causes further codegen // differences. -//void bgLoadRoom(s32 roomnum) -//{ -// s32 size; // 2f4 -// s32 inflatedlen; // 2f0 -// u8 *allocation; -// s32 readlen; -// s32 fileoffset; -// u8 *memaddr; -// struct roomgfxdata18 *thing1; -// struct roomgfxdata18 *thing2; -// s32 v0; -// s32 len; -// u32 sp208[50]; -// s32 sp140[50]; -// u32 sp78[50]; -// s32 allocationend; -// s32 a2; -// s32 i; // 6c -// u32 end1; -// u32 end2; -// s32 prev; -// -//#if VERSION < VERSION_NTSC_1_0 -// bgVerifyLightSums("bg.c", 7076); -//#endif -// -// if (roomnum == 0 || roomnum >= g_Vars.roomcount || g_Rooms[roomnum].loaded240) { -// return; -// } -// -// if (g_Rooms[roomnum].gfxdatalen > 0) { -// size = g_Rooms[roomnum].gfxdatalen; -// -// if (debug0f11edb0()) { -// size += 1024; -// } -// } else { -// size = memaGetLongestFree(); -// } -// -// bgGarbageCollectRooms(size, false); -// allocation = memaAlloc(size); -// -// if (allocation != NULL) { -// dyntexSetCurrentRoom(roomnum); -// -// readlen = ((g_BgRooms[roomnum + 1].unk00 - g_BgRooms[roomnum].unk00) + 0xf) & ~0xf; -// fileoffset = (g_BgPrimaryData + g_BgRooms[roomnum].unk00 - g_BgPrimaryData) + 0xf1000000; -// fileoffset -= var8007fc54; -// -// if (size < readlen) { -// dyntexSetCurrentRoom(-1); -// return; -// } -// -// memaddr = size - readlen + allocation; -// bgLoadFile(memaddr, fileoffset, readlen); -// -// if (rzipIs1173(memaddr) && size < readlen + 0x20) { -// dyntexSetCurrentRoom(-1); -// return; -// } -// -// inflatedlen = bgInflate(memaddr, allocation, g_BgRooms[roomnum + 1].unk00 - g_BgRooms[roomnum].unk00); -// g_Rooms[roomnum].gfxdata = (struct roomgfxdata *)allocation; -// -// if (g_Rooms[roomnum].gfxdata->vertices) { -// g_Rooms[roomnum].gfxdata->vertices = (struct gfxvtx *)((u32)g_Rooms[roomnum].gfxdata->vertices - g_BgRooms[roomnum].unk00 + (u32)allocation); -// } -// -// if (g_Rooms[roomnum].gfxdata->colours) { -// g_Rooms[roomnum].gfxdata->colours = (u32 *)((u32)g_Rooms[roomnum].gfxdata->colours - g_BgRooms[roomnum].unk00 + (u32)allocation); -// } -// -// if (g_Rooms[roomnum].gfxdata->unk08) { -// g_Rooms[roomnum].gfxdata->unk08 = (struct roomgfxdata18 *)((u32)g_Rooms[roomnum].gfxdata->unk08 - g_BgRooms[roomnum].unk00 + (u32)allocation); -// } -// -// if (g_Rooms[roomnum].gfxdata->unk0c) { -// g_Rooms[roomnum].gfxdata->unk0c = (struct roomgfxdata18 *)((u32)g_Rooms[roomnum].gfxdata->unk0c - g_BgRooms[roomnum].unk00 + (u32)allocation); -// } -// -// thing1 = g_Rooms[roomnum].gfxdata->unk18; -// end1 = (u32)g_Rooms[roomnum].gfxdata->vertices; -// -// while ((u32)(thing1 + 1) <= end1) { -// switch (thing1->unk00) { -// case 0: -// if (thing1->unk04 != 0) { -// thing1->unk04 = (void *)((u32)thing1->unk04 - g_BgRooms[roomnum].unk00 + (u32)allocation); -// } -// if (thing1->gdl != 0) { -// thing1->gdl = (Gfx *)((u32)thing1->gdl - g_BgRooms[roomnum].unk00 + (u32)allocation); -// } -// if (thing1->vertices != 0) { -// thing1->vertices = (struct gfxvtx *)((u32)thing1->vertices - g_BgRooms[roomnum].unk00 + (u32)allocation); -// } -// if (thing1->colours != 0) { -// thing1->colours = (u32 *)((u32)thing1->colours - g_BgRooms[roomnum].unk00 + (u32)allocation); -// } -// break; -// case 1: -// if (thing1->unk04 != 0) { -// thing1->unk04 = (void *)((u32)thing1->unk04 - g_BgRooms[roomnum].unk00 + (u32)allocation); -// } -// if (thing1->gdl != 0) { -// thing1->gdl = (Gfx *)((u32)thing1->gdl - g_BgRooms[roomnum].unk00 + (u32)allocation); -// } -// if (thing1->vertices != 0) { -// thing1->vertices = (struct gfxvtx *)((u32)thing1->vertices - g_BgRooms[roomnum].unk00 + (u32)allocation); -// } -// if (thing1->colours != 0) { -// thing1->colours = (u32 *)((u32)thing1->colours - g_BgRooms[roomnum].unk00 + (u32)allocation); -// } -// if ((u32)thing1->vertices < end1) { -// end1 = (u32)thing1->vertices; -// } -// break; -// } -// -// thing1++; -// } -// -// g_Rooms[roomnum].gfxdata->numvertices = ((u32)g_Rooms[roomnum].gfxdata->colours - (u32)g_Rooms[roomnum].gfxdata->vertices) / sizeof(struct gfxvtx); -// g_Rooms[roomnum].gfxdata->numcolours = ((u32)room0f15dab4(roomnum, 0, VTXBATCHTYPE_OPA | VTXBATCHTYPE_XLU) - (u32)g_Rooms[roomnum].gfxdata->colours) / sizeof(u32); -// -// len = 0; -// v0 = room0f15dab4(roomnum, NULL, VTXBATCHTYPE_OPA | VTXBATCHTYPE_XLU); -// -// while (v0) { -// sp208[len] = v0; -// sp140[len] = room0f15dbb4(roomnum, v0); -// len++; -// -// v0 = room0f15dab4(roomnum, v0, VTXBATCHTYPE_OPA | VTXBATCHTYPE_XLU); -// } -// -// sp208[len] = (s32)allocation + inflatedlen; -// allocationend = (s32)allocation + size; -// -// tex0f175ef4(sp208[0], allocationend - (sp208[len] - sp208[0]), sp208[len] - sp208[0]); -// -// for (i = 0; i < len + 1; i++) { -// sp78[i] = sp208[i] + (allocationend - sp208[len]); -// } -// -// a2 = sp208[0]; -// -// for (i = 0; i < len; i++) { -// v0 = tex0f1756c0(sp78[i], sp208[i + 1] - sp208[i], a2, 0, sp140[i]); -// sp78[i] = a2; -// a2 += v0; -// a2 = ALIGN8(a2); -// } -// -// sp78[len] = a2; -// -// prev = g_Rooms[roomnum].gfxdatalen; -// g_Rooms[roomnum].gfxdatalen = ALIGN16(a2 - (s32)allocation + 0x20); -// -// if (g_Rooms[roomnum].gfxdatalen > prev) { -//#if VERSION < VERSION_NTSC_1_0 -// crashSetMessage("bg.c: roominf[room].allocsize > calculated!"); -// CRASH(); -//#endif -// } -// -// g_Rooms[roomnum].loaded240 = 1; -// -// if (g_Rooms[roomnum].gfxdatalen != size) { -// bool result = memaRealloc((s32)allocation, size, g_Rooms[roomnum].gfxdatalen); -// } -// -// thing2 = g_Rooms[roomnum].gfxdata->unk18; -// end2 = (u32)g_Rooms[roomnum].gfxdata->vertices; -// -// while ((u32)(thing2 + 1) <= end2) { -// switch (thing2->unk00) { -// case 0: -// if (thing2->gdl) { -// for (i = 0; i < len; i++) { -// if (thing2->gdl == (Gfx *)sp208[i]) { -// thing2->gdl = (Gfx *)sp78[i]; -// break; -// } -// } -// } -// break; -// case 1: -// if ((u32)thing2->vertices < end2) { -// end2 = (u32)thing2->vertices; -// } -// break; -// } -// -// thing2++; -// } -// -// if (g_FogEnabled) { -// gfxReplaceGbiCommandsRecursively(g_Rooms[roomnum].gfxdata->unk08, 1); -// gfxReplaceGbiCommandsRecursively(g_Rooms[roomnum].gfxdata->unk0c, 5); -// } else if (var800a65e4 == 0) { -// gfxReplaceGbiCommandsRecursively(g_Rooms[roomnum].gfxdata->unk08, 6); -// gfxReplaceGbiCommandsRecursively(g_Rooms[roomnum].gfxdata->unk0c, 7); -// } -// -// bgFindRoomVtxBatches(roomnum); -// -// g_Rooms[roomnum].flags |= ROOMFLAG_DIRTY; -// g_Rooms[roomnum].flags |= ROOMFLAG_0200; -// g_Rooms[roomnum].colours = NULL; -// -// dyntexSetCurrentRoom(-1); -// } -// -//#if VERSION < VERSION_NTSC_1_0 -// bgVerifyLightSums("bg.c", 7474); -//#endif -//} +void bgLoadRoom(s32 roomnum) +{ + s32 size; // 2f4 + s32 inflatedlen; // 2f0 + u8 *allocation; + s32 readlen; + s32 fileoffset; + u8 *memaddr; + struct roomgfxdata18 *thing1; + struct roomgfxdata18 *thing2; + Gfx *v0; + s32 len; + Gfx *sp208[50]; + struct gfxvtx *sp140[50]; + Gfx *sp78[50]; + s32 allocationend; + Gfx *a2; + s32 i; // 6c + u32 end1; + u32 end2; + s32 prev; + +#if VERSION < VERSION_NTSC_1_0 + bgVerifyLightSums("bg.c", 7076); +#endif + + if (roomnum == 0 || roomnum >= g_Vars.roomcount || g_Rooms[roomnum].loaded240) { + return; + } + + if (g_Rooms[roomnum].gfxdatalen > 0) { + size = g_Rooms[roomnum].gfxdatalen; + + if (debug0f11edb0()) { + size += 1024; + } + } else { + size = memaGetLongestFree(); + } + + bgGarbageCollectRooms(size, false); + allocation = memaAlloc(size); + + if (allocation != NULL) { + dyntexSetCurrentRoom(roomnum); + + readlen = ((g_BgRooms[roomnum + 1].unk00 - g_BgRooms[roomnum].unk00) + 0xf) & ~0xf; + fileoffset = (g_BgPrimaryData + g_BgRooms[roomnum].unk00 - g_BgPrimaryData) + 0xf1000000; + fileoffset -= var8007fc54; + + if (size < readlen) { + dyntexSetCurrentRoom(-1); + return; + } + + memaddr = size - readlen + allocation; + bgLoadFile(memaddr, fileoffset, readlen); + + if (rzipIs1173(memaddr) && size < readlen + 0x20) { + dyntexSetCurrentRoom(-1); + return; + } + + inflatedlen = bgInflate(memaddr, allocation, g_BgRooms[roomnum + 1].unk00 - g_BgRooms[roomnum].unk00); + g_Rooms[roomnum].gfxdata = (struct roomgfxdata *)allocation; + + if (g_Rooms[roomnum].gfxdata->vertices) { + g_Rooms[roomnum].gfxdata->vertices = (struct gfxvtx *)((u32)g_Rooms[roomnum].gfxdata->vertices - g_BgRooms[roomnum].unk00 + (u32)allocation); + } + + if (g_Rooms[roomnum].gfxdata->colours) { + g_Rooms[roomnum].gfxdata->colours = (u32 *)((u32)g_Rooms[roomnum].gfxdata->colours - g_BgRooms[roomnum].unk00 + (u32)allocation); + } + + if (g_Rooms[roomnum].gfxdata->unk08) { + g_Rooms[roomnum].gfxdata->unk08 = (struct roomgfxdata18 *)((u32)g_Rooms[roomnum].gfxdata->unk08 - g_BgRooms[roomnum].unk00 + (u32)allocation); + } + + if (g_Rooms[roomnum].gfxdata->unk0c) { + g_Rooms[roomnum].gfxdata->unk0c = (struct roomgfxdata18 *)((u32)g_Rooms[roomnum].gfxdata->unk0c - g_BgRooms[roomnum].unk00 + (u32)allocation); + } + + thing1 = g_Rooms[roomnum].gfxdata->unk18; + end1 = (u32)g_Rooms[roomnum].gfxdata->vertices; + + while ((u32)(thing1 + 1) <= end1) { + switch (thing1->type) { + case 0: + if (thing1->next != NULL) { + thing1->next = (struct roomgfxdata18 *)((u32)thing1->next - g_BgRooms[roomnum].unk00 + (u32)allocation); + } + if (thing1->gdl != 0) { + thing1->gdl = (Gfx *)((u32)thing1->gdl - g_BgRooms[roomnum].unk00 + (u32)allocation); + } + if (thing1->vertices != 0) { + thing1->vertices = (struct gfxvtx *)((u32)thing1->vertices - g_BgRooms[roomnum].unk00 + (u32)allocation); + } + if (thing1->colours != 0) { + thing1->colours = (u32 *)((u32)thing1->colours - g_BgRooms[roomnum].unk00 + (u32)allocation); + } + break; + case 1: + if (thing1->next != NULL) { + thing1->next = (struct roomgfxdata18 *)((u32)thing1->next - g_BgRooms[roomnum].unk00 + (u32)allocation); + } + if (thing1->gdl != 0) { + thing1->gdl = (Gfx *)((u32)thing1->gdl - g_BgRooms[roomnum].unk00 + (u32)allocation); + } + if (thing1->vertices != 0) { + thing1->vertices = (struct gfxvtx *)((u32)thing1->vertices - g_BgRooms[roomnum].unk00 + (u32)allocation); + } + if (thing1->colours != 0) { + thing1->colours = (u32 *)((u32)thing1->colours - g_BgRooms[roomnum].unk00 + (u32)allocation); + } + if ((u32)thing1->vertices < end1) { + end1 = (u32)thing1->vertices; + } + break; + } + + thing1++; + } + + g_Rooms[roomnum].gfxdata->numvertices = ((u32)g_Rooms[roomnum].gfxdata->colours - (u32)g_Rooms[roomnum].gfxdata->vertices) / sizeof(struct gfxvtx); + g_Rooms[roomnum].gfxdata->numcolours = ((u32)room0f15dab4(roomnum, 0, VTXBATCHTYPE_OPA | VTXBATCHTYPE_XLU) - (u32)g_Rooms[roomnum].gfxdata->colours) / sizeof(u32); + + len = 0; + v0 = room0f15dab4(roomnum, NULL, VTXBATCHTYPE_OPA | VTXBATCHTYPE_XLU); + + while (v0) { + sp208[len] = v0; + sp140[len] = room0f15dbb4(roomnum, v0); + len++; + + v0 = room0f15dab4(roomnum, v0, VTXBATCHTYPE_OPA | VTXBATCHTYPE_XLU); + } + + sp208[len] = (Gfx *) ((s32)allocation + inflatedlen); + allocationend = (s32)allocation + size; + + tex0f175ef4(sp208[0], (Gfx *) (allocationend - ((s32)sp208[len] - (s32)sp208[0])), (s32)sp208[len] - (s32)sp208[0]); + + for (i = 0; i < len + 1; i++) { + sp78[i] = (Gfx *) ((s32)sp208[i] + (allocationend - (s32)sp208[len])); + } + + a2 = sp208[0]; + + for (i = 0; i < len; i++) { + v0 = (Gfx *) tex0f1756c0(sp78[i], (s32)sp208[i + 1] - (s32)sp208[i], a2, 0, (u32) sp140[i]); + sp78[i] = a2; + a2 = (Gfx *) ((s32) a2 + (s32) v0); + a2 = (Gfx *) ALIGN8((s32)a2); + } + + sp78[len] = a2; + + prev = g_Rooms[roomnum].gfxdatalen; + g_Rooms[roomnum].gfxdatalen = ALIGN16((s32)a2 - (s32)allocation + 0x20); + + if (g_Rooms[roomnum].gfxdatalen > prev) { +#if VERSION < VERSION_NTSC_1_0 + crashSetMessage("bg.c: roominf[room].allocsize > calculated!"); + CRASH(); +#endif + } + + g_Rooms[roomnum].loaded240 = 1; + + if (g_Rooms[roomnum].gfxdatalen != size) { + bool result = memaRealloc((s32)allocation, size, g_Rooms[roomnum].gfxdatalen); + } + + thing2 = g_Rooms[roomnum].gfxdata->unk18; + end2 = (u32)g_Rooms[roomnum].gfxdata->vertices; + + while ((u32)(thing2 + 1) <= end2) { + switch (thing2->type) { + case 0: + if (thing2->gdl) { + for (i = 0; i < len; i++) { + if (thing2->gdl == (Gfx *)sp208[i]) { + thing2->gdl = (Gfx *)sp78[i]; + break; + } + } + } + break; + case 1: + if ((u32)thing2->vertices < end2) { + end2 = (u32)thing2->vertices; + } + break; + } + + thing2++; + } + + if (g_FogEnabled) { + gfxReplaceGbiCommandsRecursively(g_Rooms[roomnum].gfxdata->unk08, 1); + gfxReplaceGbiCommandsRecursively(g_Rooms[roomnum].gfxdata->unk0c, 5); + } else if (var800a65e4 == 0) { + gfxReplaceGbiCommandsRecursively(g_Rooms[roomnum].gfxdata->unk08, 6); + gfxReplaceGbiCommandsRecursively(g_Rooms[roomnum].gfxdata->unk0c, 7); + } + + bgFindRoomVtxBatches(roomnum); + + g_Rooms[roomnum].flags |= ROOMFLAG_DIRTY; + g_Rooms[roomnum].flags |= ROOMFLAG_0200; + g_Rooms[roomnum].colours = NULL; + + dyntexSetCurrentRoom(-1); + } + +#if VERSION < VERSION_NTSC_1_0 + bgVerifyLightSums("bg.c", 7474); +#endif +} +#endif const char var7f1b7420[] = "Checking Convex Room %d"; const char var7f1b7438[] = " Portal %d %s%s%.1f < %.1f"; @@ -6629,6 +6636,7 @@ bool bgTestHitOnObj(struct coord *arg0, struct coord *arg1, struct coord *arg2, return hit; } +#if MATCHING GLOBAL_ASM( glabel bgTestHitOnChr /* f15ffdc: 27bdff10 */ addiu $sp,$sp,-240 @@ -7357,292 +7365,293 @@ glabel bgTestHitOnChr /* f160a30: 03e00008 */ jr $ra /* f160a34: 27bd00f0 */ addiu $sp,$sp,0xf0 ); - +#else // Mismatch: Some moderate reordering, likely related to variable reuse. // Note that the branch instruction at 16052c can appear and disappear due to // changing other things in the function. -//bool bgTestHitOnChr(struct model *model, struct coord *arg1, struct coord *arg2, struct coord *arg3, -// Gfx *gdl, Gfx *gdl2, struct gfxvtx *vertices, f32 *sqdistptr, struct hitthing *hitthing) -//{ -// s16 triref; // ee -// s32 trisremaining; // e8 -// bool intersectsbbox; // e4 -// s32 spdc; -// s32 spd8; -// bool hit; // cc -// struct gfxvtx *vtx; // c0 -// Mtxf *mtx; // a8 -// struct coord min; // 9c -// struct coord max; // 90 -// struct coord sp84; -// struct coord sp78; -// s32 points[3]; // 6c -// s32 v1; -// s32 numvertices; -// f32 *ptr; -// s32 i; -// struct coord *point1; -// struct coord *point2; -// struct coord *point3; -// Gfx *tri4gdl; -// -// spdc = 16; -// spd8 = 0; -// hit = false; -// -// while (true) { -// if (gdl->dma.cmd == G_ENDDL) { -// if (gdl2 != NULL) { -// gdl = gdl2; -// gdl2 = NULL; -// continue; -// } -// break; -// } else if (gdl->dma.cmd == G_MTX) { -// // 080 -// s32 mtxindex = (gdl->words.w1 & 0xffffff) / sizeof(Mtxf); -// mtx = &model->matrices[mtxindex]; -// } else if (gdl->dma.cmd == G_VTX) { -// // 0bc -// v1 = gdl->bytes[1] & 0xf; -// numvertices = ((u32)gdl->bytes[1] >> 4) + 1; -// vtx = (struct gfxvtx *)((u32)vertices + (gdl->words.w1 & 0xffffff)); -// -// if (v1 < spdc) { -// spdc = v1; -// } -// -// if (numvertices + v1 > spd8) { -// spd8 = numvertices + v1; -// } -// -// ptr = &var800a6470[v1 * 3]; -// -// while (numvertices > 0) { -// ptr[0] = vtx->x; -// ptr[1] = vtx->y; -// ptr[2] = vtx->z; -// -// mtx4TransformVecInPlace(mtx, (struct coord *) ptr); -// -// ptr += 3; -// vtx++; -// -// numvertices--; -// } -// -// ptr = &var800a6470[spdc]; -// -// min.x = ptr[0]; -// max.x = ptr[0]; -// min.y = ptr[1]; -// max.y = ptr[1]; -// min.z = ptr[2]; -// max.z = ptr[2]; -// -// ptr += 3; -// -// for (i = spdc; i < spd8; i++) { -// if (ptr[0] < min.x) { -// min.x = ptr[0]; -// } -// -// if (ptr[1] < min.y) { -// min.y = ptr[1]; -// } -// -// if (ptr[2] < min.z) { -// min.z = ptr[2]; -// } -// -// if (ptr[0] > max.x) { -// max.x = ptr[0]; -// } -// -// if (ptr[1] > max.y) { -// max.y = ptr[1]; -// } -// -// if (ptr[2] > max.z) { -// max.z = ptr[2]; -// } -// -// ptr += 3; -// } -// -// if ((arg1->x < min.x && arg2->x < min.x) -// || (arg1->x > max.x && arg2->x > max.x) -// || (arg1->y < min.y && arg2->y < min.y) -// || (arg1->y > max.y && arg2->y > max.y) -// || (arg1->z < min.z && arg2->z < min.z) -// || (arg1->z > max.z && arg2->z > max.z)) { -// intersectsbbox = false; -// } else { -// intersectsbbox = bgTestLineIntersectsBbox(arg1, arg3, &min, &max); -// } -// } else { -// // 3d4 -// if (!intersectsbbox) { -// gdl++; -// continue; -// } -// -// if ((gdl->dma.cmd != G_TRI1 && gdl->dma.cmd != G_TRI4)) { -// gdl++; -// continue; -// } -// -// if (gdl->dma.cmd == G_TRI1) { -// trisremaining = 0; -// triref = 0; -// points[0] = gdl->tri.tri.v[0] / 10; -// points[1] = gdl->tri.tri.v[1] / 10; -// points[2] = gdl->tri.tri.v[2] / 10; -// } else if (gdl->dma.cmd == G_TRI4) { -// tri4gdl = gdl; -// trisremaining = 3; -// triref = 1; -// points[0] = tri4gdl->tri4.x1; -// points[1] = tri4gdl->tri4.y1; -// points[2] = tri4gdl->tri4.z1; -// } -// -// do { -// if (points[0] == 0 && points[1] == 0 && points[2] == 0) { -// break; -// } -// -// point1 = (struct coord *) &var800a6470[points[0] * 3]; -// point2 = (struct coord *) &var800a6470[points[1] * 3]; -// point3 = (struct coord *) &var800a6470[points[2] * 3]; -// -// min.x = point1->x; -// max.x = point1->x; -// -// if (point2->x < min.x) { -// min.x = point2->x; -// } -// -// if (point2->x > max.x) { -// max.x = point2->x; -// } -// -// if (point3->x < min.x) { -// min.x = point3->x; -// } -// -// if (point3->x > max.x) { -// max.x = point3->x; -// } -// -// if (!(arg1->x < min.x && arg2->x < min.x) && !(arg1->x > max.x && arg2->x > max.x)) { -// min.z = point1->z; -// max.z = point1->z; -// -// if (point2->z < min.z) { -// min.z = point2->z; -// } -// -// if (point2->z > max.z) { -// max.z = point2->z; -// } -// -// if (point3->z < min.z) { -// min.z = point3->z; -// } -// -// if (point3->z > max.z) { -// max.z = point3->z; -// } -// -// if (!(arg1->z < min.z && arg2->z < min.z) && !(arg1->z > max.z && arg2->z > max.z)) { -// min.y = point1->y; -// max.y = point1->y; -// -// if (point2->y < min.y) { -// min.y = point2->y; -// } -// -// if (point2->y > max.y) { -// max.y = point2->y; -// } -// -// if (point3->y < min.y) { -// min.y = point3->y; -// } -// -// if (point3->y > max.y) { -// max.y = point3->y; -// } -// -// if (!(arg1->y < min.y && arg2->y < min.y) && !(arg1->y > max.y && arg2->y > max.y)) { -// if (bgTestLineIntersectsBbox(arg1, arg3, &min, &max) -// && func0002f560(point1, point2, point3, 0, arg1, arg2, arg3, &sp84, &sp78)) { -// f32 tmp; -// f32 sqdist; -// -// tmp = sp84.x - arg1->x; -// sqdist = tmp * tmp; -// -// tmp = sp84.y - arg1->y; -// sqdist += tmp * tmp; -// -// tmp = sp84.z - arg1->z; -// sqdist += tmp * tmp; -// -// if (sqdist < *sqdistptr) { -// hit = true; -// -// *sqdistptr = sqdist; -// -// hitthing->unk00.x = sp84.x; -// hitthing->unk00.y = sp84.y; -// hitthing->unk00.z = sp84.z; -// hitthing->unk0c.x = sp78.x; -// hitthing->unk0c.y = sp78.y; -// hitthing->unk0c.z = sp78.z; -// hitthing->unk18 = &vtx[points[0]]; -// hitthing->unk1c = &vtx[points[1]]; -// hitthing->unk20 = &vtx[points[2]]; -// hitthing->texturenum = -1; -// hitthing->unk28 = triref; -// hitthing->tricmd = gdl; -// } -// } -// } -// } -// } -// -// trisremaining--; -// -// if (1); -// if (1); -// if (1); -// -// if (trisremaining == 2) { -// points[0] = tri4gdl->tri4.x2; -// points[1] = tri4gdl->tri4.y2; -// points[2] = tri4gdl->tri4.z2; -// triref = 2; -// } else if (trisremaining == 1) { -// points[0] = tri4gdl->tri4.x3; -// points[1] = tri4gdl->tri4.y3; -// points[2] = tri4gdl->tri4.z3; -// triref = 3; -// } else if (trisremaining == 0) { -// points[0] = tri4gdl->tri4.x4; -// points[1] = tri4gdl->tri4.y4; -// points[2] = tri4gdl->tri4.z4; -// triref = 1; -// } -// } while (trisremaining >= 0); -// } -// -// gdl++; -// } -// -// return hit; -//} +bool bgTestHitOnChr(struct model *model, struct coord *arg1, struct coord *arg2, struct coord *arg3, + Gfx *gdl, Gfx *gdl2, struct gfxvtx *vertices, f32 *sqdistptr, struct hitthing *hitthing) +{ + s16 triref; // ee + s32 trisremaining; // e8 + bool intersectsbbox; // e4 + s32 spdc; + s32 spd8; + bool hit; // cc + struct gfxvtx *vtx; // c0 + Mtxf *mtx; // a8 + struct coord min; // 9c + struct coord max; // 90 + struct coord sp84; + struct coord sp78; + s32 points[3]; // 6c + s32 v1; + s32 numvertices; + f32 *ptr; + s32 i; + struct coord *point1; + struct coord *point2; + struct coord *point3; + Gfx *tri4gdl; + + spdc = 16; + spd8 = 0; + hit = false; + + while (true) { + if (gdl->dma.cmd == G_ENDDL) { + if (gdl2 != NULL) { + gdl = gdl2; + gdl2 = NULL; + continue; + } + break; + } else if (gdl->dma.cmd == G_MTX) { + // 080 + s32 mtxindex = (gdl->words.w1 & 0xffffff) / sizeof(Mtxf); + mtx = &model->matrices[mtxindex]; + } else if (gdl->dma.cmd == G_VTX) { + // 0bc + v1 = gdl->bytes[1] & 0xf; + numvertices = ((u32)gdl->bytes[1] >> 4) + 1; + vtx = (struct gfxvtx *)((u32)vertices + (gdl->words.w1 & 0xffffff)); + + if (v1 < spdc) { + spdc = v1; + } + + if (numvertices + v1 > spd8) { + spd8 = numvertices + v1; + } + + ptr = &var800a6470[v1 * 3]; + + while (numvertices > 0) { + ptr[0] = vtx->x; + ptr[1] = vtx->y; + ptr[2] = vtx->z; + + mtx4TransformVecInPlace(mtx, (struct coord *) ptr); + + ptr += 3; + vtx++; + + numvertices--; + } + + ptr = &var800a6470[spdc]; + + min.x = ptr[0]; + max.x = ptr[0]; + min.y = ptr[1]; + max.y = ptr[1]; + min.z = ptr[2]; + max.z = ptr[2]; + + ptr += 3; + + for (i = spdc; i < spd8; i++) { + if (ptr[0] < min.x) { + min.x = ptr[0]; + } + + if (ptr[1] < min.y) { + min.y = ptr[1]; + } + + if (ptr[2] < min.z) { + min.z = ptr[2]; + } + + if (ptr[0] > max.x) { + max.x = ptr[0]; + } + + if (ptr[1] > max.y) { + max.y = ptr[1]; + } + + if (ptr[2] > max.z) { + max.z = ptr[2]; + } + + ptr += 3; + } + + if ((arg1->x < min.x && arg2->x < min.x) + || (arg1->x > max.x && arg2->x > max.x) + || (arg1->y < min.y && arg2->y < min.y) + || (arg1->y > max.y && arg2->y > max.y) + || (arg1->z < min.z && arg2->z < min.z) + || (arg1->z > max.z && arg2->z > max.z)) { + intersectsbbox = false; + } else { + intersectsbbox = bgTestLineIntersectsBbox(arg1, arg3, &min, &max); + } + } else { + // 3d4 + if (!intersectsbbox) { + gdl++; + continue; + } + + if ((gdl->dma.cmd != G_TRI1 && gdl->dma.cmd != G_TRI4)) { + gdl++; + continue; + } + + if (gdl->dma.cmd == G_TRI1) { + trisremaining = 0; + triref = 0; + points[0] = gdl->tri.tri.v[0] / 10; + points[1] = gdl->tri.tri.v[1] / 10; + points[2] = gdl->tri.tri.v[2] / 10; + } else if (gdl->dma.cmd == G_TRI4) { + tri4gdl = gdl; + trisremaining = 3; + triref = 1; + points[0] = tri4gdl->tri4.x1; + points[1] = tri4gdl->tri4.y1; + points[2] = tri4gdl->tri4.z1; + } + + do { + if (points[0] == 0 && points[1] == 0 && points[2] == 0) { + break; + } + + point1 = (struct coord *) &var800a6470[points[0] * 3]; + point2 = (struct coord *) &var800a6470[points[1] * 3]; + point3 = (struct coord *) &var800a6470[points[2] * 3]; + + min.x = point1->x; + max.x = point1->x; + + if (point2->x < min.x) { + min.x = point2->x; + } + + if (point2->x > max.x) { + max.x = point2->x; + } + + if (point3->x < min.x) { + min.x = point3->x; + } + + if (point3->x > max.x) { + max.x = point3->x; + } + + if (!(arg1->x < min.x && arg2->x < min.x) && !(arg1->x > max.x && arg2->x > max.x)) { + min.z = point1->z; + max.z = point1->z; + + if (point2->z < min.z) { + min.z = point2->z; + } + + if (point2->z > max.z) { + max.z = point2->z; + } + + if (point3->z < min.z) { + min.z = point3->z; + } + + if (point3->z > max.z) { + max.z = point3->z; + } + + if (!(arg1->z < min.z && arg2->z < min.z) && !(arg1->z > max.z && arg2->z > max.z)) { + min.y = point1->y; + max.y = point1->y; + + if (point2->y < min.y) { + min.y = point2->y; + } + + if (point2->y > max.y) { + max.y = point2->y; + } + + if (point3->y < min.y) { + min.y = point3->y; + } + + if (point3->y > max.y) { + max.y = point3->y; + } + + if (!(arg1->y < min.y && arg2->y < min.y) && !(arg1->y > max.y && arg2->y > max.y)) { + if (bgTestLineIntersectsBbox(arg1, arg3, &min, &max) + && func0002f560(point1, point2, point3, 0, arg1, arg2, arg3, &sp84, &sp78)) { + f32 tmp; + f32 sqdist; + + tmp = sp84.x - arg1->x; + sqdist = tmp * tmp; + + tmp = sp84.y - arg1->y; + sqdist += tmp * tmp; + + tmp = sp84.z - arg1->z; + sqdist += tmp * tmp; + + if (sqdist < *sqdistptr) { + hit = true; + + *sqdistptr = sqdist; + + hitthing->unk00.x = sp84.x; + hitthing->unk00.y = sp84.y; + hitthing->unk00.z = sp84.z; + hitthing->unk0c.x = sp78.x; + hitthing->unk0c.y = sp78.y; + hitthing->unk0c.z = sp78.z; + hitthing->unk18 = &vtx[points[0]]; + hitthing->unk1c = &vtx[points[1]]; + hitthing->unk20 = &vtx[points[2]]; + hitthing->texturenum = -1; + hitthing->unk28 = triref; + hitthing->tricmd = gdl; + } + } + } + } + } + + trisremaining--; + + if (1); + if (1); + if (1); + + if (trisremaining == 2) { + points[0] = tri4gdl->tri4.x2; + points[1] = tri4gdl->tri4.y2; + points[2] = tri4gdl->tri4.z2; + triref = 2; + } else if (trisremaining == 1) { + points[0] = tri4gdl->tri4.x3; + points[1] = tri4gdl->tri4.y3; + points[2] = tri4gdl->tri4.z3; + triref = 3; + } else if (trisremaining == 0) { + points[0] = tri4gdl->tri4.x4; + points[1] = tri4gdl->tri4.y4; + points[2] = tri4gdl->tri4.z4; + triref = 1; + } + } while (trisremaining >= 0); + } + + gdl++; + } + + return hit; +} +#endif bool bgTestHitInVtxBatch(struct coord *arg0, struct coord *arg1, struct coord *arg2, struct vtxbatch *batch, s32 roomnum, struct hitthing *hitthing) { @@ -8191,6 +8200,7 @@ bool func0f161c08(struct coord *arg0, s16 roomnum) return true; } +#if MATCHING GLOBAL_ASM( glabel func0f161d30 /* f161d30: 27bdff60 */ addiu $sp,$sp,-160 @@ -8462,132 +8472,133 @@ glabel func0f161d30 /* f162120: 03e00008 */ jr $ra /* f162124: 27bd00a0 */ addiu $sp,$sp,0xa0 ); - +#else // Mismatch: Goal writes to sp40 and lower -//bool func0f161d30(struct coord *arg0, s16 roomnum) -//{ -// struct room *room; -// s32 portalnum; -// struct var800a4ccc *s2; -// struct portalvertices *pvertices; -// s32 i; -// s32 j; -// struct coord *cur; -// struct coord *next; -// f32 f0; -// f32 f18; -// s32 t4; -// bool t5; -// -// struct coord sp74; -// struct coord sp68; -// struct coord sp5c; -// f32 sp58; -// struct coord sp4c; -// -// room = &g_Rooms[roomnum]; -// -// sp74.f[0] = room->centre.f[0]; -// sp74.f[1] = room->centre.f[1]; -// sp74.f[2] = room->centre.f[2]; -// -// for (i = 0; i < room->numportals; i++) { -// portalnum = g_RoomPortals[room->roomportallistoffset + i]; -// pvertices = (struct portalvertices *)((u32)g_BgPortals + g_BgPortals[portalnum].verticesoffset); -// s2 = &var800a4ccc[portalnum]; -// -// f0 = arg0->f[0] * s2->coord.f[0] + arg0->f[1] * s2->coord.f[1] + arg0->f[2] * s2->coord.f[2]; -// f18 = sp74.f[0] * s2->coord.f[0] + sp74.f[1] * s2->coord.f[1] + sp74.f[2] * s2->coord.f[2]; -// -// if (f0 < s2->unk0c) { -// if (f18 < s2->unk0c) { -// continue; -// } -// } else { -// if (f0 > s2->unk10 && f18 > s2->unk10) { -// continue; -// } -// } -// -// sp68.f[0] = sp74.f[0] - arg0->f[0]; -// sp68.f[1] = sp74.f[1] - arg0->f[1]; -// sp68.f[2] = sp74.f[2] - arg0->f[2]; -// -// t4 = 0; -// t5 = true; -// cur = &pvertices->vertices[0]; -// next = &pvertices->vertices[1]; -// -// for (j = 0; j < pvertices->count; j++) { -// f32 tmp; -// f32 sp44; -// f32 sp40; -// f32 sp3c; -// f32 sp38; -// f32 sp34; -// f32 sp30; -// -// if (j + 1 == pvertices->count) { -// next = &pvertices->vertices[0]; -// } -// -// sp5c.f[0] = next->f[0] - cur->f[0]; -// sp5c.f[1] = next->f[1] - cur->f[1]; -// sp5c.f[2] = next->f[2] - cur->f[2]; -// -// sp44 = sp68.f[0]; -// sp40 = sp68.f[1]; -// sp3c = sp68.f[2]; -// -// sp38 = sp5c.f[0]; -// sp34 = sp5c.f[1]; -// sp30 = sp5c.f[2]; -// -// sp4c.f[0] = sp34 * sp3c - sp30 * sp40; -// sp4c.f[1] = sp30 * sp44 - sp38 * sp3c; -// sp4c.f[2] = sp38 * sp40 - sp34 * sp44; -// -// if (sp4c.f[0] * sp4c.f[0] + sp4c.f[1] * sp4c.f[1] + sp4c.f[2] * sp4c.f[2] == 0.0f) { -// t5 = false; -// break; -// } -// -// sp58 = sp4c.f[0] * cur->f[0] + sp4c.f[1] * cur->f[1] + sp4c.f[2] * cur->f[2]; -// tmp = sp4c.f[0] * arg0->f[0] + sp4c.f[1] * arg0->f[1] + sp4c.f[2] * arg0->f[2]; -// -// if (tmp < sp58) { -// if (t4 == 2) { -// t5 = false; -// break; -// } -// -// t4 = 1; -// } else if (t4 == 1) { -// t5 = false; -// break; -// } else { -// t4 = 2; -// } -// -// cur++; -// next++; -// } -// -// if (t5) { -// if (f0 < s2->unk0c) { -// if (roomnum == g_BgPortals[portalnum].roomnum2) { -// return false; -// } -// } else if (f0 > s2->unk10) { -// if (roomnum == g_BgPortals[portalnum].roomnum1) { -// return false; -// } -// } -// } -// } -// -// return true; -//} +bool func0f161d30(struct coord *arg0, s16 roomnum) +{ + struct room *room; + s32 portalnum; + struct var800a4ccc *s2; + struct portalvertices *pvertices; + s32 i; + s32 j; + struct coord *cur; + struct coord *next; + f32 f0; + f32 f18; + s32 t4; + bool t5; + + struct coord sp74; + struct coord sp68; + struct coord sp5c; + f32 sp58; + struct coord sp4c; + + room = &g_Rooms[roomnum]; + + sp74.f[0] = room->centre.f[0]; + sp74.f[1] = room->centre.f[1]; + sp74.f[2] = room->centre.f[2]; + + for (i = 0; i < room->numportals; i++) { + portalnum = g_RoomPortals[room->roomportallistoffset + i]; + pvertices = (struct portalvertices *)((u32)g_BgPortals + g_BgPortals[portalnum].verticesoffset); + s2 = &var800a4ccc[portalnum]; + + f0 = arg0->f[0] * s2->coord.f[0] + arg0->f[1] * s2->coord.f[1] + arg0->f[2] * s2->coord.f[2]; + f18 = sp74.f[0] * s2->coord.f[0] + sp74.f[1] * s2->coord.f[1] + sp74.f[2] * s2->coord.f[2]; + + if (f0 < s2->min) { + if (f18 < s2->min) { + continue; + } + } else { + if (f0 > s2->max && f18 > s2->max) { + continue; + } + } + + sp68.f[0] = sp74.f[0] - arg0->f[0]; + sp68.f[1] = sp74.f[1] - arg0->f[1]; + sp68.f[2] = sp74.f[2] - arg0->f[2]; + + t4 = 0; + t5 = true; + cur = &pvertices->vertices[0]; + next = &pvertices->vertices[1]; + + for (j = 0; j < pvertices->count; j++) { + f32 tmp; + f32 sp44; + f32 sp40; + f32 sp3c; + f32 sp38; + f32 sp34; + f32 sp30; + + if (j + 1 == pvertices->count) { + next = &pvertices->vertices[0]; + } + + sp5c.f[0] = next->f[0] - cur->f[0]; + sp5c.f[1] = next->f[1] - cur->f[1]; + sp5c.f[2] = next->f[2] - cur->f[2]; + + sp44 = sp68.f[0]; + sp40 = sp68.f[1]; + sp3c = sp68.f[2]; + + sp38 = sp5c.f[0]; + sp34 = sp5c.f[1]; + sp30 = sp5c.f[2]; + + sp4c.f[0] = sp34 * sp3c - sp30 * sp40; + sp4c.f[1] = sp30 * sp44 - sp38 * sp3c; + sp4c.f[2] = sp38 * sp40 - sp34 * sp44; + + if (sp4c.f[0] * sp4c.f[0] + sp4c.f[1] * sp4c.f[1] + sp4c.f[2] * sp4c.f[2] == 0.0f) { + t5 = false; + break; + } + + sp58 = sp4c.f[0] * cur->f[0] + sp4c.f[1] * cur->f[1] + sp4c.f[2] * cur->f[2]; + tmp = sp4c.f[0] * arg0->f[0] + sp4c.f[1] * arg0->f[1] + sp4c.f[2] * arg0->f[2]; + + if (tmp < sp58) { + if (t4 == 2) { + t5 = false; + break; + } + + t4 = 1; + } else if (t4 == 1) { + t5 = false; + break; + } else { + t4 = 2; + } + + cur++; + next++; + } + + if (t5) { + if (f0 < s2->min) { + if (roomnum == g_BgPortals[portalnum].roomnum2) { + return false; + } + } else if (f0 > s2->max) { + if (roomnum == g_BgPortals[portalnum].roomnum1) { + return false; + } + } + } + } + + return true; +} +#endif bool func0f162128(struct coord *arg0, s16 roomnum) { @@ -9008,6 +9019,7 @@ struct bgcmd *bgExecuteCommands(struct bgcmd *cmd) return bgExecuteCommandsBranch(cmd, true); } +#if MATCHING GLOBAL_ASM( glabel bgTickPortalsXray /* f162d9c: 27bdff48 */ addiu $sp,$sp,-184 @@ -9357,143 +9369,144 @@ glabel bgTickPortalsXray /* f1632cc: 03e00008 */ jr $ra /* f1632d0: 27bd00b8 */ addiu $sp,$sp,0xb8 ); - const char var7f1b75ac[] = "edist"; u32 edist = 400; +#else // Mismatch: Regalloc and some reordered instructions. Related to var800a4640. -//void bgTickPortalsXray(void) -//{ -// struct coord vismax; // ac -// struct coord vismin; // a0 -// struct coord eraserpos; // 94 -// struct coord vismid; // 88 -// struct player *player = g_Vars.currentplayer; -// s16 ymax; // 82 -// s16 xmax; // 80 -// s16 ymin; // 7e -// s16 xmin; // 7c -// struct stagetableentry *stage; -// s32 i; -// u32 stack; -// -// static u32 edist = 400; -// -// currentPlayerCalculateScreenProperties(); -// -// if (var8007fc34 < var8007fc30) { -// var8007fc34 = var8007fc30; -// } -// -// xmin = player->screenxminf; -// ymin = player->screenyminf; -// xmax = player->screenxmaxf; -// ymax = player->screenymaxf; -// -// if (bgunGetWeaponNum(HAND_RIGHT) == WEAPON_FARSIGHT && player->gunsightoff == 0) { -// player->eraserdepth = -500.0f / camGetLodScaleZ(); -// } else { -// player->eraserdepth = -500.0f; -// } -// -// eraserpos.f[0] = 0.0f; -// eraserpos.f[1] = 0.0f; -// eraserpos.f[2] = player->eraserdepth; -// -// mtx4TransformVecInPlace(camGetProjectionMtxF(), &eraserpos); -// -// player->eraserpos.f[0] = eraserpos.f[0]; -// player->eraserpos.f[1] = eraserpos.f[1]; -// player->eraserpos.f[2] = eraserpos.f[2]; -// -// mainOverrideVariable("edist", &edist); -// -// stage = stageGetCurrent(); -// -// player->eraserpropdist = stage->eraserpropdist; -// player->eraserbgdist = (f32) stage->eraserpropdist + stage->unk30; -// -// vismax.f[0] = eraserpos.f[0] + player->eraserbgdist; -// vismax.f[1] = eraserpos.f[1] + player->eraserbgdist; -// vismax.f[2] = eraserpos.f[2] + player->eraserbgdist; -// -// vismin.f[0] = eraserpos.f[0] - player->eraserbgdist; -// vismin.f[1] = eraserpos.f[1] - player->eraserbgdist; -// vismin.f[2] = eraserpos.f[2] - player->eraserbgdist; -// -// vismid.f[0] = eraserpos.f[0]; -// vismid.f[1] = eraserpos.f[1]; -// vismid.f[2] = eraserpos.f[2]; -// -// var8007fc2c = 0; -// var8007fc30 = 0; -// -// var800a4640.unk2d0.roomnum = -1; -// var800a4640.unk2d0.draworder = 255; -// var800a4640.unk2d0.box.xmin = xmin; -// var800a4640.unk2d0.box.ymin = ymin; -// var800a4640.unk2d0.box.xmax = xmax; -// var800a4640.unk2d0.box.ymax = ymax; -// -// var800a4ce6 = 0; -// var800a4ce4 = 0x7fff; -// -// for (i = 1; i < g_Vars.roomcount; i++) { -// if (!(vismax.f[0] < g_Rooms[i].bbmin[0]) && !(vismin.f[0] > g_Rooms[i].bbmax[0]) -// && !(vismax.f[2] < g_Rooms[i].bbmin[2]) && !(vismin.f[2] > g_Rooms[i].bbmax[2]) -// && !(vismax.f[1] < g_Rooms[i].bbmin[1]) && !(vismin.f[1] > g_Rooms[i].bbmax[1])) { -// s32 index = var8007fc2c; -// -// if (1); -// if (1); -// -// if (index < 60) { -// f32 x; -// f32 y; -// f32 z; -// -// if (var800a4640.unk000[index].roomnum); \ -// g_Rooms[i].flags |= ROOMFLAG_ONSCREEN; -// -// var800a4640.unk000[index].roomnum = i; -// -// roomUnpauseProps(i, false); -// -// x = (g_Rooms[i].bbmin[0] + g_Rooms[i].bbmax[0]) / 2.0f - vismid.f[0]; -// y = (g_Rooms[i].bbmin[1] + g_Rooms[i].bbmax[1]) / 2.0f - vismid.f[1]; -// z = (g_Rooms[i].bbmin[2] + g_Rooms[i].bbmax[2]) / 2.0f - vismid.f[2]; -// -// var800a4640.unk000[index].draworder = sqrtf(x * x + y * y + z * z) / 100.0f; -// -// if (var800a4640.unk000[index].draworder > var800a4ce6) { -// var800a4ce6 = var800a4640.unk000[index].draworder; -// } -// -// if (var800a4640.unk000[index].draworder < var800a4ce4) { -// var800a4ce4 = var800a4640.unk000[index].draworder; -// } -// -// var800a4640.unk000[index].box.xmin = xmin; -// var800a4640.unk000[index].box.ymin = ymin; -// var800a4640.unk000[index].box.xmax = xmax; -// var800a4640.unk000[index].box.ymax = ymax; -// -// var8007fc2c++; -// var8007fc30++; -// -// g_Rooms[player->cam_room].flags |= ROOMFLAG_ONSCREEN; -// } else { -// // empty -// } -// } -// } -// -// bgChooseRoomsToLoad(); -// -// if (1); -// if (1); -//} +void bgTickPortalsXray(void) +{ + struct coord vismax; // ac + struct coord vismin; // a0 + struct coord eraserpos; // 94 + struct coord vismid; // 88 + struct player *player = g_Vars.currentplayer; + s16 ymax; // 82 + s16 xmax; // 80 + s16 ymin; // 7e + s16 xmin; // 7c + struct stagetableentry *stage; + s32 i; + u32 stack; + + static u32 edist = 400; + + currentPlayerCalculateScreenProperties(); + + if (var8007fc34 < var8007fc30) { + var8007fc34 = var8007fc30; + } + + xmin = player->screenxminf; + ymin = player->screenyminf; + xmax = player->screenxmaxf; + ymax = player->screenymaxf; + + if (bgunGetWeaponNum(HAND_RIGHT) == WEAPON_FARSIGHT && player->gunsightoff == 0) { + player->eraserdepth = -500.0f / camGetLodScaleZ(); + } else { + player->eraserdepth = -500.0f; + } + + eraserpos.f[0] = 0.0f; + eraserpos.f[1] = 0.0f; + eraserpos.f[2] = player->eraserdepth; + + mtx4TransformVecInPlace(camGetProjectionMtxF(), &eraserpos); + + player->eraserpos.f[0] = eraserpos.f[0]; + player->eraserpos.f[1] = eraserpos.f[1]; + player->eraserpos.f[2] = eraserpos.f[2]; + + mainOverrideVariable("edist", &edist); + + stage = stageGetCurrent(); + + player->eraserpropdist = stage->eraserpropdist; + player->eraserbgdist = (f32) stage->eraserpropdist + stage->unk30; + + vismax.f[0] = eraserpos.f[0] + player->eraserbgdist; + vismax.f[1] = eraserpos.f[1] + player->eraserbgdist; + vismax.f[2] = eraserpos.f[2] + player->eraserbgdist; + + vismin.f[0] = eraserpos.f[0] - player->eraserbgdist; + vismin.f[1] = eraserpos.f[1] - player->eraserbgdist; + vismin.f[2] = eraserpos.f[2] - player->eraserbgdist; + + vismid.f[0] = eraserpos.f[0]; + vismid.f[1] = eraserpos.f[1]; + vismid.f[2] = eraserpos.f[2]; + + var8007fc2c = 0; + var8007fc30 = 0; + + var800a4640.unk2d0.roomnum = -1; + var800a4640.unk2d0.draworder = 255; + var800a4640.unk2d0.box.xmin = xmin; + var800a4640.unk2d0.box.ymin = ymin; + var800a4640.unk2d0.box.xmax = xmax; + var800a4640.unk2d0.box.ymax = ymax; + + var800a4ce6 = 0; + var800a4ce4 = 0x7fff; + + for (i = 1; i < g_Vars.roomcount; i++) { + if (!(vismax.f[0] < g_Rooms[i].bbmin[0]) && !(vismin.f[0] > g_Rooms[i].bbmax[0]) + && !(vismax.f[2] < g_Rooms[i].bbmin[2]) && !(vismin.f[2] > g_Rooms[i].bbmax[2]) + && !(vismax.f[1] < g_Rooms[i].bbmin[1]) && !(vismin.f[1] > g_Rooms[i].bbmax[1])) { + s32 index = var8007fc2c; + + if (1); + if (1); + + if (index < 60) { + f32 x; + f32 y; + f32 z; + + if (var800a4640.unk000[index].roomnum); \ + g_Rooms[i].flags |= ROOMFLAG_ONSCREEN; + + var800a4640.unk000[index].roomnum = i; + + roomUnpauseProps(i, false); + + x = (g_Rooms[i].bbmin[0] + g_Rooms[i].bbmax[0]) / 2.0f - vismid.f[0]; + y = (g_Rooms[i].bbmin[1] + g_Rooms[i].bbmax[1]) / 2.0f - vismid.f[1]; + z = (g_Rooms[i].bbmin[2] + g_Rooms[i].bbmax[2]) / 2.0f - vismid.f[2]; + + var800a4640.unk000[index].draworder = sqrtf(x * x + y * y + z * z) / 100.0f; + + if (var800a4640.unk000[index].draworder > var800a4ce6) { + var800a4ce6 = var800a4640.unk000[index].draworder; + } + + if (var800a4640.unk000[index].draworder < var800a4ce4) { + var800a4ce4 = var800a4640.unk000[index].draworder; + } + + var800a4640.unk000[index].box.xmin = xmin; + var800a4640.unk000[index].box.ymin = ymin; + var800a4640.unk000[index].box.xmax = xmax; + var800a4640.unk000[index].box.ymax = ymax; + + var8007fc2c++; + var8007fc30++; + + g_Rooms[player->cam_room].flags |= ROOMFLAG_ONSCREEN; + } else { + // empty + } + } + } + + bgChooseRoomsToLoad(); + + if (1); + if (1); +} +#endif void func0f1632d4(s16 roomnum1, s16 roomnum2, s16 draworder, struct screenbox *box) { diff --git a/src/game/bodyreset.c b/src/game/bodyreset.c index 002fdc61f..4af4c77be 100644 --- a/src/game/bodyreset.c +++ b/src/game/bodyreset.c @@ -21,6 +21,7 @@ struct stageheadlimit g_StageHeadLimits[3] = { u32 var80061708 = 0x00000000; u32 var8006170c = 0x00000000; +#if MATCHING GLOBAL_ASM( glabel bodiesReset /* f00b820: 27bdffd0 */ addiu $sp,$sp,-48 @@ -267,92 +268,93 @@ glabel bodiesReset /* f00bb68: 03e00008 */ jr $ra /* f00bb6c: 27bd0030 */ addiu $sp,$sp,0x30 ); - +#else // Mismatches: // - Address of var80062b14 Should be loaded to a callee-save register // - PLAYERCOUNT() calculation is more spread out // (does other register preparation during calculation) // - Loop at 950 is calculated differently -//void bodiesReset(s32 stagenum) -//{ -// s32 *headsavailablelist; -// s32 headsavailablelen; -// bool done; -// s32 i; -// s32 j; -// -// for (i = 0; g_HeadsAndBodies[i].bodyfileid; i++) { -// g_HeadsAndBodies[i].unk0c = NULL; -// } -// -// var80062c80 = random() % g_NumBondBodies; -// var80062b14 = 0; -// var80062b18 = 0; -// -// if (PLAYERCOUNT() >= 2) { -// g_NumActiveHeadsPerGender = 4; -// } else { -// // 950 -// g_NumActiveHeadsPerGender = 8; -// -// for (i = 0; i < ARRAYCOUNT(g_StageHeadLimits); i++) { -// if (g_StageHeadLimits[i].stagenum == stagenum) { -// g_NumActiveHeadsPerGender = g_StageHeadLimits[i].maxheads; -// } -// } -// } -// -// // Male heads -// if (cheatIsActive(CHEAT_TEAMHEADSONLY)) { -// headsavailablelist = g_MaleGuardTeamHeads; -// headsavailablelen = g_NumMaleGuardTeamHeads; -// } else { -// headsavailablelist = g_MaleGuardHeads; -// headsavailablelen = g_NumMaleGuardHeads; -// } -// -// for (i = 0; i < g_NumActiveHeadsPerGender; i++) { -// do { -// done = true; -// g_ActiveMaleHeads[i] = headsavailablelist[random() % headsavailablelen]; -// -// if (headsavailablelen > g_NumActiveHeadsPerGender) { -// for (j = 0; j < i; j++) { -// if (g_ActiveMaleHeads[i] == g_ActiveMaleHeads[j]) { -// done = false; -// } -// } -// } -// } while (!done); -// } -// -// // Female heads -// if (cheatIsActive(CHEAT_TEAMHEADSONLY)) { -// headsavailablelist = g_FemaleGuardTeamHeads; -// headsavailablelen = g_NumFemaleGuardTeamHeads; -// } else { -// headsavailablelist = g_FemaleGuardHeads; -// headsavailablelen = g_NumFemaleGuardHeads; -// } -// -// for (i = 0; i < g_NumActiveHeadsPerGender; i++) { -// do { -// done = true; -// g_ActiveFemaleHeads[i] = headsavailablelist[random() % headsavailablelen]; -// -// if (headsavailablelen > g_NumActiveHeadsPerGender) { -// for (j = 0; j < i; j++) { -// if (g_ActiveFemaleHeads[i] == g_ActiveFemaleHeads[j]) { -// done = false; -// } -// } -// } -// } while (!done); -// } -// -// g_ActiveMaleHeadsIndex = 0; -// g_ActiveFemaleHeadsIndex = 0; -// -// for (i = 0; i < g_NumActiveHeadsPerGender; i++); -// for (i = 0; i < g_NumActiveHeadsPerGender; i++); -//} +void bodiesReset(s32 stagenum) +{ + s32 *headsavailablelist; + s32 headsavailablelen; + bool done; + s32 i; + s32 j; + + for (i = 0; g_HeadsAndBodies[i].filenum; i++) { + g_HeadsAndBodies[i].filedata = NULL; + } + + var80062c80 = random() % g_NumBondBodies; + var80062b14 = 0; + var80062b18 = 0; + + if (PLAYERCOUNT() >= 2) { + g_NumActiveHeadsPerGender = 4; + } else { + // 950 + g_NumActiveHeadsPerGender = 8; + + for (i = 0; i < ARRAYCOUNT(g_StageHeadLimits); i++) { + if (g_StageHeadLimits[i].stagenum == stagenum) { + g_NumActiveHeadsPerGender = g_StageHeadLimits[i].maxheads; + } + } + } + + // Male heads + if (cheatIsActive(CHEAT_TEAMHEADSONLY)) { + headsavailablelist = g_MaleGuardTeamHeads; + headsavailablelen = g_NumMaleGuardTeamHeads; + } else { + headsavailablelist = g_MaleGuardHeads; + headsavailablelen = g_NumMaleGuardHeads; + } + + for (i = 0; i < g_NumActiveHeadsPerGender; i++) { + do { + done = true; + g_ActiveMaleHeads[i] = headsavailablelist[random() % headsavailablelen]; + + if (headsavailablelen > g_NumActiveHeadsPerGender) { + for (j = 0; j < i; j++) { + if (g_ActiveMaleHeads[i] == g_ActiveMaleHeads[j]) { + done = false; + } + } + } + } while (!done); + } + + // Female heads + if (cheatIsActive(CHEAT_TEAMHEADSONLY)) { + headsavailablelist = g_FemaleGuardTeamHeads; + headsavailablelen = g_NumFemaleGuardTeamHeads; + } else { + headsavailablelist = g_FemaleGuardHeads; + headsavailablelen = g_NumFemaleGuardHeads; + } + + for (i = 0; i < g_NumActiveHeadsPerGender; i++) { + do { + done = true; + g_ActiveFemaleHeads[i] = headsavailablelist[random() % headsavailablelen]; + + if (headsavailablelen > g_NumActiveHeadsPerGender) { + for (j = 0; j < i; j++) { + if (g_ActiveFemaleHeads[i] == g_ActiveFemaleHeads[j]) { + done = false; + } + } + } + } while (!done); + } + + g_ActiveMaleHeadsIndex = 0; + g_ActiveFemaleHeadsIndex = 0; + + for (i = 0; i < g_NumActiveHeadsPerGender; i++); + for (i = 0; i < g_NumActiveHeadsPerGender; i++); +} +#endif diff --git a/src/game/bondgun.c b/src/game/bondgun.c index 2b3c5535a..6a0d0f556 100644 --- a/src/game/bondgun.c +++ b/src/game/bondgun.c @@ -7410,6 +7410,7 @@ struct guncmd var80070200[2] = { { GUNCMD_END }, }; +#if MATCHING GLOBAL_ASM( glabel bgunAutoSwitchWeapon /* f0a1df4: 27bdff98 */ addiu $sp,$sp,-104 @@ -7600,7 +7601,7 @@ glabel bgunAutoSwitchWeapon /* f0a2088: 03e00008 */ jr $ra /* f0a208c: 27bd0068 */ addiu $sp,$sp,0x68 ); - +#else /** * Automatically choose and equip a new weapon after trying to fire a weapon * which is out of ammo. @@ -7629,121 +7630,122 @@ glabel bgunAutoSwitchWeapon // Mismatch: First loop should store pointer to current item in s3 and do an // address comparison for the end, but the below stores index in s4 and does an // integer comparison. Variable refcounts affects this so might be related. -//void bgunAutoSwitchWeapon(void) -//{ -// s32 i; -// bool foundcurrent2; -// s32 firstweaponnum2; -// bool usable; -// s32 firstweaponnum = -1; // 50 -// s32 newweaponnum = -1; -// bool foundcurrent = false; // 48 -// s32 curweaponnum = g_Vars.currentplayer->gunctrl.weaponnum; // 44 -// s32 foundsuperdragon = 0; -// s32 wantammo = false; // 40 -// s32 weaponnum; -// struct weapon *weapon; -// struct weaponfunc *func; -// s32 weaponnum2; -// -// if (g_Vars.tickmode == TICKMODE_CUTSCENE) { -// return; -// } -// -// // Loop through g_AutoSwitchWeaponsPrimary, checking which weapons the -// // player has which are usable. Stop when both any usable weapon is found -// // and when the player's current weapon is found. Note the first and last -// // usable weapons. -// for (i = 0; i < ARRAYCOUNT(g_AutoSwitchWeaponsPrimary) && (newweaponnum == -1 || !foundcurrent); i++) { -// usable = false; -// -// if (invHasSingleWeaponIncAllGuns(g_AutoSwitchWeaponsPrimary[i])) { -// weaponnum = g_AutoSwitchWeaponsPrimary[i]; -// weapon = weaponFindById(weaponnum); -// func = weaponGetFunctionById(weaponnum, FUNC_PRIMARY); -// -// if (!bgun0f0990b0(func, weapon) && (func->flags & FUNCFLAG_AUTOSWITCHUNSELECTABLE) == 0) { -// usable = true; -// } -// -// if (weaponnum == WEAPON_SUPERDRAGON && !foundsuperdragon) { -// foundsuperdragon++; -// } else { -// func = weaponGetFunctionById(weaponnum, FUNC_SECONDARY); -// -// if (!bgun0f0990b0(func, weapon) && (func->flags & FUNCFLAG_AUTOSWITCHUNSELECTABLE) == 0) { -// usable = true; -// } -// } -// -// if (weaponnum == curweaponnum) { -// foundcurrent = true; -// } else if (usable) { -// newweaponnum = weaponnum; -// -// if (firstweaponnum == -1) { -// firstweaponnum = weaponnum; -// } -// } -// } -// } -// -// foundcurrent2 = false; -// firstweaponnum2 = -1; -// -// if (!foundcurrent) { -// newweaponnum = firstweaponnum; -// } -// -// if (newweaponnum == -1) { -// newweaponnum = WEAPON_UNARMED; -// } -// -// if (newweaponnum == WEAPON_UNARMED) { -// // No usable weapon was found in the primary array, -// // so search the secondary array. -// for (i = 0; i < ARRAYCOUNT(g_AutoSwitchWeaponsSecondary); i++) { -// weaponnum2 = g_AutoSwitchWeaponsSecondary[i]; -// -// if (invHasSingleWeaponIncAllGuns(weaponnum2)) { -// if (weaponnum2 == curweaponnum) { -// foundcurrent2 = true; -// } -// -// if (firstweaponnum2 == -1) { -// firstweaponnum2 = weaponnum2; -// } -// } -// } -// -// newweaponnum = firstweaponnum2; -// -// if (newweaponnum == -1) { -// newweaponnum = WEAPON_UNARMED; -// } -// -// if (foundcurrent2) { -// newweaponnum = -1; -// } -// -// wantammo = true; -// } -// -// // Switch to newweaponnum -// if (newweaponnum >= 0 && newweaponnum != curweaponnum) { -// if (invHasDoubleWeaponIncAllGuns(newweaponnum, newweaponnum)) { -// g_Vars.currentplayer->gunctrl.dualwielding = true; -// } else { -// g_Vars.currentplayer->gunctrl.dualwielding = false; -// } -// -// bgunEquipWeapon(newweaponnum); -// -// if (wantammo) { -// g_Vars.currentplayer->gunctrl.wantammo = true; -// } -// } -//} +void bgunAutoSwitchWeapon(void) +{ + s32 i; + bool foundcurrent2; + s32 firstweaponnum2; + bool usable; + s32 firstweaponnum = -1; // 50 + s32 newweaponnum = -1; + bool foundcurrent = false; // 48 + s32 curweaponnum = g_Vars.currentplayer->gunctrl.weaponnum; // 44 + s32 foundsuperdragon = 0; + s32 wantammo = false; // 40 + s32 weaponnum; + struct weapon *weapon; + struct weaponfunc *func; + s32 weaponnum2; + + if (g_Vars.tickmode == TICKMODE_CUTSCENE) { + return; + } + + // Loop through g_AutoSwitchWeaponsPrimary, checking which weapons the + // player has which are usable. Stop when both any usable weapon is found + // and when the player's current weapon is found. Note the first and last + // usable weapons. + for (i = 0; i < ARRAYCOUNT(g_AutoSwitchWeaponsPrimary) && (newweaponnum == -1 || !foundcurrent); i++) { + usable = false; + + if (invHasSingleWeaponIncAllGuns(g_AutoSwitchWeaponsPrimary[i])) { + weaponnum = g_AutoSwitchWeaponsPrimary[i]; + weapon = weaponFindById(weaponnum); + func = weaponGetFunctionById(weaponnum, FUNC_PRIMARY); + + if (!bgun0f0990b0(func, weapon) && (func->flags & FUNCFLAG_AUTOSWITCHUNSELECTABLE) == 0) { + usable = true; + } + + if (weaponnum == WEAPON_SUPERDRAGON && !foundsuperdragon) { + foundsuperdragon++; + } else { + func = weaponGetFunctionById(weaponnum, FUNC_SECONDARY); + + if (!bgun0f0990b0(func, weapon) && (func->flags & FUNCFLAG_AUTOSWITCHUNSELECTABLE) == 0) { + usable = true; + } + } + + if (weaponnum == curweaponnum) { + foundcurrent = true; + } else if (usable) { + newweaponnum = weaponnum; + + if (firstweaponnum == -1) { + firstweaponnum = weaponnum; + } + } + } + } + + foundcurrent2 = false; + firstweaponnum2 = -1; + + if (!foundcurrent) { + newweaponnum = firstweaponnum; + } + + if (newweaponnum == -1) { + newweaponnum = WEAPON_UNARMED; + } + + if (newweaponnum == WEAPON_UNARMED) { + // No usable weapon was found in the primary array, + // so search the secondary array. + for (i = 0; i < ARRAYCOUNT(g_AutoSwitchWeaponsSecondary); i++) { + weaponnum2 = g_AutoSwitchWeaponsSecondary[i]; + + if (invHasSingleWeaponIncAllGuns(weaponnum2)) { + if (weaponnum2 == curweaponnum) { + foundcurrent2 = true; + } + + if (firstweaponnum2 == -1) { + firstweaponnum2 = weaponnum2; + } + } + } + + newweaponnum = firstweaponnum2; + + if (newweaponnum == -1) { + newweaponnum = WEAPON_UNARMED; + } + + if (foundcurrent2) { + newweaponnum = -1; + } + + wantammo = true; + } + + // Switch to newweaponnum + if (newweaponnum >= 0 && newweaponnum != curweaponnum) { + if (invHasDoubleWeaponIncAllGuns(newweaponnum, newweaponnum)) { + g_Vars.currentplayer->gunctrl.dualwielding = true; + } else { + g_Vars.currentplayer->gunctrl.dualwielding = false; + } + + bgunEquipWeapon(newweaponnum); + + if (wantammo) { + g_Vars.currentplayer->gunctrl.wantammo = true; + } + } +} +#endif void bgunEquipWeapon2(s32 handnum, s32 weaponnum) { @@ -8974,6 +8976,7 @@ void bgun0f0a45d0(struct hand *hand, struct modelfiledata *filedata, bool isdeto } } +#if MATCHING #if VERSION >= VERSION_JPN_FINAL GLOBAL_ASM( glabel bgun0f0a46a4 @@ -11187,107 +11190,108 @@ glabel var7f1ac918 /* f0a4e40: 27bd00e0 */ addiu $sp,$sp,0xe0 ); #endif - +#else /** * With this function stubbed, the tranquilizer's spent ammo does not detach * when reloading, and the pulled pin on grenades and nbombs appears to move * with the model rather than detaching properly. */ -//void bgun0f0a46a4(struct hand *hand, struct modelfiledata *modeldef, bool isdetonator) -//{ -// struct coord spd0; -// Mtxf sp90; -// struct coord sp84; -// Mtxf sp44; -// s32 i; -// f32 lvupdate; -// f32 newval; -// f32 sumval; -// -// switch (hand->unk0d0e_00) { -// case 1: -// // 6e4 -// switch (hand->unk0d0e_04) { -// case 0: -// // 710 -// hand->unk0d20.f[0] = (RANDOMFRAC() - 0.5f) * 0.5333333f * 0.0625f + 0.5333333f; -// hand->unk0d20.f[1] = 0.0f; -// hand->unk0d20.f[2] = RANDOMFRAC() * 2.5f * 0.0625f + 2.5f; -// spd0.f[0] = 2.0f * RANDOMFRAC() * M_BADTAU / 184.0f - 0.03414231f; -// spd0.f[1] = 2.0f * RANDOMFRAC() * M_BADTAU / 184.0f - 0.03414231f; -// spd0.f[2] = 2.0f * RANDOMFRAC() * M_BADTAU / 184.0f - 0.03414231f; -// break; -// case 1: -// // 8b8 -// hand->unk0d20.f[0] = -((RANDOMFRAC() - 0.5f) * 0.5333333f * 0.0625f + 3.0f * 0.5333333f); -// hand->unk0d20.f[1] = RANDOMFRAC() * 2.5f * 0.125f + 2.5f; -// hand->unk0d20.f[2] = -(RANDOMFRAC() + 1.0f); -// spd0.f[0] = (RANDOMFRAC() + 3.0f) * M_BADTAU / 208.0f; -// spd0.f[1] = 2.0f * RANDOMFRAC() * M_BADTAU / 544.0f - 0.0115481345f; -// spd0.f[2] = 2.0f * RANDOMFRAC() * M_BADTAU / 544.0f - 0.0115481345f; -// break; -// case 2: -// // aa4 -// hand->unk0d20.f[0] = 0.0f; -// hand->unk0d20.f[1] = RANDOMFRAC() * 2.5f * 0.125f + 2.5f; -// hand->unk0d20.f[2] = (RANDOMFRAC() + 1.0f) * 0.25f; -// spd0.f[0] = (RANDOMFRAC() + 3.0f) * M_BADTAU / 368.0f; -// spd0.f[1] = 2.0f * RANDOMFRAC() * M_BADTAU / 944.0f - 0.006654857f; -// spd0.f[2] = 2.0f * RANDOMFRAC() * M_BADTAU / 944.0f - 0.006654857f; -// break; -// } -// -// // c28 -// hand->unk0d10 = hand->unk0d14 - 200.0f; -// -// mtx4LoadRotation(&spd0, &sp90); -// mtx4ToMtx3(&sp90, hand->unk0d50); -// -// if (g_Vars.lvupdate240 > 0 && hand->unk0d0e_04) { -// sp84.x = (hand->posmtx.m[3][0] - hand->prevmtx.m[3][0]) / g_Vars.lvupdate240f; -// sp84.y = (hand->posmtx.m[3][1] - hand->prevmtx.m[3][1]) / g_Vars.lvupdate240f; -// sp84.z = (hand->posmtx.m[3][2] - hand->prevmtx.m[3][2]) / g_Vars.lvupdate240f; -// -// mtx00017588(hand->posmtx.m, sp44.m); -// mtx4RotateVecInPlace(&sp44, &sp84); -// -// hand->unk0d20.f[0] += sp84.x * 0.3f; -// hand->unk0d20.f[1] += sp84.y * 0.3f; -// hand->unk0d20.f[2] += sp84.z * 0.3f; -// } -// -// hand->unk0d0e_00 = 2; -// break; -// case 2: -// // d28 -// lvupdate = g_Vars.lvupdate240f; -// -// if (g_Vars.currentplayer->isdead && lvupdate > 1.5f) { -// lvupdate = 1.5f; -// } -// -// newval = hand->unk0d20.f[1] - lvupdate * 0.2777778f; -// -// if (hand->unk0d18 < hand->unk0d10) { -// hand->unk0d0e_00 = 3; -// break; -// } -// -// sumval = hand->unk0d20.f[1] + newval; -// -// hand->unk0d20.f[1] = newval; -// -// hand->unk0d14 += lvupdate * hand->unk0d20.f[0]; -// hand->unk0d18 += lvupdate * 0.5f * sumval; -// hand->unk0d1c += lvupdate * hand->unk0d20.f[2]; -// -// for (i = 0; i < g_Vars.lvupdate240; i++) { -// mtx00016110(hand->unk0d50, hand->unk0d2c); -// } -// -// break; -// } -//} +void bgun0f0a46a4(struct hand *hand, struct modelfiledata *modeldef, bool isdetonator) +{ + struct coord spd0; + Mtxf sp90; + struct coord sp84; + Mtxf sp44; + s32 i; + f32 lvupdate; + f32 newval; + f32 sumval; + + switch (hand->unk0d0e_00) { + case 1: + // 6e4 + switch (hand->unk0d0e_04) { + case 0: + // 710 + hand->unk0d20.f[0] = (RANDOMFRAC() - 0.5f) * 0.5333333f * 0.0625f + 0.5333333f; + hand->unk0d20.f[1] = 0.0f; + hand->unk0d20.f[2] = RANDOMFRAC() * 2.5f * 0.0625f + 2.5f; + spd0.f[0] = 2.0f * RANDOMFRAC() * M_BADTAU / 184.0f - 0.03414231f; + spd0.f[1] = 2.0f * RANDOMFRAC() * M_BADTAU / 184.0f - 0.03414231f; + spd0.f[2] = 2.0f * RANDOMFRAC() * M_BADTAU / 184.0f - 0.03414231f; + break; + case 1: + // 8b8 + hand->unk0d20.f[0] = -((RANDOMFRAC() - 0.5f) * 0.5333333f * 0.0625f + 3.0f * 0.5333333f); + hand->unk0d20.f[1] = RANDOMFRAC() * 2.5f * 0.125f + 2.5f; + hand->unk0d20.f[2] = -(RANDOMFRAC() + 1.0f); + spd0.f[0] = (RANDOMFRAC() + 3.0f) * M_BADTAU / 208.0f; + spd0.f[1] = 2.0f * RANDOMFRAC() * M_BADTAU / 544.0f - 0.0115481345f; + spd0.f[2] = 2.0f * RANDOMFRAC() * M_BADTAU / 544.0f - 0.0115481345f; + break; + case 2: + // aa4 + hand->unk0d20.f[0] = 0.0f; + hand->unk0d20.f[1] = RANDOMFRAC() * 2.5f * 0.125f + 2.5f; + hand->unk0d20.f[2] = (RANDOMFRAC() + 1.0f) * 0.25f; + spd0.f[0] = (RANDOMFRAC() + 3.0f) * M_BADTAU / 368.0f; + spd0.f[1] = 2.0f * RANDOMFRAC() * M_BADTAU / 944.0f - 0.006654857f; + spd0.f[2] = 2.0f * RANDOMFRAC() * M_BADTAU / 944.0f - 0.006654857f; + break; + } + + // c28 + hand->unk0d10 = hand->unk0d14 - 200.0f; + + mtx4LoadRotation(&spd0, &sp90); + mtx4ToMtx3(&sp90, hand->unk0d50); + + if (g_Vars.lvupdate240 > 0 && hand->unk0d0e_04) { + sp84.x = (hand->posmtx.m[3][0] - hand->prevmtx.m[3][0]) / g_Vars.lvupdate240f; + sp84.y = (hand->posmtx.m[3][1] - hand->prevmtx.m[3][1]) / g_Vars.lvupdate240f; + sp84.z = (hand->posmtx.m[3][2] - hand->prevmtx.m[3][2]) / g_Vars.lvupdate240f; + + mtx00017588(hand->posmtx.m, sp44.m); + mtx4RotateVecInPlace(&sp44, &sp84); + + hand->unk0d20.f[0] += sp84.x * 0.3f; + hand->unk0d20.f[1] += sp84.y * 0.3f; + hand->unk0d20.f[2] += sp84.z * 0.3f; + } + + hand->unk0d0e_00 = 2; + break; + case 2: + // d28 + lvupdate = g_Vars.lvupdate240f; + + if (g_Vars.currentplayer->isdead && lvupdate > 1.5f) { + lvupdate = 1.5f; + } + + newval = hand->unk0d20.f[1] - lvupdate * 0.2777778f; + + if (hand->unk0d18 < hand->unk0d10) { + hand->unk0d0e_00 = 3; + break; + } + + sumval = hand->unk0d20.f[1] + newval; + + hand->unk0d20.f[1] = newval; + + hand->unk0d14 += lvupdate * hand->unk0d20.f[0]; + hand->unk0d18 += lvupdate * 0.5f * sumval; + hand->unk0d1c += lvupdate * hand->unk0d20.f[2]; + + for (i = 0; i < g_Vars.lvupdate240; i++) { + mtx00016110(hand->unk0d50, hand->unk0d2c); + } + + break; + } +} +#endif void bgun0f0a4e44(struct hand *hand, struct weapon *weapondef, struct modelfiledata *modeldef, struct weaponfunc *funcdef, s32 maxburst, u8 *allocation, s32 weaponnum, @@ -12345,6 +12349,7 @@ u32 var800702d4 = 0x00000000; u32 var800702d8 = 0x00000000; u32 var800702dc = 0x00000001; +#if MATCHING #if PAL GLOBAL_ASM( glabel bgunRender @@ -14860,261 +14865,262 @@ glabel var7f1aca90 /* f0a5a84: 27bd0148 */ addiu $sp,$sp,0x148 ); #endif - +#else // Mismatch: Goal uses different codegen for accessing vertices -//void bgunRender(Gfx **gdlptr) -//{ -// Gfx *gdl = *gdlptr; -// struct modelrenderdata renderdata = {NULL, true, 3}; // 10c -// struct player *player; -// s32 i; -// -// static bool renderhand = true; // var800702dc -// -// player = g_Vars.currentplayer; -// -// if (player->visionmode == VISIONMODE_XRAY) { -// for (i = 0; i < 2; i++) { -// if (g_Vars.currentplayer->hands[i].firedrocket) { -// g_Vars.currentplayer->hands[i].rocket = NULL; -// } -// } -// return; -// } -// -// gdl = mblurRender(gdl); -// gdl = vi0000b280(gdl); -// gdl = vi0000b1d0(gdl); -// -// gDPSetScissor(gdl++, G_SC_NON_INTERLACE, viGetViewLeft(), viGetViewTop(), -// viGetViewLeft() + viGetViewWidth(), viGetViewTop() + viGetViewHeight()); -// -// gdl = vi0000aca4(gdl, 1.5, 1000); -// -// if (g_Vars.currentplayer->teleportstate != TELEPORTSTATE_INACTIVE) { -// f32 f2; -// -// if (optionsGetScreenRatio() == SCREENRATIO_16_9) { -// f2 = player0f0bd358() * 1.3333334f; -// } else { -// f2 = player0f0bd358(); -// } -// -// gdl = vi0000b0e8(gdl, 60, f2); -// } -// -// if (PLAYERCOUNT() == 1 && IS8MB()) { -// gdl = lasersightRenderBeam(gdl); -// } -// -// for (i = 0; i < 2; i++) { -// struct hand *hand; -// s32 j; -// s32 alpha; -// s32 weaponnum; // ec -// struct modelnode *node; // e8 -// u32 colour; // e4 -// -// hand = player->hands + i; -// -// weaponnum = bgunGetWeaponNum2(i); -// -// if (hand->visible) { -// gdl = beamRender(gdl, &hand->beam, 0, 0); -// -// if (weaponHasFlag(hand->gset.weaponnum, WEAPONFLAG_00008000)) { -// gSPNumLights(gdl++, 1); -// gSPLight(gdl++, &var80070098, 1); -// gSPLight(gdl++, &var80070090, 2); -// gSPLookAt(gdl++, camGetLookAt()); -// } -// -// gSPPerspNormalize(gdl++, mtx00016dcc(0, 300)); -// -// // There is support for guns having a TV screen on them -// // but no guns have this model part so it's not used. -// node = modelGetPart(hand->gunmodel.filedata, MODELPART_0010); -// -// if (node) { -// union modelrwdata *rwdata = modelGetNodeRwData(&hand->gunmodel, modelGetPart(hand->gunmodel.filedata, MODELPART_0011)); -// -// if (rwdata) { -// rwdata->toggle.visible = true; -// } -// -// gdl = tvscreenRender(&hand->gunmodel, node, &var8009cf88, gdl, 0, 1); -// } -// -// renderdata.gdl = gdl; -// renderdata.unk30 = 4; -// -// if (USINGDEVICE(DEVICE_NIGHTVISION) || USINGDEVICE(DEVICE_IRSCANNER)) { -// // 67c -// u8 *col = player->gunshadecol; -// u32 shade; -// s32 spb0[4]; -// s32 spa0[4]; -// -// if (col[0] > col[1] && col[0] > col[2]) { -// shade = col[0]; -// } else if (col[1] > col[2]) { -// shade = col[1]; -// } else { -// shade = col[2]; -// } -// -// renderdata.envcolour = (shade << 24 | shade << 16 | shade << 8) + col[3]; -// -// if (USINGDEVICE(DEVICE_NIGHTVISION)) { -// spb0[0] = var8009caef; -// spb0[1] = var8009caef; -// spb0[2] = var8009caef; -// spb0[3] = var8009caf0; -// -// colour = (spb0[0] << 24 | spb0[1] << 16 | spb0[2] << 8) + spb0[3]; -// } else if (USINGDEVICE(DEVICE_IRSCANNER)) { -// spa0[0] = 0xff; -// spa0[1] = 0; -// spa0[2] = 0; -// spa0[3] = 0x80; -// -// colour = (spa0[0] << 24 | spa0[1] << 16 | spa0[2] << 8) + spa0[3]; -// } -// -// if (weaponnum == WEAPON_UNARMED) { -// renderdata.envcolour = colour; -// } -// } else { -// renderdata.envcolour = player->gunshadecol[0] << 24 | player->gunshadecol[1] << 16 | player->gunshadecol[2] << 8 | player->gunshadecol[3]; -// colour = renderdata.envcolour; -// -// // 838 -// if (hand->gset.weaponnum == WEAPON_MAULER) { -// u32 weight = hand->matmot1 * 50.0f; -// renderdata.envcolour = colourBlend(0xff00007f, renderdata.envcolour, weight); -// } -// } -// -// // Apply transparency based on player's cloak -// alpha = chrGetCloakAlpha(player->prop->chr); -// -// if (alpha < 255) { -// colour = (s32) (alpha * 0.74509805f) + 0x41; -// renderdata.unk30 = 5; -// renderdata.fogcolour = renderdata.envcolour; -// renderdata.envcolour = colour; -// } -// -// renderdata.zbufferenabled = true; -// -// mtx00016760(); -// -// // Render rocket launcher's rocket if it's in Jo's hand or in the launcher -// if (hand->rocket) { -// struct model *rocketmodel = hand->rocket->base.model; // 98 -// bool sp94 = false; -// -//#if VERSION >= VERSION_NTSC_1_0 -// if (rocketmodel && rocketmodel->filedata) { -// sp94 = true; -// -// modelRender(&renderdata, rocketmodel); -// -// func0f0c33f0(rocketmodel->matrices, rocketmodel->filedata->nummatrices); -// -// if (hand->firedrocket) { -// hand->rocket = NULL; -// } -// } -// -// if (sp94); -//#else -// modelRender(&renderdata, rocketmodel); -// -// func0f0c33f0(rocketmodel->matrices, rocketmodel->filedata->nummatrices); -// -// if (hand->firedrocket) { -// hand->rocket = NULL; -// } -//#endif -// } -// -// if (weaponHasFlag(weaponnum, WEAPONFLAG_DUALFLIP)) { -// gSPClearGeometryMode(renderdata.gdl++, G_CULL_BOTH); -// -// if (i == HAND_RIGHT) { -// renderdata.cullmode = CULLMODE_BACK; -// } else { -// renderdata.cullmode = CULLMODE_FRONT; -// } -// } -// -// // Slide the laser's liquid texture -// if (PLAYERCOUNT() == 1) { -// node = modelGetPart(hand->gunmodel.filedata, MODELPART_LASER_0041); -// -// // a5c -// if (node) { -// struct modelrodata_gundl *rodata; -// rodata = &node->rodata->gundl; -// -// for (j = 0; j < rodata->numvertices; j++) { -// // a7c -// s32 stack[2]; -// s32 k; -// -// (rodata->vertices + j)->t -= g_Vars.lvupdate240 * PALUP(25); -// -// if ((rodata->vertices + j)->t < -0x6000) { -// for (k = 0; k < rodata->numvertices; k++) { -// (rodata->vertices + k)->t += 0x2000; -// } -// } -// } -// } -// } -// -// // Render the gun -// modelRender(&renderdata, &hand->gunmodel); -// -// // Render the hand -// if (player->gunctrl.handmodeldef && renderhand) { -// s32 prevcolour = renderdata.envcolour; // 7c -// -// hand->handmodel.matrices = hand->gunmodel.matrices; -// -// model0001cc20(&hand->handmodel); -// -// renderdata.envcolour = colour; -// modelRender(&renderdata, &hand->handmodel); -// renderdata.envcolour = prevcolour; -// } -// -// // Clean up -// gdl = renderdata.gdl; -// -// if (weaponHasFlag(weaponnum, WEAPONFLAG_DUALFLIP)) { -// gSPClearGeometryMode(gdl++, G_CULL_BOTH); -// } -// -// func0f0c33f0(hand->gunmodel.matrices, hand->gunmodel.filedata->nummatrices); -// mtx00016784(); -// -// gSPPerspNormalize(gdl++, viGetPerspScale()); -// } -// } -// -// casingsRender(&gdl); -// mblur0f176298(); -// -// gdl = mblur0f1762ac(gdl); -// gdl = vi0000b1d0(gdl); -// -// gDPSetScissor(gdl++, G_SC_NON_INTERLACE, viGetViewLeft(), viGetViewTop(), -// viGetViewLeft() + viGetViewWidth(), viGetViewTop() + viGetViewHeight()); -// -// *gdlptr = gdl; -//} +void bgunRender(Gfx **gdlptr) +{ + Gfx *gdl = *gdlptr; + struct modelrenderdata renderdata = {NULL, true, 3}; // 10c + struct player *player; + s32 i; + + static bool renderhand = true; // var800702dc + + player = g_Vars.currentplayer; + + if (player->visionmode == VISIONMODE_XRAY) { + for (i = 0; i < 2; i++) { + if (g_Vars.currentplayer->hands[i].firedrocket) { + g_Vars.currentplayer->hands[i].rocket = NULL; + } + } + return; + } + + gdl = mblurRender(gdl); + gdl = vi0000b280(gdl); + gdl = vi0000b1d0(gdl); + + gDPSetScissor(gdl++, G_SC_NON_INTERLACE, viGetViewLeft(), viGetViewTop(), + viGetViewLeft() + viGetViewWidth(), viGetViewTop() + viGetViewHeight()); + + gdl = vi0000aca4(gdl, 1.5, 1000); + + if (g_Vars.currentplayer->teleportstate != TELEPORTSTATE_INACTIVE) { + f32 f2; + + if (optionsGetScreenRatio() == SCREENRATIO_16_9) { + f2 = player0f0bd358() * 1.3333334f; + } else { + f2 = player0f0bd358(); + } + + gdl = vi0000b0e8(gdl, 60, f2); + } + + if (PLAYERCOUNT() == 1 && IS8MB()) { + gdl = lasersightRenderBeam(gdl); + } + + for (i = 0; i < 2; i++) { + struct hand *hand; + s32 j; + s32 alpha; + s32 weaponnum; // ec + struct modelnode *node; // e8 + u32 colour; // e4 + + hand = player->hands + i; + + weaponnum = bgunGetWeaponNum2(i); + + if (hand->visible) { + gdl = beamRender(gdl, &hand->beam, 0, 0); + + if (weaponHasFlag(hand->gset.weaponnum, WEAPONFLAG_00008000)) { + gSPNumLights(gdl++, 1); + gSPLight(gdl++, &var80070098, 1); + gSPLight(gdl++, &var80070090, 2); + gSPLookAt(gdl++, camGetLookAt()); + } + + gSPPerspNormalize(gdl++, mtx00016dcc(0, 300)); + + // There is support for guns having a TV screen on them + // but no guns have this model part so it's not used. + node = modelGetPart(hand->gunmodel.filedata, MODELPART_0010); + + if (node) { + union modelrwdata *rwdata = modelGetNodeRwData(&hand->gunmodel, modelGetPart(hand->gunmodel.filedata, MODELPART_0011)); + + if (rwdata) { + rwdata->toggle.visible = true; + } + + gdl = tvscreenRender(&hand->gunmodel, node, &var8009cf88, gdl, 0, 1); + } + + renderdata.gdl = gdl; + renderdata.unk30 = 4; + + if (USINGDEVICE(DEVICE_NIGHTVISION) || USINGDEVICE(DEVICE_IRSCANNER)) { + // 67c + u8 *col = player->gunshadecol; + u32 shade; + s32 spb0[4]; + s32 spa0[4]; + + if (col[0] > col[1] && col[0] > col[2]) { + shade = col[0]; + } else if (col[1] > col[2]) { + shade = col[1]; + } else { + shade = col[2]; + } + + renderdata.envcolour = (shade << 24 | shade << 16 | shade << 8) + col[3]; + + if (USINGDEVICE(DEVICE_NIGHTVISION)) { + spb0[0] = var8009caef; + spb0[1] = var8009caef; + spb0[2] = var8009caef; + spb0[3] = var8009caf0; + + colour = (spb0[0] << 24 | spb0[1] << 16 | spb0[2] << 8) + spb0[3]; + } else if (USINGDEVICE(DEVICE_IRSCANNER)) { + spa0[0] = 0xff; + spa0[1] = 0; + spa0[2] = 0; + spa0[3] = 0x80; + + colour = (spa0[0] << 24 | spa0[1] << 16 | spa0[2] << 8) + spa0[3]; + } + + if (weaponnum == WEAPON_UNARMED) { + renderdata.envcolour = colour; + } + } else { + renderdata.envcolour = player->gunshadecol[0] << 24 | player->gunshadecol[1] << 16 | player->gunshadecol[2] << 8 | player->gunshadecol[3]; + colour = renderdata.envcolour; + + // 838 + if (hand->gset.weaponnum == WEAPON_MAULER) { + u32 weight = hand->matmot1 * 50.0f; + renderdata.envcolour = colourBlend(0xff00007f, renderdata.envcolour, weight); + } + } + + // Apply transparency based on player's cloak + alpha = chrGetCloakAlpha(player->prop->chr); + + if (alpha < 255) { + colour = (s32) (alpha * 0.74509805f) + 0x41; + renderdata.unk30 = 5; + renderdata.fogcolour = renderdata.envcolour; + renderdata.envcolour = colour; + } + + renderdata.zbufferenabled = true; + + mtx00016760(); + + // Render rocket launcher's rocket if it's in Jo's hand or in the launcher + if (hand->rocket) { + struct model *rocketmodel = hand->rocket->base.model; // 98 + bool sp94 = false; + +#if VERSION >= VERSION_NTSC_1_0 + if (rocketmodel && rocketmodel->filedata) { + sp94 = true; + + modelRender(&renderdata, rocketmodel); + + func0f0c33f0(rocketmodel->matrices, rocketmodel->filedata->nummatrices); + + if (hand->firedrocket) { + hand->rocket = NULL; + } + } + + if (sp94); +#else + modelRender(&renderdata, rocketmodel); + + func0f0c33f0(rocketmodel->matrices, rocketmodel->filedata->nummatrices); + + if (hand->firedrocket) { + hand->rocket = NULL; + } +#endif + } + + if (weaponHasFlag(weaponnum, WEAPONFLAG_DUALFLIP)) { + gSPClearGeometryMode(renderdata.gdl++, G_CULL_BOTH); + + if (i == HAND_RIGHT) { + renderdata.cullmode = CULLMODE_BACK; + } else { + renderdata.cullmode = CULLMODE_FRONT; + } + } + + // Slide the laser's liquid texture + if (PLAYERCOUNT() == 1) { + node = modelGetPart(hand->gunmodel.filedata, MODELPART_LASER_0041); + + // a5c + if (node) { + struct modelrodata_gundl *rodata; + rodata = &node->rodata->gundl; + + for (j = 0; j < rodata->numvertices; j++) { + // a7c + s32 stack[2]; + s32 k; + + (rodata->vertices + j)->t -= g_Vars.lvupdate240 * PALUP(25); + + if ((rodata->vertices + j)->t < -0x6000) { + for (k = 0; k < rodata->numvertices; k++) { + (rodata->vertices + k)->t += 0x2000; + } + } + } + } + } + + // Render the gun + modelRender(&renderdata, &hand->gunmodel); + + // Render the hand + if (player->gunctrl.handmodeldef && renderhand) { + s32 prevcolour = renderdata.envcolour; // 7c + + hand->handmodel.matrices = hand->gunmodel.matrices; + + model0001cc20(&hand->handmodel); + + renderdata.envcolour = colour; + modelRender(&renderdata, &hand->handmodel); + renderdata.envcolour = prevcolour; + } + + // Clean up + gdl = renderdata.gdl; + + if (weaponHasFlag(weaponnum, WEAPONFLAG_DUALFLIP)) { + gSPClearGeometryMode(gdl++, G_CULL_BOTH); + } + + func0f0c33f0(hand->gunmodel.matrices, hand->gunmodel.filedata->nummatrices); + mtx00016784(); + + gSPPerspNormalize(gdl++, viGetPerspScale()); + } + } + + casingsRender(&gdl); + mblur0f176298(); + + gdl = mblur0f1762ac(gdl); + gdl = vi0000b1d0(gdl); + + gDPSetScissor(gdl++, G_SC_NON_INTERLACE, viGetViewLeft(), viGetViewTop(), + viGetViewLeft() + viGetViewWidth(), viGetViewTop() + viGetViewHeight()); + + *gdlptr = gdl; +} +#endif /** * Find and return an available audio handle out of a pool of four. diff --git a/src/game/camdraw.c b/src/game/camdraw.c index 741763811..2cef4a5a1 100644 --- a/src/game/camdraw.c +++ b/src/game/camdraw.c @@ -825,6 +825,7 @@ s32 func0f14ad38(s32 device) const char var7f1b6688[] = "Cam_ClearCameraLoadBuffer -> Camera=%d\n"; const char var7f1b66b0[] = "Cam_StartTemp : Need %u bytes for temp cam images buffer\n"; +#if MATCHING GLOBAL_ASM( glabel func0f14ad58 .late_rodata @@ -916,62 +917,63 @@ glabel var7f1b72e8 /* f14ae98: 03e00008 */ jr $ra /* f14ae9c: e4500048 */ swc1 $f16,0x48($v0) ); - +#else // Mismatch: need to fiddle with the order of these -//void func0f14ad58(s32 index) -//{ -// struct var8007f8dc *thing = &var8007f8dc[index]; -// -// thing->unk000 = 0; -// thing->unk004 = 1.0f; -// thing->unk008 = 1.0f; -// thing->unk050 = 110.0f; -// thing->unk00c = 0.1f; -// thing->unk010 = 0.2f; -// thing->unk054 = 30; -// thing->unk058 = -1; -// thing->unk068 = -1; -// thing->unk06c = 0; -// thing->unk070 = 0; -// thing->unk074 = 0; -// thing->unk084 = 0; -// thing->unk024 = 1.0f; -// thing->unk028 = 1.0f; -// thing->unk03c = 1.0f; -// thing->unk014 = 0.0f; -// thing->unk018 = 0.0f; -// thing->unk01c = 0.0f; -// thing->unk020 = 0.0f; -// thing->unk02c = 0.0f; -// thing->unk030 = 0.0f; -// thing->unk034 = 0.0f; -// thing->unk038 = 0.0f; -// thing->unk040 = 0.0f; -// thing->unk044 = 30.0f; -// thing->unk060 = 6; -// thing->unk08c = 14; -// thing->unk088 = 1; -// thing->unk090 = 0; -// thing->unk064 = 0; -// thing->unk0f4 = 0; -// thing->unk094 = 0; -// thing->unk0f8 = 0; -// thing->unk0fc = 3; -// thing->unk100 = 3; -// thing->unk0e0 = 0; -// thing->unk0e4 = 0; -// thing->unk0e8 = 0; -// thing->unk0ec = 0; -// thing->unk0f0 = 0; -// thing->unk078 = 0; -// thing->unk07c = 0; -// thing->unk05c = var8007f940; -// thing->unk048 = 1.0f; -// thing->unk0d4_00 = false; -// thing->unk0d4_01 = false; -// thing->unk0d4_02 = false; -// thing->unk0d4_04 = true; -//} +void func0f14ad58(s32 index) +{ + struct var8007f8dc *thing = &var8007f8dc[index]; + + thing->unk000 = 0; + thing->unk004 = 1.0f; + thing->unk008 = 1.0f; + thing->unk050 = 110.0f; + thing->unk00c = 0.1f; + thing->unk010 = 0.2f; + thing->unk054 = 30; + thing->unk058 = -1; + thing->unk068 = -1; + thing->unk06c = 0; + thing->unk070 = 0; + thing->unk074 = 0; + thing->unk084 = 0; + thing->unk024 = 1.0f; + thing->unk028 = 1.0f; + thing->unk03c = 1.0f; + thing->unk014 = 0.0f; + thing->unk018 = 0.0f; + thing->unk01c = 0.0f; + thing->unk020 = 0.0f; + thing->unk02c = 0.0f; + thing->unk030 = 0.0f; + thing->unk034 = 0.0f; + thing->unk038 = 0.0f; + thing->unk040 = 0.0f; + thing->unk044 = 30.0f; + thing->unk060 = 6; + thing->unk08c = 14; + thing->unk088 = 1; + thing->unk090 = 0; + thing->unk064 = 0; + thing->unk0f4 = 0; + thing->unk094 = 0; + thing->unk0f8 = 0; + thing->unk0fc = 3; + thing->unk100 = 3; + thing->unk0e0 = 0; + thing->unk0e4 = 0; + thing->unk0e8 = 0; + thing->unk0ec = 0; + thing->unk0f0 = 0; + thing->unk078 = 0; + thing->unk07c = 0; + thing->unk05c = var8007f904[30]; + thing->unk048 = 1.0f; + thing->unk0d4_00 = false; + thing->unk0d4_01 = false; + thing->unk0d4_02 = false; + thing->unk0d4_04 = true; +} +#endif bool func0f14aea0(s32 device) { @@ -1630,6 +1632,7 @@ void func0f14c4c0(s32 index) menuSetBanner(MENUBANNER_DOWNLOADINGIMAGE, false); } +#if MATCHING GLOBAL_ASM( glabel func0f14c50c /* f14c50c: 27bdffe0 */ addiu $sp,$sp,-32 @@ -1792,68 +1795,69 @@ glabel func0f14c50c /* f14c754: 03e00008 */ jr $ra /* f14c758: 27bd0020 */ addiu $sp,$sp,0x20 ); - +#else // Mismatch: Goal loads var8007f8e0 into a2 then does nothing with it. // The below optimises it out. -//void func0f14c50c(struct var8007f8e0 *dst, struct var8007f8e0 *src, u32 line, char *file) -//{ -// struct var8007f8e0 *thing = var8007f8e0; -// s32 i; -// s32 j; -// s32 row = 0; -// -// for (i = 0; i < 22; i++); -// -// dst->unk3f4_00 = src->unk3f4_00; -// dst->unk3f4_01 = src->unk3f4_01; -// dst->unk3f4_02 = src->unk3f4_02; -// dst->unk3f4_03 = src->unk3f4_03; -// dst->colournum = src->colournum; -// dst->stylenum = src->stylenum; -// dst->unk3a4 = src->unk3a4; -// dst->unk3b4 = src->unk3b4; -// dst->unk3b8 = src->unk3b8; -// dst->unk3bc = src->unk3bc; -// dst->unk3c0 = src->unk3c0; -// dst->unk3c4 = src->unk3c4; -// dst->unk3c8 = src->unk3c8; -// dst->unk3cc = src->unk3cc; -// dst->unk3ec = src->unk3ec; -// dst->unk3f0 = src->unk3f0; -// -// dst->fileguid.fileid = src->fileguid.fileid; -// dst->fileguid.deviceserial = src->fileguid.deviceserial; -// -// for (i = 0; i != 7; i++) { -// dst->unk3d0[i] = src->unk3d0[i]; -// } -// -// if (dst->unk01c) { -// s32 i; -// -// for (i = 63; i != -1; i--) { -// for (j = 0; j != 64; j++) { -// s32 fudge = (i & 1) ? ((j & 4) ? -4 : 4) : 0; -// -// dst->unk01c[row * 64 + j] = src->unk004.textureptr[i * 64 + j + fudge]; -// } -// -// row++; -// } -// } -// -// func0f14c75c(&dst->unk004, &src->unk004); -// -// if (dst->unk010.textureptr && src->unk010.textureptr) { -// func0f14c75c(&dst->unk010, &src->unk010); -// } -// -// if (src->unk3f4_04) { -// for (i = 0; i < 1024; i++) { -// dst->unk020[i] = src->unk020[i]; -// } -// } -//} +void func0f14c50c(struct var8007f8e0 *dst, struct var8007f8e0 *src, u32 line, char *file) +{ + struct var8007f8e0 *thing = var8007f8e0; + s32 i; + s32 j; + s32 row = 0; + + for (i = 0; i < 22; i++); + + dst->unk3f4_00 = src->unk3f4_00; + dst->unk3f4_01 = src->unk3f4_01; + dst->unk3f4_02 = src->unk3f4_02; + dst->unk3f4_03 = src->unk3f4_03; + dst->colournum = src->colournum; + dst->stylenum = src->stylenum; + dst->unk3a4 = src->unk3a4; + dst->unk3b4 = src->unk3b4; + dst->unk3b8 = src->unk3b8; + dst->unk3bc = src->unk3bc; + dst->unk3c0 = src->unk3c0; + dst->unk3c4 = src->unk3c4; + dst->unk3c8 = src->unk3c8; + dst->unk3cc = src->unk3cc; + dst->unk3ec = src->unk3ec; + dst->unk3f0 = src->unk3f0; + + dst->fileguid.fileid = src->fileguid.fileid; + dst->fileguid.deviceserial = src->fileguid.deviceserial; + + for (i = 0; i != 7; i++) { + dst->unk3d0[i] = src->unk3d0[i]; + } + + if (dst->unk01c) { + s32 i; + + for (i = 63; i != -1; i--) { + for (j = 0; j != 64; j++) { + s32 fudge = (i & 1) ? ((j & 4) ? -4 : 4) : 0; + + dst->unk01c[row * 64 + j] = src->unk004.textureptr[i * 64 + j + fudge]; + } + + row++; + } + } + + func0f14c75c(&dst->unk004, &src->unk004); + + if (dst->unk010.textureptr && src->unk010.textureptr) { + func0f14c75c(&dst->unk010, &src->unk010); + } + + if (src->unk3f4_04) { + for (i = 0; i < 1024; i++) { + dst->unk020[i] = src->unk020[i]; + } + } +} +#endif void func0f14c75c(struct textureconfig *arg0, struct textureconfig *arg1) { @@ -2112,6 +2116,7 @@ void func0f14d2c8(u8 *arg0, u8 *arg1) } } +#if MATCHING GLOBAL_ASM( glabel func0f14d4f0 /* f14d4f0: 27bdff30 */ addiu $sp,$sp,-208 @@ -2289,75 +2294,76 @@ u32 var8007fa50 = 0x3c5a0169; u32 var8007fa54 = 0x3cb3b752; u32 var8007fa58 = 0x3c5a0169; u32 var8007fa5c = 0x3b42938e; - +#else // Mismatch: Different codegen. The function is generating a 64x64 thumbnail // from a 128x128 source, and there's lots of different ways that variables can // be used to do this. -//void func0f14d4f0(u8 *arg0, u8 *arg1) -//{ -// f32 *s1 = (f32 *) var800a45a0->unk474; -// f32 *s0 = (f32 *) var800a45a0->unk478; -// s32 i; -// s32 j; -// s32 x; -// s32 y; -// -// f32 sp50[] = { -// 0.0029690000228584f, -// 0.013306000269949f, -// 0.021937999874353f, -// 0.013306000269949f, -// 0.0029690000228584f, -// 0.013306000269949f, -// 0.059634000062943f, -// 0.098319999873638f, -// 0.059634000062943f, -// 0.013306000269949f, -// 0.021937999874353f, -// 0.098319999873638f, -// 0.16210299730301f, -// 0.098319999873638f, -// 0.021937999874353f, -// 0.013306000269949f, -// 0.059634000062943f, -// 0.098319999873638f, -// 0.059634000062943f, -// 0.013306000269949f, -// 0.0029690000228584f, -// 0.013306000269949f, -// 0.021937999874353f, -// 0.013306000269949f, -// 0.0029690000228584f, -// }; -// -// for (i = 0; i < 128; i++) { -// for (j = 0; j < 128; j++) { -// s1[i * 128 + j] = arg0[i * 128 + j]; -// } -// } -// -// func0f14d8d8(s1, s0, 128, sp50, 5); -// -// for (y = 0; y < 63; y++) { -// for (x = 0; x < 63; x++) { -// f32 value = ( -// s0[y * 2 * 128 + x * 2 + 0] + -// s0[y * 2 * 128 + x * 2 + 1] + -// s0[y * 2 * 128 + x * 2 + 128] + -// s0[y * 2 * 128 + x * 2 + 129]) * 0.25f; -// -// if (value < 0.0f) { -// value = 0.0f; -// } -// -// if (value > 255.0f) { -// value = 255.0f; -// } -// -// arg1[y * 64 + x] = value; -// } -// } -//} +void func0f14d4f0(u8 *arg0, u8 *arg1) +{ + f32 *s1 = (f32 *) var800a45a0->unk474; + f32 *s0 = (f32 *) var800a45a0->unk478; + s32 i; + s32 j; + s32 x; + s32 y; + + f32 sp50[] = { + 0.0029690000228584f, + 0.013306000269949f, + 0.021937999874353f, + 0.013306000269949f, + 0.0029690000228584f, + 0.013306000269949f, + 0.059634000062943f, + 0.098319999873638f, + 0.059634000062943f, + 0.013306000269949f, + 0.021937999874353f, + 0.098319999873638f, + 0.16210299730301f, + 0.098319999873638f, + 0.021937999874353f, + 0.013306000269949f, + 0.059634000062943f, + 0.098319999873638f, + 0.059634000062943f, + 0.013306000269949f, + 0.0029690000228584f, + 0.013306000269949f, + 0.021937999874353f, + 0.013306000269949f, + 0.0029690000228584f, + }; + + for (i = 0; i < 128; i++) { + for (j = 0; j < 128; j++) { + s1[i * 128 + j] = arg0[i * 128 + j]; + } + } + + func0f14d8d8(s1, s0, 128, sp50, 5); + + for (y = 0; y < 63; y++) { + for (x = 0; x < 63; x++) { + f32 value = ( + s0[y * 2 * 128 + x * 2 + 0] + + s0[y * 2 * 128 + x * 2 + 1] + + s0[y * 2 * 128 + x * 2 + 128] + + s0[y * 2 * 128 + x * 2 + 129]) * 0.25f; + + if (value < 0.0f) { + value = 0.0f; + } + + if (value > 255.0f) { + value = 255.0f; + } + + arg1[y * 64 + x] = value; + } + } +} +#endif void func0f14d714(u8 *arg0, u8 *arg1) { @@ -3250,6 +3256,7 @@ void func0f14f4e4(struct var8007f8e0 *arg0) } } +#if MATCHING GLOBAL_ASM( glabel func0f14f510 .late_rodata @@ -3386,35 +3393,36 @@ glabel var7f1b7364 /* f14f6f8: 03e00008 */ jr $ra /* f14f6fc: 27bd0060 */ addiu $sp,$sp,0x60 ); +#else +void func0f14f510(s32 arg0) +{ + s32 i; + s32 j; -//void func0f14f510(s32 arg0) -//{ -// s32 i; -// s32 j; -// -// for (i = 0; i < 8; i++) { -// s32 tmp = (i + 1) * arg0 + 1; -// -// for (j = 0; j < 8; j++) { -// var800a45a0->unk06c[i * 8 + j] = tmp + j * arg0; -// } -// } -// -// var800a45a0->unk010 = 0; -// var800a45a0->unk00c = 0; -// -// for (i = 0; i < 8; i++) { -// var800a45a0->unk17c[i] = 1 / sqrtf(8); -// var800a45a0->unk27c[i * 8] = var800a45a0->unk17c[i]; -// } -// -// for (i = 1; i < 8; i++) { -// for (j = 0; j < 8; j++) { -// var800a45a0->unk17c[i * 8 + j] = sqrtf(0.25f) * cosf(((1 + j * 2) * M_PI * i) / 16.0f); -// var800a45a0->unk27c[j * 8 + i] = var800a45a0->unk17c[i * 8 + j]; -// } -// } -//} + for (i = 0; i < 8; i++) { + s32 tmp = (i + 1) * arg0 + 1; + + for (j = 0; j < 8; j++) { + var800a45a0->unk06c[i][j] = tmp + j * arg0; + } + } + + var800a45a0->unk010 = 0; + var800a45a0->unk00c = 0; + + for (i = 0; i < 8; i++) { + var800a45a0->unk17c[0][i] = 1 / sqrtf(8); + var800a45a0->unk27c[i][0] = var800a45a0->unk17c[0][i]; + } + + for (i = 1; i < 8; i++) { + for (j = 0; j < 8; j++) { + var800a45a0->unk17c[i][j] = sqrtf(0.25f) * cosf(((1 + j * 2) * M_PI * i) / 16.0f); + var800a45a0->unk27c[j][i] = var800a45a0->unk17c[i][j]; + } + } +} +#endif void func0f14f700(struct var8007f8e0 *arg0, u32 arg1, u32 arg2) { @@ -3807,6 +3815,7 @@ const char var7f1b727c[] = "\nCam_SaveEditSlotToParamPakItem -> Save failed\n"; const char var7f1b72ac[] = "Camera Save Error Result: %d\n"; const char var7f1b72cc[] = "Magic Guid set to %d\n"; +#if MATCHING GLOBAL_ASM( glabel pheadSaveFile /* f150468: 27bdeb08 */ addiu $sp,$sp,-5368 @@ -4037,106 +4046,107 @@ glabel pheadSaveFile /* f1507ac: 03e00008 */ jr $ra /* f1507b0: 27bd14f8 */ addiu $sp,$sp,0x14f8 ); - +#else // Mismatch: Regalloc -//s32 pheadSaveFile(s8 device, s32 fileid, u16 serial) -//{ -// u32 stack[2]; -// struct camerafile file; // 1050 -// struct var8007f8e0 *thing = func0f14a06c(-1); -// s32 ret; -// s32 writtenfileid; // 1044 -// u8 sp44[0x1000]; -// s32 i; -// -// if (!thing->unk3f4_03) { -// thing->unk036 = 1; -// thing->unk024 = sp44; -// -// while (true) { -// func0f150068(thing, thing->unk036); -// -// file.unk80 = thing->unk02c / 8; -// -// if ((u32)file.unk80 >= 1024) { -// thing->unk036++; -// -// if (thing->unk036 >= 12) { -// return -1; -// } -// } else { -// break; -// } -// } -// -// for (i = 0; i < (u32)file.unk80; i++) { -// thing->unk020[i] = thing->unk024[i]; -// } -// -// for (i = file.unk80; i < 1024; i++) { -// thing->unk020[i] = 0; -// } -// -// thing->unk3f4_03 = true; -// } -// -// file.unk8e_00 = thing->unk3f4_01; -// file.unk8e_01 = thing->unk3f4_02; -// file.unk8e_02 = thing->unk3a4; -// -// file.unk82 = thing->unk3bc; -// file.unk84 = thing->unk3b8; -// file.unk8c = thing->colournum; -// file.unk8d = thing->stylenum; -// file.unk86 = thing->unk3c0; -// file.unk87 = thing->unk3c4; -// file.unk88 = thing->unk3c8; -// file.unk89 = thing->unk3cc; -// file.unk8a = thing->unk3ec; -// file.unk8b = thing->unk3f0; -// -// for (i = 0; i != ARRAYCOUNT(file.unk90); i++) { -// file.unk90[i] = thing->unk3d0[i] * 1000.0f; -// } -// -// for (i = 0; i < ARRAYCOUNT(file.unk00); i++) { -// file.unk00[i] = thing->unk010.textureptr[i]; -// } -// -// for (i = 0; i < ARRAYCOUNT(file.unk9e); i++) { -// file.unk9e[i] = thing->unk020[i]; -// } -// -// var80075bd0[3] = true; -// -// ret = pakSaveAtGuid(device, fileid, PAKFILETYPE_CAMERA, (u8 *)&file, &writtenfileid, NULL); -// -// if (ret == 0) { -// s32 i; -// for (i = 0; i < 18; i++) { -// struct var8007f8e0 *thing2 = func0f14a06c(i); -// -// if (thing2->fileguid.fileid == thing->fileguid.fileid -// && thing2->fileguid.deviceserial == thing->fileguid.deviceserial) { -// thing2->fileguid.fileid = writtenfileid; -// thing2->fileguid.deviceserial = serial; -// -// if (i >= 12) { -// g_Vars.modifiedfiles |= MODFILE_GAME; -// } -// } -// } -// -// thing->fileguid.fileid = writtenfileid; -// thing->fileguid.deviceserial = serial; -// -// return 0; -// } -// -// g_FilemgrLastPakError = ret; -// -// return -1; -//} +s32 pheadSaveFile(s8 device, s32 fileid, u16 serial) +{ + u32 stack[2]; + struct camerafile file; // 1050 + struct var8007f8e0 *thing = func0f14a06c(-1); + s32 ret; + s32 writtenfileid; // 1044 + u8 sp44[0x1000]; + s32 i; + + if (!thing->unk3f4_03) { + thing->unk036 = 1; + thing->unk024 = sp44; + + while (true) { + func0f150068(thing, thing->unk036); + + file.unk80 = thing->unk02c / 8; + + if ((u32)file.unk80 >= 1024) { + thing->unk036++; + + if (thing->unk036 >= 12) { + return -1; + } + } else { + break; + } + } + + for (i = 0; i < (u32)file.unk80; i++) { + thing->unk020[i] = thing->unk024[i]; + } + + for (i = file.unk80; i < 1024; i++) { + thing->unk020[i] = 0; + } + + thing->unk3f4_03 = true; + } + + file.unk8e_00 = thing->unk3f4_01; + file.unk8e_01 = thing->unk3f4_02; + file.unk8e_02 = thing->unk3a4; + + file.unk82 = thing->unk3bc; + file.unk84 = thing->unk3b8; + file.unk8c = thing->colournum; + file.unk8d = thing->stylenum; + file.unk86 = thing->unk3c0; + file.unk87 = thing->unk3c4; + file.unk88 = thing->unk3c8; + file.unk89 = thing->unk3cc; + file.unk8a = thing->unk3ec; + file.unk8b = thing->unk3f0; + + for (i = 0; i != ARRAYCOUNT(file.unk90); i++) { + file.unk90[i] = thing->unk3d0[i] * 1000.0f; + } + + for (i = 0; i < ARRAYCOUNT(file.unk00); i++) { + file.unk00[i] = thing->unk010.textureptr[i]; + } + + for (i = 0; i < ARRAYCOUNT(file.unk9e); i++) { + file.unk9e[i] = thing->unk020[i]; + } + + var80075bd0[3] = true; + + ret = pakSaveAtGuid(device, fileid, PAKFILETYPE_CAMERA, (u8 *)&file, &writtenfileid, NULL); + + if (ret == 0) { + s32 i; + for (i = 0; i < 18; i++) { + struct var8007f8e0 *thing2 = func0f14a06c(i); + + if (thing2->fileguid.fileid == thing->fileguid.fileid + && thing2->fileguid.deviceserial == thing->fileguid.deviceserial) { + thing2->fileguid.fileid = writtenfileid; + thing2->fileguid.deviceserial = serial; + + if (i >= 12) { + g_Vars.modifiedfiles |= MODFILE_GAME; + } + } + } + + thing->fileguid.fileid = writtenfileid; + thing->fileguid.deviceserial = serial; + + return 0; + } + + g_FilemgrLastPakError = ret; + + return -1; +} +#endif void phGetGuid(s32 index, struct fileguid *guid) { diff --git a/src/game/camera.c b/src/game/camera.c index 7b1e57acd..8ab940243 100644 --- a/src/game/camera.c +++ b/src/game/camera.c @@ -586,6 +586,7 @@ bool camIsPosInScreenBox(struct coord *pos, f32 arg1, struct var800a4640_00 *arg return true; } +#if MATCHING GLOBAL_ASM( glabel camIsPosInFovAndVisibleRoom /* f0b6260: 27bdffb0 */ addiu $sp,$sp,-80 @@ -681,50 +682,51 @@ glabel camIsPosInFovAndVisibleRoom /* f0b63a0: 03e00008 */ jr $ra /* f0b63a4: 27bd0050 */ addiu $sp,$sp,0x50 ); - +#else // Mismatch: Too much compiler-managed stack -//bool camIsPosInFovAndVisibleRoom(s16 *rooms, struct coord *pos, f32 arg2) -//{ -// s8 hasdata = false; -// s16 room; -// s32 i; -// struct var800a4640_00 *thisthing; -// struct var800a4640_00 thing; // 34 -// -// for (i = 0, room = rooms[0]; room != -1; i++, room = rooms[i]) { -// if (g_Rooms[room].flags & ROOMFLAG_ONSCREEN) { -// thisthing = func0f158140(room); -// -// if (hasdata == false) { -// thing.box.xmin = thisthing->box.xmin; -// thing.box.ymin = thisthing->box.ymin; -// thing.box.xmax = thisthing->box.xmax; -// thing.box.ymax = thisthing->box.ymax; -// } else { -// if (thisthing->box.xmin < thing.box.xmin) { -// thing.box.xmin = thisthing->box.xmin; -// } -// -// if (thisthing->box.ymin < thing.box.ymin) { -// thing.box.ymin = thisthing->box.ymin; -// } -// -// if (thisthing->box.xmax > thing.box.xmax) { -// thing.box.xmax = thisthing->box.xmax; -// } -// -// if (thisthing->box.ymax > thing.box.ymax) { -// thing.box.ymax = thisthing->box.ymax; -// } -// } -// -// hasdata = true; -// } -// } -// -// if (!hasdata) { -// return false; -// } -// -// return camIsPosInScreenBox(pos, arg2, &thing); -//} +bool camIsPosInFovAndVisibleRoom(s16 *rooms, struct coord *pos, f32 arg2) +{ + s8 hasdata = false; + s16 room; + s32 i; + struct var800a4640_00 *thisthing; + struct var800a4640_00 thing; // 34 + + for (i = 0, room = rooms[0]; room != -1; i++, room = rooms[i]) { + if (g_Rooms[room].flags & ROOMFLAG_ONSCREEN) { + thisthing = func0f158140(room); + + if (hasdata == false) { + thing.box.xmin = thisthing->box.xmin; + thing.box.ymin = thisthing->box.ymin; + thing.box.xmax = thisthing->box.xmax; + thing.box.ymax = thisthing->box.ymax; + } else { + if (thisthing->box.xmin < thing.box.xmin) { + thing.box.xmin = thisthing->box.xmin; + } + + if (thisthing->box.ymin < thing.box.ymin) { + thing.box.ymin = thisthing->box.ymin; + } + + if (thisthing->box.xmax > thing.box.xmax) { + thing.box.xmax = thisthing->box.xmax; + } + + if (thisthing->box.ymax > thing.box.ymax) { + thing.box.ymax = thisthing->box.ymax; + } + } + + hasdata = true; + } + } + + if (!hasdata) { + return false; + } + + return camIsPosInScreenBox(pos, arg2, &thing); +} +#endif diff --git a/src/game/chr.c b/src/game/chr.c index 22ae75004..68126e5aa 100644 --- a/src/game/chr.c +++ b/src/game/chr.c @@ -3670,6 +3670,7 @@ void chrEmitSparks(struct chrdata *chr, struct prop *prop, s32 hitpart, struct c #endif } +#if MATCHING GLOBAL_ASM( glabel chr0f0260c4 /* f0260c4: 27bdfed8 */ addiu $sp,$sp,-296 @@ -4233,282 +4234,283 @@ glabel chr0f0260c4 /* f0268b4: 03e00008 */ jr $ra /* f0268b8: 27bd0128 */ addiu $sp,$sp,0x128 ); - +#else // Mismatch: The bottom two tmp calculations should multiply by s32 0xc using // shift operations, however doing this causes it to boot gdlptr out of s8 and // use s8 for s32 0xc. The below multiplies by 6 which is incorrect, but creates // a diff of only one instruction to show that this is the only issue. -//void chr0f0260c4(struct model *model, s32 hitpart, struct modelnode *node, struct coord *arg3) -//{ -// struct modelnode *bestnode = NULL; -// s32 mindist = 0x7fffffff; -// s32 bestcoords[3]; -// struct modelnode *curnode; -// Gfx *gdlptr; -// Gfx *gdlptr2; -// struct gfxvtx *vertices; -// struct modelnode *posnode = NULL; -// struct coord relpos; -// struct coord spd4; -// struct coord spc8; -// s32 spbc[3]; -// s32 alpha = 20 + (random() % 50); -// struct modelrodata_dl *rodata; -// struct modelrwdata_dl *rwdata; -// s32 spac = 0; -// s32 op; -// s32 nodetype; -// -// modelNodeGetModelRelativePosition(model, model0001a740(node), &relpos); -// -// spc8.f[0] = arg3->x - relpos.x; -// spc8.f[1] = arg3->y - relpos.y; -// spc8.f[2] = arg3->z - relpos.z; -// -// // This first pass over the node tree is deciding which modelnode to use. -// curnode = node; -// -// while (curnode) { -// s32 nodetype = curnode->type & 0xff; -// -// switch (nodetype) { -// case MODELNODETYPE_DL: -// rodata = &curnode->rodata->dl; -// rwdata = modelGetNodeRwData(model, curnode); -// -// if (rwdata->gdl == NULL) { -// break; -// } -// -// // By default, the model instance's displaylist points to the -// // one in the model definition. If it hasn't been changed we'll -// // use the space... after the model definition's colour table? -// // Let's hope that's not being used by other instances... -// if (rwdata->gdl == rodata->primary) { -// gdlptr = (Gfx *)((u32)rodata->colourtable + ((u32)rodata->primary & 0xffffff)); -// } else { -// gdlptr = rwdata->gdl; -// } -// -// if (rodata->secondary) { -// gdlptr2 = (Gfx *)((u32)rodata->colourtable + ((u32)rodata->secondary & 0xffffff)); -// } else { -// gdlptr2 = NULL; -// } -// -// // Iterate the primary DL, and once the end is reached -// // iterate the secondary DL if we have one. -// while (true) { -// op = *(s8 *)&gdlptr->words.w0; -// -// if (op == G_ENDDL) { -// if (gdlptr2) { -// // Switch to second DL -// gdlptr = gdlptr2; -// gdlptr2 = NULL; -// } else { -// // We're done -// gdlptr = NULL; -// break; -// } -// } else { -// // Note: We should have found an MTX op before VTX. -// if (op == G_VTX) { -// u8 *ptr = (u8 *)&gdlptr->words.w0; -// u32 word = gdlptr->words.w1 & 0xffffff; -// s32 numverts; -// s32 i; -// -// vertices = (struct gfxvtx *)((u32)rodata->vertices + word); -// numverts = (u32)ptr[1] / 16 + 1; -// -// if (posnode) { -// for (i = 0; i < numverts; i++) { -// s32 x = spbc[0] - vertices[i].x; -// s32 y = spbc[1] - vertices[i].y; -// s32 z = spbc[2] - vertices[i].z; -// s32 dist = x * x + y * y + z * z; -// -// if (dist < mindist) { -// mindist = dist; -// bestnode = curnode; -// bestcoords[0] = vertices[i].x + (s32)spd4.f[0]; -// bestcoords[1] = vertices[i].y + (s32)spd4.f[1]; -// bestcoords[2] = vertices[i].z + (s32)spd4.f[2]; -// } -// } -// } -// } else if (op == G_MTX) { -// u32 addr = gdlptr->words.w1 & 0xffffff; -// posnode = model0001a634(model, addr / sizeof(Mtxf)); -// modelNodeGetModelRelativePosition(model, posnode, &spd4); -// -// spbc[0] = spd4.x + spc8.x; -// spbc[1] = spd4.y + spc8.y; -// spbc[2] = spd4.z + spc8.z; -// } -// -// gdlptr++; -// } -// } -// break; -// case MODELNODETYPE_DISTANCE: -// model0001c784(model, curnode); -// break; -// case MODELNODETYPE_TOGGLE: -// model0001c7d0(model, curnode); -// break; -// case MODELNODETYPE_HEADSPOT: -// modelAttachHead(model, curnode); -// break; -// } -// -// if (curnode->child && (curnode == node -// || (nodetype != MODELNODETYPE_BBOX && nodetype != MODELNODETYPE_11))) { -// curnode = curnode->child; -// } else { -// while (curnode) { -// if (curnode == node) { -// curnode = NULL; -// break; -// } -// -// if (curnode->next) { -// curnode = curnode->next; -// break; -// } -// -// curnode = curnode->parent; -// } -// } -// } -// -// if (bestnode == NULL) { -// return; -// } -// -// // Do a pass over the entire model's tree, looking for vertices that share -// // the chosen vertex, and darken then. -// curnode = model->filedata->rootnode; -// -// while (curnode) { -// nodetype = curnode->type & 0xff; -// -// switch (nodetype) { -// case MODELNODETYPE_DL: -// rodata = &curnode->rodata->dl; -// rwdata = modelGetNodeRwData(model, curnode); -// -// if (rwdata->gdl == NULL) { -// break; -// } -// -// if (rwdata->gdl == rodata->primary) { -// gdlptr = (Gfx *)((u32)rodata->colourtable + ((u32)rodata->primary & 0xffffff)); -// } else { -// gdlptr = rwdata->gdl; -// } -// -// if (rodata->secondary) { -// gdlptr2 = (Gfx *)((u32)rodata->colourtable + ((u32)rodata->secondary & 0xffffff)); -// } else { -// gdlptr2 = NULL; -// } -// -// while (true) { -// s32 op = *(s8 *)&gdlptr->words.w0; -// -// if (op == G_ENDDL) { -// if (gdlptr2) { -// // Switch to second DL -// gdlptr = gdlptr2; -// gdlptr2 = NULL; -// } else { -// // We're done -// gdlptr = NULL; -// break; -// } -// } else { -// // Note: We should have found an MTX op before VTX. -// if (op == G_VTX) { -// u8 *ptr = (u8 *)&gdlptr->words.w0; -// u32 word = gdlptr->words.w1 & 0xffffff; -// struct gfxvtx *vertices = (struct gfxvtx *)((u32)rodata->vertices + word); -// s32 numverts = (u32)ptr[1] / 16 + 1; -// s32 i; -// -// if (posnode) { -// for (i = 0; i < numverts; i++) { -// s32 x = vertices[i].x + (s32)spd4.f[0]; -// s32 y = vertices[i].y + (s32)spd4.f[1]; -// s32 z = vertices[i].z + (s32)spd4.f[2]; -// -// if (x == bestcoords[0] && y == bestcoords[1] && z == bestcoords[2]) { -// u32 tmp = ALIGN8((u32)&rodata->vertices[(u32)rodata->numvertices]); // u32 0xc -// -// if ((u32)rwdata->colours == tmp) { -// struct colour *colours = vtxstoreAllocate(rodata->numcolours, VTXSTORETYPE_CHRCOL, 0, 0); -// s32 j; -// -// if (colours) { -// for (j = 0; j < rodata->numcolours; j++) { -// colours[j] = rwdata->colours[j]; -// } -// -// rwdata->colours = colours; -// -// tmp = ALIGN8((s32)&rodata->vertices[rodata->numvertices]); // s32 0xc -// } else { -// tmp = ALIGN8((s32)rodata->vertices + rodata->numvertices * 6); // s32 0xc -// } -// } -// -// if ((u32)rwdata->colours != tmp) { -// u32 offset = rwdata->vertices[word / 12u + i].colour >> 2; // u32 0xc (both divide and mult) -// struct colour *colours = (struct colour *) ((u32)rwdata->colours + spac); -// -// colours[offset].a = alpha; -// } -// } -// } -// } -// } else if (op == G_MTX) { -// u32 addr = gdlptr->words.w1 & 0xffffff; -// posnode = model0001a634(model, addr / sizeof(Mtxf)); -// modelNodeGetModelRelativePosition(model, posnode, &spd4); -// } else if (op == G_SETCOLOR) { -// spac = gdlptr->words.w1 & 0xffffff; -// } -// -// gdlptr++; -// } -// } -// break; -// case MODELNODETYPE_DISTANCE: -// model0001c784(model, curnode); -// break; -// case MODELNODETYPE_TOGGLE: -// model0001c7d0(model, curnode); -// break; -// case MODELNODETYPE_HEADSPOT: -// modelAttachHead(model, curnode); -// break; -// } -// -// if (curnode->child) { -// curnode = curnode->child; -// } else { -// while (curnode) { -// if (curnode && curnode->next) { -// curnode = curnode->next; -// break; -// } -// -// curnode = curnode->parent; -// } -// } -// } -//} +void chr0f0260c4(struct model *model, s32 hitpart, struct modelnode *node, struct coord *arg3) +{ + struct modelnode *bestnode = NULL; + s32 mindist = 0x7fffffff; + s32 bestcoords[3]; + struct modelnode *curnode; + Gfx *gdlptr; + Gfx *gdlptr2; + struct gfxvtx *vertices; + struct modelnode *posnode = NULL; + struct coord relpos; + struct coord spd4; + struct coord spc8; + s32 spbc[3]; + s32 alpha = 20 + (random() % 50); + struct modelrodata_dl *rodata; + struct modelrwdata_dl *rwdata; + s32 spac = 0; + s32 op; + s32 nodetype; + + modelNodeGetModelRelativePosition(model, model0001a740(node), &relpos); + + spc8.f[0] = arg3->x - relpos.x; + spc8.f[1] = arg3->y - relpos.y; + spc8.f[2] = arg3->z - relpos.z; + + // This first pass over the node tree is deciding which modelnode to use. + curnode = node; + + while (curnode) { + s32 nodetype = curnode->type & 0xff; + + switch (nodetype) { + case MODELNODETYPE_DL: + rodata = &curnode->rodata->dl; + rwdata = modelGetNodeRwData(model, curnode); + + if (rwdata->gdl == NULL) { + break; + } + + // By default, the model instance's displaylist points to the + // one in the model definition. If it hasn't been changed we'll + // use the space... after the model definition's colour table? + // Let's hope that's not being used by other instances... + if (rwdata->gdl == rodata->primary) { + gdlptr = (Gfx *)((u32)rodata->colourtable + ((u32)rodata->primary & 0xffffff)); + } else { + gdlptr = rwdata->gdl; + } + + if (rodata->secondary) { + gdlptr2 = (Gfx *)((u32)rodata->colourtable + ((u32)rodata->secondary & 0xffffff)); + } else { + gdlptr2 = NULL; + } + + // Iterate the primary DL, and once the end is reached + // iterate the secondary DL if we have one. + while (true) { + op = *(s8 *)&gdlptr->words.w0; + + if (op == G_ENDDL) { + if (gdlptr2) { + // Switch to second DL + gdlptr = gdlptr2; + gdlptr2 = NULL; + } else { + // We're done + gdlptr = NULL; + break; + } + } else { + // Note: We should have found an MTX op before VTX. + if (op == G_VTX) { + u8 *ptr = (u8 *)&gdlptr->words.w0; + u32 word = gdlptr->words.w1 & 0xffffff; + s32 numverts; + s32 i; + + vertices = (struct gfxvtx *)((u32)rodata->vertices + word); + numverts = (u32)ptr[1] / 16 + 1; + + if (posnode) { + for (i = 0; i < numverts; i++) { + s32 x = spbc[0] - vertices[i].x; + s32 y = spbc[1] - vertices[i].y; + s32 z = spbc[2] - vertices[i].z; + s32 dist = x * x + y * y + z * z; + + if (dist < mindist) { + mindist = dist; + bestnode = curnode; + bestcoords[0] = vertices[i].x + (s32)spd4.f[0]; + bestcoords[1] = vertices[i].y + (s32)spd4.f[1]; + bestcoords[2] = vertices[i].z + (s32)spd4.f[2]; + } + } + } + } else if (op == G_MTX) { + u32 addr = gdlptr->words.w1 & 0xffffff; + posnode = model0001a634(model, addr / sizeof(Mtxf)); + modelNodeGetModelRelativePosition(model, posnode, &spd4); + + spbc[0] = spd4.x + spc8.x; + spbc[1] = spd4.y + spc8.y; + spbc[2] = spd4.z + spc8.z; + } + + gdlptr++; + } + } + break; + case MODELNODETYPE_DISTANCE: + model0001c784(model, curnode); + break; + case MODELNODETYPE_TOGGLE: + model0001c7d0(model, curnode); + break; + case MODELNODETYPE_HEADSPOT: + modelAttachHead(model, curnode); + break; + } + + if (curnode->child && (curnode == node + || (nodetype != MODELNODETYPE_BBOX && nodetype != MODELNODETYPE_11))) { + curnode = curnode->child; + } else { + while (curnode) { + if (curnode == node) { + curnode = NULL; + break; + } + + if (curnode->next) { + curnode = curnode->next; + break; + } + + curnode = curnode->parent; + } + } + } + + if (bestnode == NULL) { + return; + } + + // Do a pass over the entire model's tree, looking for vertices that share + // the chosen vertex, and darken then. + curnode = model->filedata->rootnode; + + while (curnode) { + nodetype = curnode->type & 0xff; + + switch (nodetype) { + case MODELNODETYPE_DL: + rodata = &curnode->rodata->dl; + rwdata = modelGetNodeRwData(model, curnode); + + if (rwdata->gdl == NULL) { + break; + } + + if (rwdata->gdl == rodata->primary) { + gdlptr = (Gfx *)((u32)rodata->colourtable + ((u32)rodata->primary & 0xffffff)); + } else { + gdlptr = rwdata->gdl; + } + + if (rodata->secondary) { + gdlptr2 = (Gfx *)((u32)rodata->colourtable + ((u32)rodata->secondary & 0xffffff)); + } else { + gdlptr2 = NULL; + } + + while (true) { + s32 op = *(s8 *)&gdlptr->words.w0; + + if (op == G_ENDDL) { + if (gdlptr2) { + // Switch to second DL + gdlptr = gdlptr2; + gdlptr2 = NULL; + } else { + // We're done + gdlptr = NULL; + break; + } + } else { + // Note: We should have found an MTX op before VTX. + if (op == G_VTX) { + u8 *ptr = (u8 *)&gdlptr->words.w0; + u32 word = gdlptr->words.w1 & 0xffffff; + struct gfxvtx *vertices = (struct gfxvtx *)((u32)rodata->vertices + word); + s32 numverts = (u32)ptr[1] / 16 + 1; + s32 i; + + if (posnode) { + for (i = 0; i < numverts; i++) { + s32 x = vertices[i].x + (s32)spd4.f[0]; + s32 y = vertices[i].y + (s32)spd4.f[1]; + s32 z = vertices[i].z + (s32)spd4.f[2]; + + if (x == bestcoords[0] && y == bestcoords[1] && z == bestcoords[2]) { + u32 tmp = ALIGN8((u32)&rodata->vertices[(u32)rodata->numvertices]); // u32 0xc + + if ((u32)rwdata->colours == tmp) { + struct colour *colours = vtxstoreAllocate(rodata->numcolours, VTXSTORETYPE_CHRCOL, 0, 0); + s32 j; + + if (colours) { + for (j = 0; j < rodata->numcolours; j++) { + colours[j] = rwdata->colours[j]; + } + + rwdata->colours = colours; + + tmp = ALIGN8((s32)&rodata->vertices[rodata->numvertices]); // s32 0xc + } else { + tmp = ALIGN8((s32)rodata->vertices + rodata->numvertices * 6); // s32 0xc + } + } + + if ((u32)rwdata->colours != tmp) { + u32 offset = rwdata->vertices[word / 12u + i].colour >> 2; // u32 0xc (both divide and mult) + struct colour *colours = (struct colour *) ((u32)rwdata->colours + spac); + + colours[offset].a = alpha; + } + } + } + } + } else if (op == G_MTX) { + u32 addr = gdlptr->words.w1 & 0xffffff; + posnode = model0001a634(model, addr / sizeof(Mtxf)); + modelNodeGetModelRelativePosition(model, posnode, &spd4); + } else if (op == G_SETCOLOR) { + spac = gdlptr->words.w1 & 0xffffff; + } + + gdlptr++; + } + } + break; + case MODELNODETYPE_DISTANCE: + model0001c784(model, curnode); + break; + case MODELNODETYPE_TOGGLE: + model0001c7d0(model, curnode); + break; + case MODELNODETYPE_HEADSPOT: + modelAttachHead(model, curnode); + break; + } + + if (curnode->child) { + curnode = curnode->child; + } else { + while (curnode) { + if (curnode && curnode->next) { + curnode = curnode->next; + break; + } + + curnode = curnode->parent; + } + } + } +} +#endif /** * Bruise a chr by darkening their vertices. diff --git a/src/game/chraction.c b/src/game/chraction.c index a9737aee8..681b50e85 100644 --- a/src/game/chraction.c +++ b/src/game/chraction.c @@ -9838,6 +9838,7 @@ void chrCalculateTrajectory(struct coord *frompos, f32 arg1, struct coord *aimpo arg3->z = zvel / latvel * sp28; } +#if MATCHING #if VERSION == VERSION_JPN_FINAL GLOBAL_ASM( glabel chrShoot @@ -17758,7 +17759,7 @@ glabel var7f1a9184 /* f041238: 00000000 */ sll $zero,$zero,0x0 ); #endif - +#else /** * Fire the chr's gun, check what was hit and do all the appropriate things such * as dealing damage, creating beams and sparks and playing sounds. @@ -17772,616 +17773,617 @@ glabel var7f1a9184 // - Float calculations near 65536 have diffent codegen // - Calculation of sp168 and spcc have reordered instructions // - Calculate of xdiff/ydiff/zdiff prior to chrCalculateHit is different -//void chrShoot(struct chrdata *chr, s32 handnum) -//{ -// struct prop *chrprop = chr->prop; // 274 -// struct prop *gunprop; -// u8 isaibot = false; // 26f -// u8 normalshoot = true; // 26e -// -// if (chr->aibot) { -// isaibot = true; -// } -// -// gunprop = chrGetHeldProp(chr, handnum); -// -// if (gunprop) { -// bool firingthistick = false; -// struct weaponobj *weapon = gunprop->weapon; // 264 -// struct gset gset; // 260 -// struct prop *targetprop = chrGetTargetProp(chr); // 25c -// u32 attackflags; -// bool shotdue; // 254 -// bool makebeam; // 250 -// struct coord gunpos; // 244 -// s16 gunrooms[8]; // 234 -// struct coord hitpos; // 228 -// bool hitsomething; // 224 -// s16 hitrooms[8]; // 214 -// bool sp210; -// s32 tickspershot; -// f32 sp208; // unused? -// -// gset = weapon->gset; -// attackflags = ATTACKFLAG_AIMATTARGET; -// -// if (chr->actiontype == ACT_ATTACK -// || chr->actiontype == ACT_BOT_ATTACKSTAND -// || chr->actiontype == ACT_BOT_ATTACKKNEEL -// || chr->actiontype == ACT_BOT_ATTACKSTRAFE) { -// attackflags = chr->act_attack.flags; -// } -// -// shotdue = false; -// makebeam = false; -// hitsomething = false; -// sp210 = false; -// -// // Most guns can fire at most once every few ticks - even automatics. -// // The chr's firecount property tracks how many ticks have elapsed since -// // the last bullet, which is used to determine if another bullet should -// // be discharged on this tick. -// tickspershot = weaponGetNumTicksPerShot(gset.weaponnum, gset.weaponfunc); -// -// if (tickspershot <= 0) { -// shotdue = true; -// makebeam = true; -// } else { -// if (chr->aibot -// && chr->aibot->weaponnum == WEAPON_REAPER -// && chr->aibot->gunfunc == FUNC_PRIMARY) { -// sp208 = (TICKS(90) - chr->aibot->reaperspeed[handnum]); -// sp208 *= 1.0f / 1.8f; -// tickspershot *= sp208 + 1; -// } -// -// chr->firecount[handnum] += g_Vars.lvupdate240_60; -// -// if (chr->firecount[handnum] >= tickspershot) { -// chr->firecount[handnum] = 0; -// chr->unk32c_12 ^= 1 << handnum; -// -// shotdue = true; -// -// if ((chr->unk32c_12 & (1 << handnum)) || gset.weaponnum == WEAPON_LASER) { -// makebeam = true; -// } -// -// if (chr->actiontype == ACT_ATTACK) { -// if (modelGetAnimNum(chr->model) == ANIM_SNIPING_ONGROUND) { -// chr->act_attack.numshots++; -// } -// } -// } -// } -// -// if (shotdue) { -// f32 aimangle = chrGetAimAngle(chr); -// f32 sp200 = func0f03e754(chr); -// bool sp1fc = isaibot ? CDTYPE_PLAYERS : 0; -// -// firingthistick = true; -// -// if (!chrGetGunPos(chr, handnum, &gunpos)) { -// // Gun is off screen - use a quick but inexact calculation -// gunpos.f[0] = chrprop->pos.f[0]; -// gunpos.f[1] = chrprop->pos.f[1] + 30; -// gunpos.f[2] = chrprop->pos.f[2]; -// -// if (handnum == HAND_LEFT) { -// gunpos.f[0] += cosf(aimangle) * 10; -// gunpos.f[2] += -sinf(aimangle) * 10; -// } else { -// gunpos.f[0] += -cosf(aimangle) * 10; -// gunpos.f[2] += sinf(aimangle) * 10; -// } -// } -// -// // Check that the chr isn't clipping their gun through anything such -// // as another chr or a closed door. If they are, the shot won't be -// // taken because that wouldn't be fair. -// // How nice of the developers to check for this! -// chrSetPerimEnabled(chr, false); -// -// if (cd0002de34(&chrprop->pos, chrprop->rooms, &gunpos, gunrooms, -// CDTYPE_DOORS | CDTYPE_CHRS | CDTYPE_BG | CDTYPE_DOORSWITHOUTFLAG | sp1fc, -// 0x10) == CDRESULT_COLLISION) { -// firingthistick = false; -// } -// -// chrSetPerimEnabled(chr, true); -// -// if (firingthistick) { -// bool angleok = false; // 1f8 -// bool hitplayer = false; // 1f4 -// bool effective = true; // 1f0 -// u32 sp1ec; -// struct coord vector; // 1e0 -// f32 xdiff; -// f32 ydiff; -// f32 zdiff; -// f32 sqshotdist; // 1d0 -// struct prop *hitprop = NULL; // 1cc -// u32 sp1c8 = isaibot -// ? CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_CHRS | CDTYPE_PATHBLOCKER | CDTYPE_BG | CDTYPE_DOORSWITHOUTFLAG | CDTYPE_PLAYERS -// : CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_CHRS | CDTYPE_PATHBLOCKER | CDTYPE_BG | CDTYPE_DOORSWITHOUTFLAG; -// u32 sp1c4; -// bool isshootingeyespy = CHRRACE(targetprop->chr) == RACE_EYESPY && chrGetDistanceToTarget(chr) > 150; // 1c0 -// bool fudgeforeyespy = false; // 1bc -// -// if (isshootingeyespy) { -// vector.f[0] = xdiff = targetprop->pos.f[0] - gunpos.f[0]; -// vector.f[1] = ydiff = targetprop->pos.f[1] - gunpos.f[1]; -// vector.f[2] = zdiff = targetprop->pos.f[2] - gunpos.f[2]; -// -// guNormalize(&vector.f[0], &vector.f[1], &vector.f[2]); -// propSetPerimEnabled(targetprop, true); -// } else { -// vector.f[0] = cosf(sp200) * sinf(aimangle); -// vector.f[1] = sinf(sp200); -// vector.f[2] = cosf(sp200) * cosf(aimangle); -// -// if (isaibot) { -// bgunCalculateBotShotSpread(&vector, chr->aibot->weaponnum, chr->aibot->gunfunc, chr->aibot->burstsdone[handnum], botGuessCrouchPos(chr), chr->weapons_held[0] && chr->weapons_held[1]); -// } -// } -// -// // Handle Farsight shots by aibots specially -// // because they can shoot through walls. -// if (chr->aibot && gset.weaponnum == WEAPON_FARSIGHT && !chr->aibot->unk128) { -// makebeam = true; -// -// // This function can never return 2 though... -// if (botactShootFarsight(chr, 0, &vector, &gunpos) == 2) { -// normalshoot = random() % 255 > 200; -// } -// } -// -// // Check if the shot would hit anything -// hitpos.f[0] = gunpos.f[0] + vector.f[0] * 65536; -// hitpos.f[1] = gunpos.f[1] + vector.f[1] * 65536; -// hitpos.f[2] = gunpos.f[2] + vector.f[2] * 65536; -// -// chrSetPerimEnabled(chr, false); -// -// if (isaibot) { -// g_Vars.useperimshoot = true; -// } -// -// if (cdTestAToB4(&gunpos, gunrooms, &hitpos, sp1c8, 0x10) == CDRESULT_COLLISION) { -// hitsomething = true; -// cdGetPos(&hitpos, 12072, "chraction.c"); -// hitprop = cdGetObstacle(); -// } -// -// chrSetPerimEnabled(chr, true); -// -// if (isaibot) { -// g_Vars.useperimshoot = false; -// } -// -// // Eyespy is small and hard to hit, so make it a 50/50 chance -// if (hitprop == NULL && isshootingeyespy) { -// fudgeforeyespy = random() % 100 > 50; -// -// if (fudgeforeyespy) { -// hitprop = targetprop; -// -// hitpos.x = targetprop->pos.x; -// hitpos.y = targetprop->pos.y; -// hitpos.z = targetprop->pos.z; -// } -// } -// -// xdiff = hitpos.x - gunpos.x; -// ydiff = hitpos.y - gunpos.y; -// zdiff = hitpos.z - gunpos.z; -// -// sqshotdist = xdiff * xdiff + ydiff * ydiff + zdiff * zdiff; -// -// // Handle projectile launchers specially -// if (gset.weaponnum == WEAPON_ROCKETLAUNCHER -// || gset.weaponnum == WEAPON_SLAYER -// || (gset.weaponnum == WEAPON_SUPERDRAGON && gset.weaponfunc == FUNC_SECONDARY) -// || gset.weaponnum == WEAPON_DEVASTATOR -// || gset.weaponnum == WEAPON_CROSSBOW -// || gset.weaponnum == WEAPON_ROCKETLAUNCHER_34) { -// makebeam = false; -// -// // AI bots won't fire their projectile weapon in less than -// // 4 metres of space -// if (isaibot || sqshotdist > 400 * 400) { -// struct weaponobj *projectileobj; // 1b8 -// Mtxf sp178; -// struct coord sp16c; -// f32 sp168; -// struct coord sp15c; -// Mtxf sp11c; -// Mtxf spdc; -// struct weapon *weapondef = weaponFindById(gset.weaponnum); -// struct weaponfunc_shootprojectile *func = weapondef->functions[gset.weaponfunc]; // d4 -// -// // Handle creating the projectile -// if (gset.weaponnum == WEAPON_ROCKETLAUNCHER -// || gset.weaponnum == WEAPON_ROCKETLAUNCHER_34 -// || gset.weaponnum == WEAPON_SLAYER) { -// s32 rockettype = WEAPON_ROCKET; -// -// if (func->base.base.flags & FUNCFLAG_HOMINGROCKET) { -// rockettype = WEAPON_HOMINGROCKET; -// } -// -// projectileobj = weaponCreateProjectileFromWeaponNum(func->projectilemodelnum, rockettype, chr); -// } else if (gset.weaponnum == WEAPON_CROSSBOW) { -// projectileobj = weaponCreateProjectileFromWeaponNum(func->projectilemodelnum, WEAPON_BOLT, chr); -// -// if (projectileobj) { -// projectileobj->gunfunc = gset.weaponfunc; -// } -// } else if (gset.weaponnum == WEAPON_DEVASTATOR) { -// projectileobj = weaponCreateProjectileFromWeaponNum(func->projectilemodelnum, WEAPON_GRENADEROUND, chr); -// -// if (projectileobj) { -// projectileobj->gunfunc = gset.weaponfunc; -// } -// } else if (gset.weaponnum == WEAPON_SUPERDRAGON) { -// projectileobj = weaponCreateProjectileFromWeaponNum(func->projectilemodelnum, WEAPON_GRENADEROUND, chr); -// -// if (projectileobj) { -// projectileobj->gunfunc = FUNC_2; -// } -// } else { -// // Unreachable -// projectileobj = weaponCreateProjectileFromGset(func->projectilemodelnum, &gset, g_Vars.currentplayer->prop->chr); -// } -// -// if (projectileobj) { -// f32 spcc; -// -// sp168 = func->unk4c * (1.0f / 0.6f) / 60.0f; -// spcc = func->unk54 * (1.0f / 0.6f); -// -// // AI bots are a bit smarter than solo chrs -// // with regard to how they aim their projectiles -// if (isaibot && chrIsTargetInFov(chr, 30, 0)) { -// bool hasaimpos = false; -// f32 tmp1; -// struct coord aimpos; // b8 -// -// if (gset.weaponfunc == FUNC_PRIMARY && -// (gset.weaponnum == WEAPON_ROCKETLAUNCHER -// || gset.weaponnum == WEAPON_ROCKETLAUNCHER_34 -// || gset.weaponnum == WEAPON_SLAYER)) { -// if (targetprop->type == PROPTYPE_CHR || targetprop->type == PROPTYPE_PLAYER) { -// // Rockets - aim at target's feet -// aimpos.f[0] = targetprop->pos.f[0]; -// aimpos.f[1] = targetprop->chr->manground; -// aimpos.f[2] = targetprop->pos.f[2]; -// -// vector.f[0] = aimpos.f[0] - gunpos.f[0]; -// vector.f[1] = aimpos.f[1] - gunpos.f[1]; -// vector.f[2] = aimpos.f[2] - gunpos.f[2]; -// -// guNormalize(&vector.f[0], &vector.f[1], &vector.f[2]); -// hasaimpos = true; -// } -// } else if ((gset.weaponnum == WEAPON_DEVASTATOR && gset.weaponfunc == FUNC_PRIMARY) -// || gset.weaponnum == WEAPON_SUPERDRAGON) { -// if (targetprop->type == PROPTYPE_CHR || targetprop->type == PROPTYPE_PLAYER) { -// // Grenades - aim at target's feet -// aimpos.x = targetprop->pos.x; -// aimpos.y = targetprop->chr->manground; -// aimpos.z = targetprop->pos.z; -// -// chrCalculateTrajectory(&gunpos, spcc, &aimpos, &vector); -// hasaimpos = true; -// } -// } else if ((gset.weaponnum == WEAPON_DEVASTATOR && gset.weaponfunc == FUNC_SECONDARY) -// || gset.weaponnum == WEAPON_CROSSBOW) { -// // Wall hugger grenade or crossbow - aim at target directly -// aimpos.x = targetprop->pos.x; -// aimpos.y = targetprop->pos.y; -// aimpos.z = targetprop->pos.z; -// -// if (targetprop->type == PROPTYPE_PLAYER) { -// aimpos.y -= 25; -// } -// -// chrCalculateTrajectory(&gunpos, spcc, &aimpos, &vector); -// hasaimpos = true; -// } -// -// if (hasaimpos) { -// f32 angle = chrGetAngleToPos(chr, &aimpos); // b4 -// f32 cos = cosf(angle); // b0 -// f32 sin = sinf(angle); -// -// tmp1 = vector.f[0]; -// vector.x = vector.f[2] * sin + vector.f[0] * cos; -// vector.z = vector.f[2] * cos - tmp1 * sin; -// } -// } -// -// // Calculate and projectile's matrix, -// // spawn position and speed -// mtx4LoadIdentity(&sp178); -// mtx4LoadXRotation(sp200, &sp11c); -// mtx4LoadYRotation(aimangle, &spdc); -// mtx00015be0(&spdc, &sp11c); -// -// sp15c.f[0] = xdiff = vector.f[0] * sp168; -// sp15c.f[1] = ydiff = vector.f[1] * sp168; -// sp15c.f[2] = zdiff = vector.f[2] * sp168; -// -// sp16c.x = vector.f[0] * spcc + xdiff * g_Vars.lvupdate240freal; -// sp16c.y = vector.f[1] * spcc + ydiff * g_Vars.lvupdate240freal; -// sp16c.z = vector.f[2] * spcc + zdiff * g_Vars.lvupdate240freal; -// -// projectileobj->timer240 = func->timer60; -// -// if (projectileobj->timer240 != -1) { -//#if PAL -// projectileobj->timer240 = projectileobj->timer240 * 200 / 60; -//#else -// projectileobj->timer240 *= 4; -//#endif -// } -// -// bgun0f09ebcc(&projectileobj->base, &gunpos, gunrooms, &sp11c, &sp16c, &sp178, chrprop, &gunpos); -// -// if (projectileobj->base.hidden & OBJHFLAG_PROJECTILE) { -// if (func->base.base.flags & FUNCFLAG_PROJECTILE_LIGHTWEIGHT) { -// projectileobj->base.projectile->flags |= PROJECTILEFLAG_LIGHTWEIGHT; -// } else if (func->base.base.flags & FUNCFLAG_PROJECTILE_POWERED) { -// projectileobj->base.projectile->flags |= PROJECTILEFLAG_POWERED; -// } -// -// projectileobj->base.projectile->unk010 = sp15c.x; -// projectileobj->base.projectile->unk014 = sp15c.y; -// projectileobj->base.projectile->unk018 = sp15c.z; -// -// projectileobj->base.projectile->pickuptimer240 = 240; -// projectileobj->base.projectile->unk08c = func->unk5c; -// projectileobj->base.projectile->unk098 = func->unk50 * (1.0f / 0.6f); -// -// projectileobj->base.projectile->targetprop = chrGetTargetProp(chr); -// -// // Play sound -// if (func->unk60 > 0) { -// propsnd0f0939f8(NULL, projectileobj->base.prop, func->unk60, -1, -// -1, 0, 0, 0, NULL, -1, NULL, -1, -1, -1, -1); -// } -// } -// } -// } else { -// firingthistick = false; -// } -// -// normalshoot = false; -// } else if (gset.weaponnum == WEAPON_MAULER && isaibot && gset.weaponfunc == FUNC_SECONDARY) { -// gset.unk063a = (s32)(chr->aibot->maulercharge[handnum] * 10); -// chr->aibot->maulercharge[handnum] = 0; -// } -// -// if (normalshoot) { -// if (!isaibot) { -// if ((attackflags & ATTACKFLAG_AIMATTARGET) -// && targetprop->type == PROPTYPE_PLAYER -// && chrCanSeeAttackTarget(chr, &gunpos, gunrooms, false) -//#if VERSION >= VERSION_NTSC_1_0 -// && chrCompareTeams(targetprop->chr, chr, COMPARE_ENEMIES) -//#endif -// ) { -// // Solo chr shooting at a player -// f32 xdiff = targetprop->pos.f[0] - gunpos.f[0] - vector.f[0] * 15; -// f32 ydiff = targetprop->pos.f[1] - gunpos.f[1] - vector.f[1] * 15; -// f32 zdiff = targetprop->pos.f[2] - gunpos.f[2] - vector.f[2] * 15; -// -// if (xdiff * xdiff + ydiff * ydiff + zdiff * zdiff <= sqshotdist) { -// // Player has a chance of being hit -// chrCalculateHit(chr, &angleok, &hitplayer, &gset); -// -// // If the player was hit then turn off effective -// // (There's no need to check other props for -// // hits later on in this function) -// effective = !hitplayer; -// -// if (angleok -// && (chr->actiontype == ACT_ATTACK -// || chr->actiontype == ACT_ATTACKROLL -// || chr->actiontype == ACT_BOT_ATTACKSTAND -// || chr->actiontype == ACT_BOT_ATTACKKNEEL -// || chr->actiontype == ACT_BOT_ATTACKSTRAFE)) { -// chr->act_attack.lastontarget60 = g_Vars.lvframe60; -// } -// } -// } else { -// // Solo chr shooting at something else -// if (chr->actiontype == ACT_ATTACK -// || chr->actiontype == ACT_ATTACKROLL -// || chr->actiontype == ACT_BOT_ATTACKSTAND -// || chr->actiontype == ACT_BOT_ATTACKKNEEL -// || chr->actiontype == ACT_BOT_ATTACKSTRAFE) { -// chr->act_attack.lastontarget60 = g_Vars.lvframe60; -// } -// } -// -// if (hitplayer) { -// f32 damage = gsetGetDamage(&gset); // 9c -// struct modelnode *node = NULL; // 98 -// struct model *model = NULL; // 94 -// s32 side = -1; // 90 -// s32 hitpart = HITPART_GENERAL; // 8c -// struct chrdata *targetchr = targetprop->chr; // 88 -// -// hitpos.x = targetprop->pos.x; -// hitpos.y = targetprop->pos.y; -// hitpos.z = targetprop->pos.z; -// -// if (random() % 2) { -// hitpos.y += 2 + random() % 10; -// } else { -// hitpos.y -= 2 + random() % 10; -// } -// -// bgunPlayPropHitSound(&gset, targetprop, -1); -// -// if (targetchr->model && chrGetShield(targetchr) > 0) { -// chrCalculateShieldHit(targetchr, &hitpos, &vector, &node, &hitpart, &model, &side); -// } -// -// func0f0341dc(targetchr, damage, &vector, &gset, chr->prop, HITPART_GENERAL, targetprop, node, model, side, NULL); -// } else if ((hitprop == NULL || (hitprop->type != PROPTYPE_CHR && hitprop->type != PROPTYPE_PLAYER)) -// && sqshotdist < 100 * 100) { -// // Hit the background or something other than a -// // player or chr, and the shot distance was less -// // than 1 metre. Don't bother applying damage etc. -// effective = false; -// } -// } -// -// if (effective) { -// if (hitprop) { -// if (hitprop->type == PROPTYPE_PLAYER || hitprop->type == PROPTYPE_CHR) { -// // Hit a player or chr other than the one they -// // were aiming for -// if (isaibot -// || fudgeforeyespy -// || ((chr->chrflags & CHRCFLAG_00000040) && chrCompareTeams(hitprop->chr, chr, COMPARE_ENEMIES))) { -// struct modelnode *node = NULL; // 84 -// struct model *model = NULL; // 80 -// s32 side = -1; // 7c -// s32 hitpart = HITPART_GENERAL; // 78 -// f32 damage = gsetGetDamage(&gset); -// struct chrdata *hitchr = hitprop->chr; // 70 -// -// bgunPlayPropHitSound(&gset, hitprop, -1); -// -// if (hitchr->model && chrGetShield(hitchr) > 0) { -// chrCalculateShieldHit(hitchr, &hitpos, &vector, &node, &hitpart, &model, &side); -// } -// -// chrEmitSparks(hitchr, hitprop, hitpart, &hitpos, &vector, chr); -// func0f0341dc(hitchr, damage, &vector, &gset, chr->prop, HITPART_GENERAL, hitprop, node, model, side, NULL); -// } else { -// makebeam = false; -// firingthistick = false; -// } -// } else if (hitprop->type == PROPTYPE_OBJ -// || hitprop->type == PROPTYPE_WEAPON -// || hitprop->type == PROPTYPE_DOOR) { -// // Hit an object -// struct defaultobj *hitobj = hitprop->obj; // 6c -// s32 playernum = -1; // 68 -// -// if (g_Vars.mplayerisrunning) { -// playernum = mpPlayerGetIndex(chr); -// } -// -// bgunPlayPropHitSound(&gset, hitprop, -1); -// func0f065e74(&gunpos, gunrooms, &hitpos, hitrooms); -// sp210 = true; -// -// if (chrIsUsingPaintball(chr)) { -// sparksCreate(hitrooms[0], hitprop, &hitpos, NULL, NULL, SPARKTYPE_PAINT); -// } else { -// sparksCreate(hitrooms[0], hitprop, &hitpos, NULL, NULL, SPARKTYPE_DEFAULT); -// } -// -// if (g_MissionConfig.iscoop && chr->team == TEAM_ALLY -// && (hitobj->flags2 & OBJFLAG2_IMMUNETOANTI)) { -// // empty -// } else { -// objTakeGunfire(hitobj, gsetGetDamage(&gset), &hitpos, gset.weaponnum, playernum); -// } -// } -// } else if (hitsomething) { -// // Hit the background -// func0f065e74(&gunpos, gunrooms, &hitpos, hitrooms); -// sp210 = true; -// bgunPlayBgHitSound(&gset, &hitpos, -1, hitrooms); -// -// if (chrIsUsingPaintball(chr)) { -// sparksCreate(hitrooms[0], 0, &hitpos, NULL, NULL, SPARKTYPE_PAINT); -// } else { -// sparksCreate(hitrooms[0], 0, &hitpos, NULL, NULL, SPARKTYPE_DEFAULT); -// } -// } -// -// // Create explosion if using Phoenix -// if (gset.weaponnum == WEAPON_PHOENIX && gset.weaponfunc == FUNC_SECONDARY) { -// s32 playernum = chr->aibot ? mpPlayerGetIndex(chr) : g_Vars.currentplayernum; -// -// if (!sp210) { -// func0f065e74(&gunpos, gunrooms, &hitpos, hitrooms); -// } -// -// explosionCreateSimple(0, &hitpos, hitrooms, EXPLOSIONTYPE_PHOENIX, playernum); -// } -// } -// } -// -// if (isshootingeyespy) { -// propSetPerimEnabled(targetprop, false); -// } -// } -// } -// -// if (makebeam) { -// switch (gset.weaponnum) { -// case WEAPON_FALCON2: -// case WEAPON_FALCON2_SILENCER: -// case WEAPON_FALCON2_SCOPE: -// case WEAPON_MAGSEC4: -// case WEAPON_MAULER: -// case WEAPON_PHOENIX: -// case WEAPON_DY357MAGNUM: -// case WEAPON_DY357LX: -// case WEAPON_CMP150: -// case WEAPON_CYCLONE: -// case WEAPON_CALLISTO: -// case WEAPON_RCP120: -// case WEAPON_LAPTOPGUN: -// case WEAPON_DRAGON: -// case WEAPON_K7AVENGER: -// case WEAPON_AR34: -// case WEAPON_SUPERDRAGON: -// case WEAPON_REAPER: -// case WEAPON_SNIPERRIFLE: -// case WEAPON_FARSIGHT: -// case WEAPON_TRANQUILIZER: -// case WEAPON_LASER: -// case WEAPON_PP9I: -// case WEAPON_CC13: -// case WEAPON_KL01313: -// case WEAPON_KF7SPECIAL: -// case WEAPON_ZZT: -// case WEAPON_DMC: -// case WEAPON_AR53: -// case WEAPON_RCP45: -// makebeam = true; -// break; -// default: -// makebeam = false; -// break; -// } -// } -// -// chrCreateFireslot(chr, handnum, firingthistick, firingthistick && makebeam, &gunpos, &hitpos); -// -// if (isaibot) { -// if (firingthistick) { -// if (chr->aibot->loadedammo[handnum] > 0) { -// chr->aibot->loadedammo[handnum]--; -// } -// } -// -// chrSetFiring(chr, handnum, firingthistick && normalshoot); -// } else { -// chrSetFiring(chr, handnum, firingthistick); -// } -// } -//} +void chrShoot(struct chrdata *chr, s32 handnum) +{ + struct prop *chrprop = chr->prop; // 274 + struct prop *gunprop; + u8 isaibot = false; // 26f + u8 normalshoot = true; // 26e + + if (chr->aibot) { + isaibot = true; + } + + gunprop = chrGetHeldProp(chr, handnum); + + if (gunprop) { + bool firingthistick = false; + struct weaponobj *weapon = gunprop->weapon; // 264 + struct gset gset; // 260 + struct prop *targetprop = chrGetTargetProp(chr); // 25c + u32 attackflags; + bool shotdue; // 254 + bool makebeam; // 250 + struct coord gunpos; // 244 + s16 gunrooms[8]; // 234 + struct coord hitpos; // 228 + bool hitsomething; // 224 + s16 hitrooms[8]; // 214 + bool sp210; + s32 tickspershot; + f32 sp208; // unused? + + gset = weapon->gset; + attackflags = ATTACKFLAG_AIMATTARGET; + + if (chr->actiontype == ACT_ATTACK + || chr->actiontype == ACT_BOT_ATTACKSTAND + || chr->actiontype == ACT_BOT_ATTACKKNEEL + || chr->actiontype == ACT_BOT_ATTACKSTRAFE) { + attackflags = chr->act_attack.flags; + } + + shotdue = false; + makebeam = false; + hitsomething = false; + sp210 = false; + + // Most guns can fire at most once every few ticks - even automatics. + // The chr's firecount property tracks how many ticks have elapsed since + // the last bullet, which is used to determine if another bullet should + // be discharged on this tick. + tickspershot = weaponGetNumTicksPerShot(gset.weaponnum, gset.weaponfunc); + + if (tickspershot <= 0) { + shotdue = true; + makebeam = true; + } else { + if (chr->aibot + && chr->aibot->weaponnum == WEAPON_REAPER + && chr->aibot->gunfunc == FUNC_PRIMARY) { + sp208 = (TICKS(90) - chr->aibot->reaperspeed[handnum]); + sp208 *= 1.0f / 1.8f; + tickspershot *= sp208 + 1; + } + + chr->firecount[handnum] += g_Vars.lvupdate240_60; + + if (chr->firecount[handnum] >= tickspershot) { + chr->firecount[handnum] = 0; + chr->unk32c_12 ^= 1 << handnum; + + shotdue = true; + + if ((chr->unk32c_12 & (1 << handnum)) || gset.weaponnum == WEAPON_LASER) { + makebeam = true; + } + + if (chr->actiontype == ACT_ATTACK) { + if (modelGetAnimNum(chr->model) == ANIM_SNIPING_ONGROUND) { + chr->act_attack.numshots++; + } + } + } + } + + if (shotdue) { + f32 aimangle = chrGetAimAngle(chr); + f32 sp200 = func0f03e754(chr); + bool sp1fc = isaibot ? CDTYPE_PLAYERS : 0; + + firingthistick = true; + + if (!chrGetGunPos(chr, handnum, &gunpos)) { + // Gun is off screen - use a quick but inexact calculation + gunpos.f[0] = chrprop->pos.f[0]; + gunpos.f[1] = chrprop->pos.f[1] + 30; + gunpos.f[2] = chrprop->pos.f[2]; + + if (handnum == HAND_LEFT) { + gunpos.f[0] += cosf(aimangle) * 10; + gunpos.f[2] += -sinf(aimangle) * 10; + } else { + gunpos.f[0] += -cosf(aimangle) * 10; + gunpos.f[2] += sinf(aimangle) * 10; + } + } + + // Check that the chr isn't clipping their gun through anything such + // as another chr or a closed door. If they are, the shot won't be + // taken because that wouldn't be fair. + // How nice of the developers to check for this! + chrSetPerimEnabled(chr, false); + + if (cd0002de34(&chrprop->pos, chrprop->rooms, &gunpos, gunrooms, + CDTYPE_DOORS | CDTYPE_CHRS | CDTYPE_BG | CDTYPE_DOORSWITHOUTFLAG | sp1fc, + 0x10) == CDRESULT_COLLISION) { + firingthistick = false; + } + + chrSetPerimEnabled(chr, true); + + if (firingthistick) { + bool angleok = false; // 1f8 + bool hitplayer = false; // 1f4 + bool effective = true; // 1f0 + u32 sp1ec; + struct coord vector; // 1e0 + f32 xdiff; + f32 ydiff; + f32 zdiff; + f32 sqshotdist; // 1d0 + struct prop *hitprop = NULL; // 1cc + u32 sp1c8 = isaibot + ? CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_CHRS | CDTYPE_PATHBLOCKER | CDTYPE_BG | CDTYPE_DOORSWITHOUTFLAG | CDTYPE_PLAYERS + : CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_CHRS | CDTYPE_PATHBLOCKER | CDTYPE_BG | CDTYPE_DOORSWITHOUTFLAG; + u32 sp1c4; + bool isshootingeyespy = CHRRACE(targetprop->chr) == RACE_EYESPY && chrGetDistanceToTarget(chr) > 150; // 1c0 + bool fudgeforeyespy = false; // 1bc + + if (isshootingeyespy) { + vector.f[0] = xdiff = targetprop->pos.f[0] - gunpos.f[0]; + vector.f[1] = ydiff = targetprop->pos.f[1] - gunpos.f[1]; + vector.f[2] = zdiff = targetprop->pos.f[2] - gunpos.f[2]; + + guNormalize(&vector.f[0], &vector.f[1], &vector.f[2]); + propSetPerimEnabled(targetprop, true); + } else { + vector.f[0] = cosf(sp200) * sinf(aimangle); + vector.f[1] = sinf(sp200); + vector.f[2] = cosf(sp200) * cosf(aimangle); + + if (isaibot) { + bgunCalculateBotShotSpread(&vector, chr->aibot->weaponnum, chr->aibot->gunfunc, chr->aibot->burstsdone[handnum], botGuessCrouchPos(chr), chr->weapons_held[0] && chr->weapons_held[1]); + } + } + + // Handle Farsight shots by aibots specially + // because they can shoot through walls. + if (chr->aibot && gset.weaponnum == WEAPON_FARSIGHT && !chr->aibot->targetinsight) { + makebeam = true; + + // This function can never return 2 though... + if (botactShootFarsight(chr, 0, &vector, &gunpos) == 2) { + normalshoot = random() % 255 > 200; + } + } + + // Check if the shot would hit anything + hitpos.f[0] = gunpos.f[0] + vector.f[0] * 65536; + hitpos.f[1] = gunpos.f[1] + vector.f[1] * 65536; + hitpos.f[2] = gunpos.f[2] + vector.f[2] * 65536; + + chrSetPerimEnabled(chr, false); + + if (isaibot) { + g_Vars.useperimshoot = true; + } + + if (cdTestAToB4(&gunpos, gunrooms, &hitpos, sp1c8, 0x10) == CDRESULT_COLLISION) { + hitsomething = true; + cdGetPos(&hitpos, 12072, "chraction.c"); + hitprop = cdGetObstacle(); + } + + chrSetPerimEnabled(chr, true); + + if (isaibot) { + g_Vars.useperimshoot = false; + } + + // Eyespy is small and hard to hit, so make it a 50/50 chance + if (hitprop == NULL && isshootingeyespy) { + fudgeforeyespy = random() % 100 > 50; + + if (fudgeforeyespy) { + hitprop = targetprop; + + hitpos.x = targetprop->pos.x; + hitpos.y = targetprop->pos.y; + hitpos.z = targetprop->pos.z; + } + } + + xdiff = hitpos.x - gunpos.x; + ydiff = hitpos.y - gunpos.y; + zdiff = hitpos.z - gunpos.z; + + sqshotdist = xdiff * xdiff + ydiff * ydiff + zdiff * zdiff; + + // Handle projectile launchers specially + if (gset.weaponnum == WEAPON_ROCKETLAUNCHER + || gset.weaponnum == WEAPON_SLAYER + || (gset.weaponnum == WEAPON_SUPERDRAGON && gset.weaponfunc == FUNC_SECONDARY) + || gset.weaponnum == WEAPON_DEVASTATOR + || gset.weaponnum == WEAPON_CROSSBOW + || gset.weaponnum == WEAPON_ROCKETLAUNCHER_34) { + makebeam = false; + + // AI bots won't fire their projectile weapon in less than + // 4 metres of space + if (isaibot || sqshotdist > 400 * 400) { + struct weaponobj *projectileobj; // 1b8 + Mtxf sp178; + struct coord sp16c; + f32 sp168; + struct coord sp15c; + Mtxf sp11c; + Mtxf spdc; + struct weapon *weapondef = weaponFindById(gset.weaponnum); + struct weaponfunc_shootprojectile *func = weapondef->functions[gset.weaponfunc]; // d4 + + // Handle creating the projectile + if (gset.weaponnum == WEAPON_ROCKETLAUNCHER + || gset.weaponnum == WEAPON_ROCKETLAUNCHER_34 + || gset.weaponnum == WEAPON_SLAYER) { + s32 rockettype = WEAPON_ROCKET; + + if (func->base.base.flags & FUNCFLAG_HOMINGROCKET) { + rockettype = WEAPON_HOMINGROCKET; + } + + projectileobj = weaponCreateProjectileFromWeaponNum(func->projectilemodelnum, rockettype, chr); + } else if (gset.weaponnum == WEAPON_CROSSBOW) { + projectileobj = weaponCreateProjectileFromWeaponNum(func->projectilemodelnum, WEAPON_BOLT, chr); + + if (projectileobj) { + projectileobj->gunfunc = gset.weaponfunc; + } + } else if (gset.weaponnum == WEAPON_DEVASTATOR) { + projectileobj = weaponCreateProjectileFromWeaponNum(func->projectilemodelnum, WEAPON_GRENADEROUND, chr); + + if (projectileobj) { + projectileobj->gunfunc = gset.weaponfunc; + } + } else if (gset.weaponnum == WEAPON_SUPERDRAGON) { + projectileobj = weaponCreateProjectileFromWeaponNum(func->projectilemodelnum, WEAPON_GRENADEROUND, chr); + + if (projectileobj) { + projectileobj->gunfunc = FUNC_2; + } + } else { + // Unreachable + projectileobj = weaponCreateProjectileFromGset(func->projectilemodelnum, &gset, g_Vars.currentplayer->prop->chr); + } + + if (projectileobj) { + f32 spcc; + + sp168 = func->unk4c * (1.0f / 0.6f) / 60.0f; + spcc = func->unk54 * (1.0f / 0.6f); + + // AI bots are a bit smarter than solo chrs + // with regard to how they aim their projectiles + if (isaibot && chrIsTargetInFov(chr, 30, 0)) { + bool hasaimpos = false; + f32 tmp1; + struct coord aimpos; // b8 + + if (gset.weaponfunc == FUNC_PRIMARY && + (gset.weaponnum == WEAPON_ROCKETLAUNCHER + || gset.weaponnum == WEAPON_ROCKETLAUNCHER_34 + || gset.weaponnum == WEAPON_SLAYER)) { + if (targetprop->type == PROPTYPE_CHR || targetprop->type == PROPTYPE_PLAYER) { + // Rockets - aim at target's feet + aimpos.f[0] = targetprop->pos.f[0]; + aimpos.f[1] = targetprop->chr->manground; + aimpos.f[2] = targetprop->pos.f[2]; + + vector.f[0] = aimpos.f[0] - gunpos.f[0]; + vector.f[1] = aimpos.f[1] - gunpos.f[1]; + vector.f[2] = aimpos.f[2] - gunpos.f[2]; + + guNormalize(&vector.f[0], &vector.f[1], &vector.f[2]); + hasaimpos = true; + } + } else if ((gset.weaponnum == WEAPON_DEVASTATOR && gset.weaponfunc == FUNC_PRIMARY) + || gset.weaponnum == WEAPON_SUPERDRAGON) { + if (targetprop->type == PROPTYPE_CHR || targetprop->type == PROPTYPE_PLAYER) { + // Grenades - aim at target's feet + aimpos.x = targetprop->pos.x; + aimpos.y = targetprop->chr->manground; + aimpos.z = targetprop->pos.z; + + chrCalculateTrajectory(&gunpos, spcc, &aimpos, &vector); + hasaimpos = true; + } + } else if ((gset.weaponnum == WEAPON_DEVASTATOR && gset.weaponfunc == FUNC_SECONDARY) + || gset.weaponnum == WEAPON_CROSSBOW) { + // Wall hugger grenade or crossbow - aim at target directly + aimpos.x = targetprop->pos.x; + aimpos.y = targetprop->pos.y; + aimpos.z = targetprop->pos.z; + + if (targetprop->type == PROPTYPE_PLAYER) { + aimpos.y -= 25; + } + + chrCalculateTrajectory(&gunpos, spcc, &aimpos, &vector); + hasaimpos = true; + } + + if (hasaimpos) { + f32 angle = chrGetAngleToPos(chr, &aimpos); // b4 + f32 cos = cosf(angle); // b0 + f32 sin = sinf(angle); + + tmp1 = vector.f[0]; + vector.x = vector.f[2] * sin + vector.f[0] * cos; + vector.z = vector.f[2] * cos - tmp1 * sin; + } + } + + // Calculate and projectile's matrix, + // spawn position and speed + mtx4LoadIdentity(&sp178); + mtx4LoadXRotation(sp200, &sp11c); + mtx4LoadYRotation(aimangle, &spdc); + mtx00015be0(&spdc, &sp11c); + + sp15c.f[0] = xdiff = vector.f[0] * sp168; + sp15c.f[1] = ydiff = vector.f[1] * sp168; + sp15c.f[2] = zdiff = vector.f[2] * sp168; + + sp16c.x = vector.f[0] * spcc + xdiff * g_Vars.lvupdate240freal; + sp16c.y = vector.f[1] * spcc + ydiff * g_Vars.lvupdate240freal; + sp16c.z = vector.f[2] * spcc + zdiff * g_Vars.lvupdate240freal; + + projectileobj->timer240 = func->timer60; + + if (projectileobj->timer240 != -1) { +#if PAL + projectileobj->timer240 = projectileobj->timer240 * 200 / 60; +#else + projectileobj->timer240 *= 4; +#endif + } + + bgun0f09ebcc(&projectileobj->base, &gunpos, gunrooms, &sp11c, &sp16c, &sp178, chrprop, &gunpos); + + if (projectileobj->base.hidden & OBJHFLAG_PROJECTILE) { + if (func->base.base.flags & FUNCFLAG_PROJECTILE_LIGHTWEIGHT) { + projectileobj->base.projectile->flags |= PROJECTILEFLAG_LIGHTWEIGHT; + } else if (func->base.base.flags & FUNCFLAG_PROJECTILE_POWERED) { + projectileobj->base.projectile->flags |= PROJECTILEFLAG_POWERED; + } + + projectileobj->base.projectile->unk010 = sp15c.x; + projectileobj->base.projectile->unk014 = sp15c.y; + projectileobj->base.projectile->unk018 = sp15c.z; + + projectileobj->base.projectile->pickuptimer240 = 240; + projectileobj->base.projectile->unk08c = func->unk5c; + projectileobj->base.projectile->unk098 = func->unk50 * (1.0f / 0.6f); + + projectileobj->base.projectile->targetprop = chrGetTargetProp(chr); + + // Play sound + if (func->soundnum > 0) { + propsnd0f0939f8(NULL, projectileobj->base.prop, func->soundnum, -1, + -1, 0, 0, 0, NULL, -1, NULL, -1, -1, -1, -1); + } + } + } + } else { + firingthistick = false; + } + + normalshoot = false; + } else if (gset.weaponnum == WEAPON_MAULER && isaibot && gset.weaponfunc == FUNC_SECONDARY) { + gset.unk063a = (s32)(chr->aibot->maulercharge[handnum] * 10); + chr->aibot->maulercharge[handnum] = 0; + } + + if (normalshoot) { + if (!isaibot) { + if ((attackflags & ATTACKFLAG_AIMATTARGET) + && targetprop->type == PROPTYPE_PLAYER + && chrCanSeeAttackTarget(chr, &gunpos, gunrooms, false) +#if VERSION >= VERSION_NTSC_1_0 + && chrCompareTeams(targetprop->chr, chr, COMPARE_ENEMIES) +#endif + ) { + // Solo chr shooting at a player + f32 xdiff = targetprop->pos.f[0] - gunpos.f[0] - vector.f[0] * 15; + f32 ydiff = targetprop->pos.f[1] - gunpos.f[1] - vector.f[1] * 15; + f32 zdiff = targetprop->pos.f[2] - gunpos.f[2] - vector.f[2] * 15; + + if (xdiff * xdiff + ydiff * ydiff + zdiff * zdiff <= sqshotdist) { + // Player has a chance of being hit + chrCalculateHit(chr, &angleok, &hitplayer, &gset); + + // If the player was hit then turn off effective + // (There's no need to check other props for + // hits later on in this function) + effective = !hitplayer; + + if (angleok + && (chr->actiontype == ACT_ATTACK + || chr->actiontype == ACT_ATTACKROLL + || chr->actiontype == ACT_BOT_ATTACKSTAND + || chr->actiontype == ACT_BOT_ATTACKKNEEL + || chr->actiontype == ACT_BOT_ATTACKSTRAFE)) { + chr->act_attack.lastontarget60 = g_Vars.lvframe60; + } + } + } else { + // Solo chr shooting at something else + if (chr->actiontype == ACT_ATTACK + || chr->actiontype == ACT_ATTACKROLL + || chr->actiontype == ACT_BOT_ATTACKSTAND + || chr->actiontype == ACT_BOT_ATTACKKNEEL + || chr->actiontype == ACT_BOT_ATTACKSTRAFE) { + chr->act_attack.lastontarget60 = g_Vars.lvframe60; + } + } + + if (hitplayer) { + f32 damage = gsetGetDamage(&gset); // 9c + struct modelnode *node = NULL; // 98 + struct model *model = NULL; // 94 + s32 side = -1; // 90 + s32 hitpart = HITPART_GENERAL; // 8c + struct chrdata *targetchr = targetprop->chr; // 88 + + hitpos.x = targetprop->pos.x; + hitpos.y = targetprop->pos.y; + hitpos.z = targetprop->pos.z; + + if (random() % 2) { + hitpos.y += 2 + random() % 10; + } else { + hitpos.y -= 2 + random() % 10; + } + + bgunPlayPropHitSound(&gset, targetprop, -1); + + if (targetchr->model && chrGetShield(targetchr) > 0) { + chrCalculateShieldHit(targetchr, &hitpos, &vector, &node, &hitpart, &model, &side); + } + + func0f0341dc(targetchr, damage, &vector, &gset, chr->prop, HITPART_GENERAL, targetprop, node, model, side, NULL); + } else if ((hitprop == NULL || (hitprop->type != PROPTYPE_CHR && hitprop->type != PROPTYPE_PLAYER)) + && sqshotdist < 100 * 100) { + // Hit the background or something other than a + // player or chr, and the shot distance was less + // than 1 metre. Don't bother applying damage etc. + effective = false; + } + } + + if (effective) { + if (hitprop) { + if (hitprop->type == PROPTYPE_PLAYER || hitprop->type == PROPTYPE_CHR) { + // Hit a player or chr other than the one they + // were aiming for + if (isaibot + || fudgeforeyespy + || ((chr->chrflags & CHRCFLAG_00000040) && chrCompareTeams(hitprop->chr, chr, COMPARE_ENEMIES))) { + struct modelnode *node = NULL; // 84 + struct model *model = NULL; // 80 + s32 side = -1; // 7c + s32 hitpart = HITPART_GENERAL; // 78 + f32 damage = gsetGetDamage(&gset); + struct chrdata *hitchr = hitprop->chr; // 70 + + bgunPlayPropHitSound(&gset, hitprop, -1); + + if (hitchr->model && chrGetShield(hitchr) > 0) { + chrCalculateShieldHit(hitchr, &hitpos, &vector, &node, &hitpart, &model, &side); + } + + chrEmitSparks(hitchr, hitprop, hitpart, &hitpos, &vector, chr); + func0f0341dc(hitchr, damage, &vector, &gset, chr->prop, HITPART_GENERAL, hitprop, node, model, side, NULL); + } else { + makebeam = false; + firingthistick = false; + } + } else if (hitprop->type == PROPTYPE_OBJ + || hitprop->type == PROPTYPE_WEAPON + || hitprop->type == PROPTYPE_DOOR) { + // Hit an object + struct defaultobj *hitobj = hitprop->obj; // 6c + s32 playernum = -1; // 68 + + if (g_Vars.mplayerisrunning) { + playernum = mpPlayerGetIndex(chr); + } + + bgunPlayPropHitSound(&gset, hitprop, -1); + func0f065e74(&gunpos, gunrooms, &hitpos, hitrooms); + sp210 = true; + + if (chrIsUsingPaintball(chr)) { + sparksCreate(hitrooms[0], hitprop, &hitpos, NULL, NULL, SPARKTYPE_PAINT); + } else { + sparksCreate(hitrooms[0], hitprop, &hitpos, NULL, NULL, SPARKTYPE_DEFAULT); + } + + if (g_MissionConfig.iscoop && chr->team == TEAM_ALLY + && (hitobj->flags2 & OBJFLAG2_IMMUNETOANTI)) { + // empty + } else { + objTakeGunfire(hitobj, gsetGetDamage(&gset), &hitpos, gset.weaponnum, playernum); + } + } + } else if (hitsomething) { + // Hit the background + func0f065e74(&gunpos, gunrooms, &hitpos, hitrooms); + sp210 = true; + bgunPlayBgHitSound(&gset, &hitpos, -1, hitrooms); + + if (chrIsUsingPaintball(chr)) { + sparksCreate(hitrooms[0], 0, &hitpos, NULL, NULL, SPARKTYPE_PAINT); + } else { + sparksCreate(hitrooms[0], 0, &hitpos, NULL, NULL, SPARKTYPE_DEFAULT); + } + } + + // Create explosion if using Phoenix + if (gset.weaponnum == WEAPON_PHOENIX && gset.weaponfunc == FUNC_SECONDARY) { + s32 playernum = chr->aibot ? mpPlayerGetIndex(chr) : g_Vars.currentplayernum; + + if (!sp210) { + func0f065e74(&gunpos, gunrooms, &hitpos, hitrooms); + } + + explosionCreateSimple(0, &hitpos, hitrooms, EXPLOSIONTYPE_PHOENIX, playernum); + } + } + } + + if (isshootingeyespy) { + propSetPerimEnabled(targetprop, false); + } + } + } + + if (makebeam) { + switch (gset.weaponnum) { + case WEAPON_FALCON2: + case WEAPON_FALCON2_SILENCER: + case WEAPON_FALCON2_SCOPE: + case WEAPON_MAGSEC4: + case WEAPON_MAULER: + case WEAPON_PHOENIX: + case WEAPON_DY357MAGNUM: + case WEAPON_DY357LX: + case WEAPON_CMP150: + case WEAPON_CYCLONE: + case WEAPON_CALLISTO: + case WEAPON_RCP120: + case WEAPON_LAPTOPGUN: + case WEAPON_DRAGON: + case WEAPON_K7AVENGER: + case WEAPON_AR34: + case WEAPON_SUPERDRAGON: + case WEAPON_REAPER: + case WEAPON_SNIPERRIFLE: + case WEAPON_FARSIGHT: + case WEAPON_TRANQUILIZER: + case WEAPON_LASER: + case WEAPON_PP9I: + case WEAPON_CC13: + case WEAPON_KL01313: + case WEAPON_KF7SPECIAL: + case WEAPON_ZZT: + case WEAPON_DMC: + case WEAPON_AR53: + case WEAPON_RCP45: + makebeam = true; + break; + default: + makebeam = false; + break; + } + } + + chrCreateFireslot(chr, handnum, firingthistick, firingthistick && makebeam, &gunpos, &hitpos); + + if (isaibot) { + if (firingthistick) { + if (chr->aibot->loadedammo[handnum] > 0) { + chr->aibot->loadedammo[handnum]--; + } + } + + chrSetFiring(chr, handnum, firingthistick && normalshoot); + } else { + chrSetFiring(chr, handnum, firingthistick); + } + } +} +#endif void func0f041a74(struct chrdata *chr) { @@ -19985,6 +19987,7 @@ bool chrNavCheckForObstacle(struct chrdata *chr, struct coord *chrpos, s16 *chrr return result; } +#if MATCHING GLOBAL_ASM( glabel chrNavTryObstacle .late_rodata @@ -20204,86 +20207,87 @@ glabel var7f1a925c /* f045a68: 03e00008 */ jr $ra /* f045a6c: 00000000 */ nop ); - +#else // Mismatch: regalloc -//bool chrNavTryObstacle(struct chrdata *chr, struct coord *arg1, bool arg2, struct coord *arg3, f32 radius, bool arg5, struct coord *nextpos, struct waydata *waydata, f32 arg8, s32 cdtypes, s32 arg10) -//{ -// struct prop *prop = chr->prop; // 74 -// struct coord sp68; -// struct coord sp5c; -// f32 norm = 1; // 58 -// f32 sp54; -// struct coord sp48; -// struct coord *sp44; -// struct coord *sp40; -// -// if (arg2) { -// sp44 = arg1; -// sp40 = arg3; -// } else { -// sp44 = arg3; -// sp40 = arg1; -// } -// -// sp68.x = arg1->f[0] - prop->pos.f[0]; -// sp68.y = 0; -// sp68.z = arg1->f[2] - prop->pos.f[2]; -// -// if (sp68.f[0] || sp68.f[2]) { -// f32 tmp = sqrtf(sp68.f[0] * sp68.f[0] + sp68.f[2] * sp68.f[2]); -// -// if (tmp > 0) { -// norm = 1 / tmp; -// sp68.f[0] *= radius * norm; -// sp68.f[2] *= radius * norm; -// sp54 = radius * norm; -// } else { -// sp68.f[2] = radius; -// sp54 = radius * norm; -// } -// } else { -// sp68.f[2] = radius; -// sp54 = radius * norm; -// } -// -// if (sp54 > 1) { -// sp54 = 0.7852731347084f; -// } else { -// sp54 = acosf(sp54); -// } -// -// if (!arg2 && sp54) { -// sp54 = M_BADTAU - sp54; -// } -// -// sp48.x = sp68.f[0] * -cosf(sp54) + sp68.f[2] * sinf(sp54); -// sp48.y = 0; -// sp48.z = sp68.f[0] * -sinf(sp54) - sp68.f[2] * cosf(sp54); -// -// sp5c.x = arg1->f[0] + sp48.f[0]; -// sp5c.y = arg1->f[1]; -// sp5c.z = arg1->f[2] + sp48.f[2]; -// -// if (chrNavCanSeeNextPos(chr, &prop->pos, prop->rooms, &sp5c, sp44, sp40, arg8, chr->radius, cdtypes, 1)) { -// if (!arg5 || func0f03645c(chr, &prop->pos, prop->rooms, &sp5c, nextpos, cdtypes)) { -// if (arg10) { -// waydata->gotaimposobj = true; -// waydata->aimposobj.x = sp5c.x; -// waydata->aimposobj.y = sp5c.y; -// waydata->aimposobj.z = sp5c.z; -// } else { -// waydata->gotaimpos = true; -// waydata->aimpos.x = sp5c.x; -// waydata->aimpos.y = sp5c.y; -// waydata->aimpos.z = sp5c.z; -// } -// -// return true; -// } -// } -// -// return false; -//} +bool chrNavTryObstacle(struct chrdata *chr, struct coord *arg1, bool arg2, struct coord *arg3, f32 radius, bool arg5, struct coord *nextpos, struct waydata *waydata, f32 arg8, s32 cdtypes, s32 arg10) +{ + struct prop *prop = chr->prop; // 74 + struct coord sp68; + struct coord sp5c; + f32 norm = 1; // 58 + f32 sp54; + struct coord sp48; + struct coord *sp44; + struct coord *sp40; + + if (arg2) { + sp44 = arg1; + sp40 = arg3; + } else { + sp44 = arg3; + sp40 = arg1; + } + + sp68.x = arg1->f[0] - prop->pos.f[0]; + sp68.y = 0; + sp68.z = arg1->f[2] - prop->pos.f[2]; + + if (sp68.f[0] || sp68.f[2]) { + f32 tmp = sqrtf(sp68.f[0] * sp68.f[0] + sp68.f[2] * sp68.f[2]); + + if (tmp > 0) { + norm = 1 / tmp; + sp68.f[0] *= radius * norm; + sp68.f[2] *= radius * norm; + sp54 = radius * norm; + } else { + sp68.f[2] = radius; + sp54 = radius * norm; + } + } else { + sp68.f[2] = radius; + sp54 = radius * norm; + } + + if (sp54 > 1) { + sp54 = 0.7852731347084f; + } else { + sp54 = acosf(sp54); + } + + if (!arg2 && sp54) { + sp54 = M_BADTAU - sp54; + } + + sp48.x = sp68.f[0] * -cosf(sp54) + sp68.f[2] * sinf(sp54); + sp48.y = 0; + sp48.z = sp68.f[0] * -sinf(sp54) - sp68.f[2] * cosf(sp54); + + sp5c.x = arg1->f[0] + sp48.f[0]; + sp5c.y = arg1->f[1]; + sp5c.z = arg1->f[2] + sp48.f[2]; + + if (chrNavCanSeeNextPos(chr, &prop->pos, prop->rooms, &sp5c, sp44, sp40, arg8, chr->radius, cdtypes, 1)) { + if (!arg5 || func0f03645c(chr, &prop->pos, prop->rooms, &sp5c, nextpos, cdtypes)) { + if (arg10) { + waydata->gotaimposobj = true; + waydata->aimposobj.x = sp5c.x; + waydata->aimposobj.y = sp5c.y; + waydata->aimposobj.z = sp5c.z; + } else { + waydata->gotaimpos = true; + waydata->aimpos.x = sp5c.x; + waydata->aimpos.y = sp5c.y; + waydata->aimpos.z = sp5c.z; + } + + return true; + } + } + + return false; +} +#endif #if VERSION >= VERSION_NTSC_1_0 const char var7f1a8be8[] = "CHARS -> FRAMETIMESCALEI(240) = %d"; diff --git a/src/game/chraicommands.c b/src/game/chraicommands.c index a3196863a..d85587d74 100644 --- a/src/game/chraicommands.c +++ b/src/game/chraicommands.c @@ -6853,6 +6853,7 @@ s16 g_MaianQuipBank[][4] = { /** * @cmd 0130 */ +#if MATCHING #if VERSION == VERSION_PAL_FINAL GLOBAL_ASM( glabel aiSayQuip @@ -9490,265 +9491,266 @@ glabel var7f1a9d64 /* f05a010: 00000000 */ sll $zero,$zero,0x0 ); #endif - +#else // regalloc difference near 64c -//bool aiSayQuip(void) -//{ -// u8 column; // 167 -// s16 audioid; // 164 -// u8 i; // 163 -// u8 *cmd = g_Vars.ailist + g_Vars.aioffset; // 156 -// s32 numnearbychrs; // 152 -// bool issomeonetalking; // 148 -// s32 probability; // 144 -// u32 stack; // 140 - not referenced -// s16 *chrnums; // 136 -// s16 (*bank)[4]; // 132 -// char *text; // 128 -// struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]); // 124 -// u32 prevplayernum = g_Vars.currentplayernum; // 120 -// s32 distance; // 116 - not referenced -// s32 row = cmd[3]; // 112 -// u32 playernum; // 108 - not referenced -// u8 headshotted = g_Vars.chrdata->hidden2 & CHRH2FLAG_HEADSHOTTED; // 107 -// struct chrdata *loopchr; // 100 -// -// // Choose bank -// // 2c0 -// if (CHRRACE(g_Vars.chrdata) == RACE_SKEDAR) { -// bank = g_SkedarQuipBank; -// -// if (row > 5) { -// row = 0; -// } -// // 2e0 -// } else if (g_Vars.chrdata->headnum == HEAD_MAIAN_S) { -// bank = g_MaianQuipBank; -// -// if (row > 2) { -// row = random() & 1; -// } -// // 324 -// } else if (cmd[7] == 0) { -// if (g_Vars.chrdata->voicebox > 3) { -// g_Vars.chrdata->voicebox = 3; -// } -// -// bank = &g_GuardQuipBank[g_Vars.chrdata->voicebox * 41]; -// } else { -// // 37c -// bank = g_SpecialQuipBank; -// } -// -// // 37c -// if (!row && !cmd[4] && !cmd[6]) { -// g_Vars.chrdata->soundtimer = 0; -// g_Vars.aioffset += 10; -// return false; -// } -// -// // 3bc -// chrnums = teamGetChrIds(g_Vars.chrdata->team); -// numnearbychrs = 0; -// issomeonetalking = false; -// probability = cmd[4]; -// -// // Make it impossible for Elvis and Jon to use anything but special phrases -// // 3f0 -// if ((g_Vars.chrdata->headnum == HEAD_ELVIS -// || g_Vars.chrdata->headnum == HEAD_THEKING -// || g_Vars.chrdata->headnum == HEAD_ELVIS_GOGS -// || g_Vars.chrdata->headnum == HEAD_JONATHAN) && -// bank != g_SpecialQuipBank) { -// probability = 0; -// } -// -// // If the person talking is a player, and they've just died, -// // try using the other coop player. -// // 420 -// if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { -// // 444 -// playernum = playermgrGetPlayerNumByProp(chr->prop); -// -// if (g_Vars.coopplayernum >= 0 && g_Vars.players[playernum]->isdead) { -// // 470 -// if (playernum == g_Vars.bondplayernum) { -// playernum = g_Vars.coopplayernum; -// } else { -// playernum = g_Vars.bondplayernum; -// } -// } -// -// setCurrentPlayerNum(playernum); -// } -// -// // If soundgap permits talking at this time and probability passes -// // 494 -// if ((g_Vars.chrdata->soundgap == 0 || g_Vars.chrdata->soundgap * 60 < g_Vars.chrdata->soundtimer) -// && probability > (u8)random()) { -// // Try and find a chr in the same squadron who is currently talking -// // 4dc -// while (*chrnums != -2) { -// loopchr = chrFindByLiteralId(*chrnums); -// -// if (loopchr && loopchr->model -// && !chrIsDead(loopchr) -// && loopchr->actiontype != ACT_DEAD -// && g_Vars.chrdata->squadron == loopchr->squadron -// && loopchr->alertness >= 100 -// && g_Vars.chrdata->chrnum != loopchr->chrnum -// && chrGetDistanceToChr(g_Vars.chrdata, loopchr->chrnum) < 7000) { -// // 584 -// numnearbychrs++; -// -// // 594 -// if (loopchr->soundtimer < 60 && cmd[6] != 0 && cmd[6] != 255) { -// issomeonetalking = true; -// } -// } -// -// chrnums++; -// } -// -// // 5dc -// if (!issomeonetalking && -// ((numnearbychrs == 0 && (cmd[6] == 0 || cmd[6] == 255)) || -// (numnearbychrs > 0 && cmd[6] > 0))) { -// column = random() % 3; -// -// // 64c -// if ((cmd[7] & 0x80) == 0) { -// audioid = bank[row][1 + column]; -// } else { -// audioid = bank[row][1 + g_Vars.chrdata->tude]; -// } -// -// // 6a0 -// if (audioWasNotPlayedRecently(audioid) || CHRRACE(g_Vars.chrdata) == RACE_SKEDAR) { -// // 6d4 -// audioMarkAsRecentlyPlayed(audioid); -// -// // 6e8 -// // Replace gurgle with "why me" -// if (audioid == 0x34e && !headshotted) { -// audioid = 0x34d; -// } -// -// // 700 -// g_Vars.chrdata->soundtimer = 0; -// g_Vars.chrdata->soundgap = cmd[5]; -// g_Vars.chrdata->propsoundcount++; -// -// // 72c -// if (audioid != 0x3f7 && audioid != 0x331 && audioid != 0x3a1) { -// func0f0926bc(g_Vars.chrdata->prop, 9, 0xffff); -// // 7a8 -// propsnd0f0939f8(0, g_Vars.chrdata->prop, audioid, -1, -// -1, 8, 0, 9, 0, -1, 0, -1, -1, -1, -1); -// } else { -// // Audio is "Stop moving", "Stop dodging" or "Stand still" -// distance = chrGetDistanceLostToTargetInLastSecond(g_Vars.chrdata); -// -// if (ABS(distance) > 50) { -// func0f0926bc(g_Vars.chrdata->prop, 9, 0xffff); -// // 840 -// propsnd0f0939f8(0, g_Vars.chrdata->prop, audioid, -1, -// -1, 8, 0, 9, 0, -1, 0, -1, -1, -1, -1); -// } -// } -// -// // Consider putting text on screen -// // Note: if cmd[8] is 0 then it means no text, so the value -// // needs to be be decremented by one so it's 0-indexed. -// // 850 -// if (cmd[8] && (cmd[7] & 0x80) == 0) { -// if (column > 2) { -// column = 2; -// } -// -// text = langGet(g_QuipTexts[cmd[8] - 1][1 + column]); -// -// if (!sndIsFiltered(audioid)) { -// // 8ac -// hudmsgCreateWithColour(text, HUDMSGTYPE_INGAMESUBTITLE, cmd[9]); -// } -// } else if (cmd[8]) { -// text = langGet(g_QuipTexts[cmd[8] - 1][1 + g_Vars.chrdata->tude]); -// -// if (!sndIsFiltered(audioid)) { -// // 904 -// hudmsgCreateWithColour(text, HUDMSGTYPE_INGAMESUBTITLE, cmd[9]); -// } -// } -// } else { -// // Audio was played recently - try and find a different one -// audioid = 0; -// -// // 92c -// for (i = 1; i < 4; i++) { -// if (audioWasNotPlayedRecently(g_GuardQuipBank[row][i]) -// && audioWasNotPlayedRecently(bank[row][i])) { -// audioid = bank[row][i]; -// break; -// } -// } -// -// // 99c -// if (audioid) { -// audioMarkAsRecentlyPlayed(audioid); -// -// // Replace gurgle with "why me" -// if (audioid == 0x34e && !headshotted) { -// audioid = 0x34d; -// } -// -// g_Vars.chrdata->soundtimer = 0; -// g_Vars.chrdata->soundgap = cmd[5]; -// g_Vars.chrdata->propsoundcount++; -// -// // 9fc -// if (audioid != 0x3f7 && audioid != 0x331 && audioid != 0x3a1) { -// func0f0926bc(g_Vars.chrdata->prop, 9, 0xffff); -// // a80 -// propsnd0f0939f8(0, g_Vars.chrdata->prop, audioid, -1, -// -1, 8, 0, 9, 0, -1, 0, -1, -1, -1, -1); -// } else { -// // Audio is "Stop moving", "Stop dodging" or "Stand still" -// // a90 -// distance = chrGetDistanceLostToTargetInLastSecond(g_Vars.chrdata); -// -// if (ABS(distance) > 50) { -// func0f0926bc(g_Vars.chrdata->prop, 9, 0xffff); -// // b28 -// propsnd0f0939f8(0, g_Vars.chrdata->prop, audioid, -1, -// -1, 8, 0, 9, 0, -1, 0, -1, -1, -1, -1); -// } -// } -// -// // b44 -// if (cmd[8]) { -// text = langGet(g_QuipTexts[cmd[8] - 1][i]); -// -// if (!sndIsFiltered(audioid)) { -// // b78 -// hudmsgCreateWithColour(text, HUDMSGTYPE_INGAMESUBTITLE, cmd[9]); -// } -// } -// } else { -// g_Vars.chrdata->soundtimer = 0; -// g_Vars.chrdata->soundgap = cmd[5]; -// chrUnsetFlags(g_Vars.chrdata, CHRFLAG1_TALKINGTODISGUISE, BANK_1); -// } -// } -// } -// } -// -// setCurrentPlayerNum(prevplayernum); -// -// g_Vars.aioffset += 10; -// -// return false; -//} +bool aiSayQuip(void) +{ + u8 column; // 167 + s16 audioid; // 164 + u8 i; // 163 + u8 *cmd = g_Vars.ailist + g_Vars.aioffset; // 156 + s32 numnearbychrs; // 152 + bool issomeonetalking; // 148 + s32 probability; // 144 + u32 stack; // 140 - not referenced + s16 *chrnums; // 136 + s16 (*bank)[4]; // 132 + char *text; // 128 + struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]); // 124 + u32 prevplayernum = g_Vars.currentplayernum; // 120 + s32 distance; // 116 - not referenced + s32 row = cmd[3]; // 112 + u32 playernum; // 108 - not referenced + u8 headshotted = g_Vars.chrdata->hidden2 & CHRH2FLAG_HEADSHOTTED; // 107 + struct chrdata *loopchr; // 100 + + // Choose bank + // 2c0 + if (CHRRACE(g_Vars.chrdata) == RACE_SKEDAR) { + bank = g_SkedarQuipBank; + + if (row > 5) { + row = 0; + } + // 2e0 + } else if (g_Vars.chrdata->headnum == HEAD_MAIAN_S) { + bank = g_MaianQuipBank; + + if (row > 2) { + row = random() & 1; + } + // 324 + } else if (cmd[7] == 0) { + if (g_Vars.chrdata->voicebox > 3) { + g_Vars.chrdata->voicebox = 3; + } + + bank = &g_GuardQuipBank[g_Vars.chrdata->voicebox * 41]; + } else { + // 37c + bank = g_SpecialQuipBank; + } + + // 37c + if (!row && !cmd[4] && !cmd[6]) { + g_Vars.chrdata->soundtimer = 0; + g_Vars.aioffset += 10; + return false; + } + + // 3bc + chrnums = teamGetChrIds(g_Vars.chrdata->team); + numnearbychrs = 0; + issomeonetalking = false; + probability = cmd[4]; + + // Make it impossible for Elvis and Jon to use anything but special phrases + // 3f0 + if ((g_Vars.chrdata->headnum == HEAD_ELVIS + || g_Vars.chrdata->headnum == HEAD_THEKING + || g_Vars.chrdata->headnum == HEAD_ELVIS_GOGS + || g_Vars.chrdata->headnum == HEAD_JONATHAN) && + bank != g_SpecialQuipBank) { + probability = 0; + } + + // If the person talking is a player, and they've just died, + // try using the other coop player. + // 420 + if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { + // 444 + playernum = playermgrGetPlayerNumByProp(chr->prop); + + if (g_Vars.coopplayernum >= 0 && g_Vars.players[playernum]->isdead) { + // 470 + if (playernum == g_Vars.bondplayernum) { + playernum = g_Vars.coopplayernum; + } else { + playernum = g_Vars.bondplayernum; + } + } + + setCurrentPlayerNum(playernum); + } + + // If soundgap permits talking at this time and probability passes + // 494 + if ((g_Vars.chrdata->soundgap == 0 || g_Vars.chrdata->soundgap * 60 < g_Vars.chrdata->soundtimer) + && probability > (u8)random()) { + // Try and find a chr in the same squadron who is currently talking + // 4dc + while (*chrnums != -2) { + loopchr = chrFindByLiteralId(*chrnums); + + if (loopchr && loopchr->model + && !chrIsDead(loopchr) + && loopchr->actiontype != ACT_DEAD + && g_Vars.chrdata->squadron == loopchr->squadron + && loopchr->alertness >= 100 + && g_Vars.chrdata->chrnum != loopchr->chrnum + && chrGetDistanceToChr(g_Vars.chrdata, loopchr->chrnum) < 7000) { + // 584 + numnearbychrs++; + + // 594 + if (loopchr->soundtimer < 60 && cmd[6] != 0 && cmd[6] != 255) { + issomeonetalking = true; + } + } + + chrnums++; + } + + // 5dc + if (!issomeonetalking && + ((numnearbychrs == 0 && (cmd[6] == 0 || cmd[6] == 255)) || + (numnearbychrs > 0 && cmd[6] > 0))) { + column = random() % 3; + + // 64c + if ((cmd[7] & 0x80) == 0) { + audioid = bank[row][1 + column]; + } else { + audioid = bank[row][1 + g_Vars.chrdata->tude]; + } + + // 6a0 + if (audioWasNotPlayedRecently(audioid) || CHRRACE(g_Vars.chrdata) == RACE_SKEDAR) { + // 6d4 + audioMarkAsRecentlyPlayed(audioid); + + // 6e8 + // Replace gurgle with "why me" + if (audioid == 0x34e && !headshotted) { + audioid = 0x34d; + } + + // 700 + g_Vars.chrdata->soundtimer = 0; + g_Vars.chrdata->soundgap = cmd[5]; + g_Vars.chrdata->propsoundcount++; + + // 72c + if (audioid != 0x3f7 && audioid != 0x331 && audioid != 0x3a1) { + func0f0926bc(g_Vars.chrdata->prop, 9, 0xffff); + // 7a8 + propsnd0f0939f8(0, g_Vars.chrdata->prop, audioid, -1, + -1, 8, 0, 9, 0, -1, 0, -1, -1, -1, -1); + } else { + // Audio is "Stop moving", "Stop dodging" or "Stand still" + distance = chrGetDistanceLostToTargetInLastSecond(g_Vars.chrdata); + + if (ABS(distance) > 50) { + func0f0926bc(g_Vars.chrdata->prop, 9, 0xffff); + // 840 + propsnd0f0939f8(0, g_Vars.chrdata->prop, audioid, -1, + -1, 8, 0, 9, 0, -1, 0, -1, -1, -1, -1); + } + } + + // Consider putting text on screen + // Note: if cmd[8] is 0 then it means no text, so the value + // needs to be be decremented by one so it's 0-indexed. + // 850 + if (cmd[8] && (cmd[7] & 0x80) == 0) { + if (column > 2) { + column = 2; + } + + text = langGet(g_QuipTexts[cmd[8] - 1][1 + column]); + + if (!sndIsFiltered(audioid)) { + // 8ac + hudmsgCreateWithColour(text, HUDMSGTYPE_INGAMESUBTITLE, cmd[9]); + } + } else if (cmd[8]) { + text = langGet(g_QuipTexts[cmd[8] - 1][1 + g_Vars.chrdata->tude]); + + if (!sndIsFiltered(audioid)) { + // 904 + hudmsgCreateWithColour(text, HUDMSGTYPE_INGAMESUBTITLE, cmd[9]); + } + } + } else { + // Audio was played recently - try and find a different one + audioid = 0; + + // 92c + for (i = 1; i < 4; i++) { + if (audioWasNotPlayedRecently(g_GuardQuipBank[row][i]) + && audioWasNotPlayedRecently(bank[row][i])) { + audioid = bank[row][i]; + break; + } + } + + // 99c + if (audioid) { + audioMarkAsRecentlyPlayed(audioid); + + // Replace gurgle with "why me" + if (audioid == 0x34e && !headshotted) { + audioid = 0x34d; + } + + g_Vars.chrdata->soundtimer = 0; + g_Vars.chrdata->soundgap = cmd[5]; + g_Vars.chrdata->propsoundcount++; + + // 9fc + if (audioid != 0x3f7 && audioid != 0x331 && audioid != 0x3a1) { + func0f0926bc(g_Vars.chrdata->prop, 9, 0xffff); + // a80 + propsnd0f0939f8(0, g_Vars.chrdata->prop, audioid, -1, + -1, 8, 0, 9, 0, -1, 0, -1, -1, -1, -1); + } else { + // Audio is "Stop moving", "Stop dodging" or "Stand still" + // a90 + distance = chrGetDistanceLostToTargetInLastSecond(g_Vars.chrdata); + + if (ABS(distance) > 50) { + func0f0926bc(g_Vars.chrdata->prop, 9, 0xffff); + // b28 + propsnd0f0939f8(0, g_Vars.chrdata->prop, audioid, -1, + -1, 8, 0, 9, 0, -1, 0, -1, -1, -1, -1); + } + } + + // b44 + if (cmd[8]) { + text = langGet(g_QuipTexts[cmd[8] - 1][i]); + + if (!sndIsFiltered(audioid)) { + // b78 + hudmsgCreateWithColour(text, HUDMSGTYPE_INGAMESUBTITLE, cmd[9]); + } + } + } else { + g_Vars.chrdata->soundtimer = 0; + g_Vars.chrdata->soundgap = cmd[5]; + chrUnsetFlags(g_Vars.chrdata, CHRFLAG1_TALKINGTODISGUISE, BANK_1); + } + } + } + } + + setCurrentPlayerNum(prevplayernum); + + g_Vars.aioffset += 10; + + return false; +} +#endif void propDecrementSoundCount(struct prop *prop) { diff --git a/src/game/dlights.c b/src/game/dlights.c index 8fb520d8f..499f1637d 100644 --- a/src/game/dlights.c +++ b/src/game/dlights.c @@ -950,6 +950,7 @@ void roomSetLighting(s32 roomnum, s32 operation, u8 arg2, u8 arg3, u8 arg4) } } +#if MATCHING #if VERSION >= VERSION_NTSC_1_0 GLOBAL_ASM( glabel lightTickBroken @@ -1592,122 +1593,123 @@ glabel lightTickBroken const char var7f1a7bb4[] = "dlights.c"; const char var7f1a7bc0[] = "dlights.c"; - +#else // Mismatch: Documented below -//bool lightTickBroken(s32 roomnum, s32 lightnum) -//{ -// struct light *light = (struct light *)(g_BgLightsFileData + ((g_Rooms[roomnum].lightindex + lightnum) * 0x22)); -// struct coord spc8; -// struct coord spbc; -// struct coord spb0; -// struct coord spa4; -// struct coord sp98; -// struct coord sp8c; -// struct coord sp80; -// struct coord centre; // 74 -// f32 rand1; // 70 -// f32 rand2; // 6c -// s32 sparktype; // 68 -// -// if (!light->unk05_00) { -// return false; -// } -// -// if (light->sparking) { -// if ((random() % 8) == 0) { -// light->sparking = false; -// } else if ((random() % 2) == 0) { -// rand1 = 2.0f * RANDOMFRAC() - 1.0f; // range -1 to 1 -// rand2 = 2.0f * RANDOMFRAC() - 1.0f; // range -1 to 1 -// sparktype = -1; -// -// spc8.x = light->bbox[1].x - light->bbox[0].x; -// spc8.y = light->bbox[1].y - light->bbox[0].y; -// spc8.z = light->bbox[1].z - light->bbox[0].z; -// -// spc8.x = rand1 * spc8.x; -// spc8.y = rand1 * spc8.y; -// spc8.z = rand1 * spc8.z; -// -// spbc.x = light->bbox[2].x - light->bbox[0].x; -// spbc.y = light->bbox[2].y - light->bbox[0].y; -// spbc.z = light->bbox[2].z - light->bbox[0].z; -// -// spbc.x = rand2 * spbc.x; -// spbc.y = rand2 * spbc.y; -// spbc.z = rand2 * spbc.z; -// -// // @bug? These all use x -// sp98.x = light->bbox[0].x + spc8.x + spbc.x; -// sp98.y = light->bbox[0].x + spc8.y + spbc.y; -// sp98.z = light->bbox[0].x + spc8.z + spbc.z; -// -// sp8c.x = light->unk07; -// sp8c.y = light->unk08; -// sp8c.z = light->unk09; -// -// sp80.x = -sp8c.f[0]; -// sp80.y = -sp8c.f[1]; -// sp80.z = -sp8c.f[2]; -// -// func0f177164(&sp98, &spa4, VERSION >= VERSION_NTSC_1_0 ? 1546 : 1570, "dlights.c"); -// -// spa4.x += sp80.x; -// spa4.y += sp80.y; -// spa4.z += sp80.z; -// -// func0f177164(&spa4, &spa4, VERSION >= VERSION_NTSC_1_0 ? 1548 : 1572, "dlights.c"); -// -// // Mismatch: Goal loads roomnum * 0x14 into sp58 here but doesn't -// // use it until after lightGetBboxCentre. The below statement does -// // the same but also emits the load and store instructions. -// g_BgRooms[roomnum].unk00 += 0; -// -// switch (random() % 4) { -// case 0: -// sparktype = SPARKTYPE_LIGHT1; -// break; -// case 1: -// sparktype = SPARKTYPE_LIGHT2; -// break; -// case 2: -// sparktype = SPARKTYPE_LIGHT3; -// break; -// case 3: -// sparktype = SPARKTYPE_LIGHT4; -// break; -// } -// -// lightGetBboxCentre(roomnum, lightnum, ¢re); -// -// centre.x += g_BgRooms[roomnum].pos.x; -// centre.y += g_BgRooms[roomnum].pos.y; -// centre.z += g_BgRooms[roomnum].pos.z; -// -// sparksCreate(roomnum, NULL, ¢re, &spa4, &sp8c, sparktype); -// -// if ((random() % 4) == 0) { -// s16 smokerooms[2]; // 64 -// smokerooms[0] = roomnum; -// smokerooms[1] = -1; -// -// smokeCreateSimple(¢re, smokerooms, SMOKETYPE_BULLETIMPACT); -// } -// -// roomAdjustLighting(roomnum, 0x40, 0x50); -// propsnd0f0939f8(NULL, NULL, propsndGetRandomSparkSound(), -1, -1, 0x400, 0, 0x10, ¢re, -1.0f, 0, roomnum, -1.0f, -1.0f, -1.0f); -// return true; -// } -// } else { -// u32 stack; -// -// if ((random() % 80) == 0) { -// light->sparking = true; -// } -// } -// -// return false; -//} +bool lightTickBroken(s32 roomnum, s32 lightnum) +{ + struct light *light = (struct light *)(g_BgLightsFileData + ((g_Rooms[roomnum].lightindex + lightnum) * 0x22)); + struct coord spc8; + struct coord spbc; + struct coord spb0; + struct coord spa4; + struct coord sp98; + struct coord sp8c; + struct coord sp80; + struct coord centre; // 74 + f32 rand1; // 70 + f32 rand2; // 6c + s32 sparktype; // 68 + + if (!light->unk05_00) { + return false; + } + + if (light->sparking) { + if ((random() % 8) == 0) { + light->sparking = false; + } else if ((random() % 2) == 0) { + rand1 = 2.0f * RANDOMFRAC() - 1.0f; // range -1 to 1 + rand2 = 2.0f * RANDOMFRAC() - 1.0f; // range -1 to 1 + sparktype = -1; + + spc8.x = light->bbox[1].x - light->bbox[0].x; + spc8.y = light->bbox[1].y - light->bbox[0].y; + spc8.z = light->bbox[1].z - light->bbox[0].z; + + spc8.x = rand1 * spc8.x; + spc8.y = rand1 * spc8.y; + spc8.z = rand1 * spc8.z; + + spbc.x = light->bbox[2].x - light->bbox[0].x; + spbc.y = light->bbox[2].y - light->bbox[0].y; + spbc.z = light->bbox[2].z - light->bbox[0].z; + + spbc.x = rand2 * spbc.x; + spbc.y = rand2 * spbc.y; + spbc.z = rand2 * spbc.z; + + // @bug? These all use x + sp98.x = light->bbox[0].x + spc8.x + spbc.x; + sp98.y = light->bbox[0].x + spc8.y + spbc.y; + sp98.z = light->bbox[0].x + spc8.z + spbc.z; + + sp8c.x = light->unk07; + sp8c.y = light->unk08; + sp8c.z = light->unk09; + + sp80.x = -sp8c.f[0]; + sp80.y = -sp8c.f[1]; + sp80.z = -sp8c.f[2]; + + func0f177164(&sp98, &spa4, VERSION >= VERSION_NTSC_1_0 ? 1546 : 1570, "dlights.c"); + + spa4.x += sp80.x; + spa4.y += sp80.y; + spa4.z += sp80.z; + + func0f177164(&spa4, &spa4, VERSION >= VERSION_NTSC_1_0 ? 1548 : 1572, "dlights.c"); + + // Mismatch: Goal loads roomnum * 0x14 into sp58 here but doesn't + // use it until after lightGetBboxCentre. The below statement does + // the same but also emits the load and store instructions. + g_BgRooms[roomnum].unk00 += 0; + + switch (random() % 4) { + case 0: + sparktype = SPARKTYPE_LIGHT1; + break; + case 1: + sparktype = SPARKTYPE_LIGHT2; + break; + case 2: + sparktype = SPARKTYPE_LIGHT3; + break; + case 3: + sparktype = SPARKTYPE_LIGHT4; + break; + } + + lightGetBboxCentre(roomnum, lightnum, ¢re); + + centre.x += g_BgRooms[roomnum].pos.x; + centre.y += g_BgRooms[roomnum].pos.y; + centre.z += g_BgRooms[roomnum].pos.z; + + sparksCreate(roomnum, NULL, ¢re, &spa4, &sp8c, sparktype); + + if ((random() % 4) == 0) { + s16 smokerooms[2]; // 64 + smokerooms[0] = roomnum; + smokerooms[1] = -1; + + smokeCreateSimple(¢re, smokerooms, SMOKETYPE_BULLETIMPACT); + } + + roomAdjustLighting(roomnum, 0x40, 0x50); + propsnd0f0939f8(NULL, NULL, propsndGetRandomSparkSound(), -1, -1, 0x400, 0, 0x10, ¢re, -1.0f, 0, roomnum, -1.0f, -1.0f, -1.0f); + return true; + } + } else { + u32 stack; + + if ((random() % 80) == 0) { + light->sparking = true; + } + } + + return false; +} +#endif const char var7f1a7bcc[] = "L2 - g_bfGlobalLightRebuild = %d"; const char var7f1a7bf0[] = "Acoustic Shadowing is %s"; diff --git a/src/game/file.c b/src/game/file.c index 9988d1443..db2e4db22 100644 --- a/src/game/file.c +++ b/src/game/file.c @@ -2075,2028 +2075,2028 @@ struct fileinfo g_FileInfo[NUM_FILES]; u32 var800aa570; #endif -void *g_FileTable[] = { - /*0x0000*/ NULL, - /*0x0001*/ &_file_bg_sev_seg, - /*0x0002*/ &_file_bg_silo_seg, - /*0x0003*/ &_file_bg_stat_seg, - /*0x0004*/ &_file_bg_arec_seg, - /*0x0005*/ &_file_bg_arch_seg, - /*0x0006*/ &_file_bg_tra_seg, - /*0x0007*/ &_file_bg_dest_seg, - /*0x0008*/ &_file_bg_sevb_seg, - /*0x0009*/ &_file_bg_azt_seg, - /*0x000a*/ &_file_bg_pete_seg, - /*0x000b*/ &_file_bg_depo_seg, - /*0x000c*/ &_file_bg_ref_seg, - /*0x000d*/ &_file_bg_cryp_seg, - /*0x000e*/ &_file_bg_dam_seg, - /*0x000f*/ &_file_bg_ark_seg, - /*0x0010*/ &_file_bg_run_seg, - /*0x0011*/ &_file_bg_sevx_seg, - /*0x0012*/ &_file_bg_jun_seg, - /*0x0013*/ &_file_bg_dish_seg, - /*0x0014*/ &_file_bg_cave_seg, - /*0x0015*/ &_file_bg_cat_seg, - /*0x0016*/ &_file_bg_crad_seg, - /*0x0017*/ &_file_bg_sho_seg, - /*0x0018*/ &_file_bg_eld_seg, - /*0x0019*/ &_file_bg_imp_seg, - /*0x001a*/ &_file_bg_ash_seg, - /*0x001b*/ &_file_bg_lue_seg, - /*0x001c*/ &_file_bg_ame_seg, - /*0x001d*/ &_file_bg_rit_seg, - /*0x001e*/ &_file_bg_oat_seg, - /*0x001f*/ &_file_bg_ear_seg, - /*0x0020*/ &_file_bg_lee_seg, - /*0x0021*/ &_file_bg_lip_seg, - /*0x0022*/ &_file_bg_len_seg, - /*0x0023*/ &_file_bg_wax_seg, - /*0x0024*/ &_file_bg_pam_seg, - /*0x0025*/ &_file_bg_uff_seg, - /*0x0026*/ &_file_bg_old_seg, - /*0x0027*/ &_file_bg_ate_seg, - /*0x0028*/ &_file_bg_lam_seg, - /*0x0029*/ &_file_bg_mp1_seg, - /*0x002a*/ &_file_bg_mp2_seg, - /*0x002b*/ &_file_bg_mp3_seg, - /*0x002c*/ &_file_bg_mp4_seg, - /*0x002d*/ &_file_bg_mp5_seg, - /*0x002e*/ &_file_bg_mp6_seg, - /*0x002f*/ &_file_bg_mp7_seg, - /*0x0030*/ &_file_bg_mp8_seg, - /*0x0031*/ &_file_bg_mp9_seg, - /*0x0032*/ &_file_bg_mp10_seg, - /*0x0033*/ &_file_bg_mp11_seg, - /*0x0034*/ &_file_bg_mp12_seg, - /*0x0035*/ &_file_bg_mp13_seg, - /*0x0036*/ &_file_bg_mp14_seg, - /*0x0037*/ &_file_bg_mp15_seg, - /*0x0038*/ &_file_bg_mp16_seg, - /*0x0039*/ &_file_bg_mp17_seg, - /*0x003a*/ &_file_bg_mp18_seg, - /*0x003b*/ &_file_bg_mp19_seg, - /*0x003c*/ &_file_bg_mp20_seg, - /*0x003d*/ &_file_ob_mid_seg, - /*0x003e*/ &_file_Ca51guardZ, - /*0x003f*/ &_file_Carea51guardZ, - /*0x0040*/ &_file_CcarringtonZ, - /*0x0041*/ &_file_CcassandraZ, - /*0x0042*/ &_file_Cdark_combatZ, - /*0x0043*/ &_file_Cdark_frockZ, - /*0x0044*/ &_file_Cdark_trenchZ, - /*0x0045*/ &_file_CddshockZ, - /*0x0046*/ &_file_Cdd_secguardZ, - /*0x0047*/ &_file_CdjbondZ, - /*0x0048*/ &_file_CdrcarrollZ, - /*0x0049*/ &_file_CelvisZ, - /*0x004a*/ &_file_Celvis1Z, - /*0x004b*/ &_file_CeyespyZ, - /*0x004c*/ &_file_Cfem_guardZ, - /*0x004d*/ &_file_ClabtechZ, - /*0x004e*/ &_file_CmrblondeZ, - /*0x004f*/ &_file_CofficeworkerZ, - /*0x0050*/ &_file_Cofficeworker2Z, - /*0x0051*/ &_file_CoverallZ, - /*0x0052*/ &_file_CsecretaryZ, - /*0x0053*/ &_file_CskedarZ, - /*0x0054*/ &_file_CstripesZ, - /*0x0055*/ &_file_CtestchrZ, - /*0x0056*/ &_file_CthekingZ, - /*0x0057*/ &_file_CtrentZ, - /*0x0058*/ &_file_GcartblueZ, - /*0x0059*/ &_file_GcartridgeZ, - /*0x005a*/ &_file_GcartrifleZ, - /*0x005b*/ &_file_GcartshellZ, - /*0x005c*/ &_file_GjoypadZ, - /*0x005d*/ &_file_Pa51_crate1Z, - /*0x005e*/ &_file_Pa51_crate2Z, - /*0x005f*/ &_file_Pa51_crate3Z, - /*0x0060*/ &_file_Pa51_exp1Z, - /*0x0061*/ &_file_Pa51_exp2Z, - /*0x0062*/ &_file_Pa51_horiz_door_botZ, - /*0x0063*/ &_file_Pa51_horiz_door_glZ, - /*0x0064*/ &_file_Pa51_horiz_door_secretZ, - /*0x0065*/ &_file_Pa51_horiz_door_topZ, - /*0x0066*/ &_file_Pa51_lift_controlZ, - /*0x0067*/ &_file_Pa51_lift_hangarZ, - /*0x0068*/ &_file_Pa51_lift_storeZ, - /*0x0069*/ &_file_Pa51_lift_thinwallZ, - /*0x006a*/ &_file_Pa51_unexp1Z, - /*0x006b*/ &_file_Pa51_unexp2Z, - /*0x006c*/ &_file_Pa51_unexp3Z, - /*0x006d*/ &_file_Pa51_vert_door_leftZ, - /*0x006e*/ &_file_Pa51_vert_door_rightZ, - /*0x006f*/ &_file_Pa51_vert_door_stZ, - /*0x0070*/ &_file_Pa51boardZ, - /*0x0071*/ &_file_Pa51chairZ, - /*0x0072*/ &_file_Pa51deskentZ, - /*0x0073*/ &_file_Pa51divideZ, - /*0x0074*/ &_file_Pa51screenZ, - /*0x0075*/ &_file_Pa51tableZ, - /*0x0076*/ &_file_Pa51trolleyZ, - /*0x0077*/ &_file_Pa51wastebinZ, - /*0x0078*/ &_file_Paivillabot1Z, - /*0x0079*/ &_file_Paivillabot2Z, - /*0x007a*/ &_file_Paivillabot3Z, - /*0x007b*/ &_file_Paivilladoor1Z, - /*0x007c*/ &_file_Paivilladoor2aZ, - /*0x007d*/ &_file_Paivilladoor4Z, - /*0x007e*/ &_file_PaivillawindmillZ, - /*0x007f*/ &_file_Pal_airlockZ, - /*0x0080*/ &_file_Pal_dockliftZ, - /*0x0081*/ &_file_Paldoor_lZ, - /*0x0082*/ &_file_Paldoor_rZ, - /*0x0083*/ &_file_Pborg_crateZ, - /*0x0084*/ &_file_PcaseZ, - /*0x0085*/ &_file_Pch_shutter1Z, - /*0x0086*/ &_file_PchrbriefcaseZ, - /*0x0087*/ &_file_PchrbugZ, - /*0x0088*/ &_file_PchrdatathiefZ, - /*0x0089*/ &_file_Pcryptdoor1bZ, - /*0x008a*/ &_file_Pdd_ac_expZ, - /*0x008b*/ &_file_Pdd_ac_unexpZ, - /*0x008c*/ &_file_Pdd_acbot_expZ, - /*0x008d*/ &_file_Pdd_acbot_unexpZ, - /*0x008e*/ &_file_Pdd_bannerZ, - /*0x008f*/ &_file_Pdd_chairZ, - /*0x0090*/ &_file_Pdd_decodoorZ, - /*0x0091*/ &_file_Pdd_deskZ, - /*0x0092*/ &_file_Pdd_fanroofZ, - /*0x0093*/ &_file_Pdd_fanwallZ, - /*0x0094*/ &_file_Pdd_hovcabZ, - /*0x0095*/ &_file_Pdd_hovcarZ, - /*0x0096*/ &_file_Pdd_hovcopZ, - /*0x0097*/ &_file_Pdd_hovercopterZ, - /*0x0098*/ &_file_Pdd_hovmotoZ, - /*0x0099*/ &_file_Pdd_hovtruckZ, - /*0x009a*/ &_file_Pdd_lab_cautionZ, - /*0x009b*/ &_file_Pdd_lab_cautiontopZ, - /*0x009c*/ &_file_Pdd_lab_door_bsZ, - /*0x009d*/ &_file_Pdd_lab_door_secZ, - /*0x009e*/ &_file_Pdd_lab_door_windZ, - /*0x009f*/ &_file_Pdd_lab_hazardZ, - /*0x00a0*/ &_file_Pdd_lab_restrictedZ, - /*0x00a1*/ &_file_Pdd_lab_sector2botZ, - /*0x00a2*/ &_file_Pdd_lab_sector2topZ, - /*0x00a3*/ &_file_Pdd_lab_sector3Z, - /*0x00a4*/ &_file_Pdd_lab_sector3topZ, - /*0x00a5*/ &_file_Pdd_lab_sector3windZ, - /*0x00a6*/ &_file_Pdd_lab_sector4topZ, - /*0x00a7*/ &_file_Pdd_liftdoorZ, - /*0x00a8*/ &_file_Pdd_liftrZ, - /*0x00a9*/ &_file_Pdd_officedoorZ, - /*0x00aa*/ &_file_Pdd_plantrubberZ, - /*0x00ab*/ &_file_Pdd_plantspiderZ, - /*0x00ac*/ &_file_Pdd_plantspikeZ, - /*0x00ad*/ &_file_Pdd_redarmZ, - /*0x00ae*/ &_file_Pdd_redsofaZ, - /*0x00af*/ &_file_Pdd_secretdoorZ, - /*0x00b0*/ &_file_Pdd_secretdoor2Z, - /*0x00b1*/ &_file_Pdd_servicedoorZ, - /*0x00b2*/ &_file_Pdd_stonedeskZ, - /*0x00b3*/ &_file_Pdd_vertblindZ, - /*0x00b4*/ &_file_Pdd_winddoorZ, - /*0x00b5*/ &_file_Pdd_windowZ, - /*0x00b6*/ &_file_PddjumpshipZ, - /*0x00b7*/ &_file_Pdoor1a_G5Z, - /*0x00b8*/ &_file_Pdoor1atri_G5Z, - /*0x00b9*/ &_file_Pdoor1b_G5Z, - /*0x00ba*/ &_file_Pdoor2_G5Z, - /*0x00bb*/ &_file_Pdoor2a_G5Z, - /*0x00bc*/ &_file_Pdoor4a_G5Z, - /*0x00bd*/ &_file_Pdoor4b_G5Z, - /*0x00be*/ &_file_Pdoor_rollertrainZ, - /*0x00bf*/ &_file_PdoorconsoleZ, - /*0x00c0*/ &_file_Pdr_caroll_doorZ, - /*0x00c1*/ &_file_Pdr_caroll_door_baseZ, - /*0x00c2*/ &_file_Pdr_caroll_door_bleftZ, - /*0x00c3*/ &_file_Pdr_caroll_door_bmainZ, - /*0x00c4*/ &_file_Pdr_caroll_door_brightZ, - /*0x00c5*/ &_file_Pdr_caroll_door_leftZ, - /*0x00c6*/ &_file_Pdr_caroll_door_mainZ, - /*0x00c7*/ &_file_Pdr_caroll_door_rightZ, - /*0x00c8*/ &_file_PdropshipZ, - /*0x00c9*/ &_file_PdumpsterZ, - /*0x00ca*/ &_file_PexplosionbitZ, - /*0x00cb*/ &_file_PflagZ, - /*0x00cc*/ &_file_Pg5_escdoordownZ, - /*0x00cd*/ &_file_Pg5_escdoordownboomZ, - /*0x00ce*/ &_file_Pg5_escdoorupZ, - /*0x00cf*/ &_file_Pg5_escdoorupboomZ, - /*0x00d0*/ &_file_Pg5_mainframeZ, - /*0x00d1*/ &_file_Pg5safedoorZ, - /*0x00d2*/ &_file_Pg5carliftdoorZ, - /*0x00d3*/ &_file_PgoldeneyelogoZ, - /*0x00d4*/ &_file_PhooverbotZ, - /*0x00d5*/ &_file_PhovbikeZ, - /*0x00d6*/ &_file_PhoverbedZ, - /*0x00d7*/ &_file_Phovercrate1Z, - /*0x00d8*/ &_file_PlasdoorZ, - /*0x00d9*/ &_file_PmarkerZ, - /*0x00da*/ &_file_Pmedlabwin1Z, - /*0x00db*/ &_file_Pmedlabwin2Z, - /*0x00dc*/ &_file_PmodemboxZ, - /*0x00dd*/ &_file_PnintendologoZ, - /*0x00de*/ &_file_Pnlogo2Z, - /*0x00df*/ &_file_Pnlogo3Z, - /*0x00e0*/ &_file_PnlogoZ, - /*0x00e1*/ &_file_Ppc1Z, - /*0x00e2*/ &_file_PpdfourZ, - /*0x00e3*/ &_file_PpdoneZ, - /*0x00e4*/ &_file_PpdthreeZ, - /*0x00e5*/ &_file_PpdtwoZ, - /*0x00e6*/ &_file_PperfectdarkZ, - /*0x00e7*/ &_file_PpolicecarZ, - /*0x00e8*/ &_file_PravineliftZ, - /*0x00e9*/ &_file_PropeZ, - /*0x00ea*/ &_file_Psk_cryopod1_botZ, - /*0x00eb*/ &_file_Psk_cryopod1_topZ, - /*0x00ec*/ &_file_Psk_door1Z, - /*0x00ed*/ &_file_Psk_fighter1Z, - /*0x00ee*/ &_file_Psk_hangardoor_botZ, - /*0x00ef*/ &_file_Psk_hangardoor_topZ, - /*0x00f0*/ &_file_Psk_ship_door1Z, - /*0x00f1*/ &_file_Psk_ship_holo1Z, - /*0x00f2*/ &_file_Psk_ship_holo2Z, - /*0x00f3*/ &_file_Psk_ship_hulldoor1Z, - /*0x00f4*/ &_file_Psk_ship_hulldoor2Z, - /*0x00f5*/ &_file_Psk_ship_hulldoor3Z, - /*0x00f6*/ &_file_Psk_ship_hulldoor4Z, - /*0x00f7*/ &_file_Psk_under_generatorZ, - /*0x00f8*/ &_file_Psk_under_transZ, - /*0x00f9*/ &_file_Pskcrev_exp1Z, - /*0x00fa*/ &_file_Pskcrev_unexp1Z, - /*0x00fb*/ &_file_Psktnl_exp1Z, - /*0x00fc*/ &_file_Psktnl_unexp1Z, - /*0x00fd*/ &_file_PtaxicabZ, - /*0x00fe*/ &_file_PtesterbotZ, - /*0x00ff*/ &_file_PtestobjZ, - /*0x0100*/ &_file_PtvscreenZ, - /*0x0101*/ &_file_PwindowZ, - /*0x0102*/ &_file_Ump_setupameZ, - /*0x0103*/ &_file_Ump_setuparchZ, - /*0x0104*/ &_file_Ump_setuparecZ, - /*0x0105*/ &_file_Ump_setuparkZ, - /*0x0106*/ &_file_Ump_setupashZ, - /*0x0107*/ &_file_Ump_setupaztZ, - /*0x0108*/ &_file_Ump_setupcatZ, - /*0x0109*/ &_file_Ump_setupcaveZ, - /*0x010a*/ &_file_Ump_setupcradZ, - /*0x010b*/ &_file_Ump_setupcrypZ, - /*0x010c*/ &_file_Ump_setupdamZ, - /*0x010d*/ &_file_Ump_setupdepoZ, - /*0x010e*/ &_file_Ump_setupdestZ, - /*0x010f*/ &_file_Ump_setupdishZ, - /*0x0110*/ &_file_Ump_setupearZ, - /*0x0111*/ &_file_Ump_setupeldZ, - /*0x0112*/ &_file_Ump_setupimpZ, - /*0x0113*/ &_file_Ump_setupjunZ, - /*0x0114*/ &_file_Ump_setupleeZ, - /*0x0115*/ &_file_Ump_setuplenZ, - /*0x0116*/ &_file_Ump_setuplipZ, - /*0x0117*/ &_file_Ump_setuplueZ, - /*0x0118*/ &_file_Ump_setupoatZ, - /*0x0119*/ &_file_Ump_setuppamZ, - /*0x011a*/ &_file_Ump_setuppeteZ, - /*0x011b*/ &_file_Ump_setuprefZ, - /*0x011c*/ &_file_Ump_setupritZ, - /*0x011d*/ &_file_Ump_setuprunZ, - /*0x011e*/ &_file_Ump_setupsevZ, - /*0x011f*/ &_file_Ump_setupsevbZ, - /*0x0120*/ &_file_Ump_setupsevxZ, - /*0x0121*/ &_file_Ump_setupshoZ, - /*0x0122*/ &_file_Ump_setupsiloZ, - /*0x0123*/ &_file_Ump_setupstatZ, - /*0x0124*/ &_file_Ump_setuptraZ, - /*0x0125*/ &_file_Ump_setupwaxZ, - /*0x0126*/ &_file_UsetupameZ, - /*0x0127*/ &_file_UsetuparchZ, - /*0x0128*/ &_file_UsetuparecZ, - /*0x0129*/ &_file_UsetuparkZ, - /*0x012a*/ &_file_UsetupashZ, - /*0x012b*/ &_file_UsetupaztZ, - /*0x012c*/ &_file_UsetupcatZ, - /*0x012d*/ &_file_UsetupcaveZ, - /*0x012e*/ &_file_UsetupcradZ, - /*0x012f*/ &_file_UsetupcrypZ, - /*0x0130*/ &_file_UsetupdamZ, - /*0x0131*/ &_file_UsetupdepoZ, - /*0x0132*/ &_file_UsetupdestZ, - /*0x0133*/ &_file_UsetupdishZ, - /*0x0134*/ &_file_UsetupearZ, - /*0x0135*/ &_file_UsetupeldZ, - /*0x0136*/ &_file_UsetupimpZ, - /*0x0137*/ &_file_UsetupjunZ, - /*0x0138*/ &_file_UsetupleeZ, - /*0x0139*/ &_file_UsetuplenZ, - /*0x013a*/ &_file_UsetuplipZ, - /*0x013b*/ &_file_UsetuplueZ, - /*0x013c*/ &_file_UsetupoatZ, - /*0x013d*/ &_file_UsetuppamZ, - /*0x013e*/ &_file_UsetuppeteZ, - /*0x013f*/ &_file_UsetuprefZ, - /*0x0140*/ &_file_UsetupritZ, - /*0x0141*/ &_file_UsetuprunZ, - /*0x0142*/ &_file_UsetupsevZ, - /*0x0143*/ &_file_UsetupsevbZ, - /*0x0144*/ &_file_UsetupsevxZ, - /*0x0145*/ &_file_UsetupsevxbZ, - /*0x0146*/ &_file_UsetupshoZ, - /*0x0147*/ &_file_UsetupsiloZ, - /*0x0148*/ &_file_UsetupstatZ, - /*0x0149*/ &_file_UsetuptraZ, - /*0x014a*/ &_file_UsetupwaxZ, - /*0x014b*/ &_file_bg_ame_padsZ, - /*0x014c*/ &_file_bg_ame_tilesZ, - /*0x014d*/ &_file_bg_arch_padsZ, - /*0x014e*/ &_file_bg_arch_tilesZ, - /*0x014f*/ &_file_bg_arec_padsZ, - /*0x0150*/ &_file_bg_arec_tilesZ, - /*0x0151*/ &_file_bg_ark_padsZ, - /*0x0152*/ &_file_bg_ark_tilesZ, - /*0x0153*/ &_file_bg_ash_padsZ, - /*0x0154*/ &_file_bg_ash_tilesZ, - /*0x0155*/ &_file_bg_azt_padsZ, - /*0x0156*/ &_file_bg_azt_tilesZ, - /*0x0157*/ &_file_bg_cat_padsZ, - /*0x0158*/ &_file_bg_cat_tilesZ, - /*0x0159*/ &_file_bg_cave_padsZ, - /*0x015a*/ &_file_bg_cave_tilesZ, - /*0x015b*/ &_file_bg_crad_padsZ, - /*0x015c*/ &_file_bg_crad_tilesZ, - /*0x015d*/ &_file_bg_cryp_padsZ, - /*0x015e*/ &_file_bg_cryp_tilesZ, - /*0x015f*/ &_file_bg_dam_padsZ, - /*0x0160*/ &_file_bg_dam_tilesZ, - /*0x0161*/ &_file_bg_depo_padsZ, - /*0x0162*/ &_file_bg_depo_tilesZ, - /*0x0163*/ &_file_bg_dest_padsZ, - /*0x0164*/ &_file_bg_dest_tilesZ, - /*0x0165*/ &_file_bg_dish_padsZ, - /*0x0166*/ &_file_bg_dish_tilesZ, - /*0x0167*/ &_file_bg_ear_padsZ, - /*0x0168*/ &_file_bg_ear_tilesZ, - /*0x0169*/ &_file_bg_eld_padsZ, - /*0x016a*/ &_file_bg_eld_tilesZ, - /*0x016b*/ &_file_bg_imp_padsZ, - /*0x016c*/ &_file_bg_imp_tilesZ, - /*0x016d*/ &_file_bg_jun_padsZ, - /*0x016e*/ &_file_bg_jun_tilesZ, - /*0x016f*/ &_file_bg_lee_padsZ, - /*0x0170*/ &_file_bg_lee_tilesZ, - /*0x0171*/ &_file_bg_len_padsZ, - /*0x0172*/ &_file_bg_len_tilesZ, - /*0x0173*/ &_file_bg_lip_padsZ, - /*0x0174*/ &_file_bg_lip_tilesZ, - /*0x0175*/ &_file_bg_lue_padsZ, - /*0x0176*/ &_file_bg_lue_tilesZ, - /*0x0177*/ &_file_bg_oat_padsZ, - /*0x0178*/ &_file_bg_oat_tilesZ, - /*0x0179*/ &_file_bg_pam_padsZ, - /*0x017a*/ &_file_bg_pam_tilesZ, - /*0x017b*/ &_file_bg_pete_padsZ, - /*0x017c*/ &_file_bg_pete_tilesZ, - /*0x017d*/ &_file_bg_ref_padsZ, - /*0x017e*/ &_file_bg_ref_tilesZ, - /*0x017f*/ &_file_bg_rit_padsZ, - /*0x0180*/ &_file_bg_rit_tilesZ, - /*0x0181*/ &_file_bg_run_padsZ, - /*0x0182*/ &_file_bg_run_tilesZ, - /*0x0183*/ &_file_bg_sev_padsZ, - /*0x0184*/ &_file_bg_sev_tilesZ, - /*0x0185*/ &_file_bg_sevb_padsZ, - /*0x0186*/ &_file_bg_sevb_tilesZ, - /*0x0187*/ &_file_bg_sevx_padsZ, - /*0x0188*/ &_file_bg_sevx_tilesZ, - /*0x0189*/ &_file_bg_sho_padsZ, - /*0x018a*/ &_file_bg_sho_tilesZ, - /*0x018b*/ &_file_bg_silo_padsZ, - /*0x018c*/ &_file_bg_silo_tilesZ, - /*0x018d*/ &_file_bg_stat_padsZ, - /*0x018e*/ &_file_bg_stat_tilesZ, - /*0x018f*/ &_file_bg_tra_padsZ, - /*0x0190*/ &_file_bg_tra_tilesZ, - /*0x0191*/ &_file_bg_wax_padsZ, - /*0x0192*/ &_file_bg_wax_tilesZ, - /*0x0193*/ &_file_GtestgunZ, - /*0x0194*/ &_file_Cdd_labtechZ, - /*0x0195*/ &_file_Pcctv_pdZ, - /*0x0196*/ &_file_PcomhubZ, - /*0x0197*/ &_file_PquadpodZ, - /*0x0198*/ &_file_Ppd_consoleZ, - /*0x0199*/ &_file_CconneryZ, - /*0x019a*/ &_file_CmooreZ, - /*0x019b*/ &_file_CdaltonZ, - /*0x019c*/ &_file_Cheaddark_combatZ, - /*0x019d*/ &_file_CheadelvisZ, - /*0x019e*/ &_file_CheadrossZ, - /*0x019f*/ &_file_CheadcarringtonZ, - /*0x01a0*/ &_file_CheadmrblondeZ, - /*0x01a1*/ &_file_CheadtrentZ, - /*0x01a2*/ &_file_CheadddshockZ, - /*0x01a3*/ &_file_CheadgrahamZ, - /*0x01a4*/ &_file_Cheaddark_frockZ, - /*0x01a5*/ &_file_CheadsecretaryZ, - /*0x01a6*/ &_file_CheadcassandraZ, - /*0x01a7*/ &_file_CheadthekingZ, - /*0x01a8*/ &_file_Cheadfem_guardZ, - /*0x01a9*/ &_file_CheadjonZ, - /*0x01aa*/ &_file_Plift_platformZ, - /*0x01ab*/ &_file_Pdd_grateZ, - /*0x01ac*/ &_file_PlightswitchZ, - /*0x01ad*/ &_file_PblastshieldZ, - /*0x01ae*/ &_file_Plightswitch2Z, - /*0x01af*/ &_file_Pdd_accessdoorupZ, - /*0x01b0*/ &_file_Pdd_accessdoordnZ, - /*0x01b1*/ &_file_Cdark_rippedZ, - /*0x01b2*/ &_file_Cheadmark2Z, - /*0x01b3*/ &_file_CheadchristZ, - /*0x01b4*/ &_file_Plab_containerZ, - /*0x01b5*/ &_file_Plab_chairZ, - /*0x01b6*/ &_file_Plab_tableZ, - /*0x01b7*/ &_file_Plab_microscopeZ, - /*0x01b8*/ &_file_Plab_mainframeZ, - /*0x01b9*/ &_file_Pdd_labdoorZ, - /*0x01ba*/ &_file_Pdd_lab_doortopZ, - /*0x01bb*/ &_file_Pmulti_ammo_crateZ, - /*0x01bc*/ &_file_CheadrussZ, - /*0x01bd*/ &_file_CheadgreyZ, - /*0x01be*/ &_file_CheaddarlingZ, - /*0x01bf*/ &_file_Cdd_guardZ, - /*0x01c0*/ &_file_CheadrobertZ, - /*0x01c1*/ &_file_Cdd_shockZ, - /*0x01c2*/ &_file_CheadbeauZ, - /*0x01c3*/ &_file_PchrchainZ, - /*0x01c4*/ &_file_Cdd_shock_infZ, - /*0x01c5*/ &_file_Cheadfem_guard2Z, - /*0x01c6*/ &_file_ProofgunZ, - /*0x01c7*/ &_file_PtdoorZ, - /*0x01c8*/ &_file_CbiotechZ, - /*0x01c9*/ &_file_CfbiguyZ, - /*0x01ca*/ &_file_PgroundgunZ, - /*0x01cb*/ &_file_CciaguyZ, - /*0x01cc*/ &_file_Ca51trooperZ, - /*0x01cd*/ &_file_CheadbrianZ, - /*0x01ce*/ &_file_CheadjamieZ, - /*0x01cf*/ &_file_Cheadduncan2Z, - /*0x01d0*/ &_file_CheadbiotechZ, - /*0x01d1*/ &_file_UsetupuffZ, - /*0x01d2*/ &_file_Ump_setupuffZ, - /*0x01d3*/ &_file_bg_uff_padsZ, - /*0x01d4*/ &_file_bg_uff_tilesZ, - /*0x01d5*/ &_file_UsetupoldZ, - /*0x01d6*/ &_file_Ump_setupoldZ, - /*0x01d7*/ &_file_bg_old_padsZ, - /*0x01d8*/ &_file_bg_old_tilesZ, - /*0x01d9*/ &_file_UsetupateZ, - /*0x01da*/ &_file_Ump_setupateZ, - /*0x01db*/ &_file_bg_ate_padsZ, - /*0x01dc*/ &_file_bg_ate_tilesZ, - /*0x01dd*/ &_file_UsetuplamZ, - /*0x01de*/ &_file_Ump_setuplamZ, - /*0x01df*/ &_file_bg_lam_padsZ, - /*0x01e0*/ &_file_bg_lam_tilesZ, - /*0x01e1*/ &_file_Usetupmp1Z, - /*0x01e2*/ &_file_Ump_setupmp1Z, - /*0x01e3*/ &_file_bg_mp1_padsZ, - /*0x01e4*/ &_file_bg_mp1_tilesZ, - /*0x01e5*/ &_file_Usetupmp2Z, - /*0x01e6*/ &_file_Ump_setupmp2Z, - /*0x01e7*/ &_file_bg_mp2_padsZ, - /*0x01e8*/ &_file_bg_mp2_tilesZ, - /*0x01e9*/ &_file_Usetupmp3Z, - /*0x01ea*/ &_file_Ump_setupmp3Z, - /*0x01eb*/ &_file_bg_mp3_padsZ, - /*0x01ec*/ &_file_bg_mp3_tilesZ, - /*0x01ed*/ &_file_Usetupmp4Z, - /*0x01ee*/ &_file_Ump_setupmp4Z, - /*0x01ef*/ &_file_bg_mp4_padsZ, - /*0x01f0*/ &_file_bg_mp4_tilesZ, - /*0x01f1*/ &_file_Usetupmp5Z, - /*0x01f2*/ &_file_Ump_setupmp5Z, - /*0x01f3*/ &_file_bg_mp5_padsZ, - /*0x01f4*/ &_file_bg_mp5_tilesZ, - /*0x01f5*/ &_file_Usetupmp6Z, - /*0x01f6*/ &_file_Ump_setupmp6Z, - /*0x01f7*/ &_file_bg_mp6_padsZ, - /*0x01f8*/ &_file_bg_mp6_tilesZ, - /*0x01f9*/ &_file_Usetupmp7Z, - /*0x01fa*/ &_file_Ump_setupmp7Z, - /*0x01fb*/ &_file_bg_mp7_padsZ, - /*0x01fc*/ &_file_bg_mp7_tilesZ, - /*0x01fd*/ &_file_Usetupmp8Z, - /*0x01fe*/ &_file_Ump_setupmp8Z, - /*0x01ff*/ &_file_bg_mp8_padsZ, - /*0x0200*/ &_file_bg_mp8_tilesZ, - /*0x0201*/ &_file_Usetupmp9Z, - /*0x0202*/ &_file_Ump_setupmp9Z, - /*0x0203*/ &_file_bg_mp9_padsZ, - /*0x0204*/ &_file_bg_mp9_tilesZ, - /*0x0205*/ &_file_Usetupmp10Z, - /*0x0206*/ &_file_Ump_setupmp10Z, - /*0x0207*/ &_file_bg_mp10_padsZ, - /*0x0208*/ &_file_bg_mp10_tilesZ, - /*0x0209*/ &_file_Usetupmp11Z, - /*0x020a*/ &_file_Ump_setupmp11Z, - /*0x020b*/ &_file_bg_mp11_padsZ, - /*0x020c*/ &_file_bg_mp11_tilesZ, - /*0x020d*/ &_file_Usetupmp12Z, - /*0x020e*/ &_file_Ump_setupmp12Z, - /*0x020f*/ &_file_bg_mp12_padsZ, - /*0x0210*/ &_file_bg_mp12_tilesZ, - /*0x0211*/ &_file_Usetupmp13Z, - /*0x0212*/ &_file_Ump_setupmp13Z, - /*0x0213*/ &_file_bg_mp13_padsZ, - /*0x0214*/ &_file_bg_mp13_tilesZ, - /*0x0215*/ &_file_Usetupmp14Z, - /*0x0216*/ &_file_Ump_setupmp14Z, - /*0x0217*/ &_file_bg_mp14_padsZ, - /*0x0218*/ &_file_bg_mp14_tilesZ, - /*0x0219*/ &_file_Usetupmp15Z, - /*0x021a*/ &_file_Ump_setupmp15Z, - /*0x021b*/ &_file_bg_mp15_padsZ, - /*0x021c*/ &_file_bg_mp15_tilesZ, - /*0x021d*/ &_file_Usetupmp16Z, - /*0x021e*/ &_file_Ump_setupmp16Z, - /*0x021f*/ &_file_bg_mp16_padsZ, - /*0x0220*/ &_file_bg_mp16_tilesZ, - /*0x0221*/ &_file_Usetupmp17Z, - /*0x0222*/ &_file_Ump_setupmp17Z, - /*0x0223*/ &_file_bg_mp17_padsZ, - /*0x0224*/ &_file_bg_mp17_tilesZ, - /*0x0225*/ &_file_Usetupmp18Z, - /*0x0226*/ &_file_Ump_setupmp18Z, - /*0x0227*/ &_file_bg_mp18_padsZ, - /*0x0228*/ &_file_bg_mp18_tilesZ, - /*0x0229*/ &_file_Usetupmp19Z, - /*0x022a*/ &_file_Ump_setupmp19Z, - /*0x022b*/ &_file_bg_mp19_padsZ, - /*0x022c*/ &_file_bg_mp19_tilesZ, - /*0x022d*/ &_file_Usetupmp20Z, - /*0x022e*/ &_file_Ump_setupmp20Z, - /*0x022f*/ &_file_bg_mp20_padsZ, - /*0x0230*/ &_file_bg_mp20_tilesZ, - /*0x0231*/ &_file_Ca51airmanZ, - /*0x0232*/ &_file_Cheadneil2Z, - /*0x0233*/ &_file_Pci_sofaZ, - /*0x0234*/ &_file_Pci_liftZ, - /*0x0235*/ &_file_Pci_liftdoorZ, - /*0x0236*/ &_file_CchicrobZ, - /*0x0237*/ &_file_CstewardZ, - /*0x0238*/ &_file_CheadedmcgZ, - /*0x0239*/ &_file_CstewardessZ, - /*0x023a*/ &_file_CheadankaZ, - /*0x023b*/ &_file_CpresidentZ, - /*0x023c*/ &_file_Cstewardess_coatZ, - /*0x023d*/ &_file_Cheadleslie_sZ, - /*0x023e*/ &_file_PlasercutZ, - /*0x023f*/ &_file_Psk_shuttleZ, - /*0x0240*/ &_file_CminiskedarZ, - /*0x0241*/ &_file_PnewvilladoorZ, - /*0x0242*/ &_file_Cnsa_lackeyZ, - /*0x0243*/ &_file_Cheadmatt_cZ, - /*0x0244*/ &_file_Cpres_securityZ, - /*0x0245*/ &_file_Cheadpeer_sZ, - /*0x0246*/ &_file_CnegotiatorZ, - /*0x0247*/ &_file_Cheadeileen_tZ, - /*0x0248*/ &_file_Psk_pillarleftZ, - /*0x0249*/ &_file_Psk_pillarrightZ, - /*0x024a*/ &_file_Psk_plinth_tZ, - /*0x024b*/ &_file_Psk_plinth_mlZ, - /*0x024c*/ &_file_Psk_plinth_mrZ, - /*0x024d*/ &_file_Psk_plinth_blZ, - /*0x024e*/ &_file_Psk_plinth_brZ, - /*0x024f*/ &_file_Psk_fl_shad_tZ, - /*0x0250*/ &_file_Psk_fl_shad_mlZ, - /*0x0251*/ &_file_Psk_fl_shad_mrZ, - /*0x0252*/ &_file_Psk_fl_shad_blZ, - /*0x0253*/ &_file_Psk_fl_shad_brZ, - /*0x0254*/ &_file_Psk_fl_noshad_tZ, - /*0x0255*/ &_file_Psk_fl_noshad_mlZ, - /*0x0256*/ &_file_Psk_fl_noshad_mrZ, - /*0x0257*/ &_file_Psk_fl_noshad_blZ, - /*0x0258*/ &_file_Psk_fl_noshad_brZ, - /*0x0259*/ &_file_GhudpieceZ, - /*0x025a*/ &_file_Psk_templecolumn1Z, - /*0x025b*/ &_file_Psk_templecolumn2Z, - /*0x025c*/ &_file_Psk_templecolumn3Z, - /*0x025d*/ &_file_Psk_sunshad1Z, - /*0x025e*/ &_file_Psk_sunshad2Z, - /*0x025f*/ &_file_Psk_sunnoshad1Z, - /*0x0260*/ &_file_Psk_sunnoshad2Z, - /*0x0261*/ &_file_Cg5_guardZ, - /*0x0262*/ &_file_Cheadandy_rZ, - /*0x0263*/ &_file_Cpelagic_guardZ, - /*0x0264*/ &_file_Cg5_swat_guardZ, - /*0x0265*/ &_file_Calaskan_guardZ, - /*0x0266*/ &_file_Cmaian_soldierZ, - /*0x0267*/ &_file_Cheadben_rZ, - /*0x0268*/ &_file_Cheadsteve_kZ, - /*0x0269*/ &_file_PbarrelZ, - /*0x026a*/ &_file_Pglass_floorZ, - /*0x026b*/ &_file_Pesca_stepZ, - /*0x026c*/ &_file_Pmatrix_liftZ, - /*0x026d*/ &_file_Prubble1Z, - /*0x026e*/ &_file_Prubble2Z, - /*0x026f*/ &_file_Prubble3Z, - /*0x0270*/ &_file_Prubble4Z, - /*0x0271*/ &_file_Arecep01M, - /*0x0272*/ &_file_Arecep02M, - /*0x0273*/ &_file_Arecep03M, - /*0x0274*/ &_file_Arecep04M, - /*0x0275*/ &_file_Arecep05M, - /*0x0276*/ &_file_Arecep06M, - /*0x0277*/ &_file_Arlguard1M, - /*0x0278*/ &_file_Arltech01M, - /*0x0279*/ &_file_Arltech02M, - /*0x027a*/ &_file_Arltech03M, - /*0x027b*/ &_file_Arltech04M, - /*0x027c*/ &_file_Arltech05M, - /*0x027d*/ &_file_Arltech06M, - /*0x027e*/ &_file_Ascie2aM, - /*0x027f*/ &_file_Ascie2bM, - /*0x0280*/ &_file_Ascie2cM, - /*0x0281*/ &_file_Ascie2dM, - /*0x0282*/ &_file_Ascie2eM, - /*0x0283*/ &_file_Ascie2fM, - /*0x0284*/ &_file_Ascie2gM, - /*0x0285*/ &_file_Ascie3aM, - /*0x0286*/ &_file_Ascie3bM, - /*0x0287*/ &_file_Ascie3cM, - /*0x0288*/ &_file_Ascie3dM, - /*0x0289*/ &_file_Ascie3eM, - /*0x028a*/ &_file_Ascie3gM, - /*0x028b*/ &_file_Ascien10aM, - /*0x028c*/ &_file_Ascien2_aM, - /*0x028d*/ &_file_Ascien3_aM, - /*0x028e*/ &_file_Ascien4_aM, - /*0x028f*/ &_file_Ascien5_aM, - /*0x0290*/ &_file_Ascien6_aM, - /*0x0291*/ &_file_Ascien7_aM, - /*0x0292*/ &_file_Ascien9_aM, - /*0x0293*/ &_file_AvilgrimM, - /*0x0294*/ &_file_Awepgd01M, - /*0x0295*/ &_file_Awepgd02M, - /*0x0296*/ &_file_Awepgd03M, - /*0x0297*/ &_file_Awepsc01M, - /*0x0298*/ &_file_Awepsc02M, - /*0x0299*/ &_file_Awepsc03M, - /*0x029a*/ &_file_Aa51elv01M, - /*0x029b*/ &_file_Aa51elv02M, - /*0x029c*/ &_file_Aa51elv03M, - /*0x029d*/ &_file_Aa51grd01M, - /*0x029e*/ &_file_Aa51grd02M, - /*0x029f*/ &_file_Aa51grd03M, - /*0x02a0*/ &_file_Aa51grd04M, - /*0x02a1*/ &_file_Aa51grd05M, - /*0x02a2*/ &_file_Aa51grd06M, - /*0x02a3*/ &_file_Aa51grd07M, - /*0x02a4*/ &_file_Aa51grd08M, - /*0x02a5*/ &_file_Aa51grd09M, - /*0x02a6*/ &_file_Aa51grd10M, - /*0x02a7*/ &_file_Aa51jo1M, - /*0x02a8*/ &_file_Aa51jo2M, - /*0x02a9*/ &_file_Aa51jo3M, - /*0x02aa*/ &_file_Aa51jo4M, - /*0x02ab*/ &_file_Aa51jo5M, - /*0x02ac*/ &_file_Aa51jo6M, - /*0x02ad*/ &_file_Aa51jon01M, - /*0x02ae*/ &_file_Aa51jon02M, - /*0x02af*/ &_file_Aa51jon03M, - /*0x02b0*/ &_file_Aa51jon04M, - /*0x02b1*/ &_file_Aa51jon05M, - /*0x02b2*/ &_file_Aa51jon06M, - /*0x02b3*/ &_file_Aa51jon07M, - /*0x02b4*/ &_file_Aa51jon08M, - /*0x02b5*/ &_file_Aa51jon09M, - /*0x02b6*/ &_file_Aa51jon10M, - /*0x02b7*/ &_file_Aa51jon11M, - /*0x02b8*/ &_file_Aa51jon12M, - /*0x02b9*/ &_file_Aa51jon14M, - /*0x02ba*/ &_file_Aa51jon15M, - /*0x02bb*/ &_file_Aa51sci1M, - /*0x02bc*/ &_file_Aaf1jo01M, - /*0x02bd*/ &_file_Aaf1jo02M, - /*0x02be*/ &_file_Aaf1jo03M, - /*0x02bf*/ &_file_Aaf1pr01M, - /*0x02c0*/ &_file_Aaf1pr02M, - /*0x02c1*/ &_file_Aaf1pr03M, - /*0x02c2*/ &_file_Aaf1pr04M, - /*0x02c3*/ &_file_Aaf1pr05M, - /*0x02c4*/ &_file_Aaf1pr06M, - /*0x02c5*/ &_file_Aaf1pr07M, - /*0x02c6*/ &_file_Aaf1pr08M, - /*0x02c7*/ &_file_Aaf1pr09M, - /*0x02c8*/ &_file_Aaf1pr10M, - /*0x02c9*/ &_file_Aaf1tr01M, - /*0x02ca*/ &_file_Aaf1tr02M, - /*0x02cb*/ &_file_Aaf1tr03M, - /*0x02cc*/ &_file_Aairbgd01M, - /*0x02cd*/ &_file_Aairbgd02M, - /*0x02ce*/ &_file_Aairbgd03M, - /*0x02cf*/ &_file_Aairbgd04M, - /*0x02d0*/ &_file_Aairbgd05M, - /*0x02d1*/ &_file_Aairbgd06M, - /*0x02d2*/ &_file_Aairbgd07M, - /*0x02d3*/ &_file_Aairbgd08M, - /*0x02d4*/ &_file_Aairbgd09M, - /*0x02d5*/ &_file_Aairbgd10M, - /*0x02d6*/ &_file_Aairbgd11M, - /*0x02d7*/ &_file_Aairbgd12M, - /*0x02d8*/ &_file_Aairbgd13M, - /*0x02d9*/ &_file_Aairbgd14M, - /*0x02da*/ &_file_Aairbgd15M, - /*0x02db*/ &_file_Aairbgd16M, - /*0x02dc*/ &_file_Aairstw01M, - /*0x02dd*/ &_file_Aairstw02M, - /*0x02de*/ &_file_Aairstw03M, - /*0x02df*/ &_file_Aassael01M, - /*0x02e0*/ &_file_Aassael02M, - /*0x02e1*/ &_file_Aassael03M, - /*0x02e2*/ &_file_Aassael04M, - /*0x02e3*/ &_file_Aassael05M, - /*0x02e4*/ &_file_Aassael06M, - /*0x02e5*/ &_file_Absewrk01M, - /*0x02e6*/ &_file_Absewrk02M, - /*0x02e7*/ &_file_Absewrk03M, - /*0x02e8*/ &_file_Absewrk04M, - /*0x02e9*/ &_file_Absewrk05M, - /*0x02ea*/ &_file_Acetael01M, - /*0x02eb*/ &_file_Achdroid1M, - /*0x02ec*/ &_file_Achdroid2M, - /*0x02ed*/ &_file_Acsec01M, - /*0x02ee*/ &_file_Acsec02M, - /*0x02ef*/ &_file_Acsec03M, - /*0x02f0*/ &_file_Acstan1M, - /*0x02f1*/ &_file_Acstan2M, - /*0x02f2*/ &_file_Adevr01M, - /*0x02f3*/ &_file_Adevr02M, - /*0x02f4*/ &_file_Adevr03M, - /*0x02f5*/ &_file_Adevr04M, - /*0x02f6*/ &_file_Adevr05M, - /*0x02f7*/ &_file_Adevr06M, - /*0x02f8*/ &_file_Adevr07M, - /*0x02f9*/ &_file_Adevr08M, - /*0x02fa*/ &_file_Adevr09M, - /*0x02fb*/ &_file_Adevr10M, - /*0x02fc*/ &_file_Adevr11M, - /*0x02fd*/ &_file_Adevr12M, - /*0x02fe*/ &_file_Aexec01M, - /*0x02ff*/ &_file_Aexec02M, - /*0x0300*/ &_file_Aexec04M, - /*0x0301*/ &_file_Aexec05M, - /*0x0302*/ &_file_Aexec06M, - /*0x0303*/ &_file_Aexec07M, - /*0x0304*/ &_file_Aexec08M, - /*0x0305*/ &_file_Aexec09M, - /*0x0306*/ &_file_Aexec10M, - /*0x0307*/ &_file_Aexec11M, - /*0x0308*/ &_file_Aexec12M, - /*0x0309*/ &_file_Aexec13M, - /*0x030a*/ &_file_Aexec14M, - /*0x030b*/ &_file_Ahelic01M, - /*0x030c*/ &_file_Ahelic02M, - /*0x030d*/ &_file_Ahelic03M, - /*0x030e*/ &_file_Ahologd01M, - /*0x030f*/ &_file_AholohopkM, - /*0x0310*/ &_file_Ainvcar01M, - /*0x0311*/ &_file_Ainvcar02M, - /*0x0312*/ &_file_Ainvcar03M, - /*0x0313*/ &_file_Ainvcar04M, - /*0x0314*/ &_file_Ainvcar05M, - /*0x0315*/ &_file_Ainvcar06M, - /*0x0316*/ &_file_Ainvcar07M, - /*0x0317*/ &_file_Ainvcar08M, - /*0x0318*/ &_file_Ainvcar09M, - /*0x0319*/ &_file_Ainvcar10M, - /*0x031a*/ &_file_Ainvcar11M, - /*0x031b*/ &_file_Ainvcar12M, - /*0x031c*/ &_file_AinvfarrM, - /*0x031d*/ &_file_AinvfemaM, - /*0x031e*/ &_file_AinvfostM, - /*0x031f*/ &_file_AinvgrimM, - /*0x0320*/ &_file_AinvhopkM, - /*0x0321*/ &_file_AinvmaleM, - /*0x0322*/ &_file_Ajoexec01M, - /*0x0323*/ &_file_Ajoexec02M, - /*0x0324*/ &_file_Ajosci01M, - /*0x0325*/ &_file_Ajosci02M, - /*0x0326*/ &_file_Ajosci03M, - /*0x0327*/ &_file_Alabacc1M, - /*0x0328*/ &_file_Alabacc2M, - /*0x0329*/ &_file_Alabacc3M, - /*0x032a*/ &_file_Alabacc4M, - /*0x032b*/ &_file_Alabacc5M, - /*0x032c*/ &_file_Alabacc6M, - /*0x032d*/ &_file_Alabtech1M, - /*0x032e*/ &_file_Alabtech2M, - /*0x032f*/ &_file_Alabtech3M, - /*0x0330*/ &_file_Alabtech5M, - /*0x0331*/ &_file_Alabtech6M, - /*0x0332*/ &_file_Alabtech7M, - /*0x0333*/ &_file_Alabtech8M, - /*0x0334*/ &_file_Alabtech9M, - /*0x0335*/ &_file_Aoffwrk01M, - /*0x0336*/ &_file_Aoffwrk02M, - /*0x0337*/ &_file_Aoffwrk03M, - /*0x0338*/ &_file_Aoffwrk04M, - /*0x0339*/ &_file_Cpresident_cloneZ, - /*0x033a*/ &_file_CheadjonathanZ, - /*0x033b*/ &_file_Cheadmaian_sZ, - /*0x033c*/ &_file_Cdark_af1Z, - /*0x033d*/ &_file_Pcable_carZ, - /*0x033e*/ &_file_Pelvis_saucerZ, - /*0x033f*/ &_file_Pstewardess_trolleyZ, - /*0x0340*/ &_file_Pairbase_lift_enclosedZ, - /*0x0341*/ &_file_Pairbase_lift_angleZ, - /*0x0342*/ &_file_Pairbase_safedoorZ, - /*0x0343*/ &_file_Paf1_pilotchairZ, - /*0x0344*/ &_file_Paf1_passchairZ, - /*0x0345*/ &_file_CheadshaunZ, - /*0x0346*/ &_file_PchrnightsightZ, - /*0x0347*/ &_file_PchrshieldZ, - /*0x0348*/ &_file_Pchrfalcon2Z, - /*0x0349*/ &_file_Pchrleegun1Z, - /*0x034a*/ &_file_PchrmaulerZ, - /*0x034b*/ &_file_Pchrdy357Z, - /*0x034c*/ &_file_Pchrdy357trentZ, - /*0x034d*/ &_file_PchrmaianpistolZ, - /*0x034e*/ &_file_Pchrfalcon2silZ, - /*0x034f*/ &_file_Pchrfalcon2scopeZ, - /*0x0350*/ &_file_Pchrcmp150Z, - /*0x0351*/ &_file_Pchrar34Z, - /*0x0352*/ &_file_PchrdragonZ, - /*0x0353*/ &_file_PchrsuperdragonZ, - /*0x0354*/ &_file_PchravengerZ, - /*0x0355*/ &_file_PchrcycloneZ, - /*0x0356*/ &_file_PchrmaiansmgZ, - /*0x0357*/ &_file_Pchrrcp120Z, - /*0x0358*/ &_file_PchrpcgunZ, - /*0x0359*/ &_file_PchrshotgunZ, - /*0x035a*/ &_file_PchrskminigunZ, - /*0x035b*/ &_file_PchrdyrocketZ, - /*0x035c*/ &_file_PchrdevastatorZ, - /*0x035d*/ &_file_PchrskrocketZ, - /*0x035e*/ &_file_Pchrz2020Z, - /*0x035f*/ &_file_PchrsniperrifleZ, - /*0x0360*/ &_file_PchrcrossbowZ, - /*0x0361*/ &_file_PchrdruggunZ, - /*0x0362*/ &_file_PchrknifeZ, - /*0x0363*/ &_file_PchrnbombZ, - /*0x0364*/ &_file_PchrflashbangZ, - /*0x0365*/ &_file_PchrgrenadeZ, - /*0x0366*/ &_file_PchrtimedmineZ, - /*0x0367*/ &_file_PchrproximitymineZ, - /*0x0368*/ &_file_PchrremotemineZ, - /*0x0369*/ &_file_PchrecmmineZ, - /*0x036a*/ &_file_PchrwppkZ, - /*0x036b*/ &_file_Pchrtt33Z, - /*0x036c*/ &_file_PchrskorpionZ, - /*0x036d*/ &_file_PchrkalashZ, - /*0x036e*/ &_file_PchruziZ, - /*0x036f*/ &_file_Pchrmp5kZ, - /*0x0370*/ &_file_Pchrm16Z, - /*0x0371*/ &_file_Pchrfnp90Z, - /*0x0372*/ &_file_PchrdyrocketmisZ, - /*0x0373*/ &_file_PchrskrocketmisZ, - /*0x0374*/ &_file_PchrcrossboltZ, - /*0x0375*/ &_file_PchrdevgrenadeZ, - /*0x0376*/ &_file_PchrdraggrenadeZ, - /*0x0377*/ &_file_Gfalcon2Z, - /*0x0378*/ &_file_Gleegun1Z, - /*0x0379*/ &_file_GskpistolZ, - /*0x037a*/ &_file_Gdy357Z, - /*0x037b*/ &_file_Gdy357trentZ, - /*0x037c*/ &_file_GmaianpistolZ, - /*0x037d*/ &_file_Gcmp150Z, - /*0x037e*/ &_file_Gar34Z, - /*0x037f*/ &_file_GdydragonZ, - /*0x0380*/ &_file_GdysuperdragonZ, - /*0x0381*/ &_file_Gk7avengerZ, - /*0x0382*/ &_file_GcycloneZ, - /*0x0383*/ &_file_GmaiansmgZ, - /*0x0384*/ &_file_Grcp120Z, - /*0x0385*/ &_file_GpcgunZ, - /*0x0386*/ &_file_GshotgunZ, - /*0x0387*/ &_file_GskminigunZ, - /*0x0388*/ &_file_GdyrocketZ, - /*0x0389*/ &_file_GdydevastatorZ, - /*0x038a*/ &_file_GskrocketZ, - /*0x038b*/ &_file_Gz2020Z, - /*0x038c*/ &_file_GsniperrifleZ, - /*0x038d*/ &_file_GcrossbowZ, - /*0x038e*/ &_file_GdruggunZ, - /*0x038f*/ &_file_GknifeZ, - /*0x0390*/ &_file_GgrenadeZ, - /*0x0391*/ &_file_GtimedmineZ, - /*0x0392*/ &_file_GproximitymineZ, - /*0x0393*/ &_file_GremotemineZ, - /*0x0394*/ &_file_GwppkZ, - /*0x0395*/ &_file_Gtt33Z, - /*0x0396*/ &_file_GskorpionZ, - /*0x0397*/ &_file_Gak47Z, - /*0x0398*/ &_file_GuziZ, - /*0x0399*/ &_file_Gmp5kZ, - /*0x039a*/ &_file_Gm16Z, - /*0x039b*/ &_file_Gfnp90Z, - /*0x039c*/ &_file_Gfalcon2lodZ, - /*0x039d*/ &_file_GskminigunlodZ, - /*0x039e*/ &_file_Pa51_turretZ, - /*0x039f*/ &_file_PpelagicdoorZ, - /*0x03a0*/ &_file_Am1_l1_aM, - /*0x03a1*/ &_file_Am1_l1_bM, - /*0x03a2*/ &_file_Am1_l1_cM, - /*0x03a3*/ &_file_Am1_l1_dM, - /*0x03a4*/ &_file_Am1_l2_aM, - /*0x03a5*/ &_file_Am1_l2_bM, - /*0x03a6*/ &_file_Am1_l2_cM, - /*0x03a7*/ &_file_Am1_l2_dM, - /*0x03a8*/ &_file_Am1_l3_aM, - /*0x03a9*/ &_file_Am1_l3_bM, - /*0x03aa*/ &_file_Am1_l3_cM, - /*0x03ab*/ &_file_Am1_l3_dM, - /*0x03ac*/ &_file_Am2_l1_aM, - /*0x03ad*/ &_file_Am2_l1_bM, - /*0x03ae*/ &_file_Am2_l1_cM, - /*0x03af*/ &_file_Am2_l1_dM, - /*0x03b0*/ &_file_Am3_l1_aM, - /*0x03b1*/ &_file_Am3_l1_bM, - /*0x03b2*/ &_file_Am3_l1_cM, - /*0x03b3*/ &_file_Am3_l1_dM, - /*0x03b4*/ &_file_Am3_l2_aM, - /*0x03b5*/ &_file_Am3_l2_bM, - /*0x03b6*/ &_file_Am3_l2_cM, - /*0x03b7*/ &_file_Am3_l2_dM, - /*0x03b8*/ &_file_Am4_l1_aM, - /*0x03b9*/ &_file_Am4_l1_bM, - /*0x03ba*/ &_file_Am4_l1_cM, - /*0x03bb*/ &_file_Am4_l1_dM, - /*0x03bc*/ &_file_Am4_l2_aM, - /*0x03bd*/ &_file_Am4_l2_bM, - /*0x03be*/ &_file_Am4_l2_cM, - /*0x03bf*/ &_file_Am4_l2_dM, - /*0x03c0*/ &_file_Am4_l3_aM, - /*0x03c1*/ &_file_Am4_l3_bM, - /*0x03c2*/ &_file_Am4_l3_cM, - /*0x03c3*/ &_file_Am4_l3_dM, - /*0x03c4*/ &_file_Am5_l1_aM, - /*0x03c5*/ &_file_Am5_l1_bM, - /*0x03c6*/ &_file_Am5_l1_cM, - /*0x03c7*/ &_file_Am5_l1_dM, - /*0x03c8*/ &_file_Am5_l2_aM, - /*0x03c9*/ &_file_Am5_l2_bM, - /*0x03ca*/ &_file_Am5_l2_cM, - /*0x03cb*/ &_file_Am5_l2_dM, - /*0x03cc*/ &_file_Am5_l3_aM, - /*0x03cd*/ &_file_Am5_l3_bM, - /*0x03ce*/ &_file_Am5_l3_cM, - /*0x03cf*/ &_file_Am5_l3_dM, - /*0x03d0*/ &_file_Am6_l1_aM, - /*0x03d1*/ &_file_Am6_l1_bM, - /*0x03d2*/ &_file_Am6_l1_cM, - /*0x03d3*/ &_file_Am6_l1_dM, - /*0x03d4*/ &_file_Am6_l2_aM, - /*0x03d5*/ &_file_Am6_l2_bM, - /*0x03d6*/ &_file_Am6_l2_cM, - /*0x03d7*/ &_file_Am6_l2_dM, - /*0x03d8*/ &_file_Am7_l1_aM, - /*0x03d9*/ &_file_Am7_l1_bM, - /*0x03da*/ &_file_Am7_l1_cM, - /*0x03db*/ &_file_Am7_l1_dM, - /*0x03dc*/ &_file_Am8_l1_aM, - /*0x03dd*/ &_file_Am8_l1_bM, - /*0x03de*/ &_file_Am8_l1_cM, - /*0x03df*/ &_file_Am8_l1_dM, - /*0x03e0*/ &_file_Am9_l1_aM, - /*0x03e1*/ &_file_Am9_l1_bM, - /*0x03e2*/ &_file_Am9_l1_cM, - /*0x03e3*/ &_file_Am9_l1_dM, - /*0x03e4*/ &_file_Ap1_01_joM, - /*0x03e5*/ &_file_Ap1_02_caM, - /*0x03e6*/ &_file_Ap1_03_joM, - /*0x03e7*/ &_file_Ap1_04_caM, - /*0x03e8*/ &_file_Ap1_05_joM, - /*0x03e9*/ &_file_Ap1_06_caM, - /*0x03ea*/ &_file_Ap1_07_joM, - /*0x03eb*/ &_file_Ap1_08_caM, - /*0x03ec*/ &_file_Ap2_01_joM, - /*0x03ed*/ &_file_Ap2_02_joM, - /*0x03ee*/ &_file_Ap2_03_drM, - /*0x03ef*/ &_file_Ap2_04_joM, - /*0x03f0*/ &_file_Ap2_05_joM, - /*0x03f1*/ &_file_Ap2_06_drM, - /*0x03f2*/ &_file_Ap2_07_drM, - /*0x03f3*/ &_file_Ap3_01_gdM, - /*0x03f4*/ &_file_Ap3_02_joM, - /*0x03f5*/ &_file_Ap3_03_joM, - /*0x03f6*/ &_file_Ap4_01_dvM, - /*0x03f7*/ &_file_Ap4_02_joM, - /*0x03f8*/ &_file_Ap4_03_dvM, - /*0x03f9*/ &_file_Ap4_04_joM, - /*0x03fa*/ &_file_Ap4_05_dvM, - /*0x03fb*/ &_file_Ap4_06_joM, - /*0x03fc*/ &_file_Ap4_07_blM, - /*0x03fd*/ &_file_Ap4_08_dvM, - /*0x03fe*/ &_file_Ap4_09_dvM, - /*0x03ff*/ &_file_Ap5_01_joM, - /*0x0400*/ &_file_Ap5_02_joM, - /*0x0401*/ &_file_Ap5_03_joM, - /*0x0402*/ &_file_Ap6_01_joM, - /*0x0403*/ &_file_Ap6_02_caM, - /*0x0404*/ &_file_Ap6_03_joM, - /*0x0405*/ &_file_Ap6_04_caM, - /*0x0406*/ &_file_Ap6_05_joM, - /*0x0407*/ &_file_Ap6_06_caM, - /*0x0408*/ &_file_Ap7_01_caM, - /*0x0409*/ &_file_Ap7_02_joM, - /*0x040a*/ &_file_Ap7_03_caM, - /*0x040b*/ &_file_Ap7_04_joM, - /*0x040c*/ &_file_Ap8_01_dvM, - /*0x040d*/ &_file_Ap8_02_blM, - /*0x040e*/ &_file_Ap8_03_dvM, - /*0x040f*/ &_file_Ap8_04_blM, - /*0x0410*/ &_file_Ap8_06_blM, - /*0x0411*/ &_file_Ap8_07_trM, - /*0x0412*/ &_file_Ap8_08_dvM, - /*0x0413*/ &_file_Ap8_09_trM, - /*0x0414*/ &_file_Ap8_10_blM, - /*0x0415*/ &_file_Ap9_01_joM, - /*0x0416*/ &_file_Ap9_02_caM, - /*0x0417*/ &_file_Ap9_03_joM, - /*0x0418*/ &_file_Ap10_01_caM, - /*0x0419*/ &_file_Ap10_02_caM, - /*0x041a*/ &_file_Ap10_03_caM, - /*0x041b*/ &_file_Ap10_04_caM, - /*0x041c*/ &_file_Ap10_05_joM, - /*0x041d*/ &_file_Ap10_06_caM, - /*0x041e*/ &_file_Ap10_07_joM, - /*0x041f*/ &_file_Ap10_08_caM, - /*0x0420*/ &_file_Ap10_09_joM, - /*0x0421*/ &_file_Ap11_01_jnM, - /*0x0422*/ &_file_Ap11_02_joM, - /*0x0423*/ &_file_Ap11_03_jnM, - /*0x0424*/ &_file_Ap11_04_joM, - /*0x0425*/ &_file_Ap11_05_jnM, - /*0x0426*/ &_file_Ap11_06_joM, - /*0x0427*/ &_file_Ap11_07_jnM, - /*0x0428*/ &_file_Ap11_08_joM, - /*0x0429*/ &_file_Ap12_01_jnM, - /*0x042a*/ &_file_Ap12_02_joM, - /*0x042b*/ &_file_Ap12_03_jnM, - /*0x042c*/ &_file_Ap12_04_joM, - /*0x042d*/ &_file_Ap12_05_jnM, - /*0x042e*/ &_file_Ap12_06_joM, - /*0x042f*/ &_file_Ap12_07_jnM, - /*0x0430*/ &_file_Ap12_08_joM, - /*0x0431*/ &_file_Ap12_09_jnM, - /*0x0432*/ &_file_Ap12_10_joM, - /*0x0433*/ &_file_Ap13_01_joM, - /*0x0434*/ &_file_Ap13_02_suM, - /*0x0435*/ &_file_Ap13_03_joM, - /*0x0436*/ &_file_Ap13_04_suM, - /*0x0437*/ &_file_Ap13_06_suM, - /*0x0438*/ &_file_Ap14_03_suM, - /*0x0439*/ &_file_Ap14_04_joM, - /*0x043a*/ &_file_Ap14_05_suM, - /*0x043b*/ &_file_Ap14_07_joM, - /*0x043c*/ &_file_Ap15_01_elM, - /*0x043d*/ &_file_Ap15_02_elM, - /*0x043e*/ &_file_Ap15_03_joM, - /*0x043f*/ &_file_Ap15_04_jnM, - /*0x0440*/ &_file_Ap15_05_elM, - /*0x0441*/ &_file_Ap15_06_joM, - /*0x0442*/ &_file_Ap15_07_elM, - /*0x0443*/ &_file_Ap15_08_joM, - /*0x0444*/ &_file_Ap15_09_elM, - /*0x0445*/ &_file_Ap15_10_joM, - /*0x0446*/ &_file_Ap15_11_elM, - /*0x0447*/ &_file_Ap16_01_joM, - /*0x0448*/ &_file_Ap16_02_caM, - /*0x0449*/ &_file_Ap16_04_caM, - /*0x044a*/ &_file_Ap16_05_joM, - /*0x044b*/ &_file_Ap16_06_caM, - /*0x044c*/ &_file_Ap17_01_trM, - /*0x044d*/ &_file_Ap17_02_prM, - /*0x044e*/ &_file_Ap17_03_trM, - /*0x044f*/ &_file_Ap17_04_prM, - /*0x0450*/ &_file_Ap17_05_trM, - /*0x0451*/ &_file_Ap17_06_trM, - /*0x0452*/ &_file_Ap18_01_joM, - /*0x0453*/ &_file_Ap18_02_elM, - /*0x0454*/ &_file_Ap18_03_elM, - /*0x0455*/ &_file_Ap18_04_joM, - /*0x0456*/ &_file_Ap18_05_elM, - /*0x0457*/ &_file_Ap19_01_caM, - /*0x0458*/ &_file_Ap19_02_caM, - /*0x0459*/ &_file_Ap19_03_joM, - /*0x045a*/ &_file_Ap19_04_caM, - /*0x045b*/ &_file_Ap19_05_joM, - /*0x045c*/ &_file_Ap19_06_joM, - /*0x045d*/ &_file_Ap20_01_joM, - /*0x045e*/ &_file_Ap20_02_prM, - /*0x045f*/ &_file_Ap20_03_joM, - /*0x0460*/ &_file_Ap20_04_prM, - /*0x0461*/ &_file_Ap20_05_joM, - /*0x0462*/ &_file_Ap20_06_blM, - /*0x0463*/ &_file_Ap20_07_trM, - /*0x0464*/ &_file_Ap20_08_trM, - /*0x0465*/ &_file_Ap21_01_elM, - /*0x0466*/ &_file_Ap21_02_joM, - /*0x0467*/ &_file_Ap21_03_elM, - /*0x0468*/ &_file_Ap21_04_joM, - /*0x0469*/ &_file_Ap22_01_elM, - /*0x046a*/ &_file_Ap22_02_joM, - /*0x046b*/ &_file_Ap22_03_elM, - /*0x046c*/ &_file_Ap22_04_joM, - /*0x046d*/ &_file_Ap23_01_joM, - /*0x046e*/ &_file_Ap23_02_drM, - /*0x046f*/ &_file_Ap23_03_joM, - /*0x0470*/ &_file_Ap23_04_drM, - /*0x0471*/ &_file_Ap23_05_joM, - /*0x0472*/ &_file_Ap23_06_drM, - /*0x0473*/ &_file_Ap23_07_joM, - /*0x0474*/ &_file_Ap23_08_drM, - /*0x0475*/ &_file_Ap24_01_caM, - /*0x0476*/ &_file_Ap24_02_joM, - /*0x0477*/ &_file_Ap24_03_caM, - /*0x0478*/ &_file_Ap24_04_joM, - /*0x0479*/ &_file_Ap24_05_caM, - /*0x047a*/ &_file_Ap24_06_caM, - /*0x047b*/ &_file_Ap24_07_joM, - /*0x047c*/ &_file_Ap24_08_joM, - /*0x047d*/ &_file_Ap25_01_joM, - /*0x047e*/ &_file_Ap25_02_joM, - /*0x047f*/ &_file_Ap26_01_joM, - /*0x0480*/ &_file_Ap26_02_dvM, - /*0x0481*/ &_file_Ap26_03_joM, - /*0x0482*/ &_file_Ap26_04_dvM, - /*0x0483*/ &_file_Ap26_05_dvM, - /*0x0484*/ &_file_Ap26_06_joM, - /*0x0485*/ &_file_Ap26_07_dvM, - /*0x0486*/ &_file_Ap26_08_dvM, - /*0x0487*/ &_file_Ap27_01_joM, - /*0x0488*/ &_file_Ap27_02_elM, - /*0x0489*/ &_file_Ap27_03_elM, - /*0x048a*/ &_file_Ap27_04_joM, - /*0x048b*/ &_file_Ap27_05_joM, - /*0x048c*/ &_file_Ap27_06_elM, - /*0x048d*/ &_file_Ap28_01_elM, - /*0x048e*/ &_file_Ap28_02_joM, - /*0x048f*/ &_file_Ap28_03_elM, - /*0x0490*/ &_file_Ap28_04_joM, - /*0x0491*/ &_file_Ap28_05_elM, - /*0x0492*/ &_file_Ap28_06_joM, - /*0x0493*/ &_file_Ap29_01_elM, - /*0x0494*/ &_file_Ap29_02_joM, - /*0x0495*/ &_file_Ap29_03_elM, - /*0x0496*/ &_file_Ap29_04_joM, - /*0x0497*/ &_file_Ap29_05_joM, - /*0x0498*/ &_file_Ap29_06_elM, - /*0x0499*/ &_file_Ap29_07_joM, - /*0x049a*/ &_file_Ap29_08_elM, - /*0x049b*/ &_file_Ap29_09_joM, - /*0x049c*/ &_file_Ap29_10_elM, - /*0x049d*/ &_file_PautosurgeonZ, - /*0x049e*/ &_file_CdarkwetZ, - /*0x049f*/ &_file_CdarkaqualungZ, - /*0x04a0*/ &_file_CdarksnowZ, - /*0x04a1*/ &_file_CdarklabZ, - /*0x04a2*/ &_file_CfemlabtechZ, - /*0x04a3*/ &_file_CddsniperZ, - /*0x04a4*/ &_file_Cpilotaf1Z, - /*0x04a5*/ &_file_CcilabtechZ, - /*0x04a6*/ &_file_CcifemtechZ, - /*0x04a7*/ &_file_Cheadeileen_hZ, - /*0x04a8*/ &_file_Cheadscott_hZ, - /*0x04a9*/ &_file_CcarreveningsuitZ, - /*0x04aa*/ &_file_CjonathonZ, - /*0x04ab*/ &_file_CcisoldierZ, - /*0x04ac*/ &_file_CheadsanchezZ, - /*0x04ad*/ &_file_CheaddarkaquaZ, - /*0x04ae*/ &_file_CheadddsniperZ, - /*0x04af*/ &_file_PlimoZ, - /*0x04b0*/ &_file_PpdmenuZ, - /*0x04b1*/ &_file_Pa51interceptorZ, - /*0x04b2*/ &_file_Pa51dishZ, - /*0x04b3*/ &_file_Pa51radarconsoleZ, - /*0x04b4*/ &_file_Pa51lockerdoorZ, - /*0x04b5*/ &_file_Pg5generatorZ, - /*0x04b6*/ &_file_Pg5dumpsterZ, - /*0x04b7*/ &_file_Gar34lodZ, - /*0x04b8*/ &_file_GavengerlodZ, - /*0x04b9*/ &_file_Gcmp150lodZ, - /*0x04ba*/ &_file_GcrossbowlodZ, - /*0x04bb*/ &_file_GcyclonelodZ, - /*0x04bc*/ &_file_GdruggunlodZ, - /*0x04bd*/ &_file_Gdy357lodZ, - /*0x04be*/ &_file_Gdy357trentlodZ, - /*0x04bf*/ &_file_GdevastatorlodZ, - /*0x04c0*/ &_file_GdydragonlodZ, - /*0x04c1*/ &_file_GdysuperdragonlodZ, - /*0x04c2*/ &_file_GknifelodZ, - /*0x04c3*/ &_file_GlaserlodZ, - /*0x04c4*/ &_file_GmagseclodZ, - /*0x04c5*/ &_file_GmayanpistollodZ, - /*0x04c6*/ &_file_GmayansmglodZ, - /*0x04c7*/ &_file_GpcgunlodZ, - /*0x04c8*/ &_file_Grcp120lodZ, - /*0x04c9*/ &_file_GrocketlodZ, - /*0x04ca*/ &_file_GshotgunlodZ, - /*0x04cb*/ &_file_GskpistollodZ, - /*0x04cc*/ &_file_GskrocketlodZ, - /*0x04cd*/ &_file_GsniperlodZ, - /*0x04ce*/ &_file_Gz2020lodZ, - /*0x04cf*/ &_file_PchrcloakerZ, - /*0x04d0*/ &_file_PchrspeedpillZ, - /*0x04d1*/ &_file_PbaggagecarrierZ, - /*0x04d2*/ &_file_PminesignZ, - /*0x04d3*/ &_file_PchamberZ, - /*0x04d4*/ &_file_PisotopeexperimentZ, - /*0x04d5*/ &_file_PisotopeZ, - /*0x04d6*/ &_file_PreactordoorZ, - /*0x04d7*/ &_file_PsaucerinsideZ, - /*0x04d8*/ &_file_PvillastoolZ, - /*0x04d9*/ &_file_Pcetanwindow1Z, - /*0x04da*/ &_file_Pcetanwindow2Z, - /*0x04db*/ &_file_Pcetanwindow3Z, - /*0x04dc*/ &_file_Apelelv01M, - /*0x04dd*/ &_file_Apelgrd01M, - /*0x04de*/ &_file_Ap29_11_joM, - /*0x04df*/ &_file_GlaserZ, - /*0x04e0*/ &_file_PbigpelagicdoorZ, - /*0x04e1*/ &_file_Psk_jonrubble3Z, - /*0x04e2*/ &_file_Psk_jonrubble4Z, - /*0x04e3*/ &_file_Psk_jonrubble5Z, - /*0x04e4*/ &_file_Psk_jonrubble6Z, - /*0x04e5*/ &_file_GcombathandslodZ, - /*0x04e6*/ &_file_PbinocularsZ, - /*0x04e7*/ &_file_PsubmarineZ, - /*0x04e8*/ &_file_Pairforce1Z, - /*0x04e9*/ &_file_PenginepartZ, - /*0x04ea*/ &_file_Am3l2carrM, - /*0x04eb*/ &_file_Aelvcet01M, - /*0x04ec*/ &_file_Aelvcet02M, - /*0x04ed*/ &_file_Ajorep01M, - /*0x04ee*/ &_file_Ajorep02M, - /*0x04ef*/ &_file_Ajorep03M, - /*0x04f0*/ &_file_Ajorep04M, - /*0x04f1*/ &_file_PcetroofgunZ, - /*0x04f2*/ &_file_PcetansmalldoorZ, - /*0x04f3*/ &_file_PpowernodeZ, - /*0x04f4*/ &_file_PcetanbluegreenlZ, - /*0x04f5*/ &_file_PcetanbluegreenrZ, - /*0x04f6*/ &_file_PskedarconsoleZ, - /*0x04f7*/ &_file_PskedarconsolepanelZ, - /*0x04f8*/ &_file_Ajorpld01M, - /*0x04f9*/ &_file_Ajorpld02M, - /*0x04fa*/ &_file_Ajorpld03M, - /*0x04fb*/ &_file_Ajorpld04M, - /*0x04fc*/ &_file_GnbombZ, - /*0x04fd*/ &_file_GnbomblodZ, - /*0x04fe*/ &_file_GgrenadelodZ, - /*0x04ff*/ &_file_PweaponcdoorZ, - /*0x0500*/ &_file_PtargetZ, - /*0x0501*/ &_file_PdevicesecretdoorZ, - /*0x0502*/ &_file_PcarringtonsecretdoorZ, - /*0x0503*/ &_file_PsinisterpcZ, - /*0x0504*/ &_file_PsinisterstationZ, - /*0x0505*/ &_file_PkeypadlockZ, - /*0x0506*/ &_file_PthumbprintscannerZ, - /*0x0507*/ &_file_PretinalockZ, - /*0x0508*/ &_file_PcardlockZ, - /*0x0509*/ &_file_PgoodstationZ, - /*0x050a*/ &_file_PgoodpcZ, - /*0x050b*/ &_file_CskedarkingZ, - /*0x050c*/ &_file_CelviswaistcoatZ, - /*0x050d*/ &_file_CheadgriffeyZ, - /*0x050e*/ &_file_CheadmotoZ, - /*0x050f*/ &_file_CheadkeithZ, - /*0x0510*/ &_file_CheadwinnerZ, - /*0x0511*/ &_file_Ca51faceplateZ, - /*0x0512*/ &_file_PchrautogunZ, - /*0x0513*/ &_file_Pg5bigchairZ, - /*0x0514*/ &_file_Pg5smallchairZ, - /*0x0515*/ &_file_PkingsceptreZ, - /*0x0516*/ &_file_PlabcoatZ, - /*0x0517*/ &_file_Atrjo01M, - /*0x0518*/ &_file_Atrgrim01M, - /*0x0519*/ &_file_Atrgrim02M, - /*0x051a*/ &_file_Atrcarr06M, - /*0x051b*/ &_file_Atrcarr07M, - /*0x051c*/ &_file_Atrcarr08M, - /*0x051d*/ &_file_Atrcarr01M, - /*0x051e*/ &_file_Atrcarr02M, - /*0x051f*/ &_file_Atrcarr03M, - /*0x0520*/ &_file_Atrcarr04M, - /*0x0521*/ &_file_Atrcarr05M, - /*0x0522*/ &_file_Atrcarr12M, - /*0x0523*/ &_file_Abnblde01M, - /*0x0524*/ &_file_Abncass01M, - /*0x0525*/ &_file_Pcidoor1Z, - /*0x0526*/ &_file_Pg5_chairZ, - /*0x0527*/ &_file_Pg5_chair2Z, - /*0x0528*/ &_file_Pdd_window_foyerZ, - /*0x0529*/ &_file_Ghand_jowetsuitZ, - /*0x052a*/ &_file_Ghand_trentZ, - /*0x052b*/ &_file_Ghand_jofrockZ, - /*0x052c*/ &_file_Ghand_jotrenchZ, - /*0x052d*/ &_file_Ghand_ddsniperZ, - /*0x052e*/ &_file_Ghand_presidentZ, - /*0x052f*/ &_file_Ghand_joaf1Z, - /*0x0530*/ &_file_Ghand_jopilotZ, - /*0x0531*/ &_file_Ghand_carringtonZ, - /*0x0532*/ &_file_Ghand_mrblondeZ, - /*0x0533*/ &_file_Ghand_ciaZ, - /*0x0534*/ &_file_Ghand_cifemtechZ, - /*0x0535*/ &_file_Ghand_fbiarmZ, - /*0x0536*/ &_file_Ghand_josnowZ, - /*0x0537*/ &_file_Ghand_vriesZ, - /*0x0538*/ &_file_Ghand_ddsecurityZ, - /*0x0539*/ &_file_Ghand_tragic_pelagicZ, - /*0x053a*/ &_file_Ghand_stewardess_coatZ, - /*0x053b*/ &_file_Ghand_ddlabtechZ, - /*0x053c*/ &_file_Pci_cabinetZ, - /*0x053d*/ &_file_Pci_deskZ, - /*0x053e*/ &_file_Pci_carr_deskZ, - /*0x053f*/ &_file_Pci_f_chairZ, - /*0x0540*/ &_file_Pci_loungerZ, - /*0x0541*/ &_file_Pci_f_sofaZ, - /*0x0542*/ &_file_Pci_tableZ, - /*0x0543*/ &_file_Pcv_coffee_tableZ, - /*0x0544*/ &_file_Pcv_chair1Z, - /*0x0545*/ &_file_Pcv_chair2Z, - /*0x0546*/ &_file_Pcv_sofaZ, - /*0x0547*/ &_file_Pcv_chair4Z, - /*0x0548*/ &_file_Pcv_lampZ, - /*0x0549*/ &_file_Pcv_cabinetZ, - /*0x054a*/ &_file_Pcv_f_bedZ, - /*0x054b*/ &_file_Ppel_chair1Z, - /*0x054c*/ &_file_Psk_console2Z, - /*0x054d*/ &_file_Pdd_ear_tableZ, - /*0x054e*/ &_file_Pdd_ear_chairZ, - /*0x054f*/ &_file_Pairbase_table2Z, - /*0x0550*/ &_file_Pairbase_chair2Z, - /*0x0551*/ &_file_Pmisc_crateZ, - /*0x0552*/ &_file_Pmisc_irspecsZ, - /*0x0553*/ &_file_Cheadelvis_gogsZ, - /*0x0554*/ &_file_CheadstevemZ, - /*0x0555*/ &_file_Pa51_roofgunZ, - /*0x0556*/ &_file_Psk_drone_gunZ, - /*0x0557*/ &_file_Pci_roofgunZ, - /*0x0558*/ &_file_Pcv_tableZ, - /*0x0559*/ &_file_Cdark_leatherZ, - /*0x055a*/ &_file_Cheaddark_snowZ, - /*0x055b*/ &_file_CheadpresidentZ, - /*0x055c*/ &_file_Pcidoor1_refZ, - /*0x055d*/ &_file_Palaskadoor_outZ, - /*0x055e*/ &_file_Palaskadoor_inZ, - /*0x055f*/ &_file_PwirefenceZ, - /*0x0560*/ &_file_PrarelogoZ, - /*0x0561*/ &_file_Chead_vdZ, - /*0x0562*/ &_file_Apelelv02M, - /*0x0563*/ &_file_PkeycardZ, - /*0x0564*/ &_file_PbodyarmourZ, - /*0x0565*/ &_file_Pa51gate_rZ, - /*0x0566*/ &_file_Pa51gate_lZ, - /*0x0567*/ &_file_Paf1_lampZ, - /*0x0568*/ &_file_Paf1_toiletZ, - /*0x0569*/ &_file_Paf1_doorbig2Z, - /*0x056a*/ &_file_Paf1_phoneZ, - /*0x056b*/ &_file_Paf1_cargodoorZ, - /*0x056c*/ &_file_Pg5_alarmZ, - /*0x056d*/ &_file_Pg5_laser_switchZ, - /*0x056e*/ &_file_Psk_templecolumn4Z, - /*0x056f*/ &_file_PcorehatchZ, - /*0x0570*/ &_file_LameE, - /*0x0571*/ &_file_LameJ, - /*0x0572*/ &_file_LameP, - /*0x0573*/ &_file_Lame_str_gZ, - /*0x0574*/ &_file_Lame_str_fZ, - /*0x0575*/ &_file_Lame_str_sZ, - /*0x0576*/ &_file_Lame_str_iZ, - /*0x0577*/ &_file_LarchE, - /*0x0578*/ &_file_LarchJ, - /*0x0579*/ &_file_LarchP, - /*0x057a*/ &_file_Larch_str_gZ, - /*0x057b*/ &_file_Larch_str_fZ, - /*0x057c*/ &_file_Larch_str_sZ, - /*0x057d*/ &_file_Larch_str_iZ, - /*0x057e*/ &_file_LarecE, - /*0x057f*/ &_file_LarecJ, - /*0x0580*/ &_file_LarecP, - /*0x0581*/ &_file_Larec_str_gZ, - /*0x0582*/ &_file_Larec_str_fZ, - /*0x0583*/ &_file_Larec_str_sZ, - /*0x0584*/ &_file_Larec_str_iZ, - /*0x0585*/ &_file_LarkE, - /*0x0586*/ &_file_LarkJ, - /*0x0587*/ &_file_LarkP, - /*0x0588*/ &_file_Lark_str_gZ, - /*0x0589*/ &_file_Lark_str_fZ, - /*0x058a*/ &_file_Lark_str_sZ, - /*0x058b*/ &_file_Lark_str_iZ, - /*0x058c*/ &_file_LashE, - /*0x058d*/ &_file_LashJ, - /*0x058e*/ &_file_LashP, - /*0x058f*/ &_file_Lash_str_gZ, - /*0x0590*/ &_file_Lash_str_fZ, - /*0x0591*/ &_file_Lash_str_sZ, - /*0x0592*/ &_file_Lash_str_iZ, - /*0x0593*/ &_file_LateE, - /*0x0594*/ &_file_LateJ, - /*0x0595*/ &_file_LateP, - /*0x0596*/ &_file_Late_str_gZ, - /*0x0597*/ &_file_Late_str_fZ, - /*0x0598*/ &_file_Late_str_sZ, - /*0x0599*/ &_file_Late_str_iZ, - /*0x059a*/ &_file_LaztE, - /*0x059b*/ &_file_LaztJ, - /*0x059c*/ &_file_LaztP, - /*0x059d*/ &_file_Lazt_str_gZ, - /*0x059e*/ &_file_Lazt_str_fZ, - /*0x059f*/ &_file_Lazt_str_sZ, - /*0x05a0*/ &_file_Lazt_str_iZ, - /*0x05a1*/ &_file_LcatE, - /*0x05a2*/ &_file_LcatJ, - /*0x05a3*/ &_file_LcatP, - /*0x05a4*/ &_file_Lcat_str_gZ, - /*0x05a5*/ &_file_Lcat_str_fZ, - /*0x05a6*/ &_file_Lcat_str_sZ, - /*0x05a7*/ &_file_Lcat_str_iZ, - /*0x05a8*/ &_file_LcaveE, - /*0x05a9*/ &_file_LcaveJ, - /*0x05aa*/ &_file_LcaveP, - /*0x05ab*/ &_file_Lcave_str_gZ, - /*0x05ac*/ &_file_Lcave_str_fZ, - /*0x05ad*/ &_file_Lcave_str_sZ, - /*0x05ae*/ &_file_Lcave_str_iZ, - /*0x05af*/ &_file_LcradE, - /*0x05b0*/ &_file_LcradJ, - /*0x05b1*/ &_file_LcradP, - /*0x05b2*/ &_file_Lcrad_str_gZ, - /*0x05b3*/ &_file_Lcrad_str_fZ, - /*0x05b4*/ &_file_Lcrad_str_sZ, - /*0x05b5*/ &_file_Lcrad_str_iZ, - /*0x05b6*/ &_file_LcrypE, - /*0x05b7*/ &_file_LcrypJ, - /*0x05b8*/ &_file_LcrypP, - /*0x05b9*/ &_file_Lcryp_str_gZ, - /*0x05ba*/ &_file_Lcryp_str_fZ, - /*0x05bb*/ &_file_Lcryp_str_sZ, - /*0x05bc*/ &_file_Lcryp_str_iZ, - /*0x05bd*/ &_file_LdamE, - /*0x05be*/ &_file_LdamJ, - /*0x05bf*/ &_file_LdamP, - /*0x05c0*/ &_file_Ldam_str_gZ, - /*0x05c1*/ &_file_Ldam_str_fZ, - /*0x05c2*/ &_file_Ldam_str_sZ, - /*0x05c3*/ &_file_Ldam_str_iZ, - /*0x05c4*/ &_file_LdepoE, - /*0x05c5*/ &_file_LdepoJ, - /*0x05c6*/ &_file_LdepoP, - /*0x05c7*/ &_file_Ldepo_str_gZ, - /*0x05c8*/ &_file_Ldepo_str_fZ, - /*0x05c9*/ &_file_Ldepo_str_sZ, - /*0x05ca*/ &_file_Ldepo_str_iZ, - /*0x05cb*/ &_file_LdestE, - /*0x05cc*/ &_file_LdestJ, - /*0x05cd*/ &_file_LdestP, - /*0x05ce*/ &_file_Ldest_str_gZ, - /*0x05cf*/ &_file_Ldest_str_fZ, - /*0x05d0*/ &_file_Ldest_str_sZ, - /*0x05d1*/ &_file_Ldest_str_iZ, - /*0x05d2*/ &_file_LdishE, - /*0x05d3*/ &_file_LdishJ, - /*0x05d4*/ &_file_LdishP, - /*0x05d5*/ &_file_Ldish_str_gZ, - /*0x05d6*/ &_file_Ldish_str_fZ, - /*0x05d7*/ &_file_Ldish_str_sZ, - /*0x05d8*/ &_file_Ldish_str_iZ, - /*0x05d9*/ &_file_LearE, - /*0x05da*/ &_file_LearJ, - /*0x05db*/ &_file_LearP, - /*0x05dc*/ &_file_Lear_str_gZ, - /*0x05dd*/ &_file_Lear_str_fZ, - /*0x05de*/ &_file_Lear_str_sZ, - /*0x05df*/ &_file_Lear_str_iZ, - /*0x05e0*/ &_file_LeldE, - /*0x05e1*/ &_file_LeldJ, - /*0x05e2*/ &_file_LeldP, - /*0x05e3*/ &_file_Leld_str_gZ, - /*0x05e4*/ &_file_Leld_str_fZ, - /*0x05e5*/ &_file_Leld_str_sZ, - /*0x05e6*/ &_file_Leld_str_iZ, - /*0x05e7*/ &_file_LgunE, - /*0x05e8*/ &_file_LgunJ, - /*0x05e9*/ &_file_LgunP, - /*0x05ea*/ &_file_Lgun_str_gZ, - /*0x05eb*/ &_file_Lgun_str_fZ, - /*0x05ec*/ &_file_Lgun_str_sZ, - /*0x05ed*/ &_file_Lgun_str_iZ, - /*0x05ee*/ &_file_LimpE, - /*0x05ef*/ &_file_LimpJ, - /*0x05f0*/ &_file_LimpP, - /*0x05f1*/ &_file_Limp_str_gZ, - /*0x05f2*/ &_file_Limp_str_fZ, - /*0x05f3*/ &_file_Limp_str_sZ, - /*0x05f4*/ &_file_Limp_str_iZ, - /*0x05f5*/ &_file_LjunE, - /*0x05f6*/ &_file_LjunJ, - /*0x05f7*/ &_file_LjunP, - /*0x05f8*/ &_file_Ljun_str_gZ, - /*0x05f9*/ &_file_Ljun_str_fZ, - /*0x05fa*/ &_file_Ljun_str_sZ, - /*0x05fb*/ &_file_Ljun_str_iZ, - /*0x05fc*/ &_file_LlamE, - /*0x05fd*/ &_file_LlamJ, - /*0x05fe*/ &_file_LlamP, - /*0x05ff*/ &_file_Llam_str_gZ, - /*0x0600*/ &_file_Llam_str_fZ, - /*0x0601*/ &_file_Llam_str_sZ, - /*0x0602*/ &_file_Llam_str_iZ, - /*0x0603*/ &_file_LleeE, - /*0x0604*/ &_file_LleeJ, - /*0x0605*/ &_file_LleeP, - /*0x0606*/ &_file_Llee_str_gZ, - /*0x0607*/ &_file_Llee_str_fZ, - /*0x0608*/ &_file_Llee_str_sZ, - /*0x0609*/ &_file_Llee_str_iZ, - /*0x060a*/ &_file_LlenE, - /*0x060b*/ &_file_LlenJ, - /*0x060c*/ &_file_LlenP, - /*0x060d*/ &_file_Llen_str_gZ, - /*0x060e*/ &_file_Llen_str_fZ, - /*0x060f*/ &_file_Llen_str_sZ, - /*0x0610*/ &_file_Llen_str_iZ, - /*0x0611*/ &_file_LlipE, - /*0x0612*/ &_file_LlipJ, - /*0x0613*/ &_file_LlipP, - /*0x0614*/ &_file_Llip_str_gZ, - /*0x0615*/ &_file_Llip_str_fZ, - /*0x0616*/ &_file_Llip_str_sZ, - /*0x0617*/ &_file_Llip_str_iZ, - /*0x0618*/ &_file_LlueE, - /*0x0619*/ &_file_LlueJ, - /*0x061a*/ &_file_LlueP, - /*0x061b*/ &_file_Llue_str_gZ, - /*0x061c*/ &_file_Llue_str_fZ, - /*0x061d*/ &_file_Llue_str_sZ, - /*0x061e*/ &_file_Llue_str_iZ, - /*0x061f*/ &_file_LmiscE, - /*0x0620*/ &_file_LmiscJ, - /*0x0621*/ &_file_LmiscP, - /*0x0622*/ &_file_Lmisc_str_gZ, - /*0x0623*/ &_file_Lmisc_str_fZ, - /*0x0624*/ &_file_Lmisc_str_sZ, - /*0x0625*/ &_file_Lmisc_str_iZ, - /*0x0626*/ &_file_Lmp10E, - /*0x0627*/ &_file_Lmp10J, - /*0x0628*/ &_file_Lmp10P, - /*0x0629*/ &_file_Lmp10_str_gZ, - /*0x062a*/ &_file_Lmp10_str_fZ, - /*0x062b*/ &_file_Lmp10_str_sZ, - /*0x062c*/ &_file_Lmp10_str_iZ, - /*0x062d*/ &_file_Lmp11E, - /*0x062e*/ &_file_Lmp11J, - /*0x062f*/ &_file_Lmp11P, - /*0x0630*/ &_file_Lmp11_str_gZ, - /*0x0631*/ &_file_Lmp11_str_fZ, - /*0x0632*/ &_file_Lmp11_str_sZ, - /*0x0633*/ &_file_Lmp11_str_iZ, - /*0x0634*/ &_file_Lmp12E, - /*0x0635*/ &_file_Lmp12J, - /*0x0636*/ &_file_Lmp12P, - /*0x0637*/ &_file_Lmp12_str_gZ, - /*0x0638*/ &_file_Lmp12_str_fZ, - /*0x0639*/ &_file_Lmp12_str_sZ, - /*0x063a*/ &_file_Lmp12_str_iZ, - /*0x063b*/ &_file_Lmp13E, - /*0x063c*/ &_file_Lmp13J, - /*0x063d*/ &_file_Lmp13P, - /*0x063e*/ &_file_Lmp13_str_gZ, - /*0x063f*/ &_file_Lmp13_str_fZ, - /*0x0640*/ &_file_Lmp13_str_sZ, - /*0x0641*/ &_file_Lmp13_str_iZ, - /*0x0642*/ &_file_Lmp14E, - /*0x0643*/ &_file_Lmp14J, - /*0x0644*/ &_file_Lmp14P, - /*0x0645*/ &_file_Lmp14_str_gZ, - /*0x0646*/ &_file_Lmp14_str_fZ, - /*0x0647*/ &_file_Lmp14_str_sZ, - /*0x0648*/ &_file_Lmp14_str_iZ, - /*0x0649*/ &_file_Lmp15E, - /*0x064a*/ &_file_Lmp15J, - /*0x064b*/ &_file_Lmp15P, - /*0x064c*/ &_file_Lmp15_str_gZ, - /*0x064d*/ &_file_Lmp15_str_fZ, - /*0x064e*/ &_file_Lmp15_str_sZ, - /*0x064f*/ &_file_Lmp15_str_iZ, - /*0x0650*/ &_file_Lmp16E, - /*0x0651*/ &_file_Lmp16J, - /*0x0652*/ &_file_Lmp16P, - /*0x0653*/ &_file_Lmp16_str_gZ, - /*0x0654*/ &_file_Lmp16_str_fZ, - /*0x0655*/ &_file_Lmp16_str_sZ, - /*0x0656*/ &_file_Lmp16_str_iZ, - /*0x0657*/ &_file_Lmp17E, - /*0x0658*/ &_file_Lmp17J, - /*0x0659*/ &_file_Lmp17P, - /*0x065a*/ &_file_Lmp17_str_gZ, - /*0x065b*/ &_file_Lmp17_str_fZ, - /*0x065c*/ &_file_Lmp17_str_sZ, - /*0x065d*/ &_file_Lmp17_str_iZ, - /*0x065e*/ &_file_Lmp18E, - /*0x065f*/ &_file_Lmp18J, - /*0x0660*/ &_file_Lmp18P, - /*0x0661*/ &_file_Lmp18_str_gZ, - /*0x0662*/ &_file_Lmp18_str_fZ, - /*0x0663*/ &_file_Lmp18_str_sZ, - /*0x0664*/ &_file_Lmp18_str_iZ, - /*0x0665*/ &_file_Lmp19E, - /*0x0666*/ &_file_Lmp19J, - /*0x0667*/ &_file_Lmp19P, - /*0x0668*/ &_file_Lmp19_str_gZ, - /*0x0669*/ &_file_Lmp19_str_fZ, - /*0x066a*/ &_file_Lmp19_str_sZ, - /*0x066b*/ &_file_Lmp19_str_iZ, - /*0x066c*/ &_file_Lmp1E, - /*0x066d*/ &_file_Lmp1J, - /*0x066e*/ &_file_Lmp1P, - /*0x066f*/ &_file_Lmp1_str_gZ, - /*0x0670*/ &_file_Lmp1_str_fZ, - /*0x0671*/ &_file_Lmp1_str_sZ, - /*0x0672*/ &_file_Lmp1_str_iZ, - /*0x0673*/ &_file_Lmp20E, - /*0x0674*/ &_file_Lmp20J, - /*0x0675*/ &_file_Lmp20P, - /*0x0676*/ &_file_Lmp20_str_gZ, - /*0x0677*/ &_file_Lmp20_str_fZ, - /*0x0678*/ &_file_Lmp20_str_sZ, - /*0x0679*/ &_file_Lmp20_str_iZ, - /*0x067a*/ &_file_Lmp2E, - /*0x067b*/ &_file_Lmp2J, - /*0x067c*/ &_file_Lmp2P, - /*0x067d*/ &_file_Lmp2_str_gZ, - /*0x067e*/ &_file_Lmp2_str_fZ, - /*0x067f*/ &_file_Lmp2_str_sZ, - /*0x0680*/ &_file_Lmp2_str_iZ, - /*0x0681*/ &_file_Lmp3E, - /*0x0682*/ &_file_Lmp3J, - /*0x0683*/ &_file_Lmp3P, - /*0x0684*/ &_file_Lmp3_str_gZ, - /*0x0685*/ &_file_Lmp3_str_fZ, - /*0x0686*/ &_file_Lmp3_str_sZ, - /*0x0687*/ &_file_Lmp3_str_iZ, - /*0x0688*/ &_file_Lmp4E, - /*0x0689*/ &_file_Lmp4J, - /*0x068a*/ &_file_Lmp4P, - /*0x068b*/ &_file_Lmp4_str_gZ, - /*0x068c*/ &_file_Lmp4_str_fZ, - /*0x068d*/ &_file_Lmp4_str_sZ, - /*0x068e*/ &_file_Lmp4_str_iZ, - /*0x068f*/ &_file_Lmp5E, - /*0x0690*/ &_file_Lmp5J, - /*0x0691*/ &_file_Lmp5P, - /*0x0692*/ &_file_Lmp5_str_gZ, - /*0x0693*/ &_file_Lmp5_str_fZ, - /*0x0694*/ &_file_Lmp5_str_sZ, - /*0x0695*/ &_file_Lmp5_str_iZ, - /*0x0696*/ &_file_Lmp6E, - /*0x0697*/ &_file_Lmp6J, - /*0x0698*/ &_file_Lmp6P, - /*0x0699*/ &_file_Lmp6_str_gZ, - /*0x069a*/ &_file_Lmp6_str_fZ, - /*0x069b*/ &_file_Lmp6_str_sZ, - /*0x069c*/ &_file_Lmp6_str_iZ, - /*0x069d*/ &_file_Lmp7E, - /*0x069e*/ &_file_Lmp7J, - /*0x069f*/ &_file_Lmp7P, - /*0x06a0*/ &_file_Lmp7_str_gZ, - /*0x06a1*/ &_file_Lmp7_str_fZ, - /*0x06a2*/ &_file_Lmp7_str_sZ, - /*0x06a3*/ &_file_Lmp7_str_iZ, - /*0x06a4*/ &_file_Lmp8E, - /*0x06a5*/ &_file_Lmp8J, - /*0x06a6*/ &_file_Lmp8P, - /*0x06a7*/ &_file_Lmp8_str_gZ, - /*0x06a8*/ &_file_Lmp8_str_fZ, - /*0x06a9*/ &_file_Lmp8_str_sZ, - /*0x06aa*/ &_file_Lmp8_str_iZ, - /*0x06ab*/ &_file_Lmp9E, - /*0x06ac*/ &_file_Lmp9J, - /*0x06ad*/ &_file_Lmp9P, - /*0x06ae*/ &_file_Lmp9_str_gZ, - /*0x06af*/ &_file_Lmp9_str_fZ, - /*0x06b0*/ &_file_Lmp9_str_sZ, - /*0x06b1*/ &_file_Lmp9_str_iZ, - /*0x06b2*/ &_file_LmpmenuE, - /*0x06b3*/ &_file_LmpmenuJ, - /*0x06b4*/ &_file_LmpmenuP, - /*0x06b5*/ &_file_Lmpmenu_str_gZ, - /*0x06b6*/ &_file_Lmpmenu_str_fZ, - /*0x06b7*/ &_file_Lmpmenu_str_sZ, - /*0x06b8*/ &_file_Lmpmenu_str_iZ, - /*0x06b9*/ &_file_LmpweaponsE, - /*0x06ba*/ &_file_LmpweaponsJ, - /*0x06bb*/ &_file_LmpweaponsP, - /*0x06bc*/ &_file_Lmpweapons_str_gZ, - /*0x06bd*/ &_file_Lmpweapons_str_fZ, - /*0x06be*/ &_file_Lmpweapons_str_sZ, - /*0x06bf*/ &_file_Lmpweapons_str_iZ, - /*0x06c0*/ &_file_LoatE, - /*0x06c1*/ &_file_LoatJ, - /*0x06c2*/ &_file_LoatP, - /*0x06c3*/ &_file_Loat_str_gZ, - /*0x06c4*/ &_file_Loat_str_fZ, - /*0x06c5*/ &_file_Loat_str_sZ, - /*0x06c6*/ &_file_Loat_str_iZ, - /*0x06c7*/ &_file_LoldE, - /*0x06c8*/ &_file_LoldJ, - /*0x06c9*/ &_file_LoldP, - /*0x06ca*/ &_file_Lold_str_gZ, - /*0x06cb*/ &_file_Lold_str_fZ, - /*0x06cc*/ &_file_Lold_str_sZ, - /*0x06cd*/ &_file_Lold_str_iZ, - /*0x06ce*/ &_file_LoptionsE, - /*0x06cf*/ &_file_LoptionsJ, - /*0x06d0*/ &_file_LoptionsP, - /*0x06d1*/ &_file_Loptions_str_gZ, - /*0x06d2*/ &_file_Loptions_str_fZ, - /*0x06d3*/ &_file_Loptions_str_sZ, - /*0x06d4*/ &_file_Loptions_str_iZ, - /*0x06d5*/ &_file_LpamE, - /*0x06d6*/ &_file_LpamJ, - /*0x06d7*/ &_file_LpamP, - /*0x06d8*/ &_file_Lpam_str_gZ, - /*0x06d9*/ &_file_Lpam_str_fZ, - /*0x06da*/ &_file_Lpam_str_sZ, - /*0x06db*/ &_file_Lpam_str_iZ, - /*0x06dc*/ &_file_LpeteE, - /*0x06dd*/ &_file_LpeteJ, - /*0x06de*/ &_file_LpeteP, - /*0x06df*/ &_file_Lpete_str_gZ, - /*0x06e0*/ &_file_Lpete_str_fZ, - /*0x06e1*/ &_file_Lpete_str_sZ, - /*0x06e2*/ &_file_Lpete_str_iZ, - /*0x06e3*/ &_file_LpropobjE, - /*0x06e4*/ &_file_LpropobjJ, - /*0x06e5*/ &_file_LpropobjP, - /*0x06e6*/ &_file_Lpropobj_str_gZ, - /*0x06e7*/ &_file_Lpropobj_str_fZ, - /*0x06e8*/ &_file_Lpropobj_str_sZ, - /*0x06e9*/ &_file_Lpropobj_str_iZ, - /*0x06ea*/ &_file_LrefE, - /*0x06eb*/ &_file_LrefJ, - /*0x06ec*/ &_file_LrefP, - /*0x06ed*/ &_file_Lref_str_gZ, - /*0x06ee*/ &_file_Lref_str_fZ, - /*0x06ef*/ &_file_Lref_str_sZ, - /*0x06f0*/ &_file_Lref_str_iZ, - /*0x06f1*/ &_file_LritE, - /*0x06f2*/ &_file_LritJ, - /*0x06f3*/ &_file_LritP, - /*0x06f4*/ &_file_Lrit_str_gZ, - /*0x06f5*/ &_file_Lrit_str_fZ, - /*0x06f6*/ &_file_Lrit_str_sZ, - /*0x06f7*/ &_file_Lrit_str_iZ, - /*0x06f8*/ &_file_LrunE, - /*0x06f9*/ &_file_LrunJ, - /*0x06fa*/ &_file_LrunP, - /*0x06fb*/ &_file_Lrun_str_gZ, - /*0x06fc*/ &_file_Lrun_str_fZ, - /*0x06fd*/ &_file_Lrun_str_sZ, - /*0x06fe*/ &_file_Lrun_str_iZ, - /*0x06ff*/ &_file_LsevE, - /*0x0700*/ &_file_LsevJ, - /*0x0701*/ &_file_LsevP, - /*0x0702*/ &_file_Lsev_str_gZ, - /*0x0703*/ &_file_Lsev_str_fZ, - /*0x0704*/ &_file_Lsev_str_sZ, - /*0x0705*/ &_file_Lsev_str_iZ, - /*0x0706*/ &_file_LsevbE, - /*0x0707*/ &_file_LsevbJ, - /*0x0708*/ &_file_LsevbP, - /*0x0709*/ &_file_Lsevb_str_gZ, - /*0x070a*/ &_file_Lsevb_str_fZ, - /*0x070b*/ &_file_Lsevb_str_sZ, - /*0x070c*/ &_file_Lsevb_str_iZ, - /*0x070d*/ &_file_LsevxE, - /*0x070e*/ &_file_LsevxJ, - /*0x070f*/ &_file_LsevxP, - /*0x0710*/ &_file_Lsevx_str_gZ, - /*0x0711*/ &_file_Lsevx_str_fZ, - /*0x0712*/ &_file_Lsevx_str_sZ, - /*0x0713*/ &_file_Lsevx_str_iZ, - /*0x0714*/ &_file_LsevxbE, - /*0x0715*/ &_file_LsevxbJ, - /*0x0716*/ &_file_LsevxbP, - /*0x0717*/ &_file_Lsevxb_str_gZ, - /*0x0718*/ &_file_Lsevxb_str_fZ, - /*0x0719*/ &_file_Lsevxb_str_sZ, - /*0x071a*/ &_file_Lsevxb_str_iZ, - /*0x071b*/ &_file_LshoE, - /*0x071c*/ &_file_LshoJ, - /*0x071d*/ &_file_LshoP, - /*0x071e*/ &_file_Lsho_str_gZ, - /*0x071f*/ &_file_Lsho_str_fZ, - /*0x0720*/ &_file_Lsho_str_sZ, - /*0x0721*/ &_file_Lsho_str_iZ, - /*0x0722*/ &_file_LsiloE, - /*0x0723*/ &_file_LsiloJ, - /*0x0724*/ &_file_LsiloP, - /*0x0725*/ &_file_Lsilo_str_gZ, - /*0x0726*/ &_file_Lsilo_str_fZ, - /*0x0727*/ &_file_Lsilo_str_sZ, - /*0x0728*/ &_file_Lsilo_str_iZ, - /*0x0729*/ &_file_LstatE, - /*0x072a*/ &_file_LstatJ, - /*0x072b*/ &_file_LstatP, - /*0x072c*/ &_file_Lstat_str_gZ, - /*0x072d*/ &_file_Lstat_str_fZ, - /*0x072e*/ &_file_Lstat_str_sZ, - /*0x072f*/ &_file_Lstat_str_iZ, - /*0x0730*/ &_file_LtitleE, - /*0x0731*/ &_file_LtitleJ, - /*0x0732*/ &_file_LtitleP, - /*0x0733*/ &_file_Ltitle_str_gZ, - /*0x0734*/ &_file_Ltitle_str_fZ, - /*0x0735*/ &_file_Ltitle_str_sZ, - /*0x0736*/ &_file_Ltitle_str_iZ, - /*0x0737*/ &_file_LtraE, - /*0x0738*/ &_file_LtraJ, - /*0x0739*/ &_file_LtraP, - /*0x073a*/ &_file_Ltra_str_gZ, - /*0x073b*/ &_file_Ltra_str_fZ, - /*0x073c*/ &_file_Ltra_str_sZ, - /*0x073d*/ &_file_Ltra_str_iZ, - /*0x073e*/ &_file_LuffE, - /*0x073f*/ &_file_LuffJ, - /*0x0740*/ &_file_LuffP, - /*0x0741*/ &_file_Luff_str_gZ, - /*0x0742*/ &_file_Luff_str_fZ, - /*0x0743*/ &_file_Luff_str_sZ, - /*0x0744*/ &_file_Luff_str_iZ, - /*0x0745*/ &_file_LwaxE, - /*0x0746*/ &_file_LwaxJ, - /*0x0747*/ &_file_LwaxP, - /*0x0748*/ &_file_Lwax_str_gZ, - /*0x0749*/ &_file_Lwax_str_fZ, - /*0x074a*/ &_file_Lwax_str_sZ, - /*0x074b*/ &_file_Lwax_str_iZ, - /*0x074c*/ &_file_Pa51grateZ, - /*0x074d*/ &_file_GecmmineZ, - /*0x074e*/ &_file_GcommsuplinkZ, - /*0x074f*/ &_file_GirscannerZ, - /*0x0750*/ &_file_Paf1escapedoorZ, - /*0x0751*/ &_file_PprescapsuleZ, - /*0x0752*/ &_file_PskedarbridgeZ, - /*0x0753*/ &_file_Ppelagicdoor2Z, - /*0x0754*/ &_file_Avault2M, - /*0x0755*/ &_file_Ap29_12_elM, - /*0x0756*/ &_file_Pttb_boxZ, - /*0x0757*/ &_file_PinstfrontdoorZ, - /*0x0758*/ &_file_Ap14_09_joM, - /*0x0759*/ &_file_Ap19_07_joM, - /*0x075a*/ &_file_Ap19_08_joM, - /*0x075b*/ &_file_PchrlaserZ, - /*0x075c*/ &_file_PbaftaZ, - /*0x075d*/ &_file_PchrsonicscrewerZ, - /*0x075e*/ &_file_PchrlumphammerZ, - /*0x075f*/ &_file_PskedarbombZ, - /*0x0760*/ &_file_PexplosivebrickZ, - /*0x0761*/ &_file_PresearchtapeZ, - /*0x0762*/ &_file_PziggycardZ, - /*0x0763*/ &_file_PsafeitemZ, - /*0x0764*/ &_file_Ghand_elvisZ, - /*0x0765*/ &_file_Paf1_tableZ, - /*0x0766*/ &_file_Ghand_a51guardZ, - /*0x0767*/ &_file_Ghand_ddshockZ, - /*0x0768*/ &_file_Ghand_blackguardZ, - /*0x0769*/ &_file_Ghand_ddfodderZ, - /*0x076a*/ &_file_Ghand_ddbioZ, - /*0x076b*/ &_file_Ghand_a51airmanZ, - /*0x076c*/ &_file_Ghand_g5guardZ, - /*0x076d*/ &_file_Ghand_cisoldierZ, - /*0x076e*/ &_file_PsensitiveinfoZ, - /*0x076f*/ &_file_PrussdarZ, - /*0x0770*/ &_file_PxrayspecsZ, - /*0x0771*/ &_file_PchreyespyZ, - /*0x0772*/ &_file_PchrdoordecoderZ, - /*0x0773*/ &_file_PbriefcaseZ, - /*0x0774*/ &_file_PsuitcaseZ, - /*0x0775*/ &_file_PshuttledoorZ, - /*0x0776*/ &_file_PruinbridgeZ, - /*0x0777*/ &_file_PsecretindoorZ, - /*0x0778*/ &_file_PskpuzzleobjectZ, - /*0x0779*/ &_file_Pa51liftdoorZ, - /*0x077a*/ &_file_Acicarr06M, - /*0x077b*/ &_file_Acicarr11M, - /*0x077c*/ &_file_Acifarr08M, - /*0x077d*/ &_file_Acifarr12M, - /*0x077e*/ &_file_Acifema01M, - /*0x077f*/ &_file_Acifema04M, - /*0x0780*/ &_file_Acifema07M, - /*0x0781*/ &_file_Acifema08M, - /*0x0782*/ &_file_Acifema09M, - /*0x0783*/ &_file_Acifema14M, - /*0x0784*/ &_file_Acifost08M, - /*0x0785*/ &_file_Acifost12M, - /*0x0786*/ &_file_Acigrim05M, - /*0x0787*/ &_file_Acigrim06M, - /*0x0788*/ &_file_Acigrim07M, - /*0x0789*/ &_file_Acigrim08M, - /*0x078a*/ &_file_Acigrim09M, - /*0x078b*/ &_file_Acigrim10M, - /*0x078c*/ &_file_Acihopk09M, - /*0x078d*/ &_file_Acihopk11M, - /*0x078e*/ &_file_Acimale02M, - /*0x078f*/ &_file_Acimale03M, - /*0x0790*/ &_file_Acimale07M, - /*0x0791*/ &_file_Acimale09M, - /*0x0792*/ &_file_Acimale11M, - /*0x0793*/ &_file_Acimale13M, - /*0x0794*/ &_file_Aciroge08M, - /*0x0795*/ &_file_Aciroge12M, - /*0x0796*/ &_file_Cdark_negotiatorZ, - /*0x0797*/ &_file_PcihubZ, - /*0x0798*/ &_file_Psk_ship_door2Z, - /*0x0799*/ &_file_Psk_window1Z, - /*0x079a*/ &_file_Psk_hangardoorb_topZ, - /*0x079b*/ &_file_Psk_hangardoorb_botZ, - /*0x079c*/ &_file_Paf1_innerdoorZ, - /*0x079d*/ &_file_Plaser_postZ, - /*0x079e*/ &_file_Atrfost01M, - /*0x079f*/ &_file_Atrfost02M, - /*0x07a0*/ &_file_Atrfost03M, - /*0x07a1*/ &_file_Atrcarr09M, - /*0x07a2*/ &_file_Atrcarr10M, - /*0x07a3*/ &_file_Atrcarr11M, - /*0x07a4*/ &_file_Acifarr01M, - /*0x07a5*/ &_file_Acifarr02M, - /*0x07a6*/ &_file_Acifarr03M, - /*0x07a7*/ &_file_Acigrim01M, - /*0x07a8*/ &_file_Acigrim03M, - /*0x07a9*/ &_file_Acigrim04M, - /*0x07aa*/ &_file_Acihopk01M, - /*0x07ab*/ &_file_Acihopk04M, - /*0x07ac*/ &_file_Acihopk06M, - /*0x07ad*/ &_file_Aciroge01M, - /*0x07ae*/ &_file_Aciroge02M, - /*0x07af*/ &_file_Atrroge01M, - /*0x07b0*/ &_file_Acicarr07M, - /*0x07b1*/ &_file_Acicarr08M, - /*0x07b2*/ &_file_PtargetampZ, - /*0x07b3*/ &_file_Psk_liftZ, - /*0x07b4*/ &_file_PknockknockZ, - /*0x07b5*/ &_file_PcetandoorZ, - /*0x07b6*/ &_file_Ajoinst01M, - /*0x07b7*/ &_file_Ajoinst02M, - /*0x07b8*/ &_file_Ajoinst03M, - /*0x07b9*/ &_file_Ajoinst04M, - /*0x07ba*/ &_file_Ap25_03_joM, - /*0x07bb*/ &_file_Paf1rubbleZ, - /*0x07bc*/ &_file_Pdd_dr_nonrefZ, - /*0x07bd*/ &_file_CheadtimZ, - /*0x07be*/ &_file_CheadgrantZ, - /*0x07bf*/ &_file_CheadpennyZ, - /*0x07c0*/ &_file_CheadrobinZ, - /*0x07c1*/ &_file_CheadalexZ, - /*0x07c2*/ &_file_CheadjulianneZ, - /*0x07c3*/ &_file_CheadlauraZ, - /*0x07c4*/ &_file_CheaddavecZ, - /*0x07c5*/ &_file_CheadkenZ, - /*0x07c6*/ &_file_CheadjoelZ, - /*0x07c7*/ &_file_PcetandoorsideZ, - /*0x07c8*/ &_file_Ap29_13_joM, - /*0x07c9*/ &_file_Ap29_14_joM, - /*0x07ca*/ &_file_Acicarr09M, - /*0x07cb*/ &_file_Acicarr10M, - /*0x07cc*/ &_file_PbuddybridgeZ, - /*0x07cd*/ &_file_CheadcookZ, - /*0x07ce*/ &_file_CheadpryceZ, - /*0x07cf*/ &_file_CheadsilkeZ, - /*0x07d0*/ &_file_CheadsmithZ, - /*0x07d1*/ &_file_CheadgarethZ, - /*0x07d2*/ &_file_CheadmurchieZ, - /*0x07d3*/ &_file_CheadwongZ, - /*0x07d4*/ &_file_CheadcarterZ, - /*0x07d5*/ &_file_CheadtintinZ, - /*0x07d6*/ &_file_CheadmuntonZ, - /*0x07d7*/ &_file_CheadstamperZ, - /*0x07d8*/ &_file_CheadjonesZ, - /*0x07d9*/ &_file_CheadphelpsZ, - /*0x07da*/ &_file_Ap29_15_joM, - /*0x07db*/ &_file_Ap16_03_joM, - /*0x07dc*/ &_file_Acarrbye02M, +u32 g_FileTable[] = { + /*0x0000*/ 0, + /*0x0001*/ (u32) &_file_bg_sev_seg, + /*0x0002*/ (u32) &_file_bg_silo_seg, + /*0x0003*/ (u32) &_file_bg_stat_seg, + /*0x0004*/ (u32) &_file_bg_arec_seg, + /*0x0005*/ (u32) &_file_bg_arch_seg, + /*0x0006*/ (u32) &_file_bg_tra_seg, + /*0x0007*/ (u32) &_file_bg_dest_seg, + /*0x0008*/ (u32) &_file_bg_sevb_seg, + /*0x0009*/ (u32) &_file_bg_azt_seg, + /*0x000a*/ (u32) &_file_bg_pete_seg, + /*0x000b*/ (u32) &_file_bg_depo_seg, + /*0x000c*/ (u32) &_file_bg_ref_seg, + /*0x000d*/ (u32) &_file_bg_cryp_seg, + /*0x000e*/ (u32) &_file_bg_dam_seg, + /*0x000f*/ (u32) &_file_bg_ark_seg, + /*0x0010*/ (u32) &_file_bg_run_seg, + /*0x0011*/ (u32) &_file_bg_sevx_seg, + /*0x0012*/ (u32) &_file_bg_jun_seg, + /*0x0013*/ (u32) &_file_bg_dish_seg, + /*0x0014*/ (u32) &_file_bg_cave_seg, + /*0x0015*/ (u32) &_file_bg_cat_seg, + /*0x0016*/ (u32) &_file_bg_crad_seg, + /*0x0017*/ (u32) &_file_bg_sho_seg, + /*0x0018*/ (u32) &_file_bg_eld_seg, + /*0x0019*/ (u32) &_file_bg_imp_seg, + /*0x001a*/ (u32) &_file_bg_ash_seg, + /*0x001b*/ (u32) &_file_bg_lue_seg, + /*0x001c*/ (u32) &_file_bg_ame_seg, + /*0x001d*/ (u32) &_file_bg_rit_seg, + /*0x001e*/ (u32) &_file_bg_oat_seg, + /*0x001f*/ (u32) &_file_bg_ear_seg, + /*0x0020*/ (u32) &_file_bg_lee_seg, + /*0x0021*/ (u32) &_file_bg_lip_seg, + /*0x0022*/ (u32) &_file_bg_len_seg, + /*0x0023*/ (u32) &_file_bg_wax_seg, + /*0x0024*/ (u32) &_file_bg_pam_seg, + /*0x0025*/ (u32) &_file_bg_uff_seg, + /*0x0026*/ (u32) &_file_bg_old_seg, + /*0x0027*/ (u32) &_file_bg_ate_seg, + /*0x0028*/ (u32) &_file_bg_lam_seg, + /*0x0029*/ (u32) &_file_bg_mp1_seg, + /*0x002a*/ (u32) &_file_bg_mp2_seg, + /*0x002b*/ (u32) &_file_bg_mp3_seg, + /*0x002c*/ (u32) &_file_bg_mp4_seg, + /*0x002d*/ (u32) &_file_bg_mp5_seg, + /*0x002e*/ (u32) &_file_bg_mp6_seg, + /*0x002f*/ (u32) &_file_bg_mp7_seg, + /*0x0030*/ (u32) &_file_bg_mp8_seg, + /*0x0031*/ (u32) &_file_bg_mp9_seg, + /*0x0032*/ (u32) &_file_bg_mp10_seg, + /*0x0033*/ (u32) &_file_bg_mp11_seg, + /*0x0034*/ (u32) &_file_bg_mp12_seg, + /*0x0035*/ (u32) &_file_bg_mp13_seg, + /*0x0036*/ (u32) &_file_bg_mp14_seg, + /*0x0037*/ (u32) &_file_bg_mp15_seg, + /*0x0038*/ (u32) &_file_bg_mp16_seg, + /*0x0039*/ (u32) &_file_bg_mp17_seg, + /*0x003a*/ (u32) &_file_bg_mp18_seg, + /*0x003b*/ (u32) &_file_bg_mp19_seg, + /*0x003c*/ (u32) &_file_bg_mp20_seg, + /*0x003d*/ (u32) &_file_ob_mid_seg, + /*0x003e*/ (u32) &_file_Ca51guardZ, + /*0x003f*/ (u32) &_file_Carea51guardZ, + /*0x0040*/ (u32) &_file_CcarringtonZ, + /*0x0041*/ (u32) &_file_CcassandraZ, + /*0x0042*/ (u32) &_file_Cdark_combatZ, + /*0x0043*/ (u32) &_file_Cdark_frockZ, + /*0x0044*/ (u32) &_file_Cdark_trenchZ, + /*0x0045*/ (u32) &_file_CddshockZ, + /*0x0046*/ (u32) &_file_Cdd_secguardZ, + /*0x0047*/ (u32) &_file_CdjbondZ, + /*0x0048*/ (u32) &_file_CdrcarrollZ, + /*0x0049*/ (u32) &_file_CelvisZ, + /*0x004a*/ (u32) &_file_Celvis1Z, + /*0x004b*/ (u32) &_file_CeyespyZ, + /*0x004c*/ (u32) &_file_Cfem_guardZ, + /*0x004d*/ (u32) &_file_ClabtechZ, + /*0x004e*/ (u32) &_file_CmrblondeZ, + /*0x004f*/ (u32) &_file_CofficeworkerZ, + /*0x0050*/ (u32) &_file_Cofficeworker2Z, + /*0x0051*/ (u32) &_file_CoverallZ, + /*0x0052*/ (u32) &_file_CsecretaryZ, + /*0x0053*/ (u32) &_file_CskedarZ, + /*0x0054*/ (u32) &_file_CstripesZ, + /*0x0055*/ (u32) &_file_CtestchrZ, + /*0x0056*/ (u32) &_file_CthekingZ, + /*0x0057*/ (u32) &_file_CtrentZ, + /*0x0058*/ (u32) &_file_GcartblueZ, + /*0x0059*/ (u32) &_file_GcartridgeZ, + /*0x005a*/ (u32) &_file_GcartrifleZ, + /*0x005b*/ (u32) &_file_GcartshellZ, + /*0x005c*/ (u32) &_file_GjoypadZ, + /*0x005d*/ (u32) &_file_Pa51_crate1Z, + /*0x005e*/ (u32) &_file_Pa51_crate2Z, + /*0x005f*/ (u32) &_file_Pa51_crate3Z, + /*0x0060*/ (u32) &_file_Pa51_exp1Z, + /*0x0061*/ (u32) &_file_Pa51_exp2Z, + /*0x0062*/ (u32) &_file_Pa51_horiz_door_botZ, + /*0x0063*/ (u32) &_file_Pa51_horiz_door_glZ, + /*0x0064*/ (u32) &_file_Pa51_horiz_door_secretZ, + /*0x0065*/ (u32) &_file_Pa51_horiz_door_topZ, + /*0x0066*/ (u32) &_file_Pa51_lift_controlZ, + /*0x0067*/ (u32) &_file_Pa51_lift_hangarZ, + /*0x0068*/ (u32) &_file_Pa51_lift_storeZ, + /*0x0069*/ (u32) &_file_Pa51_lift_thinwallZ, + /*0x006a*/ (u32) &_file_Pa51_unexp1Z, + /*0x006b*/ (u32) &_file_Pa51_unexp2Z, + /*0x006c*/ (u32) &_file_Pa51_unexp3Z, + /*0x006d*/ (u32) &_file_Pa51_vert_door_leftZ, + /*0x006e*/ (u32) &_file_Pa51_vert_door_rightZ, + /*0x006f*/ (u32) &_file_Pa51_vert_door_stZ, + /*0x0070*/ (u32) &_file_Pa51boardZ, + /*0x0071*/ (u32) &_file_Pa51chairZ, + /*0x0072*/ (u32) &_file_Pa51deskentZ, + /*0x0073*/ (u32) &_file_Pa51divideZ, + /*0x0074*/ (u32) &_file_Pa51screenZ, + /*0x0075*/ (u32) &_file_Pa51tableZ, + /*0x0076*/ (u32) &_file_Pa51trolleyZ, + /*0x0077*/ (u32) &_file_Pa51wastebinZ, + /*0x0078*/ (u32) &_file_Paivillabot1Z, + /*0x0079*/ (u32) &_file_Paivillabot2Z, + /*0x007a*/ (u32) &_file_Paivillabot3Z, + /*0x007b*/ (u32) &_file_Paivilladoor1Z, + /*0x007c*/ (u32) &_file_Paivilladoor2aZ, + /*0x007d*/ (u32) &_file_Paivilladoor4Z, + /*0x007e*/ (u32) &_file_PaivillawindmillZ, + /*0x007f*/ (u32) &_file_Pal_airlockZ, + /*0x0080*/ (u32) &_file_Pal_dockliftZ, + /*0x0081*/ (u32) &_file_Paldoor_lZ, + /*0x0082*/ (u32) &_file_Paldoor_rZ, + /*0x0083*/ (u32) &_file_Pborg_crateZ, + /*0x0084*/ (u32) &_file_PcaseZ, + /*0x0085*/ (u32) &_file_Pch_shutter1Z, + /*0x0086*/ (u32) &_file_PchrbriefcaseZ, + /*0x0087*/ (u32) &_file_PchrbugZ, + /*0x0088*/ (u32) &_file_PchrdatathiefZ, + /*0x0089*/ (u32) &_file_Pcryptdoor1bZ, + /*0x008a*/ (u32) &_file_Pdd_ac_expZ, + /*0x008b*/ (u32) &_file_Pdd_ac_unexpZ, + /*0x008c*/ (u32) &_file_Pdd_acbot_expZ, + /*0x008d*/ (u32) &_file_Pdd_acbot_unexpZ, + /*0x008e*/ (u32) &_file_Pdd_bannerZ, + /*0x008f*/ (u32) &_file_Pdd_chairZ, + /*0x0090*/ (u32) &_file_Pdd_decodoorZ, + /*0x0091*/ (u32) &_file_Pdd_deskZ, + /*0x0092*/ (u32) &_file_Pdd_fanroofZ, + /*0x0093*/ (u32) &_file_Pdd_fanwallZ, + /*0x0094*/ (u32) &_file_Pdd_hovcabZ, + /*0x0095*/ (u32) &_file_Pdd_hovcarZ, + /*0x0096*/ (u32) &_file_Pdd_hovcopZ, + /*0x0097*/ (u32) &_file_Pdd_hovercopterZ, + /*0x0098*/ (u32) &_file_Pdd_hovmotoZ, + /*0x0099*/ (u32) &_file_Pdd_hovtruckZ, + /*0x009a*/ (u32) &_file_Pdd_lab_cautionZ, + /*0x009b*/ (u32) &_file_Pdd_lab_cautiontopZ, + /*0x009c*/ (u32) &_file_Pdd_lab_door_bsZ, + /*0x009d*/ (u32) &_file_Pdd_lab_door_secZ, + /*0x009e*/ (u32) &_file_Pdd_lab_door_windZ, + /*0x009f*/ (u32) &_file_Pdd_lab_hazardZ, + /*0x00a0*/ (u32) &_file_Pdd_lab_restrictedZ, + /*0x00a1*/ (u32) &_file_Pdd_lab_sector2botZ, + /*0x00a2*/ (u32) &_file_Pdd_lab_sector2topZ, + /*0x00a3*/ (u32) &_file_Pdd_lab_sector3Z, + /*0x00a4*/ (u32) &_file_Pdd_lab_sector3topZ, + /*0x00a5*/ (u32) &_file_Pdd_lab_sector3windZ, + /*0x00a6*/ (u32) &_file_Pdd_lab_sector4topZ, + /*0x00a7*/ (u32) &_file_Pdd_liftdoorZ, + /*0x00a8*/ (u32) &_file_Pdd_liftrZ, + /*0x00a9*/ (u32) &_file_Pdd_officedoorZ, + /*0x00aa*/ (u32) &_file_Pdd_plantrubberZ, + /*0x00ab*/ (u32) &_file_Pdd_plantspiderZ, + /*0x00ac*/ (u32) &_file_Pdd_plantspikeZ, + /*0x00ad*/ (u32) &_file_Pdd_redarmZ, + /*0x00ae*/ (u32) &_file_Pdd_redsofaZ, + /*0x00af*/ (u32) &_file_Pdd_secretdoorZ, + /*0x00b0*/ (u32) &_file_Pdd_secretdoor2Z, + /*0x00b1*/ (u32) &_file_Pdd_servicedoorZ, + /*0x00b2*/ (u32) &_file_Pdd_stonedeskZ, + /*0x00b3*/ (u32) &_file_Pdd_vertblindZ, + /*0x00b4*/ (u32) &_file_Pdd_winddoorZ, + /*0x00b5*/ (u32) &_file_Pdd_windowZ, + /*0x00b6*/ (u32) &_file_PddjumpshipZ, + /*0x00b7*/ (u32) &_file_Pdoor1a_G5Z, + /*0x00b8*/ (u32) &_file_Pdoor1atri_G5Z, + /*0x00b9*/ (u32) &_file_Pdoor1b_G5Z, + /*0x00ba*/ (u32) &_file_Pdoor2_G5Z, + /*0x00bb*/ (u32) &_file_Pdoor2a_G5Z, + /*0x00bc*/ (u32) &_file_Pdoor4a_G5Z, + /*0x00bd*/ (u32) &_file_Pdoor4b_G5Z, + /*0x00be*/ (u32) &_file_Pdoor_rollertrainZ, + /*0x00bf*/ (u32) &_file_PdoorconsoleZ, + /*0x00c0*/ (u32) &_file_Pdr_caroll_doorZ, + /*0x00c1*/ (u32) &_file_Pdr_caroll_door_baseZ, + /*0x00c2*/ (u32) &_file_Pdr_caroll_door_bleftZ, + /*0x00c3*/ (u32) &_file_Pdr_caroll_door_bmainZ, + /*0x00c4*/ (u32) &_file_Pdr_caroll_door_brightZ, + /*0x00c5*/ (u32) &_file_Pdr_caroll_door_leftZ, + /*0x00c6*/ (u32) &_file_Pdr_caroll_door_mainZ, + /*0x00c7*/ (u32) &_file_Pdr_caroll_door_rightZ, + /*0x00c8*/ (u32) &_file_PdropshipZ, + /*0x00c9*/ (u32) &_file_PdumpsterZ, + /*0x00ca*/ (u32) &_file_PexplosionbitZ, + /*0x00cb*/ (u32) &_file_PflagZ, + /*0x00cc*/ (u32) &_file_Pg5_escdoordownZ, + /*0x00cd*/ (u32) &_file_Pg5_escdoordownboomZ, + /*0x00ce*/ (u32) &_file_Pg5_escdoorupZ, + /*0x00cf*/ (u32) &_file_Pg5_escdoorupboomZ, + /*0x00d0*/ (u32) &_file_Pg5_mainframeZ, + /*0x00d1*/ (u32) &_file_Pg5safedoorZ, + /*0x00d2*/ (u32) &_file_Pg5carliftdoorZ, + /*0x00d3*/ (u32) &_file_PgoldeneyelogoZ, + /*0x00d4*/ (u32) &_file_PhooverbotZ, + /*0x00d5*/ (u32) &_file_PhovbikeZ, + /*0x00d6*/ (u32) &_file_PhoverbedZ, + /*0x00d7*/ (u32) &_file_Phovercrate1Z, + /*0x00d8*/ (u32) &_file_PlasdoorZ, + /*0x00d9*/ (u32) &_file_PmarkerZ, + /*0x00da*/ (u32) &_file_Pmedlabwin1Z, + /*0x00db*/ (u32) &_file_Pmedlabwin2Z, + /*0x00dc*/ (u32) &_file_PmodemboxZ, + /*0x00dd*/ (u32) &_file_PnintendologoZ, + /*0x00de*/ (u32) &_file_Pnlogo2Z, + /*0x00df*/ (u32) &_file_Pnlogo3Z, + /*0x00e0*/ (u32) &_file_PnlogoZ, + /*0x00e1*/ (u32) &_file_Ppc1Z, + /*0x00e2*/ (u32) &_file_PpdfourZ, + /*0x00e3*/ (u32) &_file_PpdoneZ, + /*0x00e4*/ (u32) &_file_PpdthreeZ, + /*0x00e5*/ (u32) &_file_PpdtwoZ, + /*0x00e6*/ (u32) &_file_PperfectdarkZ, + /*0x00e7*/ (u32) &_file_PpolicecarZ, + /*0x00e8*/ (u32) &_file_PravineliftZ, + /*0x00e9*/ (u32) &_file_PropeZ, + /*0x00ea*/ (u32) &_file_Psk_cryopod1_botZ, + /*0x00eb*/ (u32) &_file_Psk_cryopod1_topZ, + /*0x00ec*/ (u32) &_file_Psk_door1Z, + /*0x00ed*/ (u32) &_file_Psk_fighter1Z, + /*0x00ee*/ (u32) &_file_Psk_hangardoor_botZ, + /*0x00ef*/ (u32) &_file_Psk_hangardoor_topZ, + /*0x00f0*/ (u32) &_file_Psk_ship_door1Z, + /*0x00f1*/ (u32) &_file_Psk_ship_holo1Z, + /*0x00f2*/ (u32) &_file_Psk_ship_holo2Z, + /*0x00f3*/ (u32) &_file_Psk_ship_hulldoor1Z, + /*0x00f4*/ (u32) &_file_Psk_ship_hulldoor2Z, + /*0x00f5*/ (u32) &_file_Psk_ship_hulldoor3Z, + /*0x00f6*/ (u32) &_file_Psk_ship_hulldoor4Z, + /*0x00f7*/ (u32) &_file_Psk_under_generatorZ, + /*0x00f8*/ (u32) &_file_Psk_under_transZ, + /*0x00f9*/ (u32) &_file_Pskcrev_exp1Z, + /*0x00fa*/ (u32) &_file_Pskcrev_unexp1Z, + /*0x00fb*/ (u32) &_file_Psktnl_exp1Z, + /*0x00fc*/ (u32) &_file_Psktnl_unexp1Z, + /*0x00fd*/ (u32) &_file_PtaxicabZ, + /*0x00fe*/ (u32) &_file_PtesterbotZ, + /*0x00ff*/ (u32) &_file_PtestobjZ, + /*0x0100*/ (u32) &_file_PtvscreenZ, + /*0x0101*/ (u32) &_file_PwindowZ, + /*0x0102*/ (u32) &_file_Ump_setupameZ, + /*0x0103*/ (u32) &_file_Ump_setuparchZ, + /*0x0104*/ (u32) &_file_Ump_setuparecZ, + /*0x0105*/ (u32) &_file_Ump_setuparkZ, + /*0x0106*/ (u32) &_file_Ump_setupashZ, + /*0x0107*/ (u32) &_file_Ump_setupaztZ, + /*0x0108*/ (u32) &_file_Ump_setupcatZ, + /*0x0109*/ (u32) &_file_Ump_setupcaveZ, + /*0x010a*/ (u32) &_file_Ump_setupcradZ, + /*0x010b*/ (u32) &_file_Ump_setupcrypZ, + /*0x010c*/ (u32) &_file_Ump_setupdamZ, + /*0x010d*/ (u32) &_file_Ump_setupdepoZ, + /*0x010e*/ (u32) &_file_Ump_setupdestZ, + /*0x010f*/ (u32) &_file_Ump_setupdishZ, + /*0x0110*/ (u32) &_file_Ump_setupearZ, + /*0x0111*/ (u32) &_file_Ump_setupeldZ, + /*0x0112*/ (u32) &_file_Ump_setupimpZ, + /*0x0113*/ (u32) &_file_Ump_setupjunZ, + /*0x0114*/ (u32) &_file_Ump_setupleeZ, + /*0x0115*/ (u32) &_file_Ump_setuplenZ, + /*0x0116*/ (u32) &_file_Ump_setuplipZ, + /*0x0117*/ (u32) &_file_Ump_setuplueZ, + /*0x0118*/ (u32) &_file_Ump_setupoatZ, + /*0x0119*/ (u32) &_file_Ump_setuppamZ, + /*0x011a*/ (u32) &_file_Ump_setuppeteZ, + /*0x011b*/ (u32) &_file_Ump_setuprefZ, + /*0x011c*/ (u32) &_file_Ump_setupritZ, + /*0x011d*/ (u32) &_file_Ump_setuprunZ, + /*0x011e*/ (u32) &_file_Ump_setupsevZ, + /*0x011f*/ (u32) &_file_Ump_setupsevbZ, + /*0x0120*/ (u32) &_file_Ump_setupsevxZ, + /*0x0121*/ (u32) &_file_Ump_setupshoZ, + /*0x0122*/ (u32) &_file_Ump_setupsiloZ, + /*0x0123*/ (u32) &_file_Ump_setupstatZ, + /*0x0124*/ (u32) &_file_Ump_setuptraZ, + /*0x0125*/ (u32) &_file_Ump_setupwaxZ, + /*0x0126*/ (u32) &_file_UsetupameZ, + /*0x0127*/ (u32) &_file_UsetuparchZ, + /*0x0128*/ (u32) &_file_UsetuparecZ, + /*0x0129*/ (u32) &_file_UsetuparkZ, + /*0x012a*/ (u32) &_file_UsetupashZ, + /*0x012b*/ (u32) &_file_UsetupaztZ, + /*0x012c*/ (u32) &_file_UsetupcatZ, + /*0x012d*/ (u32) &_file_UsetupcaveZ, + /*0x012e*/ (u32) &_file_UsetupcradZ, + /*0x012f*/ (u32) &_file_UsetupcrypZ, + /*0x0130*/ (u32) &_file_UsetupdamZ, + /*0x0131*/ (u32) &_file_UsetupdepoZ, + /*0x0132*/ (u32) &_file_UsetupdestZ, + /*0x0133*/ (u32) &_file_UsetupdishZ, + /*0x0134*/ (u32) &_file_UsetupearZ, + /*0x0135*/ (u32) &_file_UsetupeldZ, + /*0x0136*/ (u32) &_file_UsetupimpZ, + /*0x0137*/ (u32) &_file_UsetupjunZ, + /*0x0138*/ (u32) &_file_UsetupleeZ, + /*0x0139*/ (u32) &_file_UsetuplenZ, + /*0x013a*/ (u32) &_file_UsetuplipZ, + /*0x013b*/ (u32) &_file_UsetuplueZ, + /*0x013c*/ (u32) &_file_UsetupoatZ, + /*0x013d*/ (u32) &_file_UsetuppamZ, + /*0x013e*/ (u32) &_file_UsetuppeteZ, + /*0x013f*/ (u32) &_file_UsetuprefZ, + /*0x0140*/ (u32) &_file_UsetupritZ, + /*0x0141*/ (u32) &_file_UsetuprunZ, + /*0x0142*/ (u32) &_file_UsetupsevZ, + /*0x0143*/ (u32) &_file_UsetupsevbZ, + /*0x0144*/ (u32) &_file_UsetupsevxZ, + /*0x0145*/ (u32) &_file_UsetupsevxbZ, + /*0x0146*/ (u32) &_file_UsetupshoZ, + /*0x0147*/ (u32) &_file_UsetupsiloZ, + /*0x0148*/ (u32) &_file_UsetupstatZ, + /*0x0149*/ (u32) &_file_UsetuptraZ, + /*0x014a*/ (u32) &_file_UsetupwaxZ, + /*0x014b*/ (u32) &_file_bg_ame_padsZ, + /*0x014c*/ (u32) &_file_bg_ame_tilesZ, + /*0x014d*/ (u32) &_file_bg_arch_padsZ, + /*0x014e*/ (u32) &_file_bg_arch_tilesZ, + /*0x014f*/ (u32) &_file_bg_arec_padsZ, + /*0x0150*/ (u32) &_file_bg_arec_tilesZ, + /*0x0151*/ (u32) &_file_bg_ark_padsZ, + /*0x0152*/ (u32) &_file_bg_ark_tilesZ, + /*0x0153*/ (u32) &_file_bg_ash_padsZ, + /*0x0154*/ (u32) &_file_bg_ash_tilesZ, + /*0x0155*/ (u32) &_file_bg_azt_padsZ, + /*0x0156*/ (u32) &_file_bg_azt_tilesZ, + /*0x0157*/ (u32) &_file_bg_cat_padsZ, + /*0x0158*/ (u32) &_file_bg_cat_tilesZ, + /*0x0159*/ (u32) &_file_bg_cave_padsZ, + /*0x015a*/ (u32) &_file_bg_cave_tilesZ, + /*0x015b*/ (u32) &_file_bg_crad_padsZ, + /*0x015c*/ (u32) &_file_bg_crad_tilesZ, + /*0x015d*/ (u32) &_file_bg_cryp_padsZ, + /*0x015e*/ (u32) &_file_bg_cryp_tilesZ, + /*0x015f*/ (u32) &_file_bg_dam_padsZ, + /*0x0160*/ (u32) &_file_bg_dam_tilesZ, + /*0x0161*/ (u32) &_file_bg_depo_padsZ, + /*0x0162*/ (u32) &_file_bg_depo_tilesZ, + /*0x0163*/ (u32) &_file_bg_dest_padsZ, + /*0x0164*/ (u32) &_file_bg_dest_tilesZ, + /*0x0165*/ (u32) &_file_bg_dish_padsZ, + /*0x0166*/ (u32) &_file_bg_dish_tilesZ, + /*0x0167*/ (u32) &_file_bg_ear_padsZ, + /*0x0168*/ (u32) &_file_bg_ear_tilesZ, + /*0x0169*/ (u32) &_file_bg_eld_padsZ, + /*0x016a*/ (u32) &_file_bg_eld_tilesZ, + /*0x016b*/ (u32) &_file_bg_imp_padsZ, + /*0x016c*/ (u32) &_file_bg_imp_tilesZ, + /*0x016d*/ (u32) &_file_bg_jun_padsZ, + /*0x016e*/ (u32) &_file_bg_jun_tilesZ, + /*0x016f*/ (u32) &_file_bg_lee_padsZ, + /*0x0170*/ (u32) &_file_bg_lee_tilesZ, + /*0x0171*/ (u32) &_file_bg_len_padsZ, + /*0x0172*/ (u32) &_file_bg_len_tilesZ, + /*0x0173*/ (u32) &_file_bg_lip_padsZ, + /*0x0174*/ (u32) &_file_bg_lip_tilesZ, + /*0x0175*/ (u32) &_file_bg_lue_padsZ, + /*0x0176*/ (u32) &_file_bg_lue_tilesZ, + /*0x0177*/ (u32) &_file_bg_oat_padsZ, + /*0x0178*/ (u32) &_file_bg_oat_tilesZ, + /*0x0179*/ (u32) &_file_bg_pam_padsZ, + /*0x017a*/ (u32) &_file_bg_pam_tilesZ, + /*0x017b*/ (u32) &_file_bg_pete_padsZ, + /*0x017c*/ (u32) &_file_bg_pete_tilesZ, + /*0x017d*/ (u32) &_file_bg_ref_padsZ, + /*0x017e*/ (u32) &_file_bg_ref_tilesZ, + /*0x017f*/ (u32) &_file_bg_rit_padsZ, + /*0x0180*/ (u32) &_file_bg_rit_tilesZ, + /*0x0181*/ (u32) &_file_bg_run_padsZ, + /*0x0182*/ (u32) &_file_bg_run_tilesZ, + /*0x0183*/ (u32) &_file_bg_sev_padsZ, + /*0x0184*/ (u32) &_file_bg_sev_tilesZ, + /*0x0185*/ (u32) &_file_bg_sevb_padsZ, + /*0x0186*/ (u32) &_file_bg_sevb_tilesZ, + /*0x0187*/ (u32) &_file_bg_sevx_padsZ, + /*0x0188*/ (u32) &_file_bg_sevx_tilesZ, + /*0x0189*/ (u32) &_file_bg_sho_padsZ, + /*0x018a*/ (u32) &_file_bg_sho_tilesZ, + /*0x018b*/ (u32) &_file_bg_silo_padsZ, + /*0x018c*/ (u32) &_file_bg_silo_tilesZ, + /*0x018d*/ (u32) &_file_bg_stat_padsZ, + /*0x018e*/ (u32) &_file_bg_stat_tilesZ, + /*0x018f*/ (u32) &_file_bg_tra_padsZ, + /*0x0190*/ (u32) &_file_bg_tra_tilesZ, + /*0x0191*/ (u32) &_file_bg_wax_padsZ, + /*0x0192*/ (u32) &_file_bg_wax_tilesZ, + /*0x0193*/ (u32) &_file_GtestgunZ, + /*0x0194*/ (u32) &_file_Cdd_labtechZ, + /*0x0195*/ (u32) &_file_Pcctv_pdZ, + /*0x0196*/ (u32) &_file_PcomhubZ, + /*0x0197*/ (u32) &_file_PquadpodZ, + /*0x0198*/ (u32) &_file_Ppd_consoleZ, + /*0x0199*/ (u32) &_file_CconneryZ, + /*0x019a*/ (u32) &_file_CmooreZ, + /*0x019b*/ (u32) &_file_CdaltonZ, + /*0x019c*/ (u32) &_file_Cheaddark_combatZ, + /*0x019d*/ (u32) &_file_CheadelvisZ, + /*0x019e*/ (u32) &_file_CheadrossZ, + /*0x019f*/ (u32) &_file_CheadcarringtonZ, + /*0x01a0*/ (u32) &_file_CheadmrblondeZ, + /*0x01a1*/ (u32) &_file_CheadtrentZ, + /*0x01a2*/ (u32) &_file_CheadddshockZ, + /*0x01a3*/ (u32) &_file_CheadgrahamZ, + /*0x01a4*/ (u32) &_file_Cheaddark_frockZ, + /*0x01a5*/ (u32) &_file_CheadsecretaryZ, + /*0x01a6*/ (u32) &_file_CheadcassandraZ, + /*0x01a7*/ (u32) &_file_CheadthekingZ, + /*0x01a8*/ (u32) &_file_Cheadfem_guardZ, + /*0x01a9*/ (u32) &_file_CheadjonZ, + /*0x01aa*/ (u32) &_file_Plift_platformZ, + /*0x01ab*/ (u32) &_file_Pdd_grateZ, + /*0x01ac*/ (u32) &_file_PlightswitchZ, + /*0x01ad*/ (u32) &_file_PblastshieldZ, + /*0x01ae*/ (u32) &_file_Plightswitch2Z, + /*0x01af*/ (u32) &_file_Pdd_accessdoorupZ, + /*0x01b0*/ (u32) &_file_Pdd_accessdoordnZ, + /*0x01b1*/ (u32) &_file_Cdark_rippedZ, + /*0x01b2*/ (u32) &_file_Cheadmark2Z, + /*0x01b3*/ (u32) &_file_CheadchristZ, + /*0x01b4*/ (u32) &_file_Plab_containerZ, + /*0x01b5*/ (u32) &_file_Plab_chairZ, + /*0x01b6*/ (u32) &_file_Plab_tableZ, + /*0x01b7*/ (u32) &_file_Plab_microscopeZ, + /*0x01b8*/ (u32) &_file_Plab_mainframeZ, + /*0x01b9*/ (u32) &_file_Pdd_labdoorZ, + /*0x01ba*/ (u32) &_file_Pdd_lab_doortopZ, + /*0x01bb*/ (u32) &_file_Pmulti_ammo_crateZ, + /*0x01bc*/ (u32) &_file_CheadrussZ, + /*0x01bd*/ (u32) &_file_CheadgreyZ, + /*0x01be*/ (u32) &_file_CheaddarlingZ, + /*0x01bf*/ (u32) &_file_Cdd_guardZ, + /*0x01c0*/ (u32) &_file_CheadrobertZ, + /*0x01c1*/ (u32) &_file_Cdd_shockZ, + /*0x01c2*/ (u32) &_file_CheadbeauZ, + /*0x01c3*/ (u32) &_file_PchrchainZ, + /*0x01c4*/ (u32) &_file_Cdd_shock_infZ, + /*0x01c5*/ (u32) &_file_Cheadfem_guard2Z, + /*0x01c6*/ (u32) &_file_ProofgunZ, + /*0x01c7*/ (u32) &_file_PtdoorZ, + /*0x01c8*/ (u32) &_file_CbiotechZ, + /*0x01c9*/ (u32) &_file_CfbiguyZ, + /*0x01ca*/ (u32) &_file_PgroundgunZ, + /*0x01cb*/ (u32) &_file_CciaguyZ, + /*0x01cc*/ (u32) &_file_Ca51trooperZ, + /*0x01cd*/ (u32) &_file_CheadbrianZ, + /*0x01ce*/ (u32) &_file_CheadjamieZ, + /*0x01cf*/ (u32) &_file_Cheadduncan2Z, + /*0x01d0*/ (u32) &_file_CheadbiotechZ, + /*0x01d1*/ (u32) &_file_UsetupuffZ, + /*0x01d2*/ (u32) &_file_Ump_setupuffZ, + /*0x01d3*/ (u32) &_file_bg_uff_padsZ, + /*0x01d4*/ (u32) &_file_bg_uff_tilesZ, + /*0x01d5*/ (u32) &_file_UsetupoldZ, + /*0x01d6*/ (u32) &_file_Ump_setupoldZ, + /*0x01d7*/ (u32) &_file_bg_old_padsZ, + /*0x01d8*/ (u32) &_file_bg_old_tilesZ, + /*0x01d9*/ (u32) &_file_UsetupateZ, + /*0x01da*/ (u32) &_file_Ump_setupateZ, + /*0x01db*/ (u32) &_file_bg_ate_padsZ, + /*0x01dc*/ (u32) &_file_bg_ate_tilesZ, + /*0x01dd*/ (u32) &_file_UsetuplamZ, + /*0x01de*/ (u32) &_file_Ump_setuplamZ, + /*0x01df*/ (u32) &_file_bg_lam_padsZ, + /*0x01e0*/ (u32) &_file_bg_lam_tilesZ, + /*0x01e1*/ (u32) &_file_Usetupmp1Z, + /*0x01e2*/ (u32) &_file_Ump_setupmp1Z, + /*0x01e3*/ (u32) &_file_bg_mp1_padsZ, + /*0x01e4*/ (u32) &_file_bg_mp1_tilesZ, + /*0x01e5*/ (u32) &_file_Usetupmp2Z, + /*0x01e6*/ (u32) &_file_Ump_setupmp2Z, + /*0x01e7*/ (u32) &_file_bg_mp2_padsZ, + /*0x01e8*/ (u32) &_file_bg_mp2_tilesZ, + /*0x01e9*/ (u32) &_file_Usetupmp3Z, + /*0x01ea*/ (u32) &_file_Ump_setupmp3Z, + /*0x01eb*/ (u32) &_file_bg_mp3_padsZ, + /*0x01ec*/ (u32) &_file_bg_mp3_tilesZ, + /*0x01ed*/ (u32) &_file_Usetupmp4Z, + /*0x01ee*/ (u32) &_file_Ump_setupmp4Z, + /*0x01ef*/ (u32) &_file_bg_mp4_padsZ, + /*0x01f0*/ (u32) &_file_bg_mp4_tilesZ, + /*0x01f1*/ (u32) &_file_Usetupmp5Z, + /*0x01f2*/ (u32) &_file_Ump_setupmp5Z, + /*0x01f3*/ (u32) &_file_bg_mp5_padsZ, + /*0x01f4*/ (u32) &_file_bg_mp5_tilesZ, + /*0x01f5*/ (u32) &_file_Usetupmp6Z, + /*0x01f6*/ (u32) &_file_Ump_setupmp6Z, + /*0x01f7*/ (u32) &_file_bg_mp6_padsZ, + /*0x01f8*/ (u32) &_file_bg_mp6_tilesZ, + /*0x01f9*/ (u32) &_file_Usetupmp7Z, + /*0x01fa*/ (u32) &_file_Ump_setupmp7Z, + /*0x01fb*/ (u32) &_file_bg_mp7_padsZ, + /*0x01fc*/ (u32) &_file_bg_mp7_tilesZ, + /*0x01fd*/ (u32) &_file_Usetupmp8Z, + /*0x01fe*/ (u32) &_file_Ump_setupmp8Z, + /*0x01ff*/ (u32) &_file_bg_mp8_padsZ, + /*0x0200*/ (u32) &_file_bg_mp8_tilesZ, + /*0x0201*/ (u32) &_file_Usetupmp9Z, + /*0x0202*/ (u32) &_file_Ump_setupmp9Z, + /*0x0203*/ (u32) &_file_bg_mp9_padsZ, + /*0x0204*/ (u32) &_file_bg_mp9_tilesZ, + /*0x0205*/ (u32) &_file_Usetupmp10Z, + /*0x0206*/ (u32) &_file_Ump_setupmp10Z, + /*0x0207*/ (u32) &_file_bg_mp10_padsZ, + /*0x0208*/ (u32) &_file_bg_mp10_tilesZ, + /*0x0209*/ (u32) &_file_Usetupmp11Z, + /*0x020a*/ (u32) &_file_Ump_setupmp11Z, + /*0x020b*/ (u32) &_file_bg_mp11_padsZ, + /*0x020c*/ (u32) &_file_bg_mp11_tilesZ, + /*0x020d*/ (u32) &_file_Usetupmp12Z, + /*0x020e*/ (u32) &_file_Ump_setupmp12Z, + /*0x020f*/ (u32) &_file_bg_mp12_padsZ, + /*0x0210*/ (u32) &_file_bg_mp12_tilesZ, + /*0x0211*/ (u32) &_file_Usetupmp13Z, + /*0x0212*/ (u32) &_file_Ump_setupmp13Z, + /*0x0213*/ (u32) &_file_bg_mp13_padsZ, + /*0x0214*/ (u32) &_file_bg_mp13_tilesZ, + /*0x0215*/ (u32) &_file_Usetupmp14Z, + /*0x0216*/ (u32) &_file_Ump_setupmp14Z, + /*0x0217*/ (u32) &_file_bg_mp14_padsZ, + /*0x0218*/ (u32) &_file_bg_mp14_tilesZ, + /*0x0219*/ (u32) &_file_Usetupmp15Z, + /*0x021a*/ (u32) &_file_Ump_setupmp15Z, + /*0x021b*/ (u32) &_file_bg_mp15_padsZ, + /*0x021c*/ (u32) &_file_bg_mp15_tilesZ, + /*0x021d*/ (u32) &_file_Usetupmp16Z, + /*0x021e*/ (u32) &_file_Ump_setupmp16Z, + /*0x021f*/ (u32) &_file_bg_mp16_padsZ, + /*0x0220*/ (u32) &_file_bg_mp16_tilesZ, + /*0x0221*/ (u32) &_file_Usetupmp17Z, + /*0x0222*/ (u32) &_file_Ump_setupmp17Z, + /*0x0223*/ (u32) &_file_bg_mp17_padsZ, + /*0x0224*/ (u32) &_file_bg_mp17_tilesZ, + /*0x0225*/ (u32) &_file_Usetupmp18Z, + /*0x0226*/ (u32) &_file_Ump_setupmp18Z, + /*0x0227*/ (u32) &_file_bg_mp18_padsZ, + /*0x0228*/ (u32) &_file_bg_mp18_tilesZ, + /*0x0229*/ (u32) &_file_Usetupmp19Z, + /*0x022a*/ (u32) &_file_Ump_setupmp19Z, + /*0x022b*/ (u32) &_file_bg_mp19_padsZ, + /*0x022c*/ (u32) &_file_bg_mp19_tilesZ, + /*0x022d*/ (u32) &_file_Usetupmp20Z, + /*0x022e*/ (u32) &_file_Ump_setupmp20Z, + /*0x022f*/ (u32) &_file_bg_mp20_padsZ, + /*0x0230*/ (u32) &_file_bg_mp20_tilesZ, + /*0x0231*/ (u32) &_file_Ca51airmanZ, + /*0x0232*/ (u32) &_file_Cheadneil2Z, + /*0x0233*/ (u32) &_file_Pci_sofaZ, + /*0x0234*/ (u32) &_file_Pci_liftZ, + /*0x0235*/ (u32) &_file_Pci_liftdoorZ, + /*0x0236*/ (u32) &_file_CchicrobZ, + /*0x0237*/ (u32) &_file_CstewardZ, + /*0x0238*/ (u32) &_file_CheadedmcgZ, + /*0x0239*/ (u32) &_file_CstewardessZ, + /*0x023a*/ (u32) &_file_CheadankaZ, + /*0x023b*/ (u32) &_file_CpresidentZ, + /*0x023c*/ (u32) &_file_Cstewardess_coatZ, + /*0x023d*/ (u32) &_file_Cheadleslie_sZ, + /*0x023e*/ (u32) &_file_PlasercutZ, + /*0x023f*/ (u32) &_file_Psk_shuttleZ, + /*0x0240*/ (u32) &_file_CminiskedarZ, + /*0x0241*/ (u32) &_file_PnewvilladoorZ, + /*0x0242*/ (u32) &_file_Cnsa_lackeyZ, + /*0x0243*/ (u32) &_file_Cheadmatt_cZ, + /*0x0244*/ (u32) &_file_Cpres_securityZ, + /*0x0245*/ (u32) &_file_Cheadpeer_sZ, + /*0x0246*/ (u32) &_file_CnegotiatorZ, + /*0x0247*/ (u32) &_file_Cheadeileen_tZ, + /*0x0248*/ (u32) &_file_Psk_pillarleftZ, + /*0x0249*/ (u32) &_file_Psk_pillarrightZ, + /*0x024a*/ (u32) &_file_Psk_plinth_tZ, + /*0x024b*/ (u32) &_file_Psk_plinth_mlZ, + /*0x024c*/ (u32) &_file_Psk_plinth_mrZ, + /*0x024d*/ (u32) &_file_Psk_plinth_blZ, + /*0x024e*/ (u32) &_file_Psk_plinth_brZ, + /*0x024f*/ (u32) &_file_Psk_fl_shad_tZ, + /*0x0250*/ (u32) &_file_Psk_fl_shad_mlZ, + /*0x0251*/ (u32) &_file_Psk_fl_shad_mrZ, + /*0x0252*/ (u32) &_file_Psk_fl_shad_blZ, + /*0x0253*/ (u32) &_file_Psk_fl_shad_brZ, + /*0x0254*/ (u32) &_file_Psk_fl_noshad_tZ, + /*0x0255*/ (u32) &_file_Psk_fl_noshad_mlZ, + /*0x0256*/ (u32) &_file_Psk_fl_noshad_mrZ, + /*0x0257*/ (u32) &_file_Psk_fl_noshad_blZ, + /*0x0258*/ (u32) &_file_Psk_fl_noshad_brZ, + /*0x0259*/ (u32) &_file_GhudpieceZ, + /*0x025a*/ (u32) &_file_Psk_templecolumn1Z, + /*0x025b*/ (u32) &_file_Psk_templecolumn2Z, + /*0x025c*/ (u32) &_file_Psk_templecolumn3Z, + /*0x025d*/ (u32) &_file_Psk_sunshad1Z, + /*0x025e*/ (u32) &_file_Psk_sunshad2Z, + /*0x025f*/ (u32) &_file_Psk_sunnoshad1Z, + /*0x0260*/ (u32) &_file_Psk_sunnoshad2Z, + /*0x0261*/ (u32) &_file_Cg5_guardZ, + /*0x0262*/ (u32) &_file_Cheadandy_rZ, + /*0x0263*/ (u32) &_file_Cpelagic_guardZ, + /*0x0264*/ (u32) &_file_Cg5_swat_guardZ, + /*0x0265*/ (u32) &_file_Calaskan_guardZ, + /*0x0266*/ (u32) &_file_Cmaian_soldierZ, + /*0x0267*/ (u32) &_file_Cheadben_rZ, + /*0x0268*/ (u32) &_file_Cheadsteve_kZ, + /*0x0269*/ (u32) &_file_PbarrelZ, + /*0x026a*/ (u32) &_file_Pglass_floorZ, + /*0x026b*/ (u32) &_file_Pesca_stepZ, + /*0x026c*/ (u32) &_file_Pmatrix_liftZ, + /*0x026d*/ (u32) &_file_Prubble1Z, + /*0x026e*/ (u32) &_file_Prubble2Z, + /*0x026f*/ (u32) &_file_Prubble3Z, + /*0x0270*/ (u32) &_file_Prubble4Z, + /*0x0271*/ (u32) &_file_Arecep01M, + /*0x0272*/ (u32) &_file_Arecep02M, + /*0x0273*/ (u32) &_file_Arecep03M, + /*0x0274*/ (u32) &_file_Arecep04M, + /*0x0275*/ (u32) &_file_Arecep05M, + /*0x0276*/ (u32) &_file_Arecep06M, + /*0x0277*/ (u32) &_file_Arlguard1M, + /*0x0278*/ (u32) &_file_Arltech01M, + /*0x0279*/ (u32) &_file_Arltech02M, + /*0x027a*/ (u32) &_file_Arltech03M, + /*0x027b*/ (u32) &_file_Arltech04M, + /*0x027c*/ (u32) &_file_Arltech05M, + /*0x027d*/ (u32) &_file_Arltech06M, + /*0x027e*/ (u32) &_file_Ascie2aM, + /*0x027f*/ (u32) &_file_Ascie2bM, + /*0x0280*/ (u32) &_file_Ascie2cM, + /*0x0281*/ (u32) &_file_Ascie2dM, + /*0x0282*/ (u32) &_file_Ascie2eM, + /*0x0283*/ (u32) &_file_Ascie2fM, + /*0x0284*/ (u32) &_file_Ascie2gM, + /*0x0285*/ (u32) &_file_Ascie3aM, + /*0x0286*/ (u32) &_file_Ascie3bM, + /*0x0287*/ (u32) &_file_Ascie3cM, + /*0x0288*/ (u32) &_file_Ascie3dM, + /*0x0289*/ (u32) &_file_Ascie3eM, + /*0x028a*/ (u32) &_file_Ascie3gM, + /*0x028b*/ (u32) &_file_Ascien10aM, + /*0x028c*/ (u32) &_file_Ascien2_aM, + /*0x028d*/ (u32) &_file_Ascien3_aM, + /*0x028e*/ (u32) &_file_Ascien4_aM, + /*0x028f*/ (u32) &_file_Ascien5_aM, + /*0x0290*/ (u32) &_file_Ascien6_aM, + /*0x0291*/ (u32) &_file_Ascien7_aM, + /*0x0292*/ (u32) &_file_Ascien9_aM, + /*0x0293*/ (u32) &_file_AvilgrimM, + /*0x0294*/ (u32) &_file_Awepgd01M, + /*0x0295*/ (u32) &_file_Awepgd02M, + /*0x0296*/ (u32) &_file_Awepgd03M, + /*0x0297*/ (u32) &_file_Awepsc01M, + /*0x0298*/ (u32) &_file_Awepsc02M, + /*0x0299*/ (u32) &_file_Awepsc03M, + /*0x029a*/ (u32) &_file_Aa51elv01M, + /*0x029b*/ (u32) &_file_Aa51elv02M, + /*0x029c*/ (u32) &_file_Aa51elv03M, + /*0x029d*/ (u32) &_file_Aa51grd01M, + /*0x029e*/ (u32) &_file_Aa51grd02M, + /*0x029f*/ (u32) &_file_Aa51grd03M, + /*0x02a0*/ (u32) &_file_Aa51grd04M, + /*0x02a1*/ (u32) &_file_Aa51grd05M, + /*0x02a2*/ (u32) &_file_Aa51grd06M, + /*0x02a3*/ (u32) &_file_Aa51grd07M, + /*0x02a4*/ (u32) &_file_Aa51grd08M, + /*0x02a5*/ (u32) &_file_Aa51grd09M, + /*0x02a6*/ (u32) &_file_Aa51grd10M, + /*0x02a7*/ (u32) &_file_Aa51jo1M, + /*0x02a8*/ (u32) &_file_Aa51jo2M, + /*0x02a9*/ (u32) &_file_Aa51jo3M, + /*0x02aa*/ (u32) &_file_Aa51jo4M, + /*0x02ab*/ (u32) &_file_Aa51jo5M, + /*0x02ac*/ (u32) &_file_Aa51jo6M, + /*0x02ad*/ (u32) &_file_Aa51jon01M, + /*0x02ae*/ (u32) &_file_Aa51jon02M, + /*0x02af*/ (u32) &_file_Aa51jon03M, + /*0x02b0*/ (u32) &_file_Aa51jon04M, + /*0x02b1*/ (u32) &_file_Aa51jon05M, + /*0x02b2*/ (u32) &_file_Aa51jon06M, + /*0x02b3*/ (u32) &_file_Aa51jon07M, + /*0x02b4*/ (u32) &_file_Aa51jon08M, + /*0x02b5*/ (u32) &_file_Aa51jon09M, + /*0x02b6*/ (u32) &_file_Aa51jon10M, + /*0x02b7*/ (u32) &_file_Aa51jon11M, + /*0x02b8*/ (u32) &_file_Aa51jon12M, + /*0x02b9*/ (u32) &_file_Aa51jon14M, + /*0x02ba*/ (u32) &_file_Aa51jon15M, + /*0x02bb*/ (u32) &_file_Aa51sci1M, + /*0x02bc*/ (u32) &_file_Aaf1jo01M, + /*0x02bd*/ (u32) &_file_Aaf1jo02M, + /*0x02be*/ (u32) &_file_Aaf1jo03M, + /*0x02bf*/ (u32) &_file_Aaf1pr01M, + /*0x02c0*/ (u32) &_file_Aaf1pr02M, + /*0x02c1*/ (u32) &_file_Aaf1pr03M, + /*0x02c2*/ (u32) &_file_Aaf1pr04M, + /*0x02c3*/ (u32) &_file_Aaf1pr05M, + /*0x02c4*/ (u32) &_file_Aaf1pr06M, + /*0x02c5*/ (u32) &_file_Aaf1pr07M, + /*0x02c6*/ (u32) &_file_Aaf1pr08M, + /*0x02c7*/ (u32) &_file_Aaf1pr09M, + /*0x02c8*/ (u32) &_file_Aaf1pr10M, + /*0x02c9*/ (u32) &_file_Aaf1tr01M, + /*0x02ca*/ (u32) &_file_Aaf1tr02M, + /*0x02cb*/ (u32) &_file_Aaf1tr03M, + /*0x02cc*/ (u32) &_file_Aairbgd01M, + /*0x02cd*/ (u32) &_file_Aairbgd02M, + /*0x02ce*/ (u32) &_file_Aairbgd03M, + /*0x02cf*/ (u32) &_file_Aairbgd04M, + /*0x02d0*/ (u32) &_file_Aairbgd05M, + /*0x02d1*/ (u32) &_file_Aairbgd06M, + /*0x02d2*/ (u32) &_file_Aairbgd07M, + /*0x02d3*/ (u32) &_file_Aairbgd08M, + /*0x02d4*/ (u32) &_file_Aairbgd09M, + /*0x02d5*/ (u32) &_file_Aairbgd10M, + /*0x02d6*/ (u32) &_file_Aairbgd11M, + /*0x02d7*/ (u32) &_file_Aairbgd12M, + /*0x02d8*/ (u32) &_file_Aairbgd13M, + /*0x02d9*/ (u32) &_file_Aairbgd14M, + /*0x02da*/ (u32) &_file_Aairbgd15M, + /*0x02db*/ (u32) &_file_Aairbgd16M, + /*0x02dc*/ (u32) &_file_Aairstw01M, + /*0x02dd*/ (u32) &_file_Aairstw02M, + /*0x02de*/ (u32) &_file_Aairstw03M, + /*0x02df*/ (u32) &_file_Aassael01M, + /*0x02e0*/ (u32) &_file_Aassael02M, + /*0x02e1*/ (u32) &_file_Aassael03M, + /*0x02e2*/ (u32) &_file_Aassael04M, + /*0x02e3*/ (u32) &_file_Aassael05M, + /*0x02e4*/ (u32) &_file_Aassael06M, + /*0x02e5*/ (u32) &_file_Absewrk01M, + /*0x02e6*/ (u32) &_file_Absewrk02M, + /*0x02e7*/ (u32) &_file_Absewrk03M, + /*0x02e8*/ (u32) &_file_Absewrk04M, + /*0x02e9*/ (u32) &_file_Absewrk05M, + /*0x02ea*/ (u32) &_file_Acetael01M, + /*0x02eb*/ (u32) &_file_Achdroid1M, + /*0x02ec*/ (u32) &_file_Achdroid2M, + /*0x02ed*/ (u32) &_file_Acsec01M, + /*0x02ee*/ (u32) &_file_Acsec02M, + /*0x02ef*/ (u32) &_file_Acsec03M, + /*0x02f0*/ (u32) &_file_Acstan1M, + /*0x02f1*/ (u32) &_file_Acstan2M, + /*0x02f2*/ (u32) &_file_Adevr01M, + /*0x02f3*/ (u32) &_file_Adevr02M, + /*0x02f4*/ (u32) &_file_Adevr03M, + /*0x02f5*/ (u32) &_file_Adevr04M, + /*0x02f6*/ (u32) &_file_Adevr05M, + /*0x02f7*/ (u32) &_file_Adevr06M, + /*0x02f8*/ (u32) &_file_Adevr07M, + /*0x02f9*/ (u32) &_file_Adevr08M, + /*0x02fa*/ (u32) &_file_Adevr09M, + /*0x02fb*/ (u32) &_file_Adevr10M, + /*0x02fc*/ (u32) &_file_Adevr11M, + /*0x02fd*/ (u32) &_file_Adevr12M, + /*0x02fe*/ (u32) &_file_Aexec01M, + /*0x02ff*/ (u32) &_file_Aexec02M, + /*0x0300*/ (u32) &_file_Aexec04M, + /*0x0301*/ (u32) &_file_Aexec05M, + /*0x0302*/ (u32) &_file_Aexec06M, + /*0x0303*/ (u32) &_file_Aexec07M, + /*0x0304*/ (u32) &_file_Aexec08M, + /*0x0305*/ (u32) &_file_Aexec09M, + /*0x0306*/ (u32) &_file_Aexec10M, + /*0x0307*/ (u32) &_file_Aexec11M, + /*0x0308*/ (u32) &_file_Aexec12M, + /*0x0309*/ (u32) &_file_Aexec13M, + /*0x030a*/ (u32) &_file_Aexec14M, + /*0x030b*/ (u32) &_file_Ahelic01M, + /*0x030c*/ (u32) &_file_Ahelic02M, + /*0x030d*/ (u32) &_file_Ahelic03M, + /*0x030e*/ (u32) &_file_Ahologd01M, + /*0x030f*/ (u32) &_file_AholohopkM, + /*0x0310*/ (u32) &_file_Ainvcar01M, + /*0x0311*/ (u32) &_file_Ainvcar02M, + /*0x0312*/ (u32) &_file_Ainvcar03M, + /*0x0313*/ (u32) &_file_Ainvcar04M, + /*0x0314*/ (u32) &_file_Ainvcar05M, + /*0x0315*/ (u32) &_file_Ainvcar06M, + /*0x0316*/ (u32) &_file_Ainvcar07M, + /*0x0317*/ (u32) &_file_Ainvcar08M, + /*0x0318*/ (u32) &_file_Ainvcar09M, + /*0x0319*/ (u32) &_file_Ainvcar10M, + /*0x031a*/ (u32) &_file_Ainvcar11M, + /*0x031b*/ (u32) &_file_Ainvcar12M, + /*0x031c*/ (u32) &_file_AinvfarrM, + /*0x031d*/ (u32) &_file_AinvfemaM, + /*0x031e*/ (u32) &_file_AinvfostM, + /*0x031f*/ (u32) &_file_AinvgrimM, + /*0x0320*/ (u32) &_file_AinvhopkM, + /*0x0321*/ (u32) &_file_AinvmaleM, + /*0x0322*/ (u32) &_file_Ajoexec01M, + /*0x0323*/ (u32) &_file_Ajoexec02M, + /*0x0324*/ (u32) &_file_Ajosci01M, + /*0x0325*/ (u32) &_file_Ajosci02M, + /*0x0326*/ (u32) &_file_Ajosci03M, + /*0x0327*/ (u32) &_file_Alabacc1M, + /*0x0328*/ (u32) &_file_Alabacc2M, + /*0x0329*/ (u32) &_file_Alabacc3M, + /*0x032a*/ (u32) &_file_Alabacc4M, + /*0x032b*/ (u32) &_file_Alabacc5M, + /*0x032c*/ (u32) &_file_Alabacc6M, + /*0x032d*/ (u32) &_file_Alabtech1M, + /*0x032e*/ (u32) &_file_Alabtech2M, + /*0x032f*/ (u32) &_file_Alabtech3M, + /*0x0330*/ (u32) &_file_Alabtech5M, + /*0x0331*/ (u32) &_file_Alabtech6M, + /*0x0332*/ (u32) &_file_Alabtech7M, + /*0x0333*/ (u32) &_file_Alabtech8M, + /*0x0334*/ (u32) &_file_Alabtech9M, + /*0x0335*/ (u32) &_file_Aoffwrk01M, + /*0x0336*/ (u32) &_file_Aoffwrk02M, + /*0x0337*/ (u32) &_file_Aoffwrk03M, + /*0x0338*/ (u32) &_file_Aoffwrk04M, + /*0x0339*/ (u32) &_file_Cpresident_cloneZ, + /*0x033a*/ (u32) &_file_CheadjonathanZ, + /*0x033b*/ (u32) &_file_Cheadmaian_sZ, + /*0x033c*/ (u32) &_file_Cdark_af1Z, + /*0x033d*/ (u32) &_file_Pcable_carZ, + /*0x033e*/ (u32) &_file_Pelvis_saucerZ, + /*0x033f*/ (u32) &_file_Pstewardess_trolleyZ, + /*0x0340*/ (u32) &_file_Pairbase_lift_enclosedZ, + /*0x0341*/ (u32) &_file_Pairbase_lift_angleZ, + /*0x0342*/ (u32) &_file_Pairbase_safedoorZ, + /*0x0343*/ (u32) &_file_Paf1_pilotchairZ, + /*0x0344*/ (u32) &_file_Paf1_passchairZ, + /*0x0345*/ (u32) &_file_CheadshaunZ, + /*0x0346*/ (u32) &_file_PchrnightsightZ, + /*0x0347*/ (u32) &_file_PchrshieldZ, + /*0x0348*/ (u32) &_file_Pchrfalcon2Z, + /*0x0349*/ (u32) &_file_Pchrleegun1Z, + /*0x034a*/ (u32) &_file_PchrmaulerZ, + /*0x034b*/ (u32) &_file_Pchrdy357Z, + /*0x034c*/ (u32) &_file_Pchrdy357trentZ, + /*0x034d*/ (u32) &_file_PchrmaianpistolZ, + /*0x034e*/ (u32) &_file_Pchrfalcon2silZ, + /*0x034f*/ (u32) &_file_Pchrfalcon2scopeZ, + /*0x0350*/ (u32) &_file_Pchrcmp150Z, + /*0x0351*/ (u32) &_file_Pchrar34Z, + /*0x0352*/ (u32) &_file_PchrdragonZ, + /*0x0353*/ (u32) &_file_PchrsuperdragonZ, + /*0x0354*/ (u32) &_file_PchravengerZ, + /*0x0355*/ (u32) &_file_PchrcycloneZ, + /*0x0356*/ (u32) &_file_PchrmaiansmgZ, + /*0x0357*/ (u32) &_file_Pchrrcp120Z, + /*0x0358*/ (u32) &_file_PchrpcgunZ, + /*0x0359*/ (u32) &_file_PchrshotgunZ, + /*0x035a*/ (u32) &_file_PchrskminigunZ, + /*0x035b*/ (u32) &_file_PchrdyrocketZ, + /*0x035c*/ (u32) &_file_PchrdevastatorZ, + /*0x035d*/ (u32) &_file_PchrskrocketZ, + /*0x035e*/ (u32) &_file_Pchrz2020Z, + /*0x035f*/ (u32) &_file_PchrsniperrifleZ, + /*0x0360*/ (u32) &_file_PchrcrossbowZ, + /*0x0361*/ (u32) &_file_PchrdruggunZ, + /*0x0362*/ (u32) &_file_PchrknifeZ, + /*0x0363*/ (u32) &_file_PchrnbombZ, + /*0x0364*/ (u32) &_file_PchrflashbangZ, + /*0x0365*/ (u32) &_file_PchrgrenadeZ, + /*0x0366*/ (u32) &_file_PchrtimedmineZ, + /*0x0367*/ (u32) &_file_PchrproximitymineZ, + /*0x0368*/ (u32) &_file_PchrremotemineZ, + /*0x0369*/ (u32) &_file_PchrecmmineZ, + /*0x036a*/ (u32) &_file_PchrwppkZ, + /*0x036b*/ (u32) &_file_Pchrtt33Z, + /*0x036c*/ (u32) &_file_PchrskorpionZ, + /*0x036d*/ (u32) &_file_PchrkalashZ, + /*0x036e*/ (u32) &_file_PchruziZ, + /*0x036f*/ (u32) &_file_Pchrmp5kZ, + /*0x0370*/ (u32) &_file_Pchrm16Z, + /*0x0371*/ (u32) &_file_Pchrfnp90Z, + /*0x0372*/ (u32) &_file_PchrdyrocketmisZ, + /*0x0373*/ (u32) &_file_PchrskrocketmisZ, + /*0x0374*/ (u32) &_file_PchrcrossboltZ, + /*0x0375*/ (u32) &_file_PchrdevgrenadeZ, + /*0x0376*/ (u32) &_file_PchrdraggrenadeZ, + /*0x0377*/ (u32) &_file_Gfalcon2Z, + /*0x0378*/ (u32) &_file_Gleegun1Z, + /*0x0379*/ (u32) &_file_GskpistolZ, + /*0x037a*/ (u32) &_file_Gdy357Z, + /*0x037b*/ (u32) &_file_Gdy357trentZ, + /*0x037c*/ (u32) &_file_GmaianpistolZ, + /*0x037d*/ (u32) &_file_Gcmp150Z, + /*0x037e*/ (u32) &_file_Gar34Z, + /*0x037f*/ (u32) &_file_GdydragonZ, + /*0x0380*/ (u32) &_file_GdysuperdragonZ, + /*0x0381*/ (u32) &_file_Gk7avengerZ, + /*0x0382*/ (u32) &_file_GcycloneZ, + /*0x0383*/ (u32) &_file_GmaiansmgZ, + /*0x0384*/ (u32) &_file_Grcp120Z, + /*0x0385*/ (u32) &_file_GpcgunZ, + /*0x0386*/ (u32) &_file_GshotgunZ, + /*0x0387*/ (u32) &_file_GskminigunZ, + /*0x0388*/ (u32) &_file_GdyrocketZ, + /*0x0389*/ (u32) &_file_GdydevastatorZ, + /*0x038a*/ (u32) &_file_GskrocketZ, + /*0x038b*/ (u32) &_file_Gz2020Z, + /*0x038c*/ (u32) &_file_GsniperrifleZ, + /*0x038d*/ (u32) &_file_GcrossbowZ, + /*0x038e*/ (u32) &_file_GdruggunZ, + /*0x038f*/ (u32) &_file_GknifeZ, + /*0x0390*/ (u32) &_file_GgrenadeZ, + /*0x0391*/ (u32) &_file_GtimedmineZ, + /*0x0392*/ (u32) &_file_GproximitymineZ, + /*0x0393*/ (u32) &_file_GremotemineZ, + /*0x0394*/ (u32) &_file_GwppkZ, + /*0x0395*/ (u32) &_file_Gtt33Z, + /*0x0396*/ (u32) &_file_GskorpionZ, + /*0x0397*/ (u32) &_file_Gak47Z, + /*0x0398*/ (u32) &_file_GuziZ, + /*0x0399*/ (u32) &_file_Gmp5kZ, + /*0x039a*/ (u32) &_file_Gm16Z, + /*0x039b*/ (u32) &_file_Gfnp90Z, + /*0x039c*/ (u32) &_file_Gfalcon2lodZ, + /*0x039d*/ (u32) &_file_GskminigunlodZ, + /*0x039e*/ (u32) &_file_Pa51_turretZ, + /*0x039f*/ (u32) &_file_PpelagicdoorZ, + /*0x03a0*/ (u32) &_file_Am1_l1_aM, + /*0x03a1*/ (u32) &_file_Am1_l1_bM, + /*0x03a2*/ (u32) &_file_Am1_l1_cM, + /*0x03a3*/ (u32) &_file_Am1_l1_dM, + /*0x03a4*/ (u32) &_file_Am1_l2_aM, + /*0x03a5*/ (u32) &_file_Am1_l2_bM, + /*0x03a6*/ (u32) &_file_Am1_l2_cM, + /*0x03a7*/ (u32) &_file_Am1_l2_dM, + /*0x03a8*/ (u32) &_file_Am1_l3_aM, + /*0x03a9*/ (u32) &_file_Am1_l3_bM, + /*0x03aa*/ (u32) &_file_Am1_l3_cM, + /*0x03ab*/ (u32) &_file_Am1_l3_dM, + /*0x03ac*/ (u32) &_file_Am2_l1_aM, + /*0x03ad*/ (u32) &_file_Am2_l1_bM, + /*0x03ae*/ (u32) &_file_Am2_l1_cM, + /*0x03af*/ (u32) &_file_Am2_l1_dM, + /*0x03b0*/ (u32) &_file_Am3_l1_aM, + /*0x03b1*/ (u32) &_file_Am3_l1_bM, + /*0x03b2*/ (u32) &_file_Am3_l1_cM, + /*0x03b3*/ (u32) &_file_Am3_l1_dM, + /*0x03b4*/ (u32) &_file_Am3_l2_aM, + /*0x03b5*/ (u32) &_file_Am3_l2_bM, + /*0x03b6*/ (u32) &_file_Am3_l2_cM, + /*0x03b7*/ (u32) &_file_Am3_l2_dM, + /*0x03b8*/ (u32) &_file_Am4_l1_aM, + /*0x03b9*/ (u32) &_file_Am4_l1_bM, + /*0x03ba*/ (u32) &_file_Am4_l1_cM, + /*0x03bb*/ (u32) &_file_Am4_l1_dM, + /*0x03bc*/ (u32) &_file_Am4_l2_aM, + /*0x03bd*/ (u32) &_file_Am4_l2_bM, + /*0x03be*/ (u32) &_file_Am4_l2_cM, + /*0x03bf*/ (u32) &_file_Am4_l2_dM, + /*0x03c0*/ (u32) &_file_Am4_l3_aM, + /*0x03c1*/ (u32) &_file_Am4_l3_bM, + /*0x03c2*/ (u32) &_file_Am4_l3_cM, + /*0x03c3*/ (u32) &_file_Am4_l3_dM, + /*0x03c4*/ (u32) &_file_Am5_l1_aM, + /*0x03c5*/ (u32) &_file_Am5_l1_bM, + /*0x03c6*/ (u32) &_file_Am5_l1_cM, + /*0x03c7*/ (u32) &_file_Am5_l1_dM, + /*0x03c8*/ (u32) &_file_Am5_l2_aM, + /*0x03c9*/ (u32) &_file_Am5_l2_bM, + /*0x03ca*/ (u32) &_file_Am5_l2_cM, + /*0x03cb*/ (u32) &_file_Am5_l2_dM, + /*0x03cc*/ (u32) &_file_Am5_l3_aM, + /*0x03cd*/ (u32) &_file_Am5_l3_bM, + /*0x03ce*/ (u32) &_file_Am5_l3_cM, + /*0x03cf*/ (u32) &_file_Am5_l3_dM, + /*0x03d0*/ (u32) &_file_Am6_l1_aM, + /*0x03d1*/ (u32) &_file_Am6_l1_bM, + /*0x03d2*/ (u32) &_file_Am6_l1_cM, + /*0x03d3*/ (u32) &_file_Am6_l1_dM, + /*0x03d4*/ (u32) &_file_Am6_l2_aM, + /*0x03d5*/ (u32) &_file_Am6_l2_bM, + /*0x03d6*/ (u32) &_file_Am6_l2_cM, + /*0x03d7*/ (u32) &_file_Am6_l2_dM, + /*0x03d8*/ (u32) &_file_Am7_l1_aM, + /*0x03d9*/ (u32) &_file_Am7_l1_bM, + /*0x03da*/ (u32) &_file_Am7_l1_cM, + /*0x03db*/ (u32) &_file_Am7_l1_dM, + /*0x03dc*/ (u32) &_file_Am8_l1_aM, + /*0x03dd*/ (u32) &_file_Am8_l1_bM, + /*0x03de*/ (u32) &_file_Am8_l1_cM, + /*0x03df*/ (u32) &_file_Am8_l1_dM, + /*0x03e0*/ (u32) &_file_Am9_l1_aM, + /*0x03e1*/ (u32) &_file_Am9_l1_bM, + /*0x03e2*/ (u32) &_file_Am9_l1_cM, + /*0x03e3*/ (u32) &_file_Am9_l1_dM, + /*0x03e4*/ (u32) &_file_Ap1_01_joM, + /*0x03e5*/ (u32) &_file_Ap1_02_caM, + /*0x03e6*/ (u32) &_file_Ap1_03_joM, + /*0x03e7*/ (u32) &_file_Ap1_04_caM, + /*0x03e8*/ (u32) &_file_Ap1_05_joM, + /*0x03e9*/ (u32) &_file_Ap1_06_caM, + /*0x03ea*/ (u32) &_file_Ap1_07_joM, + /*0x03eb*/ (u32) &_file_Ap1_08_caM, + /*0x03ec*/ (u32) &_file_Ap2_01_joM, + /*0x03ed*/ (u32) &_file_Ap2_02_joM, + /*0x03ee*/ (u32) &_file_Ap2_03_drM, + /*0x03ef*/ (u32) &_file_Ap2_04_joM, + /*0x03f0*/ (u32) &_file_Ap2_05_joM, + /*0x03f1*/ (u32) &_file_Ap2_06_drM, + /*0x03f2*/ (u32) &_file_Ap2_07_drM, + /*0x03f3*/ (u32) &_file_Ap3_01_gdM, + /*0x03f4*/ (u32) &_file_Ap3_02_joM, + /*0x03f5*/ (u32) &_file_Ap3_03_joM, + /*0x03f6*/ (u32) &_file_Ap4_01_dvM, + /*0x03f7*/ (u32) &_file_Ap4_02_joM, + /*0x03f8*/ (u32) &_file_Ap4_03_dvM, + /*0x03f9*/ (u32) &_file_Ap4_04_joM, + /*0x03fa*/ (u32) &_file_Ap4_05_dvM, + /*0x03fb*/ (u32) &_file_Ap4_06_joM, + /*0x03fc*/ (u32) &_file_Ap4_07_blM, + /*0x03fd*/ (u32) &_file_Ap4_08_dvM, + /*0x03fe*/ (u32) &_file_Ap4_09_dvM, + /*0x03ff*/ (u32) &_file_Ap5_01_joM, + /*0x0400*/ (u32) &_file_Ap5_02_joM, + /*0x0401*/ (u32) &_file_Ap5_03_joM, + /*0x0402*/ (u32) &_file_Ap6_01_joM, + /*0x0403*/ (u32) &_file_Ap6_02_caM, + /*0x0404*/ (u32) &_file_Ap6_03_joM, + /*0x0405*/ (u32) &_file_Ap6_04_caM, + /*0x0406*/ (u32) &_file_Ap6_05_joM, + /*0x0407*/ (u32) &_file_Ap6_06_caM, + /*0x0408*/ (u32) &_file_Ap7_01_caM, + /*0x0409*/ (u32) &_file_Ap7_02_joM, + /*0x040a*/ (u32) &_file_Ap7_03_caM, + /*0x040b*/ (u32) &_file_Ap7_04_joM, + /*0x040c*/ (u32) &_file_Ap8_01_dvM, + /*0x040d*/ (u32) &_file_Ap8_02_blM, + /*0x040e*/ (u32) &_file_Ap8_03_dvM, + /*0x040f*/ (u32) &_file_Ap8_04_blM, + /*0x0410*/ (u32) &_file_Ap8_06_blM, + /*0x0411*/ (u32) &_file_Ap8_07_trM, + /*0x0412*/ (u32) &_file_Ap8_08_dvM, + /*0x0413*/ (u32) &_file_Ap8_09_trM, + /*0x0414*/ (u32) &_file_Ap8_10_blM, + /*0x0415*/ (u32) &_file_Ap9_01_joM, + /*0x0416*/ (u32) &_file_Ap9_02_caM, + /*0x0417*/ (u32) &_file_Ap9_03_joM, + /*0x0418*/ (u32) &_file_Ap10_01_caM, + /*0x0419*/ (u32) &_file_Ap10_02_caM, + /*0x041a*/ (u32) &_file_Ap10_03_caM, + /*0x041b*/ (u32) &_file_Ap10_04_caM, + /*0x041c*/ (u32) &_file_Ap10_05_joM, + /*0x041d*/ (u32) &_file_Ap10_06_caM, + /*0x041e*/ (u32) &_file_Ap10_07_joM, + /*0x041f*/ (u32) &_file_Ap10_08_caM, + /*0x0420*/ (u32) &_file_Ap10_09_joM, + /*0x0421*/ (u32) &_file_Ap11_01_jnM, + /*0x0422*/ (u32) &_file_Ap11_02_joM, + /*0x0423*/ (u32) &_file_Ap11_03_jnM, + /*0x0424*/ (u32) &_file_Ap11_04_joM, + /*0x0425*/ (u32) &_file_Ap11_05_jnM, + /*0x0426*/ (u32) &_file_Ap11_06_joM, + /*0x0427*/ (u32) &_file_Ap11_07_jnM, + /*0x0428*/ (u32) &_file_Ap11_08_joM, + /*0x0429*/ (u32) &_file_Ap12_01_jnM, + /*0x042a*/ (u32) &_file_Ap12_02_joM, + /*0x042b*/ (u32) &_file_Ap12_03_jnM, + /*0x042c*/ (u32) &_file_Ap12_04_joM, + /*0x042d*/ (u32) &_file_Ap12_05_jnM, + /*0x042e*/ (u32) &_file_Ap12_06_joM, + /*0x042f*/ (u32) &_file_Ap12_07_jnM, + /*0x0430*/ (u32) &_file_Ap12_08_joM, + /*0x0431*/ (u32) &_file_Ap12_09_jnM, + /*0x0432*/ (u32) &_file_Ap12_10_joM, + /*0x0433*/ (u32) &_file_Ap13_01_joM, + /*0x0434*/ (u32) &_file_Ap13_02_suM, + /*0x0435*/ (u32) &_file_Ap13_03_joM, + /*0x0436*/ (u32) &_file_Ap13_04_suM, + /*0x0437*/ (u32) &_file_Ap13_06_suM, + /*0x0438*/ (u32) &_file_Ap14_03_suM, + /*0x0439*/ (u32) &_file_Ap14_04_joM, + /*0x043a*/ (u32) &_file_Ap14_05_suM, + /*0x043b*/ (u32) &_file_Ap14_07_joM, + /*0x043c*/ (u32) &_file_Ap15_01_elM, + /*0x043d*/ (u32) &_file_Ap15_02_elM, + /*0x043e*/ (u32) &_file_Ap15_03_joM, + /*0x043f*/ (u32) &_file_Ap15_04_jnM, + /*0x0440*/ (u32) &_file_Ap15_05_elM, + /*0x0441*/ (u32) &_file_Ap15_06_joM, + /*0x0442*/ (u32) &_file_Ap15_07_elM, + /*0x0443*/ (u32) &_file_Ap15_08_joM, + /*0x0444*/ (u32) &_file_Ap15_09_elM, + /*0x0445*/ (u32) &_file_Ap15_10_joM, + /*0x0446*/ (u32) &_file_Ap15_11_elM, + /*0x0447*/ (u32) &_file_Ap16_01_joM, + /*0x0448*/ (u32) &_file_Ap16_02_caM, + /*0x0449*/ (u32) &_file_Ap16_04_caM, + /*0x044a*/ (u32) &_file_Ap16_05_joM, + /*0x044b*/ (u32) &_file_Ap16_06_caM, + /*0x044c*/ (u32) &_file_Ap17_01_trM, + /*0x044d*/ (u32) &_file_Ap17_02_prM, + /*0x044e*/ (u32) &_file_Ap17_03_trM, + /*0x044f*/ (u32) &_file_Ap17_04_prM, + /*0x0450*/ (u32) &_file_Ap17_05_trM, + /*0x0451*/ (u32) &_file_Ap17_06_trM, + /*0x0452*/ (u32) &_file_Ap18_01_joM, + /*0x0453*/ (u32) &_file_Ap18_02_elM, + /*0x0454*/ (u32) &_file_Ap18_03_elM, + /*0x0455*/ (u32) &_file_Ap18_04_joM, + /*0x0456*/ (u32) &_file_Ap18_05_elM, + /*0x0457*/ (u32) &_file_Ap19_01_caM, + /*0x0458*/ (u32) &_file_Ap19_02_caM, + /*0x0459*/ (u32) &_file_Ap19_03_joM, + /*0x045a*/ (u32) &_file_Ap19_04_caM, + /*0x045b*/ (u32) &_file_Ap19_05_joM, + /*0x045c*/ (u32) &_file_Ap19_06_joM, + /*0x045d*/ (u32) &_file_Ap20_01_joM, + /*0x045e*/ (u32) &_file_Ap20_02_prM, + /*0x045f*/ (u32) &_file_Ap20_03_joM, + /*0x0460*/ (u32) &_file_Ap20_04_prM, + /*0x0461*/ (u32) &_file_Ap20_05_joM, + /*0x0462*/ (u32) &_file_Ap20_06_blM, + /*0x0463*/ (u32) &_file_Ap20_07_trM, + /*0x0464*/ (u32) &_file_Ap20_08_trM, + /*0x0465*/ (u32) &_file_Ap21_01_elM, + /*0x0466*/ (u32) &_file_Ap21_02_joM, + /*0x0467*/ (u32) &_file_Ap21_03_elM, + /*0x0468*/ (u32) &_file_Ap21_04_joM, + /*0x0469*/ (u32) &_file_Ap22_01_elM, + /*0x046a*/ (u32) &_file_Ap22_02_joM, + /*0x046b*/ (u32) &_file_Ap22_03_elM, + /*0x046c*/ (u32) &_file_Ap22_04_joM, + /*0x046d*/ (u32) &_file_Ap23_01_joM, + /*0x046e*/ (u32) &_file_Ap23_02_drM, + /*0x046f*/ (u32) &_file_Ap23_03_joM, + /*0x0470*/ (u32) &_file_Ap23_04_drM, + /*0x0471*/ (u32) &_file_Ap23_05_joM, + /*0x0472*/ (u32) &_file_Ap23_06_drM, + /*0x0473*/ (u32) &_file_Ap23_07_joM, + /*0x0474*/ (u32) &_file_Ap23_08_drM, + /*0x0475*/ (u32) &_file_Ap24_01_caM, + /*0x0476*/ (u32) &_file_Ap24_02_joM, + /*0x0477*/ (u32) &_file_Ap24_03_caM, + /*0x0478*/ (u32) &_file_Ap24_04_joM, + /*0x0479*/ (u32) &_file_Ap24_05_caM, + /*0x047a*/ (u32) &_file_Ap24_06_caM, + /*0x047b*/ (u32) &_file_Ap24_07_joM, + /*0x047c*/ (u32) &_file_Ap24_08_joM, + /*0x047d*/ (u32) &_file_Ap25_01_joM, + /*0x047e*/ (u32) &_file_Ap25_02_joM, + /*0x047f*/ (u32) &_file_Ap26_01_joM, + /*0x0480*/ (u32) &_file_Ap26_02_dvM, + /*0x0481*/ (u32) &_file_Ap26_03_joM, + /*0x0482*/ (u32) &_file_Ap26_04_dvM, + /*0x0483*/ (u32) &_file_Ap26_05_dvM, + /*0x0484*/ (u32) &_file_Ap26_06_joM, + /*0x0485*/ (u32) &_file_Ap26_07_dvM, + /*0x0486*/ (u32) &_file_Ap26_08_dvM, + /*0x0487*/ (u32) &_file_Ap27_01_joM, + /*0x0488*/ (u32) &_file_Ap27_02_elM, + /*0x0489*/ (u32) &_file_Ap27_03_elM, + /*0x048a*/ (u32) &_file_Ap27_04_joM, + /*0x048b*/ (u32) &_file_Ap27_05_joM, + /*0x048c*/ (u32) &_file_Ap27_06_elM, + /*0x048d*/ (u32) &_file_Ap28_01_elM, + /*0x048e*/ (u32) &_file_Ap28_02_joM, + /*0x048f*/ (u32) &_file_Ap28_03_elM, + /*0x0490*/ (u32) &_file_Ap28_04_joM, + /*0x0491*/ (u32) &_file_Ap28_05_elM, + /*0x0492*/ (u32) &_file_Ap28_06_joM, + /*0x0493*/ (u32) &_file_Ap29_01_elM, + /*0x0494*/ (u32) &_file_Ap29_02_joM, + /*0x0495*/ (u32) &_file_Ap29_03_elM, + /*0x0496*/ (u32) &_file_Ap29_04_joM, + /*0x0497*/ (u32) &_file_Ap29_05_joM, + /*0x0498*/ (u32) &_file_Ap29_06_elM, + /*0x0499*/ (u32) &_file_Ap29_07_joM, + /*0x049a*/ (u32) &_file_Ap29_08_elM, + /*0x049b*/ (u32) &_file_Ap29_09_joM, + /*0x049c*/ (u32) &_file_Ap29_10_elM, + /*0x049d*/ (u32) &_file_PautosurgeonZ, + /*0x049e*/ (u32) &_file_CdarkwetZ, + /*0x049f*/ (u32) &_file_CdarkaqualungZ, + /*0x04a0*/ (u32) &_file_CdarksnowZ, + /*0x04a1*/ (u32) &_file_CdarklabZ, + /*0x04a2*/ (u32) &_file_CfemlabtechZ, + /*0x04a3*/ (u32) &_file_CddsniperZ, + /*0x04a4*/ (u32) &_file_Cpilotaf1Z, + /*0x04a5*/ (u32) &_file_CcilabtechZ, + /*0x04a6*/ (u32) &_file_CcifemtechZ, + /*0x04a7*/ (u32) &_file_Cheadeileen_hZ, + /*0x04a8*/ (u32) &_file_Cheadscott_hZ, + /*0x04a9*/ (u32) &_file_CcarreveningsuitZ, + /*0x04aa*/ (u32) &_file_CjonathonZ, + /*0x04ab*/ (u32) &_file_CcisoldierZ, + /*0x04ac*/ (u32) &_file_CheadsanchezZ, + /*0x04ad*/ (u32) &_file_CheaddarkaquaZ, + /*0x04ae*/ (u32) &_file_CheadddsniperZ, + /*0x04af*/ (u32) &_file_PlimoZ, + /*0x04b0*/ (u32) &_file_PpdmenuZ, + /*0x04b1*/ (u32) &_file_Pa51interceptorZ, + /*0x04b2*/ (u32) &_file_Pa51dishZ, + /*0x04b3*/ (u32) &_file_Pa51radarconsoleZ, + /*0x04b4*/ (u32) &_file_Pa51lockerdoorZ, + /*0x04b5*/ (u32) &_file_Pg5generatorZ, + /*0x04b6*/ (u32) &_file_Pg5dumpsterZ, + /*0x04b7*/ (u32) &_file_Gar34lodZ, + /*0x04b8*/ (u32) &_file_GavengerlodZ, + /*0x04b9*/ (u32) &_file_Gcmp150lodZ, + /*0x04ba*/ (u32) &_file_GcrossbowlodZ, + /*0x04bb*/ (u32) &_file_GcyclonelodZ, + /*0x04bc*/ (u32) &_file_GdruggunlodZ, + /*0x04bd*/ (u32) &_file_Gdy357lodZ, + /*0x04be*/ (u32) &_file_Gdy357trentlodZ, + /*0x04bf*/ (u32) &_file_GdevastatorlodZ, + /*0x04c0*/ (u32) &_file_GdydragonlodZ, + /*0x04c1*/ (u32) &_file_GdysuperdragonlodZ, + /*0x04c2*/ (u32) &_file_GknifelodZ, + /*0x04c3*/ (u32) &_file_GlaserlodZ, + /*0x04c4*/ (u32) &_file_GmagseclodZ, + /*0x04c5*/ (u32) &_file_GmayanpistollodZ, + /*0x04c6*/ (u32) &_file_GmayansmglodZ, + /*0x04c7*/ (u32) &_file_GpcgunlodZ, + /*0x04c8*/ (u32) &_file_Grcp120lodZ, + /*0x04c9*/ (u32) &_file_GrocketlodZ, + /*0x04ca*/ (u32) &_file_GshotgunlodZ, + /*0x04cb*/ (u32) &_file_GskpistollodZ, + /*0x04cc*/ (u32) &_file_GskrocketlodZ, + /*0x04cd*/ (u32) &_file_GsniperlodZ, + /*0x04ce*/ (u32) &_file_Gz2020lodZ, + /*0x04cf*/ (u32) &_file_PchrcloakerZ, + /*0x04d0*/ (u32) &_file_PchrspeedpillZ, + /*0x04d1*/ (u32) &_file_PbaggagecarrierZ, + /*0x04d2*/ (u32) &_file_PminesignZ, + /*0x04d3*/ (u32) &_file_PchamberZ, + /*0x04d4*/ (u32) &_file_PisotopeexperimentZ, + /*0x04d5*/ (u32) &_file_PisotopeZ, + /*0x04d6*/ (u32) &_file_PreactordoorZ, + /*0x04d7*/ (u32) &_file_PsaucerinsideZ, + /*0x04d8*/ (u32) &_file_PvillastoolZ, + /*0x04d9*/ (u32) &_file_Pcetanwindow1Z, + /*0x04da*/ (u32) &_file_Pcetanwindow2Z, + /*0x04db*/ (u32) &_file_Pcetanwindow3Z, + /*0x04dc*/ (u32) &_file_Apelelv01M, + /*0x04dd*/ (u32) &_file_Apelgrd01M, + /*0x04de*/ (u32) &_file_Ap29_11_joM, + /*0x04df*/ (u32) &_file_GlaserZ, + /*0x04e0*/ (u32) &_file_PbigpelagicdoorZ, + /*0x04e1*/ (u32) &_file_Psk_jonrubble3Z, + /*0x04e2*/ (u32) &_file_Psk_jonrubble4Z, + /*0x04e3*/ (u32) &_file_Psk_jonrubble5Z, + /*0x04e4*/ (u32) &_file_Psk_jonrubble6Z, + /*0x04e5*/ (u32) &_file_GcombathandslodZ, + /*0x04e6*/ (u32) &_file_PbinocularsZ, + /*0x04e7*/ (u32) &_file_PsubmarineZ, + /*0x04e8*/ (u32) &_file_Pairforce1Z, + /*0x04e9*/ (u32) &_file_PenginepartZ, + /*0x04ea*/ (u32) &_file_Am3l2carrM, + /*0x04eb*/ (u32) &_file_Aelvcet01M, + /*0x04ec*/ (u32) &_file_Aelvcet02M, + /*0x04ed*/ (u32) &_file_Ajorep01M, + /*0x04ee*/ (u32) &_file_Ajorep02M, + /*0x04ef*/ (u32) &_file_Ajorep03M, + /*0x04f0*/ (u32) &_file_Ajorep04M, + /*0x04f1*/ (u32) &_file_PcetroofgunZ, + /*0x04f2*/ (u32) &_file_PcetansmalldoorZ, + /*0x04f3*/ (u32) &_file_PpowernodeZ, + /*0x04f4*/ (u32) &_file_PcetanbluegreenlZ, + /*0x04f5*/ (u32) &_file_PcetanbluegreenrZ, + /*0x04f6*/ (u32) &_file_PskedarconsoleZ, + /*0x04f7*/ (u32) &_file_PskedarconsolepanelZ, + /*0x04f8*/ (u32) &_file_Ajorpld01M, + /*0x04f9*/ (u32) &_file_Ajorpld02M, + /*0x04fa*/ (u32) &_file_Ajorpld03M, + /*0x04fb*/ (u32) &_file_Ajorpld04M, + /*0x04fc*/ (u32) &_file_GnbombZ, + /*0x04fd*/ (u32) &_file_GnbomblodZ, + /*0x04fe*/ (u32) &_file_GgrenadelodZ, + /*0x04ff*/ (u32) &_file_PweaponcdoorZ, + /*0x0500*/ (u32) &_file_PtargetZ, + /*0x0501*/ (u32) &_file_PdevicesecretdoorZ, + /*0x0502*/ (u32) &_file_PcarringtonsecretdoorZ, + /*0x0503*/ (u32) &_file_PsinisterpcZ, + /*0x0504*/ (u32) &_file_PsinisterstationZ, + /*0x0505*/ (u32) &_file_PkeypadlockZ, + /*0x0506*/ (u32) &_file_PthumbprintscannerZ, + /*0x0507*/ (u32) &_file_PretinalockZ, + /*0x0508*/ (u32) &_file_PcardlockZ, + /*0x0509*/ (u32) &_file_PgoodstationZ, + /*0x050a*/ (u32) &_file_PgoodpcZ, + /*0x050b*/ (u32) &_file_CskedarkingZ, + /*0x050c*/ (u32) &_file_CelviswaistcoatZ, + /*0x050d*/ (u32) &_file_CheadgriffeyZ, + /*0x050e*/ (u32) &_file_CheadmotoZ, + /*0x050f*/ (u32) &_file_CheadkeithZ, + /*0x0510*/ (u32) &_file_CheadwinnerZ, + /*0x0511*/ (u32) &_file_Ca51faceplateZ, + /*0x0512*/ (u32) &_file_PchrautogunZ, + /*0x0513*/ (u32) &_file_Pg5bigchairZ, + /*0x0514*/ (u32) &_file_Pg5smallchairZ, + /*0x0515*/ (u32) &_file_PkingsceptreZ, + /*0x0516*/ (u32) &_file_PlabcoatZ, + /*0x0517*/ (u32) &_file_Atrjo01M, + /*0x0518*/ (u32) &_file_Atrgrim01M, + /*0x0519*/ (u32) &_file_Atrgrim02M, + /*0x051a*/ (u32) &_file_Atrcarr06M, + /*0x051b*/ (u32) &_file_Atrcarr07M, + /*0x051c*/ (u32) &_file_Atrcarr08M, + /*0x051d*/ (u32) &_file_Atrcarr01M, + /*0x051e*/ (u32) &_file_Atrcarr02M, + /*0x051f*/ (u32) &_file_Atrcarr03M, + /*0x0520*/ (u32) &_file_Atrcarr04M, + /*0x0521*/ (u32) &_file_Atrcarr05M, + /*0x0522*/ (u32) &_file_Atrcarr12M, + /*0x0523*/ (u32) &_file_Abnblde01M, + /*0x0524*/ (u32) &_file_Abncass01M, + /*0x0525*/ (u32) &_file_Pcidoor1Z, + /*0x0526*/ (u32) &_file_Pg5_chairZ, + /*0x0527*/ (u32) &_file_Pg5_chair2Z, + /*0x0528*/ (u32) &_file_Pdd_window_foyerZ, + /*0x0529*/ (u32) &_file_Ghand_jowetsuitZ, + /*0x052a*/ (u32) &_file_Ghand_trentZ, + /*0x052b*/ (u32) &_file_Ghand_jofrockZ, + /*0x052c*/ (u32) &_file_Ghand_jotrenchZ, + /*0x052d*/ (u32) &_file_Ghand_ddsniperZ, + /*0x052e*/ (u32) &_file_Ghand_presidentZ, + /*0x052f*/ (u32) &_file_Ghand_joaf1Z, + /*0x0530*/ (u32) &_file_Ghand_jopilotZ, + /*0x0531*/ (u32) &_file_Ghand_carringtonZ, + /*0x0532*/ (u32) &_file_Ghand_mrblondeZ, + /*0x0533*/ (u32) &_file_Ghand_ciaZ, + /*0x0534*/ (u32) &_file_Ghand_cifemtechZ, + /*0x0535*/ (u32) &_file_Ghand_fbiarmZ, + /*0x0536*/ (u32) &_file_Ghand_josnowZ, + /*0x0537*/ (u32) &_file_Ghand_vriesZ, + /*0x0538*/ (u32) &_file_Ghand_ddsecurityZ, + /*0x0539*/ (u32) &_file_Ghand_tragic_pelagicZ, + /*0x053a*/ (u32) &_file_Ghand_stewardess_coatZ, + /*0x053b*/ (u32) &_file_Ghand_ddlabtechZ, + /*0x053c*/ (u32) &_file_Pci_cabinetZ, + /*0x053d*/ (u32) &_file_Pci_deskZ, + /*0x053e*/ (u32) &_file_Pci_carr_deskZ, + /*0x053f*/ (u32) &_file_Pci_f_chairZ, + /*0x0540*/ (u32) &_file_Pci_loungerZ, + /*0x0541*/ (u32) &_file_Pci_f_sofaZ, + /*0x0542*/ (u32) &_file_Pci_tableZ, + /*0x0543*/ (u32) &_file_Pcv_coffee_tableZ, + /*0x0544*/ (u32) &_file_Pcv_chair1Z, + /*0x0545*/ (u32) &_file_Pcv_chair2Z, + /*0x0546*/ (u32) &_file_Pcv_sofaZ, + /*0x0547*/ (u32) &_file_Pcv_chair4Z, + /*0x0548*/ (u32) &_file_Pcv_lampZ, + /*0x0549*/ (u32) &_file_Pcv_cabinetZ, + /*0x054a*/ (u32) &_file_Pcv_f_bedZ, + /*0x054b*/ (u32) &_file_Ppel_chair1Z, + /*0x054c*/ (u32) &_file_Psk_console2Z, + /*0x054d*/ (u32) &_file_Pdd_ear_tableZ, + /*0x054e*/ (u32) &_file_Pdd_ear_chairZ, + /*0x054f*/ (u32) &_file_Pairbase_table2Z, + /*0x0550*/ (u32) &_file_Pairbase_chair2Z, + /*0x0551*/ (u32) &_file_Pmisc_crateZ, + /*0x0552*/ (u32) &_file_Pmisc_irspecsZ, + /*0x0553*/ (u32) &_file_Cheadelvis_gogsZ, + /*0x0554*/ (u32) &_file_CheadstevemZ, + /*0x0555*/ (u32) &_file_Pa51_roofgunZ, + /*0x0556*/ (u32) &_file_Psk_drone_gunZ, + /*0x0557*/ (u32) &_file_Pci_roofgunZ, + /*0x0558*/ (u32) &_file_Pcv_tableZ, + /*0x0559*/ (u32) &_file_Cdark_leatherZ, + /*0x055a*/ (u32) &_file_Cheaddark_snowZ, + /*0x055b*/ (u32) &_file_CheadpresidentZ, + /*0x055c*/ (u32) &_file_Pcidoor1_refZ, + /*0x055d*/ (u32) &_file_Palaskadoor_outZ, + /*0x055e*/ (u32) &_file_Palaskadoor_inZ, + /*0x055f*/ (u32) &_file_PwirefenceZ, + /*0x0560*/ (u32) &_file_PrarelogoZ, + /*0x0561*/ (u32) &_file_Chead_vdZ, + /*0x0562*/ (u32) &_file_Apelelv02M, + /*0x0563*/ (u32) &_file_PkeycardZ, + /*0x0564*/ (u32) &_file_PbodyarmourZ, + /*0x0565*/ (u32) &_file_Pa51gate_rZ, + /*0x0566*/ (u32) &_file_Pa51gate_lZ, + /*0x0567*/ (u32) &_file_Paf1_lampZ, + /*0x0568*/ (u32) &_file_Paf1_toiletZ, + /*0x0569*/ (u32) &_file_Paf1_doorbig2Z, + /*0x056a*/ (u32) &_file_Paf1_phoneZ, + /*0x056b*/ (u32) &_file_Paf1_cargodoorZ, + /*0x056c*/ (u32) &_file_Pg5_alarmZ, + /*0x056d*/ (u32) &_file_Pg5_laser_switchZ, + /*0x056e*/ (u32) &_file_Psk_templecolumn4Z, + /*0x056f*/ (u32) &_file_PcorehatchZ, + /*0x0570*/ (u32) &_file_LameE, + /*0x0571*/ (u32) &_file_LameJ, + /*0x0572*/ (u32) &_file_LameP, + /*0x0573*/ (u32) &_file_Lame_str_gZ, + /*0x0574*/ (u32) &_file_Lame_str_fZ, + /*0x0575*/ (u32) &_file_Lame_str_sZ, + /*0x0576*/ (u32) &_file_Lame_str_iZ, + /*0x0577*/ (u32) &_file_LarchE, + /*0x0578*/ (u32) &_file_LarchJ, + /*0x0579*/ (u32) &_file_LarchP, + /*0x057a*/ (u32) &_file_Larch_str_gZ, + /*0x057b*/ (u32) &_file_Larch_str_fZ, + /*0x057c*/ (u32) &_file_Larch_str_sZ, + /*0x057d*/ (u32) &_file_Larch_str_iZ, + /*0x057e*/ (u32) &_file_LarecE, + /*0x057f*/ (u32) &_file_LarecJ, + /*0x0580*/ (u32) &_file_LarecP, + /*0x0581*/ (u32) &_file_Larec_str_gZ, + /*0x0582*/ (u32) &_file_Larec_str_fZ, + /*0x0583*/ (u32) &_file_Larec_str_sZ, + /*0x0584*/ (u32) &_file_Larec_str_iZ, + /*0x0585*/ (u32) &_file_LarkE, + /*0x0586*/ (u32) &_file_LarkJ, + /*0x0587*/ (u32) &_file_LarkP, + /*0x0588*/ (u32) &_file_Lark_str_gZ, + /*0x0589*/ (u32) &_file_Lark_str_fZ, + /*0x058a*/ (u32) &_file_Lark_str_sZ, + /*0x058b*/ (u32) &_file_Lark_str_iZ, + /*0x058c*/ (u32) &_file_LashE, + /*0x058d*/ (u32) &_file_LashJ, + /*0x058e*/ (u32) &_file_LashP, + /*0x058f*/ (u32) &_file_Lash_str_gZ, + /*0x0590*/ (u32) &_file_Lash_str_fZ, + /*0x0591*/ (u32) &_file_Lash_str_sZ, + /*0x0592*/ (u32) &_file_Lash_str_iZ, + /*0x0593*/ (u32) &_file_LateE, + /*0x0594*/ (u32) &_file_LateJ, + /*0x0595*/ (u32) &_file_LateP, + /*0x0596*/ (u32) &_file_Late_str_gZ, + /*0x0597*/ (u32) &_file_Late_str_fZ, + /*0x0598*/ (u32) &_file_Late_str_sZ, + /*0x0599*/ (u32) &_file_Late_str_iZ, + /*0x059a*/ (u32) &_file_LaztE, + /*0x059b*/ (u32) &_file_LaztJ, + /*0x059c*/ (u32) &_file_LaztP, + /*0x059d*/ (u32) &_file_Lazt_str_gZ, + /*0x059e*/ (u32) &_file_Lazt_str_fZ, + /*0x059f*/ (u32) &_file_Lazt_str_sZ, + /*0x05a0*/ (u32) &_file_Lazt_str_iZ, + /*0x05a1*/ (u32) &_file_LcatE, + /*0x05a2*/ (u32) &_file_LcatJ, + /*0x05a3*/ (u32) &_file_LcatP, + /*0x05a4*/ (u32) &_file_Lcat_str_gZ, + /*0x05a5*/ (u32) &_file_Lcat_str_fZ, + /*0x05a6*/ (u32) &_file_Lcat_str_sZ, + /*0x05a7*/ (u32) &_file_Lcat_str_iZ, + /*0x05a8*/ (u32) &_file_LcaveE, + /*0x05a9*/ (u32) &_file_LcaveJ, + /*0x05aa*/ (u32) &_file_LcaveP, + /*0x05ab*/ (u32) &_file_Lcave_str_gZ, + /*0x05ac*/ (u32) &_file_Lcave_str_fZ, + /*0x05ad*/ (u32) &_file_Lcave_str_sZ, + /*0x05ae*/ (u32) &_file_Lcave_str_iZ, + /*0x05af*/ (u32) &_file_LcradE, + /*0x05b0*/ (u32) &_file_LcradJ, + /*0x05b1*/ (u32) &_file_LcradP, + /*0x05b2*/ (u32) &_file_Lcrad_str_gZ, + /*0x05b3*/ (u32) &_file_Lcrad_str_fZ, + /*0x05b4*/ (u32) &_file_Lcrad_str_sZ, + /*0x05b5*/ (u32) &_file_Lcrad_str_iZ, + /*0x05b6*/ (u32) &_file_LcrypE, + /*0x05b7*/ (u32) &_file_LcrypJ, + /*0x05b8*/ (u32) &_file_LcrypP, + /*0x05b9*/ (u32) &_file_Lcryp_str_gZ, + /*0x05ba*/ (u32) &_file_Lcryp_str_fZ, + /*0x05bb*/ (u32) &_file_Lcryp_str_sZ, + /*0x05bc*/ (u32) &_file_Lcryp_str_iZ, + /*0x05bd*/ (u32) &_file_LdamE, + /*0x05be*/ (u32) &_file_LdamJ, + /*0x05bf*/ (u32) &_file_LdamP, + /*0x05c0*/ (u32) &_file_Ldam_str_gZ, + /*0x05c1*/ (u32) &_file_Ldam_str_fZ, + /*0x05c2*/ (u32) &_file_Ldam_str_sZ, + /*0x05c3*/ (u32) &_file_Ldam_str_iZ, + /*0x05c4*/ (u32) &_file_LdepoE, + /*0x05c5*/ (u32) &_file_LdepoJ, + /*0x05c6*/ (u32) &_file_LdepoP, + /*0x05c7*/ (u32) &_file_Ldepo_str_gZ, + /*0x05c8*/ (u32) &_file_Ldepo_str_fZ, + /*0x05c9*/ (u32) &_file_Ldepo_str_sZ, + /*0x05ca*/ (u32) &_file_Ldepo_str_iZ, + /*0x05cb*/ (u32) &_file_LdestE, + /*0x05cc*/ (u32) &_file_LdestJ, + /*0x05cd*/ (u32) &_file_LdestP, + /*0x05ce*/ (u32) &_file_Ldest_str_gZ, + /*0x05cf*/ (u32) &_file_Ldest_str_fZ, + /*0x05d0*/ (u32) &_file_Ldest_str_sZ, + /*0x05d1*/ (u32) &_file_Ldest_str_iZ, + /*0x05d2*/ (u32) &_file_LdishE, + /*0x05d3*/ (u32) &_file_LdishJ, + /*0x05d4*/ (u32) &_file_LdishP, + /*0x05d5*/ (u32) &_file_Ldish_str_gZ, + /*0x05d6*/ (u32) &_file_Ldish_str_fZ, + /*0x05d7*/ (u32) &_file_Ldish_str_sZ, + /*0x05d8*/ (u32) &_file_Ldish_str_iZ, + /*0x05d9*/ (u32) &_file_LearE, + /*0x05da*/ (u32) &_file_LearJ, + /*0x05db*/ (u32) &_file_LearP, + /*0x05dc*/ (u32) &_file_Lear_str_gZ, + /*0x05dd*/ (u32) &_file_Lear_str_fZ, + /*0x05de*/ (u32) &_file_Lear_str_sZ, + /*0x05df*/ (u32) &_file_Lear_str_iZ, + /*0x05e0*/ (u32) &_file_LeldE, + /*0x05e1*/ (u32) &_file_LeldJ, + /*0x05e2*/ (u32) &_file_LeldP, + /*0x05e3*/ (u32) &_file_Leld_str_gZ, + /*0x05e4*/ (u32) &_file_Leld_str_fZ, + /*0x05e5*/ (u32) &_file_Leld_str_sZ, + /*0x05e6*/ (u32) &_file_Leld_str_iZ, + /*0x05e7*/ (u32) &_file_LgunE, + /*0x05e8*/ (u32) &_file_LgunJ, + /*0x05e9*/ (u32) &_file_LgunP, + /*0x05ea*/ (u32) &_file_Lgun_str_gZ, + /*0x05eb*/ (u32) &_file_Lgun_str_fZ, + /*0x05ec*/ (u32) &_file_Lgun_str_sZ, + /*0x05ed*/ (u32) &_file_Lgun_str_iZ, + /*0x05ee*/ (u32) &_file_LimpE, + /*0x05ef*/ (u32) &_file_LimpJ, + /*0x05f0*/ (u32) &_file_LimpP, + /*0x05f1*/ (u32) &_file_Limp_str_gZ, + /*0x05f2*/ (u32) &_file_Limp_str_fZ, + /*0x05f3*/ (u32) &_file_Limp_str_sZ, + /*0x05f4*/ (u32) &_file_Limp_str_iZ, + /*0x05f5*/ (u32) &_file_LjunE, + /*0x05f6*/ (u32) &_file_LjunJ, + /*0x05f7*/ (u32) &_file_LjunP, + /*0x05f8*/ (u32) &_file_Ljun_str_gZ, + /*0x05f9*/ (u32) &_file_Ljun_str_fZ, + /*0x05fa*/ (u32) &_file_Ljun_str_sZ, + /*0x05fb*/ (u32) &_file_Ljun_str_iZ, + /*0x05fc*/ (u32) &_file_LlamE, + /*0x05fd*/ (u32) &_file_LlamJ, + /*0x05fe*/ (u32) &_file_LlamP, + /*0x05ff*/ (u32) &_file_Llam_str_gZ, + /*0x0600*/ (u32) &_file_Llam_str_fZ, + /*0x0601*/ (u32) &_file_Llam_str_sZ, + /*0x0602*/ (u32) &_file_Llam_str_iZ, + /*0x0603*/ (u32) &_file_LleeE, + /*0x0604*/ (u32) &_file_LleeJ, + /*0x0605*/ (u32) &_file_LleeP, + /*0x0606*/ (u32) &_file_Llee_str_gZ, + /*0x0607*/ (u32) &_file_Llee_str_fZ, + /*0x0608*/ (u32) &_file_Llee_str_sZ, + /*0x0609*/ (u32) &_file_Llee_str_iZ, + /*0x060a*/ (u32) &_file_LlenE, + /*0x060b*/ (u32) &_file_LlenJ, + /*0x060c*/ (u32) &_file_LlenP, + /*0x060d*/ (u32) &_file_Llen_str_gZ, + /*0x060e*/ (u32) &_file_Llen_str_fZ, + /*0x060f*/ (u32) &_file_Llen_str_sZ, + /*0x0610*/ (u32) &_file_Llen_str_iZ, + /*0x0611*/ (u32) &_file_LlipE, + /*0x0612*/ (u32) &_file_LlipJ, + /*0x0613*/ (u32) &_file_LlipP, + /*0x0614*/ (u32) &_file_Llip_str_gZ, + /*0x0615*/ (u32) &_file_Llip_str_fZ, + /*0x0616*/ (u32) &_file_Llip_str_sZ, + /*0x0617*/ (u32) &_file_Llip_str_iZ, + /*0x0618*/ (u32) &_file_LlueE, + /*0x0619*/ (u32) &_file_LlueJ, + /*0x061a*/ (u32) &_file_LlueP, + /*0x061b*/ (u32) &_file_Llue_str_gZ, + /*0x061c*/ (u32) &_file_Llue_str_fZ, + /*0x061d*/ (u32) &_file_Llue_str_sZ, + /*0x061e*/ (u32) &_file_Llue_str_iZ, + /*0x061f*/ (u32) &_file_LmiscE, + /*0x0620*/ (u32) &_file_LmiscJ, + /*0x0621*/ (u32) &_file_LmiscP, + /*0x0622*/ (u32) &_file_Lmisc_str_gZ, + /*0x0623*/ (u32) &_file_Lmisc_str_fZ, + /*0x0624*/ (u32) &_file_Lmisc_str_sZ, + /*0x0625*/ (u32) &_file_Lmisc_str_iZ, + /*0x0626*/ (u32) &_file_Lmp10E, + /*0x0627*/ (u32) &_file_Lmp10J, + /*0x0628*/ (u32) &_file_Lmp10P, + /*0x0629*/ (u32) &_file_Lmp10_str_gZ, + /*0x062a*/ (u32) &_file_Lmp10_str_fZ, + /*0x062b*/ (u32) &_file_Lmp10_str_sZ, + /*0x062c*/ (u32) &_file_Lmp10_str_iZ, + /*0x062d*/ (u32) &_file_Lmp11E, + /*0x062e*/ (u32) &_file_Lmp11J, + /*0x062f*/ (u32) &_file_Lmp11P, + /*0x0630*/ (u32) &_file_Lmp11_str_gZ, + /*0x0631*/ (u32) &_file_Lmp11_str_fZ, + /*0x0632*/ (u32) &_file_Lmp11_str_sZ, + /*0x0633*/ (u32) &_file_Lmp11_str_iZ, + /*0x0634*/ (u32) &_file_Lmp12E, + /*0x0635*/ (u32) &_file_Lmp12J, + /*0x0636*/ (u32) &_file_Lmp12P, + /*0x0637*/ (u32) &_file_Lmp12_str_gZ, + /*0x0638*/ (u32) &_file_Lmp12_str_fZ, + /*0x0639*/ (u32) &_file_Lmp12_str_sZ, + /*0x063a*/ (u32) &_file_Lmp12_str_iZ, + /*0x063b*/ (u32) &_file_Lmp13E, + /*0x063c*/ (u32) &_file_Lmp13J, + /*0x063d*/ (u32) &_file_Lmp13P, + /*0x063e*/ (u32) &_file_Lmp13_str_gZ, + /*0x063f*/ (u32) &_file_Lmp13_str_fZ, + /*0x0640*/ (u32) &_file_Lmp13_str_sZ, + /*0x0641*/ (u32) &_file_Lmp13_str_iZ, + /*0x0642*/ (u32) &_file_Lmp14E, + /*0x0643*/ (u32) &_file_Lmp14J, + /*0x0644*/ (u32) &_file_Lmp14P, + /*0x0645*/ (u32) &_file_Lmp14_str_gZ, + /*0x0646*/ (u32) &_file_Lmp14_str_fZ, + /*0x0647*/ (u32) &_file_Lmp14_str_sZ, + /*0x0648*/ (u32) &_file_Lmp14_str_iZ, + /*0x0649*/ (u32) &_file_Lmp15E, + /*0x064a*/ (u32) &_file_Lmp15J, + /*0x064b*/ (u32) &_file_Lmp15P, + /*0x064c*/ (u32) &_file_Lmp15_str_gZ, + /*0x064d*/ (u32) &_file_Lmp15_str_fZ, + /*0x064e*/ (u32) &_file_Lmp15_str_sZ, + /*0x064f*/ (u32) &_file_Lmp15_str_iZ, + /*0x0650*/ (u32) &_file_Lmp16E, + /*0x0651*/ (u32) &_file_Lmp16J, + /*0x0652*/ (u32) &_file_Lmp16P, + /*0x0653*/ (u32) &_file_Lmp16_str_gZ, + /*0x0654*/ (u32) &_file_Lmp16_str_fZ, + /*0x0655*/ (u32) &_file_Lmp16_str_sZ, + /*0x0656*/ (u32) &_file_Lmp16_str_iZ, + /*0x0657*/ (u32) &_file_Lmp17E, + /*0x0658*/ (u32) &_file_Lmp17J, + /*0x0659*/ (u32) &_file_Lmp17P, + /*0x065a*/ (u32) &_file_Lmp17_str_gZ, + /*0x065b*/ (u32) &_file_Lmp17_str_fZ, + /*0x065c*/ (u32) &_file_Lmp17_str_sZ, + /*0x065d*/ (u32) &_file_Lmp17_str_iZ, + /*0x065e*/ (u32) &_file_Lmp18E, + /*0x065f*/ (u32) &_file_Lmp18J, + /*0x0660*/ (u32) &_file_Lmp18P, + /*0x0661*/ (u32) &_file_Lmp18_str_gZ, + /*0x0662*/ (u32) &_file_Lmp18_str_fZ, + /*0x0663*/ (u32) &_file_Lmp18_str_sZ, + /*0x0664*/ (u32) &_file_Lmp18_str_iZ, + /*0x0665*/ (u32) &_file_Lmp19E, + /*0x0666*/ (u32) &_file_Lmp19J, + /*0x0667*/ (u32) &_file_Lmp19P, + /*0x0668*/ (u32) &_file_Lmp19_str_gZ, + /*0x0669*/ (u32) &_file_Lmp19_str_fZ, + /*0x066a*/ (u32) &_file_Lmp19_str_sZ, + /*0x066b*/ (u32) &_file_Lmp19_str_iZ, + /*0x066c*/ (u32) &_file_Lmp1E, + /*0x066d*/ (u32) &_file_Lmp1J, + /*0x066e*/ (u32) &_file_Lmp1P, + /*0x066f*/ (u32) &_file_Lmp1_str_gZ, + /*0x0670*/ (u32) &_file_Lmp1_str_fZ, + /*0x0671*/ (u32) &_file_Lmp1_str_sZ, + /*0x0672*/ (u32) &_file_Lmp1_str_iZ, + /*0x0673*/ (u32) &_file_Lmp20E, + /*0x0674*/ (u32) &_file_Lmp20J, + /*0x0675*/ (u32) &_file_Lmp20P, + /*0x0676*/ (u32) &_file_Lmp20_str_gZ, + /*0x0677*/ (u32) &_file_Lmp20_str_fZ, + /*0x0678*/ (u32) &_file_Lmp20_str_sZ, + /*0x0679*/ (u32) &_file_Lmp20_str_iZ, + /*0x067a*/ (u32) &_file_Lmp2E, + /*0x067b*/ (u32) &_file_Lmp2J, + /*0x067c*/ (u32) &_file_Lmp2P, + /*0x067d*/ (u32) &_file_Lmp2_str_gZ, + /*0x067e*/ (u32) &_file_Lmp2_str_fZ, + /*0x067f*/ (u32) &_file_Lmp2_str_sZ, + /*0x0680*/ (u32) &_file_Lmp2_str_iZ, + /*0x0681*/ (u32) &_file_Lmp3E, + /*0x0682*/ (u32) &_file_Lmp3J, + /*0x0683*/ (u32) &_file_Lmp3P, + /*0x0684*/ (u32) &_file_Lmp3_str_gZ, + /*0x0685*/ (u32) &_file_Lmp3_str_fZ, + /*0x0686*/ (u32) &_file_Lmp3_str_sZ, + /*0x0687*/ (u32) &_file_Lmp3_str_iZ, + /*0x0688*/ (u32) &_file_Lmp4E, + /*0x0689*/ (u32) &_file_Lmp4J, + /*0x068a*/ (u32) &_file_Lmp4P, + /*0x068b*/ (u32) &_file_Lmp4_str_gZ, + /*0x068c*/ (u32) &_file_Lmp4_str_fZ, + /*0x068d*/ (u32) &_file_Lmp4_str_sZ, + /*0x068e*/ (u32) &_file_Lmp4_str_iZ, + /*0x068f*/ (u32) &_file_Lmp5E, + /*0x0690*/ (u32) &_file_Lmp5J, + /*0x0691*/ (u32) &_file_Lmp5P, + /*0x0692*/ (u32) &_file_Lmp5_str_gZ, + /*0x0693*/ (u32) &_file_Lmp5_str_fZ, + /*0x0694*/ (u32) &_file_Lmp5_str_sZ, + /*0x0695*/ (u32) &_file_Lmp5_str_iZ, + /*0x0696*/ (u32) &_file_Lmp6E, + /*0x0697*/ (u32) &_file_Lmp6J, + /*0x0698*/ (u32) &_file_Lmp6P, + /*0x0699*/ (u32) &_file_Lmp6_str_gZ, + /*0x069a*/ (u32) &_file_Lmp6_str_fZ, + /*0x069b*/ (u32) &_file_Lmp6_str_sZ, + /*0x069c*/ (u32) &_file_Lmp6_str_iZ, + /*0x069d*/ (u32) &_file_Lmp7E, + /*0x069e*/ (u32) &_file_Lmp7J, + /*0x069f*/ (u32) &_file_Lmp7P, + /*0x06a0*/ (u32) &_file_Lmp7_str_gZ, + /*0x06a1*/ (u32) &_file_Lmp7_str_fZ, + /*0x06a2*/ (u32) &_file_Lmp7_str_sZ, + /*0x06a3*/ (u32) &_file_Lmp7_str_iZ, + /*0x06a4*/ (u32) &_file_Lmp8E, + /*0x06a5*/ (u32) &_file_Lmp8J, + /*0x06a6*/ (u32) &_file_Lmp8P, + /*0x06a7*/ (u32) &_file_Lmp8_str_gZ, + /*0x06a8*/ (u32) &_file_Lmp8_str_fZ, + /*0x06a9*/ (u32) &_file_Lmp8_str_sZ, + /*0x06aa*/ (u32) &_file_Lmp8_str_iZ, + /*0x06ab*/ (u32) &_file_Lmp9E, + /*0x06ac*/ (u32) &_file_Lmp9J, + /*0x06ad*/ (u32) &_file_Lmp9P, + /*0x06ae*/ (u32) &_file_Lmp9_str_gZ, + /*0x06af*/ (u32) &_file_Lmp9_str_fZ, + /*0x06b0*/ (u32) &_file_Lmp9_str_sZ, + /*0x06b1*/ (u32) &_file_Lmp9_str_iZ, + /*0x06b2*/ (u32) &_file_LmpmenuE, + /*0x06b3*/ (u32) &_file_LmpmenuJ, + /*0x06b4*/ (u32) &_file_LmpmenuP, + /*0x06b5*/ (u32) &_file_Lmpmenu_str_gZ, + /*0x06b6*/ (u32) &_file_Lmpmenu_str_fZ, + /*0x06b7*/ (u32) &_file_Lmpmenu_str_sZ, + /*0x06b8*/ (u32) &_file_Lmpmenu_str_iZ, + /*0x06b9*/ (u32) &_file_LmpweaponsE, + /*0x06ba*/ (u32) &_file_LmpweaponsJ, + /*0x06bb*/ (u32) &_file_LmpweaponsP, + /*0x06bc*/ (u32) &_file_Lmpweapons_str_gZ, + /*0x06bd*/ (u32) &_file_Lmpweapons_str_fZ, + /*0x06be*/ (u32) &_file_Lmpweapons_str_sZ, + /*0x06bf*/ (u32) &_file_Lmpweapons_str_iZ, + /*0x06c0*/ (u32) &_file_LoatE, + /*0x06c1*/ (u32) &_file_LoatJ, + /*0x06c2*/ (u32) &_file_LoatP, + /*0x06c3*/ (u32) &_file_Loat_str_gZ, + /*0x06c4*/ (u32) &_file_Loat_str_fZ, + /*0x06c5*/ (u32) &_file_Loat_str_sZ, + /*0x06c6*/ (u32) &_file_Loat_str_iZ, + /*0x06c7*/ (u32) &_file_LoldE, + /*0x06c8*/ (u32) &_file_LoldJ, + /*0x06c9*/ (u32) &_file_LoldP, + /*0x06ca*/ (u32) &_file_Lold_str_gZ, + /*0x06cb*/ (u32) &_file_Lold_str_fZ, + /*0x06cc*/ (u32) &_file_Lold_str_sZ, + /*0x06cd*/ (u32) &_file_Lold_str_iZ, + /*0x06ce*/ (u32) &_file_LoptionsE, + /*0x06cf*/ (u32) &_file_LoptionsJ, + /*0x06d0*/ (u32) &_file_LoptionsP, + /*0x06d1*/ (u32) &_file_Loptions_str_gZ, + /*0x06d2*/ (u32) &_file_Loptions_str_fZ, + /*0x06d3*/ (u32) &_file_Loptions_str_sZ, + /*0x06d4*/ (u32) &_file_Loptions_str_iZ, + /*0x06d5*/ (u32) &_file_LpamE, + /*0x06d6*/ (u32) &_file_LpamJ, + /*0x06d7*/ (u32) &_file_LpamP, + /*0x06d8*/ (u32) &_file_Lpam_str_gZ, + /*0x06d9*/ (u32) &_file_Lpam_str_fZ, + /*0x06da*/ (u32) &_file_Lpam_str_sZ, + /*0x06db*/ (u32) &_file_Lpam_str_iZ, + /*0x06dc*/ (u32) &_file_LpeteE, + /*0x06dd*/ (u32) &_file_LpeteJ, + /*0x06de*/ (u32) &_file_LpeteP, + /*0x06df*/ (u32) &_file_Lpete_str_gZ, + /*0x06e0*/ (u32) &_file_Lpete_str_fZ, + /*0x06e1*/ (u32) &_file_Lpete_str_sZ, + /*0x06e2*/ (u32) &_file_Lpete_str_iZ, + /*0x06e3*/ (u32) &_file_LpropobjE, + /*0x06e4*/ (u32) &_file_LpropobjJ, + /*0x06e5*/ (u32) &_file_LpropobjP, + /*0x06e6*/ (u32) &_file_Lpropobj_str_gZ, + /*0x06e7*/ (u32) &_file_Lpropobj_str_fZ, + /*0x06e8*/ (u32) &_file_Lpropobj_str_sZ, + /*0x06e9*/ (u32) &_file_Lpropobj_str_iZ, + /*0x06ea*/ (u32) &_file_LrefE, + /*0x06eb*/ (u32) &_file_LrefJ, + /*0x06ec*/ (u32) &_file_LrefP, + /*0x06ed*/ (u32) &_file_Lref_str_gZ, + /*0x06ee*/ (u32) &_file_Lref_str_fZ, + /*0x06ef*/ (u32) &_file_Lref_str_sZ, + /*0x06f0*/ (u32) &_file_Lref_str_iZ, + /*0x06f1*/ (u32) &_file_LritE, + /*0x06f2*/ (u32) &_file_LritJ, + /*0x06f3*/ (u32) &_file_LritP, + /*0x06f4*/ (u32) &_file_Lrit_str_gZ, + /*0x06f5*/ (u32) &_file_Lrit_str_fZ, + /*0x06f6*/ (u32) &_file_Lrit_str_sZ, + /*0x06f7*/ (u32) &_file_Lrit_str_iZ, + /*0x06f8*/ (u32) &_file_LrunE, + /*0x06f9*/ (u32) &_file_LrunJ, + /*0x06fa*/ (u32) &_file_LrunP, + /*0x06fb*/ (u32) &_file_Lrun_str_gZ, + /*0x06fc*/ (u32) &_file_Lrun_str_fZ, + /*0x06fd*/ (u32) &_file_Lrun_str_sZ, + /*0x06fe*/ (u32) &_file_Lrun_str_iZ, + /*0x06ff*/ (u32) &_file_LsevE, + /*0x0700*/ (u32) &_file_LsevJ, + /*0x0701*/ (u32) &_file_LsevP, + /*0x0702*/ (u32) &_file_Lsev_str_gZ, + /*0x0703*/ (u32) &_file_Lsev_str_fZ, + /*0x0704*/ (u32) &_file_Lsev_str_sZ, + /*0x0705*/ (u32) &_file_Lsev_str_iZ, + /*0x0706*/ (u32) &_file_LsevbE, + /*0x0707*/ (u32) &_file_LsevbJ, + /*0x0708*/ (u32) &_file_LsevbP, + /*0x0709*/ (u32) &_file_Lsevb_str_gZ, + /*0x070a*/ (u32) &_file_Lsevb_str_fZ, + /*0x070b*/ (u32) &_file_Lsevb_str_sZ, + /*0x070c*/ (u32) &_file_Lsevb_str_iZ, + /*0x070d*/ (u32) &_file_LsevxE, + /*0x070e*/ (u32) &_file_LsevxJ, + /*0x070f*/ (u32) &_file_LsevxP, + /*0x0710*/ (u32) &_file_Lsevx_str_gZ, + /*0x0711*/ (u32) &_file_Lsevx_str_fZ, + /*0x0712*/ (u32) &_file_Lsevx_str_sZ, + /*0x0713*/ (u32) &_file_Lsevx_str_iZ, + /*0x0714*/ (u32) &_file_LsevxbE, + /*0x0715*/ (u32) &_file_LsevxbJ, + /*0x0716*/ (u32) &_file_LsevxbP, + /*0x0717*/ (u32) &_file_Lsevxb_str_gZ, + /*0x0718*/ (u32) &_file_Lsevxb_str_fZ, + /*0x0719*/ (u32) &_file_Lsevxb_str_sZ, + /*0x071a*/ (u32) &_file_Lsevxb_str_iZ, + /*0x071b*/ (u32) &_file_LshoE, + /*0x071c*/ (u32) &_file_LshoJ, + /*0x071d*/ (u32) &_file_LshoP, + /*0x071e*/ (u32) &_file_Lsho_str_gZ, + /*0x071f*/ (u32) &_file_Lsho_str_fZ, + /*0x0720*/ (u32) &_file_Lsho_str_sZ, + /*0x0721*/ (u32) &_file_Lsho_str_iZ, + /*0x0722*/ (u32) &_file_LsiloE, + /*0x0723*/ (u32) &_file_LsiloJ, + /*0x0724*/ (u32) &_file_LsiloP, + /*0x0725*/ (u32) &_file_Lsilo_str_gZ, + /*0x0726*/ (u32) &_file_Lsilo_str_fZ, + /*0x0727*/ (u32) &_file_Lsilo_str_sZ, + /*0x0728*/ (u32) &_file_Lsilo_str_iZ, + /*0x0729*/ (u32) &_file_LstatE, + /*0x072a*/ (u32) &_file_LstatJ, + /*0x072b*/ (u32) &_file_LstatP, + /*0x072c*/ (u32) &_file_Lstat_str_gZ, + /*0x072d*/ (u32) &_file_Lstat_str_fZ, + /*0x072e*/ (u32) &_file_Lstat_str_sZ, + /*0x072f*/ (u32) &_file_Lstat_str_iZ, + /*0x0730*/ (u32) &_file_LtitleE, + /*0x0731*/ (u32) &_file_LtitleJ, + /*0x0732*/ (u32) &_file_LtitleP, + /*0x0733*/ (u32) &_file_Ltitle_str_gZ, + /*0x0734*/ (u32) &_file_Ltitle_str_fZ, + /*0x0735*/ (u32) &_file_Ltitle_str_sZ, + /*0x0736*/ (u32) &_file_Ltitle_str_iZ, + /*0x0737*/ (u32) &_file_LtraE, + /*0x0738*/ (u32) &_file_LtraJ, + /*0x0739*/ (u32) &_file_LtraP, + /*0x073a*/ (u32) &_file_Ltra_str_gZ, + /*0x073b*/ (u32) &_file_Ltra_str_fZ, + /*0x073c*/ (u32) &_file_Ltra_str_sZ, + /*0x073d*/ (u32) &_file_Ltra_str_iZ, + /*0x073e*/ (u32) &_file_LuffE, + /*0x073f*/ (u32) &_file_LuffJ, + /*0x0740*/ (u32) &_file_LuffP, + /*0x0741*/ (u32) &_file_Luff_str_gZ, + /*0x0742*/ (u32) &_file_Luff_str_fZ, + /*0x0743*/ (u32) &_file_Luff_str_sZ, + /*0x0744*/ (u32) &_file_Luff_str_iZ, + /*0x0745*/ (u32) &_file_LwaxE, + /*0x0746*/ (u32) &_file_LwaxJ, + /*0x0747*/ (u32) &_file_LwaxP, + /*0x0748*/ (u32) &_file_Lwax_str_gZ, + /*0x0749*/ (u32) &_file_Lwax_str_fZ, + /*0x074a*/ (u32) &_file_Lwax_str_sZ, + /*0x074b*/ (u32) &_file_Lwax_str_iZ, + /*0x074c*/ (u32) &_file_Pa51grateZ, + /*0x074d*/ (u32) &_file_GecmmineZ, + /*0x074e*/ (u32) &_file_GcommsuplinkZ, + /*0x074f*/ (u32) &_file_GirscannerZ, + /*0x0750*/ (u32) &_file_Paf1escapedoorZ, + /*0x0751*/ (u32) &_file_PprescapsuleZ, + /*0x0752*/ (u32) &_file_PskedarbridgeZ, + /*0x0753*/ (u32) &_file_Ppelagicdoor2Z, + /*0x0754*/ (u32) &_file_Avault2M, + /*0x0755*/ (u32) &_file_Ap29_12_elM, + /*0x0756*/ (u32) &_file_Pttb_boxZ, + /*0x0757*/ (u32) &_file_PinstfrontdoorZ, + /*0x0758*/ (u32) &_file_Ap14_09_joM, + /*0x0759*/ (u32) &_file_Ap19_07_joM, + /*0x075a*/ (u32) &_file_Ap19_08_joM, + /*0x075b*/ (u32) &_file_PchrlaserZ, + /*0x075c*/ (u32) &_file_PbaftaZ, + /*0x075d*/ (u32) &_file_PchrsonicscrewerZ, + /*0x075e*/ (u32) &_file_PchrlumphammerZ, + /*0x075f*/ (u32) &_file_PskedarbombZ, + /*0x0760*/ (u32) &_file_PexplosivebrickZ, + /*0x0761*/ (u32) &_file_PresearchtapeZ, + /*0x0762*/ (u32) &_file_PziggycardZ, + /*0x0763*/ (u32) &_file_PsafeitemZ, + /*0x0764*/ (u32) &_file_Ghand_elvisZ, + /*0x0765*/ (u32) &_file_Paf1_tableZ, + /*0x0766*/ (u32) &_file_Ghand_a51guardZ, + /*0x0767*/ (u32) &_file_Ghand_ddshockZ, + /*0x0768*/ (u32) &_file_Ghand_blackguardZ, + /*0x0769*/ (u32) &_file_Ghand_ddfodderZ, + /*0x076a*/ (u32) &_file_Ghand_ddbioZ, + /*0x076b*/ (u32) &_file_Ghand_a51airmanZ, + /*0x076c*/ (u32) &_file_Ghand_g5guardZ, + /*0x076d*/ (u32) &_file_Ghand_cisoldierZ, + /*0x076e*/ (u32) &_file_PsensitiveinfoZ, + /*0x076f*/ (u32) &_file_PrussdarZ, + /*0x0770*/ (u32) &_file_PxrayspecsZ, + /*0x0771*/ (u32) &_file_PchreyespyZ, + /*0x0772*/ (u32) &_file_PchrdoordecoderZ, + /*0x0773*/ (u32) &_file_PbriefcaseZ, + /*0x0774*/ (u32) &_file_PsuitcaseZ, + /*0x0775*/ (u32) &_file_PshuttledoorZ, + /*0x0776*/ (u32) &_file_PruinbridgeZ, + /*0x0777*/ (u32) &_file_PsecretindoorZ, + /*0x0778*/ (u32) &_file_PskpuzzleobjectZ, + /*0x0779*/ (u32) &_file_Pa51liftdoorZ, + /*0x077a*/ (u32) &_file_Acicarr06M, + /*0x077b*/ (u32) &_file_Acicarr11M, + /*0x077c*/ (u32) &_file_Acifarr08M, + /*0x077d*/ (u32) &_file_Acifarr12M, + /*0x077e*/ (u32) &_file_Acifema01M, + /*0x077f*/ (u32) &_file_Acifema04M, + /*0x0780*/ (u32) &_file_Acifema07M, + /*0x0781*/ (u32) &_file_Acifema08M, + /*0x0782*/ (u32) &_file_Acifema09M, + /*0x0783*/ (u32) &_file_Acifema14M, + /*0x0784*/ (u32) &_file_Acifost08M, + /*0x0785*/ (u32) &_file_Acifost12M, + /*0x0786*/ (u32) &_file_Acigrim05M, + /*0x0787*/ (u32) &_file_Acigrim06M, + /*0x0788*/ (u32) &_file_Acigrim07M, + /*0x0789*/ (u32) &_file_Acigrim08M, + /*0x078a*/ (u32) &_file_Acigrim09M, + /*0x078b*/ (u32) &_file_Acigrim10M, + /*0x078c*/ (u32) &_file_Acihopk09M, + /*0x078d*/ (u32) &_file_Acihopk11M, + /*0x078e*/ (u32) &_file_Acimale02M, + /*0x078f*/ (u32) &_file_Acimale03M, + /*0x0790*/ (u32) &_file_Acimale07M, + /*0x0791*/ (u32) &_file_Acimale09M, + /*0x0792*/ (u32) &_file_Acimale11M, + /*0x0793*/ (u32) &_file_Acimale13M, + /*0x0794*/ (u32) &_file_Aciroge08M, + /*0x0795*/ (u32) &_file_Aciroge12M, + /*0x0796*/ (u32) &_file_Cdark_negotiatorZ, + /*0x0797*/ (u32) &_file_PcihubZ, + /*0x0798*/ (u32) &_file_Psk_ship_door2Z, + /*0x0799*/ (u32) &_file_Psk_window1Z, + /*0x079a*/ (u32) &_file_Psk_hangardoorb_topZ, + /*0x079b*/ (u32) &_file_Psk_hangardoorb_botZ, + /*0x079c*/ (u32) &_file_Paf1_innerdoorZ, + /*0x079d*/ (u32) &_file_Plaser_postZ, + /*0x079e*/ (u32) &_file_Atrfost01M, + /*0x079f*/ (u32) &_file_Atrfost02M, + /*0x07a0*/ (u32) &_file_Atrfost03M, + /*0x07a1*/ (u32) &_file_Atrcarr09M, + /*0x07a2*/ (u32) &_file_Atrcarr10M, + /*0x07a3*/ (u32) &_file_Atrcarr11M, + /*0x07a4*/ (u32) &_file_Acifarr01M, + /*0x07a5*/ (u32) &_file_Acifarr02M, + /*0x07a6*/ (u32) &_file_Acifarr03M, + /*0x07a7*/ (u32) &_file_Acigrim01M, + /*0x07a8*/ (u32) &_file_Acigrim03M, + /*0x07a9*/ (u32) &_file_Acigrim04M, + /*0x07aa*/ (u32) &_file_Acihopk01M, + /*0x07ab*/ (u32) &_file_Acihopk04M, + /*0x07ac*/ (u32) &_file_Acihopk06M, + /*0x07ad*/ (u32) &_file_Aciroge01M, + /*0x07ae*/ (u32) &_file_Aciroge02M, + /*0x07af*/ (u32) &_file_Atrroge01M, + /*0x07b0*/ (u32) &_file_Acicarr07M, + /*0x07b1*/ (u32) &_file_Acicarr08M, + /*0x07b2*/ (u32) &_file_PtargetampZ, + /*0x07b3*/ (u32) &_file_Psk_liftZ, + /*0x07b4*/ (u32) &_file_PknockknockZ, + /*0x07b5*/ (u32) &_file_PcetandoorZ, + /*0x07b6*/ (u32) &_file_Ajoinst01M, + /*0x07b7*/ (u32) &_file_Ajoinst02M, + /*0x07b8*/ (u32) &_file_Ajoinst03M, + /*0x07b9*/ (u32) &_file_Ajoinst04M, + /*0x07ba*/ (u32) &_file_Ap25_03_joM, + /*0x07bb*/ (u32) &_file_Paf1rubbleZ, + /*0x07bc*/ (u32) &_file_Pdd_dr_nonrefZ, + /*0x07bd*/ (u32) &_file_CheadtimZ, + /*0x07be*/ (u32) &_file_CheadgrantZ, + /*0x07bf*/ (u32) &_file_CheadpennyZ, + /*0x07c0*/ (u32) &_file_CheadrobinZ, + /*0x07c1*/ (u32) &_file_CheadalexZ, + /*0x07c2*/ (u32) &_file_CheadjulianneZ, + /*0x07c3*/ (u32) &_file_CheadlauraZ, + /*0x07c4*/ (u32) &_file_CheaddavecZ, + /*0x07c5*/ (u32) &_file_CheadkenZ, + /*0x07c6*/ (u32) &_file_CheadjoelZ, + /*0x07c7*/ (u32) &_file_PcetandoorsideZ, + /*0x07c8*/ (u32) &_file_Ap29_13_joM, + /*0x07c9*/ (u32) &_file_Ap29_14_joM, + /*0x07ca*/ (u32) &_file_Acicarr09M, + /*0x07cb*/ (u32) &_file_Acicarr10M, + /*0x07cc*/ (u32) &_file_PbuddybridgeZ, + /*0x07cd*/ (u32) &_file_CheadcookZ, + /*0x07ce*/ (u32) &_file_CheadpryceZ, + /*0x07cf*/ (u32) &_file_CheadsilkeZ, + /*0x07d0*/ (u32) &_file_CheadsmithZ, + /*0x07d1*/ (u32) &_file_CheadgarethZ, + /*0x07d2*/ (u32) &_file_CheadmurchieZ, + /*0x07d3*/ (u32) &_file_CheadwongZ, + /*0x07d4*/ (u32) &_file_CheadcarterZ, + /*0x07d5*/ (u32) &_file_CheadtintinZ, + /*0x07d6*/ (u32) &_file_CheadmuntonZ, + /*0x07d7*/ (u32) &_file_CheadstamperZ, + /*0x07d8*/ (u32) &_file_CheadjonesZ, + /*0x07d9*/ (u32) &_file_CheadphelpsZ, + /*0x07da*/ (u32) &_file_Ap29_15_joM, + /*0x07db*/ (u32) &_file_Ap16_03_joM, + /*0x07dc*/ (u32) &_file_Acarrbye02M, #if VERSION >= VERSION_NTSC_1_0 - /*0x07dd*/ &_file_Asaucerexp1M, + /*0x07dd*/ (u32) &_file_Asaucerexp1M, #endif #if VERSION == VERSION_JPN_FINAL - /*0x07de*/ &_file_PjaplogoZ, - /*0x07df*/ &_file_PjappdZ, + /*0x07de*/ (u32) &_file_PjaplogoZ, + /*0x07df*/ (u32) &_file_PjappdZ, #endif - &_filenamesSegmentRomStart, + (u32) &_filenamesSegmentRomStart, }; u32 fileGetRomAddress(s32 filenum) @@ -4203,6 +4203,7 @@ void fileLoadPartToAddr(u16 filenum, void *memaddr, s32 offset, u32 len) } } +#if MATCHING #if VERSION >= VERSION_NTSC_1_0 GLOBAL_ASM( glabel fileGetInflatedSize @@ -4349,32 +4350,33 @@ glabel fileGetInflatedSize /* f161a2c: 00000000 */ sll $zero,$zero,0x0 ); #endif +#else +u32 fileGetInflatedSize(s32 filenum) +{ + u8 buffer[0x50]; + u8 *alignedbuffer; + u32 romaddr; + u32 tmp; -//u32 fileGetInflatedSize(s32 filenum) -//{ -// u8 buffer[0x50]; -// u8 *alignedbuffer; -// void *romaddr; -// u32 tmp; -// -// romaddr = g_FileTable[filenum]; -// alignedbuffer = buffer; -// -// if (romaddr == NULL) { -// alignedbuffer = (u8 *)(((u32)alignedbuffer) & ~0xf); -// -// stub0f175f58(file0f166ea8((u32 *) &g_FileTable[filenum]), (u32)alignedbuffer, 16); -// } else { -// alignedbuffer = (u8 *)(((u32)alignedbuffer) & ~0xf); -// dmaExec((void *)alignedbuffer, romaddr, 0x40); -// } -// -// if (rzipIs1173((void *)alignedbuffer)) { -// return (alignedbuffer[2] << 16) | (alignedbuffer[3] << 8) | alignedbuffer[4]; -// } -// -// return 0; -//} + romaddr = g_FileTable[filenum]; + alignedbuffer = buffer; + + if (romaddr == 0) { + alignedbuffer = (u8 *)(((u32)alignedbuffer) & ~0xf); + + stub0f175f58(file0f166ea8((u32 *) &g_FileTable[filenum]), (u32)alignedbuffer, 16); + } else { + alignedbuffer = (u8 *)(((u32)alignedbuffer) & ~0xf); + dmaExec((void *)alignedbuffer, romaddr, 0x40); + } + + if (rzipIs1173((void *)alignedbuffer)) { + return (alignedbuffer[2] << 16) | (alignedbuffer[3] << 8) | alignedbuffer[4]; + } + + return 0; +} +#endif void *fileLoadToNew(s32 filenum, u32 method) { diff --git a/src/game/game_1531a0.c b/src/game/game_1531a0.c index 7be4c2001..581eec18a 100644 --- a/src/game/game_1531a0.c +++ b/src/game/game_1531a0.c @@ -2911,6 +2911,7 @@ Gfx *func0f1574d0jf(Gfx *gdl, s32 *x, s32 *y, char *text, struct fontchar *font1 } #endif +#if MATCHING #if VERSION >= VERSION_JPN_FINAL GLOBAL_ASM( glabel textMeasure @@ -3534,99 +3535,99 @@ glabel textMeasure /* f15751c: 27bd0018 */ addiu $sp,$sp,0x18 ); #endif - +#else // Mismatch: Goal moves textheight to s0 then uses a0 for text[i] and/or // thischar. -//void textMeasure(s32 *textheight, s32 *textwidth, char *text, struct fontchar *font1, struct font *font2, s32 lineheight) -//{ -// s32 thischar; -// s32 prevchar; -// s32 longest; -// s32 i; -// s32 tmp; -// -// *textheight = 0; -// prevchar = 'H'; // Just a default - presumably chosen for its flat right edge -// longest = 0; -// *textwidth = 0; -// -// // 324 -// if (lineheight == 0) { -// lineheight = font1['['].baseline + font1['['].height; -// } -// -// // 344 -// // Force minimum height for non-English languages -// if (g_Jpn && lineheight < 14) { -// lineheight = 14; -// } -// -// // 358 -// if (text) { -// thischar = text[0]; -// -// for (i = 0; text[i] != '\0'; ) { -// // 388 -// if (thischar == ' ') { -// // Space -// if (text[i + 1] != '\n') { -// *textwidth += 5; -// } -// -// prevchar = 'H'; -// i++; -// } else /*3b4*/ if (thischar == '\n') { -// // Line break -// if (*textwidth > longest) { -// longest = *textwidth; -// } -// -// *textwidth = 0; -// *textheight += lineheight; -// i++; -// } else /*3e8*/ { -// if (thischar < 0x80) { -// // Normal single-byte character -// u8 character = thischar; -// s32 b = font1[character - 0x21].unk04; -// s32 a = font1[prevchar - 0x21].unk04; -// -// tmp = font2->unk000[b + a * 13] + var8007fac4 - 1; -// tmp = font1[character - 0x21].width + tmp; -// -// *textwidth = *textwidth - tmp; -// -// prevchar = text[i]; -// i++; -// } else /*460*/ if (thischar < 0xc0) { -// // Multi-byte character -// tmp = font2->unk000[0] + var8007fac4 - 1; -// *textwidth = *textwidth - tmp + 11; -// i += 2; -// } else { -// // Multi-byte character -// // 494 -// tmp = font2->unk000[0] + var8007fac4 - 1; -// *textwidth = *textwidth - tmp + 15; -// i += 2; -// } -// -// if (textheight); -// } -// -// thischar = text[i]; -// } -// } -// -// if (g_ScaleX == 1) { -// *textwidth *= var8007fad0; -// } -// -// // @bug? Shouldn't this go before the scale check? -// if (*textwidth < longest) { -// *textwidth = longest; -// } -//} +void textMeasure(s32 *textheight, s32 *textwidth, char *text, struct fontchar *font1, struct font *font2, s32 lineheight) +{ + s32 thischar; + s32 prevchar; + s32 longest; + s32 i; + s32 tmp; + + *textheight = 0; + prevchar = 'H'; // Just a default - presumably chosen for its flat right edge + longest = 0; + *textwidth = 0; + + // 324 + if (lineheight == 0) { + lineheight = font1['['].baseline + font1['['].height; + } + + // 344 + // Force minimum height for non-English languages + if (g_Jpn && lineheight < 14) { + lineheight = 14; + } + + // 358 + if (text) { + thischar = text[0]; + + for (i = 0; text[i] != '\0'; ) { + // 388 + if (thischar == ' ') { + // Space + if (text[i + 1] != '\n') { + *textwidth += 5; + } + + prevchar = 'H'; + i++; + } else /*3b4*/ if (thischar == '\n') { + // Line break + if (*textwidth > longest) { + longest = *textwidth; + } + + *textwidth = 0; + *textheight += lineheight; + i++; + } else /*3e8*/ { + if (thischar < 0x80) { + // Normal single-byte character + u8 character = thischar; + s32 b = font1[character - 0x21].unk04; + s32 a = font1[prevchar - 0x21].unk04; + + tmp = font2->unk000[b + a * 13] + var8007fac4 - 1; + + *textwidth = *textwidth + font1[character - 0x21].width - tmp; + + prevchar = text[i]; + i++; + } else /*460*/ if (thischar < 0xc0) { + // Multi-byte character + tmp = font2->unk000[0] + var8007fac4 - 1; + *textwidth = *textwidth - tmp + 11; + i += 2; + } else { + // Multi-byte character + // 494 + tmp = font2->unk000[0] + var8007fac4 - 1; + *textwidth = *textwidth - tmp + 15; + i += 2; + } + + if (textheight); + } + + thischar = text[i]; + } + } + + if (g_ScaleX == 1) { + *textwidth *= var8007fad0; + } + + // @bug? Shouldn't this go before the scale check? + if (*textwidth < longest) { + *textwidth = longest; + } +} +#endif #if VERSION == VERSION_JPN_FINAL bool func0f157768jf(s32 arg0, s32 arg1) diff --git a/src/game/gunfx.c b/src/game/gunfx.c index 232e1c2c1..dfccda33a 100644 --- a/src/game/gunfx.c +++ b/src/game/gunfx.c @@ -301,6 +301,7 @@ u32 var80070518 = 0x00000000; u32 var8007051c = 0x00000000; u32 var80070520 = 0x00000000; +#if MATCHING GLOBAL_ASM( glabel beamRender .late_rodata @@ -1427,313 +1428,314 @@ glabel var7f1accf4 /* f0adbb4: 03e00008 */ jr $ra /* f0adbb8: 27bd0190 */ addiu $sp,$sp,0x190 ); - +#else // Mismatch: Regalloc and some swapped loads and stores // - After gfxAllocateMatrix, goal skips f0 and uses f12 // - Goal reuses f2 in neg.s instruction for cam0f0b4e68's a1 // - Calculation of spcc near sp100 is reordered -//Gfx *beamRender(Gfx *gdl, struct beam *beam, bool arg2, u8 arg3) -//{ -// u32 stack; -// Mtxf *sp188; -// Mtxf sp148; -// -// if (arg3 < 5 && beam->age >= 0) { -// struct colour *colours = gfxAllocateColours(1); // 144 -// struct coord sp138; -// struct coord *campos = &g_Vars.currentplayer->cam_pos; // 134 -// f32 sp130; -// f32 sp12c = beam->mindist; -// struct gfxvtx *vertices; -// f32 sp124 = beam->dist; -// struct coord sp118; -// struct coord sp10c; -// struct coord sp100 = {0, 0, 0}; -// struct coord spf4 = {0, 0, 0}; -// f32 spf0 = 1.4142f; -// struct textureconfig *texconfig = &g_TexBeamConfigs[arg3]; // ec -// s32 i; -// Mtxf *worldtoscreenmtx = camGetWorldToScreenMtxf(); // e4 -// s32 j; -// u32 stack1; -// s32 spd8; -// struct coord spcc; -// u32 stack2; -// f32 spc0[2]; -// f32 spb8[2]; -// f32 f14; -// f32 f16; -// f32 f18; -// f32 spa8; -// f32 spa4; -// -// switch (beam->weaponnum) { -// case WEAPON_CYCLONE: -// texconfig = &g_TexBeamConfigs[1]; -// break; -// case WEAPON_TRANQUILIZER: -// texconfig = &g_TexBeamConfigs[3]; -// break; -// case WEAPON_MAULER: -// case WEAPON_PHOENIX: -// case WEAPON_CALLISTO: -// case WEAPON_REAPER: -// case WEAPON_FARSIGHT: -// texconfig = &g_TexBeamConfigs[4]; -// break; -// } -// -// if (beam->weaponnum == -1 || beam->weaponnum == WEAPON_CYCLONE) { -// colours[0].word = 0xffffff7f; -// } else { -// colours[0].word = 0xffffffff; -// } -// -// if (beam->weaponnum == WEAPON_LASER) { -// // Laser primary -// sp130 = 50.0f; -// texconfig = &g_TexLaserConfigs[0]; -// } else if (beam->weaponnum == -2) { -// // Laser secondary -// sp130 = 10.0f; -// texconfig = &g_TexLaserConfigs[0]; -// -// colours[0].a = 150 + (random() % 50); -// -// if ((random() % 5) == 0) { -// colours[0].r = colours[0].g = 255 - (random() % 100); -// } -// } else { -// sp130 = 30.0f; -// } -// -// if (beam->weaponnum <= -3) { -// // Mauler -// sp130 = sp130 * ((beam->weaponnum + 3) * 2.0f + 1.0f); -// texconfig = &g_TexBeamConfigs[4]; -// } -// -// sp138.f[0] = beam->from.f[0]; -// sp138.f[1] = beam->from.f[1]; -// sp138.f[2] = beam->from.f[2]; -// -// if (sp124 > 0.0f) { -// sp138.f[0] += sp124 * beam->dir.f[0]; -// sp138.f[1] += sp124 * beam->dir.f[1]; -// sp138.f[2] += sp124 * beam->dir.f[2]; -// } else { -// sp12c += sp124; -// sp124 = 0.0f; -// } -// -// if (sp124 + sp12c > beam->maxdist) { -// sp12c = beam->maxdist - sp124; -// } -// -// sp10c.f[0] = (beam->dir.f[1] * (campos->f[2] - (sp138.f[2] + sp12c * beam->dir.f[2]))) - (beam->dir.f[2] * (campos->f[1] - (sp138.f[1] + sp12c * beam->dir.f[1]))); -// sp10c.f[1] = (beam->dir.f[2] * (campos->f[0] - (sp138.f[0] + sp12c * beam->dir.f[0]))) - (beam->dir.f[0] * (campos->f[2] - (sp138.f[2] + sp12c * beam->dir.f[2]))); -// sp10c.f[2] = (beam->dir.f[0] * (campos->f[1] - (sp138.f[1] + sp12c * beam->dir.f[1]))) - (beam->dir.f[1] * (campos->f[0] - (sp138.f[0] + sp12c * beam->dir.f[0]))); -// -// if (sp10c.f[0] != 0.0f || sp10c.f[1] != 0.0f || sp10c.f[2] != 0.0f) { -// guNormalize(&sp10c.f[0], &sp10c.f[1], &sp10c.f[2]); -// -// sp10c.f[0] *= sp130; -// sp10c.f[1] *= sp130; -// sp10c.f[2] *= sp130; -// } else { -// sp10c.f[0] = 0.0f; -// sp10c.f[1] = sp130; -// sp10c.f[2] = 0.0f; -// } -// -// sp118.f[0] = beam->dir.f[1] * sp10c.f[2] - beam->dir.f[2] * sp10c.f[1]; -// sp118.f[1] = beam->dir.f[2] * sp10c.f[0] - beam->dir.f[0] * sp10c.f[2]; -// sp118.f[2] = beam->dir.f[0] * sp10c.f[1] - beam->dir.f[1] * sp10c.f[0]; -// -// guNormalize(&sp118.f[0], &sp118.f[1], &sp118.f[2]); -// -// sp118.f[0] *= sp130; -// sp118.f[1] *= sp130; -// sp118.f[2] *= sp130; -// -// if (beam->weaponnum == WEAPON_LASER) { -// vertices = gfxAllocateVertices(8); -// } else { -// vertices = gfxAllocateVertices(4); -// } -// -// sp188 = gfxAllocateMatrix(); -// -// if (sp12c > 0.0f -// && sp138.f[0] > -32000.0f && sp138.f[0] < 32000.0f -// && sp138.f[1] > -32000.0f && sp138.f[1] < 32000.0f -// && sp138.f[2] > -32000.0f && sp138.f[2] < 32000.0f) { -// spd8 = true; -// mtx4LoadTranslation(&sp138, &sp148); -// mtx00015f04(0.1f, &sp148); -// mtx00015be0(worldtoscreenmtx, &sp148); -// -// for (i = 0; i < 4; i++) { -// for (j = 0; j < 4; j++) { -// if (sp148.m[i][j] < -32000.0f || sp148.m[i][j] > 32000.0f) { -// spd8 = false; -// break; -// } -// } -// } -// -// if (spd8) { -// mtx00016054(&sp148, sp188); -// -// if (beam->weaponnum); -// -// if (beam->weaponnum == -2 && PLAYERCOUNT() == 1) { -// spcc.f[0] = sp138.f[0] + beam->dir.f[0] * sp12c; -// spcc.f[1] = sp138.f[1] + beam->dir.f[1] * sp12c; -// spcc.f[2] = sp138.f[2] + beam->dir.f[2] * sp12c; -// -// mtx4TransformVecInPlace(worldtoscreenmtx, &spcc); -// -// spb8[0] = spb8[1] = sp130 / 10.0f; -// -// cam0f0b4e68(spb8, -spcc.f[2], spc0); -// -// if (spc0[0] < 2.0f) { -// spcc.f[0] *= spc0[0] * 0.5f; -// spcc.f[1] *= spc0[0] * 0.5f; -// spcc.f[2] *= spc0[0] * 0.5f; -// } -// -// mtx4TransformVecInPlace(camGetProjectionMtxF(), &spcc); -// -// spcc.f[0] -= sp138.f[0]; -// spcc.f[1] -= sp138.f[1]; -// spcc.f[2] -= sp138.f[2]; -// -// if (1); -// -// sp100.f[0] = spcc.f[0] * 10.0f; -// sp100.f[1] = spcc.f[1] * 10.0f; -// sp100.f[2] = spcc.f[2] * 10.0f; -// } else { -// sp100.f[0] = beam->dir.f[0] * (sp12c * 10.0f); -// sp100.f[1] = beam->dir.f[1] * (sp12c * 10.0f); -// sp100.f[2] = beam->dir.f[2] * (sp12c * 10.0f); -// } -// -// if (sp100.f[0] > -30000.0f && sp100.f[0] < 30000.0f -// && sp100.f[1] > -30000.0f && sp100.f[1] < 30000.0f -// && sp100.f[2] > -30000.0f && sp100.f[2] < 30000.0f) { -// vertices[0].x = sp10c.f[0]; -// vertices[0].y = sp10c.f[1]; -// vertices[0].z = sp10c.f[2]; -// vertices[0].s = texconfig->width * 32; -// vertices[0].t = 0; -// vertices[0].colour = 0; -// -// vertices[1].x = -sp10c.f[0]; -// vertices[1].y = -sp10c.f[1]; -// vertices[1].z = -sp10c.f[2]; -// vertices[1].s = 0; -// vertices[1].t = 0; -// vertices[1].colour = 0; -// -// vertices[2].x = sp100.f[0] + sp10c.f[0] * 0.9f; -// vertices[2].y = sp100.f[1] + sp10c.f[1] * 0.9f; -// vertices[2].z = sp100.f[2] + sp10c.f[2] * 0.9f; -// vertices[2].s = texconfig->width * 32; -// vertices[2].t = texconfig->height * 32; -// vertices[2].colour = 0; -// -// vertices[3].x = sp100.f[0] - sp10c.f[0] * 0.9f; -// vertices[3].y = sp100.f[1] - sp10c.f[1] * 0.9f; -// vertices[3].z = sp100.f[2] - sp10c.f[2] * 0.9f; -// vertices[3].s = 0; -// vertices[3].t = texconfig->height * 32; -// vertices[3].colour = 0; -// -// if (beam->weaponnum == WEAPON_LASER) { -// f14 = campos->f[0] - sp138.f[0]; -// f16 = campos->f[1] - sp138.f[1]; -// f18 = campos->f[2] - sp138.f[2]; -// -// spa8 = f14 * f14 + f16 * f16 + f18 * f18; -// -// f14 = campos->f[0] - (sp138.f[0] + beam->dir.f[0] * sp12c); -// f16 = campos->f[1] - (sp138.f[1] + beam->dir.f[1] * sp12c); -// f18 = campos->f[2] - (sp138.f[2] + beam->dir.f[2] * sp12c); -// -// spa4 = f14 * f14 + f16 * f16 + f18 * f18; -// -// if (spa4 < spa8) { -// spf4.f[0] = sp100.f[0]; -// spf4.f[1] = sp100.f[1]; -// spf4.f[2] = sp100.f[2]; -// spf0 *= 0.9f; -// } -// -// vertices[4].x = spf4.f[0] + sp118.f[0] * spf0; -// vertices[4].y = spf4.f[1] + sp118.f[1] * spf0; -// vertices[4].z = spf4.f[2] + sp118.f[2] * spf0; -// vertices[4].s = g_TexGroup03Configs[0].width * 32; -// vertices[4].t = g_TexGroup03Configs[0].height * 32; -// vertices[4].colour = 0; -// -// vertices[5].x = spf4.f[0] - sp118.f[0] * spf0; -// vertices[5].y = spf4.f[1] - sp118.f[1] * spf0; -// vertices[5].z = spf4.f[2] - sp118.f[2] * spf0; -// vertices[5].s = 0; -// vertices[5].t = 0; -// vertices[5].colour = 0; -// -// vertices[6].x = spf4.f[0] + sp10c.f[0] * spf0; -// vertices[6].y = spf4.f[1] + sp10c.f[1] * spf0; -// vertices[6].z = spf4.f[2] + sp10c.f[2] * spf0; -// vertices[6].s = 0; -// vertices[6].t = g_TexGroup03Configs[0].height * 32; -// vertices[6].colour = 0; -// -// vertices[7].x = spf4.f[0] - sp10c.f[0] * spf0; -// vertices[7].y = spf4.f[1] - sp10c.f[1] * spf0; -// vertices[7].z = spf4.f[2] - sp10c.f[2] * spf0; -// vertices[7].s = g_TexGroup03Configs[0].width * 32; -// vertices[7].t = 0; -// vertices[7].colour = 0; -// } -// -// gSPClearGeometryMode(gdl++, G_CULL_BACK); -// gSPMatrix(gdl++, osVirtualToPhysical(sp188), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); -// gDPSetCycleType(gdl++, G_CYC_1CYCLE); -// gDPSetColorDither(gdl++, G_CD_DISABLE); -// gDPSetRenderMode(gdl++, G_RM_AA_ZB_XLU_SURF, G_RM_AA_ZB_XLU_SURF2); -// gDPSetAlphaCompare(gdl++, G_AC_NONE); -// gDPSetTextureLOD(gdl++, G_TL_TILE); -// gDPSetTextureConvert(gdl++, G_TC_FILT); -// gDPSetCombineMode(gdl++, G_CC_BLENDIA, G_CC_BLENDIA); -// gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1); -// -// if (beam->weaponnum == WEAPON_LASER) { -// texSelect(&gdl, &g_TexGroup03Configs[0], 4, arg2, 2, true, NULL); -// -// gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 8); -// gDPTri2(gdl++, 4, 5, 6, 4, 5, 7); -// -// texSelect(&gdl, texconfig, 4, arg2, 2, true, NULL); -// -// gDPTri2(gdl++, 0, 2, 3, 0, 3, 1); -// } else { -// texSelect(&gdl, texconfig, 4, arg2, 2, true, NULL); -// -// gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 4); -// gDPTri2(gdl++, 0, 2, 3, 0, 3, 1); -// } -// } -// } -// } -// } -// -// return gdl; -//} +Gfx *beamRender(Gfx *gdl, struct beam *beam, bool arg2, u8 arg3) +{ + u32 stack; + Mtxf *sp188; + Mtxf sp148; + + if (arg3 < 5 && beam->age >= 0) { + struct colour *colours = gfxAllocateColours(1); // 144 + struct coord sp138; + struct coord *campos = &g_Vars.currentplayer->cam_pos; // 134 + f32 sp130; + f32 sp12c = beam->mindist; + struct gfxvtx *vertices; + f32 sp124 = beam->dist; + struct coord sp118; + struct coord sp10c; + struct coord sp100 = {0, 0, 0}; + struct coord spf4 = {0, 0, 0}; + f32 spf0 = 1.4142f; + struct textureconfig *texconfig = &g_TexBeamConfigs[arg3]; // ec + s32 i; + Mtxf *worldtoscreenmtx = camGetWorldToScreenMtxf(); // e4 + s32 j; + u32 stack1; + s32 spd8; + struct coord spcc; + u32 stack2; + f32 spc0[2]; + f32 spb8[2]; + f32 f14; + f32 f16; + f32 f18; + f32 spa8; + f32 spa4; + + switch (beam->weaponnum) { + case WEAPON_CYCLONE: + texconfig = &g_TexBeamConfigs[1]; + break; + case WEAPON_TRANQUILIZER: + texconfig = &g_TexBeamConfigs[3]; + break; + case WEAPON_MAULER: + case WEAPON_PHOENIX: + case WEAPON_CALLISTO: + case WEAPON_REAPER: + case WEAPON_FARSIGHT: + texconfig = &g_TexBeamConfigs[4]; + break; + } + + if (beam->weaponnum == -1 || beam->weaponnum == WEAPON_CYCLONE) { + colours[0].word = 0xffffff7f; + } else { + colours[0].word = 0xffffffff; + } + + if (beam->weaponnum == WEAPON_LASER) { + // Laser primary + sp130 = 50.0f; + texconfig = &g_TexLaserConfigs[0]; + } else if (beam->weaponnum == -2) { + // Laser secondary + sp130 = 10.0f; + texconfig = &g_TexLaserConfigs[0]; + + colours[0].a = 150 + (random() % 50); + + if ((random() % 5) == 0) { + colours[0].r = colours[0].g = 255 - (random() % 100); + } + } else { + sp130 = 30.0f; + } + + if (beam->weaponnum <= -3) { + // Mauler + sp130 = sp130 * ((beam->weaponnum + 3) * 2.0f + 1.0f); + texconfig = &g_TexBeamConfigs[4]; + } + + sp138.f[0] = beam->from.f[0]; + sp138.f[1] = beam->from.f[1]; + sp138.f[2] = beam->from.f[2]; + + if (sp124 > 0.0f) { + sp138.f[0] += sp124 * beam->dir.f[0]; + sp138.f[1] += sp124 * beam->dir.f[1]; + sp138.f[2] += sp124 * beam->dir.f[2]; + } else { + sp12c += sp124; + sp124 = 0.0f; + } + + if (sp124 + sp12c > beam->maxdist) { + sp12c = beam->maxdist - sp124; + } + + sp10c.f[0] = (beam->dir.f[1] * (campos->f[2] - (sp138.f[2] + sp12c * beam->dir.f[2]))) - (beam->dir.f[2] * (campos->f[1] - (sp138.f[1] + sp12c * beam->dir.f[1]))); + sp10c.f[1] = (beam->dir.f[2] * (campos->f[0] - (sp138.f[0] + sp12c * beam->dir.f[0]))) - (beam->dir.f[0] * (campos->f[2] - (sp138.f[2] + sp12c * beam->dir.f[2]))); + sp10c.f[2] = (beam->dir.f[0] * (campos->f[1] - (sp138.f[1] + sp12c * beam->dir.f[1]))) - (beam->dir.f[1] * (campos->f[0] - (sp138.f[0] + sp12c * beam->dir.f[0]))); + + if (sp10c.f[0] != 0.0f || sp10c.f[1] != 0.0f || sp10c.f[2] != 0.0f) { + guNormalize(&sp10c.f[0], &sp10c.f[1], &sp10c.f[2]); + + sp10c.f[0] *= sp130; + sp10c.f[1] *= sp130; + sp10c.f[2] *= sp130; + } else { + sp10c.f[0] = 0.0f; + sp10c.f[1] = sp130; + sp10c.f[2] = 0.0f; + } + + sp118.f[0] = beam->dir.f[1] * sp10c.f[2] - beam->dir.f[2] * sp10c.f[1]; + sp118.f[1] = beam->dir.f[2] * sp10c.f[0] - beam->dir.f[0] * sp10c.f[2]; + sp118.f[2] = beam->dir.f[0] * sp10c.f[1] - beam->dir.f[1] * sp10c.f[0]; + + guNormalize(&sp118.f[0], &sp118.f[1], &sp118.f[2]); + + sp118.f[0] *= sp130; + sp118.f[1] *= sp130; + sp118.f[2] *= sp130; + + if (beam->weaponnum == WEAPON_LASER) { + vertices = gfxAllocateVertices(8); + } else { + vertices = gfxAllocateVertices(4); + } + + sp188 = gfxAllocateMatrix(); + + if (sp12c > 0.0f + && sp138.f[0] > -32000.0f && sp138.f[0] < 32000.0f + && sp138.f[1] > -32000.0f && sp138.f[1] < 32000.0f + && sp138.f[2] > -32000.0f && sp138.f[2] < 32000.0f) { + spd8 = true; + mtx4LoadTranslation(&sp138, &sp148); + mtx00015f04(0.1f, &sp148); + mtx00015be0(worldtoscreenmtx, &sp148); + + for (i = 0; i < 4; i++) { + for (j = 0; j < 4; j++) { + if (sp148.m[i][j] < -32000.0f || sp148.m[i][j] > 32000.0f) { + spd8 = false; + break; + } + } + } + + if (spd8) { + mtx00016054(&sp148, sp188); + + if (beam->weaponnum); + + if (beam->weaponnum == -2 && PLAYERCOUNT() == 1) { + spcc.f[0] = sp138.f[0] + beam->dir.f[0] * sp12c; + spcc.f[1] = sp138.f[1] + beam->dir.f[1] * sp12c; + spcc.f[2] = sp138.f[2] + beam->dir.f[2] * sp12c; + + mtx4TransformVecInPlace(worldtoscreenmtx, &spcc); + + spb8[0] = spb8[1] = sp130 / 10.0f; + + cam0f0b4e68(spb8, -spcc.f[2], spc0); + + if (spc0[0] < 2.0f) { + spcc.f[0] *= spc0[0] * 0.5f; + spcc.f[1] *= spc0[0] * 0.5f; + spcc.f[2] *= spc0[0] * 0.5f; + } + + mtx4TransformVecInPlace(camGetProjectionMtxF(), &spcc); + + spcc.f[0] -= sp138.f[0]; + spcc.f[1] -= sp138.f[1]; + spcc.f[2] -= sp138.f[2]; + + if (1); + + sp100.f[0] = spcc.f[0] * 10.0f; + sp100.f[1] = spcc.f[1] * 10.0f; + sp100.f[2] = spcc.f[2] * 10.0f; + } else { + sp100.f[0] = beam->dir.f[0] * (sp12c * 10.0f); + sp100.f[1] = beam->dir.f[1] * (sp12c * 10.0f); + sp100.f[2] = beam->dir.f[2] * (sp12c * 10.0f); + } + + if (sp100.f[0] > -30000.0f && sp100.f[0] < 30000.0f + && sp100.f[1] > -30000.0f && sp100.f[1] < 30000.0f + && sp100.f[2] > -30000.0f && sp100.f[2] < 30000.0f) { + vertices[0].x = sp10c.f[0]; + vertices[0].y = sp10c.f[1]; + vertices[0].z = sp10c.f[2]; + vertices[0].s = texconfig->width * 32; + vertices[0].t = 0; + vertices[0].colour = 0; + + vertices[1].x = -sp10c.f[0]; + vertices[1].y = -sp10c.f[1]; + vertices[1].z = -sp10c.f[2]; + vertices[1].s = 0; + vertices[1].t = 0; + vertices[1].colour = 0; + + vertices[2].x = sp100.f[0] + sp10c.f[0] * 0.9f; + vertices[2].y = sp100.f[1] + sp10c.f[1] * 0.9f; + vertices[2].z = sp100.f[2] + sp10c.f[2] * 0.9f; + vertices[2].s = texconfig->width * 32; + vertices[2].t = texconfig->height * 32; + vertices[2].colour = 0; + + vertices[3].x = sp100.f[0] - sp10c.f[0] * 0.9f; + vertices[3].y = sp100.f[1] - sp10c.f[1] * 0.9f; + vertices[3].z = sp100.f[2] - sp10c.f[2] * 0.9f; + vertices[3].s = 0; + vertices[3].t = texconfig->height * 32; + vertices[3].colour = 0; + + if (beam->weaponnum == WEAPON_LASER) { + f14 = campos->f[0] - sp138.f[0]; + f16 = campos->f[1] - sp138.f[1]; + f18 = campos->f[2] - sp138.f[2]; + + spa8 = f14 * f14 + f16 * f16 + f18 * f18; + + f14 = campos->f[0] - (sp138.f[0] + beam->dir.f[0] * sp12c); + f16 = campos->f[1] - (sp138.f[1] + beam->dir.f[1] * sp12c); + f18 = campos->f[2] - (sp138.f[2] + beam->dir.f[2] * sp12c); + + spa4 = f14 * f14 + f16 * f16 + f18 * f18; + + if (spa4 < spa8) { + spf4.f[0] = sp100.f[0]; + spf4.f[1] = sp100.f[1]; + spf4.f[2] = sp100.f[2]; + spf0 *= 0.9f; + } + + vertices[4].x = spf4.f[0] + sp118.f[0] * spf0; + vertices[4].y = spf4.f[1] + sp118.f[1] * spf0; + vertices[4].z = spf4.f[2] + sp118.f[2] * spf0; + vertices[4].s = g_TexGroup03Configs[0].width * 32; + vertices[4].t = g_TexGroup03Configs[0].height * 32; + vertices[4].colour = 0; + + vertices[5].x = spf4.f[0] - sp118.f[0] * spf0; + vertices[5].y = spf4.f[1] - sp118.f[1] * spf0; + vertices[5].z = spf4.f[2] - sp118.f[2] * spf0; + vertices[5].s = 0; + vertices[5].t = 0; + vertices[5].colour = 0; + + vertices[6].x = spf4.f[0] + sp10c.f[0] * spf0; + vertices[6].y = spf4.f[1] + sp10c.f[1] * spf0; + vertices[6].z = spf4.f[2] + sp10c.f[2] * spf0; + vertices[6].s = 0; + vertices[6].t = g_TexGroup03Configs[0].height * 32; + vertices[6].colour = 0; + + vertices[7].x = spf4.f[0] - sp10c.f[0] * spf0; + vertices[7].y = spf4.f[1] - sp10c.f[1] * spf0; + vertices[7].z = spf4.f[2] - sp10c.f[2] * spf0; + vertices[7].s = g_TexGroup03Configs[0].width * 32; + vertices[7].t = 0; + vertices[7].colour = 0; + } + + gSPClearGeometryMode(gdl++, G_CULL_BACK); + gSPMatrix(gdl++, osVirtualToPhysical(sp188), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetCycleType(gdl++, G_CYC_1CYCLE); + gDPSetColorDither(gdl++, G_CD_DISABLE); + gDPSetRenderMode(gdl++, G_RM_AA_ZB_XLU_SURF, G_RM_AA_ZB_XLU_SURF2); + gDPSetAlphaCompare(gdl++, G_AC_NONE); + gDPSetTextureLOD(gdl++, G_TL_TILE); + gDPSetTextureConvert(gdl++, G_TC_FILT); + gDPSetCombineMode(gdl++, G_CC_BLENDIA, G_CC_BLENDIA); + gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1); + + if (beam->weaponnum == WEAPON_LASER) { + texSelect(&gdl, &g_TexGroup03Configs[0], 4, arg2, 2, true, NULL); + + gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 8); + gDPTri2(gdl++, 4, 5, 6, 4, 5, 7); + + texSelect(&gdl, texconfig, 4, arg2, 2, true, NULL); + + gDPTri2(gdl++, 0, 2, 3, 0, 3, 1); + } else { + texSelect(&gdl, texconfig, 4, arg2, 2, true, NULL); + + gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 4); + gDPTri2(gdl++, 0, 2, 3, 0, 3, 1); + } + } + } + } + } + + return gdl; +} +#endif void beamTick(struct beam *beam) { diff --git a/src/game/menugfx.c b/src/game/menugfx.c index 5306a1fb8..30d053f9f 100644 --- a/src/game/menugfx.c +++ b/src/game/menugfx.c @@ -20,6 +20,7 @@ #define NUM_SUCCESS_PARTICLES 280 +#if MATCHING #if VERSION == VERSION_PAL_FINAL GLOBAL_ASM( glabel menugfxCreateBlur @@ -517,6 +518,7 @@ const u32 var7f1adf00[] = {0x63636363}; const u32 var7f1adf04[] = {0x00000000}; u32 var80071180 = 1; +#else #define BLURIMG_WIDTH 40 #define BLURIMG_HEIGHT 30 #define SAMPLE_WIDTH 8 @@ -539,113 +541,114 @@ u32 var80071180 = 1; * It's a simple fade between the source framebuffer and the blurred image. * Only one blurred image is made. */ -//void menugfxCreateBlur(void) -//{ -//#if VERSION >= VERSION_PAL_FINAL -// // Mismatch: Different codegen -// u8 *fb = viGetFrontBuffer(); -// s32 fbwidthinbytes = viGetWidth() * 2; -// f32 scale = viGetWidth() / 320.0f; -// s32 dsty; -// s32 dstx; -// s32 srcx; -// s32 srcy; -// -// static u32 var80071180 = 1; -// -// g_ScaleX = 1; -// -// if (var80071180 == 1) { -// fb = viGetFrontBuffer(); -// } -// -// mainOverrideVariable("cccc", &var80071180); -// -// for (dsty = 0; dsty < 30; dsty++) { -// for (dstx = 0; dstx < 40; dstx++) { -// s32 dstindex = dsty * 80 + dstx * 2; -// u32 r = 0; -// u32 g = 0; -// u32 b = 0; -// -// for (srcx = 0; srcx < 8; srcx++) { -// for (srcy = 0; srcy < 8; srcy++) { -// s32 e = (f32)dstx * 2 * 4 * 2 * scale; -// s32 c = (dsty * fbwidthinbytes * 8); -// s32 block = (e + c) & ~1; -// s32 a = (f32)srcx * 2 * scale; -// s32 d = (srcy * fbwidthinbytes); -// s32 index = (a + block + d) & ~1; -// -// u32 colour = fb[index] << 8 | fb[index + 1]; -// -// r += colour >> 11 & 0x1f; -// g += colour >> 6 & 0x1f; -// b += colour >> 1 & 0x1f; -// } -// } -// -// r /= SAMPLE_WIDTH * SAMPLE_HEIGHT; -// g /= SAMPLE_WIDTH * SAMPLE_HEIGHT; -// b /= SAMPLE_WIDTH * SAMPLE_HEIGHT; -// -// g_BlurBuffer[dstindex + 0] = (r << 3) | (g >> 2); -// g_BlurBuffer[dstindex + 1] = (g << 6) | ((b & 0x1f) << 1); -// } -// } -// -// g_ScaleX = 1; -//#else -// // Mismatch: The below stores 0x280 (end value for dstx loop) in s8, -// // and doesn't store samplestartindex in s2. -// u8 *fb = viGetFrontBuffer(); -// s32 fbwidthinbytes = PXTOBYTES(viGetWidth()); -// s32 dsty; -// s32 dstx; -// s32 srcx; -// s32 srcy; -// -// static u32 var80071180 = 1; -// -// g_ScaleX = (g_ViRes == VIRES_HI) ? 2 : 1; -// -// if (var80071180 == 1) { -// fb = viGetFrontBuffer(); -// } -// -// mainOverrideVariable("cccc", &var80071180); -// -// for (dsty = 0; dsty < BLURIMG_HEIGHT; dsty++) { -// for (dstx = 0; dstx < BLURIMG_WIDTH; dstx++) { -// s32 dstindex = PXTOBYTES(dsty * BLURIMG_WIDTH) + PXTOBYTES(dstx); -// u32 r = 0; -// u32 g = 0; -// u32 b = 0; -// s32 samplestartindex = PXTOBYTES(dstx * SAMPLE_WIDTH) * g_ScaleX + dsty * fbwidthinbytes * SAMPLE_HEIGHT; -// -// for (srcx = 0; srcx < SAMPLE_WIDTH; srcx++) { -// for (srcy = 0; srcy < SAMPLE_HEIGHT; srcy++) { -// s32 offset = PXTOBYTES(srcx) * g_ScaleX + srcy * fbwidthinbytes; -// s32 colour = fb[samplestartindex + offset] << 8 | fb[samplestartindex + offset + 1]; -// -// r += colour >> 11 & 0x1f; -// g += colour >> 6 & 0x1f; -// b += colour >> 1 & 0x1f; -// } -// } -// -// r /= SAMPLE_WIDTH * SAMPLE_HEIGHT; -// g /= SAMPLE_WIDTH * SAMPLE_HEIGHT; -// b /= SAMPLE_WIDTH * SAMPLE_HEIGHT; -// -// g_BlurBuffer[dstindex + 0] = (r << 3) | (g >> 2); -// g_BlurBuffer[dstindex + 1] = (g << 6) | ((b & 0x1f) << 1); -// } -// } -// -// g_ScaleX = 1; -//#endif -//} +void menugfxCreateBlur(void) +{ +#if VERSION >= VERSION_PAL_FINAL + // Mismatch: Different codegen + u8 *fb = (u8 *) viGetFrontBuffer(); + s32 fbwidthinbytes = viGetWidth() * 2; + f32 scale = viGetWidth() / 320.0f; + s32 dsty; + s32 dstx; + s32 srcx; + s32 srcy; + + static u32 var80071180 = 1; + + g_ScaleX = 1; + + if (var80071180 == 1) { + fb = (u8 *) viGetFrontBuffer(); + } + + mainOverrideVariable("cccc", &var80071180); + + for (dsty = 0; dsty < 30; dsty++) { + for (dstx = 0; dstx < 40; dstx++) { + s32 dstindex = dsty * 80 + dstx * 2; + u32 r = 0; + u32 g = 0; + u32 b = 0; + + for (srcx = 0; srcx < 8; srcx++) { + for (srcy = 0; srcy < 8; srcy++) { + s32 e = (f32)dstx * 2 * 4 * 2 * scale; + s32 c = (dsty * fbwidthinbytes * 8); + s32 block = (e + c) & ~1; + s32 a = (f32)srcx * 2 * scale; + s32 d = (srcy * fbwidthinbytes); + s32 index = (a + block + d) & ~1; + + u32 colour = fb[index] << 8 | fb[index + 1]; + + r += colour >> 11 & 0x1f; + g += colour >> 6 & 0x1f; + b += colour >> 1 & 0x1f; + } + } + + r /= SAMPLE_WIDTH * SAMPLE_HEIGHT; + g /= SAMPLE_WIDTH * SAMPLE_HEIGHT; + b /= SAMPLE_WIDTH * SAMPLE_HEIGHT; + + g_BlurBuffer[dstindex + 0] = (r << 3) | (g >> 2); + g_BlurBuffer[dstindex + 1] = (g << 6) | ((b & 0x1f) << 1); + } + } + + g_ScaleX = 1; +#else + // Mismatch: The below stores 0x280 (end value for dstx loop) in s8, + // and doesn't store samplestartindex in s2. + u8 *fb = (u8 *) viGetFrontBuffer(); + s32 fbwidthinbytes = PXTOBYTES(viGetWidth()); + s32 dsty; + s32 dstx; + s32 srcx; + s32 srcy; + + static u32 var80071180 = 1; + + g_ScaleX = (g_ViRes == VIRES_HI) ? 2 : 1; + + if (var80071180 == 1) { + fb = (u8 *) viGetFrontBuffer(); + } + + mainOverrideVariable("cccc", &var80071180); + + for (dsty = 0; dsty < BLURIMG_HEIGHT; dsty++) { + for (dstx = 0; dstx < BLURIMG_WIDTH; dstx++) { + s32 dstindex = PXTOBYTES(dsty * BLURIMG_WIDTH) + PXTOBYTES(dstx); + u32 r = 0; + u32 g = 0; + u32 b = 0; + s32 samplestartindex = PXTOBYTES(dstx * SAMPLE_WIDTH) * g_ScaleX + dsty * fbwidthinbytes * SAMPLE_HEIGHT; + + for (srcx = 0; srcx < SAMPLE_WIDTH; srcx++) { + for (srcy = 0; srcy < SAMPLE_HEIGHT; srcy++) { + s32 offset = PXTOBYTES(srcx) * g_ScaleX + srcy * fbwidthinbytes; + s32 colour = fb[samplestartindex + offset] << 8 | fb[samplestartindex + offset + 1]; + + r += colour >> 11 & 0x1f; + g += colour >> 6 & 0x1f; + b += colour >> 1 & 0x1f; + } + } + + r /= SAMPLE_WIDTH * SAMPLE_HEIGHT; + g /= SAMPLE_WIDTH * SAMPLE_HEIGHT; + b /= SAMPLE_WIDTH * SAMPLE_HEIGHT; + + g_BlurBuffer[dstindex + 0] = (r << 3) | (g >> 2); + g_BlurBuffer[dstindex + 1] = (g << 6) | ((b & 0x1f) << 1); + } + } + + g_ScaleX = 1; +#endif +} +#endif Gfx *menugfxRenderBgBlur(Gfx *gdl, u32 colour, s16 arg2, s16 arg3) { @@ -803,6 +806,7 @@ Gfx *menugfxRenderDialogBackground(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, str return gdl; } +#if MATCHING GLOBAL_ASM( glabel menugfxRenderBgGreenHaze .late_rodata @@ -1261,7 +1265,7 @@ glabel var7f1adf18 /* f0e1660: 03e00008 */ jr $ra /* f0e1664: 27bd0118 */ addiu $sp,$sp,0x118 ); - +#else /** * This unused function renders an experimental menu background. * @@ -1269,126 +1273,127 @@ glabel var7f1adf18 * Both layers spin slowly in opposite directions. */ // Mismatch: Regalloc, and a different approach is taken for the i == 1 checks. -//Gfx *menugfxRenderBgGreenHaze(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2) -//{ -// u32 *colours; -// struct gfxvtx *vertices; -// u32 alphas[2]; // 104 -// s32 i; -// s16 t5; -// s16 s0; -// s16 s2; -// s16 s3; -// f32 f20; -// f32 f22; -// f32 f24; -// f32 f26; -// f32 f0; -// f32 f2; -// u32 stack[2]; -// struct gfxvtx *iter; -// -// colours = gfxAllocateColours(4); -// vertices = gfxAllocateVertices(8); -// -// gDPPipeSync(gdl++); -// gDPSetCycleType(gdl++, G_CYC_1CYCLE); -// gDPSetAlphaCompare(gdl++, G_AC_NONE); -// gDPSetCombineMode(gdl++, G_CC_MODULATEI, G_CC_MODULATEI); -// gSPClearGeometryMode(gdl++, G_CULL_BOTH); -// gDPSetTextureFilter(gdl++, G_TF_BILERP); -// -// texSelect(&gdl, &g_TexGeneralConfigs[6], 2, 0, 2, 1, NULL); -// -// gDPSetRenderMode(gdl++, G_RM_XLU_SURF, G_RM_XLU_SURF2); -// -// vertices[4].x = vertices[0].x = x1 * 10; -// vertices[4].y = vertices[0].y = y1 * 10; -// vertices[4].z = vertices[0].z = -10; -// vertices[5].x = vertices[1].x = x2 * 10; -// vertices[5].y = vertices[1].y = y1 * 10; -// vertices[5].z = vertices[1].z = -10; -// vertices[6].x = vertices[2].x = x2 * 10; -// vertices[6].y = vertices[2].y = y2 * 10; -// vertices[6].z = vertices[2].z = -10; -// vertices[7].x = vertices[3].x = x1 * 10; -// vertices[7].y = vertices[3].y = y2 * 10; -// vertices[7].z = vertices[3].z = -10; -// -// for (i = 0; i < 2; i++) { -// f0 = var80061630; -// f26 = M_BADTAU * var80061630; -// -// if (i == 1) { -// f26 = -f26; -// } -// -// if (i == 1) { -// f0 += 0.5f; -// } -// -// if (f0 > 1.0f) { -// f0 -= 1.0f; -// } -// -// f2 = 1.0f - f0; -// -// if (f0 < 0.2f) { -// alphas[i] = f0 / 0.2f * 127.0f; -// } else if (f0 > 0.9f) { -// alphas[i] = f2 / 0.1f * 127.0f; -// } else { -// alphas[i] = 0x7f; -// } -// -// f20 = (f2 + 0.1f) * 15.0f; -// f22 = (x2 - x1) / 2 * f20; -// f24 = (y2 - y1) / 2 * f20; -// -// s2 = sinf(f26) * f22; -// s3 = cosf(f26) * f24; -// s0 = cosf(f26) * f22; -// t5 = -sinf(f26) * f24; -// -// if (1); -// -// iter = &vertices[i * 4]; -// -// iter[0].unk08 = i * 256 - s2 - s0; -// iter[0].unk0a = i * 256 - s3 - t5; -// iter[1].unk08 = i * 256 + s2 - s0; -// iter[1].unk0a = i * 256 + s3 - t5; -// iter[2].unk08 = i * 256 + s2 + s0; -// iter[2].unk0a = i * 256 + s3 + t5; -// iter[3].unk08 = i * 256 - s2 + s0; -// iter[3].unk0a = i * 256 - s3 + t5; -// } -// -// vertices[0].colour = 0; -// vertices[1].colour = 0; -// vertices[2].colour = 4; -// vertices[3].colour = 4; -// vertices[4].colour = 12; -// vertices[5].colour = 12; -// vertices[6].colour = 8; -// vertices[7].colour = 8; -// -// colours[0] = 0x00af0000 | alphas[0]; -// colours[1] = 0xffff0000 | alphas[0]; -// colours[2] = 0x00af0000 | alphas[1]; -// colours[3] = 0xffff0000 | alphas[1]; -// -// gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 4); -// gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 8); -// -// if (var80061630 > 0.5f) { -// gDPTri4(gdl++, 4, 5, 6, 6, 7, 4, 0, 1, 2, 2, 3, 0); -// } else { -// gDPTri4(gdl++, 0, 1, 2, 2, 3, 0, 4, 5, 6, 6, 7, 4); -// } -// -// return gdl; -//} +Gfx *menugfxRenderBgGreenHaze(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2) +{ + u32 *colours; + struct gfxvtx *vertices; + u32 alphas[2]; // 104 + s32 i; + s16 t5; + s16 s0; + s16 s2; + s16 s3; + f32 f20; + f32 f22; + f32 f24; + f32 f26; + f32 f0; + f32 f2; + u32 stack[2]; + struct gfxvtx *iter; + + colours = gfxAllocateColours(4); + vertices = gfxAllocateVertices(8); + + gDPPipeSync(gdl++); + gDPSetCycleType(gdl++, G_CYC_1CYCLE); + gDPSetAlphaCompare(gdl++, G_AC_NONE); + gDPSetCombineMode(gdl++, G_CC_MODULATEI, G_CC_MODULATEI); + gSPClearGeometryMode(gdl++, G_CULL_BOTH); + gDPSetTextureFilter(gdl++, G_TF_BILERP); + + texSelect(&gdl, &g_TexGeneralConfigs[6], 2, 0, 2, 1, NULL); + + gDPSetRenderMode(gdl++, G_RM_XLU_SURF, G_RM_XLU_SURF2); + + vertices[4].x = vertices[0].x = x1 * 10; + vertices[4].y = vertices[0].y = y1 * 10; + vertices[4].z = vertices[0].z = -10; + vertices[5].x = vertices[1].x = x2 * 10; + vertices[5].y = vertices[1].y = y1 * 10; + vertices[5].z = vertices[1].z = -10; + vertices[6].x = vertices[2].x = x2 * 10; + vertices[6].y = vertices[2].y = y2 * 10; + vertices[6].z = vertices[2].z = -10; + vertices[7].x = vertices[3].x = x1 * 10; + vertices[7].y = vertices[3].y = y2 * 10; + vertices[7].z = vertices[3].z = -10; + + for (i = 0; i < 2; i++) { + f0 = var80061630; + f26 = M_BADTAU * var80061630; + + if (i == 1) { + f26 = -f26; + } + + if (i == 1) { + f0 += 0.5f; + } + + if (f0 > 1.0f) { + f0 -= 1.0f; + } + + f2 = 1.0f - f0; + + if (f0 < 0.2f) { + alphas[i] = f0 / 0.2f * 127.0f; + } else if (f0 > 0.9f) { + alphas[i] = f2 / 0.1f * 127.0f; + } else { + alphas[i] = 0x7f; + } + + f20 = (f2 + 0.1f) * 15.0f; + f22 = (x2 - x1) / 2 * f20; + f24 = (y2 - y1) / 2 * f20; + + s2 = sinf(f26) * f22; + s3 = cosf(f26) * f24; + s0 = cosf(f26) * f22; + t5 = -sinf(f26) * f24; + + if (1); + + iter = &vertices[i * 4]; + + iter[0].s = i * 256 - s2 - s0; + iter[0].t = i * 256 - s3 - t5; + iter[1].s = i * 256 + s2 - s0; + iter[1].t = i * 256 + s3 - t5; + iter[2].s = i * 256 + s2 + s0; + iter[2].t = i * 256 + s3 + t5; + iter[3].s = i * 256 - s2 + s0; + iter[3].t = i * 256 - s3 + t5; + } + + vertices[0].colour = 0; + vertices[1].colour = 0; + vertices[2].colour = 4; + vertices[3].colour = 4; + vertices[4].colour = 12; + vertices[5].colour = 12; + vertices[6].colour = 8; + vertices[7].colour = 8; + + colours[0] = 0x00af0000 | alphas[0]; + colours[1] = 0xffff0000 | alphas[0]; + colours[2] = 0x00af0000 | alphas[1]; + colours[3] = 0xffff0000 | alphas[1]; + + gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 4); + gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 8); + + if (var80061630 > 0.5f) { + gDPTri4(gdl++, 4, 5, 6, 6, 7, 4, 0, 1, 2, 2, 3, 0); + } else { + gDPTri4(gdl++, 0, 1, 2, 2, 3, 0, 4, 5, 6, 6, 7, 4); + } + + return gdl; +} +#endif Gfx *menugfxDrawDropdownBackground(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2) { @@ -1803,6 +1808,7 @@ glabel menugfxDrawListGroupHeader ); #endif +#if MATCHING GLOBAL_ASM( glabel menugfxRenderGradient /* f0e1ce8: 27bdffa0 */ addiu $sp,$sp,-96 @@ -1985,79 +1991,80 @@ glabel menugfxRenderGradient /* f0e1fa4: 03e00008 */ jr $ra /* f0e1fa8: 27bd0060 */ addiu $sp,$sp,0x60 ); - +#else // Mismatch: Goal has the if statement with empty contents -//Gfx *menugfxRenderGradient(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colourstart, u32 colourmid, u32 colourend) -//{ -// u32 *colours = gfxAllocateColours(3); -// struct gfxvtx *vertices = gfxAllocateVertices(6); -// s32 ymid; -// -// gDPPipeSync(gdl++); -// gDPSetCycleType(gdl++, G_CYC_1CYCLE); -// gDPSetAlphaCompare(gdl++, G_AC_NONE); -// gDPSetCombineMode(gdl++, G_CC_MODULATEI, G_CC_MODULATEI); -// gSPClearGeometryMode(gdl++, G_CULL_BOTH); -// gDPSetTextureFilter(gdl++, G_TF_BILERP); -// -// texSelect(&gdl, NULL, 2, 0, 2, 1, NULL); -// -// gDPSetRenderMode(gdl++, G_RM_XLU_SURF, G_RM_XLU_SURF2); -// -// ymid = (y1 + y2) / 2; -// -// if (x2 - x1 < ymid * 2) { -// ymid <<= 0; -// } -// -// // 0 = top left -// // 1 = top right -// // 2 = bottom right -// // 3 = bottom left -// // 4 = mid left -// // 5 = mid right -// -// vertices[0].z = -10; -// vertices[1].z = -10; -// vertices[2].z = -10; -// vertices[3].z = -10; -// vertices[4].z = -10; -// vertices[5].z = -10; -// -// vertices[0].x = x1 * 10; -// vertices[0].y = y1 * 10; -// vertices[0].colour = 0; -// -// vertices[1].x = x2 * 10; -// vertices[1].y = y1 * 10; -// vertices[1].colour = 0; -// -// vertices[2].x = x2 * 10; -// vertices[2].y = y2 * 10; -// vertices[2].colour = 4; -// -// vertices[3].x = x1 * 10; -// vertices[3].y = y2 * 10; -// vertices[3].colour = 4; -// -// vertices[4].x = x1 * 10; -// vertices[4].y = ymid * 10; -// vertices[4].colour = 8; -// -// vertices[5].x = x2 * 10; -// vertices[5].y = ymid * 10; -// vertices[5].colour = 8; -// -// colours[0] = colourstart; -// colours[2] = colourmid; -// colours[1] = colourend; -// -// gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 3); -// gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 6); -// gDPTri4(gdl++, 0, 1, 5, 5, 4, 0, 2, 3, 4, 4, 5, 2); -// -// return gdl; -//} +Gfx *menugfxRenderGradient(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colourstart, u32 colourmid, u32 colourend) +{ + u32 *colours = gfxAllocateColours(3); + struct gfxvtx *vertices = gfxAllocateVertices(6); + s32 ymid; + + gDPPipeSync(gdl++); + gDPSetCycleType(gdl++, G_CYC_1CYCLE); + gDPSetAlphaCompare(gdl++, G_AC_NONE); + gDPSetCombineMode(gdl++, G_CC_MODULATEI, G_CC_MODULATEI); + gSPClearGeometryMode(gdl++, G_CULL_BOTH); + gDPSetTextureFilter(gdl++, G_TF_BILERP); + + texSelect(&gdl, NULL, 2, 0, 2, 1, NULL); + + gDPSetRenderMode(gdl++, G_RM_XLU_SURF, G_RM_XLU_SURF2); + + ymid = (y1 + y2) / 2; + + if (x2 - x1 < ymid * 2) { + ymid <<= 0; + } + + // 0 = top left + // 1 = top right + // 2 = bottom right + // 3 = bottom left + // 4 = mid left + // 5 = mid right + + vertices[0].z = -10; + vertices[1].z = -10; + vertices[2].z = -10; + vertices[3].z = -10; + vertices[4].z = -10; + vertices[5].z = -10; + + vertices[0].x = x1 * 10; + vertices[0].y = y1 * 10; + vertices[0].colour = 0; + + vertices[1].x = x2 * 10; + vertices[1].y = y1 * 10; + vertices[1].colour = 0; + + vertices[2].x = x2 * 10; + vertices[2].y = y2 * 10; + vertices[2].colour = 4; + + vertices[3].x = x1 * 10; + vertices[3].y = y2 * 10; + vertices[3].colour = 4; + + vertices[4].x = x1 * 10; + vertices[4].y = ymid * 10; + vertices[4].colour = 8; + + vertices[5].x = x2 * 10; + vertices[5].y = ymid * 10; + vertices[5].colour = 8; + + colours[0] = colourstart; + colours[2] = colourmid; + colours[1] = colourend; + + gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 3); + gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 6); + gDPTri4(gdl++, 0, 1, 5, 5, 4, 0, 2, 3, 4, 4, 5, 2); + + return gdl; +} +#endif Gfx *menugfxRenderSlider(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, s32 markerx, u32 colour) { @@ -2222,6 +2229,7 @@ Gfx *menugfxDrawLine(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colour1, u32 return gdl; } +#if MATCHING GLOBAL_ASM( glabel menugfxDrawTessellatedRect /* f0e2744: 27bdff68 */ addiu $sp,$sp,-152 @@ -2456,87 +2464,88 @@ glabel menugfxDrawTessellatedRect /* f0e2a9c: 03e00008 */ jr $ra /* f0e2aa0: 27bd0098 */ addiu $sp,$sp,0x98 ); - +#else // Mismatch: Uses callee-save registers differently -//Gfx *menugfxDrawTessellatedRect(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colour1, u32 colour2) -//{ -// if (textHasDiagonalBlend()) { -// if (y2 - y1 > x2 - x1) { -// // Portrait -// s32 numfullparts; // 94 -// u32 nextcolour; -// u32 thiscolour; // 8c -// s32 i; -// s32 nexty; -// s32 thisy; // 80 -// u32 stack[2]; -// -// numfullparts = (y2 - y1) / 15; -// thiscolour = text0f153e94(x1, y1, colour1); -// thisy = y1; -// -// for (i = 0; i < numfullparts; i++) { -// nexty = y1 + i * 15; -// -// if (y2 - nexty < 3) { -// nexty = y2; -// nextcolour = text0f153e94(x2, y2, colour2); -// } else { -// nextcolour = colourBlend(colour2, colour1, (nexty - y1) * 255 / (y2 - y1)); -// // @bug? Should y1 be x1? -// nextcolour = text0f153e94(y1, thisy, nextcolour); -// } -// -// gdl = menugfxDrawTri2(gdl, x1, thisy, x2, nexty, thiscolour, nextcolour, false); -// -// thisy = nexty; -// thiscolour = nextcolour; -// } -// -// nextcolour = text0f153e94(x2, y2, colour2); -// gdl = menugfxDrawTri2(gdl, x1, thisy, x2, y2, thiscolour, nextcolour, false); -// } else { -// // Landscape -// // 8f4 -// s32 numfullparts; // 74 -// u32 nextcolour; -// u32 thiscolour; // 6c -// s32 i; -// s32 nextx; -// s32 thisx; // 60 -// u32 stack[1]; -// -// numfullparts = (x2 - x1) / 15; -// thiscolour = text0f153e94(x1, y1, colour1); -// thisx = x1; -// -// for (i = 0; i < numfullparts; i++) { -// nextx = x1 + i * 15; -// -// if (x2 - nextx < 3) { -// nextx = x2; -// nextcolour = text0f153e94(x2, y2, colour2); -// } else { -// nextcolour = colourBlend(colour2, colour1, (nextx - x1) * 255 / (x2 - x1)); -// nextcolour = text0f153e94(thisx, y1, nextcolour); -// } -// -// gdl = menugfxDrawTri2(gdl, thisx, y1, nextx, y2, thiscolour, nextcolour, false); -// -// thisx = nextx; -// thiscolour = nextcolour; -// } -// -// nextcolour = text0f153e94(x2, y2, colour2); -// gdl = menugfxDrawTri2(gdl, thisx, y1, x2, y2, thiscolour, nextcolour, false); -// } -// } else { -// // a40 -// gdl = menugfxDrawTri2(gdl, x1, y1, x2, y2, colour1, colour2, false); -// } -// -// return gdl; -//} +Gfx *menugfxDrawTessellatedRect(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colour1, u32 colour2) +{ + if (textHasDiagonalBlend()) { + if (y2 - y1 > x2 - x1) { + // Portrait + s32 numfullparts; // 94 + u32 nextcolour; + u32 thiscolour; // 8c + s32 i; + s32 nexty; + s32 thisy; // 80 + u32 stack[2]; + + numfullparts = (y2 - y1) / 15; + thiscolour = text0f153e94(x1, y1, colour1); + thisy = y1; + + for (i = 0; i < numfullparts; i++) { + nexty = y1 + i * 15; + + if (y2 - nexty < 3) { + nexty = y2; + nextcolour = text0f153e94(x2, y2, colour2); + } else { + nextcolour = colourBlend(colour2, colour1, (nexty - y1) * 255 / (y2 - y1)); + // @bug? Should y1 be x1? + nextcolour = text0f153e94(y1, thisy, nextcolour); + } + + gdl = menugfxDrawTri2(gdl, x1, thisy, x2, nexty, thiscolour, nextcolour, false); + + thisy = nexty; + thiscolour = nextcolour; + } + + nextcolour = text0f153e94(x2, y2, colour2); + gdl = menugfxDrawTri2(gdl, x1, thisy, x2, y2, thiscolour, nextcolour, false); + } else { + // Landscape + // 8f4 + s32 numfullparts; // 74 + u32 nextcolour; + u32 thiscolour; // 6c + s32 i; + s32 nextx; + s32 thisx; // 60 + u32 stack[1]; + + numfullparts = (x2 - x1) / 15; + thiscolour = text0f153e94(x1, y1, colour1); + thisx = x1; + + for (i = 0; i < numfullparts; i++) { + nextx = x1 + i * 15; + + if (x2 - nextx < 3) { + nextx = x2; + nextcolour = text0f153e94(x2, y2, colour2); + } else { + nextcolour = colourBlend(colour2, colour1, (nextx - x1) * 255 / (x2 - x1)); + nextcolour = text0f153e94(thisx, y1, nextcolour); + } + + gdl = menugfxDrawTri2(gdl, thisx, y1, nextx, y2, thiscolour, nextcolour, false); + + thisx = nextx; + thiscolour = nextcolour; + } + + nextcolour = text0f153e94(x2, y2, colour2); + gdl = menugfxDrawTri2(gdl, thisx, y1, x2, y2, thiscolour, nextcolour, false); + } + } else { + // a40 + gdl = menugfxDrawTri2(gdl, x1, y1, x2, y2, colour1, colour2, false); + } + + return gdl; +} +#endif /** * Consider rendering a shimmer effect along a line, based on timing. @@ -2977,6 +2986,7 @@ Gfx *menugfxRenderBgFailure(Gfx *gdl) return gdl; } +#if MATCHING GLOBAL_ASM( glabel menugfxRenderBgCone .late_rodata @@ -3253,77 +3263,78 @@ glabel var7f1adf4c /* f0e4584: 03e00008 */ jr $ra /* f0e4588: 27bd00a0 */ addiu $sp,$sp,0xa0 ); - +#else // Mismatch: Float regalloc -//Gfx *menugfxRenderBgCone(Gfx *gdl) -//{ -// f32 sp9c; -// u32 stack[2]; -// f32 angle; -// s32 x1; -// s32 y1; -// s32 x2; -// s32 y2; -// u32 s0; -// f32 sp78; -// s32 colour; -// s32 i; -// -// angle = M_BADTAU * var80061630; -// sp9c = angle * 2.0f; -// s0 = (u32)(func0f006b08(1) * 255.0f) << 16; -// -// gdl = func0f0d4a3c(gdl, 0); -// -// colour = s0 | 0xff00007f; -// -// var8009de90 = -100000; -// var8009de94 = 100000; -// -// for (i = 0; i < 8; i++) { -// angle = sp9c + i * 2.0f * M_PI * 0.125f; -// -// x1 = 600.0f * sinf(angle); -// y1 = 600.0f * cosf(angle); -// x2 = 600.0f * sinf(angle + 0.78539818525314f); -// y2 = 600.0f * cosf(angle + 0.78539818525314f); -// -// x1 += 160; -// x2 += 160; -// y1 += 120; -// y2 += 120; -// -// gdl = menugfxDrawPlane(gdl, x1, y1, x2, y2, colour, colour, MENUPLANE_08); -// } -// -// s0 = (u32)(255.0f - func0f006b54(1) * 255.0f) << 16; -// -// if (M_BADTAU * var80061630); -// angle = M_BADTAU * var80061630; -// sp78 = -angle; -// -// colour = s0 | 0xff00007f; -// -// for (i = 0; i < 8; i++) { -// angle = sp78 + 2.0f * i * M_PI * 0.125f; -// -// x1 = 600.0f * sinf(angle); -// y1 = 600.0f * cosf(angle); -// x2 = 600.0f * sinf(angle + 0.78539818525314f); -// y2 = 600.0f * cosf(angle + 0.78539818525314f); -// -// x1 += 160; -// x2 += 160; -// y1 += 120; -// y2 += 120; -// -// gdl = menugfxDrawPlane(gdl, x1, y1, x2, y2, colour, colour, MENUPLANE_09); -// } -// -// gdl = func0f0d4c80(gdl); -// -// return gdl; -//} +Gfx *menugfxRenderBgCone(Gfx *gdl) +{ + f32 sp9c; + u32 stack[2]; + f32 angle; + s32 x1; + s32 y1; + s32 x2; + s32 y2; + u32 s0; + f32 sp78; + s32 colour; + s32 i; + + angle = M_BADTAU * var80061630; + sp9c = angle * 2.0f; + s0 = (u32)(func0f006b08(1) * 255.0f) << 16; + + gdl = func0f0d4a3c(gdl, 0); + + colour = s0 | 0xff00007f; + + var8009de90 = -100000; + var8009de94 = 100000; + + for (i = 0; i < 8; i++) { + angle = sp9c + i * 2.0f * M_PI * 0.125f; + + x1 = 600.0f * sinf(angle); + y1 = 600.0f * cosf(angle); + x2 = 600.0f * sinf(angle + 0.78539818525314f); + y2 = 600.0f * cosf(angle + 0.78539818525314f); + + x1 += 160; + x2 += 160; + y1 += 120; + y2 += 120; + + gdl = menugfxDrawPlane(gdl, x1, y1, x2, y2, colour, colour, MENUPLANE_08); + } + + s0 = (u32)(255.0f - func0f006b54(1) * 255.0f) << 16; + + if (M_BADTAU * var80061630); + angle = M_BADTAU * var80061630; + sp78 = -angle; + + colour = s0 | 0xff00007f; + + for (i = 0; i < 8; i++) { + angle = sp78 + 2.0f * i * M_PI * 0.125f; + + x1 = 600.0f * sinf(angle); + y1 = 600.0f * cosf(angle); + x2 = 600.0f * sinf(angle + 0.78539818525314f); + y2 = 600.0f * cosf(angle + 0.78539818525314f); + + x1 += 160; + x2 += 160; + y1 += 120; + y2 += 120; + + gdl = menugfxDrawPlane(gdl, x1, y1, x2, y2, colour, colour, MENUPLANE_09); + } + + gdl = func0f0d4c80(gdl); + + return gdl; +} +#endif /** * Fill the framebuffer with a transparent green overlay. diff --git a/src/game/menuitem.c b/src/game/menuitem.c index 9ff19bdee..f26446c38 100644 --- a/src/game/menuitem.c +++ b/src/game/menuitem.c @@ -1594,6 +1594,7 @@ Gfx *menuitemSeparatorRender(Gfx *gdl, struct menurendercontext *context) u32 var800711e8 = 0x00000000; +#if MATCHING #if VERSION >= VERSION_JPN_FINAL GLOBAL_ASM( glabel menuitemObjectivesRenderOne @@ -4187,172 +4188,173 @@ glabel menuitemObjectivesRenderOne const char var7f1adfa0[] = "brcol"; const char var7f1adfa8[] = "%d: "; const char var7f1adfb0[] = "%s"; - +#else // Mismatch: Stack usage is different. Target appears to use compiler-managed // stack from 0x44 and below, which means the vars from 0x48 to 0x6c are real // variables, and many are optimised out. -//Gfx *menuitemObjectivesRenderOne(Gfx *gdl, struct menudialog *dialog, s32 index, s32 position, s16 objx, s16 objy, s16 width, s16 height, bool withstatus, s32 arg9) -//{ -// u32 sp12c; -// s32 x; // 128 -// s32 y; // 124 -// char *sp120; -// char buffer[80]; // d0 -// char *spcc; -// u32 spc8; -// s32 textwidth; // c4 -// s32 textheight; // c0 -// s32 spbc; -// s32 tmp; -// s32 spb4; -// s32 spb0; -// s32 spac; -// s32 spa8; -// u32 stack3[2]; -// s32 sp9c; -// s32 sp98; -// u32 s0; -// s32 stack[4]; -// s32 sp80; -// s32 sp7c; -// s32 sp78; -// s32 sp74; -// s32 stack2; -// s32 sp6c; -// s32 sp58; -// s32 sp54; -// -// spbc = 0; -// -// if (arg9) { -// spbc = PAL ? 16 : 12; -// } -// -// mainOverrideVariable("brcol", &var800711e8); -// sp120 = langGet(g_Briefing.objectivenames[index]); -// y = objy; -// sp12c = MIXCOLOUR(dialog, unfocused); -// -// if (dialog->dimmed) { -// sp12c = (colourBlend(sp12c, 0, 0x2c) & 0xffffff00) | (sp12c & 0xff); -// } -// -// textSetWaveColours(g_MenuColourPalettes3[dialog->type].unfocused, g_MenuColourPalettes2[dialog->type].unfocused); -// buffer[0] = '\0'; -// -// // Render objective number -// gdl = text0f153628(gdl); -// sprintf(buffer, "%d: ", position); -// textMeasure(&textheight, &textwidth, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0); -// x = objx - textwidth + 25; -// gdl = textRenderProjected(gdl, &x, &y, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, sp12c, width, height, 0, 0); -// -// x = objx + 25; -// -// if (arg9) { -// textWrap(85, sp120, buffer, g_CharsHandelGothicXs, g_FontHandelGothicXs); -// gdl = textRenderProjected(gdl, &x, &y, buffer, g_CharsHandelGothicXs, g_FontHandelGothicXs, sp12c, width, height, 0, 0); -// } else { -// sprintf(buffer, "%s", sp120); -// gdl = textRenderProjected(gdl, &x, &y, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, sp12c, width, height, 0, 0); -// } -// -// if (withstatus) { -// switch (objectiveCheck(index)) { -// case OBJECTIVE_INCOMPLETE: -// spcc = langGet(L_OPTIONS_001); // "Incomplete" -// spc8 = 0xffff00ff; -// break; -// case OBJECTIVE_COMPLETE: -// spcc = langGet(L_OPTIONS_000); // "Complete" -// spc8 = 0x00ff00ff; -// break; -// case OBJECTIVE_FAILED: -// spcc = langGet(L_OPTIONS_002); // "Failed" -// spc8 = 0xff4040ff; -// break; -// } -// -// if (dialog != g_Menus[g_MpPlayerNum].curdialog) { -// spc8 = g_MenuColourPalettes[0].unfocused; -// } -// -// textMeasure(&textheight, &textwidth, spcc, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0); -// -// if (var800711e8 != 0) { -// spc8 = var800711e8; -// } -// -// x = objx + width - textwidth - 10; -// y = objy + spbc + 9; -// -// gdl = textRenderProjected(gdl, &x, &y, spcc, g_CharsHandelGothicXs, g_FontHandelGothicXs, spc8, width, height, 0, 0); -// -// x = objx + width - textwidth - 10; -// y = objy + spbc + 9; -// -// gdl = textRenderProjected(gdl, &x, &y, spcc, g_CharsHandelGothicXs, g_FontHandelGothicXs, spc8 & 0xffffff7f, width, height, 0, 0); -// -// x = objx + width - textwidth - 13; -// y = objy + 9; -// -// gdl = text0f153780(gdl); -// -// spb4 = objx + 22; -// spb0 = objy - 2; -// spac = objy + 8; -// spa8 = y + spbc + 2; -// tmp = (objx * 3 + objx + 66) / 4; -// sp9c = x; -// sp98 = tmp + 19 + (sp9c - tmp - 24) * (position - 1) / 5; -// -// sp58 = (objx * 3 + objx + 66) / 4 - 1; -// sp54 = (objx * 3 + objx + 66) / 4 + 14; -// -// gdl = menugfx0f0e2498(gdl); -// -// // Blue lines -// gdl = menugfxDrawTessellatedRect(gdl, objx, spb0, spb4, spb0 + 1, sp12c & 0xffffff00, (sp12c & 0xffffff00) | 0x3f); -// gdl = menugfxDrawTessellatedRect(gdl, spb4, spb0, spb4 + 1, spac, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); -// gdl = menugfxDrawTessellatedRect(gdl, objx, spac, sp58, spac + 1, sp12c & 0xffffff00, (sp12c & 0xffffff00) | 0x3f); -// gdl = menugfxDrawTessellatedRect(gdl, sp58 + 3, spac, spb4 + 1, spac + 1, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); -// gdl = menugfxDrawTessellatedRect(gdl, sp58, spac, sp58 + 1, spa8 + 2, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); -// gdl = menugfxDrawTessellatedRect(gdl, sp58 + 2, spac, sp58 + 3, spa8, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); -// gdl = menugfxDrawTessellatedRect(gdl, sp58 + 2, spa8, sp54, spa8 + 1, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); -// gdl = menugfxDrawTessellatedRect(gdl, sp58, spa8 + 2, sp54, spa8 + 3, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); -// gdl = menugfxDrawTessellatedRect(gdl, sp54, spa8, sp98, spa8 + 1, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); -// gdl = menugfxDrawTessellatedRect(gdl, sp54, spa8 + 2, sp98, spa8 + 3, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); -// -// // Coloured lines -// gdl = menugfxDrawTessellatedRect(gdl, sp98, spa8, sp98 + 1, spa8 + 3, (spc8 & 0xffffff00) | 0x3f, (spc8 & 0xffffff00) | 0x3f); -// gdl = menugfxDrawTessellatedRect(gdl, sp98 + 1, spa8 + 1, sp9c - 4, spa8 + 2, (spc8 & 0xffffff00) | 0x3f, (spc8 & 0xffffff00) | 0x3f); -// gdl = menugfxDrawTessellatedRect(gdl, sp9c - 4, spa8 + 1, sp9c, spa8 + 2, (spc8 & 0xffffff00) | 0x3f, spc8 & 0xffffff00 | 0xcf); -// } else { -// // Render lines without status -// sp80 = objx + 22; -// sp7c = objy - 2; -// sp78 = objy + 8; -// sp74 = y + 1; -// -// textMeasure(&textheight, &textwidth, sp120, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0); -// -// sp6c = objx + textwidth + 25; -// sp58 = (objx * 3 + objx + 66) / 4 - 1; -// -// gdl = text0f153780(gdl); -// gdl = menugfx0f0e2498(gdl); -// -// gdl = menugfxDrawTessellatedRect(gdl, objx, sp7c, sp80, sp7c + 1, sp12c & 0xffffff00, (sp12c & 0xffffff00) | 0x3f); -// gdl = menugfxDrawTessellatedRect(gdl, sp80, sp7c, sp80 + 1, sp78, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); -// gdl = menugfxDrawTessellatedRect(gdl, objx, sp78, sp58, sp78 + 1, sp12c & 0xffffff00, (sp12c & 0xffffff00) | 0x3f); -// gdl = menugfxDrawTessellatedRect(gdl, sp58 + 3, sp78, sp80 + 1, sp78 + 1, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); -// gdl = menugfxDrawTessellatedRect(gdl, sp58, sp78, sp58 + 1, sp74 + 2, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); -// gdl = menugfxDrawTessellatedRect(gdl, sp58 + 2, sp78, sp58 + 3, sp74, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); -// gdl = menugfxDrawTessellatedRect(gdl, sp58 + 2, sp74, sp6c, sp74 + 1, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); -// } -// -// return gdl; -//} +Gfx *menuitemObjectivesRenderOne(Gfx *gdl, struct menudialog *dialog, s32 index, s32 position, s16 objx, s16 objy, s16 width, s16 height, bool withstatus, s32 arg9) +{ + u32 sp12c; + s32 x; // 128 + s32 y; // 124 + char *sp120; + char buffer[80]; // d0 + char *spcc; + u32 spc8; + s32 textwidth; // c4 + s32 textheight; // c0 + s32 spbc; + s32 tmp; + s32 spb4; + s32 spb0; + s32 spac; + s32 spa8; + u32 stack3[2]; + s32 sp9c; + s32 sp98; + u32 s0; + s32 stack[4]; + s32 sp80; + s32 sp7c; + s32 sp78; + s32 sp74; + s32 stack2; + s32 sp6c; + s32 sp58; + s32 sp54; + + spbc = 0; + + if (arg9) { + spbc = PAL ? 16 : 12; + } + + mainOverrideVariable("brcol", &var800711e8); + sp120 = langGet(g_Briefing.objectivenames[index]); + y = objy; + sp12c = MIXCOLOUR(dialog, unfocused); + + if (dialog->dimmed) { + sp12c = (colourBlend(sp12c, 0, 0x2c) & 0xffffff00) | (sp12c & 0xff); + } + + textSetWaveColours(g_MenuColourPalettes3[dialog->type].unfocused, g_MenuColourPalettes2[dialog->type].unfocused); + buffer[0] = '\0'; + + // Render objective number + gdl = text0f153628(gdl); + sprintf(buffer, "%d: ", position); + textMeasure(&textheight, &textwidth, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0); + x = objx - textwidth + 25; + gdl = textRenderProjected(gdl, &x, &y, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, sp12c, width, height, 0, 0); + + x = objx + 25; + + if (arg9) { + textWrap(85, sp120, buffer, g_CharsHandelGothicXs, g_FontHandelGothicXs); + gdl = textRenderProjected(gdl, &x, &y, buffer, g_CharsHandelGothicXs, g_FontHandelGothicXs, sp12c, width, height, 0, 0); + } else { + sprintf(buffer, "%s", sp120); + gdl = textRenderProjected(gdl, &x, &y, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, sp12c, width, height, 0, 0); + } + + if (withstatus) { + switch (objectiveCheck(index)) { + case OBJECTIVE_INCOMPLETE: + spcc = langGet(L_OPTIONS_001); // "Incomplete" + spc8 = 0xffff00ff; + break; + case OBJECTIVE_COMPLETE: + spcc = langGet(L_OPTIONS_000); // "Complete" + spc8 = 0x00ff00ff; + break; + case OBJECTIVE_FAILED: + spcc = langGet(L_OPTIONS_002); // "Failed" + spc8 = 0xff4040ff; + break; + } + + if (dialog != g_Menus[g_MpPlayerNum].curdialog) { + spc8 = g_MenuColourPalettes[0].unfocused; + } + + textMeasure(&textheight, &textwidth, spcc, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0); + + if (var800711e8 != 0) { + spc8 = var800711e8; + } + + x = objx + width - textwidth - 10; + y = objy + spbc + 9; + + gdl = textRenderProjected(gdl, &x, &y, spcc, g_CharsHandelGothicXs, g_FontHandelGothicXs, spc8, width, height, 0, 0); + + x = objx + width - textwidth - 10; + y = objy + spbc + 9; + + gdl = textRenderProjected(gdl, &x, &y, spcc, g_CharsHandelGothicXs, g_FontHandelGothicXs, spc8 & 0xffffff7f, width, height, 0, 0); + + x = objx + width - textwidth - 13; + y = objy + 9; + + gdl = text0f153780(gdl); + + spb4 = objx + 22; + spb0 = objy - 2; + spac = objy + 8; + spa8 = y + spbc + 2; + tmp = (objx * 3 + objx + 66) / 4; + sp9c = x; + sp98 = tmp + 19 + (sp9c - tmp - 24) * (position - 1) / 5; + + sp58 = (objx * 3 + objx + 66) / 4 - 1; + sp54 = (objx * 3 + objx + 66) / 4 + 14; + + gdl = menugfx0f0e2498(gdl); + + // Blue lines + gdl = menugfxDrawTessellatedRect(gdl, objx, spb0, spb4, spb0 + 1, sp12c & 0xffffff00, (sp12c & 0xffffff00) | 0x3f); + gdl = menugfxDrawTessellatedRect(gdl, spb4, spb0, spb4 + 1, spac, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); + gdl = menugfxDrawTessellatedRect(gdl, objx, spac, sp58, spac + 1, sp12c & 0xffffff00, (sp12c & 0xffffff00) | 0x3f); + gdl = menugfxDrawTessellatedRect(gdl, sp58 + 3, spac, spb4 + 1, spac + 1, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); + gdl = menugfxDrawTessellatedRect(gdl, sp58, spac, sp58 + 1, spa8 + 2, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); + gdl = menugfxDrawTessellatedRect(gdl, sp58 + 2, spac, sp58 + 3, spa8, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); + gdl = menugfxDrawTessellatedRect(gdl, sp58 + 2, spa8, sp54, spa8 + 1, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); + gdl = menugfxDrawTessellatedRect(gdl, sp58, spa8 + 2, sp54, spa8 + 3, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); + gdl = menugfxDrawTessellatedRect(gdl, sp54, spa8, sp98, spa8 + 1, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); + gdl = menugfxDrawTessellatedRect(gdl, sp54, spa8 + 2, sp98, spa8 + 3, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); + + // Coloured lines + gdl = menugfxDrawTessellatedRect(gdl, sp98, spa8, sp98 + 1, spa8 + 3, (spc8 & 0xffffff00) | 0x3f, (spc8 & 0xffffff00) | 0x3f); + gdl = menugfxDrawTessellatedRect(gdl, sp98 + 1, spa8 + 1, sp9c - 4, spa8 + 2, (spc8 & 0xffffff00) | 0x3f, (spc8 & 0xffffff00) | 0x3f); + gdl = menugfxDrawTessellatedRect(gdl, sp9c - 4, spa8 + 1, sp9c, spa8 + 2, (spc8 & 0xffffff00) | 0x3f, spc8 & 0xffffff00 | 0xcf); + } else { + // Render lines without status + sp80 = objx + 22; + sp7c = objy - 2; + sp78 = objy + 8; + sp74 = y + 1; + + textMeasure(&textheight, &textwidth, sp120, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0); + + sp6c = objx + textwidth + 25; + sp58 = (objx * 3 + objx + 66) / 4 - 1; + + gdl = text0f153780(gdl); + gdl = menugfx0f0e2498(gdl); + + gdl = menugfxDrawTessellatedRect(gdl, objx, sp7c, sp80, sp7c + 1, sp12c & 0xffffff00, (sp12c & 0xffffff00) | 0x3f); + gdl = menugfxDrawTessellatedRect(gdl, sp80, sp7c, sp80 + 1, sp78, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); + gdl = menugfxDrawTessellatedRect(gdl, objx, sp78, sp58, sp78 + 1, sp12c & 0xffffff00, (sp12c & 0xffffff00) | 0x3f); + gdl = menugfxDrawTessellatedRect(gdl, sp58 + 3, sp78, sp80 + 1, sp78 + 1, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); + gdl = menugfxDrawTessellatedRect(gdl, sp58, sp78, sp58 + 1, sp74 + 2, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); + gdl = menugfxDrawTessellatedRect(gdl, sp58 + 2, sp78, sp58 + 3, sp74, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); + gdl = menugfxDrawTessellatedRect(gdl, sp58 + 2, sp74, sp6c, sp74 + 1, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f); + } + + return gdl; +} +#endif Gfx *menuitemObjectivesRender(Gfx *gdl, struct menurendercontext *context) { diff --git a/src/game/nbomb.c b/src/game/nbomb.c index 21e95056b..3fd841933 100644 --- a/src/game/nbomb.c +++ b/src/game/nbomb.c @@ -423,6 +423,7 @@ void func0f0099a4(void) } } +#if MATCHING #if PAL GLOBAL_ASM( glabel nbombInflictDamage @@ -1095,96 +1096,97 @@ glabel var7f1a7f20 /* f0099d4: 27bd0320 */ addiu $sp,$sp,0x320 ); #endif - +#else // Mismatch: different usage of callee-save registers relating to room loop -//void nbombInflictDamage(struct nbomb *nbomb) -//{ -// s32 index = 0; -// u32 stack; -// s16 propnums[256]; // 100 -// struct coord bbmin; // f4 -// struct coord bbmax; // e8 -// s16 roomnums[54]; // 7c -// s16 *propnumptr; -// s32 i; -// u8 sp70[4]; -// u32 stack2; -// -// sp70[0] = WEAPON_NBOMB; -// sp70[3] = 0; -// -// if (g_Vars.lvupdate240 <= 0 || nbomb->age240 > 350) { -// return; -// } -// -// if (g_Rooms); -// -// // Find rooms which intersect the nbomb dome's bbox -// bbmin.x = nbomb->pos.f[0] - nbomb->radius; -// bbmin.y = nbomb->pos.f[1] - nbomb->radius; -// bbmin.z = nbomb->pos.f[2] - nbomb->radius; -// -// bbmax.x = nbomb->pos.f[0] + nbomb->radius; -// bbmax.y = nbomb->pos.f[1] + nbomb->radius; -// bbmax.z = nbomb->pos.f[2] + nbomb->radius; -// -// if (g_Vars.roomcount); -// if (g_Vars.roomcount); -// -// for (i = 1; i < g_Vars.roomcount; i++) { -// if (!(bbmax.f[0] < g_Rooms[i].bbmin[0] -// || bbmin.f[0] > g_Rooms[i].bbmax[0] -// || bbmax.f[1] < g_Rooms[i].bbmin[1] -// || bbmin.f[1] > g_Rooms[i].bbmax[1] -// || bbmax.f[2] < g_Rooms[i].bbmin[2] -// || bbmin.f[2] > g_Rooms[i].bbmax[2]) -// && index < 52) { -// roomnums[index] = i; -// index++; -// roomAdjustLighting(i, -38, -180); -// } -// } -// -// roomnums[index] = -1; -// -// // Iterate props in the affected rooms and damage any chrs -// roomGetProps(roomnums, propnums, 256); -// -// propnumptr = propnums; -// -// while (*propnumptr >= 0) { -// struct prop *prop = &g_Vars.props[*propnumptr]; -// -// if (prop->timetoregen == 0) { -// if (prop->type == PROPTYPE_CHR || prop->type == PROPTYPE_PLAYER) { -// f32 xdiff = prop->pos.f[0] - nbomb->pos.f[0]; -// f32 ydiff = prop->pos.f[1] - nbomb->pos.f[1]; -// f32 zdiff = prop->pos.f[2] - nbomb->pos.f[2]; -// -// f32 dist = sqrtf(xdiff * xdiff + ydiff * ydiff + zdiff * zdiff); -// -// if (dist < nbomb->radius) { -// struct chrdata *chr = prop->chr; -// -// if (chr) { -// struct coord vector = {0, 0, 0}; -// f32 damage = 0.0099999997764826f * g_Vars.lvupdate240freal; -// -// chrDamageByMisc(chr, damage, &vector, sp70, nbomb->prop); -// -// chr->chrflags |= CHRCFLAG_TRIGGERSHOTLIST; -// -// if (chr->hidden & CHRHFLAG_CLOAKED) { -// chrUncloak(chr, true); -// } -// } -// } -// } -// } -// -// propnumptr++; -// } -//} +void nbombInflictDamage(struct nbomb *nbomb) +{ + s32 index = 0; + u32 stack; + s16 propnums[256]; // 100 + struct coord bbmin; // f4 + struct coord bbmax; // e8 + s16 roomnums[54]; // 7c + s16 *propnumptr; + s32 i; + struct gset gset; // 70 + u32 stack2; + + gset.weaponnum = WEAPON_NBOMB; + gset.weaponfunc = FUNC_PRIMARY; + + if (g_Vars.lvupdate240 <= 0 || nbomb->age240 > 350) { + return; + } + + if (g_Rooms); + + // Find rooms which intersect the nbomb dome's bbox + bbmin.x = nbomb->pos.f[0] - nbomb->radius; + bbmin.y = nbomb->pos.f[1] - nbomb->radius; + bbmin.z = nbomb->pos.f[2] - nbomb->radius; + + bbmax.x = nbomb->pos.f[0] + nbomb->radius; + bbmax.y = nbomb->pos.f[1] + nbomb->radius; + bbmax.z = nbomb->pos.f[2] + nbomb->radius; + + if (g_Vars.roomcount); + if (g_Vars.roomcount); + + for (i = 1; i < g_Vars.roomcount; i++) { + if (!(bbmax.f[0] < g_Rooms[i].bbmin[0] + || bbmin.f[0] > g_Rooms[i].bbmax[0] + || bbmax.f[1] < g_Rooms[i].bbmin[1] + || bbmin.f[1] > g_Rooms[i].bbmax[1] + || bbmax.f[2] < g_Rooms[i].bbmin[2] + || bbmin.f[2] > g_Rooms[i].bbmax[2]) + && index < 52) { + roomnums[index] = i; + index++; + roomAdjustLighting(i, -38, -180); + } + } + + roomnums[index] = -1; + + // Iterate props in the affected rooms and damage any chrs + roomGetProps(roomnums, propnums, 256); + + propnumptr = propnums; + + while (*propnumptr >= 0) { + struct prop *prop = &g_Vars.props[*propnumptr]; + + if (prop->timetoregen == 0) { + if (prop->type == PROPTYPE_CHR || prop->type == PROPTYPE_PLAYER) { + f32 xdiff = prop->pos.f[0] - nbomb->pos.f[0]; + f32 ydiff = prop->pos.f[1] - nbomb->pos.f[1]; + f32 zdiff = prop->pos.f[2] - nbomb->pos.f[2]; + + f32 dist = sqrtf(xdiff * xdiff + ydiff * ydiff + zdiff * zdiff); + + if (dist < nbomb->radius) { + struct chrdata *chr = prop->chr; + + if (chr) { + struct coord vector = {0, 0, 0}; + f32 damage = 0.0099999997764826f * g_Vars.lvupdate240freal; + + chrDamageByMisc(chr, damage, &vector, &gset, nbomb->ownerprop); + + chr->chrflags |= CHRCFLAG_TRIGGERSHOTLIST; + + if (chr->hidden & CHRHFLAG_CLOAKED) { + chrUncloak(chr, true); + } + } + } + } + } + + propnumptr++; + } +} +#endif u32 var800616e8 = 0x00000000; u32 var800616ec = 0x00000000; @@ -1451,6 +1453,7 @@ f32 gasGetDoorFrac(s32 tagnum) return 0; } +#if MATCHING #if PAL GLOBAL_ASM( glabel nbombRenderOverlay @@ -2074,134 +2077,136 @@ glabel nbombRenderOverlay /* f00a93c: 27bd0080 */ addiu $sp,$sp,0x80 ); #endif - +#else /** * Checks if the player is inside an nbomb storm, and if so renders the black * storm texture directly over the screen. */ // Mismatch: Goal has an extra move in the calculation of sp5e -//Gfx *nbombRenderOverlay(Gfx *gdl) -//{ -// u32 stack; -// struct coord campos; // 70 -// struct gfxvtx *vertices; -// u32 maxalpha; -// bool inside; -// s32 i; -// s16 sp5e; -// s16 s2; -// u32 stack2[2]; -// bool sp50 = false; -// s32 b; -// u32 *colours; // 48 -// s32 a; -// s16 viewleft; // 42 -// s16 viewtop; // 40 -// s16 viewright; // 3e -// s16 viewbottom; // 3c -// -// campos.x = g_Vars.currentplayer->cam_pos.x; -// campos.y = g_Vars.currentplayer->cam_pos.y; -// campos.z = g_Vars.currentplayer->cam_pos.z; -// -// inside = false; -// maxalpha = 0; -// -// for (i = 0; i < ARRAYCOUNT(g_Nbombs); i++) { -// if (g_Nbombs[i].age240 >= 0 && g_Nbombs[i].age240 <= TICKS(350)) { -// f32 xdiff = campos.f[0] - g_Nbombs[i].pos.f[0]; -// f32 ydiff = campos.f[1] - g_Nbombs[i].pos.f[1]; -// f32 zdiff = campos.f[2] - g_Nbombs[i].pos.f[2]; -// -// if (sqrtf(xdiff * xdiff + ydiff * ydiff + zdiff * zdiff) < g_Nbombs[i].radius) { -// u32 alpha = nbombCalculateAlpha(&g_Nbombs[i]); -// -// inside = true; -// -// if (alpha > maxalpha) { -// maxalpha = alpha; -// } -// } -// } -// } -// -// if (inside) { -// colours = gfxAllocateColours(1); -// vertices = gfxAllocateVertices(4); -// -// viewleft = viGetViewLeft() * 10; -// viewtop = viGetViewTop() * 10; -// viewright = (s16)(viGetViewLeft() + viGetViewWidth()) * 10; -// viewbottom = (s16)(viGetViewTop() + viGetViewHeight()) * 10; -// -// sp50 = true; -// -// s2 = (s32) (8.0f * var80061630 * 128.0f * 32.0f) % 2048; -// sp5e = ((s32)(campos.f[1] * 8.0f) % 2048) + (s32)(2.0f * var80061630 * 128.0f * 32.0f); -// -// if (1); -// if (1); -// -// gdl = func0f0d479c(gdl); -// -// if (1); -// -// texSelect(&gdl, &g_TexGeneralConfigs[10], 2, 1, 2, true, NULL); -// -// gDPPipeSync(gdl++); -// gDPSetCycleType(gdl++, G_CYC_1CYCLE); -// gDPSetAlphaCompare(gdl++, G_AC_NONE); -// gDPSetCombineMode(gdl++, G_CC_MODULATEIA, G_CC_MODULATEIA); -// gSPClearGeometryMode(gdl++, G_CULL_BOTH); -// gDPSetColorDither(gdl++, G_CD_DISABLE); -// gDPSetTextureFilter(gdl++, G_TF_BILERP); -// gDPSetRenderMode(gdl++, G_RM_ZB_XLU_SURF, G_RM_ZB_XLU_SURF2); -// gDPSetTexturePersp(gdl++, G_TP_PERSP); -// -// vertices[0].x = viewleft; -// vertices[0].y = viewtop; -// vertices[0].z = -10; -// -// vertices[1].x = viewright; -// vertices[1].y = viewtop; -// vertices[1].z = -10; -// -// vertices[2].x = viewright; -// vertices[2].y = viewbottom; -// vertices[2].z = -10; -// -// vertices[3].x = viewleft; -// vertices[3].y = viewbottom; -// vertices[3].z = -10; -// -// vertices[0].s = s2; -// vertices[0].t = sp5e; -// vertices[1].s = s2 + 160; -// vertices[1].t = sp5e; -// vertices[2].s = s2 + 160; -// vertices[2].t = sp5e + 960; -// vertices[3].s = s2; -// vertices[3].t = sp5e + 960; -// -// vertices[0].colour = 0; -// vertices[1].colour = 0; -// vertices[2].colour = 0; -// vertices[3].colour = 0; -// -// colours[0] = maxalpha; -// -// gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1); -// gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 4); -// gDPTri2(gdl++, 0, 1, 2, 2, 3, 0); -// } -// -// if (sp50) { -// gdl = func0f0d49c8(gdl); -// } -// -// return gdl; -//} +Gfx *nbombRenderOverlay(Gfx *gdl) +{ + u32 stack; + struct coord campos; // 70 + struct gfxvtx *vertices; + u32 maxalpha; + bool inside; + s32 i; + s16 sp5e; + s16 s2; + u32 stack2[2]; + bool sp50 = false; + s32 b; + u32 *colours; // 48 + s32 a; + s16 viewleft; // 42 + s16 viewtop; // 40 + s16 viewright; // 3e + s16 viewbottom; // 3c + campos.x = g_Vars.currentplayer->cam_pos.x; + campos.y = g_Vars.currentplayer->cam_pos.y; + campos.z = g_Vars.currentplayer->cam_pos.z; + + inside = false; + maxalpha = 0; + + for (i = 0; i < ARRAYCOUNT(g_Nbombs); i++) { + if (g_Nbombs[i].age240 >= 0 && g_Nbombs[i].age240 <= TICKS(350)) { + f32 xdiff = campos.f[0] - g_Nbombs[i].pos.f[0]; + f32 ydiff = campos.f[1] - g_Nbombs[i].pos.f[1]; + f32 zdiff = campos.f[2] - g_Nbombs[i].pos.f[2]; + + if (sqrtf(xdiff * xdiff + ydiff * ydiff + zdiff * zdiff) < g_Nbombs[i].radius) { + u32 alpha = nbombCalculateAlpha(&g_Nbombs[i]); + + inside = true; + + if (alpha > maxalpha) { + maxalpha = alpha; + } + } + } + } + + if (inside) { + colours = gfxAllocateColours(1); + vertices = gfxAllocateVertices(4); + + viewleft = viGetViewLeft() * 10; + viewtop = viGetViewTop() * 10; + viewright = (s16)(viGetViewLeft() + viGetViewWidth()) * 10; + viewbottom = (s16)(viGetViewTop() + viGetViewHeight()) * 10; + + sp50 = true; + + s2 = (s32) (8.0f * var80061630 * 128.0f * 32.0f) % 2048; + sp5e = ((s32)(campos.f[1] * 8.0f) % 2048) + (s32)(2.0f * var80061630 * 128.0f * 32.0f); + + if (1); + if (1); + + gdl = func0f0d479c(gdl); + + if (1); + + texSelect(&gdl, &g_TexGeneralConfigs[10], 2, 1, 2, true, NULL); + + gDPPipeSync(gdl++); + gDPSetCycleType(gdl++, G_CYC_1CYCLE); + gDPSetAlphaCompare(gdl++, G_AC_NONE); + gDPSetCombineMode(gdl++, G_CC_MODULATEIA, G_CC_MODULATEIA); + gSPClearGeometryMode(gdl++, G_CULL_BOTH); + gDPSetColorDither(gdl++, G_CD_DISABLE); + gDPSetTextureFilter(gdl++, G_TF_BILERP); + gDPSetRenderMode(gdl++, G_RM_ZB_XLU_SURF, G_RM_ZB_XLU_SURF2); + gDPSetTexturePersp(gdl++, G_TP_PERSP); + + vertices[0].x = viewleft; + vertices[0].y = viewtop; + vertices[0].z = -10; + + vertices[1].x = viewright; + vertices[1].y = viewtop; + vertices[1].z = -10; + + vertices[2].x = viewright; + vertices[2].y = viewbottom; + vertices[2].z = -10; + + vertices[3].x = viewleft; + vertices[3].y = viewbottom; + vertices[3].z = -10; + + vertices[0].s = s2; + vertices[0].t = sp5e; + vertices[1].s = s2 + 160; + vertices[1].t = sp5e; + vertices[2].s = s2 + 160; + vertices[2].t = sp5e + 960; + vertices[3].s = s2; + vertices[3].t = sp5e + 960; + + vertices[0].colour = 0; + vertices[1].colour = 0; + vertices[2].colour = 0; + vertices[3].colour = 0; + + colours[0] = maxalpha; + + gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1); + gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 4); + gDPTri2(gdl++, 0, 1, 2, 2, 3, 0); + } + + if (sp50) { + gdl = func0f0d49c8(gdl); + } + + return gdl; +} +#endif + +#if MATCHING GLOBAL_ASM( glabel gasRender .late_rodata @@ -2775,206 +2780,207 @@ const u32 var7f1a7ea0[] = {0x0000009a}; const u32 var7f1a7ea4[] = {0x00000091}; const u32 var7f1a7ea8[] = {0x0000008f}; const u32 var7f1a7eac[] = {0x00000090}; - +#else // Mismatch: Float calculations -//Gfx *gasRender(Gfx *gdl) -//{ -// bool show = false; -// f32 alphafrac = 1.0f; // 108 -// struct coord campos; // fc -// s16 spfa; // fa -// u32 alpha; -// s32 i; -// bool drawn = false; // ec -// const u32 gasrooms[] = { 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x91, 0x8f, 0x90 }; // bc -// f32 intensityfrac; // b8 -// u32 stack; -// f32 frac1; // b0 -// f32 frac2; -// -// f32 distance; -// u32 *colours; // a4 -// struct gfxvtx *vertices; -// s16 viewleft; // 9e -// s16 viewtop; // 9c -// s16 viewright; // 9a -// s16 viewbottom; // 98 -// f32 fVar19; -// f32 camposx; // 8c -// f32 camposz; // 88 -// f32 sp78; // 78 -// s16 sp76; // 76 -// s16 sp72; // 72 -// s16 sVar15; -// s32 uVar21; -// f32 sp38; // 38 -// -// if (g_Vars.stagenum == STAGE_ESCAPE) { -// intensityfrac = 1.0f; -// -// campos.x = g_Vars.currentplayer->cam_pos.x; -// campos.y = g_Vars.currentplayer->cam_pos.y; -// campos.z = g_Vars.currentplayer->cam_pos.z; -// -// for (i = 0; i < 12; i++) { -// if (roomContainsCoord(&campos, gasrooms[i])) { -// show = true; -// } -// } -// -// if (!show) { -// // Outside of the gas rooms list - check distance to abitrary point -// distance = sqrtf( -// (campos.f[0] - -1473.0f) * (campos.f[0] - -1473.0f) + -// (campos.f[1] - -308.0f) * (campos.f[1] - -308.0f) + -// (campos.f[2] - -13660.0f) * (campos.f[2] - -13660.0f)); -// -// if (distance < 1328.0f) { -// show = true; -// alphafrac = 1.0f - distance / 1328.0f; -// intensityfrac = gasGetDoorFrac(0x32); -// } -// } else { -// if (roomContainsCoord(&campos, 0x91)) { -// // In the small room between the first two doors -// frac1 = gasGetDoorFrac(0x30); -// frac2 = gasGetDoorFrac(0x31); -// -// if (frac2 > frac1) { -// intensityfrac = frac2; -// } else { -// intensityfrac = frac1; -// } -// -// intensityfrac += 0.2f; -// } -// } -// -// alphafrac *= intensityfrac; -// -// if (show && g_Vars.tickmode == TICKMODE_CUTSCENE) { -// if (g_CutsceneCurAnimFrame60 < 2180) { -// show = false; -// } else { -// if (g_CutsceneCurAnimFrame60 < 2600) { -// alphafrac *= (g_CutsceneCurAnimFrame60 - 2180) / 420.0f; -// } -// } -// } -// -// if (show) { -// f32 lookx; -// f32 lookz; -// f32 tmp; -// f32 tmp2; -// s32 tmp3; -// colours = gfxAllocateColours(1); -// vertices = gfxAllocateVertices(8); -// viewleft = viGetViewLeft() * 10; -// viewtop = viGetViewTop() * 10; -// viewright = (viGetViewLeft() + viGetViewWidth()) * 10; -// viewbottom = (viGetViewTop() + viGetViewHeight()) * 10; -// -// lookx = g_Vars.currentplayer->cam_look.x; -// lookz = g_Vars.currentplayer->cam_look.z; -// camposx = g_Vars.currentplayer->cam_pos.f[0]; -// camposz = g_Vars.currentplayer->cam_pos.f[2]; -// -// sp78 = atan2f(-lookx, lookz) / M_BADTAU; -// sp38 = (func0f006b08(4) - 0.5f) / 6.0f; -// -// fVar19 = (camposx + camposz) / 3000.0f; -// fVar19 -= (s32)fVar19; -// tmp = sp38 + sp78 + fVar19 * 1.5f; -// -// sp76 = (s32)((2.0f * tmp) * 128.0f * 32.0f) % 0x800; -// -// tmp2 = (func0f006b54(4) - 0.5f) / -9.0f; -// drawn = true; -// fVar19 = tmp2 + sp78 + sp38; -// -// sVar15 = (s32)((2.0f * fVar19) * 128.0f * 32.0f) % 0x800; -// -// tmp3 = (s32)(campos.y * 8.0f) % 0x800; -// -// spfa = tmp3 + (s32)((2.0f * var80061630) * 128.0f * 32.0f); -// sp72 = tmp3 + (s32)((2.0f * var80061630) * 64.0f * 32.0f); -// -// gdl = func0f0d479c(gdl); -// -// texSelect(&gdl, &g_TexGeneralConfigs[6], 4, 1, 2, 1, NULL); -// -// gDPPipeSync(gdl++); -// gDPSetCycleType(gdl++, G_CYC_1CYCLE); -// gDPSetAlphaCompare(gdl++, G_AC_NONE); -// gDPSetCombineMode(gdl++, G_CC_MODULATEIA, G_CC_MODULATEIA); -// gSPClearGeometryMode(gdl++, G_CULL_BOTH); -// gDPSetColorDither(gdl++, G_CD_DISABLE); -// gDPSetTextureFilter(gdl++, G_TF_BILERP); -// gDPSetRenderMode(gdl++, G_RM_CLD_SURF, G_RM_CLD_SURF2); -// gDPSetTexturePersp(gdl++, G_TP_PERSP); -// -// vertices[0].x = viewleft; -// vertices[0].y = viewtop; -// vertices[0].z = -10; -// vertices[1].z = -10; -// vertices[2].z = -10; -// vertices[3].z = -10; -// vertices[4].z = -10; -// vertices[5].z = -10; -// vertices[6].z = -10; -// vertices[7].z = -10; -// vertices[0].s = sVar15; -// vertices[0].t = sp72; -// vertices[1].y = viewtop; -// vertices[4].y = viewtop; -// vertices[5].y = viewtop; -// vertices[3].x = viewleft; -// vertices[4].x = viewleft; -// vertices[7].x = viewleft; -// vertices[2].y = viewbottom; -// vertices[3].y = viewbottom; -// vertices[6].y = viewbottom; -// vertices[7].y = viewbottom; -// vertices[1].x = viewright; -// vertices[2].x = viewright; -// vertices[5].x = viewright; -// vertices[6].x = viewright; -// vertices[1].s = sVar15 + 960; -// vertices[2].s = sVar15 + 960; -// vertices[2].t = sp72 + 640; -// vertices[3].s = sVar15; -// vertices[3].t = sp72 + 640; -// vertices[0].colour = 0; -// vertices[1].colour = 0; -// vertices[2].colour = 0; -// vertices[3].colour = 0; -// vertices[1].t = sp72; -// vertices[4].t = spfa; -// vertices[4].s = sp76; -// vertices[5].s = sp76 + 640; -// vertices[6].s = sp76 + 640; -// vertices[6].t = spfa + 480; -// vertices[7].t = spfa + 480; -// vertices[4].colour = 0; -// vertices[5].colour = 0; -// vertices[6].colour = 0; -// vertices[7].colour = 0; -// vertices[5].t = spfa; -// vertices[7].s = sp76; -// -// colours[0] = 0x3faf1100 | (u32)(alphafrac * 127.0f); -// -// gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1); -// gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 8); -// -// gDPTri4(gdl++, 0, 1, 2, 2, 3, 0, 4, 5, 6, 6, 7, 4); -// } -// } -// -// if (drawn) { -// gdl = func0f0d49c8(gdl); -// } -// -// return gdl; -//} +Gfx *gasRender(Gfx *gdl) +{ + bool show = false; + f32 alphafrac = 1.0f; // 108 + struct coord campos; // fc + s16 spfa; // fa + u32 alpha; + s32 i; + bool drawn = false; // ec + const u32 gasrooms[] = { 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x91, 0x8f, 0x90 }; // bc + f32 intensityfrac; // b8 + u32 stack; + f32 frac1; // b0 + f32 frac2; + + f32 distance; + u32 *colours; // a4 + struct gfxvtx *vertices; + s16 viewleft; // 9e + s16 viewtop; // 9c + s16 viewright; // 9a + s16 viewbottom; // 98 + f32 fVar19; + f32 camposx; // 8c + f32 camposz; // 88 + f32 sp78; // 78 + s16 sp76; // 76 + s16 sp72; // 72 + s16 sVar15; + s32 uVar21; + f32 sp38; // 38 + + if (g_Vars.stagenum == STAGE_ESCAPE) { + intensityfrac = 1.0f; + + campos.x = g_Vars.currentplayer->cam_pos.x; + campos.y = g_Vars.currentplayer->cam_pos.y; + campos.z = g_Vars.currentplayer->cam_pos.z; + + for (i = 0; i < 12; i++) { + if (roomContainsCoord(&campos, gasrooms[i])) { + show = true; + } + } + + if (!show) { + // Outside of the gas rooms list - check distance to abitrary point + distance = sqrtf( + (campos.f[0] - -1473.0f) * (campos.f[0] - -1473.0f) + + (campos.f[1] - -308.0f) * (campos.f[1] - -308.0f) + + (campos.f[2] - -13660.0f) * (campos.f[2] - -13660.0f)); + + if (distance < 1328.0f) { + show = true; + alphafrac = 1.0f - distance / 1328.0f; + intensityfrac = gasGetDoorFrac(0x32); + } + } else { + if (roomContainsCoord(&campos, 0x91)) { + // In the small room between the first two doors + frac1 = gasGetDoorFrac(0x30); + frac2 = gasGetDoorFrac(0x31); + + if (frac2 > frac1) { + intensityfrac = frac2; + } else { + intensityfrac = frac1; + } + + intensityfrac += 0.2f; + } + } + + alphafrac *= intensityfrac; + + if (show && g_Vars.tickmode == TICKMODE_CUTSCENE) { + if (g_CutsceneCurAnimFrame60 < 2180) { + show = false; + } else { + if (g_CutsceneCurAnimFrame60 < 2600) { + alphafrac *= (g_CutsceneCurAnimFrame60 - 2180) / 420.0f; + } + } + } + + if (show) { + f32 lookx; + f32 lookz; + f32 tmp; + f32 tmp2; + s32 tmp3; + colours = gfxAllocateColours(1); + vertices = gfxAllocateVertices(8); + viewleft = viGetViewLeft() * 10; + viewtop = viGetViewTop() * 10; + viewright = (viGetViewLeft() + viGetViewWidth()) * 10; + viewbottom = (viGetViewTop() + viGetViewHeight()) * 10; + + lookx = g_Vars.currentplayer->cam_look.x; + lookz = g_Vars.currentplayer->cam_look.z; + camposx = g_Vars.currentplayer->cam_pos.f[0]; + camposz = g_Vars.currentplayer->cam_pos.f[2]; + + sp78 = atan2f(-lookx, lookz) / M_BADTAU; + sp38 = (func0f006b08(4) - 0.5f) / 6.0f; + + fVar19 = (camposx + camposz) / 3000.0f; + fVar19 -= (s32)fVar19; + tmp = sp38 + sp78 + fVar19 * 1.5f; + + sp76 = (s32)((2.0f * tmp) * 128.0f * 32.0f) % 0x800; + + tmp2 = (func0f006b54(4) - 0.5f) / -9.0f; + drawn = true; + fVar19 = tmp2 + sp78 + sp38; + + sVar15 = (s32)((2.0f * fVar19) * 128.0f * 32.0f) % 0x800; + + tmp3 = (s32)(campos.y * 8.0f) % 0x800; + + spfa = tmp3 + (s32)((2.0f * var80061630) * 128.0f * 32.0f); + sp72 = tmp3 + (s32)((2.0f * var80061630) * 64.0f * 32.0f); + + gdl = func0f0d479c(gdl); + + texSelect(&gdl, &g_TexGeneralConfigs[6], 4, 1, 2, 1, NULL); + + gDPPipeSync(gdl++); + gDPSetCycleType(gdl++, G_CYC_1CYCLE); + gDPSetAlphaCompare(gdl++, G_AC_NONE); + gDPSetCombineMode(gdl++, G_CC_MODULATEIA, G_CC_MODULATEIA); + gSPClearGeometryMode(gdl++, G_CULL_BOTH); + gDPSetColorDither(gdl++, G_CD_DISABLE); + gDPSetTextureFilter(gdl++, G_TF_BILERP); + gDPSetRenderMode(gdl++, G_RM_CLD_SURF, G_RM_CLD_SURF2); + gDPSetTexturePersp(gdl++, G_TP_PERSP); + + vertices[0].x = viewleft; + vertices[0].y = viewtop; + vertices[0].z = -10; + vertices[1].z = -10; + vertices[2].z = -10; + vertices[3].z = -10; + vertices[4].z = -10; + vertices[5].z = -10; + vertices[6].z = -10; + vertices[7].z = -10; + vertices[0].s = sVar15; + vertices[0].t = sp72; + vertices[1].y = viewtop; + vertices[4].y = viewtop; + vertices[5].y = viewtop; + vertices[3].x = viewleft; + vertices[4].x = viewleft; + vertices[7].x = viewleft; + vertices[2].y = viewbottom; + vertices[3].y = viewbottom; + vertices[6].y = viewbottom; + vertices[7].y = viewbottom; + vertices[1].x = viewright; + vertices[2].x = viewright; + vertices[5].x = viewright; + vertices[6].x = viewright; + vertices[1].s = sVar15 + 960; + vertices[2].s = sVar15 + 960; + vertices[2].t = sp72 + 640; + vertices[3].s = sVar15; + vertices[3].t = sp72 + 640; + vertices[0].colour = 0; + vertices[1].colour = 0; + vertices[2].colour = 0; + vertices[3].colour = 0; + vertices[1].t = sp72; + vertices[4].t = spfa; + vertices[4].s = sp76; + vertices[5].s = sp76 + 640; + vertices[6].s = sp76 + 640; + vertices[6].t = spfa + 480; + vertices[7].t = spfa + 480; + vertices[4].colour = 0; + vertices[5].colour = 0; + vertices[6].colour = 0; + vertices[7].colour = 0; + vertices[5].t = spfa; + vertices[7].s = sp76; + + colours[0] = 0x3faf1100 | (u32)(alphafrac * 127.0f); + + gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1); + gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 8); + + gDPTri4(gdl++, 0, 1, 2, 2, 3, 0, 4, 5, 6, 6, 7, 4); + } + } + + if (drawn) { + gdl = func0f0d49c8(gdl); + } + + return gdl; +} +#endif diff --git a/src/game/pak.c b/src/game/pak.c index f9e18eda1..cf916183c 100644 --- a/src/game/pak.c +++ b/src/game/pak.c @@ -5432,6 +5432,7 @@ bool pak0f11d7c4(s8 device) return false; } +#if MATCHING GLOBAL_ASM( glabel pakConvertFromGbcImage /* f11d8b4: 27bdffe0 */ addiu $sp,$sp,-32 @@ -5509,7 +5510,7 @@ glabel pakConvertFromGbcImage /* f11d9bc: 03e00008 */ jr $ra /* f11d9c0: 27bd0020 */ addiu $sp,$sp,0x20 ); - +#else /** * Convert camera pixel data from the Game Boy Camera's format and write it to * a 128x128 byte array. @@ -5518,46 +5519,47 @@ glabel pakConvertFromGbcImage * linear; the two bits for each pixel are in neighbouring bytes using the same * bit index. It also appears that the GBC format is column major. */ -//void pakConvertFromGbcImage(u8 *src, u8 *dst) -//{ -// s32 i; -// s32 j; -// s32 byte; -// s32 bit; -// s32 a0; -// s32 a3; -// s32 t2; -// u8 *s2; -// -// for (i = 0; i < 16; i++) { -// a0 = (i * 16) << 4; -// -// for (j = 0; j < 16; j++) { -// s2 = &src[a0]; -// -// for (byte = 0; byte < 8; byte++) { -// t2 = (i * 8 + byte) << 7; -// a3 = j * 8; -// -// for (bit = 0; bit < 8; bit++) { -// dst[t2 + a3] = 0; -// -// if ((s2[byte * 2 + 0] & (0x80 >> bit)) == 0) { -// dst[t2 + a3] += 0x40; -// } -// -// if ((s2[byte * 2 + 1] & (0x80 >> bit)) == 0) { -// dst[t2 + a3] += 0x80; -// } -// -// a3++; -// } -// } -// -// a0 += 16; -// } -// } -//} +void pakConvertFromGbcImage(u8 *src, u8 *dst) +{ + s32 i; + s32 j; + s32 byte; + s32 bit; + s32 a0; + s32 a3; + s32 t2; + u8 *s2; + + for (i = 0; i < 16; i++) { + a0 = (i * 16) << 4; + + for (j = 0; j < 16; j++) { + s2 = &src[a0]; + + for (byte = 0; byte < 8; byte++) { + t2 = (i * 8 + byte) << 7; + a3 = j * 8; + + for (bit = 0; bit < 8; bit++) { + dst[t2 + a3] = 0; + + if ((s2[byte * 2 + 0] & (0x80 >> bit)) == 0) { + dst[t2 + a3] += 0x40; + } + + if ((s2[byte * 2 + 1] & (0x80 >> bit)) == 0) { + dst[t2 + a3] += 0x80; + } + + a3++; + } + } + + a0 += 16; + } + } +} +#endif /** * Perform operations on a 128 x 128 image. diff --git a/src/game/playermgr.c b/src/game/playermgr.c index 38739ec43..9d3f7752c 100644 --- a/src/game/playermgr.c +++ b/src/game/playermgr.c @@ -701,6 +701,7 @@ void playermgrSetAspectRatio(f32 aspect) g_Vars.currentplayer->aspect = aspect; } +#if MATCHING #if VERSION >= VERSION_NTSC_1_0 GLOBAL_ASM( glabel playermgrGetModelOfWeapon @@ -1184,67 +1185,68 @@ glabel var7f1b522c /* f128cec: 00601025 */ or $v0,$v1,$zero ); #endif +#else +s32 playermgrGetModelOfWeapon(s32 weapon) +{ + switch (weapon) { + case WEAPON_NONE: + case WEAPON_UNARMED: return -1; + case WEAPON_FALCON2: return MODEL_CHRFALCON2; + case WEAPON_MAGSEC4: return MODEL_CHRLEEGUN1; + case WEAPON_MAULER: return MODEL_CHRMAULER; + case WEAPON_DY357MAGNUM: return MODEL_CHRDY357; + case WEAPON_DY357LX: return MODEL_CHRDY357TRENT; + case WEAPON_PHOENIX: return MODEL_CHRMAIANPISTOL; + case WEAPON_FALCON2_SILENCER: return MODEL_CHRFALCON2SIL; + case WEAPON_FALCON2_SCOPE: return MODEL_CHRFALCON2SCOPE; + case WEAPON_CMP150: return MODEL_CHRCMP150; + case WEAPON_AR34: return MODEL_CHRAR34; + case WEAPON_DRAGON: return MODEL_CHRDRAGON; + case WEAPON_SUPERDRAGON: return MODEL_CHRSUPERDRAGON; + case WEAPON_K7AVENGER: return MODEL_CHRAVENGER; + case WEAPON_CYCLONE: return MODEL_CHRCYCLONE; + case WEAPON_CALLISTO: return MODEL_CHRMAIANSMG; + case WEAPON_RCP120: return MODEL_CHRRCP120; + case WEAPON_LAPTOPGUN: return MODEL_CHRPCGUN; + case WEAPON_SHOTGUN: return MODEL_CHRSHOTGUN; + case WEAPON_REAPER: return MODEL_CHRSKMINIGUN; + case WEAPON_ROCKETLAUNCHER: return MODEL_CHRDYROCKET; + case WEAPON_DEVASTATOR: return MODEL_CHRDEVASTATOR; + case WEAPON_SLAYER: return MODEL_CHRSKROCKET; + case WEAPON_FARSIGHT: return MODEL_CHRZ2020; + case WEAPON_SNIPERRIFLE: return MODEL_CHRSNIPERRIFLE; + case WEAPON_CROSSBOW: return MODEL_CHRCROSSBOW; + case WEAPON_LASER: return MODEL_CHRLASER; + case WEAPON_COMBATKNIFE: return MODEL_CHRKNIFE; + case WEAPON_TRANQUILIZER: return MODEL_CHRDRUGGUN; + case WEAPON_PSYCHOSISGUN: return MODEL_CHRDRUGGUN; + case WEAPON_NBOMB: return MODEL_CHRNBOMB; + case WEAPON_GRENADE: return MODEL_CHRGRENADE; + case WEAPON_REMOTEMINE: return MODEL_CHRREMOTEMINE; + case WEAPON_PROXIMITYMINE: return MODEL_CHRPROXIMITYMINE; + case WEAPON_TIMEDMINE: return MODEL_CHRTIMEDMINE; + case WEAPON_BRIEFCASE2: return MODEL_CHRBRIEFCASE; + case WEAPON_CLOAKINGDEVICE: return MODEL_CHRCLOAKER; + case WEAPON_PP9I: return MODEL_CHRWPPK; + case WEAPON_CC13: return MODEL_CHRTT33; + case WEAPON_KL01313: return MODEL_CHRSKORPION; + case WEAPON_KF7SPECIAL: return MODEL_CHRKALASH; + case WEAPON_ZZT: return MODEL_CHRUZI; + case WEAPON_DMC: return MODEL_CHRMP5K; + case WEAPON_AR53: return MODEL_CHRM16; + case WEAPON_RCP45: return MODEL_CHRFNP90; + case WEAPON_COMBATBOOST: return -1; + case WEAPON_HAMMER: return MODEL_CHRLUMPHAMMER; + case WEAPON_SCREWDRIVER: return MODEL_CHRSONICSCREWER; + } -//s32 playermgrGetModelOfWeapon(s32 weapon) -//{ -// switch (weapon) { -// case WEAPON_NONE: -// case WEAPON_UNARMED: return -1; -// case WEAPON_FALCON2: return MODEL_CHRFALCON2; -// case WEAPON_MAGSEC4: return MODEL_CHRLEEGUN1; -// case WEAPON_MAULER: return MODEL_CHRMAULER; -// case WEAPON_DY357MAGNUM: return MODEL_CHRDY357; -// case WEAPON_DY357LX: return MODEL_CHRDY357TRENT; -// case WEAPON_PHOENIX: return MODEL_CHRMAIANPISTOL; -// case WEAPON_FALCON2_SILENCER: return MODEL_CHRFALCON2SIL; -// case WEAPON_FALCON2_SCOPE: return MODEL_CHRFALCON2SCOPE; -// case WEAPON_CMP150: return MODEL_CHRCMP150; -// case WEAPON_AR34: return MODEL_CHRAR34; -// case WEAPON_DRAGON: return MODEL_CHRDRAGON; -// case WEAPON_SUPERDRAGON: return MODEL_CHRSUPERDRAGON; -// case WEAPON_K7AVENGER: return MODEL_CHRAVENGER; -// case WEAPON_CYCLONE: return MODEL_CHRCYCLONE; -// case WEAPON_CALLISTO: return MODEL_CHRMAIANSMG; -// case WEAPON_RCP120: return MODEL_CHRRCP120; -// case WEAPON_LAPTOPGUN: return MODEL_CHRPCGUN; -// case WEAPON_SHOTGUN: return MODEL_CHRSHOTGUN; -// case WEAPON_REAPER: return MODEL_CHRSKMINIGUN; -// case WEAPON_ROCKETLAUNCHER: return MODEL_CHRDYROCKET; -// case WEAPON_DEVASTATOR: return MODEL_CHRDEVASTATOR; -// case WEAPON_SLAYER: return MODEL_CHRSKROCKET; -// case WEAPON_FARSIGHT: return MODEL_CHRZ2020; -// case WEAPON_SNIPERRIFLE: return MODEL_CHRSNIPERRIFLE; -// case WEAPON_CROSSBOW: return MODEL_CHRCROSSBOW; -// case WEAPON_LASER: return MODEL_CHRLASER; -// case WEAPON_COMBATKNIFE: return MODEL_CHRKNIFE; -// case WEAPON_TRANQUILIZER: return MODEL_CHRDRUGGUN; -// case WEAPON_PSYCHOSISGUN: return MODEL_CHRDRUGGUN; -// case WEAPON_NBOMB: return MODEL_CHRNBOMB; -// case WEAPON_GRENADE: return MODEL_CHRGRENADE; -// case WEAPON_REMOTEMINE: return MODEL_CHRREMOTEMINE; -// case WEAPON_PROXIMITYMINE: return MODEL_CHRPROXIMITYMINE; -// case WEAPON_TIMEDMINE: return MODEL_CHRTIMEDMINE; -// case WEAPON_BRIEFCASE2: return MODEL_CHRBRIEFCASE; -// case WEAPON_CLOAKINGDEVICE: return MODEL_CHRCLOAKER; -// case WEAPON_PP9I: return MODEL_CHRWPPK; -// case WEAPON_CC13: return MODEL_CHRTT33; -// case WEAPON_KL01313: return MODEL_CHRSKORPION; -// case WEAPON_KF7SPECIAL: return MODEL_CHRKALASH; -// case WEAPON_ZZT: return MODEL_CHRUZI; -// case WEAPON_DMC: return MODEL_CHRMP5K; -// case WEAPON_AR53: return MODEL_CHRM16; -// case WEAPON_RCP45: return MODEL_CHRFNP90; -// case WEAPON_COMBATBOOST: return -1; -// case WEAPON_HAMMER: return MODEL_CHRLUMPHAMMER; -// case WEAPON_SCREWDRIVER: return MODEL_CHRSONICSCREWER; -// } -// -// if (weapon <= WEAPON_PSYCHOSISGUN) { -// return MODEL_CHRSNIPERRIFLE; -// } -// -// return -1; -//} + if (weapon <= WEAPON_PSYCHOSISGUN) { + return MODEL_CHRSNIPERRIFLE; + } + + return -1; +} +#endif void playermgrDeleteWeapon(s32 hand) { diff --git a/src/game/propobj.c b/src/game/propobj.c index 849047c24..6a315fb69 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -14058,6 +14058,7 @@ void tvscreenSetTexture(struct tvscreen *screen, s32 texturenum) screen->tconfig = (struct textureconfig *)texturenum; } +#if MATCHING GLOBAL_ASM( glabel tvscreenRender .late_rodata @@ -15049,302 +15050,303 @@ glabel var7f1aa824 /* f0809bc: 03e00008 */ jr $ra /* f0809c0: 27bd00b8 */ addiu $sp,$sp,0xb8 ); - +#else // Mismatch: Several issues, but main one is the float variables near the cosf // and sinf calls. Appears to be functionally identical. -//Gfx *tvscreenRender(struct model *model, struct modelnode *node, struct tvscreen *screen, Gfx *gdl, s32 arg4, s32 arg5) -//{ -// struct textureconfig *tconfig; -// -// if (node && (node->type & 0xff) == MODELNODETYPE_DL) { -// struct gfxvtx *vertices = gfxAllocateVertices(4); // b4 -// u8 *colours = gfxAllocateColours(1); // b0 -// Gfx *savedgdl = gdl++; // ac -// union modelrodata *rodata = node->rodata; // a8 -// union modelrwdata *rwdata = modelGetNodeRwData(model, node); // a4 -// bool yielding = false; -// -// while (!yielding) { -// u32 *cmd = &screen->cmdlist[screen->offset]; -// -// switch (cmd[0]) { -// case TVCMD_STOPSCROLL: // f07fce4 -// screen->xmidinc = 0; -// screen->ymidinc = 0; -// screen->offset++; -// break; -// case TVCMD_SCROLLRELX: // f07fcf8 -// screen->xmidfrac = 0; -// screen->xmidinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2]; -// screen->xmidold = screen->xmid; -// screen->xmidnew = screen->xmid + (s32)cmd[1] * (1.0f / 1024.0f); -// screen->offset += 3; -// break; -// case TVCMD_SCROLLRELY: // f07fd68 -// screen->ymidfrac = 0; -// screen->ymidinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2]; -// screen->ymidold = screen->ymid; -// screen->ymidnew = screen->ymid + (s32)cmd[1] * (1.0f / 1024.0f); -// screen->offset += 3; -// break; -// case TVCMD_SCROLLABSX: // f07fdd8 -// screen->xmidfrac = 0; -// screen->xmidinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2]; -// screen->xmidold = screen->xmid; -// screen->xmidnew = (s32)cmd[1] * (1.0f / 1024.0f); -// screen->offset += 3; -// break; -// case TVCMD_SCROLLABSY: // f07fe44 -// screen->ymidfrac = 0; -// screen->ymidinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2]; -// screen->ymidold = screen->ymid; -// screen->ymidnew = (s32)cmd[1] * (1.0f / 1024.0f); -// screen->offset += 3; -// break; -// case TVCMD_SCALEABSX: // f07feb0 -// screen->xscalefrac = 0; -// screen->xscaleinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2]; -// screen->xscaleold = screen->xscale; -// screen->xscalenew = (s32)cmd[1] * (1.0f / 1024.0f); -// screen->offset += 3; -// break; -// case TVCMD_SCALEABSY: // f07ff1c -// screen->yscalefrac = 0; -// screen->yscaleinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2]; -// screen->yscaleold = screen->yscale; -// screen->yscalenew = (s32)cmd[1] * (1.0f / 1024.0f); -// screen->offset += 3; -// break; -// case TVCMD_SETTEXTURE: // f07ff88 -// tvscreenSetTexture(screen, cmd[1]); -// screen->offset += 2; -// break; -// case TVCMD_PAUSE: // f07ffb4 -// if (screen->pause60 >= 0) { -// screen->pause60 -= g_Vars.lvupdate240_60; -// -// if (screen->pause60 >= 0) { -// yielding = true; -// } else { -// screen->offset += 2; -// } -// } else { -// yielding = true; -// screen->pause60 = cmd[1]; -// } -// break; -// case TVCMD_SETCMDLIST: // f080000 -// tvscreenSetCmdlist(screen, (u32 *) cmd[1]); -// break; -// case TVCMD_RANDSETCMDLIST: // f080020 -// if ((random() >> 16) < cmd[2]) { -// tvscreenSetCmdlist(screen, (u32 *) cmd[1]); -// } else { -// screen->offset += 3; -// } -// break; -// case TVCMD_RESTART: // f080074 -// screen->offset = 0; -// break; -// case TVCMD_YIELD: // f08007c -// yielding = true; -// break; -// case TVCMD_SETCOLOUR: // f080084 -// screen->colfrac = 0; -// screen->colinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2]; -// -// screen->redold = screen->red; -// screen->rednew = (cmd[1] >> 24); -// -// screen->greenold = screen->green; -// screen->greennew = (cmd[1] >> 16); -// -// screen->blueold = screen->blue; -// screen->bluenew = (cmd[1] >> 8); -// -// screen->alphaold = screen->alpha; -// screen->alphanew = cmd[1]; -// -// screen->offset += 3; -// break; -// case TVCMD_ROTATEABS: // f08011c -// screen->rot = (s32)cmd[1] * (M_BADTAU / 65536.0f); -// screen->offset += 2; -// break; -// case TVCMD_ROTATEREL: // f080140 -// screen->rot += g_Vars.lvupdate240f * (s32)cmd[1] * (M_BADTAU / 65536.0f); -// -// if (screen->rot >= M_BADTAU) { -// screen->rot -= M_BADTAU; -// } -// -// if (screen->rot < 0) { -// screen->rot += M_BADTAU; -// } -// -// screen->offset += 2; -// break; -// } -// } -// -// // Increment X scale -// if (screen->xscaleinc > 0) { -// screen->xscalefrac += screen->xscaleinc * g_Vars.lvupdate240f; -// -// if (screen->xscalefrac < 1.0f) { -// screen->xscale = screen->xscaleold + (screen->xscalenew - screen->xscaleold) * screen->xscalefrac; -// } else { -// screen->xscalefrac = 1.0f; -// screen->xscaleinc = 0; -// screen->xscale = screen->xscalenew; -// } -// } -// -// // Increment Y scale -// if (screen->yscaleinc > 0) { -// screen->yscalefrac += screen->yscaleinc * g_Vars.lvupdate240f; -// -// if (screen->yscalefrac < 1.0f) { -// screen->yscale = screen->yscaleold + (screen->yscalenew - screen->yscaleold) * screen->yscalefrac; -// } else { -// screen->yscalefrac = 1.0f; -// screen->yscaleinc = 0; -// screen->yscale = screen->yscalenew; -// } -// } -// -// // Increment X scroll -// if (screen->xmidinc > 0) { -// screen->xmidfrac += screen->xmidinc * g_Vars.lvupdate240f; -// -// if (screen->xmidfrac < 1.0f) { -// screen->xmid = screen->xmidold + (screen->xmidnew - screen->xmidold) * screen->xmidfrac; -// } else { -// screen->xmidfrac = 1.0f; -// screen->xmidinc = 0; -// screen->xmid = screen->xmidnew; -// } -// } -// -// // Increment Y scroll -// if (screen->ymidinc > 0) { -// screen->ymidfrac += screen->ymidinc * g_Vars.lvupdate240f; -// -// if (screen->ymidfrac < 1.0f) { -// screen->ymid = screen->ymidold + (screen->ymidnew - screen->ymidold) * screen->ymidfrac; -// } else { -// screen->ymidfrac = 1.0f; -// screen->ymidinc = 0; -// screen->ymid = screen->ymidnew; -// } -// } -// -// // Increment colour change -// // 370 -// if (screen->colinc > 0) { -// screen->colfrac += screen->colinc * g_Vars.lvupdate240f; -// -// // 398 -// if (screen->colfrac < 1.0f) { -// s32 r; -// s32 g; -// s32 b; -// s32 a; -// r = screen->colfrac * (screen->rednew - screen->redold); -// g = screen->colfrac * (screen->greennew - screen->greenold); -// screen->red = r + screen->redold; -// screen->green = g + screen->greenold; -// b = screen->colfrac * (screen->bluenew - screen->blueold); -// a = screen->colfrac * (screen->alphanew - screen->alphaold); -// screen->blue = b + screen->blueold; -// screen->alpha = a + screen->alphaold; -// } else { -// screen->colfrac = 1.0f; -// screen->colinc = 0; -// screen->red = screen->rednew; -// screen->green = screen->greennew; -// screen->blue = screen->bluenew; -// screen->alpha = screen->alphanew; -// } -// } -// -// // Set up everything for rendering -// rwdata->dl.vertices = vertices; -// rwdata->dl.unk08 = (u32 *) colours; -// rwdata->dl.gdl = gdl; -// -// vertices[0] = rodata->dl.vertices[0]; -// vertices[1] = rodata->dl.vertices[1]; -// vertices[2] = rodata->dl.vertices[2]; -// vertices[3] = rodata->dl.vertices[3]; -// -// if ((u32)screen->tconfig < 100) { -// tconfig = &g_TexScreenConfigs[(u32)screen->tconfig]; -// } else { -// tconfig = screen->tconfig; -// } -// -// if (tconfig != NULL) { -// f32 f20 = screen->xscale * 0.5f; -// f32 f24 = screen->yscale * 0.5f; -// f32 f14 = f20; -// f32 f16 = f24; -// -// if (screen->rot != 0) { -// f32 f22 = cosf(screen->rot) * 1.4141999483109f; -// f32 f2 = sinf(screen->rot) * 1.4141999483109f; -// -// f20 *= f22; -// f24 *= f2; -// f14 *= f2; -// f16 *= f22; -// } -// -// vertices[0].s = tconfig->width * (screen->xmid + f20) * 32; -// vertices[0].t = tconfig->height * (screen->ymid + f24) * 32; -// vertices[1].s = tconfig->width * (screen->xmid - f14) * 32; -// vertices[1].t = tconfig->height * (screen->ymid + f16) * 32; -// vertices[2].s = tconfig->width * (screen->xmid - f20) * 32; -// vertices[2].t = tconfig->height * (screen->ymid - f24) * 32; -// vertices[3].s = tconfig->width * (screen->xmid + f14) * 32; -// vertices[3].t = tconfig->height * (screen->ymid - f16) * 32; -// } -// -// if (tconfig); -// -// colours[0] = screen->red; -// colours[1] = screen->green; -// colours[2] = screen->blue; -// colours[3] = screen->alpha; -// -// vertices[0].colour = 0; -// vertices[1].colour = 0; -// vertices[2].colour = 0; -// vertices[3].colour = 0; -// -// if (screen->alpha < 255) { -// arg5 = 2; -// } -// -// // Render the image -// gSPSetGeometryMode(gdl++, G_CULL_BACK); -// -// texSelect(&gdl, tconfig, arg5, arg4, 2, 1, NULL); -// -// gSPMatrix(gdl++, osVirtualToPhysical(model->matrices), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); -// -// gMoveWd(gdl++, 1, 6, osVirtualToPhysical(vertices)); -// gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1); -// gDPSetVerticeArray(gdl++, 0x04000000, 4); -// -// gDPTri2(gdl++, 0, 1, 2, 0, 2, 3); -// gSPEndDisplayList(gdl++); -// -// gSPBranchList(savedgdl++, gdl); -// } -// -// return gdl; -//} +Gfx *tvscreenRender(struct model *model, struct modelnode *node, struct tvscreen *screen, Gfx *gdl, s32 arg4, s32 arg5) +{ + struct textureconfig *tconfig; + + if (node && (node->type & 0xff) == MODELNODETYPE_DL) { + struct gfxvtx *vertices = gfxAllocateVertices(4); // b4 + u8 *colours = gfxAllocateColours(1); // b0 + Gfx *savedgdl = gdl++; // ac + union modelrodata *rodata = node->rodata; // a8 + union modelrwdata *rwdata = modelGetNodeRwData(model, node); // a4 + bool yielding = false; + + while (!yielding) { + u32 *cmd = &screen->cmdlist[screen->offset]; + + switch (cmd[0]) { + case TVCMD_STOPSCROLL: // f07fce4 + screen->xmidinc = 0; + screen->ymidinc = 0; + screen->offset++; + break; + case TVCMD_SCROLLRELX: // f07fcf8 + screen->xmidfrac = 0; + screen->xmidinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2]; + screen->xmidold = screen->xmid; + screen->xmidnew = screen->xmid + (s32)cmd[1] * (1.0f / 1024.0f); + screen->offset += 3; + break; + case TVCMD_SCROLLRELY: // f07fd68 + screen->ymidfrac = 0; + screen->ymidinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2]; + screen->ymidold = screen->ymid; + screen->ymidnew = screen->ymid + (s32)cmd[1] * (1.0f / 1024.0f); + screen->offset += 3; + break; + case TVCMD_SCROLLABSX: // f07fdd8 + screen->xmidfrac = 0; + screen->xmidinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2]; + screen->xmidold = screen->xmid; + screen->xmidnew = (s32)cmd[1] * (1.0f / 1024.0f); + screen->offset += 3; + break; + case TVCMD_SCROLLABSY: // f07fe44 + screen->ymidfrac = 0; + screen->ymidinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2]; + screen->ymidold = screen->ymid; + screen->ymidnew = (s32)cmd[1] * (1.0f / 1024.0f); + screen->offset += 3; + break; + case TVCMD_SCALEABSX: // f07feb0 + screen->xscalefrac = 0; + screen->xscaleinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2]; + screen->xscaleold = screen->xscale; + screen->xscalenew = (s32)cmd[1] * (1.0f / 1024.0f); + screen->offset += 3; + break; + case TVCMD_SCALEABSY: // f07ff1c + screen->yscalefrac = 0; + screen->yscaleinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2]; + screen->yscaleold = screen->yscale; + screen->yscalenew = (s32)cmd[1] * (1.0f / 1024.0f); + screen->offset += 3; + break; + case TVCMD_SETTEXTURE: // f07ff88 + tvscreenSetTexture(screen, cmd[1]); + screen->offset += 2; + break; + case TVCMD_PAUSE: // f07ffb4 + if (screen->pause60 >= 0) { + screen->pause60 -= g_Vars.lvupdate240_60; + + if (screen->pause60 >= 0) { + yielding = true; + } else { + screen->offset += 2; + } + } else { + yielding = true; + screen->pause60 = cmd[1]; + } + break; + case TVCMD_SETCMDLIST: // f080000 + tvscreenSetCmdlist(screen, (u32 *) cmd[1]); + break; + case TVCMD_RANDSETCMDLIST: // f080020 + if ((random() >> 16) < cmd[2]) { + tvscreenSetCmdlist(screen, (u32 *) cmd[1]); + } else { + screen->offset += 3; + } + break; + case TVCMD_RESTART: // f080074 + screen->offset = 0; + break; + case TVCMD_YIELD: // f08007c + yielding = true; + break; + case TVCMD_SETCOLOUR: // f080084 + screen->colfrac = 0; + screen->colinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2]; + + screen->redold = screen->red; + screen->rednew = (cmd[1] >> 24); + + screen->greenold = screen->green; + screen->greennew = (cmd[1] >> 16); + + screen->blueold = screen->blue; + screen->bluenew = (cmd[1] >> 8); + + screen->alphaold = screen->alpha; + screen->alphanew = cmd[1]; + + screen->offset += 3; + break; + case TVCMD_ROTATEABS: // f08011c + screen->rot = (s32)cmd[1] * (M_BADTAU / 65536.0f); + screen->offset += 2; + break; + case TVCMD_ROTATEREL: // f080140 + screen->rot += g_Vars.lvupdate240f * (s32)cmd[1] * (M_BADTAU / 65536.0f); + + if (screen->rot >= M_BADTAU) { + screen->rot -= M_BADTAU; + } + + if (screen->rot < 0) { + screen->rot += M_BADTAU; + } + + screen->offset += 2; + break; + } + } + + // Increment X scale + if (screen->xscaleinc > 0) { + screen->xscalefrac += screen->xscaleinc * g_Vars.lvupdate240f; + + if (screen->xscalefrac < 1.0f) { + screen->xscale = screen->xscaleold + (screen->xscalenew - screen->xscaleold) * screen->xscalefrac; + } else { + screen->xscalefrac = 1.0f; + screen->xscaleinc = 0; + screen->xscale = screen->xscalenew; + } + } + + // Increment Y scale + if (screen->yscaleinc > 0) { + screen->yscalefrac += screen->yscaleinc * g_Vars.lvupdate240f; + + if (screen->yscalefrac < 1.0f) { + screen->yscale = screen->yscaleold + (screen->yscalenew - screen->yscaleold) * screen->yscalefrac; + } else { + screen->yscalefrac = 1.0f; + screen->yscaleinc = 0; + screen->yscale = screen->yscalenew; + } + } + + // Increment X scroll + if (screen->xmidinc > 0) { + screen->xmidfrac += screen->xmidinc * g_Vars.lvupdate240f; + + if (screen->xmidfrac < 1.0f) { + screen->xmid = screen->xmidold + (screen->xmidnew - screen->xmidold) * screen->xmidfrac; + } else { + screen->xmidfrac = 1.0f; + screen->xmidinc = 0; + screen->xmid = screen->xmidnew; + } + } + + // Increment Y scroll + if (screen->ymidinc > 0) { + screen->ymidfrac += screen->ymidinc * g_Vars.lvupdate240f; + + if (screen->ymidfrac < 1.0f) { + screen->ymid = screen->ymidold + (screen->ymidnew - screen->ymidold) * screen->ymidfrac; + } else { + screen->ymidfrac = 1.0f; + screen->ymidinc = 0; + screen->ymid = screen->ymidnew; + } + } + + // Increment colour change + // 370 + if (screen->colinc > 0) { + screen->colfrac += screen->colinc * g_Vars.lvupdate240f; + + // 398 + if (screen->colfrac < 1.0f) { + s32 r; + s32 g; + s32 b; + s32 a; + r = screen->colfrac * (screen->rednew - screen->redold); + g = screen->colfrac * (screen->greennew - screen->greenold); + screen->red = r + screen->redold; + screen->green = g + screen->greenold; + b = screen->colfrac * (screen->bluenew - screen->blueold); + a = screen->colfrac * (screen->alphanew - screen->alphaold); + screen->blue = b + screen->blueold; + screen->alpha = a + screen->alphaold; + } else { + screen->colfrac = 1.0f; + screen->colinc = 0; + screen->red = screen->rednew; + screen->green = screen->greennew; + screen->blue = screen->bluenew; + screen->alpha = screen->alphanew; + } + } + + // Set up everything for rendering + rwdata->dl.vertices = vertices; + rwdata->dl.colours = (struct colour *) colours; + rwdata->dl.gdl = gdl; + + vertices[0] = rodata->dl.vertices[0]; + vertices[1] = rodata->dl.vertices[1]; + vertices[2] = rodata->dl.vertices[2]; + vertices[3] = rodata->dl.vertices[3]; + + if ((u32)screen->tconfig < 100) { + tconfig = &g_TexScreenConfigs[(u32)screen->tconfig]; + } else { + tconfig = screen->tconfig; + } + + if (tconfig != NULL) { + f32 f20 = screen->xscale * 0.5f; + f32 f24 = screen->yscale * 0.5f; + f32 f14 = f20; + f32 f16 = f24; + + if (screen->rot != 0) { + f32 f22 = cosf(screen->rot) * 1.4141999483109f; + f32 f2 = sinf(screen->rot) * 1.4141999483109f; + + f20 *= f22; + f24 *= f2; + f14 *= f2; + f16 *= f22; + } + + vertices[0].s = tconfig->width * (screen->xmid + f20) * 32; + vertices[0].t = tconfig->height * (screen->ymid + f24) * 32; + vertices[1].s = tconfig->width * (screen->xmid - f14) * 32; + vertices[1].t = tconfig->height * (screen->ymid + f16) * 32; + vertices[2].s = tconfig->width * (screen->xmid - f20) * 32; + vertices[2].t = tconfig->height * (screen->ymid - f24) * 32; + vertices[3].s = tconfig->width * (screen->xmid + f14) * 32; + vertices[3].t = tconfig->height * (screen->ymid - f16) * 32; + } + + if (tconfig); + + colours[0] = screen->red; + colours[1] = screen->green; + colours[2] = screen->blue; + colours[3] = screen->alpha; + + vertices[0].colour = 0; + vertices[1].colour = 0; + vertices[2].colour = 0; + vertices[3].colour = 0; + + if (screen->alpha < 255) { + arg5 = 2; + } + + // Render the image + gSPSetGeometryMode(gdl++, G_CULL_BACK); + + texSelect(&gdl, tconfig, arg5, arg4, 2, 1, NULL); + + gSPMatrix(gdl++, osVirtualToPhysical(model->matrices), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + gMoveWd(gdl++, 1, 6, osVirtualToPhysical(vertices)); + gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1); + gDPSetVerticeArray(gdl++, 0x04000000, 4); + + gDPTri2(gdl++, 0, 1, 2, 0, 2, 3); + gSPEndDisplayList(gdl++); + + gSPBranchList(savedgdl++, gdl); + } + + return gdl; +} +#endif void objRenderProp(struct prop *prop, struct modelrenderdata *renderdata, bool xlupass) { diff --git a/src/game/propsnd.c b/src/game/propsnd.c index 47188b5dc..eb99503af 100644 --- a/src/game/propsnd.c +++ b/src/game/propsnd.c @@ -239,6 +239,7 @@ s32 propsndGetSubtitleOpacity(s32 channelnum) return 0; } +#if MATCHING #if VERSION >= VERSION_JPN_FINAL GLOBAL_ASM( glabel propsndTickChannel @@ -3423,289 +3424,290 @@ glabel var7f1ab740 /* f091a38: 00000000 */ sll $zero,$zero,0x0 ); #endif - +#else // Mismatch: Some reordered instructions -//void propsndTickChannel(s32 channelnum) -//{ -// struct audiochannel *channel = &g_AudioChannels[channelnum]; -// -//#if VERSION >= VERSION_NTSC_1_0 -// if ((channel->flags2 & AUDIOCHANNELFLAG2_0080) == 0 -// && channel->unk28 != 11 -// && ((channel->audiohandle != NULL && sndGetState(channel->audiohandle) != AL_STOPPED) -// || (channel->flags & AUDIOCHANNELFLAG_0002) -// || (channel->flags & AUDIOCHANNELFLAG_1000) -// || ((channel->flags & AUDIOCHANNELFLAG_ISMP3) && sndIsPlayingMp3()))) -//#else -// if ((channel->audiohandle != NULL && sndGetState(channel->audiohandle) != AL_STOPPED) -// || (channel->flags & AUDIOCHANNELFLAG_0002) -// || (channel->flags & AUDIOCHANNELFLAG_1000) -// || ((channel->flags & AUDIOCHANNELFLAG_ISMP3) && sndIsPlayingMp3())) -//#endif -// { -// struct coord *pos = NULL; // 50 -// s16 *rooms = NULL; // 4c -// s32 sp48; -// s32 sp44; -// s32 sp40; -// f32 sp3c; -// -// if (channel->prop) { -// pos = &channel->prop->pos; -// rooms = channel->prop->rooms; -// } else if (channel->rooms[0] != -1) { -// rooms = channel->rooms; -// } -// -// if (channel->posptr != NULL) { -// pos = channel->posptr; -// } -// -// if (1); -// -// if (g_Vars.langfilteron && (channel->flags2 & AUDIOCHANNELFLAG2_OFFENSIVE)) { -// channel->unk04 = 0; -// } else if (channel->flags2 & AUDIOCHANNELFLAG2_0010) { -// if ((channel->flags & AUDIOCHANNELFLAG_1000) == 0) { -// return; -// } -// -// channel->unk04 = channel->unk10; -// } else { -// if (pos && rooms) { -// s16 *tmprooms; -// -// if (channel->flags & AUDIOCHANNELFLAG_8000) { -// tmprooms = NULL; -// } else { -// tmprooms = rooms; -// } -// -// var8006ae50 = channel->unk2c; -// -// channel->unk04 = propsnd0f0946b0(pos, channel->unk34, channel->unk38, channel->unk3c, -// tmprooms, channel->soundnum26, channel->unk10, &channel->unk4c); -// } -// -// if ((channel->flags & AUDIOCHANNELFLAG_0020) == 0) { -// channel->unk0a = propsnd0f094d78(pos, channel->unk34, channel->unk38, channel->unk3c, -// channel->unk4c, channel->flags & AUDIOCHANNELFLAG_0800, &channel->audiohandle); -// } -// } -// -// if (rooms != NULL && rooms[0] != -1) { -// channel->unk0c = 0; -// channel->unk1a = 1; -// } else { -// channel->unk0c = 0; -// channel->unk1a = 1; -// } -// -// if (channel->audiohandle != NULL && channel->unk44 > 0.0f) { -// if (channel->unk48 < 0.0f) { -// sp3c = channel->unk44; -// } else if (channel->unk20 > 0.0f) { -// sp3c = channel->unk48 + (channel->unk44 - channel->unk48) * g_Vars.lvupdate240 / channel->unk20; -// } else { -// sp3c = channel->unk44; -// } -// } else { -// sp3c = -1.0f; -// } -// -// sp44 = channel->unk0a; -// sp48 = channel->unk06; -// sp40 = channel->unk0c; -// -// if (channel->unk06 == -1) { -// sp48 = channel->unk04; -// } else if (channel->unk1c >= 0) { -// if (channel->unk1c > g_Vars.lvupdate240_60) { -// sp48 = channel->unk06 + (channel->unk04 - channel->unk06) * g_Vars.lvupdate240_60 / channel->unk1c; -// } -// -// channel->unk1c -= g_Vars.lvupdate240_60; -// } else if (channel->unk18 && channel->unk06 != channel->unk04) { -// f32 f12 = channel->unk04 - channel->unk06; -//#if VERSION >= VERSION_PAL_BETA -// f32 f14 = g_Vars.lvupdate240freal * (1.0f / 6000.0f) * channel->unk18; -//#else -// f32 f14 = g_Vars.lvupdate240_60 * (1.0f / 6000.0f) * channel->unk18; -//#endif -// -// if (ABS(f12) > 1.0f) { -// if (f14 > 1.0f) { -// f14 = 1.0f; -// } -// -// if (ABS(f14 * f12) > 1.0f) { -// sp48 = channel->unk06 + (s32) (f14 * f12); -// } -// } -// } else { -// sp48 = channel->unk04; -// } -// -// if (lvIsPaused() -// || (mpIsPaused() && (channel->flags2 & AUDIOCHANNELFLAG2_0002)) -// || (mpIsPaused() && PLAYERCOUNT() == 1)) { -// channel->unk06 = -1; -// sp48 = 0; -// } -// -// if (sp48 != channel->unk06) { -// channel->unk06 = sp48; -// } else { -// sp48 = -1; -// } -// -//#if VERSION >= VERSION_NTSC_1_0 -// if (channel->unk0a != channel->unk08) { -// if (channel->flags & AUDIOCHANNELFLAG_1000) { -// channel->unk08 = channel->unk0a; -// sp44 = channel->unk08; -// } else { -// s32 diff = channel->unk0a - channel->unk08; -// s32 lvupdate = g_Vars.lvupdate240 * 512 / 240; -// s32 dir = diff < 0 ? -1 : 1; -// s32 absdiff = ABS(diff); -// s32 amount = absdiff < lvupdate ? absdiff : lvupdate; -// -// channel->unk08 += amount * dir; -// sp44 = channel->unk08; -// } -// -// channel->flags |= AUDIOCHANNELFLAG_4000; -// } else { -// sp44 = -1; -// } -//#else -// if (sp44 != channel->unk08) { -// channel->flags |= AUDIOCHANNELFLAG_4000; -// channel->unk08 = sp44; -// } else { -// sp44 = -1; -// } -//#endif -// -// if (sp40 != channel->unk0e) { -// channel->unk0e = sp40; -// } else { -// sp40 = -1; -// } -// -// if (sp3c > 0.0f && ABS(sp3c - channel->unk48) > 0.01f) { -// channel->unk48 = sp3c; -// } else { -// sp3c = -1.0f; -// } -// -// if (channel->flags & AUDIOCHANNELFLAG_0002) { -// if (channel->unk06 > 0) { -// if (channel->flags & AUDIOCHANNELFLAG_2000) { -// channel->flags &= ~AUDIOCHANNELFLAG_2000; -// channel->flags |= AUDIOCHANNELFLAG_1000; -// } -// } else { -// if ((channel->flags & AUDIOCHANNELFLAG_2000) == 0) { -// if (channel->audiohandle != NULL && sndGetState(channel->audiohandle) != AL_STOPPED) { -// audioStop(channel->audiohandle); -//#if VERSION < VERSION_NTSC_1_0 -// channel->audiohandle = NULL; -//#endif -// } -// -// channel->flags |= AUDIOCHANNELFLAG_2000; -// } -// -//#if VERSION >= VERSION_NTSC_1_0 -// channel->flags &= ~AUDIOCHANNELFLAG_1000; -//#endif -// } -// } -// -// if ((channel->flags & AUDIOCHANNELFLAG_2000) == 0) { -// if (channel->flags & AUDIOCHANNELFLAG_1000) { -// if (channel->flags & AUDIOCHANNELFLAG_ISMP3) { -// sndStartMp3(channel->soundnum26, sp48, sp44, (channel->flags2 & AUDIOCHANNELFLAG2_0001) ? 1 : 0); -// } else { -//#if VERSION >= VERSION_NTSC_1_0 -// if (channel->flags & AUDIOCHANNELFLAG_0400) { -// if (sp48) { -// snd00010718(&channel->audiohandle, channel->flags & AUDIOCHANNELFLAG_ISMP3, sp48, sp44, -// channel->soundnum26, sp3c, channel->unk1a, sp40, 1); -// } -// } else { -// if (sp48) { -// snd00010718(&channel->audiohandle, channel->flags & AUDIOCHANNELFLAG_ISMP3, sp48, sp44, -// channel->soundnum26, sp3c, channel->unk1a, sp40, 1); -// } -// } -//#else -// snd00010718(&channel->audiohandle, channel->flags & AUDIOCHANNELFLAG_ISMP3, sp48, sp44, -// channel->soundnum26, sp3c, channel->unk1a, sp40, 1); -//#endif -// } -// -// channel->flags &= ~AUDIOCHANNELFLAG_1000; -// } else { -// sndAdjust(&channel->audiohandle, channel->flags & AUDIOCHANNELFLAG_ISMP3, sp48, sp44, -// channel->soundnum26, sp3c, channel->unk1a, sp40, channel->flags & AUDIOCHANNELFLAG_4000); -// } -// } -// } else { -//#if VERSION >= VERSION_NTSC_1_0 -// if (channel->unk28 != 11) { -// if (channel->flags & AUDIOCHANNELFLAG_ISMP3) { -// if (!sndIsPlayingMp3()) { -// if (channel->flags & AUDIOCHANNELFLAG_FORPROP) { -// propDecrementSoundCount(channel->prop); -// } -// -// if (channel->flags & AUDIOCHANNELFLAG_FORHUDMSG) { -// hudmsgsHideByChannel(channelnum); -// } -// } -// -// channel->flags = AUDIOCHANNELFLAG_IDLE; -// } else if (channel->audiohandle == NULL) { -// if (channel->flags & AUDIOCHANNELFLAG_FORPROP) { -// propDecrementSoundCount(channel->prop); -// } -// -// channel->flags = AUDIOCHANNELFLAG_IDLE; -// } -// } -//#else -// if (channel->flags & AUDIOCHANNELFLAG_ISMP3) { -// if (!sndIsPlayingMp3()) { -// if (channel->flags & AUDIOCHANNELFLAG_FORPROP) { -// propDecrementSoundCount(channel->prop); -// } -// -// if (channel->flags & AUDIOCHANNELFLAG_FORHUDMSG) { -// hudmsgsHideByChannel(channelnum); -// } -// } -// } else if (channel->audiohandle == NULL) { -// if (channel->flags & AUDIOCHANNELFLAG_FORPROP) { -// propDecrementSoundCount(channel->prop); -// } -// } -// -// channel->flags = AUDIOCHANNELFLAG_IDLE; -//#endif -// } -// -// if (var8006ae44 && (channel->flags2 & AUDIOCHANNELFLAG2_0004)) { -// propsndPrintChannel(channel); -// } -// -//#if VERSION >= VERSION_NTSC_1_0 -// channel->flags &= ~AUDIOCHANNELFLAG_1000; -//#endif -// channel->flags &= ~AUDIOCHANNELFLAG_4000; -//} +void propsndTickChannel(s32 channelnum) +{ + struct audiochannel *channel = &g_AudioChannels[channelnum]; + +#if VERSION >= VERSION_NTSC_1_0 + if ((channel->flags2 & AUDIOCHANNELFLAG2_0080) == 0 + && channel->unk28 != 11 + && ((channel->audiohandle != NULL && sndGetState(channel->audiohandle) != AL_STOPPED) + || (channel->flags & AUDIOCHANNELFLAG_0002) + || (channel->flags & AUDIOCHANNELFLAG_1000) + || ((channel->flags & AUDIOCHANNELFLAG_ISMP3) && sndIsPlayingMp3()))) +#else + if ((channel->audiohandle != NULL && sndGetState(channel->audiohandle) != AL_STOPPED) + || (channel->flags & AUDIOCHANNELFLAG_0002) + || (channel->flags & AUDIOCHANNELFLAG_1000) + || ((channel->flags & AUDIOCHANNELFLAG_ISMP3) && sndIsPlayingMp3())) +#endif + { + struct coord *pos = NULL; // 50 + s16 *rooms = NULL; // 4c + s32 sp48; + s32 sp44; + s32 sp40; + f32 sp3c; + + if (channel->prop) { + pos = &channel->prop->pos; + rooms = channel->prop->rooms; + } else if (channel->rooms[0] != -1) { + rooms = channel->rooms; + } + + if (channel->posptr != NULL) { + pos = channel->posptr; + } + + if (1); + + if (g_Vars.langfilteron && (channel->flags2 & AUDIOCHANNELFLAG2_OFFENSIVE)) { + channel->unk04 = 0; + } else if (channel->flags2 & AUDIOCHANNELFLAG2_0010) { + if ((channel->flags & AUDIOCHANNELFLAG_1000) == 0) { + return; + } + + channel->unk04 = channel->unk10; + } else { + if (pos && rooms) { + s16 *tmprooms; + + if (channel->flags & AUDIOCHANNELFLAG_8000) { + tmprooms = NULL; + } else { + tmprooms = rooms; + } + + var8006ae50 = channel->unk2c; + + channel->unk04 = propsnd0f0946b0(pos, channel->unk34, channel->unk38, channel->unk3c, + tmprooms, channel->soundnum26, channel->unk10, &channel->unk4c); + } + + if ((channel->flags & AUDIOCHANNELFLAG_0020) == 0) { + channel->unk0a = propsnd0f094d78(pos, channel->unk34, channel->unk38, channel->unk3c, + channel->unk4c, channel->flags & AUDIOCHANNELFLAG_0800, channel); + } + } + + if (rooms != NULL && rooms[0] != -1) { + channel->unk0c = 0; + channel->unk1a = 1; + } else { + channel->unk0c = 0; + channel->unk1a = 1; + } + + if (channel->audiohandle != NULL && channel->unk44 > 0.0f) { + if (channel->unk48 < 0.0f) { + sp3c = channel->unk44; + } else if (channel->unk20 > 0.0f) { + sp3c = channel->unk48 + (channel->unk44 - channel->unk48) * g_Vars.lvupdate240 / channel->unk20; + } else { + sp3c = channel->unk44; + } + } else { + sp3c = -1.0f; + } + + sp44 = channel->unk0a; + sp48 = channel->unk06; + sp40 = channel->unk0c; + + if (channel->unk06 == -1) { + sp48 = channel->unk04; + } else if (channel->unk1c >= 0) { + if (channel->unk1c > g_Vars.lvupdate240_60) { + sp48 = channel->unk06 + (channel->unk04 - channel->unk06) * g_Vars.lvupdate240_60 / channel->unk1c; + } + + channel->unk1c -= g_Vars.lvupdate240_60; + } else if (channel->unk18 && channel->unk06 != channel->unk04) { + f32 f12 = channel->unk04 - channel->unk06; +#if VERSION >= VERSION_PAL_BETA + f32 f14 = g_Vars.lvupdate240freal * (1.0f / 6000.0f) * channel->unk18; +#else + f32 f14 = g_Vars.lvupdate240_60 * (1.0f / 6000.0f) * channel->unk18; +#endif + + if (ABS(f12) > 1.0f) { + if (f14 > 1.0f) { + f14 = 1.0f; + } + + if (ABS(f14 * f12) > 1.0f) { + sp48 = channel->unk06 + (s32) (f14 * f12); + } + } + } else { + sp48 = channel->unk04; + } + + if (lvIsPaused() + || (mpIsPaused() && (channel->flags2 & AUDIOCHANNELFLAG2_0002)) + || (mpIsPaused() && PLAYERCOUNT() == 1)) { + channel->unk06 = -1; + sp48 = 0; + } + + if (sp48 != channel->unk06) { + channel->unk06 = sp48; + } else { + sp48 = -1; + } + +#if VERSION >= VERSION_NTSC_1_0 + if (channel->unk0a != channel->unk08) { + if (channel->flags & AUDIOCHANNELFLAG_1000) { + channel->unk08 = channel->unk0a; + sp44 = channel->unk08; + } else { + s32 diff = channel->unk0a - channel->unk08; + s32 lvupdate = g_Vars.lvupdate240 * 512 / 240; + s32 dir = diff < 0 ? -1 : 1; + s32 absdiff = ABS(diff); + s32 amount = absdiff < lvupdate ? absdiff : lvupdate; + + channel->unk08 += amount * dir; + sp44 = channel->unk08; + } + + channel->flags |= AUDIOCHANNELFLAG_4000; + } else { + sp44 = -1; + } +#else + if (sp44 != channel->unk08) { + channel->flags |= AUDIOCHANNELFLAG_4000; + channel->unk08 = sp44; + } else { + sp44 = -1; + } +#endif + + if (sp40 != channel->unk0e) { + channel->unk0e = sp40; + } else { + sp40 = -1; + } + + if (sp3c > 0.0f && ABS(sp3c - channel->unk48) > 0.01f) { + channel->unk48 = sp3c; + } else { + sp3c = -1.0f; + } + + if (channel->flags & AUDIOCHANNELFLAG_0002) { + if (channel->unk06 > 0) { + if (channel->flags & AUDIOCHANNELFLAG_2000) { + channel->flags &= ~AUDIOCHANNELFLAG_2000; + channel->flags |= AUDIOCHANNELFLAG_1000; + } + } else { + if ((channel->flags & AUDIOCHANNELFLAG_2000) == 0) { + if (channel->audiohandle != NULL && sndGetState(channel->audiohandle) != AL_STOPPED) { + audioStop(channel->audiohandle); +#if VERSION < VERSION_NTSC_1_0 + channel->audiohandle = NULL; +#endif + } + + channel->flags |= AUDIOCHANNELFLAG_2000; + } + +#if VERSION >= VERSION_NTSC_1_0 + channel->flags &= ~AUDIOCHANNELFLAG_1000; +#endif + } + } + + if ((channel->flags & AUDIOCHANNELFLAG_2000) == 0) { + if (channel->flags & AUDIOCHANNELFLAG_1000) { + if (channel->flags & AUDIOCHANNELFLAG_ISMP3) { + sndStartMp3(channel->soundnum26, sp48, sp44, (channel->flags2 & AUDIOCHANNELFLAG2_0001) ? 1 : 0); + } else { +#if VERSION >= VERSION_NTSC_1_0 + if (channel->flags & AUDIOCHANNELFLAG_0400) { + if (sp48) { + snd00010718(&channel->audiohandle, channel->flags & AUDIOCHANNELFLAG_ISMP3, sp48, sp44, + channel->soundnum26, sp3c, channel->unk1a, sp40, 1); + } + } else { + if (sp48) { + snd00010718(&channel->audiohandle, channel->flags & AUDIOCHANNELFLAG_ISMP3, sp48, sp44, + channel->soundnum26, sp3c, channel->unk1a, sp40, 1); + } + } +#else + snd00010718(&channel->audiohandle, channel->flags & AUDIOCHANNELFLAG_ISMP3, sp48, sp44, + channel->soundnum26, sp3c, channel->unk1a, sp40, 1); +#endif + } + + channel->flags &= ~AUDIOCHANNELFLAG_1000; + } else { + sndAdjust(&channel->audiohandle, channel->flags & AUDIOCHANNELFLAG_ISMP3, sp48, sp44, + channel->soundnum26, sp3c, channel->unk1a, sp40, channel->flags & AUDIOCHANNELFLAG_4000); + } + } + } else { +#if VERSION >= VERSION_NTSC_1_0 + if (channel->unk28 != 11) { + if (channel->flags & AUDIOCHANNELFLAG_ISMP3) { + if (!sndIsPlayingMp3()) { + if (channel->flags & AUDIOCHANNELFLAG_FORPROP) { + propDecrementSoundCount(channel->prop); + } + + if (channel->flags & AUDIOCHANNELFLAG_FORHUDMSG) { + hudmsgsHideByChannel(channelnum); + } + } + + channel->flags = AUDIOCHANNELFLAG_IDLE; + } else if (channel->audiohandle == NULL) { + if (channel->flags & AUDIOCHANNELFLAG_FORPROP) { + propDecrementSoundCount(channel->prop); + } + + channel->flags = AUDIOCHANNELFLAG_IDLE; + } + } +#else + if (channel->flags & AUDIOCHANNELFLAG_ISMP3) { + if (!sndIsPlayingMp3()) { + if (channel->flags & AUDIOCHANNELFLAG_FORPROP) { + propDecrementSoundCount(channel->prop); + } + + if (channel->flags & AUDIOCHANNELFLAG_FORHUDMSG) { + hudmsgsHideByChannel(channelnum); + } + } + } else if (channel->audiohandle == NULL) { + if (channel->flags & AUDIOCHANNELFLAG_FORPROP) { + propDecrementSoundCount(channel->prop); + } + } + + channel->flags = AUDIOCHANNELFLAG_IDLE; +#endif + } + + if (var8006ae44 && (channel->flags2 & AUDIOCHANNELFLAG2_0004)) { + propsndPrintChannel(channel); + } + +#if VERSION >= VERSION_NTSC_1_0 + channel->flags &= ~AUDIOCHANNELFLAG_1000; +#endif + channel->flags &= ~AUDIOCHANNELFLAG_4000; +} +#endif void propsndTick(void) { diff --git a/src/game/sight.c b/src/game/sight.c index aa9ba4c78..42ebae970 100644 --- a/src/game/sight.c +++ b/src/game/sight.c @@ -1147,6 +1147,7 @@ Gfx *sightDrawSkedar(Gfx *gdl, bool sighton) return gdl; } +#if MATCHING GLOBAL_ASM( glabel sightDrawZoom .late_rodata @@ -3251,152 +3252,153 @@ glabel var7f1ade54 /* f0dc168: 03e00008 */ jr $ra /* f0dc16c: 00000000 */ nop ); - +#else // Mismatch: Goal loads 1.0f into $at earlier -//Gfx *sightDrawZoom(Gfx *gdl, bool sighton) -//{ -// s32 viewleft; // fc -// s32 viewtop; // f8 -// s32 halfwidth; // f4 -// s32 halfheight; // f0 -// s32 viewright; -// s32 viewbottom; // e8 -// f32 maxfovy; -// s32 availableabove; // e0 -// s32 availablebelow; // dc -// s32 availableleft; -// s32 availableright; -// f32 zoominfovy; -// f32 frac; // cc -// -// f32 boxright; // 50 -// f32 boxtop; // 4c -// f32 boxbottom; // 48 -// f32 boxleft; -// -// s32 outerwidth; -// s32 outerheight; // b4 -// s32 weaponnum; // b0 -// u8 showzoomrange; // af -// -// s32 innerwidth; -// s32 innerheight; -// -// viewleft = viGetViewLeft() / g_ScaleX; -// viewtop = viGetViewTop(); -// halfwidth = (viGetViewWidth() / g_ScaleX) >> 1; -// halfheight = viGetViewHeight() >> 1; -// viewright = viewleft + halfwidth * 2 - 1; -// viewbottom = viewtop + halfheight * 2 - 1; -// -// availableleft = halfwidth - 48; -// availableright = halfwidth - 49; -// availableabove = halfheight - 10; -// availablebelow = halfheight - 10; -// frac = 1.0f; -// weaponnum = g_Vars.currentplayer->hands[HAND_RIGHT].gset.weaponnum; -// outerwidth = (halfwidth >> 1) - 60; -// outerheight = (halfheight >> 1) - 22; -// -// showzoomrange = optionsGetShowZoomRange(g_Vars.currentplayerstats->mpindex) -// && optionsGetSightOnScreen(g_Vars.currentplayerstats->mpindex); -// -// maxfovy = currentPlayerGetGunZoomFov(); -// zoominfovy = g_Vars.currentplayer->zoominfovy; -// -// if (maxfovy == 0.0f || maxfovy == 60.0f) { -// if (weaponnum != WEAPON_SNIPERRIFLE) { -// showzoomrange = false; -// } -// } else { -// frac = maxfovy / zoominfovy; -// } -// -// if (showzoomrange) { -// gdl = text0f153628(gdl); -// gdl = textSetPrimColour(gdl, 0x00ff0028); -// -// if (frac < 0.2f) { -// outerwidth *= 0.2f; -// outerheight *= 0.2f; -// } else { -// outerwidth *= frac; -// outerheight *= frac; -// } -// -// if (PLAYERCOUNT() >= 2) { -// outerheight *= 2; -// } -// -// if (outerwidth < 5) { -// outerwidth = 5; -// } -// -// if (outerheight < 5) { -// outerheight = 5; -// } -// -// // a600 -// boxtop = viewtop + (halfheight - availableabove * frac); -// boxleft = viewleft + (halfwidth - availableleft * frac); -// boxright = viewright - (halfwidth - availableright * frac); -// boxbottom = viewbottom - (halfheight - availablebelow * frac); -// -// // Goal loads 1.0f into $at around here -// // (The +1s in the GBI macros are floats) -// -// if (outerwidth > boxright - boxleft) { -// outerwidth = boxright - boxleft; -// } -// -// if (outerheight > boxbottom - boxtop) { -// outerheight = boxbottom - boxtop; -// } -// -// // a72c -// // Top left outer -// gDPFillRectangleScaled(gdl++, boxleft + 1, boxtop, boxleft + outerwidth - 1 + 1, boxtop + 1); -// gDPFillRectangleScaled(gdl++, boxleft, boxtop, boxleft + 1, boxtop + outerheight - 1 + 1); -// -// // Top right outer -// gDPFillRectangleScaled(gdl++, boxright - outerwidth + 2, boxtop, boxright - 1 + 1, boxtop + 1); -// gDPFillRectangleScaled(gdl++, boxright, boxtop, boxright + 1, boxtop + outerheight - 1 + 1); -// -// // Bottom left outer -// gDPFillRectangleScaled(gdl++, boxleft + 1, boxbottom, boxleft + outerwidth - 1 + 1, boxbottom + 1); -// gDPFillRectangleScaled(gdl++, boxleft, boxbottom - outerheight + 1, boxleft + 1, boxbottom + 1); -// -// // Bottom right outer -// gDPFillRectangleScaled(gdl++, boxright - outerwidth + 2, boxbottom, boxright - 1 + 1, boxbottom + 1); -// gDPFillRectangleScaled(gdl++, boxright, boxbottom - outerheight + 1, boxright + 1, boxbottom + 1); -// -// innerwidth = outerwidth >> 1; -// innerheight = outerheight >> 1; -// -// // Top left inner -// gDPFillRectangleScaled(gdl++, boxleft, boxtop, boxleft + innerwidth + 1, boxtop + 1); -// gDPFillRectangleScaled(gdl++, boxleft, boxtop, boxleft + 1, boxtop + innerheight + 1); -// -// // Top right inner -// gDPFillRectangleScaled(gdl++, boxright - innerwidth, boxtop, boxright + 1, boxtop + 1); -// gDPFillRectangleScaled(gdl++, boxright, boxtop, boxright + 1, boxtop + innerheight + 1); -// -// // Bottom left inner -// gDPFillRectangleScaled(gdl++, boxleft, boxbottom, boxleft + innerwidth + 1, boxbottom + 1); -// gDPFillRectangleScaled(gdl++, boxleft, boxbottom - innerheight, boxleft + 1, boxbottom + 1); -// -// // Bottom right inner -// gDPFillRectangleScaled(gdl++, boxright - innerwidth, boxbottom, boxright + 1, boxbottom + 1); -// gDPFillRectangleScaled(gdl++, boxright, boxbottom - innerheight, boxright + 1, boxbottom + 1); -// -// gdl = text0f153838(gdl); -// gdl = text0f153780(gdl); -// } -// -// gdl = sightDrawDefault(gdl, sighton); -// -// return gdl; -//} +Gfx *sightDrawZoom(Gfx *gdl, bool sighton) +{ + s32 viewleft; // fc + s32 viewtop; // f8 + s32 halfwidth; // f4 + s32 halfheight; // f0 + s32 viewright; + s32 viewbottom; // e8 + f32 maxfovy; + s32 availableabove; // e0 + s32 availablebelow; // dc + s32 availableleft; + s32 availableright; + f32 zoominfovy; + f32 frac; // cc + + f32 boxright; // 50 + f32 boxtop; // 4c + f32 boxbottom; // 48 + f32 boxleft; + + s32 outerwidth; + s32 outerheight; // b4 + s32 weaponnum; // b0 + u8 showzoomrange; // af + + s32 innerwidth; + s32 innerheight; + + viewleft = viGetViewLeft() / g_ScaleX; + viewtop = viGetViewTop(); + halfwidth = (viGetViewWidth() / g_ScaleX) >> 1; + halfheight = viGetViewHeight() >> 1; + viewright = viewleft + halfwidth * 2 - 1; + viewbottom = viewtop + halfheight * 2 - 1; + + availableleft = halfwidth - 48; + availableright = halfwidth - 49; + availableabove = halfheight - 10; + availablebelow = halfheight - 10; + frac = 1.0f; + weaponnum = g_Vars.currentplayer->hands[HAND_RIGHT].gset.weaponnum; + outerwidth = (halfwidth >> 1) - 60; + outerheight = (halfheight >> 1) - 22; + + showzoomrange = optionsGetShowZoomRange(g_Vars.currentplayerstats->mpindex) + && optionsGetSightOnScreen(g_Vars.currentplayerstats->mpindex); + + maxfovy = currentPlayerGetGunZoomFov(); + zoominfovy = g_Vars.currentplayer->zoominfovy; + + if (maxfovy == 0.0f || maxfovy == 60.0f) { + if (weaponnum != WEAPON_SNIPERRIFLE) { + showzoomrange = false; + } + } else { + frac = maxfovy / zoominfovy; + } + + if (showzoomrange) { + gdl = text0f153628(gdl); + gdl = textSetPrimColour(gdl, 0x00ff0028); + + if (frac < 0.2f) { + outerwidth *= 0.2f; + outerheight *= 0.2f; + } else { + outerwidth *= frac; + outerheight *= frac; + } + + if (PLAYERCOUNT() >= 2) { + outerheight *= 2; + } + + if (outerwidth < 5) { + outerwidth = 5; + } + + if (outerheight < 5) { + outerheight = 5; + } + + // a600 + boxtop = viewtop + (halfheight - availableabove * frac); + boxleft = viewleft + (halfwidth - availableleft * frac); + boxright = viewright - (halfwidth - availableright * frac); + boxbottom = viewbottom - (halfheight - availablebelow * frac); + + // Goal loads 1.0f into $at around here + // (The +1s in the GBI macros are floats) + + if (outerwidth > boxright - boxleft) { + outerwidth = boxright - boxleft; + } + + if (outerheight > boxbottom - boxtop) { + outerheight = boxbottom - boxtop; + } + + // a72c + // Top left outer + gDPFillRectangleScaled(gdl++, boxleft + 1, boxtop, boxleft + outerwidth - 1 + 1, boxtop + 1); + gDPFillRectangleScaled(gdl++, boxleft, boxtop, boxleft + 1, boxtop + outerheight - 1 + 1); + + // Top right outer + gDPFillRectangleScaled(gdl++, boxright - outerwidth + 2, boxtop, boxright - 1 + 1, boxtop + 1); + gDPFillRectangleScaled(gdl++, boxright, boxtop, boxright + 1, boxtop + outerheight - 1 + 1); + + // Bottom left outer + gDPFillRectangleScaled(gdl++, boxleft + 1, boxbottom, boxleft + outerwidth - 1 + 1, boxbottom + 1); + gDPFillRectangleScaled(gdl++, boxleft, boxbottom - outerheight + 1, boxleft + 1, boxbottom + 1); + + // Bottom right outer + gDPFillRectangleScaled(gdl++, boxright - outerwidth + 2, boxbottom, boxright - 1 + 1, boxbottom + 1); + gDPFillRectangleScaled(gdl++, boxright, boxbottom - outerheight + 1, boxright + 1, boxbottom + 1); + + innerwidth = outerwidth >> 1; + innerheight = outerheight >> 1; + + // Top left inner + gDPFillRectangleScaled(gdl++, boxleft, boxtop, boxleft + innerwidth + 1, boxtop + 1); + gDPFillRectangleScaled(gdl++, boxleft, boxtop, boxleft + 1, boxtop + innerheight + 1); + + // Top right inner + gDPFillRectangleScaled(gdl++, boxright - innerwidth, boxtop, boxright + 1, boxtop + 1); + gDPFillRectangleScaled(gdl++, boxright, boxtop, boxright + 1, boxtop + innerheight + 1); + + // Bottom left inner + gDPFillRectangleScaled(gdl++, boxleft, boxbottom, boxleft + innerwidth + 1, boxbottom + 1); + gDPFillRectangleScaled(gdl++, boxleft, boxbottom - innerheight, boxleft + 1, boxbottom + 1); + + // Bottom right inner + gDPFillRectangleScaled(gdl++, boxright - innerwidth, boxbottom, boxright + 1, boxbottom + 1); + gDPFillRectangleScaled(gdl++, boxright, boxbottom - innerheight, boxright + 1, boxbottom + 1); + + gdl = text0f153838(gdl); + gdl = text0f153780(gdl); + } + + gdl = sightDrawDefault(gdl, sighton); + + return gdl; +} +#endif Gfx *sightDrawMaian(Gfx *gdl, bool sighton) { diff --git a/src/game/sky.c b/src/game/sky.c index 7d287cb77..21e2d4638 100644 --- a/src/game/sky.c +++ b/src/game/sky.c @@ -2606,6 +2606,7 @@ Gfx *skyRenderSuns(Gfx *gdl, bool xray) return gdl; } +#if MATCHING #if VERSION == VERSION_PAL_FINAL GLOBAL_ASM( glabel sky0f126384 @@ -4350,152 +4351,153 @@ glabel var7f1b511c /* f126c38: 27bd0190 */ addiu $sp,$sp,0x190 ); #endif - +#else /** * Render a sun and its artifacts. */ -//Gfx *sky0f126384(Gfx *gdl, f32 x, f32 y, f32 arg3, f32 size, s32 arg5, f32 arg6) -//{ -// f32 fa; -// f32 fb; -// f32 fc; -// f32 sp17c[2]; -// f32 sp174[2]; -// s32 sp15c[] = { 16, 32, 12, 32, 24, 64 }; // diameters? -// s32 sp144[] = { 60, 80, 225, 275, 470, 570 }; // distances from the sun? -// -// u32 colours[] = { // 12c -// 0xff99ffff, // pinkish/purple -// 0x9999ffff, // blue -// 0x99ffffff, // very light blue -// 0x99ff99ff, // green -// 0xffff99ff, // yellow -// 0xff9999ff, // red -// }; -// -// f32 sp128; -// f32 sp124; -// s32 scale; -// s32 i; -// f32 f2; -// f32 f12; -// f32 f20; -// f32 f0; -// -// scale = 1; -// -// if (g_ViRes == VIRES_HI) { -// scale = 2; -// } -// -// sp128 = (x - viGetViewWidth() * 0.5f) * 0.01f; -// sp124 = (y - viGetViewHeight() * 0.5f) * 0.01f; -// -// // Render the sun -// texSelect(&gdl, &g_TexLightGlareConfigs[6], 4, 0, 2, 1, NULL); -// -// gDPSetCycleType(gdl++, G_CYC_1CYCLE); -// gDPSetColorDither(gdl++, G_CD_BAYER); -// gDPSetAlphaDither(gdl++, G_AD_PATTERN); -// gDPSetRenderMode(gdl++, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2); -// gDPSetTexturePersp(gdl++, G_TP_NONE); -// gDPSetAlphaCompare(gdl++, G_AC_NONE); -// gDPSetTextureLOD(gdl++, G_TL_TILE); -// gDPSetTextureConvert(gdl++, G_TC_FILT); -// gDPSetTextureLUT(gdl++, G_TT_NONE); -// gDPSetTextureFilter(gdl++, G_TF_BILERP); -// gDPSetCombineLERP(gdl++, -// 0, 0, 0, ENVIRONMENT, TEXEL0, 0, ENVIRONMENT, 0, -// 0, 0, 0, ENVIRONMENT, TEXEL0, 0, ENVIRONMENT, 0); -// -// fa = (size * (0.5f + 0.5f * arg3) * (60.0f / viGetFovY())); -// -// gDPSetEnvColor(gdl++, 0xff, 0xff, 0xff, (s32)(arg6 * arg3 * 255.0f)); -// -// sp17c[0] = x; -// sp17c[1] = y; -// sp174[1] = fa; -// sp174[0] = fa * scale; -// -// func0f0b2150(&gdl, sp17c, sp174, g_TexLightGlareConfigs[6].width, g_TexLightGlareConfigs[6].height, 0, 1, 1, 1, 0, 1); -// -// // Render the artifacts -// texSelect(&gdl, &g_TexLightGlareConfigs[1], 4, 0, 2, 1, NULL); -// -// gDPSetCycleType(gdl++, G_CYC_1CYCLE); -// gDPSetColorDither(gdl++, G_CD_BAYER); -// gDPSetAlphaDither(gdl++, G_AD_PATTERN); -// gDPSetRenderMode(gdl++, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2); -// gDPSetTexturePersp(gdl++, G_TP_NONE); -// gDPSetAlphaCompare(gdl++, G_AC_NONE); -// gDPSetTextureLOD(gdl++, G_TL_TILE); -// gDPSetTextureConvert(gdl++, G_TC_FILT); -// gDPSetTextureLUT(gdl++, G_TT_NONE); -// gDPSetTextureFilter(gdl++, G_TF_BILERP); -// gDPSetCombineLERP(gdl++, -// 0, 0, 0, ENVIRONMENT, TEXEL0, 0, ENVIRONMENT, 0, -// 0, 0, 0, ENVIRONMENT, TEXEL0, 0, ENVIRONMENT, 0); -// -// for (i = 0; i < 6; i++) { -// // 90c -// if (arg5 < 90) { -// if (arg5 < 30) { -// f2 = arg5 * 0.033333335071802f; -// } else { -// f2 = 1.0f; -// } -// } else { -// f2 = (180.0f - (arg5 - 90)) * 0.0055555556900799f * 0.5f; -// -// if (f2 < 0.0f) { -// f2 = 0.0f; -// } -// -// f2 += 0.5f; -// } -// -// // 974 -// fb = x - sp144[i] * sp128; -// fc = y - sp144[i] * sp124; -// fa = sp15c[i] * 0.5f; -// -// gDPSetEnvColor(gdl++, colours[i] >> 24, (colours[i] >> 16) & 0xff, (colours[i] >> 8) & 0xff, (s32)((colours[i] & 0xff) * (arg6 * f2))); -// -// sp17c[0] = fb; -// sp17c[1] = fc; -// -// sp174[1] = fa; -// sp174[0] = fa * scale; -// -// func0f0b2150(&gdl, sp17c, sp174, g_TexLightGlareConfigs[1].width, g_TexLightGlareConfigs[1].height, 0, 0, 0, 0, 0, 1); -// } -// -// f20 = viGetViewWidth() * .5f - x; -// f0 = viGetViewHeight() * .5f - y; -// -// f12 = (40.0f - sqrtf(f20 * f20 + f0 * f0)) * 0.0125f; -// -// if (f12 < 0.0f) { -// f12 = 0.0f; -// } -// -// f12 += 0.1f; -// -// if (arg5 <= g_Vars.lvupdate240) { -// f12 = 0.0f; -// } -// -// if (f12 > 0.0f) { -// sky0f127334(arg6 * f12 * 255.0f, arg6 * f12 * 255.0f, arg6 * f12 * 255.0f); -// } -// -// gDPSetColorDither(gdl++, G_CD_BAYER); -// gDPSetAlphaDither(gdl++, G_AD_PATTERN | G_CD_DISABLE); -// gDPSetTexturePersp(gdl++, G_TP_PERSP); -// gDPSetTextureLOD(gdl++, G_TL_LOD); -// -// return gdl; -//} +Gfx *sky0f126384(Gfx *gdl, f32 x, f32 y, f32 arg3, f32 size, s32 arg5, f32 arg6) +{ + f32 fa; + f32 fb; + f32 fc; + f32 sp17c[2]; + f32 sp174[2]; + s32 sp15c[] = { 16, 32, 12, 32, 24, 64 }; // diameters? + s32 sp144[] = { 60, 80, 225, 275, 470, 570 }; // distances from the sun? + + u32 colours[] = { // 12c + 0xff99ffff, // pinkish/purple + 0x9999ffff, // blue + 0x99ffffff, // very light blue + 0x99ff99ff, // green + 0xffff99ff, // yellow + 0xff9999ff, // red + }; + + f32 sp128; + f32 sp124; + s32 scale; + s32 i; + f32 f2; + f32 f12; + f32 f20; + f32 f0; + + scale = 1; + + if (g_ViRes == VIRES_HI) { + scale = 2; + } + + sp128 = (x - viGetViewWidth() * 0.5f) * 0.01f; + sp124 = (y - viGetViewHeight() * 0.5f) * 0.01f; + + // Render the sun + texSelect(&gdl, &g_TexLightGlareConfigs[6], 4, 0, 2, 1, NULL); + + gDPSetCycleType(gdl++, G_CYC_1CYCLE); + gDPSetColorDither(gdl++, G_CD_BAYER); + gDPSetAlphaDither(gdl++, G_AD_PATTERN); + gDPSetRenderMode(gdl++, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2); + gDPSetTexturePersp(gdl++, G_TP_NONE); + gDPSetAlphaCompare(gdl++, G_AC_NONE); + gDPSetTextureLOD(gdl++, G_TL_TILE); + gDPSetTextureConvert(gdl++, G_TC_FILT); + gDPSetTextureLUT(gdl++, G_TT_NONE); + gDPSetTextureFilter(gdl++, G_TF_BILERP); + gDPSetCombineLERP(gdl++, + 0, 0, 0, ENVIRONMENT, TEXEL0, 0, ENVIRONMENT, 0, + 0, 0, 0, ENVIRONMENT, TEXEL0, 0, ENVIRONMENT, 0); + + fa = (size * (0.5f + 0.5f * arg3) * (60.0f / viGetFovY())); + + gDPSetEnvColor(gdl++, 0xff, 0xff, 0xff, (s32)(arg6 * arg3 * 255.0f)); + + sp17c[0] = x; + sp17c[1] = y; + sp174[1] = fa; + sp174[0] = fa * scale; + + func0f0b2150(&gdl, sp17c, sp174, g_TexLightGlareConfigs[6].width, g_TexLightGlareConfigs[6].height, 0, 1, 1, 1, 0, 1); + + // Render the artifacts + texSelect(&gdl, &g_TexLightGlareConfigs[1], 4, 0, 2, 1, NULL); + + gDPSetCycleType(gdl++, G_CYC_1CYCLE); + gDPSetColorDither(gdl++, G_CD_BAYER); + gDPSetAlphaDither(gdl++, G_AD_PATTERN); + gDPSetRenderMode(gdl++, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2); + gDPSetTexturePersp(gdl++, G_TP_NONE); + gDPSetAlphaCompare(gdl++, G_AC_NONE); + gDPSetTextureLOD(gdl++, G_TL_TILE); + gDPSetTextureConvert(gdl++, G_TC_FILT); + gDPSetTextureLUT(gdl++, G_TT_NONE); + gDPSetTextureFilter(gdl++, G_TF_BILERP); + gDPSetCombineLERP(gdl++, + 0, 0, 0, ENVIRONMENT, TEXEL0, 0, ENVIRONMENT, 0, + 0, 0, 0, ENVIRONMENT, TEXEL0, 0, ENVIRONMENT, 0); + + for (i = 0; i < 6; i++) { + // 90c + if (arg5 < 90) { + if (arg5 < 30) { + f2 = arg5 * 0.033333335071802f; + } else { + f2 = 1.0f; + } + } else { + f2 = (180.0f - (arg5 - 90)) * 0.0055555556900799f * 0.5f; + + if (f2 < 0.0f) { + f2 = 0.0f; + } + + f2 += 0.5f; + } + + // 974 + fb = x - sp144[i] * sp128; + fc = y - sp144[i] * sp124; + fa = sp15c[i] * 0.5f; + + gDPSetEnvColor(gdl++, colours[i] >> 24, (colours[i] >> 16) & 0xff, (colours[i] >> 8) & 0xff, (s32)((colours[i] & 0xff) * (arg6 * f2))); + + sp17c[0] = fb; + sp17c[1] = fc; + + sp174[1] = fa; + sp174[0] = fa * scale; + + func0f0b2150(&gdl, sp17c, sp174, g_TexLightGlareConfigs[1].width, g_TexLightGlareConfigs[1].height, 0, 0, 0, 0, 0, 1); + } + + f20 = viGetViewWidth() * .5f - x; + f0 = viGetViewHeight() * .5f - y; + + f12 = (40.0f - sqrtf(f20 * f20 + f0 * f0)) * 0.0125f; + + if (f12 < 0.0f) { + f12 = 0.0f; + } + + f12 += 0.1f; + + if (arg5 <= g_Vars.lvupdate240) { + f12 = 0.0f; + } + + if (f12 > 0.0f) { + sky0f127334(arg6 * f12 * 255.0f, arg6 * f12 * 255.0f, arg6 * f12 * 255.0f); + } + + gDPSetColorDither(gdl++, G_CD_BAYER); + gDPSetAlphaDither(gdl++, G_AD_PATTERN | G_CD_DISABLE); + gDPSetTexturePersp(gdl++, G_TP_PERSP); + gDPSetTextureLOD(gdl++, G_TL_LOD); + + return gdl; +} +#endif /** * Render a sun and its artifacts if on screen. diff --git a/src/game/sparkstick.c b/src/game/sparkstick.c index c484350a7..50cb6180a 100644 --- a/src/game/sparkstick.c +++ b/src/game/sparkstick.c @@ -6,6 +6,7 @@ const u32 var7f1a8680[] = {0xb8d1b717}; +#if MATCHING GLOBAL_ASM( glabel sparksTick /* f01e050: 27bdffe0 */ addiu $sp,$sp,-32 @@ -148,83 +149,84 @@ glabel sparksTick /* f01e244: 03e00008 */ jr $ra /* f01e248: 27bd0020 */ addiu $sp,$sp,0x20 ); - +#else // Mismatch due to regalloc near group->startindex -//void sparksTick(void) -//{ -// struct sparkgroup *group; -// struct sparktype *type; -// s32 i; -// s32 j; -// s32 k; -// -// // 074 -// if (g_SparksAreActive) { -// g_SparksAreActive = false; -// group = &g_SparkGroups[0]; -// -// // Iterate spark groups -// for (i = 0; i != 10; i++) { -// type = &g_SparkTypes[group->type]; -// -// // 0e8 -// if (group->age >= type->maxage) { -// group->age = 0; -// } else /*0f8*/ if (group->age) { -// // 10c -// if (g_SparksAreActive == false) { -// g_SparksAreActive = true; -// } -// -// // 118 -// // Iterate the lvupdate multiplier -// for (j = 0; j < g_Vars.lvupdate240_60; j++) { -// // 120 -// struct spark *spark = &g_Sparks[group->startindex]; -// struct spark *next = &g_Sparks[group->startindex]; -// group->age++; -// -// // 144 -// // Iterate sparks in this group -// for (k = 0; k < group->numsparks; k++) { -// // 14c -// // Update this spark if active -// if (spark->ttl) { -// spark->speed.x -= spark->speed.x * type->decel; -// spark->speed.y = (spark->speed.y - spark->speed.y * type->decel) - type->weight; -// spark->speed.z -= spark->speed.z * type->decel; -// -// if (spark->speed.y == 0) { -// spark->speed.y = -0.0001f; -// } -// -// spark->pos.x += spark->speed.x; -// spark->pos.y += spark->speed.y; -// spark->pos.z += spark->speed.z; -// -// spark->ttl--; -// } -// -// // 1f4 -// // If reached the end of the array, jump back to start -// if (++next == &g_Sparks[100]) { -// // @dangerous: `next` is not reset here, so this -// // condition will only pass once per group. -// // If a group contains more than 100 sparks, it -// // could cause spark to overflow the array and write -// // over whatever's after it. -// spark = &g_Sparks[0]; -// } else { -// spark++; -// } -// -// // 208 -// } -// } -// } -// -// // 224 -// group++; -// } -// } -//} +void sparksTick(void) +{ + struct sparkgroup *group; + struct sparktype *type; + s32 i; + s32 j; + s32 k; + + // 074 + if (g_SparksAreActive) { + g_SparksAreActive = false; + group = &g_SparkGroups[0]; + + // Iterate spark groups + for (i = 0; i != 10; i++) { + type = &g_SparkTypes[group->type]; + + // 0e8 + if (group->age >= type->maxage) { + group->age = 0; + } else /*0f8*/ if (group->age) { + // 10c + if (g_SparksAreActive == false) { + g_SparksAreActive = true; + } + + // 118 + // Iterate the lvupdate multiplier + for (j = 0; j < g_Vars.lvupdate240_60; j++) { + // 120 + struct spark *spark = &g_Sparks[group->startindex]; + struct spark *next = &g_Sparks[group->startindex]; + group->age++; + + // 144 + // Iterate sparks in this group + for (k = 0; k < group->numsparks; k++) { + // 14c + // Update this spark if active + if (spark->ttl) { + spark->speed.x -= spark->speed.x * type->decel; + spark->speed.y = (spark->speed.y - spark->speed.y * type->decel) - type->weight; + spark->speed.z -= spark->speed.z * type->decel; + + if (spark->speed.y == 0) { + spark->speed.y = -0.0001f; + } + + spark->pos.x += spark->speed.x; + spark->pos.y += spark->speed.y; + spark->pos.z += spark->speed.z; + + spark->ttl--; + } + + // 1f4 + // If reached the end of the array, jump back to start + if (++next == &g_Sparks[100]) { + // @dangerous: `next` is not reset here, so this + // condition will only pass once per group. + // If a group contains more than 100 sparks, it + // could cause spark to overflow the array and write + // over whatever's after it. + spark = &g_Sparks[0]; + } else { + spark++; + } + + // 208 + } + } + } + + // 224 + group++; + } + } +} +#endif diff --git a/src/game/stars.c b/src/game/stars.c index 855c99a9f..758f61c16 100644 --- a/src/game/stars.c +++ b/src/game/stars.c @@ -92,6 +92,7 @@ void starInsert(s32 index, struct coord *arg1) } } +#if MATCHING GLOBAL_ASM( glabel starsReset /* f1360e8: 27bdff18 */ addiu $sp,$sp,-232 @@ -631,123 +632,124 @@ glabel starsReset /* f136874: 03e00008 */ jr $ra /* f136878: 27bd00e8 */ addiu $sp,$sp,0xe8 ); - +#else #define ABS2(value) ((value) < 0 ? -(value) : (value)) -//void starsReset(void) -//{ -// struct coord spd4; -// struct coord spc8; -// f32 spbc[2]; -// s32 spb0; -// f32 f12; -// f32 f0; -// f32 f2; -// s32 v0; -// s32 v1; -// s32 i; -// s32 tmp; -// -// g_StarPositions = NULL; -// -// if (PLAYERCOUNT() < 2) { -// g_StarsBelowHorizon = false; -// g_StarGridSize = 3; -// -// if (g_Vars.stagenum == STAGE_TEST_OLD) { -// g_StarsBelowHorizon = true; -// g_StarCount = 1600; -// } else if (g_Vars.stagenum == STAGE_DEFECTION || g_Vars.stagenum == STAGE_EXTRACTION) { -// g_StarCount = 200; -// g_StarGridSize = 2; -// } else if (g_Vars.stagenum == STAGE_ATTACKSHIP) { -// g_StarsBelowHorizon = true; -// g_StarCount = 1200; -// } else { -// g_StarCount = 200; -// g_StarGridSize = 2; -// } -// -// tmp = g_StarGridSize + 1; -// g_StarPositions = mempAlloc(ALIGN64(g_StarCount * 3 + tmp * 72 * tmp + g_StarGridSize * 6 * g_StarGridSize * 4 + 4), MEMPOOL_STAGE); -// -// if (g_StarPositions != NULL) { -// s32 tmp; -// g_StarPosIndexes = (s32 *)(g_StarPositions + g_StarCount * 3); -// -// for (i = 0; i < (g_StarGridSize * 6 * g_StarGridSize + 1); i++) { -// g_StarPosIndexes[i] = 0; -// } -// -// g_StarData3 = (f32 *)((u32)g_StarPosIndexes + (g_StarGridSize * 6 * g_StarGridSize + 1) * sizeof(f32)); -// -// stars0f135c70(); -// -// for (i = 0; i < g_StarCount; i++) { -// spd4.f[0] = 2.0f * RANDOMFRAC() - 1.0f; -// -// if (g_StarsBelowHorizon) { -// spd4.f[1] = 2.0f * RANDOMFRAC() - 1.0f; -// } else { -// spd4.f[1] = RANDOMFRAC(); -// } -// -// spd4.f[2] = 2.0f * RANDOMFRAC() - 1.0f; -// -// guNormalize(&spd4.f[0], &spd4.f[1], &spd4.f[2]); -// -// if (ABS2(spd4.f[1]) < ABS2(spd4.f[0])) { -// f0 = ABS2(spd4.f[2]) < ABS2(spd4.f[0]) ? ABS2(spd4.f[0]) : ABS2(spd4.f[2]); -// } else { -// f0 = ABS2(spd4.f[2]) < ABS2(spd4.f[1]) ? ABS2(spd4.f[1]) : ABS2(spd4.f[2]); -// } -// -// // 5e0 -// tmp = g_StarGridSize * g_StarGridSize; -// -// spc8.f[0] = spd4.f[0] / f0; -// spc8.f[1] = spd4.f[1] / f0; -// spc8.f[2] = spd4.f[2] / f0; -// -// if (spc8.f[0] == 1.0f || spc8.f[0] == -1.0f) { -// spb0 = spc8.f[0] == -1.0f ? 0 : 1; -// spbc[0] = spc8.f[2]; -// spbc[1] = spc8.f[1]; -// f12 = (spbc[0] + 1.0f) / 2.0f; -// f2 = (spbc[1] + 1.0f) / 2.0f; -// } else if (spc8.f[1] == 1.0f || spc8.f[1] == -1.0f) { -// spb0 = spc8.f[1] == -1.0f ? 2 : 3; -// spbc[0] = spc8.f[0]; -// spbc[1] = spc8.f[2]; -// f12 = (spbc[0] + 1.0f) / 2.0f; -// f2 = (spbc[1] + 1.0f) / 2.0f; -// } else if (spc8.f[2] == 1.0f || spc8.f[2] == -1.0f) { -// spb0 = spc8.f[2] == -1.0f ? 4 : 5; -// spbc[0] = spc8.f[1]; -// spbc[1] = spc8.f[0]; -// f12 = (spbc[0] + 1.0f) / 2.0f; -// f2 = (spbc[1] + 1.0f) / 2.0f; -// } else{ -// f12 = (spbc[0] + 1.0f) / 2.0f; -// f2 = (spbc[1] + 1.0f) / 2.0f; -// } -// -// v0 = f2 * g_StarGridSize; -// v1 = f12 * g_StarGridSize; -// -// if (v0 == g_StarGridSize) { -// v0--; -// } -// -// if (v1 == g_StarGridSize) { -// v1--; -// } -// -// starInsert(spb0 * tmp + (g_StarGridSize * v1) + v0, spd4.f); -// } -// } -// } -//} +void starsReset(void) +{ + struct coord spd4; + struct coord spc8; + f32 spbc[2]; + s32 spb0; + f32 f12; + f32 f0; + f32 f2; + s32 v0; + s32 v1; + s32 i; + s32 tmp; + + g_StarPositions = NULL; + + if (PLAYERCOUNT() < 2) { + g_StarsBelowHorizon = false; + g_StarGridSize = 3; + + if (g_Vars.stagenum == STAGE_TEST_OLD) { + g_StarsBelowHorizon = true; + g_StarCount = 1600; + } else if (g_Vars.stagenum == STAGE_DEFECTION || g_Vars.stagenum == STAGE_EXTRACTION) { + g_StarCount = 200; + g_StarGridSize = 2; + } else if (g_Vars.stagenum == STAGE_ATTACKSHIP) { + g_StarsBelowHorizon = true; + g_StarCount = 1200; + } else { + g_StarCount = 200; + g_StarGridSize = 2; + } + + tmp = g_StarGridSize + 1; + g_StarPositions = mempAlloc(ALIGN64(g_StarCount * 3 + tmp * 72 * tmp + g_StarGridSize * 6 * g_StarGridSize * 4 + 4), MEMPOOL_STAGE); + + if (g_StarPositions != NULL) { + s32 tmp; + g_StarPosIndexes = (s32 *)(g_StarPositions + g_StarCount * 3); + + for (i = 0; i < (g_StarGridSize * 6 * g_StarGridSize + 1); i++) { + g_StarPosIndexes[i] = 0; + } + + g_StarData3 = (f32 *)((u32)g_StarPosIndexes + (g_StarGridSize * 6 * g_StarGridSize + 1) * sizeof(f32)); + + stars0f135c70(); + + for (i = 0; i < g_StarCount; i++) { + spd4.f[0] = 2.0f * RANDOMFRAC() - 1.0f; + + if (g_StarsBelowHorizon) { + spd4.f[1] = 2.0f * RANDOMFRAC() - 1.0f; + } else { + spd4.f[1] = RANDOMFRAC(); + } + + spd4.f[2] = 2.0f * RANDOMFRAC() - 1.0f; + + guNormalize(&spd4.f[0], &spd4.f[1], &spd4.f[2]); + + if (ABS2(spd4.f[1]) < ABS2(spd4.f[0])) { + f0 = ABS2(spd4.f[2]) < ABS2(spd4.f[0]) ? ABS2(spd4.f[0]) : ABS2(spd4.f[2]); + } else { + f0 = ABS2(spd4.f[2]) < ABS2(spd4.f[1]) ? ABS2(spd4.f[1]) : ABS2(spd4.f[2]); + } + + // 5e0 + tmp = g_StarGridSize * g_StarGridSize; + + spc8.f[0] = spd4.f[0] / f0; + spc8.f[1] = spd4.f[1] / f0; + spc8.f[2] = spd4.f[2] / f0; + + if (spc8.f[0] == 1.0f || spc8.f[0] == -1.0f) { + spb0 = spc8.f[0] == -1.0f ? 0 : 1; + spbc[0] = spc8.f[2]; + spbc[1] = spc8.f[1]; + f12 = (spbc[0] + 1.0f) / 2.0f; + f2 = (spbc[1] + 1.0f) / 2.0f; + } else if (spc8.f[1] == 1.0f || spc8.f[1] == -1.0f) { + spb0 = spc8.f[1] == -1.0f ? 2 : 3; + spbc[0] = spc8.f[0]; + spbc[1] = spc8.f[2]; + f12 = (spbc[0] + 1.0f) / 2.0f; + f2 = (spbc[1] + 1.0f) / 2.0f; + } else if (spc8.f[2] == 1.0f || spc8.f[2] == -1.0f) { + spb0 = spc8.f[2] == -1.0f ? 4 : 5; + spbc[0] = spc8.f[1]; + spbc[1] = spc8.f[0]; + f12 = (spbc[0] + 1.0f) / 2.0f; + f2 = (spbc[1] + 1.0f) / 2.0f; + } else{ + f12 = (spbc[0] + 1.0f) / 2.0f; + f2 = (spbc[1] + 1.0f) / 2.0f; + } + + v0 = f2 * g_StarGridSize; + v1 = f12 * g_StarGridSize; + + if (v0 == g_StarGridSize) { + v0--; + } + + if (v1 == g_StarGridSize) { + v1--; + } + + starInsert(spb0 * tmp + (g_StarGridSize * v1) + v0, &spd4); + } + } + } +} +#endif Gfx *starsRender(Gfx *gdl) { diff --git a/src/game/tex.c b/src/game/tex.c index 728ad2d4e..becb4e92d 100644 --- a/src/game/tex.c +++ b/src/game/tex.c @@ -777,6 +777,7 @@ Gfx *tex0f17563c(Gfx *gdl, struct tex *tex, s32 arg2, s32 arg3, s32 arg4) return gdl; } +#if MATCHING GLOBAL_ASM( glabel tex0f1756c0 .late_rodata @@ -1386,346 +1387,347 @@ glabel jtbl_var7f1b7c70 /* f175eec: 03e00008 */ jr $ra /* f175ef0: 27bd0138 */ addiu $sp,$sp,0x138 ); - +#else // Mismatch: Extra move instruction in last half of G_VTX case -//s32 tex0f1756c0(Gfx *arg0, s32 arg1, Gfx *arg2, struct texpool *arg3, u32 arg4) -//{ -// struct tex *v0; -// struct tex *v0_2; -// Gfx *sp12c; -// s32 sp128; -// u32 tmp1; -// u32 tmp2; -// u32 tmp3; -// u32 tmp4; -// u32 tmp5; -// u32 tmp6; -// bool flag; -// s32 j; -// bool sp104; -// u8 animated; -// Gfx *s5; -// Gfx *s6; -// u32 spf4; -// s32 texturenum; -// s32 texturenum2; -// bool spe8; -// s32 spe4; -// s32 spe0; -// struct gfxvtx *spA0[16]; -// u8 sp90[16]; -// -// s32 i; -// -// sp12c = NULL; -// sp104 = true; -// animated = false; -// spe8 = false; -// spe4 = false; -// var800844d0 = false; -// spf4 = 0; -// s5 = arg0; -// s6 = arg2; -// -// sp128 = arg1 >> 3; -// -// tex0f173a08(); -// -// spe0 = dyntexHasRoom(); -// -// if (spe0) { -// for (j = 0; j < 16; j++) { -// sp90[j] = 0; -// } -// } -// -// if (arg3 == NULL) { -// arg3 = &g_TexSharedPool; -// } -// -// while (sp128 > 0) { -// switch (s5->texture.cmd) { -// case 0xc0: // Repurposed? -// spe4 = true; -// -// if (animated) { -// spe8 = true; -// } -// -// texturenum = s5->words.w1 & 0xfff; -// flag = s5->words.w0 & 0x200; -// -// texLoadFromTextureNum(texturenum, arg3); -// -// v0 = texFindInPool(texturenum, arg3); -// -// if (v0 != NULL) { -// spf4 = v0->unk0c_03; -// } else { -// spf4 = 0; -// } -// -// if (v0 != NULL) { -// s6 = tex0f1742e4(s6, sp12c, v0, sp104); -// sp104 = false; -// animated = false; -// -// switch (s5->unkc0.subcmd) { -// case 0: -// tmp6 = (s5->words.w1 >> 24) & 0xff; -// tmp1 = (s5->words.w0 >> 22) & 3; -// tmp2 = (s5->words.w0 >> 20) & 3; -// tmp3 = (s5->words.w0 >> 18) & 3; -// tmp4 = (s5->words.w0 >> 14) & 0xf; -// tmp5 = (s5->words.w0 >> 10) & 0xf; -// -// s6 = tex0f175490(s6, v0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, flag); -// break; -// case 1: -// texturenum2 = (s5->words.w1 >> 12) & 0xfff; -// texLoadFromTextureNum(texturenum2, arg3); -// v0_2 = texFindInPool(texturenum2, arg3); -// -// if (v0_2 != NULL) { -// tmp6 = (s5->words.w1 >> 24) & 0xff; -// tmp1 = (s5->words.w0 >> 22) & 3; -// tmp2 = (s5->words.w0 >> 20) & 3; -// tmp3 = (s5->words.w0 >> 18) & 3; -// tmp4 = (s5->words.w0 >> 14) & 0xf; -// tmp5 = (s5->words.w0 >> 10) & 0xf; -// -// s6 = tex0f175308(s6, v0, tmp1, tmp2, tmp3, v0_2, tmp4, tmp5, tmp6, flag); -// } -// break; -// case 2: -// tmp1 = (s5->words.w0 >> 22) & 3; -// tmp2 = (s5->words.w0 >> 20) & 3; -// tmp3 = (s5->words.w0 >> 18) & 3; -// -// s6 = tex0f1751e4(s6, v0, tmp1, tmp2, tmp3, flag); -// break; -// case 3: -// tmp1 = (s5->words.w0 >> 22) & 3; -// tmp2 = (s5->words.w0 >> 20) & 3; -// tmp3 = (s5->words.w0 >> 18) & 3; -// -// s6 = tex0f17563c(s6, v0, tmp1, tmp2, tmp3); -// break; -// case 4: -// tmp1 = (s5->words.w0 >> 22) & 3; -// tmp2 = (s5->words.w0 >> 20) & 3; -// tmp3 = (s5->words.w0 >> 18) & 3; -// -// s6 = tex0f1755dc(s6, v0, tmp1, tmp2, tmp3); -// break; -// } -// -// if (spe0 != 0) { -// // Deep Sea - green river under floor -// if (texturenum == TEXTURE_06CB) { -// dyntexSetCurrentType(DYNTEXTYPE_RIVER); -// animated = true; -// } -// -// // Deep Sea - juice that flows inside SA megaweapon -// // Attack Ship - juice that flows inside engine power node -// if (texturenum == TEXTURE_0A6A) { -// dyntexSetCurrentType(DYNTEXTYPE_POWERJUICE); -// animated = true; -// } -// -// // Deep Sea - white rings around SA megaweapon node -// // Attack Ship - white rings around engine power node -// if (texturenum == TEXTURE_0A69) { -// dyntexSetCurrentType(DYNTEXTYPE_POWERRING); -// animated = true; -// } -// -// // Deep Sea - teleport -// if (texturenum == TEXTURE_06E2) { -// dyntexSetCurrentType(DYNTEXTYPE_TELEPORTAL); -// animated = true; -// } -// -// // 01c7 - Air Base - distant water -// // 01c7 - Investigation - puddle behind glass near shield -// // 0dae - Chicago - canal -// // 0dae - Villa - shallow water -// // 0dae - Sewers (MP) -// if (texturenum == TEXTURE_01C7 || texturenum == TEXTURE_0DAE) { -// dyntexSetCurrentType(DYNTEXTYPE_RIVER); -// animated = true; -// } -// -// // Air Force One - Monitor -// if (texturenum == TEXTURE_029B) { -// dyntexSetCurrentType(DYNTEXTYPE_MONITOR); -// animated = true; -// } -// -// // Villa - deep water -// // Complex - water -// if (texturenum == TEXTURE_090F) { -// dyntexSetCurrentType(DYNTEXTYPE_OCEAN); -// animated = true; -// } -// -// // Attack Ship - triangular arrows -// if (texturenum == TEXTURE_0A42) { -// dyntexSetCurrentType(DYNTEXTYPE_ARROWS); -// animated = true; -// } -// } -// } -// -// s5++; -// break; -// case G_VTX: -// { -// s32 start; -// s32 count; -// u32 offset; -// struct gfxvtx *vtx; -// -// if (spe0) { -// start = s5->bytes[1] & 0xf; -// count = ((u32)s5->bytes[1] >> 4) + 1; -// vtx = (struct gfxvtx *)(s5->dma.addr & 0x00ffffff); -// -// for (i = start; i < start + count; i++) { -// if (animated && sp90[i]) { -// dyntexAddVertex(spA0[i]); -// sp90[i] = 0; -// } -// -// spA0[i] = vtx; -// vtx++; -// } -// } -// -// if (spf4 && arg4) { -// // b7c -// u32 offset; -// struct gfxvtx *vtx; -// s32 i; -// -// count = (s5->dma.par >> 4) + 1; -// offset = s5->dma.addr & 0x00ffffff; -// i = 0; -// offset = (arg4 + offset); -// vtx = (struct gfxvtx *) offset; -// -// for (; i < count; i++) { -// vtx[i].unk08 >>= 1; -// vtx[i].unk0a >>= 1; -// } -// } -// } -// -// *s6 = *s5; -// s6++; -// s5++; -// break; -// case G_RDPPIPESYNC: -// var800844d0 = true; -// *s6 = *s5; -// s6++; -// s5++; -// break; -// case (u8)G_TRI4: -// case (u8)G_TRI1: -// if (animated) { -// if (s5->texture.cmd == (u8)G_TRI1) { -// sp90[s5->tri.tri.v[0] / 10] = 1; -// sp90[s5->tri.tri.v[1] / 10] = 1; -// sp90[s5->tri.tri.v[2] / 10] = 1; -// } else { -// // c68 -// if (s5->tri4.x1 != s5->tri4.y1 || s5->tri4.z1 != s5->tri4.y1) { -// sp90[s5->tri4.x1] = 1; -// sp90[s5->tri4.y1] = 1; -// sp90[s5->tri4.z1] = 1; -// } -// -// // cbc -// if (s5->tri4.x2 != s5->tri4.y2 || s5->tri4.z2 != s5->tri4.y2) { -// sp90[s5->tri4.x2] = 1; -// sp90[s5->tri4.y2] = 1; -// sp90[s5->tri4.z2] = 1; -// } -// -// // d0c -// if (s5->tri4.x3 != s5->tri4.y3 || s5->tri4.z3 != s5->tri4.y3) { -// sp90[s5->tri4.x3] = 1; -// sp90[s5->tri4.y3] = 1; -// sp90[s5->tri4.z3] = 1; -// } -// -// // d58 -// if (s5->tri4.x4 != s5->tri4.y4 || s5->tri4.z4 != s5->tri4.y4) { -// sp90[s5->tri4.x4] = 1; -// sp90[s5->tri4.y4] = 1; -// sp90[s5->tri4.z4] = 1; -// } -// } -// } -// -// sp104 = true; -// var800844d0 = false; -// -// *s6 = *s5; -// s6++; -// s5++; -// break; -// case (u8)G_TEXTURE: -// spe4 = true; -// -// if (animated) { -// spe8 = true; -// } -// -// animated = false; -// sp104 = false; -// -// sp12c = s6; -// *s6 = *s5; -// s6++; -// s5++; -// break; -// case (u8)G_SETOTHERMODE_H: -// *s6 = *s5; -// s6++; -// s5++; -// break; -// default: -// *s6 = *s5; -// s6++; -// s5++; -// break; -// } -// -// sp128--; -// -// if (spe4 || sp128 <= 0) { -// spe4 = false; -// -// if (spe8 || animated) { -// s32 i; -// -// spe8 = false; -// -// for (i = 0; i < 16; i++) { -// if (sp90[i]) { -// dyntexAddVertex(spA0[i]); -// sp90[i] = 0; -// } -// } -// } -// } -// } -// -// return (u32)s6 - (u32)arg2; -//} +s32 tex0f1756c0(Gfx *arg0, s32 arg1, Gfx *arg2, struct texpool *arg3, u32 arg4) +{ + struct tex *v0; + struct tex *v0_2; + Gfx *sp12c; + s32 sp128; + u32 tmp1; + u32 tmp2; + u32 tmp3; + u32 tmp4; + u32 tmp5; + u32 tmp6; + bool flag; + s32 j; + bool sp104; + u8 animated; + Gfx *s5; + Gfx *s6; + u32 spf4; + s32 texturenum; + s32 texturenum2; + bool spe8; + s32 spe4; + s32 spe0; + struct gfxvtx *spA0[16]; + u8 sp90[16]; + + s32 i; + + sp12c = NULL; + sp104 = true; + animated = false; + spe8 = false; + spe4 = false; + var800844d0 = false; + spf4 = 0; + s5 = arg0; + s6 = arg2; + + sp128 = arg1 >> 3; + + tex0f173a08(); + + spe0 = dyntexHasRoom(); + + if (spe0) { + for (j = 0; j < 16; j++) { + sp90[j] = 0; + } + } + + if (arg3 == NULL) { + arg3 = &g_TexSharedPool; + } + + while (sp128 > 0) { + switch (s5->texture.cmd) { + case 0xc0: // Repurposed? + spe4 = true; + + if (animated) { + spe8 = true; + } + + texturenum = s5->words.w1 & 0xfff; + flag = s5->words.w0 & 0x200; + + texLoadFromTextureNum(texturenum, arg3); + + v0 = texFindInPool(texturenum, arg3); + + if (v0 != NULL) { + spf4 = v0->unk0c_03; + } else { + spf4 = 0; + } + + if (v0 != NULL) { + s6 = tex0f1742e4(s6, sp12c, v0, sp104); + sp104 = false; + animated = false; + + switch (s5->unkc0.subcmd) { + case 0: + tmp6 = (s5->words.w1 >> 24) & 0xff; + tmp1 = (s5->words.w0 >> 22) & 3; + tmp2 = (s5->words.w0 >> 20) & 3; + tmp3 = (s5->words.w0 >> 18) & 3; + tmp4 = (s5->words.w0 >> 14) & 0xf; + tmp5 = (s5->words.w0 >> 10) & 0xf; + + s6 = tex0f175490(s6, v0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, flag); + break; + case 1: + texturenum2 = (s5->words.w1 >> 12) & 0xfff; + texLoadFromTextureNum(texturenum2, arg3); + v0_2 = texFindInPool(texturenum2, arg3); + + if (v0_2 != NULL) { + tmp6 = (s5->words.w1 >> 24) & 0xff; + tmp1 = (s5->words.w0 >> 22) & 3; + tmp2 = (s5->words.w0 >> 20) & 3; + tmp3 = (s5->words.w0 >> 18) & 3; + tmp4 = (s5->words.w0 >> 14) & 0xf; + tmp5 = (s5->words.w0 >> 10) & 0xf; + + s6 = tex0f175308(s6, v0, tmp1, tmp2, tmp3, v0_2, tmp4, tmp5, tmp6, flag); + } + break; + case 2: + tmp1 = (s5->words.w0 >> 22) & 3; + tmp2 = (s5->words.w0 >> 20) & 3; + tmp3 = (s5->words.w0 >> 18) & 3; + + s6 = tex0f1751e4(s6, v0, tmp1, tmp2, tmp3, flag); + break; + case 3: + tmp1 = (s5->words.w0 >> 22) & 3; + tmp2 = (s5->words.w0 >> 20) & 3; + tmp3 = (s5->words.w0 >> 18) & 3; + + s6 = tex0f17563c(s6, v0, tmp1, tmp2, tmp3); + break; + case 4: + tmp1 = (s5->words.w0 >> 22) & 3; + tmp2 = (s5->words.w0 >> 20) & 3; + tmp3 = (s5->words.w0 >> 18) & 3; + + s6 = tex0f1755dc(s6, v0, tmp1, tmp2, tmp3); + break; + } + + if (spe0 != 0) { + // Deep Sea - green river under floor + if (texturenum == TEXTURE_06CB) { + dyntexSetCurrentType(DYNTEXTYPE_RIVER); + animated = true; + } + + // Deep Sea - juice that flows inside SA megaweapon + // Attack Ship - juice that flows inside engine power node + if (texturenum == TEXTURE_0A6A) { + dyntexSetCurrentType(DYNTEXTYPE_POWERJUICE); + animated = true; + } + + // Deep Sea - white rings around SA megaweapon node + // Attack Ship - white rings around engine power node + if (texturenum == TEXTURE_0A69) { + dyntexSetCurrentType(DYNTEXTYPE_POWERRING); + animated = true; + } + + // Deep Sea - teleport + if (texturenum == TEXTURE_06E2) { + dyntexSetCurrentType(DYNTEXTYPE_TELEPORTAL); + animated = true; + } + + // 01c7 - Air Base - distant water + // 01c7 - Investigation - puddle behind glass near shield + // 0dae - Chicago - canal + // 0dae - Villa - shallow water + // 0dae - Sewers (MP) + if (texturenum == TEXTURE_01C7 || texturenum == TEXTURE_0DAE) { + dyntexSetCurrentType(DYNTEXTYPE_RIVER); + animated = true; + } + + // Air Force One - Monitor + if (texturenum == TEXTURE_029B) { + dyntexSetCurrentType(DYNTEXTYPE_MONITOR); + animated = true; + } + + // Villa - deep water + // Complex - water + if (texturenum == TEXTURE_090F) { + dyntexSetCurrentType(DYNTEXTYPE_OCEAN); + animated = true; + } + + // Attack Ship - triangular arrows + if (texturenum == TEXTURE_0A42) { + dyntexSetCurrentType(DYNTEXTYPE_ARROWS); + animated = true; + } + } + } + + s5++; + break; + case G_VTX: + { + s32 start; + s32 count; + u32 offset; + struct gfxvtx *vtx; + + if (spe0) { + start = s5->bytes[1] & 0xf; + count = ((u32)s5->bytes[1] >> 4) + 1; + vtx = (struct gfxvtx *)(s5->dma.addr & 0x00ffffff); + + for (i = start; i < start + count; i++) { + if (animated && sp90[i]) { + dyntexAddVertex(spA0[i]); + sp90[i] = 0; + } + + spA0[i] = vtx; + vtx++; + } + } + + if (spf4 && arg4) { + // b7c + u32 offset; + struct gfxvtx *vtx; + s32 i; + + count = (s5->dma.par >> 4) + 1; + offset = s5->dma.addr & 0x00ffffff; + i = 0; + offset = (arg4 + offset); + vtx = (struct gfxvtx *) offset; + + for (; i < count; i++) { + vtx[i].s >>= 1; + vtx[i].t >>= 1; + } + } + } + + *s6 = *s5; + s6++; + s5++; + break; + case G_RDPPIPESYNC: + var800844d0 = true; + *s6 = *s5; + s6++; + s5++; + break; + case (u8)G_TRI4: + case (u8)G_TRI1: + if (animated) { + if (s5->texture.cmd == (u8)G_TRI1) { + sp90[s5->tri.tri.v[0] / 10] = 1; + sp90[s5->tri.tri.v[1] / 10] = 1; + sp90[s5->tri.tri.v[2] / 10] = 1; + } else { + // c68 + if (s5->tri4.x1 != s5->tri4.y1 || s5->tri4.z1 != s5->tri4.y1) { + sp90[s5->tri4.x1] = 1; + sp90[s5->tri4.y1] = 1; + sp90[s5->tri4.z1] = 1; + } + + // cbc + if (s5->tri4.x2 != s5->tri4.y2 || s5->tri4.z2 != s5->tri4.y2) { + sp90[s5->tri4.x2] = 1; + sp90[s5->tri4.y2] = 1; + sp90[s5->tri4.z2] = 1; + } + + // d0c + if (s5->tri4.x3 != s5->tri4.y3 || s5->tri4.z3 != s5->tri4.y3) { + sp90[s5->tri4.x3] = 1; + sp90[s5->tri4.y3] = 1; + sp90[s5->tri4.z3] = 1; + } + + // d58 + if (s5->tri4.x4 != s5->tri4.y4 || s5->tri4.z4 != s5->tri4.y4) { + sp90[s5->tri4.x4] = 1; + sp90[s5->tri4.y4] = 1; + sp90[s5->tri4.z4] = 1; + } + } + } + + sp104 = true; + var800844d0 = false; + + *s6 = *s5; + s6++; + s5++; + break; + case (u8)G_TEXTURE: + spe4 = true; + + if (animated) { + spe8 = true; + } + + animated = false; + sp104 = false; + + sp12c = s6; + *s6 = *s5; + s6++; + s5++; + break; + case (u8)G_SETOTHERMODE_H: + *s6 = *s5; + s6++; + s5++; + break; + default: + *s6 = *s5; + s6++; + s5++; + break; + } + + sp128--; + + if (spe4 || sp128 <= 0) { + spe4 = false; + + if (spe8 || animated) { + s32 i; + + spe8 = false; + + for (i = 0; i < 16; i++) { + if (sp90[i]) { + dyntexAddVertex(spA0[i]); + sp90[i] = 0; + } + } + } + } + } + + return (u32)s6 - (u32)arg2; +} +#endif void tex0f175ef4(Gfx *arg0, Gfx *arg1, s32 arg2) { diff --git a/src/game/title.c b/src/game/title.c index bd50047a4..d04c79789 100644 --- a/src/game/title.c +++ b/src/game/title.c @@ -778,6 +778,7 @@ bool g_PdLogoUnusedRotEnabled = false; bool g_PdLogoLightMoving = false; f32 g_PdLogoLightDirFrac = 0; +#if MATCHING GLOBAL_ASM( glabel titleRenderPdLogoModel /* f017248: 27bdfeb0 */ addiu $sp,$sp,-336 @@ -1277,175 +1278,176 @@ glabel titleRenderPdLogoModel /* f017978: 03e00008 */ jr $ra /* f01797c: 27bd0150 */ addiu $sp,$sp,0x150 ); - +#else // Mismatch: Minor reordering in the sp100 loop -//Gfx *titleRenderPdLogoModel(Gfx *gdl, struct model *model, bool arg2, f32 arg3, s32 arg4, f32 arg5, Mtxf *arg6, struct gfxvtx *vertices, u32 *colours) -//{ -// struct modelrenderdata renderdata = {NULL, true, 3}; // 110 -// s16 tmp2; -// s32 i; // 108 -// s32 j; -// struct gfxvtx *sp100; -// struct colour *spfc; -// union modelrwdata *tmp; -// struct modelrwdata_dl *rwdata; -// struct modelnode *node1; -// struct modelnode *node2; -// s32 s6; -// s32 k; -// struct modelrodata_dl *s5rodata; -// struct modelrodata_dl *s1rodata; -// s32 alpha1; // d8 -// s32 spcc[3]; -// f32 spc0[3]; -// struct gfxvtx *a3; -// s32 alpha2; // b8 -// Mtxf sp6c; -// struct gfxvtx *t0; -// struct colour *s1; -// struct colour *s2; -// -// tmp = modelGetNodeRwData(model, modelGetPart(model->filedata, MODELPART_LOGO_0000)); -// tmp->toggle.visible = arg2; -// -// tmp = modelGetNodeRwData(model, modelGetPart(model->filedata, MODELPART_LOGO_0001)); -// tmp->toggle.visible = !arg2; -// -// s6 = arg3 * 65536.0f; -// -// if (s6 < 0) { -// s6 = 0; -// } else if (s6 > 65536) { -// s6 = 65536; -// } -// -// alpha1 = s6 / 256; -// -// if (alpha1 > arg4) { -// alpha1 = arg4; -// } -// -// if (!arg2) { -// s6 = 65536 - s6; -// alpha1 = 256 - alpha1; -// } -// -// if (alpha1 < 0) { -// alpha1 = 0; -// } else if (alpha1 > 255) { -// alpha1 = 255; -// } -// -// alpha2 = arg5 * 256.0f; -// -// if (alpha2 < 0) { -// alpha2 = 0; -// } else if (alpha2 > 255) { -// alpha2 = 255; -// } -// -// sp100 = vertices; -// spfc = (void *)colours; -// -// for (i = 0; i < 4; i++) { -// if (i == 0) { -// node1 = modelGetPart(model->filedata, MODELPART_LOGO_0002); -// node2 = modelGetPart(model->filedata, MODELPART_LOGO_0003); -// } else if (i == 1) { -// node1 = modelGetPart(model->filedata, MODELPART_LOGO_0004); -// node2 = modelGetPart(model->filedata, MODELPART_LOGO_0005); -// } else if (i == 2) { -// node1 = modelGetPart(model->filedata, MODELPART_LOGO_0006); -// node2 = modelGetPart(model->filedata, MODELPART_LOGO_0007); -// } else { -// node1 = modelGetPart(model->filedata, MODELPART_LOGO_0008); -// node2 = modelGetPart(model->filedata, MODELPART_LOGO_0009); -// } -// -// if (node1 && node2) { -// if (arg2) { -// s5rodata = &node1->rodata->dl; -// s1rodata = &node2->rodata->dl; -// rwdata = modelGetNodeRwData(model, node1); -// } else { -// s5rodata = &node2->rodata->dl; -// s1rodata = &node1->rodata->dl; -// rwdata = modelGetNodeRwData(model, node2); -// } -// -// s1 = (struct colour *)ALIGN8(s5rodata->numvertices * sizeof(struct gfxvtx) + (s32)s5rodata->vertices); -// if (1); -// s2 = (struct colour *)ALIGN8(s1rodata->numvertices * sizeof(struct gfxvtx) + (s32)s1rodata->vertices); -// -// a3 = s5rodata->vertices; -// t0 = s1rodata->vertices; -// -// rwdata->vertices = sp100; -// rwdata->colours = spfc; -// -// for (j = 0; j < s5rodata->numvertices; j++) { -// sp100[j] = a3[j]; -// -// tmp2 = (t0[j].x - a3[j].x) * s6 / 65536; -// sp100[j].x += tmp2; -// -// tmp2 = (t0[j].y - a3[j].y) * s6 / 65536; -// sp100[j].y += tmp2; -// -// tmp2 = (t0[j].z - a3[j].z) * s6 / 65536; -// sp100[j].z += tmp2; -// } -// -// for (j = 0; j < s5rodata->numcolours; j++) { -// spcc[0] = (s32)((s1[j].r * (65536 - s6) + s2[j].r * s6) / 65536); -// spcc[1] = (s32)((s1[j].g * (65536 - s6) + s2[j].g * s6) / 65536); -// spcc[2] = (s32)((s1[j].b * (65536 - s6) + s2[j].b * s6) / 65536); -// -// spc0[0] = spcc[0]; -// spc0[1] = spcc[1]; -// spc0[2] = spcc[2]; -// -// if (spc0[0] != 0.0f || spc0[1] != 0.0f || spc0[2] != 0.0f) { -// guNormalize(&spc0[0], &spc0[1], &spc0[2]); -// } -// -// spfc[j].r = (s32)(spc0[0] * 127.0f); -// spfc[j].g = (s32)(spc0[1] * 127.0f); -// spfc[j].b = (s32)(spc0[2] * 127.0f); -// spfc[j].a = alpha2; -// } -// -// sp100 = (void *)ALIGN8(s5rodata->numvertices * sizeof(struct gfxvtx) + (s32)sp100); -// spfc = (void *)ALIGN8(s5rodata->numcolours * sizeof(u32) + (s32)spfc); -// } -// } -// -// gDPSetPrimColor(gdl++, 0, 0, 0x00, 0x00, 0x00, alpha1); -// -// renderdata.unk00 = arg6; -// renderdata.unk10 = gfxAllocate(model->filedata->nummatrices * sizeof(Mtxf)); -// -// mtx4Copy(arg6, renderdata.unk10); -// -// model->matrices = renderdata.unk10; -// -// model0001cc20(model); -// -// renderdata.flags = 3; -// renderdata.zbufferenabled = false; -// renderdata.gdl = gdl; -// -// modelRender(&renderdata, model); -// -// gdl = renderdata.gdl; -// -// for (k = 0, j = 0; k < model->filedata->nummatrices; k++, j += sizeof(Mtxf)) { -// mtx4Copy((Mtxf *)((u32)model->matrices + j), &sp6c); -// mtx00016054(&sp6c, model->matrices + k); -// } -// -// return gdl; -//} +Gfx *titleRenderPdLogoModel(Gfx *gdl, struct model *model, bool arg2, f32 arg3, s32 arg4, f32 arg5, Mtxf *arg6, struct gfxvtx *vertices, u32 *colours) +{ + struct modelrenderdata renderdata = {NULL, true, 3}; // 110 + s16 tmp2; + s32 i; // 108 + s32 j; + struct gfxvtx *sp100; + struct colour *spfc; + union modelrwdata *tmp; + struct modelrwdata_dl *rwdata; + struct modelnode *node1; + struct modelnode *node2; + s32 s6; + s32 k; + struct modelrodata_dl *s5rodata; + struct modelrodata_dl *s1rodata; + s32 alpha1; // d8 + s32 spcc[3]; + f32 spc0[3]; + struct gfxvtx *a3; + s32 alpha2; // b8 + Mtxf sp6c; + struct gfxvtx *t0; + struct colour *s1; + struct colour *s2; + + tmp = modelGetNodeRwData(model, modelGetPart(model->filedata, MODELPART_LOGO_0000)); + tmp->toggle.visible = arg2; + + tmp = modelGetNodeRwData(model, modelGetPart(model->filedata, MODELPART_LOGO_0001)); + tmp->toggle.visible = !arg2; + + s6 = arg3 * 65536.0f; + + if (s6 < 0) { + s6 = 0; + } else if (s6 > 65536) { + s6 = 65536; + } + + alpha1 = s6 / 256; + + if (alpha1 > arg4) { + alpha1 = arg4; + } + + if (!arg2) { + s6 = 65536 - s6; + alpha1 = 256 - alpha1; + } + + if (alpha1 < 0) { + alpha1 = 0; + } else if (alpha1 > 255) { + alpha1 = 255; + } + + alpha2 = arg5 * 256.0f; + + if (alpha2 < 0) { + alpha2 = 0; + } else if (alpha2 > 255) { + alpha2 = 255; + } + + sp100 = vertices; + spfc = (void *)colours; + + for (i = 0; i < 4; i++) { + if (i == 0) { + node1 = modelGetPart(model->filedata, MODELPART_LOGO_0002); + node2 = modelGetPart(model->filedata, MODELPART_LOGO_0003); + } else if (i == 1) { + node1 = modelGetPart(model->filedata, MODELPART_LOGO_0004); + node2 = modelGetPart(model->filedata, MODELPART_LOGO_0005); + } else if (i == 2) { + node1 = modelGetPart(model->filedata, MODELPART_LOGO_0006); + node2 = modelGetPart(model->filedata, MODELPART_LOGO_0007); + } else { + node1 = modelGetPart(model->filedata, MODELPART_LOGO_0008); + node2 = modelGetPart(model->filedata, MODELPART_LOGO_0009); + } + + if (node1 && node2) { + if (arg2) { + s5rodata = &node1->rodata->dl; + s1rodata = &node2->rodata->dl; + rwdata = modelGetNodeRwData(model, node1); + } else { + s5rodata = &node2->rodata->dl; + s1rodata = &node1->rodata->dl; + rwdata = modelGetNodeRwData(model, node2); + } + + s1 = (struct colour *)ALIGN8(s5rodata->numvertices * sizeof(struct gfxvtx) + (s32)s5rodata->vertices); + if (1); + s2 = (struct colour *)ALIGN8(s1rodata->numvertices * sizeof(struct gfxvtx) + (s32)s1rodata->vertices); + + a3 = s5rodata->vertices; + t0 = s1rodata->vertices; + + rwdata->vertices = sp100; + rwdata->colours = spfc; + + for (j = 0; j < s5rodata->numvertices; j++) { + sp100[j] = a3[j]; + + tmp2 = (t0[j].x - a3[j].x) * s6 / 65536; + sp100[j].x += tmp2; + + tmp2 = (t0[j].y - a3[j].y) * s6 / 65536; + sp100[j].y += tmp2; + + tmp2 = (t0[j].z - a3[j].z) * s6 / 65536; + sp100[j].z += tmp2; + } + + for (j = 0; j < s5rodata->numcolours; j++) { + spcc[0] = (s32)((s1[j].r * (65536 - s6) + s2[j].r * s6) / 65536); + spcc[1] = (s32)((s1[j].g * (65536 - s6) + s2[j].g * s6) / 65536); + spcc[2] = (s32)((s1[j].b * (65536 - s6) + s2[j].b * s6) / 65536); + + spc0[0] = spcc[0]; + spc0[1] = spcc[1]; + spc0[2] = spcc[2]; + + if (spc0[0] != 0.0f || spc0[1] != 0.0f || spc0[2] != 0.0f) { + guNormalize(&spc0[0], &spc0[1], &spc0[2]); + } + + spfc[j].r = (s32)(spc0[0] * 127.0f); + spfc[j].g = (s32)(spc0[1] * 127.0f); + spfc[j].b = (s32)(spc0[2] * 127.0f); + spfc[j].a = alpha2; + } + + sp100 = (void *)ALIGN8(s5rodata->numvertices * sizeof(struct gfxvtx) + (s32)sp100); + spfc = (void *)ALIGN8(s5rodata->numcolours * sizeof(u32) + (s32)spfc); + } + } + + gDPSetPrimColor(gdl++, 0, 0, 0x00, 0x00, 0x00, alpha1); + + renderdata.unk00 = arg6; + renderdata.unk10 = gfxAllocate(model->filedata->nummatrices * sizeof(Mtxf)); + + mtx4Copy(arg6, renderdata.unk10); + + model->matrices = renderdata.unk10; + + model0001cc20(model); + + renderdata.flags = 3; + renderdata.zbufferenabled = false; + renderdata.gdl = gdl; + + modelRender(&renderdata, model); + + gdl = renderdata.gdl; + + for (k = 0, j = 0; k < model->filedata->nummatrices; k++, j += sizeof(Mtxf)) { + mtx4Copy((Mtxf *)((u32)model->matrices + j), &sp6c); + mtx00016054(&sp6c, model->matrices + k); + } + + return gdl; +} +#endif /** * Skip immediately to the "PERFECT DARK" part of the PdLogo mode. @@ -1489,6 +1491,7 @@ void titleSkipToPdTitle(void) musicStartTemporaryPrimary(MUSIC_TITLE2); } +#if MATCHING #if VERSION >= VERSION_JPN_FINAL GLOBAL_ASM( glabel titleRenderPdLogo @@ -7469,7 +7472,6 @@ glabel var7f1a8468 /* f018dac: 00000000 */ nop ); #endif - u32 var80062818 = 0x00000000; u32 var8006281c = 0x00000001; u32 var80062820 = 0x00000003; @@ -7490,434 +7492,436 @@ u32 var80062854 = 0x00000000; u32 var80062858 = 0x00000000; u32 var8006285c = 0x00000000; f32 var80062860 = 1000; +#else // Mismatch: first tick assignments need to be permutated -//Gfx *titleRenderPdLogo(Gfx *gdl) -//{ -// struct modelrenderdata renderdata = { NULL, true, 3 }; // 2f0 -// Mtxf sp2b0; -// Mtxf sp270; -// Mtxf sp230; -// struct model *model; // 22c -// Mtxf sp1e8; -// Mtxf sp1a8; -// struct modelnode *node; -// struct modelrodata_dl *rodata; // 164 -// struct modelrwdata_dl *rwdata; // 160 -// f32 sp13c = g_TitleTimer / 4500.0f - 0.1f; -// LookAt *lookat; // 134 -// Mtx spf0; -// f32 spe4; -// f32 spe0; -// s32 numvertices; // dc -// s32 numcolours; // d8 -// -// // b74 -// if (g_PdLogoIsFirstTick) { -// g_PdLogoYRotCur = 4.2404751777649f; -// g_PdLogoYRotSpeed = 0.018846554681659f; -// g_PdLogoXRotCur = 0.47116386890411f; -// g_PdLogoXRotSpeed = 0.0f; -// g_PdLogoScale = 0.35f; -// g_PdLogoFrac = 0.0f; -// g_PdLogoUseCombinedModel = false; -// g_PdLogoAmbientLightFrac = 1.0f; -// g_PdLogoIsFirstTick = false; -// g_PdLogoBlackTimer = 1; -// g_PdLogoYRotEnabled = false; -// g_PdLogoPreMorphTimer = 0; -// g_PdLogoMorphing = false; -// g_PdLogoExitTimer = 0; -// g_PdLogoMorphEndTimer = 0; -// g_PdLogoYRotStopping = false; -// g_PdLogoDarkenEnabled = false; -// var80062804 = 1; -// g_PdLogoPointlessTimerEnabled = false; -// g_PdLogoPreTitleTimer = 0; -// g_PdLogoTitleStepFrac = 0.0f; -// g_PdLogoTitlePresenting = false; -// g_PdLogoTitleStep = -1; -// g_PdLogoPointlessTimer = 0; -// g_PdLogoUnusedRotEnabled = false; -// g_PdLogoUnusedRot = 1.5705462694168f; -// g_PdLogoLightMoving = false; -// g_PdLogoLightDirFrac = 0.0f; -// } -// -// // c7c -// if (g_PdLogoBlackTimer != 0) { -// g_PdLogoBlackTimer++; -// -// if (g_PdLogoBlackTimer >= 4) { -// g_PdLogoBlackTimer = 0; -// g_PdLogoYRotEnabled = true; -// g_PdLogoPreMorphTimer = 1; -// } -// } -// -// // ce4 -// if (g_PdLogoYRotStopping) { -// if (g_PdLogoYRotCur < g_PdLogoEndYRot) { -// applySpeed(&g_PdLogoYRotCur, g_PdLogoEndYRot, &g_PdLogoYRotSpeed, 0.00018846555030905f, 0.00018846555030905f, 0.018846554681659f); -// -// if (g_PdLogoYRotCur >= g_PdLogoEndYRot) { -// g_PdLogoYRotCur = g_PdLogoEndYRot; -// g_PdLogoYRotSpeed = 0.0f; -// } -// -// if (g_PdLogoYRotCur >= M_BADTAU) { -// g_PdLogoYRotCur -= M_BADTAU; -// g_PdLogoEndYRot -= M_BADTAU; -// } else if (g_PdLogoYRotCur < 0.0f) { -// g_PdLogoYRotCur += M_BADTAU; -// g_PdLogoEndYRot += M_BADTAU; -// } -// } -// -// if (g_PdLogoYRotCur >= g_PdLogoEndYRot) { -// g_PdLogoYRotStopping = false; -// } -// } else /*e18*/ if (g_PdLogoYRotEnabled) { -// g_PdLogoYRotCur += g_PdLogoYRotSpeed * g_Vars.lvupdate240freal; -// -// if (g_PdLogoYRotCur >= M_BADTAU) { -// g_PdLogoYRotCur -= M_BADTAU; -// } else if (g_PdLogoYRotCur < 0.0f) { -// g_PdLogoYRotCur += M_BADTAU; -// } -// } -// -// // e90 -// if (g_PdLogoPreMorphTimer != 0) { -// s32 duration = 80; -// -// g_PdLogoPreMorphTimer += g_Vars.lvupdate240_60; -// -// if (g_PdLogoPreMorphTimer > 0) { -// g_PdLogoFrac = (f32) g_PdLogoPreMorphTimer / (f32) duration; -// } else { -// g_PdLogoFrac = 0.0f; -// } -// -// if (g_PdLogoPreMorphTimer > duration) { -// g_PdLogoPreMorphTimer = 0; -// g_PdLogoMorphing = true; -// g_PdLogoFrac = 0.0f; -// g_PdLogoUseCombinedModel = true; -// } -// } -// -// // f14 -// if (g_PdLogoMorphing) { -// g_PdLogoFrac += 0.004f * g_Vars.lvupdate240freal; -// -// if (g_PdLogoFrac >= 0.8f) { -// if (g_PdLogoMorphEndTimer == 0) { -// g_PdLogoMorphEndTimer = 1; -// } -// } -// -// if (g_PdLogoFrac >= 1.0f) { -// g_PdLogoFrac = 1.0f; -// g_PdLogoMorphing = false; -// } -// } -// -// // f80 -// if (g_PdLogoMorphEndTimer != 0) { -// g_PdLogoMorphEndTimer += g_Vars.lvupdate240_60; -// -// if (g_PdLogoXRotCur > 0.0f) { -// // Implement the camera lowering effect, but it's actually -// // the model that rotates upwards to face the camera -// applyRotation(&g_PdLogoXRotCur, 0.0f, &g_PdLogoXRotSpeed, 0.00011307933164062f, 0.00011307933164062f, 0.011307933367789f); -// -// if (g_PdLogoXRotCur <= 0.0f) { -// g_PdLogoXRotCur = 0.0f; -// g_PdLogoXRotSpeed = 0.0f; -// } -// } -// -// if (g_PdLogoMorphEndTimer > 30 && g_PdLogoMorphEndTimer - g_Vars.lvupdate240_60 <= 30) { -// // Start slowing the spinning rotation -// g_PdLogoYRotEnabled = false; -// g_PdLogoYRotStopping = true; -// g_PdLogoEndYRot = ((s32) (g_PdLogoYRotCur * 4.0f / M_BADTAU) + 2) * M_BADTAU * 0.25f; -// } -// -// if (g_PdLogoMorphEndTimer > 100 && g_PdLogoMorphEndTimer - g_Vars.lvupdate240_60 <= 100) { -// g_PdLogoDarkenEnabled = true; -// } -// -// if (!g_PdLogoYRotStopping && g_PdLogoXRotCur <= 0.0f) { -// // Spinning has stopped and model is also facing camera vertically -// g_PdLogoMorphEndTimer = 0; -// g_PdLogoDarkenEnabled = true; -// } -// } -// -// // 118 -// if (g_PdLogoDarkenEnabled) { -// // Fading out the side and back faces of the logo... -// // This is done by adjusting the ambient lighting. I guess the front -// // face is excluded from ambient light? -// g_PdLogoAmbientLightFrac -= 0.0075f * g_Vars.lvupdate240freal; -// -// if (g_PdLogoAmbientLightFrac <= 0.0f) { -// g_PdLogoAmbientLightFrac = 0.0f; -// g_PdLogoDarkenEnabled = false; -// g_PdLogoPreTitleTimer = 1; -// } -// } -// -// // 178 -// if (g_PdLogoPreTitleTimer != 0) { -// g_PdLogoPreTitleTimer += g_Vars.lvupdate240_60; -// -// if (g_PdLogoPreTitleTimer > 20) { -// g_PdLogoPreTitleTimer = 0; -// g_PdLogoPointlessTimerEnabled = true; -// } -// } -// -// // 1a8 -// if (g_PdLogoPointlessTimerEnabled) { -// g_PdLogoPointlessTimerEnabled = false; -// g_PdLogoPointlessTimer = 1; -// } -// -// // 1c4 -// if (g_PdLogoPointlessTimer != 0) { -// g_PdLogoPointlessTimer += g_Vars.lvupdate240_60; -// -// if (g_PdLogoPointlessTimer > 0) { -// g_PdLogoPointlessTimer = 0; -// g_PdLogoTitlePresenting = true; -// g_PdLogoTitleStep = 1; -// g_PdLogoLightMoving = true; -// } -// } -// -// // 208 -// if (g_PdLogoTitlePresenting) { -// g_PdLogoUnusedRotEnabled = true; -// -// if (g_PdLogoTitleStep == 0) { -// // Unreachable - step 0 is not used -// g_PdLogoTitleStepFrac += 0.025f; -// } else if (g_PdLogoTitleStep == 1) { -// g_PdLogoTitleStepFrac += 0.09f; -// } else { -// g_PdLogoTitleStepFrac += 0.1f; -// } -// -// if (g_PdLogoTitleStepFrac >= 1.0f) { -// g_PdLogoTitleStepFrac = 0.0f; -// g_PdLogoTitleStep++; -// -// if (g_PdLogoTitleStep == 10) { -// g_PdLogoTitlePresenting = false; -// g_PdLogoExitTimer = 1; -// } -// } -// } -// -// // 2d4 -// if (g_PdLogoUnusedRotEnabled) { -// // Some unused value... maybe a different method of rotating the light? -// g_PdLogoUnusedRot += 0.0062821852043271f * g_Vars.lvupdate240freal; -// -// if (g_PdLogoUnusedRot >= M_BADTAU) { -// g_PdLogoUnusedRot -= M_BADTAU; -// } -// } -// -// // 32c -// if (g_PdLogoLightMoving) { -// g_PdLogoLightDirFrac += 0.017f * g_Vars.lvupdate240freal; -// -// if (g_PdLogoLightDirFrac >= 1.0f) { -// g_PdLogoLightDirFrac = 1.0f; -// g_PdLogoLightMoving = false; -// } -// } -// -// // 380 -// if (g_PdLogoExitTimer != 0) { -// g_PdLogoExitTimer += g_Vars.lvupdate240_60; -// -// if (g_PdLogoExitTimer > 60) { -// g_PdLogoExitTimer = 0; -// g_PdLogoTriggerExit = true; -// } -// } -// -// // 3b0 -// gdl = viSetFillColour(gdl, 0, 0, 0); -// gdl = viFillBuffer(gdl); -// -// if (g_PdLogoBlackTimer != 0) { -// return gdl; -// } -// -// lookat = gfxAllocateLookAt(2); -// -// guLookAtReflect(&spf0, lookat, -// 0.0f, 0.0f, 4000.0f, -// 0.0f, 0.0f, 0.0f, -// 0.0f, 1.0f, 0.0f); -// -// gSPLookAt(gdl++, lookat); -// -// spe4 = (g_PdLogoLightDirFrac + -1.0f) * M_PI + M_PI; -// spe0 = (0.0f - 0.15f * g_PdLogoLightDirFrac) * M_PI + M_PI; -// -// var80062578.a.l.colc[0] = var80062578.a.l.colc[1] = var80062578.a.l.colc[2] = 0; -// var80062578.a.l.col[0] = var80062578.a.l.col[1] = var80062578.a.l.col[2] = 0; -// var80062578.l[0].l.colc[0] = var80062578.l[0].l.colc[1] = var80062578.l[0].l.colc[2] = 255; -// var80062578.l[0].l.col[0] = var80062578.l[0].l.col[1] = var80062578.l[0].l.col[2] = 255; -// -// var80062578.l[0].l.dir[0] = 127.0f * sinf(spe4) * cosf(spe0); -// var80062578.l[0].l.dir[1] = 127.0f * sinf(spe0); -// var80062578.l[0].l.dir[2] = 127.0f * cosf(spe4) * cosf(spe0); -// -// mtx00016ae4(&sp2b0, -// 0.0f, 0.0f, 4000, -// 0.0f, 0.0f, 0.0f, -// 0.0f, 1.0f, 0.0f); -// -// if (g_PdLogoUseCombinedModel == true) { -// model = g_TitleModel; -// } else { -// model = g_TitleModelNLogo2; -// } -// -// mtx4LoadYRotation(g_PdLogoYRotCur, &sp1e8); -// mtx4LoadXRotation(g_PdLogoXRotCur, &sp1a8); -// mtx4MultMtx4InPlace(&sp1a8, &sp1e8); -// mtx4MultMtx4(&sp2b0, &sp1e8, &sp270); -// mtx00015f04(g_PdLogoScale, &sp270); -// -// var80062560.a.l.colc[0] = var80062560.a.l.colc[1] = var80062560.a.l.colc[2] = 255.0f * g_PdLogoAmbientLightFrac; -// var80062560.a.l.col[0] = var80062560.a.l.col[1] = var80062560.a.l.col[2] = 255.0f * g_PdLogoAmbientLightFrac; -// -// numvertices = 0; -// numcolours = 0; -// -// node = modelGetPart(model->filedata, MODELPART_LOGO_0002); -// -// if (node) { -// Gfx *tmp; -// -// rodata = &node->rodata->dl; -// numvertices += rodata->numvertices + 1; -// numcolours += rodata->numcolours + 1; -// -// rwdata = modelGetNodeRwData(model, node); -// rwdata->gdl = tmp = gfxAllocate(5 * sizeof(Gfx)); -// -// gSPSetLights1(tmp++, var80062530); -// gSPBranchList(tmp++, rodata->primary); -// } -// -// node = modelGetPart(model->filedata, MODELPART_LOGO_0004); -// -// if (node) { -// Gfx *tmp; -// -// rodata = &node->rodata->dl; -// numvertices += rodata->numvertices + 1; -// numcolours += rodata->numcolours + 1; -// -// rwdata = modelGetNodeRwData(model, node); -// rwdata->gdl = tmp = gfxAllocate(5 * sizeof(Gfx)); -// -// if (g_PdLogoAmbientLightFrac > 0.0f) { -// gSPSetLights1(tmp++, var80062560); -// gSPBranchList(tmp++, rodata->primary); -// } else { -// gSPEndDisplayList(tmp++); -// } -// } -// -// node = modelGetPart(model->filedata, MODELPART_LOGO_0006); -// -// if (node) { -// Gfx *tmp; -// -// rodata = &node->rodata->dl; -// numvertices += rodata->numvertices + 1; -// numcolours += rodata->numcolours + 1; -// -// rwdata = modelGetNodeRwData(model, node); -// rwdata->gdl = tmp = gfxAllocate(5 * sizeof(Gfx)); -// -// if (g_PdLogoAmbientLightFrac > 0.0f) { -// gSPSetLights1(tmp++, var80062560); -// gSPBranchList(tmp++, rodata->primary); -// } else { -// gSPEndDisplayList(tmp++); -// } -// } -// -// node = modelGetPart(model->filedata, MODELPART_LOGO_0008); -// -// if (node) { -// Gfx *tmp; -// -// rodata = &node->rodata->dl; -// numvertices += rodata->numvertices + 1; -// numcolours += rodata->numcolours + 1; -// -// rwdata = modelGetNodeRwData(model, node); -// rwdata->gdl = tmp = gfxAllocate(5 * sizeof(Gfx)); -// -// if (g_PdLogoAmbientLightFrac > 0.0f) { -// gSPSetLights1(tmp++, var80062560); -// gSPBranchList(tmp++, rodata->primary); -// } else { -// gSPEndDisplayList(tmp++); -// } -// } -// -// gdl = titleRenderPdLogoModel(gdl, model, var80062804, g_PdLogoFrac, 240, 1.0f, &sp270, gfxAllocateVertices(numvertices), gfxAllocateColours(numcolours)); -// -// gSPSetLights1(gdl++, var80062578); -// -// { -// struct coord sp64 = {0, 0, 1000}; -// -// mtx4LoadTranslation(&sp64, &sp1e8); -// mtx00015f88(1.0f + sp13c, &sp1e8); -// mtx4MultMtx4(&sp2b0, &sp1e8, &sp230); -// mtx00015f04(0.308f, &sp230); -// -// if (g_PdLogoTitleStep >= 0) { -// if (g_PdLogoTitleStep == 0) { -// // empty -// } else if (g_PdLogoTitleStep == 1) { -// f32 frac = g_PdLogoTitleStepFrac; -// s32 a2 = g_PdLogoTitleStepFrac < 0.5f; -// -// gdl = titleRenderPdLogoModel(gdl, g_TitleModelPdThree, a2, frac, 255, frac, &sp230, var8009cca8[var8009ccb8], var8009ccb0[var8009ccb8]); -// } else if (g_PdLogoTitleStep == 2) { -// f32 frac = g_PdLogoTitleStepFrac; -// s32 a2 = g_PdLogoTitleStepFrac < 0.5f; -// -// gdl = titleRenderPdLogoModel(gdl, g_TitleModelPdTwo, a2, 1.0f - frac, 255, 1.0f, &sp230, var8009cca8[var8009ccb8], var8009ccb0[var8009ccb8]); -// } else if (g_PdLogoTitleStep == 3) { -// f32 frac = g_PdLogoTitleStepFrac; -// s32 a2 = g_PdLogoTitleStepFrac < 0.5f; -// -// gdl = titleRenderPdLogoModel(gdl, g_TitleModelPdTwo, a2, frac, 255, 1.0f, &sp230, var8009cca8[var8009ccb8], var8009ccb0[var8009ccb8]); -// } else { -// gdl = titleRenderPdLogoModel(gdl, g_TitleModelPdTwo, 0, 1.0f, 255, 1.0f, &sp230, var8009cca8[var8009ccb8], var8009ccb0[var8009ccb8]); -// } -// } -// } -// -// return gdl; -//} +Gfx *titleRenderPdLogo(Gfx *gdl) +{ + struct modelrenderdata renderdata = { NULL, true, 3 }; // 2f0 + Mtxf sp2b0; + Mtxf sp270; + Mtxf sp230; + struct model *model; // 22c + Mtxf sp1e8; + Mtxf sp1a8; + struct modelnode *node; + struct modelrodata_dl *rodata; // 164 + struct modelrwdata_dl *rwdata; // 160 + f32 sp13c = g_TitleTimer / 4500.0f - 0.1f; + LookAt *lookat; // 134 + Mtx spf0; + f32 spe4; + f32 spe0; + s32 numvertices; // dc + s32 numcolours; // d8 + + // b74 + if (g_PdLogoIsFirstTick) { + g_PdLogoYRotCur = 4.2404751777649f; + g_PdLogoYRotSpeed = 0.018846554681659f; + g_PdLogoXRotCur = 0.47116386890411f; + g_PdLogoXRotSpeed = 0.0f; + g_PdLogoScale = 0.35f; + g_PdLogoFrac = 0.0f; + g_PdLogoUseCombinedModel = false; + g_PdLogoAmbientLightFrac = 1.0f; + g_PdLogoIsFirstTick = false; + g_PdLogoBlackTimer = 1; + g_PdLogoYRotEnabled = false; + g_PdLogoPreMorphTimer = 0; + g_PdLogoMorphing = false; + g_PdLogoExitTimer = 0; + g_PdLogoMorphEndTimer = 0; + g_PdLogoYRotStopping = false; + g_PdLogoDarkenEnabled = false; + var80062804 = 1; + g_PdLogoPointlessTimerEnabled = false; + g_PdLogoPreTitleTimer = 0; + g_PdLogoTitleStepFrac = 0.0f; + g_PdLogoTitlePresenting = false; + g_PdLogoTitleStep = -1; + g_PdLogoPointlessTimer = 0; + g_PdLogoUnusedRotEnabled = false; + g_PdLogoUnusedRot = 1.5705462694168f; + g_PdLogoLightMoving = false; + g_PdLogoLightDirFrac = 0.0f; + } + + // c7c + if (g_PdLogoBlackTimer != 0) { + g_PdLogoBlackTimer++; + + if (g_PdLogoBlackTimer >= 4) { + g_PdLogoBlackTimer = 0; + g_PdLogoYRotEnabled = true; + g_PdLogoPreMorphTimer = 1; + } + } + + // ce4 + if (g_PdLogoYRotStopping) { + if (g_PdLogoYRotCur < g_PdLogoEndYRot) { + applySpeed(&g_PdLogoYRotCur, g_PdLogoEndYRot, &g_PdLogoYRotSpeed, 0.00018846555030905f, 0.00018846555030905f, 0.018846554681659f); + + if (g_PdLogoYRotCur >= g_PdLogoEndYRot) { + g_PdLogoYRotCur = g_PdLogoEndYRot; + g_PdLogoYRotSpeed = 0.0f; + } + + if (g_PdLogoYRotCur >= M_BADTAU) { + g_PdLogoYRotCur -= M_BADTAU; + g_PdLogoEndYRot -= M_BADTAU; + } else if (g_PdLogoYRotCur < 0.0f) { + g_PdLogoYRotCur += M_BADTAU; + g_PdLogoEndYRot += M_BADTAU; + } + } + + if (g_PdLogoYRotCur >= g_PdLogoEndYRot) { + g_PdLogoYRotStopping = false; + } + } else /*e18*/ if (g_PdLogoYRotEnabled) { + g_PdLogoYRotCur += g_PdLogoYRotSpeed * g_Vars.lvupdate240freal; + + if (g_PdLogoYRotCur >= M_BADTAU) { + g_PdLogoYRotCur -= M_BADTAU; + } else if (g_PdLogoYRotCur < 0.0f) { + g_PdLogoYRotCur += M_BADTAU; + } + } + + // e90 + if (g_PdLogoPreMorphTimer != 0) { + s32 duration = 80; + + g_PdLogoPreMorphTimer += g_Vars.lvupdate240_60; + + if (g_PdLogoPreMorphTimer > 0) { + g_PdLogoFrac = (f32) g_PdLogoPreMorphTimer / (f32) duration; + } else { + g_PdLogoFrac = 0.0f; + } + + if (g_PdLogoPreMorphTimer > duration) { + g_PdLogoPreMorphTimer = 0; + g_PdLogoMorphing = true; + g_PdLogoFrac = 0.0f; + g_PdLogoUseCombinedModel = true; + } + } + + // f14 + if (g_PdLogoMorphing) { + g_PdLogoFrac += 0.004f * g_Vars.lvupdate240freal; + + if (g_PdLogoFrac >= 0.8f) { + if (g_PdLogoMorphEndTimer == 0) { + g_PdLogoMorphEndTimer = 1; + } + } + + if (g_PdLogoFrac >= 1.0f) { + g_PdLogoFrac = 1.0f; + g_PdLogoMorphing = false; + } + } + + // f80 + if (g_PdLogoMorphEndTimer != 0) { + g_PdLogoMorphEndTimer += g_Vars.lvupdate240_60; + + if (g_PdLogoXRotCur > 0.0f) { + // Implement the camera lowering effect, but it's actually + // the model that rotates upwards to face the camera + applyRotation(&g_PdLogoXRotCur, 0.0f, &g_PdLogoXRotSpeed, 0.00011307933164062f, 0.00011307933164062f, 0.011307933367789f); + + if (g_PdLogoXRotCur <= 0.0f) { + g_PdLogoXRotCur = 0.0f; + g_PdLogoXRotSpeed = 0.0f; + } + } + + if (g_PdLogoMorphEndTimer > 30 && g_PdLogoMorphEndTimer - g_Vars.lvupdate240_60 <= 30) { + // Start slowing the spinning rotation + g_PdLogoYRotEnabled = false; + g_PdLogoYRotStopping = true; + g_PdLogoEndYRot = ((s32) (g_PdLogoYRotCur * 4.0f / M_BADTAU) + 2) * M_BADTAU * 0.25f; + } + + if (g_PdLogoMorphEndTimer > 100 && g_PdLogoMorphEndTimer - g_Vars.lvupdate240_60 <= 100) { + g_PdLogoDarkenEnabled = true; + } + + if (!g_PdLogoYRotStopping && g_PdLogoXRotCur <= 0.0f) { + // Spinning has stopped and model is also facing camera vertically + g_PdLogoMorphEndTimer = 0; + g_PdLogoDarkenEnabled = true; + } + } + + // 118 + if (g_PdLogoDarkenEnabled) { + // Fading out the side and back faces of the logo... + // This is done by adjusting the ambient lighting. I guess the front + // face is excluded from ambient light? + g_PdLogoAmbientLightFrac -= 0.0075f * g_Vars.lvupdate240freal; + + if (g_PdLogoAmbientLightFrac <= 0.0f) { + g_PdLogoAmbientLightFrac = 0.0f; + g_PdLogoDarkenEnabled = false; + g_PdLogoPreTitleTimer = 1; + } + } + + // 178 + if (g_PdLogoPreTitleTimer != 0) { + g_PdLogoPreTitleTimer += g_Vars.lvupdate240_60; + + if (g_PdLogoPreTitleTimer > 20) { + g_PdLogoPreTitleTimer = 0; + g_PdLogoPointlessTimerEnabled = true; + } + } + + // 1a8 + if (g_PdLogoPointlessTimerEnabled) { + g_PdLogoPointlessTimerEnabled = false; + g_PdLogoPointlessTimer = 1; + } + + // 1c4 + if (g_PdLogoPointlessTimer != 0) { + g_PdLogoPointlessTimer += g_Vars.lvupdate240_60; + + if (g_PdLogoPointlessTimer > 0) { + g_PdLogoPointlessTimer = 0; + g_PdLogoTitlePresenting = true; + g_PdLogoTitleStep = 1; + g_PdLogoLightMoving = true; + } + } + + // 208 + if (g_PdLogoTitlePresenting) { + g_PdLogoUnusedRotEnabled = true; + + if (g_PdLogoTitleStep == 0) { + // Unreachable - step 0 is not used + g_PdLogoTitleStepFrac += 0.025f; + } else if (g_PdLogoTitleStep == 1) { + g_PdLogoTitleStepFrac += 0.09f; + } else { + g_PdLogoTitleStepFrac += 0.1f; + } + + if (g_PdLogoTitleStepFrac >= 1.0f) { + g_PdLogoTitleStepFrac = 0.0f; + g_PdLogoTitleStep++; + + if (g_PdLogoTitleStep == 10) { + g_PdLogoTitlePresenting = false; + g_PdLogoExitTimer = 1; + } + } + } + + // 2d4 + if (g_PdLogoUnusedRotEnabled) { + // Some unused value... maybe a different method of rotating the light? + g_PdLogoUnusedRot += 0.0062821852043271f * g_Vars.lvupdate240freal; + + if (g_PdLogoUnusedRot >= M_BADTAU) { + g_PdLogoUnusedRot -= M_BADTAU; + } + } + + // 32c + if (g_PdLogoLightMoving) { + g_PdLogoLightDirFrac += 0.017f * g_Vars.lvupdate240freal; + + if (g_PdLogoLightDirFrac >= 1.0f) { + g_PdLogoLightDirFrac = 1.0f; + g_PdLogoLightMoving = false; + } + } + + // 380 + if (g_PdLogoExitTimer != 0) { + g_PdLogoExitTimer += g_Vars.lvupdate240_60; + + if (g_PdLogoExitTimer > 60) { + g_PdLogoExitTimer = 0; + g_PdLogoTriggerExit = true; + } + } + + // 3b0 + gdl = viSetFillColour(gdl, 0, 0, 0); + gdl = viFillBuffer(gdl); + + if (g_PdLogoBlackTimer != 0) { + return gdl; + } + + lookat = gfxAllocateLookAt(2); + + guLookAtReflect(&spf0, lookat, + 0.0f, 0.0f, 4000.0f, + 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f); + + gSPLookAt(gdl++, lookat); + + spe4 = (g_PdLogoLightDirFrac + -1.0f) * M_PI + M_PI; + spe0 = (0.0f - 0.15f * g_PdLogoLightDirFrac) * M_PI + M_PI; + + var80062578.a.l.colc[0] = var80062578.a.l.colc[1] = var80062578.a.l.colc[2] = 0; + var80062578.a.l.col[0] = var80062578.a.l.col[1] = var80062578.a.l.col[2] = 0; + var80062578.l[0].l.colc[0] = var80062578.l[0].l.colc[1] = var80062578.l[0].l.colc[2] = 255; + var80062578.l[0].l.col[0] = var80062578.l[0].l.col[1] = var80062578.l[0].l.col[2] = 255; + + var80062578.l[0].l.dir[0] = 127.0f * sinf(spe4) * cosf(spe0); + var80062578.l[0].l.dir[1] = 127.0f * sinf(spe0); + var80062578.l[0].l.dir[2] = 127.0f * cosf(spe4) * cosf(spe0); + + mtx00016ae4(&sp2b0, + 0.0f, 0.0f, 4000, + 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f); + + if (g_PdLogoUseCombinedModel == true) { + model = g_TitleModel; + } else { + model = g_TitleModelNLogo2; + } + + mtx4LoadYRotation(g_PdLogoYRotCur, &sp1e8); + mtx4LoadXRotation(g_PdLogoXRotCur, &sp1a8); + mtx4MultMtx4InPlace(&sp1a8, &sp1e8); + mtx4MultMtx4(&sp2b0, &sp1e8, &sp270); + mtx00015f04(g_PdLogoScale, &sp270); + + var80062560.a.l.colc[0] = var80062560.a.l.colc[1] = var80062560.a.l.colc[2] = 255.0f * g_PdLogoAmbientLightFrac; + var80062560.a.l.col[0] = var80062560.a.l.col[1] = var80062560.a.l.col[2] = 255.0f * g_PdLogoAmbientLightFrac; + + numvertices = 0; + numcolours = 0; + + node = modelGetPart(model->filedata, MODELPART_LOGO_0002); + + if (node) { + Gfx *tmp; + + rodata = &node->rodata->dl; + numvertices += rodata->numvertices + 1; + numcolours += rodata->numcolours + 1; + + rwdata = modelGetNodeRwData(model, node); + rwdata->gdl = tmp = gfxAllocate(5 * sizeof(Gfx)); + + gSPSetLights1(tmp++, var80062530); + gSPBranchList(tmp++, rodata->primary); + } + + node = modelGetPart(model->filedata, MODELPART_LOGO_0004); + + if (node) { + Gfx *tmp; + + rodata = &node->rodata->dl; + numvertices += rodata->numvertices + 1; + numcolours += rodata->numcolours + 1; + + rwdata = modelGetNodeRwData(model, node); + rwdata->gdl = tmp = gfxAllocate(5 * sizeof(Gfx)); + + if (g_PdLogoAmbientLightFrac > 0.0f) { + gSPSetLights1(tmp++, var80062560); + gSPBranchList(tmp++, rodata->primary); + } else { + gSPEndDisplayList(tmp++); + } + } + + node = modelGetPart(model->filedata, MODELPART_LOGO_0006); + + if (node) { + Gfx *tmp; + + rodata = &node->rodata->dl; + numvertices += rodata->numvertices + 1; + numcolours += rodata->numcolours + 1; + + rwdata = modelGetNodeRwData(model, node); + rwdata->gdl = tmp = gfxAllocate(5 * sizeof(Gfx)); + + if (g_PdLogoAmbientLightFrac > 0.0f) { + gSPSetLights1(tmp++, var80062560); + gSPBranchList(tmp++, rodata->primary); + } else { + gSPEndDisplayList(tmp++); + } + } + + node = modelGetPart(model->filedata, MODELPART_LOGO_0008); + + if (node) { + Gfx *tmp; + + rodata = &node->rodata->dl; + numvertices += rodata->numvertices + 1; + numcolours += rodata->numcolours + 1; + + rwdata = modelGetNodeRwData(model, node); + rwdata->gdl = tmp = gfxAllocate(5 * sizeof(Gfx)); + + if (g_PdLogoAmbientLightFrac > 0.0f) { + gSPSetLights1(tmp++, var80062560); + gSPBranchList(tmp++, rodata->primary); + } else { + gSPEndDisplayList(tmp++); + } + } + + gdl = titleRenderPdLogoModel(gdl, model, var80062804, g_PdLogoFrac, 240, 1.0f, &sp270, gfxAllocateVertices(numvertices), gfxAllocateColours(numcolours)); + + gSPSetLights1(gdl++, var80062578); + + { + struct coord sp64 = {0, 0, 1000}; + + mtx4LoadTranslation(&sp64, &sp1e8); + mtx00015f88(1.0f + sp13c, &sp1e8); + mtx4MultMtx4(&sp2b0, &sp1e8, &sp230); + mtx00015f04(0.308f, &sp230); + + if (g_PdLogoTitleStep >= 0) { + if (g_PdLogoTitleStep == 0) { + // empty + } else if (g_PdLogoTitleStep == 1) { + f32 frac = g_PdLogoTitleStepFrac; + s32 a2 = g_PdLogoTitleStepFrac < 0.5f; + + gdl = titleRenderPdLogoModel(gdl, g_TitleModelPdThree, a2, frac, 255, frac, &sp230, var8009cca8[var8009ccb8], var8009ccb0[var8009ccb8]); + } else if (g_PdLogoTitleStep == 2) { + f32 frac = g_PdLogoTitleStepFrac; + s32 a2 = g_PdLogoTitleStepFrac < 0.5f; + + gdl = titleRenderPdLogoModel(gdl, g_TitleModelPdTwo, a2, 1.0f - frac, 255, 1.0f, &sp230, var8009cca8[var8009ccb8], var8009ccb0[var8009ccb8]); + } else if (g_PdLogoTitleStep == 3) { + f32 frac = g_PdLogoTitleStepFrac; + s32 a2 = g_PdLogoTitleStepFrac < 0.5f; + + gdl = titleRenderPdLogoModel(gdl, g_TitleModelPdTwo, a2, frac, 255, 1.0f, &sp230, var8009cca8[var8009ccb8], var8009ccb0[var8009ccb8]); + } else { + gdl = titleRenderPdLogoModel(gdl, g_TitleModelPdTwo, 0, 1.0f, 255, 1.0f, &sp230, var8009cca8[var8009ccb8], var8009ccb0[var8009ccb8]); + } + } + } + + return gdl; +} +#endif struct sndstate *g_TitleAudioHandle = NULL; bool g_TitleTypewriterFinishing = false; diff --git a/src/game/wallhit.c b/src/game/wallhit.c index e061f786a..d69230720 100644 --- a/src/game/wallhit.c +++ b/src/game/wallhit.c @@ -412,6 +412,7 @@ void wallhitReapOne(void) if (1); } +#if MATCHING GLOBAL_ASM( glabel wallhitsTick .late_rodata @@ -1027,205 +1028,206 @@ glabel var7f1b5d18 /* f13f3ec: 03e00008 */ jr $ra /* f13f3f0: 27bd0130 */ addiu $sp,$sp,0x130 ); - const char var7f1b5a54[] = "wallhit"; s32 var8007f834 = 0; +#else // Mismatch: float regalloc for midx, midy and midz -//void wallhitsTick(void) -//{ -// f32 sp12c; -// f32 fov; -// s32 numallocated; -// s32 i; -// s32 j; -// u32 stack[3]; -// f32 midx; -// f32 midy; -// f32 midz; -// f32 f22; -// f32 f24; -// struct wallhit *wallhit; -// struct coord spc8[4]; -// u32 stack2[4]; -// -// static s32 var8007f834 = 0; -// -// sp12c = (g_Vars.lvupdate240 + 2.0f) * 0.25f; -// fov = currentPlayerGetGunZoomFov(); -// -// mainOverrideVariable("wallhit", &var8007f750); -// -// var8007f740 = 0; -// -// if (fov == 0.0f || fov == 60.0f) { -// var8007f748 = 1; -// } else { -// f32 tmp = fov / g_Vars.currentplayer->zoominfovy; -// var8007f748 = 60.0f / fov - 1.00f / tmp + 1; -// } -// -// var8007f74c = 1.0f / var8007f748; -// -// numallocated = g_WallhitsNumFree + g_WallhitsNumUsed; -// -// if (numallocated < var8009cc70) { -// wallhitReapOne(); -// } else if (numallocated < var8009cc74) { -// var8007f834++; -// -// if (var8007f834 == 8) { -// var8007f834 = 0; -// wallhitReapOne(); -// } -// } -// -// wallhit = g_Wallhits; -// -// for (i = 0; i < g_WallhitsMax; i++) { -// f32 f0 = sp12c; -// -// if (wallhit->inuse) { -// if (wallhit->timerspeed != 8) { -// f0 *= 0.6f * ((wallhit->timerspeed - 8.0f) * 0.125f); -// } -// -// if (wallhit->timermax) { -// u32 amount = (u32)(f0 + 0.5f); -// -// if (wallhit->expanding) { -// if (wallhit->timercur > wallhit->timermax) { -// wallhit->timermax = 0; -// wallhit->timercur = 0; -// wallhit->inuse = true; -// } -// -// wallhit->timercur += amount; -// } else { -// if (amount < wallhit->timercur) { -// wallhit->timercur -= amount; -// } else { -// wallhitFree(wallhit); -// } -// } -// -// if (wallhit->timermax) { -// f24 = (f32) wallhit->timercur / wallhit->timermax; -// -// if (f24 > 1.0f) { -// f24 = 1.0f; -// } -// -// f22 = f24; -// -// if (wallhit->expanding) { -// f32 frac = 0.2f; -// f32 sizefrac; -// f32 f30; -// s32 minindex; -// f32 tmp; -// s32 j; -// -// tmp = 1.5707964f * f24; -// f30 = (1.0f - frac) * sinf(tmp); -// f22 = 1.0f - tmp + 0.6f; -// -// wallhit->vertices2 = gfxAllocateVertices(4); -// -// midx = var800845dc.x; \ -// midy = var800845dc.y; \ -// midz = var800845dc.z; -// -// // Copy the vertices into a float array -// for (j = 0; j < 4; j++) { -// spc8[j].x = wallhit->vertices[j].x; -// spc8[j].y = wallhit->vertices[j].y; -// spc8[j].z = wallhit->vertices[j].z; -// } -// -// // Sum the vertices and divide them by 4 to get the centre -// minindex = 0; -// -// for (j = 0; j < 4; j++) { -// midx = midx + spc8[j].x; -// midy = midy + spc8[j].y; -// midz = midz + spc8[j].z; -// -// // This should be j != 0, but minindex is unused -// // so it doesn't affect anything -// if (minindex != 0 && spc8[j].y < spc8[minindex].y) { -// minindex = j; -// } -// } -// -// midx = 0.25f * midx; -// midy = 0.25f * midy; -// midz = 0.25f * midz; -// -// sizefrac = frac + f30; -// -// // Calculate and apply the new size -// for (j = 0; j < 4; j++) { -// f32 xradius = spc8[j].x - midx; -// f32 yradius = spc8[j].y - midy; -// f32 zradius = spc8[j].z - midz; -// -// wallhit->vertices2[j].x = midx + xradius * sizefrac; -// wallhit->vertices2[j].y = midy + yradius * sizefrac; -// wallhit->vertices2[j].z = midz + zradius * sizefrac; -// wallhit->vertices2[j].s = wallhit->vertices[j].s; -// wallhit->vertices2[j].t = wallhit->vertices[j].t; -// wallhit->vertices2[j].colour = wallhit->vertices[j].colour; -// } -// -// if (1); -// -// f24 *= 2.0f; -// -// if (f24 > 1.0f) { -// f24 = 1.0f; -// } -// -// if (1); -// } -// -// for (j = 0; j < 4; j++) { -// u32 alpha; -// -// if (f22 > 1.0f) { -// f22 = 1.0f; -// } -// -// alpha = wallhit->basecolours[j].a * f24; -// -// if (alpha > 255) { -// alpha = 255; -// } -// -// wallhit->finalcolours[j].a = alpha; -// } -// } else { -// if (wallhit->inuse) { -// wallhit->vertices2 = NULL; -// -// for (j = 0; j < 4; j++) { -// wallhit->finalcolours[j].a = wallhit->basecolours[j].a; -// } -// } else { -// wallhit->vertices2 = NULL; -// } -// } -// } -// -// wallhit->unk6f_05 = true; -// } -// -// wallhit++; -// -// if (1); -// } -//} +void wallhitsTick(void) +{ + f32 sp12c; + f32 fov; + s32 numallocated; + s32 i; + s32 j; + u32 stack[3]; + f32 midx; + f32 midy; + f32 midz; + f32 f22; + f32 f24; + struct wallhit *wallhit; + struct coord spc8[4]; + u32 stack2[4]; + + static s32 var8007f834 = 0; + + sp12c = (g_Vars.lvupdate240 + 2.0f) * 0.25f; + fov = currentPlayerGetGunZoomFov(); + + mainOverrideVariable("wallhit", &var8007f750); + + var8007f740 = 0; + + if (fov == 0.0f || fov == 60.0f) { + var8007f748 = 1; + } else { + f32 tmp = fov / g_Vars.currentplayer->zoominfovy; + var8007f748 = 60.0f / fov - 1.00f / tmp + 1; + } + + var8007f74c = 1.0f / var8007f748; + + numallocated = g_WallhitsNumFree + g_WallhitsNumUsed; + + if (numallocated < var8009cc70) { + wallhitReapOne(); + } else if (numallocated < var8009cc74) { + var8007f834++; + + if (var8007f834 == 8) { + var8007f834 = 0; + wallhitReapOne(); + } + } + + wallhit = g_Wallhits; + + for (i = 0; i < g_WallhitsMax; i++) { + f32 f0 = sp12c; + + if (wallhit->inuse) { + if (wallhit->timerspeed != 8) { + f0 *= 0.6f * ((wallhit->timerspeed - 8.0f) * 0.125f); + } + + if (wallhit->timermax) { + u32 amount = (u32)(f0 + 0.5f); + + if (wallhit->expanding) { + if (wallhit->timercur > wallhit->timermax) { + wallhit->timermax = 0; + wallhit->timercur = 0; + wallhit->inuse = true; + } + + wallhit->timercur += amount; + } else { + if (amount < wallhit->timercur) { + wallhit->timercur -= amount; + } else { + wallhitFree(wallhit); + } + } + + if (wallhit->timermax) { + f24 = (f32) wallhit->timercur / wallhit->timermax; + + if (f24 > 1.0f) { + f24 = 1.0f; + } + + f22 = f24; + + if (wallhit->expanding) { + f32 frac = 0.2f; + f32 sizefrac; + f32 f30; + s32 minindex; + f32 tmp; + s32 j; + + tmp = 1.5707964f * f24; + f30 = (1.0f - frac) * sinf(tmp); + f22 = 1.0f - tmp + 0.6f; + + wallhit->vertices2 = gfxAllocateVertices(4); + + midx = var800845dc.x; \ + midy = var800845dc.y; \ + midz = var800845dc.z; + + // Copy the vertices into a float array + for (j = 0; j < 4; j++) { + spc8[j].x = wallhit->vertices[j].x; + spc8[j].y = wallhit->vertices[j].y; + spc8[j].z = wallhit->vertices[j].z; + } + + // Sum the vertices and divide them by 4 to get the centre + minindex = 0; + + for (j = 0; j < 4; j++) { + midx = midx + spc8[j].x; + midy = midy + spc8[j].y; + midz = midz + spc8[j].z; + + // This should be j != 0, but minindex is unused + // so it doesn't affect anything + if (minindex != 0 && spc8[j].y < spc8[minindex].y) { + minindex = j; + } + } + + midx = 0.25f * midx; + midy = 0.25f * midy; + midz = 0.25f * midz; + + sizefrac = frac + f30; + + // Calculate and apply the new size + for (j = 0; j < 4; j++) { + f32 xradius = spc8[j].x - midx; + f32 yradius = spc8[j].y - midy; + f32 zradius = spc8[j].z - midz; + + wallhit->vertices2[j].x = midx + xradius * sizefrac; + wallhit->vertices2[j].y = midy + yradius * sizefrac; + wallhit->vertices2[j].z = midz + zradius * sizefrac; + wallhit->vertices2[j].s = wallhit->vertices[j].s; + wallhit->vertices2[j].t = wallhit->vertices[j].t; + wallhit->vertices2[j].colour = wallhit->vertices[j].colour; + } + + if (1); + + f24 *= 2.0f; + + if (f24 > 1.0f) { + f24 = 1.0f; + } + + if (1); + } + + for (j = 0; j < 4; j++) { + u32 alpha; + + if (f22 > 1.0f) { + f22 = 1.0f; + } + + alpha = wallhit->basecolours[j].a * f24; + + if (alpha > 255) { + alpha = 255; + } + + wallhit->finalcolours[j].a = alpha; + } + } else { + if (wallhit->inuse) { + wallhit->vertices2 = NULL; + + for (j = 0; j < 4; j++) { + wallhit->finalcolours[j].a = wallhit->basecolours[j].a; + } + } else { + wallhit->vertices2 = NULL; + } + } + } + + wallhit->unk6f_05 = true; + } + + wallhit++; + + if (1); + } +} +#endif const char var7f1b5a5c[] = "g_MaxRound = %s%s%f"; const char var7f1b5a70[] = ""; diff --git a/src/game/weather.c b/src/game/weather.c index f4e1ff4f6..7d42ff003 100644 --- a/src/game/weather.c +++ b/src/game/weather.c @@ -758,6 +758,7 @@ bool weatherIsRoomWeatherProof(s32 room) return false; } +#if MATCHING GLOBAL_ASM( glabel weatherRenderRain .late_rodata @@ -2483,614 +2484,618 @@ u32 var8007f0f0 = 2500; u32 var8007f0f4 = 1; u32 var8007f0f8 = 1; u32 var8007f0fc = 22000; +#else +u32 var8007f0e0 = 0x00000001; -//Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2) -//{ -// u8 stack[0x10]; -// s32 spdb0[10]; -// Mtxf *mtx; -// s32 i; -// s32 s0; -// s32 spd84[8]; -// s32 spd80; -// s32 spcb8[50]; -// struct coord spca8; -// struct coord spc9c; -// struct coord spc90; -// s32 s1; -// s32 s1_2; -// s32 s2; -// -// f32 spc84; -// s32 spbbc[50]; -// struct coord sp964[50]; -// struct coord sp70c[50]; -// s32 sp708; -// s32 sp258[50][6]; -// bool s3; -// struct gfxvtx *s3_2; -// s32 s4; -// struct weatherparticledata *particledata; -// struct weatherparticle *particle; -// f32 temp_f2_7; -// s32 a2; -// struct coord sp230; -// struct coord sp224; -// f32 f0; -// f32 sp218[2]; -// f32 sp214; -// struct gfxvtx *vertices; // 210 -// f32 frac; -// s32 a0; -// Mtxf sp1c8; -// struct coord sp198[4]; -// s32 sp194; -// -// s32 j2; -// s32 k; -// u32 *colours; -// struct gfxvtx *v0_2; -// f32 sp174; -// s32 numneighbours; -// s32 j; -// s32 p; -// f32 tmp1; -// f32 tmp2; -// f32 tmp3; -// struct coord sp15c; -// struct coord sp150; -// s16 sp128[20]; -// struct coord sp108; -// struct coord spfc; -// struct coord spe4; -// struct coord spd4; -// -// static u32 var8007f0e4 = 0xaaaaaa1f; -// static u32 var8007f0e8 = 0x11111844; -// static u32 var8007f0ec = 50; -// static u32 var8007f0f0 = 2500; -// static u32 var8007f0f4 = 1; -// static u32 var8007f0f8 = 1; -// static u32 var8007f0fc = 22000; -// -// spd80 = 1; -// s4 = 0; -// sp708 = 0; -// -// mainOverrideVariable("raincol1", &var8007f0e4); -// mainOverrideVariable("raincol2", &var8007f0e8); -// mainOverrideVariable("rainwidth", &var8007f0e0); -// mainOverrideVariable("rainout", &var8007f0ec); -// mainOverrideVariable("cddiv", &var8007f0f0); -// mainOverrideVariable("wetclip", &var8007f0f4); -// mainOverrideVariable("bounder", &var8007f0f8); -// mainOverrideVariable("trypitch", &var8007f0fc); -// -// if (g_Vars.lvupdate240 <= 0) { -// spd80 = 0; -// } -// -// osGetCount(); -// -// for (i = 0; i != 10; i++) { -// spdb0[i] = 0; -// } -// -// texSelect(&gdl, &g_TexGeneralConfigs[1], 2, 1, 2, 1, NULL); -// -// gDPSetCycleType(gdl++, G_CYC_1CYCLE); -// gDPSetColorDither(gdl++, G_CD_DISABLE); -// gDPSetRenderMode(gdl++, G_RM_AA_ZB_XLU_SURF, G_RM_NOOP2); -// gDPSetAlphaCompare(gdl++, G_AC_NONE); -// gDPSetTextureLOD(gdl++, G_TL_TILE); -// gDPSetTextureConvert(gdl++, G_TC_FILT); -// gDPSetCombineLERP(gdl++, -// 0, 0, 0, SHADE, TEXEL0, 0, SHADE, 0, -// 0, 0, 0, SHADE, TEXEL0, 0, SHADE, 0); -// -// particledata = weather->particledata[arg2]; -// sp194 = 0; -// -// mtx4LoadIdentity(&sp1c8); -// mtx00015be0(camGetWorldToScreenMtxf(), &sp1c8); -// -// sp1c8.m[3][0] = 0.0f; -// sp1c8.m[3][1] = 0.0f; -// sp1c8.m[3][2] = 0.0f; -// -// mtx = gfxAllocateMatrix(); -// -// mtx00016054(&sp1c8, mtx); -// -// gSPMatrix(gdl++, osVirtualToPhysical(mtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); -// -// sp230.f[0] = g_Vars.currentplayer->cam_pos.f[0]; -// sp230.f[1] = g_Vars.currentplayer->cam_pos.f[1]; -// sp230.f[2] = g_Vars.currentplayer->cam_pos.f[2]; -// -// sp224.f[0] = sp230.f[0] - particledata->unk3e80.f[0]; -// sp224.f[1] = sp230.f[1] - particledata->unk3e80.f[1]; -// sp224.f[2] = sp230.f[2] - particledata->unk3e80.f[2]; -// -// if (ABSF(sp224.f[0]) > ABSF(particledata->boundarymin.f[0]) + ABSF(particledata->boundarymax.f[0]) -// || ABSF(sp224.f[1]) > ABSF(particledata->boundarymin.f[1]) + ABSF(particledata->boundarymax.f[1]) -// || ABSF(sp224.f[2]) > ABSF(particledata->boundarymin.f[2]) + ABSF(particledata->boundarymax.f[2])) { -// sp224.f[0] = particledata->boundaryrange.f[0] * 0.5f; -// sp224.f[1] = particledata->boundaryrange.f[1] * 0.5f; -// sp224.f[2] = particledata->boundaryrange.f[2] * 0.5f; -// } -// -// // 32b0 -// for (p = 0; p < 500; p++) { -// particle = &particledata->particles[p]; -// -// // x -// f0 = particle->pos.f[0] - particledata->boundarymin.f[0] - sp224.f[0]; -// -// if (f0 < 0.0f) { -// f0 += particledata->boundaryrange.f[0]; -// } -// -// if (f0 > particledata->boundaryrange.f[0]) { -// f0 -= particledata->boundaryrange.f[0]; -// } -// -// particle->pos.f[0] = particledata->boundarymin.f[0] + f0; -// -// // y -// f0 = particle->pos.f[1] - particledata->boundarymin.f[1] - sp224.f[1]; -// -// if (f0 < 0.0f) { -// f0 += particledata->boundaryrange.f[1]; -// } -// -// if (f0 > particledata->boundaryrange.f[1]) { -// f0 -= particledata->boundaryrange.f[1]; -// } -// -// particle->pos.f[1] = particledata->boundarymin.f[1] + f0; -// -// // z -// f0 = particle->pos.f[2] - particledata->boundarymin.f[2] - sp224.f[2]; -// -// if (f0 < 0.0f) { -// f0 += particledata->boundaryrange.f[2]; -// } -// -// if (f0 > particledata->boundaryrange.f[2]) { -// f0 -= particledata->boundaryrange.f[2]; -// } -// -// particle->pos.f[2] = particledata->boundarymin.f[2] + f0; -// } -// -// // 33a4 -// particledata->unk3e80.f[0] = sp230.f[0]; -// particledata->unk3e80.f[1] = sp230.f[1]; -// particledata->unk3e80.f[2] = sp230.f[2]; -// -// if (weatherIsRoomWeatherProof(g_Vars.currentplayer->cam_room)) { -// if (weather->unk88 > 0.99f) { -// weather->unk8c = 0.65f; -// weather->unk90 = 9; -// } -// } else if (weather->unk88 < 0.66f) { -// weather->unk8c = 1.0f; -// weather->unk90 = 7; -// } -// -// // 3444 -// if (g_Vars.lvupdate240 > 0) { -// g_SkyLightningActive = false; -// -// if (weather->unk94 < 0) { -// if (RANDOMFRAC() < weather->unkc4) { -// func0f131610(weather); -// } -// } else { -// // 34bc -// if (weather->unk98 - 1 == weather->unk94 -// || weather->unk9c - 1 == weather->unk94 -// || weather->unka0 - 1 == weather->unk94) { -// g_SkyLightningActive = true; -// } -// -// if (weather->unk98 == weather->unk94 -// || weather->unk9c == weather->unk94 -// || weather->unka0 == weather->unk94) { -// s1 = 150; -// -// if (weather->unk9c == weather->unk94) { -// s1 = 200; -// } -// -// // 3534 -// for (s0 = 1; s0 < g_Vars.roomcount; s0++) { -// if (!weatherIsRoomWeatherProof(s0)) { -// roomSetUnk52(s0, s1); -// } -// } -// } -// -// // 3574 -// if (weather->unka4 == weather->unk94) { -// s1_2 = 0x80ba; -// sp174 = RANDOMFRAC() * 1.5f + 0.4f; -// frac = RANDOMFRAC(); -// -// if (frac); -// -// // 608 -// if (frac <= 0.2f && frac > .1f) { -// s1_2 = 0x80bb; -// } -// -// // 63c -// if (frac <= 0.3f && frac > .2f) { -// s1_2 = 0x80bc; -// } -// -// if (frac <= 0.4f && frac > .3f) { -// s1_2 = 0x80bd; -// } -// -// if (frac <= 0.5f && frac > .4f) { -// s1_2 = 0x80be; -// } -// -// if (frac <= 0.6f && frac > .5f) { -// s1_2 = 0x80bf; -// } -// -// if (frac <= 0.7f && frac > .6f) { -// s1_2 = 0x80c0; -// } -// -// if (frac <= 0.8f && frac > .7f) { -// s1_2 = 0x80c1; -// } -// -// if (frac <= 0.9f && frac > .8f) { -// s1_2 = 0x80c2; -// } -// -// if (frac <= 1.0f && frac > .9f) { -// s1_2 = 0x80c3; -// } -// -// if (weather->audiohandles[3] == NULL) { -// weather->unkf8 = s1_2; -// sndStart(var80095200, s1_2, &weather->audiohandles[3], -1, -1, -1.0f, -1, -1); -// weather->unk58[3].unk00 = 1.f; -// -// if (weather->audiohandles[3] != NULL) { -// a2 = weather->unk88; -// -// if (g_Vars.tickmode == TICKMODE_CUTSCENE) { -// a2 /= 2; -// } -// -// sndAdjust(&weather->audiohandles[3], 0, a2, -1, weather->unkf8, 1, 1, -1, 1); -// audioPostEvent(weather->audiohandles[3], 0x10, *(s32 *)&sp174); -// } -// } -// } -// -// weather->unk94++; -// -// if (weather->unk94 > 150) { -// weather->unk94 = -1; -// } -// } -// } -// -// // 38c4 -// if (var8007f0f4) { -// sp150.f[0] = particledata->boundarymin.f[0] + g_Vars.currentplayer->cam_pos.f[0]; -// sp15c.f[0] = particledata->boundarymax.f[0] + g_Vars.currentplayer->cam_pos.f[0]; -// sp150.f[1] = particledata->boundarymin.f[1] + g_Vars.currentplayer->cam_pos.f[1]; -// sp15c.f[1] = particledata->boundarymax.f[1] + g_Vars.currentplayer->cam_pos.f[1]; -// sp150.f[2] = particledata->boundarymin.f[2] + g_Vars.currentplayer->cam_pos.f[2]; -// sp15c.f[2] = particledata->boundarymax.f[2] + g_Vars.currentplayer->cam_pos.f[2]; -// -// if (s4 < 50) { -// spcb8[s4] = g_Vars.currentplayer->cam_room; -// s4++; -// } -// -// spc84 = 1.0f; -// -// // 3950 -// for (s2 = 0; s2 < s4; s2++) { -// numneighbours = roomGetNeighbours(spcb8[s2], sp128, ARRAYCOUNT(sp128)); -// -// // 396c -// for (j2 = 0; j2 < numneighbours; j2++) { -// a0 = true; -// -// if (g_Rooms[sp128[j2]].flags & ROOMFLAG_ONSCREEN) { -// for (k = 0; k < s4; k++) { -// if (spcb8[k] == sp128[j2]) { -// a0 = false; -// } -// } -// -// if (a0) { -// if (sp15c.f[0] < g_Rooms[sp128[j2]].bbmin[0] || g_Rooms[sp128[j2]].bbmax[0] < sp150.f[0]) { -// a0 = false; -// } -// -// if (sp15c.f[1] < g_Rooms[sp128[j2]].bbmin[1] || g_Rooms[sp128[j2]].bbmax[1] < sp150.f[1]) { -// a0 = false; -// } -// -// if (sp15c.f[2] < g_Rooms[sp128[j2]].bbmin[2] || g_Rooms[sp128[j2]].bbmax[2] < sp150.f[2]) { -// a0 = false; -// } -// } -// -// if (a0 && s4 < 50) { -// spcb8[s4] = sp128[j2]; -// s4++; -// } -// } -// } -// } -// -// // 3a98 -// for (s2 = 0; s2 < s4; s2++) { -// if (weatherIsRoomWeatherProof(spcb8[s2])) { -// sp964[sp708].f[0] = g_Rooms[spcb8[s2]].bbmin[0] / 1.0f; -// sp964[sp708].f[1] = g_Rooms[spcb8[s2]].bbmin[1] / 1.0f; -// sp964[sp708].f[2] = g_Rooms[spcb8[s2]].bbmin[2] / 1.0f; -// -// sp70c[sp708].f[0] = g_Rooms[spcb8[s2]].bbmax[0] / 1.0f; -// sp70c[sp708].f[1] = g_Rooms[spcb8[s2]].bbmax[1] / 1.0f; -// sp70c[sp708].f[2] = g_Rooms[spcb8[s2]].bbmax[2] / 1.0f; -// -// if (sp708 < 50) { -// spbbc[sp708] = spcb8[s2]; -// sp708++; -// } -// } -// } -// -// // 3b70 -// for (s0 = 0; s0 < sp708; s0++) { -// if (spbbc[s0]); -// sp258[s0][0] = g_Rooms[spbbc[s0]].bbmin[0]; -// sp258[s0][1] = g_Rooms[spbbc[s0]].bbmin[1]; -// sp258[s0][2] = g_Rooms[spbbc[s0]].bbmin[2]; -// sp258[s0][3] = g_Rooms[spbbc[s0]].bbmax[0]; -// sp258[s0][4] = g_Rooms[spbbc[s0]].bbmax[1]; -// sp258[s0][5] = g_Rooms[spbbc[s0]].bbmax[2]; -// } -// } -// -// colours = gfxAllocateColours(2); -// colours[0] = var8007f0e4; -// colours[1] = var8007f0e8; -// -// gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 2); -// -// spd84[0] = osGetCount(); -// -// // 3ca4 -// for (p = 0; p < 500; p++) { -// s3 = 1; -// -// if (particledata->particles[p].active & 3) { -// spd84[7] = osGetCount(); -// -// sp108.f[0] = particledata->unk3e80.f[0] + particledata->particles[p].pos.f[0]; -// sp108.f[1] = particledata->unk3e80.f[1] + particledata->particles[p].pos.f[1]; -// sp108.f[2] = particledata->unk3e80.f[2] + particledata->particles[p].pos.f[2]; -// -// if (cam0f0b5b9c(&sp108, 150)) { -// spdb0[7] = spdb0[7] + osGetCount() - spd84[7]; -// -// sp218[0] = particledata->particles[p].pos.f[0]; -// sp218[1] = particledata->particles[p].pos.f[2]; -// -// sp214 = sqrtf(sp218[0] * sp218[0] + sp218[1] * sp218[1]); -// -// if (sp214 < 0.0001f) { -// // empty -// } else { -// s32 tmp = sp194 * 3; -// -// if (sp194 == 0) { -// vertices = gfxAllocateVertices(12); -// } -// -// sp218[0] /= sp214; -// sp218[1] /= sp214; -// -// v0_2 = &vertices[tmp]; -// -// for (j = 0; j < 4; j++) { -// v0_2[j].unk08 = 0; -// v0_2[j].unk0a = 0; -// -// sp198[j].f[0] = particledata->particles[p].pos.f[0]; -// sp198[j].f[1] = particledata->particles[p].pos.f[1]; -// sp198[j].f[2] = particledata->particles[p].pos.f[2]; -// } -// -// spd84[1] = osGetCount(); -// spd84[2] = osGetCount(); -// -// // 3e0c -// if (var8007f0f4 && sp708 > 0) { -// spca8.f[0] = spc90.f[0] = (particledata->unk3e80.f[0] + particledata->particles[p].pos.f[0]) * spc84; -// spca8.f[1] = spc90.f[1] = (particledata->unk3e80.f[0] + particledata->particles[p].pos.f[1]) * spc84; -// spca8.f[2] = spc90.f[2] = (particledata->unk3e80.f[0] + particledata->particles[p].pos.f[2]) * spc84; -// -// spc9c.f[0] = (particledata->unk3e80.f[0] + (particledata->particles[p].pos.f[0] - (weather->windspeedx * (var8007f0ec / 10.0f)))) * spc84; -// spc9c.f[1] = (particledata->unk3e80.f[0] + (particledata->particles[p].pos.f[1] + weather->unkb8)) * spc84; -// spc9c.f[2] = (particledata->unk3e80.f[0] + (particledata->particles[p].pos.f[2] - (weather->windspeedz * (var8007f0ec / 10.0f)))) * spc84; -// -// spfc.f[0] = spc9c.f[0] - spc90.f[0]; -// spfc.f[1] = spc9c.f[1] - spc90.f[1]; -// spfc.f[2] = spc9c.f[2] - spc90.f[2]; -// -// // 3f24 -// if (spca8.f[0] < spc9c.f[0]) { -// tmp1 = spc9c.f[0]; -// spc9c.f[0] = spca8.f[0]; -// spca8.f[0] = tmp1; -// } -// -// if (spca8.f[1] < spc9c.f[1]) { -// tmp2 = spca8.f[1]; -// spca8.f[1] = spc9c.f[1]; -// spc9c.f[1] = tmp2; -// } -// -// if (spca8.f[2] < spc9c.f[2]) { -// tmp3 = spca8.f[2]; -// spca8.f[2] = spc9c.f[2]; -// spc9c.f[2] = tmp3; -// } -// -// spd84[3] = osGetCount(); -// -// // 3f84 -// for (s0 = 0; s0 < sp708; s0++) { -// if (spc9c.f[0] <= g_Rooms[spbbc[s0]].bbmax[0] -// && spca8.f[0] >= g_Rooms[spbbc[s0]].bbmin[0] -// && spc9c.f[2] <= g_Rooms[spbbc[s0]].bbmax[2] -// && spca8.f[2] >= g_Rooms[spbbc[s0]].bbmin[2] -// && spc9c.f[1] <= g_Rooms[spbbc[s0]].bbmax[1] -// && spca8.f[1] >= g_Rooms[spbbc[s0]].bbmin[1] -// && var8007f0f8 -// && func0f15f20c(&spc90, &spfc, &sp258[s0][0], &sp258[s0][3])) { -// s3 = 0; -// } -// } -// -// spdb0[3] = spdb0[3] + osGetCount() - spd84[3]; -// } -// -// spdb0[2] = spdb0[2] + osGetCount() - spd84[2]; -// -// // 40b8 -// if (s3) { -// spd84[4] = osGetCount(); -// -// temp_f2_7 = var8007f0e0 * (1.0f + sp214 / (var8007f0f0 / 10.0f)); -// -// sp198[0].f[0] += -sp218[1] * -temp_f2_7; -// sp198[0].f[2] += sp218[0] * -temp_f2_7; -// -// sp198[1].f[0] += -sp218[1] * temp_f2_7; -// sp198[1].f[2] += sp218[0] * temp_f2_7; -// -// sp198[3].f[0] -= weather->windspeedx * (var8007f0ec / 10.0f) + -sp218[1] * temp_f2_7; -// sp198[3].f[1] += weather->unkb8; -// sp198[3].f[2] -= weather->windspeedz * (var8007f0ec / 10.0f) + sp218[0] * temp_f2_7; -// -// sp198[2].f[0] -= weather->windspeedx * (var8007f0ec / 10.0f) + -sp218[1] * -temp_f2_7; -// sp198[2].f[1] += weather->unkb8; -// sp198[2].f[2] -= weather->windspeedz * (var8007f0ec / 10.0f) + sp218[0] * -temp_f2_7; -// -// v0_2[0].colour = 0; -// v0_2[1].colour = 0; -// v0_2[2].colour = 4; -// v0_2[3].colour = 4; -// -// if (spd80 > 0) { -// spe4.f[0] = (particledata->unk3e80.f[0] + particledata->particles[p].pos.f[0]) * spc84; -// spe4.f[1] = (particledata->unk3e80.f[1] + particledata->particles[p].pos.f[1]) * spc84; -// spe4.f[2] = (particledata->unk3e80.f[2] + particledata->particles[p].pos.f[2]) * spc84; -// -// for (s0 = 0; s0 < s4; s0++) { -// if (spe4.f[0] <= g_Rooms[spcb8[s0]].bbmax[0] -// && spe4.f[0] >= g_Rooms[spcb8[s0]].bbmin[0] -// && spe4.f[2] <= g_Rooms[spcb8[s0]].bbmax[2] -// && spe4.f[2] >= g_Rooms[spcb8[s0]].bbmin[2] -// && spe4.f[1] <= g_Rooms[spcb8[s0]].bbmax[1] -// && spe4.f[1] >= g_Rooms[spcb8[s0]].bbmin[1] -// && spe4.f[1] + spc84 * (particledata->particles[p].inc.f[1] * 1) < g_Rooms[spcb8[s0]].bbmin[1]) { -// spd4.f[0] = particledata->unk3e80.f[0] + particledata->particles[p].pos.f[0]; -// spd4.f[1] = g_Rooms[spcb8[s0]].bbmin[1] / spc84; -// spd4.f[2] = particledata->unk3e80.f[2] + particledata->particles[p].pos.f[2]; -// -// sparksCreate(spcb8[s0], NULL, &spd4, &particledata->particles[p].inc, NULL, SPARKTYPE_SHALLOWWATER); -// -// spd80--; -// } -// } -// } -// -// spdb0[4] = spdb0[4] + osGetCount() - spd84[4]; -// spd84[5] = osGetCount(); -// -// v0_2[0].unk08 = 0; -// v0_2[0].unk0a = 256; -// -// v0_2[1].unk08 = 256; -// v0_2[1].unk0a = 256; -// -// v0_2[2].unk08 = 256; -// v0_2[2].unk0a = 0; -// -// v0_2[3].unk08 = 0; -// v0_2[3].unk0a = 0; -// -// spdb0[5] = spdb0[5] + osGetCount() - spd84[5]; -// spd84[6] = osGetCount(); -// -// v0_2[0].x = sp198[0].f[0]; -// v0_2[0].y = sp198[0].f[1]; -// v0_2[0].z = sp198[0].f[2]; -// -// v0_2[1].x = sp198[1].f[0]; -// v0_2[1].y = sp198[1].f[1]; -// v0_2[1].z = sp198[1].f[2]; -// -// v0_2[2].x = sp198[2].f[0]; -// v0_2[2].y = sp198[2].f[1]; -// v0_2[2].z = sp198[2].f[2]; -// -// if (sp194 == 3) { -// gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 12); -// gDPTri4(gdl++, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); -// sp194 = 0; -// -// } else { -// sp194++; -// } -// -// spdb0[6] = spdb0[6] + osGetCount() - spd84[6]; -// spdb0[1] = spdb0[1] + osGetCount() - spd84[1]; -// } -// } -// } -// } -// } -// -// if (sp194 > 0) { -// gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 12); -// -// if (sp194 == 1) { -// gDPTri1(gdl++, 0, 1, 2); -// } -// -// if (sp194 == 2) { -// gDPTri2(gdl++, 0, 1, 2, 3, 4, 5); -// } -// -// if (sp194 == 3) { -// gDPTri3(gdl++, 0, 1, 2, 3, 4, 5, 6, 7, 8); -// } -// } -// -// osGetCount(); -// -// return gdl; -//} +Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2) +{ + u8 stack[0x10]; + s32 spdb0[10]; + Mtxf *mtx; + s32 i; + s32 s0; + s32 spd84[8]; + s32 spd80; + s32 spcb8[50]; + struct coord spca8; + struct coord spc9c; + struct coord spc90; + s32 s1; + s32 s1_2; + s32 s2; + f32 spc84; + s32 spbbc[50]; + struct coord sp964[50]; + struct coord sp70c[50]; + s32 sp708; + s32 sp258[50][6]; + bool s3; + struct gfxvtx *s3_2; + s32 s4; + struct weatherparticledata *particledata; + struct weatherparticle *particle; + f32 temp_f2_7; + s32 a2; + struct coord sp230; + struct coord sp224; + f32 f0; + f32 sp218[2]; + f32 sp214; + struct gfxvtx *vertices; // 210 + f32 frac; + s32 a0; + Mtxf sp1c8; + struct coord sp198[4]; + s32 sp194; + + s32 j2; + s32 k; + u32 *colours; + struct gfxvtx *v0_2; + f32 sp174; + s32 numneighbours; + s32 j; + s32 p; + f32 tmp1; + f32 tmp2; + f32 tmp3; + struct coord sp15c; + struct coord sp150; + s16 sp128[20]; + struct coord sp108; + struct coord spfc; + struct coord spe4; + struct coord spd4; + + static u32 var8007f0e4 = 0xaaaaaa1f; + static u32 var8007f0e8 = 0x11111844; + static u32 var8007f0ec = 50; + static u32 var8007f0f0 = 2500; + static u32 var8007f0f4 = 1; + static u32 var8007f0f8 = 1; + static u32 var8007f0fc = 22000; + + spd80 = 1; + s4 = 0; + sp708 = 0; + + mainOverrideVariable("raincol1", &var8007f0e4); + mainOverrideVariable("raincol2", &var8007f0e8); + mainOverrideVariable("rainwidth", &var8007f0e0); + mainOverrideVariable("rainout", &var8007f0ec); + mainOverrideVariable("cddiv", &var8007f0f0); + mainOverrideVariable("wetclip", &var8007f0f4); + mainOverrideVariable("bounder", &var8007f0f8); + mainOverrideVariable("trypitch", &var8007f0fc); + + if (g_Vars.lvupdate240 <= 0) { + spd80 = 0; + } + + osGetCount(); + + for (i = 0; i != 10; i++) { + spdb0[i] = 0; + } + + texSelect(&gdl, &g_TexGeneralConfigs[1], 2, 1, 2, 1, NULL); + + gDPSetCycleType(gdl++, G_CYC_1CYCLE); + gDPSetColorDither(gdl++, G_CD_DISABLE); + gDPSetRenderMode(gdl++, G_RM_AA_ZB_XLU_SURF, G_RM_NOOP2); + gDPSetAlphaCompare(gdl++, G_AC_NONE); + gDPSetTextureLOD(gdl++, G_TL_TILE); + gDPSetTextureConvert(gdl++, G_TC_FILT); + gDPSetCombineLERP(gdl++, + 0, 0, 0, SHADE, TEXEL0, 0, SHADE, 0, + 0, 0, 0, SHADE, TEXEL0, 0, SHADE, 0); + + particledata = weather->particledata[arg2]; + sp194 = 0; + + mtx4LoadIdentity(&sp1c8); + mtx00015be0(camGetWorldToScreenMtxf(), &sp1c8); + + sp1c8.m[3][0] = 0.0f; + sp1c8.m[3][1] = 0.0f; + sp1c8.m[3][2] = 0.0f; + + mtx = gfxAllocateMatrix(); + + mtx00016054(&sp1c8, mtx); + + gSPMatrix(gdl++, osVirtualToPhysical(mtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + sp230.f[0] = g_Vars.currentplayer->cam_pos.f[0]; + sp230.f[1] = g_Vars.currentplayer->cam_pos.f[1]; + sp230.f[2] = g_Vars.currentplayer->cam_pos.f[2]; + + sp224.f[0] = sp230.f[0] - particledata->unk3e80.f[0]; + sp224.f[1] = sp230.f[1] - particledata->unk3e80.f[1]; + sp224.f[2] = sp230.f[2] - particledata->unk3e80.f[2]; + + if (ABSF(sp224.f[0]) > ABSF(particledata->boundarymin.f[0]) + ABSF(particledata->boundarymax.f[0]) + || ABSF(sp224.f[1]) > ABSF(particledata->boundarymin.f[1]) + ABSF(particledata->boundarymax.f[1]) + || ABSF(sp224.f[2]) > ABSF(particledata->boundarymin.f[2]) + ABSF(particledata->boundarymax.f[2])) { + sp224.f[0] = particledata->boundaryrange.f[0] * 0.5f; + sp224.f[1] = particledata->boundaryrange.f[1] * 0.5f; + sp224.f[2] = particledata->boundaryrange.f[2] * 0.5f; + } + + // 32b0 + for (p = 0; p < 500; p++) { + particle = &particledata->particles[p]; + + // x + f0 = particle->pos.f[0] - particledata->boundarymin.f[0] - sp224.f[0]; + + if (f0 < 0.0f) { + f0 += particledata->boundaryrange.f[0]; + } + + if (f0 > particledata->boundaryrange.f[0]) { + f0 -= particledata->boundaryrange.f[0]; + } + + particle->pos.f[0] = particledata->boundarymin.f[0] + f0; + + // y + f0 = particle->pos.f[1] - particledata->boundarymin.f[1] - sp224.f[1]; + + if (f0 < 0.0f) { + f0 += particledata->boundaryrange.f[1]; + } + + if (f0 > particledata->boundaryrange.f[1]) { + f0 -= particledata->boundaryrange.f[1]; + } + + particle->pos.f[1] = particledata->boundarymin.f[1] + f0; + + // z + f0 = particle->pos.f[2] - particledata->boundarymin.f[2] - sp224.f[2]; + + if (f0 < 0.0f) { + f0 += particledata->boundaryrange.f[2]; + } + + if (f0 > particledata->boundaryrange.f[2]) { + f0 -= particledata->boundaryrange.f[2]; + } + + particle->pos.f[2] = particledata->boundarymin.f[2] + f0; + } + + // 33a4 + particledata->unk3e80.f[0] = sp230.f[0]; + particledata->unk3e80.f[1] = sp230.f[1]; + particledata->unk3e80.f[2] = sp230.f[2]; + + if (weatherIsRoomWeatherProof(g_Vars.currentplayer->cam_room)) { + if (weather->unk88 > 0.99f) { + weather->unk8c = 0.65f; + weather->unk90 = 9; + } + } else if (weather->unk88 < 0.66f) { + weather->unk8c = 1.0f; + weather->unk90 = 7; + } + + // 3444 + if (g_Vars.lvupdate240 > 0) { + g_SkyLightningActive = false; + + if (weather->unk94 < 0) { + if (RANDOMFRAC() < weather->unkc4) { + func0f131610(weather); + } + } else { + // 34bc + if (weather->unk98 - 1 == weather->unk94 + || weather->unk9c - 1 == weather->unk94 + || weather->unka0 - 1 == weather->unk94) { + g_SkyLightningActive = true; + } + + if (weather->unk98 == weather->unk94 + || weather->unk9c == weather->unk94 + || weather->unka0 == weather->unk94) { + s1 = 150; + + if (weather->unk9c == weather->unk94) { + s1 = 200; + } + + // 3534 + for (s0 = 1; s0 < g_Vars.roomcount; s0++) { + if (!weatherIsRoomWeatherProof(s0)) { + roomSetUnk52(s0, s1); + } + } + } + + // 3574 + if (weather->unka4 == weather->unk94) { + s1_2 = 0x80ba; + sp174 = RANDOMFRAC() * 1.5f + 0.4f; + frac = RANDOMFRAC(); + + if (frac); + + // 608 + if (frac <= 0.2f && frac > .1f) { + s1_2 = 0x80bb; + } + + // 63c + if (frac <= 0.3f && frac > .2f) { + s1_2 = 0x80bc; + } + + if (frac <= 0.4f && frac > .3f) { + s1_2 = 0x80bd; + } + + if (frac <= 0.5f && frac > .4f) { + s1_2 = 0x80be; + } + + if (frac <= 0.6f && frac > .5f) { + s1_2 = 0x80bf; + } + + if (frac <= 0.7f && frac > .6f) { + s1_2 = 0x80c0; + } + + if (frac <= 0.8f && frac > .7f) { + s1_2 = 0x80c1; + } + + if (frac <= 0.9f && frac > .8f) { + s1_2 = 0x80c2; + } + + if (frac <= 1.0f && frac > .9f) { + s1_2 = 0x80c3; + } + + if (weather->audiohandles[3] == NULL) { + weather->unkf8 = s1_2; + sndStart(var80095200, s1_2, &weather->audiohandles[3], -1, -1, -1.0f, -1, -1); + weather->unk58[3].unk00 = 1.f; + + if (weather->audiohandles[3] != NULL) { + a2 = weather->unk88; + + if (g_Vars.tickmode == TICKMODE_CUTSCENE) { + a2 /= 2; + } + + sndAdjust(&weather->audiohandles[3], 0, a2, -1, weather->unkf8, 1, 1, -1, 1); + audioPostEvent(weather->audiohandles[3], 0x10, *(s32 *)&sp174); + } + } + } + + weather->unk94++; + + if (weather->unk94 > 150) { + weather->unk94 = -1; + } + } + } + + // 38c4 + if (var8007f0f4) { + sp150.f[0] = particledata->boundarymin.f[0] + g_Vars.currentplayer->cam_pos.f[0]; + sp15c.f[0] = particledata->boundarymax.f[0] + g_Vars.currentplayer->cam_pos.f[0]; + sp150.f[1] = particledata->boundarymin.f[1] + g_Vars.currentplayer->cam_pos.f[1]; + sp15c.f[1] = particledata->boundarymax.f[1] + g_Vars.currentplayer->cam_pos.f[1]; + sp150.f[2] = particledata->boundarymin.f[2] + g_Vars.currentplayer->cam_pos.f[2]; + sp15c.f[2] = particledata->boundarymax.f[2] + g_Vars.currentplayer->cam_pos.f[2]; + + if (s4 < 50) { + spcb8[s4] = g_Vars.currentplayer->cam_room; + s4++; + } + + spc84 = 1.0f; + + // 3950 + for (s2 = 0; s2 < s4; s2++) { + numneighbours = roomGetNeighbours(spcb8[s2], sp128, ARRAYCOUNT(sp128)); + + // 396c + for (j2 = 0; j2 < numneighbours; j2++) { + a0 = true; + + if (g_Rooms[sp128[j2]].flags & ROOMFLAG_ONSCREEN) { + for (k = 0; k < s4; k++) { + if (spcb8[k] == sp128[j2]) { + a0 = false; + } + } + + if (a0) { + if (sp15c.f[0] < g_Rooms[sp128[j2]].bbmin[0] || g_Rooms[sp128[j2]].bbmax[0] < sp150.f[0]) { + a0 = false; + } + + if (sp15c.f[1] < g_Rooms[sp128[j2]].bbmin[1] || g_Rooms[sp128[j2]].bbmax[1] < sp150.f[1]) { + a0 = false; + } + + if (sp15c.f[2] < g_Rooms[sp128[j2]].bbmin[2] || g_Rooms[sp128[j2]].bbmax[2] < sp150.f[2]) { + a0 = false; + } + } + + if (a0 && s4 < 50) { + spcb8[s4] = sp128[j2]; + s4++; + } + } + } + } + + // 3a98 + for (s2 = 0; s2 < s4; s2++) { + if (weatherIsRoomWeatherProof(spcb8[s2])) { + sp964[sp708].f[0] = g_Rooms[spcb8[s2]].bbmin[0] / 1.0f; + sp964[sp708].f[1] = g_Rooms[spcb8[s2]].bbmin[1] / 1.0f; + sp964[sp708].f[2] = g_Rooms[spcb8[s2]].bbmin[2] / 1.0f; + + sp70c[sp708].f[0] = g_Rooms[spcb8[s2]].bbmax[0] / 1.0f; + sp70c[sp708].f[1] = g_Rooms[spcb8[s2]].bbmax[1] / 1.0f; + sp70c[sp708].f[2] = g_Rooms[spcb8[s2]].bbmax[2] / 1.0f; + + if (sp708 < 50) { + spbbc[sp708] = spcb8[s2]; + sp708++; + } + } + } + + // 3b70 + for (s0 = 0; s0 < sp708; s0++) { + if (spbbc[s0]); + sp258[s0][0] = g_Rooms[spbbc[s0]].bbmin[0]; + sp258[s0][1] = g_Rooms[spbbc[s0]].bbmin[1]; + sp258[s0][2] = g_Rooms[spbbc[s0]].bbmin[2]; + sp258[s0][3] = g_Rooms[spbbc[s0]].bbmax[0]; + sp258[s0][4] = g_Rooms[spbbc[s0]].bbmax[1]; + sp258[s0][5] = g_Rooms[spbbc[s0]].bbmax[2]; + } + } + + colours = gfxAllocateColours(2); + colours[0] = var8007f0e4; + colours[1] = var8007f0e8; + + gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 2); + + spd84[0] = osGetCount(); + + // 3ca4 + for (p = 0; p < 500; p++) { + s3 = 1; + + if (particledata->particles[p].active & 3) { + spd84[7] = osGetCount(); + + sp108.f[0] = particledata->unk3e80.f[0] + particledata->particles[p].pos.f[0]; + sp108.f[1] = particledata->unk3e80.f[1] + particledata->particles[p].pos.f[1]; + sp108.f[2] = particledata->unk3e80.f[2] + particledata->particles[p].pos.f[2]; + + if (cam0f0b5b9c(&sp108, 150)) { + spdb0[7] = spdb0[7] + osGetCount() - spd84[7]; + + sp218[0] = particledata->particles[p].pos.f[0]; + sp218[1] = particledata->particles[p].pos.f[2]; + + sp214 = sqrtf(sp218[0] * sp218[0] + sp218[1] * sp218[1]); + + if (sp214 < 0.0001f) { + // empty + } else { + s32 tmp = sp194 * 3; + + if (sp194 == 0) { + vertices = gfxAllocateVertices(12); + } + + sp218[0] /= sp214; + sp218[1] /= sp214; + + v0_2 = &vertices[tmp]; + + for (j = 0; j < 4; j++) { + v0_2[j].s = 0; + v0_2[j].t = 0; + + sp198[j].f[0] = particledata->particles[p].pos.f[0]; + sp198[j].f[1] = particledata->particles[p].pos.f[1]; + sp198[j].f[2] = particledata->particles[p].pos.f[2]; + } + + spd84[1] = osGetCount(); + spd84[2] = osGetCount(); + + // 3e0c + if (var8007f0f4 && sp708 > 0) { + spca8.f[0] = spc90.f[0] = (particledata->unk3e80.f[0] + particledata->particles[p].pos.f[0]) * spc84; + spca8.f[1] = spc90.f[1] = (particledata->unk3e80.f[0] + particledata->particles[p].pos.f[1]) * spc84; + spca8.f[2] = spc90.f[2] = (particledata->unk3e80.f[0] + particledata->particles[p].pos.f[2]) * spc84; + + spc9c.f[0] = (particledata->unk3e80.f[0] + (particledata->particles[p].pos.f[0] - (weather->windspeedx * (var8007f0ec / 10.0f)))) * spc84; + spc9c.f[1] = (particledata->unk3e80.f[0] + (particledata->particles[p].pos.f[1] + weather->unkb8)) * spc84; + spc9c.f[2] = (particledata->unk3e80.f[0] + (particledata->particles[p].pos.f[2] - (weather->windspeedz * (var8007f0ec / 10.0f)))) * spc84; + + spfc.f[0] = spc9c.f[0] - spc90.f[0]; + spfc.f[1] = spc9c.f[1] - spc90.f[1]; + spfc.f[2] = spc9c.f[2] - spc90.f[2]; + + // 3f24 + if (spca8.f[0] < spc9c.f[0]) { + tmp1 = spc9c.f[0]; + spc9c.f[0] = spca8.f[0]; + spca8.f[0] = tmp1; + } + + if (spca8.f[1] < spc9c.f[1]) { + tmp2 = spca8.f[1]; + spca8.f[1] = spc9c.f[1]; + spc9c.f[1] = tmp2; + } + + if (spca8.f[2] < spc9c.f[2]) { + tmp3 = spca8.f[2]; + spca8.f[2] = spc9c.f[2]; + spc9c.f[2] = tmp3; + } + + spd84[3] = osGetCount(); + + // 3f84 + for (s0 = 0; s0 < sp708; s0++) { + if (spc9c.f[0] <= g_Rooms[spbbc[s0]].bbmax[0] + && spca8.f[0] >= g_Rooms[spbbc[s0]].bbmin[0] + && spc9c.f[2] <= g_Rooms[spbbc[s0]].bbmax[2] + && spca8.f[2] >= g_Rooms[spbbc[s0]].bbmin[2] + && spc9c.f[1] <= g_Rooms[spbbc[s0]].bbmax[1] + && spca8.f[1] >= g_Rooms[spbbc[s0]].bbmin[1] + && var8007f0f8 + && func0f15f20c(&spc90, &spfc, &sp258[s0][0], &sp258[s0][3])) { + s3 = 0; + } + } + + spdb0[3] = spdb0[3] + osGetCount() - spd84[3]; + } + + spdb0[2] = spdb0[2] + osGetCount() - spd84[2]; + + // 40b8 + if (s3) { + spd84[4] = osGetCount(); + + temp_f2_7 = var8007f0e0 * (1.0f + sp214 / (var8007f0f0 / 10.0f)); + + sp198[0].f[0] += -sp218[1] * -temp_f2_7; + sp198[0].f[2] += sp218[0] * -temp_f2_7; + + sp198[1].f[0] += -sp218[1] * temp_f2_7; + sp198[1].f[2] += sp218[0] * temp_f2_7; + + sp198[3].f[0] -= weather->windspeedx * (var8007f0ec / 10.0f) + -sp218[1] * temp_f2_7; + sp198[3].f[1] += weather->unkb8; + sp198[3].f[2] -= weather->windspeedz * (var8007f0ec / 10.0f) + sp218[0] * temp_f2_7; + + sp198[2].f[0] -= weather->windspeedx * (var8007f0ec / 10.0f) + -sp218[1] * -temp_f2_7; + sp198[2].f[1] += weather->unkb8; + sp198[2].f[2] -= weather->windspeedz * (var8007f0ec / 10.0f) + sp218[0] * -temp_f2_7; + + v0_2[0].colour = 0; + v0_2[1].colour = 0; + v0_2[2].colour = 4; + v0_2[3].colour = 4; + + if (spd80 > 0) { + spe4.f[0] = (particledata->unk3e80.f[0] + particledata->particles[p].pos.f[0]) * spc84; + spe4.f[1] = (particledata->unk3e80.f[1] + particledata->particles[p].pos.f[1]) * spc84; + spe4.f[2] = (particledata->unk3e80.f[2] + particledata->particles[p].pos.f[2]) * spc84; + + for (s0 = 0; s0 < s4; s0++) { + if (spe4.f[0] <= g_Rooms[spcb8[s0]].bbmax[0] + && spe4.f[0] >= g_Rooms[spcb8[s0]].bbmin[0] + && spe4.f[2] <= g_Rooms[spcb8[s0]].bbmax[2] + && spe4.f[2] >= g_Rooms[spcb8[s0]].bbmin[2] + && spe4.f[1] <= g_Rooms[spcb8[s0]].bbmax[1] + && spe4.f[1] >= g_Rooms[spcb8[s0]].bbmin[1] + && spe4.f[1] + spc84 * (particledata->particles[p].inc.f[1] * 1) < g_Rooms[spcb8[s0]].bbmin[1]) { + spd4.f[0] = particledata->unk3e80.f[0] + particledata->particles[p].pos.f[0]; + spd4.f[1] = g_Rooms[spcb8[s0]].bbmin[1] / spc84; + spd4.f[2] = particledata->unk3e80.f[2] + particledata->particles[p].pos.f[2]; + + sparksCreate(spcb8[s0], NULL, &spd4, &particledata->particles[p].inc, NULL, SPARKTYPE_SHALLOWWATER); + + spd80--; + } + } + } + + spdb0[4] = spdb0[4] + osGetCount() - spd84[4]; + spd84[5] = osGetCount(); + + v0_2[0].s = 0; + v0_2[0].t = 256; + + v0_2[1].s = 256; + v0_2[1].t = 256; + + v0_2[2].s = 256; + v0_2[2].t = 0; + + v0_2[3].s = 0; + v0_2[3].t = 0; + + spdb0[5] = spdb0[5] + osGetCount() - spd84[5]; + spd84[6] = osGetCount(); + + v0_2[0].x = sp198[0].f[0]; + v0_2[0].y = sp198[0].f[1]; + v0_2[0].z = sp198[0].f[2]; + + v0_2[1].x = sp198[1].f[0]; + v0_2[1].y = sp198[1].f[1]; + v0_2[1].z = sp198[1].f[2]; + + v0_2[2].x = sp198[2].f[0]; + v0_2[2].y = sp198[2].f[1]; + v0_2[2].z = sp198[2].f[2]; + + if (sp194 == 3) { + gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 12); + gDPTri4(gdl++, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); + sp194 = 0; + + } else { + sp194++; + } + + spdb0[6] = spdb0[6] + osGetCount() - spd84[6]; + spdb0[1] = spdb0[1] + osGetCount() - spd84[1]; + } + } + } + } + } + + if (sp194 > 0) { + gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 12); + + if (sp194 == 1) { + gDPTri1(gdl++, 0, 1, 2); + } + + if (sp194 == 2) { + gDPTri2(gdl++, 0, 1, 2, 3, 4, 5); + } + + if (sp194 == 3) { + gDPTri3(gdl++, 0, 1, 2, 3, 4, 5, 6, 7, 8); + } + } + + osGetCount(); + + return gdl; +} +#endif + +#if MATCHING GLOBAL_ASM( glabel weatherRenderSnow .late_rodata @@ -4553,529 +4558,532 @@ u32 var8007f104 = 5; u32 var8007f108 = 10; u32 var8007f10c = 0x8888aaff; u32 var8007f110 = 0xffffff7f; +#else +u32 var8007f100 = 50; -//Gfx *weatherRenderSnow(Gfx *gdl, struct weatherdata *weather, s32 arg2) -//{ -// struct weatherparticledata *particledata; -// struct weatherparticle *particle; -// s32 j; -// s32 k; -// s32 s8; -// f32 tmp; -// u32 sp137c; -// u8 stack[0x3c]; -// u32 sp1354; -// bool a0; -// bool s1; -// s32 sp126c[50]; -// s32 sp1268; -// f32 sp1168[8][4][2]; -// struct coord sp115c; -// struct coord sp1150; -// struct coord sp1144; -// s32 j2; -// s32 sp1078[50]; -// struct coord spe20[50]; -// struct coord spbc8[50]; -// f32 f0_2; -// f32 sp264[50][12]; -// f32 sp260; -// s32 s7; -// u32 *colours; -// f32 *fptr; -// f32 f0; -// s32 numneighbours; -// f32 f20; -// f32 f2; -// f32 f0_3; -// struct coord sp234; -// struct coord sp228; -// f32 f0_4; -// f32 sp220; -// f32 sp21c; -// Mtxf *mtx; -// struct gfxvtx *vertices; // 214 -// struct gfxvtx *v0; -// struct gfxvtx *v0_2; -// Mtxf sp1cc; -// struct coord sp19c[4]; -// s32 sp198; -// s32 stack3[3]; -// f32 f24; -// s32 i; // 184 -// struct coord sp178; -// struct coord sp16c; -// s16 sp144[20]; -// struct coord sp124; -// struct coord sp118; -// f32 f26; -// f32 sp108; -// f32 f16; -// s32 index; -// s32 stack2[2]; -// -// static u32 var8007f104 = 5; -// static u32 var8007f108 = 10; -// static u32 var8007f10c = 0x8888aaff; -// static u32 var8007f110 = 0xffffff7f; -// -// s7 = 0; -// sp1268 = 0; -// -// texSelect(&gdl, &g_TexGeneralConfigs[0], 4, 0, 2, 1, NULL); -// -// gDPSetCycleType(gdl++, G_CYC_1CYCLE); -// gDPSetColorDither(gdl++, G_CD_DISABLE); -// gDPSetRenderMode(gdl++, G_RM_AA_ZB_XLU_SURF, G_RM_NOOP2); -// gDPSetAlphaCompare(gdl++, G_AC_NONE); -// gDPSetTextureLOD(gdl++, G_TL_TILE); -// gDPSetTextureConvert(gdl++, G_TC_FILT); -// gDPSetCombineLERP(gdl++, -// 0, 0, 0, SHADE, TEXEL0, 0, SHADE, 0, -// 0, 0, 0, SHADE, TEXEL0, 0, SHADE, 0); -// -// mainOverrideVariable("snowwidth", &var8007f104); -// mainOverrideVariable("snowheight", &var8007f108); -// mainOverrideVariable("snowcol1", &var8007f10c); -// mainOverrideVariable("snowcol2", &var8007f110); -// -// particledata = weather->particledata[arg2]; -// -// sp198 = 0; -// -// mtx4LoadIdentity(&sp1cc); -// mtx00015be0(camGetWorldToScreenMtxf(), &sp1cc); -// -// sp1cc.m[3][0] = 0.0f; -// sp1cc.m[3][1] = 0.0f; -// sp1cc.m[3][2] = 0.0f; -// -// mtx = gfxAllocateMatrix(); -// -// mtx00016054(&sp1cc, mtx); -// -// gSPMatrix(gdl++, osVirtualToPhysical(mtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); -// -// sp234.f[0] = g_Vars.currentplayer->cam_pos.f[0]; -// sp234.f[1] = g_Vars.currentplayer->cam_pos.f[1]; -// sp234.f[2] = g_Vars.currentplayer->cam_pos.f[2]; -// -// sp228.f[0] = sp234.f[0] - particledata->unk3e80.f[0]; -// sp228.f[1] = sp234.f[1] - particledata->unk3e80.f[1]; -// sp228.f[2] = sp234.f[2] - particledata->unk3e80.f[2]; -// -// if (ABSF(sp228.f[0]) > ABSF(particledata->boundarymin.f[0]) + ABSF(particledata->boundarymax.f[0]) -// || ABSF(sp228.f[1]) > ABSF(particledata->boundarymin.f[1]) + ABSF(particledata->boundarymax.f[1]) -// || ABSF(sp228.f[2]) > ABSF(particledata->boundarymin.f[2]) + ABSF(particledata->boundarymax.f[2])) { -// sp228.f[0] = particledata->boundaryrange.f[0] * 0.5f; -// sp228.f[1] = particledata->boundaryrange.f[1] * 0.5f; -// sp228.f[2] = particledata->boundaryrange.f[2] * 0.5f; -// } -// -// // 4ac8 -// for (s8 = 0; s8 < 500; s8++) { -// particle = &particledata->particles[s8]; -// -// // x -// f0 = particle->pos.f[0] - particledata->boundarymin.f[0] - sp228.f[0]; -// -// if (f0 < 0) { -// f0 += particledata->boundaryrange.f[0]; -// } -// -// if (f0 > particledata->boundaryrange.f[0]) { -// f0 -= particledata->boundaryrange.f[0]; -// } -// -// particle->pos.f[0] = particledata->boundarymin.f[0] + f0; -// -// // y -// f0 = particle->pos.f[1] - particledata->boundarymin.f[1] - sp228.f[1]; -// -// if (f0 < 0) { -// f0 += particledata->boundaryrange.f[1]; -// } -// -// if (f0 > particledata->boundaryrange.f[1]) { -// f0 -= particledata->boundaryrange.f[1]; -// } -// -// particle->pos.f[1] = particledata->boundarymin.f[1] + f0; -// -// // z -// f0 = particle->pos.f[2] - particledata->boundarymin.f[2] - sp228.f[2]; -// -// if (f0 < 0) { -// f0 += particledata->boundaryrange.f[2]; -// } -// -// if (f0 > particledata->boundaryrange.f[2]) { -// f0 -= particledata->boundaryrange.f[2]; -// } -// -// particle->pos.f[2] = particledata->boundarymin.f[2] + f0; -// } -// -// // 4bbc -// particledata->unk3e80.f[0] = sp234.f[0]; -// particledata->unk3e80.f[1] = sp234.f[1]; -// particledata->unk3e80.f[2] = sp234.f[2]; -// -// sp16c.f[0] = particledata->boundarymin.f[0] + g_Vars.currentplayer->cam_pos.f[0]; -// sp178.f[0] = particledata->boundarymax.f[0] + g_Vars.currentplayer->cam_pos.f[0]; -// sp16c.f[1] = particledata->boundarymin.f[1] + g_Vars.currentplayer->cam_pos.f[1]; -// sp178.f[1] = particledata->boundarymax.f[1] + g_Vars.currentplayer->cam_pos.f[1]; -// sp16c.f[2] = particledata->boundarymin.f[2] + g_Vars.currentplayer->cam_pos.f[2]; -// sp178.f[2] = particledata->boundarymax.f[2] + g_Vars.currentplayer->cam_pos.f[2]; -// -// if (sp1268 < 50) { -// sp126c[sp1268] = g_Vars.currentplayer->cam_room; -// sp1268++; -// } -// -// // 4c54 -// for (i = 0; i < sp1268; i++) { -// numneighbours = roomGetNeighbours(sp126c[i], sp144, ARRAYCOUNT(sp144)); -// -// for (j2 = 0; j2 < numneighbours; j2++) { -// a0 = true; -// -// if (g_Rooms[sp144[j2]].flags & ROOMFLAG_ONSCREEN) { -// for (k = 0; k < sp1268; k++) { -// if (sp126c[k] == sp144[j2]) { -// a0 = false; -// } -// } -// -// if (a0) { -// if (sp178.f[0] < g_Rooms[sp144[j2]].bbmin[0] || g_Rooms[sp144[j2]].bbmax[0] < sp16c.f[0]) { -// a0 = false; -// } -// -// if (sp178.f[1] < g_Rooms[sp144[j2]].bbmin[1] || g_Rooms[sp144[j2]].bbmax[1] < sp16c.f[1]) { -// a0 = false; -// } -// -// if (sp178.f[2] < g_Rooms[sp144[j2]].bbmin[2] || g_Rooms[sp144[j2]].bbmax[2] < sp16c.f[2]) { -// a0 = false; -// } -// } -// -// if (a0 && sp1268 < 50) { -// sp126c[sp1268] = sp144[j2]; -// sp1268++; -// } -// } -// } -// } -// -// // 4dc0 -// for (i = 0; i < sp1268; i++) { -// if (weatherIsRoomWeatherProof(sp126c[i])) { -// spe20[s7].f[0] = g_Rooms[sp126c[i]].bbmin[0] / 1; -// spe20[s7].f[1] = g_Rooms[sp126c[i]].bbmin[1] / 1; -// spe20[s7].f[2] = g_Rooms[sp126c[i]].bbmin[2] / 1; -// -// spbc8[s7].f[0] = g_Rooms[sp126c[i]].bbmax[0] / 1; -// spbc8[s7].f[1] = g_Rooms[sp126c[i]].bbmax[1] / 1; -// spbc8[s7].f[2] = g_Rooms[sp126c[i]].bbmax[2] / 1; -// -// if (s7 < 50) { -// sp1078[s7] = sp126c[i]; -// s7++; -// } -// } -// -// if (1); -// } -// -// // 4ea4 -// for (j = 0; j < s7; j++) { -// if (var8007f100); -// -// sp264[j][6] = sp264[j][0] = g_Rooms[sp1078[j]].bbmin[0] / 1 - var8007f104; -// sp264[j][9] = sp264[j][3] = g_Rooms[sp1078[j]].bbmax[0] / 1 + var8007f104; -// sp264[j][6] -= var8007f100; -// sp264[j][9] += var8007f100; -// -// sp264[j][7] = sp264[j][1] = g_Rooms[sp1078[j]].bbmin[1] / 1 - var8007f104; -// sp264[j][10] = sp264[j][4] = g_Rooms[sp1078[j]].bbmax[1] / 1 + var8007f104; -// sp264[j][7] -= var8007f100; -// sp264[j][10] += var8007f100; -// -// sp264[j][8] = sp264[j][2] = g_Rooms[sp1078[j]].bbmin[2] / 1 - var8007f104; -// sp264[j][11] = sp264[j][5] = g_Rooms[sp1078[j]].bbmax[2] / 1 + var8007f104; -// sp264[j][8] -= var8007f100; -// sp264[j][11] += var8007f100; -// } -// -// // 4ff0 -// for (j = 0; j < 8; j++) { -// sp1168[j][0][0] = sinf(particledata->unk3ec8[j]); -// sp1168[j][0][1] = cosf(particledata->unk3ec8[j]); -// sp1168[j][1][0] = sinf(particledata->unk3ec8[j] + 1.5707963705063f); -// sp1168[j][1][1] = cosf(particledata->unk3ec8[j] + 1.5707963705063f); -// sp1168[j][2][0] = sinf(particledata->unk3ec8[j] + M_PI); -// sp1168[j][2][1] = cosf(particledata->unk3ec8[j] + M_PI); -// sp1168[j][3][0] = sinf(particledata->unk3ec8[j] + 4.7123889923096f); -// sp1168[j][3][1] = cosf(particledata->unk3ec8[j] + 4.7123889923096f); -// } -// -// // 514c -// colours = gfxAllocateColours(16); -// -// for (j = 0; j < 16; j++) { -// colours[j] = (var8007f10c & 0xffffff00) | ((0x10ef - j * 0xff) / 0x11); -// } -// -// gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 16); -// -// // 51f8 -// for (s8 = 0; s8 < 500; s8++) { -// s1 = true; -// -// if (particledata->particles[s8].active & 3) { -// sp1354 = osGetCount(); -// -// sp124.f[0] = particledata->unk3e80.f[0] + particledata->particles[s8].pos.f[0]; -// sp124.f[1] = particledata->unk3e80.f[1] + particledata->particles[s8].pos.f[1]; -// sp124.f[2] = particledata->unk3e80.f[2] + particledata->particles[s8].pos.f[2]; -// -// if (cam0f0b5b9c(&sp124, 5)) { -// sp137c = sp137c + osGetCount() - sp1354; -// -// sp21c = particledata->particles[s8].pos.f[0]; -// sp220 = particledata->particles[s8].pos.f[2]; -// -// f20 = sqrtf(sp220 * sp220 + sp21c * sp21c); -// -// if (f20 < 0.00001f) { -// // empty -// } else { -// sp260 = 0.0f; -// -// if (sp198 == 0) { -// vertices = gfxAllocateVertices(8); -// } -// -// sp21c /= f20; -// sp220 /= f20; -// -// v0_2 = &vertices[sp198 * 4]; -// -// for (j = 0; j < 4; j++) { -// v0_2[j].unk08 = 0; -// v0_2[j].unk0a = 0; -// -// sp19c[j].f[0] = particledata->particles[s8].pos.f[0]; -// sp19c[j].f[1] = particledata->particles[s8].pos.f[1]; -// sp19c[j].f[2] = particledata->particles[s8].pos.f[2]; -// } -// -// // 5344 -// if (s7 > 0) { -// sp118.f[0] = particledata->particles[s8].pos.f[0] + particledata->unk3e80.f[0]; -// sp118.f[1] = particledata->particles[s8].pos.f[1] + particledata->unk3e80.f[1]; -// sp118.f[2] = particledata->particles[s8].pos.f[2] + particledata->unk3e80.f[2]; -// -// for (j = 0; j < s7; j++) { -// // 5398 -// if (var8007f100); -// -// if (s1 -// && sp264[j][6] < sp118.f[0] -// && sp264[j][9] > sp118.f[0] -// && sp264[j][7] < sp118.f[1] -// && sp264[j][10] > sp118.f[1] -// && sp264[j][8] < sp118.f[2] -// && sp264[j][11] > sp118.f[2]) { -// if (sp264[j][0] < sp118.f[0] -// && sp264[j][3] > sp118.f[0] -// && sp264[j][1] < sp118.f[1] -// && sp264[j][4] > sp118.f[1] -// && sp264[j][2] < sp118.f[2] -// && sp264[j][5] > sp118.f[2]) { -// s1 = false; -// } else { -// // 54a8 -// f2 = 0.0f; -// -// // 54d8 -// if (sp264[j][0] > sp118.f[0]) { -// f2 = sp118.f[0] - sp264[j][6]; -// } -// -// // 54ec -// if (sp264[j][3] < sp118.f[0]) { -// f2 = sp118.f[0] - sp264[j][9]; -// } -// -// // 5500 -// tmp = ABSF(f2) / var8007f100; -// f2 = tmp; -// -// // 5524 -// if (tmp > sp260) { -// sp260 = tmp; -// } -// -// if (sp264[j][2] > sp118.f[2]) { -// f2 = sp118.f[2] - sp264[j][8]; -// } -// -// if (sp264[j][5] < sp118.f[2]) { -// f2 = sp118.f[2] - sp264[j][11]; -// } -// -// f2 = ABSF(f2) / var8007f100; -// -// if (f2 > sp260) { -// sp260 = f2; -// } -// } -// } -// } -// } -// -// // 559c -// if (s1) { -// f0_3 = sqrtf(particledata->particles[s8].pos.f[0] * particledata->particles[s8].pos.f[0] -// + particledata->particles[s8].pos.f[1] * particledata->particles[s8].pos.f[1] -// + particledata->particles[s8].pos.f[2] * particledata->particles[s8].pos.f[2]); -// -// f24 = particledata->particles[s8].pos.f[0] / f0_3; -// sp108 = particledata->particles[s8].pos.f[1] / f0_3; -// f26 = particledata->particles[s8].pos.f[2] / f0_3; -// -// // 55fc -// f0_4 = sqrtf(f24 * f24 + f26 * f26); -// -// sp1144.f[2] = sp108 * (f24 / f0_4); -// sp1144.f[1] = -f0_3; -// sp1144.f[0] = sp108 * (f26 / f0_4); -// -// sp1144.f[6] = -sp220; -// sp1144.f[7] = 1.0f; -// sp1144.f[8] = sp21c; -// -// // 5720 -// index = (s8 >> 2) & 7; -// -// for (j = 0; j < 4; j++) { -// sp19c[j].f[0] += (var8007f104 * (f26 / f0_4)) * sp1168[index][j][0] + (var8007f104 * sp1144.f[2]) * sp1168[index][j][1]; -// sp19c[j].f[1] += 0.0f + (var8007f104 * sp1144.f[1]) * sp1168[index][j][1]; -// sp19c[j].f[2] += (var8007f104 * -(f24 / f0_4)) * sp1168[index][j][0] + (var8007f104 * sp1144.f[0]) * sp1168[index][j][1]; -// } -// -// // 5784 -// // x -// f16 = 0.0f; -// -// if (particledata->particles[s8].pos.f[0] < particledata->boundarymin.f[0] + 150.0f) { -// f16 = particledata->particles[s8].pos.f[0] - particledata->boundarymin.f[0] - 150.0f; -// } -// -// if (particledata->particles[s8].pos.f[0] > particledata->boundarymax.f[0] - 150.0f) { -// f16 = particledata->particles[s8].pos.f[0] - particledata->boundarymax.f[0] + 150.0f; -// } -// -// f16 = ABSF(f16) / 150.0f; -// -// if (f16 > sp260) { -// sp260 = f16; -// } -// -// // 5870 -// // y -// f16 = 0.0f; -// -// if (particledata->particles[s8].pos.f[1] < particledata->boundarymin.f[1] + 150.0f) { -// f16 = particledata->particles[s8].pos.f[1] - particledata->boundarymin.f[1] - 150.0f; -// } -// -// if (particledata->particles[s8].pos.f[1] > particledata->boundarymax.f[1] - 150.0f) { -// f16 = particledata->particles[s8].pos.f[1] - particledata->boundarymax.f[1] + 150.0f; -// } -// -// f16 = ABSF(f16) / 150.0f; -// -// if (f16 > sp260) { -// sp260 = f16; -// } -// -// // 58f8 -// // z -// f16 = 0.0f; -// -// if (particledata->particles[s8].pos.f[2] < particledata->boundarymin.f[2] + 150.0f) { -// f16 = particledata->particles[s8].pos.f[2] - particledata->boundarymin.f[2] - 150.0f; -// } -// -// if (particledata->particles[s8].pos.f[2] > particledata->boundarymax.f[2] - 150.0f) { -// f16 = particledata->particles[s8].pos.f[2] - particledata->boundarymax.f[2] + 150.0f; -// } -// -// f16 = ABSF(f16) / 150.0f; -// -// if (f16 > sp260) { -// sp260 = f16; -// } -// -// // 5978 -// v0 = &vertices[sp198 * 4]; -// -// v0[0].colour = (s32)(sp260 * 16.0f) * 4; -// v0[1].colour = (s32)(sp260 * 16.0f) * 4; -// v0[2].colour = (s32)(sp260 * 16.0f) * 4; -// v0[3].colour = (s32)(sp260 * 16.0f) * 4; -// -// v0[0].unk08 = ((s32)(s8 & 1) * 8) * 32; -// v0[1].unk08 = ((s32)(s8 & 1) * 8 + 8) * 32; -// v0[2].unk08 = ((s32)(s8 & 1) * 8 + 8) * 32; -// v0[3].unk08 = ((s32)(s8 & 1) * 8) * 32; -// -// v0[0].unk0a = (((s8 & 2) >> 1) * 8 + 8) * 32; -// v0[1].unk0a = (((s8 & 2) >> 1) * 8 + 8) * 32; -// v0[2].unk0a = (((s8 & 2) >> 1) * 8) * 32; -// v0[3].unk0a = (((s8 & 2) >> 1) * 8) * 32; -// -// v0[0].x = sp19c[0].f[0]; -// v0[0].y = sp19c[0].f[1]; -// v0[0].z = sp19c[0].f[2]; -// -// v0[1].x = sp19c[1].f[0]; -// v0[1].y = sp19c[1].f[1]; -// v0[1].z = sp19c[1].f[2]; -// -// v0[2].x = sp19c[2].f[0]; -// v0[2].y = sp19c[2].f[1]; -// v0[2].z = sp19c[2].f[2]; -// -// v0[3].x = sp19c[3].f[0]; -// v0[3].y = sp19c[3].f[1]; -// v0[3].z = sp19c[3].f[2]; -// -// if (sp198 == 1) { -// sp198 = 0; -// -// gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 8); -// gDPTri4(gdl++, 0, 1, 2, 2, 3, 0, 4, 5, 6, 6, 7, 4); -// } else { -// sp198 = 1; -// } -// } -// } -// } -// } -// } -// -// if (sp198 > 0) { -// gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 8); -// gDPTri2(gdl++, 0, 1, 2, 2, 3, 0); -// } -// -// return gdl; -//} +Gfx *weatherRenderSnow(Gfx *gdl, struct weatherdata *weather, s32 arg2) +{ + struct weatherparticledata *particledata; + struct weatherparticle *particle; + s32 j; + s32 k; + s32 s8; + f32 tmp; + u32 sp137c; + u8 stack[0x3c]; + u32 sp1354; + bool a0; + bool s1; + s32 sp126c[50]; + s32 sp1268; + f32 sp1168[8][4][2]; + struct coord sp115c; + struct coord sp1150; + struct coord sp1144; + s32 j2; + s32 sp1078[50]; + struct coord spe20[50]; + struct coord spbc8[50]; + f32 f0_2; + f32 sp264[50][12]; + f32 sp260; + s32 s7; + u32 *colours; + f32 *fptr; + f32 f0; + s32 numneighbours; + f32 f20; + f32 f2; + f32 f0_3; + struct coord sp234; + struct coord sp228; + f32 f0_4; + f32 sp220; + f32 sp21c; + Mtxf *mtx; + struct gfxvtx *vertices; // 214 + struct gfxvtx *v0; + struct gfxvtx *v0_2; + Mtxf sp1cc; + struct coord sp19c[4]; + s32 sp198; + s32 stack3[3]; + f32 f24; + s32 i; // 184 + struct coord sp178; + struct coord sp16c; + s16 sp144[20]; + struct coord sp124; + struct coord sp118; + f32 f26; + f32 sp108; + f32 f16; + s32 index; + s32 stack2[2]; + + static u32 var8007f104 = 5; + static u32 var8007f108 = 10; + static u32 var8007f10c = 0x8888aaff; + static u32 var8007f110 = 0xffffff7f; + + s7 = 0; + sp1268 = 0; + + texSelect(&gdl, &g_TexGeneralConfigs[0], 4, 0, 2, 1, NULL); + + gDPSetCycleType(gdl++, G_CYC_1CYCLE); + gDPSetColorDither(gdl++, G_CD_DISABLE); + gDPSetRenderMode(gdl++, G_RM_AA_ZB_XLU_SURF, G_RM_NOOP2); + gDPSetAlphaCompare(gdl++, G_AC_NONE); + gDPSetTextureLOD(gdl++, G_TL_TILE); + gDPSetTextureConvert(gdl++, G_TC_FILT); + gDPSetCombineLERP(gdl++, + 0, 0, 0, SHADE, TEXEL0, 0, SHADE, 0, + 0, 0, 0, SHADE, TEXEL0, 0, SHADE, 0); + + mainOverrideVariable("snowwidth", &var8007f104); + mainOverrideVariable("snowheight", &var8007f108); + mainOverrideVariable("snowcol1", &var8007f10c); + mainOverrideVariable("snowcol2", &var8007f110); + + particledata = weather->particledata[arg2]; + + sp198 = 0; + + mtx4LoadIdentity(&sp1cc); + mtx00015be0(camGetWorldToScreenMtxf(), &sp1cc); + + sp1cc.m[3][0] = 0.0f; + sp1cc.m[3][1] = 0.0f; + sp1cc.m[3][2] = 0.0f; + + mtx = gfxAllocateMatrix(); + + mtx00016054(&sp1cc, mtx); + + gSPMatrix(gdl++, osVirtualToPhysical(mtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + sp234.f[0] = g_Vars.currentplayer->cam_pos.f[0]; + sp234.f[1] = g_Vars.currentplayer->cam_pos.f[1]; + sp234.f[2] = g_Vars.currentplayer->cam_pos.f[2]; + + sp228.f[0] = sp234.f[0] - particledata->unk3e80.f[0]; + sp228.f[1] = sp234.f[1] - particledata->unk3e80.f[1]; + sp228.f[2] = sp234.f[2] - particledata->unk3e80.f[2]; + + if (ABSF(sp228.f[0]) > ABSF(particledata->boundarymin.f[0]) + ABSF(particledata->boundarymax.f[0]) + || ABSF(sp228.f[1]) > ABSF(particledata->boundarymin.f[1]) + ABSF(particledata->boundarymax.f[1]) + || ABSF(sp228.f[2]) > ABSF(particledata->boundarymin.f[2]) + ABSF(particledata->boundarymax.f[2])) { + sp228.f[0] = particledata->boundaryrange.f[0] * 0.5f; + sp228.f[1] = particledata->boundaryrange.f[1] * 0.5f; + sp228.f[2] = particledata->boundaryrange.f[2] * 0.5f; + } + + // 4ac8 + for (s8 = 0; s8 < 500; s8++) { + particle = &particledata->particles[s8]; + + // x + f0 = particle->pos.f[0] - particledata->boundarymin.f[0] - sp228.f[0]; + + if (f0 < 0) { + f0 += particledata->boundaryrange.f[0]; + } + + if (f0 > particledata->boundaryrange.f[0]) { + f0 -= particledata->boundaryrange.f[0]; + } + + particle->pos.f[0] = particledata->boundarymin.f[0] + f0; + + // y + f0 = particle->pos.f[1] - particledata->boundarymin.f[1] - sp228.f[1]; + + if (f0 < 0) { + f0 += particledata->boundaryrange.f[1]; + } + + if (f0 > particledata->boundaryrange.f[1]) { + f0 -= particledata->boundaryrange.f[1]; + } + + particle->pos.f[1] = particledata->boundarymin.f[1] + f0; + + // z + f0 = particle->pos.f[2] - particledata->boundarymin.f[2] - sp228.f[2]; + + if (f0 < 0) { + f0 += particledata->boundaryrange.f[2]; + } + + if (f0 > particledata->boundaryrange.f[2]) { + f0 -= particledata->boundaryrange.f[2]; + } + + particle->pos.f[2] = particledata->boundarymin.f[2] + f0; + } + + // 4bbc + particledata->unk3e80.f[0] = sp234.f[0]; + particledata->unk3e80.f[1] = sp234.f[1]; + particledata->unk3e80.f[2] = sp234.f[2]; + + sp16c.f[0] = particledata->boundarymin.f[0] + g_Vars.currentplayer->cam_pos.f[0]; + sp178.f[0] = particledata->boundarymax.f[0] + g_Vars.currentplayer->cam_pos.f[0]; + sp16c.f[1] = particledata->boundarymin.f[1] + g_Vars.currentplayer->cam_pos.f[1]; + sp178.f[1] = particledata->boundarymax.f[1] + g_Vars.currentplayer->cam_pos.f[1]; + sp16c.f[2] = particledata->boundarymin.f[2] + g_Vars.currentplayer->cam_pos.f[2]; + sp178.f[2] = particledata->boundarymax.f[2] + g_Vars.currentplayer->cam_pos.f[2]; + + if (sp1268 < 50) { + sp126c[sp1268] = g_Vars.currentplayer->cam_room; + sp1268++; + } + + // 4c54 + for (i = 0; i < sp1268; i++) { + numneighbours = roomGetNeighbours(sp126c[i], sp144, ARRAYCOUNT(sp144)); + + for (j2 = 0; j2 < numneighbours; j2++) { + a0 = true; + + if (g_Rooms[sp144[j2]].flags & ROOMFLAG_ONSCREEN) { + for (k = 0; k < sp1268; k++) { + if (sp126c[k] == sp144[j2]) { + a0 = false; + } + } + + if (a0) { + if (sp178.f[0] < g_Rooms[sp144[j2]].bbmin[0] || g_Rooms[sp144[j2]].bbmax[0] < sp16c.f[0]) { + a0 = false; + } + + if (sp178.f[1] < g_Rooms[sp144[j2]].bbmin[1] || g_Rooms[sp144[j2]].bbmax[1] < sp16c.f[1]) { + a0 = false; + } + + if (sp178.f[2] < g_Rooms[sp144[j2]].bbmin[2] || g_Rooms[sp144[j2]].bbmax[2] < sp16c.f[2]) { + a0 = false; + } + } + + if (a0 && sp1268 < 50) { + sp126c[sp1268] = sp144[j2]; + sp1268++; + } + } + } + } + + // 4dc0 + for (i = 0; i < sp1268; i++) { + if (weatherIsRoomWeatherProof(sp126c[i])) { + spe20[s7].f[0] = g_Rooms[sp126c[i]].bbmin[0] / 1; + spe20[s7].f[1] = g_Rooms[sp126c[i]].bbmin[1] / 1; + spe20[s7].f[2] = g_Rooms[sp126c[i]].bbmin[2] / 1; + + spbc8[s7].f[0] = g_Rooms[sp126c[i]].bbmax[0] / 1; + spbc8[s7].f[1] = g_Rooms[sp126c[i]].bbmax[1] / 1; + spbc8[s7].f[2] = g_Rooms[sp126c[i]].bbmax[2] / 1; + + if (s7 < 50) { + sp1078[s7] = sp126c[i]; + s7++; + } + } + + if (1); + } + + // 4ea4 + for (j = 0; j < s7; j++) { + if (var8007f100); + + sp264[j][6] = sp264[j][0] = g_Rooms[sp1078[j]].bbmin[0] / 1 - var8007f104; + sp264[j][9] = sp264[j][3] = g_Rooms[sp1078[j]].bbmax[0] / 1 + var8007f104; + sp264[j][6] -= var8007f100; + sp264[j][9] += var8007f100; + + sp264[j][7] = sp264[j][1] = g_Rooms[sp1078[j]].bbmin[1] / 1 - var8007f104; + sp264[j][10] = sp264[j][4] = g_Rooms[sp1078[j]].bbmax[1] / 1 + var8007f104; + sp264[j][7] -= var8007f100; + sp264[j][10] += var8007f100; + + sp264[j][8] = sp264[j][2] = g_Rooms[sp1078[j]].bbmin[2] / 1 - var8007f104; + sp264[j][11] = sp264[j][5] = g_Rooms[sp1078[j]].bbmax[2] / 1 + var8007f104; + sp264[j][8] -= var8007f100; + sp264[j][11] += var8007f100; + } + + // 4ff0 + for (j = 0; j < 8; j++) { + sp1168[j][0][0] = sinf(particledata->unk3ec8[j]); + sp1168[j][0][1] = cosf(particledata->unk3ec8[j]); + sp1168[j][1][0] = sinf(particledata->unk3ec8[j] + 1.5707963705063f); + sp1168[j][1][1] = cosf(particledata->unk3ec8[j] + 1.5707963705063f); + sp1168[j][2][0] = sinf(particledata->unk3ec8[j] + M_PI); + sp1168[j][2][1] = cosf(particledata->unk3ec8[j] + M_PI); + sp1168[j][3][0] = sinf(particledata->unk3ec8[j] + 4.7123889923096f); + sp1168[j][3][1] = cosf(particledata->unk3ec8[j] + 4.7123889923096f); + } + + // 514c + colours = gfxAllocateColours(16); + + for (j = 0; j < 16; j++) { + colours[j] = (var8007f10c & 0xffffff00) | ((0x10ef - j * 0xff) / 0x11); + } + + gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 16); + + // 51f8 + for (s8 = 0; s8 < 500; s8++) { + s1 = true; + + if (particledata->particles[s8].active & 3) { + sp1354 = osGetCount(); + + sp124.f[0] = particledata->unk3e80.f[0] + particledata->particles[s8].pos.f[0]; + sp124.f[1] = particledata->unk3e80.f[1] + particledata->particles[s8].pos.f[1]; + sp124.f[2] = particledata->unk3e80.f[2] + particledata->particles[s8].pos.f[2]; + + if (cam0f0b5b9c(&sp124, 5)) { + sp137c = sp137c + osGetCount() - sp1354; + + sp21c = particledata->particles[s8].pos.f[0]; + sp220 = particledata->particles[s8].pos.f[2]; + + f20 = sqrtf(sp220 * sp220 + sp21c * sp21c); + + if (f20 < 0.00001f) { + // empty + } else { + sp260 = 0.0f; + + if (sp198 == 0) { + vertices = gfxAllocateVertices(8); + } + + sp21c /= f20; + sp220 /= f20; + + v0_2 = &vertices[sp198 * 4]; + + for (j = 0; j < 4; j++) { + v0_2[j].s = 0; + v0_2[j].t = 0; + + sp19c[j].f[0] = particledata->particles[s8].pos.f[0]; + sp19c[j].f[1] = particledata->particles[s8].pos.f[1]; + sp19c[j].f[2] = particledata->particles[s8].pos.f[2]; + } + + // 5344 + if (s7 > 0) { + sp118.f[0] = particledata->particles[s8].pos.f[0] + particledata->unk3e80.f[0]; + sp118.f[1] = particledata->particles[s8].pos.f[1] + particledata->unk3e80.f[1]; + sp118.f[2] = particledata->particles[s8].pos.f[2] + particledata->unk3e80.f[2]; + + for (j = 0; j < s7; j++) { + // 5398 + if (var8007f100); + + if (s1 + && sp264[j][6] < sp118.f[0] + && sp264[j][9] > sp118.f[0] + && sp264[j][7] < sp118.f[1] + && sp264[j][10] > sp118.f[1] + && sp264[j][8] < sp118.f[2] + && sp264[j][11] > sp118.f[2]) { + if (sp264[j][0] < sp118.f[0] + && sp264[j][3] > sp118.f[0] + && sp264[j][1] < sp118.f[1] + && sp264[j][4] > sp118.f[1] + && sp264[j][2] < sp118.f[2] + && sp264[j][5] > sp118.f[2]) { + s1 = false; + } else { + // 54a8 + f2 = 0.0f; + + // 54d8 + if (sp264[j][0] > sp118.f[0]) { + f2 = sp118.f[0] - sp264[j][6]; + } + + // 54ec + if (sp264[j][3] < sp118.f[0]) { + f2 = sp118.f[0] - sp264[j][9]; + } + + // 5500 + tmp = ABSF(f2) / var8007f100; + f2 = tmp; + + // 5524 + if (tmp > sp260) { + sp260 = tmp; + } + + if (sp264[j][2] > sp118.f[2]) { + f2 = sp118.f[2] - sp264[j][8]; + } + + if (sp264[j][5] < sp118.f[2]) { + f2 = sp118.f[2] - sp264[j][11]; + } + + f2 = ABSF(f2) / var8007f100; + + if (f2 > sp260) { + sp260 = f2; + } + } + } + } + } + + // 559c + if (s1) { + f0_3 = sqrtf(particledata->particles[s8].pos.f[0] * particledata->particles[s8].pos.f[0] + + particledata->particles[s8].pos.f[1] * particledata->particles[s8].pos.f[1] + + particledata->particles[s8].pos.f[2] * particledata->particles[s8].pos.f[2]); + + f24 = particledata->particles[s8].pos.f[0] / f0_3; + sp108 = particledata->particles[s8].pos.f[1] / f0_3; + f26 = particledata->particles[s8].pos.f[2] / f0_3; + + // 55fc + f0_4 = sqrtf(f24 * f24 + f26 * f26); + + sp1144.f[2] = sp108 * (f24 / f0_4); + sp1144.f[1] = -f0_3; + sp1144.f[0] = sp108 * (f26 / f0_4); + + sp1144.f[6] = -sp220; + sp1144.f[7] = 1.0f; + sp1144.f[8] = sp21c; + + // 5720 + index = (s8 >> 2) & 7; + + for (j = 0; j < 4; j++) { + sp19c[j].f[0] += (var8007f104 * (f26 / f0_4)) * sp1168[index][j][0] + (var8007f104 * sp1144.f[2]) * sp1168[index][j][1]; + sp19c[j].f[1] += 0.0f + (var8007f104 * sp1144.f[1]) * sp1168[index][j][1]; + sp19c[j].f[2] += (var8007f104 * -(f24 / f0_4)) * sp1168[index][j][0] + (var8007f104 * sp1144.f[0]) * sp1168[index][j][1]; + } + + // 5784 + // x + f16 = 0.0f; + + if (particledata->particles[s8].pos.f[0] < particledata->boundarymin.f[0] + 150.0f) { + f16 = particledata->particles[s8].pos.f[0] - particledata->boundarymin.f[0] - 150.0f; + } + + if (particledata->particles[s8].pos.f[0] > particledata->boundarymax.f[0] - 150.0f) { + f16 = particledata->particles[s8].pos.f[0] - particledata->boundarymax.f[0] + 150.0f; + } + + f16 = ABSF(f16) / 150.0f; + + if (f16 > sp260) { + sp260 = f16; + } + + // 5870 + // y + f16 = 0.0f; + + if (particledata->particles[s8].pos.f[1] < particledata->boundarymin.f[1] + 150.0f) { + f16 = particledata->particles[s8].pos.f[1] - particledata->boundarymin.f[1] - 150.0f; + } + + if (particledata->particles[s8].pos.f[1] > particledata->boundarymax.f[1] - 150.0f) { + f16 = particledata->particles[s8].pos.f[1] - particledata->boundarymax.f[1] + 150.0f; + } + + f16 = ABSF(f16) / 150.0f; + + if (f16 > sp260) { + sp260 = f16; + } + + // 58f8 + // z + f16 = 0.0f; + + if (particledata->particles[s8].pos.f[2] < particledata->boundarymin.f[2] + 150.0f) { + f16 = particledata->particles[s8].pos.f[2] - particledata->boundarymin.f[2] - 150.0f; + } + + if (particledata->particles[s8].pos.f[2] > particledata->boundarymax.f[2] - 150.0f) { + f16 = particledata->particles[s8].pos.f[2] - particledata->boundarymax.f[2] + 150.0f; + } + + f16 = ABSF(f16) / 150.0f; + + if (f16 > sp260) { + sp260 = f16; + } + + // 5978 + v0 = &vertices[sp198 * 4]; + + v0[0].colour = (s32)(sp260 * 16.0f) * 4; + v0[1].colour = (s32)(sp260 * 16.0f) * 4; + v0[2].colour = (s32)(sp260 * 16.0f) * 4; + v0[3].colour = (s32)(sp260 * 16.0f) * 4; + + v0[0].s = ((s32)(s8 & 1) * 8) * 32; + v0[1].s = ((s32)(s8 & 1) * 8 + 8) * 32; + v0[2].s = ((s32)(s8 & 1) * 8 + 8) * 32; + v0[3].s = ((s32)(s8 & 1) * 8) * 32; + + v0[0].t = (((s8 & 2) >> 1) * 8 + 8) * 32; + v0[1].t = (((s8 & 2) >> 1) * 8 + 8) * 32; + v0[2].t = (((s8 & 2) >> 1) * 8) * 32; + v0[3].t = (((s8 & 2) >> 1) * 8) * 32; + + v0[0].x = sp19c[0].f[0]; + v0[0].y = sp19c[0].f[1]; + v0[0].z = sp19c[0].f[2]; + + v0[1].x = sp19c[1].f[0]; + v0[1].y = sp19c[1].f[1]; + v0[1].z = sp19c[1].f[2]; + + v0[2].x = sp19c[2].f[0]; + v0[2].y = sp19c[2].f[1]; + v0[2].z = sp19c[2].f[2]; + + v0[3].x = sp19c[3].f[0]; + v0[3].y = sp19c[3].f[1]; + v0[3].z = sp19c[3].f[2]; + + if (sp198 == 1) { + sp198 = 0; + + gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 8); + gDPTri4(gdl++, 0, 1, 2, 2, 3, 0, 4, 5, 6, 6, 7, 4); + } else { + sp198 = 1; + } + } + } + } + } + } + + if (sp198 > 0) { + gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 8); + gDPTri2(gdl++, 0, 1, 2, 2, 3, 0); + } + + return gdl; +} +#endif void weatherStop(void) { diff --git a/src/include/bss.h b/src/include/bss.h index c1b65926f..641fecc0b 100644 --- a/src/include/bss.h +++ b/src/include/bss.h @@ -35,7 +35,7 @@ extern u32 var80095200; extern OSMesgQueue g_PiMesgQueue; extern struct g_vars g_Vars; extern u8 **var8009a874; -extern s32 *var8009a888; +extern u8 **var8009a888; extern union filedataptr g_TileFileData; extern s32 g_TileNumRooms; extern u32 *g_TileRooms; diff --git a/src/include/game/body.h b/src/include/game/body.h index d50162532..120598cbd 100644 --- a/src/include/game/body.h +++ b/src/include/game/body.h @@ -6,7 +6,7 @@ void bodiesInit(void); -void bodiesReset(void); +void bodiesReset(s32 stagenum); u32 bodyGetRace(s32 bodynum); bool bodyLoad(s32 bodynum); diff --git a/src/include/types.h b/src/include/types.h index 0a750effb..039e92953 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -5960,7 +5960,7 @@ struct sndcache { struct rdptask { OSScTask sctask; - u8 *framebuffer; + u16 *framebuffer; u32 unk5c; }; diff --git a/src/lib/anim.c b/src/lib/anim.c index 594629b7f..fdf0166f0 100644 --- a/src/lib/anim.c +++ b/src/lib/anim.c @@ -19,7 +19,7 @@ s16 *var8009a878; s16 *var8009a87c; u8 *var8009a880; u8 *var8009a884; -s32 *var8009a888; +u8 **var8009a888; s16 *var8009a88c; s32 *var8009a890; s16 var8009a894; @@ -290,6 +290,7 @@ void anim00023d0c(void) } } +#if MATCHING GLOBAL_ASM( glabel anim00023d38 /* 23d38: 3c0b8006 */ lui $t3,%hi(var8005f010) @@ -436,44 +437,46 @@ glabel anim00023d38 /* 23f48: 03e00008 */ jr $ra /* 23f4c: 00000000 */ nop ); - +#else // Mismatch: for loop is handled differently -//void anim00023d38(s16 animnum) -//{ -// s32 i; -// -// if (var8005f010[animnum] != 0xff) { -// var8009a890[var8005f010[animnum]] = g_Vars.thisframe240; -// var8005f004 = (var8005f010[animnum] + 1) % 40; -// } else { -// s32 index = var8005f004; -// s32 bestvalue = var8009a890[index]; -// s32 stack; -// s32 tmp; -// -// for (i = 0; i < 40; i++) { -// if (var8009a890[i] < bestvalue) { -// bestvalue = var8009a890[i]; -// index = i; -// } -// } -// -// tmp = var8009a88c[index]; -// -// if (tmp) { -// var8005f010[tmp] = 0xff; -// } -// -// tmp = g_Anims[animnum].headerlen; -// -// var8009a888[index] = animDma(&var8009a884[var8005f01c * index], g_Anims[animnum].data, tmp); -// var8005f010[animnum] = index; -// var8009a88c[index] = animnum; -// var8009a890[index] = g_Vars.thisframe240; -// var8005f004 = (index + 1) % 40; -// } -//} +void anim00023d38(s16 animnum) +{ + s32 i; + if (var8005f010[animnum] != 0xff) { + var8009a890[var8005f010[animnum]] = g_Vars.thisframe240; + var8005f004 = (var8005f010[animnum] + 1) % 40; + } else { + s32 index = var8005f004; + s32 bestvalue = var8009a890[index]; + s32 stack; + s32 tmp; + + for (i = 0; i < 40; i++) { + if (var8009a890[i] < bestvalue) { + bestvalue = var8009a890[i]; + index = i; + } + } + + tmp = var8009a88c[index]; + + if (tmp) { + var8005f010[tmp] = 0xff; + } + + tmp = g_Anims[animnum].headerlen; + + var8009a888[index] = animDma(&var8009a884[var8005f01c * index], g_Anims[animnum].data, tmp); + var8005f010[animnum] = index; + var8009a88c[index] = animnum; + var8009a890[index] = g_Vars.thisframe240; + var8005f004 = (index + 1) % 40; + } +} +#endif + +#if MATCHING GLOBAL_ASM( glabel anim00023f50 /* 23f50: 30cf0007 */ andi $t7,$a2,0x7 @@ -516,32 +519,33 @@ glabel anim00023f50 /* 23fd8: 03e00008 */ jr $ra /* 23fdc: 00601025 */ or $v0,$v1,$zero ); - +#else // Mismatch: regalloc -//u32 anim00023f50(u8 *arg0, u8 arg1, u32 arg2) -//{ -// u32 result = 0; -// u8 numbits; -// u32 tmp; -// -// arg0 += arg2 / 8; -// numbits = 8 - (arg2 % 8); -// -// while (arg1 >= numbits) { -// arg1 -= numbits; -// result |= (*arg0 & ((1 << numbits) - 1)) << arg1; -// arg0++; -// numbits = 8; -// } -// -// if (arg1 > 0) { -// result |= (*arg0 >> (numbits - arg1)) & ((1 << arg1) - 1); -// } -// -// if (arg2 / 8); -// -// return result; -//} +s32 anim00023f50(u8 *arg0, u8 arg1, u32 arg2) +{ + u32 result = 0; + u8 numbits; + u32 tmp; + + arg0 += arg2 / 8; + numbits = 8 - (arg2 % 8); + + while (arg1 >= numbits) { + arg1 -= numbits; + result |= (*arg0 & ((1 << numbits) - 1)) << arg1; + arg0++; + numbits = 8; + } + + if (arg1 > 0) { + result |= (*arg0 >> (numbits - arg1)) & ((1 << arg1) - 1); + } + + if (arg2 / 8); + + return result; +} +#endif s32 anim00023fe0(u8 *arg0, u8 arg1, s32 arg2) { @@ -571,7 +575,7 @@ void anim00024050(s32 arg0, bool flip, struct skeleton *skel, s16 animnum, u8 ar } bitsperentry = g_Anims[animnum].initialposbitsperentry; - ptr = (u8 *)var8009a888[var8005f010[animnum]]; + ptr = var8009a888[var8005f010[animnum]]; sum = 0; end = ptr + g_Anims[animnum].headerlen; @@ -765,7 +769,7 @@ u16 anim0002485c(s32 arg0, bool arg1, struct skeleton *skel, s16 animnum, s32 lo // This is iterating the header information in the animation's data sum = 0; - ptr = (u8 *)var8009a888[var8005f010[animnum]]; + ptr = var8009a888[var8005f010[animnum]]; for (i = 0; i < arg0; i++) { u8 flags = *ptr; @@ -843,7 +847,7 @@ f32 anim00024c14(s32 arg0, s16 animnum, u8 arg2) { u32 stack[2]; u8 *sp24 = var8009a874[arg2]; - u8 *ptr = (u8 *)var8009a888[var8005f010[animnum]]; + u8 *ptr = var8009a888[var8005f010[animnum]]; f32 result = 0; s32 total = 0; s32 i; diff --git a/src/lib/collision.c b/src/lib/collision.c index 5c4bc772c..54adf2f58 100644 --- a/src/lib/collision.c +++ b/src/lib/collision.c @@ -2988,6 +2988,7 @@ s32 cdTestVolume(struct coord *pos, f32 width, s16 *rooms, s32 types, s32 arg4, return result; } +#if MATCHING GLOBAL_ASM( glabel cd0002a6fc /* 2a6fc: 27bdff58 */ addiu $sp,$sp,-168 @@ -3191,77 +3192,78 @@ glabel cd0002a6fc /* 2a9e8: 03e00008 */ jr $ra /* 2a9ec: 27bd00a8 */ addiu $sp,$sp,0xa8 ); - +#else // Mismatch: Goal copies geo from t1 to v0 in the type 0 block -//s32 cd0002a6fc(struct coord *pos, struct coord *pos2, f32 width, s16 *rooms, s32 types, bool arg5, f32 arg6, f32 arg7) -//{ -// u32 stack[5]; -// struct collisionthing thing; // 80 -// s32 cdresult; -// struct coord sp70; -// struct coord sp64; -// -// cdresult = CDRESULT_NOCOLLISION; -// -// cd00027d1c(pos2, width, rooms, types, 4, arg5, arg6, arg7, &thing, 1); -// -// // 768 -// if (thing.geo != NULL) { -// cdresult = CDRESULT_COLLISION; -// -// // 778 -// if (thing.geo->type == GEOTYPE_TILE_I) { -// struct geotilei *tile = (struct geotilei *) thing.geo; -// s32 this = thing.vertexindex; -// s32 next = (this + 1) % thing.geo->numvertices; -// -// sp70.x = tile->vertices[this][0]; -// sp70.y = tile->vertices[this][1]; -// sp70.z = tile->vertices[this][2]; -// -// sp64.x = tile->vertices[next][0]; -// sp64.y = tile->vertices[next][1]; -// sp64.z = tile->vertices[next][2]; -// } else /*854*/ if (thing.geo->type == GEOTYPE_TILE_F) { -// struct geotilef *type1 = (struct geotilef *) thing.geo; -// s32 this = thing.vertexindex; -// s32 next = (this + 1) % thing.geo->numvertices; -// -// sp70.x = type1->vertices[this].x; -// sp70.y = type1->vertices[this].y; -// sp70.z = type1->vertices[this].z; -// -// sp64.x = type1->vertices[next].x; -// sp64.y = type1->vertices[next].y; -// sp64.z = type1->vertices[next].z; -// } else if (thing.geo->type == GEOTYPE_BLOCK) { -// struct geoblock *block = (struct geoblock *) thing.geo; -// s32 this = thing.vertexindex; -// s32 next = (this + 1) % thing.geo->numvertices; -// -// sp70.x = block->vertices[this][0]; -// sp70.y = pos->y; -// sp70.z = block->vertices[this][1]; -// -// sp64.x = block->vertices[next][0]; -// sp64.y = pos->y; -// sp64.z = block->vertices[next][1]; -// } else if (thing.geo->type == GEOTYPE_CYL) { -// struct geocyl *cyl = (struct geocyl *) thing.geo; -// -// if (1); -// -// cd00025848(cyl->x, cyl->z, cyl->width, pos->x, pos->z, &sp70.x, &sp70.z, &sp64.x, &sp64.z); -// -// sp70.y = pos->y; -// sp64.y = pos->y; -// } -// -// cd00024fb0(&sp70, &sp64, thing.prop); -// } -// -// return cdresult; -//} +s32 cd0002a6fc(struct coord *pos, struct coord *pos2, f32 width, s16 *rooms, s32 types, bool arg5, f32 arg6, f32 arg7) +{ + u32 stack[5]; + struct collisionthing thing; // 80 + s32 cdresult; + struct coord sp70; + struct coord sp64; + + cdresult = CDRESULT_NOCOLLISION; + + cd00027d1c(pos2, width, rooms, types, 4, arg5, arg6, arg7, &thing, 1); + + // 768 + if (thing.geo != NULL) { + cdresult = CDRESULT_COLLISION; + + // 778 + if (thing.geo->type == GEOTYPE_TILE_I) { + struct geotilei *tile = (struct geotilei *) thing.geo; + s32 this = thing.vertexindex; + s32 next = (this + 1) % thing.geo->numvertices; + + sp70.x = tile->vertices[this][0]; + sp70.y = tile->vertices[this][1]; + sp70.z = tile->vertices[this][2]; + + sp64.x = tile->vertices[next][0]; + sp64.y = tile->vertices[next][1]; + sp64.z = tile->vertices[next][2]; + } else /*854*/ if (thing.geo->type == GEOTYPE_TILE_F) { + struct geotilef *type1 = (struct geotilef *) thing.geo; + s32 this = thing.vertexindex; + s32 next = (this + 1) % thing.geo->numvertices; + + sp70.x = type1->vertices[this].x; + sp70.y = type1->vertices[this].y; + sp70.z = type1->vertices[this].z; + + sp64.x = type1->vertices[next].x; + sp64.y = type1->vertices[next].y; + sp64.z = type1->vertices[next].z; + } else if (thing.geo->type == GEOTYPE_BLOCK) { + struct geoblock *block = (struct geoblock *) thing.geo; + s32 this = thing.vertexindex; + s32 next = (this + 1) % thing.geo->numvertices; + + sp70.x = block->vertices[this][0]; + sp70.y = pos->y; + sp70.z = block->vertices[this][1]; + + sp64.x = block->vertices[next][0]; + sp64.y = pos->y; + sp64.z = block->vertices[next][1]; + } else if (thing.geo->type == GEOTYPE_CYL) { + struct geocyl *cyl = (struct geocyl *) thing.geo; + + if (1); + + cd00025848(cyl->x, cyl->z, cyl->radius, pos->x, pos->z, &sp70.x, &sp70.z, &sp64.x, &sp64.z); + + sp70.y = pos->y; + sp64.y = pos->y; + } + + cd00024fb0(&sp70, &sp64, thing.prop); + } + + return cdresult; +} +#endif s32 cdTestAToB1(struct coord *origpos, struct coord *dstpos, f32 width, s16 *dstrooms, s32 types, s32 arg5, f32 ymax, f32 ymin) { @@ -4185,6 +4187,7 @@ bool cd0002d15c(struct coord *pos, struct coord *coord2, s16 *rooms, u32 types, return true; } +#if MATCHING GLOBAL_ASM( glabel cd0002d3b0 /* 2d3b0: 27bdfd20 */ addiu $sp,$sp,-736 @@ -4386,68 +4389,69 @@ glabel cd0002d3b0 /* 2d6a4: 03e00008 */ jr $ra /* 2d6a8: 27bd02e0 */ addiu $sp,$sp,0x2e0 ); - +#else // Mismatch: Calculation of g_TileRooms[roomnum] is different // Other functions and the below use t3 as the offset, t2 as the base, then t2 + t3 // But goal for this function uses t2 as the offset, t3 as the base, then t2 + t3 -//s32 cd0002d3b0(struct coord *arg0, struct coord *arg1, s16 *rooms, s32 types, u16 arg4, s32 arg5, s32 arg6, f32 ymax, f32 ymin) -//{ -// s32 roomnum; -// s16 *roomptr; -// u8 *start; -// u8 *end; -// struct coord sp2c4; -// bool sp2c0 = false; -// u32 sp2b4[3]; -// struct coord sp2a8; -// struct coord sp29c; -// f32 sp298 = 4294967296; -// struct geo *sp294; -// s16 *propnumptr; -// s16 propnums[256]; -// -// sp2c4.x = arg1->x - arg0->x; -// sp2c4.y = arg1->y - arg0->y; -// sp2c4.z = arg1->z - arg0->z; -// -// if (types & CDTYPE_BG) { -// roomptr = rooms; -// roomnum = rooms[0]; -// -// while (roomnum != -1) { -// if (roomnum < g_TileNumRooms) { -// start = g_TileFileData.u8 + g_TileRooms[roomnum]; -// end = g_TileFileData.u8 + g_TileRooms[roomnum + 1]; -// -// if (!cd0002c714(start, end, arg0, arg1, &sp2c4, arg4, arg5, arg6, ymax, ymin, &sp298, sp2b4, &sp2a8, &sp29c, &sp294, roomnum)) { -// sp2c0 = true; -// cd00025254(&sp2a8, &sp29c, sp2b4, NULL, sp298, sp294); -// } -// } -// -// roomptr++; -// roomnum = *roomptr; -// } -// } -// -// roomGetProps(rooms, propnums, 256); -// propnumptr = propnums; -// -// while (*propnumptr >= 0) { -// struct prop *prop = &g_Vars.props[*propnumptr]; -// -// if (propIsOfCdType(prop, types) -// && propUpdateGeometry(prop, &start, &end) -// && !cd0002c714(start, end, arg0, arg1, &sp2c4, arg4, arg5, arg6, ymax, ymin, &sp298, sp2b4, &sp2a8, &sp29c, &sp294, -999)) { -// sp2c0 = true; -// cd00025254(&sp2a8, &sp29c, sp2b4, prop, sp298, sp294); -// } -// -// propnumptr++; -// } -// -// return !sp2c0; -//} +s32 cd0002d3b0(struct coord *arg0, struct coord *arg1, s16 *rooms, s32 types, u16 arg4, s32 arg5, s32 arg6, f32 ymax, f32 ymin) +{ + s32 roomnum; + s16 *roomptr; + u8 *start; + u8 *end; + struct coord sp2c4; + bool sp2c0 = false; + struct coord sp2b4; + struct coord sp2a8; + struct coord sp29c; + f32 sp298 = 4294967296; + struct geo *sp294; + s16 *propnumptr; + s16 propnums[256]; + + sp2c4.x = arg1->x - arg0->x; + sp2c4.y = arg1->y - arg0->y; + sp2c4.z = arg1->z - arg0->z; + + if (types & CDTYPE_BG) { + roomptr = rooms; + roomnum = rooms[0]; + + while (roomnum != -1) { + if (roomnum < g_TileNumRooms) { + start = g_TileFileData.u8 + g_TileRooms[roomnum]; + end = g_TileFileData.u8 + g_TileRooms[roomnum + 1]; + + if (!cd0002c714(start, end, arg0, arg1, &sp2c4, arg4, arg5, arg6, ymax, ymin, &sp298, &sp2b4, &sp2a8, &sp29c, &sp294, roomnum)) { + sp2c0 = true; + cd00025254(&sp2a8, &sp29c, &sp2b4, NULL, sp298, sp294); + } + } + + roomptr++; + roomnum = *roomptr; + } + } + + roomGetProps(rooms, propnums, 256); + propnumptr = propnums; + + while (*propnumptr >= 0) { + struct prop *prop = &g_Vars.props[*propnumptr]; + + if (propIsOfCdType(prop, types) + && propUpdateGeometry(prop, &start, &end) + && !cd0002c714(start, end, arg0, arg1, &sp2c4, arg4, arg5, arg6, ymax, ymin, &sp298, &sp2b4, &sp2a8, &sp29c, &sp294, -999)) { + sp2c0 = true; + cd00025254(&sp2a8, &sp29c, &sp2b4, prop, sp298, sp294); + } + + propnumptr++; + } + + return !sp2c0; +} +#endif bool cd0002d6ac(struct coord *pos, s16 *rooms, struct coord *targetpos, u32 types, u32 arg4, f32 arg5, f32 arg6) { @@ -4677,6 +4681,7 @@ bool cd0002ded8(struct coord *arg0, struct coord *arg1, struct prop *prop) return !result; } +#if MATCHING GLOBAL_ASM( glabel cd0002dffc /* 2dffc: 27bdff78 */ addiu $sp,$sp,-136 @@ -4857,64 +4862,65 @@ glabel cd0002dffc /* 2e270: 03e00008 */ jr $ra /* 2e274: 27bd0088 */ addiu $sp,$sp,0x88 ); - +#else // Mismatch: Float regalloc, likely related to the zero variable -//bool cd0002dffc(struct geoblock *arg0, struct geoblock *arg1) -//{ -// u32 stack[4]; -// f32 zero = 0; -// s32 numvertices0 = arg0->header.numvertices; -// s32 numvertices1 = arg1->header.numvertices; -// s32 i; -// -// for (i = 0; i < numvertices0; i++) { -// s32 next = (i + 1) % numvertices0; -// f64 diff1; -// f64 diff2; -// -// diff1 = arg0->vertices[next][1] - (f64)arg0->vertices[i][1]; -// diff2 = arg0->vertices[i][0] - (f64)arg0->vertices[next][0]; -// -// if (diff1 == zero && diff2 == zero) { -// if (cdIs2dPointInBlock(arg1, arg0->vertices[i][0], arg0->vertices[i][1])) { -// return false; -// } -// } else { -// f64 sum1 = arg0->vertices[i][0] * diff1 + arg0->vertices[i][1] * diff2; -// f64 sum2; -// s32 j = (next + 1) % numvertices0; -// s32 k; -// -// while (j != i) { -// sum2 = arg0->vertices[j][0] * diff1 + arg0->vertices[j][1] * diff2; -// -// if (sum2 != sum1) { -// break; -// } -// -// j = (j + 1) % numvertices0; -// } -// -// for (k = 0; k < numvertices1; k++) { -// f64 sum3 = arg1->vertices[k][0] * diff1 + arg1->vertices[k][1] * diff2; -// -// if (sum2 == sum1) { -// sum2 = sum1 - sum3 + sum1; -// } -// -// if ((sum3 < sum1 && sum2 < sum1) || (sum3 > sum1 && sum2 > sum1)) { -// break; -// } -// } -// -// if (k == numvertices1) { -// return true; -// } -// } -// } -// -// return false; -//} +bool cd0002dffc(struct geoblock *arg0, struct geoblock *arg1) +{ + u32 stack[4]; + f32 zero = 0; + s32 numvertices0 = arg0->header.numvertices; + s32 numvertices1 = arg1->header.numvertices; + s32 i; + + for (i = 0; i < numvertices0; i++) { + s32 next = (i + 1) % numvertices0; + f64 diff1; + f64 diff2; + + diff1 = arg0->vertices[next][1] - (f64)arg0->vertices[i][1]; + diff2 = arg0->vertices[i][0] - (f64)arg0->vertices[next][0]; + + if (diff1 == zero && diff2 == zero) { + if (cdIs2dPointInBlock(arg1, arg0->vertices[i][0], arg0->vertices[i][1])) { + return false; + } + } else { + f64 sum1 = arg0->vertices[i][0] * diff1 + arg0->vertices[i][1] * diff2; + f64 sum2; + s32 j = (next + 1) % numvertices0; + s32 k; + + while (j != i) { + sum2 = arg0->vertices[j][0] * diff1 + arg0->vertices[j][1] * diff2; + + if (sum2 != sum1) { + break; + } + + j = (j + 1) % numvertices0; + } + + for (k = 0; k < numvertices1; k++) { + f64 sum3 = arg1->vertices[k][0] * diff1 + arg1->vertices[k][1] * diff2; + + if (sum2 == sum1) { + sum2 = sum1 - sum3 + sum1; + } + + if ((sum3 < sum1 && sum2 < sum1) || (sum3 > sum1 && sum2 > sum1)) { + break; + } + } + + if (k == numvertices1) { + return true; + } + } + } + + return false; +} +#endif s32 cd0002e278(u8 *start, u8 *end, struct geoblock *ref, u16 flags) { diff --git a/src/lib/mema.c b/src/lib/mema.c index 584437dc2..5242f084f 100644 --- a/src/lib/mema.c +++ b/src/lib/mema.c @@ -393,6 +393,7 @@ void memaPrint(void) #endif } +#if MATCHING #if VERSION >= VERSION_NTSC_1_0 GLOBAL_ASM( glabel memaAlloc @@ -618,86 +619,87 @@ glabel memaAlloc /* 13494: 27bd0030 */ addiu $sp,$sp,0x30 ); #endif +#else +void *memaAlloc(u32 size) +{ + u32 addr; + u32 diff; + s32 i; -//void *memaAlloc(u32 size) -//{ -// u32 addr; -// u32 diff; -// s32 i; -// -// struct memaspace *curr = &g_MemaHeap.spaces[0]; -// u32 bestdiff = 0xffffffff; -// struct memaspace *best = NULL; -// -// // Iterate up to the first 16 spaces, looking for the -// // smallest space that will accommodate the requested size. -// for (i = 0; i < 16; i++) { -// if (curr->size >= size) { -// if (curr->addr == 0xffffffff) { -// // Reached the end -// break; -// } -// -// diff = curr->size - size; -// -// if (diff < bestdiff) { -// bestdiff = diff; -// best = curr; -// -// // Stop looking if the space is small enough -//#if VERSION >= VERSION_NTSC_1_0 -// if (diff < 64 || (IS8MB() && diff < size / 4)) -//#else -// if (diff < 64 || diff < size / 4) -//#endif -// { -// break; -// } -// } -// } -// -// curr++; -// } -// -// if (best == NULL) { -// // Keep iterating until we find a space that is big enough to fit. -// // The last space is marked as size 0xffffffff which prevents this loop -// // from iterating past the end of the spaces array. -// while (curr->size < size) { -// curr++; -// } -// -// if (curr->addr == 0xffffffff) { -// // There was no space, so attempt to free up some space -// // by doing several defrag passes -// for (i = 0; i < 8; i++) { -// memaDefragPass(&g_MemaHeap); -// } -// -// curr = &g_MemaHeap.spaces[0]; -// -// while (curr->size < size) { -// curr++; -// } -// -// if (curr->addr == 0xffffffff) { -// return NULL; -// } -// } -// -// best = curr; -// } -// -// addr = best->addr; -// best->addr += size; -// best->size -= size; -// -// if (best->size == 0) { -// best->addr = 0; -// } -// -// return (void *)addr; -//} + struct memaspace *curr = &g_MemaHeap.spaces[0]; + u32 bestdiff = 0xffffffff; + struct memaspace *best = NULL; + + // Iterate up to the first 16 spaces, looking for the + // smallest space that will accommodate the requested size. + for (i = 0; i < 16; i++) { + if (curr->size >= size) { + if (curr->addr == 0xffffffff) { + // Reached the end + break; + } + + diff = curr->size - size; + + if (diff < bestdiff) { + bestdiff = diff; + best = curr; + + // Stop looking if the space is small enough +#if VERSION >= VERSION_NTSC_1_0 + if (diff < 64 || (IS8MB() && diff < size / 4)) +#else + if (diff < 64 || diff < size / 4) +#endif + { + break; + } + } + } + + curr++; + } + + if (best == NULL) { + // Keep iterating until we find a space that is big enough to fit. + // The last space is marked as size 0xffffffff which prevents this loop + // from iterating past the end of the spaces array. + while (curr->size < size) { + curr++; + } + + if (curr->addr == 0xffffffff) { + // There was no space, so attempt to free up some space + // by doing several defrag passes + for (i = 0; i < 8; i++) { + memaDefragPass(&g_MemaHeap); + } + + curr = &g_MemaHeap.spaces[0]; + + while (curr->size < size) { + curr++; + } + + if (curr->addr == 0xffffffff) { + return NULL; + } + } + + best = curr; + } + + addr = best->addr; + best->addr += size; + best->size -= size; + + if (best->size == 0) { + best->addr = 0; + } + + return (void *)addr; +} +#endif /** * Grow the allocation which currently *ends at* the given address. diff --git a/src/lib/music.c b/src/lib/music.c index b15ee91e5..c3d14a49f 100644 --- a/src/lib/music.c +++ b/src/lib/music.c @@ -209,6 +209,7 @@ s32 musicHandleEvent5(struct musicevent *event, s32 result) } #endif +#if MATCHING #if VERSION >= VERSION_NTSC_1_0 GLOBAL_ASM( glabel musicTickEvents @@ -862,161 +863,162 @@ glabel musicTickEvents /* 1211c: 27bd0058 */ addiu $sp,$sp,0x58 ); #endif - +#else // Mismatch: In the "Remove the marked events" loop, goal reloads // g_MusicEventQueueLength if the if statement passed. Suspect there's some code // being optimised out that overwrites a1 or wrote to g_MusicEventQueueLength. // The code below uses += 0 to get the mismatch down to one instruction, -//void musicTickEvents(void) -//{ -// s32 i; -// s32 j; -// s32 result; -// struct musicevent *event; -// -// if (!g_SndDisabled) { -// if (g_MusicEventQueueLength); -// -// for (i = 0; i < 3; i++) { -// if (var800aaa38[i].unk04 == 0 && n_alCSPGetState(g_SeqInstances[i].seqp) == AL_PLAYING) { -// if (g_SeqInstances[i].seqp->chanState[0].unk0d <= var70053ca0[var800aaa38[i].tracktype]) { -// n_alSeqpStop((N_ALSeqPlayer *)g_SeqInstances[i].seqp); -// -// var800aaa38[i].tracktype = TRACKTYPE_NONE; -// var800aaa38[i].unk04 = 0; -// var800aaa38[i].unk08 = 0; -// var800aaa38[i].unk0c = 0; -// } else if (g_SeqInstances[i].seqp->chanState[0].unk0d == var800aaa38[i].unk0c) { -// n_alSeqpStop((N_ALSeqPlayer *)g_SeqInstances[i].seqp); -// -// var800aaa38[i].tracktype = TRACKTYPE_NONE; -// var800aaa38[i].unk04 = 0; -// var800aaa38[i].unk08 = 0; -// var800aaa38[i].unk0c = 0; -// } -// } -// } -// -// // Figure out which events can be removed from the queue due to later -// // events superseding them. This loop just marks those events as -// // removable by setting their tracktype to none. -// for (i = g_MusicEventQueueLength - 1; i >= 0; i--) { -// event = &g_MusicEventQueue[i]; -// -// if (event->eventtype == MUSICEVENTTYPE_5) { -// continue; -// } -// -// if (event->tracktype == TRACKTYPE_NONE) { -// continue; -// } -// -// for (j = i - 1; j >= 0; j--) { -// struct musicevent *earlier = &g_MusicEventQueue[j]; -// -// if (event->eventtype == MUSICEVENTTYPE_STOPALL) { -// earlier->tracktype = TRACKTYPE_NONE; -// continue; -// } -// -// if (earlier->eventtype == MUSICEVENTTYPE_5) { -// continue; -// } -// -// if (earlier->tracktype == TRACKTYPE_NONE) { -// continue; -// } -// -// if (earlier->tracktype == event->tracktype) { -// switch (event->eventtype) { -// case MUSICEVENTTYPE_STOP: -// earlier->tracktype = TRACKTYPE_NONE; -// break; -// case MUSICEVENTTYPE_PLAY: -// switch (earlier->eventtype) { -// case MUSICEVENTTYPE_PLAY: -// case MUSICEVENTTYPE_FADE: -// earlier->tracktype = TRACKTYPE_NONE; -// break; -// } -// break; -// case MUSICEVENTTYPE_FADE: -// if (earlier->eventtype == MUSICEVENTTYPE_FADE) { -// earlier->tracktype = TRACKTYPE_NONE; -// } -// break; -// } -// } -// } -// } -// -// // Remove the marked events from the queue, shift the remaining -// // events forward and recount the queue length. -// for (i = 0, j = 0; i < g_MusicEventQueueLength; i++) { -// if (g_MusicEventQueue[i].tracktype) { -// g_MusicEventQueue[j] = g_MusicEventQueue[i]; -// j++; -// -// g_MusicEventQueueLength += 0; -// } -// } -// -// g_MusicEventQueueLength = j; -// -// event = &g_MusicEventQueue[0]; -// -// if (var800840e0 == 0 || var800840e4 < g_Vars.diffframe240) { -// var800840e4 = var800840e0; -// -// while (g_MusicEventQueueLength) { -// event->numattempts++; -// -// result = RESULT_FAIL; -// -// switch (event->eventtype) { -// case MUSICEVENTTYPE_PLAY: -// result = musicHandlePlayEvent(event, 0); -// break; -// case MUSICEVENTTYPE_STOP: -// result = musicHandleStopEvent(event, 0); -// break; -// case MUSICEVENTTYPE_FADE: -// result = musicHandleFadeEvent(event, 0); -// break; -// case MUSICEVENTTYPE_STOPALL: -// result = musicHandleStopAllEvent(0); -// break; -// case MUSICEVENTTYPE_5: -// result = musicHandleEvent5(event, 0); -// break; -// } -// -// if (result != RESULT_FAIL) { -// // Remove the item from the queue -// g_MusicEventQueueLength--; -// -// for (i = 0; i < g_MusicEventQueueLength; i++) { -// g_MusicEventQueue[i] = g_MusicEventQueue[i + 1]; -// } -// -// // Break from processing further events on this frame -// // if requested -// if (result == RESULT_OK_BREAK) { -// break; -// } -// } else { -// break; -// } -// } -// } -// -// if (var800840e0) { -// var800840e4 -= g_Vars.diffframe240; -// } else { -// var800840e4 = 0; -// } -// } -//} +void musicTickEvents(void) +{ + s32 i; + s32 j; + s32 result; + struct musicevent *event; + + if (!g_SndDisabled) { + if (g_MusicEventQueueLength); + + for (i = 0; i < 3; i++) { + if (var800aaa38[i].unk04 == 0 && n_alCSPGetState(g_SeqInstances[i].seqp) == AL_PLAYING) { + if (g_SeqInstances[i].seqp->chanState[0].unk0d <= var70053ca0[var800aaa38[i].tracktype]) { + n_alSeqpStop((N_ALSeqPlayer *)g_SeqInstances[i].seqp); + + var800aaa38[i].tracktype = TRACKTYPE_NONE; + var800aaa38[i].unk04 = 0; + var800aaa38[i].unk08 = 0; + var800aaa38[i].unk0c = 0; + } else if (g_SeqInstances[i].seqp->chanState[0].unk0d == var800aaa38[i].unk0c) { + n_alSeqpStop((N_ALSeqPlayer *)g_SeqInstances[i].seqp); + + var800aaa38[i].tracktype = TRACKTYPE_NONE; + var800aaa38[i].unk04 = 0; + var800aaa38[i].unk08 = 0; + var800aaa38[i].unk0c = 0; + } + } + } + + // Figure out which events can be removed from the queue due to later + // events superseding them. This loop just marks those events as + // removable by setting their tracktype to none. + for (i = g_MusicEventQueueLength - 1; i >= 0; i--) { + event = &g_MusicEventQueue[i]; + + if (event->eventtype == MUSICEVENTTYPE_5) { + continue; + } + + if (event->tracktype == TRACKTYPE_NONE) { + continue; + } + + for (j = i - 1; j >= 0; j--) { + struct musicevent *earlier = &g_MusicEventQueue[j]; + + if (event->eventtype == MUSICEVENTTYPE_STOPALL) { + earlier->tracktype = TRACKTYPE_NONE; + continue; + } + + if (earlier->eventtype == MUSICEVENTTYPE_5) { + continue; + } + + if (earlier->tracktype == TRACKTYPE_NONE) { + continue; + } + + if (earlier->tracktype == event->tracktype) { + switch (event->eventtype) { + case MUSICEVENTTYPE_STOP: + earlier->tracktype = TRACKTYPE_NONE; + break; + case MUSICEVENTTYPE_PLAY: + switch (earlier->eventtype) { + case MUSICEVENTTYPE_PLAY: + case MUSICEVENTTYPE_FADE: + earlier->tracktype = TRACKTYPE_NONE; + break; + } + break; + case MUSICEVENTTYPE_FADE: + if (earlier->eventtype == MUSICEVENTTYPE_FADE) { + earlier->tracktype = TRACKTYPE_NONE; + } + break; + } + } + } + } + + // Remove the marked events from the queue, shift the remaining + // events forward and recount the queue length. + for (i = 0, j = 0; i < g_MusicEventQueueLength; i++) { + if (g_MusicEventQueue[i].tracktype) { + g_MusicEventQueue[j] = g_MusicEventQueue[i]; + j++; + + g_MusicEventQueueLength += 0; + } + } + + g_MusicEventQueueLength = j; + + event = &g_MusicEventQueue[0]; + + if (var800840e0 == 0 || var800840e4 < g_Vars.diffframe240) { + var800840e4 = var800840e0; + + while (g_MusicEventQueueLength) { + event->numattempts++; + + result = RESULT_FAIL; + + switch (event->eventtype) { + case MUSICEVENTTYPE_PLAY: + result = musicHandlePlayEvent(event, 0); + break; + case MUSICEVENTTYPE_STOP: + result = musicHandleStopEvent(event, 0); + break; + case MUSICEVENTTYPE_FADE: + result = musicHandleFadeEvent(event, 0); + break; + case MUSICEVENTTYPE_STOPALL: + result = musicHandleStopAllEvent(0); + break; + case MUSICEVENTTYPE_5: + result = musicHandleEvent5(event, 0); + break; + } + + if (result != RESULT_FAIL) { + // Remove the item from the queue + g_MusicEventQueueLength--; + + for (i = 0; i < g_MusicEventQueueLength; i++) { + g_MusicEventQueue[i] = g_MusicEventQueue[i + 1]; + } + + // Break from processing further events on this frame + // if requested + if (result == RESULT_OK_BREAK) { + break; + } + } else { + break; + } + } + } + + if (var800840e0) { + var800840e4 -= g_Vars.diffframe240; + } else { + var800840e4 = 0; + } + } +} +#endif void musicTick(void) { diff --git a/src/lib/ultra/libc/llcvt.c b/src/lib/ultra/libc/llcvt.c index 444d5a368..0881bc84a 100644 --- a/src/lib/ultra/libc/llcvt.c +++ b/src/lib/ultra/libc/llcvt.c @@ -65,6 +65,7 @@ glabel __d_to_ull //} #endif +#if MATCHING GLOBAL_ASM( glabel __f_to_ull /* 5a7c: 444ef800 */ cfc1 $t6,$31 @@ -110,13 +111,14 @@ glabel __f_to_ull /* 5b10: 03e00008 */ jr $ra /* 5b14: 0002103f */ dsra32 $v0,$v0,0x0 ); - +#else // Mismatch: Goal loads 0x80000000 then shifts it left by 32, // while the below stores it in .rodata and loads it. -//unsigned long long __f_to_ull(float f) -//{ -// return f; -//} +unsigned long long __f_to_ull(float f) +{ + return f; +} +#endif double __ll_to_d(long long s) { diff --git a/src/lib/ultra/libc/sprintf.c b/src/lib/ultra/libc/sprintf.c index 31340f738..17eb35e94 100644 --- a/src/lib/ultra/libc/sprintf.c +++ b/src/lib/ultra/libc/sprintf.c @@ -1,10 +1,12 @@ #include +#include "stdarg.h" char *proutSprintf(char *dst, const char *src, size_t count) { return (char *)memcpy((u8 *)dst, (u8 *)src, count) + count; } +#if MATCHING GLOBAL_ASM( glabel sprintf /* 136b4: 27bdffe0 */ addiu $sp,$sp,-32 @@ -30,21 +32,24 @@ glabel sprintf /* 13700: 03e00008 */ jr $ra /* 13704: 00000000 */ nop ); - +#else // Mismatch: // Goal takes v0 from _Printf and copies it to v1 but leaves v0 unmodified. // The below copies v0 to v1 then back to v0 for the return. -//int sprintf(char *dst, const char *fmt, ...) -//{ -// int ans; -// va_list ap; -// -// va_start(ap, fmt); -// ans = _Printf(proutSprintf, dst, fmt, ap); -// -// if (ans >= 0) { -// dst[ans] = 0; -// } -// -// return ans; -//} +int sprintf(char *dst, const char *fmt, ...) +{ + int ans; + va_list ap; + + va_start(ap, fmt); + ans = _Printf(proutSprintf, dst, fmt, ap); + + if (ans >= 0) { + dst[ans] = 0; + } + + va_end(ap); + + return ans; +} +#endif diff --git a/src/lib/ultra/os/getmemsize.c b/src/lib/ultra/os/getmemsize.c index a9de1b690..99b2ab4c8 100644 --- a/src/lib/ultra/os/getmemsize.c +++ b/src/lib/ultra/os/getmemsize.c @@ -2,6 +2,7 @@ #include #include +#if MATCHING GLOBAL_ASM( glabel osGetMemSize /* 4f530: 27bdfff0 */ addiu $sp,$sp,-16 @@ -77,4 +78,5 @@ glabel osGetMemSize .NB0004f63c: /* 4f63c: 03e00008 */ jr $ra /* 4f640: 27bd0010 */ addiu $sp,$sp,0x10 -);; +); +#endif diff --git a/src/lib/ultra/os/syncputchars.c b/src/lib/ultra/os/syncputchars.c index a38c5f814..94956b5e9 100644 --- a/src/lib/ultra/os/syncputchars.c +++ b/src/lib/ultra/os/syncputchars.c @@ -5,6 +5,7 @@ unsigned int __osRdbSendMessage = 0; unsigned int __osRdbWriteOK = 1; +#if MATCHING GLOBAL_ASM( glabel __osSyncPutChars /* 4100: 27bdffc8 */ addiu $sp,$sp,-56 @@ -73,30 +74,31 @@ glabel __osSyncPutChars /* 41e4: 03e00008 */ jr $ra /* 41e8: 00000000 */ sll $zero,$zero,0x0 ); +#else +void __osSyncPutChars(int type, int length, const char *buf) +{ + rdbPacket packet; + int i; + u32 mask; -//void __osSyncPutChars(int type, int length, const char *buf) -//{ -// rdbPacket packet; -// int i; -// u32 mask; -// -// packet.type = type; -// packet.length = length; -// -// for (i = 0; i < length; i++) { -// packet.buf[i] = buf[i]; -// } -// -// while (!__osAtomicDec(&__osRdbWriteOK)); -// -// mask = __osDisableInt(); -// -// *(u32 *)RDB_BASE_REG = *(u32 *)&packet; -// -// while (!(__osGetCause() & CAUSE_IP6)); -// -// *(u32 *)RDB_READ_INTR_REG = 0; -// -// __osRdbWriteOK++; -// __osRestoreInt(mask); -//} + packet.type = type; + packet.length = length; + + for (i = 0; i < length; i++) { + packet.buf[i] = buf[i]; + } + + while (!__osAtomicDec(&__osRdbWriteOK)); + + mask = __osDisableInt(); + + *(u32 *)RDB_BASE_REG = *(u32 *)&packet; + + while (!(__osGetCause() & CAUSE_IP6)); + + *(u32 *)RDB_READ_INTR_REG = 0; + + __osRdbWriteOK++; + __osRestoreInt(mask); +} +#endif diff --git a/src/lib/vi.c b/src/lib/vi.c index 1d5b7a2a4..7eeedaeab 100644 --- a/src/lib/vi.c +++ b/src/lib/vi.c @@ -295,6 +295,7 @@ void vi00009ed4(void) osViSetSpecialFeatures(OS_VI_GAMMA_OFF | OS_VI_DITHER_FILTER_ON); } +#if MATCHING #if VERSION == VERSION_PAL_FINAL GLOBAL_ASM( glabel viUpdateMode @@ -2153,162 +2154,163 @@ glabel viUpdateMode /* aa4c: 00000000 */ nop ); #endif - +#else // Mismatch: Different codegen near reg usage -//void viUpdateMode(void) -//{ -// struct rend_vidat *prevdata; -// f32 x; -// f32 y; -// s32 reg; -// s32 v1; -// s32 tmp; -// -// if (g_ViBackData->mode != g_ViFrontData->mode) { -// switch (g_ViBackData->mode) { -// case 0: -// osViSetYScale(1); -// osViBlack(true); -// break; -// case 1: -// break; -// case 2: -// break; -// } -// } -// -// x = (f32)g_ViBackData->x / (f32)g_ViBackData->bufx; -// y = (f32)g_ViBackData->y / (f32)g_ViBackData->bufy; -// -// if (g_ViBackData->mode == VIMODE_NONE) { -// y = 1; -// } -// -// g_ViXScalesBySlot[g_ViSlot] = x; -// g_ViYScalesBySlot[g_ViSlot] = y; -// -// // 12c -// if (g_ViBackData->mode == VIMODE_LO) { -// if (g_ViIs16Bit) { -// if (osTvType == OS_TV_MPAL) { -// var8008dcc0[g_ViSlot] = osViModeTable[OS_VI_MPAL_LAN1]; -// } else { -// var8008dcc0[g_ViSlot] = osViModeTable[OS_VI_NTSC_LAN1]; -// } -// } else { -// if (osTvType == OS_TV_MPAL) { -// var8008dcc0[g_ViSlot] = osViModeTable[OS_VI_MPAL_LAN2]; -// } else { -// var8008dcc0[g_ViSlot] = osViModeTable[OS_VI_NTSC_LAN2]; -// } -// } -// -// var8008dcc0[g_ViSlot].comRegs.width = g_ViBackData->bufx; -// var8008dcc0[g_ViSlot].comRegs.xScale = g_ViBackData->bufx * 1024 / 640; -// var8008dcc0[g_ViSlot].fldRegs[0].origin = g_ViBackData->bufx * 2; -// var8008dcc0[g_ViSlot].fldRegs[1].origin = g_ViBackData->bufx * 2; -// -// // 324 -// if (IS4MB()) { -// var8008dcc0[g_ViSlot].fldRegs[0].yScale = 1024; -// var8008dcc0[g_ViSlot].fldRegs[1].yScale = 1024; -// } else { -// var8008dcc0[g_ViSlot].fldRegs[0].yScale = g_ViBackData->bufy * 2048 / 440; -// var8008dcc0[g_ViSlot].fldRegs[1].yScale = g_ViBackData->bufy * 2048 / 440; -// } -// -// // 3ac -// reg = var8008dcc0[g_ViSlot].comRegs.hStart; -// reg = ADD_LOW_AND_HI_16_MOD(reg, var8005d588); -// var8008dcc0[g_ViSlot].comRegs.hStart = reg; -// var8008dcc0[g_ViSlot].fldRegs[0].vStart = reg; -// var8008dcc0[g_ViSlot].fldRegs[1].vStart = reg; -// var8008de08 = reg; -// -// v1 = g_ViBackData->bufy * 1024 / var8008dcc0[g_ViSlot].fldRegs[0].yScale; -// -// // 458 -// if (v1 > 300) { -// v1 >>= 1; -// } -// -// tmp = 277 - v1; -// reg = ((tmp + 2) << 16) | (tmp + ((v1 - 2) * 2) + 2); -// reg = ADD_LOW_AND_HI_16_MOD(reg, var8005d58c); -// var8008de0c = reg; -// var8008de10 = reg; -// -// g_SchedViModesPending[g_ViSlot] = true; -// } else /*534*/ if (g_ViBackData->mode == VIMODE_HI) { -// if (osTvType == OS_TV_MPAL) { -// var8008dcc0[g_ViSlot] = osViModeTable[OS_VI_MPAL_HAF1]; -// } else { -// var8008dcc0[g_ViSlot] = osViModeTable[OS_VI_NTSC_HAF1]; -// } -// -// var8008dcc0[g_ViSlot].comRegs.width = g_ViBackData->bufx; -// var8008dcc0[g_ViSlot].comRegs.xScale = g_ViBackData->bufx * 1024 / 640; -// var8008dcc0[g_ViSlot].fldRegs[0].yScale = 2048; -// var8008dcc0[g_ViSlot].fldRegs[1].yScale = 2048; -// var8008dcc0[g_ViSlot].fldRegs[0].origin = g_ViBackData->bufx * 2; -// var8008dcc0[g_ViSlot].fldRegs[1].origin = g_ViBackData->bufx * 4; -// -// reg = var8008dcc0[g_ViSlot].comRegs.hStart; -// reg = ADD_LOW_AND_HI_16_MOD(reg, var8005d588); -// var8008dcc0[g_ViSlot].comRegs.hStart = reg; -// var8008de08 = reg; -// -// reg = var8008dcc0[g_ViSlot].fldRegs[0].vStart; -// reg = ADD_LOW_AND_HI_16_MOD(reg, var8005d58c); -// var8008dcc0[g_ViSlot].fldRegs[0].vStart = reg; -// var8008de0c = reg; -// -// reg = var8008dcc0[g_ViSlot].fldRegs[1].vStart; -// reg = ADD_LOW_AND_HI_16_MOD(reg, var8005d58c); -// var8008dcc0[g_ViSlot].fldRegs[1].vStart = reg; -// var8008de10 = reg; -// -// // 7f8 -// if (var8005dd18) { -// reg = var8005d58c; -// reg = (reg + 431) % 0xffff << 16 | (reg + 123) % 0xffff; -// var8008dcc0[g_ViSlot].fldRegs[0].vStart = reg; -// var8008de0c = reg; -// -// reg = var8005d58c; -// reg = (reg + 433) % 0xffff << 16 | (reg + 121) % 0xffff; -// var8008dcc0[g_ViSlot].fldRegs[1].vStart = reg; -// var8008de10 = reg; -// } -// -// g_SchedViModesPending[g_ViSlot] = true; -// } else { -// // 8f4 -// g_SchedViModesPending[g_ViSlot] = false; -// } -// -// // 908 -// g_ViSlot = (g_ViSlot + 1) % 2; -// -// g_RdpCurTask->framebuffer = g_ViIs16Bit ? g_ViBackData->fb : g_FrameBuffers[0]; -// -// prevdata = g_ViBackData; -// -// g_ViFrontIndex = (g_ViFrontIndex + 1) % 2; -// g_ViBackIndex = (g_ViBackIndex + 1) % 2; -// -// g_ViFrontData = g_ViDataArray + g_ViFrontIndex; -// g_ViBackData = g_ViDataArray + g_ViBackIndex; -// -// bcopy(prevdata, g_ViBackData, sizeof(g_ViBackData)); -// -// g_ViBackData->fb = g_FrameBuffers[g_ViBackIndex]; -// -// if (g_ViReconfigured) { -// g_ViReconfigured = false; -// viBlack(false); -// } -//} +void viUpdateMode(void) +{ + struct rend_vidat *prevdata; + f32 x; + f32 y; + s32 reg; + s32 v1; + s32 tmp; + + if (g_ViBackData->mode != g_ViFrontData->mode) { + switch (g_ViBackData->mode) { + case 0: + osViSetYScale(1); + osViBlack(true); + break; + case 1: + break; + case 2: + break; + } + } + + x = (f32)g_ViBackData->x / (f32)g_ViBackData->bufx; + y = (f32)g_ViBackData->y / (f32)g_ViBackData->bufy; + + if (g_ViBackData->mode == VIMODE_NONE) { + y = 1; + } + + g_ViXScalesBySlot[g_ViSlot] = x; + g_ViYScalesBySlot[g_ViSlot] = y; + + // 12c + if (g_ViBackData->mode == VIMODE_LO) { + if (g_ViIs16Bit) { + if (osTvType == OS_TV_MPAL) { + var8008dcc0[g_ViSlot] = osViModeTable[OS_VI_MPAL_LAN1]; + } else { + var8008dcc0[g_ViSlot] = osViModeTable[OS_VI_NTSC_LAN1]; + } + } else { + if (osTvType == OS_TV_MPAL) { + var8008dcc0[g_ViSlot] = osViModeTable[OS_VI_MPAL_LAN2]; + } else { + var8008dcc0[g_ViSlot] = osViModeTable[OS_VI_NTSC_LAN2]; + } + } + + var8008dcc0[g_ViSlot].comRegs.width = g_ViBackData->bufx; + var8008dcc0[g_ViSlot].comRegs.xScale = g_ViBackData->bufx * 1024 / 640; + var8008dcc0[g_ViSlot].fldRegs[0].origin = g_ViBackData->bufx * 2; + var8008dcc0[g_ViSlot].fldRegs[1].origin = g_ViBackData->bufx * 2; + + // 324 + if (IS4MB()) { + var8008dcc0[g_ViSlot].fldRegs[0].yScale = 1024; + var8008dcc0[g_ViSlot].fldRegs[1].yScale = 1024; + } else { + var8008dcc0[g_ViSlot].fldRegs[0].yScale = g_ViBackData->bufy * 2048 / 440; + var8008dcc0[g_ViSlot].fldRegs[1].yScale = g_ViBackData->bufy * 2048 / 440; + } + + // 3ac + reg = var8008dcc0[g_ViSlot].comRegs.hStart; + reg = ADD_LOW_AND_HI_16_MOD(reg, var8005d588); + var8008dcc0[g_ViSlot].comRegs.hStart = reg; + var8008dcc0[g_ViSlot].fldRegs[0].vStart = reg; + var8008dcc0[g_ViSlot].fldRegs[1].vStart = reg; + var8008de08 = reg; + + v1 = g_ViBackData->bufy * 1024 / var8008dcc0[g_ViSlot].fldRegs[0].yScale; + + // 458 + if (v1 > 300) { + v1 >>= 1; + } + + tmp = 277 - v1; + reg = ((tmp + 2) << 16) | (tmp + ((v1 - 2) * 2) + 2); + reg = ADD_LOW_AND_HI_16_MOD(reg, var8005d58c); + var8008de0c = reg; + var8008de10 = reg; + + g_SchedViModesPending[g_ViSlot] = true; + } else /*534*/ if (g_ViBackData->mode == VIMODE_HI) { + if (osTvType == OS_TV_MPAL) { + var8008dcc0[g_ViSlot] = osViModeTable[OS_VI_MPAL_HAF1]; + } else { + var8008dcc0[g_ViSlot] = osViModeTable[OS_VI_NTSC_HAF1]; + } + + var8008dcc0[g_ViSlot].comRegs.width = g_ViBackData->bufx; + var8008dcc0[g_ViSlot].comRegs.xScale = g_ViBackData->bufx * 1024 / 640; + var8008dcc0[g_ViSlot].fldRegs[0].yScale = 2048; + var8008dcc0[g_ViSlot].fldRegs[1].yScale = 2048; + var8008dcc0[g_ViSlot].fldRegs[0].origin = g_ViBackData->bufx * 2; + var8008dcc0[g_ViSlot].fldRegs[1].origin = g_ViBackData->bufx * 4; + + reg = var8008dcc0[g_ViSlot].comRegs.hStart; + reg = ADD_LOW_AND_HI_16_MOD(reg, var8005d588); + var8008dcc0[g_ViSlot].comRegs.hStart = reg; + var8008de08 = reg; + + reg = var8008dcc0[g_ViSlot].fldRegs[0].vStart; + reg = ADD_LOW_AND_HI_16_MOD(reg, var8005d58c); + var8008dcc0[g_ViSlot].fldRegs[0].vStart = reg; + var8008de0c = reg; + + reg = var8008dcc0[g_ViSlot].fldRegs[1].vStart; + reg = ADD_LOW_AND_HI_16_MOD(reg, var8005d58c); + var8008dcc0[g_ViSlot].fldRegs[1].vStart = reg; + var8008de10 = reg; + + // 7f8 + if (var8005dd18) { + reg = var8005d58c; + reg = (reg + 431) % 0xffff << 16 | (reg + 123) % 0xffff; + var8008dcc0[g_ViSlot].fldRegs[0].vStart = reg; + var8008de0c = reg; + + reg = var8005d58c; + reg = (reg + 433) % 0xffff << 16 | (reg + 121) % 0xffff; + var8008dcc0[g_ViSlot].fldRegs[1].vStart = reg; + var8008de10 = reg; + } + + g_SchedViModesPending[g_ViSlot] = true; + } else { + // 8f4 + g_SchedViModesPending[g_ViSlot] = false; + } + + // 908 + g_ViSlot = (g_ViSlot + 1) % 2; + + g_RdpCurTask->framebuffer = g_ViIs16Bit ? g_ViBackData->fb : g_FrameBuffers[0]; + + prevdata = g_ViBackData; + + g_ViFrontIndex = (g_ViFrontIndex + 1) % 2; + g_ViBackIndex = (g_ViBackIndex + 1) % 2; + + g_ViFrontData = g_ViDataArray + g_ViFrontIndex; + g_ViBackData = g_ViDataArray + g_ViBackIndex; + + bcopy(prevdata, g_ViBackData, sizeof(g_ViBackData)); + + g_ViBackData->fb = g_FrameBuffers[g_ViBackIndex]; + + if (g_ViReconfigured) { + g_ViReconfigured = false; + viBlack(false); + } +} +#endif void viShake(f32 intensity) { diff --git a/src/lib/vm.c b/src/lib/vm.c index 74761c9d6..f41decafc 100644 --- a/src/lib/vm.c +++ b/src/lib/vm.c @@ -106,6 +106,7 @@ extern u32 *g_VmZipTable; #define MAX_LOADED_PAGES 268 +#if MATCHING #if VERSION >= VERSION_NTSC_1_0 GLOBAL_ASM( glabel vmInit @@ -719,7 +720,7 @@ glabel vmInit /* 7684: 27bd1568 */ addiu $sp,$sp,0x1568 ); #endif - +#else /** * Initialise the virtual memory. * @@ -781,129 +782,130 @@ glabel vmInit * set to the start of the unzipped game segment. */ // Mismatch: Calclulations near the start are hard to match -//void vmInit(void) -//{ -// s32 i; -// s32 j; -// u8 *s3; -// u32 *s5; -// u32 t8; -// u8 *s2; -// u8 *s1; -// u8 *chunkbuffer; -// s32 maxsize; -// u32 sp1474; // aka s6 -// u8 sp68[1024 * 5]; // 68 to 1467 -// u8 *gameseg; // 54 -// u8 *zip; // 48 -// u8 *s7; -// s32 statetablelen; -// -// g_VmInitialised = true; -// -// rzipInit(); -// -// if (bootGetMemSize() <= 0x400000) { -// g_Is4Mb = true; -// -// g_VmNumPages = (s32)((&_gameSegmentEnd - &_gameSegmentStart) + 0xfff) / PAGE_SIZE; -// t8 = (u32)((&_gameSegmentEnd - &_gameSegmentStart) + 0xfff) / PAGE_SIZE; -// sp1474 = t8 + 1; -// -// g_VmRamEnd = 0x7f000000 + PAGE_SIZE * g_VmNumPages; -// g_VmStateTableEnd = STACK_START; -// g_VmStateTable = (u32 *)(STACK_START - g_VmNumPages * 8); -// g_VmZipTable = (u32 *)(((u32)g_VmStateTable - (sp1474 + 5) * 4) & ~0xf); -// -// // Load gamezips pointer list -// dmaExec(g_VmZipTable, (u32)&_gamezipSegmentRomStart, ALIGN16((sp1474 + 1) * 4)); -// -// // Make pointers absolute instead of relative to their segment -// for (i = 0; i < sp1474; i++) { -// g_VmZipTable[i] += (u32)&_gamezipSegmentRomStart; -// } -// -// // Find the size of the biggest compressed zip -// maxsize = 0; -// -// for (i = 0; i < sp1474 - 1; i++) { -// u32 size = g_VmZipTable[i + 1] - g_VmZipTable[i]; -// -// if (size > maxsize) { -// maxsize = size; -// } -// } -// -// maxsize += 0x40; -// maxsize &= ~0xf; -// g_VmZipBuffer = (u32)g_VmZipTable - maxsize; -// g_VmZipBuffer &= ~0xf; -// gameseg = (u8 *)(g_VmZipBuffer - MAX_LOADED_PAGES * PAGE_SIZE); -// gameseg -= (u32)gameseg & 0x1fff; -// var8008ae20 = (u32)gameseg; -// g_VmMarker = (u32)gameseg; -// -// tlb000010a4(); -// -// statetablelen = (g_VmNumPages * 8) >> 2; -// -// for (i = 0; i < statetablelen; i++) { -// g_VmStateTable[i] = 0; -// } -// -// tlb0000113c(); -// } else { -// // Expansion pak is being used -// g_Is4Mb = false; -// -// t8 = (u32)((&_gameSegmentEnd - &_gameSegmentStart) + 0xfff) / PAGE_SIZE; -// s7 = (u8 *)STACK_START; -// gameseg = (u8 *)(((u32)s7 - ALIGN64(&_gameSegmentEnd - &_gameSegmentStart)) & 0xfffe0000); -// sp1474 = t8 + 1; -// -// s5 = (u32 *)(((u32)gameseg - ((t8 + 5) * 4)) & ~0xf); -// g_VmMarker = (u32)gameseg; -// -// // Load gamezips pointer list -// dmaExec(s5, (u32)&_gamezipSegmentRomStart, ALIGN16((sp1474 + 1) * 4)); -// -// // Make pointers absolute instead of relative to their segment -// for (i = 0; i < sp1474; i++) { -// s5[i] += (u32)&_gamezipSegmentRomStart; -// } -// -// // Load each zip from the ROM and inflate them to the game segment -// s2 = gameseg; -// chunkbuffer = (u8 *)((u32)s5 - PAGE_SIZE * 2); -// zip = chunkbuffer + 2; -// -// for (i = 0; i < sp1474 - 1; i++) { -// dmaExec(chunkbuffer, s5[i], ALIGN16(s5[i + 1] - s5[i])); -// s2 += rzipInflate(zip, s2, sp68); -// } -// -// // This loop sets the following TLB entries: -// // entry 2: 0x7f000000 to 0x7f010000 and 0x7f010000 to 0x7f020000 -// // entry 3: 0x7f020000 to 0x7f030000 and 0x7f030000 to 0x7f040000 -// // ... -// // entry 14: 0x7f1a0000 to 0x7f1b0000 and 0x7f1b0000 to 0x7f1c0000 -// s1 = (u8 *)0x7f000000; -// i = 2; -// -// while (gameseg <= s7) { -// osMapTLB(i, OS_PM_64K, s1, -// osVirtualToPhysical((void *)gameseg), -// osVirtualToPhysical((void *)(gameseg + 0x10000)), -1); -// -// gameseg += 0x20000; -// s1 += 0x20000; -// i++; -// } -// } -// -// g_VmNumTlbMisses = 0; -// g_VmNumPageMisses = 0; -// g_VmNumPageReplaces = 0; -// -// osInvalICache(0, ICACHE_SIZE); -//} +void vmInit(void) +{ + s32 i; + s32 j; + u8 *s3; + u32 *s5; + u32 t8; + u8 *s2; + u8 *s1; + u8 *chunkbuffer; + s32 maxsize; + u32 sp1474; // aka s6 + u8 sp68[1024 * 5]; // 68 to 1467 + u8 *gameseg; // 54 + u8 *zip; // 48 + u8 *s7; + s32 statetablelen; + + g_VmInitialised = true; + + rzipInit(); + + if (bootGetMemSize() <= 0x400000) { + g_Is4Mb = true; + + g_VmNumPages = (s32)((&_gameSegmentEnd - &_gameSegmentStart) + 0xfff) / PAGE_SIZE; + t8 = (u32)((&_gameSegmentEnd - &_gameSegmentStart) + 0xfff) / PAGE_SIZE; + sp1474 = t8 + 1; + + g_VmRamEnd = 0x7f000000 + PAGE_SIZE * g_VmNumPages; + g_VmStateTableEnd = STACK_START; + g_VmStateTable = (u32 *)(STACK_START - g_VmNumPages * 8); + g_VmZipTable = (u32 *)(((u32)g_VmStateTable - (sp1474 + 5) * 4) & ~0xf); + + // Load gamezips pointer list + dmaExec(g_VmZipTable, (u32)&_gamezipSegmentRomStart, ALIGN16((sp1474 + 1) * 4)); + + // Make pointers absolute instead of relative to their segment + for (i = 0; i < sp1474; i++) { + g_VmZipTable[i] += (u32)&_gamezipSegmentRomStart; + } + + // Find the size of the biggest compressed zip + maxsize = 0; + + for (i = 0; i < sp1474 - 1; i++) { + u32 size = g_VmZipTable[i + 1] - g_VmZipTable[i]; + + if (size > maxsize) { + maxsize = size; + } + } + + maxsize += 0x40; + maxsize &= ~0xf; + g_VmZipBuffer = (u32)g_VmZipTable - maxsize; + g_VmZipBuffer &= ~0xf; + gameseg = (u8 *)(g_VmZipBuffer - MAX_LOADED_PAGES * PAGE_SIZE); + gameseg -= (u32)gameseg & 0x1fff; + var8008ae20 = (u32)gameseg; + g_VmMarker = gameseg; + + tlb000010a4(); + + statetablelen = (g_VmNumPages * 8) >> 2; + + for (i = 0; i < statetablelen; i++) { + g_VmStateTable[i] = 0; + } + + tlb0000113c(); + } else { + // Expansion pak is being used + g_Is4Mb = false; + + t8 = (u32)((&_gameSegmentEnd - &_gameSegmentStart) + 0xfff) / PAGE_SIZE; + s7 = (u8 *)STACK_START; + gameseg = (u8 *)(((u32)s7 - ALIGN64(&_gameSegmentEnd - &_gameSegmentStart)) & 0xfffe0000); + sp1474 = t8 + 1; + + s5 = (u32 *)(((u32)gameseg - ((t8 + 5) * 4)) & ~0xf); + g_VmMarker = gameseg; + + // Load gamezips pointer list + dmaExec(s5, (u32)&_gamezipSegmentRomStart, ALIGN16((sp1474 + 1) * 4)); + + // Make pointers absolute instead of relative to their segment + for (i = 0; i < sp1474; i++) { + s5[i] += (u32)&_gamezipSegmentRomStart; + } + + // Load each zip from the ROM and inflate them to the game segment + s2 = gameseg; + chunkbuffer = (u8 *)((u32)s5 - PAGE_SIZE * 2); + zip = chunkbuffer + 2; + + for (i = 0; i < sp1474 - 1; i++) { + dmaExec(chunkbuffer, s5[i], ALIGN16(s5[i + 1] - s5[i])); + s2 += rzipInflate(zip, s2, sp68); + } + + // This loop sets the following TLB entries: + // entry 2: 0x7f000000 to 0x7f010000 and 0x7f010000 to 0x7f020000 + // entry 3: 0x7f020000 to 0x7f030000 and 0x7f030000 to 0x7f040000 + // ... + // entry 14: 0x7f1a0000 to 0x7f1b0000 and 0x7f1b0000 to 0x7f1c0000 + s1 = (u8 *)0x7f000000; + i = 2; + + while (gameseg <= s7) { + osMapTLB(i, OS_PM_64K, s1, + osVirtualToPhysical((void *)gameseg), + osVirtualToPhysical((void *)(gameseg + 0x10000)), -1); + + gameseg += 0x20000; + s1 += 0x20000; + i++; + } + } + + g_VmNumTlbMisses = 0; + g_VmNumPageMisses = 0; + g_VmNumPageReplaces = 0; + + osInvalICache(0, ICACHE_SIZE); +} +#endif