Remove Dr Caroll and robot

This commit is contained in:
Ryan Dwyer
2022-11-05 11:59:38 +10:00
parent 7f7dbfc830
commit dac7e78ba6
6 changed files with 167 additions and 642 deletions
-16
View File
@@ -389,22 +389,6 @@ void bodyAllocateChr(s32 stagenum, struct packedchr *packed, s32 cmdindex)
chr->rtracked = false;
if (bodynum == BODY_DRCAROLL) {
chr->drcarollimage_left = 0;
chr->drcarollimage_right = 0;
chr->height = 185;
chr->radius = 30;
} else if (bodynum == BODY_CHICROB) {
chr->unk348[0] = mempAlloc(sizeof(struct fireslotthing), MEMPOOL_STAGE);
chr->unk348[1] = mempAlloc(sizeof(struct fireslotthing), MEMPOOL_STAGE);
chr->unk348[0]->beam = mempAlloc(ALIGN16(sizeof(struct beam)), MEMPOOL_STAGE);
chr->unk348[1]->beam = mempAlloc(ALIGN16(sizeof(struct beam)), MEMPOOL_STAGE);
chr->unk348[0]->beam->age = -1;
chr->unk348[1]->beam->age = -1;
chr->height = 200;
chr->radius = 42;
}
if (packed->spawnflags & SPAWNFLAG_INVINCIBLE) {
chr->chrflags |= CHRCFLAG_INVINCIBLE;
}
+156 -278
View File
@@ -1519,264 +1519,196 @@ void chrHandleJointPositioned(s32 joint, Mtxf *mtx)
f32 yrot; // eg. twist left/right or shaking head
f32 zrot; // eg. cartwheeling
if (g_CurModelChr->model->filedata->skel == &g_SkelRobot) {
// Handle Chicago robot guns
theta = chrGetInverseTheta(g_CurModelChr);
if (joint == 1) {
gunrotx = g_CurModelChr->gunrotx[0];
gunroty = g_CurModelChr->gunroty[0];
} else if (joint == 2) {
gunrotx = g_CurModelChr->gunrotx[1];
gunroty = g_CurModelChr->gunroty[1];
} else {
return;
}
mtx00015be0(camGetProjectionMtxF(), mtx);
sp138.x = mtx->m[3][0];
sp138.y = mtx->m[3][1];
sp138.z = mtx->m[3][2];
mtx->m[3][0] = 0.0f;
mtx->m[3][1] = 0.0f;
mtx->m[3][2] = 0.0f;
if (gunrotx < 0.0f) {
gunrotx += M_BADTAU;
}
if (gunroty < 0.0f) {
gunroty += M_BADTAU;
}
gunrot = M_BADTAU - theta + 1.5707963705063f;
if (gunrot >= M_BADTAU) {
gunrot -= M_BADTAU;
}
mtx4LoadYRotation(gunrot, &spb8);
mtx00015be0(&spb8, mtx);
mtx4LoadXRotation(gunrotx, &spf8);
mtx00015be0(&spf8, mtx);
gunrot = gunroty + theta;
if (gunrot >= M_BADTAU) {
gunrot -= M_BADTAU;
}
mtx4LoadYRotation(gunrot, &spb8);
mtx00015be0(&spb8, mtx);
if (scale != 1.0f) {
mtx00015f04(scale, mtx);
}
mtx->m[3][0] = sp138.x;
mtx->m[3][1] = sp138.y;
mtx->m[3][2] = sp138.z;
mtx00015be0(camGetWorldToScreenMtxf(), mtx);
if (g_CurModelChr->model->filedata->skel == &g_SkelChr) {
lshoulderjoint = 2;
rshoulderjoint = 3;
waistjoint = 1;
neckjoint = 0;
} else {
if (g_CurModelChr->model->filedata->skel == &g_SkelChr) {
lshoulderjoint = 2;
rshoulderjoint = 3;
waistjoint = 1;
neckjoint = 0;
} else if (g_CurModelChr->model->filedata->skel == &g_SkelSkedar) {
lshoulderjoint = 3;
rshoulderjoint = 4;
waistjoint = 2;
neckjoint = 1;
} else {
lshoulderjoint = -1;
rshoulderjoint = -1;
waistjoint = -1;
neckjoint = -1;
}
lshoulderjoint = -1;
rshoulderjoint = -1;
waistjoint = -1;
neckjoint = -1;
}
if (joint == lshoulderjoint || joint == rshoulderjoint || joint == waistjoint || joint == neckjoint) {
xrot = 0.0f;
yrot = 0.0f;
zrot = 0.0f;
if (joint == lshoulderjoint || joint == rshoulderjoint || joint == waistjoint || joint == neckjoint) {
xrot = 0.0f;
yrot = 0.0f;
zrot = 0.0f;
// Apply rotation based on chr's aiming properties
if (joint == rshoulderjoint) {
xrot = g_CurModelChr->aimuprshoulder;
} else if (joint == lshoulderjoint) {
xrot = g_CurModelChr->aimuplshoulder;
} else if (joint == waistjoint) {
// Up/down at the waist
// Apply rotation based on chr's aiming properties
if (joint == rshoulderjoint) {
xrot = g_CurModelChr->aimuprshoulder;
} else if (joint == lshoulderjoint) {
xrot = g_CurModelChr->aimuplshoulder;
} else if (joint == waistjoint) {
// Up/down at the waist
xrot = g_CurModelChr->aimupback;
if (g_CurModelChr->hidden2 & CHRH2FLAG_0004) {
if (xrot > 1.0470308065414f) {
xrot -= 1.0470308065414f;
} else if (xrot < -0.87252569198608f) {
xrot += 0.87252569198608f;
} else {
xrot = 0.0f;
}
}
// Left/right at the waist
yrot = g_CurModelChr->aimsideback;
if (g_CurModelChr->aibot) {
yrot += g_CurModelChr->aibot->angleoffset;
} else if (g_CurModelChr->prop->type == PROPTYPE_PLAYER) {
yrot += g_Vars.players[playermgrGetPlayerNumByProp(g_CurModelChr->prop)]->angleoffset;
}
} else if (joint == neckjoint) {
// Head up/down
if (g_CurModelChr->hidden2 & CHRH2FLAG_0004) {
xrot = g_CurModelChr->aimupback;
if (g_CurModelChr->hidden2 & CHRH2FLAG_0004) {
if (xrot > 1.0470308065414f) {
xrot -= 1.0470308065414f;
} else if (xrot < -0.87252569198608f) {
xrot += 0.87252569198608f;
} else {
xrot = 0.0f;
}
}
// Left/right at the waist
yrot = g_CurModelChr->aimsideback;
if (g_CurModelChr->aibot) {
yrot += g_CurModelChr->aibot->angleoffset;
} else if (g_CurModelChr->prop->type == PROPTYPE_PLAYER) {
yrot += g_Vars.players[playermgrGetPlayerNumByProp(g_CurModelChr->prop)]->angleoffset;
}
} else if (joint == neckjoint) {
// Head up/down
if (g_CurModelChr->hidden2 & CHRH2FLAG_0004) {
xrot = g_CurModelChr->aimupback;
if (xrot > 1.0470308065414f) {
xrot = 1.0470308065414f;
} else if (xrot < -0.87252569198608f) {
xrot = -0.87252569198608f;
}
} else if (g_CurModelChr->model->anim->flip) {
xrot = g_CurModelChr->aimuplshoulder;
} else {
xrot = g_CurModelChr->aimuprshoulder;
}
// Apply head bobbing when dizzy
if (g_CurModelChr->blurdrugamount > TICKS(1000)
&& g_CurModelChr->actiontype != ACT_DEAD
&& g_CurModelChr->actiontype != ACT_DIE) {
zrot = g_CurModelChr->drugheadsway / 360.0f * M_BADTAU;
xrot -= (28.0f - ABS(g_CurModelChr->drugheadsway)) / 250.0f * M_BADTAU;
if (xrot > 1.0470308065414f) {
xrot = 1.0470308065414f;
} else if (xrot < -0.87252569198608f) {
xrot = -0.87252569198608f;
}
} else if (g_CurModelChr->model->anim->flip) {
xrot = g_CurModelChr->aimuplshoulder;
} else {
xrot = g_CurModelChr->aimuprshoulder;
}
// Apply flinch when chr is shot
if (g_CurModelChr->flinchcnt >= 0 && (CHRRACE(g_CurModelChr) == RACE_HUMAN)) {
if (g_CurModelChr->hidden2 & CHRH2FLAG_HEADSHOTTED) {
if (joint == neckjoint) {
f32 flinchamount = chrGetFlinchAmount(g_CurModelChr);
s32 flinchtype = (g_CurModelChr->hidden2 >> 13) & 7;
f32 mult = 60.0f;
// Apply head bobbing when dizzy
if (g_CurModelChr->blurdrugamount > TICKS(1000)
&& g_CurModelChr->actiontype != ACT_DEAD
&& g_CurModelChr->actiontype != ACT_DIE) {
zrot = g_CurModelChr->drugheadsway / 360.0f * M_BADTAU;
xrot -= (28.0f - ABS(g_CurModelChr->drugheadsway)) / 250.0f * M_BADTAU;
}
}
if ((flinchtype & 1) == 0) {
mult = 85.0f;
}
if (flinchtype >= 5 && flinchtype < 8) {
zrot -= flinchamount * (M_BADTAU * mult / 360.0f);
} else if (flinchtype > 0 && flinchtype < 4) {
zrot += flinchamount * (M_BADTAU * mult / 360.0f);
}
if (flinchtype == 7 || flinchtype == 0 || flinchtype == 1) {
xrot += flinchamount * (M_BADTAU * mult / 360.0f);
} else if (flinchtype >= 3 && flinchtype < 6) {
xrot -= flinchamount * (M_BADTAU * mult / 360.0f);
}
}
} else if (joint == rshoulderjoint || joint == lshoulderjoint) {
// Apply flinch when chr is shot
if (g_CurModelChr->flinchcnt >= 0 && (CHRRACE(g_CurModelChr) == RACE_HUMAN)) {
if (g_CurModelChr->hidden2 & CHRH2FLAG_HEADSHOTTED) {
if (joint == neckjoint) {
f32 flinchamount = chrGetFlinchAmount(g_CurModelChr);
s32 flinchtype = (g_CurModelChr->hidden2 >> 13) & 7;
f32 flinchamount = chrGetFlinchAmount(g_CurModelChr) * 0.26175770163536f;
f32 mult = 60.0f;
xrot -= flinchamount;
if ((flinchtype & 1) == 0) {
mult = 85.0f;
}
if (flinchtype < 3) {
yrot -= flinchamount;
if (flinchtype >= 5 && flinchtype < 8) {
zrot -= flinchamount * (M_BADTAU * mult / 360.0f);
} else if (flinchtype > 0 && flinchtype < 4) {
zrot += flinchamount * (M_BADTAU * mult / 360.0f);
}
if (flinchtype == 7 || flinchtype == 0 || flinchtype == 1) {
xrot += flinchamount * (M_BADTAU * mult / 360.0f);
} else if (flinchtype >= 3 && flinchtype < 6) {
yrot += flinchamount;
xrot -= flinchamount * (M_BADTAU * mult / 360.0f);
}
} else if (joint == waistjoint) {
f32 flinchamount;
s32 flinchtype;
}
} else if (joint == rshoulderjoint || joint == lshoulderjoint) {
s32 flinchtype = (g_CurModelChr->hidden2 >> 13) & 7;
f32 flinchamount = chrGetFlinchAmount(g_CurModelChr) * 0.26175770163536f;
flinchamount = chrGetFlinchAmount(g_CurModelChr);
flinchtype = (g_CurModelChr->hidden2 >> 13) & 7;
xrot -= flinchamount;
xrot += flinchamount * 0.26175770163536f;
if (flinchtype < 3) {
yrot -= flinchamount;
} else if (flinchtype >= 3 && flinchtype < 6) {
yrot += flinchamount;
}
} else if (joint == waistjoint) {
f32 flinchamount;
s32 flinchtype;
if (flinchtype < 3) {
yrot += flinchamount * 0.26175770163536f;
} else if (flinchtype >= 3 && flinchtype < 6) {
yrot -= flinchamount * 0.26175770163536f;
}
flinchamount = chrGetFlinchAmount(g_CurModelChr);
flinchtype = (g_CurModelChr->hidden2 >> 13) & 7;
if (flinchtype == 2 || flinchtype == 5 || flinchtype == 7) {
zrot += flinchamount * 0.17450514435768f;
} else if (flinchtype == 1 || flinchtype == 4 || flinchtype == 6) {
zrot -= flinchamount * 0.17450514435768f;
}
xrot += flinchamount * 0.26175770163536f;
if (flinchtype < 3) {
yrot += flinchamount * 0.26175770163536f;
} else if (flinchtype >= 3 && flinchtype < 6) {
yrot -= flinchamount * 0.26175770163536f;
}
if (flinchtype == 2 || flinchtype == 5 || flinchtype == 7) {
zrot += flinchamount * 0.17450514435768f;
} else if (flinchtype == 1 || flinchtype == 4 || flinchtype == 6) {
zrot -= flinchamount * 0.17450514435768f;
}
}
}
if (xrot != 0.0f || yrot != 0.0f || zrot != 0.0f || scale != 1.0f) {
struct coord sp70;
f32 aimangle;
Mtxf tmpmtx;
if (xrot != 0.0f || yrot != 0.0f || zrot != 0.0f || scale != 1.0f) {
struct coord sp70;
f32 aimangle;
Mtxf tmpmtx;
aimangle = chrGetAimAngle(g_CurModelChr);
aimangle = chrGetAimAngle(g_CurModelChr);
if (xrot < 0.0f) {
xrot = -xrot;
} else {
xrot = M_BADTAU - xrot;
}
if (xrot < 0.0f) {
xrot = -xrot;
} else {
xrot = M_BADTAU - xrot;
}
if (yrot < 0.0f) {
yrot += M_BADTAU;
}
mtx00015be0(camGetProjectionMtxF(), mtx);
sp70.x = mtx->m[3][0];
sp70.y = mtx->m[3][1];
sp70.z = mtx->m[3][2];
mtx->m[3][0] = 0.0f;
mtx->m[3][1] = 0.0f;
mtx->m[3][2] = 0.0f;
if (xrot != 0.0f || zrot != 0.0f) {
yrot -= aimangle;
if (yrot < 0.0f) {
yrot += M_BADTAU;
}
mtx00015be0(camGetProjectionMtxF(), mtx);
mtx4LoadYRotation(yrot, &tmpmtx);
mtx00015be0(&tmpmtx, mtx);
sp70.x = mtx->m[3][0];
sp70.y = mtx->m[3][1];
sp70.z = mtx->m[3][2];
mtx->m[3][0] = 0.0f;
mtx->m[3][1] = 0.0f;
mtx->m[3][2] = 0.0f;
if (xrot != 0.0f || zrot != 0.0f) {
yrot -= aimangle;
if (yrot < 0.0f) {
yrot += M_BADTAU;
}
mtx4LoadYRotation(yrot, &tmpmtx);
mtx00015be0(&tmpmtx, mtx);
if (xrot != 0.0f) {
mtx4LoadXRotation(xrot, &tmpmtx);
mtx00015be0(&tmpmtx, mtx);
}
if (zrot != 0.0f) {
mtx4LoadZRotation(zrot, &tmpmtx);
mtx00015be0(&tmpmtx, mtx);
}
mtx4LoadYRotation(aimangle, &tmpmtx);
mtx00015be0(&tmpmtx, mtx);
} else {
mtx4LoadYRotation(yrot, &tmpmtx);
if (xrot != 0.0f) {
mtx4LoadXRotation(xrot, &tmpmtx);
mtx00015be0(&tmpmtx, mtx);
}
if (scale != 1.0f) {
mtx00015f04(scale, mtx);
if (zrot != 0.0f) {
mtx4LoadZRotation(zrot, &tmpmtx);
mtx00015be0(&tmpmtx, mtx);
}
mtx->m[3][0] = sp70.x;
mtx->m[3][1] = sp70.y;
mtx->m[3][2] = sp70.z;
mtx00015be0(camGetWorldToScreenMtxf(), mtx);
mtx4LoadYRotation(aimangle, &tmpmtx);
mtx00015be0(&tmpmtx, mtx);
} else {
mtx4LoadYRotation(yrot, &tmpmtx);
mtx00015be0(&tmpmtx, mtx);
}
if (scale != 1.0f) {
mtx00015f04(scale, mtx);
}
mtx->m[3][0] = sp70.x;
mtx->m[3][1] = sp70.y;
mtx->m[3][2] = sp70.z;
mtx00015be0(camGetWorldToScreenMtxf(), mtx);
}
}
}
@@ -2493,19 +2425,7 @@ s32 chrTick(struct prop *prop)
g_ModelJointPositionedFunc = &chrHandleJointPositioned;
g_CurModelChr = chr;
if (CHRRACE(chr) == RACE_DRCAROLL) {
angle = chrGetInverseTheta(chr);
sp190.x = sinf(angle) * 19;
sp190.y = 0.0f;
sp190.z = cosf(angle) * 19;
mtx4LoadTranslation(&sp190, &sp1a8);
mtx4MultMtx4InPlace(camGetWorldToScreenMtxf(), &sp1a8);
sp210.unk00 = &sp1a8;
} else {
sp210.unk00 = camGetWorldToScreenMtxf();
}
sp210.unk00 = camGetWorldToScreenMtxf();
sp210.unk10 = gfxAllocate(model->filedata->nummatrices * sizeof(Mtxf));
@@ -3273,10 +3193,6 @@ Gfx *chrRender(struct prop *prop, Gfx *gdl, bool xlupass)
}
}
if (chr->race == RACE_DRCAROLL) {
chrSetDrCarollImages(chr, chr->drcarollimage_left, chr->drcarollimage_right);
}
g_Vars.currentplayerstats->drawplayercount++;
if (chr0f024738(chr)) {
@@ -5260,9 +5176,6 @@ bool chrCalculateAutoAim(struct prop *prop, struct coord *arg1, f32 *arg2, f32 *
} else if (model->filedata->skel == &g_SkelSkedar) {
mtx2 = &model->matrices[0];
arg1->z = mtx2->m[3][2];
} else if (model->filedata->skel == &g_SkelDrCaroll) {
mtx2 = &model->matrices[0];
arg1->z = mtx2->m[3][2];
} else {
arg1->z = model->matrices[0].m[3][2];
}
@@ -5274,9 +5187,6 @@ bool chrCalculateAutoAim(struct prop *prop, struct coord *arg1, f32 *arg2, f32 *
} else if (model->filedata->skel == &g_SkelSkedar) {
arg1->x = mtx2->m[3][0];
arg1->y = mtx2->m[3][1];
} else if (model->filedata->skel == &g_SkelDrCaroll) {
arg1->x = mtx2->m[3][0];
arg1->y = mtx2->m[3][1];
} else {
arg1->x = model->matrices[0].m[3][0];
arg1->y = model->matrices[0].m[3][1];
@@ -6830,35 +6740,3 @@ void shieldhitsTick(void)
}
}
}
void chrSetDrCarollImages(struct chrdata *drcaroll, s32 imageleft, s32 imageright)
{
if (drcaroll && imageleft >= 0 && imageleft < 6 && imageright >= 0 && imageright < 6) {
struct model *model = drcaroll->model;
struct modelnode *nodes[2];
union modelrwdata *rwdata;
s32 i;
s32 j;
u32 stack;
// Iterate model parts relating to images
// Parts 0-5 are the left image
// Parts 6-11 are the right image
for (i = 0; i < 6; i++) {
nodes[0] = modelGetPart(model->filedata, i);
nodes[1] = modelGetPart(model->filedata, i + 6);
for (j = 0; j < 2; j++) {
if (nodes[j]) {
rwdata = modelGetNodeRwData(model, nodes[j]);
if (j == 0) {
rwdata->toggle.visible = (imageleft == i) ? true : false;
} else {
rwdata->toggle.visible = (imageright == i) ? true : false;
}
}
}
}
}
}
+7 -321
View File
@@ -1669,8 +1669,6 @@ void chrChooseStandAnimation(struct chrdata *chr, f32 mergetime)
modelSetAnimLooping(chr->model, 0, 16);
modelSetAnimEndFrame(chr->model, 120);
}
} else if (race == RACE_DRCAROLL) {
modelSetAnimation(chr->model, ANIM_013E, 0, 0, 0.5, mergetime);
} else if (race == RACE_ROBOT) {
modelSetAnimation(chr->model, ANIM_0237, 0, 0, 0.5, mergetime);
}
@@ -1748,19 +1746,6 @@ void chrStand(struct chrdata *chr)
modelSetAnimEndFrame(chr->model, 151);
}
}
} else if (race == RACE_DRCAROLL || race == RACE_ROBOT) {
chr->actiontype = ACT_STAND;
chr->act_stand.prestand = true;
chr->act_stand.flags = 0;
chr->act_stand.entityid = 0;
chr->act_stand.reaim = 0;
chr->act_stand.turning = TURNSTATE_OFF;
chr->act_stand.checkfacingwall = false;
chr->act_stand.wallcount = random() % 120 + 180;
chr->sleep = 0;
chr->act_stand.playwalkanim = false;
func0f02e9a0(chr, 16);
} else {
func0f02e9a0(chr, 16);
}
@@ -2660,9 +2645,7 @@ void chrStartAnim(struct chrdata *chr, s32 animnum, f32 startframe, f32 endframe
speed = -speed;
}
if (CHRRACE(chr) != RACE_DRCAROLL) {
chrStopFiring(chr);
}
chrStopFiring(chr);
chr->actiontype = ACT_ANIM;
@@ -2712,11 +2695,6 @@ void chrBeginDead(struct chrdata *chr)
chr->act_dead.invistimer60 = 0;
chr->act_dead.notifychrindex = 0;
chr->sleep = 0;
if (chr->race == RACE_DRCAROLL) {
chr->drcarollimage_left = DRCAROLLIMAGE_STATIC;
chr->drcarollimage_right = DRCAROLLIMAGE_STATIC;
}
}
}
@@ -2929,12 +2907,6 @@ void chrAttackAmount(struct chrdata *chr, u32 attackflags, u32 entityid, u32 max
chr->act_attack.dooneburst = false;
}
#if PAL
s32 g_DrCarollDyingTimer = 8;
#else
s32 g_DrCarollDyingTimer = 10;
#endif
u8 var80068080 = 50;
/**
@@ -3007,45 +2979,11 @@ void chrBeginDeath(struct chrdata *chr, struct coord *dir, f32 relangle, s32 hit
chr->act_die.notifychrindex = 0;
chr->act_die.timeextra = 0;
chr->act_die.drcarollimagedelay = TICKS(45);
chr->act_die.thudframe1 = -1;
chr->act_die.thudframe2 = -1;
if (chr->race == RACE_DRCAROLL) {
chr->drcarollimage_left = (s32)((random() % 400) * 0.01f) + 1;
chr->drcarollimage_right = (s32)((random() % 400) * 0.01f) + 1;
}
chr->sleep = 0;
// Handle robots and Dr Caroll then return early
if (race == RACE_ROBOT || race == RACE_DRCAROLL) {
impactforce1 = gsetGetImpactForce(gset) * 0.5f;
if (impactforce1 <= 0) {
impactforce1 = 3;
}
if (impactforce1 != 0.0f) {
chr->elapseextra = 0;
chr->timeextra = impactforce1 * 15;
chr->extraspeed.x = dir->x * impactforce1;
chr->extraspeed.y = dir->y * impactforce1;
chr->extraspeed.z = dir->z * impactforce1;
}
if (race == RACE_DRCAROLL) {
g_DrCarollDyingTimer = 0;
chr->soundtimer = 0;
chr->voicebox = VOICEBOX_MALE1;
modelSetAnimation(chr->model, ANIM_0164, false, 0, 0.5f, 16);
}
return;
}
// Handle humans and Skedar
if (race == RACE_HUMAN) {
animnum = modelGetAnimNum(chr->model);
@@ -3246,20 +3184,6 @@ void chrBeginArgh(struct chrdata *chr, f32 angle, s32 hitpart)
return;
}
if (race == RACE_DRCAROLL) {
chr->actiontype = ACT_ARGH;
chr->act_argh.notifychrindex = 0;
chr->act_argh.lvframe60 = g_Vars.lvframe60;
chr->sleep = 0;
modelSetAnimation(chr->model, ANIM_0163, false, 0, 0.5f, 16);
chr->drcarollimage_left = DRCAROLLIMAGE_X;
chr->drcarollimage_right = DRCAROLLIMAGE_X;
return;
}
instant = chr->actiontype == ACT_ARGH && chr->act_argh.lvframe60 == g_Vars.lvframe60;
for (i = 0; g_AnimTablesByRace[race][i].hitpart != -1; i++) {
@@ -3453,14 +3377,9 @@ void chrYeetFromPos(struct chrdata *chr, struct coord *exppos, f32 force)
chr->act_die.thudframe1 = row->thudframe;
chr->act_die.thudframe2 = -1;
chr->act_die.timeextra = 0;
chr->act_die.drcarollimagedelay = TICKS(45);
if (chr->race == RACE_DRCAROLL) {
chr->drcarollimage_left = 1 + (s32)((random() % 400) * 0.01f);
chr->drcarollimage_right = 1 + (s32)((random() % 400) * 0.01f);
}
chr->sleep = 0;
modelSetAnimation(model, row->animnum, row->flip, row->startframe, row->speed, 8);
if (row->endframe >= 0.0f) {
@@ -3587,9 +3506,7 @@ void chrChoke(struct chrdata *chr, s32 choketype)
s32 playernum;
s32 allowoverride = false;
static s32 nextindexdrcaroll = 0;
static s32 nextindexmaian = 0;
static s32 nextindexskedar = 0;
static s32 nextindexshock = 0;
static s32 nextindexmale = 0;
static s32 nextindexfemale = 0;
@@ -3606,27 +3523,7 @@ void chrChoke(struct chrdata *chr, s32 choketype)
male = true;
}
if (race == RACE_DRCAROLL) {
s16 sounds[] = {
SFX_ARGH_DRCAROLL_0240,
SFX_ARGH_DRCAROLL_024C,
SFX_ARGH_DRCAROLL_0250,
SFX_ARGH_DRCAROLL_0251,
SFX_ARGH_DRCAROLL_0259,
SFX_ARGH_DRCAROLL_025A,
};
if (g_DrCarollDyingTimer > TICKS(10)) {
g_DrCarollDyingTimer = 0;
soundnum = sounds[nextindexdrcaroll];
nextindexdrcaroll++;
if (nextindexdrcaroll >= ARRAYCOUNT(sounds)) {
nextindexdrcaroll = 0;
}
}
} else if (chr->headnum == HEAD_THEKING
if (chr->headnum == HEAD_THEKING
|| chr->headnum == HEAD_ELVIS
|| chr->headnum == HEAD_MAIAN_S
|| chr->headnum == HEAD_ELVIS_GOGS) {
@@ -4049,7 +3946,7 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse
func = gsetGetWeaponFunction(gset);
isclose = func && (func->type & 0xff) == INVENTORYFUNCTYPE_CLOSE;
makedizzy = race != RACE_DRCAROLL && gsetHasFunctionFlags(gset, FUNCFLAG_MAKEDIZZY);
makedizzy = gsetHasFunctionFlags(gset, FUNCFLAG_MAKEDIZZY);
if (chr->prop == g_Vars.currentplayer->prop && g_Vars.currentplayer->invincible) {
return;
@@ -4499,7 +4396,7 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse
chr->numarghs++;
// Handle chr dizziness and psychosis
if (makedizzy && race != RACE_DRCAROLL && race != RACE_ROBOT) {
if (makedizzy) {
if (gsetHasFunctionFlags(gset, FUNCFLAG_PSYCHOSIS)) {
chr->hidden |= CHRHFLAG_PSYCHOSISED;
} else {
@@ -5664,16 +5561,6 @@ void chrGoPosChooseAnimation(struct chrdata *chr)
}
}
}
} else if (race == RACE_DRCAROLL) {
if (gospeed == GOPOSFLAG_RUN) {
anim = ANIM_0160;
} else if (gospeed == GOPOSFLAG_WALK) {
anim = ANIM_015F;
} else {
anim = ANIM_015F;
}
} else if (race == RACE_ROBOT) {
anim = ANIM_0238;
}
if (anim >= 0) {
@@ -5839,10 +5726,6 @@ void chrPatrolChooseAnimation(struct chrdata *chr)
} else {
modelSetAnimation(chr->model, random() % 2 ? ANIM_005C : ANIM_0072, flip, 0, speed, 16);
}
} else if (race == RACE_DRCAROLL) {
modelSetAnimation(chr->model, ANIM_015F, false, 0, 0.5f, 16);
} else if (race == RACE_ROBOT) {
modelSetAnimation(chr->model, ANIM_0238, false, 0, 0.5f, 16);
}
}
@@ -7239,10 +7122,6 @@ bool chrDropItem(struct chrdata *chr, u32 modelnum, u32 weaponnum)
struct weaponobj *weapon;
u8 race = CHRRACE(chr);
if (race == RACE_DRCAROLL || race == RACE_ROBOT) {
return false;
}
weapon = weaponCreateProjectileFromWeaponNum(modelnum, (u8)weaponnum, chr);
if (weapon && weapon->base.prop) {
@@ -7843,51 +7722,6 @@ void chrTickDie(struct chrdata *chr)
return;
}
if (race == RACE_DRCAROLL) {
struct prop *prop = chr->prop;
if (g_DrCarollDyingTimer > TICKS(120) && chr->voicebox) {
// Play speech
u16 phrases[] = {
SFX_DRCAROLL_SYSTEMS_FAILURE,
SFX_DRCAROLL_YOU_GO_ON,
SFX_DRCAROLL_I_CANT_MAKE_IT,
SFX_DRCAROLL_IM_DYING,
SFX_DRCAROLL_GOODBYE,
SFX_DRCAROLL_YOU_WERE_SUPPOSED,
};
propsnd0f0939f8(NULL, chr->prop, phrases[random() % 5], -1,
-1, 0, 0, 0, 0, -1, 0, -1, -1, -1, -1);
chr->voicebox = 0;
}
// Change images randomly
if (chr->act_die.drcarollimagedelay > 0) {
chr->act_die.drcarollimagedelay -= g_Vars.lvupdate60;
} else {
chr->act_die.drcarollimagedelay = (random() % TICKS(1000)) * 0.01f + 5.0f;
chr->drcarollimage_left = 1 + (s32)((random() % 400) * 0.01f);
chr->drcarollimage_right = 1 + (s32)((random() % 400) * 0.01f);
}
if (g_DrCarollDyingTimer > TICKS(310)) {
// Explode
func0f0926bc(prop, 1, 0xffff);
explosionCreateSimple(prop, &prop->pos, prop->rooms, EXPLOSIONTYPE_8, g_Vars.currentplayernum);
chrBeginDead(chr);
} else if (chr->soundtimer > (s32)var80068080) {
// Play shield damage sound
chr->soundtimer = 0;
var80068080 -= 5;
propsnd0f0939f8(NULL, prop, SFX_SHIELD_DAMAGE, -1,
-1, 1024, 0, 0, 0, -1, 0, -1, -1, -1, -1);
sparksCreate(prop->rooms[0], prop, &prop->pos, NULL, 0, SPARKTYPE_ELECTRICAL);
}
return;
}
// Human or Skedar
// If due, play thud 1 sound
if (chr->act_die.thudframe1 >= 0 && modelGetCurAnimFrame(model) >= chr->act_die.thudframe1) {
@@ -8125,11 +7959,6 @@ void chrTickArgh(struct chrdata *chr)
if (CHRRACE(chr) == RACE_HUMAN && modelGetAnimNum(model) == ANIM_DEATH_STOMACH_LONG) {
func0f02ed28(chr, 26);
} else {
if (chr->race == RACE_DRCAROLL) {
chr->drcarollimage_left = DRCAROLLIMAGE_EYESDEFAULT;
chr->drcarollimage_right = DRCAROLLIMAGE_EYESDEFAULT;
}
chrStop(chr);
}
}
@@ -8840,7 +8669,7 @@ void chrStopFiring(struct chrdata *chr)
{
u8 race = CHRRACE(chr);
if (race != RACE_DRCAROLL && chr->aibot == NULL) {
if (chr->aibot == NULL) {
chrSetFiring(chr, HAND_RIGHT, false);
chrSetFiring(chr, HAND_LEFT, false);
@@ -10332,143 +10161,12 @@ void func0f0429d8(struct chrdata *chr, f32 arg1, f32 arg2)
void chrTickRobotAttack(struct chrdata *chr)
{
s32 i;
f32 roty = 0.0f;
f32 rotx = 0.0f;
struct prop *targetprop = chrGetTargetProp(chr);
bool firing;
bool empty;
f32 invtheta = chrGetInverseTheta(chr);
struct act_robotattack *act = &chr->act_robotattack;
func0f0429d8(chr, 0.085f, invtheta);
if (chr->model->filedata->skel != &g_SkelRobot) {
act->finished = true;
return;
}
for (i = 0; i < 2; i++) {
empty = false;
if (act->numshots[i] > 0) {
chr->unk348[i]->unk01 = !(chr->unk348[i]->unk00 % 3);
firing = !(chr->unk348[i]->unk00 % 2);
} else {
chr->unk348[i]->unk01 = 0;
firing = false;
}
act->firing[i] = firing;
if (act->numshots[0] <= 0 && act->numshots[1] <= 0) {
empty = true;
if (ABS(chr->gunroty[0]) < 0.03f
&& ABS(chr->gunrotx[0]) < 0.03f
&& ABS(chr->gunroty[1]) < 0.03f
&& ABS(chr->gunrotx[1]) < 0.03f) {
act->finished = true;
}
}
if (empty);
if ((f32)empty);
if (!empty) {
f32 aimy;
union modelrodata *rodata;
struct coord spe4;
Mtxf spa4;
aimy = targetprop->pos.y - 20.0f;
rodata = modelGetPartRodata(chr->model->filedata, (i ? MODELPART_ROBOT_0000 : MODELPART_ROBOT_0001));
act->pos[i].x = rodata->position.pos.x;
act->pos[i].y = rodata->position.pos.y - 300.0f;
act->pos[i].z = rodata->position.pos.z;
mtx4LoadYRotation(invtheta, &spa4);
mtx4RotateVec(&spa4, &act->pos[i], &spe4);
spe4.x *= chr->model->scale;
spe4.y *= chr->model->scale;
spe4.z *= chr->model->scale;
act->pos[i].x = spe4.x + chr->prop->pos.x;
act->pos[i].y = spe4.y + chr->prop->pos.y;
act->pos[i].z = spe4.z + chr->prop->pos.z;
roty = atan2f(targetprop->pos.x - act->pos[i].x, targetprop->pos.z - act->pos[i].z) - invtheta;
if (roty < 0.0f) {
roty += M_BADTAU;
}
if (roty > M_BADPI) {
roty -= M_BADTAU;
}
if (roty < -0.524f) {
roty = -0.524f;
}
if (roty > 0.524f) {
roty = 0.524f;
}
#define X() (targetprop->pos.x - act->pos[i].x)
#define Z() (targetprop->pos.z - act->pos[i].z)
rotx = M_BADTAU - atan2f(aimy - act->pos[i].y, sqrtf(Z() * Z() + X() * X()));
if (rotx > M_BADPI) {
rotx -= M_BADTAU;
}
if (rotx < -0.524f) {
rotx = -0.524f;
}
if (rotx > 0.524f) {
rotx = 0.524f;
}
}
chr->gunroty[i] += (roty - chr->gunroty[i]) * 0.15f;
chr->gunrotx[i] += (rotx - chr->gunrotx[i]) * 0.15f;
if (!empty) {
if (firing) {
f32 gunrotx = chr->gunrotx[i];
f32 gunroty = chr->gunroty[i];
if (gunrotx < 0.0f) {
gunrotx += M_BADTAU;
}
if (gunroty < 0.0f) {
gunroty += M_BADTAU;
}
gunroty += invtheta;
if (gunroty >= M_BADTAU) {
gunroty -= M_BADTAU;
}
act->dir[i].x = sinf(gunroty) * cosf(gunrotx);
act->dir[i].y = -sinf(gunrotx);
act->dir[i].z = cosf(gunroty) * cosf(gunrotx);
robotSetMuzzleFlash(chr, i, true);
act->numshots[i]--;
}
chr->unk348[i]->unk00++;
}
}
act->finished = true;
}
void chrTickAttack(struct chrdata *chr)
@@ -12709,10 +12407,6 @@ void chraTick(struct chrdata *chr)
chr->sleep = 0;
}
if (race == RACE_DRCAROLL) {
g_DrCarollDyingTimer += g_Vars.lvupdate60;
}
chr->soundtimer += g_Vars.lvupdate60;
chr->talktimer += g_Vars.lvupdate60;
@@ -15482,11 +15176,3 @@ bool chrIsAvoiding(struct chrdata *chr)
return false;
}
void chrDrCarollEmitSparks(struct chrdata *chr)
{
if (chr && chr->prop) {
propsnd0f0939f8(0, chr->prop, SFX_SHIELD_DAMAGE, -1, -1, 0, 0, 0, 0, -1, 0, -1, -1, -1, -1);
sparksCreate(chr->prop->rooms[0], chr->prop, &chr->prop->pos, NULL, 0, SPARKTYPE_ELECTRICAL);
}
}
-21
View File
@@ -3,17 +3,6 @@
#include "data.h"
#include "types.h"
u8 g_SkelDrCarollJoints[][2] = {
{ 0, 0 },
{ 1, 1 },
{ 2, 2 },
{ 3, 3 },
};
struct skeleton g_SkelDrCaroll = {
SKEL_DRCAROLL, ARRAYCOUNT(g_SkelDrCarollJoints), g_SkelDrCarollJoints,
};
u8 g_Skel22Joints[][2] = {
{ 0, 0 },
{ 1, 1 },
@@ -51,16 +40,6 @@ struct skeleton g_Skel22 = {
SKEL_22, ARRAYCOUNT(g_Skel22Joints), g_Skel22Joints,
};
u8 g_SkelRobotJoints[][2] = {
{ 0, 0 },
{ 1, 2 },
{ 2, 1 },
};
struct skeleton g_SkelRobot = {
SKEL_ROBOT, ARRAYCOUNT(g_SkelRobotJoints), g_SkelRobotJoints,
};
struct headorbody g_HeadsAndBodies[] = {
// ismale
// | height
+3 -3
View File
@@ -48,7 +48,7 @@ struct skeleton *g_Skeletons[] = {
&g_Skel0C,
&g_SkelJoypad,
&g_SkelLift,
&g_SkelSkedar,
NULL,
&g_SkelLogo,
&g_SkelPdLogo,
&g_SkelHoverbike,
@@ -61,7 +61,7 @@ struct skeleton *g_Skeletons[] = {
&g_SkelChopper,
&g_SkelFalcon2,
&g_SkelKnife,
&g_SkelDrCaroll,
NULL,
&g_SkelRope,
&g_SkelCmp150,
&g_SkelBanner,
@@ -76,7 +76,7 @@ struct skeleton *g_Skeletons[] = {
&g_SkelDropship,
&g_SkelMauler,
&g_SkelDevastator,
&g_SkelRobot,
NULL,
&g_SkelPistol,
&g_SkelAr34,
&g_SkelMagnum,
+1 -3
View File
@@ -63,9 +63,7 @@ void splatTickChr(struct prop *prop)
return;
}
race = CHRRACE(chr);
if (race != RACE_DRCAROLL && race != RACE_ROBOT) {
{
u8 isskedar = false;
if (chr->bodynum == BODY_MRBLONDE) {