From e0bd85935a39b01adf0372f4a7c9ec0c6f20d83c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 30 Jun 2020 20:59:24 +0200 Subject: [PATCH] - replaced user quotes with GZDoom's notification display entirely. --- source/games/duke/src/gameloop.cpp | 265 ++++++++++++++++++++++++++++ source/games/duke/src/zz_cheats.cpp | 6 - source/games/duke/src/zz_game.cpp | 3 +- source/games/duke/src/zz_text.cpp | 35 ---- source/games/duke/src/zz_text.h | 3 - 5 files changed, 266 insertions(+), 46 deletions(-) create mode 100644 source/games/duke/src/gameloop.cpp diff --git a/source/games/duke/src/gameloop.cpp b/source/games/duke/src/gameloop.cpp new file mode 100644 index 000000000..ffcbafa7b --- /dev/null +++ b/source/games/duke/src/gameloop.cpp @@ -0,0 +1,265 @@ +//------------------------------------------------------------------------- +/* +Copyright (C) 1996, 2003 - 3D Realms Entertainment +Copyright (C) 2020 - Christoph Oelckers + +This file is part of Duke Nukem 3D version 1.5 - Atomic Edition + +Duke Nukem 3D is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +aint with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +Original Source: 1996 - Todd Replogle +Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms +Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au) +*/ +//------------------------------------------------------------------------- + +#include "ns.h" // Must come before everything else! + +#include "duke3d.h" +#include "demo.h" +#include "screens.h" +#include "baselayer.h" +#include "m_argv.h" +#include "mapinfo.h" +#include "texturemanager.h" + +BEGIN_DUKE_NS + +static inline int movefifoend(int myconnectindex) +{ +#if 1 + return g_player[myconnectindex].movefifoend; +#else + return movefifoend[myconnectindex]; +#endif +} + +static void fakedomovethings() +{ + // prediction +} + +static void fakedomovethingscorrect() +{ + // unprediction +} + +/* +void mploadsave() +{ + for(int i=connecthead;i>=0;i=connectpoint2[i]) + if( sync[i].bits&(1<<17) ) + { + multiflag = 2; + multiwhat = (sync[i].bits>>18)&1; + multipos = (unsigned) (sync[i].bits>>19)&15; + multiwho = i; + + if( multiwhat ) + { + saveplayer( multipos ); + multiflag = 0; + + if(multiwho != myconnectindex) + { + strcpy(&fta_quotes[122],&ud.user_name[multiwho][0]); + strcat(&fta_quotes[122]," SAVED A MULTIPLAYER GAME"); + FTA(122,&ps[myconnectindex]); + } + else + { + strcpy(&fta_quotes[122],"MULTIPLAYER GAME SAVED"); + FTA(122,&ps[myconnectindex]); + } + break; + } + else + { +// waitforeverybody(); + + j = loadplayer( multipos ); + + multiflag = 0; + + if(j == 0 && !RR) + { + if(multiwho != myconnectindex) + { + strcpy(&fta_quotes[122],&ud.user_name[multiwho][0]); + strcat(&fta_quotes[122]," LOADED A MULTIPLAYER GAME"); + FTA(122,&ps[myconnectindex]); + } + else + { + strcpy(&fta_quotes[122],"MULTIPLAYER GAME LOADED"); + FTA(122,&ps[myconnectindex]); + } + return 1; + } + } + } +} +*/ + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- +int domovethings(); + +char moveloop() +{ + int i; + + if (numplayers > 1) + while (fakemovefifoplc < movefifoend[myconnectindex]) fakedomovethings(); + + getpackets(); + + if (numplayers < 2) bufferjitter = 0; + while (movefifoend(myconnectindex)-movefifoplc > bufferjitter) + { + for(i=connecthead;i>=0;i=connectpoint2[i]) + if (movefifoplc == movefifoend(i)) break; + if (i >= 0) break; + if( domovethings() ) return 1; + } + return 0; +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +int domovethings() +{ + int i, j; + int ch; + + // mplpadsave(); + + ud.camerasprite = -1; + lockclock += TICSPERFRAME; + + if(earthquaketime > 0) earthquaketime--; + if(rtsplaying > 0) rtsplaying--; + + if( show_shareware > 0 ) + { + show_shareware--; + if(show_shareware == 0) + { + pus = NUMPAGES; + pub = NUMPAGES; + } + } + + everyothertime++; + + for(i=connecthead;i>=0;i=connectpoint2[i]) + copybufbyte(&inputfifo[movefifoplc&(MOVEFIFOSIZ-1)][i],&sync[i],sizeof(input)); + movefifoplc++; + + updateinterpolations(); + + j = -1; + for(i=connecthead;i>=0;i=connectpoint2[i]) + { + if ((sync[i].bits&(1<<26)) == 0) { j = i; continue; } + + if (i == myconnectindex) gameexit(" "); + if (screenpeek == i) + { + screenpeek = connectpoint2[i]; + if (screenpeek < 0) screenpeek = connecthead; + } + + if (i == connecthead) connecthead = connectpoint2[connecthead]; + else connectpoint2[j] = connectpoint2[i]; + + numplayers--; + ud.multimode--; + + closedemowrite(); + + if (numplayers < 2 && !RR) + sound(GENERIC_AMBIENCE17); + + pub = NUMPAGES; + pus = NUMPAGES; + vscrn(); + + Printf(PRINT_NOTIFY, "%s is history!",ud.user_name[i]); + + quickkill(&ps[i]); + deletesprite(ps[i].i); + + if(j < 0 && networkmode == 0 ) + gameexit( " \nThe 'MASTER/First player' just quit the game. All\nplayers are returned from the game. This only happens in 5-8\nplayer mode as a different network scheme is used."); + } + + if ((numplayers >= 2) && ((movefifoplc&7) == 7)) + { + ch = (char)(randomseed&255); + for(i=connecthead;i>=0;i=connectpoint2[i]) + ch += ((ps[i].posx+ps[i].posy+ps[i].posz+ps[i].ang+ps[i].horiz)&255); + syncval[myconnectindex][syncvalhead[myconnectindex]&(MOVEFIFOSIZ-1)] = ch; + syncvalhead[myconnectindex]++; + } + + if(ud.recstat == 1) record(); + + if( ud.pause_on == 0 ) + { + global_random = TRAND; + movedummyplayers();//ST 13 + } + + for(i=connecthead;i>=0;i=connectpoint2[i]) + { + cheatkeys(i); + + if( ud.pause_on == 0 ) + { + processinput(i); + checksectors(i); + } + } + + if( ud.pause_on == 0 ) + { + fi.think(); + } + + fakedomovethingscorrect(); + + if( (everyothertime&1) == 0) + { + animatewalls(); + movecyclers(); + pan3dsound(); + } + + + return 0; +} + + +END_DUKE_NS + diff --git a/source/games/duke/src/zz_cheats.cpp b/source/games/duke/src/zz_cheats.cpp index 282130920..533642a74 100644 --- a/source/games/duke/src/zz_cheats.cpp +++ b/source/games/duke/src/zz_cheats.cpp @@ -459,12 +459,6 @@ void G_DoCheats(void) case CHEAT_DEBUG: g_Debug = 1-g_Debug; - - G_DumpDebugInfo(); - Bsprintf(tempbuf, "Gamevars dumped to log"); - G_AddUserQuote(tempbuf); - Bsprintf(tempbuf, "Map dumped to debug.map"); - G_AddUserQuote(tempbuf); end_cheat(pPlayer); break; diff --git a/source/games/duke/src/zz_game.cpp b/source/games/duke/src/zz_game.cpp index 021a0309e..795253736 100644 --- a/source/games/duke/src/zz_game.cpp +++ b/source/games/duke/src/zz_game.cpp @@ -1243,7 +1243,6 @@ void G_HandleLocalKeys(void) { if (inputState.UnboundKeyPressed(sc_F1) || inputState.UnboundKeyPressed(sc_F2) || cl_autovote) { - G_AddUserQuote(GStrings("VoteCast")); Net_SendMapVote(inputState.UnboundKeyPressed(sc_F1) || cl_autovote ? cl_autovote-1 : 0); inputState.ClearKeyStatus(sc_F1); inputState.ClearKeyStatus(sc_F2); @@ -1347,7 +1346,7 @@ void G_HandleLocalKeys(void) { if (SHIFTS_IS_PRESSED) { - G_AddUserQuote(*CombatMacros[ridiculeNum-1]); + Printf(PRINT_NOTIFY, *CombatMacros[ridiculeNum-1]); Net_SendTaunt(ridiculeNum); pus = NUMPAGES; pub = NUMPAGES; diff --git a/source/games/duke/src/zz_text.cpp b/source/games/duke/src/zz_text.cpp index aac345c34..48ae4fbf6 100644 --- a/source/games/duke/src/zz_text.cpp +++ b/source/games/duke/src/zz_text.cpp @@ -188,29 +188,6 @@ void captionmenutext(int32_t x, int32_t y, char const *t) } -int32_t user_quote_time[MAXUSERQUOTES]; -static char user_quote[MAXUSERQUOTES][178]; - -void G_AddUserQuote(const char* daquote) -{ - int32_t i; - - if (hud_messages == 0) return; - Printf(PRINT_MEDIUM | PRINT_NOTIFY, "%s\n", daquote); - if (hud_messages == 1) - { - for (i = MAXUSERQUOTES - 1; i > 0; i--) - { - Bstrcpy(user_quote[i], user_quote[i - 1]); - user_quote_time[i] = user_quote_time[i - 1]; - } - Bstrcpy(user_quote[0], daquote); - - user_quote_time[0] = hud_messagetime; - pub = NUMPAGES; - } -} - int32_t textsc(int32_t sc) { return scale(sc, hud_textscale, 400); @@ -321,18 +298,6 @@ void G_PrintGameQuotes(int32_t snum) if (k > 1 && !reserved_quote) y += k <= 8 ? (height * (k-1))>>3 : height; - for (size_t i = MAXUSERQUOTES-1; i < MAXUSERQUOTES; --i) - { - k = user_quote_time[i]; - - if (k <= 0) - continue; - - // int32_t const sh = hud_glowingquotes ? sintable[((totalclock+(i<<2))<<5)&2047]>>11 : 0; - - height = mpgametext(mpgametext_x, y, user_quote[i], textsh(k), texto(k), texta(k), TEXT_LINEWRAP).y + textsc(1<<16); - y += k <= 4 ? (height * (k-1))>>2 : height; - } } void P_DoQuote(int32_t q, DukePlayer_t *p) diff --git a/source/games/duke/src/zz_text.h b/source/games/duke/src/zz_text.h index e35400421..cf9d0e7f6 100644 --- a/source/games/duke/src/zz_text.h +++ b/source/games/duke/src/zz_text.h @@ -27,9 +27,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_DUKE_NS -#define MAXUSERQUOTES 6 - -extern int32_t user_quote_time[MAXUSERQUOTES]; extern int32_t minitext_lowercase; extern int32_t minitext_yofs;