From 3ed90ca4f29972934c63cb28a696b50f9ed1c72a Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Sun, 12 Jan 2014 14:04:51 +0000 Subject: [PATCH] Block off hacks for the primitive splitscreen CON mod with SPLITSCREEN_MOD_HACKS so they are no longer compiled. These hacks could no longer be allowed to co-opt the fake multiplayer mode, used for local testing and mod development. I have half a mind to remove the hacks outright because they could be likened to drilling bolts directly into your car engine just so you could mount a bowling ball as a hood ornament. However, I don't want to take away the splitscreen hack mod from anyone who uses it, and the work done on these hacks should be useful if proper splitscreen were implemented internally using per-player input and multiple renderer/audio passes. git-svn-id: https://svn.eduke32.com/eduke32@4249 1a8010ca-5511-0410-912e-c29ae57300e0 --- .../eduke32/package/sdk/samples/splitscr.con | 5 +- polymer/eduke32/source/actors.c | 4 ++ polymer/eduke32/source/game.c | 58 +++++++++++++++++-- polymer/eduke32/source/gameexec.c | 2 + polymer/eduke32/source/player.c | 4 ++ polymer/eduke32/source/sounds.c | 4 ++ 6 files changed, 69 insertions(+), 8 deletions(-) diff --git a/polymer/eduke32/package/sdk/samples/splitscr.con b/polymer/eduke32/package/sdk/samples/splitscr.con index e444e101c..f55b5369b 100644 --- a/polymer/eduke32/package/sdk/samples/splitscr.con +++ b/polymer/eduke32/package/sdk/samples/splitscr.con @@ -5,12 +5,11 @@ Beta 1 By Bloodclaw Modified from original for use with EDuke32 SVN. -Usage: eduke32 splitscr.con -q2 +Requires an EDuke32 binary built with SPLITSCREEN_MOD_HACKS preprocessor flag. +Usage: eduke32 -mx splitscr.con -q2 -------------------------------------------------------------------------------- */ -include GAME.CON - // Key name definitions definegamefuncname 11 P2_Move_Forward definegamefuncname 12 P2_Move_Backward diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 785a98738..4f6259c5e 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -1356,12 +1356,14 @@ ACTOR_STATIC void G_MoveFX(void) { int32_t x = ldist(&sprite[peekps->i],s); +#ifdef SPLITSCREEN_MOD_HACKS if (g_fakeMultiMode==2) { // HACK for splitscreen mod int32_t otherdist = ldist(&sprite[g_player[1].ps->i],s); x = min(x, otherdist); } +#endif if (x < ht && T1 == 0) { @@ -1382,12 +1384,14 @@ ACTOR_STATIC void G_MoveFX(void) { int32_t x = dist(&sprite[peekps->i],s); +#ifdef SPLITSCREEN_MOD_HACKS if (g_fakeMultiMode==2) { // HACK for splitscreen mod int32_t otherdist = dist(&sprite[g_player[1].ps->i],s); x = min(x, otherdist); } +#endif if (x < ht && T1 == 0 && FX_VoiceAvailable(g_sounds[s->lotag].pr-1)) { diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 9d362a000..12b520175 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -1954,8 +1954,13 @@ static void G_DrawStatusBar(int32_t snum) int32_t i, j, o, u; int32_t permbit = 0; +#ifdef SPLITSCREEN_MOD_HACKS const int32_t ss = g_fakeMultiMode ? 4 : ud.screen_size; const int32_t althud = g_fakeMultiMode ? 0 : ud.althud; +#else + const int32_t ss = ud.screen_size; + const int32_t althud = ud.althud; +#endif const int32_t SBY = (200-tilesizy[BOTTOMSTATUSBAR]); @@ -2116,7 +2121,10 @@ static void G_DrawStatusBar(int32_t snum) else { // ORIGINAL MINI STATUS BAR - int32_t orient = 2+8+16+256, yofs=0, yofssh=0; + int32_t orient = 2+8+16+256, yofssh=0; + +#ifdef SPLITSCREEN_MOD_HACKS + int32_t yofs=0; if (g_fakeMultiMode) { @@ -2132,6 +2140,7 @@ static void G_DrawStatusBar(int32_t snum) yofssh = yofs<<16; } } +#endif rotatesprite_fs(sbarx(5), yofssh+sbary(200-28), sb16, 0, HEALTHBOX, 0, 21, orient); if (p->inven_icon) @@ -2550,7 +2559,10 @@ static int32_t calc_ybase(int32_t begy) { int32_t k = begy; - if (GTFLAGS(GAMETYPE_FRAGBAR) && (ud.screen_size > 0 && !g_fakeMultiMode) + if (GTFLAGS(GAMETYPE_FRAGBAR) && ud.screen_size > 0 +#ifdef SPLITSCREEN_MOD_HACKS + && !g_fakeMultiMode +#endif && (g_netServer || ud.multimode > 1)) { int32_t i, j = 0; @@ -2629,10 +2641,14 @@ void G_PrintGameQuotes(int32_t snum) { if (reserved_quote) { +#ifdef SPLITSCREEN_MOD_HACKS if (!g_fakeMultiMode) +#endif k = 140;//quotebot-8-4; +#ifdef SPLITSCREEN_MOD_HACKS else k = 50; +#endif } else { @@ -2647,6 +2663,7 @@ void G_PrintGameQuotes(int32_t snum) { int32_t pal = 0; +#ifdef SPLITSCREEN_MOD_HACKS if (g_fakeMultiMode) { pal = g_player[snum].pcolor; @@ -2663,6 +2680,7 @@ void G_PrintGameQuotes(int32_t snum) k += 101; } } +#endif gametextpalbits(160, k, ScriptQuotes[ps->ftq], hud_glowingquotes ? quotepulseshade : 0, @@ -3419,7 +3437,9 @@ void G_DisplayRest(int32_t smoothratio) palaccum_t tint = PALACCUM_INITIALIZER; DukePlayer_t *const pp = g_player[screenpeek].ps; +#ifdef SPLITSCREEN_MOD_HACKS DukePlayer_t *const pp2 = g_fakeMultiMode==2 ? g_player[1].ps : NULL; +#endif int32_t cposx, cposy, cang; #ifdef USE_OPENGL @@ -3446,14 +3466,18 @@ void G_DisplayRest(int32_t smoothratio) #endif // USE_OPENGL palaccum_add(&tint, &pp->pals, pp->pals.f); +#ifdef SPLITSCREEN_MOD_HACKS if (pp2) palaccum_add(&tint, &pp2->pals, pp2->pals.f); +#endif { static const palette_t loogiepal = { 0, 63, 0, 0 }; palaccum_add(&tint, &loogiepal, pp->loogcnt>>1); +#ifdef SPLITSCREEN_MOD_HACKS if (pp2) palaccum_add(&tint, &loogiepal, pp2->loogcnt>>1); +#endif } if (g_restorePalette) @@ -3464,16 +3488,20 @@ void G_DisplayRest(int32_t smoothratio) if (g_restorePalette < 2 || omovethingscnt+1 == g_moveThingsCount) { int32_t pal = pp->palette; +#ifdef SPLITSCREEN_MOD_HACKS const int32_t opal = pal; if (pp2) // splitscreen HACK: BASEPAL trumps all, then it's arbitrary. pal = min(pal, pp2->palette); +#endif // g_restorePalette < 0: reset tinting, too (e.g. when loading new game) P_SetGamePalette(pp, pal, 2 + (g_restorePalette>0)*16); +#ifdef SPLITSCREEN_MOD_HACKS if (pp2) // keep first player's pal as its member! pp->palette = opal; +#endif g_restorePalette = 0; } @@ -3538,13 +3566,17 @@ void G_DisplayRest(int32_t smoothratio) else { P_DisplayWeapon(screenpeek); +#ifdef SPLITSCREEN_MOD_HACKS if (pp2) // HACK P_DisplayWeapon(1); +#endif if (pp->over_shoulder_on == 0) P_DisplayScuba(screenpeek); +#ifdef SPLITSCREEN_MOD_HACKS if (pp2 && pp2->over_shoulder_on == 0) // HACK P_DisplayScuba(1); +#endif } G_MoveClouds(); } @@ -3606,12 +3638,14 @@ void G_DisplayRest(int32_t smoothratio) if (VM_OnEvent(EVENT_DISPLAYSBAR, g_player[screenpeek].ps->i, screenpeek, -1, 0) == 0) G_DrawStatusBar(screenpeek); +#ifdef SPLITSCREEN_MOD_HACKS // HACK if (g_fakeMultiMode==2) { G_DrawStatusBar(1); G_PrintGameQuotes(1); } +#endif G_PrintGameQuotes(screenpeek); @@ -4257,7 +4291,9 @@ void G_HandleMirror(int32_t x, int32_t y, int32_t z, int32_t a, int32_t horiz, i g_visibility = j; } +#ifdef SPLITSCREEN_MOD_HACKS if (!g_fakeMultiMode) +#endif { // HACK for splitscreen mod: this is so that mirrors will be drawn // from showview commands. Ugly, because we'll attempt do draw mirrors @@ -4377,7 +4413,11 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio) const int32_t vr = divscale22(1,sprite[p->i].yrepeat+28); const int32_t software_screen_tilting = - (getrendermode() == REND_CLASSIC && ((ud.screen_tilting && p->rotscrnang && !g_fakeMultiMode))); + (getrendermode() == REND_CLASSIC && ((ud.screen_tilting && p->rotscrnang +#ifdef SPLITSCREEN_MOD_HACKS + && !g_fakeMultiMode +#endif + ))); int32_t pixelDoubling = 0; if (!r_usenewaspect) @@ -4462,7 +4502,11 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio) tmpvr = i>>1; tmpyx = (65536*ydim*8)/(xdim*5); } - else if (getrendermode() >= REND_POLYMOST && (ud.screen_tilting && !g_fakeMultiMode)) + else if (getrendermode() >= REND_POLYMOST && (ud.screen_tilting +#ifdef SPLITSCREEN_MOD_HACKS + && !g_fakeMultiMode +#endif + )) { #ifdef USE_OPENGL setrollangle(p->orotscrnang + mulscale16(((p->rotscrnang - p->orotscrnang + 1024)&2047)-1024, smoothratio)); @@ -11992,7 +12036,11 @@ int32_t G_DoMoveThings(void) } // Name display when aiming at opponents - if (ud.idplayers && (g_netServer || ud.multimode > 1) && !g_fakeMultiMode) + if (ud.idplayers && (g_netServer || ud.multimode > 1) +#ifdef SPLITSCREEN_MOD_HACKS + && !g_fakeMultiMode +#endif + ) { hitdata_t hit; DukePlayer_t *const p = g_player[screenpeek].ps; diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 1c2a1d779..a7fbdf4cd 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -1590,7 +1590,9 @@ skip_check: continue; } if (vm.g_p == screenpeek || (GametypeFlags[ud.coop]&GAMETYPE_COOPSOUND) +#ifdef SPLITSCREEN_MOD_HACKS || (g_fakeMultiMode==2) +#endif ) A_PlaySound(*insptr,g_player[screenpeek].ps->i); insptr++; diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index e26aafc32..fe467d4b7 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -1712,9 +1712,11 @@ static int32_t P_DisplayFist(int32_t gs,int32_t snum) fistpal = P_GetHudPal(ps); +#ifdef SPLITSCREEN_MOD_HACKS // XXX: this is outdated, doesn't handle above/below split. if (g_fakeMultiMode==2) wx[(g_snum==0)] = (wx[0]+wx[1])/2+1; +#endif rotatesprite( (-fisti+222+(g_player[snum].sync->avel>>4))<<16, @@ -1758,6 +1760,7 @@ static void G_DrawTileScaled(int32_t x, int32_t y, int32_t tilenum, int32_t shad if (orientation&4) ang = 1024; +#ifdef SPLITSCREEN_MOD_HACKS if (g_fakeMultiMode==2) { const int32_t sidebyside = (ud.screen_size!=0); @@ -1777,6 +1780,7 @@ static void G_DrawTileScaled(int32_t x, int32_t y, int32_t tilenum, int32_t shad wy[(g_snum==0)] = (wy[0]+wy[1])/2 + 2; } } +#endif #ifdef USE_OPENGL if (getrendermode() >= REND_POLYMOST && usemodels && md_tilehasmodel(tilenum,p) >= 0) diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index a0ada60db..90ce1482d 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -484,6 +484,7 @@ static int32_t S_CalcDistAndAng(int32_t i, int32_t num, int32_t camsect, int32_t sndist = FindDistance3D(cam->x-pos->x, cam->y-pos->y, (cam->z-pos->z)>>4); +#ifdef SPLITSCREEN_MOD_HACKS if (g_fakeMultiMode==2) { // HACK for splitscreen mod: take the min of sound distances @@ -510,6 +511,7 @@ static int32_t S_CalcDistAndAng(int32_t i, int32_t num, int32_t camsect, int32_t } } } +#endif if ((g_sounds[num].m & SF_GLOBAL) == 0 && S_IsAmbientSFX(i) && (sector[SECT].lotag&0xff) < 9) // ST_9_SLIDING_ST_DOOR sndist = divscale14(sndist, SHT+1); @@ -607,12 +609,14 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos) pitch = S_GetPitch(num); peekps = g_player[screenpeek].ps; +#ifdef SPLITSCREEN_MOD_HACKS if (g_fakeMultiMode==2) { // splitscreen HACK if (g_player[1].ps->i == i) peekps = g_player[1].ps; } +#endif if (peekps->sound_pitch) pitch += peekps->sound_pitch;