From 14e8ac702f29b413ea9e9af3f7ff672ffab017f9 Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Sat, 31 Oct 2015 14:45:42 -0400 Subject: [PATCH 001/562] Added freeslots for SPR2. Make sure your MAINCFG / LUA lump comes _before_ the S_SKIN section. --- src/dehacked.c | 45 ++++++++++++++++++++++++++++++++++++++++----- src/info.c | 1 + src/info.h | 5 ++++- src/lua_infolib.c | 6 +++--- src/r_things.c | 2 +- 5 files changed, 49 insertions(+), 10 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 0ba054f07..a35025494 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -671,6 +671,22 @@ static void readfreeslots(MYFILE *f) break; } } + else if (fastcmp(type, "SPR2_")) + { + // Search if we already have an SPR2 by that name... + for (i = SPR_FIRSTFREESLOT; i < free_spr2; i++) + if (memcmp(spr2names[i],word,4) == 0) + break; + // We found it? (Two mods using the same SPR2 name?) Then don't allocate another one. + if (i != free_spr2) + continue; + // Copy in the spr2 name and increment free_spr2. + if (free_spr2 < NUMPLAYERSPRITES) { + strncpy(spr2names[free_spr2],word,4); + spr2names[free_spr2++][4] = 0; + } else + CONS_Alert(CONS_WARNING, "Ran out of free SPR2 slots!\n"); + } else deh_warning("Freeslots: unknown enum class '%s' for '%s_%s'", type, type, word); } @@ -8292,7 +8308,7 @@ static inline int lib_freeslot(lua_State *L) lua_pushinteger(L, sfx); r++; } else - return r; + CONS_Alert(CONS_WARNING, "Ran out of free SFX slots!\n"); } else if (fastcmp(type, "SPR")) { @@ -8319,7 +8335,7 @@ static inline int lib_freeslot(lua_State *L) break; } if (j > SPR_LASTFREESLOT) - return r; + CONS_Alert(CONS_WARNING, "Ran out of free sprite slots!\n"); } else if (fastcmp(type, "S")) { @@ -8334,7 +8350,7 @@ static inline int lib_freeslot(lua_State *L) break; } if (i == NUMSTATEFREESLOTS) - return r; + CONS_Alert(CONS_WARNING, "Ran out of free State slots!\n"); } else if (fastcmp(type, "MT")) { @@ -8349,7 +8365,26 @@ static inline int lib_freeslot(lua_State *L) break; } if (i == NUMMOBJFREESLOTS) - return r; + CONS_Alert(CONS_WARNING, "Ran out of free MobjType slots!\n"); + } + else if (fastcmp(type, "SPR2")) + { + // Search if we already have an SPR2 by that name... + enum playersprite i; + for (i = SPR_FIRSTFREESLOT; i < free_spr2; i++) + if (memcmp(spr2names[i],word,4) == 0) + break; + // We don't, so allocate a new one. + if (i == free_spr2) { + if (free_spr2 < NUMPLAYERSPRITES) + { + CONS_Printf("Sprite SPR2_%s allocated.\n",word); + strncpy(spr2names[free_spr2],word,4); + spr2names[free_spr2++][4] = 0; + } else + CONS_Alert(CONS_WARNING, "Ran out of free SPR2 slots!\n"); + } + r++; } Z_Free(s); lua_remove(L, 1); @@ -8516,7 +8551,7 @@ static inline int lib_getenum(lua_State *L) } else if (fastncmp("SPR2_",word,4)) { p = word+5; - for (i = 0; i < NUMPLAYERSPRITES; i++) + for (i = 0; i < free_spr2; i++) if (!spr2names[i][4]) { // special 3-char cases, e.g. SPR2_RUN diff --git a/src/info.c b/src/info.c index 8d7c249ad..d6ccab1f9 100644 --- a/src/info.c +++ b/src/info.c @@ -99,6 +99,7 @@ char spr2names[NUMPLAYERSPRITES][5] = "SRID", "SFLT" }; +enum playersprite free_spr2 = SPR2_FIRSTFREESLOT; // Doesn't work with g++, needs actionf_p1 (don't modify this comment) state_t states[NUMSTATES] = diff --git a/src/info.h b/src/info.h index e313526b9..67602b301 100644 --- a/src/info.h +++ b/src/info.h @@ -618,6 +618,8 @@ enum playersprite SPR2_SRID, SPR2_SFLT, + SPR2_FIRSTFREESLOT, + SPR2_LASTFREESLOT = SPR2_FIRSTFREESLOT + NUMSPRITEFREESLOTS - 1, NUMPLAYERSPRITES }; @@ -3528,8 +3530,9 @@ typedef struct extern state_t states[NUMSTATES]; extern char sprnames[NUMSPRITES + 1][5]; -char spr2names[NUMPLAYERSPRITES][5]; +extern char spr2names[NUMPLAYERSPRITES][5]; extern state_t *astate; +extern enum playersprite free_spr2; typedef enum mobj_type { diff --git a/src/lua_infolib.c b/src/lua_infolib.c index a983bb002..1925ffd35 100644 --- a/src/lua_infolib.c +++ b/src/lua_infolib.c @@ -105,7 +105,7 @@ static int lib_getSpr2name(lua_State *L) if (lua_isnumber(L, 1)) { i = lua_tonumber(L, 1); - if (i > NUMPLAYERSPRITES) + if (i >= free_spr2) return 0; lua_pushlstring(L, spr2names[i], 4); return 1; @@ -113,7 +113,7 @@ static int lib_getSpr2name(lua_State *L) else if (lua_isstring(L, 1)) { const char *name = lua_tostring(L, 1); - for (i = 0; i < NUMPLAYERSPRITES; i++) + for (i = 0; i < free_spr2; i++) if (fastcmp(name, spr2names[i])) { lua_pushinteger(L, i); @@ -125,7 +125,7 @@ static int lib_getSpr2name(lua_State *L) static int lib_spr2namelen(lua_State *L) { - lua_pushinteger(L, NUMPLAYERSPRITES); + lua_pushinteger(L, free_spr2); return 1; } diff --git a/src/r_things.c b/src/r_things.c index 60fbad1af..461ac978c 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2671,7 +2671,7 @@ next_token: if (z < lastlump) lastlump = z; // load all sprite sets we are aware of. - for (sprite2 = 0; sprite2 < NUMPLAYERSPRITES; sprite2++) + for (sprite2 = 0; sprite2 < free_spr2; sprite2++) R_AddSingleSpriteDef(spr2names[sprite2], &skin->sprites[sprite2], wadnum, lump, lastlump); } From 24ab56691e6fd1cb194039322da2bac4cdae7dad Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Tue, 10 Nov 2015 20:33:01 -0500 Subject: [PATCH 002/562] Fixed spr2 freslot logic bug. --- src/dehacked.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dehacked.c b/src/dehacked.c index a35025494..3a9782074 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -671,7 +671,7 @@ static void readfreeslots(MYFILE *f) break; } } - else if (fastcmp(type, "SPR2_")) + else if (fastcmp(type, "SPR2")) { // Search if we already have an SPR2 by that name... for (i = SPR_FIRSTFREESLOT; i < free_spr2; i++) From 4e2cc2c2001a01130020206c6467cb4c2d3e9213 Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Tue, 10 Nov 2015 20:45:53 -0500 Subject: [PATCH 003/562] Fixed more logic bugs. SPR_FIRSTFREESLOT is not the same as SPR2_FIRSTFREESLOT. What was I, drunk? --- src/dehacked.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 3a9782074..09da3ee6e 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -674,11 +674,11 @@ static void readfreeslots(MYFILE *f) else if (fastcmp(type, "SPR2")) { // Search if we already have an SPR2 by that name... - for (i = SPR_FIRSTFREESLOT; i < free_spr2; i++) + for (i = SPR2_FIRSTFREESLOT; i < free_spr2; i++) if (memcmp(spr2names[i],word,4) == 0) break; // We found it? (Two mods using the same SPR2 name?) Then don't allocate another one. - if (i != free_spr2) + if (i < free_spr2) continue; // Copy in the spr2 name and increment free_spr2. if (free_spr2 < NUMPLAYERSPRITES) { @@ -8371,11 +8371,11 @@ static inline int lib_freeslot(lua_State *L) { // Search if we already have an SPR2 by that name... enum playersprite i; - for (i = SPR_FIRSTFREESLOT; i < free_spr2; i++) + for (i = SPR2_FIRSTFREESLOT; i < free_spr2; i++) if (memcmp(spr2names[i],word,4) == 0) break; // We don't, so allocate a new one. - if (i == free_spr2) { + if (i >= free_spr2) { if (free_spr2 < NUMPLAYERSPRITES) { CONS_Printf("Sprite SPR2_%s allocated.\n",word); From 265a607b58103ee11d793e514918226c0eacceb6 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 31 Dec 2015 08:38:23 -0800 Subject: [PATCH 004/562] rewrite of monitors to accomodate repeat use monitors. It's a lot nicer in general, honestly. I think a couple bugs with custom monitors respawning got fixed in the process. Note that a monitorgfx.wad is needed if you want to see things besides s for monitors, due to graphic changes. --- src/dehacked.c | 391 ++++---- src/hardware/hw_light.c | 43 +- src/info.c | 2056 +++++++++++++++++++++++---------------- src/info.h | 436 +++++---- src/p_enemy.c | 313 +++--- src/p_inter.c | 7 +- src/p_local.h | 2 + src/p_map.c | 2 +- src/p_mobj.c | 205 ++-- src/p_user.c | 2 +- src/sounds.c | 1 + src/sounds.h | 1 + 12 files changed, 2009 insertions(+), 1450 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 0ba054f07..d0f582385 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1628,6 +1628,9 @@ static actionpointer_t actionpointers[] = {{A_Pain}, "A_PAIN"}, {{A_Fall}, "A_FALL"}, {{A_MonitorPop}, "A_MONITORPOP"}, + {{A_BigMonitorPop}, "A_BIGMONITORPOP"}, + {{A_BigMonitorRestore}, "A_BIGMONITORRESTORE"}, + {{A_BigMonitorSparkle}, "A_BIGMONITORSPARKLE"}, {{A_Look}, "A_LOOK"}, {{A_Chase}, "A_CHASE"}, {{A_FaceStabChase}, "A_FACESTABCHASE"}, @@ -4855,170 +4858,169 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_CANNONLAUNCHER2", "S_CANNONLAUNCHER3", - // Super Ring Box - "S_SUPERRINGBOX", - "S_SUPERRINGBOX1", - "S_SUPERRINGBOX2", - "S_SUPERRINGBOX3", - "S_SUPERRINGBOX4", - "S_SUPERRINGBOX5", - "S_SUPERRINGBOX6", + // Monitor Miscellany + "S_BOXSPARKLE1", + "S_BOXSPARKLE2", + "S_BOXSPARKLE3", - // Red Team Ring Box - "S_REDRINGBOX", - "S_REDRINGBOX1", + "S_BOX_FLICKER", + "S_BOX_POP1", + "S_BOX_POP2", - // Blue Team Ring Box - "S_BLUERINGBOX", - "S_BLUERINGBOX1", + "S_BIGBOX_FLICKER", + "S_BIGBOX_OFF1", + "S_BIGBOX_OFF2", + "S_BIGBOX_OFF3", + "S_BIGBOX_OFF4", + "S_BIGBOX_OFF5", + "S_BIGBOX_OFF6", + "S_BIGBOX_OFF7", - // Super Sneakers Box - "S_SHTV", - "S_SHTV1", - "S_SHTV2", - "S_SHTV3", - "S_SHTV4", - "S_SHTV5", - "S_SHTV6", + // Monitor States (one per box) + "S_MYSTERY_BOX", + "S_RING_BOX", + "S_PITY_BOX", + "S_ATTRACT_BOX", + "S_FORCE_BOX", + "S_ARMAGEDDON_BOX", + "S_WHIRLWIND_BOX", + "S_ELEMENTAL_BOX", + "S_SNEAKERS_BOX", + "S_INVULN_BOX", + "S_1UP_BOX", + "S_EGGMAN_BOX", + "S_MIXUP_BOX", + "S_GRAVITY_BOX", + "S_RECYCLER_BOX", + "S_SCORE1K_BOX", + "S_SCORE10K_BOX", - // Invincibility Box - "S_PINV", - "S_PINV1", - "S_PINV2", - "S_PINV3", - "S_PINV4", - "S_PINV5", - "S_PINV6", + // Repeat Monitor States (one per box) + "S_MYSTERY_BIGBOX", + "S_RING_BIGBOX", + "S_PITY_BIGBOX", + "S_ATTRACT_BIGBOX", + "S_FORCE_BIGBOX", + "S_ARMAGEDDON_BIGBOX", + "S_WHIRLWIND_BIGBOX", + "S_ELEMENTAL_BIGBOX", + "S_SNEAKERS_BIGBOX", + "S_INVULN_BIGBOX", + "S_1UP_BIGBOX", + "S_EGGMAN_BIGBOX", + "S_MIXUP_BIGBOX", + "S_GRAVITY_BIGBOX", + "S_RECYCLER_BIGBOX", + "S_SCORE1K_BIGBOX", + "S_SCORE10K_BIGBOX", - // 1-Up Box - "S_PRUP", - "S_PRUP1", - "S_PRUP2", - "S_PRUP3", - "S_PRUP4", - "S_PRUP5", - "S_PRUP6", + // Team Ring Boxes (these are special) + "S_RING_REDBOX1", + "S_RING_REDBOX2", + "S_REDBOX_POP1", + "S_REDBOX_POP2", - // Ring Shield Box - "S_YLTV", - "S_YLTV1", - "S_YLTV2", - "S_YLTV3", - "S_YLTV4", - "S_YLTV5", - "S_YLTV6", + "S_RING_BLUEBOX1", + "S_RING_BLUEBOX2", + "S_BLUEBOX_POP1", + "S_BLUEBOX_POP2", - // Force Shield Box - "S_BLTV1", - "S_BLTV2", - "S_BLTV3", - "S_BLTV4", - "S_BLTV5", - "S_BLTV6", - "S_BLTV7", + // Box Icons -- 5 states each, one for each part of the twirl + "S_RING_ICON1", + "S_RING_ICON2", + "S_RING_ICON3", + "S_RING_ICON4", + "S_RING_ICON5", - // Bomb Shield Box - "S_BKTV1", - "S_BKTV2", - "S_BKTV3", - "S_BKTV4", - "S_BKTV5", - "S_BKTV6", - "S_BKTV7", + "S_PITY_ICON1", + "S_PITY_ICON2", + "S_PITY_ICON3", + "S_PITY_ICON4", + "S_PITY_ICON5", - // Jump Shield Box - "S_WHTV1", - "S_WHTV2", - "S_WHTV3", - "S_WHTV4", - "S_WHTV5", - "S_WHTV6", - "S_WHTV7", + "S_ATTRACT_ICON1", + "S_ATTRACT_ICON2", + "S_ATTRACT_ICON3", + "S_ATTRACT_ICON4", + "S_ATTRACT_ICON5", - // Water Shield Box - "S_GRTV", - "S_GRTV1", - "S_GRTV2", - "S_GRTV3", - "S_GRTV4", - "S_GRTV5", - "S_GRTV6", + "S_FORCE_ICON1", + "S_FORCE_ICON2", + "S_FORCE_ICON3", + "S_FORCE_ICON4", + "S_FORCE_ICON5", - // Pity Shield Box - "S_PITV1", - "S_PITV2", - "S_PITV3", - "S_PITV4", - "S_PITV5", - "S_PITV6", - "S_PITV7", + "S_ARMAGEDDON_ICON1", + "S_ARMAGEDDON_ICON2", + "S_ARMAGEDDON_ICON3", + "S_ARMAGEDDON_ICON4", + "S_ARMAGEDDON_ICON5", - // Eggman Box - "S_EGGTV1", - "S_EGGTV2", - "S_EGGTV3", - "S_EGGTV4", - "S_EGGTV5", - "S_EGGTV6", - "S_EGGTV7", + "S_WHIRLWIND_ICON1", + "S_WHIRLWIND_ICON2", + "S_WHIRLWIND_ICON3", + "S_WHIRLWIND_ICON4", + "S_WHIRLWIND_ICON5", - // Teleport Box - "S_MIXUPBOX1", - "S_MIXUPBOX2", - "S_MIXUPBOX3", - "S_MIXUPBOX4", - "S_MIXUPBOX5", - "S_MIXUPBOX6", - "S_MIXUPBOX7", + "S_ELEMENTAL_ICON1", + "S_ELEMENTAL_ICON2", + "S_ELEMENTAL_ICON3", + "S_ELEMENTAL_ICON4", + "S_ELEMENTAL_ICON5", - // Recycler Box - "S_RECYCLETV1", - "S_RECYCLETV2", - "S_RECYCLETV3", - "S_RECYCLETV4", - "S_RECYCLETV5", - "S_RECYCLETV6", - "S_RECYCLETV7", + "S_SNEAKERS_ICON1", + "S_SNEAKERS_ICON2", + "S_SNEAKERS_ICON3", + "S_SNEAKERS_ICON4", + "S_SNEAKERS_ICON5", - // Question Box - "S_RANDOMBOX1", - "S_RANDOMBOX2", - "S_RANDOMBOX3", + "S_INVULN_ICON1", + "S_INVULN_ICON2", + "S_INVULN_ICON3", + "S_INVULN_ICON4", + "S_INVULN_ICON5", - // Gravity Boots Box - "S_GBTV1", - "S_GBTV2", - "S_GBTV3", - "S_GBTV4", - "S_GBTV5", - "S_GBTV6", - "S_GBTV7", + "S_1UP_ICON1", + "S_1UP_ICON2", + "S_1UP_ICON3", + "S_1UP_ICON4", + "S_1UP_ICON5", - // Score boxes - "S_SCORETVA1", - "S_SCORETVA2", - "S_SCORETVA3", - "S_SCORETVA4", - "S_SCORETVA5", - "S_SCORETVA6", - "S_SCORETVA7", - "S_SCORETVB1", - "S_SCORETVB2", - "S_SCORETVB3", - "S_SCORETVB4", - "S_SCORETVB5", - "S_SCORETVB6", - "S_SCORETVB7", + "S_EGGMAN_ICON1", + "S_EGGMAN_ICON2", + "S_EGGMAN_ICON3", + "S_EGGMAN_ICON4", + "S_EGGMAN_ICON5", - // Monitor Explosion - "S_MONITOREXPLOSION1", - "S_MONITOREXPLOSION2", + "S_MIXUP_ICON1", + "S_MIXUP_ICON2", + "S_MIXUP_ICON3", + "S_MIXUP_ICON4", + "S_MIXUP_ICON5", - "S_REDMONITOREXPLOSION1", - "S_REDMONITOREXPLOSION2", + "S_GRAVITY_ICON1", + "S_GRAVITY_ICON2", + "S_GRAVITY_ICON3", + "S_GRAVITY_ICON4", + "S_GRAVITY_ICON5", - "S_BLUEMONITOREXPLOSION1", - "S_BLUEMONITOREXPLOSION2", + "S_RECYCLER_ICON1", + "S_RECYCLER_ICON2", + "S_RECYCLER_ICON3", + "S_RECYCLER_ICON4", + "S_RECYCLER_ICON5", + + "S_SCORE1K_ICON1", + "S_SCORE1K_ICON2", + "S_SCORE1K_ICON3", + "S_SCORE1K_ICON4", + "S_SCORE1K_ICON5", + + "S_SCORE10K_ICON1", + "S_SCORE10K_ICON2", + "S_SCORE10K_ICON3", + "S_SCORE10K_ICON4", + "S_SCORE10K_ICON5", "S_ROCKET", @@ -6760,47 +6762,68 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_BIGAIRMINE", "MT_CANNONLAUNCHER", - // Monitor Boxes - "MT_SUPERRINGBOX", - "MT_REDRINGBOX", - "MT_BLUERINGBOX", - "MT_SNEAKERTV", - "MT_INV", - "MT_PRUP", // 1up Box - "MT_YELLOWTV", // Attract shield TV - "MT_BLUETV", // Force shield TV - "MT_BLACKTV", // Bomb shield TV - "MT_WHITETV", // Jump shield TV - "MT_GREENTV", // Elemental shield TV - "MT_PITYTV", // Pity shield TV - "MT_EGGMANBOX", - "MT_MIXUPBOX", - "MT_RECYCLETV", - "MT_RECYCLEICO", - "MT_QUESTIONBOX", - "MT_GRAVITYBOX", - "MT_SCORETVSMALL", - "MT_SCORETVLARGE", - // Monitor miscellany - "MT_MONITOREXPLOSION", - "MT_REDMONITOREXPLOSION", - "MT_BLUEMONITOREXPLOSION", - "MT_RINGICO", - "MT_SHOESICO", - "MT_INVCICO", - "MT_1UPICO", - "MT_YSHIELDICO", - "MT_BSHIELDICO", - "MT_KSHIELDICO", - "MT_WSHIELDICO", - "MT_GSHIELDICO", - "MT_PITYSHIELDICO", - "MT_EGGMANICO", - "MT_MIXUPICO", - "MT_GRAVITYICO", - "MT_SCOREICOSMALL", - "MT_SCOREICOLARGE", + "MT_BOXSPARKLE", + + // Monitor boxes -- regular + "MT_RING_BOX", + "MT_PITY_BOX", + "MT_ATTRACT_BOX", + "MT_FORCE_BOX", + "MT_ARMAGEDDON_BOX", + "MT_WHIRLWIND_BOX", + "MT_ELEMENTAL_BOX", + "MT_SNEAKERS_BOX", + "MT_INVULN_BOX", + "MT_1UP_BOX", + "MT_EGGMAN_BOX", + "MT_MIXUP_BOX", + "MT_MYSTERY_BOX", + "MT_GRAVITY_BOX", + "MT_RECYCLER_BOX", + "MT_SCORE1K_BOX", + "MT_SCORE10K_BOX", + + // Monitor boxes -- repeating (big) boxes + "MT_RING_BIGBOX", + "MT_PITY_BIGBOX", + "MT_ATTRACT_BIGBOX", + "MT_FORCE_BIGBOX", + "MT_ARMAGEDDON_BIGBOX", + "MT_WHIRLWIND_BIGBOX", + "MT_ELEMENTAL_BIGBOX", + "MT_SNEAKERS_BIGBOX", + "MT_INVULN_BIGBOX", + "MT_1UP_BIGBOX", + "MT_EGGMAN_BIGBOX", + "MT_MIXUP_BIGBOX", + "MT_MYSTERY_BIGBOX", + "MT_GRAVITY_BIGBOX", + "MT_RECYCLER_BIGBOX", + "MT_SCORE1K_BIGBOX", + "MT_SCORE10K_BIGBOX", + + // Monitor boxes -- special + "MT_RING_REDBOX", + "MT_RING_BLUEBOX", + + // Monitor icons + "MT_RING_ICON", + "MT_PITY_ICON", + "MT_ATTRACT_ICON", + "MT_FORCE_ICON", + "MT_ARMAGEDDON_ICON", + "MT_WHIRLWIND_ICON", + "MT_ELEMENTAL_ICON", + "MT_SNEAKERS_ICON", + "MT_INVULN_ICON", + "MT_1UP_ICON", + "MT_EGGMAN_ICON", + "MT_MIXUP_ICON", + "MT_GRAVITY_ICON", + "MT_RECYCLER_ICON", + "MT_SCORE1K_ICON", + "MT_SCORE10K_ICON", // Projectiles "MT_ROCKET", diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index fb369387f..094495f91 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -247,27 +247,30 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_BMNE // Monitor Boxes - &lspr[NOLIGHT], // SPR_SRBX - &lspr[NOLIGHT], // SPR_RRBX - &lspr[NOLIGHT], // SPR_BRBX - &lspr[NOLIGHT], // SPR_SHTV - &lspr[NOLIGHT], // SPR_PINV - &lspr[NOLIGHT], // SPR_YLTV - &lspr[NOLIGHT], // SPR_BLTV - &lspr[NOLIGHT], // SPR_BKTV - &lspr[NOLIGHT], // SPR_WHTV - &lspr[NOLIGHT], // SPR_GRTV - &lspr[NOLIGHT], // SPR_ELTV - &lspr[NOLIGHT], // SPR_EGGB - &lspr[NOLIGHT], // SPR_MIXU - &lspr[NOLIGHT], // SPR_RECY - &lspr[NOLIGHT], // SPR_QUES - &lspr[NOLIGHT], // SPR_GBTV - &lspr[NOLIGHT], // SPR_PRUP - &lspr[NOLIGHT], // SPR_PTTV + &lspr[NOLIGHT], // SPR_MSTV + &lspr[NOLIGHT], // SPR_XLTV - // Monitor Miscellany - &lspr[NOLIGHT], // SPR_MTEX + &lspr[NOLIGHT], // SPR_TRRI + &lspr[NOLIGHT], // SPR_TBRI + + &lspr[NOLIGHT], // SPR_TVRI + &lspr[NOLIGHT], // SPR_TVPI + &lspr[NOLIGHT], // SPR_TVAT + &lspr[NOLIGHT], // SPR_TVFO + &lspr[NOLIGHT], // SPR_TVAR + &lspr[NOLIGHT], // SPR_TVWW + &lspr[NOLIGHT], // SPR_TVEL + &lspr[NOLIGHT], // SPR_TVSS + &lspr[NOLIGHT], // SPR_TVIV + &lspr[NOLIGHT], // SPR_TV1U + &lspr[NOLIGHT], // SPR_TV1P + &lspr[NOLIGHT], // SPR_TVEG + &lspr[NOLIGHT], // SPR_TVMX + &lspr[NOLIGHT], // SPR_TVMY + &lspr[NOLIGHT], // SPR_TVGV + &lspr[NOLIGHT], // SPR_TVRC + &lspr[NOLIGHT], // SPR_TV1K + &lspr[NOLIGHT], // SPR_TVTK // Projectiles &lspr[NOLIGHT], // SPR_MISL diff --git a/src/info.c b/src/info.c index 8d7c249ad..d00ecc5dc 100644 --- a/src/info.c +++ b/src/info.c @@ -34,26 +34,26 @@ char sprnames[NUMSPRITES + 1][5] = "FAKE","EGGP","EFIR","EGGQ","EGGR","BRAK","BGOO","BMSL","EGGT","RCKT", "ELEC","TARG","NPLM","MNPL","METL","MSCF","MSCB","RING","TRNG","EMMY", "TOKE","RFLG","BFLG","NWNG","EMBM","CEMG","EMER","FANS","BUBL","SIGN", - "STEM","SPIK","SFLM","USPK","STPT","BMNE","SRBX","RRBX","BRBX","SHTV", - "PINV","YLTV","BLTV","BKTV","WHTV","GRTV","ELTV","EGGB","MIXU","RECY", - "QUES","GBTV","PRUP","PTTV","MTEX","MISL","TORP","ENRG","MINE","JBUL", - "TRLS","CBLL","AROW","CFIR","FWR1","FWR2","FWR3","FWR4","BUS1","BUS2", - "THZP","ALRM","GARG","SEWE","DRIP","CRL1","CRL2","CRL3","BCRY","CHAN", - "FLAM","ESTA","SMCH","BMCH","SMCE","BMCE","BTBL","STBL","CACT","FLME", - "DFLM","XMS1","XMS2","XMS3","BSZ1","BSZ2","BSZ3","BSZ4","BSZ5","BSZ6", - "BSZ7","BSZ8","STLG","DBAL","RCRY","ARMA","ARMF","ARMB","WIND","MAGN", - "ELEM","FORC","PITY","IVSP","SSPK","GOAL","BIRD","BUNY","MOUS","CHIC", - "COWZ","RBRD","SPRY","SPRR","SPRB","YSPR","RSPR","RAIN","SNO1","SPLH", - "SPLA","SMOK","BUBP","BUBO","BUBN","BUBM","POPP","TFOG","SEED","PRTL", - "SCOR","DRWN","TTAG","GFLG","RRNG","RNGB","RNGR","RNGI","RNGA","RNGE", - "RNGS","RNGG","PIKB","PIKR","PIKA","PIKE","PIKS","PIKG","TAUT","TGRE", - "TSCR","COIN","CPRK","GOOM","BGOM","FFWR","FBLL","SHLL","PUMA","HAMM", - "KOOP","BFLM","MAXE","MUS1","MUS2","TOAD","NDRN","SUPE","SUPZ","NDRL", - "NSPK","NBMP","HOOP","NSCR","NPRU","CAPS","SUPT","SPRK","BOM1","BOM2", - "BOM3","BOM4","ROIA","ROIB","ROIC","ROID","ROIE","ROIF","ROIG","ROIH", - "ROII","ROIJ","ROIK","ROIL","ROIM","ROIN","ROIO","ROIP","BBAL","GWLG", - "GWLR","SRBA","SRBB","SRBC","SRBD","SRBE","SRBF","SRBG","SRBH","SRBI", - "SRBJ","SRBK","SRBL","SRBM","SRBN","SRBO", + "STEM","SPIK","SFLM","USPK","STPT","BMNE","MSTV","XLTV","TRRI","TBRI", + "TVRI","TVPI","TVAT","TVFO","TVAR","TVWW","TVEL","TVSS","TVIV","TV1U", + "TV1P","TVEG","TVMX","TVMY","TVGV","TVRC","TV1K","TVTK","MISL","TORP", + "ENRG","MINE","JBUL","TRLS","CBLL","AROW","CFIR","FWR1","FWR2","FWR3", + "FWR4","BUS1","BUS2","THZP","ALRM","GARG","SEWE","DRIP","CRL1","CRL2", + "CRL3","BCRY","CHAN","FLAM","ESTA","SMCH","BMCH","SMCE","BMCE","BTBL", + "STBL","CACT","FLME","DFLM","XMS1","XMS2","XMS3","BSZ1","BSZ2","BSZ3", + "BSZ4","BSZ5","BSZ6","BSZ7","BSZ8","STLG","DBAL","RCRY","ARMA","ARMF", + "ARMB","WIND","MAGN","ELEM","FORC","PITY","IVSP","SSPK","GOAL","BIRD", + "BUNY","MOUS","CHIC","COWZ","RBRD","SPRY","SPRR","SPRB","YSPR","RSPR", + "RAIN","SNO1","SPLH","SPLA","SMOK","BUBP","BUBO","BUBN","BUBM","POPP", + "TFOG","SEED","PRTL","SCOR","DRWN","TTAG","GFLG","RRNG","RNGB","RNGR", + "RNGI","RNGA","RNGE","RNGS","RNGG","PIKB","PIKR","PIKA","PIKE","PIKS", + "PIKG","TAUT","TGRE","TSCR","COIN","CPRK","GOOM","BGOM","FFWR","FBLL", + "SHLL","PUMA","HAMM","KOOP","BFLM","MAXE","MUS1","MUS2","TOAD","NDRN", + "SUPE","SUPZ","NDRL","NSPK","NBMP","HOOP","NSCR","NPRU","CAPS","SUPT", + "SPRK","BOM1","BOM2","BOM3","BOM4","ROIA","ROIB","ROIC","ROID","ROIE", + "ROIF","ROIG","ROIH","ROII","ROIJ","ROIK","ROIL","ROIM","ROIN","ROIO", + "ROIP","BBAL","GWLG","GWLR","SRBA","SRBB","SRBC","SRBD","SRBE","SRBF", + "SRBG","SRBH","SRBI","SRBJ","SRBK","SRBL","SRBM","SRBN","SRBO", }; char spr2names[NUMPLAYERSPRITES][5] = @@ -1239,172 +1239,171 @@ state_t states[NUMSTATES] = {SPR_NULL, 0, 1, {A_LobShot}, MT_CANNONBALL, 4*TICRATE, S_CANNONLAUNCHER3}, // S_CANNONLAUNCHER2 {SPR_NULL, 0, 2, {A_SetRandomTics}, TICRATE/2, 3*TICRATE, S_CANNONLAUNCHER1}, // S_CANNONLAUNCHER3 - // Super Ring Box - {SPR_SRBX, 0, 2, {NULL}, 0, 0, S_SUPERRINGBOX1}, // S_SUPERRINGBOX - {SPR_MTEX, 0, 1, {NULL}, 0, 0, S_SUPERRINGBOX}, // S_SUPERRINGBOX1 - {SPR_SRBX, 1, 4, {A_MonitorPop}, 0, 0, S_SUPERRINGBOX3}, // S_SUPERRINGBOX2 - {SPR_YLTV, 2, 4, {NULL}, 0, 0, S_SUPERRINGBOX4}, // S_SUPERRINGBOX3 - {SPR_YLTV, 3, 4, {NULL}, 0, 0, S_SUPERRINGBOX5}, // S_SUPERRINGBOX4 - {SPR_YLTV, 4, 4, {NULL}, 0, 0, S_SUPERRINGBOX6}, // S_SUPERRINGBOX5 - {SPR_SRBX, 1, 18, {A_RingBox}, 0, 0, S_NULL}, // S_SUPERRINGBOX6 + // Monitor Miscellany + {SPR_NSPK, FF_TRANS40, 20, {NULL}, 0, 0, S_BOXSPARKLE2}, // S_BOXSPARKLE1 + {SPR_NSPK, FF_TRANS60, 10, {NULL}, 0, 0, S_BOXSPARKLE3}, // S_BOXSPARKLE2 + {SPR_NSPK, FF_TRANS80, 5, {NULL}, 0, 0, S_NULL}, // S_BOXSPARKLE3 - // Red Team Ring Box - {SPR_RRBX, 0, 2, {NULL}, 0, 0, S_REDRINGBOX1}, // S_REDRINGBOX - {SPR_RRBX, 1, 1, {NULL}, 0, 0, S_REDRINGBOX}, // S_REDRINGBOX1 + {SPR_MSTV, 0, 1, {NULL}, 0, 0, S_SPAWNSTATE}, // S_BOX_FLICKER + {SPR_MSTV, 0, 4, {A_MonitorPop}, 0, 0, S_BOX_POP2}, // S_BOX_POP1 + {SPR_MSTV, 1, -1, {NULL}, 0, 0, S_NULL}, // S_BOX_POP2 - // Blue Team Ring Box - {SPR_BRBX, 0, 2, {NULL}, 0, 0, S_BLUERINGBOX1}, // S_BLUERINGBOX - {SPR_BRBX, 1, 1, {NULL}, 0, 0, S_BLUERINGBOX}, // S_BLUERINGBOX1 + {SPR_XLTV, 0, 1, {NULL}, 0, 0, S_SPAWNSTATE}, // S_BIGBOX_FLICKER + {SPR_XLTV, 1, 89, {A_BigMonitorPop}, 0, 0, S_BIGBOX_OFF2}, // S_BIGBOX_OFF1 + {SPR_XLTV, 2, 4, {A_PlayAttackSound}, 0, 0, S_BIGBOX_OFF3}, // S_BIGBOX_OFF2 + {SPR_XLTV, 3, 4, {NULL}, 0, 0, S_BIGBOX_OFF4}, // S_BIGBOX_OFF3 + {SPR_XLTV, 4, 4, {NULL}, 0, 0, S_BIGBOX_OFF5}, // S_BIGBOX_OFF4 + {SPR_XLTV, 5, 2, {NULL}, 0, 0, S_BIGBOX_OFF6}, // S_BIGBOX_OFF5 + {SPR_XLTV, 6, 2, {NULL}, 0, 0, S_BIGBOX_OFF7}, // S_BIGBOX_OFF6 + {SPR_XLTV, 6, 0, {A_BigMonitorRestore}, 0, 0, S_SPAWNSTATE}, // S_BIGBOX_OFF7 - // Super Sneakers Box - {SPR_SHTV, 0, 2, {NULL}, 0, 0, S_SHTV1}, // S_SHTV - {SPR_MTEX, 0, 1, {NULL}, 0, 0, S_SHTV}, // S_SHTV1 - {SPR_SHTV, 1, 4, {A_MonitorPop}, 0, 0, S_SHTV3}, // S_SHTV2 - {SPR_YLTV, 2, 4, {NULL}, 0, 0, S_SHTV4}, // S_SHTV3 - {SPR_YLTV, 3, 4, {NULL}, 0, 0, S_SHTV5}, // S_SHTV4 - {SPR_YLTV, 4, 4, {NULL}, 0, 0, S_SHTV6}, // S_SHTV5 - {SPR_SHTV, 1, 18, {A_SuperSneakers}, 0, 0, S_NULL}, // S_SHTV6 + // Monitor States (one per box) + {SPR_TVMY, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_MYSTERY_BOX + {SPR_TVRI, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_RING_BOX + {SPR_TVPI, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_PITY_BOX + {SPR_TVAT, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_ATTRACT_BOX + {SPR_TVFO, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_FORCE_BOX + {SPR_TVAR, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_ARMAGEDDON_BOX + {SPR_TVWW, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_WHIRLWIND_BOX + {SPR_TVEL, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_ELEMENTAL_BOX + {SPR_TVSS, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_SNEAKERS_BOX + {SPR_TVIV, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_INVULN_BOX + {SPR_TV1P, 0, 2, {A_1upThinker}, 0, 0, S_BOX_FLICKER}, // S_1UP_BOX + {SPR_TVEG, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_EGGMAN_BOX + {SPR_TVMX, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_MIXUP_BOX + {SPR_TVGV, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_GRAVITY_BOX + {SPR_TVRC, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_RECYCLER_BOX + {SPR_TV1K, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_SCORE1K_BOX + {SPR_TVTK, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_SCORE10K_BOX - // Invincibility Box - {SPR_PINV, 0, 2, {NULL}, 0, 0, S_PINV1}, // S_PINV - {SPR_MTEX, 0, 1, {NULL}, 0, 0, S_PINV}, // S_PINV1 - {SPR_PINV, 1, 4, {A_MonitorPop}, 0, 0, S_PINV3}, // S_PINV2 - {SPR_PINV, 2, 4, {NULL}, 0, 0, S_PINV4}, // S_PINV3 - {SPR_PINV, 3, 4, {NULL}, 0, 0, S_PINV5}, // S_PINV4 - {SPR_PINV, 4, 4, {NULL}, 0, 0, S_PINV6}, // S_PINV5 - {SPR_PINV, 1, 18, {A_Invincibility}, 0, 0, S_NULL}, // S_PINV6 + // Repeat Monitor States (one per box) + {SPR_TVMY, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_MYSTERY_BIGBOX + {SPR_TVRI, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_RING_BIGBOX + {SPR_TVPI, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_PITY_BIGBOX + {SPR_TVAT, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_ATTRACT_BIGBOX + {SPR_TVFO, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_FORCE_BIGBOX + {SPR_TVAR, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_ARMAGEDDON_BIGBOX + {SPR_TVWW, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_WHIRLWIND_BIGBOX + {SPR_TVEL, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_ELEMENTAL_BIGBOX + {SPR_TVSS, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_SNEAKERS_BIGBOX + {SPR_TVIV, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_INVULN_BIGBOX + {SPR_TV1P, 1, 2, {A_DualAction}, S_MYSTERY_BIGBOX, S_1UP_BOX, S_BIGBOX_FLICKER}, // S_1UP_BIGBOX + {SPR_TVEG, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_EGGMAN_BIGBOX + {SPR_TVMX, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_MIXUP_BIGBOX + {SPR_TVGV, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_GRAVITY_BIGBOX + {SPR_TVRC, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_RECYCLER_BIGBOX + {SPR_TV1K, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_SCORE1K_BIGBOX + {SPR_TVTK, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_SCORE10K_BIGBOX - // 1up Box - {SPR_PRUP, 2, 2, {A_1upThinker}, 0, 0, S_PRUP1}, // S_PRUP - {SPR_MTEX, 0, 1, {NULL}, 0, 0, S_PRUP}, // S_PRUP1 - {SPR_PRUP, 3, 4, {A_MonitorPop}, 0, 0, S_PRUP3}, // S_PRUP2 - {SPR_PINV, 2, 4, {NULL}, 0, 0, S_PRUP4}, // S_PRUP3 - {SPR_PINV, 3, 4, {NULL}, 0, 0, S_PRUP5}, // S_PRUP4 - {SPR_PINV, 4, 4, {NULL}, 0, 0, S_PRUP6}, // S_PRUP5 - {SPR_PRUP, 3, 18, {A_ExtraLife}, 0, 0, S_NULL}, // S_PRUP6 + // Team Ring Boxes (these are special) + {SPR_TRRI, 0, 2, {NULL}, 0, 0, S_RING_REDBOX2}, // S_RING_REDBOX1 + {SPR_TRRI, 1, 1, {NULL}, 0, 0, S_RING_REDBOX1}, // S_RING_REDBOX2 + {SPR_TRRI, 1, 4, {A_MonitorPop}, 0, 0, S_REDBOX_POP2}, // S_REDBOX_POP1 + {SPR_TRRI, 2, -1, {NULL}, 0, 0, S_NULL}, // S_REDBOX_POP2 - // Ring Shield Box - {SPR_YLTV, 0, 2, {NULL}, 0, 0, S_YLTV1}, // S_YLTV - {SPR_MTEX, 0, 1, {NULL}, 0, 0, S_YLTV}, // S_YLTV1 - {SPR_YLTV, 1, 4, {A_MonitorPop}, 0, 0, S_YLTV3}, // S_YLTV2 - {SPR_YLTV, 2, 4, {NULL}, 0, 0, S_YLTV4}, // S_YLTV3 - {SPR_YLTV, 3, 4, {NULL}, 0, 0, S_YLTV5}, // S_YLTV4 - {SPR_YLTV, 4, 4, {NULL}, 0, 0, S_YLTV6}, // S_YLTV5 - {SPR_YLTV, 1, 18, {A_RingShield},0, 0, S_NULL}, // S_YLTV6 + {SPR_TBRI, 0, 2, {NULL}, 0, 0, S_RING_BLUEBOX2}, // S_RING_BLUEBOX1 + {SPR_TBRI, 1, 1, {NULL}, 0, 0, S_RING_BLUEBOX1}, // S_RING_BLUEBOX2 + {SPR_TBRI, 1, 4, {A_MonitorPop}, 0, 0, S_BLUEBOX_POP2}, // S_BLUEBOX_POP1 + {SPR_TBRI, 2, -1, {NULL}, 0, 0, S_NULL}, // S_BLUEBOX_POP2 - // Force Shield Box - {SPR_BLTV, 0, 2, {NULL}, 0, 0, S_BLTV2}, // S_BLTV1 - {SPR_MTEX, 0, 1, {NULL}, 0, 0, S_BLTV1}, // S_BLTV2 - {SPR_BLTV, 1, 4, {A_MonitorPop}, 0, 0, S_BLTV4}, // S_BLTV3 - {SPR_BLTV, 2, 4, {NULL}, 0, 0, S_BLTV5}, // S_BLTV4 - {SPR_BLTV, 3, 4, {NULL}, 0, 0, S_BLTV6}, // S_BLTV5 - {SPR_BLTV, 4, 4, {NULL}, 0, 0, S_BLTV7}, // S_BLTV6 - {SPR_BLTV, 1, 18, {A_ForceShield}, 0, 0, S_NULL}, // S_BLTV7 + // Box Icons -- 5 states each, one for each part of the twirl + {SPR_TVRI, 2, 4, {NULL}, 0, 0, S_RING_ICON2}, // S_RING_ICON1 + {SPR_TVRI, 3, 4, {NULL}, 0, 0, S_RING_ICON3}, // S_RING_ICON2 + {SPR_TVRI, 4, 4, {NULL}, 0, 0, S_RING_ICON4}, // S_RING_ICON3 + {SPR_TVRI, 5, 4, {NULL}, 0, 0, S_RING_ICON5}, // S_RING_ICON4 + {SPR_TVRI, 2, 18, {A_RingBox}, 0, 0, S_NULL}, // S_RING_ICON5 - // Bomb Shield Box - {SPR_BKTV, 0, 2, {NULL}, 0, 0, S_BKTV2}, // S_BKTV1 - {SPR_MTEX, 0, 1, {NULL}, 0, 0, S_BKTV1}, // S_BKTV2 - {SPR_BKTV, 1, 4, {A_MonitorPop}, 0, 0, S_BKTV4}, // S_BKTV3 - {SPR_BKTV, 2, 4, {NULL}, 0, 0, S_BKTV5}, // S_BKTV4 - {SPR_BKTV, 3, 4, {NULL}, 0, 0, S_BKTV6}, // S_BKTV5 - {SPR_BKTV, 4, 4, {NULL}, 0, 0, S_BKTV7}, // S_BKTV6 - {SPR_BKTV, 1, 18, {A_BombShield}, 0, 0, S_NULL}, // S_BKTV7 + {SPR_TVPI, 2, 4, {NULL}, 0, 0, S_PITY_ICON2}, // S_PITY_ICON1 + {SPR_TVPI, 3, 4, {NULL}, 0, 0, S_PITY_ICON3}, // S_PITY_ICON2 + {SPR_TVPI, 4, 4, {NULL}, 0, 0, S_PITY_ICON4}, // S_PITY_ICON3 + {SPR_TVPI, 5, 4, {NULL}, 0, 0, S_PITY_ICON5}, // S_PITY_ICON4 + {SPR_TVPI, 2, 18, {A_PityShield}, 0, 0, S_NULL}, // S_PITY_ICON5 - // Jump Shield Box - {SPR_WHTV, 0, 2, {NULL}, 0, 0, S_WHTV2}, // S_WHTV1 - {SPR_MTEX, 0, 1, {NULL}, 0, 0, S_WHTV1}, // S_WHTV2 - {SPR_WHTV, 1, 4, {A_MonitorPop}, 0, 0, S_WHTV4}, // S_WHTV3 - {SPR_WHTV, 2, 4, {NULL}, 0, 0, S_WHTV5}, // S_WHTV4 - {SPR_WHTV, 3, 4, {NULL}, 0, 0, S_WHTV6}, // S_WHTV5 - {SPR_WHTV, 4, 4, {NULL}, 0, 0, S_WHTV7}, // S_WHTV6 - {SPR_WHTV, 1, 18, {A_JumpShield}, 0, 0, S_NULL}, // S_WHTV7 + {SPR_TVAT, 2, 4, {NULL}, 0, 0, S_ATTRACT_ICON2}, // S_ATTRACT_ICON1 + {SPR_TVAT, 3, 4, {NULL}, 0, 0, S_ATTRACT_ICON3}, // S_ATTRACT_ICON2 + {SPR_TVAT, 4, 4, {NULL}, 0, 0, S_ATTRACT_ICON4}, // S_ATTRACT_ICON3 + {SPR_TVAT, 5, 4, {NULL}, 0, 0, S_ATTRACT_ICON5}, // S_ATTRACT_ICON4 + {SPR_TVAT, 2, 18, {A_RingShield},0, 0, S_NULL}, // S_ATTRACT_ICON5 - // Elemental Shield Box - {SPR_ELTV, 0, 2, {NULL}, 0, 0, S_GRTV1}, // S_GRTV - {SPR_MTEX, 0, 1, {NULL}, 0, 0, S_GRTV}, // S_GRTV1 - {SPR_ELTV, 1, 4, {A_MonitorPop}, 0, 0, S_GRTV3}, // S_GRTV2 - {SPR_ELTV, 2, 4, {NULL}, 0, 0, S_GRTV4}, // S_GRTV3 - {SPR_ELTV, 3, 4, {NULL}, 0, 0, S_GRTV5}, // S_GRTV4 - {SPR_ELTV, 4, 4, {NULL}, 0, 0, S_GRTV6}, // S_GRTV5 - {SPR_ELTV, 1, 18, {A_WaterShield}, 0, 0, S_NULL}, // S_GRTV6 + {SPR_TVFO, 2, 4, {NULL}, 0, 0, S_FORCE_ICON2}, // S_FORCE_ICON1 + {SPR_TVFO, 3, 4, {NULL}, 0, 0, S_FORCE_ICON3}, // S_FORCE_ICON2 + {SPR_TVFO, 4, 4, {NULL}, 0, 0, S_FORCE_ICON4}, // S_FORCE_ICON3 + {SPR_TVFO, 5, 4, {NULL}, 0, 0, S_FORCE_ICON5}, // S_FORCE_ICON4 + {SPR_TVFO, 2, 18, {A_ForceShield}, 0, 0, S_NULL}, // S_FORCE_ICON5 - // Pity Shield Box - {SPR_GRTV, 0, 2, {NULL}, 0, 0, S_PITV2}, // S_PITV1 - {SPR_MTEX, 0, 1, {NULL}, 0, 0, S_PITV1}, // S_PITV2 - {SPR_GRTV, 1, 4, {A_MonitorPop}, 0, 0, S_PITV4}, // S_PITV3 - {SPR_GRTV, 2, 4, {NULL}, 0, 0, S_PITV5}, // S_PITV4 - {SPR_GRTV, 3, 4, {NULL}, 0, 0, S_PITV6}, // S_PITV5 - {SPR_GRTV, 4, 4, {NULL}, 0, 0, S_PITV7}, // S_PITV6 - {SPR_GRTV, 1, 18, {A_PityShield}, 0, 0, S_NULL}, // S_PITV7 + {SPR_TVAR, 2, 4, {NULL}, 0, 0, S_ARMAGEDDON_ICON2}, // S_ARMAGEDDON_ICON1 + {SPR_TVAR, 3, 4, {NULL}, 0, 0, S_ARMAGEDDON_ICON3}, // S_ARMAGEDDON_ICON2 + {SPR_TVAR, 4, 4, {NULL}, 0, 0, S_ARMAGEDDON_ICON4}, // S_ARMAGEDDON_ICON3 + {SPR_TVAR, 5, 4, {NULL}, 0, 0, S_ARMAGEDDON_ICON5}, // S_ARMAGEDDON_ICON4 + {SPR_TVAR, 2, 18, {A_BombShield}, 0, 0, S_NULL}, // S_ARMAGEDDON_ICON5 - // Eggman Box - {SPR_EGGB, 0, 2, {NULL}, 0, 0, S_EGGTV2}, // S_EGGTV1 - {SPR_MTEX, 0, 1, {NULL}, 0, 0, S_EGGTV1}, // S_EGGTV2 - {SPR_EGGB, 1, 4, {A_MonitorPop}, 0, 0, S_EGGTV4}, // S_EGGTV3 - {SPR_BKTV, 2, 4, {NULL}, 0, 0, S_EGGTV5}, // S_EGGTV4 - {SPR_BKTV, 3, 4, {NULL}, 0, 0, S_EGGTV6}, // S_EGGTV5 - {SPR_BKTV, 4, 4, {NULL}, 0, 0, S_EGGTV7}, // S_EGGTV6 - {SPR_EGGB, 1, 18, {A_EggmanBox}, 0, 0, S_NULL}, // S_EGGTV7 + {SPR_TVWW, 2, 4, {NULL}, 0, 0, S_WHIRLWIND_ICON2}, // S_WHIRLWIND_ICON1 + {SPR_TVWW, 3, 4, {NULL}, 0, 0, S_WHIRLWIND_ICON3}, // S_WHIRLWIND_ICON2 + {SPR_TVWW, 4, 4, {NULL}, 0, 0, S_WHIRLWIND_ICON4}, // S_WHIRLWIND_ICON3 + {SPR_TVWW, 5, 4, {NULL}, 0, 0, S_WHIRLWIND_ICON5}, // S_WHIRLWIND_ICON4 + {SPR_TVWW, 2, 18, {A_JumpShield}, 0, 0, S_NULL}, // S_WHIRLWIND_ICON5 - // Teleport Box - {SPR_MIXU, 0, 2, {NULL}, 0, 0, S_MIXUPBOX2}, // S_MIXUPBOX1 - {SPR_MTEX, 0, 1, {NULL}, 0, 0, S_MIXUPBOX1}, // S_MIXUPBOX2 - {SPR_MIXU, 1, 4, {A_MonitorPop}, 0, 0, S_MIXUPBOX4}, // S_MIXUPBOX3 - {SPR_WHTV, 2, 4, {NULL}, 0, 0, S_MIXUPBOX5}, // S_MIXUPBOX4 - {SPR_WHTV, 3, 4, {NULL}, 0, 0, S_MIXUPBOX6}, // S_MIXUPBOX5 - {SPR_WHTV, 4, 4, {NULL}, 0, 0, S_MIXUPBOX7}, // S_MIXUPBOX6 - {SPR_MIXU, 1, 18, {A_MixUp}, 0, 0, S_NULL}, // S_MIXUPBOX7 + {SPR_TVEL, 2, 4, {NULL}, 0, 0, S_ELEMENTAL_ICON2}, // S_ELEMENTAL_ICON1 + {SPR_TVEL, 3, 4, {NULL}, 0, 0, S_ELEMENTAL_ICON3}, // S_ELEMENTAL_ICON2 + {SPR_TVEL, 4, 4, {NULL}, 0, 0, S_ELEMENTAL_ICON4}, // S_ELEMENTAL_ICON3 + {SPR_TVEL, 5, 4, {NULL}, 0, 0, S_ELEMENTAL_ICON5}, // S_ELEMENTAL_ICON4 + {SPR_TVEL, 2, 18, {A_WaterShield}, 0, 0, S_NULL}, // S_ELEMENTAL_ICON5 - // Recycler Box - {SPR_RECY, 0, 2, {NULL}, 0, 0, S_RECYCLETV2}, // S_RECYCLETV1 - {SPR_MTEX, 0, 1, {NULL}, 0, 0, S_RECYCLETV1}, // S_RECYCLETV2 - {SPR_RECY, 1, 4, {A_MonitorPop}, 0, 0, S_RECYCLETV4}, // S_RECYCLETV3 - {SPR_GRTV, 2, 4, {NULL}, 0, 0, S_RECYCLETV5}, // S_RECYCLETV4 - {SPR_GRTV, 3, 4, {NULL}, 0, 0, S_RECYCLETV6}, // S_RECYCLETV5 - {SPR_GRTV, 4, 4, {NULL}, 0, 0, S_RECYCLETV7}, // S_RECYCLETV6 - {SPR_RECY, 1, 18, {A_RecyclePowers}, 0, 0, S_NULL}, // S_RECYCLETV7 + {SPR_TVSS, 2, 4, {NULL}, 0, 0, S_SNEAKERS_ICON2}, // S_SNEAKERS_ICON1 + {SPR_TVSS, 3, 4, {NULL}, 0, 0, S_SNEAKERS_ICON3}, // S_SNEAKERS_ICON2 + {SPR_TVSS, 4, 4, {NULL}, 0, 0, S_SNEAKERS_ICON4}, // S_SNEAKERS_ICON3 + {SPR_TVSS, 5, 4, {NULL}, 0, 0, S_SNEAKERS_ICON5}, // S_SNEAKERS_ICON4 + {SPR_TVSS, 2, 18, {A_SuperSneakers}, 0, 0, S_NULL}, // S_SNEAKERS_ICON5 - // Question Box - {SPR_QUES, 0, 2, {NULL}, 0, 0, S_RANDOMBOX2}, // S_RANDOMBOX1 - {SPR_MTEX, 0, 1, {NULL}, 0, 0, S_RANDOMBOX1}, // S_RANDOMBOX2 - {SPR_QUES, 0, 1, {A_MonitorPop}, 0, 0, S_NULL}, // S_RANDOMBOX3 + {SPR_TVIV, 2, 4, {NULL}, 0, 0, S_INVULN_ICON2}, // S_INVULN_ICON1 + {SPR_TVIV, 3, 4, {NULL}, 0, 0, S_INVULN_ICON3}, // S_INVULN_ICON2 + {SPR_TVIV, 4, 4, {NULL}, 0, 0, S_INVULN_ICON4}, // S_INVULN_ICON3 + {SPR_TVIV, 5, 4, {NULL}, 0, 0, S_INVULN_ICON5}, // S_INVULN_ICON4 + {SPR_TVIV, 2, 18, {A_Invincibility}, 0, 0, S_NULL}, // S_INVULN_ICON5 - // Gravity Boots Box - {SPR_GBTV, 0, 2, {NULL}, 0, 0, S_GBTV2}, // S_GBTV1 - {SPR_MTEX, 0, 1, {NULL}, 0, 0, S_GBTV1}, // S_GBTV2 - {SPR_GBTV, 1, 4, {A_MonitorPop}, 0, 0, S_GBTV4}, // S_GBTV3 - {SPR_BLTV, 2, 4, {NULL}, 0, 0, S_GBTV5}, // S_GBTV4 - {SPR_BLTV, 3, 4, {NULL}, 0, 0, S_GBTV6}, // S_GBTV5 - {SPR_BLTV, 4, 4, {NULL}, 0, 0, S_GBTV7}, // S_GBTV6 - {SPR_GBTV, 1, 18, {A_GravityBox}, 0, 0, S_NULL}, // S_GBTV7 + {SPR_TV1P, 2, 4, {NULL}, 0, 0, S_1UP_ICON2}, // S_1UP_ICON1 + {SPR_TV1U, 3, 4, {NULL}, 0, 0, S_1UP_ICON3}, // S_1UP_ICON2 + {SPR_TV1U, 4, 4, {NULL}, 0, 0, S_1UP_ICON4}, // S_1UP_ICON3 + {SPR_TV1U, 5, 4, {NULL}, 0, 0, S_1UP_ICON5}, // S_1UP_ICON4 + {SPR_TV1P, 2, 18, {A_ExtraLife}, 0, 0, S_NULL}, // S_1UP_ICON5 - // Score Box (1k) - {SPR_PTTV, 0, 2, {NULL}, 0, 0, S_SCORETVA2}, // S_SCORETVA1 - {SPR_MTEX, 0, 1, {NULL}, 0, 0, S_SCORETVA1}, // S_SCORETVA2 - {SPR_PTTV, 1, 4, {A_MonitorPop}, 0, 0, S_SCORETVA4}, // S_SCORETVA3 - {SPR_PTTV, 2, 4, {NULL}, 0, 0, S_SCORETVA5}, // S_SCORETVA4 - {SPR_PTTV, 3, 4, {NULL}, 0, 0, S_SCORETVA6}, // S_SCORETVA5 - {SPR_PTTV, 4, 4, {NULL}, 0, 0, S_SCORETVA7}, // S_SCORETVA6 - {SPR_PTTV, 1, 18, {A_AwardScore}, 0, 0, S_NULL}, // S_SCORETVA7 + {SPR_TVEG, 2, 4, {NULL}, 0, 0, S_EGGMAN_ICON2}, // S_EGGMAN_ICON1 + {SPR_TVEG, 3, 4, {NULL}, 0, 0, S_EGGMAN_ICON3}, // S_EGGMAN_ICON2 + {SPR_TVEG, 4, 4, {NULL}, 0, 0, S_EGGMAN_ICON4}, // S_EGGMAN_ICON3 + {SPR_TVEG, 5, 4, {NULL}, 0, 0, S_EGGMAN_ICON5}, // S_EGGMAN_ICON4 + {SPR_TVEG, 2, 18, {A_EggmanBox}, 0, 0, S_NULL}, // S_EGGMAN_ICON5 - // Score Box (10k) - {SPR_PTTV, 5, 2, {NULL}, 0, 0, S_SCORETVB2}, // S_SCORETVB1 - {SPR_MTEX, 0, 1, {NULL}, 0, 0, S_SCORETVB1}, // S_SCORETVB2 - {SPR_PTTV, 6, 4, {A_MonitorPop}, 0, 0, S_SCORETVB4}, // S_SCORETVB3 - {SPR_PTTV, 7, 4, {NULL}, 0, 0, S_SCORETVB5}, // S_SCORETVB4 - {SPR_PTTV, 8, 4, {NULL}, 0, 0, S_SCORETVB6}, // S_SCORETVB5 - {SPR_PTTV, 9, 4, {NULL}, 0, 0, S_SCORETVB7}, // S_SCORETVB6 - {SPR_PTTV, 6, 18, {A_AwardScore}, 0, 0, S_NULL}, // S_SCORETVB7 + {SPR_TVMX, 2, 4, {NULL}, 0, 0, S_MIXUP_ICON2}, // S_MIXUP_ICON1 + {SPR_TVMX, 3, 4, {NULL}, 0, 0, S_MIXUP_ICON3}, // S_MIXUP_ICON2 + {SPR_TVMX, 4, 4, {NULL}, 0, 0, S_MIXUP_ICON4}, // S_MIXUP_ICON3 + {SPR_TVMX, 5, 4, {NULL}, 0, 0, S_MIXUP_ICON5}, // S_MIXUP_ICON4 + {SPR_TVMX, 2, 18, {A_MixUp}, 0, 0, S_NULL}, // S_MIXUP_ICON5 - // Monitor Explosion - {SPR_MTEX, 0, 4, {NULL}, 0, 0, S_MONITOREXPLOSION2}, // S_MONITOREXPLOSION1 - {SPR_MTEX, 1, -1, {NULL}, 0, 0, S_NULL}, // S_MONITOREXPLOSION2 + {SPR_TVGV, 2, 4, {NULL}, 0, 0, S_GRAVITY_ICON2}, // S_GRAVITY_ICON1 + {SPR_TVGV, 3, 4, {NULL}, 0, 0, S_GRAVITY_ICON3}, // S_GRAVITY_ICON2 + {SPR_TVGV, 4, 4, {NULL}, 0, 0, S_GRAVITY_ICON4}, // S_GRAVITY_ICON3 + {SPR_TVGV, 5, 4, {NULL}, 0, 0, S_GRAVITY_ICON5}, // S_GRAVITY_ICON4 + {SPR_TVGV, 2, 18, {A_GravityBox}, 0, 0, S_NULL}, // S_GRAVITY_ICON5 - {SPR_RRBX, 1, 4, {NULL}, 0, 0, S_REDMONITOREXPLOSION2}, // S_REDMONITOREXPLOSION1 - {SPR_RRBX, 2, -1, {NULL}, 0, 0, S_NULL}, // S_REDMONITOREXPLOSION2 + {SPR_TVRC, 2, 4, {NULL}, 0, 0, S_RECYCLER_ICON2}, // S_RECYCLER_ICON1 + {SPR_TVRC, 3, 4, {NULL}, 0, 0, S_RECYCLER_ICON3}, // S_RECYCLER_ICON2 + {SPR_TVRC, 4, 4, {NULL}, 0, 0, S_RECYCLER_ICON4}, // S_RECYCLER_ICON3 + {SPR_TVRC, 5, 4, {NULL}, 0, 0, S_RECYCLER_ICON5}, // S_RECYCLER_ICON4 + {SPR_TVRC, 2, 18, {A_RecyclePowers}, 0, 0, S_NULL}, // S_RECYCLER_ICON5 - {SPR_BRBX, 1, 4, {NULL}, 0, 0, S_BLUEMONITOREXPLOSION2}, // S_BLUEMONITOREXPLOSION1 - {SPR_BRBX, 2, -1, {NULL}, 0, 0, S_NULL}, // S_BLUEMONITOREXPLOSION2 + {SPR_TV1K, 2, 4, {NULL}, 0, 0, S_SCORE1K_ICON2}, // S_SCORE1K_ICON1 + {SPR_TV1K, 3, 4, {NULL}, 0, 0, S_SCORE1K_ICON3}, // S_SCORE1K_ICON2 + {SPR_TV1K, 4, 4, {NULL}, 0, 0, S_SCORE1K_ICON4}, // S_SCORE1K_ICON3 + {SPR_TV1K, 5, 4, {NULL}, 0, 0, S_SCORE1K_ICON5}, // S_SCORE1K_ICON4 + {SPR_TV1K, 2, 18, {A_AwardScore}, 0, 0, S_NULL}, // S_SCORE1K_ICON5 + + {SPR_TVTK, 2, 4, {NULL}, 0, 0, S_SCORE10K_ICON2}, // S_SCORE10K_ICON1 + {SPR_TVTK, 3, 4, {NULL}, 0, 0, S_SCORE10K_ICON3}, // S_SCORE10K_ICON2 + {SPR_TVTK, 4, 4, {NULL}, 0, 0, S_SCORE10K_ICON4}, // S_SCORE10K_ICON3 + {SPR_TVTK, 5, 4, {NULL}, 0, 0, S_SCORE10K_ICON5}, // S_SCORE10K_ICON4 + {SPR_TVTK, 2, 18, {A_AwardScore}, 0, 0, S_NULL}, // S_SCORE10K_ICON5 + + // --- {SPR_MISL, FF_FULLBRIGHT, 1, {A_SmokeTrailer}, MT_SMOKE, 0, S_ROCKET}, // S_ROCKET @@ -6083,417 +6082,9 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_SUPERRINGBOX - 400, // doomednum - S_SUPERRINGBOX, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_SUPERRINGBOX, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_SUPERRINGBOX2,// deathstate - S_NULL, // xdeathstate - sfx_pop, // deathsound - MT_MONITOREXPLOSION, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - MT_RINGICO, // damage - sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags - S_NULL // raisestate - }, - - { // MT_REDRINGBOX - 414, // doomednum - S_REDRINGBOX, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_REDRINGBOX, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_SUPERRINGBOX2,// deathstate - S_NULL, // xdeathstate - sfx_pop, // deathsound - MT_REDMONITOREXPLOSION, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - MT_RINGICO, // damage - sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags - S_NULL // raisestate - }, - - { // MT_BLUERINGBOX - 415, // doomednum - S_BLUERINGBOX, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_BLUERINGBOX, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_SUPERRINGBOX2,// deathstate - S_NULL, // xdeathstate - sfx_pop, // deathsound - MT_BLUEMONITOREXPLOSION, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - MT_RINGICO, // damage - sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags - S_NULL // raisestate - }, - - { // MT_SNEAKERTV - 407, // doomednum - S_SHTV, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_SHTV, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_SHTV2, // deathstate - S_NULL, // xdeathstate - sfx_pop, // deathsound - MT_MONITOREXPLOSION, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - MT_SHOESICO, // damage - sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags - S_NULL // raisestate - }, - - { // MT_INV - 408, // doomednum - S_PINV, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_PINV, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_PINV2, // deathstate - S_NULL, // xdeathstate - sfx_pop, // deathsound - MT_MONITOREXPLOSION, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - MT_INVCICO, // damage - sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags - S_NULL // raisestate - }, - - // 1-up box - { // MT_PRUP - 409, // doomednum - S_PRUP, // spawnstate - 1, // spawnhealth - S_PLAY_BOX1, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_PRUP, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_PRUP2, // deathstate - S_NULL, // xdeathstate - sfx_pop, // deathsound - MT_MONITOREXPLOSION, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - MT_1UPICO, // damage - sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_RUNSPAWNFUNC, // flags - S_NULL // raisestate - }, - - { // MT_YELLOWTV - 402, // doomednum - S_YLTV, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_YLTV, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_YLTV2, // deathstate - S_NULL, // xdeathstate - sfx_pop, // deathsound - MT_MONITOREXPLOSION, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - MT_YSHIELDICO, // damage - sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags - S_NULL // raisestate - }, - - { // MT_BLUETV - 403, // doomednum - S_BLTV1, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_BLTV1, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_BLTV3, // deathstate - S_NULL, // xdeathstate - sfx_pop, // deathsound - MT_MONITOREXPLOSION, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - MT_BSHIELDICO, // damage - sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags - S_NULL // raisestate - }, - - // bomb shield box - { // MT_BLACKTV - 404, // doomednum - S_BKTV1, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_BKTV1, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_BKTV3, // deathstate - S_NULL, // xdeathstate - sfx_pop, // deathsound - MT_MONITOREXPLOSION, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - MT_KSHIELDICO, // damage - sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags - S_NULL // raisestate - }, - - // jump shield box - { // MT_WHITETV - 405, // doomednum - S_WHTV1, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_WHTV1, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_WHTV3, // deathstate - S_NULL, // xdeathstate - sfx_pop, // deathsound - MT_MONITOREXPLOSION, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - MT_WSHIELDICO, // damage - sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags - S_NULL // raisestate - }, - - { // MT_GREENTV - 406, // doomednum - S_GRTV, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_GRTV, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_GRTV2, // deathstate - S_NULL, // xdeathstate - sfx_pop, // deathsound - MT_MONITOREXPLOSION, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - MT_GSHIELDICO, // damage - sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags - S_NULL // raisestate - }, - - { // MT_PITYTV - 401, // doomednum - S_PITV1, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_PITV1, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_PITV3, // deathstate - S_NULL, // xdeathstate - sfx_pop, // deathsound - MT_MONITOREXPLOSION, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - MT_PITYSHIELDICO, // damage - sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags - S_NULL // raisestate - }, - - { // MT_EGGMANBOX - 410, // doomednum - S_EGGTV1, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_EGGTV1, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_EGGTV3, // deathstate - S_NULL, // xdeathstate - sfx_pop, // deathsound - MT_MONITOREXPLOSION, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - MT_EGGMANICO, // damage - sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags - S_NULL // raisestate - }, - - { // MT_MIXUPBOX - 411, // doomednum - S_MIXUPBOX1, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_MIXUPBOX1, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_MIXUPBOX3, // deathstate - S_NULL, // xdeathstate - sfx_pop, // deathsound - MT_MONITOREXPLOSION, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - MT_MIXUPICO, // damage - sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags - S_NULL // raisestate - }, - - { // MT_RECYCLETV - 416, // doomednum - S_RECYCLETV1, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_RECYCLETV1, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_RECYCLETV3, // deathstate - S_NULL, // xdeathstate - sfx_pop, // deathsound - MT_MONITOREXPLOSION, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - MT_RECYCLEICO, // damage - sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags - S_NULL // raisestate - }, - - { // MT_RECYCLEICO + { // MT_BOXSPARKLE -1, // doomednum - S_RECYCLETV3, // spawnstate + S_BOXSPARKLE1, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound @@ -6506,210 +6097,993 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // missilestate S_NULL, // deathstate S_NULL, // xdeathstate - sfx_None, // deathsound - 2*FRACUNIT, // speed - 8*FRACUNIT, // radius - 14*FRACUNIT, // height + sfx_pop, // deathsound + 3*FRACUNIT, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height 0, // display offset 100, // mass - 62*FRACUNIT, // damage + 0, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY|MF_NOGRAVITY|MF_BOXICON, // flags + MF_NOGRAVITY|MF_SCENERY|MF_NOBLOCKMAP|MF_NOCLIPHEIGHT, // flags S_NULL // raisestate }, - { // MT_QUESTIONBOX + { // MT_RING_BOX + 400, // doomednum + S_RING_BOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_RING_BOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BOX_POP1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 1, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_RING_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_PITY_BOX + 401, // doomednum + S_PITY_BOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_PITY_BOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BOX_POP1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 1, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_PITY_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_ATTRACT_BOX + 402, // doomednum + S_ATTRACT_BOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_ATTRACT_BOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BOX_POP1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 1, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_ATTRACT_ICON,// damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_FORCE_BOX + 403, // doomednum + S_FORCE_BOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_FORCE_BOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BOX_POP1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 1, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_FORCE_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_ARMAGEDDON_BOX + 404, // doomednum + S_ARMAGEDDON_BOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_ARMAGEDDON_BOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BOX_POP1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 1, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_ARMAGEDDON_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_WHIRLWIND_BOX + 405, // doomednum + S_WHIRLWIND_BOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_WHIRLWIND_BOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BOX_POP1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 1, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_WHIRLWIND_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_ELEMENTAL_BOX + 406, // doomednum + S_ELEMENTAL_BOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_ELEMENTAL_BOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BOX_POP1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 1, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_ELEMENTAL_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_SNEAKERS_BOX + 407, // doomednum + S_SNEAKERS_BOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_SNEAKERS_BOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BOX_POP1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 1, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_SNEAKERS_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_INVULN_BOX + 408, // doomednum + S_INVULN_BOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_INVULN_BOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BOX_POP1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 1, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_INVULN_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_1UP_BOX + 409, // doomednum + S_1UP_BOX, // spawnstate + 1, // spawnhealth + S_PLAY_BOX1, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_1UP_BOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BOX_POP1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 1, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_1UP_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_EGGMAN_BOX + 410, // doomednum + S_EGGMAN_BOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_EGGMAN_BOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BOX_POP1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_EGGMAN_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_MIXUP_BOX + 411, // doomednum + S_MIXUP_BOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_MIXUP_BOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BOX_POP1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 1, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_MIXUP_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_MYSTERY_BOX 412, // doomednum - S_RANDOMBOX1, // spawnstate + S_MYSTERY_BOX, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound - S_RANDOMBOX1, // painstate + S_MYSTERY_BOX, // painstate 0, // painchance sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_RANDOMBOX3, // deathstate + S_BOX_POP1, // deathstate S_NULL, // xdeathstate sfx_pop, // deathsound - MT_MONITOREXPLOSION, // speed + 0, // speed 16*FRACUNIT, // radius 32*FRACUNIT, // height 0, // display offset 100, // mass - 0, // damage + MT_UNKNOWN, // damage sfx_None, // activesound MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, - { // MT_GRAVITYBOX + { // MT_GRAVITY_BOX 413, // doomednum - S_GBTV1, // spawnstate + S_GRAVITY_BOX, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound - S_GBTV1, // painstate + S_GRAVITY_BOX, // painstate 0, // painchance sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_GBTV3, // deathstate + S_BOX_POP1, // deathstate S_NULL, // xdeathstate sfx_pop, // deathsound - MT_MONITOREXPLOSION, // speed + 0, // speed 16*FRACUNIT, // radius 32*FRACUNIT, // height 0, // display offset 100, // mass - MT_GRAVITYICO, // damage - sfx_cgot, // activesound + MT_GRAVITY_ICON, // damage + sfx_None, // activesound MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, - { // MT_SCORETVSMALL + { // MT_RECYCLER_BOX + 416, // doomednum + S_RECYCLER_BOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_RECYCLER_BOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BOX_POP1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 1, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_RECYCLER_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_SCORE1K_BOX 418, // doomednum - S_SCORETVA1, // spawnstate + S_SCORE1K_BOX, // spawnstate 1, // spawnhealth S_NULL, // seestate - sfx_token, // seesound + sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound - S_SCORETVA1, // painstate + S_SCORE1K_BOX, // painstate 0, // painchance sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SCORETVA3, // deathstate + S_BOX_POP1, // deathstate S_NULL, // xdeathstate sfx_pop, // deathsound - MT_MONITOREXPLOSION, // speed + 0, // speed 16*FRACUNIT, // radius 32*FRACUNIT, // height 0, // display offset 100, // mass - MT_SCOREICOSMALL, // damage + MT_SCORE1K_ICON, // damage sfx_None, // activesound MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, - { // MT_SCORETVLARGE + { // MT_SCORE10K_BOX 419, // doomednum - S_SCORETVB1, // spawnstate + S_SCORE10K_BOX, // spawnstate 1, // spawnhealth S_NULL, // seestate - sfx_token, // seesound + sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound - S_SCORETVB1, // painstate + S_SCORE10K_BOX, // painstate 0, // painchance sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SCORETVB3, // deathstate + S_BOX_POP1, // deathstate S_NULL, // xdeathstate sfx_pop, // deathsound - MT_MONITOREXPLOSION, // speed + 0, // speed 16*FRACUNIT, // radius 32*FRACUNIT, // height 0, // display offset 100, // mass - MT_SCOREICOLARGE, // damage + MT_SCORE10K_ICON, // damage sfx_None, // activesound MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, - { // MT_MONITOREXPLOSION - -1, // doomednum - S_MONITOREXPLOSION1, // spawnstate - 0, // spawnhealth + { // MT_RING_BIGBOX + 430, // doomednum + S_RING_BIGBOX, // spawnstate + 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound 8, // reactiontime - sfx_None, // attacksound - S_XPLD1, // painstate + sfx_monton, // attacksound + S_RING_BIGBOX, // painstate 0, // painchance sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_NULL, // deathstate + S_BIGBOX_OFF1, // deathstate S_NULL, // xdeathstate - sfx_None, // deathsound + sfx_pop, // deathsound 0, // speed - 8*FRACUNIT, // radius - 8*FRACUNIT, // height + 16*FRACUNIT, // radius + 32*FRACUNIT, // height 0, // display offset - MT_EXPLODE, // mass - 0, // damage + 100, // mass + MT_RING_ICON, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY|MF_NOGRAVITY, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, - { // MT_REDMONITOREXPLOSION - -1, // doomednum - S_REDMONITOREXPLOSION1, // spawnstate - 0, // spawnhealth + { // MT_PITY_BIGBOX + 431, // doomednum + S_PITY_BIGBOX, // spawnstate + 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound 8, // reactiontime - sfx_None, // attacksound - S_XPLD1, // painstate + sfx_monton, // attacksound + S_PITY_BIGBOX, // painstate 0, // painchance sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_NULL, // deathstate + S_BIGBOX_OFF1, // deathstate S_NULL, // xdeathstate - sfx_None, // deathsound + sfx_pop, // deathsound 0, // speed - 8*FRACUNIT, // radius - 8*FRACUNIT, // height + 16*FRACUNIT, // radius + 32*FRACUNIT, // height 0, // display offset - MT_EXPLODE, // mass - 0, // damage + 100, // mass + MT_PITY_ICON, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY|MF_NOGRAVITY, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, - { // MT_BLUEMONITOREXPLOSION - -1, // doomednum - S_BLUEMONITOREXPLOSION1, // spawnstate - 0, // spawnhealth + { // MT_ATTRACT_BIGBOX + 432, // doomednum + S_ATTRACT_BIGBOX, // spawnstate + 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound 8, // reactiontime - sfx_None, // attacksound - S_XPLD1, // painstate + sfx_monton, // attacksound + S_ATTRACT_BIGBOX, // painstate 0, // painchance sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_NULL, // deathstate + S_BIGBOX_OFF1, // deathstate S_NULL, // xdeathstate - sfx_None, // deathsound + sfx_pop, // deathsound 0, // speed - 8*FRACUNIT, // radius - 8*FRACUNIT, // height + 16*FRACUNIT, // radius + 32*FRACUNIT, // height 0, // display offset - MT_EXPLODE, // mass - 0, // damage + 100, // mass + MT_ATTRACT_ICON,// damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY|MF_NOGRAVITY, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags S_NULL // raisestate }, - { // MT_RINGICO + { // MT_FORCE_BIGBOX + 433, // doomednum + S_FORCE_BIGBOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_monton, // attacksound + S_FORCE_BIGBOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BIGBOX_OFF1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_FORCE_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_ARMAGEDDON_BIGBOX + 434, // doomednum + S_ARMAGEDDON_BIGBOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_monton, // attacksound + S_ARMAGEDDON_BIGBOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BIGBOX_OFF1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_ARMAGEDDON_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_WHIRLWIND_BIGBOX + 435, // doomednum + S_WHIRLWIND_BIGBOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_monton, // attacksound + S_WHIRLWIND_BIGBOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BIGBOX_OFF1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_WHIRLWIND_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_ELEMENTAL_BIGBOX + 436, // doomednum + S_ELEMENTAL_BIGBOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_monton, // attacksound + S_ELEMENTAL_BIGBOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BIGBOX_OFF1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_ELEMENTAL_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_SNEAKERS_BIGBOX + 437, // doomednum + S_SNEAKERS_BIGBOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_monton, // attacksound + S_SNEAKERS_BIGBOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BIGBOX_OFF1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_SNEAKERS_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_INVULN_BIGBOX + 438, // doomednum + S_INVULN_BIGBOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_monton, // attacksound + S_INVULN_BIGBOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BIGBOX_OFF1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_INVULN_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_1UP_BIGBOX + 439, // doomednum + S_1UP_BIGBOX, // spawnstate + 1, // spawnhealth + S_PLAY_BOX1, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_monton, // attacksound + S_1UP_BIGBOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BIGBOX_OFF1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_1UP_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_EGGMAN_BIGBOX + 440, // doomednum + S_EGGMAN_BIGBOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_monton, // attacksound + S_EGGMAN_BIGBOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BIGBOX_OFF1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_EGGMAN_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_MIXUP_BIGBOX + 441, // doomednum + S_MIXUP_BIGBOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_monton, // attacksound + S_MIXUP_BIGBOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BIGBOX_OFF1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_MIXUP_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_MYSTERY_BIGBOX + 442, // doomednum + S_MYSTERY_BIGBOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_monton, // attacksound + S_MYSTERY_BIGBOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BIGBOX_OFF1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_UNKNOWN, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_GRAVITY_BIGBOX + 443, // doomednum + S_GRAVITY_BIGBOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_monton, // attacksound + S_GRAVITY_BIGBOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BIGBOX_OFF1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_GRAVITY_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_RECYCLER_BIGBOX + 446, // doomednum + S_RECYCLER_BIGBOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_monton, // attacksound + S_RECYCLER_BIGBOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BIGBOX_OFF1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_RECYCLER_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_SCORE1K_BIGBOX + 448, // doomednum + S_SCORE1K_BIGBOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_monton, // attacksound + S_SCORE1K_BIGBOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BIGBOX_OFF1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_SCORE1K_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_SCORE10K_BIGBOX + 449, // doomednum + S_SCORE10K_BIGBOX, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_monton, // attacksound + S_SCORE10K_BIGBOX, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BIGBOX_OFF1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_SCORE10K_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_RING_REDBOX + 414, // doomednum + S_RING_REDBOX1, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_RING_REDBOX1, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_REDBOX_POP1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_RING_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_RING_BLUEBOX + 415, // doomednum + S_RING_BLUEBOX1, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_RING_BLUEBOX1, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_BLUEBOX_POP1, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + MT_RING_ICON, // damage + sfx_None, // activesound + MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + S_NULL // raisestate + }, + + { // MT_RING_ICON -1, // doomednum - S_SUPERRINGBOX2, // spawnstate + S_RING_ICON1, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_itemup, // seesound @@ -6734,9 +7108,171 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_SHOESICO + { // MT_PITY_ICON -1, // doomednum - S_SHTV2, // spawnstate + S_PITY_ICON1, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_shield, // 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 + 2*FRACUNIT, // speed + 8*FRACUNIT, // radius + 14*FRACUNIT, // height + 0, // display offset + 100, // mass + 62*FRACUNIT, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY|MF_NOGRAVITY|MF_BOXICON, // flags + S_NULL // raisestate + }, + + { // MT_ATTRACT_ICON + -1, // doomednum + S_ATTRACT_ICON1, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_shield, // 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 + 2*FRACUNIT, // speed + 8*FRACUNIT, // radius + 14*FRACUNIT, // height + 0, // display offset + 100, // mass + 62*FRACUNIT, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY|MF_NOGRAVITY|MF_BOXICON, // flags + S_NULL // raisestate + }, + + { // MT_FORCE_ICON + -1, // doomednum + S_FORCE_ICON1, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_shield, // 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 + 2*FRACUNIT, // speed + 8*FRACUNIT, // radius + 14*FRACUNIT, // height + 0, // display offset + 100, // mass + 62*FRACUNIT, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY|MF_NOGRAVITY|MF_BOXICON, // flags + S_NULL // raisestate + }, + + { // MT_ARMAGEDDON_ICON + -1, // doomednum + S_ARMAGEDDON_ICON1, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_shield, // 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 + 2*FRACUNIT, // speed + 8*FRACUNIT, // radius + 14*FRACUNIT, // height + 0, // display offset + 100, // mass + 62*FRACUNIT, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY|MF_NOGRAVITY|MF_BOXICON, // flags + S_NULL // raisestate + }, + + { // MT_WHIRLWIND_ICON + -1, // doomednum + S_WHIRLWIND_ICON1, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_shield, // 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 + 2*FRACUNIT, // speed + 8*FRACUNIT, // radius + 14*FRACUNIT, // height + 0, // display offset + 100, // mass + 62*FRACUNIT, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY|MF_NOGRAVITY|MF_BOXICON, // flags + S_NULL // raisestate + }, + + { // MT_ELEMENTAL_ICON + -1, // doomednum + S_ELEMENTAL_ICON1, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_shield, // 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 + 2*FRACUNIT, // speed + 8*FRACUNIT, // radius + 14*FRACUNIT, // height + 0, // display offset + 100, // mass + 62*FRACUNIT, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY|MF_NOGRAVITY|MF_BOXICON, // flags + S_NULL // raisestate + }, + + { // MT_SNEAKERS_ICON + -1, // doomednum + S_SNEAKERS_ICON1, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound @@ -6761,9 +7297,9 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_INVCICO + { // MT_INVULN_ICON -1, // doomednum - S_PINV2, // spawnstate + S_INVULN_ICON1, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound @@ -6788,9 +7324,9 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_1UPICO + { // MT_1UP_ICON -1, // doomednum - S_PRUP2, // spawnstate + S_1UP_ICON1, // spawnstate 1, // spawnhealth S_PLAY_ICON1, // seestate sfx_None, // seesound @@ -6815,172 +7351,9 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_YSHIELDICO + { // MT_EGGMAN_ICON -1, // doomednum - S_YLTV2, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_shield, // 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 - 2*FRACUNIT, // speed - 8*FRACUNIT, // radius - 14*FRACUNIT, // height - 0, // display offset - 100, // mass - 62*FRACUNIT, // damage - sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY|MF_NOGRAVITY|MF_BOXICON, // flags - S_NULL // raisestate - }, - - { // MT_BSHIELDICO - -1, // doomednum - S_BLTV3, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_shield, // 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 - 2*FRACUNIT, // speed - 8*FRACUNIT, // radius - 14*FRACUNIT, // height - 0, // display offset - 100, // mass - 62*FRACUNIT, // damage - sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY|MF_NOGRAVITY|MF_BOXICON, // flags - S_NULL // raisestate - }, - - { // MT_KSHIELDICO - -1, // doomednum - S_BKTV3, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_shield, // 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 - 2*FRACUNIT, // speed - 8*FRACUNIT, // radius - 14*FRACUNIT, // height - 0, // display offset - 100, // mass - 62*FRACUNIT, // damage - sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY|MF_NOGRAVITY|MF_BOXICON, // flags - S_NULL // raisestate - }, - - { // MT_WSHIELDICO - -1, // doomednum - S_WHTV3, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_shield, // 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 - 2*FRACUNIT, // speed - 8*FRACUNIT, // radius - 14*FRACUNIT, // height - 0, // display offset - 100, // mass - 62*FRACUNIT, // damage - sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY|MF_NOGRAVITY|MF_BOXICON, // flags - S_NULL // raisestate - }, - - { // MT_GSHIELDICO - -1, // doomednum - S_GRTV2, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_shield, // 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 - 2*FRACUNIT, // speed - 8*FRACUNIT, // radius - 14*FRACUNIT, // height - 0, // display offset - 100, // mass - 62*FRACUNIT, // damage - sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY|MF_NOGRAVITY|MF_BOXICON, // flags - S_NULL // raisestate - }, - - - { // MT_PITYSHIELDICO - -1, // doomednum - S_PITV3, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_shield, // 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 - 2*FRACUNIT, // speed - 8*FRACUNIT, // radius - 14*FRACUNIT, // height - 0, // display offset - 100, // mass - 62*FRACUNIT, // damage - sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY|MF_NOGRAVITY|MF_BOXICON, // flags - S_NULL // raisestate - }, - - { // MT_EGGMANICO - -1, // doomednum - S_EGGTV3, // spawnstate + S_EGGMAN_ICON1, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound @@ -7005,9 +7378,9 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_MIXUPICO + { // MT_MIXUP_ICON -1, // doomednum - S_MIXUPBOX3, // spawnstate + S_MIXUP_ICON1, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound @@ -7032,9 +7405,9 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_GRAVITYICO + { // MT_GRAVITY_ICON -1, // doomednum - S_GBTV3, // spawnstate + S_GRAVITY_ICON1, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound @@ -7059,9 +7432,36 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_SCOREICOSMALL + { // MT_RECYCLER_ICON -1, // doomednum - S_SCORETVA3, // spawnstate + S_RECYCLER_ICON1, // spawnstate + 1, // 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 + 2*FRACUNIT, // speed + 8*FRACUNIT, // radius + 14*FRACUNIT, // height + 0, // display offset + 100, // mass + 62*FRACUNIT, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY|MF_NOGRAVITY|MF_BOXICON, // flags + S_NULL // raisestate + }, + + { // MT_SCORE1K_ICON + -1, // doomednum + S_SCORE1K_ICON1, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_token, // seesound @@ -7086,9 +7486,9 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_SCOREICOLARGE + { // MT_SCORE10K_ICON -1, // doomednum - S_SCORETVB3, // spawnstate + S_SCORE10K_ICON1, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_token, // seesound diff --git a/src/info.h b/src/info.h index e313526b9..d031addf5 100644 --- a/src/info.h +++ b/src/info.h @@ -28,6 +28,9 @@ void A_Explode(); void A_Pain(); void A_Fall(); void A_MonitorPop(); +void A_BigMonitorPop(); +void A_BigMonitorRestore(); +void A_BigMonitorSparkle(); void A_Look(); void A_Chase(); void A_FaceStabChase(); @@ -324,27 +327,30 @@ typedef enum sprite SPR_BMNE, // Big floating mine // Monitor Boxes - SPR_SRBX, - SPR_RRBX, - SPR_BRBX, - SPR_SHTV, - SPR_PINV, - SPR_YLTV, - SPR_BLTV, // Force shield - SPR_BKTV, // Bomb shield TV - SPR_WHTV, // Jump shield TV - SPR_GRTV, // Pity shield TV - SPR_ELTV, // Elemental shield TV - SPR_EGGB, // Eggman box - SPR_MIXU, // Player mixing monitor - SPR_RECY, // Recycler (power mixing) monitor - SPR_QUES, // Random monitor - SPR_GBTV, // Gravity boots TV - SPR_PRUP, // 1up - SPR_PTTV, // Score TVs + SPR_MSTV, // MiSc TV sprites + SPR_XLTV, // eXtra Large TV sprites - // Monitor Miscellany - SPR_MTEX, // Exploding monitor + SPR_TRRI, // Red team: 10 RIngs + SPR_TBRI, // Blue team: 10 RIngs + + SPR_TVRI, // 10 RIng + SPR_TVPI, // PIty shield + SPR_TVAT, // ATtraction shield + SPR_TVFO, // FOrce shield + SPR_TVAR, // ARmageddon shield + SPR_TVWW, // WhirlWind shield + SPR_TVEL, // ELemental shield + SPR_TVSS, // Super Sneakers + SPR_TVIV, // InVincibility + SPR_TV1U, // 1Up + SPR_TV1P, // 1uP (textless) + SPR_TVEG, // EGgman + SPR_TVMX, // MiXup + SPR_TVMY, // MYstery + SPR_TVGV, // GraVity boots + SPR_TVRC, // ReCycler + SPR_TV1K, // 1,000 points (1 K) + SPR_TVTK, // 10,000 points (Ten K) // Projectiles SPR_MISL, @@ -1750,170 +1756,171 @@ typedef enum state S_CANNONLAUNCHER2, S_CANNONLAUNCHER3, - // Super Ring Box - S_SUPERRINGBOX, - S_SUPERRINGBOX1, - S_SUPERRINGBOX2, - S_SUPERRINGBOX3, - S_SUPERRINGBOX4, - S_SUPERRINGBOX5, - S_SUPERRINGBOX6, + // Monitor Miscellany + S_BOXSPARKLE1, + S_BOXSPARKLE2, + S_BOXSPARKLE3, - // Red Team Ring Box - S_REDRINGBOX, - S_REDRINGBOX1, + S_BOX_FLICKER, + S_BOX_POP1, + S_BOX_POP2, - // Blue Team Ring Box - S_BLUERINGBOX, - S_BLUERINGBOX1, + S_BIGBOX_FLICKER, + S_BIGBOX_OFF1, + S_BIGBOX_OFF2, + S_BIGBOX_OFF3, + S_BIGBOX_OFF4, + S_BIGBOX_OFF5, + S_BIGBOX_OFF6, + S_BIGBOX_OFF7, - // Super Sneakers Box - S_SHTV, - S_SHTV1, - S_SHTV2, - S_SHTV3, - S_SHTV4, - S_SHTV5, - S_SHTV6, + // Monitor States (one per box) + S_MYSTERY_BOX, + S_RING_BOX, + S_PITY_BOX, + S_ATTRACT_BOX, + S_FORCE_BOX, + S_ARMAGEDDON_BOX, + S_WHIRLWIND_BOX, + S_ELEMENTAL_BOX, + S_SNEAKERS_BOX, + S_INVULN_BOX, + S_1UP_BOX, + S_EGGMAN_BOX, + S_MIXUP_BOX, + S_GRAVITY_BOX, + S_RECYCLER_BOX, + S_SCORE1K_BOX, + S_SCORE10K_BOX, - // Invincibility Box - S_PINV, - S_PINV1, - S_PINV2, - S_PINV3, - S_PINV4, - S_PINV5, - S_PINV6, + // Repeat Monitor States (one per box) + S_MYSTERY_BIGBOX, + S_RING_BIGBOX, + S_PITY_BIGBOX, + S_ATTRACT_BIGBOX, + S_FORCE_BIGBOX, + S_ARMAGEDDON_BIGBOX, + S_WHIRLWIND_BIGBOX, + S_ELEMENTAL_BIGBOX, + S_SNEAKERS_BIGBOX, + S_INVULN_BIGBOX, + S_1UP_BIGBOX, + S_EGGMAN_BIGBOX, + S_MIXUP_BIGBOX, + S_GRAVITY_BIGBOX, + S_RECYCLER_BIGBOX, + S_SCORE1K_BIGBOX, + S_SCORE10K_BIGBOX, - // 1up Box - S_PRUP, - S_PRUP1, - S_PRUP2, - S_PRUP3, - S_PRUP4, - S_PRUP5, - S_PRUP6, + // Team Ring Boxes (these are special) + S_RING_REDBOX1, + S_RING_REDBOX2, + S_REDBOX_POP1, + S_REDBOX_POP2, - // Ring Shield Box - S_YLTV, - S_YLTV1, - S_YLTV2, - S_YLTV3, - S_YLTV4, - S_YLTV5, - S_YLTV6, + S_RING_BLUEBOX1, + S_RING_BLUEBOX2, + S_BLUEBOX_POP1, + S_BLUEBOX_POP2, - // Force Shield Box - S_BLTV1, - S_BLTV2, - S_BLTV3, - S_BLTV4, - S_BLTV5, - S_BLTV6, - S_BLTV7, + // Box Icons -- 5 states each, one for each part of the twirl + S_RING_ICON1, + S_RING_ICON2, + S_RING_ICON3, + S_RING_ICON4, + S_RING_ICON5, - // Bomb Shield Box - S_BKTV1, - S_BKTV2, - S_BKTV3, - S_BKTV4, - S_BKTV5, - S_BKTV6, - S_BKTV7, + S_PITY_ICON1, + S_PITY_ICON2, + S_PITY_ICON3, + S_PITY_ICON4, + S_PITY_ICON5, - // Jump Shield Box - S_WHTV1, - S_WHTV2, - S_WHTV3, - S_WHTV4, - S_WHTV5, - S_WHTV6, - S_WHTV7, + S_ATTRACT_ICON1, + S_ATTRACT_ICON2, + S_ATTRACT_ICON3, + S_ATTRACT_ICON4, + S_ATTRACT_ICON5, - // Water Shield Box - S_GRTV, - S_GRTV1, - S_GRTV2, - S_GRTV3, - S_GRTV4, - S_GRTV5, - S_GRTV6, + S_FORCE_ICON1, + S_FORCE_ICON2, + S_FORCE_ICON3, + S_FORCE_ICON4, + S_FORCE_ICON5, - // Pity Shield Box - S_PITV1, - S_PITV2, - S_PITV3, - S_PITV4, - S_PITV5, - S_PITV6, - S_PITV7, + S_ARMAGEDDON_ICON1, + S_ARMAGEDDON_ICON2, + S_ARMAGEDDON_ICON3, + S_ARMAGEDDON_ICON4, + S_ARMAGEDDON_ICON5, - // Eggman Box - S_EGGTV1, - S_EGGTV2, - S_EGGTV3, - S_EGGTV4, - S_EGGTV5, - S_EGGTV6, - S_EGGTV7, + S_WHIRLWIND_ICON1, + S_WHIRLWIND_ICON2, + S_WHIRLWIND_ICON3, + S_WHIRLWIND_ICON4, + S_WHIRLWIND_ICON5, - // Teleport Box - S_MIXUPBOX1, - S_MIXUPBOX2, - S_MIXUPBOX3, - S_MIXUPBOX4, - S_MIXUPBOX5, - S_MIXUPBOX6, - S_MIXUPBOX7, + S_ELEMENTAL_ICON1, + S_ELEMENTAL_ICON2, + S_ELEMENTAL_ICON3, + S_ELEMENTAL_ICON4, + S_ELEMENTAL_ICON5, - // Recycler Box - S_RECYCLETV1, - S_RECYCLETV2, - S_RECYCLETV3, - S_RECYCLETV4, - S_RECYCLETV5, - S_RECYCLETV6, - S_RECYCLETV7, + S_SNEAKERS_ICON1, + S_SNEAKERS_ICON2, + S_SNEAKERS_ICON3, + S_SNEAKERS_ICON4, + S_SNEAKERS_ICON5, - // Question Box - S_RANDOMBOX1, - S_RANDOMBOX2, - S_RANDOMBOX3, + S_INVULN_ICON1, + S_INVULN_ICON2, + S_INVULN_ICON3, + S_INVULN_ICON4, + S_INVULN_ICON5, - // Gravity Boots Box - S_GBTV1, - S_GBTV2, - S_GBTV3, - S_GBTV4, - S_GBTV5, - S_GBTV6, - S_GBTV7, + S_1UP_ICON1, + S_1UP_ICON2, + S_1UP_ICON3, + S_1UP_ICON4, + S_1UP_ICON5, - // Score boxes - S_SCORETVA1, - S_SCORETVA2, - S_SCORETVA3, - S_SCORETVA4, - S_SCORETVA5, - S_SCORETVA6, - S_SCORETVA7, - S_SCORETVB1, - S_SCORETVB2, - S_SCORETVB3, - S_SCORETVB4, - S_SCORETVB5, - S_SCORETVB6, - S_SCORETVB7, + S_EGGMAN_ICON1, + S_EGGMAN_ICON2, + S_EGGMAN_ICON3, + S_EGGMAN_ICON4, + S_EGGMAN_ICON5, - // Monitor Explosion - S_MONITOREXPLOSION1, - S_MONITOREXPLOSION2, + S_MIXUP_ICON1, + S_MIXUP_ICON2, + S_MIXUP_ICON3, + S_MIXUP_ICON4, + S_MIXUP_ICON5, - S_REDMONITOREXPLOSION1, - S_REDMONITOREXPLOSION2, + S_GRAVITY_ICON1, + S_GRAVITY_ICON2, + S_GRAVITY_ICON3, + S_GRAVITY_ICON4, + S_GRAVITY_ICON5, - S_BLUEMONITOREXPLOSION1, - S_BLUEMONITOREXPLOSION2, + S_RECYCLER_ICON1, + S_RECYCLER_ICON2, + S_RECYCLER_ICON3, + S_RECYCLER_ICON4, + S_RECYCLER_ICON5, + + S_SCORE1K_ICON1, + S_SCORE1K_ICON2, + S_SCORE1K_ICON3, + S_SCORE1K_ICON4, + S_SCORE1K_ICON5, + + S_SCORE10K_ICON1, + S_SCORE10K_ICON2, + S_SCORE10K_ICON3, + S_SCORE10K_ICON4, + S_SCORE10K_ICON5, + + // --- S_ROCKET, @@ -3673,47 +3680,68 @@ typedef enum mobj_type MT_BIGAIRMINE, MT_CANNONLAUNCHER, - // Monitor Boxes - MT_SUPERRINGBOX, - MT_REDRINGBOX, - MT_BLUERINGBOX, - MT_SNEAKERTV, - MT_INV, - MT_PRUP, // 1up Box - MT_YELLOWTV, - MT_BLUETV, - MT_BLACKTV, // Bomb shield TV - MT_WHITETV, // Jump shield TV - MT_GREENTV, - MT_PITYTV, // Pity Shield TV - MT_EGGMANBOX, - MT_MIXUPBOX, - MT_RECYCLETV, - MT_RECYCLEICO, - MT_QUESTIONBOX, - MT_GRAVITYBOX, - MT_SCORETVSMALL, - MT_SCORETVLARGE, - // Monitor miscellany - MT_MONITOREXPLOSION, - MT_REDMONITOREXPLOSION, - MT_BLUEMONITOREXPLOSION, - MT_RINGICO, - MT_SHOESICO, - MT_INVCICO, - MT_1UPICO, - MT_YSHIELDICO, - MT_BSHIELDICO, - MT_KSHIELDICO, - MT_WSHIELDICO, - MT_GSHIELDICO, - MT_PITYSHIELDICO, - MT_EGGMANICO, - MT_MIXUPICO, - MT_GRAVITYICO, - MT_SCOREICOSMALL, - MT_SCOREICOLARGE, + MT_BOXSPARKLE, + + // Monitor boxes -- regular + MT_RING_BOX, + MT_PITY_BOX, + MT_ATTRACT_BOX, + MT_FORCE_BOX, + MT_ARMAGEDDON_BOX, + MT_WHIRLWIND_BOX, + MT_ELEMENTAL_BOX, + MT_SNEAKERS_BOX, + MT_INVULN_BOX, + MT_1UP_BOX, + MT_EGGMAN_BOX, + MT_MIXUP_BOX, + MT_MYSTERY_BOX, + MT_GRAVITY_BOX, + MT_RECYCLER_BOX, + MT_SCORE1K_BOX, + MT_SCORE10K_BOX, + + // Monitor boxes -- repeating (big) boxes + MT_RING_BIGBOX, + MT_PITY_BIGBOX, + MT_ATTRACT_BIGBOX, + MT_FORCE_BIGBOX, + MT_ARMAGEDDON_BIGBOX, + MT_WHIRLWIND_BIGBOX, + MT_ELEMENTAL_BIGBOX, + MT_SNEAKERS_BIGBOX, + MT_INVULN_BIGBOX, + MT_1UP_BIGBOX, + MT_EGGMAN_BIGBOX, + MT_MIXUP_BIGBOX, + MT_MYSTERY_BIGBOX, + MT_GRAVITY_BIGBOX, + MT_RECYCLER_BIGBOX, + MT_SCORE1K_BIGBOX, + MT_SCORE10K_BIGBOX, + + // Monitor boxes -- special + MT_RING_REDBOX, + MT_RING_BLUEBOX, + + // Monitor icons + MT_RING_ICON, + MT_PITY_ICON, + MT_ATTRACT_ICON, + MT_FORCE_ICON, + MT_ARMAGEDDON_ICON, + MT_WHIRLWIND_ICON, + MT_ELEMENTAL_ICON, + MT_SNEAKERS_ICON, + MT_INVULN_ICON, + MT_1UP_ICON, + MT_EGGMAN_ICON, + MT_MIXUP_ICON, + MT_GRAVITY_ICON, + MT_RECYCLER_ICON, + MT_SCORE1K_ICON, + MT_SCORE10K_ICON, // Projectiles MT_ROCKET, diff --git a/src/p_enemy.c b/src/p_enemy.c index d5da92e38..d050972db 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -818,6 +818,32 @@ static int P_RecycleCompare(const void *p1, const void *p2) } #endif +// Handles random monitor weights via console. +static mobjtype_t P_DoRandomBoxChances(void) +{ + mobjtype_t spawnchance[256]; + INT32 numchoices = 0, i = 0; + +#define QUESTIONBOXCHANCES(type, cvar) \ +for (i = cvar.value; i; --i) spawnchance[numchoices++] = type + QUESTIONBOXCHANCES(MT_RING_ICON, cv_superring); + QUESTIONBOXCHANCES(MT_SNEAKERS_ICON, cv_supersneakers); + QUESTIONBOXCHANCES(MT_INVULN_ICON, cv_invincibility); + QUESTIONBOXCHANCES(MT_WHIRLWIND_ICON, cv_jumpshield); + QUESTIONBOXCHANCES(MT_ELEMENTAL_ICON, cv_watershield); + QUESTIONBOXCHANCES(MT_ATTRACT_ICON, cv_ringshield); + QUESTIONBOXCHANCES(MT_FORCE_ICON, cv_forceshield); + QUESTIONBOXCHANCES(MT_ARMAGEDDON_ICON, cv_bombshield); + QUESTIONBOXCHANCES(MT_1UP_ICON, cv_1up); + QUESTIONBOXCHANCES(MT_EGGMAN_ICON, cv_eggmanbox); + QUESTIONBOXCHANCES(MT_MIXUP_ICON, cv_teleporters); + QUESTIONBOXCHANCES(MT_RECYCLER_ICON, cv_recycler); +#undef QUESTIONBOXCHANCES + + if (numchoices == 0) return MT_NULL; + return spawnchance[P_RandomKey(numchoices)]; +} + // // ACTION ROUTINES // @@ -2515,7 +2541,7 @@ void A_1upThinker(mobj_t *actor) if (closestplayer == -1 || skins[players[closestplayer].skin].sprites[SPR2_LIFE].numframes == 0) { // Closest player not found (no players in game?? may be empty dedicated server!), or does not have correct sprite. - actor->frame = 0; + actor->sprite = SPR_TV1U; if (actor->tracer) { P_RemoveMobj(actor->tracer); actor->tracer = NULL; @@ -2543,139 +2569,194 @@ void A_1upThinker(mobj_t *actor) // void A_MonitorPop(mobj_t *actor) { - mobj_t *remains; - mobjtype_t explode; mobjtype_t item = 0; - mobjtype_t newbox; + mobj_t *newmobj; #ifdef HAVE_BLUA if (LUA_CallAction("A_MonitorPop", actor)) return; #endif - // de-solidify + // Spawn the "pop" explosion. + if (actor->info->deathsound) + S_StartSound(actor, actor->info->deathsound); + P_SpawnMobjFromMobj(actor, 0, 0, actor->height/4, MT_EXPLODE); + + // We're dead now. De-solidify. actor->health = 0; P_UnsetThingPosition(actor); actor->flags &= ~MF_SOLID; actor->flags |= MF_NOCLIP; P_SetThingPosition(actor); - // Monitor explosion - explode = mobjinfo[actor->info->speed].mass; - remains = P_SpawnMobj(actor->x, actor->y, - ((actor->eflags & MFE_VERTICALFLIP) ? (actor->z + 3*(actor->height/4) - FixedMul(mobjinfo[explode].height, actor->scale)) : (actor->z + actor->height/4)), explode); - if (actor->eflags & MFE_VERTICALFLIP) + if (actor->info->damage == MT_UNKNOWN) { - remains->eflags |= MFE_VERTICALFLIP; - remains->flags2 |= MF2_OBJECTFLIP; - } - remains->destscale = actor->destscale; - P_SetScale(remains, actor->scale); + // MT_UNKNOWN is random. Because it's unknown to us... get it? + item = P_DoRandomBoxChances(); - remains = P_SpawnMobj(actor->x, actor->y, - ((actor->eflags & MFE_VERTICALFLIP) ? (actor->z + actor->height - FixedMul(mobjinfo[actor->info->speed].height, actor->scale)) : actor->z), - actor->info->speed); - remains->type = actor->type; // Transfer type information - P_UnsetThingPosition(remains); - if (sector_list) - { - P_DelSeclist(sector_list); - sector_list = NULL; - } - P_SetThingPosition(remains); - remains->destscale = actor->destscale; - P_SetScale(remains, actor->scale); - remains->flags = actor->flags; // Transfer flags - remains->flags2 = actor->flags2; // Transfer flags2 - remains->fuse = actor->fuse; // Transfer respawn timer - remains->threshold = 68; - remains->skin = NULL; - - P_SetTarget(&tmthing, remains); - - if (actor->info->deathsound) - S_StartSound(remains, actor->info->deathsound); - - switch (actor->type) - { - case MT_QUESTIONBOX: // Random! + if (item == MT_NULL) { - mobjtype_t spawnchance[256]; - INT32 numchoices = 0, i = 0; - -#define QUESTIONBOXCHANCES(type, cvar) \ -for (i = cvar.value; i; --i) spawnchance[numchoices++] = type - - QUESTIONBOXCHANCES(MT_SUPERRINGBOX, cv_superring); - QUESTIONBOXCHANCES(MT_SNEAKERTV, cv_supersneakers); - QUESTIONBOXCHANCES(MT_INV, cv_invincibility); - QUESTIONBOXCHANCES(MT_WHITETV, cv_jumpshield); - QUESTIONBOXCHANCES(MT_GREENTV, cv_watershield); - QUESTIONBOXCHANCES(MT_YELLOWTV, cv_ringshield); - QUESTIONBOXCHANCES(MT_BLUETV, cv_forceshield); - QUESTIONBOXCHANCES(MT_BLACKTV, cv_bombshield); - QUESTIONBOXCHANCES(MT_PRUP, cv_1up); - QUESTIONBOXCHANCES(MT_EGGMANBOX, cv_eggmanbox); - QUESTIONBOXCHANCES(MT_MIXUPBOX, cv_teleporters); - QUESTIONBOXCHANCES(MT_RECYCLETV, cv_recycler); - -#undef QUESTIONBOXCHANCES - - if (numchoices == 0) - { - CONS_Alert(CONS_WARNING, M_GetText("All monitors turned off.\n")); - return; - } - - newbox = spawnchance[P_RandomKey(numchoices)]; - item = mobjinfo[newbox].damage; - - remains->flags &= ~MF_AMBUSH; - break; - } - default: - item = actor->info->damage; - break; - } - - if (item != 0) - { - mobj_t *newmobj; - - if (actor->eflags & MFE_VERTICALFLIP) - { - newmobj = P_SpawnMobj(actor->x, actor->y, actor->z + actor->height - FixedMul(13*FRACUNIT + mobjinfo[item].height, actor->scale), item); - newmobj->eflags |= MFE_VERTICALFLIP; - } - else - newmobj = P_SpawnMobj(actor->x, actor->y, actor->z + FixedMul(13*FRACUNIT, actor->scale), item); - - newmobj->destscale = actor->destscale; - P_SetScale(newmobj, actor->scale); - P_SetTarget(&newmobj->target, actor->target); // Transfer target - if (item == MT_1UPICO && newmobj->target->player) - { - if (actor->tracer) // Remove the old lives icon. - P_RemoveMobj(actor->tracer); - - if (!newmobj->target->skin || ((skin_t *)newmobj->target->skin)->sprites[SPR2_LIFE].numframes == 0) - newmobj->frame -= 2; // No lives icon for this player, use the default. - else - { // Spawn the lives icon. - remains = P_SpawnMobj(newmobj->x, newmobj->y, newmobj->z, MT_OVERLAY); - P_SetTarget(&remains->target, newmobj); - P_SetTarget(&newmobj->tracer, remains); - - remains->color = newmobj->target->player->mo->color; - remains->skin = &skins[newmobj->target->player->skin]; - P_SetMobjState(remains, newmobj->info->seestate); - } + CONS_Alert(CONS_WARNING, M_GetText("All monitors turned off.\n")); + return; } } else - CONS_Debug(DBG_GAMELOGIC, "Powerup item not defined in 'damage' field for A_MonitorPop\n"); + item = actor->info->damage; - P_RemoveMobj(actor); + if (item == 0) + { + CONS_Debug(DBG_GAMELOGIC, "Powerup item not defined in 'damage' field for A_MonitorPop\n"); + return; + } + + newmobj = P_SpawnMobjFromMobj(actor, 0, 0, 13*FRACUNIT, item); + P_SetTarget(&newmobj->target, actor->target); // Transfer target + + if (item == MT_1UP_ICON) + { + if (actor->tracer) // Remove the old lives icon. + P_RemoveMobj(actor->tracer); + + if (!newmobj->target + || !newmobj->target->player + || !newmobj->target->skin + || ((skin_t *)newmobj->target->skin)->sprites[SPR2_LIFE].numframes == 0) + newmobj->sprite = SPR_TV1U; // No lives icon for this player, use the default. + else + { // Spawn the lives icon. + mobj_t *livesico = P_SpawnMobjFromMobj(newmobj, 0, 0, 0, MT_OVERLAY); + P_SetTarget(&livesico->target, newmobj); + P_SetTarget(&newmobj->tracer, livesico); + + livesico->color = newmobj->target->player->mo->color; + livesico->skin = &skins[newmobj->target->player->skin]; + P_SetMobjState(livesico, newmobj->info->seestate); + } + } +} + +// Function: A_BigMonitorPop +// +// Description: Used by repeating monitors when they turn off. They don't really pop, but, you know... +// +// var1 = unused +// var2 = unused +// +void A_BigMonitorPop(mobj_t *actor) +{ + mobjtype_t item = 0; + mobj_t *newmobj; + +#ifdef HAVE_BLUA + if (LUA_CallAction("A_BigMonitorPop", actor)) + return; +#endif + + // Don't spawn the "pop" explosion, because the monitor isn't broken. + if (actor->info->deathsound) + S_StartSound(actor, actor->info->deathsound); + //P_SpawnMobjFromMobj(actor, 0, 0, actor.height/4, MT_EXPLODE); + + // Remove our flags for a bit. + // Players can now stand on top of us. + P_UnsetThingPosition(actor); + actor->flags &= ~(MF_MONITOR|MF_SHOOTABLE); + actor->flags2 |= MF2_STANDONME; + P_SetThingPosition(actor); + + // Don't count this box in statistics. Sorry. + if (actor->target && actor->target->player) + --actor->target->player->numboxes; + actor->fuse = 0; // Don't let the monitor code screw us up. + + if (actor->info->damage == MT_UNKNOWN) + { + // MT_UNKNOWN is random. Because it's unknown to us... get it? + item = P_DoRandomBoxChances(); + + if (item == MT_NULL) + { + CONS_Alert(CONS_WARNING, M_GetText("All monitors turned off.\n")); + return; + } + } + else + item = actor->info->damage; + + if (item == 0) + { + CONS_Debug(DBG_GAMELOGIC, "Powerup item not defined in 'damage' field for A_BigMonitorPop\n"); + return; + } + + // Note: the icon spawns 1 fracunit higher + newmobj = P_SpawnMobjFromMobj(actor, 0, 0, 14*FRACUNIT, item); + P_SetTarget(&newmobj->target, actor->target); // Transfer target + + if (item == MT_1UP_ICON) + { + if (actor->tracer) // Remove the old lives icon. + P_RemoveMobj(actor->tracer); + + if (!newmobj->target + || !newmobj->target->player + || !newmobj->target->skin + || ((skin_t *)newmobj->target->skin)->sprites[SPR2_LIFE].numframes == 0) + newmobj->sprite = SPR_TV1U; // No lives icon for this player, use the default. + else + { // Spawn the lives icon. + mobj_t *livesico = P_SpawnMobjFromMobj(newmobj, 0, 0, 0, MT_OVERLAY); + P_SetTarget(&livesico->target, newmobj); + P_SetTarget(&newmobj->tracer, livesico); + + livesico->color = newmobj->target->player->mo->color; + livesico->skin = &skins[newmobj->target->player->skin]; + P_SetMobjState(livesico, newmobj->info->seestate); + } + } +} + +// Function: A_BigMonitorRestore +// +// Description: A repeating monitor is coming back to life. Reset monitor flags, etc. +// +// var1 = unused +// var2 = unused +// +void A_BigMonitorRestore(mobj_t *actor) +{ +#ifdef HAVE_BLUA + if (LUA_CallAction("A_BigMonitorRestore", actor)) + return; +#endif + + actor->flags |= MF_MONITOR|MF_SHOOTABLE; + actor->flags2 &= ~MF2_STANDONME; + actor->health = 1; // Just in case. +} + +// Function: A_BigMonitorSparkle +// +// Description: Spawns the little sparkly effect around big monitors. Looks pretty, doesn't it? +// +// var1 = unused +// var2 = unused +// +void A_BigMonitorSparkle(mobj_t *actor) +{ + fixed_t i, ngangle, xofs, yofs; + +#ifdef HAVE_BLUA + if (LUA_CallAction("A_BigMonitorSparkle", actor)) + return; +#endif + + ngangle = FixedAngle(((leveltime * 21) % 360) << FRACBITS); + xofs = FINESINE((ngangle>>ANGLETOFINESHIFT) & FINEMASK) * (actor->radius>>FRACBITS); + yofs = FINECOSINE((ngangle>>ANGLETOFINESHIFT) & FINEMASK) * (actor->radius>>FRACBITS); + + for (i = FRACUNIT*2; i <= FRACUNIT*3; i += FRACUNIT/2) + P_SetObjectMomZ(P_SpawnMobjFromMobj(actor, xofs, yofs, 0, MT_BOXSPARKLE), i, false); } // Function: A_Explode @@ -3160,8 +3241,8 @@ void A_ExtraLife(mobj_t *actor) player = actor->target->player; - if (actor->type == MT_1UPICO && !actor->tracer) - actor->frame -= 2; // No lives icon for this player, use the default. + if (actor->type == MT_1UP_ICON && !actor->tracer) + actor->sprite = SPR_TV1U; // No lives icon for this player, use the default. if (ultimatemode) //I don't THINK so! { diff --git a/src/p_inter.c b/src/p_inter.c index f9dc3c342..9634e0744 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1568,8 +1568,7 @@ static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *sour } else switch (source->type) { - case MT_EGGMANICO: - case MT_EGGMANBOX: + case MT_EGGMAN_ICON: str = M_GetText("%s was %s by Eggman's nefarious TV magic.\n"); break; case MT_SPIKE: @@ -2766,10 +2765,10 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da if (!force) { // Special case for team ring boxes - if (target->type == MT_REDRINGBOX && !(source->player->ctfteam == 1)) + if (target->type == MT_RING_REDBOX && !(source->player->ctfteam == 1)) return false; - if (target->type == MT_BLUERINGBOX && !(source->player->ctfteam == 2)) + if (target->type == MT_RING_BLUEBOX && !(source->player->ctfteam == 2)) return false; } diff --git a/src/p_local.h b/src/p_local.h index 498bf0828..2f00b1d0b 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -238,6 +238,8 @@ boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover); boolean P_CheckDeathPitCollide(mobj_t *mo); boolean P_CheckSolidLava(mobj_t *mo, ffloor_t *rover); +mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zofs, mobjtype_t type); + mobj_t *P_SpawnMissile(mobj_t *source, mobj_t *dest, mobjtype_t type); mobj_t *P_SpawnXYZMissile(mobj_t *source, mobj_t *dest, mobjtype_t type, fixed_t x, fixed_t y, fixed_t z); mobj_t *P_SpawnPointMissile(mobj_t *source, fixed_t xa, fixed_t ya, fixed_t za, mobjtype_t type, fixed_t x, fixed_t y, fixed_t z); diff --git a/src/p_map.c b/src/p_map.c index 214048fb3..faa3d44c9 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -955,7 +955,7 @@ static boolean PIT_CheckThing(mobj_t *thing) // 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) - && !((thing->type == MT_REDRINGBOX && tmthing->player->ctfteam != 1) || (thing->type == MT_BLUERINGBOX && tmthing->player->ctfteam != 2))) + && !((thing->type == MT_RING_REDBOX && tmthing->player->ctfteam != 1) || (thing->type == MT_RING_BLUEBOX && tmthing->player->ctfteam != 2))) ; // z checking at last // Treat noclip things as non-solid! diff --git a/src/p_mobj.c b/src/p_mobj.c index 915c742e8..86ddee029 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7258,9 +7258,60 @@ void P_MobjThinker(mobj_t *mobj) mobj_t *flagmo, *newmobj; #ifdef HAVE_BLUA - if (!LUAh_MobjFuse(mobj) && !P_MobjWasRemoved(mobj)) + if (LUAh_MobjFuse(mobj) || P_MobjWasRemoved(mobj)) + ; + else #endif - switch (mobj->type) + if (mobj->info->flags & MF_MONITOR) + { + // Special case for ALL monitors. + // If a box's speed is nonzero, it's allowed to respawn as a WRM/SRM. + if (mobj->info->speed != 0 && (mobj->flags & MF_AMBUSH || mobj->flags2 & MF2_STRONGBOX)) + { + mobjtype_t spawnchance[64]; + INT32 numchoices = 0, i = 0; + +// This define should make it a lot easier to organize and change monitor weights +#define SETMONITORCHANCES(type, strongboxamt, weakboxamt) \ +for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) spawnchance[numchoices++] = type + + // Type SRM WRM + SETMONITORCHANCES(MT_SNEAKERS_BOX, 0, 10); // Super Sneakers + SETMONITORCHANCES(MT_INVULN_BOX, 2, 0); // Invincibility + SETMONITORCHANCES(MT_WHIRLWIND_BOX, 3, 8); // Whirlwind Shield + SETMONITORCHANCES(MT_ELEMENTAL_BOX, 3, 8); // Elemental Shield + SETMONITORCHANCES(MT_ATTRACT_BOX, 2, 0); // Attraction Shield + SETMONITORCHANCES(MT_FORCE_BOX, 3, 3); // Force Shield + SETMONITORCHANCES(MT_ARMAGEDDON_BOX, 2, 0); // Armageddon Shield + SETMONITORCHANCES(MT_MIXUP_BOX, 0, 1); // Teleporters + SETMONITORCHANCES(MT_RECYCLER_BOX, 0, 1); // Recycler + SETMONITORCHANCES(MT_1UP_BOX, 1, 1); // 1-Up + // ======================================= + // Total 16 32 + +#undef SETMONITORCHANCES + + i = P_RandomKey(numchoices); // Gotta love those random numbers! + newmobj = P_SpawnMobj(mobj->x, mobj->y, mobj->z, spawnchance[i]); + + // If the monitor respawns randomly, transfer the flag. + if (mobj->flags & MF_AMBUSH) + newmobj->flags |= MF_AMBUSH; + + // Transfer flags2 (strongbox, objectflip) + newmobj->flags2 = mobj->flags2; + } + else + { + newmobj = P_SpawnMobj(mobj->x, mobj->y, mobj->z, mobj->type); + + // Transfer flags2 (strongbox, objectflip) + newmobj->flags2 = mobj->flags2; + } + P_RemoveMobj(mobj); // make sure they disappear + return; + } + else switch (mobj->type) { // gargoyle and snowman handled in P_PushableThinker, not here case MT_THROWNGRENADE: @@ -7317,68 +7368,6 @@ void P_MobjThinker(mobj_t *mobj) } P_RemoveMobj(mobj); return; - case MT_YELLOWTV: // Ring shield box - case MT_BLUETV: // Force shield box - case MT_GREENTV: // Water shield box - case MT_BLACKTV: // Bomb shield box - case MT_WHITETV: // Jump shield box - case MT_SNEAKERTV: // Super Sneaker box - case MT_SUPERRINGBOX: // 10-Ring box - case MT_REDRINGBOX: // Red Team 10-Ring box - case MT_BLUERINGBOX: // Blue Team 10-Ring box - case MT_INV: // Invincibility box - case MT_MIXUPBOX: // Teleporter Mixup box - case MT_RECYCLETV: // Recycler box - case MT_SCORETVSMALL: - case MT_SCORETVLARGE: - case MT_PRUP: // 1up! - case MT_EGGMANBOX: // Eggman box - case MT_GRAVITYBOX: // Gravity box - case MT_QUESTIONBOX: - if ((mobj->flags & MF_AMBUSH || mobj->flags2 & MF2_STRONGBOX) && mobj->type != MT_QUESTIONBOX) - { - mobjtype_t spawnchance[64]; - INT32 numchoices = 0, i = 0; - -// This define should make it a lot easier to organize and change monitor weights -#define SETMONITORCHANCES(type, strongboxamt, weakboxamt) \ -for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) spawnchance[numchoices++] = type - - // Type SRM WRM - SETMONITORCHANCES(MT_SNEAKERTV, 0, 10); // Super Sneakers - SETMONITORCHANCES(MT_INV, 2, 0); // Invincibility - SETMONITORCHANCES(MT_WHITETV, 3, 8); // Whirlwind Shield - SETMONITORCHANCES(MT_GREENTV, 3, 8); // Elemental Shield - SETMONITORCHANCES(MT_YELLOWTV, 2, 0); // Attraction Shield - SETMONITORCHANCES(MT_BLUETV, 3, 3); // Force Shield - SETMONITORCHANCES(MT_BLACKTV, 2, 0); // Armageddon Shield - SETMONITORCHANCES(MT_MIXUPBOX, 0, 1); // Teleporters - SETMONITORCHANCES(MT_RECYCLETV, 0, 1); // Recycler - SETMONITORCHANCES(MT_PRUP, 1, 1); // 1-Up - // ====================================== - // Total 16 32 - -#undef SETMONITORCHANCES - - i = P_RandomKey(numchoices); // Gotta love those random numbers! - newmobj = P_SpawnMobj(mobj->x, mobj->y, mobj->z, spawnchance[i]); - - // If the monitor respawns randomly, transfer the flag. - if (mobj->flags & MF_AMBUSH) - newmobj->flags |= MF_AMBUSH; - - // Transfer flags2 (strongbox, objectflip) - newmobj->flags2 = mobj->flags2; - } - else - { - newmobj = P_SpawnMobj(mobj->x, mobj->y, mobj->z, mobj->type); - - // Transfer flags2 (strongbox, objectflip) - newmobj->flags2 = mobj->flags2; - } - P_RemoveMobj(mobj); // make sure they disappear - return; case MT_METALSONIC_BATTLE: break; // don't remove case MT_SPIKE: @@ -7395,6 +7384,7 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s default: P_SetMobjState(mobj, mobj->info->xdeathstate); // will remove the mobj if S_NULL. break; + // Looking for monitors? They moved to a special condition above. } if (P_MobjWasRemoved(mobj)) return; @@ -8805,9 +8795,9 @@ void P_SpawnMapThing(mapthing_t *mthing) if ((mobjinfo[i].flags & MF_MONITOR) && cv_competitionboxes.value) // not Normal { if (cv_competitionboxes.value == 1) // Random - i = MT_QUESTIONBOX; + i = MT_MYSTERY_BOX; else if (cv_competitionboxes.value == 2) // Teleports - i = MT_MIXUPBOX; + i = MT_MIXUP_BOX; else if (cv_competitionboxes.value == 3) // None return; // Don't spawn! } @@ -8819,12 +8809,12 @@ void P_SpawnMapThing(mapthing_t *mthing) if ((mobjinfo[i].flags & MF_MONITOR) && cv_matchboxes.value) // not Normal { if (cv_matchboxes.value == 1) // Random - i = MT_QUESTIONBOX; + i = MT_MYSTERY_BOX; else if (cv_matchboxes.value == 3) // Don't spawn return; else // cv_matchboxes.value == 2, Non-Random { - if (i == MT_QUESTIONBOX) + if (i == MT_MYSTERY_BOX) return; // don't spawn in Non-Random mthing->options &= ~(MTF_AMBUSH|MTF_OBJECTSPECIAL); // no random respawning! @@ -8836,8 +8826,8 @@ void P_SpawnMapThing(mapthing_t *mthing) { if (i == MT_BLUETEAMRING || i == MT_REDTEAMRING) i = MT_RING; - else if (i == MT_BLUERINGBOX || i == MT_REDRINGBOX) - i = MT_SUPERRINGBOX; + else if (i == MT_RING_BLUEBOX || i == MT_RING_REDBOX) + i = MT_RING_BOX; else if (i == MT_BLUEFLAG || i == MT_REDFLAG) return; // No flags in non-CTF modes! } @@ -8864,23 +8854,27 @@ void P_SpawnMapThing(mapthing_t *mthing) return; /// \todo // 1UPs -->> Score TVs - else if (i == MT_PRUP) // 1UP + else if (i == MT_1UP_BOX) // 1UP { // Either or, doesn't matter which. if (mthing->options & (MTF_AMBUSH|MTF_OBJECTSPECIAL)) - i = MT_SCORETVLARGE; // 10,000 + i = MT_SCORE10K_BOX; // 10,000 else - i = MT_SCORETVSMALL; // 1,000 + i = MT_SCORE1K_BOX; // 1,000 } } if (ultimatemode) { - if (i == MT_PITYTV || i == MT_GREENTV || i == MT_YELLOWTV || i == MT_BLUETV || i == MT_BLACKTV || i == MT_WHITETV) + if (i == MT_PITY_BOX || i == MT_ELEMENTAL_BOX || i == MT_ATTRACT_BOX + || i == MT_FORCE_BOX || i == MT_ARMAGEDDON_BOX || i == MT_WHIRLWIND_BOX) return; // No shields in Ultimate mode - if (i == MT_SUPERRINGBOX && !G_IsSpecialStage(gamemap)) + if (i == MT_RING_BOX && !G_IsSpecialStage(gamemap)) return; // No rings in Ultimate mode (except special stages) + + // Don't include the BIGBOXes (repeating monitors) here please. + // 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++))) @@ -9306,8 +9300,10 @@ ML_NOCLIMB : Direction not controllable } //count 10 ring boxes into the number of rings equation too. - if (i == MT_SUPERRINGBOX) + if (i == MT_RING_BOX) nummaprings += 10; + if (i == MT_RING_BIGBOX) // Theoretically infinite + nummaprings += 10000; if (i == MT_BIGTUMBLEWEED || i == MT_LITTLETUMBLEWEED) { @@ -9385,16 +9381,11 @@ ML_NOCLIMB : Direction not controllable mobj->flags2 |= MF2_STANDONME; } - if (mobj->flags & MF_MONITOR) + if ((mobj->flags & MF_MONITOR) && mobj->info->speed != 0) { // flag for strong/weak random boxes - if (mthing->type == mobjinfo[MT_SUPERRINGBOX].doomednum || mthing->type == mobjinfo[MT_PRUP].doomednum || - mthing->type == mobjinfo[MT_SNEAKERTV].doomednum || mthing->type == mobjinfo[MT_INV].doomednum || - mthing->type == mobjinfo[MT_WHITETV].doomednum || mthing->type == mobjinfo[MT_GREENTV].doomednum || - mthing->type == mobjinfo[MT_YELLOWTV].doomednum || mthing->type == mobjinfo[MT_BLUETV].doomednum || - mthing->type == mobjinfo[MT_BLACKTV].doomednum || mthing->type == mobjinfo[MT_PITYTV].doomednum || - mthing->type == mobjinfo[MT_RECYCLETV].doomednum || mthing->type == mobjinfo[MT_MIXUPBOX].doomednum) - mobj->flags |= MF_AMBUSH; + // any monitor with nonzero speed is allowed to respawn like this + mobj->flags |= MF_AMBUSH; } else if (mthing->type != mobjinfo[MT_AXIS].doomednum && @@ -9407,14 +9398,12 @@ ML_NOCLIMB : Direction not controllable if (mthing->options & MTF_OBJECTSPECIAL) { - // flag for strong/weak random boxes - if (mthing->type == mobjinfo[MT_SUPERRINGBOX].doomednum || mthing->type == mobjinfo[MT_PRUP].doomednum || - mthing->type == mobjinfo[MT_SNEAKERTV].doomednum || mthing->type == mobjinfo[MT_INV].doomednum || - mthing->type == mobjinfo[MT_WHITETV].doomednum || mthing->type == mobjinfo[MT_GREENTV].doomednum || - mthing->type == mobjinfo[MT_YELLOWTV].doomednum || mthing->type == mobjinfo[MT_BLUETV].doomednum || - mthing->type == mobjinfo[MT_BLACKTV].doomednum || mthing->type == mobjinfo[MT_PITYTV].doomednum || - mthing->type == mobjinfo[MT_RECYCLETV].doomednum || mthing->type == mobjinfo[MT_MIXUPBOX].doomednum) - mobj->flags2 |= MF2_STRONGBOX; + if ((mobj->flags & MF_MONITOR) && mobj->info->speed != 0) + { + // flag for strong/weak random boxes + // any monitor with nonzero speed is allowed to respawn like this + mobj->flags2 |= MF2_STRONGBOX; + } // Requires you to be in bonus time to activate if (mobj->flags & MF_NIGHTSITEM) @@ -10411,3 +10400,35 @@ void P_FlashPal(player_t *pl, UINT16 type, UINT16 duration) pl->flashcount = duration; pl->flashpal = type; } + +// +// P_SpawnMobjFromMobj +// Spawns an object with offsets relative to the position of another object. +// Scale, gravity flip, etc. is taken into account automatically. +// +mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zofs, mobjtype_t type) +{ + mobj_t *newmobj; + + xofs = FixedMul(xofs, mobj->scale); + yofs = FixedMul(yofs, mobj->scale); + zofs = FixedMul(zofs, mobj->scale); + + newmobj = P_SpawnMobj(mobj->x + xofs, mobj->y + yofs, mobj->z + zofs, type); + if (!newmobj) + return NULL; + + if (mobj->eflags & MFE_VERTICALFLIP) + { + fixed_t elementheight = FixedMul(newmobj->info->height, mobj->scale); + + newmobj->eflags |= MFE_VERTICALFLIP; + newmobj->flags2 |= MF2_OBJECTFLIP; + newmobj->z = mobj->z + mobj->height - zofs - elementheight; + } + + newmobj->destscale = mobj->destscale; + P_SetScale(newmobj, mobj->scale); + return newmobj; +} + diff --git a/src/p_user.c b/src/p_user.c index 8854d8d64..d7ff8c27a 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8651,7 +8651,7 @@ void P_DoPityCheck(player_t *player) if ((player->pity >= 3 || player->pity < 0) && player->powers[pw_shield] == SH_NONE) { if (player->pity > 0) - S_StartSound(player->mo, mobjinfo[MT_PITYSHIELDICO].seesound); + S_StartSound(player->mo, mobjinfo[MT_PITY_ICON].seesound); player->pity = 0; player->powers[pw_shield] = SH_PITY; diff --git a/src/sounds.c b/src/sounds.c index 1ec86e7bc..50bf6f29a 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -1220,6 +1220,7 @@ sfxinfo_t S_sfx[NUMSFX] = {"lvpass", false, 96, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"mindig", false, 8, 64, -1, NULL, 0, -1, -1, LUMPERROR}, {"mixup", true, 127, 0, -1, NULL, 0, -1, -1, LUMPERROR}, + {"monton", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"pogo" , false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"pop" , false, 78, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"rail1", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, diff --git a/src/sounds.h b/src/sounds.h index c5851a346..8c2659ddb 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -1308,6 +1308,7 @@ typedef enum sfx_lvpass, sfx_mindig, sfx_mixup, + sfx_monton, sfx_pogo, sfx_pop, sfx_rail1, From 98f652aca6e0019c5c490fe45177d2eb28eb0ceb Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 31 Dec 2015 15:29:08 -0800 Subject: [PATCH 005/562] Big monitors are "Gold Monitors" now. The useless ones have been removed, too, and they should always spawn as what they should regardless of settings. By the way, graphics are at https://dl.dropboxusercontent.com/u/3518218/22/monitorgfx.wad --- src/dehacked.c | 76 +++++------ src/info.c | 350 +++++++++---------------------------------------- src/info.h | 76 +++++------ src/p_enemy.c | 20 +-- src/p_mobj.c | 31 +++-- 5 files changed, 148 insertions(+), 405 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index d0f582385..0aa577e3d 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1628,9 +1628,9 @@ static actionpointer_t actionpointers[] = {{A_Pain}, "A_PAIN"}, {{A_Fall}, "A_FALL"}, {{A_MonitorPop}, "A_MONITORPOP"}, - {{A_BigMonitorPop}, "A_BIGMONITORPOP"}, - {{A_BigMonitorRestore}, "A_BIGMONITORRESTORE"}, - {{A_BigMonitorSparkle}, "A_BIGMONITORSPARKLE"}, + {{A_GoldMonitorPop}, "A_GOLDMONITORPOP"}, + {{A_GoldMonitorRestore}, "A_GOLDMONITORRESTORE"}, + {{A_GoldMonitorSparkle}, "A_GOLDMONITORSPARKLE"}, {{A_Look}, "A_LOOK"}, {{A_Chase}, "A_CHASE"}, {{A_FaceStabChase}, "A_FACESTABCHASE"}, @@ -4867,14 +4867,14 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_BOX_POP1", "S_BOX_POP2", - "S_BIGBOX_FLICKER", - "S_BIGBOX_OFF1", - "S_BIGBOX_OFF2", - "S_BIGBOX_OFF3", - "S_BIGBOX_OFF4", - "S_BIGBOX_OFF5", - "S_BIGBOX_OFF6", - "S_BIGBOX_OFF7", + "S_GOLDBOX_FLICKER", + "S_GOLDBOX_OFF1", + "S_GOLDBOX_OFF2", + "S_GOLDBOX_OFF3", + "S_GOLDBOX_OFF4", + "S_GOLDBOX_OFF5", + "S_GOLDBOX_OFF6", + "S_GOLDBOX_OFF7", // Monitor States (one per box) "S_MYSTERY_BOX", @@ -4895,24 +4895,16 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_SCORE1K_BOX", "S_SCORE10K_BOX", - // Repeat Monitor States (one per box) - "S_MYSTERY_BIGBOX", - "S_RING_BIGBOX", - "S_PITY_BIGBOX", - "S_ATTRACT_BIGBOX", - "S_FORCE_BIGBOX", - "S_ARMAGEDDON_BIGBOX", - "S_WHIRLWIND_BIGBOX", - "S_ELEMENTAL_BIGBOX", - "S_SNEAKERS_BIGBOX", - "S_INVULN_BIGBOX", - "S_1UP_BIGBOX", - "S_EGGMAN_BIGBOX", - "S_MIXUP_BIGBOX", - "S_GRAVITY_BIGBOX", - "S_RECYCLER_BIGBOX", - "S_SCORE1K_BIGBOX", - "S_SCORE10K_BIGBOX", + // Gold Repeat Monitor States (one per box) + "S_PITY_GOLDBOX", + "S_ATTRACT_GOLDBOX", + "S_FORCE_GOLDBOX", + "S_ARMAGEDDON_GOLDBOX", + "S_WHIRLWIND_GOLDBOX", + "S_ELEMENTAL_GOLDBOX", + "S_SNEAKERS_GOLDBOX", + "S_INVULN_GOLDBOX", + "S_GRAVITY_GOLDBOX", // Team Ring Boxes (these are special) "S_RING_REDBOX1", @@ -6785,23 +6777,15 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_SCORE10K_BOX", // Monitor boxes -- repeating (big) boxes - "MT_RING_BIGBOX", - "MT_PITY_BIGBOX", - "MT_ATTRACT_BIGBOX", - "MT_FORCE_BIGBOX", - "MT_ARMAGEDDON_BIGBOX", - "MT_WHIRLWIND_BIGBOX", - "MT_ELEMENTAL_BIGBOX", - "MT_SNEAKERS_BIGBOX", - "MT_INVULN_BIGBOX", - "MT_1UP_BIGBOX", - "MT_EGGMAN_BIGBOX", - "MT_MIXUP_BIGBOX", - "MT_MYSTERY_BIGBOX", - "MT_GRAVITY_BIGBOX", - "MT_RECYCLER_BIGBOX", - "MT_SCORE1K_BIGBOX", - "MT_SCORE10K_BIGBOX", + "MT_PITY_GOLDBOX", + "MT_ATTRACT_GOLDBOX", + "MT_FORCE_GOLDBOX", + "MT_ARMAGEDDON_GOLDBOX", + "MT_WHIRLWIND_GOLDBOX", + "MT_ELEMENTAL_GOLDBOX", + "MT_SNEAKERS_GOLDBOX", + "MT_INVULN_GOLDBOX", + "MT_GRAVITY_GOLDBOX", // Monitor boxes -- special "MT_RING_REDBOX", diff --git a/src/info.c b/src/info.c index d00ecc5dc..af5126f3a 100644 --- a/src/info.c +++ b/src/info.c @@ -1248,14 +1248,14 @@ state_t states[NUMSTATES] = {SPR_MSTV, 0, 4, {A_MonitorPop}, 0, 0, S_BOX_POP2}, // S_BOX_POP1 {SPR_MSTV, 1, -1, {NULL}, 0, 0, S_NULL}, // S_BOX_POP2 - {SPR_XLTV, 0, 1, {NULL}, 0, 0, S_SPAWNSTATE}, // S_BIGBOX_FLICKER - {SPR_XLTV, 1, 89, {A_BigMonitorPop}, 0, 0, S_BIGBOX_OFF2}, // S_BIGBOX_OFF1 - {SPR_XLTV, 2, 4, {A_PlayAttackSound}, 0, 0, S_BIGBOX_OFF3}, // S_BIGBOX_OFF2 - {SPR_XLTV, 3, 4, {NULL}, 0, 0, S_BIGBOX_OFF4}, // S_BIGBOX_OFF3 - {SPR_XLTV, 4, 4, {NULL}, 0, 0, S_BIGBOX_OFF5}, // S_BIGBOX_OFF4 - {SPR_XLTV, 5, 2, {NULL}, 0, 0, S_BIGBOX_OFF6}, // S_BIGBOX_OFF5 - {SPR_XLTV, 6, 2, {NULL}, 0, 0, S_BIGBOX_OFF7}, // S_BIGBOX_OFF6 - {SPR_XLTV, 6, 0, {A_BigMonitorRestore}, 0, 0, S_SPAWNSTATE}, // S_BIGBOX_OFF7 + {SPR_XLTV, 0, 1, {NULL}, 0, 0, S_SPAWNSTATE}, // S_GOLDBOX_FLICKER + {SPR_XLTV, 1, 89, {A_GoldMonitorPop}, 0, 0, S_GOLDBOX_OFF2}, // S_GOLDBOX_OFF1 + {SPR_XLTV, 2, 4, {A_PlayAttackSound}, 0, 0, S_GOLDBOX_OFF3}, // S_GOLDBOX_OFF2 + {SPR_XLTV, 3, 4, {NULL}, 0, 0, S_GOLDBOX_OFF4}, // S_GOLDBOX_OFF3 + {SPR_XLTV, 4, 4, {NULL}, 0, 0, S_GOLDBOX_OFF5}, // S_GOLDBOX_OFF4 + {SPR_XLTV, 5, 2, {NULL}, 0, 0, S_GOLDBOX_OFF6}, // S_GOLDBOX_OFF5 + {SPR_XLTV, 6, 2, {NULL}, 0, 0, S_GOLDBOX_OFF7}, // S_GOLDBOX_OFF6 + {SPR_XLTV, 6, 0, {A_GoldMonitorRestore}, 0, 0, S_SPAWNSTATE}, // S_GOLDBOX_OFF7 // Monitor States (one per box) {SPR_TVMY, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_MYSTERY_BOX @@ -1276,24 +1276,16 @@ state_t states[NUMSTATES] = {SPR_TV1K, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_SCORE1K_BOX {SPR_TVTK, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_SCORE10K_BOX - // Repeat Monitor States (one per box) - {SPR_TVMY, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_MYSTERY_BIGBOX - {SPR_TVRI, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_RING_BIGBOX - {SPR_TVPI, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_PITY_BIGBOX - {SPR_TVAT, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_ATTRACT_BIGBOX - {SPR_TVFO, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_FORCE_BIGBOX - {SPR_TVAR, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_ARMAGEDDON_BIGBOX - {SPR_TVWW, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_WHIRLWIND_BIGBOX - {SPR_TVEL, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_ELEMENTAL_BIGBOX - {SPR_TVSS, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_SNEAKERS_BIGBOX - {SPR_TVIV, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_INVULN_BIGBOX - {SPR_TV1P, 1, 2, {A_DualAction}, S_MYSTERY_BIGBOX, S_1UP_BOX, S_BIGBOX_FLICKER}, // S_1UP_BIGBOX - {SPR_TVEG, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_EGGMAN_BIGBOX - {SPR_TVMX, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_MIXUP_BIGBOX - {SPR_TVGV, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_GRAVITY_BIGBOX - {SPR_TVRC, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_RECYCLER_BIGBOX - {SPR_TV1K, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_SCORE1K_BIGBOX - {SPR_TVTK, 1, 2, {A_BigMonitorSparkle}, 0, 0, S_BIGBOX_FLICKER}, // S_SCORE10K_BIGBOX + // Gold Repeat Monitor States (one per box) + {SPR_TVPI, 1, 2, {A_GoldMonitorSparkle}, 0, 0, S_GOLDBOX_FLICKER}, // S_PITY_GOLDBOX + {SPR_TVAT, 1, 2, {A_GoldMonitorSparkle}, 0, 0, S_GOLDBOX_FLICKER}, // S_ATTRACT_GOLDBOX + {SPR_TVFO, 1, 2, {A_GoldMonitorSparkle}, 0, 0, S_GOLDBOX_FLICKER}, // S_FORCE_GOLDBOX + {SPR_TVAR, 1, 2, {A_GoldMonitorSparkle}, 0, 0, S_GOLDBOX_FLICKER}, // S_ARMAGEDDON_GOLDBOX + {SPR_TVWW, 1, 2, {A_GoldMonitorSparkle}, 0, 0, S_GOLDBOX_FLICKER}, // S_WHIRLWIND_GOLDBOX + {SPR_TVEL, 1, 2, {A_GoldMonitorSparkle}, 0, 0, S_GOLDBOX_FLICKER}, // S_ELEMENTAL_GOLDBOX + {SPR_TVSS, 1, 2, {A_GoldMonitorSparkle}, 0, 0, S_GOLDBOX_FLICKER}, // S_SNEAKERS_GOLDBOX + {SPR_TVIV, 1, 2, {A_GoldMonitorSparkle}, 0, 0, S_GOLDBOX_FLICKER}, // S_INVULN_GOLDBOX + {SPR_TVGV, 1, 2, {A_GoldMonitorSparkle}, 0, 0, S_GOLDBOX_FLICKER}, // S_GRAVITY_GOLDBOX // Team Ring Boxes (these are special) {SPR_TRRI, 0, 2, {NULL}, 0, 0, S_RING_REDBOX2}, // S_RING_REDBOX1 @@ -6568,47 +6560,20 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_RING_BIGBOX - 430, // doomednum - S_RING_BIGBOX, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_monton, // attacksound - S_RING_BIGBOX, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_BIGBOX_OFF1, // deathstate - S_NULL, // xdeathstate - sfx_pop, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - MT_RING_ICON, // damage - sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags - S_NULL // raisestate - }, - - { // MT_PITY_BIGBOX + { // MT_PITY_GOLDBOX 431, // doomednum - S_PITY_BIGBOX, // spawnstate + S_PITY_GOLDBOX, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound 8, // reactiontime sfx_monton, // attacksound - S_PITY_BIGBOX, // painstate + S_PITY_GOLDBOX, // painstate 0, // painchance sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_BIGBOX_OFF1, // deathstate + S_GOLDBOX_OFF1, // deathstate S_NULL, // xdeathstate sfx_pop, // deathsound 0, // speed @@ -6618,24 +6583,24 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_PITY_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, - { // MT_ATTRACT_BIGBOX + { // MT_ATTRACT_GOLDBOX 432, // doomednum - S_ATTRACT_BIGBOX, // spawnstate + S_ATTRACT_GOLDBOX, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound 8, // reactiontime sfx_monton, // attacksound - S_ATTRACT_BIGBOX, // painstate + S_ATTRACT_GOLDBOX, // painstate 0, // painchance sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_BIGBOX_OFF1, // deathstate + S_GOLDBOX_OFF1, // deathstate S_NULL, // xdeathstate sfx_pop, // deathsound 0, // speed @@ -6645,24 +6610,24 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_ATTRACT_ICON,// damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, - { // MT_FORCE_BIGBOX + { // MT_FORCE_GOLDBOX 433, // doomednum - S_FORCE_BIGBOX, // spawnstate + S_FORCE_GOLDBOX, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound 8, // reactiontime sfx_monton, // attacksound - S_FORCE_BIGBOX, // painstate + S_FORCE_GOLDBOX, // painstate 0, // painchance sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_BIGBOX_OFF1, // deathstate + S_GOLDBOX_OFF1, // deathstate S_NULL, // xdeathstate sfx_pop, // deathsound 0, // speed @@ -6672,24 +6637,24 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_FORCE_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, - { // MT_ARMAGEDDON_BIGBOX + { // MT_ARMAGEDDON_GOLDBOX 434, // doomednum - S_ARMAGEDDON_BIGBOX, // spawnstate + S_ARMAGEDDON_GOLDBOX, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound 8, // reactiontime sfx_monton, // attacksound - S_ARMAGEDDON_BIGBOX, // painstate + S_ARMAGEDDON_GOLDBOX, // painstate 0, // painchance sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_BIGBOX_OFF1, // deathstate + S_GOLDBOX_OFF1, // deathstate S_NULL, // xdeathstate sfx_pop, // deathsound 0, // speed @@ -6699,24 +6664,24 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_ARMAGEDDON_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, - { // MT_WHIRLWIND_BIGBOX + { // MT_WHIRLWIND_GOLDBOX 435, // doomednum - S_WHIRLWIND_BIGBOX, // spawnstate + S_WHIRLWIND_GOLDBOX, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound 8, // reactiontime sfx_monton, // attacksound - S_WHIRLWIND_BIGBOX, // painstate + S_WHIRLWIND_GOLDBOX, // painstate 0, // painchance sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_BIGBOX_OFF1, // deathstate + S_GOLDBOX_OFF1, // deathstate S_NULL, // xdeathstate sfx_pop, // deathsound 0, // speed @@ -6726,24 +6691,24 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_WHIRLWIND_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, - { // MT_ELEMENTAL_BIGBOX + { // MT_ELEMENTAL_GOLDBOX 436, // doomednum - S_ELEMENTAL_BIGBOX, // spawnstate + S_ELEMENTAL_GOLDBOX, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound 8, // reactiontime sfx_monton, // attacksound - S_ELEMENTAL_BIGBOX, // painstate + S_ELEMENTAL_GOLDBOX, // painstate 0, // painchance sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_BIGBOX_OFF1, // deathstate + S_GOLDBOX_OFF1, // deathstate S_NULL, // xdeathstate sfx_pop, // deathsound 0, // speed @@ -6753,24 +6718,24 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_ELEMENTAL_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, - { // MT_SNEAKERS_BIGBOX + { // MT_SNEAKERS_GOLDBOX 437, // doomednum - S_SNEAKERS_BIGBOX, // spawnstate + S_SNEAKERS_GOLDBOX, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound 8, // reactiontime sfx_monton, // attacksound - S_SNEAKERS_BIGBOX, // painstate + S_SNEAKERS_GOLDBOX, // painstate 0, // painchance sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_BIGBOX_OFF1, // deathstate + S_GOLDBOX_OFF1, // deathstate S_NULL, // xdeathstate sfx_pop, // deathsound 0, // speed @@ -6780,24 +6745,24 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_SNEAKERS_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, - { // MT_INVULN_BIGBOX + { // MT_INVULN_GOLDBOX 438, // doomednum - S_INVULN_BIGBOX, // spawnstate + S_INVULN_GOLDBOX, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound 8, // reactiontime sfx_monton, // attacksound - S_INVULN_BIGBOX, // painstate + S_INVULN_GOLDBOX, // painstate 0, // painchance sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_BIGBOX_OFF1, // deathstate + S_GOLDBOX_OFF1, // deathstate S_NULL, // xdeathstate sfx_pop, // deathsound 0, // speed @@ -6807,132 +6772,24 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_INVULN_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, - { // MT_1UP_BIGBOX - 439, // doomednum - S_1UP_BIGBOX, // spawnstate - 1, // spawnhealth - S_PLAY_BOX1, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_monton, // attacksound - S_1UP_BIGBOX, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_BIGBOX_OFF1, // deathstate - S_NULL, // xdeathstate - sfx_pop, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - MT_1UP_ICON, // damage - sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags - S_NULL // raisestate - }, - - { // MT_EGGMAN_BIGBOX - 440, // doomednum - S_EGGMAN_BIGBOX, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_monton, // attacksound - S_EGGMAN_BIGBOX, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_BIGBOX_OFF1, // deathstate - S_NULL, // xdeathstate - sfx_pop, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - MT_EGGMAN_ICON, // damage - sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags - S_NULL // raisestate - }, - - { // MT_MIXUP_BIGBOX - 441, // doomednum - S_MIXUP_BIGBOX, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_monton, // attacksound - S_MIXUP_BIGBOX, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_BIGBOX_OFF1, // deathstate - S_NULL, // xdeathstate - sfx_pop, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - MT_MIXUP_ICON, // damage - sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags - S_NULL // raisestate - }, - - { // MT_MYSTERY_BIGBOX - 442, // doomednum - S_MYSTERY_BIGBOX, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_monton, // attacksound - S_MYSTERY_BIGBOX, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_BIGBOX_OFF1, // deathstate - S_NULL, // xdeathstate - sfx_pop, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - MT_UNKNOWN, // damage - sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags - S_NULL // raisestate - }, - - { // MT_GRAVITY_BIGBOX + { // MT_GRAVITY_GOLDBOX 443, // doomednum - S_GRAVITY_BIGBOX, // spawnstate + S_GRAVITY_GOLDBOX, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound 8, // reactiontime sfx_monton, // attacksound - S_GRAVITY_BIGBOX, // painstate + S_GRAVITY_GOLDBOX, // painstate 0, // painchance sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_BIGBOX_OFF1, // deathstate + S_GOLDBOX_OFF1, // deathstate S_NULL, // xdeathstate sfx_pop, // deathsound 0, // speed @@ -6942,88 +6799,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass MT_GRAVITY_ICON, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags - S_NULL // raisestate - }, - - { // MT_RECYCLER_BIGBOX - 446, // doomednum - S_RECYCLER_BIGBOX, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_monton, // attacksound - S_RECYCLER_BIGBOX, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_BIGBOX_OFF1, // deathstate - S_NULL, // xdeathstate - sfx_pop, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - MT_RECYCLER_ICON, // damage - sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags - S_NULL // raisestate - }, - - { // MT_SCORE1K_BIGBOX - 448, // doomednum - S_SCORE1K_BIGBOX, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_monton, // attacksound - S_SCORE1K_BIGBOX, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_BIGBOX_OFF1, // deathstate - S_NULL, // xdeathstate - sfx_pop, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - MT_SCORE1K_ICON, // damage - sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags - S_NULL // raisestate - }, - - { // MT_SCORE10K_BIGBOX - 449, // doomednum - S_SCORE10K_BIGBOX, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_monton, // attacksound - S_SCORE10K_BIGBOX, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_BIGBOX_OFF1, // deathstate - S_NULL, // xdeathstate - sfx_pop, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - MT_SCORE10K_ICON, // damage - sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_MONITOR, // flags + MF_SOLID|MF_SHOOTABLE|MF_MONITOR|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, diff --git a/src/info.h b/src/info.h index d031addf5..d68bf5abb 100644 --- a/src/info.h +++ b/src/info.h @@ -28,9 +28,9 @@ void A_Explode(); void A_Pain(); void A_Fall(); void A_MonitorPop(); -void A_BigMonitorPop(); -void A_BigMonitorRestore(); -void A_BigMonitorSparkle(); +void A_GoldMonitorPop(); +void A_GoldMonitorRestore(); +void A_GoldMonitorSparkle(); void A_Look(); void A_Chase(); void A_FaceStabChase(); @@ -1765,14 +1765,14 @@ typedef enum state S_BOX_POP1, S_BOX_POP2, - S_BIGBOX_FLICKER, - S_BIGBOX_OFF1, - S_BIGBOX_OFF2, - S_BIGBOX_OFF3, - S_BIGBOX_OFF4, - S_BIGBOX_OFF5, - S_BIGBOX_OFF6, - S_BIGBOX_OFF7, + S_GOLDBOX_FLICKER, + S_GOLDBOX_OFF1, + S_GOLDBOX_OFF2, + S_GOLDBOX_OFF3, + S_GOLDBOX_OFF4, + S_GOLDBOX_OFF5, + S_GOLDBOX_OFF6, + S_GOLDBOX_OFF7, // Monitor States (one per box) S_MYSTERY_BOX, @@ -1793,24 +1793,16 @@ typedef enum state S_SCORE1K_BOX, S_SCORE10K_BOX, - // Repeat Monitor States (one per box) - S_MYSTERY_BIGBOX, - S_RING_BIGBOX, - S_PITY_BIGBOX, - S_ATTRACT_BIGBOX, - S_FORCE_BIGBOX, - S_ARMAGEDDON_BIGBOX, - S_WHIRLWIND_BIGBOX, - S_ELEMENTAL_BIGBOX, - S_SNEAKERS_BIGBOX, - S_INVULN_BIGBOX, - S_1UP_BIGBOX, - S_EGGMAN_BIGBOX, - S_MIXUP_BIGBOX, - S_GRAVITY_BIGBOX, - S_RECYCLER_BIGBOX, - S_SCORE1K_BIGBOX, - S_SCORE10K_BIGBOX, + // Gold Repeat Monitor States (one per box) + S_PITY_GOLDBOX, + S_ATTRACT_GOLDBOX, + S_FORCE_GOLDBOX, + S_ARMAGEDDON_GOLDBOX, + S_WHIRLWIND_GOLDBOX, + S_ELEMENTAL_GOLDBOX, + S_SNEAKERS_GOLDBOX, + S_INVULN_GOLDBOX, + S_GRAVITY_GOLDBOX, // Team Ring Boxes (these are special) S_RING_REDBOX1, @@ -3703,23 +3695,15 @@ typedef enum mobj_type MT_SCORE10K_BOX, // Monitor boxes -- repeating (big) boxes - MT_RING_BIGBOX, - MT_PITY_BIGBOX, - MT_ATTRACT_BIGBOX, - MT_FORCE_BIGBOX, - MT_ARMAGEDDON_BIGBOX, - MT_WHIRLWIND_BIGBOX, - MT_ELEMENTAL_BIGBOX, - MT_SNEAKERS_BIGBOX, - MT_INVULN_BIGBOX, - MT_1UP_BIGBOX, - MT_EGGMAN_BIGBOX, - MT_MIXUP_BIGBOX, - MT_MYSTERY_BIGBOX, - MT_GRAVITY_BIGBOX, - MT_RECYCLER_BIGBOX, - MT_SCORE1K_BIGBOX, - MT_SCORE10K_BIGBOX, + MT_PITY_GOLDBOX, + MT_ATTRACT_GOLDBOX, + MT_FORCE_GOLDBOX, + MT_ARMAGEDDON_GOLDBOX, + MT_WHIRLWIND_GOLDBOX, + MT_ELEMENTAL_GOLDBOX, + MT_SNEAKERS_GOLDBOX, + MT_INVULN_GOLDBOX, + MT_GRAVITY_GOLDBOX, // Monitor boxes -- special MT_RING_REDBOX, diff --git a/src/p_enemy.c b/src/p_enemy.c index d050972db..4555695c9 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -2635,20 +2635,20 @@ void A_MonitorPop(mobj_t *actor) } } -// Function: A_BigMonitorPop +// Function: A_GoldMonitorPop // // Description: Used by repeating monitors when they turn off. They don't really pop, but, you know... // // var1 = unused // var2 = unused // -void A_BigMonitorPop(mobj_t *actor) +void A_GoldMonitorPop(mobj_t *actor) { mobjtype_t item = 0; mobj_t *newmobj; #ifdef HAVE_BLUA - if (LUA_CallAction("A_BigMonitorPop", actor)) + if (LUA_CallAction("A_GoldMonitorPop", actor)) return; #endif @@ -2685,7 +2685,7 @@ void A_BigMonitorPop(mobj_t *actor) if (item == 0) { - CONS_Debug(DBG_GAMELOGIC, "Powerup item not defined in 'damage' field for A_BigMonitorPop\n"); + CONS_Debug(DBG_GAMELOGIC, "Powerup item not defined in 'damage' field for A_GoldMonitorPop\n"); return; } @@ -2716,17 +2716,17 @@ void A_BigMonitorPop(mobj_t *actor) } } -// Function: A_BigMonitorRestore +// Function: A_GoldMonitorRestore // // Description: A repeating monitor is coming back to life. Reset monitor flags, etc. // // var1 = unused // var2 = unused // -void A_BigMonitorRestore(mobj_t *actor) +void A_GoldMonitorRestore(mobj_t *actor) { #ifdef HAVE_BLUA - if (LUA_CallAction("A_BigMonitorRestore", actor)) + if (LUA_CallAction("A_GoldMonitorRestore", actor)) return; #endif @@ -2735,19 +2735,19 @@ void A_BigMonitorRestore(mobj_t *actor) actor->health = 1; // Just in case. } -// Function: A_BigMonitorSparkle +// Function: A_GoldMonitorSparkle // // Description: Spawns the little sparkly effect around big monitors. Looks pretty, doesn't it? // // var1 = unused // var2 = unused // -void A_BigMonitorSparkle(mobj_t *actor) +void A_GoldMonitorSparkle(mobj_t *actor) { fixed_t i, ngangle, xofs, yofs; #ifdef HAVE_BLUA - if (LUA_CallAction("A_BigMonitorSparkle", actor)) + if (LUA_CallAction("A_GoldMonitorSparkle", actor)) return; #endif diff --git a/src/p_mobj.c b/src/p_mobj.c index 86ddee029..f5d5ecf56 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8789,36 +8789,37 @@ void P_SpawnMapThing(mapthing_t *mthing) if ((mobjinfo[i].flags & MF_ENEMY) || (mobjinfo[i].flags & MF_BOSS)) return; - // Set powerup boxes to user settings for competition. - if (gametype == GT_COMPETITION) + // Altering monitor spawns via cvars + // If MF_GRENADEBOUNCE is set in the monitor's info, + // skip this step. (Used for gold monitors) + // Yeah, this is a dirty hack. + if ((mobjinfo[i].flags & (MF_MONITOR|MF_GRENADEBOUNCE)) == MF_MONITOR) { - if ((mobjinfo[i].flags & MF_MONITOR) && cv_competitionboxes.value) // not Normal + if (gametype == GT_COMPETITION) { + // Set powerup boxes to user settings for competition. if (cv_competitionboxes.value == 1) // Random i = MT_MYSTERY_BOX; else if (cv_competitionboxes.value == 2) // Teleports i = MT_MIXUP_BOX; else if (cv_competitionboxes.value == 3) // None return; // Don't spawn! + // default case: normal } - } - - // Set powerup boxes to user settings for other netplay modes - else if (gametype != GT_COOP) - { - if ((mobjinfo[i].flags & MF_MONITOR) && cv_matchboxes.value) // not Normal + // Set powerup boxes to user settings for other netplay modes + else if (gametype != GT_COOP) { if (cv_matchboxes.value == 1) // Random i = MT_MYSTERY_BOX; - else if (cv_matchboxes.value == 3) // Don't spawn - return; - else // cv_matchboxes.value == 2, Non-Random + else if (cv_matchboxes.value == 2) // Non-Random { if (i == MT_MYSTERY_BOX) return; // don't spawn in Non-Random - mthing->options &= ~(MTF_AMBUSH|MTF_OBJECTSPECIAL); // no random respawning! } + else if (cv_matchboxes.value == 3) // Don't spawn + return; + // default case: normal } } @@ -8873,7 +8874,7 @@ void P_SpawnMapThing(mapthing_t *mthing) if (i == MT_RING_BOX && !G_IsSpecialStage(gamemap)) return; // No rings in Ultimate mode (except special stages) - // Don't include the BIGBOXes (repeating monitors) here please. + // Don't include the gold repeating boxes here please. // They're likely facets of the level's design and therefore required to progress. } @@ -9302,8 +9303,6 @@ ML_NOCLIMB : Direction not controllable //count 10 ring boxes into the number of rings equation too. if (i == MT_RING_BOX) nummaprings += 10; - if (i == MT_RING_BIGBOX) // Theoretically infinite - nummaprings += 10000; if (i == MT_BIGTUMBLEWEED || i == MT_LITTLETUMBLEWEED) { From ebd2bdd1c82eaef65526de767dc9a40401f63393 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Fri, 1 Jan 2016 14:53:29 -0600 Subject: [PATCH 006/562] Add CA_DASHMODE to the game This works fine in single player on vanilla builds, multiplayer is untested. This might not be the best way to handle the ability, so modifications for efficiency/sanity might be necessary. --- src/d_player.h | 3 ++- src/dehacked.c | 1 + src/p_user.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) diff --git a/src/d_player.h b/src/d_player.h index e2a1081b0..08c98b7a3 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -57,7 +57,8 @@ typedef enum CA_FALLSWITCH, CA_JUMPBOOST, CA_AIRDRILL, - CA_JUMPTHOK + CA_JUMPTHOK, + CA_DASHMODE } charability_t; //Secondary skin abilities diff --git a/src/dehacked.c b/src/dehacked.c index 0ba054f07..3fd05ffe6 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7623,6 +7623,7 @@ struct { {"CA_JUMPBOOST",CA_JUMPBOOST}, {"CA_AIRDRILL",CA_AIRDRILL}, {"CA_JUMPTHOK",CA_JUMPTHOK}, + {"CA_DASHMODE",CA_DASHMODE}, // Secondary {"CA2_NONE",CA2_NONE}, // now slot 0! {"CA2_SPINDASH",CA2_SPINDASH}, diff --git a/src/p_user.c b/src/p_user.c index 8854d8d64..4b307feca 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4072,6 +4072,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) case CA_THOK: case CA_HOMINGTHOK: case CA_JUMPTHOK: // Credit goes to CZ64 and Sryder13 for the original + case CA_DASHMODE: // Credit goes to Iceman404 // Now it's Sonic's abilities turn! // THOK! if (!(player->pflags & PF_THOKKED) || (player->charability2 == CA2_MULTIABILITY)) @@ -8664,6 +8665,8 @@ void P_DoPityCheck(player_t *player) // boolean playerdeadview; // show match/chaos/tag/capture the flag rankings while in death view +INT32 dashmode = 0; // initial variable set for CA_DASHMODE +boolean dashmodeflag = false; void P_PlayerThink(player_t *player) { @@ -9148,6 +9151,63 @@ void P_PlayerThink(player_t *player) player->pflags &= ~PF_SLIDING; + // Dash mode ability for Metal Sonic + if ((player->charability == CA_DASHMODE) && !(maptol & TOL_NIGHTS)) // woo, dashmode! no nights tho. + { + fixed_t defspeed = skins[player->skin].normalspeed; // Default normalspeed. + fixed_t maxtop = skins[player->skin].normalspeed * 55/36; + + if (!(player->speed > player->normalspeed)) //are we currently exceeding our normalspeed? + player->actionspd = player->normalspeed; //if not, force thok to normalspeed + else + player->actionspd = player->speed; //otherwise, thok at your current speed (this fixes super and speedshoes thok slowing you down) + + if (player->speed >= (defspeed - 5*FRACUNIT) || (player->pflags & PF_STARTDASH)) + { + dashmode++; // Counter. Adds 1 to dash mode per tic in top speed. + if (dashmode == 3*TICRATE) // This isn't in the ">=" equation because it'd cause the sound to play infinitely. + S_StartSound(player->mo, sfx_s3ka2); // If the player enters dashmode, play this sound on the the tic it starts. + } + else if (!(player->pflags & PF_SPINNING)) + { + if (dashmode > 0) + dashmode = dashmode - 3; // Rather than lose it all, it gently counts back down! + else if (dashmode < 0) + dashmode = 0; + } + + if (dashmode >= 3*TICRATE && P_IsObjectOnGround(player->mo)) // Dash Mode can continue counting in the air, but will only activate on floor touch. + dashmodeflag = true; + + if (dashmode < 3*TICRATE) // Exits Dash Mode if you drop below speed/dash counter tics. Not in the above block so it doesn't keep disabling in midair. + { + player->normalspeed = defspeed; // Reset to default if not capable of entering dash mode. + player->jumpfactor = 1*FRACUNIT; + dashmodeflag = false; + } + + //WHEN PARAMETERS ARE MET, REWARD THE DASH MODE EFFECTS + if (dashmodeflag) + { + if (player->normalspeed < maxtop) // If the player is not currently at 50 normalspeed in dash mode, add speed each tic + { + player->normalspeed = player->normalspeed + 1*FRACUNIT/5; // Enter Dash Mode smoothly. + if (player->jumpfactor < 5*FRACUNIT/4) + player->jumpfactor = player->jumpfactor + 1*FRACUNIT/300; // Boosts his jumpheight. Remember fractions instead of decimals. "1.5*FRACUNIT = 3*FRACUNIT/2" + } + } + + //COSMETIC STUPIDITY! + if (dashmode > 108) //Dash Mode will go down a tic a bit above activation, this makes dust spawn every other tic. + dashmode = 107; + + if (player->normalspeed >= maxtop) + { + mobj_t *ghost = P_SpawnGhostMobj(player->mo); // Spawns afterimages + ghost->fuse = 2; // Makes the images fade quickly + } + } + /* // Colormap verification { From a15a4ace7e8bac122a90ddc6645f76f76de1ff87 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sat, 2 Jan 2016 22:34:55 -0600 Subject: [PATCH 007/562] Do dashmode thok speed adjustments at thok instead of modifying actionspd --- src/p_user.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/p_user.c b/src/p_user.c index 4b307feca..034bab498 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4079,13 +4079,19 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) { // Catapult the player fixed_t actionspd = player->actionspd; + + if (player->charability == CA_DASHMODE) + actionspd = max(player->normalspeed, FixedDiv(player->speed, player->mo->scale)); + if (player->mo->eflags & MFE_UNDERWATER) actionspd >>= 1; + if ((player->charability == CA_JUMPTHOK) && !(player->pflags & PF_THOKKED)) { player->pflags &= ~PF_JUMPED; P_DoJump(player, false); } + P_InstaThrust(player->mo, player->mo->angle, FixedMul(actionspd, player->mo->scale)); if (maptol & TOL_2D) From ba8c0dfc6e55e1116aa93b3ce4b030711340d114 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sat, 2 Jan 2016 22:58:35 -0600 Subject: [PATCH 008/562] Clean up dash mode and make multiplayer-compatible Actionspd is now the running speed in dashmode. --- src/p_user.c | 45 ++++++++++++++------------------------------- 1 file changed, 14 insertions(+), 31 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 034bab498..802e7f9c3 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8671,8 +8671,6 @@ void P_DoPityCheck(player_t *player) // boolean playerdeadview; // show match/chaos/tag/capture the flag rankings while in death view -INT32 dashmode = 0; // initial variable set for CA_DASHMODE -boolean dashmodeflag = false; void P_PlayerThink(player_t *player) { @@ -9160,15 +9158,10 @@ void P_PlayerThink(player_t *player) // Dash mode ability for Metal Sonic if ((player->charability == CA_DASHMODE) && !(maptol & TOL_NIGHTS)) // woo, dashmode! no nights tho. { - fixed_t defspeed = skins[player->skin].normalspeed; // Default normalspeed. +#define dashmode player->glidetime fixed_t maxtop = skins[player->skin].normalspeed * 55/36; - if (!(player->speed > player->normalspeed)) //are we currently exceeding our normalspeed? - player->actionspd = player->normalspeed; //if not, force thok to normalspeed - else - player->actionspd = player->speed; //otherwise, thok at your current speed (this fixes super and speedshoes thok slowing you down) - - if (player->speed >= (defspeed - 5*FRACUNIT) || (player->pflags & PF_STARTDASH)) + if (player->speed >= FixedMul(skins[player->skin].normalspeed - 5*FRACUNIT, player->mo->scale) || (player->pflags & PF_STARTDASH)) { dashmode++; // Counter. Adds 1 to dash mode per tic in top speed. if (dashmode == 3*TICRATE) // This isn't in the ">=" equation because it'd cause the sound to play infinitely. @@ -9176,42 +9169,32 @@ void P_PlayerThink(player_t *player) } else if (!(player->pflags & PF_SPINNING)) { - if (dashmode > 0) + if (dashmode > 3) dashmode = dashmode - 3; // Rather than lose it all, it gently counts back down! - else if (dashmode < 0) + else dashmode = 0; } - - if (dashmode >= 3*TICRATE && P_IsObjectOnGround(player->mo)) // Dash Mode can continue counting in the air, but will only activate on floor touch. - dashmodeflag = true; if (dashmode < 3*TICRATE) // Exits Dash Mode if you drop below speed/dash counter tics. Not in the above block so it doesn't keep disabling in midair. { - player->normalspeed = defspeed; // Reset to default if not capable of entering dash mode. - player->jumpfactor = 1*FRACUNIT; - dashmodeflag = false; + player->normalspeed = skins[player->skin].normalspeed; // Reset to default if not capable of entering dash mode. + player->jumpfactor = skins[player->skin].jumpfactor; } - - //WHEN PARAMETERS ARE MET, REWARD THE DASH MODE EFFECTS - if (dashmodeflag) + else if (P_IsObjectOnGround(player->mo)) // Activate dash mode if we're on the ground. { - if (player->normalspeed < maxtop) // If the player is not currently at 50 normalspeed in dash mode, add speed each tic - { + if (player->normalspeed < skins[player->skin].actionspd) // If the player normalspeed is not currently at actionspd in dash mode, add speed each tic player->normalspeed = player->normalspeed + 1*FRACUNIT/5; // Enter Dash Mode smoothly. - if (player->jumpfactor < 5*FRACUNIT/4) - player->jumpfactor = player->jumpfactor + 1*FRACUNIT/300; // Boosts his jumpheight. Remember fractions instead of decimals. "1.5*FRACUNIT = 3*FRACUNIT/2" - } + + if (player->jumpfactor < FixedMul(skins[player->skin].jumpfactor, 5*FRACUNIT/4)) // Boost jump height. + player->jumpfactor = player->jumpfactor + 1*FRACUNIT/300; } - - //COSMETIC STUPIDITY! - if (dashmode > 108) //Dash Mode will go down a tic a bit above activation, this makes dust spawn every other tic. - dashmode = 107; - - if (player->normalspeed >= maxtop) + + if (player->normalspeed >= skins[player->skin].actionspd) { mobj_t *ghost = P_SpawnGhostMobj(player->mo); // Spawns afterimages ghost->fuse = 2; // Makes the images fade quickly } +#undef dashmode } /* From c38af2c6a2751336da1512d9e3a15ec1e75c565e Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sat, 2 Jan 2016 23:26:22 -0600 Subject: [PATCH 009/562] Remove unused maxtop variable --- src/p_user.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 802e7f9c3..3b0d48628 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -9159,8 +9159,6 @@ void P_PlayerThink(player_t *player) if ((player->charability == CA_DASHMODE) && !(maptol & TOL_NIGHTS)) // woo, dashmode! no nights tho. { #define dashmode player->glidetime - fixed_t maxtop = skins[player->skin].normalspeed * 55/36; - if (player->speed >= FixedMul(skins[player->skin].normalspeed - 5*FRACUNIT, player->mo->scale) || (player->pflags & PF_STARTDASH)) { dashmode++; // Counter. Adds 1 to dash mode per tic in top speed. From 1f7e135ce587e68b29da7a8dcf3e2ce7b350911c Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Sun, 3 Jan 2016 19:11:27 -0800 Subject: [PATCH 010/562] Gold boxes are supposed to be 4 fracunits taller. To match their taller sprite. --- src/info.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/info.c b/src/info.c index af5126f3a..97a505399 100644 --- a/src/info.c +++ b/src/info.c @@ -6578,7 +6578,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_pop, // deathsound 0, // speed 16*FRACUNIT, // radius - 32*FRACUNIT, // height + 36*FRACUNIT, // height 0, // display offset 100, // mass MT_PITY_ICON, // damage @@ -6605,7 +6605,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_pop, // deathsound 0, // speed 16*FRACUNIT, // radius - 32*FRACUNIT, // height + 36*FRACUNIT, // height 0, // display offset 100, // mass MT_ATTRACT_ICON,// damage @@ -6632,7 +6632,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_pop, // deathsound 0, // speed 16*FRACUNIT, // radius - 32*FRACUNIT, // height + 36*FRACUNIT, // height 0, // display offset 100, // mass MT_FORCE_ICON, // damage @@ -6659,7 +6659,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_pop, // deathsound 0, // speed 16*FRACUNIT, // radius - 32*FRACUNIT, // height + 36*FRACUNIT, // height 0, // display offset 100, // mass MT_ARMAGEDDON_ICON, // damage @@ -6686,7 +6686,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_pop, // deathsound 0, // speed 16*FRACUNIT, // radius - 32*FRACUNIT, // height + 36*FRACUNIT, // height 0, // display offset 100, // mass MT_WHIRLWIND_ICON, // damage @@ -6713,7 +6713,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_pop, // deathsound 0, // speed 16*FRACUNIT, // radius - 32*FRACUNIT, // height + 36*FRACUNIT, // height 0, // display offset 100, // mass MT_ELEMENTAL_ICON, // damage @@ -6740,7 +6740,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_pop, // deathsound 0, // speed 16*FRACUNIT, // radius - 32*FRACUNIT, // height + 36*FRACUNIT, // height 0, // display offset 100, // mass MT_SNEAKERS_ICON, // damage @@ -6767,7 +6767,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_pop, // deathsound 0, // speed 16*FRACUNIT, // radius - 32*FRACUNIT, // height + 36*FRACUNIT, // height 0, // display offset 100, // mass MT_INVULN_ICON, // damage @@ -6794,7 +6794,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_pop, // deathsound 0, // speed 16*FRACUNIT, // radius - 32*FRACUNIT, // height + 36*FRACUNIT, // height 0, // display offset 100, // mass MT_GRAVITY_ICON, // damage From c1340b6e6cbad04cc14b466475801415e3c9f64c Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Wed, 6 Jan 2016 03:07:08 -0800 Subject: [PATCH 011/562] Most minor 1up icon bug fixed. 1up icons were spawning their overlays off sync with each other so the face icon was showing up during static. Now they don't. (They'd do this in 2.1 too if you have a custom WAD added that doesn't have an overlay sprite, and you use it in multiplayer alongside a character that does.) --- src/info.c | 6 +++--- src/p_enemy.c | 26 +++++++++++++++++++++----- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/info.c b/src/info.c index 97a505399..0d7a8b998 100644 --- a/src/info.c +++ b/src/info.c @@ -1268,7 +1268,7 @@ state_t states[NUMSTATES] = {SPR_TVEL, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_ELEMENTAL_BOX {SPR_TVSS, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_SNEAKERS_BOX {SPR_TVIV, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_INVULN_BOX - {SPR_TV1P, 0, 2, {A_1upThinker}, 0, 0, S_BOX_FLICKER}, // S_1UP_BOX + {SPR_TV1U, 0, 2, {A_1upThinker}, 0, 0, S_BOX_FLICKER}, // S_1UP_BOX {SPR_TVEG, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_EGGMAN_BOX {SPR_TVMX, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_MIXUP_BOX {SPR_TVGV, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_GRAVITY_BOX @@ -1353,11 +1353,11 @@ state_t states[NUMSTATES] = {SPR_TVIV, 5, 4, {NULL}, 0, 0, S_INVULN_ICON5}, // S_INVULN_ICON4 {SPR_TVIV, 2, 18, {A_Invincibility}, 0, 0, S_NULL}, // S_INVULN_ICON5 - {SPR_TV1P, 2, 4, {NULL}, 0, 0, S_1UP_ICON2}, // S_1UP_ICON1 + {SPR_TV1U, 2, 4, {NULL}, 0, 0, S_1UP_ICON2}, // S_1UP_ICON1 {SPR_TV1U, 3, 4, {NULL}, 0, 0, S_1UP_ICON3}, // S_1UP_ICON2 {SPR_TV1U, 4, 4, {NULL}, 0, 0, S_1UP_ICON4}, // S_1UP_ICON3 {SPR_TV1U, 5, 4, {NULL}, 0, 0, S_1UP_ICON5}, // S_1UP_ICON4 - {SPR_TV1P, 2, 18, {A_ExtraLife}, 0, 0, S_NULL}, // S_1UP_ICON5 + {SPR_TV1U, 2, 18, {A_ExtraLife}, 0, 0, S_NULL}, // S_1UP_ICON5 {SPR_TVEG, 2, 4, {NULL}, 0, 0, S_EGGMAN_ICON2}, // S_EGGMAN_ICON1 {SPR_TVEG, 3, 4, {NULL}, 0, 0, S_EGGMAN_ICON3}, // S_EGGMAN_ICON2 diff --git a/src/p_enemy.c b/src/p_enemy.c index ce957243c..7903e40cc 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -2541,7 +2541,6 @@ void A_1upThinker(mobj_t *actor) if (closestplayer == -1 || skins[players[closestplayer].skin].sprites[SPR2_LIFE].numframes == 0) { // Closest player not found (no players in game?? may be empty dedicated server!), or does not have correct sprite. - actor->sprite = SPR_TV1U; if (actor->tracer) { P_RemoveMobj(actor->tracer); actor->tracer = NULL; @@ -2549,11 +2548,19 @@ void A_1upThinker(mobj_t *actor) return; } + // We're using the overlay, so use the overlay 1up box (no text) + actor->sprite = SPR_TV1P; + if (!actor->tracer) { P_SetTarget(&actor->tracer, P_SpawnMobj(actor->x, actor->y, actor->z, MT_OVERLAY)); P_SetTarget(&actor->tracer->target, actor); P_SetMobjState(actor->tracer, actor->info->seestate); + + // The overlay is going to be one tic early turning off and on + // because it's going to get its thinker run the frame we spawned it. + // So make it take one tic longer if it just spawned. + ++actor->tracer->tics; } actor->tracer->color = players[closestplayer].mo->color; @@ -2621,7 +2628,7 @@ void A_MonitorPop(mobj_t *actor) || !newmobj->target->player || !newmobj->target->skin || ((skin_t *)newmobj->target->skin)->sprites[SPR2_LIFE].numframes == 0) - newmobj->sprite = SPR_TV1U; // No lives icon for this player, use the default. + {} // No lives icon for this player, use the default. else { // Spawn the lives icon. mobj_t *livesico = P_SpawnMobjFromMobj(newmobj, 0, 0, 0, MT_OVERLAY); @@ -2631,6 +2638,9 @@ void A_MonitorPop(mobj_t *actor) livesico->color = newmobj->target->player->mo->color; livesico->skin = &skins[newmobj->target->player->skin]; P_SetMobjState(livesico, newmobj->info->seestate); + + // We're using the overlay, so use the overlay 1up sprite (no text) + newmobj->sprite = SPR_TV1P; } } } @@ -2702,7 +2712,7 @@ void A_GoldMonitorPop(mobj_t *actor) || !newmobj->target->player || !newmobj->target->skin || ((skin_t *)newmobj->target->skin)->sprites[SPR2_LIFE].numframes == 0) - newmobj->sprite = SPR_TV1U; // No lives icon for this player, use the default. + {} // No lives icon for this player, use the default. else { // Spawn the lives icon. mobj_t *livesico = P_SpawnMobjFromMobj(newmobj, 0, 0, 0, MT_OVERLAY); @@ -2712,6 +2722,9 @@ void A_GoldMonitorPop(mobj_t *actor) livesico->color = newmobj->target->player->mo->color; livesico->skin = &skins[newmobj->target->player->skin]; P_SetMobjState(livesico, newmobj->info->seestate); + + // We're using the overlay, so use the overlay 1up sprite (no text) + newmobj->sprite = SPR_TV1P; } } } @@ -3241,8 +3254,11 @@ void A_ExtraLife(mobj_t *actor) player = actor->target->player; - if (actor->type == MT_1UP_ICON && !actor->tracer) - actor->sprite = SPR_TV1U; // No lives icon for this player, use the default. + if (actor->type == MT_1UP_ICON && actor->tracer) + { + // We're using the overlay, so use the overlay 1up sprite (no text) + actor->sprite = SPR_TV1P; + } if (ultimatemode) //I don't THINK so! { From 732003bcb97d9a5cd152f39f9e98493d285bbd9d Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 14 Jan 2016 17:11:16 +0000 Subject: [PATCH 012/562] Quick fixes for unsigned-signed compiler warnings probably not the most ideal way of doing this to be fair though --- src/dehacked.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 09da3ee6e..f3d1fa1bf 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -674,11 +674,11 @@ static void readfreeslots(MYFILE *f) else if (fastcmp(type, "SPR2")) { // Search if we already have an SPR2 by that name... - for (i = SPR2_FIRSTFREESLOT; i < free_spr2; i++) + for (i = SPR2_FIRSTFREESLOT; i < (int)free_spr2; i++) if (memcmp(spr2names[i],word,4) == 0) break; // We found it? (Two mods using the same SPR2 name?) Then don't allocate another one. - if (i < free_spr2) + if (i < (int)free_spr2) continue; // Copy in the spr2 name and increment free_spr2. if (free_spr2 < NUMPLAYERSPRITES) { @@ -8551,7 +8551,7 @@ static inline int lib_getenum(lua_State *L) } else if (fastncmp("SPR2_",word,4)) { p = word+5; - for (i = 0; i < free_spr2; i++) + for (i = 0; i < (fixed_t)free_spr2; i++) if (!spr2names[i][4]) { // special 3-char cases, e.g. SPR2_RUN From 95d6cba18405b5ce7f9224e1849b3f0751bc6f02 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Mon, 25 Jan 2016 01:49:37 -0600 Subject: [PATCH 013/562] [HACK] Make dashmode work again Fixed one of Red's mistakes, and used a different struct variable for dashmode. This needs to be changed though, because everything will break if someone loads a circuit map. --- src/p_user.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 3b0d48628..91bbfc6f2 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -9158,7 +9158,7 @@ void P_PlayerThink(player_t *player) // Dash mode ability for Metal Sonic if ((player->charability == CA_DASHMODE) && !(maptol & TOL_NIGHTS)) // woo, dashmode! no nights tho. { -#define dashmode player->glidetime +#define dashmode player->laps if (player->speed >= FixedMul(skins[player->skin].normalspeed - 5*FRACUNIT, player->mo->scale) || (player->pflags & PF_STARTDASH)) { dashmode++; // Counter. Adds 1 to dash mode per tic in top speed. @@ -9168,10 +9168,13 @@ void P_PlayerThink(player_t *player) else if (!(player->pflags & PF_SPINNING)) { if (dashmode > 3) - dashmode = dashmode - 3; // Rather than lose it all, it gently counts back down! + dashmode -= 3; // Rather than lose it all, it gently counts back down! else dashmode = 0; } + + if (dashmode > 254) + dashmode = 3*TICRATE+1; if (dashmode < 3*TICRATE) // Exits Dash Mode if you drop below speed/dash counter tics. Not in the above block so it doesn't keep disabling in midair. { From 67b92d727344ab66bb5e070a9d45e8e647942c87 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 25 Jan 2016 11:47:33 +0000 Subject: [PATCH 014/562] Went and fixed the dashmode variable hack nonsense once and for all myself would have gone for "dashtime", but then I was reminded that was already a name for something to do with spindash. Oh well --- src/d_clisrv.c | 2 ++ src/d_clisrv.h | 1 + src/d_player.h | 1 + src/lua_playerlib.c | 4 ++++ src/p_saveg.c | 2 ++ src/p_user.c | 11 ++++++----- 6 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 31738e9b2..ee2d18961 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -531,6 +531,7 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) rsp->deadtimer = players[i].deadtimer; rsp->exiting = (tic_t)LONG(players[i].exiting); rsp->homing = players[i].homing; + rsp->dashmode = (tic_t)LONG(players[i].dashmode); rsp->cmomx = (fixed_t)LONG(players[i].cmomx); rsp->cmomy = (fixed_t)LONG(players[i].cmomy); rsp->rmomx = (fixed_t)LONG(players[i].rmomx); @@ -656,6 +657,7 @@ static void resynch_read_player(resynch_pak *rsp) players[i].deadtimer = rsp->deadtimer; players[i].exiting = (tic_t)LONG(rsp->exiting); players[i].homing = rsp->homing; + players[i].dashmode = (tic_t)LONG(rsp->dashmode); players[i].cmomx = (fixed_t)LONG(rsp->cmomx); players[i].cmomy = (fixed_t)LONG(rsp->cmomy); players[i].rmomx = (fixed_t)LONG(rsp->rmomx); diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 6bc06f13a..2bcfad176 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -191,6 +191,7 @@ typedef struct INT32 deadtimer; tic_t exiting; UINT8 homing; + tic_t dashmode; fixed_t cmomx; fixed_t cmomy; fixed_t rmomx; diff --git a/src/d_player.h b/src/d_player.h index 08c98b7a3..a3acb8728 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -352,6 +352,7 @@ typedef struct player_s tic_t exiting; // Exitlevel timer UINT8 homing; // Are you homing? + tic_t dashmode; // counter for dashmode ability tic_t skidtime; // Skid timer diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 64513ab97..b03833354 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -202,6 +202,8 @@ static int player_get(lua_State *L) lua_pushinteger(L, plr->exiting); else if (fastcmp(field,"homing")) lua_pushinteger(L, plr->homing); + else if (fastcmp(field,"dashmode")) + lua_pushinteger(L, plr->dashmode); else if (fastcmp(field,"skidtime")) lua_pushinteger(L, plr->skidtime); else if (fastcmp(field,"cmomx")) @@ -452,6 +454,8 @@ static int player_set(lua_State *L) plr->exiting = (tic_t)luaL_checkinteger(L, 3); else if (fastcmp(field,"homing")) plr->homing = (UINT8)luaL_checkinteger(L, 3); + else if (fastcmp(field,"dashmode")) + plr->dashmode = (tic_t)luaL_checkinteger(L, 3); else if (fastcmp(field,"skidtime")) plr->skidtime = (tic_t)luaL_checkinteger(L, 3); else if (fastcmp(field,"cmomx")) diff --git a/src/p_saveg.c b/src/p_saveg.c index 07e7b3564..a574afb55 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -162,6 +162,7 @@ static inline void P_NetArchivePlayers(void) WRITEINT32(save_p, players[i].deadtimer); WRITEUINT32(save_p, players[i].exiting); WRITEUINT8(save_p, players[i].homing); + WRITEUINT32(save_p, players[i].dashmode); WRITEUINT32(save_p, players[i].skidtime); //////////////////////////// @@ -337,6 +338,7 @@ static inline void P_NetUnArchivePlayers(void) players[i].deadtimer = READINT32(save_p); // End game if game over lasts too long players[i].exiting = READUINT32(save_p); // Exitlevel timer players[i].homing = READUINT8(save_p); // Are you homing? + players[i].dashmode = READUINT32(save_p); // counter for dashmode ability players[i].skidtime = READUINT32(save_p); // Skid timer //////////////////////////// diff --git a/src/p_user.c b/src/p_user.c index 91bbfc6f2..8a6d8b871 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -9155,10 +9155,10 @@ void P_PlayerThink(player_t *player) player->pflags &= ~PF_SLIDING; +#define dashmode player->dashmode // Dash mode ability for Metal Sonic if ((player->charability == CA_DASHMODE) && !(maptol & TOL_NIGHTS)) // woo, dashmode! no nights tho. { -#define dashmode player->laps if (player->speed >= FixedMul(skins[player->skin].normalspeed - 5*FRACUNIT, player->mo->scale) || (player->pflags & PF_STARTDASH)) { dashmode++; // Counter. Adds 1 to dash mode per tic in top speed. @@ -9172,10 +9172,10 @@ void P_PlayerThink(player_t *player) else dashmode = 0; } - + if (dashmode > 254) dashmode = 3*TICRATE+1; - + if (dashmode < 3*TICRATE) // Exits Dash Mode if you drop below speed/dash counter tics. Not in the above block so it doesn't keep disabling in midair. { player->normalspeed = skins[player->skin].normalspeed; // Reset to default if not capable of entering dash mode. @@ -9195,9 +9195,10 @@ void P_PlayerThink(player_t *player) mobj_t *ghost = P_SpawnGhostMobj(player->mo); // Spawns afterimages ghost->fuse = 2; // Makes the images fade quickly } -#undef dashmode } - + else + dashmode = 0; +#undef dashmode /* // Colormap verification { From e314b442b2762d79df4f07d5a6da0ae0d6c6c57c Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Mon, 25 Jan 2016 20:26:31 -0600 Subject: [PATCH 015/562] Remove dashmode limit since tic_t is UINT32 This might be overpowered as hell. Needs testing for sure. --- src/p_user.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 8a6d8b871..3c86c3621 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -9173,9 +9173,6 @@ void P_PlayerThink(player_t *player) dashmode = 0; } - if (dashmode > 254) - dashmode = 3*TICRATE+1; - if (dashmode < 3*TICRATE) // Exits Dash Mode if you drop below speed/dash counter tics. Not in the above block so it doesn't keep disabling in midair. { player->normalspeed = skins[player->skin].normalspeed; // Reset to default if not capable of entering dash mode. From 24da82f02640dd55bc3e4f2d31ceb33357619dfc Mon Sep 17 00:00:00 2001 From: yellowtd Date: Sat, 16 Jan 2016 23:10:38 -0500 Subject: [PATCH 016/562] Begin work on OGL slope support unfinished --- src/hardware/hw_main.c | 210 ++++++++++++++++++++++++++++++++++------- 1 file changed, 175 insertions(+), 35 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 7d6caa049..63936b178 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -39,7 +39,9 @@ #include "../st_stuff.h" #include "../i_system.h" #include "../m_cheat.h" - +#ifdef ESLOPE +#include "../p_slopes.h" +#endif #include "hw_md2.h" #define R_FAKEFLOORS @@ -535,6 +537,9 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, fixed_t fi angle_t angle = 0; FSurfaceInfo Surf; fixed_t tempxsow, tempytow; +#ifdef ESLOPE + pslope_t *slope = NULL; +#endif static FOutVector *planeVerts = NULL; static UINT16 numAllocedPlaneVerts = 0; @@ -543,6 +548,30 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, fixed_t fi if (!xsub->planepoly) return; +#ifdef ESLOPE + // Get the slope pointer to simplify future code + if (sector) + { + // Yes this fixedheight check is needed again here + if (sector->f_slope && sector->floorheight == fixedheight) + slope = sector->f_slope; + else if (sector->c_slope && sector->ceilingheight == fixedheight) + slope = sector->c_slope; + } + else if (FOFsector) + { + // Yes this fixedheight check is needed again here + if (FOFsector->f_slope && FOFsector->floorheight == fixedheight) + slope = FOFsector->f_slope; + else if (FOFsector->c_slope && FOFsector->ceilingheight == fixedheight) + slope = FOFsector->c_slope; + } + + // Set fixedheight to the slope's height from our viewpoint, if we have a slope + if (slope) + fixedheight = P_GetZAt(slope, viewx, viewy); +#endif + height = FIXED_TO_FLOAT(fixedheight); pv = xsub->planepoly->pts; @@ -608,7 +637,12 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, fixed_t fi if (FOFsector != NULL) { +#ifdef ESLOPE + if ((slope && slope == FOFsector->f_slope) + || fixedheight == FOFsector->floorheight) // it's a floor +#else if (fixedheight == FOFsector->floorheight) // it's a floor +#endif { scrollx = FIXED_TO_FLOAT(FOFsector->floor_xoffs)/fflatsize; scrolly = FIXED_TO_FLOAT(FOFsector->floor_yoffs)/fflatsize; @@ -678,24 +712,13 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, fixed_t fi v3d->x = pv->x; v3d->y = height; v3d->z = pv->y; -#ifdef SLOPENESS - if (sector && sector->special == 65535) - { - size_t q; - for (q = 0; q < sector->linecount; q++) - { - if (v3d->x == sector->lines[q]->v1->x>>FRACBITS) - { - if (v3d->z == sector->lines[q]->v1->y>>FRACBITS) - { - v3d->y += sector->lines[q]->v1->z>>FRACBITS; - break; - } - } - } - } -#else - (void)sector; + +#ifdef ESLOPE + if (slope) + { + fixedheight = P_GetZAt(slope, FLOAT_TO_FIXED(pv->x), FLOAT_TO_FIXED(pv->y)); + v3d->y = FIXED_TO_FLOAT(fixedheight); + } #endif } @@ -714,6 +737,11 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, fixed_t fi { sector_t *psector = gr_frontsector; +#ifdef ESLOPE + if (slope) + fixedheight = P_GetZAt(slope, psector->soundorg.x, psector->soundorg.y); +#endif + if (psector->ffloors) { ffloor_t *caster = psector->lightlist[R_GetPlaneLight(psector, fixedheight, false)].caster; @@ -1321,6 +1349,11 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) fixed_t worldtop, worldbottom; fixed_t worldhigh = 0, worldlow = 0; +#ifdef ESLOPE + fixed_t worldtopslope, worldbottomslope; + fixed_t worldhighslope = 0, worldlowslope = 0; + fixed_t v1x, v1y, v2x, v2y; +#endif GLTexture_t *grTex = NULL; float cliplow = 0.0f, cliphigh = 0.0f; @@ -1337,22 +1370,56 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) gr_sidedef = gr_curline->sidedef; gr_linedef = gr_curline->linedef; - if (gr_frontsector->heightsec != -1) - { - worldtop = sectors[gr_frontsector->heightsec].ceilingheight; - worldbottom = sectors[gr_frontsector->heightsec].floorheight; - } - else - { - worldtop = gr_frontsector->ceilingheight; - worldbottom = gr_frontsector->floorheight; - } - vs.x = ((polyvertex_t *)gr_curline->v1)->x; vs.y = ((polyvertex_t *)gr_curline->v1)->y; ve.x = ((polyvertex_t *)gr_curline->v2)->x; ve.y = ((polyvertex_t *)gr_curline->v2)->y; +#ifdef ESLOPE + v1x = FLOAT_TO_FIXED(vs.x); + v1y = FLOAT_TO_FIXED(vs.y); + v2x = FLOAT_TO_FIXED(ve.x); + v2y = FLOAT_TO_FIXED(ve.y); +#endif + + if (gr_frontsector->heightsec != -1) + { +#ifdef ESLOPE + worldtop = worldtopslope = sectors[gr_frontsector->heightsec].ceilingheight; + worldbottom = worldbottomslope = sectors[gr_frontsector->heightsec].floorheight; +#else + worldtop = sectors[gr_frontsector->heightsec].ceilingheight; + worldbottom = sectors[gr_frontsector->heightsec].floorheight; +#endif + } + else + { +#ifdef ESLOPE + if (gr_frontsector->c_slope) + { + worldtop = P_GetZAt(gr_frontsector->c_slope, v1x, v1y); + worldtopslope = P_GetZAt(gr_frontsector->c_slope, v2x, v2y); + } + else + { + worldtop = worldtopslope = gr_frontsector->ceilingheight; + } + + if (gr_frontsector->f_slope) + { + worldbottom = P_GetZAt(gr_frontsector->f_slope, v1x, v1y); + worldbottomslope = P_GetZAt(gr_frontsector->f_slope, v2x, v2y); + } + else + { + worldbottom = worldbottomslope = gr_frontsector->floorheight; + } +#else + worldtop = gr_frontsector->ceilingheight; + worldbottom = gr_frontsector->floorheight; +#endif + } + // remember vertices ordering // 3--2 // | /| @@ -1396,13 +1463,40 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) // two sided line if (gr_backsector->heightsec != -1) { +#ifdef ESLOPE + worldhigh = worldhighslope = sectors[gr_backsector->heightsec].ceilingheight; + worldlow = worldlowslope = sectors[gr_backsector->heightsec].floorheight; +#else worldhigh = sectors[gr_backsector->heightsec].ceilingheight; worldlow = sectors[gr_backsector->heightsec].floorheight; +#endif } else { +#ifdef ESLOPE + if (gr_backsector->c_slope) + { + worldhigh = P_GetZAt(gr_backsector->c_slope, v1x, v1y); + worldhighslope = P_GetZAt(gr_backsector->c_slope, v2x, v2y); + } + else + { + worldhigh = worldhighslope = gr_backsector->ceilingheight; + } + + if (gr_backsector->f_slope) + { + worldlow = P_GetZAt(gr_backsector->f_slope, v1x, v1y); + worldlowslope = P_GetZAt(gr_backsector->f_slope, v2x, v2y); + } + else + { + worldlow = worldlowslope = gr_backsector->floorheight; + } +#else worldhigh = gr_backsector->ceilingheight; worldlow = gr_backsector->floorheight; +#endif } // hack to allow height changes in outdoor areas @@ -1411,10 +1505,18 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) gr_backsector->ceilingpic == skyflatnum) { worldtop = worldhigh; +#ifdef ESLOPE + worldtopslope = worldhighslope; +#endif } // check TOP TEXTURE - if (worldhigh < worldtop && texturetranslation[gr_sidedef->toptexture]) + if (( +#ifdef ESLOPE + worldhighslope < worldtopslope || +#endif + worldhigh < worldtop + ) && texturetranslation[gr_sidedef->toptexture]) { if (drawtextured) { @@ -1425,8 +1527,15 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) // PEGGING if (gr_linedef->flags & ML_DONTPEGTOP) texturevpegtop = 0; - else +#ifdef ESLOPE + else if (gr_linedef->flags & ML_EFFECT1) texturevpegtop = worldhigh + textureheight[gr_sidedef->toptexture] - worldtop; + else + texturevpegtop = gr_backsector->ceilingheight + textureheight[gr_sidedef->toptexture] - gr_frontsector->ceilingheight; +#else + else + texturevpegtop = worldhigh + textureheight[gr_sidedef->toptexture] - worldtop; +#endif texturevpegtop += gr_sidedef->rowoffset; @@ -1434,14 +1543,34 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) texturevpegtop %= SHORT(textures[texturetranslation[gr_sidedef->toptexture]]->height)<scaleY; - wallVerts[0].t = wallVerts[1].t = (texturevpegtop + worldtop - worldhigh) * grTex->scaleY; + wallVerts[0].t = wallVerts[1].t = (texturevpegtop + gr_frontsector->ceilingheight - gr_backsector->ceilingheight) * grTex->scaleY; wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX; wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; + +#ifdef ESLOPE + // Adjust t value for sloped walls + if (!(gr_linedef->flags & ML_EFFECT1)) + { + // Unskewed + wallVerts[3].t += worldtop - gr_frontsector->ceilingheight; + wallVerts[2].t += worldtopslope - gr_frontsector->ceilingheight; + wallVerts[0].t += worldhigh - gr_backsector->ceilingheight; + wallVerts[1].t += worldhighslope - gr_backsector->ceilingheight; + } + +#endif } // set top/bottom coords +#ifdef ESLOPE + wallVerts[3].y = FIXED_TO_FLOAT(worldtop); + wallVerts[0].y = FIXED_TO_FLOAT(worldhigh); + wallVerts[2].y = FIXED_TO_FLOAT(worldtopslope); + wallVerts[1].y = FIXED_TO_FLOAT(worldhighslope); +#else wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(worldtop); wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(worldhigh); +#endif if (gr_frontsector->numlights) HWR_SplitWall(gr_frontsector, wallVerts, texturetranslation[gr_sidedef->toptexture], &Surf, FF_CUTSOLIDS); @@ -1452,7 +1581,11 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) } // check BOTTOM TEXTURE - if (worldlow > worldbottom && texturetranslation[gr_sidedef->bottomtexture]) //only if VISIBLE!!! + if (( +#ifdef ESLOPE + worldlowslope > worldbottomslope || +#endif + worldlow > worldbottom) && texturetranslation[gr_sidedef->bottomtexture]) //only if VISIBLE!!! { if (drawtextured) { @@ -1478,8 +1611,15 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) } // set top/bottom coords +#ifdef ESLOPE + wallVerts[3].y = FIXED_TO_FLOAT(worldlow); + wallVerts[0].y = FIXED_TO_FLOAT(worldbottom); + wallVerts[2].y = FIXED_TO_FLOAT(worldlowslope); + wallVerts[1].y = FIXED_TO_FLOAT(worldbottomslope); +#else wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(worldlow); wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(worldbottom); +#endif if (gr_frontsector->numlights) HWR_SplitWall(gr_frontsector, wallVerts, texturetranslation[gr_sidedef->bottomtexture], &Surf, FF_CUTSOLIDS); @@ -4544,7 +4684,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) + if (tz < ZCLIP_PLANE && md2_models[thing->sprite].notfound == true) //Yellow: Only MD2's dont disappear return; tx = (tr_x * gr_viewsin) - (tr_y * gr_viewcos); From 52ae3f2875220d67301c203814b704014f8f8131 Mon Sep 17 00:00:00 2001 From: yellowtd Date: Sun, 24 Jan 2016 03:41:30 -0500 Subject: [PATCH 017/562] GL slope walls and fixed plane culling --- src/hardware/hw_main.c | 173 +++++++++++++++++++++++++++++++++-------- 1 file changed, 139 insertions(+), 34 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 63936b178..34223457f 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -521,7 +521,7 @@ static UINT8 HWR_FogBlockAlpha(INT32 light, UINT32 color, UINT32 fadecolor) // L // -----------------+ // HWR_RenderPlane : Render a floor or ceiling convex polygon // -----------------+ -static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, fixed_t fixedheight, +static void HWR_RenderPlane(sector_t *shittyUnusedVariable, extrasubsector_t *xsub, fixed_t fixedheight, FBITFIELD PolyFlags, INT32 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, boolean fogplane, extracolormap_t *planecolormap) { polyvertex_t * pv; @@ -550,22 +550,21 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, fixed_t fi #ifdef ESLOPE // Get the slope pointer to simplify future code - if (sector) + if (FOFsector) { - // Yes this fixedheight check is needed again here - if (sector->f_slope && sector->floorheight == fixedheight) - slope = sector->f_slope; - else if (sector->c_slope && sector->ceilingheight == fixedheight) - slope = sector->c_slope; - } - else if (FOFsector) - { - // Yes this fixedheight check is needed again here if (FOFsector->f_slope && FOFsector->floorheight == fixedheight) slope = FOFsector->f_slope; else if (FOFsector->c_slope && FOFsector->ceilingheight == fixedheight) slope = FOFsector->c_slope; } + else + { + // Use fixedheight to determine whether to check floor or ceiling because I hate my life + if (gr_frontsector->f_slope && gr_frontsector->floorheight == fixedheight) + slope = gr_frontsector->f_slope; + else if (gr_frontsector->c_slope && gr_frontsector->ceilingheight == fixedheight) + slope = gr_frontsector->c_slope; + } // Set fixedheight to the slope's height from our viewpoint, if we have a slope if (slope) @@ -657,7 +656,12 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, fixed_t fi } else if (gr_frontsector) { +#ifdef ESLOPE + if ((slope && slope == gr_frontsector->f_slope) + || fixedheight == gr_frontsector->floorheight) // it's a floor +#else if (fixedheight < dup_viewz) // it's a floor +#endif { scrollx = FIXED_TO_FLOAT(gr_frontsector->floor_xoffs)/fflatsize; scrolly = FIXED_TO_FLOAT(gr_frontsector->floor_yoffs)/fflatsize; @@ -1552,12 +1556,24 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) if (!(gr_linedef->flags & ML_EFFECT1)) { // Unskewed - wallVerts[3].t += worldtop - gr_frontsector->ceilingheight; - wallVerts[2].t += worldtopslope - gr_frontsector->ceilingheight; - wallVerts[0].t += worldhigh - gr_backsector->ceilingheight; - wallVerts[1].t += worldhighslope - gr_backsector->ceilingheight; + wallVerts[3].t -= (worldtop - gr_frontsector->ceilingheight) * grTex->scaleY; + wallVerts[2].t -= (worldtopslope - gr_frontsector->ceilingheight) * grTex->scaleY; + wallVerts[0].t -= (worldhigh - gr_backsector->ceilingheight) * grTex->scaleY; + wallVerts[1].t -= (worldhighslope - gr_backsector->ceilingheight) * grTex->scaleY; + } + else if (gr_linedef->flags & ML_DONTPEGTOP) + { + // Skewed by top + wallVerts[0].t = (texturevpegtop + worldtop - worldhigh) * grTex->scaleY; + wallVerts[1].t = (texturevpegtop + worldtopslope - worldhighslope) * grTex->scaleY; + } + else + { + // Skewed by bottom + wallVerts[0].t = (texturevpegtop + worldhigh - worldtop) * grTex->scaleY; + wallVerts[2].t = wallVerts[3].t - (worldhighslope - worldhigh) * grTex->scaleY; + wallVerts[1].t = wallVerts[2].t - (worldhighslope - worldtopslope) * grTex->scaleY; } - #endif } @@ -1594,10 +1610,19 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) grTex = HWR_GetTexture(texturetranslation[gr_sidedef->bottomtexture]); // PEGGING - if (gr_linedef->flags & ML_DONTPEGBOTTOM) +#ifdef ESLOPE + if (!(gr_linedef->flags & ML_DONTPEGBOTTOM)) + texturevpegbottom = 0; + else if (gr_linedef->flags & ML_EFFECT1) texturevpegbottom = worldtop - worldlow; else - texturevpegbottom = 0; + texturevpegbottom = gr_frontsector->ceilingheight - gr_backsector->floorheight; +#else + if (gr_linedef->flags & ML_DONTPEGBOTTOM) + texturevpegbottom = worldtop - worldlow; + else + texturevpegbottom = 0; +#endif texturevpegbottom += gr_sidedef->rowoffset; @@ -1605,9 +1630,34 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) texturevpegbottom %= SHORT(textures[texturetranslation[gr_sidedef->bottomtexture]]->height)<scaleY; - wallVerts[0].t = wallVerts[1].t = (texturevpegbottom + worldlow - worldbottom) * grTex->scaleY; + wallVerts[0].t = wallVerts[1].t = (texturevpegbottom + gr_backsector->floorheight - gr_frontsector->floorheight) * grTex->scaleY; wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX; wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; + +#ifdef ESLOPE + // Adjust t value for sloped walls + if (!(gr_linedef->flags & ML_EFFECT1)) + { + // Unskewed + wallVerts[0].t -= (worldbottom - gr_frontsector->floorheight) * grTex->scaleY; + wallVerts[1].t -= (worldbottomslope - gr_frontsector->floorheight) * grTex->scaleY; + wallVerts[3].t -= (worldlow - gr_backsector->floorheight) * grTex->scaleY; + wallVerts[2].t -= (worldlowslope - gr_backsector->floorheight) * grTex->scaleY; + } + else if (gr_linedef->flags & ML_DONTPEGBOTTOM) + { + // Skewed by bottom + wallVerts[0].t = (texturevpegbottom + worldlow - worldbottom) * grTex->scaleY; + wallVerts[2].t = wallVerts[3].t - (worldlowslope - worldlow) * grTex->scaleY; + wallVerts[1].t = wallVerts[2].t - (worldbottomslope - worldlowslope) * grTex->scaleY; + } + else + { + // Skewed by top + wallVerts[0].t = (texturevpegbottom + worldlow - worldbottom) * grTex->scaleY; + wallVerts[1].t = (texturevpegbottom + worldlowslope - worldbottomslope) * grTex->scaleY; + } +#endif } // set top/bottom coords @@ -1925,6 +1975,11 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) { fixed_t texturevpeg; // PEGGING +#ifdef ESLOPE + if ((gr_linedef->flags & (ML_DONTPEGBOTTOM|ML_EFFECT2)) == (ML_DONTPEGBOTTOM|ML_EFFECT2)) + texturevpeg = gr_frontsector->floorheight + textureheight[gr_sidedef->midtexture] - gr_frontsector->ceilingheight + gr_sidedef->rowoffset; + else +#endif if (gr_linedef->flags & ML_DONTPEGBOTTOM) texturevpeg = worldbottom + textureheight[gr_sidedef->midtexture] - worldtop + gr_sidedef->rowoffset; else @@ -1934,14 +1989,38 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) grTex = HWR_GetTexture(gr_midtexture); wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY; - wallVerts[0].t = wallVerts[1].t = (texturevpeg + worldtop - worldbottom) * grTex->scaleY; + wallVerts[0].t = wallVerts[1].t = (texturevpeg + gr_frontsector->ceilingheight - gr_frontsector->floorheight) * grTex->scaleY; wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX; wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; + +#ifdef ESLOPE + // Texture correction for slopes + if (gr_linedef->flags & ML_EFFECT2) { + wallVerts[3].t += (gr_frontsector->ceilingheight - worldtop) * grTex->scaleY; + wallVerts[2].t += (gr_frontsector->ceilingheight - worldtopslope) * grTex->scaleY; + wallVerts[0].t += (gr_frontsector->floorheight - worldbottom) * grTex->scaleY; + wallVerts[1].t += (gr_frontsector->floorheight - worldbottomslope) * grTex->scaleY; + } else if (gr_linedef->flags & ML_DONTPEGBOTTOM) { + wallVerts[3].t = wallVerts[0].t + (worldbottom-worldtop) * grTex->scaleY; + wallVerts[2].t = wallVerts[1].t + (worldbottomslope-worldtopslope) * grTex->scaleY; + } else { + wallVerts[0].t = wallVerts[3].t - (worldbottom-worldtop) * grTex->scaleY; + wallVerts[1].t = wallVerts[2].t - (worldbottomslope-worldtopslope) * grTex->scaleY; + } +#endif } +#ifdef ESLOPE + //Set textures properly on single sided walls that are sloped + wallVerts[3].y = FIXED_TO_FLOAT(worldtop); + wallVerts[0].y = FIXED_TO_FLOAT(worldbottom); + wallVerts[2].y = FIXED_TO_FLOAT(worldtopslope); + wallVerts[1].y = FIXED_TO_FLOAT(worldbottomslope); + +#else // set top/bottom coords wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(worldtop); wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(worldbottom); - +#endif // I don't think that solid walls can use translucent linedef types... if (gr_frontsector->numlights) HWR_SplitWall(gr_frontsector, wallVerts, gr_midtexture, &Surf, FF_CUTSOLIDS); @@ -1974,6 +2053,8 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) INT32 texnum; line_t * newline = NULL; // Multi-Property FOF + ///TODO add slope support (fixing cutoffs, proper wall clipping) - maybe just disable highcut/lowcut if either sector or FOF has a slope + /// to allow fun plane intersecting in OGL? But then people would abuse that and make software look bad. :C highcut = gr_frontsector->ceilingheight < gr_backsector->ceilingheight ? gr_frontsector->ceilingheight : gr_backsector->ceilingheight; lowcut = gr_frontsector->floorheight > gr_backsector->floorheight ? gr_frontsector->floorheight : gr_backsector->floorheight; @@ -3006,6 +3087,7 @@ static void HWR_Subsector(size_t num) INT32 floorlightlevel; INT32 ceilinglightlevel; INT32 locFloorHeight, locCeilingHeight; + INT32 cullFloorHeight, cullCeilingHeight; INT32 light = 0; fixed_t wh; extracolormap_t *floorcolormap; @@ -3063,26 +3145,41 @@ static void HWR_Subsector(size_t num) // ----- for special tricks with HW renderer ----- if (gr_frontsector->pseudoSector) { - locFloorHeight = gr_frontsector->virtualFloorheight; - locCeilingHeight = gr_frontsector->virtualCeilingheight; + cullFloorHeight = locFloorHeight = gr_frontsector->virtualFloorheight; + cullCeilingHeight = locCeilingHeight = gr_frontsector->virtualCeilingheight; } else if (gr_frontsector->virtualFloor) { - locFloorHeight = gr_frontsector->virtualFloorheight; + ///@TODO Is this whole virtualFloor mess even useful? I don't think it even triggers ever. + cullFloorHeight = locFloorHeight = gr_frontsector->virtualFloorheight; if (gr_frontsector->virtualCeiling) - locCeilingHeight = gr_frontsector->virtualCeilingheight; + cullCeilingHeight = locCeilingHeight = gr_frontsector->virtualCeilingheight; else - locCeilingHeight = gr_frontsector->ceilingheight; + cullCeilingHeight = locCeilingHeight = gr_frontsector->ceilingheight; } else if (gr_frontsector->virtualCeiling) { - locCeilingHeight = gr_frontsector->virtualCeilingheight; - locFloorHeight = gr_frontsector->floorheight; + cullCeilingHeight = locCeilingHeight = gr_frontsector->virtualCeilingheight; + cullFloorHeight = locFloorHeight = gr_frontsector->floorheight; } else { - locFloorHeight = gr_frontsector->floorheight; - locCeilingHeight = gr_frontsector->ceilingheight; + cullFloorHeight = locFloorHeight = gr_frontsector->floorheight; + cullCeilingHeight = locCeilingHeight = gr_frontsector->ceilingheight; + +#ifdef ESLOPE + if (gr_frontsector->f_slope) + { + cullFloorHeight = P_GetZAt(gr_frontsector->f_slope, viewx, viewy); + locFloorHeight = P_GetZAt(gr_frontsector->f_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y); + } + + if (gr_frontsector->c_slope) + { + cullCeilingHeight = P_GetZAt(gr_frontsector->c_slope, viewx, viewy); + locCeilingHeight = P_GetZAt(gr_frontsector->c_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y); + } +#endif } // ----- end special tricks ----- @@ -3113,14 +3210,18 @@ static void HWR_Subsector(size_t num) // render floor ? #ifdef DOPLANES // yeah, easy backface cull! :) - if (locFloorHeight < dup_viewz) + if (cullFloorHeight < dup_viewz) { if (gr_frontsector->floorpic != skyflatnum) { if (sub->validcount != validcount) { HWR_GetFlat(levelflats[gr_frontsector->floorpic].lumpnum); - HWR_RenderPlane(gr_frontsector, &extrasubsectors[num], locFloorHeight, PF_Occlude, floorlightlevel, levelflats[gr_frontsector->floorpic].lumpnum, NULL, 255, false, floorcolormap); + HWR_RenderPlane(gr_frontsector, &extrasubsectors[num], + // Hack to make things continue to work around slopes. + locFloorHeight == cullFloorHeight ? locFloorHeight : gr_frontsector->floorheight, + // We now return you to your regularly scheduled rendering. + PF_Occlude, floorlightlevel, levelflats[gr_frontsector->floorpic].lumpnum, NULL, 255, false, floorcolormap); } } else @@ -3131,14 +3232,18 @@ static void HWR_Subsector(size_t num) } } - if (locCeilingHeight > dup_viewz) + if (cullCeilingHeight > dup_viewz) { if (gr_frontsector->ceilingpic != skyflatnum) { if (sub->validcount != validcount) { HWR_GetFlat(levelflats[gr_frontsector->ceilingpic].lumpnum); - HWR_RenderPlane(NULL, &extrasubsectors[num], locCeilingHeight, PF_Occlude, ceilinglightlevel, levelflats[gr_frontsector->ceilingpic].lumpnum,NULL, 255, false, ceilingcolormap); + HWR_RenderPlane(NULL, &extrasubsectors[num], + // Hack to make things continue to work around slopes. + locCeilingHeight == cullCeilingHeight ? locCeilingHeight : gr_frontsector->ceilingheight, + // We now return you to your regularly scheduled rendering. + PF_Occlude, ceilinglightlevel, levelflats[gr_frontsector->ceilingpic].lumpnum,NULL, 255, false, ceilingcolormap); } } else From e6235d4d6bddead7804facc24b2616e6f6404964 Mon Sep 17 00:00:00 2001 From: yellowtd Date: Mon, 25 Jan 2016 00:57:53 -0500 Subject: [PATCH 018/562] Fix FOF slope rendering in ogl should work as well as software if not better now --- src/hardware/hw_main.c | 107 +++++++++++++++++++++++++++++++++++------ 1 file changed, 92 insertions(+), 15 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 34223457f..5cd3b5931 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -1363,6 +1363,9 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) float cliplow = 0.0f, cliphigh = 0.0f; INT32 gr_midtexture; fixed_t h, l; // 3D sides and 2s middle textures +#ifdef ESLOPE + fixed_t hS, lS; +#endif FUINT lightnum = 0; // shut up compiler extracolormap_t *colormap; @@ -2076,6 +2079,26 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) texnum = texturetranslation[sides[newline->sidenum[0]].midtexture]; } +#ifdef ESLOPE + h = *rover->t_slope ? P_GetZAt(*rover->t_slope, v1x, v1y) : *rover->topheight; + hS = *rover->t_slope ? P_GetZAt(*rover->t_slope, v2x, v2y) : *rover->topheight; + l = *rover->b_slope ? P_GetZAt(*rover->b_slope, v1x, v1y) : *rover->bottomheight; + lS = *rover->b_slope ? P_GetZAt(*rover->b_slope, v2x, v2y) : *rover->bottomheight; + if (!(*rover->t_slope) && !gr_frontsector->c_slope && !gr_backsector->c_slope && h > highcut) + h = hS = highcut; + if (!(*rover->b_slope) && !gr_frontsector->f_slope && !gr_backsector->f_slope && l < lowcut) + l = lS = lowcut; + //Hurdler: HW code starts here + //FIXME: check if peging is correct + // set top/bottom coords + + wallVerts[3].y = FIXED_TO_FLOAT(h); + wallVerts[2].y = FIXED_TO_FLOAT(hS); + wallVerts[0].y = FIXED_TO_FLOAT(l); + wallVerts[1].y = FIXED_TO_FLOAT(lS); + + +#else h = *rover->topheight; l = *rover->bottomheight; if (h > highcut) @@ -2087,6 +2110,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) // set top/bottom coords wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(h); wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(l); +#endif if (rover->flags & FF_FOG) { wallVerts[3].t = wallVerts[2].t = 0; @@ -2096,6 +2120,15 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) } else if (drawtextured) { +#ifdef ESLOPE // P.S. this is better-organized than the old version + fixed_t offs = sides[(newline ?: rover->master)->sidenum[0]].rowoffset; + grTex = HWR_GetTexture(texnum); + + wallVerts[3].t = (*rover->topheight - h + offs) * grTex->scaleY; + wallVerts[2].t = (*rover->topheight - hS + offs) * grTex->scaleY; + wallVerts[0].t = (*rover->topheight - l + offs) * grTex->scaleY; + wallVerts[1].t = (*rover->topheight - lS + offs) * grTex->scaleY; +#else grTex = HWR_GetTexture(texnum); if (newline) @@ -2108,6 +2141,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) wallVerts[3].t = wallVerts[2].t = (*rover->topheight - h + sides[rover->master->sidenum[0]].rowoffset) * grTex->scaleY; wallVerts[0].t = wallVerts[1].t = (h - l + (*rover->topheight - h + sides[rover->master->sidenum[0]].rowoffset)) * grTex->scaleY; } +#endif wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX; wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; @@ -2180,7 +2214,26 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) newline = rover->master->frontsector->lines[0] + linenum; texnum = texturetranslation[sides[newline->sidenum[0]].midtexture]; } +#ifdef ESLOPE //backsides + h = *rover->t_slope ? P_GetZAt(*rover->t_slope, v1x, v1y) : *rover->topheight; + hS = *rover->t_slope ? P_GetZAt(*rover->t_slope, v2x, v2y) : *rover->topheight; + l = *rover->b_slope ? P_GetZAt(*rover->b_slope, v1x, v1y) : *rover->bottomheight; + lS = *rover->b_slope ? P_GetZAt(*rover->b_slope, v2x, v2y) : *rover->bottomheight; + if (!(*rover->t_slope) && !gr_frontsector->c_slope && !gr_backsector->c_slope && h > highcut) + h = hS = highcut; + if (!(*rover->b_slope) && !gr_frontsector->f_slope && !gr_backsector->f_slope && l < lowcut) + l = lS = lowcut; + //Hurdler: HW code starts here + //FIXME: check if peging is correct + // set top/bottom coords + wallVerts[3].y = FIXED_TO_FLOAT(h); + wallVerts[2].y = FIXED_TO_FLOAT(hS); + wallVerts[0].y = FIXED_TO_FLOAT(l); + wallVerts[1].y = FIXED_TO_FLOAT(lS); + + +#else h = *rover->topheight; l = *rover->bottomheight; if (h > highcut) @@ -2192,7 +2245,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) // set top/bottom coords wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(h); wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(l); - +#endif if (rover->flags & FF_FOG) { wallVerts[3].t = wallVerts[2].t = 0; @@ -3272,22 +3325,34 @@ static void HWR_Subsector(size_t num) for (rover = gr_frontsector->ffloors; rover; rover = rover->next) { + fixed_t cullHeight, centerHeight; + + // bottom plane +#ifdef ESLOPE + if (*rover->b_slope) + { + cullHeight = P_GetZAt(*rover->b_slope, viewx, viewy); + centerHeight = P_GetZAt(*rover->b_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y); + } + else +#endif + cullHeight = centerHeight = *rover->bottomheight; if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERPLANES)) continue; if (sub->validcount == validcount) continue; - if (*rover->bottomheight <= gr_frontsector->ceilingheight && - *rover->bottomheight >= gr_frontsector->floorheight && - ((dup_viewz < *rover->bottomheight && !(rover->flags & FF_INVERTPLANES)) || - (dup_viewz > *rover->bottomheight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES)))) + if (centerHeight <= locCeilingHeight && + centerHeight >= locFloorHeight && + ((dup_viewz < cullHeight && !(rover->flags & FF_INVERTPLANES)) || + (dup_viewz > cullHeight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES)))) { if (rover->flags & FF_FOG) { UINT8 alpha; - light = R_GetPlaneLight(gr_frontsector, *rover->bottomheight, dup_viewz < *rover->bottomheight ? true : false); + light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); if (rover->master->frontsector->extra_colormap) alpha = HWR_FogBlockAlpha(*gr_frontsector->lightlist[light].lightlevel, rover->master->frontsector->extra_colormap->rgba, rover->master->frontsector->extra_colormap->fadergba); @@ -3303,7 +3368,7 @@ static void HWR_Subsector(size_t num) } else if (rover->flags & FF_TRANSLUCENT) // SoM: Flags are more efficient { - light = R_GetPlaneLight(gr_frontsector, *rover->bottomheight, dup_viewz < *rover->bottomheight ? true : false); + light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); #ifndef SORTING HWR_Add3DWater(levelflats[*rover->bottompic].lumpnum, &extrasubsectors[num], @@ -3322,21 +3387,33 @@ static void HWR_Subsector(size_t num) else { HWR_GetFlat(levelflats[*rover->bottompic].lumpnum); - light = R_GetPlaneLight(gr_frontsector, *rover->bottomheight, dup_viewz < *rover->bottomheight ? true : false); + light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); HWR_RenderPlane(NULL, &extrasubsectors[num], *rover->bottomheight, PF_Occlude, *gr_frontsector->lightlist[light].lightlevel, levelflats[*rover->bottompic].lumpnum, rover->master->frontsector, 255, false, gr_frontsector->lightlist[light].extra_colormap); } } - if (*rover->topheight >= gr_frontsector->floorheight && - *rover->topheight <= gr_frontsector->ceilingheight && - ((dup_viewz > *rover->topheight && !(rover->flags & FF_INVERTPLANES)) || - (dup_viewz < *rover->topheight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES)))) + + // top plane +#ifdef ESLOPE + if (*rover->t_slope) + { + cullHeight = P_GetZAt(*rover->t_slope, viewx, viewy); + centerHeight = P_GetZAt(*rover->t_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y); + } + else +#endif + cullHeight = centerHeight = *rover->topheight; + + if (centerHeight >= locFloorHeight && + centerHeight <= locCeilingHeight && + ((dup_viewz > cullHeight && !(rover->flags & FF_INVERTPLANES)) || + (dup_viewz < cullHeight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES)))) { if (rover->flags & FF_FOG) { UINT8 alpha; - light = R_GetPlaneLight(gr_frontsector, *rover->topheight, dup_viewz < *rover->topheight ? true : false); + light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); if (rover->master->frontsector->extra_colormap) alpha = HWR_FogBlockAlpha(*gr_frontsector->lightlist[light].lightlevel, rover->master->frontsector->extra_colormap->rgba, rover->master->frontsector->extra_colormap->fadergba); @@ -3352,7 +3429,7 @@ static void HWR_Subsector(size_t num) } else if (rover->flags & FF_TRANSLUCENT) { - light = R_GetPlaneLight(gr_frontsector, *rover->topheight, dup_viewz < *rover->topheight ? true : false); + light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); #ifndef SORTING HWR_Add3DWater(levelflats[*rover->toppic].lumpnum, &extrasubsectors[num], @@ -3372,7 +3449,7 @@ static void HWR_Subsector(size_t num) else { HWR_GetFlat(levelflats[*rover->toppic].lumpnum); - light = R_GetPlaneLight(gr_frontsector, *rover->topheight, dup_viewz < *rover->topheight ? true : false); + light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); HWR_RenderPlane(NULL, &extrasubsectors[num], *rover->topheight, PF_Occlude, *gr_frontsector->lightlist[light].lightlevel, levelflats[*rover->toppic].lumpnum, rover->master->frontsector, 255, false, gr_frontsector->lightlist[light].extra_colormap); } From b3fbc37c943201e85212b145427ee17dde96e941 Mon Sep 17 00:00:00 2001 From: yellowtd Date: Wed, 27 Jan 2016 01:00:15 -0500 Subject: [PATCH 019/562] Midtextures, lights, and culling fixes for ogl slopes There's a weird issue with lights that's hard to diagnose but otherwise this is ready to go I think --- src/hardware/hw_main.c | 203 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 185 insertions(+), 18 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 5cd3b5931..52be99219 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -1082,23 +1082,47 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum, lightlist. This may also include leaving out parts of the wall that can't be seen */ GLTexture_t * glTex; + float realtop, realbot, top, bot; float pegt, pegb, pegmul; float height = 0.0f, bheight = 0.0f; + +#ifdef ESLOPE + float endrealtop, endrealbot, endtop, endbot; + float endpegt, endpegb, endpegmul; + float endheight = 0.0f, endbheight = 0.0f; + + fixed_t v1x = FLOAT_TO_FIXED(wallVerts[0].x); + fixed_t v1y = FLOAT_TO_FIXED(wallVerts[0].y); + fixed_t v2x = FLOAT_TO_FIXED(wallVerts[1].x); + fixed_t v2y = FLOAT_TO_FIXED(wallVerts[1].y); +#endif + INT32 solid, i; lightlist_t * list = sector->lightlist; const UINT8 alpha = Surf->FlatColor.s.alpha; FUINT lightnum; extracolormap_t *colormap; - realtop = top = wallVerts[2].y; + realtop = top = wallVerts[3].y; realbot = bot = wallVerts[0].y; - pegt = wallVerts[2].t; + pegt = wallVerts[3].t; pegb = wallVerts[0].t; pegmul = (pegb - pegt) / (top - bot); +#ifdef ESLOPE + endrealtop = endtop = wallVerts[2].y; + endrealbot = endbot = wallVerts[1].y; + endpegt = wallVerts[2].t; + endpegb = wallVerts[1].t; + endpegmul = (endpegb - endpegt) / (endtop - endbot); +#endif + for (i = 1; i < sector->numlights; i++) { +#ifdef ESLOPE + if (endtop < endrealbot) +#endif if (top < realbot) return; @@ -1131,14 +1155,39 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum, if (cutflag == FF_CUTSOLIDS) // These are regular walls sent in from StoreWallRange, they shouldn't be cut from this solid = false; +#ifdef ESLOPE + if (list[i].slope) + { + height = FIXED_TO_FLOAT(P_GetZAt(list[i].slope, v1x, v1y)); + endheight = FIXED_TO_FLOAT(P_GetZAt(list[i].slope, v2x, v2y)); + } + else + height = endheight = FIXED_TO_FLOAT(list[i].height); + if (solid) + if (*list[i].caster->b_slope) + { + bheight = FIXED_TO_FLOAT(P_GetZAt(*list[i].caster->b_slope, v1x, v1y)); + endbheight = FIXED_TO_FLOAT(P_GetZAt(*list[i].caster->b_slope, v2x, v2y)); + } + else + bheight = endbheight = FIXED_TO_FLOAT(*list[i].caster->bottomheight); +#else height = FIXED_TO_FLOAT(list[i].height); if (solid) bheight = FIXED_TO_FLOAT(*list[i].caster->bottomheight); +#endif +#ifdef ESLOPE + if (endheight >= endtop) +#endif if (height >= top) { if (solid && top > bheight) top = bheight; +#ifdef ESLOPE + if (solid && endtop > endbheight) + endtop = endbheight; +#endif continue; } @@ -1148,6 +1197,13 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum, if (bot < realbot) bot = realbot; +#ifdef ESLOPE + endbot = endheight; + + if (endbot < endrealbot) + endbot = endrealbot; +#endif + // colormap test if (list[i-1].caster) { @@ -1162,13 +1218,25 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum, Surf->FlatColor.s.alpha = alpha; +#ifdef ESLOPE + wallVerts[3].t = pegt + ((realtop - top) * pegmul); + wallVerts[2].t = endpegt + ((endrealtop - endtop) * endpegmul); + wallVerts[0].t = pegt + ((realtop - bot) * pegmul); + wallVerts[1].t = endpegt + ((endrealtop - endbot) * endpegmul); + // set top/bottom coords + wallVerts[3].y = top; + wallVerts[2].y = endtop; + wallVerts[0].y = bot; + wallVerts[1].y = endbot; +#else wallVerts[3].t = wallVerts[2].t = pegt + ((realtop - top) * pegmul); wallVerts[0].t = wallVerts[1].t = pegt + ((realtop - bot) * pegmul); // set top/bottom coords wallVerts[2].y = wallVerts[3].y = top; wallVerts[0].y = wallVerts[1].y = bot; +#endif glTex = HWR_GetTexture(texnum); if (cutflag & FF_TRANSLUCENT) @@ -1182,9 +1250,19 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum, top = bheight; else top = height; +#ifdef ESLOPE + if (solid) + endtop = endbheight; + else + endtop = endheight; +#endif } bot = realbot; +#ifdef ESLOPE + endbot = endrealbot; + if (endtop <= endrealbot) +#endif if (top <= realbot) return; @@ -1200,12 +1278,25 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum, } Surf->FlatColor.s.alpha = alpha; - wallVerts[3].t = wallVerts[2].t = pegt + ((realtop - top) * pegmul); - wallVerts[0].t = wallVerts[1].t = pegt + ((realtop - bot) * pegmul); +#ifdef ESLOPE + wallVerts[3].t = pegt + ((realtop - top) * pegmul); + wallVerts[2].t = endpegt + ((endrealtop - endtop) * endpegmul); + wallVerts[0].t = pegt + ((realtop - bot) * pegmul); + wallVerts[1].t = endpegt + ((endrealtop - endbot) * endpegmul); - // set top/bottom coords - wallVerts[2].y = wallVerts[3].y = top; - wallVerts[0].y = wallVerts[1].y = bot; + // set top/bottom coords + wallVerts[3].y = top; + wallVerts[2].y = endtop; + wallVerts[0].y = bot; + wallVerts[1].y = endbot; +#else + wallVerts[3].t = wallVerts[2].t = pegt + ((realtop - top) * pegmul); + wallVerts[0].t = wallVerts[1].t = pegt + ((realtop - bot) * pegmul); + + // set top/bottom coords + wallVerts[2].y = wallVerts[3].y = top; + wallVerts[0].y = wallVerts[1].y = bot; +#endif glTex = HWR_GetTexture(texnum); if (cutflag & FF_TRANSLUCENT) @@ -1739,14 +1830,36 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) popentop = back->ceilingheight; popenbottom = back->floorheight; } -#endif else - { - popentop = front->ceilingheight < back->ceilingheight ? front->ceilingheight : back->ceilingheight; - popenbottom = front->floorheight > back->floorheight ? front->floorheight : back->floorheight; +#endif + { +#ifdef ESLOPE + popentop = min(worldtop, worldhigh); + popenbottom = max(worldbottom, worldlow); +#else + popentop = min(front->ceilingheight, back->ceilingheight); + popenbottom = max(front->floorheight, back->floorheight); +#endif } - if (gr_linedef->flags & ML_DONTPEGBOTTOM) +#ifdef ESLOPE + if (gr_linedef->flags & ML_EFFECT2) + { + if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) + { + polybottom = max(front->floorheight, back->floorheight) + gr_sidedef->rowoffset; + polytop = polybottom + textureheight[gr_midtexture]*repeats; + } + else + { + polytop = min(front->ceilingheight, back->ceilingheight) + gr_sidedef->rowoffset; + polybottom = polytop - textureheight[gr_midtexture]*repeats; + } + } + else if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) +#else + if (gr_linedef->flags & ML_DONTPEGBOTTOM) +#endif { polybottom = popenbottom + gr_sidedef->rowoffset; polytop = polybottom + textureheight[gr_midtexture]*repeats; @@ -1769,17 +1882,21 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) else { // The cut-off values of a linedef can always be constant, since every line has an absoulute front and or back sector - lowcut = front->floorheight > back->floorheight ? front->floorheight : back->floorheight; - highcut = front->ceilingheight < back->ceilingheight ? front->ceilingheight : back->ceilingheight; + lowcut = popenbottom; + highcut = popentop; } - h = polytop > highcut ? highcut : polytop; - l = polybottom < lowcut ? lowcut : polybottom; + h = min(highcut, polytop); + l = max(polybottom, lowcut); if (drawtextured) { // PEGGING +#ifdef ESLOPE + if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) +#else if (gr_linedef->flags & ML_DONTPEGBOTTOM) +#endif texturevpeg = textureheight[gr_sidedef->midtexture]*repeats - h + polybottom; else texturevpeg = polytop - h; @@ -1798,6 +1915,52 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(h); wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(l); +#ifdef ESLOPE + // Correct to account for slopes + { + fixed_t midtextureslant; + + if (gr_linedef->flags & ML_EFFECT2) + midtextureslant = 0; + else if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) + midtextureslant = worldlow < worldbottom + ? worldbottomslope-worldbottom + : worldlowslope-worldlow; + else + midtextureslant = worldtop < worldhigh + ? worldtopslope-worldtop + : worldhighslope-worldhigh; + + polytop += midtextureslant; + polybottom += midtextureslant; + + highcut += worldtop < worldhigh + ? worldtopslope-worldtop + : worldhighslope-worldhigh; + lowcut += worldlow < worldbottom + ? worldbottomslope-worldbottom + : worldlowslope-worldlow; + + // Texture stuff + h = min(highcut, polytop); + l = max(polybottom, lowcut); + + if (drawtextured) + { + // PEGGING + if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) + texturevpeg = textureheight[gr_sidedef->midtexture]*repeats - h + polybottom; + else + texturevpeg = polytop - h; + wallVerts[2].t = texturevpeg * grTex->scaleY; + wallVerts[1].t = (h - l + texturevpeg) * grTex->scaleY; + } + + wallVerts[2].y = FIXED_TO_FLOAT(h); + wallVerts[1].y = FIXED_TO_FLOAT(l); + } +#endif + // set alpha for transparent walls (new boom and legacy linedef types) // ooops ! this do not work at all because render order we should render it in backtofront order switch (gr_linedef->special) @@ -2739,10 +2902,14 @@ static void HWR_AddLine(seg_t * line) // and no middle texture. if ( #ifdef POLYOBJECTS - !line->polyseg + !line->polyseg && #endif - && gr_backsector->ceilingpic == gr_frontsector->ceilingpic + gr_backsector->ceilingpic == gr_frontsector->ceilingpic && gr_backsector->floorpic == gr_frontsector->floorpic +#ifdef ESLOPE + && gr_backsector->f_slope == gr_frontsector->f_slope + && gr_backsector->c_slope == gr_frontsector->c_slope +#endif && gr_backsector->lightlevel == gr_frontsector->lightlevel && gr_curline->sidedef->midtexture == 0 && !gr_backsector->ffloors && !gr_frontsector->ffloors) From 9973bedd5f3711773b5b5f2e276e400893398b99 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 5 Feb 2016 16:38:33 +0000 Subject: [PATCH 020/562] Free the memory of all clipping arrays for each portal properly Not the actual fix I'm intending to make with this branch, but it's needed anyway --- src/r_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/r_main.c b/src/r_main.c index a4e72cba9..ccaa14b8e 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1360,6 +1360,9 @@ void R_RenderPlayerView(player_t *player) // okay done. free it. portalcullsector = NULL; // Just in case... portal_base = portal->next; + Z_Free(portal->ceilingclip); + Z_Free(portal->floorclip); + Z_Free(portal->frontscale); Z_Free(portal); } // END PORTAL RENDERING From 166fafd71708553539c753783b924496387ba4d0 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 6 Feb 2016 18:57:26 +0000 Subject: [PATCH 021/562] Fixed div-by-zero crash relating to portals, drawsegs and midtextures Had to remove Red's scale hack in order to do so, because it utterly fails when the drawseg doesn't actually belong to the portal in the first place. --- src/r_bsp.c | 4 +++- src/r_bsp.h | 1 + src/r_defs.h | 2 ++ src/r_main.c | 11 +---------- src/r_segs.c | 5 +++++ src/r_things.c | 3 +++ 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/r_bsp.c b/src/r_bsp.c index c87d8baa7..52be9a0e3 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -26,6 +26,7 @@ side_t *sidedef; line_t *linedef; sector_t *frontsector; sector_t *backsector; +boolean portalline; // is curline a portal seg? // very ugly realloc() of drawsegs at run-time, I upped it to 512 // instead of 256.. and someone managed to send me a level with @@ -378,6 +379,7 @@ static void R_AddLine(seg_t *line) return; curline = line; + portalline = false; // OPTIMIZE: quickly reject orthogonal back sides. angle1 = R_PointToAngle(line->v1->x, line->v1->y); @@ -431,7 +433,7 @@ static void R_AddLine(seg_t *line) backsector = line->backsector; // Portal line - if (line->linedef->special == 40 && P_PointOnLineSide(viewx, viewy, line->linedef) == 0) + if (line->linedef->special == 40 && line->side == 0) { if (portalrender < cv_maxportals.value) { diff --git a/src/r_bsp.h b/src/r_bsp.h index 14b11ea77..3d0429fec 100644 --- a/src/r_bsp.h +++ b/src/r_bsp.h @@ -23,6 +23,7 @@ extern side_t *sidedef; extern line_t *linedef; extern sector_t *frontsector; extern sector_t *backsector; +extern boolean portalline; // is curline a portal seg? // drawsegs are allocated on the fly... see r_segs.c diff --git a/src/r_defs.h b/src/r_defs.h index f18410fe8..a982a598b 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -675,6 +675,8 @@ typedef struct drawseg_s INT32 numthicksides; fixed_t frontscale[MAXVIDWIDTH]; + UINT8 portalpass; // if > 0 and == portalrender, do not clip sprites + #ifdef ESLOPE fixed_t maskedtextureheight[MAXVIDWIDTH]; // For handling sloped midtextures diff --git a/src/r_main.c b/src/r_main.c index ccaa14b8e..a6b13302e 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -91,7 +91,6 @@ typedef struct portal_pair INT16 *ceilingclip; INT16 *floorclip; fixed_t *frontscale; - size_t seg; } portal_pair; portal_pair *portal_base, *portal_cap; line_t *portalclipline; @@ -1230,7 +1229,7 @@ void R_AddPortal(INT32 line1, INT32 line2, INT32 x1, INT32 x2) portal->start = x1; portal->end = x2; - portal->seg = ds_p-drawsegs; + portalline = true; // this tells R_StoreWallRange that curline is a portal seg portal->viewx = viewx; portal->viewy = viewy; @@ -1344,14 +1343,6 @@ void R_RenderPlayerView(player_t *player) validcount++; - if (portal->seg) - { - // Push the portal's old drawseg out of the way so it isn't interfering with sprite clipping. -Red - drawseg_t *seg = drawsegs+portal->seg; - seg->scale1 = 0; - seg->scale2 = 0; - } - R_RenderBSPNode((INT32)numnodes - 1); R_ClipSprites(); //R_DrawPlanes(); diff --git a/src/r_segs.c b/src/r_segs.c index 04873b29c..0106a1bac 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -2887,6 +2887,11 @@ void R_StoreWallRange(INT32 start, INT32 stop) R_RenderSegLoop(); colfunc = wallcolfunc; + if (portalline) // if curline is a portal, set portalrender for drawseg + ds_p->portalpass = portalrender+1; + else + ds_p->portalpass = 0; + // save sprite clipping info if (((ds_p->silhouette & SIL_TOP) || maskedtexture) && !ds_p->sprtopclip) { diff --git a/src/r_things.c b/src/r_things.c index 2a3f8e771..667a26e0f 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2058,6 +2058,9 @@ void R_ClipSprites(void) continue; } + if (ds->portalpass > 0 && ds->portalpass == portalrender) + continue; // is a portal + r1 = ds->x1 < spr->x1 ? spr->x1 : ds->x1; r2 = ds->x2 > spr->x2 ? spr->x2 : ds->x2; From ae2b1e8ea1ba860107d036e316011f0427ec329d Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 6 Feb 2016 21:06:52 +0000 Subject: [PATCH 022/562] Use <= instead of ==, so that sprites for second-tier portals and beyond still display thx Red for spotting this --- src/r_defs.h | 2 +- src/r_things.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/r_defs.h b/src/r_defs.h index a982a598b..107b8a83f 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -675,7 +675,7 @@ typedef struct drawseg_s INT32 numthicksides; fixed_t frontscale[MAXVIDWIDTH]; - UINT8 portalpass; // if > 0 and == portalrender, do not clip sprites + UINT8 portalpass; // if > 0 and <= portalrender, do not affect sprite clipping #ifdef ESLOPE fixed_t maskedtextureheight[MAXVIDWIDTH]; // For handling sloped midtextures diff --git a/src/r_things.c b/src/r_things.c index 667a26e0f..3767b02be 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2058,7 +2058,7 @@ void R_ClipSprites(void) continue; } - if (ds->portalpass > 0 && ds->portalpass == portalrender) + if (ds->portalpass > 0 && ds->portalpass <= portalrender) continue; // is a portal r1 = ds->x1 < spr->x1 ? spr->x1 : ds->x1; From 01c78c16beafce5aeae7f6e3fdff4b6692b5287e Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Thu, 11 Feb 2016 13:46:30 -0500 Subject: [PATCH 023/562] fix md2 blendcolors for reduced palette --- src/hardware/hw_md2.c | 148 ++++++++++++++++++++---------------------- 1 file changed, 69 insertions(+), 79 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index e9b387601..4eaed1259 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1145,119 +1145,109 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, case SKINCOLOR_BLACK: blendcolor = V_GetColor(27); break; - case SKINCOLOR_CYAN: - blendcolor = V_GetColor(215); - break; - case SKINCOLOR_TEAL: - blendcolor = V_GetColor(221); - break; - case SKINCOLOR_STEELBLUE: - blendcolor = V_GetColor(203); - break; - case SKINCOLOR_BLUE: - blendcolor = V_GetColor(232); + case SKINCOLOR_BEIGE: + blendcolor = V_GetColor(247); break; case SKINCOLOR_PEACH: - blendcolor = V_GetColor(71); - break; - case SKINCOLOR_TAN: - blendcolor = V_GetColor(79); - break; - case SKINCOLOR_PINK: - blendcolor = V_GetColor(147); - break; - case SKINCOLOR_LAVENDER: - blendcolor = V_GetColor(251); - break; - case SKINCOLOR_PURPLE: - blendcolor = V_GetColor(195); - break; - case SKINCOLOR_ORANGE: - blendcolor = V_GetColor(87); - break; - case SKINCOLOR_ROSEWOOD: - blendcolor = V_GetColor(94); - break; - case SKINCOLOR_BEIGE: - blendcolor = V_GetColor(40); + blendcolor = V_GetColor(218); break; case SKINCOLOR_BROWN: - blendcolor = V_GetColor(57); + blendcolor = V_GetColor(234); break; case SKINCOLOR_RED: - blendcolor = V_GetColor(130); + blendcolor = V_GetColor(38); break; - case SKINCOLOR_DARKRED: - blendcolor = V_GetColor(139); + case SKINCOLOR_CRIMSON: + blendcolor = V_GetColor(45); break; - case SKINCOLOR_NEONGREEN: - blendcolor = V_GetColor(184); + case SKINCOLOR_ORANGE: + blendcolor = V_GetColor(54); break; - case SKINCOLOR_GREEN: - blendcolor = V_GetColor(166); - break; - case SKINCOLOR_ZIM: - blendcolor = V_GetColor(180); - break; - case SKINCOLOR_OLIVE: - blendcolor = V_GetColor(108); - break; - case SKINCOLOR_YELLOW: - blendcolor = V_GetColor(104); + case SKINCOLOR_RUST: + blendcolor = V_GetColor(60); break; case SKINCOLOR_GOLD: - blendcolor = V_GetColor(115); + blendcolor = V_GetColor(67); + break; + case SKINCOLOR_YELLOW: + blendcolor = V_GetColor(73); + break; + case SKINCOLOR_TAN: + blendcolor = V_GetColor(85); + break; + case SKINCOLOR_MOSS: + blendcolor = V_GetColor(92); + break; + case SKINCOLOR_PERIDOT: + blendcolor = V_GetColor(188); + break; + case SKINCOLOR_GREEN: + blendcolor = V_GetColor(101); + break; + case SKINCOLOR_EMERALD: + blendcolor = V_GetColor(112); + break; + case SKINCOLOR_AQUA: + blendcolor = V_GetColor(122); + break; + case SKINCOLOR_TEAL: + blendcolor = V_GetColor(141); + break; + case SKINCOLOR_CYAN: + blendcolor = V_GetColor(131); + break; + case SKINCOLOR_BLUE: + blendcolor = V_GetColor(152); + break; + case SKINCOLOR_AZURE: + blendcolor = V_GetColor(171); + break; + case SKINCOLOR_PASTEL: + blendcolor = V_GetColor(161); + break; + case SKINCOLOR_PURPLE: + blendcolor = V_GetColor(165); + break; + case SKINCOLOR_LAVENDER: + blendcolor = V_GetColor(195); + break; + case SKINCOLOR_MAGENTA: + blendcolor = V_GetColor(183); + break; + case SKINCOLOR_PINK: + blendcolor = V_GetColor(211); + break; + case SKINCOLOR_ROSY: + blendcolor = V_GetColor(202); break; - case SKINCOLOR_SUPER1: - blendcolor = V_GetColor(97); + blendcolor = V_GetColor(80); break; case SKINCOLOR_SUPER2: - blendcolor = V_GetColor(100); + blendcolor = V_GetColor(83); break; case SKINCOLOR_SUPER3: - blendcolor = V_GetColor(103); + blendcolor = V_GetColor(73); break; case SKINCOLOR_SUPER4: - blendcolor = V_GetColor(113); + blendcolor = V_GetColor(64); break; case SKINCOLOR_SUPER5: - blendcolor = V_GetColor(116); + blendcolor = V_GetColor(67); break; case SKINCOLOR_TSUPER1: - blendcolor = V_GetColor(81); - break; case SKINCOLOR_TSUPER2: - blendcolor = V_GetColor(82); - break; case SKINCOLOR_TSUPER3: - blendcolor = V_GetColor(84); - break; case SKINCOLOR_TSUPER4: - blendcolor = V_GetColor(85); - break; case SKINCOLOR_TSUPER5: - blendcolor = V_GetColor(87); - break; - case SKINCOLOR_KSUPER1: - blendcolor = V_GetColor(122); - break; case SKINCOLOR_KSUPER2: - blendcolor = V_GetColor(123); - break; case SKINCOLOR_KSUPER3: - blendcolor = V_GetColor(124); - break; case SKINCOLOR_KSUPER4: - blendcolor = V_GetColor(125); - break; case SKINCOLOR_KSUPER5: - blendcolor = V_GetColor(126); - break; default: - blendcolor = V_GetColor(247); + blendcolor = V_GetColor(255); break; } From dabc4415af553ec8a1bc14e381635e7d9879d279 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 13 Feb 2016 18:11:50 +0000 Subject: [PATCH 024/562] Fix crash caused by drawing scaled, mirrored sprites semi-covered on the left side by portal edge I suspect this crash was possible even outside the context of portals, but whatever --- src/r_things.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index 3767b02be..87879a415 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -839,10 +839,10 @@ static void R_DrawVisSprite(vissprite_t *vis) dc_texturemid = FixedDiv(dc_texturemid,this_scale); //Oh lordy, mercy me. Don't freak out if sprites go offscreen! - if (vis->xiscale > 0) + /*if (vis->xiscale > 0) frac = FixedDiv(frac, this_scale); else if (vis->x1 <= 0) - frac = (vis->x1 - vis->x2) * vis->xiscale; + frac = (vis->x1 - vis->x2) * vis->xiscale;*/ sprtopscreen = centeryfrac - FixedMul(dc_texturemid, spryscale); //dc_hires = 1; @@ -1306,7 +1306,7 @@ static void R_ProjectSprite(mobj_t *thing) } if (vis->x1 > x1) - vis->startfrac += vis->xiscale*(vis->x1-x1); + vis->startfrac += FixedDiv(vis->xiscale, this_scale)*(vis->x1-x1); //Fab: lumppat is the lump number of the patch to use, this is different // than lumpid for sprites-in-pwad : the graphics are patched From ef6430c23eaadca8a78285d82fa7a53b0e2495a1 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 15 Feb 2016 20:34:53 +0000 Subject: [PATCH 025/562] Fix respawning rings on slopes --- src/p_mobj.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 25ae8815a..f240c40f2 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8171,7 +8171,11 @@ void P_RespawnSpecials(void) if (mthing->options & MTF_OBJECTFLIP) { - z = ss->sector->ceilingheight - (mthing->options >> ZSHIFT) * FRACUNIT; + z = ( +#ifdef ESLOPE + ss->sector->c_slope ? P_GetZAt(ss->sector->c_slope, x, y) : +#endif + ss->sector->ceilingheight) - (mthing->options >> ZSHIFT) * FRACUNIT; if (mthing->options & MTF_AMBUSH && (i == MT_RING || i == MT_REDTEAMRING || i == MT_BLUETEAMRING || i == MT_COIN || P_WeaponOrPanel(i))) z -= 24*FRACUNIT; @@ -8179,7 +8183,11 @@ void P_RespawnSpecials(void) } else { - z = ss->sector->floorheight + (mthing->options >> ZSHIFT) * FRACUNIT; + z = ( +#ifdef ESLOPE + ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) : +#endif + ss->sector->floorheight) + (mthing->options >> ZSHIFT) * FRACUNIT; if (mthing->options & MTF_AMBUSH && (i == MT_RING || i == MT_REDTEAMRING || i == MT_BLUETEAMRING || i == MT_COIN || P_WeaponOrPanel(i))) z += 24*FRACUNIT; From b5673ed101741b44562e4466f1369558c16b5d54 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 15 Feb 2016 20:46:56 +0000 Subject: [PATCH 026/562] Fix player spawning on slopes --- src/p_mobj.c | 60 ++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 18 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index f240c40f2..30c061d1e 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8357,7 +8357,7 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing) fixed_t z; sector_t *sector; - + fixed_t floor, ceiling; player_t *p = &players[playernum]; mobj_t *mobj = p->mo; @@ -8373,19 +8373,31 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing) // set Z height sector = R_PointInSubsector(x, y)->sector; + + floor = +#ifdef ESLOPE + sector->f_slope ? P_GetZAt(sector->f_slope, x, y) : +#endif + sector->floorheight; + ceiling = +#ifdef ESLOPE + sector->c_slope ? P_GetZAt(sector->c_slope, x, y) : +#endif + sector->ceilingheight; + if (mthing) { // Flagging a player's ambush will make them start on the ceiling // Objectflip inverts if (!!(mthing->options & MTF_AMBUSH) ^ !!(mthing->options & MTF_OBJECTFLIP)) { - z = sector->ceilingheight - mobjinfo[MT_PLAYER].height; + z = ceiling - mobjinfo[MT_PLAYER].height; if (mthing->options >> ZSHIFT) z -= ((mthing->options >> ZSHIFT) << FRACBITS); } else { - z = sector->floorheight; + z = floor; if (mthing->options >> ZSHIFT) z += ((mthing->options >> ZSHIFT) << FRACBITS); } @@ -8397,15 +8409,15 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing) } } else - z = sector->floorheight; + z = floor; - if (z < sector->floorheight) - z = sector->floorheight; - else if (z > sector->ceilingheight - mobjinfo[MT_PLAYER].height) - z = sector->ceilingheight - mobjinfo[MT_PLAYER].height; + if (z < floor) + z = floor; + else if (z > ceiling - mobjinfo[MT_PLAYER].height) + z = ceiling - mobjinfo[MT_PLAYER].height; - mobj->floorz = sector->floorheight; - mobj->ceilingz = sector->ceilingheight; + mobj->floorz = floor; + mobj->ceilingz = ceiling; P_UnsetThingPosition(mobj); mobj->x = x; @@ -8413,7 +8425,7 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing) P_SetThingPosition(mobj); mobj->z = z; - if (mobj->z == sector->floorheight) + if (mobj->z == mobj->floorz) mobj->eflags |= MFE_ONGROUND; mobj->angle = angle; @@ -8425,6 +8437,7 @@ void P_MovePlayerToStarpost(INT32 playernum) { fixed_t z; sector_t *sector; + fixed_t floor, ceiling; player_t *p = &players[playernum]; mobj_t *mobj = p->mo; @@ -8436,14 +8449,25 @@ void P_MovePlayerToStarpost(INT32 playernum) P_SetThingPosition(mobj); sector = R_PointInSubsector(mobj->x, mobj->y)->sector; - z = p->starpostz << FRACBITS; - if (z < sector->floorheight) - z = sector->floorheight; - else if (z > sector->ceilingheight - mobjinfo[MT_PLAYER].height) - z = sector->ceilingheight - mobjinfo[MT_PLAYER].height; + floor = +#ifdef ESLOPE + sector->f_slope ? P_GetZAt(sector->f_slope, x, y) : +#endif + sector->floorheight; + ceiling = +#ifdef ESLOPE + sector->c_slope ? P_GetZAt(sector->c_slope, x, y) : +#endif + sector->ceilingheight; - mobj->floorz = sector->floorheight; - mobj->ceilingz = sector->ceilingheight; + z = p->starpostz << FRACBITS; + if (z < floor) + z = floor; + else if (z > ceiling - mobjinfo[MT_PLAYER].height) + z = ceiling - mobjinfo[MT_PLAYER].height; + + mobj->floorz = floor; + mobj->ceilingz = ceiling; mobj->z = z; if (mobj->z == mobj->floorz) From fa1bc5a09bb4ea7e69fc602d56b91d2ae685a651 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 15 Feb 2016 20:55:57 +0000 Subject: [PATCH 027/562] Whoops forgot this for last commit --- src/p_mobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 30c061d1e..65b5f9a09 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8451,12 +8451,12 @@ void P_MovePlayerToStarpost(INT32 playernum) floor = #ifdef ESLOPE - sector->f_slope ? P_GetZAt(sector->f_slope, x, y) : + sector->f_slope ? P_GetZAt(sector->f_slope, mobj->x, mobj->y) : #endif sector->floorheight; ceiling = #ifdef ESLOPE - sector->c_slope ? P_GetZAt(sector->c_slope, x, y) : + sector->c_slope ? P_GetZAt(sector->c_slope, mobj->x, mobj->y) : #endif sector->ceilingheight; From 03470118cd8214d75f220e009b14375051a7e4ea Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 15 Feb 2016 20:57:35 +0000 Subject: [PATCH 028/562] Added missing ESLOPE ifdef from when I first did these fixes for slope compiling --- src/r_segs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/r_segs.c b/src/r_segs.c index 04873b29c..591242693 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1479,9 +1479,11 @@ void R_StoreWallRange(INT32 start, INT32 stop) maskedtextureheight = NULL; +#ifdef ESLOPE //initialize segleft and segright memset(&segleft, 0x00, sizeof(segleft)); memset(&segright, 0x00, sizeof(segright)); +#endif if (ds_p == drawsegs+maxdrawsegs) { From 3058648fdc1f0ec8723a0e2a273d66b067c575f2 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 16 Feb 2016 17:58:08 +0000 Subject: [PATCH 029/562] Fix elemental flame trails not spawning when going up slopes --- src/p_user.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/p_user.c b/src/p_user.c index 96841d7e0..d5ff80f6e 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6193,6 +6193,14 @@ void P_ElementalFireTrail(player_t *player) { newx = player->mo->x + P_ReturnThrustX(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale)); newy = player->mo->y + P_ReturnThrustY(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale)); +#ifdef ESLOPE + if (player->mo->standingslope) + { + ground = P_GetZAt(player->mo->standingslope, newx, newy); + if (player->mo->eflags & MFE_VERTICALFLIP) + ground -= FixedMul(mobjinfo[MT_SPINFIRE].height, player->mo->scale); + } +#endif flame = P_SpawnMobj(newx, newy, ground, MT_SPINFIRE); P_SetTarget(&flame->target, player->mo); flame->angle = travelangle; From f87f1b7b1a9ad9b91d816316b5a0ab40a40cdfd0 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 28 Jan 2016 13:56:23 +0000 Subject: [PATCH 030/562] Fixed compiler errors as well as a ton of tab spaces (apparently it's a common problem in this file anyway but whatever) --- src/hardware/hw_main.c | 556 +++++++++++++++++++++-------------------- 1 file changed, 281 insertions(+), 275 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 52be99219..ddab53a04 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -538,37 +538,39 @@ static void HWR_RenderPlane(sector_t *shittyUnusedVariable, extrasubsector_t *xs FSurfaceInfo Surf; fixed_t tempxsow, tempytow; #ifdef ESLOPE - pslope_t *slope = NULL; + pslope_t *slope = NULL; #endif static FOutVector *planeVerts = NULL; static UINT16 numAllocedPlaneVerts = 0; + (void)shittyUnusedVariable; ///@TODO remove shitty unused variable + // no convex poly were generated for this subsector if (!xsub->planepoly) return; #ifdef ESLOPE - // Get the slope pointer to simplify future code - if (FOFsector) - { - if (FOFsector->f_slope && FOFsector->floorheight == fixedheight) - slope = FOFsector->f_slope; - else if (FOFsector->c_slope && FOFsector->ceilingheight == fixedheight) - slope = FOFsector->c_slope; - } - else - { - // Use fixedheight to determine whether to check floor or ceiling because I hate my life - if (gr_frontsector->f_slope && gr_frontsector->floorheight == fixedheight) - slope = gr_frontsector->f_slope; - else if (gr_frontsector->c_slope && gr_frontsector->ceilingheight == fixedheight) - slope = gr_frontsector->c_slope; - } + // Get the slope pointer to simplify future code + if (FOFsector) + { + if (FOFsector->f_slope && FOFsector->floorheight == fixedheight) + slope = FOFsector->f_slope; + else if (FOFsector->c_slope && FOFsector->ceilingheight == fixedheight) + slope = FOFsector->c_slope; + } + else + { + // Use fixedheight to determine whether to check floor or ceiling because I hate my life + if (gr_frontsector->f_slope && gr_frontsector->floorheight == fixedheight) + slope = gr_frontsector->f_slope; + else if (gr_frontsector->c_slope && gr_frontsector->ceilingheight == fixedheight) + slope = gr_frontsector->c_slope; + } - // Set fixedheight to the slope's height from our viewpoint, if we have a slope - if (slope) - fixedheight = P_GetZAt(slope, viewx, viewy); + // Set fixedheight to the slope's height from our viewpoint, if we have a slope + if (slope) + fixedheight = P_GetZAt(slope, viewx, viewy); #endif height = FIXED_TO_FLOAT(fixedheight); @@ -638,7 +640,7 @@ static void HWR_RenderPlane(sector_t *shittyUnusedVariable, extrasubsector_t *xs { #ifdef ESLOPE if ((slope && slope == FOFsector->f_slope) - || fixedheight == FOFsector->floorheight) // it's a floor + || fixedheight == FOFsector->floorheight) // it's a floor #else if (fixedheight == FOFsector->floorheight) // it's a floor #endif @@ -658,7 +660,7 @@ static void HWR_RenderPlane(sector_t *shittyUnusedVariable, extrasubsector_t *xs { #ifdef ESLOPE if ((slope && slope == gr_frontsector->f_slope) - || fixedheight == gr_frontsector->floorheight) // it's a floor + || fixedheight == gr_frontsector->floorheight) // it's a floor #else if (fixedheight < dup_viewz) // it's a floor #endif @@ -718,11 +720,11 @@ static void HWR_RenderPlane(sector_t *shittyUnusedVariable, extrasubsector_t *xs v3d->z = pv->y; #ifdef ESLOPE - if (slope) - { - fixedheight = P_GetZAt(slope, FLOAT_TO_FIXED(pv->x), FLOAT_TO_FIXED(pv->y)); - v3d->y = FIXED_TO_FLOAT(fixedheight); - } + if (slope) + { + fixedheight = P_GetZAt(slope, FLOAT_TO_FIXED(pv->x), FLOAT_TO_FIXED(pv->y)); + v3d->y = FIXED_TO_FLOAT(fixedheight); + } #endif } @@ -742,8 +744,8 @@ static void HWR_RenderPlane(sector_t *shittyUnusedVariable, extrasubsector_t *xs sector_t *psector = gr_frontsector; #ifdef ESLOPE - if (slope) - fixedheight = P_GetZAt(slope, psector->soundorg.x, psector->soundorg.y); + if (slope) + fixedheight = P_GetZAt(slope, psector->soundorg.x, psector->soundorg.y); #endif if (psector->ffloors) @@ -1096,6 +1098,9 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum, fixed_t v1y = FLOAT_TO_FIXED(wallVerts[0].y); fixed_t v2x = FLOAT_TO_FIXED(wallVerts[1].x); fixed_t v2y = FLOAT_TO_FIXED(wallVerts[1].y); + // compiler complains when P_GetZAt is used in FLOAT_TO_FIXED directly + // use this as a temp var to store P_GetZAt's return value each time + fixed_t temp; #endif INT32 solid, i; @@ -1156,21 +1161,27 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum, solid = false; #ifdef ESLOPE - if (list[i].slope) - { - height = FIXED_TO_FLOAT(P_GetZAt(list[i].slope, v1x, v1y)); - endheight = FIXED_TO_FLOAT(P_GetZAt(list[i].slope, v2x, v2y)); - } - else - height = endheight = FIXED_TO_FLOAT(list[i].height); + if (list[i].slope) + { + temp = P_GetZAt(list[i].slope, v1x, v1y); + height = FIXED_TO_FLOAT(temp); + temp = P_GetZAt(list[i].slope, v2x, v2y); + endheight = FIXED_TO_FLOAT(temp); + } + else + height = endheight = FIXED_TO_FLOAT(list[i].height); if (solid) - if (*list[i].caster->b_slope) - { - bheight = FIXED_TO_FLOAT(P_GetZAt(*list[i].caster->b_slope, v1x, v1y)); - endbheight = FIXED_TO_FLOAT(P_GetZAt(*list[i].caster->b_slope, v2x, v2y)); - } - else - bheight = endbheight = FIXED_TO_FLOAT(*list[i].caster->bottomheight); + { + if (*list[i].caster->b_slope) + { + temp = P_GetZAt(*list[i].caster->b_slope, v1x, v1y); + bheight = FIXED_TO_FLOAT(temp); + temp = P_GetZAt(*list[i].caster->b_slope, v2x, v2y); + endbheight = FIXED_TO_FLOAT(temp); + } + else + bheight = endbheight = FIXED_TO_FLOAT(*list[i].caster->bottomheight); + } #else height = FIXED_TO_FLOAT(list[i].height); if (solid) @@ -1178,15 +1189,15 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum, #endif #ifdef ESLOPE - if (endheight >= endtop) + if (endheight >= endtop) #endif if (height >= top) { if (solid && top > bheight) top = bheight; #ifdef ESLOPE - if (solid && endtop > endbheight) - endtop = endbheight; + if (solid && endtop > endbheight) + endtop = endbheight; #endif continue; } @@ -1198,10 +1209,10 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum, bot = realbot; #ifdef ESLOPE - endbot = endheight; + endbot = endheight; - if (endbot < endrealbot) - endbot = endrealbot; + if (endbot < endrealbot) + endbot = endrealbot; #endif // colormap test @@ -1228,7 +1239,7 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum, wallVerts[3].y = top; wallVerts[2].y = endtop; wallVerts[0].y = bot; - wallVerts[1].y = endbot; + wallVerts[1].y = endbot; #else wallVerts[3].t = wallVerts[2].t = pegt + ((realtop - top) * pegmul); wallVerts[0].t = wallVerts[1].t = pegt + ((realtop - bot) * pegmul); @@ -1260,8 +1271,8 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum, bot = realbot; #ifdef ESLOPE - endbot = endrealbot; - if (endtop <= endrealbot) + endbot = endrealbot; + if (endtop <= endrealbot) #endif if (top <= realbot) return; @@ -1279,16 +1290,16 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum, Surf->FlatColor.s.alpha = alpha; #ifdef ESLOPE - wallVerts[3].t = pegt + ((realtop - top) * pegmul); - wallVerts[2].t = endpegt + ((endrealtop - endtop) * endpegmul); - wallVerts[0].t = pegt + ((realtop - bot) * pegmul); - wallVerts[1].t = endpegt + ((endrealtop - endbot) * endpegmul); + wallVerts[3].t = pegt + ((realtop - top) * pegmul); + wallVerts[2].t = endpegt + ((endrealtop - endtop) * endpegmul); + wallVerts[0].t = pegt + ((realtop - bot) * pegmul); + wallVerts[1].t = endpegt + ((endrealtop - endbot) * endpegmul); - // set top/bottom coords - wallVerts[3].y = top; - wallVerts[2].y = endtop; - wallVerts[0].y = bot; - wallVerts[1].y = endbot; + // set top/bottom coords + wallVerts[3].y = top; + wallVerts[2].y = endtop; + wallVerts[0].y = bot; + wallVerts[1].y = endbot; #else wallVerts[3].t = wallVerts[2].t = pegt + ((realtop - top) * pegmul); wallVerts[0].t = wallVerts[1].t = pegt + ((realtop - bot) * pegmul); @@ -1455,7 +1466,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) INT32 gr_midtexture; fixed_t h, l; // 3D sides and 2s middle textures #ifdef ESLOPE - fixed_t hS, lS; + fixed_t hS, lS; #endif FUINT lightnum = 0; // shut up compiler @@ -1474,10 +1485,10 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) ve.y = ((polyvertex_t *)gr_curline->v2)->y; #ifdef ESLOPE - v1x = FLOAT_TO_FIXED(vs.x); - v1y = FLOAT_TO_FIXED(vs.y); - v2x = FLOAT_TO_FIXED(ve.x); - v2y = FLOAT_TO_FIXED(ve.y); + v1x = FLOAT_TO_FIXED(vs.x); + v1y = FLOAT_TO_FIXED(vs.y); + v2x = FLOAT_TO_FIXED(ve.x); + v2y = FLOAT_TO_FIXED(ve.y); #endif if (gr_frontsector->heightsec != -1) @@ -1493,25 +1504,25 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) else { #ifdef ESLOPE - if (gr_frontsector->c_slope) - { - worldtop = P_GetZAt(gr_frontsector->c_slope, v1x, v1y); - worldtopslope = P_GetZAt(gr_frontsector->c_slope, v2x, v2y); - } - else - { - worldtop = worldtopslope = gr_frontsector->ceilingheight; - } + if (gr_frontsector->c_slope) + { + worldtop = P_GetZAt(gr_frontsector->c_slope, v1x, v1y); + worldtopslope = P_GetZAt(gr_frontsector->c_slope, v2x, v2y); + } + else + { + worldtop = worldtopslope = gr_frontsector->ceilingheight; + } - if (gr_frontsector->f_slope) - { - worldbottom = P_GetZAt(gr_frontsector->f_slope, v1x, v1y); - worldbottomslope = P_GetZAt(gr_frontsector->f_slope, v2x, v2y); - } - else - { - worldbottom = worldbottomslope = gr_frontsector->floorheight; - } + if (gr_frontsector->f_slope) + { + worldbottom = P_GetZAt(gr_frontsector->f_slope, v1x, v1y); + worldbottomslope = P_GetZAt(gr_frontsector->f_slope, v2x, v2y); + } + else + { + worldbottom = worldbottomslope = gr_frontsector->floorheight; + } #else worldtop = gr_frontsector->ceilingheight; worldbottom = gr_frontsector->floorheight; @@ -1572,25 +1583,25 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) else { #ifdef ESLOPE - if (gr_backsector->c_slope) - { - worldhigh = P_GetZAt(gr_backsector->c_slope, v1x, v1y); - worldhighslope = P_GetZAt(gr_backsector->c_slope, v2x, v2y); - } - else - { - worldhigh = worldhighslope = gr_backsector->ceilingheight; - } + if (gr_backsector->c_slope) + { + worldhigh = P_GetZAt(gr_backsector->c_slope, v1x, v1y); + worldhighslope = P_GetZAt(gr_backsector->c_slope, v2x, v2y); + } + else + { + worldhigh = worldhighslope = gr_backsector->ceilingheight; + } - if (gr_backsector->f_slope) - { - worldlow = P_GetZAt(gr_backsector->f_slope, v1x, v1y); - worldlowslope = P_GetZAt(gr_backsector->f_slope, v2x, v2y); - } - else - { - worldlow = worldlowslope = gr_backsector->floorheight; - } + if (gr_backsector->f_slope) + { + worldlow = P_GetZAt(gr_backsector->f_slope, v1x, v1y); + worldlowslope = P_GetZAt(gr_backsector->f_slope, v2x, v2y); + } + else + { + worldlow = worldlowslope = gr_backsector->floorheight; + } #else worldhigh = gr_backsector->ceilingheight; worldlow = gr_backsector->floorheight; @@ -1604,14 +1615,14 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) { worldtop = worldhigh; #ifdef ESLOPE - worldtopslope = worldhighslope; + worldtopslope = worldhighslope; #endif } // check TOP TEXTURE if (( #ifdef ESLOPE - worldhighslope < worldtopslope || + worldhighslope < worldtopslope || #endif worldhigh < worldtop ) && texturetranslation[gr_sidedef->toptexture]) @@ -1646,28 +1657,28 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; #ifdef ESLOPE - // Adjust t value for sloped walls - if (!(gr_linedef->flags & ML_EFFECT1)) - { - // Unskewed - wallVerts[3].t -= (worldtop - gr_frontsector->ceilingheight) * grTex->scaleY; - wallVerts[2].t -= (worldtopslope - gr_frontsector->ceilingheight) * grTex->scaleY; - wallVerts[0].t -= (worldhigh - gr_backsector->ceilingheight) * grTex->scaleY; - wallVerts[1].t -= (worldhighslope - gr_backsector->ceilingheight) * grTex->scaleY; - } - else if (gr_linedef->flags & ML_DONTPEGTOP) - { - // Skewed by top - wallVerts[0].t = (texturevpegtop + worldtop - worldhigh) * grTex->scaleY; - wallVerts[1].t = (texturevpegtop + worldtopslope - worldhighslope) * grTex->scaleY; - } - else - { - // Skewed by bottom - wallVerts[0].t = (texturevpegtop + worldhigh - worldtop) * grTex->scaleY; - wallVerts[2].t = wallVerts[3].t - (worldhighslope - worldhigh) * grTex->scaleY; - wallVerts[1].t = wallVerts[2].t - (worldhighslope - worldtopslope) * grTex->scaleY; - } + // Adjust t value for sloped walls + if (!(gr_linedef->flags & ML_EFFECT1)) + { + // Unskewed + wallVerts[3].t -= (worldtop - gr_frontsector->ceilingheight) * grTex->scaleY; + wallVerts[2].t -= (worldtopslope - gr_frontsector->ceilingheight) * grTex->scaleY; + wallVerts[0].t -= (worldhigh - gr_backsector->ceilingheight) * grTex->scaleY; + wallVerts[1].t -= (worldhighslope - gr_backsector->ceilingheight) * grTex->scaleY; + } + else if (gr_linedef->flags & ML_DONTPEGTOP) + { + // Skewed by top + wallVerts[0].t = (texturevpegtop + worldtop - worldhigh) * grTex->scaleY; + wallVerts[1].t = (texturevpegtop + worldtopslope - worldhighslope) * grTex->scaleY; + } + else + { + // Skewed by bottom + wallVerts[0].t = (texturevpegtop + worldhigh - worldtop) * grTex->scaleY; + wallVerts[2].t = wallVerts[3].t - (worldhighslope - worldhigh) * grTex->scaleY; + wallVerts[1].t = wallVerts[2].t - (worldhighslope - worldtopslope) * grTex->scaleY; + } #endif } @@ -1693,7 +1704,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) // check BOTTOM TEXTURE if (( #ifdef ESLOPE - worldlowslope > worldbottomslope || + worldlowslope > worldbottomslope || #endif worldlow > worldbottom) && texturetranslation[gr_sidedef->bottomtexture]) //only if VISIBLE!!! { @@ -1729,28 +1740,28 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; #ifdef ESLOPE - // Adjust t value for sloped walls - if (!(gr_linedef->flags & ML_EFFECT1)) - { - // Unskewed - wallVerts[0].t -= (worldbottom - gr_frontsector->floorheight) * grTex->scaleY; - wallVerts[1].t -= (worldbottomslope - gr_frontsector->floorheight) * grTex->scaleY; - wallVerts[3].t -= (worldlow - gr_backsector->floorheight) * grTex->scaleY; - wallVerts[2].t -= (worldlowslope - gr_backsector->floorheight) * grTex->scaleY; - } - else if (gr_linedef->flags & ML_DONTPEGBOTTOM) - { - // Skewed by bottom - wallVerts[0].t = (texturevpegbottom + worldlow - worldbottom) * grTex->scaleY; - wallVerts[2].t = wallVerts[3].t - (worldlowslope - worldlow) * grTex->scaleY; - wallVerts[1].t = wallVerts[2].t - (worldbottomslope - worldlowslope) * grTex->scaleY; - } - else - { - // Skewed by top - wallVerts[0].t = (texturevpegbottom + worldlow - worldbottom) * grTex->scaleY; - wallVerts[1].t = (texturevpegbottom + worldlowslope - worldbottomslope) * grTex->scaleY; - } + // Adjust t value for sloped walls + if (!(gr_linedef->flags & ML_EFFECT1)) + { + // Unskewed + wallVerts[0].t -= (worldbottom - gr_frontsector->floorheight) * grTex->scaleY; + wallVerts[1].t -= (worldbottomslope - gr_frontsector->floorheight) * grTex->scaleY; + wallVerts[3].t -= (worldlow - gr_backsector->floorheight) * grTex->scaleY; + wallVerts[2].t -= (worldlowslope - gr_backsector->floorheight) * grTex->scaleY; + } + else if (gr_linedef->flags & ML_DONTPEGBOTTOM) + { + // Skewed by bottom + wallVerts[0].t = (texturevpegbottom + worldlow - worldbottom) * grTex->scaleY; + wallVerts[2].t = wallVerts[3].t - (worldlowslope - worldlow) * grTex->scaleY; + wallVerts[1].t = wallVerts[2].t - (worldbottomslope - worldlowslope) * grTex->scaleY; + } + else + { + // Skewed by top + wallVerts[0].t = (texturevpegbottom + worldlow - worldbottom) * grTex->scaleY; + wallVerts[1].t = (texturevpegbottom + worldlowslope - worldbottomslope) * grTex->scaleY; + } #endif } @@ -1843,20 +1854,20 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) } #ifdef ESLOPE - if (gr_linedef->flags & ML_EFFECT2) - { - if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) - { - polybottom = max(front->floorheight, back->floorheight) + gr_sidedef->rowoffset; - polytop = polybottom + textureheight[gr_midtexture]*repeats; - } - else - { - polytop = min(front->ceilingheight, back->ceilingheight) + gr_sidedef->rowoffset; - polybottom = polytop - textureheight[gr_midtexture]*repeats; - } - } - else if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) + if (gr_linedef->flags & ML_EFFECT2) + { + if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) + { + polybottom = max(front->floorheight, back->floorheight) + gr_sidedef->rowoffset; + polytop = polybottom + textureheight[gr_midtexture]*repeats; + } + else + { + polytop = min(front->ceilingheight, back->ceilingheight) + gr_sidedef->rowoffset; + polybottom = polytop - textureheight[gr_midtexture]*repeats; + } + } + else if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) #else if (gr_linedef->flags & ML_DONTPEGBOTTOM) #endif @@ -1893,7 +1904,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) { // PEGGING #ifdef ESLOPE - if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) + if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) #else if (gr_linedef->flags & ML_DONTPEGBOTTOM) #endif @@ -1916,49 +1927,49 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(l); #ifdef ESLOPE - // Correct to account for slopes - { - fixed_t midtextureslant; + // Correct to account for slopes + { + fixed_t midtextureslant; - if (gr_linedef->flags & ML_EFFECT2) - midtextureslant = 0; - else if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) - midtextureslant = worldlow < worldbottom - ? worldbottomslope-worldbottom - : worldlowslope-worldlow; - else - midtextureslant = worldtop < worldhigh - ? worldtopslope-worldtop - : worldhighslope-worldhigh; + if (gr_linedef->flags & ML_EFFECT2) + midtextureslant = 0; + else if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) + midtextureslant = worldlow < worldbottom + ? worldbottomslope-worldbottom + : worldlowslope-worldlow; + else + midtextureslant = worldtop < worldhigh + ? worldtopslope-worldtop + : worldhighslope-worldhigh; - polytop += midtextureslant; - polybottom += midtextureslant; + polytop += midtextureslant; + polybottom += midtextureslant; - highcut += worldtop < worldhigh - ? worldtopslope-worldtop - : worldhighslope-worldhigh; - lowcut += worldlow < worldbottom - ? worldbottomslope-worldbottom - : worldlowslope-worldlow; + highcut += worldtop < worldhigh + ? worldtopslope-worldtop + : worldhighslope-worldhigh; + lowcut += worldlow < worldbottom + ? worldbottomslope-worldbottom + : worldlowslope-worldlow; - // Texture stuff - h = min(highcut, polytop); - l = max(polybottom, lowcut); + // Texture stuff + h = min(highcut, polytop); + l = max(polybottom, lowcut); - if (drawtextured) - { - // PEGGING - if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) - texturevpeg = textureheight[gr_sidedef->midtexture]*repeats - h + polybottom; - else - texturevpeg = polytop - h; - wallVerts[2].t = texturevpeg * grTex->scaleY; - wallVerts[1].t = (h - l + texturevpeg) * grTex->scaleY; - } + if (drawtextured) + { + // PEGGING + if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) + texturevpeg = textureheight[gr_sidedef->midtexture]*repeats - h + polybottom; + else + texturevpeg = polytop - h; + wallVerts[2].t = texturevpeg * grTex->scaleY; + wallVerts[1].t = (h - l + texturevpeg) * grTex->scaleY; + } - wallVerts[2].y = FIXED_TO_FLOAT(h); - wallVerts[1].y = FIXED_TO_FLOAT(l); - } + wallVerts[2].y = FIXED_TO_FLOAT(h); + wallVerts[1].y = FIXED_TO_FLOAT(l); + } #endif // set alpha for transparent walls (new boom and legacy linedef types) @@ -2142,9 +2153,9 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) fixed_t texturevpeg; // PEGGING #ifdef ESLOPE - if ((gr_linedef->flags & (ML_DONTPEGBOTTOM|ML_EFFECT2)) == (ML_DONTPEGBOTTOM|ML_EFFECT2)) + if ((gr_linedef->flags & (ML_DONTPEGBOTTOM|ML_EFFECT2)) == (ML_DONTPEGBOTTOM|ML_EFFECT2)) texturevpeg = gr_frontsector->floorheight + textureheight[gr_sidedef->midtexture] - gr_frontsector->ceilingheight + gr_sidedef->rowoffset; - else + else #endif if (gr_linedef->flags & ML_DONTPEGBOTTOM) texturevpeg = worldbottom + textureheight[gr_sidedef->midtexture] - worldtop + gr_sidedef->rowoffset; @@ -2160,28 +2171,27 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; #ifdef ESLOPE - // Texture correction for slopes - if (gr_linedef->flags & ML_EFFECT2) { - wallVerts[3].t += (gr_frontsector->ceilingheight - worldtop) * grTex->scaleY; - wallVerts[2].t += (gr_frontsector->ceilingheight - worldtopslope) * grTex->scaleY; - wallVerts[0].t += (gr_frontsector->floorheight - worldbottom) * grTex->scaleY; - wallVerts[1].t += (gr_frontsector->floorheight - worldbottomslope) * grTex->scaleY; - } else if (gr_linedef->flags & ML_DONTPEGBOTTOM) { - wallVerts[3].t = wallVerts[0].t + (worldbottom-worldtop) * grTex->scaleY; - wallVerts[2].t = wallVerts[1].t + (worldbottomslope-worldtopslope) * grTex->scaleY; - } else { - wallVerts[0].t = wallVerts[3].t - (worldbottom-worldtop) * grTex->scaleY; - wallVerts[1].t = wallVerts[2].t - (worldbottomslope-worldtopslope) * grTex->scaleY; - } + // Texture correction for slopes + if (gr_linedef->flags & ML_EFFECT2) { + wallVerts[3].t += (gr_frontsector->ceilingheight - worldtop) * grTex->scaleY; + wallVerts[2].t += (gr_frontsector->ceilingheight - worldtopslope) * grTex->scaleY; + wallVerts[0].t += (gr_frontsector->floorheight - worldbottom) * grTex->scaleY; + wallVerts[1].t += (gr_frontsector->floorheight - worldbottomslope) * grTex->scaleY; + } else if (gr_linedef->flags & ML_DONTPEGBOTTOM) { + wallVerts[3].t = wallVerts[0].t + (worldbottom-worldtop) * grTex->scaleY; + wallVerts[2].t = wallVerts[1].t + (worldbottomslope-worldtopslope) * grTex->scaleY; + } else { + wallVerts[0].t = wallVerts[3].t - (worldbottom-worldtop) * grTex->scaleY; + wallVerts[1].t = wallVerts[2].t - (worldbottomslope-worldtopslope) * grTex->scaleY; + } #endif } #ifdef ESLOPE - //Set textures properly on single sided walls that are sloped + //Set textures properly on single sided walls that are sloped wallVerts[3].y = FIXED_TO_FLOAT(worldtop); wallVerts[0].y = FIXED_TO_FLOAT(worldbottom); wallVerts[2].y = FIXED_TO_FLOAT(worldtopslope); wallVerts[1].y = FIXED_TO_FLOAT(worldbottomslope); - #else // set top/bottom coords wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(worldtop); @@ -2255,12 +2265,10 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) //FIXME: check if peging is correct // set top/bottom coords - wallVerts[3].y = FIXED_TO_FLOAT(h); - wallVerts[2].y = FIXED_TO_FLOAT(hS); - wallVerts[0].y = FIXED_TO_FLOAT(l); - wallVerts[1].y = FIXED_TO_FLOAT(lS); - - + wallVerts[3].y = FIXED_TO_FLOAT(h); + wallVerts[2].y = FIXED_TO_FLOAT(hS); + wallVerts[0].y = FIXED_TO_FLOAT(l); + wallVerts[1].y = FIXED_TO_FLOAT(lS); #else h = *rover->topheight; l = *rover->bottomheight; @@ -2284,13 +2292,13 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) else if (drawtextured) { #ifdef ESLOPE // P.S. this is better-organized than the old version - fixed_t offs = sides[(newline ?: rover->master)->sidenum[0]].rowoffset; + fixed_t offs = sides[(newline ?: rover->master)->sidenum[0]].rowoffset; grTex = HWR_GetTexture(texnum); - wallVerts[3].t = (*rover->topheight - h + offs) * grTex->scaleY; - wallVerts[2].t = (*rover->topheight - hS + offs) * grTex->scaleY; - wallVerts[0].t = (*rover->topheight - l + offs) * grTex->scaleY; - wallVerts[1].t = (*rover->topheight - lS + offs) * grTex->scaleY; + wallVerts[3].t = (*rover->topheight - h + offs) * grTex->scaleY; + wallVerts[2].t = (*rover->topheight - hS + offs) * grTex->scaleY; + wallVerts[0].t = (*rover->topheight - l + offs) * grTex->scaleY; + wallVerts[1].t = (*rover->topheight - lS + offs) * grTex->scaleY; #else grTex = HWR_GetTexture(texnum); @@ -2390,12 +2398,10 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) //FIXME: check if peging is correct // set top/bottom coords - wallVerts[3].y = FIXED_TO_FLOAT(h); - wallVerts[2].y = FIXED_TO_FLOAT(hS); - wallVerts[0].y = FIXED_TO_FLOAT(l); - wallVerts[1].y = FIXED_TO_FLOAT(lS); - - + wallVerts[3].y = FIXED_TO_FLOAT(h); + wallVerts[2].y = FIXED_TO_FLOAT(hS); + wallVerts[0].y = FIXED_TO_FLOAT(l); + wallVerts[1].y = FIXED_TO_FLOAT(lS); #else h = *rover->topheight; l = *rover->bottomheight; @@ -2902,17 +2908,17 @@ static void HWR_AddLine(seg_t * line) // and no middle texture. if ( #ifdef POLYOBJECTS - !line->polyseg && + !line->polyseg && #endif - gr_backsector->ceilingpic == gr_frontsector->ceilingpic - && gr_backsector->floorpic == gr_frontsector->floorpic + gr_backsector->ceilingpic == gr_frontsector->ceilingpic + && gr_backsector->floorpic == gr_frontsector->floorpic #ifdef ESLOPE - && gr_backsector->f_slope == gr_frontsector->f_slope - && gr_backsector->c_slope == gr_frontsector->c_slope + && gr_backsector->f_slope == gr_frontsector->f_slope + && gr_backsector->c_slope == gr_frontsector->c_slope #endif && gr_backsector->lightlevel == gr_frontsector->lightlevel - && gr_curline->sidedef->midtexture == 0 - && !gr_backsector->ffloors && !gr_frontsector->ffloors) + && gr_curline->sidedef->midtexture == 0 + && !gr_backsector->ffloors && !gr_frontsector->ffloors) // SoM: For 3D sides... Boris, would you like to take a // crack at rendering 3D sides? You would need to add the // above check and add code to HWR_StoreWallRange... @@ -3307,7 +3313,7 @@ static void HWR_Subsector(size_t num) INT32 floorlightlevel; INT32 ceilinglightlevel; INT32 locFloorHeight, locCeilingHeight; - INT32 cullFloorHeight, cullCeilingHeight; + INT32 cullFloorHeight, cullCeilingHeight; INT32 light = 0; fixed_t wh; extracolormap_t *floorcolormap; @@ -3370,7 +3376,7 @@ static void HWR_Subsector(size_t num) } else if (gr_frontsector->virtualFloor) { - ///@TODO Is this whole virtualFloor mess even useful? I don't think it even triggers ever. + ///@TODO Is this whole virtualFloor mess even useful? I don't think it even triggers ever. cullFloorHeight = locFloorHeight = gr_frontsector->virtualFloorheight; if (gr_frontsector->virtualCeiling) cullCeilingHeight = locCeilingHeight = gr_frontsector->virtualCeilingheight; @@ -3388,17 +3394,17 @@ static void HWR_Subsector(size_t num) cullCeilingHeight = locCeilingHeight = gr_frontsector->ceilingheight; #ifdef ESLOPE - if (gr_frontsector->f_slope) - { - cullFloorHeight = P_GetZAt(gr_frontsector->f_slope, viewx, viewy); - locFloorHeight = P_GetZAt(gr_frontsector->f_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y); - } + if (gr_frontsector->f_slope) + { + cullFloorHeight = P_GetZAt(gr_frontsector->f_slope, viewx, viewy); + locFloorHeight = P_GetZAt(gr_frontsector->f_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y); + } - if (gr_frontsector->c_slope) - { - cullCeilingHeight = P_GetZAt(gr_frontsector->c_slope, viewx, viewy); - locCeilingHeight = P_GetZAt(gr_frontsector->c_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y); - } + if (gr_frontsector->c_slope) + { + cullCeilingHeight = P_GetZAt(gr_frontsector->c_slope, viewx, viewy); + locCeilingHeight = P_GetZAt(gr_frontsector->c_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y); + } #endif } // ----- end special tricks ----- @@ -3438,10 +3444,10 @@ static void HWR_Subsector(size_t num) { HWR_GetFlat(levelflats[gr_frontsector->floorpic].lumpnum); HWR_RenderPlane(gr_frontsector, &extrasubsectors[num], - // Hack to make things continue to work around slopes. - locFloorHeight == cullFloorHeight ? locFloorHeight : gr_frontsector->floorheight, - // We now return you to your regularly scheduled rendering. - PF_Occlude, floorlightlevel, levelflats[gr_frontsector->floorpic].lumpnum, NULL, 255, false, floorcolormap); + // Hack to make things continue to work around slopes. + locFloorHeight == cullFloorHeight ? locFloorHeight : gr_frontsector->floorheight, + // We now return you to your regularly scheduled rendering. + PF_Occlude, floorlightlevel, levelflats[gr_frontsector->floorpic].lumpnum, NULL, 255, false, floorcolormap); } } else @@ -3460,10 +3466,10 @@ static void HWR_Subsector(size_t num) { HWR_GetFlat(levelflats[gr_frontsector->ceilingpic].lumpnum); HWR_RenderPlane(NULL, &extrasubsectors[num], - // Hack to make things continue to work around slopes. - locCeilingHeight == cullCeilingHeight ? locCeilingHeight : gr_frontsector->ceilingheight, - // We now return you to your regularly scheduled rendering. - PF_Occlude, ceilinglightlevel, levelflats[gr_frontsector->ceilingpic].lumpnum,NULL, 255, false, ceilingcolormap); + // Hack to make things continue to work around slopes. + locCeilingHeight == cullCeilingHeight ? locCeilingHeight : gr_frontsector->ceilingheight, + // We now return you to your regularly scheduled rendering. + PF_Occlude, ceilinglightlevel, levelflats[gr_frontsector->ceilingpic].lumpnum,NULL, 255, false, ceilingcolormap); } } else @@ -3492,16 +3498,16 @@ static void HWR_Subsector(size_t num) for (rover = gr_frontsector->ffloors; rover; rover = rover->next) { - fixed_t cullHeight, centerHeight; + fixed_t cullHeight, centerHeight; // bottom plane #ifdef ESLOPE - if (*rover->b_slope) - { - cullHeight = P_GetZAt(*rover->b_slope, viewx, viewy); - centerHeight = P_GetZAt(*rover->b_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y); - } - else + if (*rover->b_slope) + { + cullHeight = P_GetZAt(*rover->b_slope, viewx, viewy); + centerHeight = P_GetZAt(*rover->b_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y); + } + else #endif cullHeight = centerHeight = *rover->bottomheight; @@ -3562,12 +3568,12 @@ static void HWR_Subsector(size_t num) // top plane #ifdef ESLOPE - if (*rover->t_slope) - { - cullHeight = P_GetZAt(*rover->t_slope, viewx, viewy); - centerHeight = P_GetZAt(*rover->t_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y); - } - else + if (*rover->t_slope) + { + cullHeight = P_GetZAt(*rover->t_slope, viewx, viewy); + centerHeight = P_GetZAt(*rover->t_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y); + } + else #endif cullHeight = centerHeight = *rover->topheight; From ce793dfe282c748ca53dd2d5dbb4a8af7c7f1d25 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sun, 21 Feb 2016 22:32:38 -0600 Subject: [PATCH 031/562] Fix vissprite-related crashing in OGL --- 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 ddab53a04..d62683206 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5039,7 +5039,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 && md2_models[thing->sprite].notfound == true) //Yellow: Only MD2's dont disappear + if (tz < ZCLIP_PLANE && (!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); From bcd05b1c6328419c8b90278729f8b649494a40f0 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sun, 21 Feb 2016 23:02:09 -0600 Subject: [PATCH 032/562] Also fixed it for MD2s --- src/hardware/hw_main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index d62683206..529c2603c 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -4520,11 +4520,10 @@ static void HWR_SortVisSprites(void) gr_vsprsortedhead.next = gr_vsprsortedhead.prev = &gr_vsprsortedhead; for (i = 0; i < gr_visspritecount; i++) { - bestdist = ZCLIP_PLANE-1; - bestdispoffset = INT32_MAX; + best = NULL; for (ds = unsorted.next; ds != &unsorted; ds = ds->next) { - if (ds->tz > bestdist) + if (!best || ds->tz > bestdist) { bestdist = ds->tz; bestdispoffset = ds->dispoffset; From 3802ec33de3738426a48f751205240314de36a51 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 23 Feb 2016 22:53:24 +0000 Subject: [PATCH 033/562] Fixed how dying players who were standing on slopes just jump off to the side --- src/p_map.c | 29 +++++++++++++++++------------ src/p_mobj.c | 14 ++++++++++++-- src/p_slopes.c | 3 +++ 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 7ff913a86..dff5c5bef 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2051,21 +2051,26 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) thing->ceilingz = tmceilingz; #ifdef ESLOPE - // Assign thing's standingslope if needed - if (thing->z <= tmfloorz && !(thing->eflags & MFE_VERTICALFLIP)) { - if (!startingonground && tmfloorslope) - P_HandleSlopeLanding(thing, tmfloorslope); + if (!(thing->flags & MF_NOCLIPHEIGHT)) + { + // Assign thing's standingslope if needed + if (thing->z <= tmfloorz && !(thing->eflags & MFE_VERTICALFLIP)) { + if (!startingonground && tmfloorslope) + P_HandleSlopeLanding(thing, tmfloorslope); - if (thing->momz <= 0) - thing->standingslope = tmfloorslope; - } - else if (thing->z+thing->height >= tmceilingz && (thing->eflags & MFE_VERTICALFLIP)) { - if (!startingonground && tmceilingslope) - P_HandleSlopeLanding(thing, tmceilingslope); + if (thing->momz <= 0) + thing->standingslope = tmfloorslope; + } + else if (thing->z+thing->height >= tmceilingz && (thing->eflags & MFE_VERTICALFLIP)) { + if (!startingonground && tmceilingslope) + P_HandleSlopeLanding(thing, tmceilingslope); - if (thing->momz >= 0) - thing->standingslope = tmceilingslope; + if (thing->momz >= 0) + thing->standingslope = tmceilingslope; + } } + else // don't set standingslope if you're not going to clip against it + thing->standingslope = NULL; #endif thing->x = x; diff --git a/src/p_mobj.c b/src/p_mobj.c index 65b5f9a09..155d985e9 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2077,8 +2077,13 @@ static boolean P_ZMovement(mobj_t *mo) I_Assert(!P_MobjWasRemoved(mo)); #ifdef ESLOPE - if (mo->standingslope && !P_IsObjectOnGround(mo)) + if (mo->standingslope) + { + if (mo->flags & MF_NOCLIPHEIGHT) + mo->standingslope = NULL; + else if (!P_IsObjectOnGround(mo)) P_SlopeLaunch(mo); + } #endif // Intercept the stupid 'fall through 3dfloors' bug @@ -2561,8 +2566,13 @@ static void P_PlayerZMovement(mobj_t *mo) return; #ifdef ESLOPE - if (mo->standingslope && !P_IsObjectOnGround(mo)) + if (mo->standingslope) + { + if (mo->flags & MF_NOCLIPHEIGHT) + mo->standingslope = NULL; + else if (!P_IsObjectOnGround(mo)) P_SlopeLaunch(mo); + } #endif // clip movement diff --git a/src/p_slopes.c b/src/p_slopes.c index 2d55cf194..797fe46b4 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -1099,6 +1099,9 @@ void P_ButteredSlope(mobj_t *mo) if (!mo->standingslope) return; + if (mo->flags & (MF_NOCLIPHEIGHT|MF_NOGRAVITY)) + return; // don't slide down slopes if you can't touch them or you're not affected by gravity + if (mo->player) { if (abs(mo->standingslope->zdelta) < FRACUNIT/4 && !(mo->player->pflags & PF_SPINNING)) return; // Don't slide on non-steep slopes unless spinning From 4b447b3d0db33c92ca1e542cc6a955af3dec45ea Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 28 Feb 2016 18:30:29 +0000 Subject: [PATCH 034/562] Don't add polyobjects to a mobj's sector nodes list. This causes the player to teeter whenever they are above the polyobject's bottom, whether or not it is solid Also, a minor tweak for the teetering code itself, though it looks a right mess and probably should be redone in the future --- src/p_map.c | 6 ++++++ src/p_user.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 61d57dcd1..760252c8b 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -3712,6 +3712,9 @@ static inline boolean PIT_GetSectors(line_t *ld) if (P_BoxOnLineSide(tmbbox, ld) != -1) return true; + if (ld->polyobj) // line belongs to a polyobject, don't add it + return true; + // This line crosses through the object. // Collect the sector(s) from the line and add to the @@ -3744,6 +3747,9 @@ static inline boolean PIT_GetPrecipSectors(line_t *ld) if (P_BoxOnLineSide(preciptmbbox, ld) != -1) return true; + if (ld->polyobj) // line belongs to a polyobject, don't add it + return true; + // This line crosses through the object. // Collect the sector(s) from the line and add to the diff --git a/src/p_user.c b/src/p_user.c index da65b7cb4..b3ba5f61f 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3087,7 +3087,7 @@ static void P_DoTeeter(player_t *player) } if (polybottom > player->mo->z + player->mo->height + tiptop - || (polybottom < player->mo->z + || (polytop < player->mo->z && player->mo->z + player->mo->height < player->mo->ceilingz - tiptop)) teeter = true; else @@ -3105,7 +3105,7 @@ static void P_DoTeeter(player_t *player) } if (polytop < player->mo->z - tiptop - || (polytop > player->mo->z + player->mo->height + || (polybottom > player->mo->z + player->mo->height && player->mo->z > player->mo->floorz + tiptop)) teeter = true; else From 98fd5ca63b32f9060bdb3e117edc6297c544aea0 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 1 Mar 2016 19:55:13 +0000 Subject: [PATCH 035/562] Made some FOF-related seg code account for slopes, as requested by some TODOs The funny thing is you really can't see ANY change here unless you have a sloped FOF intersecting a sector floor/ceiling (and a second FOF on the other side), which has other problems anyway lol --- src/r_segs.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/r_segs.c b/src/r_segs.c index 591242693..ccf70338e 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -2121,8 +2121,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) for (r2 = frontsector->ffloors; r2; r2 = r2->next) { - if (!(r2->flags & FF_EXISTS) || !(r2->flags & FF_RENDERSIDES) - || *r2->topheight < lowcut || *r2->bottomheight > highcut) ///TODO: make these account for slopes -Red + if (!(r2->flags & FF_EXISTS) || !(r2->flags & FF_RENDERSIDES)) continue; if (r2->norender == leveltime) @@ -2154,9 +2153,13 @@ void R_StoreWallRange(INT32 start, INT32 stop) } else low2 = lowslope2 = *r2->bottomheight; + if ((high2 < lowcut && highslope2 < lowcutslope) || (low2 > highcut && lowslope2 > highcutslope)) + continue; if ((high1 > high2 && highslope1 > highslope2) || (low1 < low2 && lowslope1 < lowslope2)) continue; #else + if (*r2->topheight < lowcut || *r2->bottomheight > highcut) + continue; if (*rover->topheight > *r2->topheight || *rover->bottomheight < *r2->bottomheight) continue; #endif @@ -2201,8 +2204,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) for (r2 = backsector->ffloors; r2; r2 = r2->next) { - if (!(r2->flags & FF_EXISTS) || !(r2->flags & FF_RENDERSIDES) - || *r2->topheight < lowcut || *r2->bottomheight > highcut) ///TODO: make these account for slopes -Red + if (!(r2->flags & FF_EXISTS) || !(r2->flags & FF_RENDERSIDES)) continue; if (r2->norender == leveltime) @@ -2234,9 +2236,13 @@ void R_StoreWallRange(INT32 start, INT32 stop) } else low2 = lowslope2 = *r2->bottomheight; + if ((high2 < lowcut && highslope2 < lowcutslope) || (low2 > highcut && lowslope2 > highcutslope)) + continue; if ((high1 > high2 && highslope1 > highslope2) || (low1 < low2 && lowslope1 < lowslope2)) continue; #else + if (*r2->topheight < lowcut || *r2->bottomheight > highcut) + continue; if (*rover->topheight > *r2->topheight || *rover->bottomheight < *r2->bottomheight) continue; #endif From 668cc85d7b3f828ef723289939ac134b57ce191d Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 2 Mar 2016 20:31:04 +0000 Subject: [PATCH 036/562] P_ClosestPointOnLine can now (optionally) take custom coordinates that you want to make up your line --- src/lua_baselib.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 5e2d31b10..be06982f3 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -140,14 +140,38 @@ static int lib_pAproxDistance(lua_State *L) static int lib_pClosestPointOnLine(lua_State *L) { + int n = lua_gettop(L); fixed_t x = luaL_checkfixed(L, 1); fixed_t y = luaL_checkfixed(L, 2); - line_t *line = *((line_t **)luaL_checkudata(L, 3, META_LINE)); vertex_t result; //HUDSAFE - if (!line) - return LUA_ErrInvalid(L, "line_t"); - P_ClosestPointOnLine(x, y, line, &result); + if (lua_isuserdata(L, 3)) // use a real linedef to get our points + { + line_t *line = *((line_t **)luaL_checkudata(L, 3, META_LINE)); + if (!line) + return LUA_ErrInvalid(L, "line_t"); + P_ClosestPointOnLine(x, y, line, &result); + } + else // use custom coordinates of our own! + { + vertex_t v1, v2; // fake vertexes + line_t junk; // fake linedef + + if (n < 6) + return luaL_error(L, "arguments 3 to 6 not all given (expected 4 fixed-point integers)"); + + v1.x = luaL_checkfixed(L, 3); + v1.y = luaL_checkfixed(L, 4); + v2.x = luaL_checkfixed(L, 5); + v2.y = luaL_checkfixed(L, 6); + + junk.v1 = &v1; + junk.v2 = &v2; + junk.dx = v2.x - v1.x; + junk.dy = v2.y - v1.y; + P_ClosestPointOnLine(x, y, &junk, &result); + } + lua_pushfixed(L, result.x); lua_pushfixed(L, result.y); return 2; From 560d7d9aae52260626266d45f9112ed6532b9f6b Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 3 Mar 2016 22:38:06 +0000 Subject: [PATCH 037/562] Sideways springs, horizontal hog-launchers, perpendicular plungers... Call them what you like, they're in the game now --- src/dehacked.c | 33 ++++++++++++ src/info.c | 133 +++++++++++++++++++++++++++++++++++++++++++++---- src/info.h | 36 +++++++++++++ 3 files changed, 191 insertions(+), 11 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 7b527eeef..45e2486e0 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -5463,6 +5463,36 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_RDIAG7", "S_RDIAG8", + // Yellow Side Spring + "S_YHORIZ1", + "S_YHORIZ2", + "S_YHORIZ3", + "S_YHORIZ4", + "S_YHORIZ5", + "S_YHORIZ6", + "S_YHORIZ7", + "S_YHORIZ8", + + // Red Side Spring + "S_RHORIZ1", + "S_RHORIZ2", + "S_RHORIZ3", + "S_RHORIZ4", + "S_RHORIZ5", + "S_RHORIZ6", + "S_RHORIZ7", + "S_RHORIZ8", + + // Blue Side Spring + "S_BHORIZ1", + "S_BHORIZ2", + "S_BHORIZ3", + "S_BHORIZ4", + "S_BHORIZ5", + "S_BHORIZ6", + "S_BHORIZ7", + "S_BHORIZ8", + // Rain "S_RAIN1", "S_RAINRETURN", @@ -6222,6 +6252,9 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_REDSPRING", "MT_YELLOWDIAG", // Yellow Diagonal Spring "MT_REDDIAG", // Red Diagonal Spring + "MT_YELLOWHORIZ", // Yellow Side Spring + "MT_REDHORIZ", // Red Side Spring + "MT_BLUEHORIZ", // Blue Side Spring // Interactive Objects "MT_BUBBLES", // Bubble source diff --git a/src/info.c b/src/info.c index ec1a8926e..cb5d436cf 100644 --- a/src/info.c +++ b/src/info.c @@ -43,17 +43,17 @@ char sprnames[NUMSPRITES + 1][5] = "DFLM","XMS1","XMS2","XMS3","BSZ1","BSZ2","BSZ3","BSZ4","BSZ5","BSZ6", "BSZ7","BSZ8","STLG","DBAL","RCRY","ARMA","ARMF","ARMB","WIND","MAGN", "ELEM","FORC","PITY","IVSP","SSPK","GOAL","BIRD","BUNY","MOUS","CHIC", - "COWZ","RBRD","SPRY","SPRR","SPRB","YSPR","RSPR","RAIN","SNO1","SPLH", - "SPLA","SMOK","BUBP","BUBO","BUBN","BUBM","POPP","TFOG","SEED","PRTL", - "SCOR","DRWN","TTAG","GFLG","RRNG","RNGB","RNGR","RNGI","RNGA","RNGE", - "RNGS","RNGG","PIKB","PIKR","PIKA","PIKE","PIKS","PIKG","TAUT","TGRE", - "TSCR","COIN","CPRK","GOOM","BGOM","FFWR","FBLL","SHLL","PUMA","HAMM", - "KOOP","BFLM","MAXE","MUS1","MUS2","TOAD","NDRN","SUPE","SUPZ","NDRL", - "NSPK","NBMP","HOOP","NSCR","NPRU","CAPS","SUPT","SPRK","BOM1","BOM2", - "BOM3","BOM4","ROIA","ROIB","ROIC","ROID","ROIE","ROIF","ROIG","ROIH", - "ROII","ROIJ","ROIK","ROIL","ROIM","ROIN","ROIO","ROIP","BBAL","GWLG", - "GWLR","SRBA","SRBB","SRBC","SRBD","SRBE","SRBF","SRBG","SRBH","SRBI", - "SRBJ","SRBK","SRBL","SRBM","SRBN","SRBO", + "COWZ","RBRD","SPRY","SPRR","SPRB","YSPR","RSPR","SSWY","SSWR","SSWB", + "RAIN","SNO1","SPLH","SPLA","SMOK","BUBP","BUBO","BUBN","BUBM","POPP", + "TFOG","SEED","PRTL","SCOR","DRWN","TTAG","GFLG","RRNG","RNGB","RNGR", + "RNGI","RNGA","RNGE","RNGS","RNGG","PIKB","PIKR","PIKA","PIKE","PIKS", + "PIKG","TAUT","TGRE","TSCR","COIN","CPRK","GOOM","BGOM","FFWR","FBLL", + "SHLL","PUMA","HAMM","KOOP","BFLM","MAXE","MUS1","MUS2","TOAD","NDRN", + "SUPE","SUPZ","NDRL","NSPK","NBMP","HOOP","NSCR","NPRU","CAPS","SUPT", + "SPRK","BOM1","BOM2","BOM3","BOM4","ROIA","ROIB","ROIC","ROID","ROIE", + "ROIF","ROIG","ROIH","ROII","ROIJ","ROIK","ROIL","ROIM","ROIN","ROIO", + "ROIP","BBAL","GWLG","GWLR","SRBA","SRBB","SRBC","SRBD","SRBE","SRBF", + "SRBG","SRBH","SRBI","SRBJ","SRBK","SRBL","SRBM","SRBN","SRBO", }; char spr2names[NUMPLAYERSPRITES][5] = @@ -1850,6 +1850,36 @@ state_t states[NUMSTATES] = {SPR_RSPR, 2, 1, {NULL}, 0, 0, S_RDIAG8}, // S_RDIAG7 {SPR_RSPR, 1, 1, {NULL}, 0, 0, S_RDIAG1}, // S_RDIAG8 + // Yellow Side Spring + {SPR_SSWY, 0, -1, {NULL}, 0, 0, S_NULL}, // S_YHORIZ1 + {SPR_SSWY, 1, 1, {A_Pain}, 0, 0, S_YHORIZ3}, // S_YHORIZ2 + {SPR_SSWY, 2, 1, {NULL}, 0, 0, S_YHORIZ4}, // S_YHORIZ3 + {SPR_SSWY, 3, 1, {NULL}, 0, 0, S_YHORIZ5}, // S_YHORIZ4 + {SPR_SSWY, 4, 1, {NULL}, 0, 0, S_YHORIZ6}, // S_YHORIZ5 + {SPR_SSWY, 3, 1, {NULL}, 0, 0, S_YHORIZ7}, // S_YHORIZ6 + {SPR_SSWY, 2, 1, {NULL}, 0, 0, S_YHORIZ8}, // S_YHORIZ7 + {SPR_SSWY, 1, 1, {NULL}, 0, 0, S_YHORIZ1}, // S_YHORIZ8 + + // Red Side Spring + {SPR_SSWR, 0, -1, {NULL}, 0, 0, S_NULL}, // S_RHORIZ1 + {SPR_SSWR, 1, 1, {A_Pain}, 0, 0, S_RHORIZ3}, // S_RHORIZ2 + {SPR_SSWR, 2, 1, {NULL}, 0, 0, S_RHORIZ4}, // S_RHORIZ3 + {SPR_SSWR, 3, 1, {NULL}, 0, 0, S_RHORIZ5}, // S_RHORIZ4 + {SPR_SSWR, 4, 1, {NULL}, 0, 0, S_RHORIZ6}, // S_RHORIZ5 + {SPR_SSWR, 3, 1, {NULL}, 0, 0, S_RHORIZ7}, // S_RHORIZ6 + {SPR_SSWR, 2, 1, {NULL}, 0, 0, S_RHORIZ8}, // S_RHORIZ7 + {SPR_SSWR, 1, 1, {NULL}, 0, 0, S_RHORIZ1}, // S_RHORIZ8 + + // Blue Side Spring + {SPR_SSWB, 0, -1, {NULL}, 0, 0, S_NULL}, // S_BHORIZ1 + {SPR_SSWB, 1, 1, {A_Pain}, 0, 0, S_BHORIZ3}, // S_BHORIZ2 + {SPR_SSWB, 2, 1, {NULL}, 0, 0, S_BHORIZ4}, // S_BHORIZ3 + {SPR_SSWB, 3, 1, {NULL}, 0, 0, S_BHORIZ5}, // S_BHORIZ4 + {SPR_SSWB, 4, 1, {NULL}, 0, 0, S_BHORIZ6}, // S_BHORIZ5 + {SPR_SSWB, 3, 1, {NULL}, 0, 0, S_BHORIZ7}, // S_BHORIZ6 + {SPR_SSWB, 2, 1, {NULL}, 0, 0, S_BHORIZ8}, // S_BHORIZ7 + {SPR_SSWB, 1, 1, {NULL}, 0, 0, S_BHORIZ1}, // S_BHORIZ8 + // Rain {SPR_RAIN, FF_TRANS50, -1, {NULL}, 0, 0, S_NULL}, // S_RAIN1 {SPR_RAIN, FF_TRANS50, 1, {NULL}, 0, 0, S_RAIN1}, // S_RAINRETURN @@ -5283,6 +5313,87 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_RDIAG2 // raisestate }, + { // MT_YELLOWHORIZ + 558, // doomednum + S_YHORIZ1, // spawnstate + 1, // spawnhealth + S_YHORIZ2, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_spring, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 0, // mass + 16*FRACUNIT, // damage + sfx_None, // activesound + MF_SOLID|MF_SPRING|MF_NOGRAVITY, // flags + S_YHORIZ2 // raisestate + }, + + { // MT_REDHORIZ + 559, // doomednum + S_RHORIZ1, // spawnstate + 1, // spawnhealth + S_RHORIZ2, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_spring, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 0, // mass + 64*FRACUNIT, // damage + sfx_None, // activesound + MF_SOLID|MF_SPRING|MF_NOGRAVITY, // flags + S_RHORIZ2 // raisestate + }, + + { // MT_BLUEHORIZ + 560, // doomednum + S_BHORIZ1, // spawnstate + 1, // spawnhealth + S_BHORIZ2, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_spring, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 0, // mass + 4*FRACUNIT, // damage + sfx_None, // activesound + MF_SOLID|MF_SPRING|MF_NOGRAVITY, // flags + S_BHORIZ2 // raisestate + }, + { // MT_BUBBLES 500, // doomednum S_BUBBLES1, // spawnstate diff --git a/src/info.h b/src/info.h index 677d0f9e4..83faf87c4 100644 --- a/src/info.h +++ b/src/info.h @@ -448,6 +448,9 @@ typedef enum sprite SPR_SPRB, // Blue springs SPR_YSPR, // Yellow Diagonal Spring SPR_RSPR, // Red Diagonal Spring + SPR_SSWY, // Yellow Side Spring + SPR_SSWR, // Red Side Spring + SPR_SSWB, // Blue Side Spring // Environmental Effects SPR_RAIN, // Rain @@ -2348,6 +2351,36 @@ typedef enum state S_RDIAG7, S_RDIAG8, + // Yellow Side Spring + S_YHORIZ1, + S_YHORIZ2, + S_YHORIZ3, + S_YHORIZ4, + S_YHORIZ5, + S_YHORIZ6, + S_YHORIZ7, + S_YHORIZ8, + + // Red Side Spring + S_RHORIZ1, + S_RHORIZ2, + S_RHORIZ3, + S_RHORIZ4, + S_RHORIZ5, + S_RHORIZ6, + S_RHORIZ7, + S_RHORIZ8, + + // Blue Side Spring + S_BHORIZ1, + S_BHORIZ2, + S_BHORIZ3, + S_BHORIZ4, + S_BHORIZ5, + S_BHORIZ6, + S_BHORIZ7, + S_BHORIZ8, + // Rain S_RAIN1, S_RAINRETURN, @@ -3125,6 +3158,9 @@ typedef enum mobj_type MT_REDSPRING, MT_YELLOWDIAG, // Yellow Diagonal Spring MT_REDDIAG, // Red Diagonal Spring + MT_YELLOWHORIZ, // Yellow Side Spring + MT_REDHORIZ, // Red Side Spring + MT_BLUEHORIZ, // Blue Side Spring // Interactive Objects MT_BUBBLES, // Bubble source From 099e25824fcb3cbda74256e0d16e0255475b0176 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 5 Mar 2016 16:29:25 +0000 Subject: [PATCH 038/562] First person view now should correctly take the skybox centerpoint's angle into account --- src/r_main.c | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index a4e72cba9..b1a2036cc 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -972,14 +972,42 @@ void R_SkyboxFrame(player_t *player) { if (skyboxmo[1]) { + fixed_t x = 0, y = 0; if (mh->skybox_scalex > 0) - viewx += (player->mo->x - skyboxmo[1]->x) / mh->skybox_scalex; + x = (player->mo->x - skyboxmo[1]->x) / mh->skybox_scalex; else if (mh->skybox_scalex < 0) - viewx += (player->mo->x - skyboxmo[1]->x) * -mh->skybox_scalex; + x = (player->mo->x - skyboxmo[1]->x) * -mh->skybox_scalex; if (mh->skybox_scaley > 0) - viewy += (player->mo->y - skyboxmo[1]->y) / mh->skybox_scaley; + y = (player->mo->y - skyboxmo[1]->y) / mh->skybox_scaley; else if (mh->skybox_scaley < 0) - viewy += (player->mo->y - skyboxmo[1]->y) * -mh->skybox_scaley; + y = (player->mo->y - skyboxmo[1]->y) * -mh->skybox_scaley; + + if (viewmobj->angle == 0) + { + viewx += x; + viewy += y; + } + else if (viewmobj->angle == ANGLE_90) + { + viewx -= y; + viewy += x; + } + else if (viewmobj->angle == ANGLE_180) + { + viewx -= x; + viewy -= y; + } + else if (viewmobj->angle == ANGLE_270) + { + viewx += y; + viewy -= x; + } + else + { + angle_t ang = viewmobj->angle>>ANGLETOFINESHIFT; + viewx += FixedMul(x,FINECOSINE(ang)) - FixedMul(y, FINESINE(ang)); + viewy += FixedMul(x, FINESINE(ang)) + FixedMul(y,FINECOSINE(ang)); + } } if (mh->skybox_scalez > 0) viewz += player->viewz / mh->skybox_scalez; From 4ab2c336e7e19c73a1a287802dc0e1f0969a55b8 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 6 Mar 2016 19:32:07 +0000 Subject: [PATCH 039/562] Possibly fixed the issues with LibGME mentioned in issue #14. Not even the HAVE_LIBGME macro was defined apparently, huh. --- cmake/Modules/FindGME.cmake | 8 ++++---- src/CMakeLists.txt | 1 + src/sdl/CMakeLists.txt | 3 +++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cmake/Modules/FindGME.cmake b/cmake/Modules/FindGME.cmake index 3b0c68de7..ea80af454 100644 --- a/cmake/Modules/FindGME.cmake +++ b/cmake/Modules/FindGME.cmake @@ -6,16 +6,16 @@ find_path(GME_INCLUDE_DIR NAMES gme.h PATHS ${GME_PKGCONF_INCLUDE_DIRS} - /usr/include/gme - /usr/local/include/gme + "/usr/include/gme" + "/usr/local/include/gme" ) find_library(GME_LIBRARY NAMES gme PATHS ${GME_PKGCONF_LIBRARY_DIRS} - /usr/lib - /usr/local/lib + "/usr/lib" + "/usr/local/lib" ) set(GME_PROCESS_INCLUDES GME_INCLUDE_DIR) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d9e25dbb8..6ec8f2d71 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -314,6 +314,7 @@ if(${SRB2_CONFIG_HAVE_GME}) find_package(GME) if(${GME_FOUND}) set(SRB2_HAVE_GME ON) + add_definitions(-DHAVE_LIBGME) else() message(WARNING "You have specified that GME is available but it was not found.") endif() diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index b3d734521..7190efaac 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -122,6 +122,7 @@ if(${SDL2_FOUND}) add_framework(SDL2 SRB2SDL2) add_framework(SDL2_mixer SRB2SDL2) target_link_libraries(SRB2SDL2 PRIVATE + ${GME_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${OPENGL_LIBRARIES} @@ -131,6 +132,7 @@ if(${SDL2_FOUND}) target_link_libraries(SRB2SDL2 PRIVATE ${SDL2_LIBRARIES} ${SDL2_MIXER_LIBRARIES} + ${GME_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${OPENGL_LIBRARIES} @@ -198,6 +200,7 @@ if(${SDL2_FOUND}) target_include_directories(SRB2SDL2 PRIVATE ${SDL2_INCLUDE_DIRS} ${SDL2_MIXER_INCLUDE_DIRS} + ${GME_INCLUDE_DIRS} ${PNG_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${OPENGL_INCLUDE_DIRS} From 2f539a4df98b43c318a7382e8664dc88e1751c9a Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 7 Mar 2016 20:42:25 +0000 Subject: [PATCH 040/562] R_RenderThickSideRange now checks for slopes in the front sector's lightlist This appears to fix a few holes that have been known to appear with FOF slopes sometimes, dunno how they actually came about exactly but this apparently sorts them out --- src/r_segs.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/src/r_segs.c b/src/r_segs.c index ccf70338e..8222a7268 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -673,7 +673,9 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) fixed_t offsetvalue = 0; lightlist_t *light; r_lightlist_t *rlight; +#ifndef ESLOPE fixed_t lheight; +#endif line_t *newline = NULL; #ifdef ESLOPE // Render FOF sides kinda like normal sides, with the frac and step and everything @@ -751,9 +753,49 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) for (i = p = 0; i < dc_numlights; i++) { +#ifdef ESLOPE + fixed_t leftheight, rightheight; + fixed_t pfloorleft, pfloorright; +#endif light = &frontsector->lightlist[i]; rlight = &dc_lightlist[p]; +#ifdef ESLOPE + if (light->slope) { + leftheight = P_GetZAt(light->slope, ds->leftpos.x, ds->leftpos.y); + rightheight = P_GetZAt(light->slope, ds->rightpos.x, ds->rightpos.y); + } else + leftheight = rightheight = light->height; + if (*pfloor->b_slope) { + pfloorleft = P_GetZAt(*pfloor->b_slope, ds->leftpos.x, ds->leftpos.y); + pfloorright = P_GetZAt(*pfloor->b_slope, ds->rightpos.x, ds->rightpos.y); + } else + pfloorleft = pfloorright = *pfloor->bottomheight; + + if (leftheight < pfloorleft && rightheight < pfloorright) + continue; + + if (*pfloor->t_slope) { + pfloorleft = P_GetZAt(*pfloor->t_slope, ds->leftpos.x, ds->leftpos.y); + pfloorright = P_GetZAt(*pfloor->t_slope, ds->rightpos.x, ds->rightpos.y); + } else + pfloorleft = pfloorright = *pfloor->topheight; + + if (leftheight > pfloorleft && rightheight > pfloorright && i+1 < dc_numlights) + { + lightlist_t *nextlight = &frontsector->lightlist[i+1]; + if (nextlight->slope ? P_GetZAt(nextlight->slope, ds->leftpos.x, ds->leftpos.y) : nextlight->height > pfloorleft + && nextlight->slope ? P_GetZAt(nextlight->slope, ds->rightpos.x, ds->rightpos.y) : nextlight->height > pfloorright) + continue; + } + + leftheight -= viewz; + rightheight -= viewz; + rlight->height = (centeryfrac) - FixedMul(leftheight, ds->scale1); + rlight->heightstep = (centeryfrac) - FixedMul(rightheight, ds->scale2); + rlight->heightstep = (rlight->heightstep-rlight->height)/(ds->x2-ds->x1+1); + rlight->height -= rlight->heightstep; +#else if (light->height < *pfloor->bottomheight) continue; @@ -763,13 +805,29 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) lheight = light->height;// > *pfloor->topheight ? *pfloor->topheight + FRACUNIT : light->height; rlight->heightstep = -FixedMul (rw_scalestep, (lheight - viewz)); rlight->height = (centeryfrac) - FixedMul((lheight - viewz), spryscale) - rlight->heightstep; +#endif rlight->flags = light->flags; - if (light->flags & FF_CUTLEVEL) { +#ifdef ESLOPE + if (*light->caster->b_slope) { + leftheight = P_GetZAt(*light->caster->b_slope, ds->leftpos.x, ds->leftpos.y); + rightheight = P_GetZAt(*light->caster->b_slope, ds->rightpos.x, ds->rightpos.y); + } else + leftheight = rightheight = light->caster->bottomheight; + + leftheight -= viewz; + rightheight -= viewz; + + rlight->botheight = (centeryfrac) - FixedMul(leftheight, ds->scale1); + rlight->botheightstep = (centeryfrac) - FixedMul(rightheight, ds->scale2); + rlight->botheightstep = (rlight->botheightstep-rlight->botheight)/(ds->x2-ds->x1+1); + rlight->botheight -= rlight->botheightstep; +#else lheight = *light->caster->bottomheight;// > *pfloor->topheight ? *pfloor->topheight + FRACUNIT : *light->caster->bottomheight; rlight->botheightstep = -FixedMul (rw_scalestep, (lheight - viewz)); rlight->botheight = (centeryfrac) - FixedMul((lheight - viewz), spryscale) - rlight->botheightstep; +#endif } rlight->lightlevel = *light->lightlevel; From 60ea2ecb77b4bb0926169d7bf879b2dfbf387a50 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 7 Mar 2016 21:02:35 +0000 Subject: [PATCH 041/562] Whoops, forgot these --- src/r_segs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_segs.c b/src/r_segs.c index 8222a7268..e31d570b6 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -814,7 +814,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) leftheight = P_GetZAt(*light->caster->b_slope, ds->leftpos.x, ds->leftpos.y); rightheight = P_GetZAt(*light->caster->b_slope, ds->rightpos.x, ds->rightpos.y); } else - leftheight = rightheight = light->caster->bottomheight; + leftheight = rightheight = *light->caster->bottomheight; leftheight -= viewz; rightheight -= viewz; From eab51414f348470edfb7b84e2157db7d9b1af39d Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 7 Mar 2016 21:16:02 +0000 Subject: [PATCH 042/562] Fix typo in A_ChangeAngleAbsolute --- src/p_enemy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 367d5714a..ffb690822 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -7223,7 +7223,7 @@ void A_ChangeAngleAbsolute(mobj_t *actor) //const angle_t amin = FixedAngle(locvar1*FRACUNIT); //const angle_t amax = FixedAngle(locvar2*FRACUNIT); #ifdef HAVE_BLUA - if (LUA_CallAction("A_ChangeAngelAbsolute", actor)) + if (LUA_CallAction("A_ChangeAngleAbsolute", actor)) return; #endif From 436bcdf19aa9da266e421326e7129a848dd036a6 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Tue, 8 Mar 2016 23:43:43 -0800 Subject: [PATCH 043/562] Objectplace handles slopes. Sorry MI, I'm hijacking your branch for a bit. --- src/m_cheat.c | 85 ++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 70 insertions(+), 15 deletions(-) diff --git a/src/m_cheat.c b/src/m_cheat.c index 473fbbf75..51b414df3 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -31,6 +31,7 @@ #include "v_video.h" #include "z_zone.h" +#include "p_slopes.h" #include "lua_script.h" #include "lua_hook.h" @@ -857,9 +858,19 @@ static void OP_CycleThings(INT32 amt) static boolean OP_HeightOkay(player_t *player, UINT8 ceiling) { + sector_t *sec = player->mo->subsector->sector; + if (ceiling) { - if (((player->mo->subsector->sector->ceilingheight - player->mo->z - player->mo->height)>>FRACBITS) >= (1 << (16-ZSHIFT))) +#ifdef ESLOPE + // Truncate position to match where mapthing would be when spawned + // (this applies to every further P_GetZAt call as well) + fixed_t cheight = sec->c_slope ? P_GetZAt(sec->c_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->ceilingheight; +#else + fixed_t cheight = sec->ceilingheight; +#endif + + if (((cheight - player->mo->z - player->mo->height)>>FRACBITS) >= (1 << (16-ZSHIFT))) { CONS_Printf(M_GetText("Sorry, you're too %s to place this object (max: %d %s).\n"), M_GetText("low"), (1 << (16-ZSHIFT)), M_GetText("below top ceiling")); @@ -868,7 +879,12 @@ static boolean OP_HeightOkay(player_t *player, UINT8 ceiling) } else { - if (((player->mo->z - player->mo->subsector->sector->floorheight)>>FRACBITS) >= (1 << (16-ZSHIFT))) +#ifdef ESLOPE + fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->floorheight; +#else + fixed_t fheight = sec->floorheight; +#endif + if (((player->mo->z - fheight)>>FRACBITS) >= (1 << (16-ZSHIFT))) { CONS_Printf(M_GetText("Sorry, you're too %s to place this object (max: %d %s).\n"), M_GetText("high"), (1 << (16-ZSHIFT)), M_GetText("above bottom floor")); @@ -881,6 +897,7 @@ static boolean OP_HeightOkay(player_t *player, UINT8 ceiling) static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean ceiling) { mapthing_t *mt = mapthings; + sector_t *sec = player->mo->subsector->sector; #ifdef HAVE_BLUA LUA_InvalidateMapthings(); @@ -913,9 +930,23 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c mt->x = (INT16)(player->mo->x>>FRACBITS); mt->y = (INT16)(player->mo->y>>FRACBITS); if (ceiling) - mt->options = (UINT16)((player->mo->subsector->sector->ceilingheight - player->mo->z - player->mo->height)>>FRACBITS); + { +#ifdef ESLOPE + fixed_t cheight = sec->c_slope ? P_GetZAt(sec->c_slope, mt->x << FRACBITS, mt->y << FRACBITS) : sec->ceilingheight; +#else + fixed_t cheight = sec->ceilingheight; +#endif + mt->options = (UINT16)((cheight - player->mo->z - player->mo->height)>>FRACBITS); + } else - mt->options = (UINT16)((player->mo->z - player->mo->subsector->sector->floorheight)>>FRACBITS); + { +#ifdef ESLOPE + fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, mt->x << FRACBITS, mt->y << FRACBITS) : sec->floorheight; +#else + fixed_t fheight = sec->floorheight; +#endif + mt->options = (UINT16)((player->mo->z - fheight)>>FRACBITS); + } mt->options <<= ZSHIFT; mt->angle = (INT16)(FixedInt(AngleFixed(player->mo->angle))); @@ -969,6 +1000,13 @@ void OP_NightsObjectplace(player_t *player) { UINT16 angle = (UINT16)(player->anotherflyangle % 360); INT16 temp = (INT16)FixedInt(AngleFixed(player->mo->angle)); // Traditional 2D Angle + sector_t *sec = player->mo->subsector->sector; +#ifdef ESLOPE + fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->floorheight; +#else + fixed_t fheight = sec->floorheight; +#endif + player->pflags |= PF_ATTACKDOWN; @@ -983,7 +1021,7 @@ void OP_NightsObjectplace(player_t *player) temp += 90; temp %= 360; - mt->options = (UINT16)((player->mo->z - player->mo->subsector->sector->floorheight)>>FRACBITS); + mt->options = (UINT16)((player->mo->z - fheight)>>FRACBITS); mt->angle = (INT16)(mt->angle+(INT16)((FixedInt(FixedDiv(temp*FRACUNIT, 360*(FRACUNIT/256))))<<8)); P_SpawnHoopsAndRings(mt); @@ -1117,6 +1155,33 @@ void OP_ObjectplaceMovement(player_t *player) else player->viewz = player->mo->z + player->viewheight; + // Display flag information + // Moved up so it always updates. + { + sector_t *sec = player->mo->subsector->sector; + + if (!!(mobjinfo[op_currentthing].flags & MF_SPAWNCEILING) ^ !!(cv_opflags.value & MTF_OBJECTFLIP)) + { +#ifdef ESLOPE + fixed_t cheight = sec->c_slope ? P_GetZAt(sec->c_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->ceilingheight; +#else + fixed_t cheight = sec->ceilingheight; +#endif + op_displayflags = (UINT16)((cheight - player->mo->z - mobjinfo[op_currentthing].height)>>FRACBITS); + } + else + { +#ifdef ESLOPE + fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->floorheight; +#else + fixed_t fheight = sec->floorheight; +#endif + op_displayflags = (UINT16)((player->mo->z - fheight)>>FRACBITS); + } + op_displayflags <<= ZSHIFT; + op_displayflags |= (UINT16)cv_opflags.value; + } + if (player->pflags & PF_ATTACKDOWN) { // Are ANY objectplace buttons pressed? If no, remove flag. @@ -1182,16 +1247,6 @@ void OP_ObjectplaceMovement(player_t *player) CONS_Printf(M_GetText("Placed object type %d at %d, %d, %d, %d\n"), mt->type, mt->x, mt->y, mt->options>>ZSHIFT, mt->angle); } - - // Display flag information - { - if (!!(mobjinfo[op_currentthing].flags & MF_SPAWNCEILING) ^ !!(cv_opflags.value & MTF_OBJECTFLIP)) - op_displayflags = (UINT16)((player->mo->subsector->sector->ceilingheight - player->mo->z - mobjinfo[op_currentthing].height)>>FRACBITS); - else - op_displayflags = (UINT16)((player->mo->z - player->mo->subsector->sector->floorheight)>>FRACBITS); - op_displayflags <<= ZSHIFT; - op_displayflags |= (UINT16)cv_opflags.value; - } } // From 54f95eb3877ce02eeab87cad1bf1ccd835990c83 Mon Sep 17 00:00:00 2001 From: JTE Date: Wed, 20 May 2015 23:54:04 -0400 Subject: [PATCH 044/562] Revert "Change angle_t handling in Lua." This partially reverts commit ef0e61fc3357fc8fb5367b522dd738edc96b2a7a. --- src/dehacked.c | 60 ++++++++++++++++++++++++------------------------ src/lua_script.h | 6 ++--- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index c21e8fb99..47c87eefc 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7267,36 +7267,36 @@ struct { {"FF_GOOWATER",FF_GOOWATER}, ///< Used with ::FF_SWIMMABLE. Makes thick bouncey goop. // Angles - {"ANG1",ANG1>>16}, - {"ANG2",ANG2>>16}, - {"ANG10",ANG10>>16}, - {"ANG15",ANG15>>16}, - {"ANG20",ANG20>>16}, - {"ANG30",ANG30>>16}, - {"ANG60",ANG60>>16}, - {"ANG64h",ANG64h>>16}, - {"ANG105",ANG105>>16}, - {"ANG210",ANG210>>16}, - {"ANG255",ANG255>>16}, - {"ANG340",ANG340>>16}, - {"ANG350",ANG350>>16}, - {"ANGLE_11hh",ANGLE_11hh>>16}, - {"ANGLE_22h",ANGLE_22h>>16}, - {"ANGLE_45",ANGLE_45>>16}, - {"ANGLE_67h",ANGLE_67h>>16}, - {"ANGLE_90",ANGLE_90>>16}, - {"ANGLE_112h",ANGLE_112h>>16}, - {"ANGLE_135",ANGLE_135>>16}, - {"ANGLE_157h",ANGLE_157h>>16}, - {"ANGLE_180",ANGLE_180>>16}, - {"ANGLE_202h",ANGLE_202h>>16}, - {"ANGLE_225",ANGLE_225>>16}, - {"ANGLE_247h",ANGLE_247h>>16}, - {"ANGLE_270",ANGLE_270>>16}, - {"ANGLE_292h",ANGLE_292h>>16}, - {"ANGLE_315",ANGLE_315>>16}, - {"ANGLE_337h",ANGLE_337h>>16}, - {"ANGLE_MAX",ANGLE_MAX>>16}, + {"ANG1",ANG1}, + {"ANG2",ANG2}, + {"ANG10",ANG10}, + {"ANG15",ANG15}, + {"ANG20",ANG20}, + {"ANG30",ANG30}, + {"ANG60",ANG60}, + {"ANG64h",ANG64h}, + {"ANG105",ANG105}, + {"ANG210",ANG210}, + {"ANG255",ANG255}, + {"ANG340",ANG340}, + {"ANG350",ANG350}, + {"ANGLE_11hh",ANGLE_11hh}, + {"ANGLE_22h",ANGLE_22h}, + {"ANGLE_45",ANGLE_45}, + {"ANGLE_67h",ANGLE_67h}, + {"ANGLE_90",ANGLE_90}, + {"ANGLE_112h",ANGLE_112h}, + {"ANGLE_135",ANGLE_135}, + {"ANGLE_157h",ANGLE_157h}, + {"ANGLE_180",ANGLE_180}, + {"ANGLE_202h",ANGLE_202h}, + {"ANGLE_225",ANGLE_225}, + {"ANGLE_247h",ANGLE_247h}, + {"ANGLE_270",ANGLE_270}, + {"ANGLE_292h",ANGLE_292h}, + {"ANGLE_315",ANGLE_315}, + {"ANGLE_337h",ANGLE_337h}, + {"ANGLE_MAX",ANGLE_MAX}, // P_Chase directions (dirtype_t) {"DI_NODIR",DI_NODIR}, diff --git a/src/lua_script.h b/src/lua_script.h index ec67703c3..b4b668ce7 100644 --- a/src/lua_script.h +++ b/src/lua_script.h @@ -30,9 +30,9 @@ #define lua_pushfixed(L, f) lua_pushinteger(L, f) // angle_t casting -// we reduce the angle to a fixed point between 0.0 and 1.0 -#define luaL_checkangle(L, i) (((angle_t)(luaL_checkfixed(L, i)&0xFFFF))<<16) -#define lua_pushangle(L, a) lua_pushfixed(L, a>>16) +// TODO deal with signedness +#define luaL_checkangle(L, i) ((angle_t)luaL_checkinteger(L, i)) +#define lua_pushangle(L, a) lua_pushinteger(L, a) #ifdef _DEBUG void LUA_ClearExtVars(void); From 280e932f02c64a8ac3d01bd89e5e578938d32363 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 9 Mar 2016 13:38:30 +0000 Subject: [PATCH 045/562] Shifted down the last few mobj eflags to close gap left by MF2_PUSHED -> MFE_PUSHED undo --- src/p_mobj.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/p_mobj.h b/src/p_mobj.h index e24b09652..44b3ceeec 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -232,11 +232,10 @@ typedef enum MFE_VERTICALFLIP = 1<<5, // Goo water MFE_GOOWATER = 1<<6, - // free: to and including 1<<7 // Mobj was already sprung this tic - MFE_SPRUNG = 1<<8, + MFE_SPRUNG = 1<<7, // Platform movement - MFE_APPLYPMOMZ = 1<<9, + MFE_APPLYPMOMZ = 1<<8, // free: to and including 1<<15 } mobjeflag_t; From bf415b8618c51f7826cb76ab91fe4a0003c3d238 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 9 Mar 2016 13:59:10 +0000 Subject: [PATCH 046/562] Revert "Shifted down the last few mobj eflags to close gap left by MF2_PUSHED -> MFE_PUSHED undo" This reverts commit 280e932f02c64a8ac3d01bd89e5e578938d32363. --- src/p_mobj.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.h b/src/p_mobj.h index 44b3ceeec..e24b09652 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -232,10 +232,11 @@ typedef enum MFE_VERTICALFLIP = 1<<5, // Goo water MFE_GOOWATER = 1<<6, + // free: to and including 1<<7 // Mobj was already sprung this tic - MFE_SPRUNG = 1<<7, + MFE_SPRUNG = 1<<8, // Platform movement - MFE_APPLYPMOMZ = 1<<8, + MFE_APPLYPMOMZ = 1<<9, // free: to and including 1<<15 } mobjeflag_t; From 4625118ee863b43a3c8828c79879f92ff649b850 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 9 Mar 2016 14:03:20 +0000 Subject: [PATCH 047/562] MFE_DUMMY now exists to fill the slot where MFE_PUSHED was, bleh --- src/dehacked.c | 1 + src/p_mobj.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dehacked.c b/src/dehacked.c index 926c3a488..31cf37636 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -6711,6 +6711,7 @@ static const char *const MOBJEFLAG_LIST[] = { "JUSTSTEPPEDDOWN", // used for ramp sectors "VERTICALFLIP", // Vertically flip sprite/allow upside-down physics "GOOWATER", // Goo water + "DUMMY", // free: 1<<7 "SPRUNG", // Mobj was already sprung this tic "APPLYPMOMZ", // Platform movement NULL diff --git a/src/p_mobj.h b/src/p_mobj.h index e24b09652..3979b1304 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -232,7 +232,8 @@ typedef enum MFE_VERTICALFLIP = 1<<5, // Goo water MFE_GOOWATER = 1<<6, - // free: to and including 1<<7 + // free: 1<<7 + MFE_DUMMY = 1<<7, // Mobj was already sprung this tic MFE_SPRUNG = 1<<8, // Platform movement From f40cfb0271a5945a736c6edafd012174b09f71e8 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Wed, 9 Mar 2016 06:22:40 -0800 Subject: [PATCH 048/562] Revert "MFE_DUMMY now exists to fill the slot where MFE_PUSHED was, bleh" This reverts commit 4625118ee863b43a3c8828c79879f92ff649b850. --- src/dehacked.c | 1 - src/p_mobj.h | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 31cf37636..926c3a488 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -6711,7 +6711,6 @@ static const char *const MOBJEFLAG_LIST[] = { "JUSTSTEPPEDDOWN", // used for ramp sectors "VERTICALFLIP", // Vertically flip sprite/allow upside-down physics "GOOWATER", // Goo water - "DUMMY", // free: 1<<7 "SPRUNG", // Mobj was already sprung this tic "APPLYPMOMZ", // Platform movement NULL diff --git a/src/p_mobj.h b/src/p_mobj.h index 3979b1304..e24b09652 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -232,8 +232,7 @@ typedef enum MFE_VERTICALFLIP = 1<<5, // Goo water MFE_GOOWATER = 1<<6, - // free: 1<<7 - MFE_DUMMY = 1<<7, + // free: to and including 1<<7 // Mobj was already sprung this tic MFE_SPRUNG = 1<<8, // Platform movement From a7cb049b65ddd126c1532d4a5f13dbba35942947 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Wed, 9 Mar 2016 06:23:57 -0800 Subject: [PATCH 049/562] leave a dummy string in dehacked, nothing more. a courtesy fuck you to gitlab for making me have to keep the previous screwed up bullshit in this branch. --- src/dehacked.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dehacked.c b/src/dehacked.c index 926c3a488..61bccb4f6 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -6711,6 +6711,7 @@ static const char *const MOBJEFLAG_LIST[] = { "JUSTSTEPPEDDOWN", // used for ramp sectors "VERTICALFLIP", // Vertically flip sprite/allow upside-down physics "GOOWATER", // Goo water + "\x01", // free: 1<<7 (name un-matchable) "SPRUNG", // Mobj was already sprung this tic "APPLYPMOMZ", // Platform movement NULL From 83e9eb6df4a0e75b3dbc958d4d0f482a7059e314 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Wed, 9 Mar 2016 18:30:11 -0800 Subject: [PATCH 050/562] patch.dta officially in use. Version number updated. --- src/config.h.in | 8 ++++++++ src/d_main.c | 18 +++++++++++++----- src/doomdef.h | 12 ++++++++---- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/config.h.in b/src/config.h.in index 5cd75fa5a..eef4fec13 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -15,7 +15,9 @@ #define ASSET_HASH_PLAYER_DTA "${SRB2_ASSET_player.dta_HASH}" #define ASSET_HASH_RINGS_DTA "${SRB2_ASSET_rings.dta_HASH}" #define ASSET_HASH_ZONES_DTA "${SRB2_ASSET_zones.dta_HASH}" +#ifdef USE_PATCH_DTA #define ASSET_HASH_PATCH_DTA "${SRB2_ASSET_patch.dta_HASH}" +#endif #define SRB2_COMP_REVISION "${SRB2_COMP_REVISION}" #define SRB2_COMP_BRANCH "${SRB2_COMP_BRANCH}" @@ -26,10 +28,16 @@ #else +/* Manually defined asset hashes for non-CMake builds + * Last updated 2000 / 00 / 00 + */ #define ASSET_HASH_SRB2_SRB "c1b9577687f8a795104aef4600720ea7" #define ASSET_HASH_ZONES_DTA "303838c6c534d9540288360fa49cca60" #define ASSET_HASH_PLAYER_DTA "cfca0f1c73023cbbd8f844f45480f799" #define ASSET_HASH_RINGS_DTA "85901ad4bf94637e5753d2ac2c03ea26" +#ifdef USE_PATCH_DTA +#define ASSET_HASH_PATCH_DTA "0c66790502e648bfce90fdc5bb15722e" +#endif #endif #endif diff --git a/src/d_main.c b/src/d_main.c index 3918d8118..1349a64e4 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -841,8 +841,10 @@ static void IdentifyVersion(void) // Add the weapons D_AddFile(va(pandf,srb2waddir,"rings.dta")); +#ifdef USE_PATCH_DTA // Add our crappy patches to fix our bugs - // D_AddFile(va(pandf,srb2waddir,"patch.dta")); + D_AddFile(va(pandf,srb2waddir,"patch.dta")); +#endif #if !defined (HAVE_SDL) || defined (HAVE_MIXER) { @@ -1133,12 +1135,18 @@ void D_SRB2Main(void) W_VerifyFileMD5(1, ASSET_HASH_ZONES_DTA); // zones.dta W_VerifyFileMD5(2, ASSET_HASH_PLAYER_DTA); // player.dta W_VerifyFileMD5(3, ASSET_HASH_RINGS_DTA); // rings.dta - //W_VerifyFileMD5(4, "0c66790502e648bfce90fdc5bb15722e"); // patch.dta - // don't check music.dta because people like to modify it, and it doesn't matter if they do - // ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for. +#ifdef USE_PATCH_DTA + W_VerifyFileMD5(4, ASSET_HASH_PATCH_DTA); // patch.dta #endif - mainwads = 4; // there are 5 wads not to unload + // don't check music.dta because people like to modify it, and it doesn't matter if they do + // ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for. +#endif //ifndef DEVELOP + + mainwads = 4; // there are 4 wads not to unload +#ifdef USE_PATCH_DTA + ++mainwads; // patch.dta adds one more +#endif cht_Init(); diff --git a/src/doomdef.h b/src/doomdef.h index a44fe4779..c3a0bfa6e 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -148,13 +148,17 @@ extern FILE *logstream; // we use comprevision and compbranch instead. #else #define VERSION 201 // Game version -#define SUBVERSION 14 // more precise version number -#define VERSIONSTRING "v2.1.14" -#define VERSIONSTRINGW L"v2.1.14" +#define SUBVERSION 15 // more precise version number +#define VERSIONSTRING "v2.1.15" +#define VERSIONSTRINGW L"v2.1.15" // Hey! If you change this, add 1 to the MODVERSION below! // Otherwise we can't force updates! #endif +// Does this version require an added patch file? +// Comment or uncomment this as necessary. +#define USE_PATCH_DTA + // Modification options // If you want to take advantage of the Master Server's ability to force clients to update // to the latest version, fill these out. Otherwise, just comment out UPDATE_ALERT and leave @@ -208,7 +212,7 @@ extern FILE *logstream; // it's only for detection of the version the player is using so the MS can alert them of an update. // Only set it higher, not lower, obviously. // Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1". -#define MODVERSION 19 +#define MODVERSION 20 // ========================================================================= From 5b89164cf7e4ada2ac999ed41d163059c2a1ec76 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 10 Mar 2016 20:50:54 +0000 Subject: [PATCH 051/562] Fix camera going nuts around intangible polyobjects --- src/p_map.c | 2 +- src/p_user.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 61d57dcd1..5c5d9cdfd 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1616,7 +1616,7 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam) po->validcount = validcount; - if (!P_PointInsidePolyobj(po, x, y)) + if (!P_PointInsidePolyobj(po, x, y) || !(po->flags & POF_SOLID)) { plink = (polymaplink_t *)(plink->link.next); continue; diff --git a/src/p_user.c b/src/p_user.c index 03b2c1dd8..c08eea5c6 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8163,7 +8163,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall po->validcount = validcount; - if (!P_PointInsidePolyobj(po, x, y)) + if (!P_PointInsidePolyobj(po, x, y) || !(po->flags & POF_SOLID)) { plink = (polymaplink_t *)(plink->link.next); continue; From 509516f59f2711856c0edbbacbf6f3fa11de8b36 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 10 Mar 2016 16:38:06 -0500 Subject: [PATCH 052/562] travis: enable apt and ccache cache --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index c652584f8..5815e711f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,8 @@ compiler: - clang cache: + apt: true + ccache: true directories: - $HOME/srb2_cache From c67683eb0af0351396a93120b3f14199964ac983 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 12 Mar 2016 19:59:32 +0000 Subject: [PATCH 053/562] Fixed slope walls displaying sprites through them if they weren't completely above you Sadly this does not fix ALL sprite issues, but just some of them at the least --- src/r_segs.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/r_segs.c b/src/r_segs.c index e31d570b6..fdae62d50 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1859,7 +1859,10 @@ void R_StoreWallRange(INT32 start, INT32 stop) { ds_p->silhouette = SIL_BOTTOM; #ifdef ESLOPE - ds_p->bsilheight = (frontsector->f_slope ? INT32_MAX : frontsector->floorheight); + if ((backsector->f_slope ? P_GetZAt(backsector->f_slope, viewx, viewy) : backsector->floorheight) > viewz) + ds_p->bsilheight = INT32_MAX; + else + ds_p->bsilheight = (frontsector->f_slope ? INT32_MAX : frontsector->floorheight); #else ds_p->bsilheight = frontsector->floorheight; #endif @@ -1883,7 +1886,10 @@ void R_StoreWallRange(INT32 start, INT32 stop) { ds_p->silhouette |= SIL_TOP; #ifdef ESLOPE - ds_p->tsilheight = (frontsector->c_slope ? INT32_MIN : frontsector->ceilingheight); + if ((backsector->c_slope ? P_GetZAt(backsector->c_slope, viewx, viewy) : backsector->ceilingheight) < viewz) + ds_p->tsilheight = INT32_MIN; + else + ds_p->tsilheight = (frontsector->c_slope ? INT32_MIN : frontsector->ceilingheight); #else ds_p->tsilheight = frontsector->ceilingheight; #endif From accab7da6a05f79f5ea0e3d2db4a76ff4052f8da Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 12 Mar 2016 23:03:56 +0000 Subject: [PATCH 054/562] Fixed precipitation not checking for slopes --- src/p_mobj.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index f074917bf..90a7daa9b 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3710,10 +3710,15 @@ static void CalculatePrecipFloor(precipmobj_t *mobj) mobjsecsubsec = mobj->subsector->sector; else return; - mobj->floorz = mobjsecsubsec->floorheight; + mobj->floorz = +#ifdef ESLOPE + mobjsecsubsec->f_slope ? P_GetZAt(mobjsecsubsec->f_slope, mobj->x, mobj->y) : +#endif + mobjsecsubsec->floorheight; if (mobjsecsubsec->ffloors) { ffloor_t *rover; + fixed_t topheight; for (rover = mobjsecsubsec->ffloors; rover; rover = rover->next) { @@ -3724,8 +3729,15 @@ static void CalculatePrecipFloor(precipmobj_t *mobj) if (!(rover->flags & FF_BLOCKOTHERS) && !(rover->flags & FF_SWIMMABLE)) continue; - if (*rover->topheight > mobj->floorz) - mobj->floorz = *rover->topheight; +#ifdef ESLOPE + if (*rover->t_slope) + topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y); + else +#endif + topheight = *rover->topheight; + + if (topheight > mobj->floorz) + mobj->floorz = topheight; } } } @@ -7768,6 +7780,7 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype { state_t *st; precipmobj_t *mobj = Z_Calloc(sizeof (*mobj), PU_LEVEL, NULL); + fixed_t starting_floorz; mobj->x = x; mobj->y = y; @@ -7786,8 +7799,16 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype // set subsector and/or block links P_SetPrecipitationThingPosition(mobj); - mobj->floorz = mobj->subsector->sector->floorheight; - mobj->ceilingz = mobj->subsector->sector->ceilingheight; + mobj->floorz = starting_floorz = +#ifdef ESLOPE + mobj->subsector->sector->f_slope ? P_GetZAt(mobj->subsector->sector->f_slope, x, y) : +#endif + mobj->subsector->sector->floorheight; + mobj->ceilingz = +#ifdef ESLOPE + mobj->subsector->sector->c_slope ? P_GetZAt(mobj->subsector->sector->c_slope, x, y) : +#endif + mobj->subsector->sector->ceilingheight; mobj->z = z; mobj->momz = mobjinfo[type].speed; @@ -7797,7 +7818,7 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype CalculatePrecipFloor(mobj); - if (mobj->floorz != mobj->subsector->sector->floorheight) + if (mobj->floorz != starting_floorz) mobj->precipflags |= PCF_FOF; else if (GETSECSPECIAL(mobj->subsector->sector->special, 1) == 7 || GETSECSPECIAL(mobj->subsector->sector->special, 1) == 6 From f9949a3026a7ac965c036a2e7c12bbc9f5627a4b Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 14 Mar 2016 12:24:51 -0400 Subject: [PATCH 055/562] dropping NOVERSION, you will not build SRB2 without a SCM --- src/Makefile | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Makefile b/src/Makefile index d4cc64a4b..8520d8d5e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -262,9 +262,7 @@ else OBJS+=$(OBJDIR)/hw3sound.o endif -ifndef NOVERSION OPTS += -DCOMPVERSION -endif ifndef NONX86 ifndef GCC29 @@ -550,9 +548,6 @@ cleandep: $(REMOVE) comptime.h pre-build: -ifdef NOVERSION - -@touch comptime.c -else ifdef WINDOWSHELL -..\comptime.bat . else From f5b56f2a076e89a59ad6fdcdb6e4c2e26f02c3e1 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 14 Mar 2016 12:28:22 -0400 Subject: [PATCH 056/562] fixup --- src/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 8520d8d5e..701cdcfb1 100644 --- a/src/Makefile +++ b/src/Makefile @@ -553,7 +553,6 @@ ifdef WINDOWSHELL else -@../comptime.sh . endif -endif clean: $(REMOVE) *~ *.flc From 2ecdd9e6f9ea891c7cead7f3331b1b626df2681b Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 14 Jan 2016 04:31:48 -0800 Subject: [PATCH 057/562] Branch and revision information in builds Also makes comptime.bat work with git if able. Development builds will now show the branch and the SHA1 hash of the revision. Also been tested to work with subversion, where it displays "Subversion r####". You know, just in case. --- comptime.bat | 28 ++++++++++++++++++++++++---- comptime.sh | 10 +++++++--- src/comptime.c | 2 ++ src/d_netcmd.c | 4 ++++ src/doomdef.h | 7 +++++-- src/m_menu.c | 9 ++++++--- src/m_misc.c | 10 ++++------ 7 files changed, 52 insertions(+), 18 deletions(-) diff --git a/comptime.bat b/comptime.bat index 23ee7ea55..b8450ff64 100644 --- a/comptime.bat +++ b/comptime.bat @@ -1,10 +1,30 @@ @ECHO OFF -set REV=Unknown +set BRA=Unknown +set REV=illegal + copy nul: /b +%1\comptime.c tmp.$$$ > nul move tmp.$$$ %1\comptime.c > nul -SET REV=illegal -FOR /F "usebackq" %%s IN (`svnversion %1`) DO @SET REV=%%s + +if exist .git goto gitrev +if exist .svn goto svnrev +goto filwri + +:gitrev +set GIT=%2 +if "%GIT%"=="" set GIT=git +FOR /F "usebackq" %%s IN (`%GIT% rev-parse --abbrev-ref HEAD`) DO @SET BRA=%%s +FOR /F "usebackq" %%s IN (`%GIT% rev-parse HEAD`) DO @SET REV=%%s +set REV=%REV:~0,8% +goto filwri + +:svnrev +set BRA=Subversion +FOR /F "usebackq" %%s IN (`svnversion .`) DO @SET REV=%%s +goto filwri + +:filwri ECHO // Do not edit! This file was autogenerated > %1\comptime.h ECHO // by the %0 batch file >> %1\comptime.h ECHO // >> %1\comptime.h -ECHO const char* comprevision = "r%REV%"; >> %1\comptime.h +ECHO const char* compbranch = "%BRA%"; >> %1\comptime.h +ECHO const char* comprevision = "%REV%"; >> %1\comptime.h diff --git a/comptime.sh b/comptime.sh index 703bb2d35..71c5f08aa 100755 --- a/comptime.sh +++ b/comptime.sh @@ -5,13 +5,15 @@ if [ x"$1" != x ]; then fi versiongit() { - gitversion=`git describe` + gitbranch=`git rev-parse --abbrev-ref HEAD` + gitversion=`git rev-parse HEAD` cat < $path/comptime.h // Do not edit! This file was autogenerated -// by the $0 script with git svn +// by the $0 script with git // -const char* comprevision = "$gitversion"; +const char* compbranch = "$gitbranch"; +const char* comprevision = "${gitversion:0:8}"; EOF exit 0 } @@ -23,6 +25,7 @@ versionsvn() { // Do not edit! This file was autogenerated // by the $0 script with subversion // +const char* compbranch = "Subversion"; const char* comprevision = "r$svnrevision"; EOF exit 0 @@ -34,6 +37,7 @@ versionfake() { // Do not edit! This file was autogenerated // by the $0 script with an unknown or nonexist SCM // +const char* compbranch = "Unknown"; const char* comprevision = "illegal"; EOF } diff --git a/src/comptime.c b/src/comptime.c index a4dc5b0f9..9f1fe2f71 100644 --- a/src/comptime.c +++ b/src/comptime.c @@ -9,12 +9,14 @@ #if (defined(CMAKECONFIG)) #include "config.h" +const char *compbranch = ""; // hell if I know what to do with cmake const char *comprevision = SRB2_COMP_REVISION; #elif (defined(COMPVERSION)) #include "comptime.h" #else +const char *compbranch = "Unknown"; const char *comprevision = "illegal"; #endif diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 266161c7c..30208422f 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3179,7 +3179,11 @@ static void Command_ListWADS_f(void) */ static void Command_Version_f(void) { +#ifdef DEVELOP + CONS_Printf("Sonic Robo Blast 2 %s-%s (%s %s)\n", compbranch, comprevision, compdate, comptime); +#else CONS_Printf("Sonic Robo Blast 2 %s (%s %s %s)\n", VERSIONSTRING, compdate, comptime, comprevision); +#endif } #ifdef UPDATE_ALERT diff --git a/src/doomdef.h b/src/doomdef.h index e4b426ebc..fe7fad8ae 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -141,7 +141,10 @@ extern FILE *logstream; #if 0 #define VERSION 0 // Game version #define SUBVERSION 0 // more precise version number -#define VERSIONSTRING "Trunk" +#define VERSIONSTRING "Development EXE" +#define VERSIONSTRINGW L"Development EXE" +// most interface strings are ignored in development mode. +// we use comprevision and compbranch instead. #else #define VERSION 201 // Game version #define SUBVERSION 14 // more precise version number @@ -413,7 +416,7 @@ INT32 I_GetKey(void); #endif // Compile date and time and revision. -extern const char *compdate, *comptime, *comprevision; +extern const char *compdate, *comptime, *comprevision, *compbranch; // Disabled code and code under testing // None of these that are disabled in the normal build are guaranteed to work perfectly diff --git a/src/m_menu.c b/src/m_menu.c index 1e7745535..780de7ad5 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2463,11 +2463,14 @@ void M_Drawer(void) V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, customversionstring); } else -#if VERSION > 0 || SUBVERSION > 0 + { +#ifdef DEVELOP // Development -- show revision / branch info + V_DrawThinString(vid.dupx, vid.height - 17*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, compbranch); + V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, comprevision); +#else // Regular build V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, va("%s", VERSIONSTRING)); -#else // Trunk build, show revision info - V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, va("%s (%s)", VERSIONSTRING, comprevision)); #endif + } } } diff --git a/src/m_misc.c b/src/m_misc.c index 21728792f..22effdddf 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -1800,16 +1800,14 @@ UINT8 M_HighestBit(UINT32 num) const char *GetRevisionString(void) { - INT32 vinfo; - static char rev[8] = {0}; + static char rev[9] = {0}; if (rev[0]) return rev; - vinfo = atoi(&comprevision[1]); - if (vinfo) - snprintf(rev, 7, "r%d", vinfo); + if (comprevision[0] == 'r') + strncpy(rev, comprevision, 7); else - strcpy(rev, "rNULL"); + snprintf(rev, 7, "r%s", comprevision); rev[7] = '\0'; return rev; From 7e174290d7e2ade1a3dde14a77e9ab6e6a48bec0 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 14 Jan 2016 04:36:27 -0800 Subject: [PATCH 058/562] SVN needs the revision prefixed with 'r' --- comptime.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/comptime.bat b/comptime.bat index b8450ff64..119b3bb5c 100644 --- a/comptime.bat +++ b/comptime.bat @@ -20,6 +20,7 @@ goto filwri :svnrev set BRA=Subversion FOR /F "usebackq" %%s IN (`svnversion .`) DO @SET REV=%%s +set REV=r%REV% goto filwri :filwri From 2f21c24d7703732a3e9a209991240d3850300484 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Sat, 16 Jan 2016 11:35:34 -0800 Subject: [PATCH 059/562] Makefile can run comptime.bat from src\ too --- comptime.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/comptime.bat b/comptime.bat index 119b3bb5c..9e127f001 100644 --- a/comptime.bat +++ b/comptime.bat @@ -6,6 +6,7 @@ copy nul: /b +%1\comptime.c tmp.$$$ > nul move tmp.$$$ %1\comptime.c > nul if exist .git goto gitrev +if exist ..\.git goto gitrev if exist .svn goto svnrev goto filwri From 873fa10fe192ffc4a545b4fa129153f13ca311c4 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 14 Mar 2016 17:47:02 -0400 Subject: [PATCH 060/562] comptime.bat: Windows 8.1 sucks --- comptime.bat | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/comptime.bat b/comptime.bat index 9e127f001..9028e2888 100644 --- a/comptime.bat +++ b/comptime.bat @@ -1,4 +1,3 @@ -@ECHO OFF set BRA=Unknown set REV=illegal @@ -13,20 +12,20 @@ goto filwri :gitrev set GIT=%2 if "%GIT%"=="" set GIT=git -FOR /F "usebackq" %%s IN (`%GIT% rev-parse --abbrev-ref HEAD`) DO @SET BRA=%%s -FOR /F "usebackq" %%s IN (`%GIT% rev-parse HEAD`) DO @SET REV=%%s +for /f "usebackq" %%s in (`%GIT% rev-parse --abbrev-ref HEAD`) do @set BRA=%%s +for /f "usebackq" %%s in (`%GIT% rev-parse HEAD`) do @set REV=%%s set REV=%REV:~0,8% goto filwri :svnrev set BRA=Subversion -FOR /F "usebackq" %%s IN (`svnversion .`) DO @SET REV=%%s +for /f "usebackq" %%s in (`svnversion .`) do @set REV=%%s set REV=r%REV% goto filwri :filwri -ECHO // Do not edit! This file was autogenerated > %1\comptime.h -ECHO // by the %0 batch file >> %1\comptime.h -ECHO // >> %1\comptime.h -ECHO const char* compbranch = "%BRA%"; >> %1\comptime.h -ECHO const char* comprevision = "%REV%"; >> %1\comptime.h +echo // Do not edit! This file was autogenerated > %1\comptime.h +echo // by the %0 batch file >> %1\comptime.h +echo // >> %1\comptime.h +echo const char* compbranch = "%BRA%"; >> %1\comptime.h +echo const char* comprevision = "%REV%"; >> %1\comptime.h From bbe93a6d31d9d9f7ac1c77c60800e9c2f2f5d810 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Mon, 14 Mar 2016 20:36:37 -0500 Subject: [PATCH 061/562] comptime.bat: Put @echo off back in --- comptime.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/comptime.bat b/comptime.bat index 9028e2888..0c7ea06d6 100644 --- a/comptime.bat +++ b/comptime.bat @@ -1,3 +1,4 @@ +@echo off set BRA=Unknown set REV=illegal From c4e54d52e704ae16835237b039253c3428295547 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 14 Mar 2016 21:54:53 -0400 Subject: [PATCH 062/562] comptime.bat: restore echo off --- comptime.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/comptime.bat b/comptime.bat index 9028e2888..0c7ea06d6 100644 --- a/comptime.bat +++ b/comptime.bat @@ -1,3 +1,4 @@ +@echo off set BRA=Unknown set REV=illegal From 5dd0e533b37e980c273901d137f17061c70ec6dd Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 15 Mar 2016 21:18:25 +0000 Subject: [PATCH 063/562] Removed unused "supdate" variable --- src/d_main.c | 2 -- src/d_main.h | 1 - 2 files changed, 3 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index a959a8632..0a3fae3b5 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -509,7 +509,6 @@ static void D_Display(void) // ========================================================================= tic_t rendergametic; -boolean supdate; void D_SRB2Loop(void) { @@ -600,7 +599,6 @@ void D_SRB2Loop(void) // Update display, next frame, with current state. D_Display(); - supdate = false; if (moviemode) M_SaveFrame(); diff --git a/src/d_main.h b/src/d_main.h index 800b61f53..c5ce19ef4 100644 --- a/src/d_main.h +++ b/src/d_main.h @@ -17,7 +17,6 @@ #include "d_event.h" #include "w_wad.h" // for MAX_WADFILES -extern boolean supdate; extern boolean advancedemo; // make sure not to write back the config until it's been correctly loaded From e941687d4c0ebe229415da976c9a830ef0413f70 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 18 Mar 2016 20:33:16 +0000 Subject: [PATCH 064/562] R_RenderMaskedSegRange now checks for slopes in the sector lightlist in other words, midtexture rendering should now correctly account for slopes from FOFs that could affect lighting/colormap --- src/r_segs.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/r_segs.c b/src/r_segs.c index fdae62d50..72315982d 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -360,10 +360,30 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) for (i = 0; i < dc_numlights; i++) { +#ifdef ESLOPE + fixed_t leftheight, rightheight; +#endif light = &frontsector->lightlist[i]; rlight = &dc_lightlist[i]; +#ifdef ESLOPE + if (light->slope) { + leftheight = P_GetZAt(light->slope, ds->leftpos.x, ds->leftpos.y); + rightheight = P_GetZAt(light->slope, ds->rightpos.x, ds->rightpos.y); + } else + leftheight = rightheight = light->height; + + leftheight -= viewz; + rightheight -= viewz; + + rlight->height = (centeryfrac) - FixedMul(leftheight, ds->scale1); + rlight->heightstep = (centeryfrac) - FixedMul(rightheight, ds->scale2); + rlight->heightstep = (rlight->heightstep-rlight->height)/(ds->x2-ds->x1+1); + //if (x1 > ds->x1) + //rlight->height -= (x1 - ds->x1)*rlight->heightstep; +#else rlight->height = (centeryfrac) - FixedMul((light->height - viewz), spryscale); rlight->heightstep = -FixedMul(rw_scalestep, (light->height - viewz)); +#endif rlight->lightlevel = *light->lightlevel; rlight->extra_colormap = light->extra_colormap; rlight->flags = light->flags; From 6623a9148e98ecdbeb6d0abff2ea80b728dd8f07 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 18 Mar 2016 23:58:58 +0000 Subject: [PATCH 065/562] Fix HOMs by actually bothering to check if either side of a seg has slopes for height-checking code --- src/r_bsp.c | 72 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 55 insertions(+), 17 deletions(-) diff --git a/src/r_bsp.c b/src/r_bsp.c index c87d8baa7..cd32b7863 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -460,26 +460,64 @@ static void R_AddLine(seg_t *line) // Closed door. #ifdef ESLOPE - // Just don't bother checking this if one side is sloped. This is probably inefficient, but it's better than - // random renderer stopping around slopes... - if (!(frontsector->f_slope || frontsector->c_slope || backsector->f_slope || backsector->c_slope)) -#endif - if (backsector->ceilingheight <= frontsector->floorheight - || backsector->floorheight >= frontsector->ceilingheight) + if (frontsector->f_slope || frontsector->c_slope || backsector->f_slope || backsector->c_slope) { - goto clipsolid; + fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends + fixed_t backf1, backf2, backc1, backc2; // back floor ceiling ends +#define SLOPEPARAMS(slope, end1, end2, normalheight) \ + if (slope) { \ + end1 = P_GetZAt(slope, line->v1->x, line->v1->y); \ + end2 = P_GetZAt(slope, line->v2->x, line->v2->y); \ + } else \ + end1 = end2 = normalheight; + + SLOPEPARAMS(frontsector->f_slope, frontf1, frontf2, frontsector->floorheight) + SLOPEPARAMS(frontsector->c_slope, frontc1, frontc2, frontsector->ceilingheight) + SLOPEPARAMS( backsector->f_slope, backf1, backf2, backsector->floorheight) + SLOPEPARAMS( backsector->c_slope, backc1, backc2, backsector->ceilingheight) +#undef SLOPEPARAMS + if ((backc1 <= frontf1 && backc2 <= frontf2) + || (backf1 >= frontc1 && backf2 >= frontc2)) + { + goto clipsolid; + } + + // Check for automap fix. Store in doorclosed for r_segs.c + doorclosed = (backc1 <= backf1 && backc2 <= backf2 + && ((backc1 >= frontc1 && backc2 >= frontc2) || curline->sidedef->toptexture) + && ((backf1 <= frontf1 && backf2 >= frontf2) || curline->sidedef->bottomtexture) + && (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum)); + + if (doorclosed) + goto clipsolid; + + // Window. + if (backc1 != frontc1 || backc2 != frontc2 + || backf1 != frontf1 || backf2 != frontf2) + { + goto clippass; + } } - - // Check for automap fix. Store in doorclosed for r_segs.c - doorclosed = R_DoorClosed(); - if (doorclosed) - goto clipsolid; - - // Window. - if (backsector->ceilingheight != frontsector->ceilingheight - || backsector->floorheight != frontsector->floorheight) + else +#endif { - goto clippass; + if (backsector->ceilingheight <= frontsector->floorheight + || backsector->floorheight >= frontsector->ceilingheight) + { + goto clipsolid; + } + + // Check for automap fix. Store in doorclosed for r_segs.c + doorclosed = R_DoorClosed(); + if (doorclosed) + goto clipsolid; + + // Window. + if (backsector->ceilingheight != frontsector->ceilingheight + || backsector->floorheight != frontsector->floorheight) + { + goto clippass; + } } // Reject empty lines used for triggers and special events. From a82c19adb1cb68e78f7eeb12e09e2c58d99f0cb1 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 19 Mar 2016 16:19:58 +0000 Subject: [PATCH 066/562] Fix sprites displaying behind "closed doors" when slopes are present. For the record, thok barriers count as "closed doors" in SRB2 level contexts --- src/r_segs.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/r_segs.c b/src/r_segs.c index 72315982d..9ecb7708e 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1947,21 +1947,25 @@ void R_StoreWallRange(INT32 start, INT32 stop) ds_p->silhouette |= SIL_TOP; } -#ifdef ESLOPE - // This causes issues with slopes. - if (!(frontsector->f_slope || frontsector->c_slope || backsector->f_slope || backsector->c_slope)) -#endif //SoM: 3/25/2000: This code fixes an automap bug that didn't check // frontsector->ceiling and backsector->floor to see if a door was closed. // Without the following code, sprites get displayed behind closed doors. { +#ifdef ESLOPE + if (doorclosed || (worldhigh <= worldbottom && worldhighslope <= worldbottomslope)) +#else if (doorclosed || backsector->ceilingheight <= frontsector->floorheight) +#endif { ds_p->sprbottomclip = negonearray; ds_p->bsilheight = INT32_MAX; ds_p->silhouette |= SIL_BOTTOM; } +#ifdef ESLOPE + if (doorclosed || (worldlow >= worldtop && worldlowslope >= worldtopslope)) +#else if (doorclosed || backsector->floorheight >= frontsector->ceilingheight) +#endif { // killough 1/17/98, 2/8/98 ds_p->sprtopclip = screenheightarray; ds_p->tsilheight = INT32_MIN; From 28631c30b70f89e337f8bd0a4ca9c0d5e3de59a7 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 19 Mar 2016 22:25:49 +0000 Subject: [PATCH 067/562] Fix maskedtextureheight being set outside of ESLOPE code --- src/r_segs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/r_segs.c b/src/r_segs.c index 9ecb7708e..9689f43df 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1555,9 +1555,8 @@ void R_StoreWallRange(INT32 start, INT32 stop) #endif static size_t maxdrawsegs = 0; - maskedtextureheight = NULL; - #ifdef ESLOPE + maskedtextureheight = NULL; //initialize segleft and segright memset(&segleft, 0x00, sizeof(segleft)); memset(&segright, 0x00, sizeof(segright)); From ec5b272fa6ea8641b7d6d5d32c80f58cea74ea80 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 19 Mar 2016 23:19:05 +0000 Subject: [PATCH 068/562] Unless I'm mistaken, scalesteps/heightsteps should be divided by stop-start, not stop-start+1. Revert this commit if that was intentional. --- src/r_segs.c | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/src/r_segs.c b/src/r_segs.c index 9689f43df..02b243d4d 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -288,6 +288,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) line_t *ldef; sector_t *front, *back; INT32 times, repeats; + INT32 range; // Calculate light table. // Use different light tables @@ -334,6 +335,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) colfunc = fuzzcolfunc; } + range = max(ds->x2-ds->x1, 1); rw_scalestep = ds->scalestep; spryscale = ds->scale1 + (x1 - ds->x1)*rw_scalestep; @@ -377,7 +379,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) rlight->height = (centeryfrac) - FixedMul(leftheight, ds->scale1); rlight->heightstep = (centeryfrac) - FixedMul(rightheight, ds->scale2); - rlight->heightstep = (rlight->heightstep-rlight->height)/(ds->x2-ds->x1+1); + rlight->heightstep = (rlight->heightstep-rlight->height)/(range); //if (x1 > ds->x1) //rlight->height -= (x1 - ds->x1)*rlight->heightstep; #else @@ -693,6 +695,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) fixed_t offsetvalue = 0; lightlist_t *light; r_lightlist_t *rlight; + INT32 range; #ifndef ESLOPE fixed_t lheight; #endif @@ -757,6 +760,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) else if (pfloor->flags & FF_FOG) colfunc = R_DrawFogColumn_8; + range = max(ds->x2-ds->x1, 1); //SoM: Moved these up here so they are available for my lightlist calculations rw_scalestep = ds->scalestep; spryscale = ds->scale1 + (x1 - ds->x1)*rw_scalestep; @@ -813,7 +817,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) rightheight -= viewz; rlight->height = (centeryfrac) - FixedMul(leftheight, ds->scale1); rlight->heightstep = (centeryfrac) - FixedMul(rightheight, ds->scale2); - rlight->heightstep = (rlight->heightstep-rlight->height)/(ds->x2-ds->x1+1); + rlight->heightstep = (rlight->heightstep-rlight->height)/(range); rlight->height -= rlight->heightstep; #else if (light->height < *pfloor->bottomheight) @@ -841,7 +845,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) rlight->botheight = (centeryfrac) - FixedMul(leftheight, ds->scale1); rlight->botheightstep = (centeryfrac) - FixedMul(rightheight, ds->scale2); - rlight->botheightstep = (rlight->botheightstep-rlight->botheight)/(ds->x2-ds->x1+1); + rlight->botheightstep = (rlight->botheightstep-rlight->botheight)/(range); rlight->botheight -= rlight->botheightstep; #else lheight = *light->caster->bottomheight;// > *pfloor->topheight ? *pfloor->topheight + FRACUNIT : *light->caster->bottomheight; @@ -951,8 +955,8 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) top_step = centeryfrac - FixedMul(right_top, ds->scale2); bottom_step = centeryfrac - FixedMul(right_bottom, ds->scale2); - top_step = (top_step-top_frac)/(ds->x2-ds->x1+1); - bottom_step = (bottom_step-bottom_frac)/(ds->x2-ds->x1+1); + top_step = (top_step-top_frac)/(range); + bottom_step = (bottom_step-bottom_frac)/(range); top_frac += top_step * (x1 - ds->x1); bottom_frac += bottom_step * (x1 - ds->x1); @@ -1549,6 +1553,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) INT32 i, p; lightlist_t *light; r_lightlist_t *rlight; + INT32 range; #ifdef ESLOPE vertex_t segleft, segright; fixed_t ceilingfrontslide, floorfrontslide, ceilingbackslide, floorbackslide; @@ -1633,7 +1638,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (stop > start) { ds_p->scale2 = R_ScaleFromGlobalAngle(viewangle + xtoviewangle[stop]); - ds_p->scalestep = rw_scalestep = (ds_p->scale2 - rw_scale) / (stop-start); + range = stop-start; } else { @@ -1654,8 +1659,11 @@ void R_StoreWallRange(INT32 start, INT32 stop) } #endif ds_p->scale2 = ds_p->scale1; + range = 1; } + ds_p->scalestep = rw_scalestep = (ds_p->scale2 - rw_scale) / (range); + // calculate texture boundaries // and decide if floor / ceiling marks are needed #ifdef ESLOPE @@ -2531,11 +2539,11 @@ void R_StoreWallRange(INT32 start, INT32 stop) #ifdef ESLOPE if (frontsector->c_slope) { fixed_t topfracend = (centeryfrac>>4) - FixedMul (worldtopslope, ds_p->scale2); - topstep = (topfracend-topfrac)/(stop-start+1); + topstep = (topfracend-topfrac)/(range); } if (frontsector->f_slope) { fixed_t bottomfracend = (centeryfrac>>4) - FixedMul (worldbottomslope, ds_p->scale2); - bottomstep = (bottomfracend-bottomfrac)/(stop-start+1); + bottomstep = (bottomfracend-bottomfrac)/(range); } #endif @@ -2596,7 +2604,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) #ifdef ESLOPE rlight->height = (centeryfrac>>4) - FixedMul(leftheight, rw_scale); rlight->heightstep = (centeryfrac>>4) - FixedMul(rightheight, ds_p->scale2); - rlight->heightstep = (rlight->heightstep-rlight->height)/(stop-start+1); + rlight->heightstep = (rlight->heightstep-rlight->height)/(range); #else rlight->height = (centeryfrac>>4) - FixedMul((light->height - viewz) >> 4, rw_scale); rlight->heightstep = -FixedMul (rw_scalestep, (light->height - viewz) >> 4); @@ -2623,7 +2631,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) rlight->botheight = (centeryfrac>>4) - FixedMul(leftheight, rw_scale); rlight->botheightstep = (centeryfrac>>4) - FixedMul(rightheight, ds_p->scale2); - rlight->botheightstep = (rlight->botheightstep-rlight->botheight)/(stop-start+1); + rlight->botheightstep = (rlight->botheightstep-rlight->botheight)/(range); #else rlight->botheight = (centeryfrac >> 4) - FixedMul((*light->caster->bottomheight - viewz) >> 4, rw_scale); @@ -2652,7 +2660,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) #ifdef ESLOPE ffloor[i].f_pos_slope >>= 4; ffloor[i].f_frac = (centeryfrac>>4) - FixedMul(ffloor[i].f_pos, rw_scale); - ffloor[i].f_step = ((centeryfrac>>4) - FixedMul(ffloor[i].f_pos_slope, ds_p->scale2) - ffloor[i].f_frac)/(stop-start+1); + ffloor[i].f_step = ((centeryfrac>>4) - FixedMul(ffloor[i].f_pos_slope, ds_p->scale2) - ffloor[i].f_frac)/(range); #else ffloor[i].f_step = FixedMul(-rw_scalestep, ffloor[i].f_pos); ffloor[i].f_frac = (centeryfrac>>4) - FixedMul(ffloor[i].f_pos, rw_scale); @@ -2681,7 +2689,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) #ifdef ESLOPE if (backsector->c_slope) { fixed_t topfracend = (centeryfrac>>4) - FixedMul (worldhighslope, ds_p->scale2); - pixhighstep = (topfracend-pixhigh)/(stop-start+1); + pixhighstep = (topfracend-pixhigh)/(range); } #endif } @@ -2697,7 +2705,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) #ifdef ESLOPE if (backsector->f_slope) { fixed_t bottomfracend = (centeryfrac>>4) - FixedMul (worldlowslope, ds_p->scale2); - pixlowstep = (bottomfracend-pixlow)/(stop-start+1); + pixlowstep = (bottomfracend-pixlow)/(range); } #endif } @@ -2739,7 +2747,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) ffloor[i].b_pos_slope >>= 4; ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); ffloor[i].b_step = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos_slope, ds_p->scale2); - ffloor[i].b_step = (ffloor[i].b_step-ffloor[i].b_frac)/(stop-start+1); + ffloor[i].b_step = (ffloor[i].b_step-ffloor[i].b_frac)/(range); i++; } @@ -2761,7 +2769,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) ffloor[i].b_pos_slope >>= 4; ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); ffloor[i].b_step = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos_slope, ds_p->scale2); - ffloor[i].b_step = (ffloor[i].b_step-ffloor[i].b_frac)/(stop-start+1); + ffloor[i].b_step = (ffloor[i].b_step-ffloor[i].b_frac)/(range); i++; } #else @@ -2824,7 +2832,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) ffloor[i].b_pos_slope >>= 4; ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); ffloor[i].b_step = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos_slope, ds_p->scale2); - ffloor[i].b_step = (ffloor[i].b_step-ffloor[i].b_frac)/(stop-start+1); + ffloor[i].b_step = (ffloor[i].b_step-ffloor[i].b_frac)/(range); i++; } @@ -2846,7 +2854,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) ffloor[i].b_pos_slope >>= 4; ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); ffloor[i].b_step = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos_slope, ds_p->scale2); - ffloor[i].b_step = (ffloor[i].b_step-ffloor[i].b_frac)/(stop-start+1); + ffloor[i].b_step = (ffloor[i].b_step-ffloor[i].b_frac)/(range); i++; } #else From 76d71bda926d11eb1315bf1e0fe36fa39d87ec59 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 25 Mar 2016 19:43:17 +0000 Subject: [PATCH 069/562] destend now scales the added-on patch width properly if needed --- src/v_video.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/v_video.c b/src/v_video.c index df81ac6d6..3eb71bb06 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -477,7 +477,16 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t } deststart = desttop; - destend = desttop + SHORT(patch->width) * dupx; + if (pscale != FRACUNIT) // scale width properly + { + fixed_t pwidth = SHORT(patch->width)<>= FRACBITS; + destend = desttop + pwidth; + } + else + destend = desttop + SHORT(patch->width) * dupx; for (col = 0; (col>>FRACBITS) < SHORT(patch->width); col += colfrac, ++x, desttop++) { From 3698c2583d36a0d302e2b005cea221d838ad80af Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 25 Mar 2016 20:04:49 +0000 Subject: [PATCH 070/562] wrap prevention code now takes flipped patches into account --- src/v_video.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/v_video.c b/src/v_video.c index 3eb71bb06..b9bdb271f 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -336,6 +336,8 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t const column_t *column; UINT8 *desttop, *dest, *deststart, *destend; const UINT8 *source, *deststop; + fixed_t pwidth; // patch width + fixed_t offx = 0; // x offset if (rendermode == render_none) return; @@ -476,25 +478,36 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t } } - deststart = desttop; if (pscale != FRACUNIT) // scale width properly { - fixed_t pwidth = SHORT(patch->width)<width)<>= FRACBITS; - destend = desttop + pwidth; } else - destend = desttop + SHORT(patch->width) * dupx; + pwidth = SHORT(patch->width) * dupx; - for (col = 0; (col>>FRACBITS) < SHORT(patch->width); col += colfrac, ++x, desttop++) + deststart = desttop; + destend = desttop + pwidth; + + for (col = 0; (col>>FRACBITS) < SHORT(patch->width); col += colfrac, ++offx, desttop++) { INT32 topdelta, prevdelta = -1; - if (x < 0) // don't draw off the left of the screen (WRAP PREVENTION) - continue; - if (x >= vid.width) // don't draw off the right of the screen (WRAP PREVENTION) - break; + if (flip) // offx is measured from right edge instead of left + { + if (x+pwidth-offx < 0) // don't draw off the left of the screen (WRAP PREVENTION) + break; + if (x+pwidth-offx >= vid.width) // don't draw off the right of the screen (WRAP PREVENTION) + continue; + } + else + { + if (x+offx < 0) // don't draw off the left of the screen (WRAP PREVENTION) + continue; + if (x+offx >= vid.width) // don't draw off the right of the screen (WRAP PREVENTION) + break; + } column = (const column_t *)((const UINT8 *)(patch) + LONG(patch->columnofs[col>>FRACBITS])); while (column->topdelta != 0xff) From 0953c9430b18bc8380aaf00f6871309a75c31a07 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 25 Mar 2016 19:16:35 -0400 Subject: [PATCH 071/562] travis-ci: try osx building --- .travis.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5815e711f..e58f09513 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,11 @@ language: c -sudo: required -dist: trusty + +matrix: + include: + - os: linux + dist: trusty + sudo: required + - os: osx env: - CFLAGS=-Wno-absolute-value -Werror From 73dd5cd8035c368d7858ee45fe0eeb1e24166766 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 25 Mar 2016 19:48:39 -0400 Subject: [PATCH 072/562] travis-ci: add brew packages --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index e58f09513..049d465a1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,4 +37,8 @@ before_script: - cd build - cmake .. +before_install: + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install sdl2_mixer libsdl game-music-emu p7zip ; fi + script: make From 8d36a77e42c092f8108248a17ccca20f6af9110f Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 25 Mar 2016 19:53:13 -0400 Subject: [PATCH 073/562] travis-ci: libpng, not libsdl --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 049d465a1..d70e1dc9a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,10 @@ language: c +sudo: required matrix: include: - os: linux dist: trusty - sudo: required - os: osx env: @@ -39,6 +39,6 @@ before_script: before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install sdl2_mixer libsdl game-music-emu p7zip ; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install sdl2_mixer libpng game-music-emu p7zip ; fi script: make From dfa41ed8782ea24485bcfa2f3d4066bc14b6d2c9 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 25 Mar 2016 19:56:05 -0400 Subject: [PATCH 074/562] travis-ci: drop libpng for osx --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d70e1dc9a..bc5489308 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,6 +39,6 @@ before_script: before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install sdl2_mixer libpng game-music-emu p7zip ; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install sdl2_mixer game-music-emu p7zip ; fi script: make From 9162e7da9d59f869bf99691a2f381f405ae0629d Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 25 Mar 2016 19:56:51 -0400 Subject: [PATCH 075/562] travis-ci: move dist setting to top --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bc5489308..d131a82b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,10 @@ language: c sudo: required +dist: trusty matrix: include: - os: linux - dist: trusty - os: osx env: From 23c9892fea6af16054f82d8eb3f295f590c11448 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 25 Mar 2016 20:02:57 -0400 Subject: [PATCH 076/562] travis-ci: fixup os list --- .travis.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index d131a82b2..4ebef34a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,10 +2,9 @@ language: c sudo: required dist: trusty -matrix: - include: - - os: linux - - os: osx +os: + - linux + - osx env: - CFLAGS=-Wno-absolute-value -Werror From 0c9081f762dd5d4cbcdcfe3871bcc599fbefc316 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 25 Mar 2016 20:10:14 -0400 Subject: [PATCH 077/562] cmake: try to fixup mac build --- src/sdl/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index 7190efaac..f44e3dee5 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -117,7 +117,7 @@ if(${SDL2_FOUND}) add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32 ${SRB2_SDL2_TOTAL_SOURCES}) set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME ${SRB2_SDL2_EXE_NAME}) - if((CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")) + if(${CMAKE_SYSTEM} MATCHES Darwin) add_framework(CoreFoundation SRB2SDL2) add_framework(SDL2 SRB2SDL2) add_framework(SDL2_mixer SRB2SDL2) @@ -227,7 +227,7 @@ if(${SDL2_FOUND}) endif() #### Installation #### - if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + if(${CMAKE_SYSTEM} MATCHES Darwin) install(TARGETS SRB2SDL2 BUNDLE DESTINATION . ) @@ -268,7 +268,7 @@ if(${SDL2_FOUND}) # Mac bundle fixup - if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + if(${CMAKE_SYSTEM} MATCHES Darwin) install(CODE " include(BundleUtilities) fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/Sonic Robo Blast 2.app\" From dadf8e1260a83125089f43ba2a6ddb119f2a474a Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 25 Mar 2016 20:21:56 -0400 Subject: [PATCH 078/562] cmake: remove fixed HWRENDER define --- src/doomtype.h | 1 - src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/doomtype.h b/src/doomtype.h index 8e7da6881..d833176f7 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -94,7 +94,6 @@ typedef long ssize_t; #ifdef __APPLE_CC__ #define DIRECTFULLSCREEN #define DEBUG_LOG -#define HWRENDER #define NOIPX #endif diff --git a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj index 98599fb60..c3f0d3b38 100644 --- a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj +++ b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj @@ -1270,6 +1270,7 @@ HAVE_BLUA, LUA_USE_POSIX, COMPVERSION, + HWRENDER, ); GCC_THREADSAFE_STATICS = NO; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; @@ -1392,6 +1393,7 @@ HAVE_BLUA, LUA_USE_POSIX, COMPVERSION, + HWRENDER, ); GCC_THREADSAFE_STATICS = NO; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; From 2165c6806661ccdc3d854dae3e528a5e9ed339f3 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 25 Mar 2016 20:25:52 -0400 Subject: [PATCH 079/562] travis: add -Wno-unknown-warning-option --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4ebef34a0..c7e8b66b0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ os: - osx env: -- CFLAGS=-Wno-absolute-value -Werror +- CFLAGS=-Wno-absolute-value -Wno-unknown-warning-option -Werror compiler: - gcc From 18f51b343b17d0ce70b271a3c6a832ab9cf9028a Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 25 Mar 2016 20:37:14 -0400 Subject: [PATCH 080/562] build: more mac fixes --- .travis.yml | 2 ++ src/md5.c | 2 +- src/string.c | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c7e8b66b0..e781c46e3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,9 @@ dist: trusty os: - linux + env: CFLAGS=-Wno-absolute-value -Werror - osx + env: CFLAGS=--Werror env: - CFLAGS=-Wno-absolute-value -Wno-unknown-warning-option -Werror diff --git a/src/md5.c b/src/md5.c index aeaac2cde..ba89c499b 100644 --- a/src/md5.c +++ b/src/md5.c @@ -36,7 +36,7 @@ #include #else #ifndef HAVE_MEMCPY - #if !((defined (_WIN32) || defined (_WIN32_WCE)) && !defined (__CYGWIN__)) + #if !((defined (_WIN32) || defined (_WIN32_WCE)) && !defined (__CYGWIN__)) && !defined (__APPLE__) #define memcpy(d, s, n) bcopy ((s), (d), (n)) #endif #endif diff --git a/src/string.c b/src/string.c index 436757309..19540547c 100644 --- a/src/string.c +++ b/src/string.c @@ -15,6 +15,8 @@ #include #include "doomdef.h" +#if !defined (__APPLE__) + // Like the OpenBSD version, but it doesn't check for src not being a valid // C string. size_t strlcat(char *dst, const char *src, size_t siz) @@ -46,3 +48,5 @@ size_t strlcpy(char *dst, const char *src, size_t siz) dst[0] = '\0'; return strlcat(dst, src, siz); } + +#endif From fc1d71454b0c7ccdf3071a34e586ab27918c5c4d Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 25 Mar 2016 20:56:04 -0400 Subject: [PATCH 081/562] travis: fixup xml --- .travis.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index e781c46e3..88d47d485 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,14 +2,11 @@ language: c sudo: required dist: trusty -os: - - linux - env: CFLAGS=-Wno-absolute-value -Werror - - osx - env: CFLAGS=--Werror - -env: -- CFLAGS=-Wno-absolute-value -Wno-unknown-warning-option -Werror +matrix: + include: + - os: linux + env: CFLAGS=Wno-absolute-value -Werror + - osx compiler: - gcc From 7122908560818ff3d36d862243983fa28c07e652 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 25 Mar 2016 20:57:57 -0400 Subject: [PATCH 082/562] travis: matrix is not correct --- .travis.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 88d47d485..c378e9ef8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,11 +2,9 @@ language: c sudo: required dist: trusty -matrix: - include: - - os: linux - env: CFLAGS=Wno-absolute-value -Werror - - osx +os: + - linux + - osx compiler: - gcc From 9bc6ce3d85b3d353a4d14df9b78d292c65de602e Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 25 Mar 2016 21:43:17 -0400 Subject: [PATCH 083/562] travis: steal SDL2 dmg for Mac build --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index c378e9ef8..84bf5dea1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,5 +36,7 @@ before_script: before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install sdl2_mixer game-music-emu p7zip ; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/release/SDL2-2.0.4.dmg; hdiutil attach SDL2-2.0.4.dmg; sudo cp -a /Volumes/SDL2/SDL2.framework /Library/Frameworks/; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.1.dmg; hdiutil attach SDL2_mixer-2.0.1.dmg; sudo cp -a /Volumes/SDL2_mixer/SDL2_mixer.framework /Library/Frameworks/; fi script: make From 2c4a27c7c6c2262debab568f5b0c466bf740b4c8 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 25 Mar 2016 22:07:34 -0400 Subject: [PATCH 084/562] macosx: let fix linking to SDL frameworks --- .travis.yml | 2 +- src/sdl/CMakeLists.txt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 84bf5dea1..df89593c4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,6 +37,6 @@ before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install sdl2_mixer game-music-emu p7zip ; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/release/SDL2-2.0.4.dmg; hdiutil attach SDL2-2.0.4.dmg; sudo cp -a /Volumes/SDL2/SDL2.framework /Library/Frameworks/; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.1.dmg; hdiutil attach SDL2_mixer-2.0.1.dmg; sudo cp -a /Volumes/SDL2_mixer/SDL2_mixer.framework /Library/Frameworks/; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.1.dmg; hdiutil attach SDL2_mixer-2.0.1.dmg; sudo cp -a /Volumes/SDL2_mixer/SDL2_mixer.framework /Library/Frameworks/; fi script: make diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index f44e3dee5..f57aa2c1f 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -118,10 +118,10 @@ if(${SDL2_FOUND}) set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME ${SRB2_SDL2_EXE_NAME}) if(${CMAKE_SYSTEM} MATCHES Darwin) - add_framework(CoreFoundation SRB2SDL2) - add_framework(SDL2 SRB2SDL2) - add_framework(SDL2_mixer SRB2SDL2) target_link_libraries(SRB2SDL2 PRIVATE + CoreFoundation + SDL2 + SDL2_mixer ${GME_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} From 077781cc567d1b7b6bee96abbba652fea0b121da Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 25 Mar 2016 22:11:39 -0400 Subject: [PATCH 085/562] macosx: drop CoreFoundation linking --- src/sdl/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index f57aa2c1f..26448cb69 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -119,7 +119,6 @@ if(${SDL2_FOUND}) if(${CMAKE_SYSTEM} MATCHES Darwin) target_link_libraries(SRB2SDL2 PRIVATE - CoreFoundation SDL2 SDL2_mixer ${GME_LIBRARIES} From 0f853640e219bda4a2af3406d1fdade541be88ad Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 25 Mar 2016 22:23:47 -0400 Subject: [PATCH 086/562] macosx: We need CoreFoudation for SDLMain --- src/sdl/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index 26448cb69..7f6771262 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -118,7 +118,9 @@ if(${SDL2_FOUND}) set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME ${SRB2_SDL2_EXE_NAME}) if(${CMAKE_SYSTEM} MATCHES Darwin) + find_library(CORE_LIB CoreFoundation) target_link_libraries(SRB2SDL2 PRIVATE + ${CORE_LIB} SDL2 SDL2_mixer ${GME_LIBRARIES} From 6bda1a57a57f0367a97f13b21d38c4ddc37427a5 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 29 Mar 2016 15:40:01 +0100 Subject: [PATCH 087/562] Fix FOF plane light underside checks --- src/r_bsp.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/r_bsp.c b/src/r_bsp.c index cd32b7863..7f64e0cbd 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -1002,7 +1002,7 @@ static void R_Subsector(size_t num) || (viewz > heightcheck && (rover->flags & FF_BOTHPLANES)))) { light = R_GetPlaneLight(frontsector, planecenterz, - viewz < *rover->bottomheight); + viewz < heightcheck); ffloor[numffloors].plane = R_FindPlane(*rover->bottomheight, *rover->bottompic, *frontsector->lightlist[light].lightlevel, *rover->bottomxoffs, @@ -1020,12 +1020,7 @@ static void R_Subsector(size_t num) frontsector->hasslope = true; #endif - ffloor[numffloors].height = -#ifdef ESLOPE - *rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) : -#endif - *rover->bottomheight; - + ffloor[numffloors].height = heightcheck; ffloor[numffloors].ffloor = rover; numffloors++; } @@ -1050,7 +1045,7 @@ static void R_Subsector(size_t num) && ((viewz > heightcheck && !(rover->flags & FF_INVERTPLANES)) || (viewz < heightcheck && (rover->flags & FF_BOTHPLANES)))) { - light = R_GetPlaneLight(frontsector, planecenterz, viewz < *rover->topheight); + light = R_GetPlaneLight(frontsector, planecenterz, viewz < heightcheck); ffloor[numffloors].plane = R_FindPlane(*rover->topheight, *rover->toppic, *frontsector->lightlist[light].lightlevel, *rover->topxoffs, *rover->topyoffs, *rover->topangle, @@ -1068,12 +1063,7 @@ static void R_Subsector(size_t num) frontsector->hasslope = true; #endif - ffloor[numffloors].height = -#ifdef ESLOPE - *rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) : -#endif - *rover->topheight; - + ffloor[numffloors].height = heightcheck; ffloor[numffloors].ffloor = rover; numffloors++; } From ef832dd8b815ec6a8753cf5515f3a72c9ba3a3ac Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 29 Mar 2016 18:59:56 +0100 Subject: [PATCH 088/562] Fixed how two adjacent FOFs can prevent each others' walls from displaying if they're at least partially covered Also some miscellaneous tweaks and changes to account for slopes properly --- src/r_segs.c | 58 ++++++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/src/r_segs.c b/src/r_segs.c index 02b243d4d..1f5477ecf 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -2248,9 +2248,9 @@ void R_StoreWallRange(INT32 start, INT32 stop) } else low2 = lowslope2 = *r2->bottomheight; - if ((high2 < lowcut && highslope2 < lowcutslope) || (low2 > highcut && lowslope2 > highcutslope)) + if ((high2 < lowcut || highslope2 < lowcutslope) || (low2 > highcut || lowslope2 > highcutslope)) continue; - if ((high1 > high2 && highslope1 > highslope2) || (low1 < low2 && lowslope1 < lowslope2)) + if ((high1 > high2 || highslope1 > highslope2) || (low1 < low2 || lowslope1 < lowslope2)) continue; #else if (*r2->topheight < lowcut || *r2->bottomheight > highcut) @@ -2331,9 +2331,9 @@ void R_StoreWallRange(INT32 start, INT32 stop) } else low2 = lowslope2 = *r2->bottomheight; - if ((high2 < lowcut && highslope2 < lowcutslope) || (low2 > highcut && lowslope2 > highcutslope)) + if ((high2 < lowcut || highslope2 < lowcutslope) || (low2 > highcut || lowslope2 > highcutslope)) continue; - if ((high1 > high2 && highslope1 > highslope2) || (low1 < low2 && lowslope1 < lowslope2)) + if ((high1 > high2 || highslope1 > highslope2) || (low1 < low2 || lowslope1 < lowslope2)) continue; #else if (*r2->topheight < lowcut || *r2->bottomheight > highcut) @@ -2679,7 +2679,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (worldhigh < worldtop #ifdef ESLOPE - || worldhighslope <= worldtopslope + || worldhighslope < worldtopslope #endif ) { @@ -2696,7 +2696,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (worldlow > worldbottom #ifdef ESLOPE - || worldlowslope >= worldbottomslope + || worldlowslope > worldbottomslope #endif ) { @@ -2713,7 +2713,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) { ffloor_t * rover; #ifdef ESLOPE - fixed_t rovertest; + fixed_t roverleft, roverright; fixed_t planevistest; #endif i = 0; @@ -2732,17 +2732,18 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (*rover->b_slope || *rover->t_slope) backsector->hasslope = true; - rovertest = (*rover->b_slope ? P_GetZAt(*rover->b_slope, backsector->soundorg.x, backsector->soundorg.y) : *rover->bottomheight) - viewz; + roverleft = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segleft.x, segleft.y) : *rover->bottomheight) - viewz; + roverright = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segright.x, segright.y) : *rover->bottomheight) - viewz; planevistest = (*rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) : *rover->bottomheight); - if (rovertest>>4 <= worldhigh && - rovertest>>4 >= worldlow && + if ((roverleft>>4 <= worldhigh || roverright>>4 <= worldhighslope) && + (roverleft>>4 >= worldlow || roverright>>4 >= worldlowslope) && ((viewz < planevistest && !(rover->flags & FF_INVERTPLANES)) || (viewz > planevistest && (rover->flags & FF_BOTHPLANES)))) { //ffloor[i].slope = *rover->b_slope; - ffloor[i].b_pos = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segleft.x, segleft.y) : *rover->bottomheight) - viewz; - ffloor[i].b_pos_slope = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segright.x, segright.y) : *rover->bottomheight) - viewz; + ffloor[i].b_pos = roverleft; + ffloor[i].b_pos_slope = roverright; ffloor[i].b_pos >>= 4; ffloor[i].b_pos_slope >>= 4; ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); @@ -2754,17 +2755,18 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (i >= MAXFFLOORS) break; - rovertest = (*rover->t_slope ? P_GetZAt(*rover->t_slope, backsector->soundorg.x, backsector->soundorg.y) : *rover->topheight) - viewz; + roverleft = (*rover->t_slope ? P_GetZAt(*rover->t_slope, segleft.x, segleft.y) : *rover->topheight) - viewz; + roverright = (*rover->t_slope ? P_GetZAt(*rover->t_slope, segright.x, segright.y) : *rover->topheight) - viewz; planevistest = (*rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) : *rover->topheight); - if (rovertest>>4 <= worldhigh && - rovertest>>4 >= worldlow && + if ((roverleft>>4 <= worldhigh || roverright>>4 <= worldhighslope) && + (roverleft>>4 >= worldlow || roverright>>4 >= worldlowslope) && ((viewz > planevistest && !(rover->flags & FF_INVERTPLANES)) || (viewz < planevistest && (rover->flags & FF_BOTHPLANES)))) { //ffloor[i].slope = *rover->t_slope; - ffloor[i].b_pos = (*rover->t_slope ? P_GetZAt(*rover->t_slope, segleft.x, segleft.y) : *rover->topheight) - viewz; - ffloor[i].b_pos_slope = (*rover->t_slope ? P_GetZAt(*rover->t_slope, segright.x, segright.y) : *rover->topheight) - viewz; + ffloor[i].b_pos = roverleft; + ffloor[i].b_pos_slope = roverright; ffloor[i].b_pos >>= 4; ffloor[i].b_pos_slope >>= 4; ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); @@ -2817,17 +2819,18 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (*rover->b_slope || *rover->t_slope) frontsector->hasslope = true; - rovertest = (*rover->b_slope ? P_GetZAt(*rover->b_slope, frontsector->soundorg.x, frontsector->soundorg.y) : *rover->bottomheight) - viewz; + roverleft = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segleft.x, segleft.y) : *rover->bottomheight) - viewz; + roverright = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segright.x, segright.y) : *rover->bottomheight) - viewz; planevistest = (*rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) : *rover->bottomheight); - if (rovertest>>4 <= worldtop && - rovertest>>4 >= worldbottom && + if ((roverleft>>4 <= worldhigh || roverright>>4 <= worldhighslope) && + (roverleft>>4 >= worldlow || roverright>>4 >= worldlowslope) && ((viewz < planevistest && !(rover->flags & FF_INVERTPLANES)) || (viewz > planevistest && (rover->flags & FF_BOTHPLANES)))) { //ffloor[i].slope = *rover->b_slope; - ffloor[i].b_pos = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segleft.x, segleft.y) : *rover->bottomheight) - viewz; - ffloor[i].b_pos_slope = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segright.x, segright.y) : *rover->bottomheight) - viewz; + ffloor[i].b_pos = roverleft; + ffloor[i].b_pos_slope = roverright; ffloor[i].b_pos >>= 4; ffloor[i].b_pos_slope >>= 4; ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); @@ -2839,17 +2842,18 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (i >= MAXFFLOORS) break; - rovertest = (*rover->t_slope ? P_GetZAt(*rover->t_slope, frontsector->soundorg.x, frontsector->soundorg.y) : *rover->topheight) - viewz; + roverleft = (*rover->t_slope ? P_GetZAt(*rover->t_slope, segleft.x, segleft.y) : *rover->topheight) - viewz; + roverright = (*rover->t_slope ? P_GetZAt(*rover->t_slope, segright.x, segright.y) : *rover->topheight) - viewz; planevistest = (*rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) : *rover->topheight); - if (rovertest>>4 <= worldtop && - rovertest>>4 >= worldbottom && + if ((roverleft>>4 <= worldhigh || roverright>>4 <= worldhighslope) && + (roverleft>>4 >= worldlow || roverright>>4 >= worldlowslope) && ((viewz > planevistest && !(rover->flags & FF_INVERTPLANES)) || (viewz < planevistest && (rover->flags & FF_BOTHPLANES)))) { //ffloor[i].slope = *rover->t_slope; - ffloor[i].b_pos = (*rover->t_slope ? P_GetZAt(*rover->t_slope, segleft.x, segleft.y) : *rover->topheight) - viewz; - ffloor[i].b_pos_slope = (*rover->t_slope ? P_GetZAt(*rover->t_slope, segright.x, segright.y) : *rover->topheight) - viewz; + ffloor[i].b_pos = roverleft; + ffloor[i].b_pos_slope = roverright; ffloor[i].b_pos >>= 4; ffloor[i].b_pos_slope >>= 4; ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); From ee00da6a74a62c74a56722b7b70fc50aa45c7f05 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 29 Mar 2016 22:32:09 +0100 Subject: [PATCH 089/562] Another thing that probably needed to check for slopes --- src/r_segs.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/r_segs.c b/src/r_segs.c index 1f5477ecf..66413c588 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -2032,8 +2032,13 @@ void R_StoreWallRange(INT32 start, INT32 stop) markceiling = false; } +#ifdef ESLOPE + if ((worldhigh <= worldbottom && worldhighslope <= worldbottomslope) + || (worldlow >= worldtop && worldlowslope >= worldtopslope)) +#else if (backsector->ceilingheight <= frontsector->floorheight || backsector->floorheight >= frontsector->ceilingheight) +#endif { // closed door markceiling = markfloor = true; From 1108a52959780c51201c2808d8ec35ee5e204bfe Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 29 Mar 2016 22:44:16 +0100 Subject: [PATCH 090/562] Check change in ceilinglightsec for markceiling code, not floorlightsec --- src/r_segs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_segs.c b/src/r_segs.c index 04873b29c..2820262e0 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1922,7 +1922,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) || backsector->ceilingpic_angle != frontsector->ceilingpic_angle //SoM: 3/22/2000: Prevents bleeding. || (frontsector->heightsec != -1 && frontsector->ceilingpic != skyflatnum) - || backsector->floorlightsec != frontsector->floorlightsec + || backsector->ceilinglightsec != frontsector->ceilinglightsec //SoM: 4/3/2000: Check for colormaps || frontsector->extra_colormap != backsector->extra_colormap || (frontsector->ffloors != backsector->ffloors && frontsector->tag != backsector->tag)) From ce2c2de58a38c5a6f7270eabb80ae37c9084d590 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Sat, 26 Mar 2016 15:48:12 -0700 Subject: [PATCH 091/562] P_Random now using a variant of xorshift This actually passes most diehard tests, as opposed to the old RNG. It's also similarly fast. Internally the PRNG generates a fixed point number from [0,1) now, which makes P_RandomKey and P_RandomRange much easier to calculate. P_Random is just a simple shift, as well. Also, the lack of floating point math in P_RandomKey and P_RandomRange now is probably for the best. --- src/m_random.c | 106 +++++++++++++++++++++++++++++++++---------------- src/m_random.h | 14 ++++--- src/st_stuff.c | 6 ++- 3 files changed, 85 insertions(+), 41 deletions(-) diff --git a/src/m_random.c b/src/m_random.c index fce65b88a..eab45a3ed 100644 --- a/src/m_random.c +++ b/src/m_random.c @@ -10,7 +10,7 @@ // See the 'LICENSE' file for more details. //----------------------------------------------------------------------------- /// \file m_random.c -/// \brief LCG PRNG originally created for XMOD +/// \brief RNG for client effects and PRNG for game actions #include "doomdef.h" #include "doomtype.h" @@ -42,7 +42,7 @@ UINT8 M_Random(void) */ INT32 M_SignedRandom(void) { - return M_Random() - 128; + return (rand() & 255) - 128; } /** Provides a random number in between 0 and the given number - 1. @@ -80,12 +80,29 @@ static UINT32 randomseed = 0; static UINT32 initialseed = 0; /** - * Provides a random byte and sets the seed appropriately. - * The nature of this PRNG allows it to cycle through about two million numbers - * before it finally starts repeating numeric sequences. - * That's more than good enough for our purposes. + * Provides a random fixed point number. + * This is a variant of an xorshift PRNG; state fits in a 32 bit integer structure. * - * \return A random byte, 0 to 255. + * \return A random fixed point number from [0,1). + */ +ATTRINLINE static fixed_t FUNCINLINE __internal_prng__(void) +{ + randomseed += 7069; + randomseed ^= randomseed << 17; + randomseed ^= randomseed >> 9; + randomseed *= 373; + randomseed ^= randomseed << 21; + randomseed ^= randomseed >> 15; + return (randomseed&((FRACUNIT-1)<<9))>>9; +} + +/** Provides a random integer from 0 to 255. + * Distribution is uniform. + * If you're curious, (&0xFF00) >> 8 gives the same result + * as a fixed point multiplication by 256. + * + * \return Random integer from [0, 255]. + * \sa __internal_prng__ */ #ifndef DEBUGRANDOM UINT8 P_Random(void) @@ -95,15 +112,14 @@ UINT8 P_RandomD(const char *rfile, INT32 rline) { CONS_Printf("P_Random() at: %sp %d\n", rfile, rline); #endif - randomseed = (randomseed*746151647)+48205429; - return (UINT8)((randomseed >> 17)&255); + return (UINT8)((__internal_prng__()&0xFF00)>>8); } -/** Provides a random number from -128 to 127. +/** Provides a random integer from -128 to 127. * Distribution is uniform. * - * \return Random number from -128 to 127. - * \sa P_Random + * \return Random integer from [-128, 127]. + * \sa __internal_prng__ */ #ifndef DEBUGRANDOM INT32 P_SignedRandom(void) @@ -113,15 +129,31 @@ INT32 P_SignedRandomD(const char *rfile, INT32 rline) { CONS_Printf("P_SignedRandom() at: %sp %d\n", rfile, rline); #endif - return P_Random() - 128; + return (INT32)((__internal_prng__()&0xFF00)>>8) - 128; } -/** Provides a random number in between 0 and the given number - 1. - * Distribution is uniform, also calls for two numbers for bigger output range. - * Use for picking random elements from an array. +/** + * Provides a random fixed point number. + * Literally a wrapper for the internal PRNG function. * - * \return A random number, 0 to arg1-1. - * \sa P_Random + * \return A random fixed point number from [0,1). + */ +#ifndef DEBUGRANDOM +fixed_t P_RandomFixed(void) +{ +#else +UINT8 P_RandomFixedD(const char *rfile, INT32 rline) +{ + CONS_Printf("P_Random() at: %sp %d\n", rfile, rline); +#endif + return __internal_prng__(); +} + +/** Provides a random integer for picking random elements from an array. + * Distribution is uniform. + * + * \return A random integer from [0,a). + * \sa __internal_prng__ */ #ifndef DEBUGRANDOM INT32 P_RandomKey(INT32 a) @@ -131,16 +163,14 @@ INT32 P_RandomKeyD(const char *rfile, INT32 rline, INT32 a) { CONS_Printf("P_RandomKey() at: %sp %d\n", rfile, rline); #endif - INT32 prandom = P_Random(); // note: forcing explicit function call order - prandom |= P_Random() << 8; // (function call order is not strictly defined) - return (INT32)((prandom/65536.0f)*a); + return (INT32)((__internal_prng__() * a) >> FRACBITS); } -/** Provides a random number in between a specific range. - * Distribution is uniform, also calls for two numbers for bigger output range. +/** Provides a random integer in a given range. + * Distribution is uniform. * - * \return A random number, arg1 to arg2. - * \sa P_Random + * \return A random integer from [a,b].P_Random + * \sa __internal_prng__ */ #ifndef DEBUGRANDOM INT32 P_RandomRange(INT32 a, INT32 b) @@ -150,21 +180,27 @@ INT32 P_RandomRangeD(const char *rfile, INT32 rline, INT32 a, INT32 b) { CONS_Printf("P_RandomRange() at: %sp %d\n", rfile, rline); #endif - INT32 prandom = P_Random(); // note: forcing explicit function call order - prandom |= P_Random() << 8; // (function call order is not strictly defined) - return (INT32)((prandom/65536.0f)*(b-a+1))+a; + return (INT32)((__internal_prng__() * (b-a+1)) >> FRACBITS) + a; } -/** Provides a random byte without saving what the seed would be. - * Used just to debug the PRNG. + + +// ---------------------- +// PRNG seeds & debugging +// ---------------------- + +/** Peeks to see what the next result from the PRNG will be. + * Used for debugging. * - * \return A 'random' byte, 0 to 255. - * \sa P_Random + * \return A 'random' fixed point number from [0,1). + * \sa __internal_prng__ */ -UINT8 P_RandomPeek(void) +fixed_t P_RandomPeek(void) { - UINT32 r = (randomseed*746151647)+48205429; - return (UINT8)((r >> 17)&255); + UINT32 r = randomseed; + fixed_t ret = __internal_prng__(); + randomseed = r; + return ret; } /** Gets the current random seed. Used by netgame savegames. diff --git a/src/m_random.h b/src/m_random.h index 42c871608..91348365b 100644 --- a/src/m_random.h +++ b/src/m_random.h @@ -20,8 +20,9 @@ //#define DEBUGRANDOM + // M_Random functions pull random numbers of various types that aren't network synced. -// P_Random functions pulls random bytes from a LCG PRNG that is network synced. +// P_Random functions pulls random bytes from a PRNG that is network synced. // RNG functions UINT8 M_Random(void); @@ -31,21 +32,24 @@ INT32 M_RandomRange(INT32 a, INT32 b); // PRNG functions #ifdef DEBUGRANDOM -#define P_Random() P_RandomD(__FILE__, __LINE__) -#define P_SignedRandom() P_SignedRandomD(__FILE__, __LINE__) -#define P_RandomKey(c) P_RandomKeyD(__FILE__, __LINE__, c) +#define P_Random() P_RandomD(__FILE__, __LINE__) +#define P_SignedRandom() P_SignedRandomD(__FILE__, __LINE__) +#define P_RandomFixed() P_RandomFixedD(__FILE__, __LINE__) +#define P_RandomKey(c) P_RandomKeyD(__FILE__, __LINE__, c) #define P_RandomRange(c, d) P_RandomRangeD(__FILE__, __LINE__, c, d) UINT8 P_RandomD(const char *rfile, INT32 rline); INT32 P_SignedRandomD(const char *rfile, INT32 rline); +fixed_t P_RandomFixedD(const char *rfile, INT32 rline); INT32 P_RandomKeyD(const char *rfile, INT32 rline, INT32 a); INT32 P_RandomRangeD(const char *rfile, INT32 rline, INT32 a, INT32 b); #else UINT8 P_Random(void); INT32 P_SignedRandom(void); +fixed_t P_RandomFixed(void); INT32 P_RandomKey(INT32 a); INT32 P_RandomRange(INT32 a, INT32 b); #endif -UINT8 P_RandomPeek(void); +fixed_t P_RandomPeek(void); // Working with the seed for PRNG #ifdef DEBUGRANDOM diff --git a/src/st_stuff.c b/src/st_stuff.c index 585db0c87..47eac22f4 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -592,9 +592,13 @@ static void ST_drawDebugInfo(void) if (cv_debug & DBG_RANDOMIZER) // randomizer testing { + fixed_t peekres = P_RandomPeek(); + peekres *= 10000; // Change from fixed point + peekres >>= FRACBITS; // to displayable decimal + V_DrawRightAlignedString(320, height - 16, V_MONOSPACE, va("Init: %08x", P_GetInitSeed())); V_DrawRightAlignedString(320, height - 8, V_MONOSPACE, va("Seed: %08x", P_GetRandSeed())); - V_DrawRightAlignedString(320, height, V_MONOSPACE, va("== : %8d", P_RandomPeek())); + V_DrawRightAlignedString(320, height, V_MONOSPACE, va("== : .%04d", peekres)); height -= 32; } From ac03ce39c8d681d915ecb1809ce9651aab5a91da Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Sun, 27 Mar 2016 07:33:15 -0700 Subject: [PATCH 092/562] *_Random is now *_RandomByte. P_RandomChance is now a macro for something that should happen a certain percentage of time. P_SignedRandom was moved to a macro. Nobody cared. # Conflicts: # src/p_inter.c --- src/d_netcmd.c | 6 +- src/g_game.c | 10 +-- src/hardware/hw3sound.c | 6 +- src/hardware/hw_light.c | 4 +- src/lua_baselib.c | 39 ++++++++++-- src/m_cheat.c | 6 +- src/m_random.c | 110 +++++++++++++++------------------ src/m_random.h | 34 ++++++----- src/p_enemy.c | 132 +++++++++++++++++++--------------------- src/p_inter.c | 28 +++------ src/p_lights.c | 4 +- src/p_mobj.c | 70 ++++++++++----------- src/p_spec.c | 2 +- src/p_tick.c | 4 +- src/p_user.c | 10 +-- src/v_video.c | 2 +- 16 files changed, 233 insertions(+), 234 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 5eb352834..c62ff8fe1 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -808,7 +808,7 @@ static boolean IsNameGood(char *name, INT32 playernum) else if (len == 1) // Agh! { // Last ditch effort... - sprintf(name, "%d", M_Random() & 7); + sprintf(name, "%d", M_RandomKey(10)); if (!IsNameGood (name, playernum)) return false; } @@ -3583,7 +3583,7 @@ retryscramble: for (i = 0; i < playercount; i++) { if (repick) - newteam = (INT16)((M_Random() % 2) + 1); + newteam = (INT16)((M_RandomByte() % 2) + 1); // One team has the most players they can get, assign the rest to the other team. if (red == maxcomposition || blue == maxcomposition) @@ -3628,7 +3628,7 @@ retryscramble: { if (repick) { - newteam = (INT16)((M_Random() % 2) + 1); + newteam = (INT16)((M_RandomByte() % 2) + 1); repick = false; } else diff --git a/src/g_game.c b/src/g_game.c index 3b7ef158f..71171fd74 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2331,8 +2331,8 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost) } } P_MovePlayerToSpawn(playernum, spawnpoint); - -#ifdef HAVE_BLUA + +#ifdef HAVE_BLUA LUAh_PlayerSpawn(&players[playernum]); // Lua hook for player spawning :) #endif @@ -2349,7 +2349,7 @@ mapthing_t *G_FindCTFStart(INT32 playernum) return NULL; } - if ((!players[playernum].ctfteam && numredctfstarts && (!numbluectfstarts || P_Random() & 1)) || players[playernum].ctfteam == 1) //red + if ((!players[playernum].ctfteam && numredctfstarts && (!numbluectfstarts || P_RandomChance(FRACUNIT/2))) || players[playernum].ctfteam == 1) //red { if (!numredctfstarts) { @@ -5487,7 +5487,7 @@ ATTRNORETURN void FUNCNORETURN G_StopMetalRecording(void) UINT8 i; WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker for (i = 0; i < 16; i++, p++) - *p = P_Random(); // This MD5 was chosen by fair dice roll and most likely < 50% correct. + *p = P_RandomByte(); // This MD5 was chosen by fair dice roll and most likely < 50% correct. #else WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker md5_buffer((char *)p+16, demo_p - (p+16), (void *)p); // make a checksum of everything after the checksum in the file. @@ -5569,7 +5569,7 @@ boolean G_CheckDemoStatus(void) UINT8 i; WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker for (i = 0; i < 16; i++, p++) - *p = P_Random(); // This MD5 was chosen by fair dice roll and most likely < 50% correct. + *p = P_RandomByte(); // This MD5 was chosen by fair dice roll and most likely < 50% correct. #else WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker md5_buffer((char *)p+16, demo_p - (p+16), p); // make a checksum of everything after the checksum in the file. diff --git a/src/hardware/hw3sound.c b/src/hardware/hw3sound.c index efc1d247b..c68430921 100644 --- a/src/hardware/hw3sound.c +++ b/src/hardware/hw3sound.c @@ -384,12 +384,12 @@ INT32 HW3S_I_StartSound(const void *origin_p, source3D_data_t *source_parm, chan /*if (gamemode != heretic) { if (sfx_id >= sfx_sawup && sfx_id <= sfx_sawhit) - pitch += 8 - (M_Random()&15); + pitch += 8 - (M_RandomByte()&15); else if (sfx_id != sfx_itemup && sfx_id != sfx_tink) - pitch += 16 - (M_Random()&31); + pitch += 16 - (M_RandomByte()&31); } else*/ - pitch = 128 + (M_Random() & 7) - (M_Random() & 7); + pitch = 128 + (M_RandomByte() & 7) - (M_RandomByte() & 7); } #endif diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index fb369387f..a93e96dc3 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -871,7 +871,7 @@ void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr) size = p_lspr->corona_radius * ((outVerts[0].z+120.0f)/950.0f); // d'ou vienne ces constante ? break; case ROCKET_SPR: - p_lspr->corona_color = (((M_Random()>>1)&0xff)<<24)|0x0040ff; + p_lspr->corona_color = (((M_RandomByte()>>1)&0xff)<<24)|0x0040ff; // don't need a break case CORONA_SPR: size = p_lspr->corona_radius * ((outVerts[0].z+60.0f)/100.0f); // d'ou vienne ces constante ? @@ -974,7 +974,7 @@ void HWR_DrawCoronas(void) size = p_lspr->corona_radius * ((cz+120.0f)/950.0f); // d'ou vienne ces constante ? break; case ROCKET_SPR: - Surf.FlatColor.s.alpha = (UINT8)((M_Random()>>1)&0xff); + Surf.FlatColor.s.alpha = (UINT8)((M_RandomByte()>>1)&0xff); // don't need a break case CORONA_SPR: size = p_lspr->corona_radius * ((cz+60.0f)/100.0f); // d'ou vienne ces constante ? diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 2cc79db47..45f18627e 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -96,17 +96,17 @@ static int lib_evalMath(lua_State *L) // M_RANDOM ////////////// -static int lib_pRandom(lua_State *L) +static int lib_pRandomFixed(lua_State *L) { NOHUD - lua_pushinteger(L, P_Random()); + lua_pushfixed(L, P_RandomFixed()); return 1; } -static int lib_pSignedRandom(lua_State *L) +static int lib_pRandomByte(lua_State *L) { NOHUD - lua_pushinteger(L, P_SignedRandom()); + lua_pushinteger(L, P_RandomByte()); return 1; } @@ -134,6 +134,30 @@ static int lib_pRandomRange(lua_State *L) return 1; } +// Deprecated, macros, etc. +static int lib_pRandom(lua_State *L) +{ + NOHUD + LUA_Deprecated(L, "P_Random", "P_RandomByte"); + lua_pushinteger(L, P_RandomByte()); + return 1; +} + +static int lib_pSignedRandom(lua_State *L) +{ + NOHUD + lua_pushinteger(L, P_SignedRandom()); + return 1; +} + +static int lib_pRandomChance(lua_State *L) +{ + fixed_t p = luaL_checkfixed(L, 1); + NOHUD + lua_pushboolean(L, P_RandomChance(p)); + return 1; +} + // P_MAPUTIL /////////////// @@ -1910,10 +1934,13 @@ static luaL_Reg lib[] = { {"EvalMath", lib_evalMath}, // m_random - {"P_Random",lib_pRandom}, - {"P_SignedRandom",lib_pSignedRandom}, + {"P_RandomFixed",lib_pRandomFixed}, + {"P_RandomByte",lib_pRandomByte}, {"P_RandomKey",lib_pRandomKey}, {"P_RandomRange",lib_pRandomRange}, + {"P_Random",lib_pRandom}, // DEPRECATED + {"P_SignedRandom",lib_pSignedRandom}, // MACRO + {"P_RandomChance",lib_pRandomChance}, // MACRO // p_maputil {"P_AproxDistance",lib_pAproxDistance}, diff --git a/src/m_cheat.c b/src/m_cheat.c index 473fbbf75..6ed8d286a 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -618,9 +618,9 @@ void Command_CauseCfail_f(void) } P_UnsetThingPosition(players[consoleplayer].mo); - P_Random(); - P_Random(); - P_Random(); + P_RandomFixed(); + P_RandomByte(); + P_RandomFixed(); players[consoleplayer].mo->x = 0; players[consoleplayer].mo->y = 123311; //cfail cansuled kthxbye players[consoleplayer].mo->z = 123311; diff --git a/src/m_random.c b/src/m_random.c index eab45a3ed..caf4d5174 100644 --- a/src/m_random.c +++ b/src/m_random.c @@ -19,48 +19,51 @@ #include "m_random.h" #include "m_fixed.h" + + // --------------------------- // RNG functions (not synched) // --------------------------- -/** Provides a random byte. - * Used outside the p_xxx game code and not synchronized in netgames. This is - * for anything that doesn't need to be synced, e.g. precipitation. +/** Provides a random fixed point number. Distribution is uniform. + * As with all M_Random functions, not synched in netgames. * - * \return A random byte, 0 to 255. + * \return A random fixed point number from [0,1). */ -UINT8 M_Random(void) +fixed_t M_RandomFixed(void) { - return (rand() & 255); + return (rand() & 0xFFFF); } -/** Provides a random signed byte. Distribution is uniform. - * As with all M_*Random functions, not synched in netgames. +/** Provides a random byte. Distribution is uniform. + * As with all M_Random functions, not synched in netgames. * - * \return A random byte, -128 to 127. - * \sa M_Random + * \return A random integer from [0, 255]. */ -INT32 M_SignedRandom(void) +UINT8 M_RandomByte(void) { - return (rand() & 255) - 128; + return (rand() & 0xFF); } -/** Provides a random number in between 0 and the given number - 1. - * Distribution is uniform. Use for picking random elements from an array. - * As with all M_*Random functions, not synched in netgames. +/** Provides a random integer for picking random elements from an array. + * Distribution is uniform. + * As with all M_Random functions, not synched in netgames. * - * \return A random number, 0 to arg1-1. + * \param a Number of items in array. + * \return A random integer from [0,a). */ INT32 M_RandomKey(INT32 a) { return (INT32)((rand()/((unsigned)RAND_MAX+1.0f))*a); } -/** Provides a random number in between a specific range. +/** Provides a random integer in a given range. * Distribution is uniform. - * As with all M_*Random functions, not synched in netgames. + * As with all M_Random functions, not synched in netgames. * - * \return A random number, arg1 to arg2. + * \param a Lower bound. + * \param b Upper bound. + * \return A random integer from [a,b]. */ INT32 M_RandomRange(INT32 a, INT32 b) { @@ -79,8 +82,7 @@ static UINT32 randomseed = 0; // Holds the INITIAL seed value. Used for demos, possibly other debugging. static UINT32 initialseed = 0; -/** - * Provides a random fixed point number. +/** Provides a random fixed point number. * This is a variant of an xorshift PRNG; state fits in a 32 bit integer structure. * * \return A random fixed point number from [0,1). @@ -96,44 +98,7 @@ ATTRINLINE static fixed_t FUNCINLINE __internal_prng__(void) return (randomseed&((FRACUNIT-1)<<9))>>9; } -/** Provides a random integer from 0 to 255. - * Distribution is uniform. - * If you're curious, (&0xFF00) >> 8 gives the same result - * as a fixed point multiplication by 256. - * - * \return Random integer from [0, 255]. - * \sa __internal_prng__ - */ -#ifndef DEBUGRANDOM -UINT8 P_Random(void) -{ -#else -UINT8 P_RandomD(const char *rfile, INT32 rline) -{ - CONS_Printf("P_Random() at: %sp %d\n", rfile, rline); -#endif - return (UINT8)((__internal_prng__()&0xFF00)>>8); -} - -/** Provides a random integer from -128 to 127. - * Distribution is uniform. - * - * \return Random integer from [-128, 127]. - * \sa __internal_prng__ - */ -#ifndef DEBUGRANDOM -INT32 P_SignedRandom(void) -{ -#else -INT32 P_SignedRandomD(const char *rfile, INT32 rline) -{ - CONS_Printf("P_SignedRandom() at: %sp %d\n", rfile, rline); -#endif - return (INT32)((__internal_prng__()&0xFF00)>>8) - 128; -} - -/** - * Provides a random fixed point number. +/** Provides a random fixed point number. Distribution is uniform. * Literally a wrapper for the internal PRNG function. * * \return A random fixed point number from [0,1). @@ -144,14 +109,34 @@ fixed_t P_RandomFixed(void) #else UINT8 P_RandomFixedD(const char *rfile, INT32 rline) { - CONS_Printf("P_Random() at: %sp %d\n", rfile, rline); + CONS_Printf("P_RandomFixed() at: %sp %d\n", rfile, rline); #endif return __internal_prng__(); } +/** Provides a random byte. Distribution is uniform. + * If you're curious, (&0xFF00) >> 8 gives the same result + * as a fixed point multiplication by 256. + * + * \return Random integer from [0, 255]. + * \sa __internal_prng__ + */ +#ifndef DEBUGRANDOM +UINT8 P_RandomByte(void) +{ +#else +UINT8 P_RandomByteD(const char *rfile, INT32 rline) +{ + CONS_Printf("P_RandomByte() at: %sp %d\n", rfile, rline); +#endif + return (UINT8)((__internal_prng__()&0xFF00)>>8); +} + /** Provides a random integer for picking random elements from an array. * Distribution is uniform. + * NOTE: Maximum range is 65536. * + * \param a Number of items in array. * \return A random integer from [0,a). * \sa __internal_prng__ */ @@ -168,8 +153,11 @@ INT32 P_RandomKeyD(const char *rfile, INT32 rline, INT32 a) /** Provides a random integer in a given range. * Distribution is uniform. + * NOTE: Maximum range is 65536. * - * \return A random integer from [a,b].P_Random + * \param a Lower bound. + * \param b Upper bound. + * \return A random integer from [a,b]. * \sa __internal_prng__ */ #ifndef DEBUGRANDOM diff --git a/src/m_random.h b/src/m_random.h index 91348365b..90784a5d0 100644 --- a/src/m_random.h +++ b/src/m_random.h @@ -25,30 +25,36 @@ // P_Random functions pulls random bytes from a PRNG that is network synced. // RNG functions -UINT8 M_Random(void); -INT32 M_SignedRandom(void); -INT32 M_RandomKey(INT32 a); -INT32 M_RandomRange(INT32 a, INT32 b); +fixed_t M_RandomFixed(void); +UINT8 M_RandomByte(void); +INT32 M_RandomKey(INT32 a); +INT32 M_RandomRange(INT32 a, INT32 b); // PRNG functions #ifdef DEBUGRANDOM -#define P_Random() P_RandomD(__FILE__, __LINE__) -#define P_SignedRandom() P_SignedRandomD(__FILE__, __LINE__) #define P_RandomFixed() P_RandomFixedD(__FILE__, __LINE__) +#define P_RandomByte() P_RandomByteD(__FILE__, __LINE__) #define P_RandomKey(c) P_RandomKeyD(__FILE__, __LINE__, c) #define P_RandomRange(c, d) P_RandomRangeD(__FILE__, __LINE__, c, d) -UINT8 P_RandomD(const char *rfile, INT32 rline); -INT32 P_SignedRandomD(const char *rfile, INT32 rline); fixed_t P_RandomFixedD(const char *rfile, INT32 rline); -INT32 P_RandomKeyD(const char *rfile, INT32 rline, INT32 a); -INT32 P_RandomRangeD(const char *rfile, INT32 rline, INT32 a, INT32 b); +UINT8 P_RandomByteD(const char *rfile, INT32 rline); +INT32 P_RandomKeyD(const char *rfile, INT32 rline, INT32 a); +INT32 P_RandomRangeD(const char *rfile, INT32 rline, INT32 a, INT32 b); #else -UINT8 P_Random(void); -INT32 P_SignedRandom(void); fixed_t P_RandomFixed(void); -INT32 P_RandomKey(INT32 a); -INT32 P_RandomRange(INT32 a, INT32 b); +UINT8 P_RandomByte(void); +INT32 P_RandomKey(INT32 a); +INT32 P_RandomRange(INT32 a, INT32 b); #endif + +// Macros for other functions +#define M_SignedRandom() ((INT32)M_RandomByte() - 128) // [-128, 127] signed byte, originally a +#define P_SignedRandom() ((INT32)P_RandomByte() - 128) // function of its own, moved to a macro + +#define M_RandomChance(p) (M_RandomFixed() < p) // given fixed point probability, p, between 0 (0%) +#define P_RandomChance(p) (P_RandomFixed() < p) // and FRACUNIT (100%), returns true p% of the time + +// Debugging fixed_t P_RandomPeek(void); // Working with the seed for PRNG diff --git a/src/p_enemy.c b/src/p_enemy.c index 367d5714a..b8737810c 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -386,7 +386,7 @@ boolean P_CheckMissileRange(mobj_t *actor) if (actor->type == MT_EGGMOBILE && dist > 160) dist = 160; - if (P_Random() < dist) + if (P_RandomByte() < dist) return false; return true; @@ -486,7 +486,7 @@ static boolean P_TryWalk(mobj_t *actor) { if (!P_Move(actor, actor->info->speed)) return false; - actor->movecount = P_Random() & 15; + actor->movecount = P_RandomByte() & 15; return true; } @@ -539,7 +539,7 @@ void P_NewChaseDir(mobj_t *actor) } // try other directions - if (P_Random() > 200 || abs(deltay) > abs(deltax)) + if (P_RandomChance(25*FRACUNIT/32) || abs(deltay) > abs(deltax)) { tdir = d[1]; d[1] = d[2]; @@ -577,7 +577,7 @@ void P_NewChaseDir(mobj_t *actor) } // randomly determine direction of search - if (P_Random() & 1) + if (P_RandomChance(FRACUNIT/2)) { for (tdir = DI_EAST; tdir <= DI_SOUTHEAST; tdir++) { @@ -632,7 +632,7 @@ boolean P_LookForPlayers(mobj_t *actor, boolean allaround, boolean tracer, fixed // BP: first time init, this allow minimum lastlook changes if (actor->lastlook < 0) - actor->lastlook = P_Random(); + actor->lastlook = P_RandomByte(); actor->lastlook %= MAXPLAYERS; @@ -707,7 +707,7 @@ static boolean P_LookForShield(mobj_t *actor) // BP: first time init, this allow minimum lastlook changes if (actor->lastlook < 0) - actor->lastlook = P_Random(); + actor->lastlook = P_RandomByte(); actor->lastlook %= MAXPLAYERS; @@ -2293,12 +2293,7 @@ void A_SkullAttack(mobj_t *actor) if (locvar1 == 1) actor->angle += ANGLE_180; else if (locvar1 == 2) - { - if (P_Random() & 1) - actor->angle += ANGLE_90; - else - actor->angle -= ANGLE_90; - } + actor->angle += (P_RandomChance(FRACUNIT/2)) ? ANGLE_90 : -ANGLE_90; an = actor->angle >> ANGLETOFINESHIFT; @@ -2398,9 +2393,9 @@ void A_BossScream(mobj_t *actor) explodetype = (mobjtype_t)locvar2; if (actor->eflags & MFE_VERTICALFLIP) - z = actor->z + actor->height - mobjinfo[explodetype].height - FixedMul((P_Random()<<(FRACBITS-2)) - 8*FRACUNIT, actor->scale); + z = actor->z + actor->height - mobjinfo[explodetype].height - FixedMul((P_RandomByte()<<(FRACBITS-2)) - 8*FRACUNIT, actor->scale); else - z = actor->z + FixedMul((P_Random()<<(FRACBITS-2)) - 8*FRACUNIT, actor->scale); + z = actor->z + FixedMul((P_RandomByte()<<(FRACBITS-2)) - 8*FRACUNIT, actor->scale); mo = P_SpawnMobj(x, y, z, explodetype); if (actor->eflags & MFE_VERTICALFLIP) @@ -3461,7 +3456,7 @@ void A_BubbleSpawn(mobj_t *actor) return; // don't make bubble! } - prandom = P_Random(); + prandom = P_RandomByte(); if (leveltime % (3*TICRATE) < 8) bubble = P_SpawnMobj(actor->x, actor->y, actor->z + (actor->height / 2), MT_EXTRALARGEBUBBLE); @@ -3509,7 +3504,7 @@ void A_FanBubbleSpawn(mobj_t *actor) return; // don't make bubble! } - prandom = P_Random(); + prandom = P_RandomByte(); if ((prandom & 0x7) == 0x7) bubble = P_SpawnMobj(actor->x, actor->y, hz, MT_SMALLBUBBLE); @@ -3550,7 +3545,7 @@ void A_BubbleRise(mobj_t *actor) // Move around slightly to make it look like it's bending around the water if (!locvar1) { - UINT8 prandom = P_Random(); + UINT8 prandom = P_RandomByte(); if (!(prandom & 0x7)) // *****000 { P_InstaThrust(actor, prandom & 0x70 ? actor->angle + ANGLE_90 : actor->angle, @@ -3833,7 +3828,7 @@ void A_ThrownRing(mobj_t *actor) // first time init, this allow minimum lastlook changes if (actor->lastlook < 0) - actor->lastlook = P_Random(); + actor->lastlook = P_RandomByte(); actor->lastlook %= MAXPLAYERS; @@ -3913,7 +3908,7 @@ void A_SetSolidSteam(mobj_t *actor) #endif actor->flags &= ~MF_NOCLIP; actor->flags |= MF_SOLID; - if (!(P_Random() & 7)) + if (P_RandomChance(FRACUNIT/8)) { if (actor->info->deathsound) S_StartSound(actor, actor->info->deathsound); // Hiss! @@ -4055,7 +4050,7 @@ void A_JetChase(mobj_t *actor) if (actor->reactiontime) actor->reactiontime--; - if (P_Random() % 32 == 1) + if (P_RandomChance(FRACUNIT/32)) { actor->momx = actor->momx / 2; actor->momy = actor->momy / 2; @@ -4416,7 +4411,7 @@ void A_JetgThink(mobj_t *actor) if (actor->target) { - if (P_Random() <= 32 && !actor->reactiontime) + if (P_RandomChance(FRACUNIT/8) && !actor->reactiontime) P_SetMobjState(actor, actor->info->missilestate); else A_JetChase (actor); @@ -4469,10 +4464,10 @@ void A_MouseThink(mobj_t *actor) { if (twodlevel || actor->flags2 & MF2_TWOD) { - if (P_Random() & 1) + if (P_RandomChance(FRACUNIT/2)) actor->angle += ANGLE_180; } - else if (P_Random() & 1) + else if (P_RandomChance(FRACUNIT/2)) actor->angle += ANGLE_90; else actor->angle -= ANGLE_90; @@ -4878,7 +4873,7 @@ void A_RockSpawn(mobj_t *actor) type = MT_ROCKCRUMBLE1 + (sides[line->sidenum[0]].rowoffset >> FRACBITS); if (line->flags & ML_NOCLIMB) - randomoomph = P_Random() * (FRACUNIT/32); + randomoomph = P_RandomByte() * (FRACUNIT/32); else randomoomph = 0; @@ -5172,7 +5167,7 @@ void A_CrawlaCommanderThink(mobj_t *actor) if (locvar1) { - if (actor->health < 2 && P_Random() < 2) + if (actor->health < 2 && P_RandomChance(FRACUNIT/128)) P_SpawnMissile(actor, actor->target, locvar1); } @@ -5187,8 +5182,8 @@ void A_CrawlaCommanderThink(mobj_t *actor) actor->threshold = 0; // Roam around, somewhat in the player's direction. - actor->angle += (P_Random()<<10); - actor->angle -= (P_Random()<<10); + actor->angle += (P_RandomByte()<<10); + actor->angle -= (P_RandomByte()<<10); if (actor->health > 1) P_InstaThrust(actor, actor->angle, FixedMul(10*FRACUNIT, actor->scale)); @@ -5204,7 +5199,7 @@ void A_CrawlaCommanderThink(mobj_t *actor) actor->threshold = 1; } } - actor->reactiontime = 2*TICRATE + P_Random()/2; + actor->reactiontime = 2*TICRATE + P_RandomByte()/2; } if (actor->health == 1) @@ -5222,8 +5217,8 @@ void A_CrawlaCommanderThink(mobj_t *actor) } else { - UINT8 prandom = P_Random(); - actor->angle = R_PointToAngle2(actor->x, actor->y, actor->target->x, actor->target->y) + (P_Random() & 1 ? -prandom : +prandom); + UINT8 prandom = P_RandomByte(); + actor->angle = R_PointToAngle2(actor->x, actor->y, actor->target->x, actor->target->y) + (P_RandomChance(FRACUNIT/2) ? -prandom : +prandom); P_InstaThrust(actor, actor->angle, FixedDiv(FixedMul(locvar2, actor->scale), 3*FRACUNIT/2)); actor->momz = FixedMul(locvar2, actor->scale); // Bounce up in air } @@ -5552,7 +5547,7 @@ void A_MixUp(mobj_t *actor) { if (counter > 255) // fail-safe to avoid endless loop break; - prandom = P_Random(); + prandom = P_RandomByte(); prandom %= numplayers; // I love modular arithmetic, don't you? if (prandom) // Make sure it's not a useless mix break; @@ -5701,7 +5696,7 @@ void A_RecyclePowers(mobj_t *actor) { UINT8 tempint; - i = j + ((P_Random() + leveltime) % (numplayers - j)); + i = j + ((P_RandomByte() + leveltime) % (numplayers - j)); tempint = postscramble[j]; postscramble[j] = postscramble[i]; postscramble[i] = tempint; @@ -5814,7 +5809,7 @@ void A_Boss1Chase(mobj_t *actor) { if (actor->health > actor->info->damage) { - if (P_Random() & 1) + if (P_RandomChance(FRACUNIT/2)) P_SetMobjState(actor, actor->info->missilestate); else P_SetMobjState(actor, actor->info->meleestate); @@ -5833,7 +5828,7 @@ void A_Boss1Chase(mobj_t *actor) // ? nomissile: // possibly choose another target - if (multiplayer && P_Random() < 2) + if (multiplayer && P_RandomChance(FRACUNIT/128)) { if (P_LookForPlayers(actor, true, false, 0)) return; // got a new target @@ -5871,7 +5866,7 @@ nomissile: deltay = actor->target->y - actor->y; actor->movedir = diags[((deltay < 0)<<1) + (deltax > 0)]; - actor->movecount = P_Random() & 15; + actor->movecount = P_RandomByte() & 15; } } @@ -5897,13 +5892,13 @@ void A_Boss2Chase(mobj_t *actor) // Startup randomness if (actor->reactiontime <= -666) - actor->reactiontime = 2*TICRATE + P_Random(); + actor->reactiontime = 2*TICRATE + P_RandomByte(); // When reactiontime hits zero, he will go the other way if (--actor->reactiontime <= 0) { reverse = true; - actor->reactiontime = 2*TICRATE + P_Random(); + actor->reactiontime = 2*TICRATE + P_RandomByte(); } P_SetTarget(&actor->target, P_GetClosestAxis(actor)); @@ -5990,12 +5985,12 @@ void A_Boss2Chase(mobj_t *actor) if (actor->info->attacksound) S_StartAttackSound(actor, actor->info->attacksound); - if (P_Random() & 1) + if (P_RandomChance(FRACUNIT/2)) { goop->momx *= 2; goop->momy *= 2; } - else if (P_Random() > 128) + else if (P_RandomChance(129*FRACUNIT/256)) { goop->momx *= 3; goop->momy *= 3; @@ -6153,7 +6148,7 @@ void A_Boss7Chase(mobj_t *actor) { A_FaceTarget(actor); P_SetMobjState(actor, S_BLACKEGG_SHOOT1); - actor->movecount = TICRATE + P_Random()/2; + actor->movecount = TICRATE + P_RandomByte()/2; return; } @@ -6162,7 +6157,7 @@ void A_Boss7Chase(mobj_t *actor) if (actor->reactiontime <= 0 && actor->z == actor->floorz) { - // Here, we'll call P_Random() and decide what kind of attack to do + // Here, we'll call P_RandomByte() and decide what kind of attack to do switch(actor->threshold) { case 0: // Lob cannon balls @@ -6170,7 +6165,7 @@ void A_Boss7Chase(mobj_t *actor) { A_FaceTarget(actor); P_SetMobjState(actor, actor->info->xdeathstate); - actor->movecount = 7*TICRATE + P_Random(); + actor->movecount = 7*TICRATE + P_RandomByte(); break; } actor->threshold++; @@ -6180,9 +6175,9 @@ void A_Boss7Chase(mobj_t *actor) P_SetMobjState(actor, S_BLACKEGG_SHOOT1); if (actor->health > actor->info->damage) - actor->movecount = TICRATE + P_Random()/3; + actor->movecount = TICRATE + P_RandomByte()/3; else - actor->movecount = TICRATE + P_Random()/2; + actor->movecount = TICRATE + P_RandomByte()/2; break; case 2: // Homing Missile A_FaceTarget(actor); @@ -6266,8 +6261,8 @@ void A_Boss2PogoSFX(mobj_t *actor) } else { - UINT8 prandom = P_Random(); - actor->angle = R_PointToAngle2(actor->x, actor->y, actor->target->x, actor->target->y) + (P_Random() & 1 ? -prandom : +prandom); + UINT8 prandom = P_RandomByte(); + actor->angle = R_PointToAngle2(actor->x, actor->y, actor->target->x, actor->target->y) + (P_RandomChance(FRACUNIT/2) ? -prandom : +prandom); P_InstaThrust(actor, actor->angle, FixedMul(FixedMul(actor->info->speed,(locvar2)), actor->scale)); } if (actor->info->activesound) S_StartSound(actor, actor->info->activesound); @@ -6307,10 +6302,10 @@ void A_Boss2PogoTarget(mobj_t *actor) // Target hit, retreat! if (actor->target->player->powers[pw_flashing] > TICRATE || actor->flags2 & MF2_FRET) { - UINT8 prandom = P_Random(); + UINT8 prandom = P_RandomByte(); actor->z++; // unstick from the floor actor->momz = FixedMul(locvar1, actor->scale); // Bounce up in air - actor->angle = R_PointToAngle2(actor->x, actor->y, actor->target->x, actor->target->y) + (P_Random() & 1 ? -prandom : +prandom); // Pick a direction, and randomize it. + actor->angle = R_PointToAngle2(actor->x, actor->y, actor->target->x, actor->target->y) + (P_RandomChance(FRACUNIT/2) ? -prandom : +prandom); // Pick a direction, and randomize it. P_InstaThrust(actor, actor->angle+ANGLE_180, FixedMul(FixedMul(actor->info->speed,(locvar2)), actor->scale)); // Move at wandering speed } // Try to land on top of the player. @@ -6347,10 +6342,10 @@ void A_Boss2PogoTarget(mobj_t *actor) // Wander semi-randomly towards the player to get closer. else { - UINT8 prandom = P_Random(); + UINT8 prandom = P_RandomByte(); actor->z++; // unstick from the floor actor->momz = FixedMul(locvar1, actor->scale); // Bounce up in air - actor->angle = R_PointToAngle2(actor->x, actor->y, actor->target->x, actor->target->y) + (P_Random() & 1 ? -prandom : +prandom); // Pick a direction, and randomize it. + actor->angle = R_PointToAngle2(actor->x, actor->y, actor->target->x, actor->target->y) + (P_RandomChance(FRACUNIT/2) ? -prandom : +prandom); // Pick a direction, and randomize it. P_InstaThrust(actor, actor->angle, FixedMul(FixedMul(actor->info->speed,(locvar2)), actor->scale)); // Move at wandering speed } // Boing! @@ -7084,7 +7079,7 @@ void A_SmokeTrailer(mobj_t *actor) P_SetObjectMomZ(th, FRACUNIT, false); th->destscale = actor->scale; P_SetScale(th, actor->scale); - th->tics -= P_Random() & 3; + th->tics -= P_RandomByte() & 3; if (th->tics < 1) th->tics = 1; } @@ -7183,7 +7178,7 @@ void A_ChangeAngleRelative(mobj_t *actor) // rather than the ranges, so <0 and >360 work as possible values. -Red INT32 locvar1 = var1; INT32 locvar2 = var2; - //angle_t angle = (P_Random()+1)<<24; + //angle_t angle = (P_RandomByte()+1)<<24; const fixed_t amin = locvar1*FRACUNIT; const fixed_t amax = locvar2*FRACUNIT; //const angle_t amin = FixedAngle(locvar1*FRACUNIT); @@ -7217,7 +7212,7 @@ void A_ChangeAngleAbsolute(mobj_t *actor) { INT32 locvar1 = var1; INT32 locvar2 = var2; - //angle_t angle = (P_Random()+1)<<24; + //angle_t angle = (P_RandomByte()+1)<<24; const fixed_t amin = locvar1*FRACUNIT; const fixed_t amax = locvar2*FRACUNIT; //const angle_t amin = FixedAngle(locvar1*FRACUNIT); @@ -7825,7 +7820,7 @@ void A_RandomState(mobj_t *actor) return; #endif - P_SetMobjState(actor, P_Random()&1 ? locvar1 : locvar2); + P_SetMobjState(actor, P_RandomChance(FRACUNIT/2) ? locvar1 : locvar2); } // Function: A_RandomStateRange @@ -8516,34 +8511,29 @@ void A_SearchForPlayers(mobj_t *actor) // Function: A_CheckRandom // -// Description: Calls a state by chance (around 1/var1). +// Description: Calls a state by chance. // -// var1 = denominator (can't exceed 100) +// var1: +// lower 16 bits = denominator +// upper 16 bits = numerator (defaults to 1 if zero) // var2 = state number // void A_CheckRandom(mobj_t *actor) { INT32 locvar1 = var1; INT32 locvar2 = var2; - INT32 i, chance; - INT32 rndadd = 0; + fixed_t chance = FRACUNIT; + #ifdef HAVE_BLUA if (LUA_CallAction("A_CheckRandom", actor)) return; #endif + // The PRNG doesn't suck anymore, OK? + if (locvar1 >> 16) + chance *= (locvar1 >> 16); + chance /= (locvar1 & 0xFFFF); - if(locvar1 > 100) - locvar1 = 100; - - for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i]) - rndadd += abs((int)players[i].mo->x) + abs((int)players[i].mo->y) + abs((int)players[i].mo->z); - - rndadd = rndadd % 10000; //additional component to enlarge random number - - chance = (P_Random() + rndadd) % locvar1; - - if (chance == 0) + if (P_RandomChance(chance)) P_SetMobjState(actor, locvar2); } @@ -9890,7 +9880,7 @@ void A_BrakChase(mobj_t *actor) S_StartSound(actor, (sfxenum_t)locvar2); // make active sound - if (actor->type != MT_CYBRAKDEMON && actor->info->activesound && P_Random() < 3) + if (actor->type != MT_CYBRAKDEMON && actor->info->activesound && P_RandomChance(3*FRACUNIT/256)) { S_StartSound(actor, actor->info->activesound); } diff --git a/src/p_inter.c b/src/p_inter.c index b8101f12b..128b50721 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1236,7 +1236,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (special->target && special->target->state == &states[S_BLACKEGG_SHOOT1]) { - if (special->target->health <= 2 && (P_Random() & 1)) + if (special->target->health <= 2 && P_RandomChance(FRACUNIT/2)) P_SetMobjState(special->target, special->target->info->missilestate); else P_SetMobjState(special->target, special->target->info->raisestate); @@ -2186,29 +2186,17 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source) default: if (target->info->doomednum) + prandom = target->info->doomednum%5; // "Random" animal for new enemies. + else + prandom = P_RandomKey(5); // No placable object, just use a random number. + + switch(prandom) { - switch(target->info->doomednum%5) - { default: item = MT_BUNNY; break; case 1: item = MT_BIRD; break; case 2: item = MT_MOUSE; break; case 3: item = MT_COW; break; case 4: item = MT_CHICKEN; break; - } - } - else - { - prandom = P_Random(); - if (prandom < 51) - item = MT_BUNNY; - else if (prandom < 102) - item = MT_BIRD; - else if (prandom < 153) - item = MT_MOUSE; - else if (prandom < 204) - item = MT_COW; - else - item = MT_CHICKEN; } break; } @@ -3086,7 +3074,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da // Killing dead. Just for kicks. // Require source and inflictor be player. Don't hurt for firing rings. - if (cv_killingdead.value && (source && source->player) && (inflictor && inflictor->player) && P_Random() < 80) + if (cv_killingdead.value && (source && source->player) && (inflictor && inflictor->player) && P_RandomChance(5*FRACUNIT/16)) P_DamageMobj(source, target, target, 1); // do the damage @@ -3600,7 +3588,7 @@ void P_PlayerFlagBurst(player_t *player, boolean toss) P_InstaThrust(flag, player->mo->angle, FixedMul(6*FRACUNIT, player->mo->scale)); else { - angle_t fa = P_Random()*FINEANGLES/256; + angle_t fa = P_RandomByte()*FINEANGLES/256; flag->momx = FixedMul(FINECOSINE(fa), FixedMul(6*FRACUNIT, player->mo->scale)); if (!(twodlevel || (player->mo->flags2 & MF2_TWOD))) flag->momy = FixedMul(FINESINE(fa), FixedMul(6*FRACUNIT, player->mo->scale)); diff --git a/src/p_lights.c b/src/p_lights.c index 2dfe006dc..a9758c723 100644 --- a/src/p_lights.c +++ b/src/p_lights.c @@ -51,7 +51,7 @@ void T_FireFlicker(fireflicker_t *flick) if (--flick->count) return; - amount = (INT16)((UINT8)(P_Random() & 3) * 16); + amount = (INT16)((UINT8)(P_RandomByte() & 3) * 16); if (flick->sector->lightlevel - amount < flick->minlight) flick->sector->lightlevel = (INT16)flick->minlight; @@ -235,7 +235,7 @@ strobe_t *P_SpawnAdjustableStrobeFlash(sector_t *minsector, sector_t *maxsector, flash->minlight = 0; if (!inSync) - flash->count = (P_Random() & 7) + 1; + flash->count = (P_RandomByte() & 7) + 1; else flash->count = 1; diff --git a/src/p_mobj.c b/src/p_mobj.c index 4e60ad612..150af1e08 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -652,9 +652,9 @@ void P_EmeraldManager(void) break; if (leveltime < TICRATE) // Start of map - spawnpoints[j]->threshold = 60*TICRATE + P_Random() * (TICRATE/5); + spawnpoints[j]->threshold = 60*TICRATE + P_RandomByte() * (TICRATE/5); else - spawnpoints[j]->threshold = P_Random() * (TICRATE/5); + spawnpoints[j]->threshold = P_RandomByte() * (TICRATE/5); break; } @@ -683,26 +683,26 @@ void P_ExplodeMissile(mobj_t *mo) explodemo = P_SpawnMobj(mo->x, mo->y, mo->z, MT_EXPLODE); P_SetScale(explodemo, mo->scale); explodemo->destscale = mo->destscale; - explodemo->momx += (P_Random() % 32) * FixedMul(FRACUNIT/8, explodemo->scale); - explodemo->momy += (P_Random() % 32) * FixedMul(FRACUNIT/8, explodemo->scale); + explodemo->momx += (P_RandomByte() % 32) * FixedMul(FRACUNIT/8, explodemo->scale); + explodemo->momy += (P_RandomByte() % 32) * FixedMul(FRACUNIT/8, explodemo->scale); S_StartSound(explodemo, sfx_pop); explodemo = P_SpawnMobj(mo->x, mo->y, mo->z, MT_EXPLODE); P_SetScale(explodemo, mo->scale); explodemo->destscale = mo->destscale; - explodemo->momx += (P_Random() % 64) * FixedMul(FRACUNIT/8, explodemo->scale); - explodemo->momy -= (P_Random() % 64) * FixedMul(FRACUNIT/8, explodemo->scale); + explodemo->momx += (P_RandomByte() % 64) * FixedMul(FRACUNIT/8, explodemo->scale); + explodemo->momy -= (P_RandomByte() % 64) * FixedMul(FRACUNIT/8, explodemo->scale); S_StartSound(explodemo, sfx_dmpain); explodemo = P_SpawnMobj(mo->x, mo->y, mo->z, MT_EXPLODE); P_SetScale(explodemo, mo->scale); explodemo->destscale = mo->destscale; - explodemo->momx -= (P_Random() % 128) * FixedMul(FRACUNIT/8, explodemo->scale); - explodemo->momy += (P_Random() % 128) * FixedMul(FRACUNIT/8, explodemo->scale); + explodemo->momx -= (P_RandomByte() % 128) * FixedMul(FRACUNIT/8, explodemo->scale); + explodemo->momy += (P_RandomByte() % 128) * FixedMul(FRACUNIT/8, explodemo->scale); S_StartSound(explodemo, sfx_pop); explodemo = P_SpawnMobj(mo->x, mo->y, mo->z, MT_EXPLODE); P_SetScale(explodemo, mo->scale); explodemo->destscale = mo->destscale; - explodemo->momx -= (P_Random() % 96) * FixedMul(FRACUNIT/8, explodemo->scale); - explodemo->momy -= (P_Random() % 96) * FixedMul(FRACUNIT/8, explodemo->scale); + explodemo->momx -= (P_RandomByte() % 96) * FixedMul(FRACUNIT/8, explodemo->scale); + explodemo->momy -= (P_RandomByte() % 96) * FixedMul(FRACUNIT/8, explodemo->scale); S_StartSound(explodemo, sfx_cybdth); // Hack: Release an animal. @@ -2405,12 +2405,12 @@ static boolean P_ZMovement(mobj_t *mo) // If deafed, give the tumbleweed another random kick if it runs out of steam. mom.z += P_MobjFlip(mo)*FixedMul(6*FRACUNIT, mo->scale); - if (P_Random() & 1) + if (P_RandomChance(FRACUNIT/2)) mom.x += FixedMul(6*FRACUNIT, mo->scale); else mom.x -= FixedMul(6*FRACUNIT, mo->scale); - if (P_Random() & 1) + if (P_RandomChance(FRACUNIT/2)) mom.y += FixedMul(6*FRACUNIT, mo->scale); else mom.y -= FixedMul(6*FRACUNIT, mo->scale); @@ -2886,7 +2886,7 @@ static boolean P_SceneryZMovement(mobj_t *mo) for (i = 0; i < 4; ++i) // split into four { - prandom = P_Random(); + prandom = P_RandomByte(); explodemo = P_SpawnMobj(mo->x, mo->y, mo->z, MT_SMALLBUBBLE); explodemo->momx += ((prandom & 0x0F) << (FRACBITS-2)) * (i & 2 ? -1 : 1); explodemo->momy += ((prandom & 0xF0) << (FRACBITS-6)) * (i & 1 ? -1 : 1); @@ -3218,13 +3218,13 @@ void P_MobjCheckWater(mobj_t *mobj) // Create tons of bubbles for (i = 0; i < bubblecount; i++) { - // P_Random()s are called individually to allow consistency + // P_RandomByte()s are called individually to allow consistency // across various compilers, since the order of function calls // in C is not part of the ANSI specification. - prandom[0] = P_Random(); - prandom[1] = P_Random(); - prandom[2] = P_Random(); - prandom[3] = P_Random(); + prandom[0] = P_RandomByte(); + prandom[1] = P_RandomByte(); + prandom[2] = P_RandomByte(); + prandom[3] = P_RandomByte(); bubbletype = MT_SMALLBUBBLE; if (!(prandom[0] & 0x3)) // medium bubble chance up to 64 from 32 @@ -3826,7 +3826,7 @@ boolean P_BossTargetPlayer(mobj_t *actor, boolean closest) // first time init, this allow minimum lastlook changes if (actor->lastlook < 0) - actor->lastlook = P_Random(); + actor->lastlook = P_RandomByte(); actor->lastlook &= PLAYERSMASK; for( ; ; actor->lastlook = (actor->lastlook+1) & PLAYERSMASK) @@ -4707,7 +4707,7 @@ static void P_Boss7Thinker(mobj_t *mobj) if (mobj->state == &states[S_BLACKEGG_STND] && mobj->tics == mobj->state->tics) { - mobj->reactiontime += P_Random(); + mobj->reactiontime += P_RandomByte(); if (mobj->health <= mobj->info->damage) mobj->reactiontime /= 4; @@ -4901,7 +4901,7 @@ static void P_Boss7Thinker(mobj_t *mobj) if (mobj->tracer && mobj->tracer->type == MT_BOSS3WAYPOINT && mobj->tracer->spawnpoint && (mobj->tracer->spawnpoint->options & 7) == waypointNum) { - if (P_Random() & 1) + if (P_RandomChance(FRACUNIT/2)) waypointNum++; else waypointNum--; @@ -4913,7 +4913,7 @@ static void P_Boss7Thinker(mobj_t *mobj) } if (waypointNum == 0 && mobj->health <= mobj->info->damage) - waypointNum = 1 + (P_Random() & 1); + waypointNum = 1 + (P_RandomFixed() & 1); // scan the thinkers to find // the waypoint to use @@ -5013,7 +5013,7 @@ static void P_Boss7Thinker(mobj_t *mobj) P_SetMobjState(mobj, mobj->info->spawnstate); } else if (mobj->state == &states[mobj->info->deathstate] && mobj->tics == mobj->state->tics) - S_StartSound(0, sfx_bedie1 + (P_Random() & 1)); + S_StartSound(0, sfx_bedie1 + (P_RandomFixed() & 1)); } @@ -5440,7 +5440,7 @@ static void P_Boss9Thinker(mobj_t *mobj) // An incoming attack is detected! What should we do?! // Go into vector form! mobj->movedir = ANGLE_11hh - FixedAngle(FixedMul(AngleFixed(ANGLE_11hh), FixedDiv((mobj->info->spawnhealth - mobj->health)<info->spawnhealth-1)<movedir = InvAngle(mobj->movedir); mobj->threshold = 6 + (FixedMul(24<info->spawnhealth - mobj->health)<info->spawnhealth-1)<>FRACBITS); if (mobj->info->activesound) @@ -6042,20 +6042,20 @@ static void P_KoopaThinker(mobj_t *koopa) P_XYMovement(koopa); - if (P_Random() < 8 && koopa->z <= koopa->floorz) + if (P_RandomChance(FRACUNIT/32) && koopa->z <= koopa->floorz) koopa->momz = FixedMul(5*FRACUNIT, koopa->scale); if (koopa->z > koopa->floorz) koopa->momz += FixedMul(FRACUNIT/4, koopa->scale); - if (P_Random() < 4) + if (P_RandomChance(FRACUNIT/64)) { mobj_t *flame; - flame = P_SpawnMobj(koopa->x - koopa->radius + FixedMul(5*FRACUNIT, koopa->scale), koopa->y, koopa->z + (P_Random()<<(FRACBITS-2)), MT_KOOPAFLAME); + flame = P_SpawnMobj(koopa->x - koopa->radius + FixedMul(5*FRACUNIT, koopa->scale), koopa->y, koopa->z + (P_RandomByte()<<(FRACBITS-2)), MT_KOOPAFLAME); flame->momx = -FixedMul(flame->info->speed, flame->scale); S_StartSound(flame, sfx_koopfr); } - else if (P_Random() > 250) + else if (P_RandomChance(5*FRACUNIT/256)) { mobj_t *hammer; hammer = P_SpawnMobj(koopa->x - koopa->radius, koopa->y, koopa->z + koopa->height, MT_HAMMER); @@ -6499,11 +6499,11 @@ void P_MobjThinker(mobj_t *mobj) fixed_t ns; mobj_t *mo2; - i = P_Random(); - z = mobj->subsector->sector->floorheight + ((P_Random()&63)*FRACUNIT); + i = P_RandomByte(); + z = mobj->subsector->sector->floorheight + ((P_RandomByte()&63)*FRACUNIT); for (j = 0; j < 2; j++) { - const angle_t fa = (P_Random()*FINEANGLES/16) & FINEMASK; + const angle_t fa = (P_RandomByte()*FINEANGLES/16) & FINEMASK; ns = 64 * FRACUNIT; x = mobj->x + FixedMul(FINESINE(fa),ns); y = mobj->y + FixedMul(FINECOSINE(fa),ns); @@ -6513,7 +6513,7 @@ void P_MobjThinker(mobj_t *mobj) mo2->momx = FixedMul(FINESINE(fa),ns); mo2->momy = FixedMul(FINECOSINE(fa),ns); - i = P_Random(); + i = P_RandomByte(); if (i % 5 == 0) P_SpawnMobj(x, y, z, MT_CHICKEN); @@ -7997,7 +7997,7 @@ void P_SpawnPrecipitation(void) continue; rainmo = P_SpawnSnowMobj(x, y, height, MT_SNOWFLAKE); - mrand = M_Random(); + mrand = M_RandomByte(); if (mrand < 64) P_SetPrecipMobjState(rainmo, S_SNOW3); else if (mrand < 144) @@ -9166,12 +9166,12 @@ ML_NOCLIMB : Direction not controllable { mobj->momz += FixedMul(16*FRACUNIT, mobj->scale); - if (P_Random() & 1) + if (P_RandomChance(FRACUNIT/2)) mobj->momx += FixedMul(16*FRACUNIT, mobj->scale); else mobj->momx -= FixedMul(16*FRACUNIT, mobj->scale); - if (P_Random() & 1) + if (P_RandomChance(FRACUNIT/2)) mobj->momy += FixedMul(16*FRACUNIT, mobj->scale); else mobj->momy -= FixedMul(16*FRACUNIT,mobj->scale); diff --git a/src/p_spec.c b/src/p_spec.c index 277fe19eb..415e1be01 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2057,7 +2057,7 @@ void P_SwitchWeather(INT32 weathernum) precipmobj = (precipmobj_t *)think; precipmobj->flags = mobjinfo[MT_SNOWFLAKE].flags; - z = M_Random(); + z = M_RandomByte(); if (z < 64) z = 2; diff --git a/src/p_tick.c b/src/p_tick.c index c72ab5b67..d45f58821 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -363,7 +363,7 @@ static void P_DoAutobalanceTeams(void) { if (totalred > totalblue) { - i = M_Random() % red; + i = M_RandomKey(red); NetPacket.packet.newteam = 2; NetPacket.packet.playernum = redarray[i]; NetPacket.packet.verification = true; @@ -375,7 +375,7 @@ static void P_DoAutobalanceTeams(void) if (totalblue > totalred) { - i = M_Random() % blue; + i = M_RandomKey(blue); NetPacket.packet.newteam = 1; NetPacket.packet.playernum = bluearray[i]; NetPacket.packet.verification = true; diff --git a/src/p_user.c b/src/p_user.c index 03b2c1dd8..380ac9804 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2172,9 +2172,9 @@ static void P_DoBubbleBreath(player_t *player) if (!(player->mo->eflags & MFE_UNDERWATER) || ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL && !(player->pflags & PF_NIGHTSMODE)) || player->spectator) return; - if (!(P_Random() % 16)) + if (P_RandomChance(FRACUNIT/16)) bubble = P_SpawnMobj(player->mo->x, player->mo->y, zh, MT_SMALLBUBBLE); - else if (!(P_Random() % 96)) + else if (P_RandomChance(3*FRACUNIT/256)) bubble = P_SpawnMobj(player->mo->x, player->mo->y, zh, MT_MEDIUMBUBBLE); if (bubble) { @@ -6620,7 +6620,7 @@ static void P_MovePlayer(player_t *player) // Little water sound while touching water - just a nicety. if ((player->mo->eflags & MFE_TOUCHWATER) && !(player->mo->eflags & MFE_UNDERWATER) && !player->spectator) { - if (P_Random() & 1 && leveltime % TICRATE == 0) + if (P_RandomChance(FRACUNIT/2) && leveltime % TICRATE == 0) S_StartSound(player->mo, sfx_floush); } @@ -8423,7 +8423,7 @@ static boolean P_SpectatorJoinGame(player_t *player) else if (redscore > bluescore) changeto = 2; else - changeto = (P_Random() & 1) + 1; + changeto = (P_RandomFixed() & 1) + 1; if (player->mo) { @@ -8674,7 +8674,7 @@ void P_PlayerThink(player_t *player) // Add some extra randomization. if (cmd->forwardmove) - P_Random(); + P_RandomFixed(); #ifdef PARANOIA if (player->playerstate == PST_REBORN) diff --git a/src/v_video.c b/src/v_video.c index df81ac6d6..02c67a24e 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -1967,7 +1967,7 @@ Unoptimized version for (y = 0; y < height; y++) { - if (M_Random() < 32) + if (M_RandomChance(FRACUNIT/8)) // 12.5% heatshifter[y] = true; } From a3e940fe65a85b3423b6918b21b795e962fdd63d Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Sun, 27 Mar 2016 15:57:50 -0700 Subject: [PATCH 093/562] Compensate for insufficient RAND_MAX values. --- src/m_random.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/m_random.c b/src/m_random.c index caf4d5174..97b654c1c 100644 --- a/src/m_random.c +++ b/src/m_random.c @@ -32,7 +32,13 @@ */ fixed_t M_RandomFixed(void) { +#if RAND_MAX < 65535 + // Compensate for insufficient randomness. + fixed_t rndv = (rand()&1)<<15; + return rand()^rndv; +#else return (rand() & 0xFFFF); +#endif } /** Provides a random byte. Distribution is uniform. @@ -246,5 +252,5 @@ void P_SetRandSeedD(const char *rfile, INT32 rline, UINT32 seed) */ UINT32 M_RandomizedSeed(void) { - return ((totalplaytime & 0xFFFF) << 16)|(rand() & 0xFFFF); + return ((totalplaytime & 0xFFFF) << 16)|M_RandomFixed(); } From 3dc4cfc2290e99f0c77f8b661d04c9e6a8669ca6 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Tue, 29 Mar 2016 06:14:31 -0700 Subject: [PATCH 094/562] Simplicity is a virute... don't overcomplicate things. --- src/m_random.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/m_random.c b/src/m_random.c index 97b654c1c..d3d3f98ca 100644 --- a/src/m_random.c +++ b/src/m_random.c @@ -95,13 +95,10 @@ static UINT32 initialseed = 0; */ ATTRINLINE static fixed_t FUNCINLINE __internal_prng__(void) { - randomseed += 7069; - randomseed ^= randomseed << 17; - randomseed ^= randomseed >> 9; - randomseed *= 373; + randomseed ^= randomseed >> 13; + randomseed ^= randomseed >> 11; randomseed ^= randomseed << 21; - randomseed ^= randomseed >> 15; - return (randomseed&((FRACUNIT-1)<<9))>>9; + return ( (randomseed*36548569) >> 4) & (FRACUNIT-1); } /** Provides a random fixed point number. Distribution is uniform. From 480f9be51f9c38ef0f8ce61fc5c014564cd38b54 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Tue, 29 Mar 2016 06:20:26 -0700 Subject: [PATCH 095/562] gotta start compensating for xorshift's needs --- src/m_random.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/m_random.c b/src/m_random.c index d3d3f98ca..79f3af113 100644 --- a/src/m_random.c +++ b/src/m_random.c @@ -83,10 +83,10 @@ INT32 M_RandomRange(INT32 a, INT32 b) // ------------------------ // Holds the current seed. -static UINT32 randomseed = 0; +static UINT32 randomseed = 0xBADE4404; // Holds the INITIAL seed value. Used for demos, possibly other debugging. -static UINT32 initialseed = 0; +static UINT32 initialseed = 0xBADE4404; /** Provides a random fixed point number. * This is a variant of an xorshift PRNG; state fits in a 32 bit integer structure. @@ -240,6 +240,9 @@ void P_SetRandSeedD(const char *rfile, INT32 rline, UINT32 seed) { CONS_Printf("P_SetRandSeed() at: %sp %d\n", rfile, rline); #endif + // xorshift requires a nonzero seed + // this should never happen, but just in case it DOES, we check + if (!seed) seed = 0xBADE4404; randomseed = initialseed = seed; } From 0fe6ee533990adbd50da7abef36e54d76e9bf70d Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Wed, 30 Mar 2016 00:22:12 -0400 Subject: [PATCH 096/562] cleanup abs warnings --- src/b_bot.c | 2 +- src/lua_hudlib.c | 2 +- src/p_map.c | 4 ++-- src/p_user.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/b_bot.c b/src/b_bot.c index 3072b1d75..5e128bff1 100644 --- a/src/b_bot.c +++ b/src/b_bot.c @@ -49,7 +49,7 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm if (sonic->player->pflags & (PF_MACESPIN|PF_ITEMHANG)) { cmd->forwardmove = sonic->player->cmd.forwardmove; - cmd->angleturn = abs((tails->angle - sonic->angle))>>16; + cmd->angleturn = (angle_t)((tails->angle - sonic->angle))>>16; if (sonic->angle < tails->angle) cmd->angleturn = -cmd->angleturn; } else if (dist > FixedMul(512*FRACUNIT, tails->scale)) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 19390d50d..d5947489a 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -408,7 +408,7 @@ static int libd_drawPaddedNum(lua_State *L) HUDONLY x = luaL_checkinteger(L, 1); y = luaL_checkinteger(L, 2); - num = abs(luaL_checkinteger(L, 3)); + num = labs(luaL_checkinteger(L, 3)); digits = luaL_optinteger(L, 4, 2); flags = luaL_optinteger(L, 5, 0); flags &= ~V_PARAMMASK; // Don't let crashes happen. diff --git a/src/p_map.c b/src/p_map.c index 1aa8bc391..09f49423b 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2507,8 +2507,8 @@ isblocking: climbangle += (ANGLE_90 * (whichside ? -1 : 1)); - if (((!slidemo->player->climbing && abs((slidemo->angle - ANGLE_90 - climbline)) < ANGLE_45) - || (slidemo->player->climbing == 1 && abs((slidemo->angle - climbline)) < ANGLE_135)) + if (((!slidemo->player->climbing && (angle_t)((slidemo->angle - ANGLE_90 - climbline)) < ANGLE_45) + || (slidemo->player->climbing == 1 && (angle_t)((slidemo->angle - climbline)) < ANGLE_135)) && P_IsClimbingValid(slidemo->player, climbangle)) { slidemo->angle = climbangle; diff --git a/src/p_user.c b/src/p_user.c index ce68e2d61..34d2d4bae 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7899,9 +7899,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (player == &players[consoleplayer]) { if (focusangle >= localangle) - localangle += abs((focusangle - localangle))>>5; + localangle += (angle_t)((focusangle - localangle))>>5; else - localangle -= abs((focusangle - localangle))>>5; + localangle -= (angle_t)((focusangle - localangle))>>5; } } else if (P_AnalogMove(player)) // Analog From 7e07d2d77a660139244a3dea823cf4d020dc0672 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Wed, 30 Mar 2016 00:23:28 -0400 Subject: [PATCH 097/562] travis-ci: reenable -Werror --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index df89593c4..c15cc6795 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,9 @@ language: c sudo: required dist: trusty +env: +- CFLAGS=-Werror + os: - linux - osx From 9cec9093bb20cbdad7c25da4f4644c7ea1fa3b03 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Wed, 30 Mar 2016 06:20:57 -0700 Subject: [PATCH 098/562] denom of A_CheckRandom can't be zero, that would be bad --- src/p_enemy.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/p_enemy.c b/src/p_enemy.c index c32e2be8c..82391a748 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -8528,6 +8528,9 @@ void A_CheckRandom(mobj_t *actor) if (LUA_CallAction("A_CheckRandom", actor)) return; #endif + if ((locvar1 & 0xFFFF) == 0) + return; + // The PRNG doesn't suck anymore, OK? if (locvar1 >> 16) chance *= (locvar1 >> 16); From b169529dfde93925add91bd6b4dd0486a327492d Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Wed, 30 Mar 2016 11:47:27 -0400 Subject: [PATCH 099/562] switich to do the angle math in signed, then run it thur abs() --- src/b_bot.c | 2 +- src/p_map.c | 4 ++-- src/p_user.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/b_bot.c b/src/b_bot.c index 5e128bff1..e9b00497e 100644 --- a/src/b_bot.c +++ b/src/b_bot.c @@ -49,7 +49,7 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm if (sonic->player->pflags & (PF_MACESPIN|PF_ITEMHANG)) { cmd->forwardmove = sonic->player->cmd.forwardmove; - cmd->angleturn = (angle_t)((tails->angle - sonic->angle))>>16; + cmd->angleturn = abs((signed)(tails->angle - sonic->angle))>>16; if (sonic->angle < tails->angle) cmd->angleturn = -cmd->angleturn; } else if (dist > FixedMul(512*FRACUNIT, tails->scale)) diff --git a/src/p_map.c b/src/p_map.c index 09f49423b..bcb3c08a9 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2507,8 +2507,8 @@ isblocking: climbangle += (ANGLE_90 * (whichside ? -1 : 1)); - if (((!slidemo->player->climbing && (angle_t)((slidemo->angle - ANGLE_90 - climbline)) < ANGLE_45) - || (slidemo->player->climbing == 1 && (angle_t)((slidemo->angle - climbline)) < ANGLE_135)) + if (((!slidemo->player->climbing && abs((signed)(slidemo->angle - ANGLE_90 - climbline)) < ANGLE_45) + || (slidemo->player->climbing == 1 && abs((signed)(slidemo->angle - climbline)) < ANGLE_135)) && P_IsClimbingValid(slidemo->player, climbangle)) { slidemo->angle = climbangle; diff --git a/src/p_user.c b/src/p_user.c index 34d2d4bae..6053ad1e5 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7899,9 +7899,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (player == &players[consoleplayer]) { if (focusangle >= localangle) - localangle += (angle_t)((focusangle - localangle))>>5; + localangle += abs((signed)(focusangle - localangle))>>5; else - localangle -= (angle_t)((focusangle - localangle))>>5; + localangle -= abs((signed)(focusangle - localangle))>>5; } } else if (P_AnalogMove(player)) // Analog From 10cc421fae6095dc6151700b9cd9006164cc0d3c Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Wed, 30 Mar 2016 12:58:00 -0400 Subject: [PATCH 100/562] travis: add all/extra warnings --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c15cc6795..54c5901d0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ sudo: required dist: trusty env: -- CFLAGS=-Werror +- CFLAGS=-Wall -W -Werror os: - linux From d90536967d6cd05b1e454f45d252723909bf3d10 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Wed, 30 Mar 2016 14:05:07 -0400 Subject: [PATCH 101/562] removed/remline ununsed code --- src/am_map.c | 33 -------- src/hardware/hw_main.c | 6 -- src/hardware/hw_md2.c | 185 ----------------------------------------- src/m_cheat.c | 20 ----- src/mserv.c | 27 ------ src/p_maputl.c | 15 ---- src/p_spec.c | 6 +- src/r_things.c | 5 -- src/sdl/i_video.c | 13 --- 9 files changed, 5 insertions(+), 305 deletions(-) diff --git a/src/am_map.c b/src/am_map.c index 70714facb..97b7c5164 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -30,9 +30,7 @@ static const UINT8 REDRANGE = 16; static const UINT8 GRAYS = (1*16); static const UINT8 GRAYSRANGE = 16; static const UINT8 BROWNS = (3*16); -static const UINT8 BROWNRANGE = 16; static const UINT8 YELLOWS = (7*16); -static const UINT8 YELLOWRANGE = 8; static const UINT8 GREENS = (10*16); static const UINT8 GREENRANGE = 16; static const UINT8 DBLACK = 31; @@ -41,11 +39,8 @@ static const UINT8 DWHITE = 0; static const UINT8 NOCLIMBREDS = 248; static const UINT8 NOCLIMBREDRANGE = 8; static const UINT8 NOCLIMBGRAYS = 204; -static const UINT8 NOCLIMBGRAYSRANGE = 4; static const UINT8 NOCLIMBBROWNS = (2*16); -static const UINT8 NOCLIMBBROWNRANGE = 16; static const UINT8 NOCLIMBYELLOWS = (11*16); -static const UINT8 NOCLIMBYELLOWRANGE = 8; #ifdef _NDS @@ -67,15 +62,10 @@ static const UINT8 NOCLIMBYELLOWRANGE = 8; #define TSWALLCOLORS GRAYS #define TSWALLRANGE GRAYSRANGE #define NOCLIMBTSWALLCOLORS NOCLIMBGRAYS -#define NOCLIMBTSWALLRANGE NOCLIMBGRAYSRANGE #define FDWALLCOLORS BROWNS -#define FDWALLRANGE BROWNRANGE #define NOCLIMBFDWALLCOLORS NOCLIMBBROWNS -#define NOCLIMBFDWALLRANGE NOCLIMBBROWNRANGE #define CDWALLCOLORS YELLOWS -#define CDWALLRANGE YELLOWRANGE #define NOCLIMBCDWALLCOLORS NOCLIMBYELLOWS -#define NOCLIMBCDWALLRANGE NOCLIMBYELLOWRANGE #define THINGCOLORS GREENS #define THINGRANGE GREENRANGE #define SECRETWALLCOLORS WALLCOLORS @@ -255,29 +245,6 @@ static AMDRAWFLINEFUNC AM_drawFline; static void AM_drawFline_soft(const fline_t *fl, INT32 color); -/** Calculates the slope and slope according to the x-axis of a line - * segment in map coordinates (with the upright y-axis and all) so - * that it can be used with the braindead drawing stuff. - * - * \param ml The line segment. - * \param is Holds the result. - */ -static inline void AM_getIslope(const mline_t *ml, islope_t *is) -{ - INT32 dx, dy; - - dy = ml->a.y - ml->b.y; - dx = ml->b.x - ml->a.x; - if (!dy) - is->islp = (dx < 0 ? -INT32_MAX : INT32_MAX); - else - is->islp = FixedDiv(dx, dy); - if (!dx) - is->slp = (dy < 0 ? -INT32_MAX : INT32_MAX); - else - is->slp = FixedDiv(dy, dx); -} - static void AM_activateNewScale(void) { m_x += m_w/2; diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index b0186049a..ae26b8deb 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3404,12 +3404,6 @@ static void HWR_ClearSprites(void) gr_visspritecount = 0; } -static inline void HWR_ResetVisSpriteChunks(void) -{ - memset(gr_visspritechunks, 0, sizeof(gr_visspritechunks)); -} - - // -------------------------------------------------------------------------- // HWR_NewVisSprite // -------------------------------------------------------------------------- diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 0745b9a00..a160be67b 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -406,191 +406,6 @@ static md2_model_t *md2_readModel(const char *filename) return model; } -/* - * center model - */ -static inline void md2_getBoundingBox (md2_model_t *model, float *minmax) -{ - size_t i; - float minx, maxx; - float miny, maxy; - float minz, maxz; - - minx = miny = minz = 999999.0f; - maxx = maxy = maxz = -999999.0f; - - /* get bounding box */ - for (i = 0; i < model->header.numVertices; i++) - { - md2_triangleVertex_t *v = &model->frames[0].vertices[i]; - - if (v->vertex[0] < minx) - minx = v->vertex[0]; - else if (v->vertex[0] > maxx) - maxx = v->vertex[0]; - - if (v->vertex[1] < miny) - miny = v->vertex[1]; - else if (v->vertex[1] > maxy) - maxy = v->vertex[1]; - - if (v->vertex[2] < minz) - minz = v->vertex[2]; - else if (v->vertex[2] > maxz) - maxz = v->vertex[2]; - } - - minmax[0] = minx; - minmax[1] = maxx; - minmax[2] = miny; - minmax[3] = maxy; - minmax[4] = minz; - minmax[5] = maxz; -} - -static inline INT32 md2_getAnimationCount(md2_model_t *model) -{ - size_t i, pos; - INT32 j = 0, count; - char name[16], last[16]; - - strcpy(last, model->frames[0].name); - pos = strlen(last) - 1; - while (last[pos] >= '0' && last[pos] <= '9' && j < 2) - { - pos--; - j++; - } - last[pos + 1] = '\0'; - - count = 0; - - for (i = 0; i <= model->header.numFrames; i++) - { - if (i == model->header.numFrames) - strcpy(name, ""); // some kind of a sentinel - else - strcpy(name, model->frames[i].name); - pos = strlen(name) - 1; - j = 0; - while (name[pos] >= '0' && name[pos] <= '9' && j < 2) - { - pos--; - j++; - } - name[pos + 1] = '\0'; - - if (strcmp(last, name)) - { - strcpy(last, name); - count++; - } - } - - return count; -} - -static inline const char * md2_getAnimationName (md2_model_t *model, INT32 animation) -{ - size_t i, pos; - INT32 j = 0, count; - static char last[32]; - char name[32]; - - strcpy(last, model->frames[0].name); - pos = strlen(last) - 1; - while (last[pos] >= '0' && last[pos] <= '9' && j < 2) - { - pos--; - j++; - } - last[pos + 1] = '\0'; - - count = 0; - - for (i = 0; i <= model->header.numFrames; i++) - { - if (i == model->header.numFrames) - strcpy(name, ""); // some kind of a sentinel - else - strcpy(name, model->frames[i].name); - pos = strlen(name) - 1; - j = 0; - while (name[pos] >= '0' && name[pos] <= '9' && j < 2) - { - pos--; - j++; - } - name[pos + 1] = '\0'; - - if (strcmp(last, name)) - { - if (count == animation) - return last; - - strcpy(last, name); - count++; - } - } - - return 0; -} - -static inline void md2_getAnimationFrames(md2_model_t *model, - INT32 animation, INT32 *startFrame, INT32 *endFrame) -{ - size_t i, pos; - INT32 j = 0, count, numFrames, frameCount; - char name[16], last[16]; - - strcpy(last, model->frames[0].name); - pos = strlen(last) - 1; - while (last[pos] >= '0' && last[pos] <= '9' && j < 2) - { - pos--; - j++; - } - last[pos + 1] = '\0'; - - count = 0; - numFrames = 0; - frameCount = 0; - - for (i = 0; i <= model->header.numFrames; i++) - { - if (i == model->header.numFrames) - strcpy(name, ""); // some kind of a sentinel - else - strcpy(name, model->frames[i].name); - pos = strlen(name) - 1; - j = 0; - while (name[pos] >= '0' && name[pos] <= '9' && j < 2) - { - pos--; - j++; - } - name[pos + 1] = '\0'; - - if (strcmp(last, name)) - { - strcpy(last, name); - - if (count == animation) - { - *startFrame = frameCount - numFrames; - *endFrame = frameCount - 1; - return; - } - - count++; - numFrames = 0; - } - frameCount++; - numFrames++; - } - *startFrame = *endFrame = 0; -} - static inline void md2_printModelInfo (md2_model_t *model) { #if 0 diff --git a/src/m_cheat.c b/src/m_cheat.c index 8cea4c6ae..c8a19666b 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -161,26 +161,6 @@ static UINT8 cht_CheckCheat(cheatseq_t *cht, char key) return rc; } -static inline void cht_GetParam(cheatseq_t *cht, char *buffer) -{ - UINT8 *p; - UINT8 c; - - p = cht->sequence; - while (*(p++) != 1) - ; - - do - { - c = *p; - *(buffer++) = c; - *(p++) = 0; - } while (c && *p != 0xff); - - if (*p == 0xff) - *buffer = 0; -} - boolean cht_Responder(event_t *ev) { UINT8 ret = 0, ch = 0; diff --git a/src/mserv.c b/src/mserv.c index 568474d73..c47d149ee 100644 --- a/src/mserv.c +++ b/src/mserv.c @@ -351,33 +351,6 @@ static INT32 GetServersList(void) } #endif -/** Get the MOTD from the master server. - */ -static inline INT32 GetMSMOTD(void) -{ - msg_t msg; - INT32 count = 0; - - msg.type = GET_MOTD_MSG; - msg.length = 0; - if (MS_Write(&msg) < 0) - return MS_WRITE_ERROR; - - while (MS_Read(&msg) >= 0) - { - if (!msg.length) - { - if (!count) - CONS_Alert(CONS_NOTICE, M_GetText("No servers currently running.\n")); - return MS_NO_ERROR; - } - count++; - CONS_Printf("%s",msg.buffer); - } - - return MS_READ_ERROR; -} - // // MS_Connect() // diff --git a/src/p_maputl.c b/src/p_maputl.c index 48dd54e8d..2aa667811 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -34,21 +34,6 @@ fixed_t P_AproxDistance(fixed_t dx, fixed_t dy) return dx + dy - (dy>>1); } -// -// P_PartialDistance -// Useful only for iterations finding the 'closest point' -// -FUNCMATH static inline fixed_t P_PartialDistance(fixed_t dx, fixed_t dy) -{ - dx >>= FRACBITS; - dy >>= FRACBITS; - - dx *= dx; - dy *= dy; - - return dx + dy; -} - // // P_ClosestPointOnLine // Finds the closest point on a given line to the supplied point diff --git a/src/p_spec.c b/src/p_spec.c index 8228c60b3..a292a8bb0 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -102,7 +102,7 @@ static void Add_Pusher(pushertype_e type, fixed_t x_mag, fixed_t y_mag, mobj_t * static void Add_MasterDisappearer(tic_t appeartime, tic_t disappeartime, tic_t offset, INT32 line, INT32 sourceline); static void P_AddBlockThinker(sector_t *sec, line_t *sourceline); static void P_AddFloatThinker(sector_t *sec, INT32 tag, line_t *sourceline); -static void P_AddBridgeThinker(line_t *sourceline, sector_t *sec); +//static void P_AddBridgeThinker(line_t *sourceline, sector_t *sec); static void P_AddFakeFloorsByLine(size_t line, ffloortype_e ffloorflags, thinkerlist_t *secthinkers); static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec); static void Add_Friction(INT32 friction, INT32 movefactor, INT32 affectee, INT32 referrer); @@ -593,6 +593,7 @@ void P_SetupLevelFlatAnims(void) // UTILITIES // +#if 0 /** Gets a side from a sector line. * * \param currentSector Sector the line is in. @@ -632,6 +633,7 @@ static inline boolean twoSided(INT32 sector, INT32 line) { return (sectors[sector].lines[line])->sidenum[1] != 0xffff; } +#endif /** Finds sector next to current. * @@ -5050,6 +5052,7 @@ static void P_AddFloatThinker(sector_t *sec, INT32 tag, line_t *sourceline) * \sa P_SpawnSpecials, T_BridgeThinker * \author SSNTails */ +/* static inline void P_AddBridgeThinker(line_t *sourceline, sector_t *sec) { levelspecthink_t *bridge; @@ -5072,6 +5075,7 @@ static inline void P_AddBridgeThinker(line_t *sourceline, sector_t *sec) bridge->vars[4] = sourceline->tag; // Start tag bridge->vars[5] = (sides[sourceline->sidenum[0]].textureoffset>>FRACBITS); // End tag } +*/ /** Adds a Mario block thinker, which changes the block's texture between blank * and ? depending on whether it has contents. diff --git a/src/r_things.c b/src/r_things.c index 9a8b1319b..c5f3c5245 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -550,11 +550,6 @@ void R_ClearSprites(void) visspritecount = clippedvissprites = 0; } -static inline void R_ResetVisSpriteChunks(void) -{ - memset(visspritechunks, 0, sizeof(visspritechunks)); -} - // // R_NewVisSprite // diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 963310a26..0f9fa58a8 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -126,8 +126,6 @@ static Uint8 BitsPerPixel = 16; #endif Uint16 realwidth = BASEVIDWIDTH; Uint16 realheight = BASEVIDHEIGHT; -static const Uint32 surfaceFlagsW = 0/*|SDL_RESIZABLE*/; -static const Uint32 surfaceFlagsF = 0; static SDL_bool mousegrabok = SDL_TRUE; #define HalfWarpMouse(x,y) SDL_WarpMouseInWindow(window, (Uint16)(x/2),(Uint16)(y/2)) static SDL_bool videoblitok = SDL_FALSE; @@ -1252,17 +1250,6 @@ static inline boolean I_SkipFrame(void) } } -static inline SDL_bool SDLmatchVideoformat(void) -{ - const SDL_PixelFormat *vidformat = vidSurface->format; - const INT32 vfBPP = vidformat?vidformat->BitsPerPixel:0; - return (((vfBPP == 8 && vid.bpp == 1 && - !vidformat->Rmask && !vidformat->Gmask && !vidformat->Bmask) || - (vfBPP == 15 && vid.bpp == 2 && vidformat->Rmask == 0x7C00 && - vidformat->Gmask == 0x03E0 && vidformat->Bmask == 0x001F )) && - !vidformat->Amask && (vidSurface->flags & SDL_RLEACCEL) == 0); -} - // // I_FinishUpdate // From 75f65c4d44d07e3b7538cafc65141b0e0c7f6016 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Wed, 30 Mar 2016 20:17:09 -0400 Subject: [PATCH 102/562] using abs() on unsigned have no effect --- src/g_game.c | 2 +- src/p_user.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 3b7ef158f..9ea51ebab 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4336,7 +4336,7 @@ void G_GhostTicker(void) { case GHC_SUPER: // Super Sonic (P_DoSuperStuff) g->mo->color = SKINCOLOR_SUPER1; - g->mo->color += abs( ( ( leveltime >> 1 ) % 9) - 4); + g->mo->color += ( ( ( leveltime >> 1 ) % 9) - 4); break; case GHC_INVINCIBLE: // Mario invincibility (P_CheckInvincibilityTimer) g->mo->color = (UINT8)(leveltime % MAXSKINCOLORS); diff --git a/src/p_user.c b/src/p_user.c index 45f860115..72b08db9c 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3449,7 +3449,7 @@ static void P_DoSuperStuff(player_t *player) case 2: /* Knux */ player->mo->color = SKINCOLOR_KSUPER1; break; default: /* everyone */ player->mo->color = SKINCOLOR_SUPER1; break; } - player->mo->color += abs( ( ( leveltime >> 1 ) % 9) - 4); + player->mo->color += ( ( ( leveltime >> 1 ) % 9) - 4); if ((cmd->forwardmove != 0 || cmd->sidemove != 0 || player->pflags & (PF_CARRIED|PF_ROPEHANG|PF_ITEMHANG|PF_MACESPIN)) && !(leveltime % TICRATE) && (player->mo->momx || player->mo->momy)) From de630d0c33ed786fe33a0e3fc5b1492812c02c2e Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Wed, 30 Mar 2016 20:30:24 -0400 Subject: [PATCH 103/562] appveyor: let check warnings as well --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 4edcd7a7f..3ddec6dfb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,6 +11,7 @@ environment: SDL2_MIXER_URL: https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.1-mingw.tar.gz SDL2_MIXER_ARCHIVE: SDL2_mixer-devel-2.0.1-mingw.tar SDL2_MIXER_MOVE: SDL2_mixer-2.0.1\i686-w64-mingw32 + CFLAGS: -Wall -W -Werror cache: - SDL2-devel-2.0.4-mingw.tar.gz From 3812b6bc20c313b6eed1471f837f70485d73a0bd Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 31 Mar 2016 06:48:08 -0700 Subject: [PATCH 104/562] the abs() is necessary; force unsigned shift and signed result --- src/g_game.c | 2 +- src/p_user.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 9ea51ebab..9578cbf8f 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4336,7 +4336,7 @@ void G_GhostTicker(void) { case GHC_SUPER: // Super Sonic (P_DoSuperStuff) g->mo->color = SKINCOLOR_SUPER1; - g->mo->color += ( ( ( leveltime >> 1 ) % 9) - 4); + g->mo->color += abs( ( (signed)( (unsigned)leveltime >> 1 ) % 9) - 4); break; case GHC_INVINCIBLE: // Mario invincibility (P_CheckInvincibilityTimer) g->mo->color = (UINT8)(leveltime % MAXSKINCOLORS); diff --git a/src/p_user.c b/src/p_user.c index 72b08db9c..518321197 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3449,7 +3449,7 @@ static void P_DoSuperStuff(player_t *player) case 2: /* Knux */ player->mo->color = SKINCOLOR_KSUPER1; break; default: /* everyone */ player->mo->color = SKINCOLOR_SUPER1; break; } - player->mo->color += ( ( ( leveltime >> 1 ) % 9) - 4); + player->mo->color += abs( ( (signed)( (unsigned)leveltime >> 1 ) % 9) - 4); if ((cmd->forwardmove != 0 || cmd->sidemove != 0 || player->pflags & (PF_CARRIED|PF_ROPEHANG|PF_ITEMHANG|PF_MACESPIN)) && !(leveltime % TICRATE) && (player->mo->momx || player->mo->momy)) From 690b65b47fe996b2f325eca1846b23b13fcdcad1 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 31 Mar 2016 06:51:04 -0700 Subject: [PATCH 105/562] "Sonic can now become Super Sonic" exists again Fixed an off-by-one array error in the process --- src/y_inter.c | 86 ++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 74 insertions(+), 12 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 104c1004d..32a722612 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -77,10 +77,14 @@ typedef union struct { - char passed1[13]; // KNUCKLES GOT - char passed2[16]; // A CHAOS EMERALD + char passed1[SKINNAMESIZE+1]; // KNUCKLES GOT / CRAWLA HONCHO + char passed2[17]; // A CHAOS EMERALD / GOT THEM ALL! + char passed3[15]; // CAN NOW BECOME + char passed4[SKINNAMESIZE+7]; // SUPER CRAWLA HONCHO INT32 passedx1; INT32 passedx2; + INT32 passedx3; + INT32 passedx4; y_bonus_t bonus; patch_t *bonuspatch; @@ -250,19 +254,62 @@ void Y_IntermissionDrawer(void) } else if (intertype == int_spec) { - // draw the header -/* if (endtic != -1 && ALL7EMERALDS(emeralds) && data.spec.nowsuper != NULL) - V_DrawScaledPatch(48, 32, 0, data.spec.nowsuper); - else - V_DrawScaledPatch(data.spec.headx, 26, 0, data.spec.cemerald); */ + static tic_t animatetic = 0; + INT32 ttheight = 16; + INT32 xoffset1 = 0; // Line 1 x offset + INT32 xoffset2 = 0; // Line 2 x offset + INT32 xoffset3 = 0; // Line 3 x offset + UINT8 drawsection = 0; - if (data.spec.passed1[0] != '\0') + // draw the header + if (intertic <= TICRATE) + animatetic = 0; + else if (!animatetic && data.spec.bonus.points == 0 && data.spec.passed3[0] != '\0') + animatetic = intertic; + + if (animatetic) { - V_DrawLevelTitle(data.spec.passedx1, 24, 0, data.spec.passed1); - V_DrawLevelTitle(data.spec.passedx2, 24+V_LevelNameHeight(data.spec.passed2)+2, 0, data.spec.passed2); + INT32 animatetimer = (intertic - animatetic); + if (animatetimer <= 8) + { + xoffset1 = -(animatetimer * 40); + xoffset2 = -((animatetimer-2) * 40); + if (xoffset2 > 0) xoffset2 = 0; + } + else if (animatetimer <= 19) + { + drawsection = 1; + xoffset1 = (16-animatetimer) * 40; + xoffset2 = (18-animatetimer) * 40; + xoffset3 = (20-animatetimer) * 40; + if (xoffset1 < 0) xoffset1 = 0; + if (xoffset2 < 0) xoffset2 = 0; + } + else + drawsection = 1; + } + + if (drawsection == 1) + { + ttheight = 16; + V_DrawLevelTitle(data.spec.passedx1 + xoffset1, ttheight, 0, data.spec.passed1); + ttheight += V_LevelNameHeight(data.spec.passed3) + 2; + V_DrawLevelTitle(data.spec.passedx3 + xoffset2, ttheight, 0, data.spec.passed3); + ttheight += V_LevelNameHeight(data.spec.passed4) + 2; + V_DrawLevelTitle(data.spec.passedx4 + xoffset3, ttheight, 0, data.spec.passed4); + } + else if (data.spec.passed1[0] != '\0') + { + ttheight = 24; + V_DrawLevelTitle(data.spec.passedx1 + xoffset1, ttheight, 0, data.spec.passed1); + ttheight += V_LevelNameHeight(data.spec.passed2) + 2; + V_DrawLevelTitle(data.spec.passedx2 + xoffset2, ttheight, 0, data.spec.passed2); } else - V_DrawLevelTitle(data.spec.passedx2, 24+(V_LevelNameHeight(data.spec.passed2)/2)+2, 0, data.spec.passed2); + { + ttheight = 24 + (V_LevelNameHeight(data.spec.passed2)/2) + 2; + V_DrawLevelTitle(data.spec.passedx2 + xoffset1, ttheight, 0, data.spec.passed2); + } // draw the emeralds if (intertic & 1) @@ -1098,6 +1145,10 @@ void Y_StartIntermission(void) data.spec.nowsuper = NULL; } */ + // Super form stuff (normally blank) + data.spec.passed3[0] = '\0'; + data.spec.passed4[0] = '\0'; + // set up the "got through act" message according to skin name if (stagefailed) { @@ -1111,10 +1162,19 @@ void Y_StartIntermission(void) skins[players[consoleplayer].skin].realname); data.spec.passed1[sizeof data.spec.passed1 - 1] = '\0'; strcpy(data.spec.passed2, "GOT THEM ALL!"); + + if (skins[players[consoleplayer].skin].flags & SF_SUPER) + { + strcpy(data.spec.passed3, "CAN NOW BECOME"); + snprintf(data.spec.passed4, + sizeof data.spec.passed4, "SUPER %s", + skins[players[consoleplayer].skin].realname); + data.spec.passed4[sizeof data.spec.passed4 - 1] = '\0'; + } } else { - if (strlen(skins[players[consoleplayer].skin].realname) <= 8) + if (strlen(skins[players[consoleplayer].skin].realname) <= SKINNAMESIZE-5) { snprintf(data.spec.passed1, sizeof data.spec.passed1, "%s GOT", @@ -1127,6 +1187,8 @@ void Y_StartIntermission(void) } data.spec.passedx1 = (BASEVIDWIDTH - V_LevelNameWidth(data.spec.passed1))/2; data.spec.passedx2 = (BASEVIDWIDTH - V_LevelNameWidth(data.spec.passed2))/2; + data.spec.passedx3 = (BASEVIDWIDTH - V_LevelNameWidth(data.spec.passed3))/2; + data.spec.passedx4 = (BASEVIDWIDTH - V_LevelNameWidth(data.spec.passed4))/2; break; } From fc8e7728cd79afa6edba40333378ebf3ab90faf5 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 31 Mar 2016 06:57:11 -0700 Subject: [PATCH 106/562] I meant to extend this to 4 seconds but forgot --- src/y_inter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 32a722612..71e72122c 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -755,7 +755,7 @@ void Y_Ticker(void) { if (intertic > tallydonetic) { - endtic = intertic + 4*TICRATE; // 4 second pause after end of tally for sound + endtic = intertic + 4*TICRATE; // 4 second pause after end of tally S_StartSound(NULL, sfx_flgcap); // cha-ching! } return; @@ -775,7 +775,7 @@ void Y_Ticker(void) if (data.spec.continues & 0x80) // don't set endtic yet! tallydonetic = intertic + (3*TICRATE)/2; else // okay we're good. - endtic = intertic + 3*TICRATE; // 3 second pause after end of tally + endtic = intertic + 4*TICRATE; // 4 second pause after end of tally S_StartSound(NULL, sfx_chchng); // cha-ching! From e34da95c4c2bbfa8e706e52fc764859405eb49ad Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 31 Mar 2016 16:32:25 +0100 Subject: [PATCH 107/562] DEVMODE's automap now supports slopes --- src/am_map.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/am_map.c b/src/am_map.c index 97b7c5164..847e517fb 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -15,6 +15,7 @@ #include "am_map.h" #include "g_input.h" #include "p_local.h" +#include "p_slopes.h" #include "v_video.h" #include "i_video.h" #include "r_state.h" @@ -996,6 +997,10 @@ static inline void AM_drawWalls(void) { size_t i; static mline_t l; +#ifdef ESLOPE + fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends + fixed_t backf1, backf2, backc1, backc2; // back floor ceiling ends +#endif for (i = 0; i < numlines; i++) { @@ -1003,6 +1008,22 @@ static inline void AM_drawWalls(void) l.a.y = lines[i].v1->y; l.b.x = lines[i].v2->x; l.b.y = lines[i].v2->y; +#ifdef ESLOPE +#define SLOPEPARAMS(slope, end1, end2, normalheight) \ + if (slope) { \ + end1 = P_GetZAt(slope, l.a.x, l.a.y); \ + end2 = P_GetZAt(slope, l.b.x, l.b.y); \ + } else \ + end1 = end2 = normalheight; + + SLOPEPARAMS(lines[i].frontsector->f_slope, frontf1, frontf2, lines[i].frontsector->floorheight) + SLOPEPARAMS(lines[i].frontsector->c_slope, frontc1, frontc2, lines[i].frontsector->ceilingheight) + if (lines[i].backsector) { + SLOPEPARAMS(lines[i].backsector->f_slope, backf1, backf2, lines[i].backsector->floorheight) + SLOPEPARAMS(lines[i].backsector->c_slope, backc1, backc2, lines[i].backsector->ceilingheight) + } +#undef SLOPEPARAMS +#endif // AM_drawMline(&l, GRAYS + 3); // Old, everything-is-gray automap if (!lines[i].backsector) // 1-sided @@ -1016,11 +1037,19 @@ static inline void AM_drawWalls(void) AM_drawMline(&l, WALLCOLORS+lightlev); } } +#ifdef ESLOPE + else if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier + || (frontf1 == frontc1 && frontf2 == frontc2)) // Front is thok barrier + { + if (backf1 == backc1 && backf2 == backc2 + && frontf1 == frontc1 && frontf2 == frontc2) // BOTH are thok barriers +#else else if (lines[i].backsector->floorheight == lines[i].backsector->ceilingheight // Back is thok barrier || lines[i].frontsector->floorheight == lines[i].frontsector->ceilingheight) // Front is thok barrier { if (lines[i].backsector->floorheight == lines[i].backsector->ceilingheight && lines[i].frontsector->floorheight == lines[i].frontsector->ceilingheight) // BOTH are thok barriers +#endif { if (lines[i].flags & ML_NOCLIMB) { @@ -1046,12 +1075,20 @@ static inline void AM_drawWalls(void) else { if (lines[i].flags & ML_NOCLIMB) { +#ifdef ESLOPE + if (backf1 != frontf1 || backf2 != frontf2) { +#else if (lines[i].backsector->floorheight != lines[i].frontsector->floorheight) { +#endif AM_drawMline(&l, NOCLIMBFDWALLCOLORS + lightlev); // floor level change } +#ifdef ESLOPE + else if (backc1 != frontc1 || backc2 != frontc2) { +#else else if (lines[i].backsector->ceilingheight != lines[i].frontsector->ceilingheight) { +#endif AM_drawMline(&l, NOCLIMBCDWALLCOLORS+lightlev); // ceiling level change } else { @@ -1060,12 +1097,20 @@ static inline void AM_drawWalls(void) } else { +#ifdef ESLOPE + if (backf1 != frontf1 || backf2 != frontf2) { +#else if (lines[i].backsector->floorheight != lines[i].frontsector->floorheight) { +#endif AM_drawMline(&l, FDWALLCOLORS + lightlev); // floor level change } +#ifdef ESLOPE + else if (backc1 != frontc1 || backc2 != frontc2) { +#else else if (lines[i].backsector->ceilingheight != lines[i].frontsector->ceilingheight) { +#endif AM_drawMline(&l, CDWALLCOLORS+lightlev); // ceiling level change } else { From f3f2c5962255b2f731c6acefd1067bb49b03c980 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Thu, 31 Mar 2016 20:42:01 -0500 Subject: [PATCH 108/562] Remove p_fab.c --- src/CMakeLists.txt | 1 - src/Makefile | 1 - src/p_fab.c | 15 --------------- 3 files changed, 17 deletions(-) delete mode 100644 src/p_fab.c diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 13d3312dd..035b46556 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -139,7 +139,6 @@ set(SRB2_CORE_RENDER_SOURCES set(SRB2_CORE_GAME_SOURCES p_ceilng.c p_enemy.c - p_fab.c p_floor.c p_inter.c p_lights.c diff --git a/src/Makefile b/src/Makefile index 449b4065d..0c034143d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -437,7 +437,6 @@ OBJS:=$(i_main_o) \ $(OBJDIR)/info.o \ $(OBJDIR)/p_ceilng.o \ $(OBJDIR)/p_enemy.o \ - $(OBJDIR)/p_fab.o \ $(OBJDIR)/p_floor.o \ $(OBJDIR)/p_inter.o \ $(OBJDIR)/p_lights.o \ diff --git a/src/p_fab.c b/src/p_fab.c deleted file mode 100644 index 7ccb93a94..000000000 --- a/src/p_fab.c +++ /dev/null @@ -1,15 +0,0 @@ -// SONIC ROBO BLAST 2 -//----------------------------------------------------------------------------- -// Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2014 by Sonic Team Junior. -// -// This program is free software distributed under the -// terms of the GNU General Public License, version 2. -// See the 'LICENSE' file for more details. -//----------------------------------------------------------------------------- -/// \file p_fab.c -/// \brief some new action routines, separated from the original doom -/// sources, so that you can include it or remove it easy. - -/// \todo -/// This file is now unused, please remove at some point From 033090b2c883f9f6df1de1555f1e0037ab06bd1f Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Thu, 31 Mar 2016 20:47:57 -0500 Subject: [PATCH 109/562] Remove p_fab.c from Code::Blocks project --- SRB2.cbp | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/SRB2.cbp b/SRB2.cbp index 5a03955b8..43696ee2e 100644 --- a/SRB2.cbp +++ b/SRB2.cbp @@ -3293,23 +3293,6 @@ HW3SOUND for 3D hardware sound support