Files
goldeneye-pc-port/src/game/initexplosioncasing.c
T
James Dansereau 5ea46fabc1 PC port: full compile + link milestone (ge007.x86_64.exe builds clean)
All ~235 translation units now compile and the target links under MSYS2
GCC 16 + CMake/Ninja (ninja ge007 -k 0: 236/236, zero errors). N64 build
untouched; every src/ change is -DPORT-gated.

Portability fixes (findings D7-D17 in docs/PCPortResearch.md section 11):
- AI X-macro system: SWITCH() call sites activated to the author's
  hand-written byte-identical references under PORT; port/shim/
  bondaicommands.h + bondconstants.h + CPPLib.h re-emit the IDO paste
  tricks (isSubroutine, file-record macros, generated CALL) GCC-clean.
- 64-bit pointer-in-word initializers: monAnim jump targets now go
  through an index table resolved by the interpreter (chrai.h/propobj.c);
  UsetuplenZ.c credits pointer PORT-gated to 0.
- IDO printf engine compiled for PC (xprintf/xlitob/xldtob) with a
  shadow xstdio.h resolving the _Printf prototype clash.
- Host-libc gaps stubbed in port/: bcopy/bzero, __libm_qnan_f,
  tlbmanage*, g_ViXScales/YScales; chrObjRandom PRNG ported from .s.

Asset data strategy (D16): single-file assets compiled for real
(animation tables, fonts, textures, rareware logo); obseg per-file .c
excluded (colliding file-local globals the N64 build isolates via
per-ELF linking); 758 ROM-derived table symbols + ramrom_* + segment
markers stubbed in port/src/assetstubs.c / n64stubs.c.

fast3d is a no-op placeholder (port/src/gfxstub.c) until Phase 2 brings
in the real software RSP. Binary not yet runnable end-to-end: ROM
loading in romdata.c is still a TODO.
2026-08-20 20:27:06 -04:00

83 lines
2.7 KiB
C

#include <ultra64.h>
#include <memp.h>
#include "initexplosioncasing.h"
#include "explosion.h"
#ifndef DEBUG
#define osSyncPrintf(...) /* PC port: variadic (was ()); IDO tolerated fixed-arg count, GCC does not */
#endif
void alloc_explosion_smoke_casing_scorch_impact_buffers(void)
{
s32 i;
s32 j;
g_NumExplosionEntries = 0;
g_NumSmokeEntries = 0;
g_NumParticleEntries = 0;
g_NumScorchEntries = 0;
g_NumImpactEntries = 0;
g_SpExplosionDamageMult = 1.0f;
osSyncPrintf("Allocating %d bytes for explosion data\n", EXPLOSION_BUFFER_LEN * sizeof(struct Explosion));
g_ExplosionBuffer = (struct Explosion *)mempAllocBytesInBank(EXPLOSION_BUFFER_LEN * sizeof(struct Explosion), MEMPOOL_STAGE);
for (i=0; i<EXPLOSION_BUFFER_LEN; i++)
{
g_ExplosionBuffer[i].prop = NULL;
for (j=0; j<EXPLOSION_PARTS_LEN; j++)
{
g_ExplosionBuffer[i].parts[j].frame = 0;
}
}
osSyncPrintf("Allocating %d bytes for smoke data\n", SMOKE_BUFFER_LEN * sizeof(struct Smoke));
g_SmokeBuffer = (struct Smoke *)mempAllocBytesInBank(SMOKE_BUFFER_LEN * sizeof(struct Smoke), MEMPOOL_STAGE);
for (i=0; i<SMOKE_BUFFER_LEN; i++)
{
g_SmokeBuffer[i].prop = NULL;
for (j=0; j<SMOKE_PARTS_LEN; j++)
{
g_SmokeBuffer[i].parts[j].size = 0.0f;
}
}
if (getPlayerCount() == 1)
{
osSyncPrintf("Allocating %d bytes for scorch data\n", SCORCH_BUFFER_LEN * sizeof(struct Scorch));
// scorches are the circle burn marks left on the ground from explosions
g_ScorchBuffer = (struct Scorch *)mempAllocBytesInBank(SCORCH_BUFFER_LEN * sizeof(struct Scorch), MEMPOOL_STAGE);
for (i=0; i<SCORCH_BUFFER_LEN; i++)
{
g_ScorchBuffer[i].roomid = -1;
}
}
osSyncPrintf("Allocating %d bytes for wallhit data\n", BULLET_IMPACT_BUFFER_LEN * sizeof(struct BulletImpact));
g_BulletImpactBuffer = (struct BulletImpact *)mempAllocBytesInBank(BULLET_IMPACT_BUFFER_LEN * sizeof(struct BulletImpact), MEMPOOL_STAGE);
for (i=0; i<BULLET_IMPACT_BUFFER_LEN; i++)
{
g_BulletImpactBuffer[i].room = -1;
}
max_particles = MAX_FLYING_PARTICLES / getPlayerCount();
if ((lvlGetCurrentStageToLoad() == LEVELID_STREETS) || (lvlGetCurrentStageToLoad() == LEVELID_DEPOT))
{
max_particles = (s32) max_particles >> 1;
}
osSyncPrintf("Allocating %d bytes for debris data (%d bits)\n", max_particles * sizeof(struct FlyingParticles), max_particles);
g_FlyingParticlesBuffer = (struct FlyingParticles *)mempAllocBytesInBank(((max_particles * sizeof(struct FlyingParticles)) + 0xF) & ~0xF, MEMPOOL_STAGE);
for (i=0; i<max_particles; i++)
{
g_FlyingParticlesBuffer[i].unk00 = 0;
}
}