mirror of
https://gitlab.com/ryandwyer/perfect-dark
synced 2026-06-18 15:15:20 -04:00
Remove unused object types
This commit is contained in:
@@ -46,7 +46,6 @@
|
||||
build/ROMID/lib/mtxasm.o (section); \
|
||||
build/ROMID/lib/mtx.o (section); \
|
||||
build/ROMID/lib/lib_17ce0.o (section); \
|
||||
build/ROMID/lib/path.o (section); \
|
||||
build/ROMID/lib/modelasm.o (section); \
|
||||
build/ROMID/lib/model.o (section); \
|
||||
build/ROMID/lib/anim.o (section); \
|
||||
|
||||
-192
@@ -250,198 +250,6 @@ struct model *bodyAllocateModel(s32 bodynum, s32 headnum, u32 spawnflags)
|
||||
return body0f02d338(bodynum, headnum, NULL, NULL, sunglasses, varyheight);
|
||||
}
|
||||
|
||||
s32 body0f02d3f8(void)
|
||||
{
|
||||
return g_BondBodies[var80062c80];
|
||||
}
|
||||
|
||||
s32 bodyChooseHead(s32 bodynum)
|
||||
{
|
||||
s32 head;
|
||||
|
||||
if (g_HeadsAndBodies[bodynum].ismale) {
|
||||
head = g_ActiveMaleHeads[g_ActiveMaleHeadsIndex++];
|
||||
|
||||
if (g_ActiveMaleHeadsIndex == g_NumActiveHeadsPerGender) {
|
||||
g_ActiveMaleHeadsIndex = 0;
|
||||
}
|
||||
} else if (bodynum == BODY_FEM_GUARD) {
|
||||
head = g_FemGuardHeads[random() % 3];
|
||||
} else {
|
||||
head = g_ActiveFemaleHeads[g_ActiveFemaleHeadsIndex++];
|
||||
|
||||
if (g_ActiveFemaleHeadsIndex == g_NumActiveHeadsPerGender) {
|
||||
g_ActiveFemaleHeadsIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return head;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read a "packed" chr definition and create a runtime chr from it.
|
||||
*
|
||||
* Chr definitions are stored in a packed format in each stage's setup file.
|
||||
* The packed format is used for space saving reasons.
|
||||
*/
|
||||
void bodyAllocateChr(s32 stagenum, struct packedchr *packed, s32 cmdindex)
|
||||
{
|
||||
struct pad pad;
|
||||
s16 rooms[2];
|
||||
struct chrdata *chr;
|
||||
struct modelfiledata *headfiledata;
|
||||
struct model *model;
|
||||
struct prop *prop;
|
||||
s32 bodynum;
|
||||
s32 headnum;
|
||||
f32 angle;
|
||||
s32 index;
|
||||
|
||||
padUnpack(packed->padnum, PADFIELD_POS | PADFIELD_LOOK | PADFIELD_ROOM, &pad);
|
||||
|
||||
rooms[0] = pad.room;
|
||||
rooms[1] = -1;
|
||||
|
||||
if (cdTestVolume(&pad.pos, 20, rooms, CDTYPE_ALL, CHECKVERTICAL_YES, 200, -200) == CDRESULT_COLLISION
|
||||
&& packed->chair == -1
|
||||
&& (packed->spawnflags & SPAWNFLAG_IGNORECOLLISION) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (packed->spawnflags & (SPAWNFLAG_ONLYONA | SPAWNFLAG_ONLYONSA | SPAWNFLAG_ONLYONPA)) {
|
||||
if ((packed->spawnflags & (SPAWNFLAG_ONLYONA | SPAWNFLAG_ONLYONSA | SPAWNFLAG_ONLYONPA)) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (((packed->spawnflags & SPAWNFLAG_ONLYONA) && lvGetDifficulty() == DIFF_A)
|
||||
|| ((packed->spawnflags & SPAWNFLAG_ONLYONSA) && lvGetDifficulty() == DIFF_SA)
|
||||
|| ((packed->spawnflags & SPAWNFLAG_ONLYONPA) && lvGetDifficulty() == DIFF_PA)) {
|
||||
// ok
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
headnum = -55555;
|
||||
headfiledata = NULL;
|
||||
|
||||
if (packed->bodynum == 255) {
|
||||
bodynum = body0f02d3f8();
|
||||
} else {
|
||||
bodynum = packed->bodynum;
|
||||
}
|
||||
|
||||
if (!g_HeadsAndBodies[bodynum].unk00_01) {
|
||||
if (packed->headnum >= 0) {
|
||||
headnum = packed->headnum;
|
||||
} else if (headnum == -55555) {
|
||||
headnum = bodyChooseHead(bodynum);
|
||||
}
|
||||
}
|
||||
|
||||
if (headnum < 0) {
|
||||
index = -1 - headnum;
|
||||
|
||||
if (index >= 0 && index < 22) {
|
||||
headfiledata = func0f18e57c(index, &headnum);
|
||||
}
|
||||
|
||||
model = body0f02ce8c(bodynum, headnum, NULL, headfiledata, false, NULL, false, false);
|
||||
} else {
|
||||
model = bodyAllocateModel(bodynum, headnum, packed->spawnflags);
|
||||
}
|
||||
|
||||
if (model != NULL) {
|
||||
angle = atan2f(pad.look.x, pad.look.z);
|
||||
prop = chrAllocate(model, &pad.pos, rooms, angle);
|
||||
|
||||
if (prop != NULL) {
|
||||
propActivate(prop);
|
||||
propEnable(prop);
|
||||
|
||||
chr = prop->chr;
|
||||
chrSetChrnum(chr, packed->chrnum);
|
||||
chr->hearingscale = packed->hearscale / 1000.0f;
|
||||
chr->visionrange = packed->viewdist;
|
||||
chr->padpreset1 = packed->padpreset;
|
||||
chr->chrpreset1 = packed->chrpreset;
|
||||
chr->headnum = headnum;
|
||||
chr->bodynum = bodynum;
|
||||
chr->race = bodyGetRace(chr->bodynum);
|
||||
|
||||
chr->rtracked = false;
|
||||
|
||||
if (packed->spawnflags & SPAWNFLAG_INVINCIBLE) {
|
||||
chr->chrflags |= CHRCFLAG_INVINCIBLE;
|
||||
}
|
||||
|
||||
if (packed->spawnflags & SPAWNFLAG_00000200) {
|
||||
chr->hidden |= CHRHFLAG_00400000;
|
||||
}
|
||||
|
||||
if (packed->spawnflags & SPAWNFLAG_ANTINONINTERACTABLE) {
|
||||
chr->hidden |= CHRHFLAG_ANTINONINTERACTABLE;
|
||||
}
|
||||
|
||||
if (packed->spawnflags & SPAWNFLAG_DONTSHOOTME) {
|
||||
chr->hidden |= CHRHFLAG_DONTSHOOTME;
|
||||
}
|
||||
|
||||
if (packed->spawnflags & SPAWNFLAG_HIDDEN) {
|
||||
chr->chrflags |= CHRCFLAG_HIDDEN;
|
||||
}
|
||||
|
||||
if (packed->spawnflags & SPAWNFLAG_RTRACKED) {
|
||||
chr->rtracked = true;
|
||||
}
|
||||
|
||||
if (packed->spawnflags & SPAWNFLAG_NOBLOOD) {
|
||||
chr->noblood = true;
|
||||
}
|
||||
|
||||
if (packed->spawnflags & SPAWNFLAG_BLUESIGHT) {
|
||||
chr->hidden2 |= CHRH2FLAG_BLUESIGHT;
|
||||
}
|
||||
|
||||
chr->flags = packed->flags;
|
||||
chr->flags2 = packed->flags2;
|
||||
chr->team = packed->team;
|
||||
chr->squadron = packed->squadron;
|
||||
chr->aibot = NULL;
|
||||
|
||||
if (packed->tude != 4) {
|
||||
chr->tude = packed->tude;
|
||||
} else {
|
||||
chr->tude = random() % 4;
|
||||
}
|
||||
|
||||
chr->voicebox = random() % 3;
|
||||
|
||||
if (!g_HeadsAndBodies[chr->bodynum].ismale) {
|
||||
chr->voicebox = VOICEBOX_FEMALE;
|
||||
}
|
||||
|
||||
chr->naturalanim = packed->naturalanim;
|
||||
chr->myspecial = packed->chair;
|
||||
chr->yvisang = packed->yvisang;
|
||||
|
||||
packed->chrindex = chr - g_ChrSlots;
|
||||
|
||||
chr->teamscandist = packed->teamscandist;
|
||||
chr->convtalk = packed->convtalk;
|
||||
|
||||
if (chr->flags & CHRFLAG0_CAN_HEARSPAWN) {
|
||||
chr->chrflags |= CHRCFLAG_CLONEABLE;
|
||||
}
|
||||
|
||||
if (random() % 5 == 0) {
|
||||
// Make chr punch slower
|
||||
chr->flags2 |= CHRFLAG1_ADJUSTPUNCHSPEED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tweak the head's Y offset to suit the body.
|
||||
*
|
||||
|
||||
@@ -10632,20 +10632,6 @@ void bgunRender(Gfx **gdlptr)
|
||||
|
||||
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;
|
||||
|
||||
|
||||
@@ -479,12 +479,6 @@ bool botTestPropForPickup(struct prop *prop, struct chrdata *chr)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!objCanPickupFromSafe(obj)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (1);
|
||||
|
||||
if (obj->type == OBJTYPE_WEAPON) {
|
||||
weaponobj = prop->weapon;
|
||||
itemtype = botinvGetItemType(chr, weaponobj->weaponnum);
|
||||
|
||||
@@ -2375,44 +2375,6 @@ s32 chrTick(struct prop *prop)
|
||||
child = next;
|
||||
}
|
||||
|
||||
if (chr->weapons_held[2] != NULL) {
|
||||
s32 index;
|
||||
struct defaultobj *obj = chr->weapons_held[2]->obj;
|
||||
struct model *hatmodel = obj->model;
|
||||
|
||||
if (chr->headnum >= HEAD_SHAUN && chr->headnum <= HEAD_SHAUN) {
|
||||
struct coord hatpos = {0, 0, 0};
|
||||
f32 spe4;
|
||||
f32 spe0;
|
||||
f32 spdc;
|
||||
Mtxf sp9c;
|
||||
Mtxf sp5c;
|
||||
s32 hattype = hatGetType(chr->weapons_held[2]);
|
||||
u8 stack[0x0c];
|
||||
|
||||
index = chr->headnum - HEAD_SHAUN;
|
||||
|
||||
hatpos.x = var8007dae4[index][hattype].x * 21.3f;
|
||||
hatpos.y = var8007dae4[index][hattype].y * 21.3f;
|
||||
hatpos.z = var8007dae4[index][hattype].z * 21.3f;
|
||||
|
||||
spe4 = var8007dae4[index][hattype].unk0c;
|
||||
spe0 = var8007dae4[index][hattype].unk10;
|
||||
spdc = var8007dae4[index][hattype].unk14;
|
||||
|
||||
mtx4LoadTranslation(&hatpos, &sp9c);
|
||||
mtx00015e24(spe4, &sp9c);
|
||||
mtx00015e80(spe0, &sp9c);
|
||||
mtx00015edc(spdc, &sp9c);
|
||||
mtx00015be4(hatmodel->matrices, &sp9c, &sp5c);
|
||||
mtx4Copy(&sp5c, hatmodel->matrices);
|
||||
|
||||
if (hattype == HATTYPE_2) {
|
||||
hatvisible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (model->filedata->skel == &g_SkelChr) {
|
||||
struct modelnode *headspotnode = modelGetPart(model->filedata, MODELPART_CHR_HEADSPOT);
|
||||
|
||||
|
||||
@@ -2164,28 +2164,6 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse
|
||||
}
|
||||
}
|
||||
|
||||
// Handle hat shots. This is left over from GE, as hats don't exist in PD
|
||||
if (damage > 0 && hitpart == HITPART_HAT && chr->weapons_held[2]) {
|
||||
s32 type = hatGetType(chr->weapons_held[2]);
|
||||
|
||||
if (type == HATTYPE_CLOTH) {
|
||||
// Hat remains on head and damages the chr (eg. Moonraker Elite)
|
||||
hitpart = HITPART_HEAD;
|
||||
} else if (type != HATTYPE_METAL) {
|
||||
// Normal hat
|
||||
damage = 0;
|
||||
objSetDropped(chr->weapons_held[2], DROPTYPE_HAT);
|
||||
chr->hidden |= CHRHFLAG_00000001;
|
||||
} else {
|
||||
// Metal helmets don't fall off and make a metallic chink noise when shot
|
||||
u16 sounds[] = { SFX_HIT_METAL_807B, SFX_HIT_METAL_8079, SFX_HATHIT_807C };
|
||||
damage = 0;
|
||||
|
||||
propsnd0f0939f8(NULL, chr->prop, sounds[random() % 3], -1,
|
||||
-1, 0, 0, 0, NULL, -1, NULL, -1, -1, -1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle incrementing player shot count
|
||||
if (aprop && aprop->type == PROPTYPE_PLAYER && !explosion) {
|
||||
bool alreadydead = false;
|
||||
|
||||
@@ -938,12 +938,6 @@ char *invGetShortNameByIndex(s32 index)
|
||||
return bgunGetShortName(weaponnum);
|
||||
}
|
||||
|
||||
void invInsertTextOverride(struct textoverride *override)
|
||||
{
|
||||
override->next = g_Vars.textoverrides;
|
||||
g_Vars.textoverrides = override;
|
||||
}
|
||||
|
||||
u32 invGetCurrentIndex(void)
|
||||
{
|
||||
return g_Vars.currentplayer->equipcuritem;
|
||||
|
||||
@@ -1448,8 +1448,6 @@ void lvUpdateSoloHandicaps(void)
|
||||
frac = (totalhealth - 0.125f) * 0.5f / 0.47500002384186f + 0.5f;
|
||||
}
|
||||
|
||||
g_CctvWaitScale = 2;
|
||||
g_CctvDamageRxScale = 2;
|
||||
g_AutogunAccuracyScale = 0.5f * frac;
|
||||
g_AutogunDamageTxScale = 0.5f * frac;
|
||||
g_AutogunDamageRxScale = 2;
|
||||
@@ -1779,7 +1777,6 @@ void lvTick(void)
|
||||
|
||||
musicTick();
|
||||
langTick();
|
||||
propsTickPadEffects();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -562,110 +562,3 @@ s32 waypointFindRoute(struct waypoint *frompoint, struct waypoint *topoint, stru
|
||||
|
||||
return arrptr - arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable the segment from A to B.
|
||||
*
|
||||
* This works by removing B from A's neighbour list. If B isn't a neighbour of
|
||||
* A (ie. segment is already disabled) then no operation is performed.
|
||||
*
|
||||
* Once B is removed from A's list, the function then updates the group
|
||||
* neighbours too. If the segment being removed is the last link between
|
||||
* A's group and B's group then group B is removed from group A's neighbour
|
||||
* list.
|
||||
*/
|
||||
void waypointDisableSegmentInDirection(struct waypoint *a, struct waypoint *b)
|
||||
{
|
||||
struct waygroup *agroup = &g_StageSetup.waygroups[a->groupnum];
|
||||
s32 bindex = b - g_StageSetup.waypoints;
|
||||
s32 bgroupnum = b->groupnum;
|
||||
bool foundlink = false;
|
||||
s32 i;
|
||||
s32 j;
|
||||
s32 tmp;
|
||||
|
||||
// Find index of the neighbour point to remove, or index of end if not found
|
||||
for (i = 0; (tmp = a->neighbours[i]) >= 0 && (tmp & 0x3fff) != bindex; i++);
|
||||
|
||||
// If neighbour was found, shuffle the rest of the neighbour list back by
|
||||
// one, effectively removing it.
|
||||
if ((tmp & 0x3fff) == bindex) {
|
||||
for (; a->neighbours[i] >= 0; i++) {
|
||||
a->neighbours[i] = a->neighbours[i + 1];
|
||||
}
|
||||
}
|
||||
|
||||
// Check if group A still contains any waypoints who have neighbours in
|
||||
// group B.
|
||||
for (i = 0; (tmp = agroup->waypoints[i]) >= 0 && !foundlink; i++) {
|
||||
struct waypoint *apoint = &g_StageSetup.waypoints[tmp];
|
||||
|
||||
for (j = 0; (tmp = apoint->neighbours[j]) >= 0 && !foundlink; j++) {
|
||||
struct waypoint *neighbour = &g_StageSetup.waypoints[tmp & 0x3fff];
|
||||
|
||||
if (neighbour->groupnum == bgroupnum) {
|
||||
foundlink = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If no link was found, remove group B from group A's neighbour list
|
||||
if (!foundlink) {
|
||||
for (i = 0; (tmp = agroup->neighbours[i]) >= 0 && (tmp & 0x3fff) != bgroupnum; i++);
|
||||
|
||||
if ((tmp & 0x3fff) == bgroupnum) {
|
||||
for (; agroup->neighbours[i] >= 0; i++) {
|
||||
agroup->neighbours[i] = agroup->neighbours[i + 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable the segment from A to B.
|
||||
*
|
||||
* This works by adding B to A's neighbour list. If B is already a neighbour of
|
||||
* A (ie. segment is already enabled) then no operation is performed.
|
||||
*
|
||||
* This code assumes that A's neighbours array is big enough to add the new
|
||||
* neighbour, which it will be if B was disabled previously.
|
||||
*/
|
||||
void waypointEnableSegmentInDirection(struct waypoint *a, struct waypoint *b)
|
||||
{
|
||||
struct waygroup *agroup = &g_StageSetup.waygroups[a->groupnum];
|
||||
s32 bpointnum = b - g_StageSetup.waypoints;
|
||||
s32 bgroupnum = b->groupnum;
|
||||
s32 neighbournum;
|
||||
s32 i;
|
||||
|
||||
// Find index in A's neighbour list where B can be added.
|
||||
// This will either be at the -1 terminator, or if B already exists in the
|
||||
// list then the index of B.
|
||||
for (i = 0; (neighbournum = a->neighbours[i]) >= 0 && (neighbournum & 0x3fff) != bpointnum; i++);
|
||||
|
||||
// Add B to A's neighbour list if it doesn't exist
|
||||
if ((neighbournum & 0x3fff) != bpointnum) {
|
||||
a->neighbours[i] = bpointnum;
|
||||
a->neighbours[i + 1] = -1;
|
||||
}
|
||||
|
||||
// Now the same for groups. Make sure B's group is a neighbour of A's group.
|
||||
for (i = 0; (neighbournum = agroup->neighbours[i]) >= 0 && (neighbournum & 0x3fff) != bgroupnum; i++);
|
||||
|
||||
if (bgroupnum != (neighbournum & 0x3fff)) {
|
||||
agroup->neighbours[i] = bgroupnum;
|
||||
agroup->neighbours[i + 1] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void waypointDisableSegment(struct waypoint *a, struct waypoint *b)
|
||||
{
|
||||
waypointDisableSegmentInDirection(a, b);
|
||||
waypointDisableSegmentInDirection(b, a);
|
||||
}
|
||||
|
||||
void waypointEnableSegment(struct waypoint *a, struct waypoint *b)
|
||||
{
|
||||
waypointEnableSegmentInDirection(a, b);
|
||||
waypointEnableSegmentInDirection(b, a);
|
||||
}
|
||||
|
||||
@@ -2199,80 +2199,6 @@ void propsTickPlayer(bool islastplayer)
|
||||
chr0f02472c();
|
||||
}
|
||||
|
||||
void propsTickPadEffects(void)
|
||||
{
|
||||
s32 i;
|
||||
struct pad pad;
|
||||
u32 stack;
|
||||
struct coord up;
|
||||
s16 rooms[2];
|
||||
s16 rooms2[2];
|
||||
s32 type;
|
||||
|
||||
if (g_LastPadEffectIndex >= 0) {
|
||||
for (i = 0; i <= g_LastPadEffectIndex; i++) {
|
||||
struct padeffectobj *effect = &g_PadEffects[i];
|
||||
|
||||
padUnpack(effect->pad, PADFIELD_ROOM, &pad);
|
||||
|
||||
if (roomIsOnscreen(pad.room)) {
|
||||
switch (effect->effect) {
|
||||
case PADEFFECT_SPARKS:
|
||||
case PADEFFECT_SPARKS2:
|
||||
rooms[0] = pad.room;
|
||||
rooms[1] = -1;
|
||||
|
||||
padUnpack(effect->pad, PADFIELD_POS | PADFIELD_UP, &pad);
|
||||
|
||||
up.x = -pad.up.x;
|
||||
up.y = -pad.up.y;
|
||||
up.z = -pad.up.z;
|
||||
|
||||
if ((random() % 2048) <= 50) {
|
||||
sparksCreate(rooms[0], NULL, &pad.pos, &up, &pad.up, SPARKTYPE_ENVIRONMENTAL1);
|
||||
propsnd0f0939f8(NULL, NULL, propsndGetRandomSparkSound(), -1, -1, 0, 0, 0, &pad.pos, -1, rooms, -1, -1, -1, -1);
|
||||
}
|
||||
|
||||
if ((random() % 2048) <= 15) {
|
||||
sparksCreate(rooms[0], NULL, &pad.pos, &up, &pad.up, SPARKTYPE_ENVIRONMENTAL1);
|
||||
sparksCreate(rooms[0], NULL, &pad.pos, &up, &pad.up, SPARKTYPE_ENVIRONMENTAL2);
|
||||
propsnd0f0939f8(NULL, NULL, propsndGetRandomSparkSound(), -1, -1, 0, 0, 0, &pad.pos, -1, rooms, -1, -1, -1, -1);
|
||||
}
|
||||
|
||||
if ((random() % 2048) <= 5) {
|
||||
sparksCreate(rooms[0], NULL, &pad.pos, &up, &pad.up, SPARKTYPE_ENVIRONMENTAL1);
|
||||
sparksCreate(rooms[0], NULL, &pad.pos, &up, &pad.up, SPARKTYPE_ENVIRONMENTAL3);
|
||||
propsnd0f0939f8(NULL, NULL, propsndGetRandomSparkSound(), -1, -1, 0, 0, 0, &pad.pos, -1, rooms, -1, -1, -1, -1);
|
||||
}
|
||||
break;
|
||||
case PADEFFECT_SPLASH:
|
||||
case PADEFFECT_SMOKE:
|
||||
type = SMOKETYPE_WATER;
|
||||
|
||||
switch (effect->effect) {
|
||||
case PADEFFECT_SPLASH:
|
||||
type = SMOKETYPE_WATER;
|
||||
break;
|
||||
case PADEFFECT_SMOKE:
|
||||
case PADEFFECT_OUTROSMOKE:
|
||||
type = SMOKETYPE_DEBRIS;
|
||||
break;
|
||||
}
|
||||
|
||||
rooms2[0] = pad.room;
|
||||
rooms2[1] = -1;
|
||||
|
||||
padUnpack(effect->pad, PADFIELD_POS | PADFIELD_UP, &pad);
|
||||
smokeCreateAtPadEffect(effect, &pad.pos, rooms2, type);
|
||||
break;
|
||||
case PADEFFECT_01:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void propSetPerimEnabled(struct prop *prop, s32 enable)
|
||||
{
|
||||
if (prop->type == PROPTYPE_CHR) {
|
||||
@@ -2796,11 +2722,6 @@ bool propIsOfCdType(struct prop *prop, u32 types)
|
||||
result = false;
|
||||
}
|
||||
|
||||
if ((types & CDTYPE_OBJSNOTSAFEORHELI)
|
||||
&& (obj->type == OBJTYPE_SAFE || obj->type == OBJTYPE_HELI)) {
|
||||
result = false;
|
||||
}
|
||||
|
||||
if ((obj->flags & OBJFLAG_PATHBLOCKER)) {
|
||||
if ((types & CDTYPE_PATHBLOCKER) == 0) {
|
||||
result = false;
|
||||
|
||||
+5
-2474
File diff suppressed because it is too large
Load Diff
@@ -39,132 +39,6 @@ u32 var8009cc34;
|
||||
u32 var8009cc38;
|
||||
u32 var8009cc3c;
|
||||
|
||||
struct tvscreen var80061a80 = {
|
||||
g_TvCmdlist00, // cmdlist
|
||||
0, // offset
|
||||
0xffff, // pause60
|
||||
0, // tconfig
|
||||
0, // rot
|
||||
1, // xscale
|
||||
0, // xscalefrac
|
||||
0, // xscaleinc
|
||||
1, // xscaleold
|
||||
1, // xscalenew
|
||||
1, // yscale
|
||||
0, // yscalefrac
|
||||
0, // yscaleinc
|
||||
1, // yscaleold
|
||||
1, // yscalenew
|
||||
0.5, // xmid
|
||||
0, // xmidfrac
|
||||
0, // xmidinc
|
||||
0.5, // xmidold
|
||||
0.5, // xmidnew
|
||||
0.5, // ymid
|
||||
0, // ymidfrac
|
||||
0, // ymidinc
|
||||
0.5, // ymidold
|
||||
0.5, // ymidnew
|
||||
0xff, // red
|
||||
0xff, // redold
|
||||
0xff, // rednew
|
||||
0xff, // green
|
||||
0xff, // greenold
|
||||
0xff, // greennew
|
||||
0xff, // blue
|
||||
0xff, // blueold
|
||||
0xff, // bluenew
|
||||
0xff, // alpha
|
||||
0xff, // alphaold
|
||||
0xff, // alphanew
|
||||
1, // colfrac
|
||||
0, // colinc
|
||||
};
|
||||
|
||||
struct tvscreen var80061af4 = {
|
||||
var8006aaa0, // cmdlist
|
||||
0, // offset
|
||||
0xffff, // pause60
|
||||
0, // tconfig
|
||||
0, // rot
|
||||
1, // xscale
|
||||
0, // xscalefrac
|
||||
0, // xscaleinc
|
||||
1, // xscaleold
|
||||
1, // xscalenew
|
||||
1, // yscale
|
||||
0, // yscalefrac
|
||||
0, // yscaleinc
|
||||
1, // yscaleold
|
||||
1, // yscalenew
|
||||
0.5, // xmid
|
||||
0, // xmidfrac
|
||||
0, // xmidinc
|
||||
0.5, // xmidold
|
||||
0.5, // xmidnew
|
||||
0.5, // ymid
|
||||
0, // ymidfrac
|
||||
0, // ymidinc
|
||||
0.5, // ymidold
|
||||
0.5, // ymidnew
|
||||
0xff, // red
|
||||
0xff, // redold
|
||||
0xff, // rednew
|
||||
0xff, // green
|
||||
0xff, // greenold
|
||||
0xff, // greennew
|
||||
0xff, // blue
|
||||
0xff, // blueold
|
||||
0xff, // bluenew
|
||||
0xff, // alpha
|
||||
0xff, // alphaold
|
||||
0xff, // alphanew
|
||||
1, // colfrac
|
||||
0, // colinc
|
||||
};
|
||||
|
||||
struct tvscreen var80061b68 = {
|
||||
var8006aae4, // cmdlist
|
||||
0, // offset
|
||||
0xffff, // pause60
|
||||
0, // tconfig
|
||||
0, // rot
|
||||
1, // xscale
|
||||
0, // xscalefrac
|
||||
0, // xscaleinc
|
||||
1, // xscaleold
|
||||
1, // xscalenew
|
||||
1, // yscale
|
||||
0, // yscalefrac
|
||||
0, // yscaleinc
|
||||
1, // yscaleold
|
||||
1, // yscalenew
|
||||
0.5, // xmid
|
||||
0, // xmidfrac
|
||||
0, // xmidinc
|
||||
0.5, // xmidold
|
||||
0.5, // xmidnew
|
||||
0.5, // ymid
|
||||
0, // ymidfrac
|
||||
0, // ymidinc
|
||||
0.5, // ymidold
|
||||
0.5, // ymidnew
|
||||
0xff, // red
|
||||
0xff, // redold
|
||||
0xff, // rednew
|
||||
0xff, // green
|
||||
0xff, // greenold
|
||||
0xff, // greennew
|
||||
0xff, // blue
|
||||
0xff, // blueold
|
||||
0xff, // bluenew
|
||||
0xff, // alpha
|
||||
0xff, // alphaold
|
||||
0xff, // alphanew
|
||||
1, // colfrac
|
||||
0, // colinc
|
||||
};
|
||||
|
||||
u32 var80061bdc = 0x00000000;
|
||||
f32 g_DoorScale = 1;
|
||||
u32 var80061be4 = 0x00000000;
|
||||
@@ -191,26 +65,8 @@ void propsReset(void)
|
||||
g_MaxEmbedments = 0;
|
||||
}
|
||||
|
||||
setupReset0f00cc8c();
|
||||
setupResetProxyMines();
|
||||
|
||||
g_AlarmTimer = 0;
|
||||
g_AlarmAudioHandle = NULL;
|
||||
g_AlarmSpeakerWeight = 64;
|
||||
|
||||
g_GasReleaseTimer240 = 0;
|
||||
g_GasReleasing = false;
|
||||
g_GasPos.x = 0;
|
||||
g_GasPos.y = 0;
|
||||
g_GasPos.z = 0;
|
||||
g_GasLastCough60 = 0;
|
||||
g_GasSoundTimer240 = 0;
|
||||
g_GasAudioHandle = NULL;
|
||||
|
||||
g_CountdownTimerOff = COUNTDOWNTIMERREASON_AI;
|
||||
g_CountdownTimerRunning = false;
|
||||
g_CountdownTimerValue60 = 0;
|
||||
|
||||
g_PlayersDetonatingMines = 0;
|
||||
g_TintedGlassEnabled = false;
|
||||
|
||||
@@ -257,15 +113,9 @@ void propsReset(void)
|
||||
}
|
||||
|
||||
g_LiftDoors = NULL;
|
||||
g_PadlockedDoors = NULL;
|
||||
g_SafeItems = NULL;
|
||||
g_LinkedScenery = NULL;
|
||||
g_BlockedPaths = NULL;
|
||||
|
||||
g_EmbedProp = NULL;
|
||||
g_EmbedHitPart = -1;
|
||||
g_CctvWaitScale = 1;
|
||||
g_CctvDamageRxScale = 1;
|
||||
g_AutogunAccuracyScale = 1;
|
||||
g_AutogunDamageTxScale = 1;
|
||||
g_AutogunDamageRxScale = 1;
|
||||
@@ -287,46 +137,6 @@ void setupCreateLiftDoor(struct linkliftdoorobj *link)
|
||||
g_LiftDoors = link;
|
||||
}
|
||||
|
||||
void setupCreatePadlockedDoor(struct padlockeddoorobj *link)
|
||||
{
|
||||
link->next = g_PadlockedDoors;
|
||||
g_PadlockedDoors = link;
|
||||
}
|
||||
|
||||
void setupCreateSafeItem(struct safeitemobj *link)
|
||||
{
|
||||
link->next = g_SafeItems;
|
||||
g_SafeItems = link;
|
||||
}
|
||||
|
||||
void setupCreateConditionalScenery(struct linksceneryobj *link)
|
||||
{
|
||||
link->next = g_LinkedScenery;
|
||||
g_LinkedScenery = link;
|
||||
}
|
||||
|
||||
void setupCreateBlockedPath(struct blockedpathobj *blockedpath)
|
||||
{
|
||||
blockedpath->next = g_BlockedPaths;
|
||||
g_BlockedPaths = blockedpath;
|
||||
}
|
||||
|
||||
void setupReset0f00cc8c(void)
|
||||
{
|
||||
struct tvscreen tmp1;
|
||||
struct tvscreen tmp2;
|
||||
struct tvscreen tmp3;
|
||||
|
||||
tmp1 = var80061a80;
|
||||
var8009ce98 = tmp1;
|
||||
|
||||
tmp2 = var80061af4;
|
||||
var8009cf10 = tmp2;
|
||||
|
||||
tmp3 = var80061b68;
|
||||
var8009cf88 = tmp3;
|
||||
}
|
||||
|
||||
void setupResetProxyMines(void)
|
||||
{
|
||||
s32 i;
|
||||
@@ -656,226 +466,6 @@ void setupPlaceWeapon(struct weaponobj *weapon, s32 cmdindex)
|
||||
}
|
||||
}
|
||||
|
||||
void setupCreateHat(struct hatobj *hat, s32 cmdindex)
|
||||
{
|
||||
if (hat->base.flags & OBJFLAG_ASSIGNEDTOCHR) {
|
||||
struct chrdata *chr = chrFindByLiteralId(hat->base.pad);
|
||||
|
||||
if (chr && chr->prop && chr->model) {
|
||||
hatAssignToChr(hat, chr);
|
||||
}
|
||||
} else {
|
||||
setupCreateObject(&hat->base, cmdindex);
|
||||
}
|
||||
}
|
||||
|
||||
void setupCreateKey(struct keyobj *key, s32 cmdindex)
|
||||
{
|
||||
setupCreateObject(&key->base, cmdindex);
|
||||
}
|
||||
|
||||
void setupCreateMine(struct mineobj *mine, s32 cmdindex)
|
||||
{
|
||||
mine->base.type = OBJTYPE_WEAPON;
|
||||
|
||||
setupCreateObject(&mine->base, cmdindex);
|
||||
|
||||
mine->base.prop->forcetick = true;
|
||||
}
|
||||
|
||||
void setupCreateCctv(struct cctvobj *cctv, s32 cmdindex)
|
||||
{
|
||||
struct defaultobj *obj = &cctv->base;
|
||||
|
||||
setupCreateObject(obj, cmdindex);
|
||||
|
||||
if (cctv->lookatpadnum >= 0) {
|
||||
struct coord lenspos;
|
||||
union modelrodata *lens = modelGetPartRodata(obj->model->filedata, MODELPART_CCTV_CASING);
|
||||
struct pad pad;
|
||||
f32 xdiff;
|
||||
f32 ydiff;
|
||||
f32 zdiff;
|
||||
|
||||
padUnpack(cctv->lookatpadnum, PADFIELD_POS, &pad);
|
||||
|
||||
lenspos.x = lens->position.pos.x;
|
||||
lenspos.y = lens->position.pos.y;
|
||||
lenspos.z = lens->position.pos.z;
|
||||
|
||||
mtx00016208(obj->realrot, &lenspos);
|
||||
|
||||
lenspos.x += obj->prop->pos.x;
|
||||
lenspos.y += obj->prop->pos.y;
|
||||
lenspos.z += obj->prop->pos.z;
|
||||
|
||||
xdiff = lenspos.x - pad.pos.x;
|
||||
ydiff = lenspos.y - pad.pos.y;
|
||||
zdiff = lenspos.z - pad.pos.z;
|
||||
|
||||
if (ydiff) {
|
||||
// empty
|
||||
}
|
||||
|
||||
mtx00016d58(&cctv->camrotm, 0.0f, 0.0f, 0.0f, xdiff, ydiff, zdiff, 0.0f, 1.0f, 0.0f);
|
||||
mtx00015f04(obj->model->scale, &cctv->camrotm);
|
||||
|
||||
cctv->toleft = 0;
|
||||
cctv->yleft = *(s32 *)&cctv->yleft * M_BADTAU / 65536.0f;
|
||||
cctv->yright = *(s32 *)&cctv->yright * M_BADTAU / 65536.0f;
|
||||
cctv->yspeed = 0.0f;
|
||||
cctv->ymaxspeed = *(s32 *)&cctv->ymaxspeed * M_BADTAU / 65536.0f;
|
||||
cctv->maxdist = *(s32 *)&cctv->maxdist;
|
||||
cctv->yrot = cctv->yleft;
|
||||
|
||||
cctv->yzero = atan2f(xdiff, zdiff);
|
||||
cctv->xzero = M_BADTAU - atan2f(ydiff, sqrtf(xdiff * xdiff + zdiff * zdiff));
|
||||
|
||||
if (xdiff || zdiff) {
|
||||
// empty
|
||||
}
|
||||
|
||||
cctv->seebondtime60 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void setupCreateAutogun(struct autogunobj *autogun, s32 cmdindex)
|
||||
{
|
||||
setupCreateObject(&autogun->base, cmdindex);
|
||||
|
||||
autogun->maxspeed = *(s32 *)&autogun->maxspeed * PALUPF(M_BADTAU) / 65536.0f;
|
||||
autogun->aimdist = *(s32 *)&autogun->aimdist * 100.0f / 65536.0f;
|
||||
autogun->ymaxleft = *(s32 *)&autogun->ymaxleft * M_BADTAU / 65536.0f;
|
||||
autogun->ymaxright = *(s32 *)&autogun->ymaxright * M_BADTAU / 65536.0f;
|
||||
|
||||
autogun->firecount = 0;
|
||||
autogun->lastseebond60 = -1;
|
||||
autogun->lastaimbond60 = -1;
|
||||
autogun->allowsoundframe = -1;
|
||||
autogun->yrot = 0;
|
||||
autogun->yspeed = 0;
|
||||
autogun->yzero = 0;
|
||||
autogun->xrot = 0;
|
||||
autogun->xspeed = 0;
|
||||
autogun->xzero = 0;
|
||||
autogun->barrelspeed = 0;
|
||||
autogun->barrelrot = 0;
|
||||
autogun->beam = mempAlloc(ALIGN16(sizeof(struct beam)), MEMPOOL_STAGE);
|
||||
autogun->beam->age = -1;
|
||||
autogun->firing = false;
|
||||
autogun->ammoquantity = 255;
|
||||
autogun->shotbondsum = 0;
|
||||
|
||||
if (autogun->targetpad >= 0) {
|
||||
u32 stack1;
|
||||
f32 xdiff;
|
||||
f32 ydiff;
|
||||
f32 zdiff;
|
||||
u32 stack2;
|
||||
struct pad pad;
|
||||
|
||||
padUnpack(autogun->targetpad, PADFIELD_POS, &pad);
|
||||
|
||||
xdiff = pad.pos.x - autogun->base.prop->pos.x;
|
||||
ydiff = pad.pos.y - autogun->base.prop->pos.y;
|
||||
zdiff = pad.pos.z - autogun->base.prop->pos.z;
|
||||
|
||||
autogun->yzero = atan2f(xdiff, zdiff);
|
||||
autogun->xzero = atan2f(ydiff, sqrtf(xdiff * xdiff + zdiff * zdiff));
|
||||
} else if (autogun->base.modelnum == MODEL_CETROOFGUN) {
|
||||
// Deep Sea roofgun
|
||||
autogun->xzero = -1.5705462694168f;
|
||||
}
|
||||
}
|
||||
|
||||
void setupCreateHangingMonitors(struct hangingmonitorsobj *monitors, s32 cmdindex)
|
||||
{
|
||||
setupCreateObject(&monitors->base, cmdindex);
|
||||
}
|
||||
|
||||
void setupCreateSingleMonitor(struct singlemonitorobj *monitor, s32 cmdindex)
|
||||
{
|
||||
u32 stack[2];
|
||||
|
||||
monitor->screen = var8009ce98;
|
||||
tvscreenSetImageByNum(&monitor->screen, monitor->imagenum);
|
||||
|
||||
// In GE, monitors with a negative pad are hanging TVs which attach to a
|
||||
// hangingmonitors object, which is actually just the mount. In PD, hanging
|
||||
// monitors do not exist in the setup files so this code is unused.
|
||||
if (monitor->base.pad < 0 && (monitor->base.flags & OBJFLAG_INSIDEANOTHEROBJ) == 0) {
|
||||
s32 modelnum = monitor->base.modelnum;
|
||||
struct defaultobj *owner = (struct defaultobj *)setupGetCmdByIndex(cmdindex + monitor->owneroffset);
|
||||
struct prop *prop;
|
||||
f32 scale;
|
||||
struct coord spa4;
|
||||
Mtxf sp64;
|
||||
Mtxf sp24;
|
||||
|
||||
setupLoadModeldef(modelnum);
|
||||
|
||||
scale = monitor->base.extrascale * (1.0f / 256.0f);
|
||||
|
||||
if (g_Vars.normmplayerisrunning || g_Vars.lvmpbotlevel) {
|
||||
monitor->base.hidden2 |= OBJH2FLAG_CANREGEN;
|
||||
}
|
||||
|
||||
prop = objInitWithAutoModel(&monitor->base);
|
||||
monitor->base.embedment = embedmentAllocate();
|
||||
|
||||
if (prop && monitor->base.embedment) {
|
||||
monitor->base.hidden |= OBJHFLAG_EMBEDDED;
|
||||
modelSetScale(monitor->base.model, monitor->base.model->scale * scale);
|
||||
monitor->base.model->attachedtomodel = owner->model;
|
||||
|
||||
if (monitor->ownerpart == MODELPART_0000) {
|
||||
monitor->base.model->attachedtonode = modelGetPart(owner->model->filedata, MODELPART_0000);
|
||||
} else if (monitor->ownerpart == MODELPART_0001) {
|
||||
monitor->base.model->attachedtonode = modelGetPart(owner->model->filedata, MODELPART_0001);
|
||||
} else if (monitor->ownerpart == MODELPART_0002) {
|
||||
monitor->base.model->attachedtonode = modelGetPart(owner->model->filedata, MODELPART_0002);
|
||||
} else {
|
||||
monitor->base.model->attachedtonode = modelGetPart(owner->model->filedata, MODELPART_0003);
|
||||
}
|
||||
|
||||
propReparent(prop, owner->prop);
|
||||
mtx4LoadXRotation(0.3664608001709f, &sp64);
|
||||
mtx00015f04(monitor->base.model->scale / owner->model->scale, &sp64);
|
||||
modelGetRootPosition(monitor->base.model, &spa4);
|
||||
|
||||
spa4.x = -spa4.x;
|
||||
spa4.y = -spa4.y;
|
||||
spa4.z = -spa4.z;
|
||||
|
||||
mtx4LoadTranslation(&spa4, &sp24);
|
||||
mtx00015be4(&sp64, &sp24, &monitor->base.embedment->matrix);
|
||||
}
|
||||
} else {
|
||||
setupCreateObject(&monitor->base, cmdindex);
|
||||
}
|
||||
|
||||
if (monitor->base.prop && (monitor->base.flags & OBJFLAG_MONITOR_RENDERPOSTBG)) {
|
||||
monitor->base.prop->flags |= PROPFLAG_RENDERPOSTBG;
|
||||
}
|
||||
}
|
||||
|
||||
void setupCreateMultiMonitor(struct multimonitorobj *monitor, s32 cmdindex)
|
||||
{
|
||||
monitor->screens[0] = var8009ce98;
|
||||
tvscreenSetImageByNum(&monitor->screens[0], monitor->imagenums[0]);
|
||||
|
||||
monitor->screens[1] = var8009ce98;
|
||||
tvscreenSetImageByNum(&monitor->screens[1], monitor->imagenums[1]);
|
||||
|
||||
monitor->screens[2] = var8009ce98;
|
||||
tvscreenSetImageByNum(&monitor->screens[2], monitor->imagenums[2]);
|
||||
|
||||
monitor->screens[3] = var8009ce98;
|
||||
tvscreenSetImageByNum(&monitor->screens[3], monitor->imagenums[3]);
|
||||
|
||||
setupCreateObject(&monitor->base, cmdindex);
|
||||
}
|
||||
|
||||
s32 setupGetPortalByPad(s32 padnum)
|
||||
{
|
||||
f32 mult;
|
||||
@@ -1109,9 +699,6 @@ void setupLoadFiles(s32 stagenum)
|
||||
u16 filenum;
|
||||
bool modified;
|
||||
|
||||
g_PadEffects = NULL;
|
||||
g_LastPadEffectIndex = -1;
|
||||
|
||||
g_DoorScale = 1;
|
||||
|
||||
for (i = 0; i < NUM_MODELS; i++) {
|
||||
@@ -1281,88 +868,11 @@ void setupCreateProps(s32 stagenum)
|
||||
|
||||
while (obj->type != OBJTYPE_END) {
|
||||
switch (obj->type) {
|
||||
case OBJTYPE_GRENADEPROB:
|
||||
{
|
||||
struct grenadeprobobj *grenadeprob = (struct grenadeprobobj *)obj;
|
||||
u8 probability = grenadeprob->probability;
|
||||
struct chrdata *chr = chrFindByLiteralId(grenadeprob->chrnum);
|
||||
|
||||
if (chr && chr->prop && chr->model) {
|
||||
chr->grenadeprob = probability;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_CHR:
|
||||
if (withchrs) {
|
||||
bodyAllocateChr(stagenum, (struct packedchr *) obj, index);
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_DOOR:
|
||||
if (withobjs && (obj->flags2 & diffflag) == 0) {
|
||||
setupCreateDoor((struct doorobj *)obj, index);
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_DOORSCALE:
|
||||
{
|
||||
struct doorscaleobj *scale = (struct doorscaleobj *)obj;
|
||||
g_DoorScale = scale->scale / 65536.0f;
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_WEAPON:
|
||||
if (withchrs && (obj->flags2 & diffflag) == 0) {
|
||||
setupPlaceWeapon((struct weaponobj *)obj, index);
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_KEY:
|
||||
if (withchrs && (obj->flags2 & diffflag) == 0) {
|
||||
setupCreateKey((struct keyobj *)obj, index);
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_HAT:
|
||||
if (withchrs && (obj->flags2 & diffflag) == 0) {
|
||||
setupCreateHat((struct hatobj *)obj, index);
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_CCTV:
|
||||
if (withobjs && (obj->flags2 & diffflag) == 0) {
|
||||
setupCreateCctv((struct cctvobj *)obj, index);
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_AUTOGUN:
|
||||
if (withobjs && (obj->flags2 & diffflag) == 0) {
|
||||
setupCreateAutogun((struct autogunobj *)obj, index);
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_HANGINGMONITORS:
|
||||
if (withobjs && (obj->flags2 & diffflag) == 0) {
|
||||
setupCreateHangingMonitors((struct hangingmonitorsobj *)obj, index);
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_SINGLEMONITOR:
|
||||
if (withobjs && (obj->flags2 & diffflag) == 0) {
|
||||
setupCreateSingleMonitor((struct singlemonitorobj *)obj, index);
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_MULTIMONITOR:
|
||||
if (withobjs && (obj->flags2 & diffflag) == 0) {
|
||||
setupCreateMultiMonitor((struct multimonitorobj *)obj, index);
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_SHIELD:
|
||||
if (withobjs) {
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
if ((obj->flags2 & diffflag) == 0)
|
||||
#else
|
||||
if ((obj->flags2 & diffflag) == 0 || g_Jpn)
|
||||
#endif
|
||||
{
|
||||
struct shieldobj *shield = (struct shieldobj *)obj;
|
||||
shield->initialamount = *(s32 *)&shield->initialamount / 65536.0f;
|
||||
shield->amount = shield->initialamount;
|
||||
setupCreateObject(obj, index);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_TINTEDGLASS:
|
||||
if (withobjs && (obj->flags2 & diffflag) == 0) {
|
||||
if (obj->flags & OBJFLAG_GLASS_HASPORTAL) {
|
||||
@@ -1443,17 +953,6 @@ void setupCreateProps(s32 stagenum)
|
||||
setupCreateHov(obj, &hoverprop->hov);
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_FAN:
|
||||
if (withobjs && (obj->flags2 & diffflag) == 0) {
|
||||
struct fanobj *fan = (struct fanobj *)obj;
|
||||
|
||||
fan->yrot = 0;
|
||||
fan->ymaxspeed = PALUPF(*(s32 *)&fan->ymaxspeed) / 65536.0f;
|
||||
fan->yaccel = PALUPF(*(s32 *)&fan->yaccel) / 65536.0f;
|
||||
|
||||
setupCreateObject(obj, index);
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_GLASS:
|
||||
if (withobjs && (obj->flags2 & diffflag) == 0) {
|
||||
if (obj->flags & OBJFLAG_GLASS_HASPORTAL) {
|
||||
@@ -1464,49 +963,8 @@ void setupCreateProps(s32 stagenum)
|
||||
setupCreateObject(obj, index);
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_ESCASTEP:
|
||||
if (withobjs && (obj->flags2 & diffflag) == 0) {
|
||||
struct escalatorobj *step = (struct escalatorobj *)obj;
|
||||
struct prop *prop;
|
||||
|
||||
// TODO: There is a stack problem here that should be
|
||||
// resolved. sp1a8 is really an Mtxf which doesn't fit
|
||||
// in its current location in the stack.
|
||||
f32 sp1a8[12];
|
||||
f32 sp184[3][3];
|
||||
|
||||
setupCreateObject(obj, index);
|
||||
|
||||
prop = obj->prop;
|
||||
|
||||
if (prop) {
|
||||
step->prevpos.x = prop->pos.x;
|
||||
step->prevpos.y = prop->pos.y;
|
||||
step->prevpos.z = prop->pos.z;
|
||||
}
|
||||
|
||||
if (obj->flags & OBJFLAG_ESCSTEP_ZALIGNED) {
|
||||
step->frame = escstepy;
|
||||
escstepy += 40;
|
||||
mtx4LoadYRotation(4.7116389274597f, (Mtxf *)sp1a8);
|
||||
mtx4ToMtx3((Mtxf *)sp1a8, sp184);
|
||||
mtx00016110(sp184, obj->realrot);
|
||||
} else {
|
||||
step->frame = escstepx;
|
||||
escstepx += 40;
|
||||
mtx4LoadYRotation(M_BADPI, (Mtxf *)sp1a8);
|
||||
mtx4ToMtx3((Mtxf *)sp1a8, sp184);
|
||||
mtx00016110(sp184, obj->realrot);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_BASIC:
|
||||
case OBJTYPE_ALARM:
|
||||
case OBJTYPE_AMMOCRATE:
|
||||
case OBJTYPE_DEBRIS:
|
||||
case OBJTYPE_GASBOTTLE:
|
||||
case OBJTYPE_29:
|
||||
case OBJTYPE_SAFE:
|
||||
if (withobjs && (obj->flags2 & diffflag) == 0) {
|
||||
setupCreateObject(obj, index);
|
||||
}
|
||||
@@ -1541,158 +999,6 @@ void setupCreateProps(s32 stagenum)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_TRUCK:
|
||||
if (withobjs && (obj->flags2 & diffflag) == 0) {
|
||||
struct truckobj *truck = (struct truckobj *)obj;
|
||||
|
||||
setupCreateObject(obj, index);
|
||||
|
||||
if (obj->model) {
|
||||
struct modelnode *node = modelGetPart(obj->model->filedata, 5);
|
||||
|
||||
if (node) {
|
||||
union modelrwdata *rwdata = modelGetNodeRwData(obj->model, node);
|
||||
rwdata->type05.unk00 = ((obj->flags & OBJFLAG_DEACTIVATED) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
truck->speed = 0;
|
||||
truck->wheelxrot = 0;
|
||||
truck->wheelyrot = 0;
|
||||
truck->speedaim = 0;
|
||||
truck->speedtime60 = -1;
|
||||
truck->turnrot60 = 0;
|
||||
truck->roty = 0;
|
||||
truck->path = NULL;
|
||||
truck->nextstep = 0;
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_HOVERCAR:
|
||||
if (withhovercars && withobjs && (obj->flags2 & diffflag) == 0) {
|
||||
struct hovercarobj *car = (struct hovercarobj *)obj;
|
||||
struct prop *prop;
|
||||
|
||||
setupCreateObject(obj, index);
|
||||
|
||||
prop = obj->prop;
|
||||
|
||||
car->speed = 0;
|
||||
car->speedaim = 0;
|
||||
car->turnrot60 = 0;
|
||||
car->roty = 0;
|
||||
car->rotx = 0;
|
||||
car->speedtime60 = -1;
|
||||
car->path = NULL;
|
||||
car->nextstep = 0;
|
||||
|
||||
if (obj->flags & OBJFLAG_CHOPPER_INACTIVE) {
|
||||
prop->pos.y = cdFindFloorYColourTypeAtPos(&prop->pos, prop->rooms, NULL, 0) + 30;
|
||||
}
|
||||
|
||||
prop->forcetick = true;
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_CHOPPER:
|
||||
if (withobjs && (obj->flags2 & diffflag) == 0) {
|
||||
struct chopperobj *chopper = (struct chopperobj *)obj;
|
||||
|
||||
setupCreateObject(obj, index);
|
||||
|
||||
obj->flags |= OBJFLAG_20000000;
|
||||
obj->prop->forcetick = true;
|
||||
|
||||
chopper->turnrot60 = 0;
|
||||
chopper->roty = 0;
|
||||
chopper->rotx = 0;
|
||||
chopper->gunroty = 0;
|
||||
chopper->gunrotx = 0;
|
||||
chopper->barrelrot = 0;
|
||||
chopper->barrelrotspeed = 0;
|
||||
chopper->path = NULL;
|
||||
chopper->nextstep = 0;
|
||||
chopper->target = -1;
|
||||
chopper->targetvisible = false;
|
||||
chopper->attackmode = CHOPPERMODE_PATROL;
|
||||
chopper->vz = 0;
|
||||
chopper->vy = 0;
|
||||
chopper->vx = 0;
|
||||
chopper->otz = 0;
|
||||
chopper->oty = 0;
|
||||
chopper->otx = 0;
|
||||
chopper->power = 0;
|
||||
chopper->bob = 0;
|
||||
chopper->bobstrength = 0.05f;
|
||||
chopper->timer60 = 0;
|
||||
chopper->patroltimer60 = 0;
|
||||
chopper->cw = 0;
|
||||
chopper->weaponsarmed = true;
|
||||
chopper->fireslotthing = mempAlloc(sizeof(struct fireslotthing), MEMPOOL_STAGE);
|
||||
chopper->fireslotthing->beam = mempAlloc(ALIGN16(sizeof(struct beam)), MEMPOOL_STAGE);
|
||||
chopper->fireslotthing->beam->age = -1;
|
||||
chopper->fireslotthing->unk08 = -1;
|
||||
chopper->fireslotthing->unk00 = 0;
|
||||
chopper->fireslotthing->unk01 = 0;
|
||||
chopper->fireslotthing->unk0c = 0.85f;
|
||||
chopper->fireslotthing->unk10 = 0.2f;
|
||||
chopper->fireslotthing->unk14 = 0;
|
||||
chopper->dead = false;
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_HELI:
|
||||
if (withobjs && (obj->flags2 & diffflag) == 0) {
|
||||
struct heliobj *heli = (struct heliobj *)obj;
|
||||
|
||||
setupCreateObject(obj, index);
|
||||
|
||||
heli->speed = 0;
|
||||
heli->speedaim = 0;
|
||||
heli->rotoryrot = 0;
|
||||
heli->rotoryspeed = 0;
|
||||
heli->rotoryspeedaim = 0;
|
||||
heli->yrot = 0;
|
||||
heli->speedtime60 = -1;
|
||||
heli->rotoryspeedtime = -1;
|
||||
heli->path = NULL;
|
||||
heli->nextstep = 0;
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_RENAMEOBJ:
|
||||
{
|
||||
struct textoverride *override = (struct textoverride *)obj;
|
||||
struct defaultobj *targetobj = setupGetObjByCmdIndex(override->objoffset + index);
|
||||
override->obj = targetobj;
|
||||
|
||||
if (targetobj) {
|
||||
targetobj->hidden |= OBJHFLAG_HASTEXTOVERRIDE;
|
||||
}
|
||||
|
||||
invInsertTextOverride(override);
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_CAMERAPOS:
|
||||
{
|
||||
struct cameraposobj *camera = (struct cameraposobj *)obj;
|
||||
camera->x = *(s32 *)&camera->x / 100.0f;
|
||||
camera->y = *(s32 *)&camera->y / 100.0f;
|
||||
camera->z = *(s32 *)&camera->z / 100.0f;
|
||||
camera->theta = *(s32 *)&camera->theta / 65536.0f;
|
||||
camera->verta = *(s32 *)&camera->verta / 65536.0f;
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_PADEFFECT:
|
||||
{
|
||||
struct padeffectobj *padeffect = (struct padeffectobj *)obj;
|
||||
if (g_LastPadEffectIndex == -1) {
|
||||
g_PadEffects = padeffect;
|
||||
}
|
||||
g_LastPadEffectIndex++;
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_MINE:
|
||||
if (withobjs && (obj->flags2 & diffflag) == 0) {
|
||||
setupCreateMine((struct mineobj *)obj, index);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
obj = (struct defaultobj *)((u32 *)obj + setupGetCmdLength((u32 *)obj));
|
||||
@@ -1786,123 +1092,7 @@ void setupCreateProps(s32 stagenum)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_SAFEITEM:
|
||||
{
|
||||
struct safeitemobj *link = (struct safeitemobj *)obj;
|
||||
s32 itemoffset = (s32)link->item;
|
||||
s32 safeoffset = (s32)link->safe;
|
||||
s32 dooroffset = (s32)link->door;
|
||||
struct defaultobj *item = setupGetObjByCmdIndex(index + itemoffset);
|
||||
struct defaultobj *safe = setupGetObjByCmdIndex(index + safeoffset);
|
||||
struct defaultobj *door = setupGetObjByCmdIndex(index + dooroffset);
|
||||
|
||||
if (item && item->prop
|
||||
&& safe && safe->prop && safe->type == OBJTYPE_SAFE
|
||||
&& door && door->prop && door->type == OBJTYPE_DOOR) {
|
||||
link->item = item;
|
||||
link->safe = (struct safeobj *)safe;
|
||||
link->door = (struct doorobj *)door;
|
||||
|
||||
setupCreateSafeItem(link);
|
||||
|
||||
item->flags2 |= OBJFLAG2_LINKEDTOSAFE;
|
||||
door->flags2 |= OBJFLAG2_LINKEDTOSAFE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_PADLOCKEDDOOR:
|
||||
{
|
||||
struct padlockeddoorobj *link = (struct padlockeddoorobj *)obj;
|
||||
s32 dooroffset = (s32)link->door;
|
||||
s32 lockoffset = (s32)link->lock;
|
||||
struct defaultobj *door = setupGetObjByCmdIndex(index + dooroffset);
|
||||
struct defaultobj *lock = setupGetObjByCmdIndex(index + lockoffset);
|
||||
|
||||
if (door && door->prop && lock && lock->prop
|
||||
&& door->type == OBJTYPE_DOOR) {
|
||||
link->door = (struct doorobj *)door;
|
||||
link->lock = lock;
|
||||
|
||||
setupCreatePadlockedDoor(link);
|
||||
|
||||
door->hidden |= OBJHFLAG_PADLOCKEDDOOR;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_CONDITIONALSCENERY:
|
||||
{
|
||||
struct linksceneryobj *link = (struct linksceneryobj *)obj;
|
||||
s32 triggeroffset = (s32)link->trigger;
|
||||
s32 unexpoffset = (s32)link->unexp;
|
||||
s32 expoffset = (s32)link->exp;
|
||||
struct defaultobj *trigger = setupGetObjByCmdIndex(index + triggeroffset);
|
||||
struct defaultobj *unexp = NULL;
|
||||
struct defaultobj *exp = NULL;
|
||||
s32 alwayszero = 0;
|
||||
|
||||
if (unexpoffset) {
|
||||
unexp = setupGetObjByCmdIndex(index + unexpoffset);
|
||||
}
|
||||
|
||||
if (expoffset) {
|
||||
exp = setupGetObjByCmdIndex(index + expoffset);
|
||||
}
|
||||
|
||||
if (trigger && trigger->prop
|
||||
&& (unexpoffset == 0 || (unexp && unexp->prop))
|
||||
&& (expoffset == 0 || (exp && exp->prop))) {
|
||||
link->trigger = trigger;
|
||||
link->unexp = unexp;
|
||||
link->exp = exp;
|
||||
|
||||
setupCreateConditionalScenery(link);
|
||||
|
||||
trigger->hidden |= OBJHFLAG_CONDITIONALSCENERY;
|
||||
|
||||
if (unexpoffset) {
|
||||
unexp->hidden |= OBJHFLAG_CONDITIONALSCENERY;
|
||||
}
|
||||
|
||||
// This gets optimised out but makes v0 unavailable
|
||||
// for storing OBJHFLAG_CONDITIONALSCENERY, which is required
|
||||
// for a match. Any function call would work; I just
|
||||
// copied the one above.
|
||||
if (alwayszero) {
|
||||
setupCreateConditionalScenery(link);
|
||||
}
|
||||
|
||||
if (expoffset) {
|
||||
exp->hidden |= OBJHFLAG_CONDITIONALSCENERY;
|
||||
exp->flags2 |= OBJFLAG2_INVISIBLE;
|
||||
}
|
||||
|
||||
if (trigger->hidden & OBJHFLAG_02000000) {
|
||||
objSetBlockedPathUnblocked(trigger, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OBJTYPE_BLOCKEDPATH:
|
||||
{
|
||||
struct blockedpathobj *blockedpath = (struct blockedpathobj *)obj;
|
||||
s32 objoffset = (s32)blockedpath->blocker;
|
||||
struct defaultobj *blocker = setupGetObjByCmdIndex(index + objoffset);
|
||||
|
||||
if (blocker && blocker->prop) {
|
||||
blockedpath->blocker = blocker;
|
||||
|
||||
setupCreateBlockedPath(blockedpath);
|
||||
|
||||
blocker->hidden |= OBJHFLAG_02000000;
|
||||
|
||||
if (blocker->hidden & OBJHFLAG_CONDITIONALSCENERY) {
|
||||
objSetBlockedPathUnblocked(blocker, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
obj = (struct defaultobj *)((u32 *)obj + setupGetCmdLength((u32 *)obj));
|
||||
index++;
|
||||
}
|
||||
|
||||
@@ -415,11 +415,6 @@ void smokeCreateAtProp(struct prop *prop, s16 type)
|
||||
smokeCreateWithSource(prop, &prop->pos, prop->rooms, type, false);
|
||||
}
|
||||
|
||||
void smokeCreateAtPadEffect(struct padeffectobj *effect, struct coord *pos, s16 *rooms, s16 type)
|
||||
{
|
||||
smokeCreateWithSource(effect, pos, rooms, type, true);
|
||||
}
|
||||
|
||||
void smokeClearForProp(struct prop *prop)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#include <ultra64.h>
|
||||
#include "constants.h"
|
||||
#include "bss.h"
|
||||
#include "data.h"
|
||||
#include "game/padhalllv.h"
|
||||
#include "types.h"
|
||||
|
||||
void objSetBlockedPathUnblocked(struct defaultobj *blocker, bool unblocked)
|
||||
{
|
||||
if (blocker->hidden & OBJHFLAG_02000000) {
|
||||
struct blockedpathobj *bp = g_BlockedPaths;
|
||||
|
||||
while (bp) {
|
||||
if (bp->blocker == blocker) {
|
||||
if (unblocked) {
|
||||
waypointEnableSegment(&g_StageSetup.waypoints[bp->waypoint1], &g_StageSetup.waypoints[bp->waypoint2]);
|
||||
break;
|
||||
} else {
|
||||
waypointDisableSegment(&g_StageSetup.waypoints[bp->waypoint1], &g_StageSetup.waypoints[bp->waypoint2]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bp = bp->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user