Add events for the remaining player-related HUD display functions:

EVENT_DISPLAYSPIT - loogies from the SPIT projectile
EVENT_DISPLAYFIST - nukebutton fist (shrunk fists are part of EVENT_DISPLAYWEAPON)
EVENT_DISPLAYKNEE - pstomp knee (quick kick is part of EVENT_DISPLAYWEAPON)
EVENT_DISPLAYKNUCKLES - knuckle crack idle animation
EVENT_DISPLAYSCUBA - scuba gear
EVENT_DISPLAYTIP - tip hand
EVENT_DISPLAYACCESS - access cards / keycards

git-svn-id: https://svn.eduke32.com/eduke32@5118 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2015-03-30 05:57:30 +00:00
parent 0b1d786f35
commit c24e5f51cd
4 changed files with 89 additions and 10 deletions

View file

@ -113,6 +113,13 @@ enum GameEvent_t {
EVENT_WORLD,
EVENT_PREWORLD,
EVENT_PRELEVEL,
EVENT_DISPLAYSPIT,
EVENT_DISPLAYFIST,
EVENT_DISPLAYKNEE,
EVENT_DISPLAYKNUCKLES,
EVENT_DISPLAYSCUBA,
EVENT_DISPLAYTIP,
EVENT_DISPLAYACCESS,
#ifdef LUNATIC
EVENT_ANIMATEALLSPRITES,
#endif

View file

@ -681,6 +681,13 @@ const char *EventNames[MAXEVENTS] =
"EVENT_WORLD",
"EVENT_PREWORLD",
"EVENT_PRELEVEL",
"EVENT_DISPLAYSPIT",
"EVENT_DISPLAYFIST",
"EVENT_DISPLAYKNEE",
"EVENT_DISPLAYKNUCKLES",
"EVENT_DISPLAYSCUBA",
"EVENT_DISPLAYTIP",
"EVENT_DISPLAYACCESS",
#ifdef LUNATIC
"EVENT_ANIMATEALLSPRITES",
#endif

View file

@ -185,11 +185,18 @@ EVENT = {
EVENT_WORLD = 105,
EVENT_PREWORLD = 106,
EVENT_PRELEVEL = 107,
EVENT_DISPLAYSPIT = 108,
EVENT_DISPLAYFIST = 109,
EVENT_DISPLAYKNEE = 110,
EVENT_DISPLAYKNUCKLES = 111,
EVENT_DISPLAYSCUBA = 112,
EVENT_DISPLAYTIP = 113,
EVENT_DISPLAYACCESS = 114,
-- EVENT_ANIMATEALLSPRITES = previous+1, -- internal
-- KEEPINSYNC with MAXEVENTS below
}
MAXEVENTS = 108 -- KEEPINSYNC with above EVENT_* list
MAXEVENTS = 115 -- KEEPINSYNC with above EVENT_* list
-- NOTE: negated values are not exported to the ffi.C namespace or CON.
-- See TWEAK_SFLAG below.

View file

@ -1670,11 +1670,15 @@ static void P_DisplaySpit(void)
{
DukePlayer_t *const ps = g_player[screenpeek].ps;
const int32_t loogcnt = ps->loogcnt;
const int32_t y = loogcnt<<2;
if (loogcnt == 0)
return;
if (VM_OnEvent(EVENT_DISPLAYSPIT, ps->i, screenpeek) != 0)
return;
const int32_t y = loogcnt<<2;
for (int32_t i=0; i < ps->numloogs; i++)
{
int32_t a = klabs(sintable[((loogcnt+i)<<5)&2047])>>5;
@ -1716,6 +1720,14 @@ static int32_t P_DisplayFist(int32_t gs)
if (fisti > 32) fisti = 32;
if (fisti <= 0) return 0;
switch (VM_OnEvent(EVENT_DISPLAYFIST, ps->i, screenpeek))
{
case 1:
return 1;
case -1:
return 0;
}
looking_arc = klabs(ps->look_ang)/9;
fistzoom = 65536 - (sintable[(512+(fisti<<6))&2047]<<2);
@ -1856,13 +1868,25 @@ static inline void G_DrawWeaponTileWithID(int32_t id, int32_t x, int32_t y, int3
static int32_t P_DisplayKnee(int32_t gs)
{
static const int8_t knee_y[] = {0,-8,-16,-32,-64,-84,-108,-108,-108,-72,-32,-8};
int32_t looking_arc, pal;
const DukePlayer_t *const ps = g_player[screenpeek].ps;
if (ps->knee_incs == 0 || ps->knee_incs >= ARRAY_SIZE(knee_y) || sprite[ps->i].extra <= 0)
if (ps->knee_incs == 0)
return 0;
switch (VM_OnEvent(EVENT_DISPLAYKNEE, ps->i, screenpeek))
{
case 1:
return 1;
case -1:
return 0;
}
if (ps->knee_incs >= ARRAY_SIZE(knee_y) || sprite[ps->i].extra <= 0)
return 0;
int32_t looking_arc, pal;
looking_arc = knee_y[ps->knee_incs] + klabs(ps->look_ang)/9;
looking_arc -= (ps->hard_landing<<3);
@ -1880,13 +1904,24 @@ static int32_t P_DisplayKnee(int32_t gs)
static int32_t P_DisplayKnuckles(int32_t gs)
{
static const int8_t knuckle_frames[] = {0,1,2,2,3,3,3,2,2,1,0};
int32_t looking_arc, pal;
const DukePlayer_t *const ps = g_player[screenpeek].ps;
if (ps->knuckle_incs == 0 || (unsigned) (ps->knuckle_incs>>1) >= ARRAY_SIZE(knuckle_frames) || sprite[ps->i].extra <= 0)
if (ps->knuckle_incs == 0)
return 0;
switch (VM_OnEvent(EVENT_DISPLAYKNUCKLES, ps->i, screenpeek))
{
case 1:
return 1;
case -1:
return 0;
}
if ((unsigned) (ps->knuckle_incs>>1) >= ARRAY_SIZE(knuckle_frames) || sprite[ps->i].extra <= 0)
return 0;
int32_t looking_arc, pal;
looking_arc = klabs(ps->look_ang)/9;
looking_arc -= (ps->hard_landing<<3);
@ -1998,7 +2033,12 @@ void P_DisplayScuba(void)
{
if (g_player[screenpeek].ps->scuba_on)
{
int32_t p = P_GetHudPal(g_player[screenpeek].ps);
const DukePlayer_t *const ps = g_player[screenpeek].ps;
if (VM_OnEvent(EVENT_DISPLAYSCUBA, ps->i, screenpeek) != 0)
return;
int32_t p = P_GetHudPal(ps);
#ifdef SPLITSCREEN_MOD_HACKS
g_snum = screenpeek;
@ -2021,16 +2061,25 @@ static const int8_t access_tip_y [] ={
static int32_t P_DisplayTip(int32_t gs)
{
const DukePlayer_t *const ps = g_player[screenpeek].ps;
int y, looking_arc, p = 0;
if (ps->tipincs == 0)
return 0;
switch (VM_OnEvent(EVENT_DISPLAYTIP, ps->i, screenpeek))
{
case 1:
return 1;
case -1:
return 0;
}
// Report that the tipping hand has been drawn so that the otherwise
// selected weapon is not drawn.
if ((unsigned)ps->tipincs >= ARRAY_SIZE(access_tip_y))
return 1;
int y, looking_arc, p = 0;
looking_arc = (klabs(ps->look_ang) / 9) - (ps->hard_landing << 3);
p = P_GetHudPal(ps);
@ -2051,14 +2100,23 @@ static int32_t P_DisplayTip(int32_t gs)
static int32_t P_DisplayAccess(int32_t gs)
{
const DukePlayer_t *const ps = g_player[screenpeek].ps;
int y, looking_arc, p = 0;
if (ps->access_incs == 0)
return 0;
switch (VM_OnEvent(EVENT_DISPLAYACCESS, ps->i, screenpeek))
{
case 1:
return 1;
case -1:
return 0;
}
if ((unsigned)ps->access_incs >= ARRAY_SIZE(access_tip_y)-4 || sprite[ps->i].extra <= 0)
return 1;
int y, looking_arc, p = 0;
looking_arc = access_tip_y[ps->access_incs] + (klabs(ps->look_ang) / 9) - (ps->hard_landing << 3);
if (ps->access_spritenum >= 0)