diff --git a/src/Makefile b/src/Makefile index 17f38d01..85ecb49a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -66,6 +66,7 @@ # Compile without 3D sound support, add 'NOHS=1' # Compile with GDBstubs, add 'RDB=1' # Compile without PNG, add 'NOPNG=1' +# Compile without zlib, add 'NOZLIB=1' # # Addon for SDL: # To Cross-Compile, add 'SDL_CONFIG=/usr/*/bin/sdl-config' @@ -119,6 +120,7 @@ include Makefile.cfg ifdef DUMMY NOPNG=1 +NOZLIB=1 NONET=1 NOHW=1 NOHS=1 @@ -199,6 +201,7 @@ endif ifdef NDS NOPNG=1 +NOZLIB=1 NONET=1 #NOHW=1 NOHS=1 @@ -325,13 +328,6 @@ LIBS+=$(PNG_LDFLAGS) CFLAGS+=$(PNG_CFLAGS) endif -ZLIB_PKGCONFIG?=zlib -ZLIB_CFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --cflags) -ZLIB_LDFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --libs) - -LIBS+=$(ZLIB_LDFLAGS) -CFLAGS+=$(ZLIB_CFLAGS) - ifdef HAVE_LIBGME OPTS+=-DHAVE_LIBGME @@ -343,6 +339,18 @@ LIBS+=$(LIBGME_LDFLAGS) CFLAGS+=$(LIBGME_CFLAGS) endif +ifndef NOZLIB +OPTS+=-DHAVE_ZLIB +ZLIB_PKGCONFIG?=zlib +ZLIB_CFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --cflags) +ZLIB_LDFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --libs) + +LIBS+=$(ZLIB_LDFLAGS) +CFLAGS+=$(ZLIB_CFLAGS) +else +NOPNG=1 +endif + ifdef STATIC LIBS:=-static $(LIBS) endif diff --git a/src/android/i_sound.c b/src/android/i_sound.c index ecf96f2f..77f8e6a5 100644 --- a/src/android/i_sound.c +++ b/src/android/i_sound.c @@ -21,13 +21,14 @@ void I_ShutdownSound(void){} // SFX I/O // -INT32 I_StartSound(sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, INT32 priority) +INT32 I_StartSound(sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, INT32 priority, INT32 channel) { (void)id; (void)vol; (void)sep; (void)pitch; (void)priority; + (void)channel; return -1; } diff --git a/src/android/i_video.c b/src/android/i_video.c index 2d0151f5..8b4bee31 100644 --- a/src/android/i_video.c +++ b/src/android/i_video.c @@ -16,7 +16,7 @@ boolean allow_fullscreen = false; -consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_vidwait = {"vid_wait", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; void I_StartupGraphics(void){} diff --git a/src/console.c b/src/console.c index ab8635b6..f79a6faf 100644 --- a/src/console.c +++ b/src/console.c @@ -154,9 +154,9 @@ static CV_PossibleValue_t menuhighlight_cons_t[] = {V_GOLDMAP, "Always gold"}, {V_LAVENDERMAP, "Always lavender"}, {V_TEAMAP, "Always tea-green"}, - {V_STEELMAP, "Always steel"}, + {V_STEELMAP, "Always steel-blue"}, {V_PINKMAP, "Always pink"}, - {V_TEALMAP, "Always teal"}, + {V_BROWNMAP, "Always brown"}, {V_PEACHMAP, "Always peach"}, {0, NULL} }; @@ -291,7 +291,7 @@ static void CONS_backcolor_Change(void) // TODO: This could probably be improved somehow... // These colormaps are 99% identical, with just a few changed bytes UINT8 *yellowmap, *purplemap, *greenmap, *bluemap, *graymap, *redmap, *orangemap,\ - *skymap, *goldmap, *lavendermap, *teamap, *steelmap, *pinkmap, *tealmap, *peachmap; + *skymap, *goldmap, *lavendermap, *teamap, *steelmap, *pinkmap, *brownmap, *peachmap; static void CON_SetupColormaps(void) { @@ -311,8 +311,8 @@ static void CON_SetupColormaps(void) teamap = (goldmap+256); steelmap = (teamap+256); pinkmap = (steelmap+256); - tealmap = (pinkmap+256); - peachmap = (tealmap+256); + brownmap = (pinkmap+256); + peachmap = (brownmap+256); // setup the other colormaps, for console text @@ -335,8 +335,8 @@ static void CON_SetupColormaps(void) goldmap[120] = (UINT8)114; teamap[120] = (UINT8)177; steelmap[120] = (UINT8)201; - pinkmap[120] = (UINT8)124; - tealmap[120] = (UINT8)220; + pinkmap[120] = (UINT8)145; + brownmap[120] = (UINT8)48; peachmap[120] = (UINT8)69; // nice // Init back colormap diff --git a/src/console.h b/src/console.h index b15ccb6f..e4f01c8e 100644 --- a/src/console.h +++ b/src/console.h @@ -39,7 +39,7 @@ extern UINT32 con_scalefactor; // console text scale factor extern consvar_t cons_backcolor, cons_menuhighlight; extern UINT8 *yellowmap, *purplemap, *greenmap, *bluemap, *graymap, *redmap, *orangemap,\ - *skymap, *goldmap, *lavendermap, *teamap, *steelmap, *pinkmap, *tealmap, *peachmap; + *skymap, *goldmap, *lavendermap, *teamap, *steelmap, *pinkmap, *brownmap, *peachmap; // Console bg color (auto updated to match) extern UINT8 *consolebgmap; diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 63393690..0f0d5972 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1631,8 +1631,6 @@ static void CL_LoadReceivedSavegame(void) automapactive = false; // load a base level - playerdeadview = false; - if (P_LoadNetGame()) { CONS_Printf(M_GetText("Map is now \"%s"), G_BuildMapName(gamemap)); @@ -2491,9 +2489,9 @@ static void CL_RemovePlayer(INT32 playernum) LUA_InvalidatePlayer(&players[playernum]); #endif - if (G_TagGametype()) //Check if you still have a game. Location flexible. =P + /*if (G_TagGametype()) //Check if you still have a game. Location flexible. =P P_CheckSurvivors(); - else if (G_BattleGametype()) // SRB2Kart + else*/ if (G_BattleGametype()) // SRB2Kart K_CheckBumpers(); else if (G_RaceGametype()) P_CheckRacers(); @@ -2920,7 +2918,9 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) } consvar_t cv_allownewplayer = {"allowjoin", "On", CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL }; +#ifdef VANILLAJOINNEXTROUND consvar_t cv_joinnextround = {"joinnextround", "Off", CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; /// \todo not done +#endif static CV_PossibleValue_t maxplayers_cons_t[] = {{2, "MIN"}, {MAXPLAYERS, "MAX"}, {0, NULL}}; consvar_t cv_maxplayers = {"maxplayers", "8", CV_SAVE, maxplayers_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t resynchattempts_cons_t[] = {{0, "MIN"}, {20, "MAX"}, {0, NULL}}; @@ -2966,7 +2966,9 @@ void D_ClientServerInit(void) RegisterNetXCmd(XD_ADDPLAYER, Got_AddPlayer); #ifndef NONET CV_RegisterVar(&cv_allownewplayer); +#ifdef VANILLAJOINNEXTROUND CV_RegisterVar(&cv_joinnextround); +#endif CV_RegisterVar(&cv_showjoinaddress); CV_RegisterVar(&cv_resynchattempts); CV_RegisterVar(&cv_blamecfail); @@ -3519,8 +3521,10 @@ static void HandleConnect(SINT8 node) // you get a free second before desynch checks. use it wisely. SV_InitResynchVars(node); +#ifdef VANILLAJOINNEXTROUND if (cv_joinnextround.value && gameaction == ga_nothing) G_SetGamestate(GS_WAITINGPLAYERS); +#endif if (!SV_SendServerConfig(node)) { G_SetGamestate(backupstate); diff --git a/src/d_clisrv.h b/src/d_clisrv.h index c8e8b008..e2a6ed7c 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -497,7 +497,11 @@ extern UINT32 realpingtable[MAXPLAYERS]; extern UINT32 playerpingtable[MAXPLAYERS]; #endif -extern consvar_t cv_joinnextround, cv_allownewplayer, cv_maxplayers, cv_resynchattempts, cv_blamecfail, cv_maxsend, cv_noticedownload, cv_downloadspeed; +extern consvar_t +#ifdef VANILLAJOINNEXTROUND + cv_joinnextround, +#endif + cv_allownewplayer, cv_maxplayers, cv_resynchattempts, cv_blamecfail, cv_maxsend, cv_noticedownload, cv_downloadspeed; // Used in d_net, the only dependence tic_t ExpandTics(INT32 low); diff --git a/src/d_main.c b/src/d_main.c index e5fe67f1..024b1dfd 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -723,20 +723,6 @@ void D_SRB2Loop(void) } else if (rendertimeout < entertic) // in case the server hang or netsplit { - // Lagless camera! Yay! - /* Not yay, it ruins Kart's drift :y - if (gamestate == GS_LEVEL && netgame) - { - if (camera.chase) - P_MoveChaseCamera(&players[displayplayer], &camera, false); - if (splitscreen && camera2.chase) - P_MoveChaseCamera(&players[secondarydisplayplayer], &camera2, false); - if (splitscreen > 1 && camera3.chase) - P_MoveChaseCamera(&players[thirddisplayplayer], &camera3, false); - if (splitscreen > 2 && camera4.chase) - P_MoveChaseCamera(&players[fourthdisplayplayer], &camera4, false); - } - */ D_Display(); if (moviemode) @@ -824,7 +810,6 @@ void D_StartTitle(void) maptol = 0; gameaction = ga_nothing; - playerdeadview = false; displayplayer = consoleplayer = 0; //demosequence = -1; gametype = GT_RACE; // SRB2kart @@ -1484,6 +1469,29 @@ void D_SRB2Main(void) } } + if (M_CheckParm("-skill") && M_IsNextParm()) + { + INT32 j; + INT16 newskill = -1; + const char *sskill = M_GetNextParm(); + + for (j = 0; kartspeed_cons_t[j].strvalue; j++) + if (!strcasecmp(kartspeed_cons_t[j].strvalue, sskill)) + { + newskill = (INT16)kartspeed_cons_t[j].value; + break; + } + if (!kartspeed_cons_t[j].strvalue) // reached end of the list with no match + { + j = atoi(sskill); // assume they gave us a skill number, which is okay too + if (j >= 0 && j <= 2) + newskill = (INT16)j; + } + + if (newskill != -1) + CV_SetValue(&cv_kartspeed, newskill); + } + if (server && !M_CheckParm("+map")) { // Prevent warping to nonexistent levels diff --git a/src/d_main.h b/src/d_main.h index 88387a57..209fa355 100644 --- a/src/d_main.h +++ b/src/d_main.h @@ -34,7 +34,7 @@ void D_SRB2Loop(void) FUNCNORETURN; // D_SRB2Main() // Not a globally visible function, just included for source reference, // calls all startup code, parses command line options. -// If not overrided by user input, calls N_AdvanceDemo. +// If not overrided by user input, calls D_AdvanceDemo. // void D_SRB2Main(void); @@ -51,9 +51,6 @@ const char *D_Home(void); // // BASE LEVEL // -void D_PageTicker(void); -// pagename is lumpname of a 320x200 patch to fill the screen -void D_PageDrawer(const char *pagename); void D_AdvanceDemo(void); void D_StartTitle(void); diff --git a/src/d_net.c b/src/d_net.c index 5437af56..eca301f0 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -49,7 +49,9 @@ doomcom_t *doomcom = NULL; /// \brief network packet data, points inside doomcom doomdata_t *netbuffer = NULL; +#ifdef DEBUGFILE FILE *debugfile = NULL; // put some net info in a file during the game +#endif #define MAXREBOUND 8 static doomdata_t reboundstore[MAXREBOUND]; diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 144e4bf9..17ae1242 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -796,10 +796,10 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_consolechat); CV_RegisterVar(&cv_chatnotifications); CV_RegisterVar(&cv_chatbacktint); - CV_RegisterVar(&cv_crosshair); - CV_RegisterVar(&cv_crosshair2); - CV_RegisterVar(&cv_crosshair3); - CV_RegisterVar(&cv_crosshair4); + //CV_RegisterVar(&cv_crosshair); + //CV_RegisterVar(&cv_crosshair2); + //CV_RegisterVar(&cv_crosshair3); + //CV_RegisterVar(&cv_crosshair4); //CV_RegisterVar(&cv_alwaysfreelook); //CV_RegisterVar(&cv_alwaysfreelook2); @@ -915,19 +915,19 @@ void D_RegisterClientCommands(void) COM_AddCommand("noclip", Command_CheatNoClip_f); COM_AddCommand("god", Command_CheatGod_f); COM_AddCommand("notarget", Command_CheatNoTarget_f); - COM_AddCommand("getallemeralds", Command_Getallemeralds_f); + /*COM_AddCommand("getallemeralds", Command_Getallemeralds_f); COM_AddCommand("resetemeralds", Command_Resetemeralds_f); COM_AddCommand("setrings", Command_Setrings_f); COM_AddCommand("setlives", Command_Setlives_f); - COM_AddCommand("setcontinues", Command_Setcontinues_f); + COM_AddCommand("setcontinues", Command_Setcontinues_f);*/ COM_AddCommand("devmode", Command_Devmode_f); COM_AddCommand("savecheckpoint", Command_Savecheckpoint_f); COM_AddCommand("scale", Command_Scale_f); COM_AddCommand("gravflip", Command_Gravflip_f); COM_AddCommand("hurtme", Command_Hurtme_f); - COM_AddCommand("jumptoaxis", Command_JumpToAxis_f); + /*COM_AddCommand("jumptoaxis", Command_JumpToAxis_f); COM_AddCommand("charability", Command_Charability_f); - COM_AddCommand("charspeed", Command_Charspeed_f); + COM_AddCommand("charspeed", Command_Charspeed_f);*/ COM_AddCommand("teleport", Command_Teleport_f); COM_AddCommand("rteleport", Command_RTeleport_f); COM_AddCommand("skynum", Command_Skynum_f); @@ -3260,9 +3260,9 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) } // In tag, check to see if you still have a game. - if (G_TagGametype()) + /*if (G_TagGametype()) P_CheckSurvivors(); - else if (G_BattleGametype()) + else*/ if (G_BattleGametype()) K_CheckBumpers(); // SRB2Kart else if (G_RaceGametype()) P_CheckRacers(); // also SRB2Kart @@ -3341,6 +3341,12 @@ static void Command_Login_f(void) XBOXSTATIC UINT8 finalmd5[16]; const char *pw; + if (!netgame) + { + CONS_Printf(M_GetText("This only works in a netgame.\n")); + return; + } + // If the server uses login, it will effectively just remove admin privileges // from whoever has them. This is good. if (COM_Argc() != 2) @@ -3455,6 +3461,12 @@ static void Command_Verify_f(void) return; } + if (!netgame) + { + CONS_Printf(M_GetText("This only works in a netgame.\n")); + return; + } + if (COM_Argc() != 2) { CONS_Printf(M_GetText("giveadmin : give admin privileges to a node\n")); @@ -3809,7 +3821,7 @@ static void Command_Addfile(void) WRITEMEM(buf_p, md5sum, 16); } - if (IsPlayerAdmin(consoleplayer)) // Request to add file + if (IsPlayerAdmin(consoleplayer) && (!server)) // Request to add file SendNetXCmd(XD_REQADDFILE, buf, buf_p - buf); else SendNetXCmd(XD_ADDFILE, buf, buf_p - buf); diff --git a/src/d_player.h b/src/d_player.h index 373110dd..02f7f45e 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -284,6 +284,7 @@ typedef enum k_voices, // Used to stop the player saying more voices than it should k_tauntvoices, // Used to specifically stop taunt voice spam k_instashield, // Instashield no-damage animation timer + k_enginesnd, // Engine sound number you're on. k_floorboost, // Prevents Sneaker sounds for a breif duration when triggered by a floor panel k_spinouttype, // Determines whether to thrust forward or not while spinning out; 0 = move forwards, 1 = stay still diff --git a/src/dehacked.c b/src/dehacked.c index 8b60ab61..4a7599b9 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1308,6 +1308,13 @@ static void readlevelheader(MYFILE *f, INT32 num) else mapheaderinfo[num-1]->levelflags &= ~LF_NOZONE; } + else if (fastcmp(word, "SECTIONRACE")) + { + if (i || word2[0] == 'T' || word2[0] == 'Y') + mapheaderinfo[num-1]->levelflags |= LF_SECTIONRACE; + else + mapheaderinfo[num-1]->levelflags &= ~LF_SECTIONRACE; + } // Individual triggers for menu flags else if (fastcmp(word, "HIDDEN")) @@ -2421,6 +2428,8 @@ static void readunlockable(MYFILE *f, INT32 num) unlockables[num].type = SECRET_SOUNDTEST; else if (fastcmp(word2, "ENCORE")) unlockables[num].type = SECRET_ENCORE; + else if (fastcmp(word2, "HELLATTACK")) + unlockables[num].type = SECRET_HELLATTACK; else unlockables[num].type = (INT16)i; } @@ -6701,9 +6710,58 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_PLAYERBOMB", // Player bomb overlay "S_PLAYERITEM", // Player item overlay + "S_PLAYERFAKE", // Player fake overlay "S_KARMAWHEEL", // Karma player wheels + // Thunder shield use stuff; + "S_KSPARK1", // Sparkling Radius + "S_KSPARK2", + "S_KSPARK3", + "S_KSPARK4", + "S_KSPARK5", + "S_KSPARK6", + "S_KSPARK7", + "S_KSPARK8", + "S_KSPARK9", + "S_KSPARK10", + "S_KSPARK11", + "S_KSPARK12", + "S_KSPARK13", // ... that's an awful lot. + + "S_LZIO11", // Straight lightning bolt + "S_LZIO12", + "S_LZIO13", + "S_LZIO14", + "S_LZIO15", + "S_LZIO16", + "S_LZIO17", + "S_LZIO18", + "S_LZIO19", + + "S_LZIO21", // Straight lightning bolt (flipped) + "S_LZIO22", + "S_LZIO23", + "S_LZIO24", + "S_LZIO25", + "S_LZIO26", + "S_LZIO27", + "S_LZIO28", + "S_LZIO29", + + "S_KLIT1", // Diagonal lightning. No, it not being straight doesn't make it gay. + "S_KLIT2", + "S_KLIT3", + "S_KLIT4", + "S_KLIT5", + "S_KLIT6", + "S_KLIT7", + "S_KLIT8", + "S_KLIT9", + "S_KLIT10", + "S_KLIT11", + "S_KLIT12", + #ifdef SEENAMES "S_NAMECHECK", #endif @@ -7565,9 +7623,9 @@ static const char *COLOR_ENUMS[] = { // Rejigged for Kart. "SALMON", // 10 // SKINCOLOR_SALMON "PINK", // 11 // SKINCOLOR_PINK "ROSE", // 12 // SKINCOLOR_ROSE - "RASPBERRY", // 13 // SKINCOLOR_RASPBERRY - "RED", // 14 // SKINCOLOR_RED - "RUBY", // 15 // SKINCOLOR_RUBY + "RUBY", // 13 // SKINCOLOR_RUBY + "RASPBERRY", // 14 // SKINCOLOR_RASPBERRY + "RED", // 15 // SKINCOLOR_RED "CRIMSON", // 16 // SKINCOLOR_CRIMSON "KETCHUP", // 17 // SKINCOLOR_KETCHUP "DAWN", // 18 // SKINCOLOR_DAWN @@ -7587,16 +7645,16 @@ static const char *COLOR_ENUMS[] = { // Rejigged for Kart. "VOMIT", // 32 // SKINCOLOR_VOMIT "GARDEN", // 33 // SKINCOLOR_GARDEN "LIME", // 34 // SKINCOLOR_LIME - "DREAM", // 35 // SKINCOLOR_DREAM - "TEA", // 36 // SKINCOLOR_TEA - "PISTACHIO", // 37 // SKINCOLOR_PISTACHIO - "ROBOHOOD", // 38 // SKINCOLOR_ROBOHOOD - "MOSS", // 39 // SKINCOLOR_MOSS - "MINT", // 40 // SKINCOLOR_MINT - "GREEN", // 41 // SKINCOLOR_GREEN - "PINETREE", // 42 // SKINCOLOR_PINETREE - "EMERALD", // 43 // SKINCOLOR_EMERALD - "SWAMP", // 44 // SKINCOLOR_SWAMP + "TEA", // 35 // SKINCOLOR_TEA + "PISTACHIO", // 36 // SKINCOLOR_PISTACHIO + "ROBOHOOD", // 37 // SKINCOLOR_ROBOHOOD + "MOSS", // 38 // SKINCOLOR_MOSS + "MINT", // 39 // SKINCOLOR_MINT + "GREEN", // 40 // SKINCOLOR_GREEN + "PINETREE", // 41 // SKINCOLOR_PINETREE + "EMERALD", // 42 // SKINCOLOR_EMERALD + "SWAMP", // 43 // SKINCOLOR_SWAMP + "DREAM", // 44 // SKINCOLOR_DREAM "AQUA", // 45 // SKINCOLOR_AQUA "TEAL", // 46 // SKINCOLOR_TEAL "CYAN", // 47 // SKINCOLOR_CYAN @@ -7606,9 +7664,9 @@ static const char *COLOR_ENUMS[] = { // Rejigged for Kart. "SLATE", // 51 // SKINCOLOR_SLATE "STEEL", // 52 // SKINCOLOR_STEEL "JET", // 53 // SKINCOLOR_JET - "PERIWINKLE", // 54 // SKINCOLOR_PERIWINKLE - "BLUE", // 55 // SKINCOLOR_BLUE - "SAPPHIRE", // 56 // SKINCOLOR_SAPPHIRE + "SAPPHIRE", // 54 // SKINCOLOR_SAPPHIRE + "PERIWINKLE", // 55 // SKINCOLOR_PERIWINKLE + "BLUE", // 56 // SKINCOLOR_BLUE "BLUEBERRY", // 57 // SKINCOLOR_BLUEBERRY "DUSK", // 58 // SKINCOLOR_DUSK "PURPLE", // 59 // SKINCOLOR_PURPLE @@ -7689,6 +7747,7 @@ static const char *const KARTSTUFF_LIST[] = { "VOICES", "TAUNTVOICES", "INSTASHIELD", + "ENGINESND", "FLOORBOOST", "SPINOUTTYPE", @@ -7895,6 +7954,7 @@ struct { {"LF_NOSSMUSIC",LF_NOSSMUSIC}, {"LF_NORELOAD",LF_NORELOAD}, {"LF_NOZONE",LF_NOZONE}, + {"LF_SECTIONRACE",LF_SECTIONRACE}, // And map flags {"LF2_HIDEINMENU",LF2_HIDEINMENU}, {"LF2_HIDEINSTATS",LF2_HIDEINSTATS}, @@ -8216,7 +8276,7 @@ struct { {"V_TEAMAP",V_TEAMAP}, {"V_STEELMAP",V_STEELMAP}, {"V_PINKMAP",V_PINKMAP}, - {"V_TEALMAP",V_TEALMAP}, + {"V_BROWNMAP",V_BROWNMAP}, {"V_PEACHMAP",V_PEACHMAP}, {"V_TRANSLUCENT",V_TRANSLUCENT}, {"V_10TRANS",V_10TRANS}, diff --git a/src/djgppdos/i_sound.c b/src/djgppdos/i_sound.c index 88fc807f..ec6f4412 100644 --- a/src/djgppdos/i_sound.c +++ b/src/djgppdos/i_sound.c @@ -165,9 +165,11 @@ INT32 I_StartSound ( sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, - INT32 priority ) + INT32 priority, + INT32 channel) { int voice; + (void)channel; if (nosound) return 0; diff --git a/src/djgppdos/vid_vesa.c b/src/djgppdos/vid_vesa.c index ec7b8b88..01a27dce 100644 --- a/src/djgppdos/vid_vesa.c +++ b/src/djgppdos/vid_vesa.c @@ -46,7 +46,7 @@ static void VID_Command_ModeInfo_f (void); static void VID_Command_ModeList_f (void); static void VID_Command_Mode_f (void); -consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_vidwait = {"vid_wait", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; static consvar_t cv_stretch = {"stretch", "On", CV_SAVE|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; #define VBEVERSION 2 // we need vesa2 or higher @@ -92,8 +92,8 @@ static vmode_t *pcurrentmode; // the current active videomode. // table des modes videos. -// seul le mode 320x200x256c standard VGA est support‚ sans le VESA. -// ce mode est le mode num‚ro 0 dans la liste. +// seul le mode 320x200x256c standard VGA est support� sans le VESA. +// ce mode est le mode num�ro 0 dans la liste. typedef struct { int modenum; // vesa vbe2.0 modenum diff --git a/src/doomdef.h b/src/doomdef.h index 31a32a6c..89cab4e5 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -245,9 +245,9 @@ typedef enum SKINCOLOR_SALMON, SKINCOLOR_PINK, SKINCOLOR_ROSE, + SKINCOLOR_RUBY, SKINCOLOR_RASPBERRY, SKINCOLOR_RED, - SKINCOLOR_RUBY, SKINCOLOR_CRIMSON, SKINCOLOR_KETCHUP, SKINCOLOR_DAWN, @@ -267,7 +267,6 @@ typedef enum SKINCOLOR_VOMIT, SKINCOLOR_GARDEN, SKINCOLOR_LIME, - SKINCOLOR_DREAM, SKINCOLOR_TEA, SKINCOLOR_PISTACHIO, SKINCOLOR_ROBOHOOD, @@ -277,6 +276,7 @@ typedef enum SKINCOLOR_PINETREE, SKINCOLOR_EMERALD, SKINCOLOR_SWAMP, + SKINCOLOR_DREAM, SKINCOLOR_AQUA, SKINCOLOR_TEAL, SKINCOLOR_CYAN, @@ -286,9 +286,9 @@ typedef enum SKINCOLOR_SLATE, SKINCOLOR_STEEL, SKINCOLOR_JET, + SKINCOLOR_SAPPHIRE, // sweet mother, i cannot weave – slender aphrodite has overcome me with longing for a girl SKINCOLOR_PERIWINKLE, SKINCOLOR_BLUE, - SKINCOLOR_SAPPHIRE, // sweet mother, i cannot weave – slender aphrodite has overcome me with longing for a girl SKINCOLOR_BLUEBERRY, SKINCOLOR_DUSK, SKINCOLOR_PURPLE, @@ -547,6 +547,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; /// SRB2Kart: Camera always has noclip. /// \note Kind of problematic. If we decide to keep this on, we'll need serious map changes. -//#define NOCLIPCAM +#define NOCLIPCAM #endif // __DOOMDEF__ diff --git a/src/doomstat.h b/src/doomstat.h index fc13b0e8..8e26d100 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -272,6 +272,7 @@ typedef struct #define LF_NOSSMUSIC 4 ///< Disable Super Sonic music #define LF_NORELOAD 8 ///< Don't reload level on death #define LF_NOZONE 16 ///< Don't include "ZONE" on level title +#define LF_SECTIONRACE 32 ///< Section race level #define LF2_HIDEINMENU 1 ///< Hide in the multiplayer menu #define LF2_HIDEINSTATS 2 ///< Hide in the statistics screen @@ -496,19 +497,17 @@ extern mapthing_t *redctfstarts[MAXPLAYERS]; // CTF #if defined (macintosh) #define DEBFILE(msg) I_OutputMsg(msg) -extern FILE *debugfile; #else #define DEBUGFILE #ifdef DEBUGFILE #define DEBFILE(msg) { if (debugfile) { fputs(msg, debugfile); fflush(debugfile); } } -extern FILE *debugfile; #else #define DEBFILE(msg) {} -extern FILE *debugfile; #endif #endif #ifdef DEBUGFILE +extern FILE *debugfile; extern INT32 debugload; #endif diff --git a/src/dummy/i_sound.c b/src/dummy/i_sound.c index 51dbb610..143da186 100644 --- a/src/dummy/i_sound.c +++ b/src/dummy/i_sound.c @@ -23,13 +23,14 @@ void I_UpdateSound(void){}; // SFX I/O // -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel) { (void)id; (void)vol; (void)sep; (void)pitch; (void)priority; + (void)channel; return -1; } diff --git a/src/dummy/i_video.c b/src/dummy/i_video.c index e167e833..93ba6b75 100644 --- a/src/dummy/i_video.c +++ b/src/dummy/i_video.c @@ -8,7 +8,7 @@ boolean highcolor = false; boolean allow_fullscreen = false; -consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_vidwait = {"vid_wait", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; void I_StartupGraphics(void){} diff --git a/src/f_finale.c b/src/f_finale.c index 6fabcd96..a6689d34 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -276,7 +276,6 @@ void F_StartIntro(void) G_SetGamestate(GS_INTRO); gameaction = ga_nothing; - playerdeadview = false; paused = false; CON_ToggleOff(); CON_ClearHUD(); @@ -523,12 +522,15 @@ static const char *credits[] = { "\"VirtAnderson\"", "", "\1Special Thanks", - "Sonic Team Jr. & SRB2", + "Sonic Team Jr. & SRB2 (www.srb2.org)", "Bandit \"Bobby\" Cochenour", // i <3 my dog + "Bear", // i <3 MY dog too + "\"Chrispy\"", + "\"DirkTheHusky\"", + "\"fickle\"", // and my sharki "\"Nev3r\"", "\"Ritz\"", "\"Spherallic\"", - "\"DirkTheHusky\"", "", "\1Produced By", "Kart Krew", @@ -554,7 +556,7 @@ static struct { {112, 80+200* 7, "CREDIT10"}, {240, 80+200* 8, "CREDIT05"}, {120, 80+200* 9, "CREDIT06"},*/ - {112, 80+200*10, "TYLER52"}, + {112, 80+100+200*10, "TYLER52"}, {0, 0, NULL} }; @@ -576,7 +578,6 @@ void F_StartCredits(void) } gameaction = ga_nothing; - playerdeadview = false; paused = false; CON_ToggleOff(); CON_ClearHUD(); @@ -738,7 +739,6 @@ void F_StartGameEvaluation(void) G_SaveGame((UINT32)cursaveslot); gameaction = ga_nothing; - playerdeadview = false; paused = false; CON_ToggleOff(); CON_ClearHUD(); @@ -849,7 +849,6 @@ void F_StartGameEnd(void) G_SetGamestate(GS_GAMEEND); gameaction = ga_nothing; - playerdeadview = false; paused = false; CON_ToggleOff(); CON_ClearHUD(); @@ -1106,7 +1105,6 @@ void F_StartContinue(void) gameaction = ga_nothing; keypressed = false; - playerdeadview = false; paused = false; CON_ToggleOff(); CON_ClearHUD(); @@ -1275,7 +1273,6 @@ void F_StartCustomCutscene(INT32 cutscenenum, boolean precutscene, boolean reset G_SetGamestate(GS_CUTSCENE); gameaction = ga_nothing; - playerdeadview = false; paused = false; CON_ToggleOff(); diff --git a/src/g_game.c b/src/g_game.c index e501fa56..ee1ee053 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -340,7 +340,7 @@ void SendWeaponPref2(void); void SendWeaponPref3(void); void SendWeaponPref4(void); -static CV_PossibleValue_t crosshair_cons_t[] = {{0, "Off"}, {1, "Cross"}, {2, "Angle"}, {3, "Point"}, {0, NULL}}; +//static CV_PossibleValue_t crosshair_cons_t[] = {{0, "Off"}, {1, "Cross"}, {2, "Angle"}, {3, "Point"}, {0, NULL}}; static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"}, #ifdef _WII {1, "LStick.X"}, {2, "LStick.Y"}, {-1, "LStick.X-"}, {-2, "LStick.Y-"}, @@ -428,10 +428,10 @@ consvar_t cv_chatbacktint = {"chatbacktint", "Off", CV_SAVE, CV_OnOff, NULL, 0, static CV_PossibleValue_t consolechat_cons_t[] = {{0, "Window"}, {1, "Console"}, {0, NULL}}; consvar_t cv_consolechat = {"chatmode", "Window", CV_SAVE, consolechat_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_crosshair = {"crosshair", "Cross", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_crosshair2 = {"crosshair2", "Cross", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_crosshair3 = {"crosshair3", "Cross", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_crosshair4 = {"crosshair4", "Cross", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +/*consvar_t cv_crosshair = {"crosshair", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_crosshair2 = {"crosshair2", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_crosshair3 = {"crosshair3", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_crosshair4 = {"crosshair4", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};*/ consvar_t cv_invertmouse = {"invertmouse", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_alwaysfreelook = {"alwaysmlook", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_invertmouse2 = {"invertmouse2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -1812,25 +1812,41 @@ static INT32 spectatedelay, spectatedelay2, spectatedelay3, spectatedelay4 = 0; boolean G_Responder(event_t *ev) { // allow spy mode changes even during the demo - if (gamestate == GS_LEVEL && ev->type == ev_keydown && ev->data1 == KEY_F12) + if (gamestate == GS_LEVEL && ev->type == ev_keydown + && (ev->data1 == gamecontrol[gc_viewpoint][0] || ev->data1 == gamecontrol[gc_viewpoint][1])) { if (splitscreen || !netgame) displayplayer = consoleplayer; else { - // spy mode - do + UINT8 i = 0; // spy mode + for (i = 0; i < MAXPLAYERS; i++) { displayplayer++; if (displayplayer == MAXPLAYERS) displayplayer = 0; + if (displayplayer == consoleplayer) + break; // End loop + if (!playeringame[displayplayer]) continue; if (players[displayplayer].spectator) continue; + // SRB2Kart: Only go through players who are actually playing + if (players[displayplayer].exiting) + continue; + + // I don't know if we want this actually, but I'll humor the suggestion anyway + if (G_BattleGametype()) + { + if (players[displayplayer].kartstuff[k_bumper] <= 0) + continue; + } + + // SRB2Kart: we have no team-based modes, YET... /*if (G_GametypeHasTeams()) { if (players[consoleplayer].ctfteam @@ -1855,24 +1871,13 @@ boolean G_Responder(event_t *ev) continue; }*/ - // SRB2Kart: Ehhh, who cares, Mario Kart's designed around screen-cheating anyway - /*if (gametype != GT_RACE) - { - if (players[consoleplayer].kartstuff[k_bumper] > 0) - continue; - }*/ - break; - } while (displayplayer != consoleplayer); + } // change statusbar also if playing back demo if (singledemo) ST_changeDemoView(); - // tell who's the view - CONS_Printf(M_GetText("Viewpoint: %s\n"), player_names[displayplayer]); - P_ResetCamera(&players[displayplayer], &camera); - return true; } } @@ -2280,28 +2285,11 @@ static inline void G_PlayerFinishLevel(INT32 player) { if (legitimateexit && !demoplayback && !mapreset) // (yes you're allowed to unlock stuff this way when the game is modified) { - UINT8 i = 0; - - if (netgame) + matchesplayed++; + if (M_UpdateUnlockablesAndExtraEmblems(true)) { - // check to see if there's anyone else at all - for (; i < MAXPLAYERS; i++) - { - if (i == consoleplayer) - continue; - if (playeringame[i] && !stplyr->spectator) - break; - } - } - - if (i != MAXPLAYERS) // Not FREE PLAY - { - matchesplayed++; - if (M_UpdateUnlockablesAndExtraEmblems(true)) - { - S_StartSound(NULL, sfx_ncitem); - G_SaveGameData(true); // only save if unlocked something - } + S_StartSound(NULL, sfx_ncitem); + G_SaveGameData(true); // only save if unlocked something } } @@ -2519,6 +2507,7 @@ void G_PlayerReborn(INT32 player) p->kartstuff[k_comebackpoints] = comebackpoints; p->kartstuff[k_comebacktimer] = comebacktime; p->kartstuff[k_wanted] = wanted; + p->kartstuff[k_eggmanblame] = -1; // Don't do anything immediately p->pflags |= PF_USEDOWN; @@ -2554,15 +2543,15 @@ void G_PlayerReborn(INT32 player) p->maxlink = 0; // If NiGHTS, find lowest mare to start with. - p->mare = P_FindLowestMare(); + p->mare = 0; /*P_FindLowestMare(); CONS_Debug(DBG_NIGHTS, M_GetText("Current mare is %d\n"), p->mare); if (p->mare == 255) - p->mare = 0; + p->mare = 0;*/ // Check to make sure their color didn't change somehow... - if (G_GametypeHasTeams()) + /*if (G_GametypeHasTeams()) { if (p->ctfteam == 1 && p->skincolor != skincolor_redteam) { @@ -2586,7 +2575,7 @@ void G_PlayerReborn(INT32 player) else if (p == &players[fourthdisplayplayer]) CV_SetValue(&cv_playercolor4, skincolor_blueteam); } - } + }*/ } // @@ -2967,8 +2956,6 @@ void G_DoReborn(INT32 playernum) P_LoadThingsOnly(); - P_ClearStarPost(player->starpostnum); - // Do a wipe wipegamestate = -1; @@ -3426,6 +3413,8 @@ static void G_DoCompleted(void) // nextmap is 0-based, unlike gamemap if (nextmapoverride != 0) nextmap = (INT16)(nextmapoverride-1); + else if (mapheaderinfo[gamemap-1]->nextlevel == 1101) // SRB2Kart: !!! WHENEVER WE GET GRAND PRIX, GO TO AWARDS MAP INSTEAD !!! + nextmap = (INT16)(mapheaderinfo[gamemap] ? gamemap : (spstage_start-1)); // (gamemap-1)+1 == gamemap :V else nextmap = (INT16)(mapheaderinfo[gamemap-1]->nextlevel-1); @@ -3454,9 +3443,6 @@ static void G_DoCompleted(void) else cm = (INT16)(mapheaderinfo[cm]->nextlevel-1); - if (cm == 1100-1) // !!! WHENEVER WE GET GRAND PRIX, GO TO AWARDS MAP INSTEAD !!! - cm = cm+1; - if (cm >= NUMMAPS || cm < 0) // out of range (either 1100-1102 or error) { cm = nextmap; //Start the loop again so that the error checking below is executed. @@ -4341,7 +4327,6 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool // Don't carry over custom music change to another map. mapmusflags |= MUSIC_RELOADRESET; - playerdeadview = false; automapactive = false; imcontinuing = false; diff --git a/src/g_game.h b/src/g_game.h index 10eb4c68..e34a6986 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -55,7 +55,7 @@ extern INT16 rw_maximums[NUM_WEAPONS]; // used in game menu extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime, cv_consolechat, cv_chatspamprotection, cv_chatbacktint; -extern consvar_t cv_crosshair, cv_crosshair2, cv_crosshair3, cv_crosshair4; +//extern consvar_t cv_crosshair, cv_crosshair2, cv_crosshair3, cv_crosshair4; extern consvar_t cv_invertmouse, cv_alwaysfreelook, cv_mousemove; extern consvar_t cv_turnaxis,cv_moveaxis,cv_brakeaxis,cv_aimaxis,cv_lookaxis,cv_fireaxis,cv_driftaxis; extern consvar_t cv_turnaxis2,cv_moveaxis2,cv_brakeaxis2,cv_aimaxis2,cv_lookaxis2,cv_fireaxis2,cv_driftaxis2; diff --git a/src/g_input.c b/src/g_input.c index 279ee56b..101fa8e4 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -1209,6 +1209,9 @@ static const char *gamecontrolname[num_gamecontrols] = "console", "pause", "systemmenu", + "screenshot", + "recordgif", + "viewpoint", "custom1", "custom2", "custom3", @@ -1293,6 +1296,9 @@ void G_Controldefault(void) // Extra controls gamecontrol[gc_pause ][0] = KEY_PAUSE; gamecontrol[gc_console ][0] = KEY_CONSOLE; + gamecontrol[gc_screenshot ][0] = KEY_F8; + gamecontrol[gc_recordgif ][0] = KEY_F9; + gamecontrol[gc_viewpoint ][0] = KEY_F12; gamecontrol[gc_talkkey ][0] = 't'; //gamecontrol[gc_teamkey ][0] = 'y'; gamecontrol[gc_scores ][0] = KEY_TAB; @@ -1303,11 +1309,11 @@ void G_Controldefault(void) gamecontrol[gc_camreset ][0] = KEY_HOME; gamecontrol[gc_camtoggle ][0] = KEY_BACKSPACE; - //gamecontrol[gc_viewpoint ][1] = KEY_JOY1+3; // Y + gamecontrol[gc_viewpoint ][1] = KEY_JOY1+3; // Y gamecontrol[gc_pause ][1] = KEY_JOY1+6; // Back gamecontrol[gc_systemmenu ][0] = KEY_JOY1+7; // Start gamecontrol[gc_camtoggle ][1] = KEY_HAT1+0; // D-Pad Up - //gamecontrol[gc_screenshot ][1] = KEY_HAT1+1; // D-Pad Down + gamecontrol[gc_screenshot ][1] = KEY_HAT1+1; // D-Pad Down gamecontrol[gc_talkkey ][1] = KEY_HAT1+2; // D-Pad Left gamecontrol[gc_scores ][1] = KEY_HAT1+3; // D-Pad Right diff --git a/src/g_input.h b/src/g_input.h index 6bbadf3e..3bdd9799 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -115,6 +115,9 @@ typedef enum gc_console, gc_pause, gc_systemmenu, + gc_screenshot, + gc_recordgif, + gc_viewpoint, gc_custom1, // Lua scriptable gc_custom2, // Lua scriptable gc_custom3, // Lua scriptable diff --git a/src/hardware/hw_bsp.c b/src/hardware/hw_bsp.c index e0e4abb4..d8866c9b 100644 --- a/src/hardware/hw_bsp.c +++ b/src/hardware/hw_bsp.c @@ -565,8 +565,6 @@ static inline void HWR_SubsecPoly(INT32 num, poly_t *poly) subsector_t *sub; seg_t *lseg; - sscount++; - sub = &subsectors[num]; count = sub->numlines; lseg = &segs[sub->firstline]; diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index f1949325..98bb434a 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -857,6 +857,10 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color) else if (!(color & V_SNAPTOTOP)) fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) / 2; } + if (color & V_SPLITSCREEN) + fy += ((float)BASEVIDHEIGHT * dupy)/2; + if (color & V_HORZSCREEN) + fx += ((float)BASEVIDWIDTH * dupx)/2; } if (fx >= vid.width || fy >= vid.height) @@ -963,6 +967,10 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32 else if (!(options & V_SNAPTOTOP)) fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) / 2; } + if (options & V_SPLITSCREEN) + fy += ((float)BASEVIDHEIGHT * dupy)/2; + if (options & V_HORZSCREEN) + fx += ((float)BASEVIDWIDTH * dupx)/2; } if (fx >= vid.width || fy >= vid.height) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 6a664d39..c0a3514e 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -643,13 +643,13 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, boolean is { scrollx = FIXED_TO_FLOAT(FOFsector->floor_xoffs)/fflatsize; scrolly = FIXED_TO_FLOAT(FOFsector->floor_yoffs)/fflatsize; - angle = FOFsector->floorpic_angle>>ANGLETOFINESHIFT; + angle = FOFsector->floorpic_angle; } else // it's a ceiling { scrollx = FIXED_TO_FLOAT(FOFsector->ceiling_xoffs)/fflatsize; scrolly = FIXED_TO_FLOAT(FOFsector->ceiling_yoffs)/fflatsize; - angle = FOFsector->ceilingpic_angle>>ANGLETOFINESHIFT; + angle = FOFsector->ceilingpic_angle; } } else if (gr_frontsector) @@ -658,24 +658,26 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, boolean is { scrollx = FIXED_TO_FLOAT(gr_frontsector->floor_xoffs)/fflatsize; scrolly = FIXED_TO_FLOAT(gr_frontsector->floor_yoffs)/fflatsize; - angle = gr_frontsector->floorpic_angle>>ANGLETOFINESHIFT; + angle = gr_frontsector->floorpic_angle; } else // it's a ceiling { scrollx = FIXED_TO_FLOAT(gr_frontsector->ceiling_xoffs)/fflatsize; scrolly = FIXED_TO_FLOAT(gr_frontsector->ceiling_yoffs)/fflatsize; - angle = gr_frontsector->ceilingpic_angle>>ANGLETOFINESHIFT; + angle = gr_frontsector->ceilingpic_angle; } } if (angle) // Only needs to be done if there's an altered angle { + angle = InvAngle(angle)>>ANGLETOFINESHIFT; + // This needs to be done so that it scrolls in a different direction after rotation like software - tempxsow = FLOAT_TO_FIXED(scrollx); + /*tempxsow = FLOAT_TO_FIXED(scrollx); tempytow = FLOAT_TO_FIXED(scrolly); scrollx = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle)))); - scrolly = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle)))); + scrolly = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));*/ // This needs to be done so everything aligns after rotation // It would be done so that rotation is done, THEN the translation, but I couldn't get it to rotate AND scroll like software does @@ -689,7 +691,7 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, boolean is { // Hurdler: add scrolling texture on floor/ceiling v3d->sow = (float)((pv->x / fflatsize) - flatxref + scrollx); - v3d->tow = (float)(flatyref - (pv->y / fflatsize) + scrolly); + v3d->tow = (float)(-(pv->y / fflatsize) + flatyref + scrolly); //v3d->sow = (float)(pv->x / fflatsize); //v3d->tow = (float)(pv->y / fflatsize); @@ -700,7 +702,7 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, boolean is tempxsow = FLOAT_TO_FIXED(v3d->sow); tempytow = FLOAT_TO_FIXED(v3d->tow); v3d->sow = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle)))); - v3d->tow = (FIXED_TO_FLOAT(-FixedMul(tempxsow, FINESINE(angle)) - FixedMul(tempytow, FINECOSINE(angle)))); + v3d->tow = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle)))); } //v3d->sow = (float)(v3d->sow - flatxref + scrollx); @@ -2811,11 +2813,14 @@ static void HWR_AddLine(seg_t * line) SLOPEPARAMS( gr_backsector->c_slope, backc1, backc2, gr_backsector->ceilingheight) #undef SLOPEPARAMS - // Closed door. - if ((backc1 <= frontf1 && backc2 <= frontf2) - || (backf1 >= frontc1 && backf2 >= frontc2)) + if (viewsector != gr_backsector && viewsector != gr_frontsector) { - goto clipsolid; + // Closed door. + if ((backc1 <= frontf1 && backc2 <= frontf2) + || (backf1 >= frontc1 && backf2 >= frontc2)) + { + goto clipsolid; + } } // Window. @@ -2828,10 +2833,13 @@ static void HWR_AddLine(seg_t * line) else #endif { - // Closed door. - if (gr_backsector->ceilingheight <= gr_frontsector->floorheight || - gr_backsector->floorheight >= gr_frontsector->ceilingheight) - goto clipsolid; + if (viewsector != gr_backsector && viewsector != gr_frontsector) + { + // Closed door. + if (gr_backsector->ceilingheight <= gr_frontsector->floorheight || + gr_backsector->floorheight >= gr_frontsector->ceilingheight) + goto clipsolid; + } // Window. if (gr_backsector->ceilingheight != gr_frontsector->ceilingheight || @@ -3268,7 +3276,6 @@ static void HWR_Subsector(size_t num, UINT8 ssplayer) if (num < numsubsectors) { - sscount++; // subsector sub = &subsectors[num]; // sector @@ -5140,7 +5147,7 @@ static void HWR_AddSprites(sector_t *sec, UINT8 ssplayer) // Handle all things in sector. // If a limit exists, handle things a tiny bit different. - if ((limit_dist = (fixed_t)((maptol & TOL_NIGHTS) ? cv_drawdist_nights.value : cv_drawdist.value) << FRACBITS)) + if ((limit_dist = (fixed_t)(/*(maptol & TOL_NIGHTS) ? cv_drawdist_nights.value : */cv_drawdist.value) << FRACBITS)) { for (thing = sec->thinglist; thing; thing = thing->snext) { @@ -5168,8 +5175,10 @@ static void HWR_AddSprites(sector_t *sec, UINT8 ssplayer) approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y); - if (approx_dist <= limit_dist) - HWR_ProjectSprite(thing); + if (approx_dist > limit_dist) + continue; + + HWR_ProjectSprite(thing); } } else @@ -5214,8 +5223,10 @@ static void HWR_AddSprites(sector_t *sec, UINT8 ssplayer) approx_dist = P_AproxDistance(viewx-precipthing->x, viewy-precipthing->y); - if (approx_dist <= limit_dist) - HWR_ProjectPrecipitationSprite(precipthing); + if (approx_dist > limit_dist) + continue; + + HWR_ProjectPrecipitationSprite(precipthing); } } else @@ -5546,6 +5557,16 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) x1 = tr_x + x1 * rightcos; x2 = tr_x - x2 * rightcos; + // okay, we can't return now... this is a hack, but weather isn't networked, so it should be ok + if (!(thing->precipflags & PCF_THUNK)) + { + if (thing->precipflags & PCF_RAIN) + P_RainThinker(thing); + else + P_SnowThinker(thing); + thing->precipflags |= PCF_THUNK; + } + // // store information in a vissprite // diff --git a/src/hu_stuff.c b/src/hu_stuff.c index ab427b48..2632197c 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -435,7 +435,7 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags) numwords = COM_Argc() - usedargs; I_Assert(numwords > 0); - if (cv_mute.value && !(server || IsPlayerAdmin(consoleplayer))) // TODO: Per Player mute. + if (CHAT_MUTE) // TODO: Per Player mute. { HU_AddChatText(va("%s>ERROR: The chat is muted. You can't say anything.", "\x85")); return; @@ -465,6 +465,7 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags) { // what we're gonna do now is check if the node exists // with that logic, characters 4 and 5 are our numbers: + const char *newmsg; int spc = 1; // used if nodenum[1] is a space. char *nodenum = (char*) malloc(3); strncpy(nodenum, msg+3, 5); @@ -503,7 +504,7 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags) return; } buf[0] = target; - const char *newmsg = msg+5+spc; + newmsg = msg+5+spc; memcpy(msg, newmsg, 252); } @@ -568,7 +569,10 @@ static void Command_Sayteam_f(void) return; } - DoSayCommand(-1, 1, 0); + if (G_GametypeHasTeams()) // revert to normal say if we don't have teams in this gametype. + DoSayCommand(-1, 1, 0); + else + DoSayCommand(0, 1, 0); } /** Send a message to everyone, to be displayed by CECHO. Only @@ -604,6 +608,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) char *msg; boolean action = false; char *ptr; + int spam_eatmsg = 0; CONS_Debug(DBG_NETPLAY,"Received SAY cmd from Player %d (%s)\n", playernum+1, player_names[playernum]); @@ -650,8 +655,6 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) } } - int spam_eatmsg = 0; - // before we do anything, let's verify the guy isn't spamming, get this easier on us. //if (stop_spamming_you_cunt[playernum] != 0 && cv_chatspamprotection.value && !(flags & HU_CSAY)) @@ -718,19 +721,32 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) // player is a spectator? if (players[playernum].spectator) - { + { cstart = "\x86"; // grey name textcolor = "\x86"; - } + } + else if (target == -1) // say team + { + if (players[playernum].ctfteam == 1) // red + { + cstart = "\x85"; + textcolor = "\x85"; + } + else // blue + { + cstart = "\x84"; + textcolor = "\x84"; + } + } else { const UINT8 color = players[playernum].skincolor; if (color <= SKINCOLOR_SILVER || color == SKINCOLOR_SLATE) cstart = "\x80"; // white - else if (color <= SKINCOLOR_BEIGE || color == SKINCOLOR_JET) + else if (color <= SKINCOLOR_BLACK || color == SKINCOLOR_JET) cstart = "\x86"; // V_GRAYMAP else if (color <= SKINCOLOR_LEATHER) - cstart = "\x8A"; // V_GOLDMAP + cstart = "\x8e"; // V_BROWNMAP else if (color <= SKINCOLOR_ROSE || color == SKINCOLOR_LILAC) cstart = "\x8d"; // V_PINKMAP else if (color <= SKINCOLOR_KETCHUP) @@ -741,14 +757,12 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) cstart = "\x8f"; // V_PEACHMAP else if (color <= SKINCOLOR_BRONZE) cstart = "\x8A"; // V_GOLDMAP - else if (color <= SKINCOLOR_MUSTARD) + else if (color <= SKINCOLOR_OLIVE) cstart = "\x82"; // V_YELLOWMAP else if (color <= SKINCOLOR_PISTACHIO) cstart = "\x8b"; // V_TEAMAP - else if (color <= SKINCOLOR_SWAMP || color == SKINCOLOR_LIME) + else if (color <= SKINCOLOR_DREAM || color == SKINCOLOR_LIME) cstart = "\x83"; // V_GREENMAP - else if (color <= SKINCOLOR_TEAL) - cstart = "\x8e"; // V_TEALMAP else if (color <= SKINCOLOR_NAVY || color == SKINCOLOR_SAPPHIRE) cstart = "\x88"; // V_SKYMAP else if (color <= SKINCOLOR_STEEL) @@ -761,7 +775,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) cstart = "\x89"; // V_LAVENDERMAP } prefix = cstart; - + // Give admins and remote admins their symbols. if (playernum == serverplayer) tempchar = (char *)Z_Calloc(strlen(cstart) + strlen(adminchar) + 1, PU_STATIC, NULL); @@ -783,13 +797,8 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) // '\4' makes the message yellow and beeps; '\3' just beeps. if (action) { - fmt = "\3* %s%s%s%s \x82%s\n"; // don't make /me yellow, yellow will be for mentions and PMs! - fmt2 = "* %s%s%s%s \x82%s"; - } - else if (target == 0) // To everyone - { - fmt = "\3%s<%s%s%s>\x80 %s%s\n"; - fmt2 = "%s<%s%s%s>\x80 %s%s"; + fmt = "\3* %s%s%s%s \x82%s%s\n"; // don't make /me yellow, yellow will be for mentions and PMs! + fmt2 = "* %s%s%s%s \x82%s%s"; } else if (target-1 == consoleplayer) // To you { @@ -809,7 +818,12 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) fmt2 = "%s<%s%s>%s\x80 %s%s"; } - else // To your team + else // To everyone or sayteam, it doesn't change anything. + { + fmt = "\3%s<%s%s%s>\x80 %s%s\n"; + fmt2 = "%s<%s%s%s>\x80 %s%s"; + } + /*else // To your team { if (players[playernum].ctfteam == 1) // red prefix = "\x85[TEAM]"; @@ -820,8 +834,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) fmt = "\3%s<%s%s>\x80%s %s%s\n"; fmt2 = "%s<%s%s>\x80%s %s%s"; - - } + }*/ HU_AddChatText(va(fmt2, prefix, cstart, dispname, cend, textcolor, msg)); // add it reguardless, in case we decide to change our mind about our chat type. @@ -870,7 +883,7 @@ static inline boolean HU_keyInChatString(char *s, char ch) { if (s[m]) s[m+1] = (s[m]); - + if (m < 1) break; // fix the chat going ham if your replace the first character. (For whatever reason this didn't happen in vanilla????) } @@ -883,9 +896,10 @@ static inline boolean HU_keyInChatString(char *s, char ch) } else if (ch == KEY_BACKSPACE) { + size_t i; if (c_input <= 0) return false; - size_t i = c_input; + i = c_input; if (!s[i-1]) return false; @@ -938,28 +952,31 @@ static void HU_queueChatChar(INT32 c) char buf[2+256]; size_t ci = 2; char *msg = &buf[2]; + size_t i; + INT32 target = 0; do { c = w_chat[-2+ci++]; if (!c || (c >= ' ' && !(c & 0x80))) // copy printable characters and terminating '\0' only. buf[ci-1]=c; } while (c); - size_t i = 0; + i = 0; for (;(iERROR: The chat is muted. You can't say anything.", "\x85")); return; } - INT32 target = 0; - if (strlen(msg) > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm { + int spc; + char *nodenum; + const char *newmsg; // what we're gonna do now is check if the node exists // with that logic, characters 4 and 5 are our numbers: @@ -970,8 +987,8 @@ static void HU_queueChatChar(INT32 c) return; } - int spc = 1; // used if nodenum[1] is a space. - char *nodenum = (char*) malloc(3); + spc = 1; // used if nodenum[1] is a space. + nodenum = (char*) malloc(3); strncpy(nodenum, msg+3, 5); // check for undesirable characters in our "number" if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9'))) @@ -1008,7 +1025,7 @@ static void HU_queueChatChar(INT32 c) return; } // we need to get rid of the /pm - const char *newmsg = msg+5+spc; + newmsg = msg+5+spc; memcpy(msg, newmsg, 255); } if (ci > 3) // don't send target+flags+empty message. @@ -1053,10 +1070,8 @@ boolean HU_Responder(event_t *ev) { // enter chat mode if ((ev->data1 == gamecontrol[gc_talkkey][0] || ev->data1 == gamecontrol[gc_talkkey][1]) - && netgame && (!cv_mute.value || server || (IsPlayerAdmin(consoleplayer)))) + && netgame && !OLD_MUTE) // check for old chat mute, still let the players open the chat incase they want to scroll otherwise. { - if (cv_mute.value && !(server || IsPlayerAdmin(consoleplayer))) - return false; chat_on = true; w_chat[0] = 0; teamtalk = false; @@ -1064,13 +1079,11 @@ boolean HU_Responder(event_t *ev) return true; } if ((ev->data1 == gamecontrol[gc_teamkey][0] || ev->data1 == gamecontrol[gc_teamkey][1]) - && netgame && (!cv_mute.value || server || (IsPlayerAdmin(consoleplayer)))) + && netgame && !OLD_MUTE) { - if (cv_mute.value && !(server || IsPlayerAdmin(consoleplayer))) - return false; chat_on = true; w_chat[0] = 0; - teamtalk = true; + teamtalk = G_GametypeHasTeams(); // Don't teamtalk if we don't have teams. chat_scrollmedown = true; return true; } @@ -1105,17 +1118,19 @@ boolean HU_Responder(event_t *ev) // TODO: make chat behave like the console, so that we can go back and edit stuff when we fuck up. // pasting. pasting is cool. chat is a bit limited, though :( - if ((c == 'v' || c == 'V') && ctrldown) + if (((c == 'v' || c == 'V') && ctrldown) && !CHAT_MUTE) { const char *paste = I_ClipboardPaste(); + size_t chatlen; + size_t pastelen; // create a dummy string real quickly if (paste == NULL) return true; - size_t chatlen = strlen(w_chat); - size_t pastelen = strlen(paste); + chatlen = strlen(w_chat); + pastelen = strlen(paste); if (chatlen+pastelen > HU_MAXMSGLEN) return true; // we can't paste this!! @@ -1145,7 +1160,7 @@ boolean HU_Responder(event_t *ev) } } - if (HU_keyInChatString(w_chat,c)) + if (!CHAT_MUTE && HU_keyInChatString(w_chat,c)) { HU_queueChatChar(c); } @@ -1155,26 +1170,29 @@ boolean HU_Responder(event_t *ev) c_input = 0; // reset input cursor chat_scrollmedown = true; // you hit enter, so you might wanna autoscroll to see what you just sent. :) } - else if (c == KEY_ESCAPE) + else if (c == KEY_ESCAPE + || ((c == gamecontrol[gc_talkkey][0] || c == gamecontrol[gc_talkkey][1] + || c == gamecontrol[gc_teamkey][0] || c == gamecontrol[gc_teamkey][1]) + && c >= KEY_MOUSE1)) // If it's not a keyboard key, then the chat button is used as a toggle. { chat_on = false; c_input = 0; // reset input cursor } - else if ((c == KEY_UPARROW || c == KEY_MOUSEWHEELUP) && chat_scroll > 0) // CHAT SCROLLING YAYS! + else if ((c == KEY_UPARROW || c == KEY_MOUSEWHEELUP) && chat_scroll > 0 && !OLDCHAT) // CHAT SCROLLING YAYS! { chat_scroll--; justscrolledup = true; chat_scrolltime = 4; } - else if ((c == KEY_DOWNARROW || c == KEY_MOUSEWHEELDOWN) && chat_scroll < chat_maxscroll && chat_maxscroll > 0) + else if ((c == KEY_DOWNARROW || c == KEY_MOUSEWHEELDOWN) && chat_scroll < chat_maxscroll && chat_maxscroll > 0 && !OLDCHAT) { chat_scroll++; justscrolleddown = true; chat_scrolltime = 4; } - else if (c == KEY_LEFTARROW && c_input != 0) // i said go back + else if (c == KEY_LEFTARROW && c_input != 0 && !OLDCHAT) // i said go back c_input--; - else if (c == KEY_RIGHTARROW && c_input < strlen(w_chat)) + else if (c == KEY_RIGHTARROW && c_input < strlen(w_chat) && !OLDCHAT) // don't need to check for admin or w/e here since the chat won't ever contain anything if it's muted. c_input++; return true; } @@ -1249,9 +1267,6 @@ INT16 chatx = 13, chaty = 169; // let's use this as our coordinates, shh static void HU_drawMiniChat(void) { - if (!chat_nummsg_min) - return; // needless to say it's useless to do anything if we don't have anything to draw. - INT32 x = chatx+2; INT32 charwidth = 4, charheight = 6; INT32 dx = 0, dy = 0; @@ -1260,6 +1275,10 @@ static void HU_drawMiniChat(void) INT32 msglines = 0; // process all messages once without rendering anything or doing anything fancy so that we know how many lines each message has... + INT32 y; + + if (!chat_nummsg_min) + return; // needless to say it's useless to do anything if we don't have anything to draw. for (; i>0; i--) { @@ -1275,10 +1294,10 @@ static void HU_drawMiniChat(void) { ++j; if (!prev_linereturn) - { + { linescount += 1; dx = 0; - } + } prev_linereturn = true; continue; } @@ -1307,7 +1326,7 @@ static void HU_drawMiniChat(void) msglines += linescount+1; } - INT32 y = chaty - charheight*(msglines+1) - (cv_kartspeedometer.value ? 16 : 0); + y = chaty - charheight*(msglines+1) - (cv_kartspeedometer.value ? 16 : 0); dx = 0; dy = 0; i = 0; @@ -1330,10 +1349,10 @@ static void HU_drawMiniChat(void) { ++j; if (!prev_linereturn) - { + { dy += charheight; dx = 0; - } + } prev_linereturn = true; continue; } @@ -1485,8 +1504,10 @@ static void HU_DrawChat(void) INT32 charwidth = 4, charheight = 6; INT32 t = 0, c = 0, y = chaty - (typelines*charheight) - (cv_kartspeedometer.value ? 16 : 0); UINT32 i = 0, saylen = strlen(w_chat); // You learn new things everyday! + INT32 cflag = 0; const char *ntalk = "Say: ", *ttalk = "Team: "; const char *talk = ntalk; + const char *mute = "Chat has been muted."; if (teamtalk) { @@ -1499,18 +1520,35 @@ static void HU_DrawChat(void) #endif } + if (CHAT_MUTE) + { + talk = mute; + typelines = 1; + cflag = V_GRAYMAP; // set text in gray if chat is muted. + } + V_DrawFillConsoleMap(chatx, y-1, cv_chatwidth.value, (typelines*charheight), 239 | V_SNAPTOBOTTOM | V_SNAPTOLEFT); - + while (talk[i]) { if (talk[i] < HU_FONTSTART) ++i; else - V_DrawChatCharacter(chatx + c + 2, y, talk[i++] |V_SNAPTOBOTTOM|V_SNAPTOLEFT, !cv_allcaps.value, NULL); + { + V_DrawChatCharacter(chatx + c + 2, y, talk[i] |V_SNAPTOBOTTOM|V_SNAPTOLEFT|cflag, !cv_allcaps.value, V_GetStringColormap(talk[i]|cflag)); + i++; + } c += charwidth; } + // if chat is muted, just draw the log and get it over with: + if (CHAT_MUTE) + { + HU_drawChatLog(0); + return; + } + i = 0; typelines = 1; @@ -1553,24 +1591,25 @@ static void HU_DrawChat(void) // handle /pm list. if (strnicmp(w_chat, "/pm", 3) == 0 && vid.width >= 400 && !teamtalk) // 320x200 unsupported kthxbai { - i = 0; INT32 count = 0; INT32 p_dispy = chaty - charheight -1; + i = 0; for(i=0; (i '9'))) || ((w_chat[4] != 0) && (((w_chat[4] < '0') || (w_chat[4] > '9'))))) && (w_chat[4] != ' ')) break; - char *nodenum = (char*) malloc(3); + nodenum = (char*) malloc(3); strncpy(nodenum, w_chat+3, 4); - UINT32 n = atoi((const char*) nodenum); // turn that into a number + n = atoi((const char*) nodenum); // turn that into a number // special cases: if ((n == 0) && !(w_chat[4] == '0')) @@ -1695,7 +1734,7 @@ static void HU_DrawChat_Old(void) // // Crosshairs are pre-cached at HU_Init -static inline void HU_DrawCrosshair(void) +/*static inline void HU_DrawCrosshair(void) { INT32 i, x, y; @@ -1847,7 +1886,7 @@ static inline void HU_DrawCrosshair4(void) V_DrawScaledPatch(x, y, V_NOSCALESTART|V_OFFSET|V_TRANSLUCENT, crosshair[i - 1]); } -} +}*/ static void HU_DrawCEcho(void) { @@ -1955,10 +1994,13 @@ void HU_Drawer(void) } else { + if (netgame) // Don't draw it outside, I know it leads to stupid stuff. + { chat_scrolltime = 0; // do scroll anyway. typelines = 1; // make sure that the chat doesn't have a weird blinking huge ass square if we typed a lot last time. if (!OLDCHAT) HU_drawMiniChat(); // draw messages in a cool fashion. + } } if (netgame) // would handle that in hu_drawminichat, but it's actually kinda awkward when you're typing a lot of messages. (only handle that in netgames duh) @@ -2018,7 +2060,7 @@ void HU_Drawer(void) return; // draw the crosshair, not when viewing demos nor with chasecam - if (!automapactive && !demoplayback) + /*if (!automapactive && !demoplayback) { if (cv_crosshair.value && !camera.chase && !players[displayplayer].spectator) HU_DrawCrosshair(); @@ -2031,7 +2073,7 @@ void HU_Drawer(void) if (cv_crosshair4.value && !camera4.chase && !players[fourthdisplayplayer].spectator) HU_DrawCrosshair4(); - } + }*/ // draw desynch text if (hu_resynching) @@ -2133,6 +2175,7 @@ void HU_drawPing(INT32 x, INT32 y, INT32 ping, boolean notext) UINT8 barcolor = 128; // color we use for the bars (green, yellow or red) SINT8 i = 0; SINT8 yoffset = 6; + INT32 dx; if (ping < 128) { numbars = 3; @@ -2144,7 +2187,7 @@ void HU_drawPing(INT32 x, INT32 y, INT32 ping, boolean notext) barcolor = 103; } - INT32 dx = x+1 - (V_SmallStringWidth(va("%dms", ping), V_ALLOWLOWERCASE)/2); + dx = x+1 - (V_SmallStringWidth(va("%dms", ping), V_ALLOWLOWERCASE)/2); if (!notext || vid.width >= 640) // how sad, we're using a shit resolution. V_DrawSmallString(dx, y+4, V_ALLOWLOWERCASE, va("%dms", ping)); @@ -2226,22 +2269,13 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I if (G_RaceGametype()) { -#define timestring(time) va("%i:%02i.%02i", G_TicsToMinutes(time, true), G_TicsToSeconds(time), G_TicsToCentiseconds(time)) +#define timestring(time) va("%i'%02i\"%02i", G_TicsToMinutes(time, true), G_TicsToSeconds(time), G_TicsToCentiseconds(time)) if (players[tab[i].num].exiting) - { - V_DrawRightAlignedString(x, y-4, hilicol, "FIN"); V_DrawRightAlignedString(x+rightoffset, y, hilicol, timestring(players[tab[i].num].realtime)); - } else if (players[tab[i].num].pflags & PF_TIMEOVER) - V_DrawRightAlignedThinString(x+rightoffset, y-1, 0, "TIME OVER..."); + V_DrawRightAlignedThinString(x+rightoffset, y-1, 0, "NO CONTEST."); else if (circuitmap) - { - V_DrawRightAlignedString(x, y-4, 0, "Lap"); - V_DrawRightAlignedString(x, y+4, 0, va("%d", tab[i].count)); - V_DrawRightAlignedString(x+rightoffset, y, 0, timestring(players[tab[i].num].starposttime)); - } - else - V_DrawRightAlignedString(x+rightoffset, y, 0, timestring(tab[i].count)); + V_DrawRightAlignedString(x+rightoffset, y, 0, va("Lap %d", tab[i].count)); #undef timestring } else diff --git a/src/hu_stuff.h b/src/hu_stuff.h index 90ffeb42..fc0e57a2 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -81,6 +81,8 @@ extern patch_t *iconprefix[MAXSKINS]; #define CHAT_BUFSIZE 64 // that's enough messages, right? We'll delete the older ones when that gets out of hand. #define OLDCHAT (cv_consolechat.value || dedicated || vid.width < 640) +#define CHAT_MUTE (cv_mute.value && !(server || IsPlayerAdmin(consoleplayer))) // this still allows to open the chat but not to type. That's used for scrolling and whatnot. +#define OLD_MUTE (OLDCHAT && cv_mute.value && !(server || IsPlayerAdmin(consoleplayer))) // this is used to prevent oldchat from opening when muted. // some functions void HU_AddChatText(const char *text); @@ -91,9 +93,6 @@ extern boolean chat_on; // set true whenever the tab rankings are being shown for any reason extern boolean hu_showscores; -// P_DeathThink sets this true to show scores while dead, in multiplayer -extern boolean playerdeadview; - // init heads up data at game startup. void HU_Init(void); diff --git a/src/i_sound.h b/src/i_sound.h index 084479ee..098c9be1 100644 --- a/src/i_sound.h +++ b/src/i_sound.h @@ -64,7 +64,7 @@ void I_ShutdownSound(void); \return sfx handle */ -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority); +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel); /** \brief Stops a sound channel. diff --git a/src/i_tcp.c b/src/i_tcp.c index 6488e984..16e7bf2f 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -686,14 +686,29 @@ static boolean SOCK_CanGet(void) #endif #ifndef NONET -static void SOCK_Send(void) +static inline ssize_t SOCK_SendToAddr(SOCKET_TYPE socket, mysockaddr_t *sockaddr) { - ssize_t c = ERRSOCKET; socklen_t d4 = (socklen_t)sizeof(struct sockaddr_in); #ifdef HAVE_IPV6 socklen_t d6 = (socklen_t)sizeof(struct sockaddr_in6); #endif socklen_t d, da = (socklen_t)sizeof(mysockaddr_t); + + switch (sockaddr->any.sa_family) + { + case AF_INET: d = d4; break; +#ifdef HAVE_IPV6 + case AF_INET6: d = d6; break; +#endif + default: d = da; break; + } + + return sendto(socket, (char *)&doomcom->data, doomcom->datalength, 0, &sockaddr->any, d); +} + +static void SOCK_Send(void) +{ + ssize_t c = ERRSOCKET; size_t i, j; if (!nodeconnected[doomcom->remotenode]) @@ -706,19 +721,7 @@ static void SOCK_Send(void) for (j = 0; j < broadcastaddresses; j++) { if (myfamily[i] == broadcastaddress[j].any.sa_family) - { - if (broadcastaddress[i].any.sa_family == AF_INET) - d = d4; -#ifdef HAVE_IPV6 - else if (broadcastaddress[i].any.sa_family == AF_INET6) - d = d6; -#endif - else - d = da; - - c = sendto(mysockets[i], (char *)&doomcom->data, doomcom->datalength, 0, - &broadcastaddress[j].any, d); - } + SOCK_SendToAddr(mysockets[i], &broadcastaddress[j]); } } return; @@ -728,35 +731,13 @@ static void SOCK_Send(void) for (i = 0; i < mysocketses; i++) { if (myfamily[i] == clientaddress[doomcom->remotenode].any.sa_family) - { - if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET) - d = d4; -#ifdef HAVE_IPV6 - else if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET6) - d = d6; -#endif - else - d = da; - - sendto(mysockets[i], (char *)&doomcom->data, doomcom->datalength, 0, - &clientaddress[doomcom->remotenode].any, d); - } + SOCK_SendToAddr(mysockets[i], &clientaddress[doomcom->remotenode]); } return; } else { - if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET) - d = d4; -#ifdef HAVE_IPV6 - else if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET6) - d = d6; -#endif - else - d = da; - - c = sendto(nodesocket[doomcom->remotenode], (char *)&doomcom->data, doomcom->datalength, 0, - &clientaddress[doomcom->remotenode].any, d); + c = SOCK_SendToAddr(nodesocket[doomcom->remotenode], &clientaddress[doomcom->remotenode]); } if (c == ERRSOCKET && errno != ECONNREFUSED && errno != EWOULDBLOCK) @@ -1044,7 +1025,7 @@ static boolean UDP_Socket(void) if (gaie == 0) { runp = ai; - while (runp != NULL) + while (runp != NULL && s < MAXNETNODES+1) { memcpy(&clientaddress[s], runp->ai_addr, runp->ai_addrlen); s++; @@ -1059,12 +1040,15 @@ static boolean UDP_Socket(void) clientaddress[s].ip4.sin_addr.s_addr = htonl(INADDR_LOOPBACK); //GetLocalAddress(); // my own ip s++; } + + s = 0; + // setup broadcast adress to BROADCASTADDR entry gaie = I_getaddrinfo("255.255.255.255", "0", &hints, &ai); if (gaie == 0) { runp = ai; - while (runp != NULL) + while (runp != NULL && s < MAXNETNODES+1) { memcpy(&broadcastaddress[s], runp->ai_addr, runp->ai_addrlen); s++; @@ -1087,7 +1071,7 @@ static boolean UDP_Socket(void) if (gaie == 0) { runp = ai; - while (runp != NULL) + while (runp != NULL && s < MAXNETNODES+1) { memcpy(&broadcastaddress[s], runp->ai_addr, runp->ai_addrlen); s++; diff --git a/src/info.c b/src/info.c index b3e4e7c7..932ff21a 100644 --- a/src/info.c +++ b/src/info.c @@ -3006,6 +3006,7 @@ state_t states[NUMSTATES] = {SPR_PBOM, FF_ANIMATE, -1, {NULL}, 3, 3, S_NULL}, // S_PLAYERBOMB {SPR_RNDM, FF_ANIMATE, -1, {NULL}, 23, 3, S_NULL}, // S_PLAYERITEM + {SPR_FITM, FF_ANIMATE, -1, {NULL}, 23, 3, S_NULL}, // S_PLAYERFAKE {SPR_PBOM, 4, -1, {NULL}, 0, 0, S_NULL}, // S_KARMAWHEEL @@ -4089,7 +4090,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 4, // mass 0, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOGRAVITY, // flags + MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOGRAVITY|MF_SCENERY, // flags S_NULL // raisestate }, @@ -10754,7 +10755,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // deathstate S_NULL, // xdeathstate sfx_None, // deathsound - -24*FRACUNIT, // speed + -72*FRACUNIT, // speed -- -24*FRACUNIT originally, srb2kart x3 (nya) 1*FRACUNIT, // radius 8*FRACUNIT, // height 0, // display offset @@ -17132,7 +17133,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_kc2e, // seesound 8, // reactiontime sfx_s3k4e, // attacksound - S_NULL, // painstate + S_PLAYERFAKE, // painstate 0, // painchance sfx_None, // painsound S_NULL, // meleestate diff --git a/src/info.h b/src/info.h index cfda742c..9241363e 100644 --- a/src/info.h +++ b/src/info.h @@ -3554,11 +3554,12 @@ typedef enum state S_PLAYERBOMB, S_PLAYERITEM, + S_PLAYERFAKE, S_KARMAWHEEL, - // Lightning shield use stuff; - S_KSPARK1, // Sparkling Radius + // Thunder shield use stuff; + S_KSPARK1, // Sparkling Radius S_KSPARK2, S_KSPARK3, S_KSPARK4, @@ -3571,7 +3572,7 @@ typedef enum state S_KSPARK11, S_KSPARK12, S_KSPARK13, // ... that's an awful lot. - + S_LZIO11, // Straight lightning bolt S_LZIO12, S_LZIO13, @@ -3581,7 +3582,7 @@ typedef enum state S_LZIO17, S_LZIO18, S_LZIO19, - + S_LZIO21, // Straight lightning bolt (flipped) S_LZIO22, S_LZIO23, @@ -3591,7 +3592,7 @@ typedef enum state S_LZIO27, S_LZIO28, S_LZIO29, - + S_KLIT1, // Diagonal lightning. No, it not being straight doesn't make it gay. S_KLIT2, S_KLIT3, diff --git a/src/k_kart.c b/src/k_kart.c index ed91616b..fccb6867 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -55,9 +55,9 @@ const char *KartColor_Names[MAXSKINCOLORS] = "Salmon", // 10 // SKINCOLOR_SALMON "Pink", // 11 // SKINCOLOR_PINK "Rose", // 12 // SKINCOLOR_ROSE - "Raspberry", // 13 // SKINCOLOR_RASPBERRY - "Red", // 14 // SKINCOLOR_RED - "Ruby", // 15 // SKINCOLOR_RUBY + "Ruby", // 13 // SKINCOLOR_RUBY + "Raspberry", // 14 // SKINCOLOR_RASPBERRY + "Red", // 15 // SKINCOLOR_RED "Crimson", // 16 // SKINCOLOR_CRIMSON "Ketchup", // 17 // SKINCOLOR_KETCHUP "Dawn", // 18 // SKINCOLOR_DAWN @@ -77,16 +77,16 @@ const char *KartColor_Names[MAXSKINCOLORS] = "Vomit", // 32 // SKINCOLOR_VOMIT "Garden", // 33 // SKINCOLOR_GARDEN "Lime", // 34 // SKINCOLOR_LIME - "Dream", // 35 // SKINCOLOR_DREAM - "Tea", // 36 // SKINCOLOR_TEA - "Pistachio", // 37 // SKINCOLOR_PISTACHIO - "Robo-Hood", // 38 // SKINCOLOR_ROBOHOOD - "Moss", // 39 // SKINCOLOR_MOSS - "Mint", // 40 // SKINCOLOR_MINT - "Green", // 41 // SKINCOLOR_GREEN - "Pinetree", // 42 // SKINCOLOR_PINETREE - "Emerald", // 43 // SKINCOLOR_EMERALD - "Swamp", // 44 // SKINCOLOR_SWAMP + "Tea", // 35 // SKINCOLOR_TEA + "Pistachio", // 36 // SKINCOLOR_PISTACHIO + "Robo-Hood", // 37 // SKINCOLOR_ROBOHOOD + "Moss", // 38 // SKINCOLOR_MOSS + "Mint", // 39 // SKINCOLOR_MINT + "Green", // 40 // SKINCOLOR_GREEN + "Pinetree", // 41 // SKINCOLOR_PINETREE + "Emerald", // 42 // SKINCOLOR_EMERALD + "Swamp", // 43 // SKINCOLOR_SWAMP + "Dream", // 44 // SKINCOLOR_DREAM "Aqua", // 45 // SKINCOLOR_AQUA "Teal", // 46 // SKINCOLOR_TEAL "Cyan", // 47 // SKINCOLOR_CYAN @@ -96,9 +96,9 @@ const char *KartColor_Names[MAXSKINCOLORS] = "Slate", // 51 // SKINCOLOR_SLATE "Steel", // 52 // SKINCOLOR_STEEL "Jet", // 53 // SKINCOLOR_JET - "Periwinkle", // 54 // SKINCOLOR_PERIWINKLE - "Blue", // 55 // SKINCOLOR_BLUE - "Sapphire", // 56 // SKINCOLOR_SAPPHIRE + "Sapphire", // 54 // SKINCOLOR_SAPPHIRE + "Periwinkle", // 55 // SKINCOLOR_PERIWINKLE + "Blue", // 56 // SKINCOLOR_BLUE "Blueberry", // 57 // SKINCOLOR_BLUEBERRY "Dusk", // 58 // SKINCOLOR_DUSK "Purple", // 59 // SKINCOLOR_PURPLE @@ -124,9 +124,9 @@ const UINT8 KartColor_Opposite[MAXSKINCOLORS*2] = SKINCOLOR_TEA,8, // 10 // SKINCOLOR_SALMON SKINCOLOR_PISTACHIO,8, // 11 // SKINCOLOR_PINK SKINCOLOR_MOSS,8, // 12 // SKINCOLOR_ROSE - SKINCOLOR_MINT,8, // 13 // SKINCOLOR_RASPBERRY - SKINCOLOR_GREEN,6, // 14 // SKINCOLOR_RED - SKINCOLOR_SAPPHIRE,8, // 15 // SKINCOLOR_RUBY + SKINCOLOR_SAPPHIRE,8, // 13 // SKINCOLOR_RUBY + SKINCOLOR_MINT,8, // 14 // SKINCOLOR_RASPBERRY + SKINCOLOR_GREEN,6, // 15 // SKINCOLOR_RED SKINCOLOR_PINETREE,6, // 16 // SKINCOLOR_CRIMSON SKINCOLOR_MUSTARD,10, // 17 // SKINCOLOR_KETCHUP SKINCOLOR_DUSK,8, // 18 // SKINCOLOR_DAWN @@ -146,16 +146,16 @@ const UINT8 KartColor_Opposite[MAXSKINCOLORS*2] = SKINCOLOR_ROBOHOOD,8, // 32 // SKINCOLOR_VOMIT SKINCOLOR_LAVENDER,6, // 33 // SKINCOLOR_GARDEN SKINCOLOR_TANGERINE,8, // 34 // SKINCOLOR_LIME - SKINCOLOR_POMEGRANATE,8, // 35 // SKINCOLOR_DREAM - SKINCOLOR_SALMON,8, // 36 // SKINCOLOR_TEA - SKINCOLOR_PINK,6, // 37 // SKINCOLOR_PISTACHIO - SKINCOLOR_VOMIT,8, // 38 // SKINCOLOR_ROBOHOOD - SKINCOLOR_ROSE,8, // 39 // SKINCOLOR_MOSS - SKINCOLOR_RASPBERRY,8, // 40 // SKINCOLOR_MINT - SKINCOLOR_RED,8, // 41 // SKINCOLOR_GREEN - SKINCOLOR_CRIMSON,8, // 42 // SKINCOLOR_PINETREE - SKINCOLOR_PURPLE,8, // 43 // SKINCOLOR_EMERALD - SKINCOLOR_BYZANTIUM,8, // 44 // SKINCOLOR_SWAMP + SKINCOLOR_SALMON,8, // 35 // SKINCOLOR_TEA + SKINCOLOR_PINK,6, // 36 // SKINCOLOR_PISTACHIO + SKINCOLOR_VOMIT,8, // 37 // SKINCOLOR_ROBOHOOD + SKINCOLOR_ROSE,8, // 38 // SKINCOLOR_MOSS + SKINCOLOR_RASPBERRY,8, // 39 // SKINCOLOR_MINT + SKINCOLOR_RED,8, // 40 // SKINCOLOR_GREEN + SKINCOLOR_CRIMSON,8, // 41 // SKINCOLOR_PINETREE + SKINCOLOR_PURPLE,8, // 42 // SKINCOLOR_EMERALD + SKINCOLOR_BYZANTIUM,8, // 43 // SKINCOLOR_SWAMP + SKINCOLOR_POMEGRANATE,8, // 44 // SKINCOLOR_DREAM SKINCOLOR_YELLOW,8, // 45 // SKINCOLOR_AQUA SKINCOLOR_OLIVE,8, // 46 // SKINCOLOR_TEAL SKINCOLOR_PEACH,8, // 47 // SKINCOLOR_CYAN @@ -165,9 +165,9 @@ const UINT8 KartColor_Opposite[MAXSKINCOLORS*2] = SKINCOLOR_GOLD,10, // 51 // SKINCOLOR_SLATE SKINCOLOR_BRONZE,10, // 52 // SKINCOLOR_STEEL SKINCOLOR_BURGUNDY,8, // 53 // SKINCOLOR_JET - SKINCOLOR_CREAMSICLE,8, // 54 // SKINCOLOR_PERIWINKLE - SKINCOLOR_ORANGE,8, // 55 // SKINCOLOR_BLUE - SKINCOLOR_RUBY,6, // 56 // SKINCOLOR_SAPPHIRE + SKINCOLOR_RUBY,6, // 54 // SKINCOLOR_SAPPHIRE + SKINCOLOR_CREAMSICLE,8, // 55 // SKINCOLOR_PERIWINKLE + SKINCOLOR_ORANGE,8, // 56 // SKINCOLOR_BLUE SKINCOLOR_PUMPKIN,8, // 57 // SKINCOLOR_BLUEBERRY SKINCOLOR_DAWN,6, // 58 // SKINCOLOR_DUSK SKINCOLOR_EMERALD,8, // 59 // SKINCOLOR_PURPLE @@ -189,11 +189,11 @@ UINT8 colortranslations[MAXSKINCOLORS][16] = { { 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63}, // SKINCOLOR_BROWN { 51, 52, 53, 55, 56, 57, 58, 60, 61, 63, 28, 28, 29, 29, 30, 31}, // SKINCOLOR_LEATHER {120, 120, 120, 121, 121, 122, 122, 123, 124, 125, 126, 128, 129, 131, 133, 135}, // SKINCOLOR_SALMON - {121, 121, 144, 144, 145, 145, 146, 146, 147, 148, 149, 150, 151, 134, 136, 138}, // SKINCOLOR_PINK + {120, 121, 121, 122, 144, 145, 146, 147, 148, 149, 150, 151, 134, 136, 138, 140}, // SKINCOLOR_PINK {144, 145, 146, 147, 148, 149, 150, 151, 134, 135, 136, 137, 138, 139, 140, 141}, // SKINCOLOR_ROSE + {121, 122, 145, 146, 147, 149, 131, 132, 133, 134, 135, 197, 197, 198, 199, 255}, // SKINCOLOR_RUBY {120, 121, 122, 123, 124, 125, 126, 127, 128, 130, 131, 133, 134, 136, 137, 139}, // SKINCOLOR_RASPBERRY {125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140}, // SKINCOLOR_RED - {121, 122, 145, 146, 147, 149, 131, 132, 133, 134, 135, 197, 197, 198, 199, 255}, // SKINCOLOR_RUBY {130, 131, 132, 133, 134, 136, 137, 138, 139, 139, 140, 140, 141, 141, 142, 143}, // SKINCOLOR_CRIMSON {104, 113, 113, 85, 86, 88, 128, 129, 131, 133, 134, 136, 138, 139, 141, 143}, // SKINCOLOR_KETCHUP {120, 121, 122, 123, 124, 147, 147, 148, 90, 91, 92, 93, 94, 95, 152, 154}, // SKINCOLOR_DAWN @@ -213,7 +213,6 @@ UINT8 colortranslations[MAXSKINCOLORS][16] = { {121, 144, 145, 72, 73, 84, 114, 115, 107, 108, 109, 183, 223, 207, 30, 246}, // SKINCOLOR_VOMIT { 98, 99, 112, 101, 113, 114, 106, 179, 180, 180, 181, 182, 183, 173, 174, 175}, // SKINCOLOR_GARDEN { 96, 97, 99, 100, 102, 104, 160, 162, 164, 166, 168, 171, 223, 223, 207, 31}, // SKINCOLOR_LIME - {120, 120, 80, 80, 81, 177, 162, 164, 228, 228, 204, 204, 205, 205, 206, 207}, // SKINCOLOR_DREAM {120, 120, 176, 176, 176, 177, 177, 178, 178, 179, 179, 180, 180, 181, 182, 183}, // SKINCOLOR_TEA {120, 120, 176, 176, 177, 177, 178, 179, 165, 166, 167, 168, 169, 170, 171, 172}, // SKINCOLOR_PISTACHIO {176, 176, 177, 178, 165, 166, 167, 167, 168, 169, 182, 182, 182, 183, 183, 183}, // SKINCOLOR_ROBOHOOD @@ -223,18 +222,19 @@ UINT8 colortranslations[MAXSKINCOLORS][16] = { {160, 161, 162, 164, 165, 167, 169, 170, 171, 171, 172, 173, 174, 175, 30, 31}, // SKINCOLOR_PINETREE {160, 184, 184, 185, 185, 186, 186, 187, 187, 188, 188, 189, 189, 190, 191, 175}, // SKINCOLOR_EMERALD {186, 187, 188, 188, 188, 189, 189, 190, 190, 191, 175, 175, 30, 30, 31, 31}, // SKINCOLOR_SWAMP + {120, 120, 80, 80, 81, 177, 162, 164, 228, 228, 204, 204, 205, 205, 206, 207}, // SKINCOLOR_DREAM {120, 208, 208, 210, 212, 214, 220, 220, 220, 221, 221, 222, 222, 223, 223, 191}, // SKINCOLOR_AQUA {210, 213, 220, 220, 220, 216, 216, 221, 221, 221, 222, 222, 223, 223, 191, 31}, // SKINCOLOR_TEAL {120, 120, 208, 208, 209, 210, 211, 212, 213, 215, 216, 217, 218, 219, 222, 223}, // SKINCOLOR_CYAN {120, 120, 208, 209, 210, 226, 215, 216, 217, 229, 229, 205, 205, 206, 207, 31}, // SKINCOLOR_JAWZ {208, 209, 211, 213, 215, 216, 216, 217, 217, 218, 218, 219, 205, 206, 207, 207}, // SKINCOLOR_CERULEAN - {215, 215, 215, 216, 216, 217, 218, 204, 204, 205, 205, 206, 207, 29, 30, 31}, // SKINCOLOR_NAVY + {211, 212, 213, 215, 216, 218, 219, 205, 206, 206, 207, 207, 28, 29, 30, 31}, // SKINCOLOR_NAVY {120, 120, 200, 200, 200, 201, 201, 201, 202, 202, 202, 203, 204, 205, 206, 207}, // SKINCOLOR_SLATE {120, 200, 200, 201, 201, 202, 202, 203, 203, 204, 204, 205, 205, 206, 207, 31}, // SKINCOLOR_STEEL - {200, 201, 202, 203, 204, 205, 206, 207, 28, 28, 29, 29, 30, 30, 31, 31}, // SKINCOLOR_JET + {225, 226, 227, 228, 229, 205, 205, 206, 207, 207, 28, 28, 29, 29, 30, 31}, // SKINCOLOR_JET + {208, 209, 211, 213, 215, 217, 229, 230, 232, 234, 236, 238, 240, 242, 244, 246}, // SKINCOLOR_SAPPHIRE {120, 224, 225, 226, 226, 227, 228, 228, 229, 230, 231, 234, 235, 237, 239, 241}, // SKINCOLOR_PERIWINKLE {224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239}, // SKINCOLOR_BLUE - {208, 209, 211, 213, 215, 217, 229, 230, 232, 234, 236, 238, 240, 242, 244, 246}, // SKINCOLOR_SAPPHIRE {228, 229, 230, 231, 232, 233, 234, 235, 237, 238, 239, 240, 242, 243, 244, 245}, // SKINCOLOR_BLUEBERRY {192, 192, 248, 249, 250, 251, 204, 204, 205, 205, 206, 206, 207, 29, 30, 31}, // SKINCOLOR_DUSK {192, 192, 192, 193, 193, 194, 194, 195, 195, 196, 196, 197, 197, 198, 198, 199}, // SKINCOLOR_PURPLE @@ -256,8 +256,6 @@ UINT8 colortranslations[MAXSKINCOLORS][16] = { */ }; -//#define SALLYALTRAINBOW // Sal's edited version of the below, which keeps a colors' lightness, and looks better with hue-shifted colors like Ruby & Dream. Not strictly *better*, just different... - // Define for getting accurate color brightness readings according to how the human eye sees them. // https://en.wikipedia.org/wiki/Relative_luminance // 0.2126 to red @@ -277,7 +275,6 @@ void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor) INT32 i; RGBA_t color; UINT8 brightness; -#ifndef SALLYALTRAINBOW INT32 j; UINT8 colorbrightnesses[16]; UINT16 brightdif; @@ -289,7 +286,6 @@ void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor) color = V_GetColor(colortranslations[skincolor][i]); SETBRIGHTNESS(colorbrightnesses[i], color.s.red, color.s.green, color.s.blue); } -#endif // next, for every colour in the palette, choose the transcolor that has the closest brightness for (i = 0; i < NUM_PALETTE_ENTRIES; i++) @@ -301,10 +297,6 @@ void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor) } color = V_GetColor(i); SETBRIGHTNESS(brightness, color.s.red, color.s.green, color.s.blue); -#ifdef SALLYALTRAINBOW - brightness = 15-(brightness/16); // Yes, 15. - dest_colormap[i] = colortranslations[skincolor][brightness]; -#else brightdif = 256; for (j = 0; j < 16; j++) { @@ -315,7 +307,6 @@ void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor) dest_colormap[i] = colortranslations[skincolor][j]; } } -#endif } } @@ -905,12 +896,12 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) if ((player->kartstuff[k_itemroulette] % 3) == 1 && P_IsLocalPlayer(player)) S_StartSound(NULL, sfx_mkitm1 + ((player->kartstuff[k_itemroulette] / 3) % 8)); - roulettestop = (TICRATE*1) + (3*(pingame - player->kartstuff[k_position])); + roulettestop = TICRATE + (3*(pingame - player->kartstuff[k_position])); // If the roulette finishes or the player presses BT_ATTACK, stop the roulette and calculate the item. // I'm returning via the exact opposite, however, to forgo having another bracket embed. Same result either way, I think. // Finally, if you get past this check, now you can actually start calculating what item you get. - if ((cmd->buttons & BT_ATTACK) && !(player->kartstuff[k_eggmanheld] || player->kartstuff[k_itemheld]) && player->kartstuff[k_itemroulette] >= roulettestop) + if ((cmd->buttons & BT_ATTACK) && !(player->kartstuff[k_eggmanheld] || player->kartstuff[k_itemheld]) && player->kartstuff[k_itemroulette] >= roulettestop && !modeattacking) { // Mashing reduces your chances for the good items mashed = FixedDiv((player->kartstuff[k_itemroulette])*FRACUNIT, ((TICRATE*3)+roulettestop)*FRACUNIT) - FRACUNIT; @@ -1277,7 +1268,7 @@ static void K_SpawnDashDustRelease(player_t *player) if (!P_IsObjectOnGround(player->mo)) return; - if (player->speed == 0) + if (!player->speed && !player->kartstuff[k_startboost]) return; travelangle = player->mo->angle; @@ -1805,11 +1796,20 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, boolean trapitem K_CalculateBattleWanted(); } + if (!player->kartstuff[k_bumper]) + { + player->kartstuff[k_comebacktimer] = comebacktime; + if (player->kartstuff[k_comebackmode] == 2) + { + mobj_t *poof = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_EXPLODE); + S_StartSound(poof, mobjinfo[MT_KARMAHITBOX].seesound); + player->kartstuff[k_comebackmode] = 0; + } + } + K_CheckBumpers(); } - player->kartstuff[k_comebacktimer] = comebacktime; - player->kartstuff[k_spinouttype] = type; if (player->kartstuff[k_spinouttype] <= 0) @@ -1887,11 +1887,20 @@ void K_SquishPlayer(player_t *player, mobj_t *source) K_CalculateBattleWanted(); } + if (!player->kartstuff[k_bumper]) + { + player->kartstuff[k_comebacktimer] = comebacktime; + if (player->kartstuff[k_comebackmode] == 2) + { + mobj_t *poof = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_EXPLODE); + S_StartSound(poof, mobjinfo[MT_KARMAHITBOX].seesound); + player->kartstuff[k_comebackmode] = 0; + } + } + K_CheckBumpers(); } - player->kartstuff[k_comebacktimer] = comebacktime; - player->kartstuff[k_squishedtimer] = 2*TICRATE; player->powers[pw_flashing] = K_GetKartFlashing(player); @@ -1933,6 +1942,9 @@ void K_ExplodePlayer(player_t *player, mobj_t *source) // A bit of a hack, we ju return; } + if (source && source != player->mo && source->player) + K_PlayHitEmSound(source); + player->mo->momz = 18*(mapheaderinfo[gamemap-1]->mobj_scale); player->mo->momx = player->mo->momy = 0; @@ -1963,11 +1975,20 @@ void K_ExplodePlayer(player_t *player, mobj_t *source) // A bit of a hack, we ju K_CalculateBattleWanted(); } + if (!player->kartstuff[k_bumper]) + { + player->kartstuff[k_comebacktimer] = comebacktime; + if (player->kartstuff[k_comebackmode] == 2) + { + mobj_t *poof = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_EXPLODE); + S_StartSound(poof, mobjinfo[MT_KARMAHITBOX].seesound); + player->kartstuff[k_comebackmode] = 0; + } + } + K_CheckBumpers(); } - player->kartstuff[k_comebacktimer] = comebacktime; - player->kartstuff[k_spinouttype] = 1; player->kartstuff[k_spinouttimer] = 2*TICRATE+(TICRATE/2); @@ -2177,6 +2198,7 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color) dust->angle = (ANGLE_180/16) * i; P_SetScale(dust, source->scale); dust->destscale = source->scale*10; + dust->scalespeed = FixedMul(dust->scalespeed, source->scale); P_InstaThrust(dust, dust->angle, FixedMul(20*FRACUNIT, source->scale)); truc = P_SpawnMobj(source->x + P_RandomRange(-radius, radius)*FRACUNIT, @@ -2184,6 +2206,7 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color) source->z + P_RandomRange(0, height)*FRACUNIT, MT_BOOMEXPLODE); P_SetScale(truc, source->scale); truc->destscale = source->scale*6; + truc->scalespeed = FixedMul(truc->scalespeed, source->scale); speed = FixedMul(10*FRACUNIT, source->scale)>>FRACBITS; truc->momx = P_RandomRange(-speed, speed)*FRACUNIT; truc->momy = P_RandomRange(-speed, speed)*FRACUNIT; @@ -2199,6 +2222,7 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color) source->z + P_RandomRange(0, height)*FRACUNIT, MT_SMOKE); P_SetScale(dust, source->scale); dust->destscale = source->scale*10; + dust->scalespeed = FixedMul(dust->scalespeed, source->scale); dust->tics = 30; dust->momz = P_RandomRange(FixedMul(3*FRACUNIT, source->scale)>>FRACBITS, FixedMul(7*FRACUNIT, source->scale)>>FRACBITS)*FRACUNIT; @@ -2207,6 +2231,7 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color) source->z + P_RandomRange(0, height)*FRACUNIT, MT_BOOMPARTICLE); P_SetScale(truc, source->scale); truc->destscale = source->scale*5; + truc->scalespeed = FixedMul(truc->scalespeed, source->scale); speed = FixedMul(20*FRACUNIT, source->scale)>>FRACBITS; truc->momx = P_RandomRange(-speed, speed)*FRACUNIT; truc->momy = P_RandomRange(-speed, speed)*FRACUNIT; @@ -2531,7 +2556,7 @@ void K_SpawnWipeoutTrail(mobj_t *mo, boolean translucent) I_Assert(mo != NULL); I_Assert(!P_MobjWasRemoved(mo)); - dust = P_SpawnMobj(mo->x + (P_RandomRange(-25,25)<y + (P_RandomRange(-25,25)<z, MT_WIPEOUTTRAIL); + dust = P_SpawnMobj(mo->x + (P_RandomRange(-25,25) * mo->scale), mo->y + (P_RandomRange(-25,25) * mo->scale), mo->z, MT_WIPEOUTTRAIL); P_SetTarget(&dust->target, mo); dust->angle = R_PointToAngle2(0,0,mo->momx,mo->momy); @@ -2600,45 +2625,17 @@ void K_DriftDustHandling(mobj_t *spawner) { dust->z += spawner->height - dust->height; } - dust->momx = FixedMul(spawner->momx + (P_RandomRange(-speedrange, speedrange)<momy = FixedMul(spawner->momy + (P_RandomRange(-speedrange, speedrange)<momz = P_MobjFlip(spawner) * P_RandomRange(1, 4)<momx = FixedMul(spawner->momx + (P_RandomRange(-speedrange, speedrange)<scale)/4); + dust->momy = FixedMul(spawner->momy + (P_RandomRange(-speedrange, speedrange)<scale)/4); + dust->momz = P_MobjFlip(spawner) * (P_RandomRange(1, 4) * (spawner->scale)); P_SetScale(dust, spawner->scale/2); dust->destscale = spawner->scale * 3; + dust->scalespeed = FixedMul(dust->scalespeed, spawner->scale); if (leveltime % 6 == 0) S_StartSound(spawner, sfx_screec); - // Now time for a bunch of flag shit, groooooaann... - if (spawner->flags2 & MF2_DONTDRAW) - dust->flags2 |= MF2_DONTDRAW; - else - dust->flags2 &= ~MF2_DONTDRAW; - - if (spawner->eflags & MFE_VERTICALFLIP) - dust->eflags |= MFE_VERTICALFLIP; - else - dust->eflags &= ~MFE_VERTICALFLIP; - - if (spawner->eflags & MFE_DRAWONLYFORP1) - dust->eflags |= MFE_DRAWONLYFORP1; - else - dust->eflags &= ~MFE_DRAWONLYFORP1; - - if (spawner->eflags & MFE_DRAWONLYFORP2) - dust->eflags |= MFE_DRAWONLYFORP2; - else - dust->eflags &= ~MFE_DRAWONLYFORP2; - - if (spawner->eflags & MFE_DRAWONLYFORP3) - dust->eflags |= MFE_DRAWONLYFORP3; - else - dust->eflags &= ~MFE_DRAWONLYFORP3; - - if (spawner->eflags & MFE_DRAWONLYFORP4) - dust->eflags |= MFE_DRAWONLYFORP4; - else - dust->eflags &= ~MFE_DRAWONLYFORP4; + K_MatchGenericExtraFlags(dust, spawner); } } @@ -2850,24 +2847,25 @@ static void K_DoThunderShield(player_t *player) int i = 0; fixed_t sx; fixed_t sy; - + angle_t an; + S_StartSound(player->mo, sfx_zio3); //player->kartstuff[k_thunderanim] = 35; P_NukeEnemies(player->mo, player->mo, RING_DIST/4); - + // spawn vertical bolt mo = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_THOK); P_SetTarget(&mo->target, player->mo); P_SetMobjState(mo, S_LZIO11); mo->color = SKINCOLOR_TEAL; mo->scale = player->mo->scale*3 + (player->mo->scale/2); - + mo = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_THOK); P_SetTarget(&mo->target, player->mo); P_SetMobjState(mo, S_LZIO21); mo->color = SKINCOLOR_CYAN; mo->scale = player->mo->scale*3 + (player->mo->scale/2); - + // spawn horizontal bolts; for (i=0; i<7; i++) { @@ -2877,9 +2875,9 @@ static void K_DoThunderShield(player_t *player) P_SetTarget(&mo->target, player->mo); P_SetMobjState(mo, S_KLIT1); } - - // spawn the radius thing: - angle_t an = ANGLE_22h; + + // spawn the radius thing: + an = ANGLE_22h; for (i=0; i<15; i++) { sx = player->mo->x + FixedMul((player->mo->scale*THUNDERRADIUS), FINECOSINE((an*i)>>ANGLETOFINESHIFT)); @@ -2974,7 +2972,10 @@ void K_DoSneaker(player_t *player, boolean doPFlag) const fixed_t prevboost = player->kartstuff[k_speedboost]; if (!player->kartstuff[k_floorboost] || player->kartstuff[k_floorboost] == 3) + { S_StartSound(player->mo, sfx_cdfm01); + K_SpawnDashDustRelease(player); + } if (!player->kartstuff[k_sneakertimer]) { @@ -2985,7 +2986,6 @@ void K_DoSneaker(player_t *player, boolean doPFlag) } player->kartstuff[k_sneakertimer] = sneakertime; - K_SpawnDashDustRelease(player); if (doPFlag) { @@ -3016,7 +3016,7 @@ static void K_DoShrink(player_t *player) } } -static void K_DoSPB(player_t *victim, player_t *source) +static void K_DoSPB(player_t *victim) { //INT32 i; S_StartSound(victim->mo, sfx_bkpoof); // Sound the BANG! @@ -3027,11 +3027,28 @@ static void K_DoSPB(player_t *victim, player_t *source) P_FlashPal(&players[i], PAL_NUKE, 10); }*/ - if (victim->mo && !victim->spectator) - P_DamageMobj(victim->mo, source->mo, source->mo, 65); + if (!victim->mo || !victim->mo->health || victim->spectator) + return; + + { + mobj_t *spbexplode; + + if (!victim->kartstuff[k_invincibilitytimer] && !victim->kartstuff[k_growshrinktimer]) + { + K_DropHnextList(victim); + K_StripItems(victim); + + victim->powers[pw_flashing] = 0; + } + + spbexplode = P_SpawnMobj(victim->mo->x, victim->mo->y, victim->mo->z, MT_BLUEEXPLOSION); + + if (playeringame[spbplayer] && !players[spbplayer].spectator && players[spbplayer].mo) + P_SetTarget(&spbexplode->target, players[spbplayer].mo); + } } -void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, boolean mute) +void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound) { const fixed_t vscale = mapheaderinfo[gamemap-1]->mobj_scale + (mo->scale - mapheaderinfo[gamemap-1]->mobj_scale); @@ -3083,8 +3100,8 @@ void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, boolean mute) else mo->momz = FixedMul(vertispeed, vscale); - if (!mute) - S_StartSound(mo, sfx_kpogos); + if (sound) + S_StartSound(mo, (sound == 1 ? sfx_kc2f : sfx_kpogos)); } void K_KillBananaChain(mobj_t *banana, mobj_t *inflictor, mobj_t *source) @@ -3140,7 +3157,7 @@ void K_DropHnextList(player_t *player) mobj_t *work = player->mo, *nextwork, *dropwork; INT32 flip; mobjtype_t type; - boolean orbit, ponground; + boolean orbit, ponground, dropall = true; if (!work) return; @@ -3180,6 +3197,7 @@ void K_DropHnextList(player_t *player) break; case MT_SSMINE_SHIELD: orbit = false; + dropall = false; type = MT_SSMINE; break; case MT_FAKESHIELD: @@ -3258,7 +3276,8 @@ void K_DropHnextList(player_t *player) player->kartstuff[k_bananadrag] = 0; if (player->kartstuff[k_eggmanheld]) player->kartstuff[k_eggmanheld] = 0; - else if (player->kartstuff[k_itemheld]) + else if (player->kartstuff[k_itemheld] + && (dropall || (--player->kartstuff[k_itemamount] <= 0))) { player->kartstuff[k_itemamount] = player->kartstuff[k_itemheld] = 0; player->kartstuff[k_itemtype] = KITEM_NONE; @@ -3627,6 +3646,92 @@ player_t *K_FindJawzTarget(mobj_t *actor, player_t *source) return wtarg; } +// Engine Sounds. +static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd) +{ + const INT32 numsnds = 13; + INT32 class = ((player->kartspeed-1)/3) + (3*((player->kartweight-1)/3)); // engine class number + UINT8 volume = 255; + fixed_t volumedampen = 0; + INT32 targetsnd = 0; + INT32 i; + + // Silence the engines + if (leveltime < 8 || player->spectator || player->exiting) + { + player->kartstuff[k_enginesnd] = 0; // Reset sound number + return; + } + +#if 0 + if ((leveltime % 8) != ((player-players) % 8)) // Per-player offset, to make engines sound distinct! +#else + if (leveltime % 8) // .25 seconds of wait time between engine sounds +#endif + return; + + if ((leveltime >= starttime-(2*TICRATE) && leveltime <= starttime) || (player->kartstuff[k_respawn] == 1)) // Startup boosts + targetsnd = ((cmd->buttons & BT_ACCELERATE) ? 12 : 0); + else + targetsnd = (((6*cmd->forwardmove)/25) + ((player->speed / mapheaderinfo[gamemap-1]->mobj_scale)/5))/2; + + if (targetsnd < 0) + targetsnd = 0; + if (targetsnd > 12) + targetsnd = 12; + + if (player->kartstuff[k_enginesnd] < targetsnd) + player->kartstuff[k_enginesnd]++; + if (player->kartstuff[k_enginesnd] > targetsnd) + player->kartstuff[k_enginesnd]--; + + if (player->kartstuff[k_enginesnd] < 0) + player->kartstuff[k_enginesnd] = 0; + if (player->kartstuff[k_enginesnd] > 12) + player->kartstuff[k_enginesnd] = 12; + + for (i = 0; i < MAXPLAYERS; i++) + { + UINT8 thisvol = 0; + fixed_t dist; + + if (!playeringame[i] || !players[i].mo || players[i].spectator || players[i].exiting) + continue; + + if ((i == displayplayer) + || (i == secondarydisplayplayer && splitscreen) + || (i == thirddisplayplayer && splitscreen > 1) + || (i == fourthdisplayplayer && splitscreen > 2)) + { + volumedampen += FRACUNIT; // We already know what this is gonna be, let's not waste our time. + continue; + } + + dist = P_AproxDistance(P_AproxDistance(player->mo->x-players[i].mo->x, + player->mo->y-players[i].mo->y), player->mo->z-players[i].mo->z) / 2; + + if (dist > 1536<>FRACBITS)) / (((1536<>(FRACBITS+4)); + + if (thisvol == 0) + continue; + + volumedampen += (thisvol * 257); // 255 * 257 = FRACUNIT + } + + if (volumedampen > FRACUNIT) + volume = FixedDiv(volume<>FRACBITS; + + if (volume <= 0) // Might as well + return; + + S_StartSoundAtVolume(player->mo, (sfx_krta00 + player->kartstuff[k_enginesnd]) + (class*numsnds), volume); +} + /** \brief Decreases various kart timers and powers per frame. Called in P_PlayerThink in p_user.c \param player player object passed from P_PlayerThink @@ -3637,14 +3742,15 @@ player_t *K_FindJawzTarget(mobj_t *actor, player_t *source) void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) { K_UpdateOffroad(player); + K_UpdateEngineSounds(player, cmd); K_GetKartBoostPower(player); // Speed lines if ((player->kartstuff[k_sneakertimer] || player->kartstuff[k_driftboost] || player->kartstuff[k_startboost]) && player->speed > 0) { - mobj_t *fast = P_SpawnMobj(player->mo->x + (P_RandomRange(-36,36)<mo->y + (P_RandomRange(-36,36)<mo->z + (player->mo->height/2) + (P_RandomRange(-20,20)<mo->x + (P_RandomRange(-36,36) * player->mo->scale), + player->mo->y + (P_RandomRange(-36,36) * player->mo->scale), + player->mo->z + (player->mo->height/2) + (P_RandomRange(-20,20) * player->mo->scale), MT_FASTLINE); fast->angle = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); fast->momx = 3*player->mo->momx/4; @@ -3820,7 +3926,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if (player->kartstuff[k_deathsentence]) { if (player->kartstuff[k_deathsentence] == 1) - K_DoSPB(player, &players[spbplayer]); + K_DoSPB(player); player->kartstuff[k_deathsentence]--; } @@ -4113,7 +4219,8 @@ static void K_KartDrift(player_t *player, boolean onground) && (player->kartstuff[k_driftcharge] >= dsone && player->kartstuff[k_driftcharge] < dstwo) && onground) { - player->kartstuff[k_driftboost] = 20; + if (player->kartstuff[k_driftboost] < 20) + player->kartstuff[k_driftboost] = 20; S_StartSound(player->mo, sfx_s23c); //K_SpawnDashDustRelease(player); player->kartstuff[k_driftcharge] = 0; @@ -4123,7 +4230,8 @@ static void K_KartDrift(player_t *player, boolean onground) && player->kartstuff[k_driftcharge] < dsthree && onground) { - player->kartstuff[k_driftboost] = 50; + if (player->kartstuff[k_driftboost] < 50) + player->kartstuff[k_driftboost] = 50; S_StartSound(player->mo, sfx_s23c); //K_SpawnDashDustRelease(player); player->kartstuff[k_driftcharge] = 0; @@ -4133,7 +4241,8 @@ static void K_KartDrift(player_t *player, boolean onground) && player->kartstuff[k_driftcharge] >= dsthree && onground) { - player->kartstuff[k_driftboost] = 125; + if (player->kartstuff[k_driftboost] < 125) + player->kartstuff[k_driftboost] = 125; S_StartSound(player->mo, sfx_s23c); //K_SpawnDashDustRelease(player); player->kartstuff[k_driftcharge] = 0; @@ -4235,7 +4344,6 @@ static void K_KartUpdatePosition(player_t *player) fixed_t oldposition = player->kartstuff[k_position]; fixed_t i, ppcd, pncd, ipcd, incd; fixed_t pmo, imo; - thinker_t *th; mobj_t *mo; if (player->spectator || !player->mo) @@ -4260,16 +4368,8 @@ static void K_KartUpdatePosition(player_t *player) player->kartstuff[k_nextcheck] = players[i].kartstuff[k_nextcheck] = 0; // This checks every thing on the map, and looks for MT_BOSS3WAYPOINT (the thing we're using for checkpoint wp's, for now) - for (th = thinkercap.next; th != &thinkercap; th = th->next) + for (mo = waypointcap; mo != NULL; mo = mo->tracer) { - if (th->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj at all, shoo - continue; - - mo = (mobj_t *)th; - - if (mo->type != MT_BOSS3WAYPOINT) // TODO: Change to 'MT_WAYPOINT'? - continue; - pmo = P_AproxDistance(P_AproxDistance( mo->x - player->mo->x, mo->y - player->mo->y), mo->z - player->mo->z) / FRACUNIT; @@ -4387,8 +4487,11 @@ void K_StripOther(player_t *player) player->kartstuff[k_invincibilitytimer] = 0; player->kartstuff[k_growshrinktimer] = 0; - player->kartstuff[k_eggmanexplode] = 0; - player->kartstuff[k_eggmanblame] = 0; + if (player->kartstuff[k_eggmanexplode]) + { + player->kartstuff[k_eggmanexplode] = 0; + player->kartstuff[k_eggmanblame] = -1; + } } // @@ -4433,14 +4536,29 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { mobj_t *newitem; + if (player->kartstuff[k_comebackmode] == 1) + { + newitem = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_RANDOMITEM); + newitem->threshold = 69; // selected "randomly". + } + else + { + newitem = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_FAKEITEM); + if (player->kartstuff[k_eggmanblame] >= 0 + && player->kartstuff[k_eggmanblame] < MAXPLAYERS + && playeringame[player->kartstuff[k_eggmanblame]] + && !players[player->kartstuff[k_eggmanblame]].spectator + && players[player->kartstuff[k_eggmanblame]].mo) + P_SetTarget(&newitem->target, players[player->kartstuff[k_eggmanblame]].mo); + player->kartstuff[k_eggmanblame] = -1; + } + + newitem->flags2 = (player->mo->flags2 & MF2_OBJECTFLIP); + newitem->fuse = 15*TICRATE; // selected randomly. + player->kartstuff[k_comebackmode] = 0; player->kartstuff[k_comebacktimer] = comebacktime; S_StartSound(player->mo, sfx_s254); - - newitem = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_RANDOMITEM); - newitem->flags2 = (player->mo->flags2 & MF2_OBJECTFLIP); - newitem->fuse = 15*TICRATE; // selected randomly. - newitem->threshold = 69; // selected "randomly". } // Eggman Monitor exploding else if (player->kartstuff[k_eggmanexplode]) @@ -4775,7 +4893,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) && !player->kartstuff[k_pogospring]) { K_PlayBoostTaunt(player->mo); - K_DoPogoSpring(player->mo, 32<mo, 32<kartstuff[k_pogospring] = 1; player->kartstuff[k_itemamount]--; } @@ -5926,7 +6044,7 @@ static void K_drawKartItem(void) // Quick Eggman numbers if (stplyr->kartstuff[k_eggmanexplode] > 1 /*&& stplyr->kartstuff[k_eggmanexplode] <= 3*TICRATE*/) - V_DrawScaledPatch(ITEM_X+17, ITEM_Y+13, V_HUDTRANS|splitflags, kp_eggnum[min(3, G_TicsToSeconds(stplyr->kartstuff[k_eggmanexplode]))]); + V_DrawScaledPatch(ITEM_X+17, ITEM_Y+13-offset, V_HUDTRANS|splitflags, kp_eggnum[min(3, G_TicsToSeconds(stplyr->kartstuff[k_eggmanexplode]))]); } void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, boolean playing) @@ -7222,7 +7340,7 @@ static void K_drawDistributionDebugger(void) if (stplyr != &players[displayplayer]) // only for p1 return; - // The only code duplication from the Kart, just to avoid the actual item function from calculating pingame twice + // The only code duplication from the Kart, just to avoid the actual item function from calculating pingame twice for (i = 0; i < MAXPLAYERS; i++) { if (!playeringame[i] || players[i].spectator) diff --git a/src/k_kart.h b/src/k_kart.h index 7c37ef67..7cab42a5 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -37,7 +37,7 @@ void K_SpawnSparkleTrail(mobj_t *mo); void K_SpawnWipeoutTrail(mobj_t *mo, boolean translucent); void K_DriftDustHandling(mobj_t *spawner); void K_DoSneaker(player_t *player, boolean doPFlag); -void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, boolean mute); +void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound); void K_KillBananaChain(mobj_t *banana, mobj_t *inflictor, mobj_t *source); void K_UpdateHnextList(player_t *player, boolean clean); void K_DropHnextList(player_t *player); diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 7c44c796..240db71c 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -92,9 +92,10 @@ static int lib_print(lua_State *L) static int lib_chatprint(lua_State *L) { const char *str = luaL_checkstring(L, 1); // retrieve string + int len; if (str == NULL) // error if we don't have a string! return luaL_error(L, LUA_QL("tostring") " must return a string to " LUA_QL("chatprint")); - int len = strlen(str); + len = strlen(str); if (len > 255) // string is too long!!! return luaL_error(L, "String exceeds the 255 characters limit of the chat buffer."); @@ -113,19 +114,21 @@ static int lib_chatprintf(lua_State *L) { int n = lua_gettop(L); /* number of arguments */ player_t *plr; + const char *str; + int len; if (n < 2) return luaL_error(L, "chatprintf requires at least two arguments: player and text."); - + plr = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); // retrieve player if (!plr) return LUA_ErrInvalid(L, "player_t"); if (plr != &players[consoleplayer]) return 0; - - const char *str = luaL_checkstring(L, 2); // retrieve string + + str = luaL_checkstring(L, 2); // retrieve string if (str == NULL) // error if we don't have a string! return luaL_error(L, LUA_QL("tostring") " must return a string to " LUA_QL("chatprintf")); - int len = strlen(str); + len = strlen(str); if (len > 255) // string is too long!!! return luaL_error(L, "String exceeds the 255 characters limit of the chat buffer."); @@ -2231,11 +2234,11 @@ static int lib_kDoPogoSpring(lua_State *L) { mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); fixed_t vertispeed = luaL_checkfixed(L, 2); - boolean mute = luaL_checkboolean(L, 3); + UINT8 sound = luaL_checkinteger(L, 3); NOHUD if (!mo) return LUA_ErrInvalid(L, "mobj_t"); - K_DoPogoSpring(mo, vertispeed, mute); + K_DoPogoSpring(mo, vertispeed, sound); return 0; } diff --git a/src/lua_maplib.c b/src/lua_maplib.c index c8ff4e28..8deb5abf 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -327,6 +327,7 @@ static int sector_get(lua_State *L) { sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR)); enum sector_e field = luaL_checkoption(L, 2, sector_opt[0], sector_opt); + INT16 i; if (!sector) { @@ -349,11 +350,23 @@ static int sector_get(lua_State *L) lua_pushfixed(L, sector->ceilingheight); return 1; case sector_floorpic: // floorpic - lua_pushlstring(L, levelflats[sector->floorpic].name, 8); + { + levelflat_t *levelflat = &levelflats[sector->floorpic]; + for (i = 0; i < 8; i++) + if (!levelflat->name[i]) + break; + lua_pushlstring(L, levelflat->name, i); return 1; + } case sector_ceilingpic: // ceilingpic - lua_pushlstring(L, levelflats[sector->ceilingpic].name, 8); + { + levelflat_t *levelflat = &levelflats[sector->ceilingpic]; + for (i = 0; i < 8; i++) + if (!levelflat->name[i]) + break; + lua_pushlstring(L, levelflat->name, i); return 1; + } case sector_lightlevel: lua_pushinteger(L, sector->lightlevel); return 1; diff --git a/src/lua_script.c b/src/lua_script.c index d8755ff6..01316c5d 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -182,19 +182,21 @@ void LUA_LoadLump(UINT16 wad, UINT16 lump) { MYFILE f; char *name; + size_t len; f.wad = wad; f.size = W_LumpLengthPwad(wad, lump); f.data = Z_Malloc(f.size, PU_LUA, NULL); W_ReadLumpPwad(wad, lump, f.data); f.curpos = f.data; - name = malloc(strlen(wadfiles[wad]->filename)+10); + len = strlen(wadfiles[wad]->filename); + name = malloc(len+10); strcpy(name, wadfiles[wad]->filename); - if (!fasticmp(&name[strlen(name) - 4], ".lua")) { + if (!fasticmp(&name[len - 4], ".lua")) { // If it's not a .lua file, copy the lump name in too. - name[strlen(wadfiles[wad]->filename)] = '|'; - M_Memcpy(name+strlen(wadfiles[wad]->filename)+1, wadfiles[wad]->lumpinfo[lump].name, 8); - name[strlen(wadfiles[wad]->filename)+9] = '\0'; + name[len] = '|'; + M_Memcpy(name+len+1, wadfiles[wad]->lumpinfo[lump].name, 8); + name[len+9] = '\0'; } LUA_LoadFile(&f, name); diff --git a/src/m_anigif.c b/src/m_anigif.c index 2540665a..e2af7009 100644 --- a/src/m_anigif.c +++ b/src/m_anigif.c @@ -492,7 +492,9 @@ static void GIF_framewrite(void) // screen regions are handled in GIF_lzw { - UINT16 delay = 3; // todo + int d1 = (int)((100.0/NEWTICRATE)*(gif_frames+1)); + int d2 = (int)((100.0/NEWTICRATE)*(gif_frames)); + UINT16 delay = d1-d2; INT32 startline; WRITEMEM(p, gifframe_gchead, 4); diff --git a/src/m_cheat.c b/src/m_cheat.c index 99b96d99..e57a85ae 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -377,7 +377,7 @@ void Command_Hurtme_f(void) } // Moves the NiGHTS player to another axis within the current mare -void Command_JumpToAxis_f(void) +/*void Command_JumpToAxis_f(void) { REQUIRE_DEVMODE; REQUIRE_INLEVEL; @@ -438,7 +438,7 @@ void Command_Charspeed_f(void) players[consoleplayer].actionspd = atoi(COM_Argv(2))< : set character speed\n")); -} +}*/ void Command_RTeleport_f(void) { @@ -683,7 +683,7 @@ void Command_Savecheckpoint_f(void) } // Like M_GetAllEmeralds() but for console devmode junkies. -void Command_Getallemeralds_f(void) +/*void Command_Getallemeralds_f(void) { REQUIRE_SINGLEPLAYER; REQUIRE_NOULTIMATE; @@ -702,7 +702,7 @@ void Command_Resetemeralds_f(void) emeralds = 0; CONS_Printf(M_GetText("Emeralds reset to zero.\n")); -} +}*/ void Command_Devmode_f(void) { @@ -730,7 +730,7 @@ void Command_Devmode_f(void) G_SetGameModified(multiplayer); } -void Command_Setrings_f(void) +/*void Command_Setrings_f(void) { REQUIRE_INLEVEL; REQUIRE_SINGLEPLAYER; @@ -785,7 +785,7 @@ void Command_Setcontinues_f(void) G_SetGameModified(multiplayer); } -} +}*/ // // OBJECTPLACE (and related variables) diff --git a/src/m_cheat.h b/src/m_cheat.h index 951c7a16..3b5a1d0f 100644 --- a/src/m_cheat.h +++ b/src/m_cheat.h @@ -48,18 +48,18 @@ void Command_CheatNoClip_f(void); void Command_CheatGod_f(void); void Command_CheatNoTarget_f(void); void Command_Savecheckpoint_f(void); -void Command_Getallemeralds_f(void); +/*void Command_Getallemeralds_f(void); void Command_Resetemeralds_f(void); void Command_Setrings_f(void); void Command_Setlives_f(void); -void Command_Setcontinues_f(void); +void Command_Setcontinues_f(void);*/ void Command_Devmode_f(void); void Command_Scale_f(void); void Command_Gravflip_f(void); void Command_Hurtme_f(void); -void Command_JumpToAxis_f(void); +/*void Command_JumpToAxis_f(void); void Command_Charability_f(void); -void Command_Charspeed_f(void); +void Command_Charspeed_f(void);*/ void Command_Teleport_f(void); void Command_RTeleport_f(void); void Command_Skynum_f(void); diff --git a/src/m_cond.c b/src/m_cond.c index 63f88cb6..80b86331 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -102,8 +102,9 @@ unlockable_t unlockables[MAXUNLOCKABLES] = /* 03 */ {"Chao Cup", "", -1, 3, SECRET_NONE, 0, false, false, 0}, /* 04 */ {"Encore Mode", "", 3, 4, SECRET_ENCORE, 0, false, false, 0}, + /* 05 */ {"Hell Attack", "", 5, 5, SECRET_HELLATTACK, 0, false, false, 0}, - /* 05 */ {"Record Attack", "", -1, -1, SECRET_RECORDATTACK, 0, true, true, 0}, + /* 06 */ {"Record Attack", "", -1, -1, SECRET_RECORDATTACK, 0, true, true, 0}, }; // Default number of emblems and extra emblems @@ -127,10 +128,13 @@ void M_SetupDefaultConditionSets(void) M_AddRawCondition(3, 1, UC_TOTALEMBLEMS, 30, 0, 0); M_AddRawCondition(3, 2, UC_MATCHESPLAYED, 50, 0, 0); - // -- 4: Collect 50 emblems OR play 150 matches - M_AddRawCondition(4, 1, UC_TOTALEMBLEMS, 50, 0, 0); + // -- 4: Collect 40 emblems OR play 150 matches + M_AddRawCondition(4, 1, UC_TOTALEMBLEMS, 40, 0, 0); M_AddRawCondition(4, 2, UC_MATCHESPLAYED, 150, 0, 0); + // -- 5: Collect 50 emblems ONLY + M_AddRawCondition(5, 1, UC_TOTALEMBLEMS, 50, 0, 0); + // -- 10: Play 100 matches M_AddRawCondition(10, 1, UC_MATCHESPLAYED, 100, 0, 0); } diff --git a/src/m_cond.h b/src/m_cond.h index 5c8762ad..81b6803c 100644 --- a/src/m_cond.h +++ b/src/m_cond.h @@ -125,6 +125,7 @@ typedef struct #define SECRET_SOUNDTEST 3 // Sound Test #define SECRET_CREDITS 4 // Enables Credits #define SECRET_ENCORE 5 // Enables Encore mode cvar +#define SECRET_HELLATTACK 6 // Map Hell in record attack // If you have more secrets than these variables allow in your game, // you seriously need to get a life. diff --git a/src/m_menu.c b/src/m_menu.c index 5d0448ce..2f848a2a 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -288,8 +288,7 @@ static void M_SetupMultiPlayer4(INT32 choice); // Options // Split into multiple parts due to size // Controls -menu_t OP_ControlsDef, /*OP_ControlListDef,*/ OP_MoveControlsDef; -menu_t /*OP_MPControlsDef, OP_CameraControlsDef, OP_MiscControlsDef,*/ OP_CustomControlsDef, OP_SpectateControlsDef; +menu_t OP_ControlsDef, OP_AllControlsDef; menu_t OP_MouseOptionsDef, OP_Mouse2OptionsDef; menu_t OP_Joystick1Def, OP_Joystick2Def; #ifndef NOFOURPLAYER @@ -663,7 +662,8 @@ static menuitem_t MISC_HelpMenu[] = {IT_KEYHANDLER | IT_NOTHING, NULL, "MANUAL09", M_HandleImageDef, 1}, {IT_KEYHANDLER | IT_NOTHING, NULL, "MANUAL10", M_HandleImageDef, 1}, {IT_KEYHANDLER | IT_NOTHING, NULL, "MANUAL11", M_HandleImageDef, 1}, - {IT_KEYHANDLER | IT_NOTHING, NULL, "MANUAL12", M_HandleImageDef, 0}, + {IT_KEYHANDLER | IT_NOTHING, NULL, "MANUAL12", M_HandleImageDef, 1}, + {IT_KEYHANDLER | IT_NOTHING, NULL, "MANUAL99", M_HandleImageDef, 0}, }; // -------------------------------- @@ -1112,88 +1112,47 @@ static menuitem_t OP_ControlsMenu[] = #endif }; -static menuitem_t OP_MoveControlsMenu[] = +static menuitem_t OP_AllControlsMenu[] = { - {IT_CONTROL, NULL, "Accelerate", M_ChangeControl, gc_accelerate }, - {IT_CONTROL, NULL, "Turn Left", M_ChangeControl, gc_turnleft }, - {IT_CONTROL, NULL, "Turn Right", M_ChangeControl, gc_turnright }, - {IT_CONTROL, NULL, "Drift", M_ChangeControl, gc_drift }, - {IT_CONTROL, NULL, "Brake", M_ChangeControl, gc_brake }, - {IT_CONTROL, NULL, "Use/Throw Item", M_ChangeControl, gc_fire }, - {IT_CONTROL, NULL, "Aim Forward", M_ChangeControl, gc_aimforward }, - {IT_CONTROL, NULL, "Aim Backward", M_ChangeControl, gc_aimbackward}, - {IT_CONTROL, NULL, "Look Backward", M_ChangeControl, gc_lookback }, - - {IT_SPACE, NULL, "", NULL, 76}, - {IT_CONTROL, NULL, "Talk key", M_ChangeControl, gc_talkkey }, - //{IT_CONTROL, NULL, "Team-Talk key", M_ChangeControl, gc_teamkey }, - {IT_CONTROL, NULL, "Rankings/Scores", M_ChangeControl, gc_scores }, - {IT_CONTROL, NULL, "Open/Close Menu (ESC)", M_ChangeControl, gc_systemmenu}, - {IT_CONTROL, NULL, "Pause", M_ChangeControl, gc_pause }, - {IT_CONTROL, NULL, "Console", M_ChangeControl, gc_console }, - - {IT_SUBMENU | IT_STRING, NULL, "Gamepad Options...", &OP_Joystick1Def, 120}, - {IT_SUBMENU | IT_STRING, NULL, "Spectator Controls...", &OP_SpectateControlsDef, 128}, - {IT_SUBMENU | IT_STRING, NULL, "Custom Lua Actions...", &OP_CustomControlsDef, 136}, + {IT_SUBMENU|IT_STRING, NULL, "Gamepad Options...", &OP_Joystick1Def, 0}, + //{IT_SPACE, NULL, NULL, NULL, 0}, + {IT_HEADER, NULL, "Gameplay Controls", NULL, 0}, + {IT_SPACE, NULL, NULL, NULL, 0}, + {IT_CONTROL, NULL, "Accelerate", M_ChangeControl, gc_accelerate }, + {IT_CONTROL, NULL, "Turn Left", M_ChangeControl, gc_turnleft }, + {IT_CONTROL, NULL, "Turn Right", M_ChangeControl, gc_turnright }, + {IT_CONTROL, NULL, "Drift", M_ChangeControl, gc_drift }, + {IT_CONTROL, NULL, "Brake", M_ChangeControl, gc_brake }, + {IT_CONTROL, NULL, "Use/Throw Item", M_ChangeControl, gc_fire }, + {IT_CONTROL, NULL, "Aim Forward", M_ChangeControl, gc_aimforward }, + {IT_CONTROL, NULL, "Aim Backward", M_ChangeControl, gc_aimbackward}, + {IT_CONTROL, NULL, "Look Backward", M_ChangeControl, gc_lookback }, + {IT_HEADER, NULL, "Miscelleanous Controls", NULL, 0}, + {IT_SPACE, NULL, NULL, NULL, 0}, + {IT_CONTROL, NULL, "Chat", M_ChangeControl, gc_talkkey }, + //{IT_CONTROL, NULL, "Team Chat", M_ChangeControl, gc_teamkey }, + {IT_CONTROL, NULL, "Show Rankings", M_ChangeControl, gc_scores }, + {IT_CONTROL, NULL, "Change Viewpoint", M_ChangeControl, gc_viewpoint }, + {IT_CONTROL, NULL, "Reset Camera", M_ChangeControl, gc_camreset }, + {IT_CONTROL, NULL, "Toggle First-Person", M_ChangeControl, gc_camtoggle }, + {IT_CONTROL, NULL, "Pause", M_ChangeControl, gc_pause }, + {IT_CONTROL, NULL, "Screenshot", M_ChangeControl, gc_screenshot }, + {IT_CONTROL, NULL, "Toggle GIF Recording", M_ChangeControl, gc_recordgif }, + {IT_CONTROL, NULL, "Open/Close Menu (ESC)", M_ChangeControl, gc_systemmenu }, + {IT_CONTROL, NULL, "Developer Console", M_ChangeControl, gc_console }, + {IT_HEADER, NULL, "Spectator Controls", NULL, 0}, + {IT_SPACE, NULL, NULL, NULL, 0}, + {IT_CONTROL, NULL, "Become Spectator", M_ChangeControl, gc_spectate }, + {IT_CONTROL, NULL, "Look Up", M_ChangeControl, gc_lookup }, + {IT_CONTROL, NULL, "Look Down", M_ChangeControl, gc_lookdown }, + {IT_CONTROL, NULL, "Center View", M_ChangeControl, gc_centerview }, + {IT_HEADER, NULL, "Custom Lua Actions", NULL, 0}, + {IT_SPACE, NULL, NULL, NULL, 0}, + {IT_CONTROL, NULL, "Custom Action 1", M_ChangeControl, gc_custom1 }, + {IT_CONTROL, NULL, "Custom Action 2", M_ChangeControl, gc_custom2 }, + {IT_CONTROL, NULL, "Custom Action 3", M_ChangeControl, gc_custom3 }, }; -static menuitem_t OP_SpectateControlsMenu[] = -{ - {IT_CONTROL, NULL, "Become Spectator", M_ChangeControl, gc_spectate }, - {IT_CONTROL, NULL, "Look Up", M_ChangeControl, gc_lookup }, - {IT_CONTROL, NULL, "Look Down", M_ChangeControl, gc_lookdown }, - {IT_CONTROL, NULL, "Center View", M_ChangeControl, gc_centerview}, - {IT_CONTROL, NULL, "Reset Camera", M_ChangeControl, gc_camreset }, - {IT_CONTROL, NULL, "Toggle Chasecam", M_ChangeControl, gc_camtoggle }, - - {IT_STRING | IT_CVAR, NULL, "Chasecam" , &cv_chasecam , 52}, - {IT_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair, 60}, -}; - -static menuitem_t OP_CustomControlsMenu[] = -{ - {IT_CONTROL, NULL, "Custom Action 1", M_ChangeControl, gc_custom1}, - {IT_CONTROL, NULL, "Custom Action 2", M_ChangeControl, gc_custom2}, - {IT_CONTROL, NULL, "Custom Action 3", M_ChangeControl, gc_custom3}, -}; - -// Obsolete thanks to Kart -/*static menuitem_t OP_MPControlsMenu[] = -{ -// {IT_CALL | IT_STRING2, NULL, "Next Weapon", M_ChangeControl, gc_driftleft }, -// {IT_CALL | IT_STRING2, NULL, "Prev Weapon", M_ChangeControl, gc_driftright }, -// {IT_CALL | IT_STRING2, NULL, "Weapon Slot 1", M_ChangeControl, gc_wepslot1 }, -// {IT_CALL | IT_STRING2, NULL, "Weapon Slot 2", M_ChangeControl, gc_wepslot2 }, -// {IT_CALL | IT_STRING2, NULL, "Weapon Slot 3", M_ChangeControl, gc_wepslot3 }, -// {IT_CALL | IT_STRING2, NULL, "Weapon Slot 4", M_ChangeControl, gc_wepslot4 }, -// {IT_CALL | IT_STRING2, NULL, "Weapon Slot 5", M_ChangeControl, gc_wepslot5 }, -// {IT_CALL | IT_STRING2, NULL, "Weapon Slot 6", M_ChangeControl, gc_wepslot6 }, -// {IT_CALL | IT_STRING2, NULL, "Weapon Slot 7", M_ChangeControl, gc_wepslot7 }, -}; - -static menuitem_t OP_CameraControlsMenu[] = -{ -// {IT_CALL | IT_STRING2, NULL, "Look Up", M_ChangeControl, gc_lookup }, -// {IT_CALL | IT_STRING2, NULL, "Look Down", M_ChangeControl, gc_lookdown }, -// {IT_CALL | IT_STRING2, NULL, "Center View", M_ChangeControl, gc_centerview }, -// {IT_CALL | IT_STRING2, NULL, "Mouselook", M_ChangeControl, gc_mouseaiming }, -}; - -static menuitem_t OP_MiscControlsMenu[] = -{ - {IT_CALL | IT_STRING2, NULL, "Custom Action 1", M_ChangeControl, gc_custom1 }, - {IT_CALL | IT_STRING2, NULL, "Custom Action 2", M_ChangeControl, gc_custom2 }, - {IT_CALL | IT_STRING2, NULL, "Custom Action 3", M_ChangeControl, gc_custom3 }, - - {IT_CALL | IT_STRING2, NULL, "Pause", M_ChangeControl, gc_pause }, - {IT_CALL | IT_STRING2, NULL, "Console", M_ChangeControl, gc_console }, - - {IT_CALL | IT_STRING2, NULL, "Talk key", M_ChangeControl, gc_talkkey }, - {IT_CALL | IT_STRING2, NULL, "Team-Talk key", M_ChangeControl, gc_teamkey }, - {IT_CALL | IT_STRING2, NULL, "Rankings/Scores", M_ChangeControl, gc_scores }, - {IT_CALL | IT_STRING2, NULL, "Spectate", M_ChangeControl, gc_spectate }, -};*/ - static menuitem_t OP_Joystick1Menu[] = { {IT_STRING | IT_CALL, NULL, "Select Gamepad..." , M_Setup1PJoystickMenu, 10}, @@ -1296,14 +1255,14 @@ static menuitem_t OP_VideoOptionsMenu[] = {IT_STRING | IT_CVAR, NULL, "Draw Distance", &cv_drawdist, 45}, //{IT_STRING | IT_CVAR, NULL, "NiGHTS Draw Dist", &cv_drawdist_nights, 55}, {IT_STRING | IT_CVAR, NULL, "Weather Draw Distance",&cv_drawdist_precip, 55}, - {IT_STRING | IT_CVAR, NULL, "Weather Density", &cv_precipdensity, 65}, - {IT_STRING | IT_CVAR, NULL, "Skyboxes", &cv_skybox, 75}, + //{IT_STRING | IT_CVAR, NULL, "Weather Density", &cv_precipdensity, 65}, + {IT_STRING | IT_CVAR, NULL, "Skyboxes", &cv_skybox, 65}, - {IT_STRING | IT_CVAR, NULL, "Show FPS", &cv_ticrate, 90}, - {IT_STRING | IT_CVAR, NULL, "Vertical Sync", &cv_vidwait, 100}, + {IT_STRING | IT_CVAR, NULL, "Show FPS", &cv_ticrate, 80}, + {IT_STRING | IT_CVAR, NULL, "Vertical Sync", &cv_vidwait, 90}, #ifdef HWRENDER - {IT_SUBMENU|IT_STRING, NULL, "OpenGL Options...", &OP_OpenGLOptionsDef, 115}, + {IT_SUBMENU|IT_STRING, NULL, "OpenGL Options...", &OP_OpenGLOptionsDef, 105}, #endif }; @@ -1316,7 +1275,7 @@ enum op_video_gamma, op_video_dd, op_video_wdd, - op_video_wd, + //op_video_wd, op_video_skybox, op_video_fps, op_video_vsync, @@ -1536,7 +1495,9 @@ static menuitem_t OP_ServerOptionsMenu[] = #ifndef NONET {IT_STRING | IT_CVAR, NULL, "Max. Player Count", &cv_maxplayers, 90}, {IT_STRING | IT_CVAR, NULL, "Allow Players to Join", &cv_allownewplayer, 100}, - //{IT_STRING | IT_CVAR, NULL, "Join on Map Change", &cv_joinnextround, 110}, +#ifdef VANILLAJOINNEXTROUND + {IT_STRING | IT_CVAR, NULL, "Join on Map Change", &cv_joinnextround, 110}, +#endif {IT_STRING | IT_CVAR, NULL, "Allow WAD Downloading", &cv_downloading, 110}, {IT_STRING | IT_CVAR, NULL, "Attempts to resynchronise", &cv_resynchattempts, 120}, @@ -1950,28 +1911,12 @@ menu_t OP_MainDef = }; menu_t OP_ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlsMenu, &OP_MainDef, 60, 30); -//menu_t OP_ControlListDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlListMenu, &OP_ControlsDef, 60, 30); -menu_t OP_MoveControlsDef = CONTROLMENUSTYLE(OP_MoveControlsMenu, &OP_ControlsDef); -//menu_t OP_MPControlsDef = CONTROLMENUSTYLE(OP_MPControlsMenu, &OP_ControlListDef); -//menu_t OP_CameraControlsDef = CONTROLMENUSTYLE(OP_CameraControlsMenu, &OP_ControlListDef); -//menu_t OP_MiscControlsDef = CONTROLMENUSTYLE(OP_MiscControlsMenu, &OP_ControlListDef); -menu_t OP_CustomControlsDef = CONTROLMENUSTYLE(OP_CustomControlsMenu, &OP_MoveControlsDef); -menu_t OP_SpectateControlsDef = CONTROLMENUSTYLE(OP_SpectateControlsMenu, &OP_MoveControlsDef); -/* -menu_t OP_P1ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_P1ControlsMenu, &OP_ControlsDef, 60, 30); -menu_t OP_P2ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_P2ControlsMenu, &OP_ControlsDef, 60, 30); +menu_t OP_AllControlsDef = CONTROLMENUSTYLE(OP_AllControlsMenu, &OP_ControlsDef); +menu_t OP_Joystick1Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick1Menu, &OP_AllControlsDef, 60, 30); +menu_t OP_Joystick2Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick2Menu, &OP_AllControlsDef, 60, 30); #ifndef NOFOURPLAYER -menu_t OP_P3ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_P3ControlsMenu, &OP_ControlsDef, 60, 30); -menu_t OP_P4ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_P4ControlsMenu, &OP_ControlsDef, 60, 30); -#endif -menu_t OP_MouseOptionsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_MouseOptionsMenu, &OP_P1ControlsDef, 60, 30); -menu_t OP_Mouse2OptionsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_Mouse2OptionsMenu, &OP_P2ControlsDef, 60, 30); -*/ -menu_t OP_Joystick1Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick1Menu, &OP_MoveControlsDef, 60, 30); -menu_t OP_Joystick2Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick2Menu, &OP_MoveControlsDef, 60, 30); -#ifndef NOFOURPLAYER -menu_t OP_Joystick3Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick3Menu, &OP_MoveControlsDef, 60, 30); -menu_t OP_Joystick4Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick4Menu, &OP_MoveControlsDef, 60, 30); +menu_t OP_Joystick3Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick3Menu, &OP_AllControlsDef, 60, 30); +menu_t OP_Joystick4Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick4Menu, &OP_AllControlsDef, 60, 30); #endif menu_t OP_JoystickSetDef = { @@ -2547,7 +2492,7 @@ boolean M_Responder(event_t *ev) if (ch == -1) return false; - else if (ch == gamecontrol[gc_systemmenu][0]) // allow remappable ESC key + else if (ch == gamecontrol[gc_systemmenu][0] || ch == gamecontrol[gc_systemmenu][1]) // allow remappable ESC key ch = KEY_ESCAPE; // F-Keys @@ -2795,6 +2740,7 @@ boolean M_Responder(event_t *ev) { // detach any keys associated with the game control G_ClearControlKeys(setupcontrols, currentMenu->menuitems[itemOn].alphaKey); + S_StartSound(NULL, sfx_shldls); return true; } @@ -3965,7 +3911,7 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt) if (M_MapLocked(mapnum+1)) return false; // not unlocked - if (gt == GT_COOP && (mapheaderinfo[mapnum]->typeoflevel & TOL_COOP)) + /*if (gt == GT_COOP && (mapheaderinfo[mapnum]->typeoflevel & TOL_COOP)) return true; if (gt == GT_COMPETITION && (mapheaderinfo[mapnum]->typeoflevel & TOL_COMPETITION)) @@ -3974,10 +3920,10 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt) if (gt == GT_CTF && (mapheaderinfo[mapnum]->typeoflevel & TOL_CTF)) return true; - if ((gt == GT_MATCH || gt == GT_TEAMMATCH) && (mapheaderinfo[mapnum]->typeoflevel & TOL_MATCH)) - return true; - if ((gt == GT_TAG || gt == GT_HIDEANDSEEK) && (mapheaderinfo[mapnum]->typeoflevel & TOL_TAG)) + return true;*/ + + if ((gt == GT_MATCH || gt == GT_TEAMMATCH) && (mapheaderinfo[mapnum]->typeoflevel & TOL_MATCH)) return true; if (gt == GT_RACE && (mapheaderinfo[mapnum]->typeoflevel & TOL_RACE)) @@ -3985,29 +3931,38 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt) return false; - case LLM_LEVELSELECT: + /*case LLM_LEVELSELECT: if (mapheaderinfo[mapnum]->levelselect != maplistoption) return false; if (M_MapLocked(mapnum+1)) return false; // not unlocked - return true; + return true;*/ case LLM_RECORDATTACK: - if (!(mapheaderinfo[mapnum]->menuflags & LF2_RECORDATTACK)) + /*if (!(mapheaderinfo[mapnum]->menuflags & LF2_RECORDATTACK)) + return false;*/ + + if (!(mapheaderinfo[mapnum]->typeoflevel & TOL_RACE)) return false; if (M_MapLocked(mapnum+1)) return false; // not unlocked - if (mapheaderinfo[mapnum]->menuflags & LF2_NOVISITNEEDED) + if (M_SecretUnlocked(SECRET_HELLATTACK)) + return true; // now you're in hell + + if (mapheaderinfo[mapnum]->menuflags & LF2_HIDEINMENU) + return false; // map hell + + /*if (mapheaderinfo[mapnum]->menuflags & LF2_NOVISITNEEDED) return true; if (!mapvisited[mapnum]) - return false; + return false;*/ return true; - case LLM_NIGHTSATTACK: + /*case LLM_NIGHTSATTACK: if (!(mapheaderinfo[mapnum]->menuflags & LF2_NIGHTSATTACK)) return false; @@ -4020,7 +3975,9 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt) if (!mapvisited[mapnum]) return false; - return true; + return true;*/ + default: + return false; } // Hmm? Couldn't decide? @@ -4264,7 +4221,7 @@ static void M_DrawImageDef(void) else { patch_t *patch = W_CachePatchName(currentMenu->menuitems[itemOn].text,PU_CACHE); - if (patch->width <= BASEVIDWIDTH) + if (patch->height <= BASEVIDHEIGHT) V_DrawScaledPatch(0,0,0,patch); else V_DrawSmallScaledPatch(0,0,0,patch); @@ -8468,19 +8425,28 @@ static void M_Setup1PControlsMenu(INT32 choice) setupcontrols = gamecontrol; // was called from main Options (for console player, then) currentMenu->lastOn = itemOn; + // Set proper gamepad options + OP_AllControlsMenu[0].itemaction = &OP_Joystick1Def; + // Unhide P1-only controls - OP_MoveControlsMenu[10].status = IT_CONTROL; // Talk - //OP_MoveControlsMenu[11].status = IT_CONTROL; // Team-talk - OP_MoveControlsMenu[11].status = IT_CONTROL; // Rankings - OP_MoveControlsMenu[12].status = IT_CONTROL; // Pause - OP_MoveControlsMenu[13].status = IT_CONTROL; // Console - OP_MoveControlsMenu[14].itemaction = &OP_Joystick1Def; // Gamepad + OP_AllControlsMenu[14].status = IT_CONTROL; // Chat + //OP_AllControlsMenu[15].status = IT_CONTROL; // Team-chat + OP_AllControlsMenu[15].status = IT_CONTROL; // Rankings + OP_AllControlsMenu[16].status = IT_CONTROL; // Viewpoint + // 17 is Reset Camera, 18 is Toggle Chasecam + OP_AllControlsMenu[19].status = IT_CONTROL; // Pause + OP_AllControlsMenu[20].status = IT_CONTROL; // Screenshot + OP_AllControlsMenu[21].status = IT_CONTROL; // GIF + OP_AllControlsMenu[22].status = IT_CONTROL; // System Menu + OP_AllControlsMenu[23].status = IT_CONTROL; // Console + OP_AllControlsMenu[24].status = IT_HEADER; // Spectator Controls header + OP_AllControlsMenu[25].status = IT_SPACE; // Spectator Controls space + OP_AllControlsMenu[26].status = IT_CONTROL; // Spectate + OP_AllControlsMenu[27].status = IT_CONTROL; // Look Up + OP_AllControlsMenu[28].status = IT_CONTROL; // Look Down + OP_AllControlsMenu[29].status = IT_CONTROL; // Center View - // Set cvars - OP_SpectateControlsMenu[6].itemaction = &cv_chasecam; // Chasecam - OP_SpectateControlsMenu[7].itemaction = &cv_crosshair; // Crosshair - - M_SetupNextMenu(&OP_MoveControlsDef); + M_SetupNextMenu(&OP_AllControlsDef); } static void M_Setup2PControlsMenu(INT32 choice) @@ -8491,19 +8457,28 @@ static void M_Setup2PControlsMenu(INT32 choice) setupcontrols = gamecontrolbis; currentMenu->lastOn = itemOn; + // Set proper gamepad options + OP_AllControlsMenu[0].itemaction = &OP_Joystick2Def; + // Hide P1-only controls - OP_MoveControlsMenu[10].status = IT_GRAYEDOUT2; // Talk - //OP_MoveControlsMenu[11].status = IT_GRAYEDOUT2; // Team-talk - OP_MoveControlsMenu[11].status = IT_GRAYEDOUT2; // Rankings - OP_MoveControlsMenu[12].status = IT_GRAYEDOUT2; // Pause - OP_MoveControlsMenu[13].status = IT_GRAYEDOUT2; // Console - OP_MoveControlsMenu[14].itemaction = &OP_Joystick2Def; // Gamepad + OP_AllControlsMenu[14].status = IT_GRAYEDOUT2; // Chat + //OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Team-chat + OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Rankings + OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Viewpoint + // 17 is Reset Camera, 18 is Toggle Chasecam + OP_AllControlsMenu[19].status = IT_GRAYEDOUT2; // Pause + OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // Screenshot + OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // GIF + OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // System Menu + OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // Console + OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Spectator Controls header + OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Spectator Controls space + OP_AllControlsMenu[26].status = IT_GRAYEDOUT2; // Spectate + OP_AllControlsMenu[27].status = IT_GRAYEDOUT2; // Look Up + OP_AllControlsMenu[28].status = IT_GRAYEDOUT2; // Look Down + OP_AllControlsMenu[29].status = IT_GRAYEDOUT2; // Center View - // Set cvars - OP_SpectateControlsMenu[6].itemaction = &cv_chasecam2; // Chasecam - OP_SpectateControlsMenu[7].itemaction = &cv_crosshair2; // Crosshair - - M_SetupNextMenu(&OP_MoveControlsDef); + M_SetupNextMenu(&OP_AllControlsDef); } #ifndef NOFOURPLAYER @@ -8515,19 +8490,28 @@ static void M_Setup3PControlsMenu(INT32 choice) setupcontrols = gamecontrol3; currentMenu->lastOn = itemOn; + // Set proper gamepad options + OP_AllControlsMenu[0].itemaction = &OP_Joystick3Def; + // Hide P1-only controls - OP_MoveControlsMenu[10].status = IT_GRAYEDOUT2; // Talk - //OP_MoveControlsMenu[11].status = IT_GRAYEDOUT2; // Team-talk - OP_MoveControlsMenu[11].status = IT_GRAYEDOUT2; // Rankings - OP_MoveControlsMenu[12].status = IT_GRAYEDOUT2; // Pause - OP_MoveControlsMenu[13].status = IT_GRAYEDOUT2; // Console - OP_MoveControlsMenu[14].itemaction = &OP_Joystick3Def; // Gamepad + OP_AllControlsMenu[14].status = IT_GRAYEDOUT2; // Chat + //OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Team-chat + OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Rankings + OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Viewpoint + // 17 is Reset Camera, 18 is Toggle Chasecam + OP_AllControlsMenu[19].status = IT_GRAYEDOUT2; // Pause + OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // Screenshot + OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // GIF + OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // System Menu + OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // Console + OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Spectator Controls header + OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Spectator Controls space + OP_AllControlsMenu[26].status = IT_GRAYEDOUT2; // Spectate + OP_AllControlsMenu[27].status = IT_GRAYEDOUT2; // Look Up + OP_AllControlsMenu[28].status = IT_GRAYEDOUT2; // Look Down + OP_AllControlsMenu[29].status = IT_GRAYEDOUT2; // Center View - // Set cvars - OP_SpectateControlsMenu[6].itemaction = &cv_chasecam3; // Chasecam - OP_SpectateControlsMenu[7].itemaction = &cv_crosshair3; // Crosshair - - M_SetupNextMenu(&OP_MoveControlsDef); + M_SetupNextMenu(&OP_AllControlsDef); } static void M_Setup4PControlsMenu(INT32 choice) @@ -8538,82 +8522,147 @@ static void M_Setup4PControlsMenu(INT32 choice) setupcontrols = gamecontrol4; currentMenu->lastOn = itemOn; + // Set proper gamepad options + OP_AllControlsMenu[0].itemaction = &OP_Joystick4Def; + // Hide P1-only controls - OP_MoveControlsMenu[10].status = IT_GRAYEDOUT2; // Talk - //OP_MoveControlsMenu[11].status = IT_GRAYEDOUT2; // Team-talk - OP_MoveControlsMenu[11].status = IT_GRAYEDOUT2; // Rankings - OP_MoveControlsMenu[12].status = IT_GRAYEDOUT2; // Pause - OP_MoveControlsMenu[13].status = IT_GRAYEDOUT2; // Console - OP_MoveControlsMenu[14].itemaction = &OP_Joystick4Def; // Gamepad + OP_AllControlsMenu[14].status = IT_GRAYEDOUT2; // Chat + //OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Team-chat + OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Rankings + OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Viewpoint + // 17 is Reset Camera, 18 is Toggle Chasecam + OP_AllControlsMenu[19].status = IT_GRAYEDOUT2; // Pause + OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // Screenshot + OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // GIF + OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // System Menu + OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // Console + OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Spectator Controls header + OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Spectator Controls space + OP_AllControlsMenu[26].status = IT_GRAYEDOUT2; // Spectate + OP_AllControlsMenu[27].status = IT_GRAYEDOUT2; // Look Up + OP_AllControlsMenu[28].status = IT_GRAYEDOUT2; // Look Down + OP_AllControlsMenu[29].status = IT_GRAYEDOUT2; // Center View - // Set cvars - OP_SpectateControlsMenu[6].itemaction = &cv_chasecam4; // Chasecam - OP_SpectateControlsMenu[7].itemaction = &cv_crosshair4; // Crosshair - - M_SetupNextMenu(&OP_MoveControlsDef); + M_SetupNextMenu(&OP_AllControlsDef); } #endif +#define controlheight 18 + // Draws the Customise Controls menu static void M_DrawControl(void) { - char tmp[50]; - INT32 i, y; - INT32 keys[2]; - const char *ctrl; - - // draw title, strings and submenu - M_DrawGenericMenu(); - - if (setupcontrols_secondaryplayer) - ctrl = "\x86""SET ""\x82""CONTROLS""\x86"" FOR ""\x82""SECONDARY PLAYER"; - else if (setupcontrols_thirdplayer) - ctrl = "\x86""SET ""\x82""CONTROLS""\x86"" FOR ""\x82""THIRD PLAYER"; - else if (setupcontrols_fourthplayer) - ctrl = "\x86""SET ""\x82""CONTROLS""\x86"" FOR ""\x82""FOURTH PLAYER"; - else - ctrl = "\x86""PRESS ""\x82""ENTER""\x86"" TO CHANGE, ""\x82""BACKSPACE""\x86"" TO CLEAR"; - - M_CentreText(28, ctrl); + char tmp[50]; + INT32 x, y, i, max, cursory = 0, iter; + INT32 keys[2]; + x = currentMenu->x; y = currentMenu->y; - for (i = 0; i < currentMenu->numitems;i++) + /*i = itemOn - (controlheight/2); + if (i < 0) + i = 0; + */ + + iter = (controlheight/2); + for (i = itemOn; ((iter || currentMenu->menuitems[i].status == IT_GRAYEDOUT2) && i > 0); i--) { - if (currentMenu->menuitems[i].status != IT_CONTROL) - { - y = currentMenu->y+currentMenu->menuitems[i].alphaKey; - continue; - } - if (currentMenu->menuitems[i].status != IT_CONTROL) - continue; + if (currentMenu->menuitems[i].status != IT_GRAYEDOUT2) + iter--; + } + if (currentMenu->menuitems[i].status == IT_GRAYEDOUT2) + i--; - keys[0] = setupcontrols[currentMenu->menuitems[i].alphaKey][0]; - keys[1] = setupcontrols[currentMenu->menuitems[i].alphaKey][1]; + iter += (controlheight/2); + for (max = itemOn; (iter && max < currentMenu->numitems); max++) + { + if (currentMenu->menuitems[max].status != IT_GRAYEDOUT2) + iter--; + } - tmp[0] ='\0'; - if (keys[0] == KEY_NULL && keys[1] == KEY_NULL) + if (iter) + { + iter += (controlheight/2); + for (i = itemOn; ((iter || currentMenu->menuitems[i].status == IT_GRAYEDOUT2) && i > 0); i--) { - strcpy(tmp, "---"); + if (currentMenu->menuitems[i].status != IT_GRAYEDOUT2) + iter--; } + } + + /*max = i + controlheight; + if (max > currentMenu->numitems) + { + max = currentMenu->numitems; + if (max < controlheight) + i = 0; else + i = max - controlheight; + }*/ + + // draw title (or big pic) + M_DrawMenuTitle(); + + M_CentreText(28, + (setupcontrols_fourthplayer ? "\x86""Set controls for ""\x82""Player 4" : + (setupcontrols_thirdplayer ? "\x86""Set controls for ""\x82""Player 3" : + (setupcontrols_secondaryplayer ? "\x86""Set controls for ""\x82""Player 2" : + "\x86""Press ""\x82""ENTER""\x86"" to change, ""\x82""BACKSPACE""\x86"" to clear")))); + + if (i) + V_DrawString(currentMenu->x - 16, y-(skullAnimCounter/5), highlightflags, "\x1A"); // up arrow + if (max != currentMenu->numitems) + V_DrawString(currentMenu->x - 16, y+(SMALLLINEHEIGHT*(controlheight-1))+(skullAnimCounter/5), highlightflags, "\x1B"); // down arrow + + for (; i < max; i++) + { + if (currentMenu->menuitems[i].status == IT_GRAYEDOUT2) + continue; + + if (i == itemOn) + cursory = y; + + if (currentMenu->menuitems[i].status == IT_CONTROL) { - if (keys[0] != KEY_NULL) - strcat (tmp, G_KeynumToString (keys[0])); + V_DrawString(x, y, ((i == itemOn) ? highlightflags : 0), currentMenu->menuitems[i].text); + keys[0] = setupcontrols[currentMenu->menuitems[i].alphaKey][0]; + keys[1] = setupcontrols[currentMenu->menuitems[i].alphaKey][1]; - if (keys[0] != KEY_NULL && keys[1] != KEY_NULL) - strcat(tmp," or "); + tmp[0] ='\0'; + if (keys[0] == KEY_NULL && keys[1] == KEY_NULL) + { + strcpy(tmp, "---"); + } + else + { + if (keys[0] != KEY_NULL) + strcat (tmp, G_KeynumToString (keys[0])); - if (keys[1] != KEY_NULL) - strcat (tmp, G_KeynumToString (keys[1])); + if (keys[0] != KEY_NULL && keys[1] != KEY_NULL) + strcat(tmp,", "); + if (keys[1] != KEY_NULL) + strcat (tmp, G_KeynumToString (keys[1])); + } + V_DrawRightAlignedString(BASEVIDWIDTH-currentMenu->x, y, highlightflags, tmp); } - V_DrawRightAlignedString(BASEVIDWIDTH-currentMenu->x, y, highlightflags, tmp); + /*else if (currentMenu->menuitems[i].status == IT_GRAYEDOUT2) + V_DrawString(x, y, V_TRANSLUCENT, currentMenu->menuitems[i].text);*/ + else if ((currentMenu->menuitems[i].status == IT_HEADER) && (i != max-1)) + V_DrawString(19, y+6, highlightflags, currentMenu->menuitems[i].text); + else if (currentMenu->menuitems[i].status & IT_STRING) + V_DrawString(x, y, ((i == itemOn) ? highlightflags : 0), currentMenu->menuitems[i].text); + y += SMALLLINEHEIGHT; } + + V_DrawScaledPatch(currentMenu->x - 20, cursory, 0, + W_CachePatchName("M_CURSOR", PU_CACHE)); } +#undef controlheight + static INT32 controltochange; static void M_ChangecontrolResponse(event_t *ev) @@ -8673,23 +8722,22 @@ static void M_ChangecontrolResponse(event_t *ev) setupcontrols[control][found] = ch-KEY_4JOY1+KEY_DBL4JOY1; } else - { - // check if change key1 or key2, or replace the two by the new - found = 0; - if (setupcontrols[control][0] == KEY_NULL) - found++; - if (setupcontrols[control][1] == KEY_NULL) - found++; - if (found == 2) - { - found = 0; - setupcontrols[control][1] = KEY_NULL; //replace key 1,clear key2 - } - G_CheckDoubleUsage(ch); - setupcontrols[control][found] = ch; - } - + { + // check if change key1 or key2, or shuffle them along in a queue + found = 0; + if (setupcontrols[control][0] != KEY_NULL) + { + found++; + if (setupcontrols[control][1] != KEY_NULL) + setupcontrols[control][0] = setupcontrols[control][1]; + } + G_CheckDoubleUsage(ch); + setupcontrols[control][found] = ch; + } + S_StartSound(NULL, sfx_strpst); } + else + S_StartSound(NULL, sfx_skid); M_StopMessage(0); } diff --git a/src/m_misc.c b/src/m_misc.c index 766db72d..f1a81bb3 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -1480,9 +1480,13 @@ boolean M_ScreenshotResponder(event_t *ev) return false; ch = ev->data1; - if (ch == KEY_F8) + + if (ch >= KEY_MOUSE1 && menuactive) // If it's not a keyboard key, then don't allow it in the menus! + return false; + + if (ch == gamecontrol[gc_screenshot][0] || ch == gamecontrol[gc_screenshot][1]) // remappable F8 M_ScreenShot(); - else if (ch == KEY_F9) + else if (ch == gamecontrol[gc_recordgif][0] || ch == gamecontrol[gc_recordgif][1]) // remappable F9 ((moviemode) ? M_StopMovie : M_StartMovie)(); else return false; diff --git a/src/nds/i_sound.c b/src/nds/i_sound.c index 8dea4ad7..a17c7f66 100644 --- a/src/nds/i_sound.c +++ b/src/nds/i_sound.c @@ -21,13 +21,14 @@ void I_ShutdownSound(void){} // SFX I/O // -INT32 I_StartSound(sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, INT32 priority) +INT32 I_StartSound(sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, INT32 priority, INT32 channel) { (void)id; (void)vol; (void)sep; (void)pitch; (void)priority; + (void)channel; return -1; } diff --git a/src/nds/i_video.c b/src/nds/i_video.c index 3dfb9955..06969dfd 100644 --- a/src/nds/i_video.c +++ b/src/nds/i_video.c @@ -32,7 +32,7 @@ boolean highcolor = false; boolean allow_fullscreen = false; -consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_vidwait = {"vid_wait", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; void I_StartupGraphics(void) { diff --git a/src/p_enemy.c b/src/p_enemy.c index 7cdc354d..37dd5899 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3913,15 +3913,25 @@ void A_ThrownRing(mobj_t *actor) //{ SRB2kart - A_GRENADERING static mobj_t *grenade; +static fixed_t explodedist; static inline boolean PIT_GrenadeRing(mobj_t *thing) { if (!grenade) - return true; + return false; if (thing->type != MT_PLAYER) // Don't explode for anything but an actual player. return true; + if (!(thing->flags & MF_SHOOTABLE)) + { + // didn't do any damage + return true; + } + + if (netgame && thing->player && thing->player->spectator) + return true; + if (thing == grenade->target && grenade->threshold != 0) // Don't blow up at your owner. return true; @@ -3935,22 +3945,13 @@ static inline boolean PIT_GrenadeRing(mobj_t *thing) return true; // see if it went over / under - if (grenade->z - grenade->info->painchance > thing->z + thing->height) + if (grenade->z - explodedist > thing->z + thing->height) return true; // overhead - if (grenade->z + grenade->height + grenade->info->painchance < thing->z) + if (grenade->z + grenade->height + explodedist < thing->z) return true; // underneath - if (netgame && thing->player && thing->player->spectator) - return true; - - if (!(thing->flags & MF_SHOOTABLE)) - { - // didn't do any damage - return true; - } - if (P_AproxDistance(P_AproxDistance(thing->x - grenade->x, thing->y - grenade->y), - thing->z - grenade->z) > grenade->info->painchance) + thing->z - grenade->z) > explodedist) return true; // Too far away // Explode! @@ -3961,7 +3962,11 @@ static inline boolean PIT_GrenadeRing(mobj_t *thing) void A_GrenadeRing(mobj_t *actor) { INT32 bx, by, xl, xh, yl, yh; - const fixed_t explodedist = actor->info->painchance; + explodedist = FixedMul(actor->info->painchance, mapheaderinfo[gamemap-1]->mobj_scale); +#ifdef HAVE_BLUA + if (LUA_CallAction("A_GrenadeRing", actor)) + return; +#endif if (leveltime % 35 == 0) S_StartSound(actor, actor->info->activesound); @@ -3978,6 +3983,80 @@ void A_GrenadeRing(mobj_t *actor) for (bx = xl; bx <= xh; bx++) P_BlockThingsIterator(bx, by, PIT_GrenadeRing); } + +static inline boolean PIT_MineExplode(mobj_t *thing) +{ + if (!grenade || P_MobjWasRemoved(grenade)) + return false; // There's the possibility these can chain react onto themselves after they've already died if there are enough all in one spot + + if (thing == grenade || thing->type == MT_MINEEXPLOSIONSOUND) // Don't explode yourself! Endless loop! + return true; + + if (!(thing->flags & MF_SHOOTABLE) || (thing->flags & MF_SCENERY)) + return true; + + if (netgame && thing->player && thing->player->spectator) + return true; + + if (G_BattleGametype() && grenade->target && grenade->target->player && grenade->target->player->kartstuff[k_bumper] <= 0 && thing == grenade->target) + return true; + + // see if it went over / under + if (grenade->z - explodedist > thing->z + thing->height) + return true; // overhead + if (grenade->z + grenade->height + explodedist < thing->z) + return true; // underneath + + if (P_AproxDistance(P_AproxDistance(thing->x - grenade->x, thing->y - grenade->y), + thing->z - grenade->z) > explodedist) + return true; // Too far away + + grenade->flags2 |= MF2_DEBRIS; + + if (thing->player) // Looks like we're going to have to need a seperate function for this too + K_ExplodePlayer(thing->player, grenade->target); + else + P_DamageMobj(thing, grenade, grenade->target, 1); + + return true; +} + +void A_MineExplode(mobj_t *actor) +{ + INT32 bx, by, xl, xh, yl, yh; + explodedist = FixedMul(actor->info->painchance, mapheaderinfo[gamemap-1]->mobj_scale); + INT32 d; + INT32 locvar1 = var1; + mobjtype_t type; +#ifdef HAVE_BLUA + if (LUA_CallAction("A_MineExplode", actor)) + return; +#endif + + type = (mobjtype_t)locvar1; + + // Use blockmap to check for nearby shootables + yh = (unsigned)(actor->y + explodedist - bmaporgy)>>MAPBLOCKSHIFT; + yl = (unsigned)(actor->y - explodedist - bmaporgy)>>MAPBLOCKSHIFT; + xh = (unsigned)(actor->x + explodedist - bmaporgx)>>MAPBLOCKSHIFT; + xl = (unsigned)(actor->x - explodedist - bmaporgx)>>MAPBLOCKSHIFT; + + grenade = actor; + + for (by = yl; by <= yh; by++) + for (bx = xl; bx <= xh; bx++) + P_BlockThingsIterator(bx, by, PIT_MineExplode); + + for (d = 0; d < 16; d++) + K_SpawnKartExplosion(actor->x, actor->y, actor->z, explodedist + 32*mapheaderinfo[gamemap-1]->mobj_scale, 32, type, d*(ANGLE_45/4), true, false, actor->target); // 32 <-> 64 + + if (actor->target && actor->target->player) + K_SpawnMineExplosion(actor, actor->target->player->skincolor); + else + K_SpawnMineExplosion(actor, SKINCOLOR_RED); + + P_SpawnMobj(actor->x, actor->y, actor->z, MT_MINEEXPLOSIONSOUND); +} //} // Function: A_SetSolidSteam @@ -8240,6 +8319,7 @@ void A_JawzExplode(mobj_t *actor) return; } +/* old A_MineExplode - see elsewhere in the file void A_MineExplode(mobj_t *actor) { mobj_t *mo2; @@ -8247,12 +8327,14 @@ void A_MineExplode(mobj_t *actor) INT32 d; INT32 locvar1 = var1; mobjtype_t type; + fixed_t range; #ifdef HAVE_BLUA if (LUA_CallAction("A_MineExplode", actor)) return; #endif type = (mobjtype_t)locvar1; + range = FixedMul(actor->info->painchance, mapheaderinfo[gamemap-1]->mobj_scale); for (th = thinkercap.next; th != &thinkercap; th = th->next) { @@ -8267,27 +8349,25 @@ void A_MineExplode(mobj_t *actor) if (mo2 == actor || mo2->type == MT_MINEEXPLOSIONSOUND) // Don't explode yourself! Endless loop! continue; + if (!(mo2->flags & MF_SHOOTABLE) || (mo2->flags & MF_SCENERY)) + continue; + if (G_BattleGametype() && actor->target && actor->target->player && actor->target->player->kartstuff[k_bumper] <= 0 && mo2 == actor->target) continue; - if (P_AproxDistance(P_AproxDistance(mo2->x - actor->x, mo2->y - actor->y), mo2->z - actor->z) > actor->info->painchance) + if (P_AproxDistance(P_AproxDistance(mo2->x - actor->x, mo2->y - actor->y), mo2->z - actor->z) > range) continue; - if ((mo2->flags & MF_SHOOTABLE) && !(mo2->flags & MF_SCENERY)) - { - actor->flags2 |= MF2_DEBRIS; + actor->flags2 |= MF2_DEBRIS; - if (mo2->player) // Looks like we're going to have to need a seperate function for this too - K_ExplodePlayer(mo2->player, actor->target); - else - P_DamageMobj(mo2, actor, actor->target, 1); - - continue; - } + if (mo2->player) // Looks like we're going to have to need a seperate function for this too + K_ExplodePlayer(mo2->player, actor->target); + else + P_DamageMobj(mo2, actor, actor->target, 1); } for (d = 0; d < 16; d++) - K_SpawnKartExplosion(actor->x, actor->y, actor->z, actor->info->painchance + 32*FRACUNIT, 32, type, d*(ANGLE_45/4), true, false, actor->target); // 32 <-> 64 + K_SpawnKartExplosion(actor->x, actor->y, actor->z, range + 32*mapheaderinfo[gamemap-1]->mobj_scale, 32, type, d*(ANGLE_45/4), true, false, actor->target); // 32 <-> 64 if (actor->target && actor->target->player) K_SpawnMineExplosion(actor, actor->target->player->skincolor); @@ -8297,7 +8377,7 @@ void A_MineExplode(mobj_t *actor) P_SpawnMobj(actor->x, actor->y, actor->z, MT_MINEEXPLOSIONSOUND); return; -} +}*/ void A_BallhogExplode(mobj_t *actor) { @@ -8318,13 +8398,13 @@ void A_BallhogExplode(mobj_t *actor) // Dumb simple function that gives a mobj its target's momentums without updating its angle. void A_LightningFollowPlayer(mobj_t *actor) { + fixed_t sx, sy; #ifdef HAVE_BLUA if (LUA_CallAction("A_LightningFollowPlayer", actor)) return; #endif - fixed_t sx, sy; if (actor->target) - { + { if (actor->extravalue1) // Make the radius also follow the player somewhat accuratly { sx = actor->target->x + FixedMul((actor->target->scale*actor->extravalue1), FINECOSINE((actor->angle)>>ANGLETOFINESHIFT)); @@ -8333,7 +8413,7 @@ void A_LightningFollowPlayer(mobj_t *actor) } else // else just teleport to player directly P_TeleportMove(actor, actor->target->x, actor->target->y, actor->target->z); - + actor->momx = actor->target->momx; actor->momy = actor->target->momy; actor->momz = actor->target->momz; // Give momentum since we don't teleport to our player literally every frame. diff --git a/src/p_floor.c b/src/p_floor.c index ac8e60dc..075ad1da 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -1819,6 +1819,7 @@ void T_ThwompSector(levelspecthink_t *thwomp) #define ceilingwasheight vars[5] fixed_t thwompx, thwompy; sector_t *actionsector; + ffloor_t *rover = NULL; INT32 secnum; // SRB2kart 170217 - Thwomps are automatic. @@ -1843,7 +1844,16 @@ void T_ThwompSector(levelspecthink_t *thwomp) secnum = P_FindSectorFromTag((INT16)thwomp->vars[0], -1); if (secnum > 0) + { actionsector = §ors[secnum]; + + // Look for thwomp FFloor + for (rover = actionsector->ffloors; rover; rover = rover->next) + { + if (rover->master == thwomp->sourceline) + break; + } + } else return; // Bad bad bad! @@ -1932,10 +1942,13 @@ void T_ThwompSector(levelspecthink_t *thwomp) { mobj_t *mp = (void *)&actionsector->soundorg; - if (thwomp->sourceline->flags & ML_EFFECT4) - S_StartSound(mp, sides[thwomp->sourceline->sidenum[0]].textureoffset>>FRACBITS); - else - S_StartSound(mp, sfx_thwomp); + if (!rover || (rover->flags & FF_EXISTS)) + { + if (thwomp->sourceline->flags & ML_EFFECT4) + S_StartSound(mp, sides[thwomp->sourceline->sidenum[0]].textureoffset>>FRACBITS); + else + S_StartSound(mp, sfx_thwomp); + } thwomp->direction = 1; // start heading back up thwomp->distance = TICRATE; // but only after a small delay @@ -1953,17 +1966,22 @@ void T_ThwompSector(levelspecthink_t *thwomp) /* // SRB2kart 170217 - Thwomps are automatic. // scan the thinkers to find players! - for (th = thinkercap.next; th != &thinkercap; th = th->next) + if (!rover || (rover->flags & FF_EXISTS)) { - if (th->function.acp1 != (actionf_p1)P_MobjThinker) - continue; - - mo = (mobj_t *)th; - if (mo->type == MT_PLAYER && mo->health && mo->z <= thwomp->sector->ceilingheight - && P_AproxDistance(thwompx - mo->x, thwompy - mo->y) <= 96*FRACUNIT) + // scan the thinkers to find players! + for (th = thinkercap.next; th != &thinkercap; th = th->next) { - thwomp->direction = -1; - break; + if (th->function.acp1 != (actionf_p1)P_MobjThinker) + continue; + + mo = (mobj_t *)th; + if (mo->type == MT_PLAYER && mo->health && mo->player && !mo->player->spectator + && mo->z <= thwomp->sector->ceilingheight + && P_AproxDistance(thwompx - mo->x, thwompy - mo->y) <= 96*FRACUNIT) + { + thwomp->direction = -1; + break; + } } }*/ diff --git a/src/p_inter.c b/src/p_inter.c index 4a120a42..cd0ed893 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -96,55 +96,6 @@ void P_RampConstant(const BasicFF_t *FFInfo, INT32 Start, INT32 End) // GET STUFF // -/** Makes sure all previous starposts are cleared. - * For instance, hitting starpost 5 will clear starposts 1 through 4, even if - * you didn't touch them. This is how the classic games work, although it can - * lead to bizarre situations on levels that allow you to make a circuit. - * - * \param postnum The number of the starpost just touched. - */ -void P_ClearStarPost(INT32 postnum) -{ - thinker_t *th; - mobj_t *mo2; - - // scan the thinkers - for (th = thinkercap.next; th != &thinkercap; th = th->next) - { - if (th->function.acp1 != (actionf_p1)P_MobjThinker) - continue; - - mo2 = (mobj_t *)th; - - if (mo2->type == MT_STARPOST && mo2->health <= postnum) - P_SetMobjState(mo2, mo2->info->seestate); - } - return; -} - -// -// P_ResetStarposts -// -// Resets all starposts back to their spawn state, used on A_Mixup and some other things. -// -void P_ResetStarposts(void) -{ - // Search through all the thinkers. - thinker_t *th; - mobj_t *post; - - for (th = thinkercap.next; th != &thinkercap; th = th->next) - { - if (th->function.acp1 != (actionf_p1)P_MobjThinker) - continue; - - post = (mobj_t *)th; - - if (post->type == MT_STARPOST) - P_SetMobjState(post, post->info->spawnstate); - } -} - // // P_CanPickupItem // @@ -299,14 +250,14 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (heightcheck) { - if (special->type == MT_FLINGEMERALD) // little hack here... + /*if (special->type == MT_FLINGEMERALD) // little hack here... { // flingemerald sprites are low to the ground, so extend collision radius down some. if (toucher->z > (special->z + special->height)) return; if (special->z - special->height > (toucher->z + toucher->height)) return; } - else + else*/ { if (toucher->momz < 0) { if (toucher->z + toucher->momz > special->z + special->height) @@ -341,7 +292,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (special->flags & MF_BOSS) { - if (special->type == MT_BLACKEGGMAN) + /*if (special->type == MT_BLACKEGGMAN) { P_DamageMobj(toucher, special, special, 1); // ouch return; @@ -357,7 +308,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) toucher->momy = -toucher->momy; P_DamageMobj(special, toucher, toucher, 1); } - /* else if (((toucher->z < special->z && !(toucher->eflags & MFE_VERTICALFLIP)) || (toucher->z + toucher->height > special->z + special->height && (toucher->eflags & MFE_VERTICALFLIP))) && player->charability == CA_FLY @@ -368,8 +318,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) P_DamageMobj(special, toucher, toucher, 1); } - */ // SRB2kart - Removed: No more fly states - else + // SRB2kart - Removed: No more fly states + else*/ P_DamageMobj(toucher, special, special, 1); return; @@ -379,7 +329,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) //////////////////////////////////////////////////////// /////ENEMIES!!////////////////////////////////////////// //////////////////////////////////////////////////////// - if (special->type == MT_GSNAPPER && !(((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING)) + /*if (special->type == MT_GSNAPPER && !(((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING)) || player->powers[pw_invulnerability] || player->powers[pw_super]) && toucher->z < special->z + special->height && toucher->z + toucher->height > special->z) { @@ -401,7 +351,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) P_DamageMobj(special, toucher, toucher, 1); } - /* else if (((toucher->z < special->z && !(toucher->eflags & MFE_VERTICALFLIP)) || (toucher->z + toucher->height > special->z + special->height && (toucher->eflags & MFE_VERTICALFLIP))) // Flame is bad at logic - JTE && player->charability == CA_FLY @@ -413,8 +362,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) P_DamageMobj(special, toucher, toucher, 1); } - */ // SRB2kart - Removed: No more fly states - else + // SRB2kart - Removed: No more fly states + else*/ P_DamageMobj(toucher, special, special, 1); return; @@ -456,10 +405,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0) { - if (player->kartstuff[k_comebackmode] != 0 || player->kartstuff[k_comebacktimer]) + if (player->kartstuff[k_comebackmode] || player->kartstuff[k_comebacktimer]) return; - if (player->kartstuff[k_comebackmode] == 0) - player->kartstuff[k_comebackmode] = 1; + player->kartstuff[k_comebackmode] = 1; } special->momx = special->momy = special->momz = 0; @@ -479,31 +427,39 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0) { - /*if (player->kartstuff[k_comebackmode] != 0 || player->kartstuff[k_comebacktimer]) + if (player->kartstuff[k_comebackmode] || player->kartstuff[k_comebacktimer]) return; - if (player->kartstuff[k_comebackmode] == 0) - player->kartstuff[k_comebackmode] = 2;*/ - return; + player->kartstuff[k_comebackmode] = 2; + } + else + { + K_DropItems(player); //K_StripItems(player); + K_StripOther(player); + player->kartstuff[k_itemroulette] = 1; + player->kartstuff[k_roulettetype] = 2; } { mobj_t *poof = P_SpawnMobj(special->x, special->y, special->z, MT_EXPLODE); S_StartSound(poof, special->info->deathsound); + } - K_DropItems(player); //K_StripItems(player); - K_StripOther(player); - player->kartstuff[k_itemroulette] = 1; - player->kartstuff[k_roulettetype] = 2; - if (special->target && special->target->player - && (G_RaceGametype() || special->target->player->kartstuff[k_bumper] > 0)) + if (special->target && special->target->player) + { + if (G_RaceGametype() || special->target->player->kartstuff[k_bumper] > 0) player->kartstuff[k_eggmanblame] = special->target->player-players; else player->kartstuff[k_eggmanblame] = player-players; - P_RemoveMobj(special); - return; + if (special->target->hnext == special) + { + P_SetTarget(&special->target->hnext, NULL); + special->target->player->kartstuff[k_eggmanheld] = 0; + } } - break; + + P_RemoveMobj(special); + return; case MT_KARMAHITBOX: if (!special->target->player) return; @@ -519,7 +475,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) || special->target->player->kartstuff[k_squishedtimer]) return; - if (special->target->player->kartstuff[k_comebackmode] == 0) + if (!special->target->player->kartstuff[k_comebackmode]) { if (player->kartstuff[k_growshrinktimer] || player->kartstuff[k_squishedtimer] || player->kartstuff[k_hyudorotimer] || player->kartstuff[k_spinouttimer] @@ -580,6 +536,52 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) player->kartstuff[k_itemroulette] = 1; player->kartstuff[k_roulettetype] = 1; } + else if (special->target->player->kartstuff[k_comebackmode] == 2 && P_CanPickupItem(player, 2)) + { + mobj_t *poof = P_SpawnMobj(special->x, special->y, special->z, MT_EXPLODE); + S_StartSound(poof, special->info->seesound); + + if (player->kartstuff[k_bumper] == 1) // If you have only one bumper left, and see if it's a 1v1 + { + INT32 numingame = 0; + INT32 i; + + for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i] || players[i].spectator || players[i].kartstuff[k_bumper] <= 0) + continue; + numingame++; + } + + if (numingame <= 2) // If so, then an extra two karma points so they are 100% certain to switch places; it's annoying to end matches with a fake kill + special->target->player->kartstuff[k_comebackpoints] += 2; + } + + special->target->player->kartstuff[k_comebackmode] = 0; + special->target->player->kartstuff[k_comebackpoints]++; + + if (netgame && cv_hazardlog.value) + CONS_Printf(M_GetText("%s gave an \"item\" to %s.\n"), player_names[special->target->player-players], player_names[player-players]); + if (special->target->player->kartstuff[k_comebackpoints] >= 3) + K_StealBumper(special->target->player, player, true); + special->target->player->kartstuff[k_comebacktimer] = comebacktime; + + K_DropItems(player); //K_StripItems(player); + K_StripOther(player); + + player->kartstuff[k_itemroulette] = 1; + player->kartstuff[k_roulettetype] = 2; + + if (special->target->player->kartstuff[k_eggmanblame] >= 0 + && special->target->player->kartstuff[k_eggmanblame] < MAXPLAYERS + && playeringame[special->target->player->kartstuff[k_eggmanblame]] + && !players[special->target->player->kartstuff[k_eggmanblame]].spectator) + player->kartstuff[k_eggmanblame] = special->target->player->kartstuff[k_eggmanblame]; + else + player->kartstuff[k_eggmanblame] = -1; + + special->target->player->kartstuff[k_eggmanblame] = -1; + } return; // ***************************************** // @@ -843,7 +845,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // ********************************** // // NiGHTS gameplay items and powerups // // ********************************** // - case MT_NIGHTSDRONE: + /*case MT_NIGHTSDRONE: if (player->bot) return; if (player->exiting) @@ -1034,7 +1036,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // Clear text player->texttimer = 0; - return; + return;*/ case MT_NIGHTSBUMPER: // Don't trigger if the stage is ended/failed if (player->exiting) @@ -1102,7 +1104,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } } return; - case MT_NIGHTSSUPERLOOP: + /*case MT_NIGHTSSUPERLOOP: if (player->bot || !(player->pflags & PF_NIGHTSMODE)) return; if (!G_IsSpecialStage(gamemap)) @@ -1235,7 +1237,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) HU_SetCEchoDuration(4); HU_DoCEcho(M_GetText("\\\\\\\\\\\\\\\\Link Freeze")); } - break; + break;*/ case MT_NIGHTSWING: if (G_IsSpecialStage(gamemap) && useNightsSS) { // Pseudo-ring. @@ -1387,35 +1389,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) player->starpostangle = special->angle; player->starpostnum = special->health; player->starpostcount++; - P_ClearStarPost(special->health); - // Find all starposts in the level with this value. - { - thinker_t *th; - mobj_t *mo2; - - for (th = thinkercap.next; th != &thinkercap; th = th->next) - { - if (th->function.acp1 != (actionf_p1)P_MobjThinker) - continue; - - mo2 = (mobj_t *)th; - - if (mo2 == special) - continue; - - if (mo2->type == MT_STARPOST && mo2->health == special->health) - { - if (!(netgame && circuitmap && player != &players[consoleplayer])) - P_SetMobjState(mo2, mo2->info->painstate); - } - } - } - - S_StartSound(toucher, special->info->painsound); - - if (!(netgame && circuitmap && player != &players[consoleplayer])) - P_SetMobjState(special, special->info->painstate); + //S_StartSound(toucher, special->info->painsound); return; case MT_FAKEMOBILE: @@ -1914,7 +1889,7 @@ void P_CheckTimeLimit(void) //Tagmode round end but only on the tic before the //XD_EXITLEVEL packet is received by all players. - if (G_TagGametype()) + /*if (G_TagGametype()) { if (leveltime == (timelimitintics + 1)) { @@ -1931,7 +1906,7 @@ void P_CheckTimeLimit(void) } //Optional tie-breaker for Match/CTF - else if (cv_overtime.value) + else*/ if (cv_overtime.value) { INT32 playerarray[MAXPLAYERS]; INT32 tempplayer = 0; @@ -2064,7 +2039,7 @@ void P_CheckPointLimit(void) /*Checks for untagged remaining players in both tag derivitave modes. *If no untagged players remain, end the round. *Also serves as error checking if the only IT player leaves.*/ -void P_CheckSurvivors(void) +/*void P_CheckSurvivors(void) { INT32 i; INT32 survivors = 0; @@ -2144,7 +2119,7 @@ void P_CheckSurvivors(void) if (server) SendNetXCmd(XD_EXITLEVEL, NULL, 0); } -} +}*/ // Checks whether or not to end a race netgame. boolean P_CheckRacers(void) @@ -2444,7 +2419,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source) localaiming4 = 0; //tag deaths handled differently in suicide cases. Don't count spectators! - if (G_TagGametype() + /*if (G_TagGametype() && !(target->player->pflags & PF_TAGIT) && (!source || !source->player) && !(target->player->spectator)) { // if you accidentally die before you run out of time to hide, ignore it. @@ -2478,7 +2453,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source) } } } - else if (G_BattleGametype()) + else*/ if (G_BattleGametype()) K_CheckBumpers(); target->player->kartstuff[k_pogospring] = 0; @@ -2841,7 +2816,7 @@ static inline boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *sou } // The tag occurs so long as you aren't shooting another tagger with friendlyfire on. - if (source->player->pflags & PF_TAGIT && !(player->pflags & PF_TAGIT)) + /*if (source->player->pflags & PF_TAGIT && !(player->pflags & PF_TAGIT)) { P_AddPlayerScore(source->player, 1); //award points to tagger. P_HitDeathMessages(player, inflictor, source); @@ -2859,7 +2834,7 @@ static inline boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *sou //checks if tagger has tagged all players, if so, end round early. P_CheckSurvivors(); - } + }*/ P_DoPlayerPain(player, source, inflictor); @@ -3385,19 +3360,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da S_StartSound(player->mo, sfx_kc59); return true; } - - // Self-Propelled Bomb - if (damage == 65) - { - mobj_t *spbexplode; - if (player == source->player) - return false; - // Just need to do this now! Being thrown upwards is done by the explosion. - //P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BLUELIGHTNING); - spbexplode = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BLUEEXPLOSION); - P_SetTarget(&spbexplode->target, source); - return true; - } //} // Sudden-Death mode diff --git a/src/p_local.h b/src/p_local.h index 51676a2c..a5e10757 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -68,7 +68,6 @@ // both the head and tail of the thinker list extern thinker_t thinkercap; -extern INT32 runcount; void P_InitThinkers(void); void P_AddThinker(thinker_t *thinker); @@ -172,7 +171,7 @@ void P_PlayerThink(player_t *player); void P_PlayerAfterThink(player_t *player); void P_DoPlayerExit(player_t *player); void P_DoTimeOver(player_t *player); -void P_NightserizePlayer(player_t *player, INT32 ptime); +//void P_NightserizePlayer(player_t *player, INT32 ptime); void P_InstaThrust(mobj_t *mo, angle_t angle, fixed_t move); fixed_t P_ReturnThrustX(mobj_t *mo, angle_t angle, fixed_t move); @@ -185,12 +184,12 @@ void P_HomingAttack(mobj_t *source, mobj_t *enemy); /// \todo doesn't belong in //boolean P_SuperReady(player_t *player); void P_DoJump(player_t *player, boolean soundandstate); boolean P_AnalogMove(player_t *player); -boolean P_TransferToNextMare(player_t *player); -UINT8 P_FindLowestMare(void); +/*boolean P_TransferToNextMare(player_t *player); +UINT8 P_FindLowestMare(void);*/ UINT8 P_FindLowestLap(void); UINT8 P_FindHighestLap(void); void P_FindEmerald(void); -void P_TransferToAxis(player_t *player, INT32 axisnum); +//void P_TransferToAxis(player_t *player, INT32 axisnum); boolean P_PlayerMoving(INT32 pnum); void P_SpawnThokMobj(player_t *player); void P_SpawnSpinMobj(player_t *player, mobjtype_t type); @@ -231,7 +230,7 @@ boolean P_MobjWasRemoved(mobj_t *th); void P_RemoveSavegameMobj(mobj_t *th); boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state); boolean P_SetMobjState(mobj_t *mobj, statenum_t state); -void P_RunShields(void); +//void P_RunShields(void); void P_RunOverlays(void); void P_RunShadows(void); void P_MobjThinker(mobj_t *mobj); @@ -406,12 +405,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck); void P_PlayerFlagBurst(player_t *player, boolean toss); void P_CheckTimeLimit(void); void P_CheckPointLimit(void); -void P_CheckSurvivors(void); +//void P_CheckSurvivors(void); boolean P_CheckRacers(void); -void P_ClearStarPost(INT32 postnum); -void P_ResetStarposts(void); - boolean P_CanPickupItem(player_t *player, UINT8 weapon); void P_DoNightsScore(player_t *player); diff --git a/src/p_map.c b/src/p_map.c index b249f362..468a5c67 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -316,7 +316,7 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object) break; if (object->player) object->player->kartstuff[k_pogospring] = 1; - K_DoPogoSpring(object, 0, true); + K_DoPogoSpring(object, 0, 0); return; } else @@ -469,7 +469,7 @@ static boolean PIT_CheckThing(mobj_t *thing) #endif // Metal Sonic destroys tiny baby objects. - if (tmthing->type == MT_METALSONIC_RACE + /*if (tmthing->type == MT_METALSONIC_RACE && (thing->flags & (MF_MISSILE|MF_ENEMY|MF_BOSS) || thing->type == MT_SPIKE)) { if ((thing->flags & (MF_ENEMY|MF_BOSS)) && (thing->health <= 0 || !(thing->flags & MF_SHOOTABLE))) @@ -495,7 +495,7 @@ static boolean PIT_CheckThing(mobj_t *thing) P_KillMobj(thing, tmthing, tmthing); } return true; - } + }*/ if (!(thing->flags & (MF_SOLID|MF_SPECIAL|MF_PAIN|MF_SHOOTABLE)) || (thing->flags & MF_NOCLIPTHING)) return true; @@ -647,9 +647,9 @@ static boolean PIT_CheckThing(mobj_t *thing) // check for skulls slamming into things if (tmthing->flags2 & MF2_SKULLFLY) { - if (tmthing->type == MT_EGGMOBILE) // Don't make Eggman stop! + /*if (tmthing->type == MT_EGGMOBILE) // Don't make Eggman stop! return true; // Let him RUN YOU RIGHT OVER. >:3 - else + else*/ { // see if it went over / under if (tmthing->z > thing->z + thing->height) @@ -1133,7 +1133,7 @@ static boolean PIT_CheckThing(mobj_t *thing) return true; // Missiles ignore Brak's helper. - if (thing->type == MT_BLACKEGGMAN_HELPER) + /*if (thing->type == MT_BLACKEGGMAN_HELPER) return true; // Hurting Brak @@ -1144,9 +1144,9 @@ static boolean PIT_CheckThing(mobj_t *thing) if (!(thing->state >= &states[S_BLACKEGG_PAIN1] && thing->state <= &states[S_BLACKEGG_PAIN35])) P_SetMobjState(thing, thing->info->painstate); return false; - } + }*/ - if (!(thing->flags & MF_SHOOTABLE) && !(thing->type == MT_EGGSHIELD)) + if (!(thing->flags & MF_SHOOTABLE)/* && !(thing->type == MT_EGGSHIELD)*/) { // didn't do any damage return !(thing->flags & MF_SOLID); @@ -1157,7 +1157,7 @@ static boolean PIT_CheckThing(mobj_t *thing) && thing->player->pflags & PF_CARRIED && thing->tracer == tmthing->target) return true; // Don't give rings to your carry player by accident. - if (thing->type == MT_EGGSHIELD) + /*if (thing->type == MT_EGGSHIELD) { fixed_t touchx, touchy; angle_t angle; @@ -1183,14 +1183,14 @@ static boolean PIT_CheckThing(mobj_t *thing) P_KillMobj(thing, tmthing, tmthing); return false; } - } + }*/ if (tmthing->type == MT_SHELL && tmthing->threshold > TICRATE) return true; // damage / explode if (tmthing->flags & MF_ENEMY) // An actual ENEMY! (Like the deton, for example) P_DamageMobj(thing, tmthing, tmthing, 1); - else if (tmthing->type == MT_BLACKEGGMAN_MISSILE && thing->player + /*else if (tmthing->type == MT_BLACKEGGMAN_MISSILE && thing->player && (thing->player->pflags & PF_JUMPED) && !thing->player->powers[pw_flashing] && thing->tracer != tmthing @@ -1230,16 +1230,13 @@ static boolean PIT_CheckThing(mobj_t *thing) tmthing->x = thing->x; tmthing->y = thing->y; P_SetThingPosition(tmthing); - } + }*/ else P_DamageMobj(thing, tmthing, tmthing->target, 1); // don't traverse any more - if (tmthing->type == MT_SHELL) - return true; - else - return false; + return (tmthing->type == MT_SHELL); } if (thing->flags & MF_PUSHABLE && (tmthing->player || tmthing->flags & MF_PUSHABLE) @@ -1303,7 +1300,7 @@ static boolean PIT_CheckThing(mobj_t *thing) } // Respawn rings and items - if ((tmthing->type == MT_NIGHTSDRONE || thing->type == MT_NIGHTSDRONE) + /*if ((tmthing->type == MT_NIGHTSDRONE || thing->type == MT_NIGHTSDRONE) && (tmthing->player || thing->player)) { mobj_t *droneobj = (tmthing->type == MT_NIGHTSDRONE) ? tmthing : thing; @@ -1323,7 +1320,7 @@ static boolean PIT_CheckThing(mobj_t *thing) } droneobj->extravalue1 = pl->anotherflyangle; droneobj->extravalue2 = (INT32)leveltime + TICRATE; - } + }*/ // check for special pickup if (thing->flags & MF_SPECIAL && tmthing->player && thing->type != MT_POKEY) @@ -1394,7 +1391,7 @@ static boolean PIT_CheckThing(mobj_t *thing) else if (thing->scale > tmthing->scale + (FRACUNIT/8)) K_SquishPlayer(tmthing->player, thing); - // SRB2kart - Starpower! + // SRB2kart - Invincibility! if (tmthing->player->kartstuff[k_invincibilitytimer] && !thing->player->kartstuff[k_invincibilitytimer]) P_DamageMobj(thing, tmthing, tmthing, 1); else if (thing->player->kartstuff[k_invincibilitytimer] && !tmthing->player->kartstuff[k_invincibilitytimer]) @@ -1440,7 +1437,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->player) { // Doesn't matter what gravity player's following! Just do your stuff in YOUR direction only - if (tmthing->eflags & MFE_VERTICALFLIP + /*if (tmthing->eflags & MFE_VERTICALFLIP && (tmthing->z + tmthing->height + tmthing->momz < thing->z || tmthing->z + tmthing->height + tmthing->momz >= thing->z + thing->height)) ; @@ -1462,7 +1459,7 @@ static boolean PIT_CheckThing(mobj_t *thing) // The tmthing->target allows the pusher of the object // to get the point if he topples it on an opponent. } - } + }*/ if (tmthing->type == MT_FAN || tmthing->type == MT_STEAM) P_DoFanAndGasJet(tmthing, thing); @@ -1585,9 +1582,9 @@ static boolean PIT_CheckThing(mobj_t *thing) ; // Fix a few nasty spring-jumping bugs that happen sometimes. // Monitors are not treated as solid to players who are jumping, spinning or gliding, // unless it's a CTF team monitor and you're on the wrong team - else if (thing->flags & MF_MONITOR && tmthing->player && tmthing->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING) + /*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))) - ; + ;*/ // z checking at last // Treat noclip things as non-solid! else if ((thing->flags & (MF_SOLID|MF_NOCLIP)) == MF_SOLID diff --git a/src/p_mobj.c b/src/p_mobj.c index 0f065733..32ac6550 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -48,6 +48,7 @@ actioncache_t actioncachehead; static mobj_t *overlaycap = NULL; static mobj_t *shadowcap = NULL; +mobj_t *waypointcap = NULL; void P_InitCachedActions(void) { @@ -494,7 +495,7 @@ boolean P_WeaponOrPanel(mobjtype_t type) // // Power Stone emerald management // -void P_EmeraldManager(void) +/*void P_EmeraldManager(void) { thinker_t *think; mobj_t *mo; @@ -663,7 +664,7 @@ void P_EmeraldManager(void) break; } } -} +}*/ // // P_ExplodeMissile @@ -4006,7 +4007,8 @@ void P_RecalcPrecipInSector(sector_t *sector) // void P_NullPrecipThinker(precipmobj_t *mobj) { - (void)mobj; + //(void)mobj; + mobj->precipflags &= ~PCF_THUNK; } void P_SnowThinker(precipmobj_t *mobj) @@ -4026,25 +4028,26 @@ void P_RainThinker(precipmobj_t *mobj) { // cycle through states, // calling action functions at transitions - if (mobj->tics > 0 && --mobj->tics == 0) - { - // you can cycle through multiple states in a tic - if (!P_SetPrecipMobjState(mobj, mobj->state->nextstate)) - return; // freed itself - } + if (mobj->tics <= 0) + return; + + if (--mobj->tics) + return; + + if (!P_SetPrecipMobjState(mobj, mobj->state->nextstate)) + return; + + if (mobj->state != &states[S_RAINRETURN]) + return; + + mobj->z = mobj->ceilingz; + P_SetPrecipMobjState(mobj, S_RAIN1); - if (mobj->state == &states[S_RAINRETURN]) - { - mobj->z = mobj->ceilingz; - P_SetPrecipMobjState(mobj, S_RAIN1); - } return; } // adjust height - mobj->z += mobj->momz; - - if (mobj->z <= mobj->floorz) + if ((mobj->z += mobj->momz) <= mobj->floorz) { // no splashes on sky or bottomless pits if (mobj->precipflags & PCF_PIT) @@ -6058,7 +6061,7 @@ static void P_NightsItemChase(mobj_t *thing) P_Attract(thing, thing->tracer, true); } -static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield) +/*static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield) { if (!thing->target || thing->target->health <= 0 || !thing->target->player || (thing->target->player->powers[pw_shield] & SH_NOSTACK) == SH_NONE || thing->target->player->powers[pw_super] @@ -6174,7 +6177,7 @@ static boolean P_AddShield(mobj_t *thing) P_SetTarget(&shields[numshields++], thing); return true; -} +}*/ void P_RunOverlays(void) { @@ -6608,8 +6611,8 @@ void P_MobjThinker(mobj_t *mobj) P_RemoveMobj(mobj); return; } - else - P_AddOverlay(mobj); + + P_AddOverlay(mobj); break; case MT_SHADOW: if (!mobj->target) @@ -6617,10 +6620,10 @@ void P_MobjThinker(mobj_t *mobj) P_RemoveMobj(mobj); return; } - else - P_AddShadow(mobj); + + P_AddShadow(mobj); break; - case MT_BLACKORB: + /*case MT_BLACKORB: case MT_WHITEORB: case MT_GREENORB: case MT_YELLOWORB: @@ -6628,7 +6631,7 @@ void P_MobjThinker(mobj_t *mobj) case MT_PITYORB: if (!P_AddShield(mobj)) return; - break; + break;*/ //{ SRB2kart mobs case MT_ORBINAUT_SHIELD: // Kart orbit/trail items case MT_JAWZ_SHIELD: @@ -8035,7 +8038,7 @@ void P_MobjThinker(mobj_t *mobj) if ((sec2 && GETSECSPECIAL(sec2->special, 3) == 1) || (P_IsObjectOnRealGround(mobj, mobj->subsector->sector) && GETSECSPECIAL(mobj->subsector->sector->special, 3) == 1)) - K_DoPogoSpring(mobj, 0, false); + K_DoPogoSpring(mobj, 0, 1); } if (mobj->threshold > 0) @@ -8110,7 +8113,7 @@ void P_MobjThinker(mobj_t *mobj) if ((sec2 && GETSECSPECIAL(sec2->special, 3) == 1) || (P_IsObjectOnRealGround(mobj, mobj->subsector->sector) && GETSECSPECIAL(mobj->subsector->sector->special, 3) == 1)) - K_DoPogoSpring(mobj, 0, false); + K_DoPogoSpring(mobj, 0, 1); break; } @@ -8139,7 +8142,7 @@ void P_MobjThinker(mobj_t *mobj) if ((sec2 && GETSECSPECIAL(sec2->special, 3) == 1) || (P_IsObjectOnRealGround(mobj, mobj->subsector->sector) && GETSECSPECIAL(mobj->subsector->sector->special, 3) == 1)) - K_DoPogoSpring(mobj, 0, false); + K_DoPogoSpring(mobj, 0, 1); } if (mobj->threshold > 0) @@ -8238,7 +8241,7 @@ void P_MobjThinker(mobj_t *mobj) return; case MT_MINEEXPLOSIONSOUND: if (mobj->health == 100) - S_StartSound(mobj, sfx_prloop); + S_StartSound(mobj, sfx_s3k4e); mobj->health--; break; case MT_BOOSTFLAME: @@ -8266,12 +8269,13 @@ void P_MobjThinker(mobj_t *mobj) P_SetScale(smoke, mobj->target->scale/2); smoke->destscale = 3*mobj->target->scale/2; + smoke->scalespeed = FixedMul(smoke->scalespeed, mobj->target->scale); smoke->momx = mobj->target->momx/2; smoke->momy = mobj->target->momy/2; smoke->momz = mobj->target->momz/2; - P_Thrust(smoke, mobj->target->angle+FixedAngle(P_RandomRange(135, 225)<mobj_scale); + P_Thrust(smoke, mobj->target->angle+FixedAngle(P_RandomRange(135, 225)<target->scale); } break; case MT_SPARKLETRAIL: @@ -8362,7 +8366,7 @@ void P_MobjThinker(mobj_t *mobj) mobj->destscale = mobj->target->destscale; P_SetScale(mobj, mobj->target->scale); mobj->color = mobj->target->color; - mobj->colorized = (mobj->target->player->kartstuff[k_comebackmode] == 1); + mobj->colorized = (mobj->target->player->kartstuff[k_comebackmode]); if (mobj->target->player->kartstuff[k_comebacktimer] > 0) { @@ -8376,12 +8380,15 @@ void P_MobjThinker(mobj_t *mobj) } else { - if (mobj->target->player->kartstuff[k_comebackmode] == 0 + if (!mobj->target->player->kartstuff[k_comebackmode] && mobj->state != &states[mobj->info->spawnstate]) P_SetMobjState(mobj, mobj->info->spawnstate); else if (mobj->target->player->kartstuff[k_comebackmode] == 1 && mobj->state != &states[mobj->info->seestate]) P_SetMobjState(mobj, mobj->info->seestate); + else if (mobj->target->player->kartstuff[k_comebackmode] == 2 + && mobj->state != &states[mobj->info->painstate]) + P_SetMobjState(mobj, mobj->info->painstate); if (mobj->target->player->powers[pw_flashing] && (leveltime & 1)) mobj->flags2 |= MF2_DONTDRAW; @@ -8748,7 +8755,7 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s if (P_MobjWasRemoved(mobj)) return; } - else if (mobj->type == MT_RANDOMITEM && mobj->threshold == 69 && mobj->fuse <= TICRATE) + else if (((mobj->type == MT_RANDOMITEM && mobj->threshold == 69) || mobj->type == MT_FAKEITEM) && mobj->fuse <= TICRATE) mobj->flags2 ^= MF2_DONTDRAW; } @@ -9540,14 +9547,15 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype static inline precipmobj_t *P_SpawnRainMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) { precipmobj_t *mo = P_SpawnPrecipMobj(x,y,z,type); - mo->thinker.function.acp1 = (actionf_p1)P_RainThinker; + mo->precipflags |= PCF_RAIN; + //mo->thinker.function.acp1 = (actionf_p1)P_RainThinker; return mo; } static inline precipmobj_t *P_SpawnSnowMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) { precipmobj_t *mo = P_SpawnPrecipMobj(x,y,z,type); - mo->thinker.function.acp1 = (actionf_p1)P_SnowThinker; + //mo->thinker.function.acp1 = (actionf_p1)P_SnowThinker; return mo; } @@ -9736,13 +9744,12 @@ consvar_t cv_suddendeath = {"suddendeath", "Off", CV_NETVAR|CV_CHEAT, CV_OnOff, void P_SpawnPrecipitation(void) { - INT32 i, j, mrand; + INT32 i, mrand; fixed_t basex, basey, x, y, height; subsector_t *precipsector = NULL; precipmobj_t *rainmo = NULL; - if (dedicated || !cv_precipdensity.value || curWeather == PRECIP_NONE - || netgame) // SRB2Kart + if (dedicated || /*!cv_precipdensity*/!cv_drawdist_precip.value || curWeather == PRECIP_NONE) // SRB2Kart return; // Use the blockmap to narrow down our placing patterns @@ -9751,7 +9758,7 @@ void P_SpawnPrecipitation(void) basex = bmaporgx + (i % bmapwidth) * MAPBLOCKSIZE; basey = bmaporgy + (i / bmapwidth) * MAPBLOCKSIZE; - for (j = 0; j < cv_precipdensity.value; ++j) + //for (j = 0; j < cv_precipdensity.value; ++j) -- density is 1 for kart always { x = basex + ((M_RandomKey(MAPBLOCKUNITS<<3)<>3); y = basey + ((M_RandomKey(MAPBLOCKUNITS<<3)<>3); @@ -9761,7 +9768,11 @@ void P_SpawnPrecipitation(void) // No sector? Stop wasting time, // move on to the next entry in the blockmap if (!precipsector) - break; + continue; + + // Not in a sector with visible sky? + if (precipsector->sector->ceilingpic != skyflatnum) + continue; // Exists, but is too small for reasonable precipitation. if (!(precipsector->sector->floorheight <= precipsector->sector->ceilingheight - (32<sector->ceilingpic != skyflatnum) - continue; - rainmo = P_SpawnSnowMobj(x, y, height, MT_SNOWFLAKE); mrand = M_RandomByte(); if (mrand < 64) @@ -9784,13 +9791,7 @@ void P_SpawnPrecipitation(void) P_SetPrecipMobjState(rainmo, S_SNOW2); } else // everything else. - { - // Not in a sector with visible sky. - if (precipsector->sector->ceilingpic != skyflatnum) - continue; - rainmo = P_SpawnRainMobj(x, y, height, MT_RAIN); - } // Randomly assign a height, now that floorz is set. rainmo->z = M_RandomRange(rainmo->floorz>>FRACBITS, rainmo->ceilingz>>FRACBITS)<health = mthing->angle; + P_SetTarget(&mobj->tracer, waypointcap); + P_SetTarget(&waypointcap, mobj); } else if (i == MT_SPIKE) { diff --git a/src/p_mobj.h b/src/p_mobj.h index 34d1f644..640b7dbb 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -261,6 +261,10 @@ typedef enum { PCF_FOF = 4, // Above MOVING FOF (this means we need to keep floorz up to date...) PCF_MOVINGFOF = 8, + // Is rain. + PCF_RAIN = 16, + // Ran the thinker this tic. + PCF_THUNK = 32, } precipflag_t; // Map Object definition. typedef struct mobj_s @@ -429,6 +433,8 @@ typedef struct actioncache_s extern actioncache_t actioncachehead; +extern mobj_t *waypointcap; + void P_InitCachedActions(void); void P_RunCachedActions(void); void P_AddCachedAction(mobj_t *mobj, INT32 statenum); diff --git a/src/p_saveg.c b/src/p_saveg.c index d9f43000..df76497d 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -945,11 +945,10 @@ typedef enum MD2_EXTVAL2 = 1<<6, MD2_HNEXT = 1<<7, MD2_HPREV = 1<<8, + MD2_COLORIZED = 1<<9, + MD2_WAYPOINTCAP = 1<<10 #ifdef ESLOPE - MD2_SLOPE = 1<<9, - MD2_COLORIZED = 1<<10 -#else - MD2_COLORIZED = 1<<9 + , MD2_SLOPE = 1<<11 #endif } mobj_diff2_t; @@ -969,6 +968,7 @@ typedef enum tc_bouncecheese, tc_startcrumble, tc_marioblock, + tc_marioblockchecker, tc_spikesector, tc_floatsector, tc_bridgethinker, @@ -1146,6 +1146,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) #endif if (mobj->colorized) diff2 |= MD2_COLORIZED; + if (mobj == waypointcap) + diff2 |= MD2_WAYPOINTCAP; if (diff2 != 0) diff |= MD_MORE; @@ -1282,7 +1284,10 @@ static void SaveSpecialLevelThinker(const thinker_t *th, const UINT8 type) size_t i; WRITEUINT8(save_p, type); for (i = 0; i < 16; i++) + { WRITEFIXED(save_p, ht->vars[i]); //var[16] + WRITEFIXED(save_p, ht->var2s[i]); //var[16] + } WRITEUINT32(save_p, SaveLine(ht->sourceline)); WRITEUINT32(save_p, SaveSector(ht->sector)); } @@ -1684,8 +1689,7 @@ static void P_NetArchiveThinkers(void) for (th = thinkercap.next; th != &thinkercap; th = th->next) { if (!(th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed - || th->function.acp1 == (actionf_p1)P_RainThinker - || th->function.acp1 == (actionf_p1)P_SnowThinker)) + || th->function.acp1 == (actionf_p1)P_NullPrecipThinker)) numsaved++; if (th->function.acp1 == (actionf_p1)P_MobjThinker) @@ -1694,8 +1698,7 @@ static void P_NetArchiveThinkers(void) continue; } #ifdef PARANOIA - else if (th->function.acp1 == (actionf_p1)P_RainThinker - || th->function.acp1 == (actionf_p1)P_SnowThinker); + else if (th->function.acp1 == (actionf_p1)P_NullPrecipThinker); #endif else if (th->function.acp1 == (actionf_p1)T_MoveCeiling) { @@ -1797,6 +1800,11 @@ static void P_NetArchiveThinkers(void) SaveSpecialLevelThinker(th, tc_marioblock); continue; } + else if (th->function.acp1 == (actionf_p1)T_MarioBlockChecker) + { + SaveSpecialLevelThinker(th, tc_marioblockchecker); + continue; + } else if (th->function.acp1 == (actionf_p1)T_SpikeSector) { SaveSpecialLevelThinker(th, tc_spikesector); @@ -2165,6 +2173,9 @@ static void LoadMobjThinker(actionf_p1 thinker) P_AddThinker(&mobj->thinker); + if (diff2 & MD2_WAYPOINTCAP) + P_SetTarget(&waypointcap, mobj); + mobj->info = (mobjinfo_t *)next; // temporarily, set when leave this function } @@ -2185,7 +2196,10 @@ static void LoadSpecialLevelThinker(actionf_p1 thinker, UINT8 floorOrCeiling) size_t i; ht->thinker.function.acp1 = thinker; for (i = 0; i < 16; i++) + { ht->vars[i] = READFIXED(save_p); //var[16] + ht->var2s[i] = READFIXED(save_p); //var[16] + } ht->sourceline = LoadLine(READUINT32(save_p)); ht->sector = LoadSector(READUINT32(save_p)); @@ -2758,6 +2772,10 @@ static void P_NetUnArchiveThinkers(void) LoadSpecialLevelThinker((actionf_p1)T_MarioBlock, 3); break; + case tc_marioblockchecker: + LoadSpecialLevelThinker((actionf_p1)T_MarioBlockChecker, 0); + break; + case tc_spikesector: LoadSpecialLevelThinker((actionf_p1)T_SpikeSector, 0); break; diff --git a/src/p_setup.c b/src/p_setup.c index 6c7b6e92..a606dca0 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2782,7 +2782,6 @@ boolean P_SetupLevel(boolean skipprecip) P_CreateBlockMap(); // Graue 02-29-2004 P_LoadSideDefs2(lastloadedmaplumpnum + ML_SIDEDEFS); - R_MakeColormaps(); P_LoadLineDefs2(); P_LoadSubsectors(lastloadedmaplumpnum + ML_SSECTORS); P_LoadNodes(lastloadedmaplumpnum + ML_NODES); @@ -2865,7 +2864,6 @@ boolean P_SetupLevel(boolean skipprecip) if (players[i].starposttime) { G_SpawnPlayer(i, true); - P_ClearStarPost(players[i].starpostnum); } else G_SpawnPlayer(i, false); @@ -2916,7 +2914,9 @@ boolean P_SetupLevel(boolean skipprecip) } else if (G_RaceGametype() && server) CV_StealthSetValue(&cv_numlaps, - ((netgame || multiplayer) && cv_basenumlaps.value) + ((netgame || multiplayer) && cv_basenumlaps.value + && (!(mapheaderinfo[gamemap - 1]->levelflags & LF_SECTIONRACE) + || (mapheaderinfo[gamemap - 1]->numlaps > cv_basenumlaps.value))) ? cv_basenumlaps.value : mapheaderinfo[gamemap - 1]->numlaps); diff --git a/src/p_slopes.c b/src/p_slopes.c index c516fa97..35d4c423 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -251,7 +251,7 @@ void P_SpawnSlope_Line(int linenum) UINT8 flags = 0; // Slope flags if (line->flags & ML_NOSONIC) flags |= SL_NOPHYSICS; - if (line->flags & ML_NOTAILS) + if (!(line->flags & ML_NOTAILS)) flags |= SL_NODYNAMIC; if (line->flags & ML_NOKNUX) flags |= SL_ANCHORVERTEX; diff --git a/src/p_spec.c b/src/p_spec.c index 17cd1f88..50aa9188 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1707,16 +1707,16 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller if (actor && actor->player && triggerline->flags & ML_EFFECT4) { - if (maptol & TOL_NIGHTS) + /*if (maptol & TOL_NIGHTS) lap = actor->player->mare; - else + else*/ lap = actor->player->laps; } else { - if (maptol & TOL_NIGHTS) + /*if (maptol & TOL_NIGHTS) lap = P_FindLowestMare(); - else + else*/ lap = P_FindLowestLap(); } @@ -2056,8 +2056,7 @@ void P_SwitchWeather(INT32 weathernum) for (think = thinkercap.next; think != &thinkercap; think = think->next) { - if ((think->function.acp1 != (actionf_p1)P_SnowThinker) - && (think->function.acp1 != (actionf_p1)P_RainThinker)) + if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker) continue; // not a precipmobj thinker precipmobj = (precipmobj_t *)think; @@ -2073,14 +2072,12 @@ void P_SwitchWeather(INT32 weathernum) for (think = thinkercap.next; think != &thinkercap; think = think->next) { + if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker) + continue; // not a precipmobj thinker + precipmobj = (precipmobj_t *)think; + if (swap == PRECIP_RAIN) // Snow To Rain { - if (!(think->function.acp1 == (actionf_p1)P_SnowThinker - || think->function.acp1 == (actionf_p1)P_NullPrecipThinker)) - continue; // not a precipmobj thinker - - precipmobj = (precipmobj_t *)think; - precipmobj->flags = mobjinfo[MT_RAIN].flags; st = &states[mobjinfo[MT_RAIN].spawnstate]; precipmobj->state = st; @@ -2091,18 +2088,13 @@ void P_SwitchWeather(INT32 weathernum) precipmobj->precipflags &= ~PCF_INVISIBLE; - think->function.acp1 = (actionf_p1)P_RainThinker; + precipmobj->precipflags |= PCF_RAIN; + //think->function.acp1 = (actionf_p1)P_RainThinker; } else if (swap == PRECIP_SNOW) // Rain To Snow { INT32 z; - if (!(think->function.acp1 == (actionf_p1)P_RainThinker - || think->function.acp1 == (actionf_p1)P_NullPrecipThinker)) - continue; // not a precipmobj thinker - - precipmobj = (precipmobj_t *)think; - precipmobj->flags = mobjinfo[MT_SNOWFLAKE].flags; z = M_RandomByte(); @@ -2120,19 +2112,13 @@ void P_SwitchWeather(INT32 weathernum) precipmobj->frame = st->frame; precipmobj->momz = mobjinfo[MT_SNOWFLAKE].speed; - precipmobj->precipflags &= ~PCF_INVISIBLE; + precipmobj->precipflags &= ~(PCF_INVISIBLE|PCF_RAIN); - think->function.acp1 = (actionf_p1)P_SnowThinker; + //think->function.acp1 = (actionf_p1)P_SnowThinker; } else if (swap == PRECIP_BLANK || swap == PRECIP_STORM_NORAIN) // Remove precip, but keep it around for reuse. { - if (!(think->function.acp1 == (actionf_p1)P_RainThinker - || think->function.acp1 == (actionf_p1)P_SnowThinker)) - continue; - - precipmobj = (precipmobj_t *)think; - - think->function.acp1 = (actionf_p1)P_NullPrecipThinker; + //think->function.acp1 = (actionf_p1)P_NullPrecipThinker; precipmobj->precipflags |= PCF_INVISIBLE; } @@ -3790,7 +3776,7 @@ DoneSection2: P_InstaThrust(player->mo, player->mo->angle, minspeed); player->kartstuff[k_pogospring] = 1; - K_DoPogoSpring(player->mo, 0, false); + K_DoPogoSpring(player->mo, 0, 1); } break; @@ -3813,7 +3799,7 @@ DoneSection2: P_InstaThrust(player->mo, player->mo->angle, minspeed); player->kartstuff[k_pogospring] = 2; - K_DoPogoSpring(player->mo, 0, false); + K_DoPogoSpring(player->mo, 0, 1); } break; @@ -4252,7 +4238,6 @@ DoneSection2: // //player->starpostangle = player->starposttime = player->starpostnum = 0; //player->starpostx = player->starposty = player->starpostz = 0; - P_ResetStarposts(); // Play the starpost sound for 'consistency' // S_StartSound(player->mo, sfx_strpst); @@ -5821,10 +5806,8 @@ void P_SpawnSpecials(INT32 fromnetsave) } else // Otherwise, set calculated offsets such that line's v1 is the apparent origin { - fixed_t cosinecomponent = FINECOSINE(flatangle>>ANGLETOFINESHIFT); - fixed_t sinecomponent = FINESINE(flatangle>>ANGLETOFINESHIFT); - xoffs = (-FixedMul(lines[i].v1->x, cosinecomponent) % MAXFLATSIZE) + (FixedMul(lines[i].v1->y, sinecomponent) % MAXFLATSIZE); // No danger of overflow thanks to the strategically placed modulo operations. - yoffs = (FixedMul(lines[i].v1->x, sinecomponent) % MAXFLATSIZE) + (FixedMul(lines[i].v1->y, cosinecomponent) % MAXFLATSIZE); // Ditto. + xoffs = -lines[i].v1->x; + yoffs = lines[i].v1->y; } for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) diff --git a/src/p_telept.c b/src/p_telept.c index 69573640..89a28ddc 100644 --- a/src/p_telept.c +++ b/src/p_telept.c @@ -96,10 +96,6 @@ void P_MixUp(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, thing->player->starpostangle = starpostangle; thing->player->starpostnum = starpostnum; - // Reset map starposts for the player's new info. - P_ResetStarposts(); - P_ClearStarPost(starpostnum); - P_ResetPlayer(thing->player); P_SetPlayerMobjState(thing, S_KART_STND1); // SRB2kart - was S_PLAY_STND diff --git a/src/p_tick.c b/src/p_tick.c index 3a55353d..9b59e70d 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -57,12 +57,12 @@ void Command_Numthinkers_f(void) CONS_Printf(M_GetText("numthinkers <#>: Count number of thinkers\n")); CONS_Printf( "\t1: P_MobjThinker\n" - "\t2: P_RainThinker\n" - "\t3: P_SnowThinker\n" - "\t4: P_NullPrecipThinker\n" - "\t5: T_Friction\n" - "\t6: T_Pusher\n" - "\t7: P_RemoveThinkerDelayed\n"); + /*"\t2: P_RainThinker\n" + "\t3: P_SnowThinker\n"*/ + "\t2: P_NullPrecipThinker\n" + "\t3: T_Friction\n" + "\t4: T_Pusher\n" + "\t5: P_RemoveThinkerDelayed\n"); return; } @@ -74,27 +74,27 @@ void Command_Numthinkers_f(void) action = (actionf_p1)P_MobjThinker; CONS_Printf(M_GetText("Number of %s: "), "P_MobjThinker"); break; - case 2: + /*case 2: action = (actionf_p1)P_RainThinker; CONS_Printf(M_GetText("Number of %s: "), "P_RainThinker"); break; case 3: action = (actionf_p1)P_SnowThinker; CONS_Printf(M_GetText("Number of %s: "), "P_SnowThinker"); - break; - case 4: + break;*/ + case 2: action = (actionf_p1)P_NullPrecipThinker; CONS_Printf(M_GetText("Number of %s: "), "P_NullPrecipThinker"); break; - case 5: + case 3: action = (actionf_p1)T_Friction; CONS_Printf(M_GetText("Number of %s: "), "T_Friction"); break; - case 6: + case 4: action = (actionf_p1)T_Pusher; CONS_Printf(M_GetText("Number of %s: "), "T_Pusher"); break; - case 7: + case 5: action = (actionf_p1)P_RemoveThinkerDelayed; CONS_Printf(M_GetText("Number of %s: "), "P_RemoveThinkerDelayed"); break; @@ -180,6 +180,7 @@ void Command_CountMobjs_f(void) void P_InitThinkers(void) { thinkercap.prev = thinkercap.next = &thinkercap; + waypointcap = NULL; } // @@ -309,7 +310,7 @@ static inline void P_RunThinkers(void) // // Determine if the teams are unbalanced, and if so, move a player to the other team. // -static void P_DoAutobalanceTeams(void) +/*static void P_DoAutobalanceTeams(void) { changeteam_union NetPacket; UINT16 usvalue; @@ -561,7 +562,7 @@ static inline void P_DoCTFStuff(void) if (cv_teamscramble.value && server) P_DoTeamscrambling(); } -} +}*/ // // P_Ticker @@ -611,11 +612,11 @@ void P_Ticker(boolean run) if (!demoplayback) // Don't increment if a demo is playing. totalplaytime++; - if (!useNightsSS && G_IsSpecialStage(gamemap)) + /*if (!useNightsSS && G_IsSpecialStage(gamemap)) P_DoSpecialStageStuff(); if (runemeraldmanager) - P_EmeraldManager(); // Power stone mode + P_EmeraldManager(); // Power stone mode*/ if (run) { @@ -632,7 +633,7 @@ void P_Ticker(boolean run) } // Run shield positioning - P_RunShields(); + //P_RunShields(); P_RunOverlays(); P_RunShadows(); @@ -647,11 +648,11 @@ void P_Ticker(boolean run) leveltime++; timeinmap++; - if (G_TagGametype()) + /*if (G_TagGametype()) P_DoTagStuff(); if (G_GametypeHasTeams()) - P_DoCTFStuff(); + P_DoCTFStuff();*/ if (run) { @@ -747,6 +748,16 @@ void P_Ticker(boolean run) D_MapChange(gamemap, gametype, encoremode, true, 0, false, false); } + // Always move the camera. + if (camera.chase) + P_MoveChaseCamera(&players[displayplayer], &camera, false); + if (splitscreen && camera2.chase) + P_MoveChaseCamera(&players[secondarydisplayplayer], &camera2, false); + if (splitscreen > 1 && camera3.chase) + P_MoveChaseCamera(&players[thirddisplayplayer], &camera3, false); + if (splitscreen > 2 && camera4.chase) + P_MoveChaseCamera(&players[fourthdisplayplayer], &camera4, false); + P_MapEnd(); // Z_CheckMemCleanup(); @@ -792,7 +803,7 @@ void P_PreTicker(INT32 frames) #endif // Run shield positioning - P_RunShields(); + //P_RunShields(); P_RunOverlays(); P_UpdateSpecials(); diff --git a/src/p_user.c b/src/p_user.c index d3407bd6..472d7c27 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -344,7 +344,7 @@ void P_ResetScore(player_t *player) // // Returns the lowest open mare available // -UINT8 P_FindLowestMare(void) +/*UINT8 P_FindLowestMare(void) { thinker_t *th; mobj_t *mo2; @@ -375,7 +375,7 @@ UINT8 P_FindLowestMare(void) CONS_Debug(DBG_NIGHTS, "Lowest mare found: %d\n", mare); return mare; -} +}*/ // // P_FindLowestLap @@ -438,7 +438,7 @@ UINT8 P_FindHighestLap(void) // (Finds the lowest mare # for capsules that have not been destroyed). // Returns true if successful, false if there is no other mare. // -boolean P_TransferToNextMare(player_t *player) +/*boolean P_TransferToNextMare(player_t *player) { thinker_t *th; mobj_t *mo2; @@ -759,7 +759,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) if (G_IsSpecialStage(gamemap)) { for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i]/* && players[i].pflags & PF_NIGHTSMODE*/) + if (playeringame[i]) total_rings += players[i].health-1; } @@ -782,10 +782,6 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) P_AddPlayerScore(&players[i], (players[i].health - 1) * 50); } - // Add score to leaderboards now - /*if (!(netgame||multiplayer) && P_IsLocalPlayer(&players[i])) - G_AddTempNightsRecords(players[i].marescore, leveltime - player->marebegunat, players[i].mare + 1);*/ - // transfer scores anyway players[i].mo->health = players[i].health = 1; @@ -803,10 +799,6 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) player->textvar = 4; // Score and grades player->finishedrings = (INT16)(player->health - 1); - // Add score to temp leaderboards - /*if (!(netgame||multiplayer) && P_IsLocalPlayer(player)) - G_AddTempNightsRecords(player->marescore, leveltime - player->marebegunat, (UINT8)(oldmare + 1));*/ - // Starting a new mare, transfer scores player->marebegunat = leveltime; @@ -824,7 +816,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) } player->pflags |= PF_NIGHTSMODE; -} +}*/ // // P_PlayerInPain @@ -4536,7 +4528,7 @@ INT32 P_GetPlayerControlDirection(player_t *player) } // Control scheme for 2d levels. -static void P_2dMovement(player_t *player) +/*static void P_2dMovement(player_t *player) { ticcmd_t *cmd; INT32 topspeed, acceleration, thrustfactor; @@ -4713,7 +4705,7 @@ static void P_2dMovement(player_t *player) else if (player->rmomx > -topspeed && cmd->sidemove < 0) P_Thrust(player->mo, movepushangle, movepushforward); } -} +}*/ //#define OLD_MOVEMENT_CODE 1 static void P_3dMovement(player_t *player) @@ -5004,7 +4996,7 @@ static void P_SpectatorMovement(player_t *player) // graphical indicator // for building/debugging // NiGHTS levels! -static void P_ShootLine(mobj_t *source, mobj_t *dest, fixed_t height) +/*static void P_ShootLine(mobj_t *source, mobj_t *dest, fixed_t height) { mobj_t *mo; INT32 i; @@ -5578,16 +5570,6 @@ static void P_DoNiGHTSCapsule(player_t *player) UINT8 em = P_GetNextEmerald(); tic_t lowest_time; - /*for (i = 0; i < MAXPLAYERS; i++) - { - if (!playeringame[i] || players[i].spectator || !players[i].mo || !players[i].mo->tracer) - continue; - - emmo = P_SpawnMobj(players[i].mo->x, players[i].mo->y, players[i].mo->z + players[i].mo->info->height, MT_GOTEMERALD); - P_SetTarget(&emmo->target, players[i].mo); - P_SetMobjState(emmo, mobjinfo[MT_GOTEMERALD].meleestate + em); - }*/ - if (player->mo->tracer) { // Only give it to ONE person, and THAT player has to get to the goal! @@ -5683,7 +5665,7 @@ static void P_NiGHTSMovement(player_t *player) boolean capsule = false; // NiGHTS special stages have a pseudo-shared timer, so check if ANYONE is feeding the capsule. for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i] /*&& players[i].pflags & PF_NIGHTSMODE*/ + if (playeringame[i] && (players[i].capsule && players[i].capsule->reactiontime)) capsule = true; if (!capsule @@ -6238,7 +6220,7 @@ static void P_NiGHTSMovement(player_t *player) if (objectplacing) OP_NightsObjectplace(player); -} +}*/ // May be used in future for CTF #if 0 @@ -6457,7 +6439,7 @@ void P_ElementalFireTrail(player_t *player) static void P_MovePlayer(player_t *player) { ticcmd_t *cmd; - INT32 i; + //INT32 i; fixed_t runspd; @@ -6532,7 +6514,7 @@ static void P_MovePlayer(player_t *player) } // Locate the capsule for this mare. - else if (maptol & TOL_NIGHTS) + /*else if (maptol & TOL_NIGHTS) { if (!player->capsule && !player->bonustime) { @@ -6585,15 +6567,15 @@ static void P_MovePlayer(player_t *player) P_DamageMobj(player->mo, NULL, NULL, 1); player->pflags &= ~PF_NIGHTSFALL; } - } + }*/ ////////////////////// // MOVEMENT CODE // ////////////////////// - if (twodlevel || player->mo->flags2 & MF2_TWOD) // 2d-level, so special control applies. + /*if (twodlevel || player->mo->flags2 & MF2_TWOD) // 2d-level, so special control applies. P_2dMovement(player); - else + else*/ { if (!player->climbing && (!P_AnalogMove(player))) player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */); @@ -6680,36 +6662,17 @@ static void P_MovePlayer(player_t *player) P_SetPlayerMobjState(player->mo, S_KART_STND1); // SRB2kart - was S_PLAY_STND //{ SRB2kart - // Engine Sounds. - if (!player->exiting) - { - if (player->speed == 0 && onground && player->speed == 0 && leveltime % 6 == 0) - S_StartSound(player->mo, sfx_kart1); - if ((player->speed < runspd && player->speed != 0) && leveltime % 8 == 0) - S_StartSound(player->mo, sfx_kart2); - - if ((player->speed > runspd) && leveltime % 8 == 0) - S_StartSound(player->mo, sfx_kart3); - - // Drifting sound - { - // Start looping the sound now. - if (leveltime % 50 == 0 && onground - && player->kartstuff[k_drift] != 0) - S_StartSound(player->mo, sfx_mkdrft); - // Leveltime being 50 might take a while at times. We'll start it up once, isntantly. - else if ((player->kartstuff[k_drift] >= 1 || player->kartstuff[k_drift] <= -1) && !S_SoundPlaying(player->mo, sfx_mkdrft) && onground) - S_StartSound(player->mo, sfx_mkdrft); - // Ok, we'll stop now. - else if ((player->kartstuff[k_drift] == 0) - && (player == &players[consoleplayer] - || (splitscreen && player == &players[secondarydisplayplayer]) - || (splitscreen > 1 && player == &players[thirddisplayplayer]) - || (splitscreen > 2 && player == &players[fourthdisplayplayer]))) - S_StopSoundByID(player->mo, sfx_mkdrft); - } - } + // Drifting sound + // Start looping the sound now. + if (leveltime % 50 == 0 && onground && player->kartstuff[k_drift] != 0) + S_StartSound(player->mo, sfx_mkdrft); + // Leveltime being 50 might take a while at times. We'll start it up once, isntantly. + else if (!S_SoundPlaying(player->mo, sfx_mkdrft) && onground && player->kartstuff[k_drift] != 0) + S_StartSound(player->mo, sfx_mkdrft); + // Ok, we'll stop now. + else if (player->kartstuff[k_drift] == 0) + S_StopSoundByID(player->mo, sfx_mkdrft); K_MoveKartPlayer(player, onground); //} @@ -7915,7 +7878,7 @@ static void P_DeathThink(player_t *player) /*if (player->deadtimer > 30*TICRATE && !G_RaceGametype()) player->playerstate = PST_REBORN; else if (player->lives > 0 && !G_IsSpecialStage(gamemap)*/ - if (player->lives > 0 && leveltime >= starttime) // *could* you respawn? + if (player->lives > 0 /*&& leveltime >= starttime*/) // *could* you respawn? { // SRB2kart - spawn automatically after 1 second if (player->deadtimer > ((netgame || multiplayer) @@ -8180,15 +8143,21 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall subsector_t *newsubsec; fixed_t f1, f2; + // We probably shouldn't move the camera if there is no player or player mobj somehow + if (!player || !player->mo) + return true; + + mo = player->mo; + #ifdef NOCLIPCAM cameranoclip = true; // We like camera noclip! #else cameranoclip = ((player->pflags & (PF_NOCLIP|PF_NIGHTSMODE)) - || (player->mo->flags & (MF_NOCLIP|MF_NOCLIPHEIGHT)) // Noclipping player camera noclips too!! + || (mo->flags & (MF_NOCLIP|MF_NOCLIPHEIGHT)) // Noclipping player camera noclips too!! || (leveltime < introtime)); // Kart intro cam #endif - if (!(player->climbing || (player->pflags & PF_NIGHTSMODE) || player->playerstate == PST_DEAD)) + if (!(player->playerstate == PST_DEAD || player->exiting)) { if (player->spectator) // force cam off for spectators return true; @@ -8217,7 +8186,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall else if (player == &players[fourthdisplayplayer]) focusangle = localangle4; else - focusangle = player->mo->angle; + focusangle = mo->angle; if (thiscam == &camera) camrotate = cv_cam_rotate.value; else if (thiscam == &camera2) @@ -8238,17 +8207,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall return true; } - if (!player || !player->mo) - return true; - - mo = player->mo; - thiscam->radius = FixedMul(20*FRACUNIT, mapheaderinfo[gamemap-1]->mobj_scale); thiscam->height = FixedMul(16*FRACUNIT, mapheaderinfo[gamemap-1]->mobj_scale); - if (!mo) - return true; - // Don't run while respawning from a starpost // Inu 4/8/13 Why not?! // if (leveltime > 0 && timeinmap <= 0) @@ -8256,7 +8217,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (player->pflags & PF_NIGHTSMODE) { - focusangle = player->mo->angle; + focusangle = mo->angle; focusaiming = 0; } else if (player == &players[consoleplayer]) @@ -8281,7 +8242,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall } else { - focusangle = player->mo->angle; + focusangle = mo->angle; focusaiming = player->aiming; } @@ -8681,9 +8642,10 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall { // Don't let the camera match your movement. thiscam->momz = 0; - + if (player->spectator) + thiscam->aiming = 0; // Only let the camera go a little bit downwards. - if (!(mo->eflags & MFE_VERTICALFLIP) && thiscam->aiming < ANGLE_337h && thiscam->aiming > ANGLE_180) + else if (!(mo->eflags & MFE_VERTICALFLIP) && thiscam->aiming < ANGLE_337h && thiscam->aiming > ANGLE_180) thiscam->aiming = ANGLE_337h; else if (mo->eflags & MFE_VERTICALFLIP && thiscam->aiming > ANGLE_22h && thiscam->aiming < ANGLE_180) thiscam->aiming = ANGLE_22h; @@ -8945,8 +8907,6 @@ void P_DoTimeOver(player_t *player) // P_PlayerThink // -boolean playerdeadview; // show match/chaos/tag/capture the flag rankings while in death view - void P_PlayerThink(player_t *player) { ticcmd_t *cmd; @@ -9129,10 +9089,6 @@ void P_PlayerThink(player_t *player) if (player->playerstate == PST_DEAD) { player->mo->flags2 &= ~MF2_SHADOW; - // show the multiplayer rankings while dead - if (player == &players[displayplayer]) - playerdeadview = true; - P_DeathThink(player); return; @@ -9157,9 +9113,6 @@ void P_PlayerThink(player_t *player) player->lives = 1; // SRB2Kart #endif - if (player == &players[displayplayer]) - playerdeadview = false; - // SRB2kart 010217 if (leveltime < starttime) player->powers[pw_nocontrol] = 2; @@ -9441,8 +9394,8 @@ void P_PlayerThink(player_t *player) player->losstime--; // Flash player after being hit. - if (!(player->pflags & PF_NIGHTSMODE - || player->kartstuff[k_hyudorotimer] // SRB2kart - fixes Hyudoro not flashing when it should. + if (!(//player->pflags & PF_NIGHTSMODE || + player->kartstuff[k_hyudorotimer] // SRB2kart - fixes Hyudoro not flashing when it should. || player->kartstuff[k_growshrinktimer] > 0 // Grow doesn't flash either. || player->kartstuff[k_respawn] // Respawn timer (for drop dash effect) || (G_BattleGametype() && player->kartstuff[k_bumper] <= 0 && player->kartstuff[k_comebacktimer]) @@ -9454,13 +9407,13 @@ void P_PlayerThink(player_t *player) else player->mo->flags2 &= ~MF2_DONTDRAW; } - else if (player->mo->tracer) + /*else if (player->mo->tracer) { if (player->powers[pw_flashing] & 1) player->mo->tracer->flags2 |= MF2_DONTDRAW; else player->mo->tracer->flags2 &= ~MF2_DONTDRAW; - } + }*/ player->pflags &= ~PF_SLIDING; @@ -9546,12 +9499,6 @@ void P_PlayerAfterThink(player_t *player) if (player->playerstate == PST_DEAD) { - // camera may still move when guy is dead - //if (!netgame) - { - if (thiscam && thiscam->chase) - P_MoveChaseCamera(player, thiscam, false); - } return; } @@ -9833,8 +9780,6 @@ void P_PlayerAfterThink(player_t *player) player->viewz = player->mo->z + player->mo->height - player->viewheight; else player->viewz = player->mo->z + player->viewheight; - if (server || addedtogame) - P_MoveChaseCamera(player, thiscam, false); // calculate the camera movement } } diff --git a/src/r_bsp.c b/src/r_bsp.c index 34b082ca..c06c48dd 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -222,30 +222,6 @@ void R_PortalClearClipSegs(INT32 start, INT32 end) newend = solidsegs + 2; } - -// R_DoorClosed -// -// This function is used to fix the automap bug which -// showed lines behind closed doors simply because the door had a dropoff. -// -// It assumes that Doom has already ruled out a door being closed because -// of front-back closure (e.g. front floor is taller than back ceiling). -static INT32 R_DoorClosed(void) -{ - return - - // if door is closed because back is shut: - backsector->ceilingheight <= backsector->floorheight - - // preserve a kind of transparent door/lift special effect: - && (backsector->ceilingheight >= frontsector->ceilingheight || curline->sidedef->toptexture) - - && (backsector->floorheight <= frontsector->floorheight || curline->sidedef->bottomtexture) - - // properly render skies (consider door "open" if both ceilings are sky): - && (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum); -} - // // If player's view height is underneath fake floor, lower the // drawn ceiling to be just under the floor height, and replace @@ -502,21 +478,24 @@ static void R_AddLine(seg_t *line) 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)) + if (viewsector != backsector && viewsector != frontsector) { - goto clipsolid; + 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; } - // 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) @@ -527,16 +506,23 @@ static void R_AddLine(seg_t *line) else #endif { - if (backsector->ceilingheight <= frontsector->floorheight - || backsector->floorheight >= frontsector->ceilingheight) + if (viewsector != backsector && viewsector != frontsector) { - goto clipsolid; - } + 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; + // Check for automap fix. Store in doorclosed for r_segs.c + doorclosed = (backsector->ceilingheight <= backsector->floorheight + && (backsector->ceilingheight >= frontsector->ceilingheight || curline->sidedef->toptexture) + && (backsector->floorheight <= frontsector->floorheight || curline->sidedef->bottomtexture) + && (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum)); + + if (doorclosed) + goto clipsolid; + } // Window. if (backsector->ceilingheight != frontsector->ceilingheight @@ -1126,30 +1112,12 @@ static void R_Subsector(size_t num, UINT8 viewnumber) && polysec->floorheight >= floorcenterz && (viewz < polysec->floorheight)) { - fixed_t xoff, yoff; - xoff = polysec->floor_xoffs; - yoff = polysec->floor_yoffs; - - if (po->angle != 0) { - angle_t fineshift = po->angle >> ANGLETOFINESHIFT; - - xoff -= FixedMul(FINECOSINE(fineshift), po->centerPt.x)+FixedMul(FINESINE(fineshift), po->centerPt.y); - yoff -= FixedMul(FINESINE(fineshift), po->centerPt.x)-FixedMul(FINECOSINE(fineshift), po->centerPt.y); - } else { - xoff -= po->centerPt.x; - yoff += po->centerPt.y; - } - light = R_GetPlaneLight(frontsector, polysec->floorheight, viewz < polysec->floorheight); light = 0; ffloor[numffloors].plane = R_FindPlane(polysec->floorheight, polysec->floorpic, - polysec->lightlevel, xoff, yoff, + polysec->lightlevel, polysec->floor_xoffs, polysec->floor_yoffs, polysec->floorpic_angle-po->angle, - NULL, - NULL -#ifdef POLYOBJECTS_PLANES - , po -#endif + NULL, NULL, po #ifdef ESLOPE , NULL // will ffloors be slopable eventually? #endif @@ -1174,28 +1142,12 @@ static void R_Subsector(size_t num, UINT8 viewnumber) && polysec->ceilingheight <= ceilingcenterz && (viewz > polysec->ceilingheight)) { - fixed_t xoff, yoff; - xoff = polysec->ceiling_xoffs; - yoff = polysec->ceiling_yoffs; - - if (po->angle != 0) { - angle_t fineshift = po->angle >> ANGLETOFINESHIFT; - - xoff -= FixedMul(FINECOSINE(fineshift), po->centerPt.x)+FixedMul(FINESINE(fineshift), po->centerPt.y); - yoff -= FixedMul(FINESINE(fineshift), po->centerPt.x)-FixedMul(FINECOSINE(fineshift), po->centerPt.y); - } else { - xoff -= po->centerPt.x; - yoff += po->centerPt.y; - } - light = R_GetPlaneLight(frontsector, polysec->ceilingheight, viewz < polysec->ceilingheight); light = 0; ffloor[numffloors].plane = R_FindPlane(polysec->ceilingheight, polysec->ceilingpic, - polysec->lightlevel, xoff, yoff, polysec->ceilingpic_angle-po->angle, - NULL, NULL -#ifdef POLYOBJECTS_PLANES - , po -#endif + polysec->lightlevel, polysec->ceiling_xoffs, polysec->ceiling_yoffs, + polysec->ceilingpic_angle-po->angle, + NULL, NULL, po #ifdef ESLOPE , NULL // will ffloors be slopable eventually? #endif diff --git a/src/r_data.c b/src/r_data.c index 9c7f2851..13b4957b 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -476,40 +476,22 @@ void R_LoadTextures(void) } else { - UINT16 patchcount = 1; //CONS_Printf("\n\"%s\" is a single patch, dimensions %d x %d",W_CheckNameForNumPwad((UINT16)w,texstart+j),patchlump->width, patchlump->height); - if (SHORT(patchlump->width) == 64 - && SHORT(patchlump->height) == 64) - { // 64x64 patch - const column_t *column; - for (k = 0; k < SHORT(patchlump->width); k++) - { // Find use of transparency. - column = (const column_t *)((const UINT8 *)patchlump + LONG(patchlump->columnofs[k])); - if (column->length != SHORT(patchlump->height)) - break; - } - if (k == SHORT(patchlump->width)) - patchcount = 2; // No transparency? 64x128 texture. - } - texture = textures[i] = Z_Calloc(sizeof(texture_t) + (sizeof(texpatch_t) * patchcount), PU_STATIC, NULL); + texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL); // Set texture properties. M_Memcpy(texture->name, W_CheckNameForNumPwad((UINT16)w, texstart + j), sizeof(texture->name)); texture->width = SHORT(patchlump->width); - texture->height = SHORT(patchlump->height)*patchcount; - texture->patchcount = patchcount; + texture->height = SHORT(patchlump->height); + texture->patchcount = 1; texture->holes = false; // Allocate information for the texture's patches. - for (k = 0; k < patchcount; k++) - { - patch = &texture->patches[k]; + patch = &texture->patches[0]; - patch->originx = 0; - patch->originy = (INT16)(k*patchlump->height); - patch->wad = (UINT16)w; - patch->lump = texstart + j; - } + patch->originx = patch->originy = 0; + patch->wad = (UINT16)w; + patch->lump = texstart + j; Z_Unlock(patchlump); @@ -1071,9 +1053,6 @@ void R_ReInitColormaps(UINT16 num, lumpnum_t newencoremap) static lumpnum_t foundcolormaps[MAXCOLORMAPS]; -static char colormapFixingArray[MAXCOLORMAPS][3][9]; -static size_t carrayindex; - // // R_ClearColormaps // @@ -1085,8 +1064,6 @@ void R_ClearColormaps(void) num_extra_colormaps = 0; - carrayindex = 0; - for (i = 0; i < MAXCOLORMAPS; i++) foundcolormaps[i] = LUMPERROR; @@ -1140,10 +1117,20 @@ static double deltas[256][3], map[256][3]; static UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b); static int RoundUp(double number); +#ifdef HASINVERT +void R_MakeInvertmap(void) +{ + size_t i; + + for (i = 0; i < 256; i++) + invertmap[i] = NearestColor(256 - pLocalPalette[i].s.red, 256 - pLocalPalette[i].s.green, 256 - pLocalPalette[i].s.blue); +} +#endif + INT32 R_CreateColormap(char *p1, char *p2, char *p3) { double cmaskr, cmaskg, cmaskb, cdestr, cdestg, cdestb; - double r, g, b, cbrightness, maskamt = 0, othermask = 0; + double maskamt = 0, othermask = 0; int mask, fog = 0; size_t mapnum = num_extra_colormaps; size_t i; @@ -1206,7 +1193,7 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3) fadedist = fadeend - fadestart; fog = NUMFROMCHAR(p2[1]); } -#undef getnum +#undef NUMFROMCHAR if (p3[0] == '#') { @@ -1249,14 +1236,30 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3) if (num_extra_colormaps == MAXCOLORMAPS) I_Error("R_CreateColormap: Too many colormaps! the limit is %d\n", MAXCOLORMAPS); - strncpy(colormapFixingArray[num_extra_colormaps][0], p1, 8); - strncpy(colormapFixingArray[num_extra_colormaps][1], p2, 8); - strncpy(colormapFixingArray[num_extra_colormaps][2], p3, 8); - num_extra_colormaps++; + foundcolormaps[mapnum] = LUMPERROR; + + // aligned on 8 bit for asm code + extra_colormaps[mapnum].colormap = NULL; + extra_colormaps[mapnum].maskcolor = (UINT16)maskcolor; + extra_colormaps[mapnum].fadecolor = (UINT16)fadecolor; + extra_colormaps[mapnum].maskamt = maskamt; + extra_colormaps[mapnum].fadestart = (UINT16)fadestart; + extra_colormaps[mapnum].fadeend = (UINT16)fadeend; + extra_colormaps[mapnum].fog = fog; + if (rendermode == render_soft) { + double r, g, b, cbrightness; + int p; + lighttable_t *colormap_p; + + // Initialise the map and delta arrays + // map[i] stores an RGB color (as double) for index i, + // which is then converted to SRB2's palette later + // deltas[i] stores a corresponding fade delta between the RGB color and the final fade color; + // map[i]'s values are decremented by after each use for (i = 0; i < 256; i++) { r = pLocalPalette[i].s.red; @@ -1279,199 +1282,13 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3) map[i][2] = 255.0l; deltas[i][2] = (map[i][2] - cdestb) / (double)fadedist; } - } - foundcolormaps[mapnum] = LUMPERROR; - - // aligned on 8 bit for asm code - extra_colormaps[mapnum].colormap = NULL; - extra_colormaps[mapnum].maskcolor = (UINT16)maskcolor; - extra_colormaps[mapnum].fadecolor = (UINT16)fadecolor; - extra_colormaps[mapnum].maskamt = maskamt; - extra_colormaps[mapnum].fadestart = (UINT16)fadestart; - extra_colormaps[mapnum].fadeend = (UINT16)fadeend; - extra_colormaps[mapnum].fog = fog; - - return (INT32)mapnum; -} - -void R_MakeColormaps(void) -{ - size_t i; - - carrayindex = num_extra_colormaps; - num_extra_colormaps = 0; - - for (i = 0; i < carrayindex; i++) - R_CreateColormap2(colormapFixingArray[i][0], colormapFixingArray[i][1], - colormapFixingArray[i][2]); -} - -#ifdef HASINVERT -void R_MakeInvertmap(void) -{ - size_t i; - - for (i = 0; i < 256; i++) - invertmap[i] = NearestColor(256 - pLocalPalette[i].s.red, 256 - pLocalPalette[i].s.green, 256 - pLocalPalette[i].s.blue); -} -#endif - -void R_CreateColormap2(char *p1, char *p2, char *p3) -{ - double cmaskr, cmaskg, cmaskb, cdestr, cdestg, cdestb; - double r, g, b, cbrightness; - double maskamt = 0, othermask = 0; - INT32 mask, p, fog = 0; - size_t mapnum = num_extra_colormaps; - size_t i; - lighttable_t *colormap_p, *colormap_p2; - UINT32 cr, cg, cb, maskcolor, fadecolor; - UINT32 fadestart = 0, fadeend = 31, fadedist = 31; - -#define HEX2INT(x) (UINT32)(x >= '0' && x <= '9' ? x - '0' : x >= 'a' && x <= 'f' ? x - 'a' + 10 : x >= 'A' && x <= 'F' ? x - 'A' + 10 : 0) - if (p1[0] == '#') - { - cr = ((HEX2INT(p1[1]) * 16) + HEX2INT(p1[2])); - cg = ((HEX2INT(p1[3]) * 16) + HEX2INT(p1[4])); - cb = ((HEX2INT(p1[5]) * 16) + HEX2INT(p1[6])); - - if (encoremap) - { - i = encoremap[NearestColor((UINT8)cr, (UINT8)cg, (UINT8)cb)]; - cr = pLocalPalette[i].s.red; - cg = pLocalPalette[i].s.green; - cb = pLocalPalette[i].s.blue; - } - - cmaskr = cr; - cmaskg = cg; - cmaskb = cb; - // Create a rough approximation of the color (a 16 bit color) - maskcolor = ((cb) >> 3) + (((cg) >> 2) << 5) + (((cr) >> 3) << 11); - if (p1[7] >= 'a' && p1[7] <= 'z') - mask = (p1[7] - 'a'); - else if (p1[7] >= 'A' && p1[7] <= 'Z') - mask = (p1[7] - 'A'); - else - mask = 24; - - maskamt = (double)(mask/24.0l); - - othermask = 1 - maskamt; - maskamt /= 0xff; - cmaskr *= maskamt; - cmaskg *= maskamt; - cmaskb *= maskamt; - } - else - { - cmaskr = cmaskg = cmaskb = 0xff; - maskamt = 0; - maskcolor = ((0xff) >> 3) + (((0xff) >> 2) << 5) + (((0xff) >> 3) << 11); - } - -#define NUMFROMCHAR(c) (c >= '0' && c <= '9' ? c - '0' : 0) - if (p2[0] == '#') - { - // Get parameters like fadestart, fadeend, and the fogflag - fadestart = NUMFROMCHAR(p2[3]) + (NUMFROMCHAR(p2[2]) * 10); - fadeend = NUMFROMCHAR(p2[5]) + (NUMFROMCHAR(p2[4]) * 10); - if (fadestart > 30) - fadestart = 0; - if (fadeend > 31 || fadeend < 1) - fadeend = 31; - fadedist = fadeend - fadestart; - fog = NUMFROMCHAR(p2[1]); - } -#undef getnum - - if (p3[0] == '#') - { - cr = ((HEX2INT(p3[1]) * 16) + HEX2INT(p3[2])); - cg = ((HEX2INT(p3[3]) * 16) + HEX2INT(p3[4])); - cb = ((HEX2INT(p3[5]) * 16) + HEX2INT(p3[6])); - - if (encoremap) - { - i = encoremap[NearestColor((UINT8)cr, (UINT8)cg, (UINT8)cb)]; - cr = pLocalPalette[i].s.red; - cg = pLocalPalette[i].s.green; - cb = pLocalPalette[i].s.blue; - } - - cdestr = cr; - cdestg = cg; - cdestb = cb; - fadecolor = (((cb) >> 3) + (((cg) >> 2) << 5) + (((cr) >> 3) << 11)); - } - else - cdestr = cdestg = cdestb = fadecolor = 0; -#undef HEX2INT - - for (i = 0; i < num_extra_colormaps; i++) - { - if (foundcolormaps[i] != LUMPERROR) - continue; - if (maskcolor == extra_colormaps[i].maskcolor - && fadecolor == extra_colormaps[i].fadecolor - && (float)maskamt == (float)extra_colormaps[i].maskamt - && fadestart == extra_colormaps[i].fadestart - && fadeend == extra_colormaps[i].fadeend - && fog == extra_colormaps[i].fog) - { - return; - } - } - - if (num_extra_colormaps == MAXCOLORMAPS) - I_Error("R_CreateColormap: Too many colormaps! the limit is %d\n", MAXCOLORMAPS); - - num_extra_colormaps++; - - if (rendermode == render_soft) - { - for (i = 0; i < 256; i++) - { - r = pLocalPalette[i].s.red; - g = pLocalPalette[i].s.green; - b = pLocalPalette[i].s.blue; - cbrightness = sqrt((r*r) + (g*g) + (b*b)); - - map[i][0] = (cbrightness * cmaskr) + (r * othermask); - if (map[i][0] > 255.0l) - map[i][0] = 255.0l; - deltas[i][0] = (map[i][0] - cdestr) / (double)fadedist; - - map[i][1] = (cbrightness * cmaskg) + (g * othermask); - if (map[i][1] > 255.0l) - map[i][1] = 255.0l; - deltas[i][1] = (map[i][1] - cdestg) / (double)fadedist; - - map[i][2] = (cbrightness * cmaskb) + (b * othermask); - if (map[i][2] > 255.0l) - map[i][2] = 255.0l; - deltas[i][2] = (map[i][2] - cdestb) / (double)fadedist; - } - } - - foundcolormaps[mapnum] = LUMPERROR; - - // aligned on 8 bit for asm code - extra_colormaps[mapnum].colormap = NULL; - extra_colormaps[mapnum].maskcolor = (UINT16)maskcolor; - extra_colormaps[mapnum].fadecolor = (UINT16)fadecolor; - extra_colormaps[mapnum].maskamt = maskamt; - extra_colormaps[mapnum].fadestart = (UINT16)fadestart; - extra_colormaps[mapnum].fadeend = (UINT16)fadeend; - extra_colormaps[mapnum].fog = fog; - -#define ABS2(x) ((x) < 0 ? -(x) : (x)) - if (rendermode == render_soft) - { + // Now allocate memory for the actual colormap array itself! colormap_p = Z_MallocAlign((256 * (encoremap ? 64 : 32)) + 10, PU_LEVEL, NULL, 8); extra_colormaps[mapnum].colormap = (UINT8 *)colormap_p; + // Calculate the palette index for each palette index, for each light level + // (as well as the two unused colormap lines we inherited from Doom) for (p = 0; p < 32; p++) { for (i = 0; i < 256; i++) @@ -1483,7 +1300,7 @@ void R_CreateColormap2(char *p1, char *p2, char *p3) if ((UINT32)p < fadestart) continue; - +#define ABS2(x) ((x) < 0 ? -(x) : (x)) if (ABS2(map[i][0] - cdestr) > ABS2(deltas[i][0])) map[i][0] -= deltas[i][0]; else @@ -1498,27 +1315,27 @@ void R_CreateColormap2(char *p1, char *p2, char *p3) map[i][2] -= deltas[i][2]; else map[i][2] = cdestb; +#undef ABS2 } } - if (!encoremap) - return; - - colormap_p2 = extra_colormaps[mapnum].colormap; - - for (p = 0; p < 32; p++) + if (encoremap) { - for (i = 0; i < 256; i++) + lighttable_t *colormap_p2 = extra_colormaps[mapnum].colormap; + + for (p = 0; p < 32; p++) { - *colormap_p = colormap_p2[encoremap[i]]; - colormap_p++; + for (i = 0; i < 256; i++) + { + *colormap_p = colormap_p2[encoremap[i]]; + colormap_p++; + } + colormap_p2 += 256; } - colormap_p2 += 256; } } -#undef ABS2 - return; + return (INT32)mapnum; } // Thanks to quake2 source! diff --git a/src/r_data.h b/src/r_data.h index 9dce6f57..e31484f6 100644 --- a/src/r_data.h +++ b/src/r_data.h @@ -93,8 +93,6 @@ void R_ReInitColormaps(UINT16 num, lumpnum_t newencoremap); void R_ClearColormaps(void); INT32 R_ColormapNumForName(char *name); INT32 R_CreateColormap(char *p1, char *p2, char *p3); -void R_CreateColormap2(char *p1, char *p2, char *p3); -void R_MakeColormaps(void); #ifdef HASINVERT void R_MakeInvertmap(void); #endif diff --git a/src/r_main.c b/src/r_main.c index 5990224c..bd1cd477 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -60,7 +60,6 @@ fixed_t projectiony; // aspect ratio // just for profiling purposes size_t framecount; -size_t sscount; size_t loopcount; fixed_t viewx, viewy, viewz; @@ -123,11 +122,19 @@ size_t num_extra_colormaps; extracolormap_t extra_colormaps[MAXCOLORMAPS]; static CV_PossibleValue_t drawdist_cons_t[] = { - {256, "256"}, {512, "512"}, {768, "768"}, + /*{256, "256"},*/ {512, "512"}, {768, "768"}, {1024, "1024"}, {1536, "1536"}, {2048, "2048"}, {3072, "3072"}, {4096, "4096"}, {6144, "6144"}, {8192, "8192"}, {0, "Infinite"}, {0, NULL}}; -static CV_PossibleValue_t precipdensity_cons_t[] = {{0, "None"}, {1, "Light"}, {2, "Moderate"}, {4, "Heavy"}, {6, "Thick"}, {8, "V.Thick"}, {0, NULL}}; + +//static CV_PossibleValue_t precipdensity_cons_t[] = {{0, "None"}, {1, "Light"}, {2, "Moderate"}, {4, "Heavy"}, {6, "Thick"}, {8, "V.Thick"}, {0, NULL}}; + +static CV_PossibleValue_t drawdist_precip_cons_t[] = { + {256, "256"}, {512, "512"}, {768, "768"}, + {1024, "1024"}, {1536, "1536"}, {2048, "2048"}, + {0, "None"}, {0, NULL}}; + +//static CV_PossibleValue_t precipdensity_cons_t[] = {{0, "None"}, {1, "Light"}, {2, "Moderate"}, {4, "Heavy"}, {6, "Thick"}, {8, "V.Thick"}, {0, NULL}}; static CV_PossibleValue_t translucenthud_cons_t[] = {{0, "MIN"}, {10, "MAX"}, {0, NULL}}; static CV_PossibleValue_t maxportals_cons_t[] = {{0, "MIN"}, {12, "MAX"}, {0, NULL}}; // lmao rendering 32 portals, you're a card static CV_PossibleValue_t homremoval_cons_t[] = {{0, "No"}, {1, "Yes"}, {2, "Flash"}, {0, NULL}}; @@ -165,9 +172,9 @@ consvar_t cv_translucenthud = {"translucenthud", "10", CV_SAVE, translucenthud_c consvar_t cv_translucency = {"translucency", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_drawdist = {"drawdist", "Infinite", CV_SAVE, drawdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_drawdist_nights = {"drawdist_nights", "2048", CV_SAVE, drawdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_drawdist_precip = {"drawdist_precip", "1024", CV_SAVE, drawdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_precipdensity = {"precipdensity", "Moderate", CV_SAVE, precipdensity_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +//consvar_t cv_drawdist_nights = {"drawdist_nights", "2048", CV_SAVE, drawdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_drawdist_precip = {"drawdist_precip", "1024", CV_SAVE, drawdist_precip_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +//consvar_t cv_precipdensity = {"precipdensity", "Moderate", CV_SAVE, precipdensity_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; // Okay, whoever said homremoval causes a performance hit should be shot. consvar_t cv_homremoval = {"homremoval", "Yes", CV_SAVE, homremoval_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -557,9 +564,6 @@ static void R_InitTextureMapping(void) // Take out the fencepost cases from viewangletox. for (i = 0; i < FINEANGLES/2; i++) { - t = FixedMul(FINETANGENT(i), focallength); - t = centerx - t; - if (viewangletox[i] == -1) viewangletox[i] = 0; else if (viewangletox[i] == viewwidth+1) @@ -1048,8 +1052,6 @@ void R_SkyboxFrame(player_t *player) viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT); viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT); - sscount = 0; - // recalc necessary stuff for mouseaiming // slopes are already calculated for the full possible view (which is 4*viewheight). @@ -1094,10 +1096,10 @@ void R_SetupFrame(player_t *player, boolean skybox) chasecam = (cv_chasecam.value != 0); } - if (player->climbing || (player->pflags & PF_NIGHTSMODE) || player->playerstate == PST_DEAD) - chasecam = true; // force chasecam on - else if (player->spectator) // no spectator chasecam + if (player->spectator) // no spectator chasecam chasecam = false; // force chasecam off + else if (player->playerstate == PST_DEAD || player->exiting) + chasecam = true; // force chasecam on if (chasecam && !thiscam->chase) { @@ -1192,8 +1194,6 @@ void R_SetupFrame(player_t *player, boolean skybox) viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT); viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT); - sscount = 0; - // recalc necessary stuff for mouseaiming // slopes are already calculated for the full possible view (which is 4*viewheight). @@ -1349,9 +1349,9 @@ void R_RenderPlayerView(player_t *player) if (cv_homremoval.value && player == &players[displayplayer]) { if (cv_homremoval.value == 1) - V_DrawFill(0, 0, vid.width, vid.height, 31); // No HOM effect! + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); // No HOM effect! else //'development' HOM removal -- makes it blindingly obvious if HOM is spotted. - V_DrawFill(0, 0, vid.width, vid.height, 128+(timeinmap&15)); + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 128+(timeinmap&15)); } // Draw over the fourth screen so you don't have to stare at a HOM :V else if (splitscreen == 2 && player == &players[thirddisplayplayer]) @@ -1513,10 +1513,10 @@ void R_RegisterEngineStuff(void) if (dedicated) return; - CV_RegisterVar(&cv_precipdensity); + //CV_RegisterVar(&cv_precipdensity); CV_RegisterVar(&cv_translucency); CV_RegisterVar(&cv_drawdist); - CV_RegisterVar(&cv_drawdist_nights); + //CV_RegisterVar(&cv_drawdist_nights); CV_RegisterVar(&cv_drawdist_precip); CV_RegisterVar(&cv_chasecam); diff --git a/src/r_main.h b/src/r_main.h index cabf17b6..2a955c9d 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -77,7 +77,7 @@ extern consvar_t cv_chasecam, cv_chasecam2, cv_chasecam3, cv_chasecam4; extern consvar_t cv_flipcam, cv_flipcam2, cv_flipcam3, cv_flipcam4; extern consvar_t cv_shadow, cv_shadowoffs; extern consvar_t cv_translucency; -extern consvar_t cv_precipdensity, cv_drawdist, cv_drawdist_nights, cv_drawdist_precip; +extern consvar_t /*cv_precipdensity,*/ cv_drawdist, /*cv_drawdist_nights,*/ cv_drawdist_precip; extern consvar_t cv_skybox; extern consvar_t cv_tailspickup; diff --git a/src/r_plane.c b/src/r_plane.c index 0f0e2f7a..c884a9c3 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -450,19 +450,37 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, #ifdef ESLOPE if (slope); else // Don't mess with this right now if a slope is involved #endif - if (plangle != 0) - { - // Add the view offset, rotated by the plane angle. - angle_t angle = plangle>>ANGLETOFINESHIFT; - xoff += FixedMul(viewx,FINECOSINE(angle))-FixedMul(viewy,FINESINE(angle)); - yoff += -FixedMul(viewx,FINESINE(angle))-FixedMul(viewy,FINECOSINE(angle)); - } - else { xoff += viewx; yoff -= viewy; + if (plangle != 0) + { + // Add the view offset, rotated by the plane angle. + fixed_t cosinecomponent = FINECOSINE(plangle>>ANGLETOFINESHIFT); + fixed_t sinecomponent = FINESINE(plangle>>ANGLETOFINESHIFT); + fixed_t oldxoff = xoff; + xoff = FixedMul(xoff,cosinecomponent)+FixedMul(yoff,sinecomponent); + yoff = -FixedMul(oldxoff,sinecomponent)+FixedMul(yoff,cosinecomponent); + } } +#ifdef POLYOBJECTS_PLANES + if (polyobj) + { + if (polyobj->angle != 0) + { + angle_t fineshift = polyobj->angle >> ANGLETOFINESHIFT; + xoff -= FixedMul(FINECOSINE(fineshift), polyobj->centerPt.x)+FixedMul(FINESINE(fineshift), polyobj->centerPt.y); + yoff -= FixedMul(FINESINE(fineshift), polyobj->centerPt.x)-FixedMul(FINECOSINE(fineshift), polyobj->centerPt.y); + } + else + { + xoff -= polyobj->centerPt.x; + yoff += polyobj->centerPt.y; + } + } +#endif + // This appears to fix the Nimbus Ruins sky bug. if (picnum == skyflatnum && pfloor) { @@ -488,6 +506,7 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, && !pfloor && !check->ffloor && check->viewx == viewx && check->viewy == viewy && check->viewz == viewz && check->viewangle == viewangle + && check->plangle == plangle #ifdef ESLOPE && check->slope == slope #endif @@ -974,23 +993,65 @@ void R_DrawSinglePlane(visplane_t *pl) #ifdef ESLOPE if (pl->slope) { // Potentially override other stuff for now cus we're mean. :< But draw a slope plane! - // I copied ZDoom's code and adapted it to SRB2... -Red + // I copied ZDoom's code and adapted it to SRB2... -fickle floatv3_t p, m, n; float ang; float vx, vy, vz; - float fudge; // 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; + // Okay, look, don't ask me why this works, but without this setup there's a disgusting-looking misalignment with the textures. -fickle + const float fudge = ((1<plangle & (ANGLE_90-1)); - xoffs -= (pl->slope->o.x + (1 << (31-nflatshiftup))) & ~((1 << (32-nflatshiftup))-1); - yoffs += (pl->slope->o.y + (1 << (31-nflatshiftup))) & ~((1 << (32-nflatshiftup))-1); + if (hack) + { + /* + Essentially: We can't & the components along the regular axes when the plane is rotated. + This is because the distance on each regular axis in order to loop is different. + We rotate them, & the components, add them together, & them again, and then rotate them back. + These three seperate & operations are done per axis in order to prevent overflows. + toast 10/04/17 + --- + ...of coooourse, this still isn't perfect. but it looks... merely kind of grody, rather than + completely wrong? idk. i'm just backporting this to kart right now. if anyone else wants to + ever try dig around: it's drifting towards 0,0, and no, multiplying by fudge doesn't fix it. + toast 27/09/18 + */ - // Okay, look, don't ask me why this works, but without this setup there's a disgusting-looking misalignment with the textures. -Red - fudge = ((1<>ANGLETOFINESHIFT); + const fixed_t sinecomponent = FINESINE(hack>>ANGLETOFINESHIFT); + + const fixed_t modmask = ((1 << (32-nflatshiftup)) - 1); + + fixed_t ox = (FixedMul(pl->slope->o.x,cosinecomponent) & modmask) - (FixedMul(pl->slope->o.y,sinecomponent) & modmask); + fixed_t oy = (-FixedMul(pl->slope->o.x,sinecomponent) & modmask) - (FixedMul(pl->slope->o.y,cosinecomponent) & modmask); + + temp = ox & modmask; + oy &= modmask; + ox = FixedMul(temp,cosinecomponent)+FixedMul(oy,-sinecomponent); // negative sine for opposite direction + oy = -FixedMul(temp,-sinecomponent)+FixedMul(oy,cosinecomponent); + + temp = xoffs; + xoffs = (FixedMul(temp,cosinecomponent) & modmask) + (FixedMul(yoffs,sinecomponent) & modmask); + yoffs = (-FixedMul(temp,sinecomponent) & modmask) + (FixedMul(yoffs,cosinecomponent) & modmask); + + temp = xoffs & modmask; + yoffs &= modmask; + xoffs = FixedMul(temp,cosinecomponent)+FixedMul(yoffs,-sinecomponent); // ditto + yoffs = -FixedMul(temp,-sinecomponent)+FixedMul(yoffs,cosinecomponent); + + xoffs -= (pl->slope->o.x - ox); + yoffs += (pl->slope->o.y + oy); + } + else + { + xoffs &= ((1 << (32-nflatshiftup))-1); + yoffs &= ((1 << (32-nflatshiftup))-1); + xoffs -= (pl->slope->o.x + (1 << (31-nflatshiftup))) & ~((1 << (32-nflatshiftup))-1); + yoffs += (pl->slope->o.y + (1 << (31-nflatshiftup))) & ~((1 << (32-nflatshiftup))-1); + } xoffs = (fixed_t)(xoffs*fudge); yoffs = (fixed_t)(yoffs/fudge); diff --git a/src/r_segs.c b/src/r_segs.c index 11287f16..231a84f7 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1365,7 +1365,7 @@ static void R_RenderSegLoop (void) if (bottom >= floorclip[rw_x]) bottom = floorclip[rw_x]-1; - if (top <= bottom) + if (top <= bottom && ceilingplane) { ceilingplane->top[rw_x] = (INT16)top; ceilingplane->bottom[rw_x] = (INT16)bottom; @@ -2113,52 +2113,55 @@ void R_StoreWallRange(INT32 start, INT32 stop) // ds_p->sprtopclip = screenheightarray; } -#ifdef ESLOPE - if (worldhigh <= worldbottom && worldhighslope <= worldbottomslope) -#else - if (worldhigh <= worldbottom) -#endif - { - ds_p->sprbottomclip = negonearray; - ds_p->bsilheight = INT32_MAX; - ds_p->silhouette |= SIL_BOTTOM; - } - -#ifdef ESLOPE - if (worldlow >= worldtop && worldlowslope >= worldtopslope) -#else - if (worldlow >= worldtop) -#endif - { - ds_p->sprtopclip = screenheightarray; - ds_p->tsilheight = INT32_MIN; - ds_p->silhouette |= SIL_TOP; - } - - //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. + if (viewsector != frontsector && viewsector != backsector) { #ifdef ESLOPE - if (doorclosed || (worldhigh <= worldbottom && worldhighslope <= worldbottomslope)) + if (worldhigh <= worldbottom && worldhighslope <= worldbottomslope) #else - if (doorclosed || backsector->ceilingheight <= frontsector->floorheight) + if (worldhigh <= worldbottom) #endif { ds_p->sprbottomclip = negonearray; ds_p->bsilheight = INT32_MAX; ds_p->silhouette |= SIL_BOTTOM; } + #ifdef ESLOPE - if (doorclosed || (worldlow >= worldtop && worldlowslope >= worldtopslope)) + if (worldlow >= worldtop && worldlowslope >= worldtopslope) #else - if (doorclosed || backsector->floorheight >= frontsector->ceilingheight) + if (worldlow >= worldtop) #endif - { // killough 1/17/98, 2/8/98 + { ds_p->sprtopclip = screenheightarray; ds_p->tsilheight = INT32_MIN; ds_p->silhouette |= SIL_TOP; } + + //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; + ds_p->silhouette |= SIL_TOP; + } + } } if (worldlow != worldbottom diff --git a/src/r_state.h b/src/r_state.h index 2715724d..b2929237 100644 --- a/src/r_state.h +++ b/src/r_state.h @@ -112,7 +112,4 @@ extern angle_t rw_normalangle; // angle to line origin extern angle_t rw_angle1; -// Segs count? -extern size_t sscount; - #endif diff --git a/src/r_things.c b/src/r_things.c index bede9cd1..802b3235 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1602,6 +1602,17 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing) return; } + // okay, we can't return now except for vertical clipping... this is a hack, but weather isn't networked, so it should be ok + if (!(thing->precipflags & PCF_THUNK)) + { + if (thing->precipflags & PCF_RAIN) + P_RainThinker(thing); + else + P_SnowThinker(thing); + thing->precipflags |= PCF_THUNK; + } + + //SoM: 3/17/2000: Disregard sprites that are out of view.. gzt = thing->z + spritecachedinfo[lump].topoffset; gz = gzt - spritecachedinfo[lump].height; @@ -1712,7 +1723,7 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel, UINT8 viewnumber) // Handle all things in sector. // If a limit exists, handle things a tiny bit different. - if ((limit_dist = (fixed_t)((maptol & TOL_NIGHTS) ? cv_drawdist_nights.value : cv_drawdist.value) << FRACBITS)) + if ((limit_dist = (fixed_t)(/*(maptol & TOL_NIGHTS) ? cv_drawdist_nights.value : */cv_drawdist.value) << FRACBITS)) { for (thing = sec->thinglist; thing; thing = thing->snext) { @@ -1740,8 +1751,10 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel, UINT8 viewnumber) approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y); - if (approx_dist <= limit_dist) - R_ProjectSprite(thing); + if (approx_dist > limit_dist) + continue; + + R_ProjectSprite(thing); } } else @@ -1785,8 +1798,10 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel, UINT8 viewnumber) approx_dist = P_AproxDistance(viewx-precipthing->x, viewy-precipthing->y); - if (approx_dist <= limit_dist) - R_ProjectPrecipitationSprite(precipthing); + if (approx_dist > limit_dist) + continue; + + R_ProjectPrecipitationSprite(precipthing); } } else diff --git a/src/s_sound.c b/src/s_sound.c index 74cca98a..d87b6106 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -85,7 +85,7 @@ consvar_t cv_digmusicvolume = {"digmusicvolume", "18", CV_SAVE, soundvolume_cons #if defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined(GP2X) consvar_t cv_numChannels = {"snd_channels", "8", CV_SAVE|CV_CALL, CV_Unsigned, SetChannelsNum, 0, NULL, NULL, 0, 0, NULL}; #else -consvar_t cv_numChannels = {"snd_channels", "32", CV_SAVE|CV_CALL, CV_Unsigned, SetChannelsNum, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_numChannels = {"snd_channels", "64", CV_SAVE|CV_CALL, CV_Unsigned, SetChannelsNum, 0, NULL, NULL, 0, 0, NULL}; #endif consvar_t surround = {"surround", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -186,7 +186,7 @@ static INT32 S_getChannel(const void *origin, sfxinfo_t *sfxinfo) } else if (origin && channels[cnum].origin == origin && channels[cnum].sfxinfo->name != sfxinfo->name - && channels[cnum].sfxinfo->pitch == SF_TOTALLYSINGLE && sfxinfo->pitch == SF_TOTALLYSINGLE) + && (channels[cnum].sfxinfo->pitch & SF_TOTALLYSINGLE) && (sfxinfo->pitch & SF_TOTALLYSINGLE)) { S_StopChannel(cnum); break; @@ -582,7 +582,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) // Assigns the handle to one of the channels in the // mix/output buffer. - channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority); + channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority, cnum); } dontplay: @@ -638,7 +638,7 @@ dontplay: // Assigns the handle to one of the channels in the // mix/output buffer. - channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority); + channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority, cnum); } dontplay3: @@ -694,7 +694,7 @@ dontplay3: // Assigns the handle to one of the channels in the // mix/output buffer. - channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority); + channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority, cnum); } dontplay4: @@ -743,7 +743,7 @@ dontplay4: // Assigns the handle to one of the channels in the // mix/output buffer. - channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority); + channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority, cnum); } void S_StartSound(const void *origin, sfxenum_t sfx_id) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 05371282..871de392 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -124,6 +124,10 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #include "macosx/mac_resources.h" #endif +#ifndef errno +#include +#endif + // Locations for searching the srb2.srb #if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) #define DEFAULTWADLOCATION1 "/usr/local/share/games/SRB2" @@ -1179,6 +1183,7 @@ static void I_ShutdownJoystick2(void) D_PostEvent(&event); } + joystick2_started = 0; JoyReset(&JoyInfo2); if (!joystick_started && !joystick2_started && !joystick3_started && !joystick4_started && SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK) @@ -2309,7 +2314,7 @@ static void I_ShutdownMouse2(void) EscapeCommFunction(mouse2filehandle, CLRRTS); PurgeComm(mouse2filehandle, PURGE_TXABORT | PURGE_RXABORT | - PURGE_TXCLEAR | PURGE_RXCLEAR); + PURGE_TXCLEAR | PURGE_RXCLEAR); CloseHandle(mouse2filehandle); @@ -2502,11 +2507,11 @@ void I_StartupMouse2(void) { // COM file handle mouse2filehandle = CreateFileA(cv_mouse2port.string, GENERIC_READ | GENERIC_WRITE, - 0, // exclusive access - NULL, // no security attrs - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); + 0, // exclusive access + NULL, // no security attrs + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); if (mouse2filehandle == INVALID_HANDLE_VALUE) { INT32 e = GetLastError(); @@ -2526,7 +2531,7 @@ void I_StartupMouse2(void) // purge buffers PurgeComm(mouse2filehandle, PURGE_TXABORT | PURGE_RXABORT - | PURGE_TXCLEAR | PURGE_RXCLEAR); + | PURGE_TXCLEAR | PURGE_RXCLEAR); // setup port to 1200 7N1 dcb.DCBlength = sizeof (DCB); @@ -2687,7 +2692,7 @@ static void I_ShutdownTimer(void) tic_t I_GetTime (void) { static Uint32 basetime = 0; - Uint32 ticks = SDL_GetTicks(); + Uint32 ticks = SDL_GetTicks(); if (!basetime) basetime = ticks; @@ -2753,7 +2758,6 @@ INT32 I_StartupSystem(void) return 0; } - // // I_Quit // @@ -3032,7 +3036,7 @@ void I_GetDiskFreeSpace(INT64 *freespace) { DWORD SectorsPerCluster, BytesPerSector, NumberOfFreeClusters, TotalNumberOfClusters; GetDiskFreeSpace(NULL, &SectorsPerCluster, &BytesPerSector, - &NumberOfFreeClusters, &TotalNumberOfClusters); + &NumberOfFreeClusters, &TotalNumberOfClusters); *freespace = BytesPerSector*SectorsPerCluster*NumberOfFreeClusters; } #else // Dummy for platform independent; 1GB should be enough @@ -3254,22 +3258,22 @@ static const char *locateWad(void) #ifdef CMAKECONFIG #ifndef NDEBUG - I_OutputMsg(","CMAKE_ASSETS_DIR); - strcpy(returnWadPath, CMAKE_ASSETS_DIR); - if (isWadPathOk(returnWadPath)) - { - return returnWadPath; - } + I_OutputMsg(","CMAKE_ASSETS_DIR); + strcpy(returnWadPath, CMAKE_ASSETS_DIR); + if (isWadPathOk(returnWadPath)) + { + return returnWadPath; + } #endif #endif #ifdef __APPLE__ - OSX_GetResourcesPath(returnWadPath); - I_OutputMsg(",%s", returnWadPath); - if (isWadPathOk(returnWadPath)) - { - return returnWadPath; - } + OSX_GetResourcesPath(returnWadPath); + I_OutputMsg(",%s", returnWadPath); + if (isWadPathOk(returnWadPath)) + { + return returnWadPath; + } #endif // examine default dirs @@ -3374,7 +3378,30 @@ const char *I_LocateWad(void) #ifdef __linux__ #define MEMINFO_FILE "/proc/meminfo" #define MEMTOTAL "MemTotal:" +#define MEMAVAILABLE "MemAvailable:" #define MEMFREE "MemFree:" +#define CACHED "Cached:" +#define BUFFERS "Buffers:" +#define SHMEM "Shmem:" + +/* Parse the contents of /proc/meminfo (in buf), return value of "name" + * (example: MemTotal) */ +static long get_entry(const char* name, const char* buf) +{ + long val; + char* hit = strstr(buf, name); + if (hit == NULL) { + return -1; + } + + errno = 0; + val = strtol(hit + strlen(name), NULL, 10); + if (errno != 0) { + CONS_Alert(CONS_ERROR, M_GetText("get_entry: strtol() failed: %s\n"), strerror(errno)); + return -1; + } + return val; +} #endif // quick fix for compil @@ -3446,6 +3473,11 @@ UINT32 I_GetFreeMem(UINT32 *total) UINT32 totalKBytes; INT32 n; INT32 meminfo_fd = -1; + long Cached; + long MemFree; + long Buffers; + long Shmem; + long MemAvailable = -1; meminfo_fd = open(MEMINFO_FILE, O_RDONLY); n = read(meminfo_fd, buf, 1023); @@ -3471,16 +3503,28 @@ UINT32 I_GetFreeMem(UINT32 *total) memTag += sizeof (MEMTOTAL); totalKBytes = atoi(memTag); - if ((memTag = strstr(buf, MEMFREE)) == NULL) + if ((memTag = strstr(buf, MEMAVAILABLE)) == NULL) { - // Error - if (total) - *total = 0L; - return 0; - } + Cached = get_entry(CACHED, buf); + MemFree = get_entry(MEMFREE, buf); + Buffers = get_entry(BUFFERS, buf); + Shmem = get_entry(SHMEM, buf); + MemAvailable = Cached + MemFree + Buffers - Shmem; - memTag += sizeof (MEMFREE); - freeKBytes = atoi(memTag); + if (MemAvailable == -1) + { + // Error + if (total) + *total = 0L; + return 0; + } + freeKBytes = MemAvailable; + } + else + { + memTag += sizeof (MEMAVAILABLE); + freeKBytes = atoi(memTag); + } if (total) *total = totalKBytes << 10; diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 5cb319f6..590158c8 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -94,7 +94,7 @@ rendermode_t rendermode=render_soft; boolean highcolor = false; // synchronize page flipping with screen refresh -consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_vidwait = {"vid_wait", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; static consvar_t cv_stretch = {"stretch", "Off", CV_SAVE|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; UINT8 graphics_started = 0; // Is used in console.c and screen.c diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index e124dcf1..d950b739 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -38,10 +38,8 @@ #include "gme/gme.h" #define GME_TREBLE 5.0 #define GME_BASS 1.0 -#ifdef HAVE_PNG /// TODO: compile with zlib support without libpng - -#define HAVE_ZLIB +#ifdef HAVE_ZLIB #ifndef _MSC_VER #ifndef _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE @@ -57,8 +55,8 @@ #endif #include "zlib.h" -#endif -#endif +#endif // HAVE_ZLIB +#endif // HAVE_LIBGME UINT8 sound_started = false; @@ -178,7 +176,7 @@ static Mix_Chunk *ds2chunk(void *stream) return NULL; // would and/or did wrap, can't store. break; } - sound = malloc(newsamples<<2); // samples * frequency shift * bytes per sample * channels + sound = Z_Malloc(newsamples<<2, PU_SOUND, NULL); // samples * frequency shift * bytes per sample * channels s = (SINT8 *)stream; d = (INT16 *)sound; @@ -246,6 +244,7 @@ void *I_GetSfx(sfxinfo_t *sfx) { void *lump; Mix_Chunk *chunk; + SDL_RWops *rw; #ifdef HAVE_LIBGME Music_Emu *emu; gme_info_t *info; @@ -361,7 +360,7 @@ void *I_GetSfx(sfxinfo_t *sfx) } Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up #else - //CONS_Alert(CONS_ERROR,"Cannot decompress VGZ; no zlib support\n"); + return NULL; // No zlib support #endif } // Try to read it as a GME sound @@ -387,21 +386,43 @@ void *I_GetSfx(sfxinfo_t *sfx) #endif // Try to load it as a WAVE or OGG using Mixer. - return Mix_LoadWAV_RW(SDL_RWFromMem(lump, sfx->length), 1); + rw = SDL_RWFromMem(lump, sfx->length); + if (rw != NULL) + { + chunk = Mix_LoadWAV_RW(rw, 1); + return chunk; + } + + return NULL; // haven't been able to get anything } void I_FreeSfx(sfxinfo_t *sfx) { if (sfx->data) + { + Mix_Chunk *chunk = (Mix_Chunk*)sfx->data; + UINT8 *abufdata = NULL; + if (chunk->allocated == 0) + { + // We allocated the data in this chunk, so get the abuf from mixer, then let it free the chunk, THEN we free the data + // I believe this should ensure the sound is not playing when we free it + abufdata = chunk->abuf; + } Mix_FreeChunk(sfx->data); + if (abufdata) + { + // I'm going to assume we used Z_Malloc to allocate this data. + Z_Free(abufdata); + } + } sfx->data = NULL; sfx->lumpnum = LUMPERROR; } -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel) { UINT8 volume = (((UINT16)vol + 1) * (UINT16)sfx_volume) / 62; // (256 * 31) / 62 == 127 - INT32 handle = Mix_PlayChannel(-1, S_sfx[id].data, 0); + INT32 handle = Mix_PlayChannel(channel, S_sfx[id].data, 0); Mix_Volume(handle, volume); Mix_SetPanning(handle, min((UINT16)(0xff-sep)<<1, 0xff), min((UINT16)(sep)<<1, 0xff)); (void)pitch; // Mixer can't handle pitch @@ -524,6 +545,7 @@ boolean I_StartDigSong(const char *musicname, boolean looping) char *data; size_t len; lumpnum_t lumpnum = W_CheckNumForName(va("O_%s",musicname)); + SDL_RWops *rw; I_Assert(!music); #ifdef HAVE_LIBGME @@ -621,7 +643,8 @@ boolean I_StartDigSong(const char *musicname, boolean looping) } Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up #else - //CONS_Alert(CONS_ERROR,"Cannot decompress VGZ; no zlib support\n"); + CONS_Alert(CONS_ERROR,"Cannot decompress VGZ; no zlib support\n"); + return true; #endif } else if (!gme_open_data(data, len, &gme, 44100)) @@ -635,7 +658,11 @@ boolean I_StartDigSong(const char *musicname, boolean looping) } #endif - music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len), SDL_FALSE); + rw = SDL_RWFromMem(data, len); + if (rw != NULL) + { + music = Mix_LoadMUS_RW(rw, 1); + } if (!music) { CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError()); @@ -798,7 +825,11 @@ void I_SetMIDIMusicVolume(UINT8 volume) INT32 I_RegisterSong(void *data, size_t len) { - music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len), SDL_FALSE); + SDL_RWops *rw = SDL_RWFromMem(data, len); + if (rw != NULL) + { + music = Mix_LoadMUS_RW(rw, 1); + } if (!music) { CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError()); @@ -842,4 +873,4 @@ void I_UnRegisterSong(INT32 handle) music = NULL; } -#endif +#endif \ No newline at end of file diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c index bc98ee2f..d4e56a21 100644 --- a/src/sdl/sdl_sound.c +++ b/src/sdl/sdl_sound.c @@ -604,10 +604,11 @@ void I_FreeSfx(sfxinfo_t * sfx) // Pitching (that is, increased speed of playback) // is set, but currently not used by mixing. // -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel) { (void)priority; (void)pitch; + (void)channel; if (nosound) return 0; diff --git a/src/sdl12/i_video.c b/src/sdl12/i_video.c index ac9d4ffc..69cf5ca9 100644 --- a/src/sdl12/i_video.c +++ b/src/sdl12/i_video.c @@ -150,7 +150,7 @@ boolean highcolor = false; #if defined(DC) || (defined(GP2X) && !defined(HAVE_GP2XSDL)) consvar_t cv_vidwait = {"vid_wait", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; #else -consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_vidwait = {"vid_wait", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; #endif static consvar_t cv_stretch = {"stretch", "Off", CV_SAVE|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; diff --git a/src/sdl12/mixer_sound.c b/src/sdl12/mixer_sound.c index 542a6716..daf09ab9 100644 --- a/src/sdl12/mixer_sound.c +++ b/src/sdl12/mixer_sound.c @@ -376,10 +376,10 @@ void I_FreeSfx(sfxinfo_t *sfx) sfx->data = NULL; } -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel) { UINT8 volume = (((UINT16)vol + 1) * (UINT16)sfx_volume) / 62; // (256 * 31) / 62 == 127 - INT32 handle = Mix_PlayChannel(-1, S_sfx[id].data, 0); + INT32 handle = Mix_PlayChannel(channel, S_sfx[id].data, 0); Mix_Volume(handle, volume); Mix_SetPanning(handle, min((UINT16)(0xff-sep)<<1, 0xff), min((UINT16)(sep)<<1, 0xff)); (void)pitch; // Mixer can't handle pitch diff --git a/src/sdl12/sdl_sound.c b/src/sdl12/sdl_sound.c index 6ba83104..01a27153 100644 --- a/src/sdl12/sdl_sound.c +++ b/src/sdl12/sdl_sound.c @@ -621,10 +621,11 @@ void I_FreeSfx(sfxinfo_t * sfx) // Pitching (that is, increased speed of playback) // is set, but currently not used by mixing. // -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel) { (void)priority; (void)pitch; + (void)channel; if (nosound) return 0; diff --git a/src/sounds.c b/src/sounds.c index 8e0ed4e0..02ad0853 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -771,9 +771,6 @@ sfxinfo_t S_sfx[NUMSFX] = {"lkt1", true, 192, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"lkt2", true, 192, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"lkt3", true, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, - {"kart1", false, 48, 0, -1, NULL, 0, -1, -1, LUMPERROR}, - {"kart2", false, 48, 0, -1, NULL, 0, -1, -1, LUMPERROR}, - {"kart3", false, 48, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"mlap", true, 127, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"sboost", true, 90, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"mush", false, 90, 0, -1, NULL, 0, -1, -1, LUMPERROR}, @@ -821,6 +818,134 @@ sfxinfo_t S_sfx[NUMSFX] = {"itfree", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"dbgsal", false, 110, 8, -1, NULL, 0, -1, -1, LUMPERROR}, + // SRB2Kart - Engine sounds + // Engine class A + {"krta00", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krta01", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krta02", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krta03", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krta04", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krta05", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krta06", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krta07", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krta08", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krta09", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krta10", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krta11", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krta12", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + // Engine class B + {"krtb00", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtb01", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtb02", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtb03", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtb04", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtb05", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtb06", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtb07", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtb08", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtb09", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtb10", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtb11", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtb12", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + // Engine class C + {"krtc00", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtc01", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtc02", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtc03", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtc04", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtc05", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtc06", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtc07", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtc08", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtc09", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtc10", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtc11", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtc12", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + // Engine class D + {"krtd00", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtd01", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtd02", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtd03", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtd04", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtd05", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtd06", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtd07", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtd08", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtd09", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtd10", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtd11", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtd12", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + // Engine class E + {"krte00", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krte01", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krte02", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krte03", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krte04", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krte05", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krte06", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krte07", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krte08", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krte09", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krte10", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krte11", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krte12", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + // Engine class F + {"krtf00", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtf01", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtf02", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtf03", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtf04", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtf05", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtf06", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtf07", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtf08", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtf09", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtf10", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtf11", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtf12", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + // Engine class G + {"krtg00", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtg01", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtg02", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtg03", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtg04", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtg05", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtg06", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtg07", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtg08", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtg09", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtg10", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtg11", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtg12", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + // Engine class H + {"krth00", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krth01", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krth02", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krth03", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krth04", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krth05", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krth06", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krth07", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krth08", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krth09", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krth10", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krth11", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krth12", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + // Engine class I + {"krti00", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krti01", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krti02", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krti03", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krti04", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krti05", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krti06", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krti07", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krti08", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krti09", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krti10", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krti11", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krti12", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + // SRB2kart - Skin sounds {"kwin", false, 64, 96, -1, NULL, 0, SKSKWIN, -1, LUMPERROR}, {"klose", false, 64, 96, -1, NULL, 0, SKSKLOSE, -1, LUMPERROR}, @@ -830,8 +955,8 @@ sfxinfo_t S_sfx[NUMSFX] = {"kattk2", false, 64, 96, -1, NULL, 0, SKSKATK2, -1, LUMPERROR}, {"kbost1", false, 64, 96, -1, NULL, 0, SKSKBST1, -1, LUMPERROR}, {"kbost2", false, 64, 96, -1, NULL, 0, SKSKBST2, -1, LUMPERROR}, - {"kslow", false, 128, 32, -1, NULL, 0, SKSKSLOW, -1, LUMPERROR}, - {"khitem", false, 64, 32, -1, NULL, 0, SKSKHITM, -1, LUMPERROR}, + {"kslow", false, 64, 32, -1, NULL, 0, SKSKSLOW, -1, LUMPERROR}, + {"khitem", false, 128, 32, -1, NULL, 0, SKSKHITM, -1, LUMPERROR}, {"kgloat", false, 64, 48, -1, NULL, 0, SKSKPOWR, -1, LUMPERROR}, // skin sounds free slots to add sounds at run time (Boris HACK!!!) diff --git a/src/sounds.h b/src/sounds.h index 301b3912..2516b646 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -846,9 +846,6 @@ typedef enum sfx_lkt1, sfx_lkt2, sfx_lkt3, - sfx_kart1, - sfx_kart2, - sfx_kart3, sfx_mlap, sfx_sboost, sfx_mush, @@ -896,6 +893,135 @@ typedef enum sfx_itfree, sfx_dbgsal, + // Next up: UNIQUE ENGINE SOUNDS! Hoooooo boy... + // Engine class A - Low Speed, Low Weight + sfx_krta00, + sfx_krta01, + sfx_krta02, + sfx_krta03, + sfx_krta04, + sfx_krta05, + sfx_krta06, + sfx_krta07, + sfx_krta08, + sfx_krta09, + sfx_krta10, + sfx_krta11, + sfx_krta12, + // Engine class B - Average Speed, Low Weight + sfx_krtb00, + sfx_krtb01, + sfx_krtb02, + sfx_krtb03, + sfx_krtb04, + sfx_krtb05, + sfx_krtb06, + sfx_krtb07, + sfx_krtb08, + sfx_krtb09, + sfx_krtb10, + sfx_krtb11, + sfx_krtb12, + // Engine class C - High Speed, Low Weight + sfx_krtc00, + sfx_krtc01, + sfx_krtc02, + sfx_krtc03, + sfx_krtc04, + sfx_krtc05, + sfx_krtc06, + sfx_krtc07, + sfx_krtc08, + sfx_krtc09, + sfx_krtc10, + sfx_krtc11, + sfx_krtc12, + // Engine class D - Low Speed, Average Weight + sfx_krtd00, + sfx_krtd01, + sfx_krtd02, + sfx_krtd03, + sfx_krtd04, + sfx_krtd05, + sfx_krtd06, + sfx_krtd07, + sfx_krtd08, + sfx_krtd09, + sfx_krtd10, + sfx_krtd11, + sfx_krtd12, + // Engine class E - Average Speed, Average Weight + sfx_krte00, + sfx_krte01, + sfx_krte02, + sfx_krte03, + sfx_krte04, + sfx_krte05, + sfx_krte06, + sfx_krte07, + sfx_krte08, + sfx_krte09, + sfx_krte10, + sfx_krte11, + sfx_krte12, + // Engine class F - High Speed, Average Weight + sfx_krtf00, + sfx_krtf01, + sfx_krtf02, + sfx_krtf03, + sfx_krtf04, + sfx_krtf05, + sfx_krtf06, + sfx_krtf07, + sfx_krtf08, + sfx_krtf09, + sfx_krtf10, + sfx_krtf11, + sfx_krtf12, + // Engine class G - Low Speed, High Weight + sfx_krtg00, + sfx_krtg01, + sfx_krtg02, + sfx_krtg03, + sfx_krtg04, + sfx_krtg05, + sfx_krtg06, + sfx_krtg07, + sfx_krtg08, + sfx_krtg09, + sfx_krtg10, + sfx_krtg11, + sfx_krtg12, + // Engine class H - Average Speed, High Weight + sfx_krth00, + sfx_krth01, + sfx_krth02, + sfx_krth03, + sfx_krth04, + sfx_krth05, + sfx_krth06, + sfx_krth07, + sfx_krth08, + sfx_krth09, + sfx_krth10, + sfx_krth11, + sfx_krth12, + // Engine class I - High Speed, High Weight + sfx_krti00, + sfx_krti01, + sfx_krti02, + sfx_krti03, + sfx_krti04, + sfx_krti05, + sfx_krti06, + sfx_krti07, + sfx_krti08, + sfx_krti09, + sfx_krti10, + sfx_krti11, + sfx_krti12, + + // And LASTLY, Kart's skin sounds. sfx_kwin, sfx_klose, sfx_khurt1, diff --git a/src/st_stuff.c b/src/st_stuff.c index 72266ba2..45e0deb5 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1952,14 +1952,13 @@ static void ST_overlayDrawer(void) ) { // SRB2kart: changed positions & text - V_DrawString(2, BASEVIDHEIGHT-50, V_HUDTRANSHALF|V_YELLOWMAP, M_GetText("- SPECTATING -")); + V_DrawString(2, BASEVIDHEIGHT-40, V_HUDTRANSHALF|V_YELLOWMAP, M_GetText("- SPECTATING -")); if (stplyr->pflags & PF_WANTSTOJOIN) - V_DrawString(2, BASEVIDHEIGHT-40, V_HUDTRANSHALF, M_GetText("Item - Cancel Join")); + V_DrawString(2, BASEVIDHEIGHT-30, V_HUDTRANSHALF, M_GetText("Item - Cancel Join")); /*else if (G_GametypeHasTeams()) - V_DrawString(2, BASEVIDHEIGHT-40, V_HUDTRANSHALF, M_GetText("Item - Join Team"));*/ + V_DrawString(2, BASEVIDHEIGHT-30, V_HUDTRANSHALF, M_GetText("Item - Join Team"));*/ else - V_DrawString(2, BASEVIDHEIGHT-40, V_HUDTRANSHALF, M_GetText("Item - Join Game")); - V_DrawString(2, BASEVIDHEIGHT-30, V_HUDTRANSHALF, M_GetText("F12 - Change View")); + V_DrawString(2, BASEVIDHEIGHT-30, V_HUDTRANSHALF, M_GetText("Item - Join Game")); V_DrawString(2, BASEVIDHEIGHT-20, V_HUDTRANSHALF, M_GetText("Accelerate - Float")); V_DrawString(2, BASEVIDHEIGHT-10, V_HUDTRANSHALF, M_GetText("Brake - Sink")); } diff --git a/src/v_video.c b/src/v_video.c index 46d34acc..0a8fd561 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -668,14 +668,10 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_ // void V_DrawContinueIcon(INT32 x, INT32 y, INT32 flags, INT32 skinnum, UINT8 skincolor) { - if (skins[skinnum].flags & SF_HIRES -#ifdef HWRENDER -// || (rendermode != render_soft && rendermode != render_none) -#endif - ) - V_DrawScaledPatch(x - 10, y - 14, flags, W_CachePatchName("CONTINS", PU_CACHE)); + if (skinnum < 0 || skinnum >= numskins || (skins[skinnum].flags & SF_HIRES)) + V_DrawScaledPatch(x - 10, y - 14, flags, W_CachePatchName("CONTINS", PU_CACHE)); // Draw a star else - { + { // Find front angle of the first waiting frame of the character's actual sprites spriteframe_t *sprframe = &skins[skinnum].spritedef.spriteframes[2 & FF_FRAMEMASK]; patch_t *patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE); const UINT8 *colormap = R_GetTranslationColormap(skinnum, skincolor, GTC_CACHE); @@ -820,6 +816,10 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c) else if (!(c & V_SNAPTOTOP)) y += (vid.height - (BASEVIDHEIGHT * dupy)) / 2; } + if (c & V_SPLITSCREEN) + y += (BASEVIDHEIGHT * dupy)/2; + if (c & V_HORZSCREEN) + x += (BASEVIDWIDTH * dupx)/2; } if (x >= vid.width || y >= vid.height) @@ -901,6 +901,10 @@ void V_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 c) else if (!(c & V_SNAPTOTOP)) y += (vid.height - (BASEVIDHEIGHT * dupy)) / 2; } + if (c & V_SPLITSCREEN) + y += (BASEVIDHEIGHT * dupy)/2; + if (c & V_HORZSCREEN) + x += (BASEVIDWIDTH * dupx)/2; } if (x >= vid.width || y >= vid.height) @@ -1282,8 +1286,8 @@ UINT8 *V_GetStringColormap(INT32 colorflags) return steelmap; case 13: // 0x8D, pink return pinkmap; - case 14: // 0x8E, teal - return tealmap; + case 14: // 0x8E, brown + return brownmap; case 15: // 0x8F, peach return peachmap; default: // reset diff --git a/src/v_video.h b/src/v_video.h index f6826cf7..734b8037 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -82,7 +82,7 @@ extern UINT8 hudtrans; #define V_TEAMAP 0x0000B000 #define V_STEELMAP 0x0000C000 #define V_PINKMAP 0x0000D000 -#define V_TEALMAP 0x0000E000 +#define V_BROWNMAP 0x0000E000 #define V_PEACHMAP 0x0000F000 // use bits 17-20 for alpha transparency diff --git a/src/w_wad.c b/src/w_wad.c index 2b6b955b..a2140754 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -196,16 +196,21 @@ static inline void W_LoadDehackedLumps(UINT16 wadnum) for (lump = 0; lump < wadfiles[wadnum]->numlumps; lump++, lump_p++) if (memcmp(lump_p->name,"SOC_",4)==0) // Check for generic SOC lump { // shameless copy+paste of code from LUA_LoadLump - char *name = malloc(strlen(wadfiles[wadnum]->filename)+10); + size_t len = strlen(wadfiles[wadnum]->filename); + char *name = malloc(len+10); + strcpy(name, wadfiles[wadnum]->filename); - if (!fasticmp(&name[strlen(name) - 4], ".soc")) { + if (!fasticmp(&name[len - 4], ".soc")) { // If it's not a .soc file, copy the lump name in too. - name[strlen(wadfiles[wadnum]->filename)] = '|'; - M_Memcpy(name+strlen(wadfiles[wadnum]->filename)+1, lump_p->name, 8); - name[strlen(wadfiles[wadnum]->filename)+9] = '\0'; + name[len] = '|'; + M_Memcpy(name+len+1, lump_p->name, 8); + name[len+9] = '\0'; } + CONS_Printf(M_GetText("Loading SOC from %s\n"), name); DEH_LoadDehackedLumpPwad(wadnum, lump); + + free(name); } else if (memcmp(lump_p->name,"MAINCFG",8)==0) // Check for MAINCFG { diff --git a/src/win32/win_snd.c b/src/win32/win_snd.c index f168f1fe..e50a4737 100644 --- a/src/win32/win_snd.c +++ b/src/win32/win_snd.c @@ -17,17 +17,13 @@ #include "gme/gme.h" #define GME_TREBLE 5.0 #define GME_BASS 1.0 -#ifdef HAVE_PNG /// TODO: compile with zlib support without libpng - -#define HAVE_ZLIB +#ifdef HAVE_ZLIB #ifndef _MSC_VER -#ifndef _WII #ifndef _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE #endif #endif -#endif #ifndef _LFS64_LARGEFILE #define _LFS64_LARGEFILE @@ -38,8 +34,8 @@ #endif #include "zlib.h" -#endif -#endif +#endif // HAVE_ZLIB +#endif // HAVE_LIBGME static FMOD_SYSTEM *fsys; static FMOD_SOUND *music_stream; @@ -357,12 +353,13 @@ void I_FreeSfx(sfxinfo_t *sfx) sfx->data = NULL; } -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel) { FMOD_SOUND *sound; FMOD_CHANNEL *chan; INT32 i; float frequency; + (void)channel; sound = (FMOD_SOUND *)S_sfx[id].data; I_Assert(sound != NULL); diff --git a/src/win32/win_vid.c b/src/win32/win_vid.c index 30fada8e..f355eaea 100644 --- a/src/win32/win_vid.c +++ b/src/win32/win_vid.c @@ -51,7 +51,7 @@ rendermode_t rendermode = render_soft; static void OnTop_OnChange(void); // synchronize page flipping with screen refresh static CV_PossibleValue_t CV_NeverOnOff[] = {{-1, "Never"}, {0, "Off"}, {1, "On"}, {0, NULL}}; -consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, OnTop_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_vidwait = {"vid_wait", "Off", CV_SAVE, CV_OnOff, OnTop_OnChange, 0, NULL, NULL, 0, 0, NULL}; static consvar_t cv_stretch = {"stretch", "On", CV_SAVE|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; static consvar_t cv_ontop = {"ontop", "Never", 0, CV_NeverOnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; diff --git a/src/win32ce/win_snd.c b/src/win32ce/win_snd.c index f9c65217..14ce4add 100644 --- a/src/win32ce/win_snd.c +++ b/src/win32ce/win_snd.c @@ -538,7 +538,8 @@ INT32 I_StartSound (sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, - INT32 priority) + INT32 priority, + INT32 channel) { HRESULT hr; LPDIRECTSOUNDBUFFER dsbuffer; @@ -549,6 +550,7 @@ INT32 I_StartSound (sfxenum_t id, #ifdef SURROUND LPDIRECTSOUNDBUFFER dssurround; #endif + (void)channel; if (nosound) return -1; diff --git a/src/win32ce/win_vid.c b/src/win32ce/win_vid.c index b9c2e131..5e8e7e1f 100644 --- a/src/win32ce/win_vid.c +++ b/src/win32ce/win_vid.c @@ -48,7 +48,7 @@ rendermode_t rendermode = render_soft; // synchronize page flipping with screen refresh -consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_vidwait = {"vid_wait", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; static consvar_t cv_stretch = {"stretch", "On", CV_SAVE|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; boolean highcolor; diff --git a/src/y_inter.c b/src/y_inter.c index e26d4973..5d7456dd 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -560,13 +560,13 @@ void Y_Ticker(void) // Team scramble code for team match and CTF. // Don't do this if we're going to automatically scramble teams next round. - if (G_GametypeHasTeams() && cv_teamscramble.value && !cv_scrambleonchange.value && server) + /*if (G_GametypeHasTeams() && cv_teamscramble.value && !cv_scrambleonchange.value && server) { // If we run out of time in intermission, the beauty is that // the P_Ticker() team scramble code will pick it up. if ((intertic % (TICRATE/7)) == 0) P_DoTeamscrambling(); - } + }*/ // multiplayer uses timer (based on cv_inttime) if (timer) @@ -1137,7 +1137,7 @@ void Y_VoteDrawer(void) else { V_DrawFixedPatch((x+40)<