From a6f830ddfff2a664ccd9cd05ddba0e17f9c118ac Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 15 Apr 2017 21:41:22 +0100 Subject: [PATCH 01/32] Add the "MapThingSpawn" hook to Lua --- src/lua_hook.h | 2 ++ src/lua_hooklib.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++ src/p_mobj.c | 10 ++++++++ 3 files changed, 77 insertions(+) diff --git a/src/lua_hook.h b/src/lua_hook.h index 88867db2b..fe5706f56 100644 --- a/src/lua_hook.h +++ b/src/lua_hook.h @@ -46,6 +46,7 @@ enum hook { hook_ShieldSpawn, hook_ShieldSpecial, hook_MobjMoveBlocked, + hook_MapThingSpawn, hook_MAX // last hook }; @@ -83,5 +84,6 @@ boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source, UINT8 #define LUAh_ShieldSpawn(player) LUAh_PlayerHook(player, hook_ShieldSpawn) // Hook for P_SpawnShieldOrb #define LUAh_ShieldSpecial(player) LUAh_PlayerHook(player, hook_ShieldSpecial) // Hook for shield abilities #define LUAh_MobjMoveBlocked(mo) LUAh_MobjHook(mo, hook_MobjMoveBlocked) // Hook for P_XYMovement (when movement is blocked) +boolean LUAh_MapThingSpawn(mobj_t *mo, mapthing_t *mthing); // Hook for P_SpawnMapThing by mobj type #endif diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index dadc1861a..04efac070 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -57,6 +57,7 @@ const char *const hookNames[hook_MAX+1] = { "ShieldSpawn", "ShieldSpecial", "MobjMoveBlocked", + "MapThingSpawn", NULL }; @@ -128,6 +129,7 @@ static int lib_addHook(lua_State *L) case hook_MobjRemoved: case hook_HurtMsg: case hook_MobjMoveBlocked: + case hook_MapThingSpawn: hook.s.mt = MT_NULL; if (lua_isnumber(L, 2)) hook.s.mt = lua_tonumber(L, 2); @@ -187,6 +189,7 @@ static int lib_addHook(lua_State *L) case hook_BossDeath: case hook_MobjRemoved: case hook_MobjMoveBlocked: + case hook_MapThingSpawn: lastp = &mobjhooks[hook.s.mt]; break; case hook_JumpSpecial: @@ -1073,4 +1076,66 @@ void LUAh_NetArchiveHook(lua_CFunction archFunc) // stack: tables } +boolean LUAh_MapThingSpawn(mobj_t *mo, mapthing_t *mthing) +{ + hook_p hookp; + boolean hooked = false; + if (!gL || !(hooksAvailable[hook_MapThingSpawn/8] & (1<<(hook_MapThingSpawn%8)))) + return false; + + lua_settop(gL, 0); + + // Look for all generic mobj map thing spawn hooks + for (hookp = mobjhooks[MT_NULL]; hookp; hookp = hookp->next) + if (hookp->type == hook_MapThingSpawn) + { + if (lua_gettop(gL) == 0) + { + LUA_PushUserdata(gL, mo, META_MOBJ); + LUA_PushUserdata(gL, mthing, META_MAPTHING); + } + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -3); + lua_pushvalue(gL, -3); + if (lua_pcall(gL, 2, 1, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + if (lua_toboolean(gL, -1)) + hooked = true; + lua_pop(gL, 1); + } + + for (hookp = mobjhooks[mo->type]; hookp; hookp = hookp->next) + if (hookp->type == hook_MapThingSpawn) + { + if (lua_gettop(gL) == 0) + { + LUA_PushUserdata(gL, mo, META_MOBJ); + LUA_PushUserdata(gL, mthing, META_MAPTHING); + } + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -3); + lua_pushvalue(gL, -3); + if (lua_pcall(gL, 2, 1, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + if (lua_toboolean(gL, -1)) + hooked = true; + lua_pop(gL, 1); + } + + lua_settop(gL, 0); + return hooked; +} + #endif diff --git a/src/p_mobj.c b/src/p_mobj.c index 520f9ad07..e38551548 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9698,6 +9698,16 @@ void P_SpawnMapThing(mapthing_t *mthing) mobj = P_SpawnMobj(x, y, z, i); mobj->spawnpoint = mthing; +#ifdef HAVE_BLUA + if (LUAh_MapThingSpawn(mobj, mthing)) + { + if (P_MobjWasRemoved(mobj)) + return; + } + else if (P_MobjWasRemoved(mobj)) + return; + else +#endif switch(mobj->type) { case MT_SKYBOX: From 3f0f645c70f04ffac6ca232460fcc7c21e09676f Mon Sep 17 00:00:00 2001 From: Sryder Date: Tue, 13 Dec 2016 21:02:23 +0000 Subject: [PATCH 02/32] Flat sprites for OGL # Conflicts: # src/hardware/hw_main.c --- src/hardware/hw_glob.h | 1 + src/hardware/hw_main.c | 74 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 68 insertions(+), 7 deletions(-) diff --git a/src/hardware/hw_glob.h b/src/hardware/hw_glob.h index 94eef1d3e..5d1a81d4f 100644 --- a/src/hardware/hw_glob.h +++ b/src/hardware/hw_glob.h @@ -78,6 +78,7 @@ typedef struct gr_vissprite_s //Hurdler: 25/04/2000: now support colormap in hardware mode UINT8 *colormap; INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing + float z1, z2; } gr_vissprite_t; // -------- diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index e15713e27..61edca41e 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -4226,6 +4226,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr) GLPatch_t *gpatch; // sprite patch converted to hardware FSurfaceInfo Surf; const boolean hires = (spr->mobj && spr->mobj->skin && ((skin_t *)spr->mobj->skin)->flags & SF_HIRES); + //const boolean papersprite = (spr->mobj && (spr->mobj->frame & FF_PAPERSPRITE)); if (spr->mobj) this_scale = FIXED_TO_FLOAT(spr->mobj->scale); if (hires) @@ -4269,7 +4270,28 @@ static void HWR_DrawSprite(gr_vissprite_t *spr) // make a wall polygon (with 2 triangles), using the floor/ceiling heights, // and the 2d map coords of start/end vertices - wallVerts[0].z = wallVerts[1].z = wallVerts[2].z = wallVerts[3].z = spr->tz; + wallVerts[0].z = wallVerts[3].z = spr->z1; + wallVerts[2].z = wallVerts[1].z = spr->z2; + + // transform + wv = wallVerts; + + /*if (spr->mobj->frame & FF_PAPERSPRITE) + { + float mobjanglecos, mobjanglesin; + mobjanglesin = FIXED_TO_FLOAT(FINESINE((spr->mobj->angle-dup_viewangle+ANGLE_90)>>ANGLETOFINESHIFT)); + mobjanglecos = FIXED_TO_FLOAT(FINECOSINE((spr->mobj->angle-dup_viewangle+ANGLE_90)>>ANGLETOFINESHIFT)); + for (i = 0; i < 4; i++,wv++) + { + // x = (x * anglecos) + (z * anglesin) + // z = (x * anglesin) - (z * anglecos) + // instead of doing the z part we just add spr->tz afterwards because they are all the same + // value right now + tr_x = wv->x-spr->x2+(spr->x2-spr->x1)/2; + //wv->x = (tr_x * mobjanglecos) + (0) + (spr->x1+(spr->x2-spr->x1)/2); + wv->z = (tr_x * mobjanglesin) - (0) + (spr->tz); + } + }*/ // transform wv = wallVerts; @@ -5065,6 +5087,10 @@ static void HWR_ProjectSprite(mobj_t *thing) angle_t ang; INT32 heightsec, phs; + const boolean papersprite = (thing->frame & FF_PAPERSPRITE); + float offset; + float ang_scale = 1.0f, ang_scalez = 0.0f; + float z1, z2; if (!thing) return; @@ -5079,7 +5105,7 @@ static void HWR_ProjectSprite(mobj_t *thing) tz = (tr_x * gr_viewcos) + (tr_y * gr_viewsin); // thing is behind view plane? - if (tz < ZCLIP_PLANE && (!cv_grmd2.value || md2_models[thing->sprite].notfound == true)) //Yellow: Only MD2's dont disappear + if (tz < ZCLIP_PLANE && !papersprite && (!cv_grmd2.value || md2_models[thing->sprite].notfound == true)) //Yellow: Only MD2's dont disappear return; tx = (tr_x * gr_viewsin) - (tr_y * gr_viewcos); @@ -5117,6 +5143,16 @@ static void HWR_ProjectSprite(mobj_t *thing) I_Error("sprframes NULL for sprite %d\n", thing->sprite); #endif + if (sprframe->rotate != SRF_SINGLE || papersprite) + { + ang = R_PointToAngle (thing->x, thing->y) - thing->angle; + if (papersprite) + { + ang_scale = FIXED_TO_FLOAT(FINESINE(ang>>ANGLETOFINESHIFT)); + ang_scalez = FIXED_TO_FLOAT(FINECOSINE(ang>>ANGLETOFINESHIFT)); + } + } + if (sprframe->rotate == SRF_SINGLE) { // use single rotation for all views @@ -5127,8 +5163,6 @@ static void HWR_ProjectSprite(mobj_t *thing) else { // choose a different rotation based on player view - ang = R_PointToAngle (thing->x, thing->y) - thing->angle; - if ((sprframe->rotate & SRF_RIGHT) && (ang < ANGLE_180)) // See from right rot = 6; // F7 slot else if ((sprframe->rotate & SRF_LEFT) && (ang >= ANGLE_180)) // See from left @@ -5146,9 +5180,20 @@ static void HWR_ProjectSprite(mobj_t *thing) // calculate edges of the shape if (flip) - tx -= FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width - spritecachedinfo[lumpoff].offset) * this_scale; + offset = FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width - spritecachedinfo[lumpoff].offset) * this_scale; else - tx -= FIXED_TO_FLOAT(spritecachedinfo[lumpoff].offset) * this_scale; + offset = FIXED_TO_FLOAT(spritecachedinfo[lumpoff].offset) * this_scale; + + if (ang_scale < 0) + { + z1 = tz + offset * ang_scalez; + tx += offset * ang_scale; + } + else + { + z1 = tz - offset * ang_scalez; + tx -= offset * ang_scale; + } // project x x1 = gr_windowcenterx + (tx * gr_centerx / tz); @@ -5159,7 +5204,20 @@ static void HWR_ProjectSprite(mobj_t *thing) x1 = tx; - tx += FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width) * this_scale; + offset = FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width) * this_scale; + if (ang_scale < 0) + { + z2 = z1 - offset * ang_scalez; + tx -= offset * ang_scale; + } + else + { + z2 = z1 + offset * ang_scalez; + tx += offset * ang_scale; + } + if (papersprite && max(z1, z1) < ZCLIP_PLANE) + return; + x2 = gr_windowcenterx + (tx * gr_centerx / tz); if (vflip) @@ -5208,6 +5266,8 @@ static void HWR_ProjectSprite(mobj_t *thing) vis->patchlumpnum = sprframe->lumppat[rot]; vis->flip = flip; vis->mobj = thing; + vis->z1 = z1; + vis->z2 = z2; //Hurdler: 25/04/2000: now support colormap in hardware mode if ((vis->mobj->flags & MF_BOSS) && (vis->mobj->flags2 & MF2_FRET) && (leveltime & 1)) // Bosses "flash" From ec0f30f84919b83afe9a34a674f43b89c63d70c3 Mon Sep 17 00:00:00 2001 From: Sryder Date: Tue, 13 Dec 2016 21:18:05 +0000 Subject: [PATCH 03/32] Fix a one character bug with clipping --- src/hardware/hw_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 61edca41e..3fbdb44d5 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5215,7 +5215,7 @@ static void HWR_ProjectSprite(mobj_t *thing) z2 = z1 + offset * ang_scalez; tx += offset * ang_scale; } - if (papersprite && max(z1, z1) < ZCLIP_PLANE) + if (papersprite && max(z1, z2) < ZCLIP_PLANE) return; x2 = gr_windowcenterx + (tx * gr_centerx / tz); From 32c4ddca5c27d432bfdbb4b7dd0955ec2eddc633 Mon Sep 17 00:00:00 2001 From: Sryder Date: Tue, 13 Dec 2016 21:22:40 +0000 Subject: [PATCH 04/32] Remove accidental leftovers Accidentally left a comment and stuff in there from previous attempts # Conflicts: # src/hardware/hw_main.c --- src/hardware/hw_main.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 3fbdb44d5..a1d5f9120 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -4276,26 +4276,6 @@ static void HWR_DrawSprite(gr_vissprite_t *spr) // transform wv = wallVerts; - /*if (spr->mobj->frame & FF_PAPERSPRITE) - { - float mobjanglecos, mobjanglesin; - mobjanglesin = FIXED_TO_FLOAT(FINESINE((spr->mobj->angle-dup_viewangle+ANGLE_90)>>ANGLETOFINESHIFT)); - mobjanglecos = FIXED_TO_FLOAT(FINECOSINE((spr->mobj->angle-dup_viewangle+ANGLE_90)>>ANGLETOFINESHIFT)); - for (i = 0; i < 4; i++,wv++) - { - // x = (x * anglecos) + (z * anglesin) - // z = (x * anglesin) - (z * anglecos) - // instead of doing the z part we just add spr->tz afterwards because they are all the same - // value right now - tr_x = wv->x-spr->x2+(spr->x2-spr->x1)/2; - //wv->x = (tr_x * mobjanglecos) + (0) + (spr->x1+(spr->x2-spr->x1)/2); - wv->z = (tr_x * mobjanglesin) - (0) + (spr->tz); - } - }*/ - - // transform - wv = wallVerts; - for (i = 0; i < 4; i++,wv++) { //look up/down ----TOTAL SUCKS!!!--- do the 2 in one!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! From ed81c9abcb28ae9bc1eba768779231bdd287f6d0 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 13 May 2017 12:49:30 +0100 Subject: [PATCH 05/32] Fix paper sprites apparently "turning" around sometimes when you turn the camera, when they're supposed to be still (sawb.wad for instance) I cleaned up some of Sryder's changes a little too I guess --- src/hardware/hw_main.c | 47 ++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index a1d5f9120..9ebf2f0a5 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5123,15 +5123,26 @@ static void HWR_ProjectSprite(mobj_t *thing) I_Error("sprframes NULL for sprite %d\n", thing->sprite); #endif - if (sprframe->rotate != SRF_SINGLE || papersprite) + if (papersprite) { - ang = R_PointToAngle (thing->x, thing->y) - thing->angle; - if (papersprite) + // Use the actual view angle, rather than the angle formed + // between the view point and the thing + // this makes sure paper sprites always appear at the right angle! + // Note: DO NOT do this in software mode version, it actually + // makes papersprites look WORSE there (I know, I've tried) + // Monster Iestyn - 13/05/17 + ang = dup_viewangle - thing->angle; + ang_scale = FIXED_TO_FLOAT(FINESINE(ang>>ANGLETOFINESHIFT)); + ang_scalez = FIXED_TO_FLOAT(FINECOSINE(ang>>ANGLETOFINESHIFT)); + + if (ang_scale < 0) { - ang_scale = FIXED_TO_FLOAT(FINESINE(ang>>ANGLETOFINESHIFT)); - ang_scalez = FIXED_TO_FLOAT(FINECOSINE(ang>>ANGLETOFINESHIFT)); + ang_scale = -ang_scale; + ang_scalez = -ang_scalez; } } + else if (sprframe->rotate != SRF_SINGLE) + ang = R_PointToAngle (thing->x, thing->y) - thing->angle; if (sprframe->rotate == SRF_SINGLE) { @@ -5164,16 +5175,8 @@ static void HWR_ProjectSprite(mobj_t *thing) else offset = FIXED_TO_FLOAT(spritecachedinfo[lumpoff].offset) * this_scale; - if (ang_scale < 0) - { - z1 = tz + offset * ang_scalez; - tx += offset * ang_scale; - } - else - { - z1 = tz - offset * ang_scalez; - tx -= offset * ang_scale; - } + z1 = tz - (offset * ang_scalez); + tx -= offset * ang_scale; // project x x1 = gr_windowcenterx + (tx * gr_centerx / tz); @@ -5185,16 +5188,10 @@ static void HWR_ProjectSprite(mobj_t *thing) x1 = tx; offset = FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width) * this_scale; - if (ang_scale < 0) - { - z2 = z1 - offset * ang_scalez; - tx -= offset * ang_scale; - } - else - { - z2 = z1 + offset * ang_scalez; - tx += offset * ang_scale; - } + + z2 = z1 + (offset * ang_scalez); + tx += offset * ang_scale; + if (papersprite && max(z1, z2) < ZCLIP_PLANE) return; From d263c4fcd4085366950f0522c21ae20f6daaf5ec Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 24 Jun 2017 18:15:06 +0100 Subject: [PATCH 06/32] Remove unused static vars in d_main.c (and remnants of some of them) --- src/d_main.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 0bba9dc06..ae25a87b7 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -107,8 +107,6 @@ UINT8 window_notinfocus = false; // // DEMO LOOP // -//static INT32 demosequence; -static const char *pagename = "MAP1PIC"; static char *startupwadfiles[MAX_WADFILES]; boolean devparm = false; // started game with -devparm @@ -721,7 +719,6 @@ void D_StartTitle(void) gameaction = ga_nothing; displayplayer = consoleplayer = 0; - //demosequence = -1; gametype = GT_COOP; paused = false; advancedemo = false; @@ -1399,7 +1396,6 @@ void D_SRB2Main(void) if (dedicated && server) { - pagename = "TITLESKY"; levelstarttic = gametic; G_SetGamestate(GS_LEVEL); if (!P_SetupLevel(false)) From 9d24186ecd7618d36759ad1de1212b79a50b6d23 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 24 Jun 2017 18:27:43 +0100 Subject: [PATCH 07/32] Removing D_SRB2Main's OS2 window title code "pmData" was originally declared in the files in the (non-SDL) OS2 source subfolder, last known to be present in Demo 4.1's source code ...said folder has not been around for over a decade, so this would definitely fail to compile if you tried compiling for OS2 without SDL anyway --- src/d_main.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index ae25a87b7..e2813f5e1 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -991,14 +991,6 @@ void D_SRB2Main(void) D_Titlebar(srb2, title); #endif -#if defined (__OS2__) && !defined (HAVE_SDL) - // set PM window title - snprintf(pmData->title, sizeof (pmData->title), - "Sonic Robo Blast 2" VERSIONSTRING ": %s", - title); - pmData->title[sizeof (pmData->title) - 1] = '\0'; -#endif - if (devparm) CONS_Printf(M_GetText("Development mode ON.\n")); From b2941087de095e51e5c0f8ec33dcb4af7ae25697 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 24 Jun 2017 18:39:17 +0100 Subject: [PATCH 08/32] Move all the leftovers of the "title" print code into D_Titlebar, since it's only used by DOS now --- src/d_main.c | 56 +++++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index e2813f5e1..007a14c1d 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -883,27 +883,10 @@ static void IdentifyVersion(void) #endif } -/* ======================================================================== */ -// Just print the nice red titlebar like the original SRB2 for DOS. -/* ======================================================================== */ #ifdef PC_DOS -static inline void D_Titlebar(char *title1, char *title2) -{ - // SRB2 banner - clrscr(); - textattr((BLUE<<4)+WHITE); - clreol(); - cputs(title1); - - // standard srb2 banner - textattr((RED<<4)+WHITE); - clreol(); - gotoxy((80-strlen(title2))/2, 2); - cputs(title2); - normvideo(); - gotoxy(1,3); -} -#endif +/* ======================================================================== */ +// Code for printing SRB2's title bar in DOS +/* ======================================================================== */ // // Center the title string, then add the date and time of compilation. @@ -932,6 +915,31 @@ static inline void D_MakeTitleString(char *s) strcpy(s, temp); } +static inline void D_Titlebar(void) +{ + char srb2[82]; // srb2 title banner + char title[82]; + + strcpy(title1, "Sonic Robo Blast 2"); + strcpy(title2, "Sonic Robo Blast 2"); + + D_MakeTitleString(title1); + + // SRB2 banner + clrscr(); + textattr((BLUE<<4)+WHITE); + clreol(); + cputs(title1); + + // standard srb2 banner + textattr((RED<<4)+WHITE); + clreol(); + gotoxy((80-strlen(title2))/2, 2); + cputs(title2); + normvideo(); + gotoxy(1,3); +} +#endif // // D_SRB2Main @@ -939,8 +947,6 @@ static inline void D_MakeTitleString(char *s) void D_SRB2Main(void) { INT32 p; - char srb2[82]; // srb2 title banner - char title[82]; INT32 pstartmap = 1; boolean autostart = false; @@ -983,12 +989,8 @@ void D_SRB2Main(void) dedicated = M_CheckParm("-dedicated") != 0; #endif - strcpy(title, "Sonic Robo Blast 2"); - strcpy(srb2, "Sonic Robo Blast 2"); - D_MakeTitleString(srb2); - #ifdef PC_DOS - D_Titlebar(srb2, title); + D_Titlebar(); #endif if (devparm) From 7d82ac406ea31f75f8f57ad61b5854612fbbe348 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 24 Jun 2017 19:27:29 +0100 Subject: [PATCH 09/32] whoops forgot to change these two --- src/d_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 007a14c1d..1a58ee89a 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -917,8 +917,8 @@ static inline void D_MakeTitleString(char *s) static inline void D_Titlebar(void) { - char srb2[82]; // srb2 title banner - char title[82]; + char title1[82]; // srb2 title banner + char title2[82]; strcpy(title1, "Sonic Robo Blast 2"); strcpy(title2, "Sonic Robo Blast 2"); From f44d769d396a7a2f7112b6b0d8c9bb24d4d6f459 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 24 Jun 2017 20:33:56 +0100 Subject: [PATCH 10/32] dehacked.c cleanup *removed Texture/Patch SOC implementations, since they weren't used in the end *removed remnants of AnimTex and some Spritename thing *none of the save* arrays in DEH_LoadDehackedFile were being used, so I removed all related code disabled or otherwise *DEH_LoadDehackedFile doesn't need a "wad" param anymore since only the Patch block was using it --- src/dehacked.c | 339 ++----------------------------------------------- 1 file changed, 11 insertions(+), 328 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index aa6f4f7f9..9c8d25213 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -382,56 +382,6 @@ static void clear_levels(void) P_AllocMapHeader(gamemap-1); } -/* -// Edits an animated texture slot on the array -// Tails 12-27-2003 -static void readAnimTex(MYFILE *f, INT32 num) -{ - char s[MAXLINELEN]; - char *word; - char *word2; - INT32 i; - - do { - if (myfgets(s, sizeof s, f) != NULL) - { - if (s[0] == '\n') break; - - tmp = strchr(s, '#'); - if (tmp) - *tmp = '\0'; - // set the value in the appropriate field - - word = strtok(s, " "); - if (word) - strupr(word); - else - break; - - word2 = strtok(NULL, " = "); - if (word2) - strupr(word2); - else - break; - - if (word2[strlen(word2)-1] == '\n') - word2[strlen(word2)-1] = '\0'; - - i = atoi(word2); - - if (fastcmp(word, "START")) - strncpy(harddefs[num].startname, word2, 8); - if (fastcmp(word, "END")) - strncpy(harddefs[num].endname, word2, 8); - else if (fastcmp(word, "SPEED")) harddefs[num].speed = i; - else if (fastcmp(word, "ISTEXTURE")) harddefs[num].istexture = i; - - else deh_warning("readAnimTex %d: unknown word '%s'", num, word); - } - } while (s[0] != '\n' && !myfeof(f)); //finish when the line is empty -} -*/ - static boolean findFreeSlot(INT32 *num) { // Send the character select entry to a free slot. @@ -2106,7 +2056,7 @@ static void readframe(MYFILE *f, INT32 num) Z_Free(s); } -static void readsound(MYFILE *f, INT32 num, const char *savesfxnames[]) +static void readsound(MYFILE *f, INT32 num) { char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); char *word; @@ -2142,21 +2092,7 @@ static void readsound(MYFILE *f, INT32 num, const char *savesfxnames[]) continue; } -/* if (fastcmp(word, "OFFSET")) - { - value -= 150360; - if (value <= 64) - value /= 8; - else if (value <= 260) - value = (value+4)/8; - else - value = (value+8)/8; - if (value >= -1 && value < sfx_freeslot0 - 1) - S_sfx[num].name = savesfxnames[value+1]; - else - deh_warning("Sound %d: offset out of bounds", num); - } - else */if (fastcmp(word, "SINGULAR")) + if (fastcmp(word, "SINGULAR")) { DEH_WriteUndoline(word, va("%d", S_sfx[num].singularity), UNDO_NONE); S_sfx[num].singularity = value; @@ -2182,8 +2118,6 @@ static void readsound(MYFILE *f, INT32 num, const char *savesfxnames[]) } while (!myfeof(f)); Z_Free(s); - - (void)savesfxnames; } /** Checks if a game data file name for a mod is good. @@ -2811,190 +2745,6 @@ static void readconditionset(MYFILE *f, UINT8 setnum) Z_Free(s); } -static void readtexture(MYFILE *f, const char *name) -{ - char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); - char *word; - char *word2; - char *tmp; - INT32 i, j, value; - UINT16 width = 0, height = 0; - INT16 patchcount = 0; - texture_t *texture; - - do - { - if (myfgets(s, MAXLINELEN, f)) - { - if (s[0] == '\n') - break; - - tmp = strchr(s, '#'); - if (tmp) - *tmp = '\0'; - - value = searchvalue(s); - word = strtok(s, " "); - if (word) - strupr(word); - else - break; - - word2 = strtok(NULL, " "); - if (word2) - strupr(word2); - else - break; - - // Width of the texture. - if (fastcmp(word, "WIDTH")) - { - DEH_WriteUndoline(word, va("%d", width), UNDO_NONE); - width = SHORT((UINT16)value); - } - // Height of the texture. - else if (fastcmp(word, "HEIGHT")) - { - DEH_WriteUndoline(word, va("%d", height), UNDO_NONE); - height = SHORT((UINT16)value); - } - // Number of patches the texture has. - else if (fastcmp(word, "NUMPATCHES")) - { - DEH_WriteUndoline(word, va("%d", patchcount), UNDO_NONE); - patchcount = SHORT((UINT16)value); - } - else - deh_warning("readtexture: unknown word '%s'", word); - } - } while (!myfeof(f)); - - // Error checking. - if (!width) - I_Error("Texture %s has no width!\n", name); - - if (!height) - I_Error("Texture %s has no height!\n", name); - - if (!patchcount) - I_Error("Texture %s has no patches!\n", name); - - // Allocate memory for the texture, and fill in information. - texture = Z_Calloc(sizeof(texture_t) + (sizeof(texpatch_t) * SHORT(patchcount)), PU_STATIC, NULL); - M_Memcpy(texture->name, name, sizeof(texture->name)); - texture->width = width; - texture->height = height; - texture->patchcount = patchcount; - texture->holes = false; - // Fill out the texture patches, to allow them to be detected - // accurately by readpatch. - for (i = 0; i < patchcount; i++) - { - texture->patches[i].originx = 0; - texture->patches[i].originy = 0; - texture->patches[i].wad = UINT16_MAX; - texture->patches[i].lump = UINT16_MAX; - } - - // Jump to the next empty texture entry. - i = 0; - while (textures[i]) - i++; - - // Fill the global texture buffer entries. - j = 1; - while (j << 1 <= texture->width) - j <<= 1; - - textures[i] = texture; - texturewidthmask[i] = j - 1; - textureheight[i] = texture->height << FRACBITS; - - // Clean up. - Z_Free(s); -} - -static void readpatch(MYFILE *f, const char *name, UINT16 wad) -{ - char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); - char *word; - char *word2; - char *tmp; - INT32 i = 0, j = 0, value; - texpatch_t patch = {0, 0, UINT16_MAX, UINT16_MAX, 0, 255, AST_COPY}; - - // Jump to the texture this patch belongs to, which, - // coincidentally, is always the last one on the buffer cache. - while (textures[i+1]) - i++; - - // Jump to the next empty patch entry. - while (memcmp(&(textures[i]->patches[j]), &patch, sizeof(patch))) - j++; - - patch.wad = wad; - // Set the texture number, but only if the lump exists. - if ((patch.lump = W_CheckNumForNamePwad(name, wad, 0)) == INT16_MAX) - I_Error("readpatch: Missing patch in texture %s", textures[i]->name); - - // note: undoing this patch will be done by other means - do - { - if (myfgets(s, MAXLINELEN, f)) - { - if (s[0] == '\n') - break; - - tmp = strchr(s, '#'); - if (tmp) - *tmp = '\0'; - - value = searchvalue(s); - word = strtok(s, " "); - if (word) - strupr(word); - else - break; - - word2 = strtok(NULL, " "); - if (word2) - strupr(word2); - else - break; - - // X position of the patch in the texture. - if (fastcmp(word, "X")) - { - //DEH_WriteUndoline(word, va("%d", patch->originx), UNDO_NONE); - patch.originx = (INT16)value; - } - // Y position of the patch in the texture. - else if (fastcmp(word, "Y")) - { - //DEH_WriteUndoline(word, va("%d", patch->originy), UNDO_NONE); - patch.originy = (INT16)value; - } - else - deh_warning("readpatch: unknown word '%s'", word); - } - } while (!myfeof(f)); - - // Error checking. - /* // Irrelevant. Origins cannot be unsigned. - if (patch.originx == UINT16_MAX) - I_Error("Patch %s on texture %s has no X position!\n", name, textures[i]->name); - - if (patch.originy == UINT16_MAX) - I_Error("Patch %s on texture %s has no Y position!\n", name, textures[i]->name); -*/ - - // Set the patch as that patch number. - textures[i]->patches[j] = patch; - - // Clean up. - Z_Free(s); -} - static void readmaincfg(MYFILE *f) { char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); @@ -3405,30 +3155,17 @@ static void ignorelines(MYFILE *f) Z_Free(s); } -static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) +static void DEH_LoadDehackedFile(MYFILE *f) { char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); char *word; char *word2; INT32 i; - // do a copy of this for cross references probleme - //XBOXSTATIC actionf_t saveactions[NUMSTATES]; - //XBOXSTATIC const char *savesprnames[NUMSPRITES]; - XBOXSTATIC const char *savesfxnames[NUMSFX]; if (!deh_loaded) initfreeslots(); deh_num_warning = 0; - // save values for cross reference - /* - for (i = 0; i < NUMSTATES; i++) - saveactions[i] = states[i].action; - for (i = 0; i < NUMSPRITES; i++) - savesprnames[i] = sprnames[i]; - */ - for (i = 0; i < NUMSFX; i++) - savesfxnames[i] = S_sfx[i].name; gamedataadded = false; @@ -3505,19 +3242,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) if (word2[strlen(word2)-1] == '\n') word2[strlen(word2)-1] = '\0'; i = atoi(word2); - if (fastcmp(word, "TEXTURE")) - { - // Read texture from spec file. - readtexture(f, word2); - DEH_WriteUndoline(word, word2, UNDO_HEADER); - } - else if (fastcmp(word, "PATCH")) - { - // Read patch from spec file. - readpatch(f, word2, wad); - DEH_WriteUndoline(word, word2, UNDO_HEADER); - } - else if (fastcmp(word, "THING") || fastcmp(word, "MOBJ") || fastcmp(word, "OBJECT")) + if (fastcmp(word, "THING") || fastcmp(word, "MOBJ") || fastcmp(word, "OBJECT")) { if (i == 0 && word2[0] != '0') // If word2 isn't a number i = get_mobjtype(word2); // find a thing by name @@ -3530,10 +3255,6 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) } DEH_WriteUndoline(word, word2, UNDO_HEADER); } -/* else if (fastcmp(word, "ANIMTEX")) - { - readAnimTex(f, i); - }*/ else if (fastcmp(word, "LIGHT")) { #ifdef HWRENDER @@ -3605,34 +3326,12 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) } DEH_WriteUndoline(word, word2, UNDO_HEADER); } - // Added translations to this just in case its re-enabled -/* else if (fastcmp(word, "POINTER")) - { - word = strtok(NULL, " "); // get frame - word = strtok(NULL, ")"); - if (word) - { - i = atoi(word); - if (i < NUMSTATES && i >= 0) - { - if (myfgets(s, MAXLINELEN, f)) - states[i].action = saveactions[searchvalue(s)]; - } - else - { - deh_warning("Pointer: Frame %d doesn't exist", i); - ignorelines(f); - } - } - else - deh_warning("pointer (Frame %d) : missing ')'", i); - }*/ else if (fastcmp(word, "SOUND")) { if (i == 0 && word2[0] != '0') // If word2 isn't a number i = get_sfx(word2); // find a sound by name if (i < NUMSFX && i > 0) - readsound(f, i, savesfxnames); + readsound(f, i); else { deh_warning("Sound %d out of range (1 - %d)", i, NUMSFX-1); @@ -3640,26 +3339,6 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) } DEH_WriteUndoline(word, word2, UNDO_HEADER); } -/* else if (fastcmp(word, "SPRITE")) - { - if (i < NUMSPRITES && i >= 0) - { - if (myfgets(s, MAXLINELEN, f)) - { - INT32 k; - k = (searchvalue(s) - 151328)/8; - if (k >= 0 && k < NUMSPRITES) - sprnames[i] = savesprnames[k]; - else - { - deh_warning("Sprite %d: offset out of bounds", i); - ignorelines(f); - } - } - } - else - deh_warning("Sprite %d doesn't exist",i); - }*/ else if (fastcmp(word, "HUDITEM")) { if (i == 0 && word2[0] != '0') // If word2 isn't a number @@ -3746,7 +3425,10 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) // no undo support for this insanity yet //DEH_WriteUndoline(word, word2, UNDO_HEADER); } - else if (fastcmp(word, "SRB2")) + // Last I heard this crashes the game if you try to use it + // so this is disabled for now + // -- Monster Iestyn +/* else if (fastcmp(word, "SRB2")) { INT32 ver = searchvalue(strtok(NULL, "\n")); if (ver != PATCHVERSION) @@ -3757,6 +3439,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) // Unless you REALLY want to piss people off, // define a custom gamedata /before/ doing this!! // (then again, modifiedgame will prevent game data saving anyway) +*/ else if (fastcmp(word, "CLEAR")) { boolean clearall = (fastcmp(word2, "ALL")); @@ -3830,7 +3513,7 @@ void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump) W_ReadLumpPwad(wad, lump, f.data); f.curpos = f.data; f.data[f.size] = 0; - DEH_LoadDehackedFile(&f, wad); + DEH_LoadDehackedFile(&f); DEH_WriteUndoline(va("# uload for wad: %u, lump: %u", wad, lump), NULL, UNDO_DONE); Z_Free(f.data); } From 0eaebb16fc0a4e7f0311f73b47d01805c64cc8dd Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 25 Jun 2017 18:17:05 +0100 Subject: [PATCH 11/32] Check if existing animdefs have the same type as the animdef we're parsing --- src/p_spec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_spec.c b/src/p_spec.c index b2e2cba95..3bf836a9c 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -456,7 +456,8 @@ void P_ParseAnimationDefintion(SINT8 istexture) // Search for existing animdef for (i = 0; i < maxanims; i++) - if (stricmp(animdefsToken, animdefs[i].startname) == 0) + if (animdefs[i].istexture == istexture // Check if it's the same type! + && stricmp(animdefsToken, animdefs[i].startname) == 0) { //CONS_Alert(CONS_NOTICE, "Duplicate animation: %s\n", animdefsToken); From c653289121ba5cf05cd1c4405d1a360a0b31d724 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 25 Jun 2017 20:22:01 +0100 Subject: [PATCH 12/32] Turns out we don't need to use SDL_SetWindowTitle on its own, since SDL_CreateWindow already deals with the window title anyway. So I've disabled everything related to Impl_SetWindowName for now Also what were you thinking Fury?!? window shouldn't be NULL for SDL_SetWindowTitle, you backwards person you --- src/sdl/i_video.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index ad60f9c53..f4ebb6df9 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -158,7 +158,7 @@ static INT32 windowedModes[MAXWINMODES][2] = static void Impl_VideoSetupSDLBuffer(void); static void Impl_VideoSetupBuffer(void); static SDL_bool Impl_CreateWindow(SDL_bool fullscreen); -static void Impl_SetWindowName(const char *title); +//static void Impl_SetWindowName(const char *title); static void Impl_SetWindowIcon(void); static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen) @@ -1188,7 +1188,7 @@ INT32 VID_SetMode(INT32 modeNum) } vid.modenum = -1; } - Impl_SetWindowName("SRB2 "VERSIONSTRING); + //Impl_SetWindowName("SRB2 "VERSIONSTRING); SDLSetMode(vid.width, vid.height, USE_FULLSCREEN); @@ -1271,14 +1271,16 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen) return SDL_TRUE; } +/* static void Impl_SetWindowName(const char *title) { - if (window != NULL) + if (window == NULL) { return; } SDL_SetWindowTitle(window, title); } +*/ static void Impl_SetWindowIcon(void) { From 9797ae31a669d635223a7f80871b3f3be997497d Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sun, 2 Jul 2017 16:48:58 +0100 Subject: [PATCH 13/32] Fix the springs jumping! The issue was that because both them and the player had MF_SOLID, the tmfloorz of the spring was getting set to above the player (or vicea versa with tmceilingz), forcing it upwards with them under certain circumstances. Now, springs only acknowledge the solidity (for purpose of tmfloorz/tmceilingz) of objects they CAN'T launch. --- src/p_map.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 86776f8d1..81bf9ebee 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -956,6 +956,8 @@ static boolean PIT_CheckThing(mobj_t *thing) if (iwassprung) // this spring caused you to gain MFE_SPRUNG just now... return false; // "cancel" P_TryMove via blocking so you keep your current position } + else if (tmthing->flags & MF_SPRING && (thing->player || thing->flags & MF_PUSHABLE)) + ; // Fix a few nasty spring-jumping bugs that happen sometimes. // Monitors are not treated as solid to players who are jumping, spinning or gliding, // unless it's a CTF team monitor and you're on the wrong team else if (thing->flags & MF_MONITOR && tmthing->player && tmthing->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING) @@ -987,11 +989,13 @@ static boolean PIT_CheckThing(mobj_t *thing) topz = thing->z - thing->scale; // FixedMul(FRACUNIT, thing->scale), but thing->scale == FRACUNIT in base scale anyways + if (thing->flags & MF_SPRING) + ; // block only when jumping not high enough, // (dont climb max. 24units while already in air) // since return false doesn't handle momentum properly, // we lie to P_TryMove() so it's always too high - if (tmthing->player && tmthing->z + tmthing->height > topz + else if (tmthing->player && tmthing->z + tmthing->height > topz && tmthing->z + tmthing->height < tmthing->ceilingz) { tmfloorz = tmceilingz = topz; // block while in air @@ -1000,8 +1004,6 @@ static boolean PIT_CheckThing(mobj_t *thing) #endif tmfloorthing = thing; // needed for side collision } - else if (thing->flags & MF_SPRING) - ; else if (topz < tmceilingz && tmthing->z <= thing->z+thing->height) { tmceilingz = topz; @@ -1030,11 +1032,13 @@ static boolean PIT_CheckThing(mobj_t *thing) topz = thing->z + thing->height + thing->scale; // FixedMul(FRACUNIT, thing->scale), but thing->scale == FRACUNIT in base scale anyways + if (thing->flags & MF_SPRING) + ; // block only when jumping not high enough, // (dont climb max. 24units while already in air) // since return false doesn't handle momentum properly, // we lie to P_TryMove() so it's always too high - if (tmthing->player && tmthing->z < topz + else if (tmthing->player && tmthing->z < topz && tmthing->z > tmthing->floorz) { tmfloorz = tmceilingz = topz; // block while in air @@ -1043,8 +1047,6 @@ static boolean PIT_CheckThing(mobj_t *thing) #endif tmfloorthing = thing; // needed for side collision } - else if (thing->flags & MF_SPRING) - ; else if (topz > tmfloorz && tmthing->z+tmthing->height >= thing->z) { tmfloorz = topz; From c751971d57a347e11b008af2e26e1cafbab653a5 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 2 Jul 2017 16:50:11 +0100 Subject: [PATCH 14/32] Fix integer type slipup in ArchiveValue for saving mobjinfo/state #s that LJSonic spotted Apart from the fact that UnArchiveValue reads UINT16 for both anyway (which alone causes problems), but UINT8 isn't even enough to store the higher end of the object types list and definitely most of the states welp --- src/lua_script.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lua_script.c b/src/lua_script.c index acb306827..991b8fcf9 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -566,14 +566,14 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) { mobjinfo_t *info = *((mobjinfo_t **)lua_touserdata(gL, myindex)); WRITEUINT8(save_p, ARCH_MOBJINFO); - WRITEUINT8(save_p, info - mobjinfo); + WRITEUINT16(save_p, info - mobjinfo); break; } case ARCH_STATE: { state_t *state = *((state_t **)lua_touserdata(gL, myindex)); WRITEUINT8(save_p, ARCH_STATE); - WRITEUINT8(save_p, state - states); + WRITEUINT16(save_p, state - states); break; } case ARCH_MOBJ: From 60e21381abfe2652fd417aeed8760acffc62e138 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Wed, 5 Jul 2017 16:20:23 +0100 Subject: [PATCH 15/32] Don't kick Tails! Also, a movement for the WRITESINT8 to prevent modification to buf if the function bails early. --- src/d_clisrv.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 312a308a1..5021f9a70 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2587,6 +2587,9 @@ static void Command_Kick(void) XBOXSTATIC UINT8 buf[3 + MAX_REASONLENGTH]; UINT8 *p = buf; + if (!netgame) // Don't kick Tails in splitscreen! + return; + if (COM_Argc() == 1) { CONS_Printf(M_GetText("kick : kick a player\n")); @@ -2596,9 +2599,10 @@ static void Command_Kick(void) if (server || adminplayer == consoleplayer) { const SINT8 pn = nametonum(COM_Argv(1)); - WRITESINT8(p, pn); + if (pn == -1 || pn == 0) return; + // Special case if we are trying to kick a player who is downloading the game state: // trigger a timeout instead of kicking them, because a kick would only // take effect after they have finished downloading @@ -2607,6 +2611,9 @@ static void Command_Kick(void) Net_ConnectionTimeout(playernode[pn]); return; } + + WRITESINT8(p, pn); + if (COM_Argc() == 2) { WRITEUINT8(p, KICK_MSG_GO_AWAY); From 9a1e1180ff8479b59dff12cc77159b92d52d0bf1 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Wed, 5 Jul 2017 16:29:21 +0100 Subject: [PATCH 16/32] Also account for bans, pff. --- src/d_clisrv.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 5021f9a70..3fdd96522 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2525,6 +2525,9 @@ static void Command_Nodes(void) static void Command_Ban(void) { + if (!netgame) // Don't kick Tails in splitscreen! + return; + if (COM_Argc() == 1) { CONS_Printf(M_GetText("Ban : ban and kick a player\n")); @@ -2540,8 +2543,9 @@ static void Command_Ban(void) if (pn == -1 || pn == 0) return; - else - WRITEUINT8(p, pn); + + WRITEUINT8(p, pn); + if (server && I_Ban && !I_Ban(node)) // only the server is allowed to do this right now { CONS_Alert(CONS_WARNING, M_GetText("Too many bans! Geez, that's a lot of people you're excluding...\n")); From aca7a574f82ceacb8a3be63b2267867a8e15c324 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 5 Jul 2017 17:05:39 +0100 Subject: [PATCH 17/32] Copy+paste st_stuff.c functions and macros to accurately draw SCORE/TIME on the tally screen like they are when actually playing the level --- src/y_inter.c | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 2fd37ff33..ff4b798f0 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -159,6 +159,20 @@ static void Y_CalculateMatchWinners(void); static void Y_FollowIntermission(void); static void Y_UnloadData(void); +// Stuff copy+pasted from st_stuff.c +static INT32 SCX(INT32 x) +{ + return FixedInt(FixedMul(x< Date: Wed, 5 Jul 2017 19:25:11 +0100 Subject: [PATCH 18/32] Display minutes in full, so 60:00 for instance displays as 60:00 and not 0:00 The normal HUD display while playing a level doesn't do this, only the tally screen does it for some reason --- src/y_inter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/y_inter.c b/src/y_inter.c index ff4b798f0..bfcb0f5b0 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -230,7 +230,7 @@ void Y_IntermissionDrawer(void) INT32 seconds, minutes, tictrn; seconds = G_TicsToSeconds(data.coop.tics); - minutes = G_TicsToMinutes(data.coop.tics, false); + minutes = G_TicsToMinutes(data.coop.tics, true); tictrn = G_TicsToCentiseconds(data.coop.tics); ST_DrawNumFromHud(HUD_MINUTES, minutes); // Minutes From e8df99c632ecdb91489b601d09e486870b38750f Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 5 Jul 2017 22:30:18 +0100 Subject: [PATCH 19/32] They didn't use V_HUDTRANS before and they probably shouldn't, my fault here --- src/y_inter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index bfcb0f5b0..acf1c6f2f 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -169,9 +169,9 @@ static INT32 SCY(INT32 z) return FixedInt(FixedMul(z< Date: Fri, 7 Jul 2017 22:40:00 +0100 Subject: [PATCH 20/32] Some more tweaks of my own: *Add CONS_Printf messages for !netgame checks *Arg count is checked first regardless of netgame status for both kick and ban, < 2 is checked instead of == 1 just in case these weren't called from console for some stupid reason? *Moved Command_Kick's buffer vars to within the code that actually does kicking stuff --- src/d_clisrv.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 3fdd96522..7c21d79fc 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2525,15 +2525,18 @@ static void Command_Nodes(void) static void Command_Ban(void) { - if (!netgame) // Don't kick Tails in splitscreen! - return; - - if (COM_Argc() == 1) + if (COM_Argc() < 2) { CONS_Printf(M_GetText("Ban : ban and kick a player\n")); return; } + if (!netgame) // Don't kick Tails in splitscreen! + { + CONS_Printf(M_GetText("This only works in a netgame.\n")); + return; + } + if (server || adminplayer == consoleplayer) { XBOXSTATIC UINT8 buf[3 + MAX_REASONLENGTH]; @@ -2588,20 +2591,22 @@ static void Command_Ban(void) static void Command_Kick(void) { - XBOXSTATIC UINT8 buf[3 + MAX_REASONLENGTH]; - UINT8 *p = buf; - - if (!netgame) // Don't kick Tails in splitscreen! - return; - - if (COM_Argc() == 1) + if (COM_Argc() < 2) { CONS_Printf(M_GetText("kick : kick a player\n")); return; } + if (!netgame) // Don't kick Tails in splitscreen! + { + CONS_Printf(M_GetText("This only works in a netgame.\n")); + return; + } + if (server || adminplayer == consoleplayer) { + XBOXSTATIC UINT8 buf[3 + MAX_REASONLENGTH]; + UINT8 *p = buf; const SINT8 pn = nametonum(COM_Argv(1)); if (pn == -1 || pn == 0) From 2ac566fa85db630ac9be5db9ff5e71376f8a6018 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 9 Jul 2017 15:08:17 +0100 Subject: [PATCH 21/32] Fix whitespace goofup of mine --- src/y_inter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/y_inter.c b/src/y_inter.c index acf1c6f2f..42f1e2235 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -236,7 +236,7 @@ void Y_IntermissionDrawer(void) ST_DrawNumFromHud(HUD_MINUTES, minutes); // Minutes ST_DrawPatchFromHud(HUD_TIMECOLON, sbocolon); // Colon ST_DrawPadNumFromHud(HUD_SECONDS, seconds, 2); // Seconds - + // we should show centiseconds on the intermission screen too, if the conditions are right. if (modeattacking || cv_timetic.value == 2) { From 96ec319897b052527d12c4c01d3ab7aaea7c568a Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 13 Jul 2017 17:29:15 +0100 Subject: [PATCH 22/32] Hardcoded SOC_TREE from patch.dta Also made sure the GFZ trees have MF2_STANDONME --- src/dehacked.c | 24 +++++ src/info.c | 288 +++++++++++++++++++++++++++++++++++++++++++++++++ src/info.h | 30 ++++++ src/p_mobj.c | 3 + 4 files changed, 345 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index 9c8d25213..189b9b269 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -4863,6 +4863,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_DEMONFIRE5", "S_DEMONFIRE6", + // GFZ flowers "S_GFZFLOWERA", "S_GFZFLOWERB", "S_GFZFLOWERC", @@ -4870,6 +4871,18 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_BERRYBUSH", "S_BUSH", + // Trees (both GFZ and misc) + "S_GFZTREE", + "S_GFZBERRYTREE", + "S_GFZCHERRYTREE", + "S_CHECKERTREE", + "S_CHECKERSUNSETTREE", + "S_FHZTREE", // Frozen Hillside + "S_FHZPINKTREE", + "S_POLYGONTREE", + "S_BUSHTREE", + "S_BUSHREDTREE", + // THZ Plant "S_THZFLOWERA", "S_THZFLOWERB", @@ -6247,6 +6260,17 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_GFZFLOWER3", "MT_BERRYBUSH", "MT_BUSH", + // Trees (both GFZ and misc) + "MT_GFZTREE", + "MT_GFZBERRYTREE", + "MT_GFZCHERRYTREE", + "MT_CHECKERTREE", + "MT_CHECKERSUNSETTREE", + "MT_FHZTREE", // Frozen Hillside + "MT_FHZPINKTREE", + "MT_POLYGONTREE", + "MT_BUSHTREE", + "MT_BUSHREDTREE", // Techno Hill Scenery "MT_THZFLOWER1", diff --git a/src/info.c b/src/info.c index 9e779acb0..c6e0c61b6 100644 --- a/src/info.c +++ b/src/info.c @@ -181,6 +181,12 @@ char sprnames[NUMSPRITES + 1][5] = "FWR4", "BUS1", // GFZ Bush w/ berries "BUS2", // GFZ Bush w/o berries + // Trees (both GFZ and misc) + "TRE1", // GFZ + "TRE2", // Checker + "TRE3", // Frozen Hillside + "TRE4", // Polygon + "TRE5", // Bush tree // Techno Hill Scenery "THZP", // Techno Hill Zone Plant @@ -1761,6 +1767,18 @@ state_t states[NUMSTATES] = {SPR_BUS1, 0, -1, {NULL}, 0, 0, S_NULL}, // S_BERRYBUSH {SPR_BUS2, 0, -1, {NULL}, 0, 0, S_NULL}, // S_BUSH + // Trees + {SPR_TRE1, 0, -1, {NULL}, 0, 0, S_NULL}, // S_GFZTREE + {SPR_TRE1, 1, -1, {NULL}, 0, 0, S_NULL}, // S_GFZBERRYTREE + {SPR_TRE1, 2, -1, {NULL}, 0, 0, S_NULL}, // S_GFZCHERRYTREE + {SPR_TRE2, 0, -1, {NULL}, 0, 0, S_NULL}, // S_CHECKERTREE + {SPR_TRE2, 1, -1, {NULL}, 0, 0, S_NULL}, // S_CHECKERSUNSETTREE + {SPR_TRE3, 0, -1, {NULL}, 0, 0, S_NULL}, // S_FHZTREE + {SPR_TRE3, 1, -1, {NULL}, 0, 0, S_NULL}, // S_FHZPINKTREE + {SPR_TRE4, 0, -1, {NULL}, 0, 0, S_NULL}, // S_POLYGONTREE + {SPR_TRE5, 0, -1, {NULL}, 0, 0, S_NULL}, // S_BUSHTREE + {SPR_TRE5, 1, -1, {NULL}, 0, 0, S_NULL}, // S_BUSHREDTREE + {SPR_THZP, FF_ANIMATE, -1, {NULL}, 7, 4, S_NULL}, // S_THZFLOWERA {SPR_FWR5, FF_ANIMATE, -1, {NULL}, 19, 2, S_NULL}, // S_THZFLOWERB @@ -8045,6 +8063,276 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_GFZTREE + 806, // doomednum + S_GFZTREE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // 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 + 0, // speed + 20*FRACUNIT, // radius + 90*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_SOLID, // flags + S_NULL // raisestate + }, + + { // MT_GFZBERRYTREE + 807, // doomednum + S_GFZBERRYTREE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // 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 + 0, // speed + 20*FRACUNIT, // radius + 90*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_SOLID, // flags + S_NULL // raisestate + }, + + { // MT_GFZCHERRYTREE + 808, // doomednum + S_GFZCHERRYTREE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // 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 + 0, // speed + 20*FRACUNIT, // radius + 90*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_SOLID, // flags + S_NULL // raisestate + }, + + { // MT_CHECKERTREE + 810, // doomednum + S_CHECKERTREE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // 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 + 0, // speed + 20*FRACUNIT, // radius + 200*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_CHECKERSUNSETTREE + 811, // doomednum + S_CHECKERSUNSETTREE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // 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 + 0, // speed + 20*FRACUNIT, // radius + 200*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_FHZTREE + 812, // doomednum + S_FHZTREE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // 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 + 0, // speed + 20*FRACUNIT, // radius + 200*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_FHZPINKTREE + 813, // doomednum + S_FHZPINKTREE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // 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 + 0, // speed + 20*FRACUNIT, // radius + 200*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_POLYGONTREE + 814, // doomednum + S_POLYGONTREE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // 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 + 0, // speed + 20*FRACUNIT, // radius + 200*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_BUSHTREE + 815, // doomednum + S_BUSHTREE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // 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 + 0, // speed + 20*FRACUNIT, // radius + 200*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_BUSHREDTREE + 816, // doomednum + S_BUSHREDTREE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // 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 + 0, // speed + 20*FRACUNIT, // radius + 200*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY, // flags + S_NULL // raisestate + }, + { // MT_THZFLOWER1 900, // doomednum S_THZFLOWERA, // spawnstate diff --git a/src/info.h b/src/info.h index 75484081e..6a2eb65c5 100644 --- a/src/info.h +++ b/src/info.h @@ -387,6 +387,12 @@ typedef enum sprite SPR_FWR4, SPR_BUS1, // GFZ Bush w/ berries SPR_BUS2, // GFZ Bush w/o berries + // Trees (both GFZ and misc) + SPR_TRE1, // GFZ + SPR_TRE2, // Checker + SPR_TRE3, // Frozen Hillside + SPR_TRE4, // Polygon + SPR_TRE5, // Bush tree // Techno Hill Scenery SPR_THZP, // THZ1 Flower @@ -1961,6 +1967,7 @@ typedef enum state S_DEMONFIRE5, S_DEMONFIRE6, + // GFZ flowers S_GFZFLOWERA, S_GFZFLOWERB, S_GFZFLOWERC, @@ -1968,6 +1975,18 @@ typedef enum state S_BERRYBUSH, S_BUSH, + // Trees (both GFZ and misc) + S_GFZTREE, + S_GFZBERRYTREE, + S_GFZCHERRYTREE, + S_CHECKERTREE, + S_CHECKERSUNSETTREE, + S_FHZTREE, // Frozen Hillside + S_FHZPINKTREE, + S_POLYGONTREE, + S_BUSHTREE, + S_BUSHREDTREE, + // THZ Plant S_THZFLOWERA, S_THZFLOWERB, @@ -3364,6 +3383,17 @@ typedef enum mobj_type MT_GFZFLOWER3, MT_BERRYBUSH, MT_BUSH, + // Trees (both GFZ and misc) + MT_GFZTREE, + MT_GFZBERRYTREE, + MT_GFZCHERRYTREE, + MT_CHECKERTREE, + MT_CHECKERSUNSETTREE, + MT_FHZTREE, // Frozen Hillside + MT_FHZPINKTREE, + MT_POLYGONTREE, + MT_BUSHTREE, + MT_BUSHREDTREE, // Techno Hill Scenery MT_THZFLOWER1, diff --git a/src/p_mobj.c b/src/p_mobj.c index 0126aa1a4..d6adf5736 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8460,6 +8460,9 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) case MT_SPIKE: mobj->flags2 |= MF2_STANDONME; break; + case MT_GFZTREE: + case MT_GFZBERRYTREE: + case MT_GFZCHERRYTREE: case MT_LAMPPOST1: case MT_LAMPPOST2: mobj->flags2 |= MF2_STANDONME; From aa947ea02203a087aa5389faccba9fbe040f10a6 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 13 Jul 2017 22:42:08 +0100 Subject: [PATCH 23/32] Starting work for hardcoding wall spikes --- src/dehacked.c | 11 +++++++++ src/info.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/info.h | 13 ++++++++++ 3 files changed, 89 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index 189b9b269..c1d0d614d 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -4677,6 +4677,15 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_SPIKED1", "S_SPIKED2", + // Wall spikes + "S_WALLSPIKE1", + "S_WALLSPIKE2", + "S_WALLSPIKE3", + "S_WALLSPIKE4", + "S_WALLSPIKE5", + "S_WALLSPIKE6", + "S_WALLSPIKEBASE", + // Starpost "S_STARPOST_IDLE", "S_STARPOST_FLASH", @@ -6170,6 +6179,8 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_SPECIALSPIKEBALL", "MT_SPINFIRE", "MT_SPIKE", + "MT_WALLSPIKE", + "MT_WALLSPIKEBASE", "MT_STARPOST", "MT_BIGMINE", "MT_BIGAIRMINE", diff --git a/src/info.c b/src/info.c index c6e0c61b6..b48758689 100644 --- a/src/info.c +++ b/src/info.c @@ -131,6 +131,8 @@ char sprnames[NUMSPRITES + 1][5] = "SPIK", // Spike Ball "SFLM", // Spin fire "USPK", // Floor spike + "WSPK", // Wall spike + "WSPB", // Wall spike base "STPT", // Starpost "BMNE", // Big floating mine @@ -1574,6 +1576,15 @@ state_t states[NUMSTATES] = {SPR_USPK, 1,-1, {NULL}, 0, 0, S_NULL}, // S_SPIKED1 -- Busted spike particles {SPR_USPK, 2,-1, {NULL}, 0, 0, S_NULL}, // S_SPIKED2 + // Wall Spike + {SPR_WSPK, 0|FF_PAPERSPRITE,-1, {A_SpikeRetract}, 1, 0, S_WALLSPIKE2}, // S_WALLSPIKE1 -- Fully extended + {SPR_WSPK, 1|FF_PAPERSPRITE, 2, {A_Pain}, 0, 0, S_WALLSPIKE3}, // S_WALLSPIKE2 + {SPR_WSPK, 2|FF_PAPERSPRITE, 2, {NULL}, 0, 0, S_WALLSPIKE4}, // S_WALLSPIKE3 + {SPR_WSPK, 3|FF_PAPERSPRITE,-1, {A_SpikeRetract}, 0, 0, S_WALLSPIKE5}, // S_WALLSPIKE4 -- Fully retracted + {SPR_WSPK, 2|FF_PAPERSPRITE, 2, {A_Pain}, 0, 0, S_WALLSPIKE6}, // S_WALLSPIKE5 + {SPR_WSPK, 1|FF_PAPERSPRITE, 2, {NULL}, 0, 0, S_WALLSPIKE1}, // S_WALLSPIKE6 + {SPR_WSPB, 0|FF_PAPERSPRITE,-1, {NULL}, 0, 0, S_NULL}, // S_WALLSPIKEBASE -- Base + // Starpost {SPR_STPT, 0 , -1, {NULL}, 0, 0, S_NULL}, // S_STARPOST_IDLE {SPR_STPT, FF_ANIMATE|17, -1, {NULL}, 5, 1, S_NULL}, // S_STARPOST_FLASH @@ -6011,6 +6022,60 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_WALLSPIKE + 522, // doomednum + S_WALLSPIKE1, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_s3k64, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 2*TICRATE, // speed + 32*FRACUNIT, // radius + 14*FRACUNIT, // height + 0, // display offset + 4, // mass + 0, // damage + sfx_None, // activesound + MF_SOLID|MF_NOGRAVITY|MF_PAPERCOLLISION, //MF_NOBLOCKMAP|MF_NOGRAVITY|MF_SCENERY|MF_NOCLIPHEIGHT, // flags + S_NULL // raisestate + }, + + { // MT_WALLSPIKEBASE + -1, // doomednum + S_WALLSPIKEBASE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // 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 + 0, // speed + 7*FRACUNIT, // radius + 14*FRACUNIT, // height + 0, // display offset + 4, // mass + 0, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_NOCLIPTHING, // flags + S_NULL // raisestate + }, + { // MT_STARPOST 502, // doomednum S_STARPOST_IDLE, // spawnstate diff --git a/src/info.h b/src/info.h index 6a2eb65c5..7a5b28ffc 100644 --- a/src/info.h +++ b/src/info.h @@ -337,6 +337,8 @@ typedef enum sprite SPR_SPIK, // Spike Ball SPR_SFLM, // Spin fire SPR_USPK, // Floor spike + SPR_WSPK, // Wall spike + SPR_WSPB, // Wall spike base SPR_STPT, // Starpost SPR_BMNE, // Big floating mine @@ -1779,6 +1781,15 @@ typedef enum state S_SPIKED1, S_SPIKED2, + // Wall spikes + S_WALLSPIKE1, + S_WALLSPIKE2, + S_WALLSPIKE3, + S_WALLSPIKE4, + S_WALLSPIKE5, + S_WALLSPIKE6, + S_WALLSPIKEBASE, + // Starpost S_STARPOST_IDLE, S_STARPOST_FLASH, @@ -3293,6 +3304,8 @@ typedef enum mobj_type MT_SPECIALSPIKEBALL, MT_SPINFIRE, MT_SPIKE, + MT_WALLSPIKE, + MT_WALLSPIKEBASE, MT_STARPOST, MT_BIGMINE, MT_BIGAIRMINE, From eacf753f2cb1955d494378bcb32b4b3601d0c754 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 13 Jul 2017 23:00:45 +0100 Subject: [PATCH 24/32] Add the remaining code from the Lua script to get wall spikes actually working so far --- src/info.c | 2 +- src/p_map.c | 39 +++++++++++++++++++++++++++++++++++++++ src/p_mobj.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 1 deletion(-) diff --git a/src/info.c b/src/info.c index b48758689..b9aae1cc6 100644 --- a/src/info.c +++ b/src/info.c @@ -6045,7 +6045,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 4, // mass 0, // damage sfx_None, // activesound - MF_SOLID|MF_NOGRAVITY|MF_PAPERCOLLISION, //MF_NOBLOCKMAP|MF_NOGRAVITY|MF_SCENERY|MF_NOCLIPHEIGHT, // flags + MF_NOBLOCKMAP|MF_NOGRAVITY|MF_SCENERY|MF_NOCLIPHEIGHT|MF_PAPERCOLLISION, // flags S_NULL // raisestate }, diff --git a/src/p_map.c b/src/p_map.c index 7bc9c9721..cbe2513c0 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -959,6 +959,45 @@ static boolean PIT_CheckThing(mobj_t *thing) P_DamageMobj(tmthing, thing, thing, 1, 0); } + if (tmthing->type == MT_WALLSPIKE && tmthing->flags & MF_SOLID && thing->player) // wall spike impales player + { + fixed_t bottomz, topz; + bottomz = tmthing->z; + topz = tmthing->z + tmthing->height; + if (tmthing->eflags & MFE_VERTICALFLIP) + bottomz -= FixedMul(FRACUNIT, tmthing->scale); + else + topz += FixedMul(FRACUNIT, tmthing->scale); + + if (thing->z + thing->height >= bottomz // above bottom + && thing->z < topz) // below top + { // don't check angle, the player was clearly in the way in this case + P_DamageMobj(thing, tmthing, tmthing, 1, DMG_SPIKE); + } + } + else if (thing->type == MT_WALLSPIKE && thing->flags & MF_SOLID && tmthing->player) + { + fixed_t bottomz, topz; + bottomz = thing->z; + topz = thing->z + thing->height; + if (thing->eflags & MFE_VERTICALFLIP) + bottomz -= FixedMul(FRACUNIT, thing->scale); + else + topz += FixedMul(FRACUNIT, thing->scale); + + if (tmthing->z + tmthing->height >= bottomz // above bottom + && tmthing->z < topz // below top + && !P_MobjWasRemoved(thing->tracer)) // this probably wouldn't work if we didn't have a tracer + { // use base as a reference point to determine what angle you touched the spike at + angle_t touchangle = R_PointToAngle2(thing->tracer->x, thing->tracer->y, tmthing->x, tmthing->y); + angle_t diffangle = thing->angle - touchangle; + if (diffangle > ANGLE_180) + diffangle = InvAngle(diffangle); + if (diffangle <= ANGLE_22h) // if you touched it at this close an angle, you get poked! + P_DamageMobj(tmthing, thing, thing, 1, DMG_SPIKE); + } + } + if (thing->flags & MF_PUSHABLE) { if (tmthing->type == MT_FAN || tmthing->type == MT_STEAM) diff --git a/src/p_mobj.c b/src/p_mobj.c index d6adf5736..bb62e4e9d 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7373,6 +7373,22 @@ void P_MobjThinker(mobj_t *mobj) } else switch (mobj->type) { + case MT_WALLSPIKEBASE: + if (!mobj->target) { + P_RemoveMobj(mobj); + return; + } + mobj->frame = (mobj->frame & ~FF_FRAMEMASK)|(mobj->target->frame & FF_FRAMEMASK); + if (mobj->angle != mobj->target->angle + ANGLE_90) // reposition if not the correct angle + { + mobj_t *target = mobj->target; + P_UnsetThingPosition(mobj); + mobj->x = target->x - P_ReturnThrustX(target, target->angle, target->radius/2 - FixedMul(FRACUNIT, target->scale)); + mobj->y = target->y - P_ReturnThrustY(target, target->angle, target->radius/2 - FixedMul(FRACUNIT, target->scale)); + P_SetThingPosition(mobj); + mobj->angle = target->angle + ANGLE_90; + } + break; case MT_FALLINGROCK: // Despawn rocks here in case zmovement code can't do so (blame slopes) if (!mobj->momx && !mobj->momy && !mobj->momz @@ -8066,6 +8082,10 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s if (mobj->spawnpoint) mobj->fuse += mobj->spawnpoint->angle; break; + case MT_WALLSPIKE: + P_SetMobjState(mobj, mobj->state->nextstate); + mobj->fuse = mobj->info->speed; + break; case MT_NIGHTSCORE: P_RemoveMobj(mobj); return; @@ -8457,6 +8477,18 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) // Collision helper can be stood on but not pushed mobj->flags2 |= MF2_STANDONME; break; + case MT_WALLSPIKE: + { + mobj_t *base = P_SpawnMobj( + mobj->x - P_ReturnThrustX(mobj, mobj->angle, mobj->radius/2 - FixedMul(FRACUNIT, mobj->scale)), + mobj->y - P_ReturnThrustY(mobj, mobj->angle, mobj->radius/2 - FixedMul(FRACUNIT, mobj->scale)), + mobj->z, MT_WALLSPIKEBASE); + base->angle = mobj->angle + ANGLE_90; + P_SetScale(base, mobj->scale); + P_SetTarget(&base->target, mobj); + P_SetTarget(&mobj->tracer, base); + } + // fall through to give standonme flag case MT_SPIKE: mobj->flags2 |= MF2_STANDONME; break; @@ -10122,6 +10154,23 @@ ML_NOCLIMB : Direction not controllable P_SetThingPosition(mobj); } } + else if (i == MT_WALLSPIKE) + { + // Pop up spikes! + if (mthing->options & MTF_OBJECTSPECIAL) + { + mobj->flags &= ~MF_SCENERY; + mobj->fuse = mobj->info->speed; + } + // Use per-thing collision for spikes if the deaf flag is checked. + if (mthing->options & MTF_AMBUSH && !metalrecording) + { + P_UnsetThingPosition(mobj); + mobj->flags &= ~(MF_NOBLOCKMAP|MF_NOCLIPHEIGHT); + mobj->flags |= MF_SOLID; + P_SetThingPosition(mobj); + } + } //count 10 ring boxes into the number of rings equation too. if (i == MT_RING_BOX) From 444e9ce7df496da40943258137d1e6746f3c1cc5 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 14 Jul 2017 17:01:13 +0100 Subject: [PATCH 25/32] Fix wall spikes being harmful from below, set initial destscale of base too just in case --- src/p_map.c | 4 ++-- src/p_mobj.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index cbe2513c0..e1f204a8c 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -969,7 +969,7 @@ static boolean PIT_CheckThing(mobj_t *thing) else topz += FixedMul(FRACUNIT, tmthing->scale); - if (thing->z + thing->height >= bottomz // above bottom + if (thing->z + thing->height > bottomz // above bottom && thing->z < topz) // below top { // don't check angle, the player was clearly in the way in this case P_DamageMobj(thing, tmthing, tmthing, 1, DMG_SPIKE); @@ -985,7 +985,7 @@ static boolean PIT_CheckThing(mobj_t *thing) else topz += FixedMul(FRACUNIT, thing->scale); - if (tmthing->z + tmthing->height >= bottomz // above bottom + if (tmthing->z + tmthing->height > bottomz // above bottom && tmthing->z < topz // below top && !P_MobjWasRemoved(thing->tracer)) // this probably wouldn't work if we didn't have a tracer { // use base as a reference point to determine what angle you touched the spike at diff --git a/src/p_mobj.c b/src/p_mobj.c index bb62e4e9d..559f746a5 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8484,6 +8484,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) mobj->y - P_ReturnThrustY(mobj, mobj->angle, mobj->radius/2 - FixedMul(FRACUNIT, mobj->scale)), mobj->z, MT_WALLSPIKEBASE); base->angle = mobj->angle + ANGLE_90; + base->destscale = mobj->destscale; P_SetScale(base, mobj->scale); P_SetTarget(&base->target, mobj); P_SetTarget(&mobj->tracer, base); From 00062220dee04fb1d9c7b9ef1236481c5bffe977 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 14 Jul 2017 17:19:01 +0100 Subject: [PATCH 26/32] Move spawning of base to P_SpawnMapThing, so objectplacing a wall spike doesn't look weird Also attempted to "optimise" spawning and position correction code --- src/p_mobj.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 559f746a5..b32d3d2ab 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7381,10 +7381,11 @@ void P_MobjThinker(mobj_t *mobj) mobj->frame = (mobj->frame & ~FF_FRAMEMASK)|(mobj->target->frame & FF_FRAMEMASK); if (mobj->angle != mobj->target->angle + ANGLE_90) // reposition if not the correct angle { - mobj_t *target = mobj->target; + mobj_t *target = mobj->target; // shortcut + const fixed_t baseradius = target->radius/2 - FixedMul(FRACUNIT, target->scale); P_UnsetThingPosition(mobj); - mobj->x = target->x - P_ReturnThrustX(target, target->angle, target->radius/2 - FixedMul(FRACUNIT, target->scale)); - mobj->y = target->y - P_ReturnThrustY(target, target->angle, target->radius/2 - FixedMul(FRACUNIT, target->scale)); + mobj->x = target->x - P_ReturnThrustX(target, target->angle, baseradius); + mobj->y = target->y - P_ReturnThrustY(target, target->angle, baseradius); P_SetThingPosition(mobj); mobj->angle = target->angle + ANGLE_90; } @@ -8478,18 +8479,6 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) mobj->flags2 |= MF2_STANDONME; break; case MT_WALLSPIKE: - { - mobj_t *base = P_SpawnMobj( - mobj->x - P_ReturnThrustX(mobj, mobj->angle, mobj->radius/2 - FixedMul(FRACUNIT, mobj->scale)), - mobj->y - P_ReturnThrustY(mobj, mobj->angle, mobj->radius/2 - FixedMul(FRACUNIT, mobj->scale)), - mobj->z, MT_WALLSPIKEBASE); - base->angle = mobj->angle + ANGLE_90; - base->destscale = mobj->destscale; - P_SetScale(base, mobj->scale); - P_SetTarget(&base->target, mobj); - P_SetTarget(&mobj->tracer, base); - } - // fall through to give standonme flag case MT_SPIKE: mobj->flags2 |= MF2_STANDONME; break; @@ -10171,6 +10160,21 @@ ML_NOCLIMB : Direction not controllable mobj->flags |= MF_SOLID; P_SetThingPosition(mobj); } + + // spawn base + { + const angle_t mobjangle = FixedAngle(mthing->angle*FRACUNIT); // the mobj's own angle hasn't been set quite yet so... + const fixed_t baseradius = mobj->radius/2 - FixedMul(FRACUNIT, mobj->scale); + mobj_t *base = P_SpawnMobj( + mobj->x - P_ReturnThrustX(mobj, mobjangle, baseradius), + mobj->y - P_ReturnThrustY(mobj, mobjangle, baseradius), + mobj->z, MT_WALLSPIKEBASE); + base->angle = mobjangle + ANGLE_90; + base->destscale = mobj->destscale; + P_SetScale(base, mobj->scale); + P_SetTarget(&base->target, mobj); + P_SetTarget(&mobj->tracer, base); + } } //count 10 ring boxes into the number of rings equation too. From 381138d7b101a9b02dabb7ec47e92fc38908a85f Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 15 Jul 2017 16:57:03 +0100 Subject: [PATCH 27/32] Increased hitbox height of GFZ trees to 128 FU and gave them all MF_SCENERY --- src/info.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/info.c b/src/info.c index b9aae1cc6..037d2b099 100644 --- a/src/info.c +++ b/src/info.c @@ -8146,12 +8146,12 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // deathsound 0, // speed 20*FRACUNIT, // radius - 90*FRACUNIT, // height + 128*FRACUNIT, // height 0, // display offset 100, // mass 0, // damage sfx_None, // activesound - MF_SOLID, // flags + MF_SOLID|MF_SCENERY, // flags S_NULL // raisestate }, @@ -8173,12 +8173,12 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // deathsound 0, // speed 20*FRACUNIT, // radius - 90*FRACUNIT, // height + 128*FRACUNIT, // height 0, // display offset 100, // mass 0, // damage sfx_None, // activesound - MF_SOLID, // flags + MF_SOLID|MF_SCENERY, // flags S_NULL // raisestate }, @@ -8200,12 +8200,12 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // deathsound 0, // speed 20*FRACUNIT, // radius - 90*FRACUNIT, // height + 128*FRACUNIT, // height 0, // display offset 100, // mass 0, // damage sfx_None, // activesound - MF_SOLID, // flags + MF_SOLID|MF_SCENERY, // flags S_NULL // raisestate }, From dbc7a4099feec9414bda0767c341782e824b776e Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 15 Jul 2017 20:15:34 +0100 Subject: [PATCH 28/32] Hardcoded SOC_TOKE from patch.dta Or rather, I killed anything to do with the old background orb, renamed all "EMMY" stuff to "TOKEN", and of course adjusted the new S_TOKEN accordingly --- src/dehacked.c | 7 +------ src/info.c | 40 ++++------------------------------------ src/info.h | 8 +------- src/p_floor.c | 8 -------- src/p_inter.c | 5 +---- src/p_mobj.c | 28 +++++----------------------- 6 files changed, 12 insertions(+), 84 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index c1d0d614d..1279d7bd0 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -4521,12 +4521,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit // Individual Team Rings "S_TEAMRING", - // Special Stage Token - "S_EMMY", - // Special Stage Token "S_TOKEN", - "S_MOVINGTOKEN", // CTF Flags "S_REDFLAG", @@ -6144,8 +6140,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_BLUEBALL", // Blue sphere replacement for special stages "MT_REDTEAMRING", //Rings collectable by red team. "MT_BLUETEAMRING", //Rings collectable by blue team. - "MT_EMMY", // emerald token for special stage - "MT_TOKEN", // Special Stage Token (uncollectible part) + "MT_TOKEN", // Special Stage Token "MT_REDFLAG", // Red CTF Flag "MT_BLUEFLAG", // Blue CTF Flag "MT_EMBLEM", diff --git a/src/info.c b/src/info.c index 037d2b099..4f1a76c73 100644 --- a/src/info.c +++ b/src/info.c @@ -114,7 +114,6 @@ char sprnames[NUMSPRITES + 1][5] = // Collectible Items "RING", "TRNG", // Team Rings - "EMMY", // emerald test "TOKE", // Special Stage Token "RFLG", // Red CTF Flag "BFLG", // Blue CTF Flag @@ -1417,14 +1416,10 @@ state_t states[NUMSTATES] = {SPR_GWLR, 2, 1, {NULL}, 0, 0, S_GRAVWELLRED}, // S_GRAVWELLRED3 // Individual Team Rings (now with shield attracting action! =P) - {SPR_TRNG, FF_ANIMATE|FF_GLOBALANIM, -1, {NULL}, 23, 1, S_TEAMRING}, // S_TEAMRING1 + {SPR_TRNG, FF_ANIMATE|FF_GLOBALANIM, -1, {NULL}, 23, 1, S_TEAMRING}, // S_TEAMRING // Special Stage Token - {SPR_EMMY, FF_ANIMATE|FF_FULLBRIGHT, -1, {NULL}, 6, 2, S_EMMY}, // S_EMMY - - // Special Stage Token - {SPR_TOKE, FF_TRANS50|FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_TOKEN - {SPR_TOKE, FF_TRANS50|FF_FULLBRIGHT, 1, {A_CapeChase}, 0, 0, S_MOVINGTOKEN}, // S_MOVINGTOKEN + {SPR_TOKE, FF_ANIMATE|FF_FULLBRIGHT, -1, {NULL}, 19, 1, S_TOKEN}, // S_TOKEN // CTF Flags {SPR_RFLG, 0, -1, {NULL}, 0, 0, S_NULL}, // S_REDFLAG @@ -5191,9 +5186,9 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_EMMY + { // MT_TOKEN 312, // doomednum - S_EMMY, // spawnstate + S_TOKEN, // spawnstate 1000, // spawnhealth S_NULL, // seestate sfx_None, // seesound @@ -5218,33 +5213,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_TOKEN - -1, // doomednum - S_TOKEN, // spawnstate - 1000, // spawnhealth - S_MOVINGTOKEN, // seestate - sfx_None, // seesound - 8, // 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 - 8, // speed - 8*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOGRAVITY|MF_NOBLOCKMAP|MF_NOCLIP, // flags - S_NULL // raisestate - }, - { // MT_REDFLAG 310, // doomednum S_REDFLAG, // spawnstate diff --git a/src/info.h b/src/info.h index 7a5b28ffc..42fd63dff 100644 --- a/src/info.h +++ b/src/info.h @@ -320,7 +320,6 @@ typedef enum sprite // Collectible Items SPR_RING, SPR_TRNG, // Team Rings - SPR_EMMY, // emerald test SPR_TOKE, // Special Stage Token SPR_RFLG, // Red CTF Flag SPR_BFLG, // Blue CTF Flag @@ -1625,12 +1624,8 @@ typedef enum state // Individual Team Rings S_TEAMRING, - // Special Stage Token - S_EMMY, - // Special Stage Token S_TOKEN, - S_MOVINGTOKEN, // CTF Flags S_REDFLAG, @@ -3269,8 +3264,7 @@ typedef enum mobj_type MT_BLUEBALL, // Blue sphere replacement for special stages MT_REDTEAMRING, //Rings collectable by red team. MT_BLUETEAMRING, //Rings collectable by blue team. - MT_EMMY, // emerald token for special stage - MT_TOKEN, // Special Stage Token (uncollectible part) + MT_TOKEN, // Special Stage token for special stage MT_REDFLAG, // Red CTF Flag MT_BLUEFLAG, // Blue CTF Flag MT_EMBLEM, diff --git a/src/p_floor.c b/src/p_floor.c index 1ed1d1565..b3c3b22cd 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -3283,14 +3283,6 @@ INT32 EV_MarioBlock(ffloor_t *rover, sector_t *sector, mobj_t *puncher) } else { - if (thing->type == MT_EMMY && thing->spawnpoint && (thing->spawnpoint->options & MTF_OBJECTSPECIAL)) - { - mobj_t *tokenobj = P_SpawnMobj(sector->soundorg.x, sector->soundorg.y, topheight, MT_TOKEN); - P_SetTarget(&thing->tracer, tokenobj); - P_SetTarget(&tokenobj->target, thing); - P_SetMobjState(tokenobj, mobjinfo[MT_TOKEN].seestate); - } - // "Powerup rise" sound S_StartSound(puncher, sfx_mario9); // Puncher is "close enough" } diff --git a/src/p_inter.c b/src/p_inter.c index 2b8006534..33ca1eeb5 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -570,7 +570,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // Gameplay related collectibles // // ***************************** // // Special Stage Token - case MT_EMMY: + case MT_TOKEN: if (player->bot) return; tokenlist += special->health; @@ -589,9 +589,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } else token++; - - if (special->tracer) // token BG - P_RemoveMobj(special->tracer); break; // Emerald Hunt diff --git a/src/p_mobj.c b/src/p_mobj.c index b32d3d2ab..2bb370f50 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9503,7 +9503,7 @@ void P_SpawnMapThing(mapthing_t *mthing) } if (metalrecording) // Metal Sonic can't use these things. - if (mobjinfo[i].flags & (MF_ENEMY|MF_BOSS) || i == MT_EMMY || i == MT_STARPOST) + if (mobjinfo[i].flags & (MF_ENEMY|MF_BOSS) || i == MT_TOKEN || i == MT_STARPOST) return; if (i >= MT_EMERALD1 && i <= MT_EMERALD7) // Pickupable Emeralds @@ -9617,7 +9617,7 @@ void P_SpawnMapThing(mapthing_t *mthing) return; // Emerald Tokens -->> Score Tokens - else if (i == MT_EMMY) + else if (i == MT_TOKEN) return; /// \todo // 1UPs -->> Score TVs @@ -9645,7 +9645,7 @@ void P_SpawnMapThing(mapthing_t *mthing) // They're likely facets of the level's design and therefore required to progress. } - if (i == MT_EMMY && (gametype != GT_COOP || ultimatemode || tokenbits == 30 || tokenlist & (1 << tokenbits++))) + if (i == MT_TOKEN && (gametype != GT_COOP || ultimatemode || tokenbits == 30 || tokenlist & (1 << tokenbits++))) return; // you already got this token, or there are too many, or the gametype's not right // Objectplace landing point @@ -9664,7 +9664,7 @@ void P_SpawnMapThing(mapthing_t *mthing) ss->sector->floorheight) + ((mthing->options >> ZSHIFT) << FRACBITS); else if (i == MT_AXIS || i == MT_AXISTRANSFER || i == MT_AXISTRANSFERLINE) z = ONFLOORZ; - else if (i == MT_SPECIALSPIKEBALL || P_WeaponOrPanel(i) || i == MT_EMERALDSPAWN || i == MT_EMMY) + else if (i == MT_SPECIALSPIKEBALL || P_WeaponOrPanel(i) || i == MT_EMERALDSPAWN || i == MT_TOKEN) { if (mthing->options & MTF_OBJECTFLIP) { @@ -10063,28 +10063,10 @@ ML_NOCLIMB : Direction not controllable mobj->radius = (mthing->angle & 16383)*FRACUNIT; } } - else if (i == MT_EMMY) + else if (i == MT_TOKEN) { if (mthing->options & MTF_OBJECTSPECIAL) // Mario Block version mobj->flags &= ~(MF_NOGRAVITY|MF_NOCLIPHEIGHT); - else - { - fixed_t zheight = mobj->z; - mobj_t *tokenobj; - - if (mthing->options & MTF_OBJECTFLIP) - zheight += mobj->height-FixedMul(mobjinfo[MT_TOKEN].height, mobj->scale); // align with emmy properly! - - tokenobj = P_SpawnMobj(x, y, zheight, MT_TOKEN); - P_SetTarget(&mobj->tracer, tokenobj); - tokenobj->destscale = mobj->scale; - P_SetScale(tokenobj, mobj->scale); - if (mthing->options & MTF_OBJECTFLIP) // flip token to match emmy - { - tokenobj->eflags |= MFE_VERTICALFLIP; - tokenobj->flags2 |= MF2_OBJECTFLIP; - } - } // We advanced tokenbits earlier due to the return check. // Subtract 1 here for the correct value. From 64fae001eb51c30770e6b3000c18566bdcd0b3e8 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 15 Jul 2017 21:16:45 +0100 Subject: [PATCH 29/32] Update hw_light.c's sprite lights list with the updates to the sprites list (and any before that I missed) Not that we're using coronas at all anymore so whatever --- src/hardware/hw_light.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index a49a788e6..cf9b1c536 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -226,8 +226,7 @@ light_t *t_lspr[NUMSPRITES] = // Collectible Items &lspr[NOLIGHT], // SPR_RING &lspr[NOLIGHT], // SPR_TRNG - &lspr[NOLIGHT], // SPR_EMMY - &lspr[BLUEBALL_L], // SPR_TOKE + &lspr[NOLIGHT], // SPR_TOKE &lspr[REDBALL_L], // SPR_RFLG &lspr[BLUEBALL_L], // SPR_BFLG &lspr[NOLIGHT], // SPR_NWNG @@ -243,6 +242,8 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_SPIK &lspr[NOLIGHT], // SPR_SFLM &lspr[NOLIGHT], // SPR_USPK + &lspr[NOLIGHT], // SPR_WSPK + &lspr[NOLIGHT], // SPR_WSPB &lspr[NOLIGHT], // SPR_STPT &lspr[NOLIGHT], // SPR_BMNE @@ -293,6 +294,12 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_FWR4 &lspr[NOLIGHT], // SPR_BUS1 &lspr[NOLIGHT], // SPR_BUS2 + // Trees (both GFZ and misc) + &lspr[NOLIGHT], // SPR_TRE1 + &lspr[NOLIGHT], // SPR_TRE2 + &lspr[NOLIGHT], // SPR_TRE3 + &lspr[NOLIGHT], // SPR_TRE4 + &lspr[NOLIGHT], // SPR_TRE5 // Techno Hill Scenery &lspr[NOLIGHT], // SPR_THZP @@ -334,6 +341,8 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_XMS1 &lspr[NOLIGHT], // SPR_XMS2 &lspr[NOLIGHT], // SPR_XMS3 + &lspr[NOLIGHT], // SPR_XMS4 + &lspr[NOLIGHT], // SPR_XMS5 // Botanic Serenity Scenery &lspr[NOLIGHT], // SPR_BSZ1 @@ -345,13 +354,9 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_BSZ7 &lspr[NOLIGHT], // SPR_BSZ8 - // Stalagmites + // Misc Scenery &lspr[NOLIGHT], // SPR_STLG - - // Disco Ball &lspr[NOLIGHT], // SPR_DBAL - - // ATZ Red Crystal &lspr[NOLIGHT], // SPR_RCRY // Powerup Indicators @@ -396,8 +401,11 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_SPRB Graue &lspr[NOLIGHT], // SPR_YSPR &lspr[NOLIGHT], // SPR_RSPR + &lspr[NOLIGHT], // SPR_SSWY + &lspr[NOLIGHT], // SPR_SSWR + &lspr[NOLIGHT], // SPR_SSWB - // Environmentals Effects + // Environmental Effects &lspr[NOLIGHT], // SPR_RAIN &lspr[NOLIGHT], // SPR_SNO1 &lspr[NOLIGHT], // SPR_SPLH @@ -405,6 +413,8 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_SMOK &lspr[NOLIGHT], // SPR_BUBL &lspr[RINGLIGHT_L], // SPR_WZAP + &lspr[NOLIGHT], // SPR_DUST + &lspr[NOLIGHT], // SPR_FPRT &lspr[SUPERSPARK_L], // SPR_TFOG &lspr[NIGHTSLIGHT_L], // SPR_SEED // Sonic CD flower seed &lspr[NOLIGHT], // SPR_PRTL From 7d4513f2f1a6c7715e29b37e58efdc8fd9aab0cb Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 17 Jul 2017 20:47:00 +0100 Subject: [PATCH 30/32] Don't be stupid with FF_BLOCKPLAYER/FF_BLOCKOTHERS flags please --- src/p_user.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 5ea1ae471..7abf85347 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1221,11 +1221,12 @@ boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec) if (!(rover->flags & FF_EXISTS)) continue; - // If the FOF is configured to let players through, continue. - if (!(rover->flags & FF_BLOCKPLAYER) && (rover->flags & FF_BLOCKOTHERS)) + // If the FOF is configured to let the object through, continue. + if (!((rover->flags & FF_BLOCKPLAYER && mo->player) + || (rover->flags & FF_BLOCKOTHERS && !mo->player))) continue; - // If the the platform is intangile from below, continue. + // If the the platform is intangible from below, continue. if (rover->flags & FF_PLATFORM) continue; @@ -1254,11 +1255,12 @@ boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec) if (!(rover->flags & FF_EXISTS)) continue; - // If the FOF is configured to let players through, continue. - if (!(rover->flags & FF_BLOCKPLAYER) && (rover->flags & FF_BLOCKOTHERS)) + // If the FOF is configured to let the object through, continue. + if (!((rover->flags & FF_BLOCKPLAYER && mo->player) + || (rover->flags & FF_BLOCKOTHERS && !mo->player))) continue; - // If the the platform is intangile from above, continue. + // If the the platform is intangible from above, continue. if (rover->flags & FF_REVERSEPLATFORM) continue; From 6e5cffba5b6dfe28cbdb4fa3204daadb4e00a056 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 17 Jul 2017 20:56:55 +0100 Subject: [PATCH 31/32] Create static function P_IsObjectOnRealGround for each time thinker to use in place of P_IsObjectOnGroundIn, for non-FOF floor touch specials This fixes solid FOFs activating floor touch specials for normal ground if using an "each time" trigger linedef --- src/p_floor.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/p_floor.c b/src/p_floor.c index 0af81efee..ce35ca12d 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -2021,6 +2021,33 @@ foundenemy: P_RemoveThinker(&nobaddies->thinker); } +// +// P_IsObjectOnRealGround +// +// Helper function for T_EachTimeThinker +// Like P_IsObjectOnGroundIn, except ONLY THE REAL GROUND IS CONSIDERED, NOT FOFS +// I'll consider whether to make this a more globally accessible function or whatever in future +// -- Monster Iestyn +// +static boolean P_IsObjectOnRealGround(mobj_t *mo, sector_t *sec) +{ + // Is the object in reverse gravity? + if (mo->eflags & MFE_VERTICALFLIP) + { + // Detect if the player is on the ceiling. + if (mo->z+mo->height >= P_GetSpecialTopZ(mo, sec, sec)) + return true; + } + // Nope! + else + { + // Detect if the player is on the floor. + if (mo->z <= P_GetSpecialBottomZ(mo, sec, sec)) + return true; + } + return false; +} + // // P_HavePlayersEnteredArea // @@ -2224,7 +2251,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime) || P_PlayerTouchingSectorSpecial(&players[i], 2, (GETSECSPECIAL(sec->special, 2))) == sec)) continue; - if (floortouch == true && P_IsObjectOnGroundIn(players[i].mo, sec)) + if (floortouch == true && P_IsObjectOnRealGround(players[i].mo, sec)) { if (i & 1) eachtime->var2s[i/2] |= 1; From 821692fbf7bed2ddf7fc341474c4beb7842d5075 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 24 Jul 2017 17:53:18 +0100 Subject: [PATCH 32/32] This was my fault, whoops --- src/p_spec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_spec.c b/src/p_spec.c index 8891165f8..4ddb90b09 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1742,7 +1742,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller case 305: // continuous case 306: // each time case 307: // once - if (!(actor && actor->player && actor->player->charability != dist/10)) + if (!(actor && actor->player && actor->player->charability == dist/10)) return false; break; case 309: // continuous