From 0422e4064995f1411f8cbcb7600a4fd2b3779de4 Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Tue, 24 Oct 2017 17:19:14 +0100 Subject: [PATCH] Add graphic for throwing items Fix missing frame of clash --- src/dehacked.c | 10 ++++++++++ src/info.c | 45 +++++++++++++++++++++++++++++++++++++++------ src/info.h | 9 +++++++++ src/k_kart.c | 11 +++++++++++ src/p_mobj.c | 18 ++++++++++++++++++ 5 files changed, 87 insertions(+), 6 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 1955f29a..93029b6c 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -6398,6 +6398,12 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_CLASH3", "S_CLASH4", "S_CLASH5", + "S_CLASH6", + + "S_FIREDITEM1", + "S_FIREDITEM2", + "S_FIREDITEM3", + "S_FIREDITEM4", #ifdef SEENAMES "S_NAMECHECK", @@ -6963,6 +6969,10 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_BUMP", + "MT_ITEMCLASH", + + "MT_FIREDITEM", + #ifdef SEENAMES "MT_NAMECHECK", #endif diff --git a/src/info.c b/src/info.c index c2d6d27a..ab570ed8 100644 --- a/src/info.c +++ b/src/info.c @@ -58,7 +58,7 @@ char sprnames[NUMSPRITES + 1][5] = "SPRG","BSPR","RNDM","RPOP","KFRE","DRIF","DSMO","FITM","DFAK","BANA", "DBAN","GSHE","DGSH","RSHE","DRSH","BOMB","BLIG","LIGH","SINK","SITR", "LAKI","POKE","AUDI","DECO","DOOD","SNES","GBAS","SPRS","BUZB","CHOM", - "SACO","CRAB","SHAD","BUMP","FLEN","CLAS" + "SACO","CRAB","SHAD","BUMP","FLEN","CLAS","PSHW" }; // Doesn't work with g++, needs actionf_p1 (don't modify this comment) @@ -2849,11 +2849,17 @@ state_t states[NUMSTATES] = {SPR_FLEN, FF_FULLBRIGHT|1, 3, {NULL}, 0, 0, S_FLINGENERGY3}, // S_FLINGENERGY2, {SPR_FLEN, FF_FULLBRIGHT|2, 3, {NULL}, 0, 0, S_NULL}, // S_FLINGENERGY3, - {SPR_CLAS, FF_FULLBRIGHT|FF_TRANS30|1, 2, {NULL}, 0, 0, S_CLASH2}, - {SPR_CLAS, FF_FULLBRIGHT|FF_TRANS30|2, 2, {NULL}, 0, 0, S_CLASH3}, - {SPR_CLAS, FF_FULLBRIGHT|FF_TRANS30|3, 2, {NULL}, 0, 0, S_CLASH4}, - {SPR_CLAS, FF_FULLBRIGHT|FF_TRANS30|4, 2, {NULL}, 0, 0, S_CLASH5}, - {SPR_CLAS, FF_FULLBRIGHT|FF_TRANS30|5, 2, {NULL}, 0, 0, S_NULL}, + {SPR_CLAS, FF_FULLBRIGHT|FF_TRANS30, 2, {NULL}, 0, 0, S_CLASH2}, // S_CLASH1 + {SPR_CLAS, FF_FULLBRIGHT|FF_TRANS30|1, 2, {NULL}, 0, 0, S_CLASH3}, // S_CLASH2 + {SPR_CLAS, FF_FULLBRIGHT|FF_TRANS30|2, 2, {NULL}, 0, 0, S_CLASH4}, // S_CLASH3 + {SPR_CLAS, FF_FULLBRIGHT|FF_TRANS30|3, 2, {NULL}, 0, 0, S_CLASH5}, // S_CLASH4 + {SPR_CLAS, FF_FULLBRIGHT|FF_TRANS30|4, 2, {NULL}, 0, 0, S_CLASH6}, // S_CLASH5 + {SPR_CLAS, FF_FULLBRIGHT|FF_TRANS30|5, 2, {NULL}, 0, 0, S_NULL}, // S_CLASH6 + + {SPR_PSHW, 0, 3, {NULL}, 0, 0, S_FIREDITEM2}, // S_FIREDITEM1 + {SPR_PSHW, 1, 3, {NULL}, 0, 0, S_FIREDITEM3}, // S_FIREDITEM2 + {SPR_PSHW, 2, 3, {NULL}, 0, 0, S_FIREDITEM4}, // S_FIREDITEM3 + {SPR_PSHW, 3, 3, {NULL}, 0, 0, S_NULL}, // S_FIREDITEM4 #ifdef SEENAMES {SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL}, // S_NAMECHECK @@ -16567,6 +16573,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_SCENERY, // flags S_NULL // raisestate }, + + { // MT_FIREDITEM + -1, // doomednum + S_FIREDITEM1, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 60*FRACUNIT, // speed + 32*FRACUNIT, // radius + 64*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_SCENERY, // flags + S_NULL // raisestate + }, // ============================================================================================================================// #ifdef SEENAMES diff --git a/src/info.h b/src/info.h index f6bf735f..c1a9e1b1 100644 --- a/src/info.h +++ b/src/info.h @@ -618,6 +618,7 @@ typedef enum sprite SPR_BUMP, // Player/shell bump SPR_FLEN, // Shell hit graphics stuff SPR_CLAS, // items clash + SPR_PSHW, // thrown indicator SPR_FIRSTFREESLOT, SPR_LASTFREESLOT = SPR_FIRSTFREESLOT + NUMSPRITEFREESLOTS - 1, @@ -3369,6 +3370,12 @@ typedef enum state S_CLASH3, S_CLASH4, S_CLASH5, + S_CLASH6, + + S_FIREDITEM1, + S_FIREDITEM2, + S_FIREDITEM3, + S_FIREDITEM4, #ifdef SEENAMES S_NAMECHECK, @@ -4012,6 +4019,8 @@ typedef enum mobj_type MT_ITEMCLASH, + MT_FIREDITEM, + #ifdef SEENAMES MT_NAMECHECK, #endif diff --git a/src/k_kart.c b/src/k_kart.c index efc931ed..3e03c267 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1824,6 +1824,13 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t angle th->momx = FixedMul(speed, FINECOSINE(an>>ANGLETOFINESHIFT)); th->momy = FixedMul(speed, FINESINE(an>>ANGLETOFINESHIFT)); + x = x + P_ReturnThrustX(source, an, source->radius + th->radius); + x = y + P_ReturnThrustY(source, an, source->radius + th->radius); + mobj_t *throwmo = P_SpawnMobj(x, y, z, MT_FIREDITEM); + throwmo->movecount = 1; + throwmo->movedir = source->angle - an; + P_SetTarget(&throwmo->target, source); + return NULL; } @@ -2042,6 +2049,10 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map if (player->mo->eflags & MFE_VERTICALFLIP) mo->eflags |= MFE_VERTICALFLIP; } + + mobj_t *throwmo = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + 80*FRACUNIT, MT_FIREDITEM); + P_SetTarget(&throwmo->target, player->mo); + throwmo->movecount = 0; // above player } else { diff --git a/src/p_mobj.c b/src/p_mobj.c index 2c628c21..64664ea6 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6819,6 +6819,24 @@ void P_MobjThinker(mobj_t *mobj) return; } break; + case MT_FIREDITEM: + { + fixed_t x, y, z; + if (mobj->movecount) + { + x = mobj->target->x + P_ReturnThrustX(mobj->target, mobj->target->angle + mobj->movedir, mobj->target->radius + mobj->radius); + y = mobj->target->y + P_ReturnThrustY(mobj->target, mobj->target->angle + mobj->movedir, mobj->target->radius + mobj->radius); + z = mobj->target->z + mobj->target->height/3; + } + else + { + x = mobj->target->x; + y = mobj->target->y; + z = mobj->target->z + 80*FRACUNIT; + } + P_TeleportMove(mobj, x, y, z); + break; + } default: if (mobj->fuse) { // Scenery object fuse! Very basic!