mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- sumo.cpp + associated code elsewhere.
This commit is contained in:
parent
e32a1af7b2
commit
0df721f331
5 changed files with 81 additions and 105 deletions
|
@ -106,7 +106,7 @@ int SetExpQuake(int16_t Weapon);
|
|||
int SetGunQuake(int16_t SpriteNum);
|
||||
int SetPlayerQuake(PLAYERp mpp);
|
||||
int SetNuclearQuake(int16_t Weapon);
|
||||
int SetSumoQuake(int16_t SpriteNum);
|
||||
int SetSumoFartQuake(int16_t SpriteNum);
|
||||
int SetSumoQuake(DSWActor*);
|
||||
int SetSumoFartQuake(DSWActor*);
|
||||
|
||||
END_SW_NS
|
||||
|
|
|
@ -308,16 +308,16 @@ SetNuclearQuake(int16_t Weapon)
|
|||
}
|
||||
|
||||
int
|
||||
SetSumoQuake(int16_t SpriteNum)
|
||||
SetSumoQuake(DSWActor* actor)
|
||||
{
|
||||
SPRITEp sp = &sprite[SpriteNum];
|
||||
SPRITEp sp = &actor->s();
|
||||
|
||||
SpawnQuake(sp->sectnum, sp->x, sp->y, sp->z, 120, 4, 20000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
SetSumoFartQuake(int16_t SpriteNum)
|
||||
SetSumoFartQuake(DSWActor* actor)
|
||||
{
|
||||
SPRITEp sp = &sprite[SpriteNum];
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ int SetupNinja(DSWActor*);
|
|||
int SetupGoro(DSWActor*);
|
||||
int SetupCoolg(DSWActor*);
|
||||
int SetupEel(DSWActor*);
|
||||
int SetupSumo(short);
|
||||
int SetupSumo(DSWActor*);
|
||||
int SetupZilla(short);
|
||||
int SetupToiletGirl(DSWActor*);
|
||||
int SetupWashGirl(DSWActor*);
|
||||
|
@ -1265,7 +1265,7 @@ ActorSpawn(SPRITEp sp)
|
|||
}
|
||||
|
||||
PicAnimOff(sp->picnum);
|
||||
SetupSumo(SpriteNum);
|
||||
SetupSumo(actor);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,11 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|||
|
||||
BEGIN_SW_NS
|
||||
|
||||
extern int InitSumoNapalm(DSWActor*);
|
||||
extern int InitSumoStompAttack(DSWActor*);
|
||||
extern int InitMiniSumoClap(DSWActor*);
|
||||
extern int InitSumoSkull(DSWActor*);
|
||||
|
||||
extern uint8_t playTrack;
|
||||
bool bosswasseen[3];
|
||||
|
||||
|
@ -627,22 +632,20 @@ ACTOR_ACTION_SET MiniSumoActionSet =
|
|||
};
|
||||
|
||||
|
||||
int
|
||||
SetupSumo(short SpriteNum)
|
||||
int SetupSumo(DSWActor* actor)
|
||||
{
|
||||
auto actor = &swActors[SpriteNum];
|
||||
SPRITEp sp = &sprite[SpriteNum];
|
||||
SPRITEp sp = &actor->s();
|
||||
USERp u;
|
||||
ANIMATOR DoActorDecide;
|
||||
|
||||
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
|
||||
{
|
||||
u = User[SpriteNum].Data();
|
||||
u = actor->u();
|
||||
ASSERT(u);
|
||||
}
|
||||
else
|
||||
{
|
||||
u = SpawnUser(SpriteNum,SUMO_RUN_R0,s_SumoRun[0]);
|
||||
u = SpawnUser(actor,SUMO_RUN_R0,s_SumoRun[0]);
|
||||
u->Health = 6000;
|
||||
}
|
||||
|
||||
|
@ -680,10 +683,6 @@ SetupSumo(short SpriteNum)
|
|||
int NullSumo(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
int SpriteNum = u->SpriteNum;
|
||||
|
||||
//if (TEST(u->Flags,SPR_SLIDING))
|
||||
//DoActorSlide(actor);
|
||||
|
||||
if (!TEST(u->Flags,SPR_CLIMBING))
|
||||
KeepActorOnFloor(actor);
|
||||
|
@ -696,10 +695,6 @@ int NullSumo(DSWActor* actor)
|
|||
int DoSumoMove(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
int SpriteNum = u->SpriteNum;
|
||||
|
||||
//if (TEST(u->Flags,SPR_SLIDING))
|
||||
//DoActorSlide(actor);
|
||||
|
||||
if (u->track >= 0)
|
||||
ActorFollowTrack(actor, ACTORMOVETICS);
|
||||
|
@ -720,10 +715,9 @@ int DoSumoMove(DSWActor* actor)
|
|||
int DoSumoRumble(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
int SpriteNum = u->SpriteNum;
|
||||
SPRITEp sp = &sprite[SpriteNum];
|
||||
SPRITEp sp = &actor->s();
|
||||
|
||||
SetSumoQuake(SpriteNum);
|
||||
SetSumoQuake(actor);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -731,16 +725,14 @@ int DoSumoRumble(DSWActor* actor)
|
|||
int InitSumoFart(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
int SpriteNum = u->SpriteNum;
|
||||
SPRITEp sp = &sprite[SpriteNum];
|
||||
extern int InitSumoNapalm(short SpriteNum);
|
||||
SPRITEp sp = &actor->s();
|
||||
|
||||
PlaySound(DIGI_SUMOFART, sp, v3df_follow);
|
||||
PlaySound(DIGI_SUMOFART, actor, v3df_follow);
|
||||
|
||||
InitChemBomb(actor);
|
||||
|
||||
SetSumoFartQuake(SpriteNum);
|
||||
InitSumoNapalm(SpriteNum);
|
||||
SetSumoFartQuake(actor);
|
||||
InitSumoNapalm(actor);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -749,12 +741,11 @@ int InitSumoStomp(DSWActor* actor)
|
|||
{
|
||||
USER* u = actor->u();
|
||||
int SpriteNum = u->SpriteNum;
|
||||
SPRITEp sp = &sprite[SpriteNum];
|
||||
extern int InitSumoStompAttack(short SpriteNum);
|
||||
SPRITEp sp = &actor->s();
|
||||
|
||||
PlaySound(DIGI_SUMOSTOMP, sp, v3df_none);
|
||||
SetSumoQuake(SpriteNum);
|
||||
InitSumoStompAttack(SpriteNum);
|
||||
PlaySound(DIGI_SUMOSTOMP, actor, v3df_none);
|
||||
SetSumoQuake(actor);
|
||||
InitSumoStompAttack(actor);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -762,25 +753,21 @@ int InitSumoStomp(DSWActor* actor)
|
|||
int InitSumoClap(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
int SpriteNum = u->SpriteNum;
|
||||
SPRITEp sp = &sprite[SpriteNum];
|
||||
extern int InitMiniSumoClap(short SpriteNum);
|
||||
extern int InitSumoSkull(short SpriteNum);
|
||||
SPRITEp sp = &actor->s();
|
||||
|
||||
if (sp->pal == 16 && RandomRange(1000) <= 800)
|
||||
InitMiniSumoClap(SpriteNum);
|
||||
InitMiniSumoClap(actor);
|
||||
else
|
||||
InitSumoSkull(SpriteNum);
|
||||
InitSumoSkull(actor);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DoSumoDeathMelt(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
int SpriteNum = u->SpriteNum;
|
||||
SPRITEp sp = &sprite[SpriteNum];
|
||||
SPRITEp sp = &actor->s();
|
||||
|
||||
PlaySound(DIGI_SUMOFART, sp, v3df_follow);
|
||||
PlaySound(DIGI_SUMOFART, actor, v3df_follow);
|
||||
|
||||
u->ID = SUMO_RUN_R0;
|
||||
InitChemBomb(actor);
|
||||
|
@ -799,14 +786,12 @@ int DoSumoDeathMelt(DSWActor* actor)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
BossHealthMeter(void)
|
||||
void BossHealthMeter(void)
|
||||
{
|
||||
SPRITEp sp;
|
||||
USERp u;
|
||||
PLAYERp pp = Player + myconnectindex;
|
||||
short color=0,metertics,meterunit;
|
||||
int i = 0;
|
||||
int y;
|
||||
extern bool NoMeters;
|
||||
short health;
|
||||
|
@ -824,20 +809,20 @@ BossHealthMeter(void)
|
|||
if (currentLevel->gameflags & (LEVEL_SW_BOSSMETER_SERPENT|LEVEL_SW_BOSSMETER_SUMO|LEVEL_SW_BOSSMETER_ZILLA) &&
|
||||
BossSpriteNum[0] <= -1 && BossSpriteNum[1] <= -1 && BossSpriteNum[2] <= -1)
|
||||
{
|
||||
StatIterator it(STAT_ENEMY);
|
||||
while ((i = it.NextIndex()) >= 0)
|
||||
SWStatIterator it(STAT_ENEMY);
|
||||
while (auto itActor = it.Next())
|
||||
{
|
||||
sp = &sprite[i];
|
||||
u = User[i].Data();
|
||||
sp = &itActor->s();
|
||||
u = itActor->u();
|
||||
|
||||
if ((u->ID == SERP_RUN_R0 || u->ID == SUMO_RUN_R0 || u->ID == ZILLA_RUN_R0) && sp->pal != 16)
|
||||
{
|
||||
if (u->ID == SERP_RUN_R0 && (currentLevel->gameflags & LEVEL_SW_BOSSMETER_SERPENT))
|
||||
BossSpriteNum[0] = i;
|
||||
BossSpriteNum[0] = itActor->GetSpriteIndex();
|
||||
else if (u->ID == SUMO_RUN_R0 && (currentLevel->gameflags & LEVEL_SW_BOSSMETER_SUMO))
|
||||
BossSpriteNum[1] = i;
|
||||
BossSpriteNum[1] = itActor->GetSpriteIndex();
|
||||
else if (u->ID == ZILLA_RUN_R0 && (currentLevel->gameflags & LEVEL_SW_BOSSMETER_ZILLA))
|
||||
BossSpriteNum[2] = i;
|
||||
BossSpriteNum[2] = itActor->GetSpriteIndex();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -847,7 +832,7 @@ BossHealthMeter(void)
|
|||
|
||||
|
||||
// Only show the meter when you can see the boss
|
||||
for (i=0; i<3; i++)
|
||||
for (int i=0; i<3; i++)
|
||||
{
|
||||
if (BossSpriteNum[i] >= 0 && !bosswasseen[i])
|
||||
{
|
||||
|
@ -885,7 +870,7 @@ BossHealthMeter(void)
|
|||
}
|
||||
|
||||
|
||||
for (i=0; i<3; i++)
|
||||
for (int i=0; i<3; i++)
|
||||
{
|
||||
|
||||
if (i == 0 && (!bosswasseen[0] || BossSpriteNum[0] < 0))
|
||||
|
|
|
@ -13660,12 +13660,10 @@ InitFistAttack(PLAYERp pp)
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
InitSumoNapalm(short SpriteNum)
|
||||
int InitSumoNapalm(DSWActor* actor)
|
||||
{
|
||||
short w;
|
||||
SPRITEp sp = &sprite[SpriteNum], wp;
|
||||
USERp u = User[SpriteNum].Data(), wu;
|
||||
SPRITEp sp = &actor->s(), wp;
|
||||
USERp u = actor->u(), wu;
|
||||
short dist;
|
||||
short i,j,ang;
|
||||
|
||||
|
@ -13687,20 +13685,20 @@ InitSumoNapalm(short SpriteNum)
|
|||
{
|
||||
for (i = 0; i < (int)SIZ(mp); i++)
|
||||
{
|
||||
w = SpawnSprite(STAT_MISSILE, FIREBALL1, s_Napalm, sp->sectnum,
|
||||
auto wActor = SpawnActor(STAT_MISSILE, FIREBALL1, s_Napalm, sp->sectnum,
|
||||
sp->x, sp->y, SPRITEp_TOS(sp), ang, NAPALM_VELOCITY);
|
||||
|
||||
wp = &sprite[w];
|
||||
wu = User[w].Data();
|
||||
wp = &wActor->s();
|
||||
wu = wActor->u();
|
||||
|
||||
wp->hitag = LUMINOUS; //Always full brightness
|
||||
if (i==0) // Only attach sound to first projectile
|
||||
{
|
||||
PlaySound(DIGI_NAPWIZ, wp, v3df_follow);
|
||||
Set3DSoundOwner(w);
|
||||
Set3DSoundOwner(wActor->GetSpriteIndex());
|
||||
}
|
||||
|
||||
SetOwner(SpriteNum, w);
|
||||
SetOwner(actor, wActor);
|
||||
wp->shade = -40;
|
||||
wp->xrepeat = 32;
|
||||
wp->yrepeat = 32;
|
||||
|
@ -13719,7 +13717,7 @@ InitSumoNapalm(short SpriteNum)
|
|||
if (mp[i].dist_over != 0)
|
||||
{
|
||||
wp->ang = NORM_ANGLE(wp->ang + mp[i].ang);
|
||||
HelpMissileLateral(w, mp[i].dist_over);
|
||||
HelpMissileLateral(wActor->GetSpriteIndex(), mp[i].dist_over);
|
||||
wp->ang = NORM_ANGLE(wp->ang - mp[i].ang);
|
||||
}
|
||||
|
||||
|
@ -13733,7 +13731,7 @@ InitSumoNapalm(short SpriteNum)
|
|||
wu->ychange = MOVEy(wp->xvel, wp->ang);
|
||||
wu->zchange = wp->zvel;
|
||||
|
||||
MissileSetPos(w, DoNapalm, mp[i].dist_out);
|
||||
MissileSetPos(wActor->GetSpriteIndex(), DoNapalm, mp[i].dist_out);
|
||||
|
||||
sp->clipdist = oclipdist;
|
||||
|
||||
|
@ -13745,13 +13743,10 @@ InitSumoNapalm(short SpriteNum)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
InitSumoSkull(short SpriteNum)
|
||||
int InitSumoSkull(DSWActor* actor)
|
||||
{
|
||||
auto actor = &swActors[SpriteNum];
|
||||
SPRITEp sp = User[SpriteNum]->SpriteP, np;
|
||||
USERp u = User[SpriteNum].Data(), nu;
|
||||
short New;
|
||||
SPRITEp sp = &actor->s(), np;
|
||||
USERp u = actor->u(), nu;
|
||||
|
||||
extern STATE s_SkullExplode[];
|
||||
extern STATE s_SkullWait[5][1];
|
||||
|
@ -13759,16 +13754,15 @@ InitSumoSkull(short SpriteNum)
|
|||
extern ATTRIBUTE SkullAttrib;
|
||||
|
||||
|
||||
PlaySound(DIGI_SERPSUMMONHEADS, sp, v3df_none);
|
||||
PlaySound(DIGI_SERPSUMMONHEADS, actor, v3df_none);
|
||||
|
||||
New = SpawnSprite(STAT_ENEMY, SKULL_R0, &s_SkullWait[0][0], sp->sectnum, sp->x, sp->y, SPRITEp_MID(sp), sp->ang, 0);
|
||||
auto actorNew = &swActors[New];
|
||||
auto actorNew = SpawnActor(STAT_ENEMY, SKULL_R0, &s_SkullWait[0][0], sp->sectnum, sp->x, sp->y, SPRITEp_MID(sp), sp->ang, 0);
|
||||
|
||||
np = &sprite[New];
|
||||
nu = User[New].Data();
|
||||
np = &actorNew->s();
|
||||
nu = actorNew->u();
|
||||
|
||||
np->xvel = 500;
|
||||
SetOwner(SpriteNum, New);
|
||||
SetOwner(actor, actorNew);
|
||||
np->shade = -20;
|
||||
np->xrepeat = 64;
|
||||
np->yrepeat = 64;
|
||||
|
@ -13803,26 +13797,23 @@ InitSumoSkull(short SpriteNum)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
InitSumoStompAttack(short SpriteNum)
|
||||
int InitSumoStompAttack(DSWActor* actor)
|
||||
{
|
||||
USERp u = User[SpriteNum].Data();
|
||||
SPRITEp sp = &sprite[SpriteNum],tsp;
|
||||
int i;
|
||||
USERp u = actor->u();
|
||||
SPRITEp sp = &actor->s(),tsp;
|
||||
unsigned stat;
|
||||
int dist;
|
||||
short reach;
|
||||
|
||||
|
||||
PlaySound(DIGI_30MMEXPLODE, sp, v3df_dontpan|v3df_doppler);
|
||||
PlaySound(DIGI_30MMEXPLODE, actor, v3df_dontpan|v3df_doppler);
|
||||
|
||||
for (stat = 0; stat < SIZ(StatDamageList); stat++)
|
||||
{
|
||||
StatIterator it(StatDamageList[stat]);
|
||||
while ((i = it.NextIndex()) >= 0)
|
||||
SWStatIterator it(StatDamageList[stat]);
|
||||
while (auto itActor = it.Next())
|
||||
{
|
||||
auto itActor = &swActors[i];
|
||||
tsp = &sprite[i];
|
||||
tsp = &itActor->s();
|
||||
|
||||
if (itActor != u->targetActor)
|
||||
break;
|
||||
|
@ -13837,7 +13828,7 @@ InitSumoStompAttack(short SpriteNum)
|
|||
if (dist < CLOSE_RANGE_DIST_FUDGE(tsp, sp, reach))
|
||||
{
|
||||
if (FAFcansee(tsp->x,tsp->y,SPRITEp_MID(tsp),tsp->sectnum,sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum))
|
||||
DoDamage(i, SpriteNum);
|
||||
DoDamage(itActor->GetSpriteIndex(), actor->GetSpriteIndex());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13846,38 +13837,38 @@ InitSumoStompAttack(short SpriteNum)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
InitMiniSumoClap(short SpriteNum)
|
||||
int InitMiniSumoClap(DSWActor* actor)
|
||||
{
|
||||
SPRITEp sp = &sprite[SpriteNum];
|
||||
USERp u = User[SpriteNum].Data();
|
||||
SPRITEp sp = &actor->s();
|
||||
USERp u = actor->u();
|
||||
int dist;
|
||||
short reach;
|
||||
|
||||
|
||||
if (!u->targetActor) return 0;
|
||||
auto tsp = &u->targetActor->s();
|
||||
|
||||
dist = Distance(sp->x, sp->y, u->targetActor->s().x, u->targetActor->s().y);
|
||||
dist = Distance(sp->x, sp->y, tsp->x, tsp->y);
|
||||
|
||||
reach = 10000;
|
||||
|
||||
if (dist < CLOSE_RANGE_DIST_FUDGE(&u->targetActor->s(), sp, 1000))
|
||||
if (dist < CLOSE_RANGE_DIST_FUDGE(tsp, sp, 1000))
|
||||
{
|
||||
if (SpriteOverlapZ(SpriteNum, u->targetActor->GetSpriteIndex(), Z(20)))
|
||||
if (SpriteOverlapZ(actor->GetSpriteIndex(), u->targetActor->GetSpriteIndex(), Z(20)))
|
||||
{
|
||||
if (FAFcansee(u->targetActor->s().x,u->targetActor->s().y,ActorMid(u->targetActor),u->targetActor->s().sectnum,sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum))
|
||||
if (FAFcansee(tsp->x, tsp->y, ActorMid(u->targetActor), tsp->sectnum, sp->x, sp->y, SPRITEp_MID(sp), sp->sectnum))
|
||||
{
|
||||
PlaySound(DIGI_CGTHIGHBONE, sp, v3df_follow|v3df_dontpan);
|
||||
DoDamage(u->targetActor->GetSpriteIndex(), SpriteNum);
|
||||
PlaySound(DIGI_CGTHIGHBONE, actor, v3df_follow | v3df_dontpan);
|
||||
DoDamage(u->targetActor->GetSpriteIndex(), actor->GetSpriteIndex());
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dist < CLOSE_RANGE_DIST_FUDGE(&u->targetActor->s(), sp, reach))
|
||||
else if (dist < CLOSE_RANGE_DIST_FUDGE(tsp, sp, reach))
|
||||
{
|
||||
if (FAFcansee(u->targetActor->s().x,u->targetActor->s().y,ActorMid(u->targetActor),u->targetActor->s().sectnum,sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum))
|
||||
if (FAFcansee(tsp->x, tsp->y, ActorMid(u->targetActor), tsp->sectnum, sp->x, sp->y, SPRITEp_MID(sp), sp->sectnum))
|
||||
{
|
||||
PlaySound(DIGI_30MMEXPLODE, sp, v3df_none);
|
||||
SpawnFireballFlames(SpriteNum, u->targetActor->GetSpriteIndex());
|
||||
PlaySound(DIGI_30MMEXPLODE, actor, v3df_none);
|
||||
SpawnFireballFlames(actor->GetSpriteIndex(), u->targetActor->GetSpriteIndex());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue