mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-30 02:30:41 +00:00
- fall_common and its fallspecial subfunction.
This commit is contained in:
parent
185b795481
commit
f0b1ab504d
7 changed files with 66 additions and 85 deletions
|
@ -5279,16 +5279,16 @@ void alterang(int ang, DDukeActor* actor, int playernum)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void fall_common(int g_i, int g_p, int JIBS6, int DRONE, int BLOODPOOL, int SHOTSPARK1, int squished, int thud, int(*fallspecial)(int, int), void (*falladjustz)(spritetype*))
|
void fall_common(DDukeActor *actor, int g_p, int JIBS6, int DRONE, int BLOODPOOL, int SHOTSPARK1, int squished, int thud, int(*fallspecial)(DDukeActor*, int))
|
||||||
{
|
{
|
||||||
auto g_sp = &sprite[g_i];
|
auto g_sp = &actor->s;
|
||||||
g_sp->xoffset = 0;
|
g_sp->xoffset = 0;
|
||||||
g_sp->yoffset = 0;
|
g_sp->yoffset = 0;
|
||||||
// if(!gotz)
|
// if(!gotz)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
int sphit = fallspecial? fallspecial(g_i, g_p) : 0;
|
int sphit = fallspecial? fallspecial(actor, g_p) : 0;
|
||||||
if (fi.floorspace(g_sp->sectnum))
|
if (fi.floorspace(g_sp->sectnum))
|
||||||
c = 0;
|
c = 0;
|
||||||
else
|
else
|
||||||
|
@ -5298,14 +5298,14 @@ void fall_common(int g_i, int g_p, int JIBS6, int DRONE, int BLOODPOOL, int SHOT
|
||||||
else c = gc;
|
else c = gc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hittype[g_i].cgg <= 0 || (sector[g_sp->sectnum].floorstat & 2))
|
if (actor->cgg <= 0 || (sector[g_sp->sectnum].floorstat & 2))
|
||||||
{
|
{
|
||||||
getglobalz(g_i);
|
getglobalz(actor);
|
||||||
hittype[g_i].cgg = 6;
|
actor->cgg = 6;
|
||||||
}
|
}
|
||||||
else hittype[g_i].cgg--;
|
else actor->cgg--;
|
||||||
|
|
||||||
if (g_sp->z < (hittype[g_i].floorz - FOURSLEIGHT))
|
if (g_sp->z < (actor->floorz - FOURSLEIGHT))
|
||||||
{
|
{
|
||||||
g_sp->zvel += c;
|
g_sp->zvel += c;
|
||||||
g_sp->z += g_sp->zvel;
|
g_sp->z += g_sp->zvel;
|
||||||
|
@ -5314,9 +5314,9 @@ void fall_common(int g_i, int g_p, int JIBS6, int DRONE, int BLOODPOOL, int SHOT
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_sp->z = hittype[g_i].floorz - FOURSLEIGHT;
|
g_sp->z = actor->floorz - FOURSLEIGHT;
|
||||||
|
|
||||||
if (badguy(g_sp) || (g_sp->picnum == TILE_APLAYER && g_sp->owner >= 0))
|
if (badguy(actor) || (g_sp->picnum == TILE_APLAYER && actor->GetOwner()))
|
||||||
{
|
{
|
||||||
|
|
||||||
if (g_sp->zvel > 3084 && g_sp->extra <= 1)
|
if (g_sp->zvel > 3084 && g_sp->extra <= 1)
|
||||||
|
@ -5327,21 +5327,21 @@ void fall_common(int g_i, int g_p, int JIBS6, int DRONE, int BLOODPOOL, int SHOT
|
||||||
goto SKIPJIBS;
|
goto SKIPJIBS;
|
||||||
if (sphit)
|
if (sphit)
|
||||||
{
|
{
|
||||||
fi.guts(g_sp, JIBS6, 5, g_p);
|
fi.guts(&actor->s, JIBS6, 5, g_p);
|
||||||
S_PlayActorSound(squished, g_i);
|
S_PlayActorSound(squished, actor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fi.guts(g_sp, JIBS6, 15, g_p);
|
fi.guts(&actor->s, JIBS6, 15, g_p);
|
||||||
S_PlayActorSound(squished, g_i);
|
S_PlayActorSound(squished, actor);
|
||||||
fi.spawn(g_i, BLOODPOOL);
|
spawn(actor, BLOODPOOL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SKIPJIBS:
|
SKIPJIBS:
|
||||||
|
|
||||||
hittype[g_i].picnum = SHOTSPARK1;
|
actor->picnum = SHOTSPARK1;
|
||||||
hittype[g_i].extra = 1;
|
actor->extra = 1;
|
||||||
g_sp->zvel = 0;
|
g_sp->zvel = 0;
|
||||||
}
|
}
|
||||||
else if (g_sp->zvel > 2048 && sector[g_sp->sectnum].lotag != 1)
|
else if (g_sp->zvel > 2048 && sector[g_sp->sectnum].lotag != 1)
|
||||||
|
@ -5350,15 +5350,15 @@ void fall_common(int g_i, int g_p, int JIBS6, int DRONE, int BLOODPOOL, int SHOT
|
||||||
short j = g_sp->sectnum;
|
short j = g_sp->sectnum;
|
||||||
int x = g_sp->x, y = g_sp->y, z = g_sp->z;
|
int x = g_sp->x, y = g_sp->y, z = g_sp->z;
|
||||||
pushmove(&x, &y, &z, &j, 128, (4 << 8), (4 << 8), CLIPMASK0);
|
pushmove(&x, &y, &z, &j, 128, (4 << 8), (4 << 8), CLIPMASK0);
|
||||||
setspritepos(g_i, x, y, z); // wrap this for safety. The renderer may need processing of the new position.
|
setspritepos(actor->GetIndex(), x, y, z); // wrap this for safety. The renderer may need processing of the new position.
|
||||||
if (j != g_sp->sectnum && j >= 0 && j < MAXSECTORS)
|
if (j != g_sp->sectnum && j >= 0 && j < MAXSECTORS)
|
||||||
changespritesect(g_i, j);
|
changespritesect(actor, j);
|
||||||
|
|
||||||
S_PlayActorSound(thud, g_i);
|
S_PlayActorSound(thud, actor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sector[g_sp->sectnum].lotag == 1)
|
if (sector[g_sp->sectnum].lotag == 1)
|
||||||
falladjustz(g_sp);
|
g_sp->z += actorinfo[g_sp->picnum].falladjustz;
|
||||||
else g_sp->zvel = 0;
|
else g_sp->zvel = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4037,29 +4037,9 @@ void move_d(int g_i, int g_p, int g_x)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
static void falladjustz(spritetype* g_sp)
|
|
||||||
{
|
|
||||||
switch (g_sp->picnum)
|
|
||||||
{
|
|
||||||
case OCTABRAIN:
|
|
||||||
case COMMANDER:
|
|
||||||
case DRONE:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
g_sp->z += (24 << 8);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void fall_d(int g_i, int g_p)
|
void fall_d(int g_i, int g_p)
|
||||||
{
|
{
|
||||||
fall_common(g_i, g_p, JIBS6, DRONE, BLOODPOOL, SHOTSPARK1, SQUISHED, THUD, nullptr, falladjustz);
|
fall_common(&hittype[g_i], g_p, JIBS6, DRONE, BLOODPOOL, SHOTSPARK1, SQUISHED, THUD, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool spawnweapondebris_d(int picnum, int dnum)
|
bool spawnweapondebris_d(int picnum, int dnum)
|
||||||
|
|
|
@ -4078,36 +4078,36 @@ void fakebubbaspawn(int g_i, int g_p)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static int fallspecial(int g_i, int g_p)
|
static int fallspecial(DDukeActor *actor, int g_p)
|
||||||
{
|
{
|
||||||
|
auto g_sp = &actor->s;
|
||||||
int sphit = 0;
|
int sphit = 0;
|
||||||
auto g_sp = &sprite[g_i];
|
|
||||||
if (isRRRA())
|
if (isRRRA())
|
||||||
{
|
{
|
||||||
if (sector[g_sp->sectnum].lotag == 801)
|
if (sector[g_sp->sectnum].lotag == 801)
|
||||||
{
|
{
|
||||||
if (g_sp->picnum == ROCK)
|
if (g_sp->picnum == ROCK)
|
||||||
{
|
{
|
||||||
fi.spawn(g_i, ROCK2);
|
spawn(actor, ROCK2);
|
||||||
fi.spawn(g_i, ROCK2);
|
spawn(actor, ROCK2);
|
||||||
addspritetodelete(g_i);
|
addspritetodelete();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (sector[g_sp->sectnum].lotag == 802)
|
else if (sector[g_sp->sectnum].lotag == 802)
|
||||||
{
|
{
|
||||||
if (g_sp->picnum != APLAYER && badguy(g_sp) && g_sp->z == hittype[g_i].floorz - FOURSLEIGHT)
|
if (g_sp->picnum != APLAYER && badguy(actor) && g_sp->z == actor->floorz - FOURSLEIGHT)
|
||||||
{
|
{
|
||||||
fi.guts(g_sp, JIBS6, 5, g_p);
|
fi.guts(&actor->s, JIBS6, 5, g_p);
|
||||||
S_PlayActorSound(SQUISHED, g_i);
|
S_PlayActorSound(SQUISHED, actor);
|
||||||
addspritetodelete(g_i);
|
addspritetodelete();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (sector[g_sp->sectnum].lotag == 803)
|
else if (sector[g_sp->sectnum].lotag == 803)
|
||||||
{
|
{
|
||||||
if (g_sp->picnum == ROCK2)
|
if (g_sp->picnum == ROCK2)
|
||||||
addspritetodelete(g_i);
|
addspritetodelete();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4115,25 +4115,25 @@ static int fallspecial(int g_i, int g_p)
|
||||||
{
|
{
|
||||||
if (g_sp->picnum == 40)
|
if (g_sp->picnum == 40)
|
||||||
{
|
{
|
||||||
addspritetodelete(g_i);
|
addspritetodelete();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (g_sp->picnum != APLAYER && (badguy(g_sp) || g_sp->picnum == HEN || g_sp->picnum == COW || g_sp->picnum == PIG || g_sp->picnum == DOGRUN || g_sp->picnum == RABBIT) && (!isRRRA() || hittype[g_i].spriteextra < 128))
|
if (g_sp->picnum != APLAYER && (badguy(actor) || g_sp->picnum == HEN || g_sp->picnum == COW || g_sp->picnum == PIG || g_sp->picnum == DOGRUN || g_sp->picnum == RABBIT) && (!isRRRA() || actor->spriteextra < 128))
|
||||||
{
|
{
|
||||||
g_sp->z = hittype[g_i].floorz - FOURSLEIGHT;
|
g_sp->z = actor->floorz - FOURSLEIGHT;
|
||||||
g_sp->zvel = 8000;
|
g_sp->zvel = 8000;
|
||||||
g_sp->extra = 0;
|
g_sp->extra = 0;
|
||||||
hittype[g_i].spriteextra++;
|
actor->spriteextra++;
|
||||||
sphit = 1;
|
sphit = 1;
|
||||||
}
|
}
|
||||||
else if (g_sp->picnum != APLAYER)
|
else if (g_sp->picnum != APLAYER)
|
||||||
{
|
{
|
||||||
if (!hittype[g_i].spriteextra)
|
if (!actor->spriteextra)
|
||||||
addspritetodelete(g_i);
|
addspritetodelete();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
hittype[g_i].picnum = SHOTSPARK1;
|
actor->picnum = SHOTSPARK1;
|
||||||
hittype[g_i].extra = 1;
|
actor->extra = 1;
|
||||||
}
|
}
|
||||||
else if (isRRRA() && (sector[g_sp->sectnum].floorpicnum == RRTILE7820 || sector[g_sp->sectnum].floorpicnum == RRTILE7768))
|
else if (isRRRA() && (sector[g_sp->sectnum].floorpicnum == RRTILE7820 || sector[g_sp->sectnum].floorpicnum == RRTILE7768))
|
||||||
{
|
{
|
||||||
|
@ -4141,8 +4141,8 @@ static int fallspecial(int g_i, int g_p)
|
||||||
{
|
{
|
||||||
if ((krand() & 3) == 1)
|
if ((krand() & 3) == 1)
|
||||||
{
|
{
|
||||||
hittype[g_i].picnum = SHOTSPARK1;
|
actor->picnum = SHOTSPARK1;
|
||||||
hittype[g_i].extra = 5;
|
actor->extra = 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4155,28 +4155,9 @@ static int fallspecial(int g_i, int g_p)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static void falladjustz(spritetype* g_sp)
|
|
||||||
{
|
|
||||||
if (isRRRA()) switch (g_sp->picnum)
|
|
||||||
{
|
|
||||||
case HULKBOAT:
|
|
||||||
g_sp->z += (12 << 8);
|
|
||||||
return;
|
|
||||||
case MINIONBOAT:
|
|
||||||
g_sp->z += (3 << 8);
|
|
||||||
return;
|
|
||||||
case CHEERBOAT:
|
|
||||||
case EMPTYBOAT:
|
|
||||||
g_sp->z += (6 << 8);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (g_sp->picnum != DRONE)
|
|
||||||
g_sp->z += (24 << 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
void fall_r(int g_i, int g_p)
|
void fall_r(int g_i, int g_p)
|
||||||
{
|
{
|
||||||
fall_common(g_i, g_p, JIBS6, DRONE, BLOODPOOL, SHOTSPARK1, 69, 158, fallspecial, falladjustz);
|
fall_common(&hittype[g_i], g_p, JIBS6, DRONE, BLOODPOOL, SHOTSPARK1, 69, 158, fallspecial);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
|
@ -42,6 +42,12 @@ void initactorflags_d()
|
||||||
{
|
{
|
||||||
actorinfo[COMMANDER].gutsoffset = -(24 << 8);
|
actorinfo[COMMANDER].gutsoffset = -(24 << 8);
|
||||||
|
|
||||||
|
for (auto &fa : actorinfo)
|
||||||
|
{
|
||||||
|
fa.falladjustz = 24 << 8;
|
||||||
|
}
|
||||||
|
actorinfo[OCTABRAIN].falladjustz = actorinfo[COMMANDER].falladjustz = actorinfo[DRONE].falladjustz = 0;
|
||||||
|
|
||||||
setflag(SFLAG_INTERNAL_BADGUY, {
|
setflag(SFLAG_INTERNAL_BADGUY, {
|
||||||
SHARK,
|
SHARK,
|
||||||
RECON,
|
RECON,
|
||||||
|
|
|
@ -34,6 +34,19 @@ BEGIN_DUKE_NS
|
||||||
|
|
||||||
void initactorflags_r()
|
void initactorflags_r()
|
||||||
{
|
{
|
||||||
|
for (auto &fa : actorinfo)
|
||||||
|
{
|
||||||
|
fa.falladjustz = 24 << 8;
|
||||||
|
}
|
||||||
|
if (isRRRA())
|
||||||
|
{
|
||||||
|
actorinfo[HULKBOAT].falladjustz = 12 << 8;
|
||||||
|
actorinfo[MINIONBOAT].falladjustz = 3 << 8;
|
||||||
|
actorinfo[CHEERBOAT].falladjustz = actorinfo[EMPTYBOAT].falladjustz = 6 << 8;
|
||||||
|
}
|
||||||
|
actorinfo[DRONE].falladjustz = 0;
|
||||||
|
|
||||||
|
|
||||||
setflag(SFLAG_INTERNAL_BADGUY|SFLAG_KILLCOUNT, {
|
setflag(SFLAG_INTERNAL_BADGUY|SFLAG_KILLCOUNT, {
|
||||||
BOULDER,
|
BOULDER,
|
||||||
BOULDER1,
|
BOULDER1,
|
||||||
|
|
|
@ -98,7 +98,7 @@ void respawn_rrra(DDukeActor* oldact, DDukeActor* newact);
|
||||||
|
|
||||||
int dodge(DDukeActor*);
|
int dodge(DDukeActor*);
|
||||||
void alterang(int ang, DDukeActor* actor, int g_p);
|
void alterang(int ang, DDukeActor* actor, int g_p);
|
||||||
void fall_common(int g_i, int g_p, int JIBS6, int DRONE, int BLOODPOOL, int SHOTSPARK1, int squished, int thud, int(*fallspecial)(int, int), void (*falladjustz)(spritetype*));
|
void fall_common(DDukeActor* g_i, int g_p, int JIBS6, int DRONE, int BLOODPOOL, int SHOTSPARK1, int squished, int thud, int(*fallspecial)(DDukeActor*, int));
|
||||||
void checkavailweapon(struct player_struct* p);
|
void checkavailweapon(struct player_struct* p);
|
||||||
void deletesprite(DDukeActor* num);
|
void deletesprite(DDukeActor* num);
|
||||||
void addammo(int weapon, struct player_struct* p, int amount);
|
void addammo(int weapon, struct player_struct* p, int amount);
|
||||||
|
@ -181,7 +181,7 @@ void spriteglass(int snum, int cnt);
|
||||||
void lotsofcolourglass(int snum, int wallNum, int cnt);
|
void lotsofcolourglass(int snum, int wallNum, int cnt);
|
||||||
void lotsofglass(int snum, int wallnum, int cnt);
|
void lotsofglass(int snum, int wallnum, int cnt);
|
||||||
|
|
||||||
void addspritetodelete(int spnum);
|
void addspritetodelete(int spnum=0);
|
||||||
void checkavailinven(struct player_struct* p);
|
void checkavailinven(struct player_struct* p);
|
||||||
int initspriteforspawn(int j, int pn, const std::initializer_list<int> &excludes);
|
int initspriteforspawn(int j, int pn, const std::initializer_list<int> &excludes);
|
||||||
void spawninitdefault(int j, int i);
|
void spawninitdefault(int j, int i);
|
||||||
|
|
|
@ -13,7 +13,7 @@ BEGIN_DUKE_NS
|
||||||
struct STATUSBARTYPE
|
struct STATUSBARTYPE
|
||||||
{
|
{
|
||||||
short frag[MAXPLAYERS], got_access, last_extra, shield_amount, curr_weapon;
|
short frag[MAXPLAYERS], got_access, last_extra, shield_amount, curr_weapon;
|
||||||
short ammo_amount[MAX_WEAPONS], holoduke_on;
|
short ammo_amount[MAX_WEAPONS];
|
||||||
unsigned char inven_icon, jetpack_on, heat_on;
|
unsigned char inven_icon, jetpack_on, heat_on;
|
||||||
short firstaid_amount, steroids_amount, holoduke_amount, jetpack_amount;
|
short firstaid_amount, steroids_amount, holoduke_amount, jetpack_amount;
|
||||||
short heat_amount, scuba_amount, boot_amount;
|
short heat_amount, scuba_amount, boot_amount;
|
||||||
|
@ -104,6 +104,7 @@ struct ActorInfo
|
||||||
uint32_t scriptaddress;
|
uint32_t scriptaddress;
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
int aimoffset;
|
int aimoffset;
|
||||||
|
int falladjustz;
|
||||||
int gutsoffset;
|
int gutsoffset;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue