mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-29 13:00:43 +00:00
- fixed the messed up parameter order of OnEvent.
This should serve as a textbook example why passing around indices is a very, very bad idea!
This commit is contained in:
parent
c1b5b17541
commit
de92287d0b
15 changed files with 100 additions and 102 deletions
|
@ -182,7 +182,7 @@ void checkavailweapon(struct player_struct* player)
|
|||
{
|
||||
SetGameVarID(g_iWorksLikeVarID, -1, player->GetActor(), snum);
|
||||
}
|
||||
OnEvent(EVENT_CHANGEWEAPON, snum, player->i, -1);
|
||||
OnEvent(EVENT_CHANGEWEAPON, snum, player->GetActor(), -1);
|
||||
}
|
||||
|
||||
player->okickback_pic = player->kickback_pic = 0;
|
||||
|
|
|
@ -256,7 +256,7 @@ void addweapon_d(struct player_struct *p, int weapon)
|
|||
SetGameVarID(g_iWorksLikeVarID, -1, snum, p->GetActor());
|
||||
}
|
||||
SetGameVarID(g_iReturnVarID, 0, snum, -1);
|
||||
OnEvent(EVENT_CHANGEWEAPON, p->i, snum, -1);
|
||||
OnEvent(EVENT_CHANGEWEAPON, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, snum) == 0)
|
||||
{
|
||||
p->curr_weapon = weapon;
|
||||
|
|
|
@ -4010,7 +4010,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
|
|||
}
|
||||
}
|
||||
|
||||
void fakebubbaspawn(DDukeActor *g_i, int g_p)
|
||||
void fakebubbaspawn(DDukeActor *actor, int g_p)
|
||||
{
|
||||
fakebubba_spawn++;
|
||||
switch (fakebubba_spawn)
|
||||
|
@ -4018,16 +4018,16 @@ void fakebubbaspawn(DDukeActor *g_i, int g_p)
|
|||
default:
|
||||
break;
|
||||
case 1:
|
||||
spawn(g_i, PIG);
|
||||
spawn(actor, PIG);
|
||||
break;
|
||||
case 2:
|
||||
spawn(g_i, MINION);
|
||||
spawn(actor, MINION);
|
||||
break;
|
||||
case 3:
|
||||
spawn(g_i, CHEER);
|
||||
spawn(actor, CHEER);
|
||||
break;
|
||||
case 4:
|
||||
spawn(g_i, VIXEN);
|
||||
spawn(actor, VIXEN);
|
||||
operateactivators(666, ps[g_p].GetActor()->GetIndex());
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -242,7 +242,7 @@ static bool cheatInventory(int player)
|
|||
auto invGet = [=](int defvalue, int evtype, int16_t &dest)
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, defvalue, -1, player);
|
||||
OnEvent(evtype, -1, player, -1);
|
||||
OnEvent(evtype, player, nullptr, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, player) >= 0)
|
||||
{
|
||||
dest = GetGameVarID(g_iReturnVarID, -1, player);
|
||||
|
|
|
@ -82,8 +82,8 @@ bool spawnweapondebris_d(int picnum, int dnum);
|
|||
bool spawnweapondebris_r(int picnum, int dnum);
|
||||
void respawnhitag_d(DDukeActor* g_sp);
|
||||
void respawnhitag_r(DDukeActor* g_sp);
|
||||
void checktimetosleep_d(DDukeActor* g_i);
|
||||
void checktimetosleep_r(DDukeActor* g_i);
|
||||
void checktimetosleep_d(DDukeActor* actor);
|
||||
void checktimetosleep_r(DDukeActor* actor);
|
||||
void move_d(DDukeActor* i, int g_p, int g_x);
|
||||
void move_r(DDukeActor* i, int g_p, int g_x);
|
||||
int spawn_d(int j, int pn);
|
||||
|
|
|
@ -95,10 +95,10 @@ struct Dispatcher
|
|||
void (*guts)(DDukeActor* s, short gtype, short n, short p);
|
||||
DDukeActor* (*ifhitsectors)(int sectnum);
|
||||
int (*ifhitbyweapon)(DDukeActor* sectnum);
|
||||
void (*fall)(DDukeActor* g_i, int g_p);
|
||||
void (*fall)(DDukeActor* actor, int g_p);
|
||||
bool (*spawnweapondebris)(int picnum, int dnum);
|
||||
void (*respawnhitag)(DDukeActor* g_sp);
|
||||
void (*checktimetosleep)(DDukeActor* g_i);
|
||||
void (*checktimetosleep)(DDukeActor* actor);
|
||||
void (*move)(DDukeActor* i, int g_p, int g_x);
|
||||
int (*spawn)(int j, int pn);
|
||||
|
||||
|
|
|
@ -297,4 +297,5 @@ inline int hitasprite(DDukeActor* actor, DDukeActor** hit)
|
|||
else *hit = nullptr;
|
||||
return dist;
|
||||
}
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -101,7 +101,7 @@ void check_fta_sounds_r(DDukeActor* i);
|
|||
|
||||
int dodge(DDukeActor*);
|
||||
void alterang(int ang, DDukeActor* actor, int g_p);
|
||||
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 fall_common(DDukeActor* actor, 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 deletesprite(DDukeActor* num);
|
||||
void addammo(int weapon, struct player_struct* p, int amount);
|
||||
|
@ -175,7 +175,7 @@ void execute(DDukeActor* s, int p, int d);
|
|||
void makeitfall(DDukeActor* s);
|
||||
int furthestangle(DDukeActor* snum, int angDiv);
|
||||
void getglobalz(DDukeActor* s);
|
||||
void OnEvent(int id, int pnum = -1, int snum = -1, int dist = -1);
|
||||
void OnEvent(int id, int pnum = -1, DDukeActor* snum = nullptr, int dist = -1);
|
||||
|
||||
short EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed char s_s, signed char s_xr, signed char s_yr, short s_a, short s_ve, int s_zv, short s_ow, signed char s_ss);
|
||||
void ceilingglass(int snum, int sectnum, int cnt);
|
||||
|
|
|
@ -68,11 +68,10 @@ enum playeraction_t {
|
|||
|
||||
struct ParseState
|
||||
{
|
||||
int g_i, g_p;
|
||||
int g_p;
|
||||
int g_x;
|
||||
int* g_t;
|
||||
uint8_t killit_flag;
|
||||
spritetype* g_sp;
|
||||
DDukeActor *g_ac;
|
||||
int* insptr;
|
||||
Collision coll;
|
||||
|
@ -83,10 +82,10 @@ struct ParseState
|
|||
|
||||
int furthestcanseepoint(DDukeActor* i, DDukeActor* ts, int* dax, int* day);
|
||||
bool ifsquished(DDukeActor* i, int p);
|
||||
void fakebubbaspawn(DDukeActor* g_i, int g_p);
|
||||
void fakebubbaspawn(DDukeActor* actor, int g_p);
|
||||
void tearitup(int sect);
|
||||
void destroyit(DDukeActor* actor);
|
||||
void mamaspawn(DDukeActor* g_i);
|
||||
void mamaspawn(DDukeActor* actor);
|
||||
void forceplayerangle(int snum);
|
||||
|
||||
bool killthesprite = false;
|
||||
|
@ -2552,7 +2551,7 @@ int ParseState::parse(void)
|
|||
|
||||
/* case 74:
|
||||
insptr++;
|
||||
getglobalz(g_i);
|
||||
getglobalz(g_ac);
|
||||
parseifelse( (( g_ac->floorz - g_ac->ceilingz ) >> 8 ) >= *insptr);
|
||||
break;
|
||||
*/
|
||||
|
@ -3824,7 +3823,7 @@ quit:
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void OnEvent(int iEventID, int p, int i, int x)
|
||||
void OnEvent(int iEventID, int p, DDukeActor *actor, int x)
|
||||
{
|
||||
char done;
|
||||
|
||||
|
@ -3839,12 +3838,10 @@ void OnEvent(int iEventID, int p, int i, int x)
|
|||
}
|
||||
|
||||
ParseState s;
|
||||
s.g_i = i; // current sprite ID
|
||||
s.g_p = p; /// current player ID
|
||||
s.g_x = x; // ?
|
||||
s.g_sp = &sprite[i];
|
||||
s.g_ac = &hittype[i];
|
||||
s.g_t = &hittype[i].temp_data[0];
|
||||
s.g_ac = actor;
|
||||
s.g_t = actor->temp_data;
|
||||
|
||||
s.insptr = &ScriptCode[apScriptGameEvent[iEventID]];
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ static InputPacket loc; // input accumulation buffer.
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void hud_input(int snum)
|
||||
void hud_input(int plnum)
|
||||
{
|
||||
int i, k;
|
||||
uint8_t dainv;
|
||||
|
@ -63,10 +63,10 @@ void hud_input(int snum)
|
|||
short unk;
|
||||
|
||||
unk = 0;
|
||||
p = &ps[snum];
|
||||
p = &ps[plnum];
|
||||
|
||||
i = p->aim_mode;
|
||||
p->aim_mode = !PlayerInput(snum, SB_AIMMODE);
|
||||
p->aim_mode = !PlayerInput(plnum, SB_AIMMODE);
|
||||
if (p->aim_mode < i)
|
||||
p->sync.actions |= SB_CENTERVIEW;
|
||||
|
||||
|
@ -75,7 +75,7 @@ void hud_input(int snum)
|
|||
|
||||
if (isRR())
|
||||
{
|
||||
if (PlayerInput(snum, SB_QUICK_KICK) && p->last_pissed_time == 0)
|
||||
if (PlayerInput(plnum, SB_QUICK_KICK) && p->last_pissed_time == 0)
|
||||
{
|
||||
if (!isRRRA() || p->GetActor()->s.extra > 0)
|
||||
{
|
||||
|
@ -93,21 +93,21 @@ void hud_input(int snum)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (PlayerInput(snum, SB_QUICK_KICK) && p->quick_kick == 0 && (p->curr_weapon != KNEE_WEAPON || p->kickback_pic == 0))
|
||||
if (PlayerInput(plnum, SB_QUICK_KICK) && p->quick_kick == 0 && (p->curr_weapon != KNEE_WEAPON || p->kickback_pic == 0))
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, snum);
|
||||
OnEvent(EVENT_QUICKKICK, -1, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, snum) == 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, plnum);
|
||||
OnEvent(EVENT_QUICKKICK, plnum, nullptr, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, plnum) == 0)
|
||||
{
|
||||
p->quick_kick = 14;
|
||||
if (!p->quick_kick_msg && snum == screenpeek) FTA(QUOTE_MIGHTY_FOOT, p);
|
||||
if (!p->quick_kick_msg && plnum == screenpeek) FTA(QUOTE_MIGHTY_FOOT, p);
|
||||
p->quick_kick_msg = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!PlayerInput(snum, SB_QUICK_KICK)) p->quick_kick_msg = false;
|
||||
if (!PlayerInput(plnum, SB_QUICK_KICK)) p->quick_kick_msg = false;
|
||||
|
||||
if (!PlayerInputBits(snum, SB_INTERFACE_BITS))
|
||||
if (!PlayerInputBits(plnum, SB_INTERFACE_BITS))
|
||||
p->interface_toggle_flag = 0;
|
||||
else if (p->interface_toggle_flag == 0)
|
||||
{
|
||||
|
@ -118,21 +118,21 @@ void hud_input(int snum)
|
|||
if (p->GetActor()->s.extra <= 0) return;
|
||||
|
||||
// Activate an inventory item. This just forwards to the other inventory bits. If the inventory selector was taken out of the playsim this could be removed.
|
||||
if (PlayerInput(snum, SB_INVUSE) && p->newowner == -1)
|
||||
if (PlayerInput(plnum, SB_INVUSE) && p->newowner == -1)
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, snum);
|
||||
OnEvent(EVENT_INVENTORY, -1, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, snum) == 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, plnum);
|
||||
OnEvent(EVENT_INVENTORY, plnum, nullptr, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, plnum) == 0)
|
||||
{
|
||||
if (p->inven_icon > ICON_NONE && p->inven_icon <= ICON_HEATS) PlayerSetItemUsed(snum, p->inven_icon);
|
||||
if (p->inven_icon > ICON_NONE && p->inven_icon <= ICON_HEATS) PlayerSetItemUsed(plnum, p->inven_icon);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isRR() && PlayerUseItem(snum, ICON_HEATS))
|
||||
if (!isRR() && PlayerUseItem(plnum, ICON_HEATS))
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, snum);
|
||||
OnEvent(EVENT_USENIGHTVISION, -1, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, snum) == 0 && p->heat_amount > 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, plnum);
|
||||
OnEvent(EVENT_USENIGHTVISION, plnum, nullptr, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, plnum) == 0 && p->heat_amount > 0)
|
||||
{
|
||||
p->heat_on = !p->heat_on;
|
||||
setpal(p);
|
||||
|
@ -142,11 +142,11 @@ void hud_input(int snum)
|
|||
}
|
||||
}
|
||||
|
||||
if (PlayerUseItem(snum, ICON_STEROIDS))
|
||||
if (PlayerUseItem(plnum, ICON_STEROIDS))
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, snum);
|
||||
OnEvent(EVENT_USESTEROIDS, -1, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, snum) == 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, plnum);
|
||||
OnEvent(EVENT_USESTEROIDS, plnum, nullptr, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, plnum) == 0)
|
||||
{
|
||||
if (p->steroids_amount == 400)
|
||||
{
|
||||
|
@ -159,11 +159,11 @@ void hud_input(int snum)
|
|||
return;
|
||||
}
|
||||
|
||||
if (PlayerInput(snum, SB_INVPREV) || PlayerInput(snum, SB_INVNEXT))
|
||||
if (PlayerInput(plnum, SB_INVPREV) || PlayerInput(plnum, SB_INVNEXT))
|
||||
{
|
||||
p->invdisptime = 26 * 2;
|
||||
|
||||
if (PlayerInput(snum, SB_INVNEXT)) k = 1;
|
||||
if (PlayerInput(plnum, SB_INVNEXT)) k = 1;
|
||||
else k = 0;
|
||||
|
||||
dainv = p->inven_icon;
|
||||
|
@ -225,17 +225,17 @@ void hud_input(int snum)
|
|||
else dainv = 0;
|
||||
|
||||
// These events force us to keep the inventory selector in the playsim as opposed to the UI where it really belongs.
|
||||
if (PlayerInput(snum, SB_INVPREV))
|
||||
if (PlayerInput(plnum, SB_INVPREV))
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, dainv, -1, snum);
|
||||
OnEvent(EVENT_INVENTORYLEFT, -1, snum, -1);
|
||||
dainv = GetGameVarID(g_iReturnVarID, -1, snum);
|
||||
SetGameVarID(g_iReturnVarID, dainv, -1, plnum);
|
||||
OnEvent(EVENT_INVENTORYLEFT, plnum, nullptr, -1);
|
||||
dainv = GetGameVarID(g_iReturnVarID, -1, plnum);
|
||||
}
|
||||
if (PlayerInput(snum, SB_INVNEXT))
|
||||
if (PlayerInput(plnum, SB_INVNEXT))
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, dainv, -1, snum);
|
||||
OnEvent(EVENT_INVENTORYRIGHT, -1, snum, -1);
|
||||
dainv = GetGameVarID(g_iReturnVarID, -1, snum);
|
||||
SetGameVarID(g_iReturnVarID, dainv, -1, plnum);
|
||||
OnEvent(EVENT_INVENTORYRIGHT, plnum, nullptr, -1);
|
||||
dainv = GetGameVarID(g_iReturnVarID, -1, plnum);
|
||||
}
|
||||
p->inven_icon = dainv;
|
||||
// Someone must have really hated constant data, doing this with a switch/case (and of course also with literal numbers...)
|
||||
|
@ -243,14 +243,14 @@ void hud_input(int snum)
|
|||
if (dainv >= 1 && dainv < 8) FTA(invquotes[dainv - 1], p);
|
||||
}
|
||||
|
||||
int weap = PlayerNewWeapon(snum);
|
||||
int weap = PlayerNewWeapon(plnum);
|
||||
if (weap > 1 && p->kickback_pic > 0)
|
||||
p->wantweaponfire = weap - 1;
|
||||
|
||||
// Here we have to be extra careful that the weapons do not get mixed up, so let's keep the code for Duke and RR completely separate.
|
||||
fi.selectweapon(snum, weap);
|
||||
fi.selectweapon(plnum, weap);
|
||||
|
||||
if (PlayerInput(snum, SB_HOLSTER))
|
||||
if (PlayerInput(plnum, SB_HOLSTER))
|
||||
{
|
||||
if (p->curr_weapon > KNEE_WEAPON)
|
||||
{
|
||||
|
@ -269,11 +269,11 @@ void hud_input(int snum)
|
|||
}
|
||||
}
|
||||
|
||||
if (PlayerUseItem(snum, ICON_HOLODUKE) && (isRR() || p->newowner == -1))
|
||||
if (PlayerUseItem(plnum, ICON_HOLODUKE) && (isRR() || p->newowner == -1))
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, snum);
|
||||
OnEvent(EVENT_HOLODUKEON, -1, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, snum) == 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, plnum);
|
||||
OnEvent(EVENT_HOLODUKEON, plnum, nullptr, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, plnum) == 0)
|
||||
{
|
||||
if (!isRR())
|
||||
{
|
||||
|
@ -290,7 +290,7 @@ void hud_input(int snum)
|
|||
p->posz + (30 << 8), TILE_APLAYER, -64, 0, 0, p->angle.ang.asbuild(), 0, 0, -1, 10);
|
||||
hittype[i].temp_data[3] = hittype[i].temp_data[4] = 0;
|
||||
p->holoduke_on = &hittype[i];
|
||||
sprite[i].yvel = snum;
|
||||
sprite[i].yvel = plnum;
|
||||
sprite[i].extra = 0;
|
||||
FTA(QUOTE_HOLODUKE_ON, p);
|
||||
S_PlayActorSound(TELEPORTER, p->holoduke_on);
|
||||
|
@ -326,18 +326,18 @@ void hud_input(int snum)
|
|||
}
|
||||
}
|
||||
|
||||
if (isRR() && PlayerUseItem(snum, ICON_HEATS) && p->newowner == -1)
|
||||
if (isRR() && PlayerUseItem(plnum, ICON_HEATS) && p->newowner == -1)
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, snum);
|
||||
OnEvent(EVENT_USENIGHTVISION, -1, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, snum) == 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, plnum);
|
||||
OnEvent(EVENT_USENIGHTVISION, plnum, nullptr, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, plnum) == 0)
|
||||
{
|
||||
if (p->yehaa_timer == 0)
|
||||
{
|
||||
p->yehaa_timer = 126;
|
||||
S_PlayActorSound(390, p->i);
|
||||
p->noise_radius = 16384;
|
||||
madenoise(snum);
|
||||
madenoise(plnum);
|
||||
if (sector[p->cursectnum].lotag == 857)
|
||||
{
|
||||
if (p->GetActor()->s.extra <= max_player_health)
|
||||
|
@ -358,11 +358,11 @@ void hud_input(int snum)
|
|||
}
|
||||
}
|
||||
|
||||
if (PlayerUseItem(snum, ICON_FIRSTAID))
|
||||
if (PlayerUseItem(plnum, ICON_FIRSTAID))
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, snum);
|
||||
OnEvent(EVENT_USEMEDKIT, -1, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, snum) == 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, plnum);
|
||||
OnEvent(EVENT_USEMEDKIT, plnum, nullptr, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, plnum) == 0)
|
||||
{
|
||||
if (p->firstaid_amount > 0 && p->GetActor()->s.extra < max_player_health)
|
||||
{
|
||||
|
@ -411,11 +411,11 @@ void hud_input(int snum)
|
|||
}
|
||||
}
|
||||
|
||||
if (PlayerUseItem(snum, ICON_JETPACK) && (isRR() || p->newowner == -1))
|
||||
if (PlayerUseItem(plnum, ICON_JETPACK) && (isRR() || p->newowner == -1))
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, snum);
|
||||
OnEvent(EVENT_USEJETPACK, -1, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, snum) == 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, plnum);
|
||||
OnEvent(EVENT_USEJETPACK, plnum, nullptr, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, plnum) == 0)
|
||||
{
|
||||
if (!isRR())
|
||||
{
|
||||
|
@ -479,11 +479,11 @@ void hud_input(int snum)
|
|||
}
|
||||
}
|
||||
|
||||
if (PlayerInput(snum, SB_TURNAROUND) && p->angle.spin.asbam() == 0 && p->on_crane == nullptr)
|
||||
if (PlayerInput(plnum, SB_TURNAROUND) && p->angle.spin.asbam() == 0 && p->on_crane == nullptr)
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, snum);
|
||||
OnEvent(EVENT_TURNAROUND, -1, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, snum) != 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, plnum);
|
||||
OnEvent(EVENT_TURNAROUND, plnum, nullptr, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, plnum) != 0)
|
||||
{
|
||||
p->sync.actions &= ~SB_TURNAROUND;
|
||||
}
|
||||
|
|
|
@ -742,7 +742,7 @@ void playerCrouch(int snum)
|
|||
auto p = &ps[snum];
|
||||
// crouching
|
||||
SetGameVarID(g_iReturnVarID, 0, p->i, snum);
|
||||
OnEvent(EVENT_CROUCH, p->i, snum, -1);
|
||||
OnEvent(EVENT_CROUCH, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0)
|
||||
{
|
||||
p->posz += (2048 + 768);
|
||||
|
@ -758,7 +758,7 @@ void playerJump(int snum, int fz, int cz)
|
|||
if ((fz - cz) > (56 << 8))
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, p->i, snum);
|
||||
OnEvent(EVENT_JUMP, p->i, snum, -1);
|
||||
OnEvent(EVENT_JUMP, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0)
|
||||
{
|
||||
p->jumping_counter = 1;
|
||||
|
@ -905,7 +905,7 @@ void checklook(int snum, ESyncBits actions)
|
|||
if ((actions & SB_LOOK_LEFT) && !p->OnMotorcycle)
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, p->i, snum);
|
||||
OnEvent(EVENT_LOOKLEFT, p->i, snum, -1);
|
||||
OnEvent(EVENT_LOOKLEFT, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) != 0)
|
||||
{
|
||||
actions &= ~SB_LOOK_LEFT;
|
||||
|
@ -915,7 +915,7 @@ void checklook(int snum, ESyncBits actions)
|
|||
if ((actions & SB_LOOK_RIGHT) && !p->OnMotorcycle)
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, p->i, snum);
|
||||
OnEvent(EVENT_LOOKRIGHT, p->i, snum, -1);
|
||||
OnEvent(EVENT_LOOKRIGHT, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) != 0)
|
||||
{
|
||||
actions &= ~SB_LOOK_RIGHT;
|
||||
|
@ -934,7 +934,7 @@ void playerCenterView(int snum)
|
|||
{
|
||||
auto p = &ps[snum];
|
||||
SetGameVarID(g_iReturnVarID, 0, p->i, snum);
|
||||
OnEvent(EVENT_RETURNTOCENTER, p->i, snum, -1);
|
||||
OnEvent(EVENT_RETURNTOCENTER, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0)
|
||||
{
|
||||
p->sync.actions |= SB_CENTERVIEW;
|
||||
|
@ -949,7 +949,7 @@ void playerLookUp(int snum, ESyncBits actions)
|
|||
{
|
||||
auto p = &ps[snum];
|
||||
SetGameVarID(g_iReturnVarID, 0, p->i, snum);
|
||||
OnEvent(EVENT_LOOKUP, p->i, snum, -1);
|
||||
OnEvent(EVENT_LOOKUP, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0)
|
||||
{
|
||||
p->sync.actions |= SB_CENTERVIEW;
|
||||
|
@ -964,7 +964,7 @@ void playerLookDown(int snum, ESyncBits actions)
|
|||
{
|
||||
auto p = &ps[snum];
|
||||
SetGameVarID(g_iReturnVarID, 0, p->i, snum);
|
||||
OnEvent(EVENT_LOOKDOWN, p->i, snum, -1);
|
||||
OnEvent(EVENT_LOOKDOWN, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0)
|
||||
{
|
||||
p->sync.actions |= SB_CENTERVIEW;
|
||||
|
@ -979,7 +979,7 @@ void playerAimUp(int snum, ESyncBits actions)
|
|||
{
|
||||
auto p = &ps[snum];
|
||||
SetGameVarID(g_iReturnVarID, 0, p->i, snum);
|
||||
OnEvent(EVENT_AIMUP, p->i, snum, -1);
|
||||
OnEvent(EVENT_AIMUP, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) != 0)
|
||||
{
|
||||
p->sync.actions &= ~SB_AIM_UP;
|
||||
|
@ -990,7 +990,7 @@ void playerAimDown(int snum, ESyncBits actions)
|
|||
{
|
||||
auto p = &ps[snum];
|
||||
SetGameVarID(g_iReturnVarID, 0, p->i, snum);
|
||||
OnEvent(EVENT_AIMDOWN, p->i, snum, -1);
|
||||
OnEvent(EVENT_AIMDOWN, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) != 0)
|
||||
{
|
||||
p->sync.actions &= ~SB_AIM_DOWN;
|
||||
|
|
|
@ -327,7 +327,7 @@ static void shootweapon(int i, int p, int sx, int sy, int sz, int sa, int atwith
|
|||
if (p >= 0)
|
||||
{
|
||||
SetGameVarID(g_iAimAngleVarID, AUTO_AIM_ANGLE, i, p);
|
||||
OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1);
|
||||
OnEvent(EVENT_GETAUTOAIMANGLE, p, ps[p].GetActor(), -1);
|
||||
j = -1;
|
||||
if (GetGameVarID(g_iAimAngleVarID, i, p) > 0)
|
||||
{
|
||||
|
@ -361,7 +361,7 @@ static void shootweapon(int i, int p, int sx, int sy, int sz, int sa, int atwith
|
|||
int zRange = 256;
|
||||
SetGameVarID(g_iAngRangeVarID, 32, i, p);
|
||||
SetGameVarID(g_iZRangeVarID, 256, i, p);
|
||||
OnEvent(EVENT_GETSHOTRANGE, i, p, -1);
|
||||
OnEvent(EVENT_GETSHOTRANGE, p, ps[p].GetActor(), -1);
|
||||
angRange = GetGameVarID(g_iAngRangeVarID, i, p);
|
||||
zRange = GetGameVarID(g_iZRangeVarID, i, p);
|
||||
|
||||
|
@ -1010,7 +1010,7 @@ void shoot_d(int i, int atwith)
|
|||
|
||||
SetGameVarID(g_iAtWithVarID, 0, p, atwith);
|
||||
SetGameVarID(g_iReturnVarID, 0, p, i);
|
||||
OnEvent(EVENT_SHOOT, i, p, -1);
|
||||
OnEvent(EVENT_SHOOT, p, ps[p].GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p, i) != 0)
|
||||
{
|
||||
return;
|
||||
|
@ -1674,7 +1674,7 @@ static void operateJetpack(int snum, ESyncBits actions, int psectlotag, int fz,
|
|||
{
|
||||
// jump
|
||||
SetGameVarID(g_iReturnVarID, 0, pi, snum);
|
||||
OnEvent(EVENT_SOARUP, pi, snum, -1);
|
||||
OnEvent(EVENT_SOARUP, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, pi, snum) == 0)
|
||||
{
|
||||
p->posz -= j;
|
||||
|
@ -1686,7 +1686,7 @@ static void operateJetpack(int snum, ESyncBits actions, int psectlotag, int fz,
|
|||
{
|
||||
// crouch
|
||||
SetGameVarID(g_iReturnVarID, 0, pi, snum);
|
||||
OnEvent(EVENT_SOARDOWN, pi, snum, -1);
|
||||
OnEvent(EVENT_SOARDOWN, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, pi, snum) == 0)
|
||||
{
|
||||
p->posz += j;
|
||||
|
@ -2642,7 +2642,7 @@ static void processweapon(int snum, ESyncBits actions, int psect)
|
|||
SetGameVarID(g_iReturnVarID, 0, pi, snum);
|
||||
SetGameVarID(g_iWeaponVarID, p->curr_weapon, pi, snum);
|
||||
SetGameVarID(g_iWorksLikeVarID, aplWeaponWorksLike[p->curr_weapon][snum], pi, snum);
|
||||
OnEvent(EVENT_HOLSTER, pi, snum, -1);
|
||||
OnEvent(EVENT_HOLSTER, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, pi, snum) == 0)
|
||||
{
|
||||
// now it uses the game definitions...
|
||||
|
|
|
@ -874,7 +874,7 @@ void shoot_r(int i, int atwith)
|
|||
|
||||
SetGameVarID(g_iAtWithVarID, 0, p, atwith);
|
||||
SetGameVarID(g_iReturnVarID, 0, p, i);
|
||||
OnEvent(EVENT_SHOOT, i, p, -1);
|
||||
OnEvent(EVENT_SHOOT, p, &hittype[i], -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p, i) != 0)
|
||||
{
|
||||
return;
|
||||
|
|
|
@ -161,7 +161,7 @@ void fireweapon_ww(int snum)
|
|||
SetGameVarID(g_iReturnVarID, 0, pi, snum);
|
||||
SetGameVarID(g_iWeaponVarID, p->curr_weapon, pi, snum);
|
||||
SetGameVarID(g_iWorksLikeVarID, aplWeaponWorksLike[p->curr_weapon][snum], pi, snum);
|
||||
OnEvent(EVENT_FIRE, pi, snum, -1);
|
||||
OnEvent(EVENT_FIRE, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, pi, snum) == 0)
|
||||
{
|
||||
switch (aplWeaponWorksLike[p->curr_weapon][snum])
|
||||
|
|
|
@ -297,7 +297,7 @@ void resetweapons(int snum)
|
|||
p->gotweapon.Set(SLINGBLADE_WEAPON);
|
||||
p->ammo_amount[SLINGBLADE_WEAPON] = 1;
|
||||
}
|
||||
OnEvent(EVENT_RESETWEAPONS, -1, snum, -1);
|
||||
OnEvent(EVENT_RESETWEAPONS, snum, nullptr, -1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -370,7 +370,7 @@ void resetinventory(int snum)
|
|||
ufocnt = 0;
|
||||
hulkspawn = 2;
|
||||
}
|
||||
OnEvent(EVENT_RESETINVENTORY, snum, p->i);
|
||||
OnEvent(EVENT_RESETINVENTORY, snum, p->GetActor());
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue