diff --git a/source/common/gamecontrol.cpp b/source/common/gamecontrol.cpp index 05ed78781..f046601cc 100644 --- a/source/common/gamecontrol.cpp +++ b/source/common/gamecontrol.cpp @@ -321,7 +321,7 @@ void CheckFrontend(int flags) { gi = Blood::CreateInterface(); } - else if (flags & GAMEFLAG_RR) + else if (flags & GAMEFLAG_RRALL) { gi = Redneck::CreateInterface(); } @@ -678,7 +678,7 @@ int RunGame() InitStatistics(); M_Init(); SetDefaultStrings(); - if (g_gameType & GAMEFLAG_RR) InitRREndMap(); // this needs to be done better later + if (g_gameType & (GAMEFLAG_RR|GAMEFLAG_RRRA)) InitRREndMap(); // this needs to be done better later if (Args->CheckParm("-sounddebug")) C_DoCommand("stat sounddebug"); diff --git a/source/common/gamecontrol.h b/source/common/gamecontrol.h index d6fd60ef7..09da6ac18 100644 --- a/source/common/gamecontrol.h +++ b/source/common/gamecontrol.h @@ -104,12 +104,13 @@ enum GAMEFLAG_FURY = 0x00000080, GAMEFLAG_RR = 0x00000100, GAMEFLAG_RRRA = 0x00000200, - GAMEFLAG_BLOOD = 0x00000400, - GAMEFLAG_SW = 0x00000800, - GAMEFLAG_POWERSLAVE = 0x00001000, - GAMEFLAG_EXHUMED = 0x00002000, - GAMEFLAG_PSEXHUMED = 0x00003000, // the two games really are the same, except for the name and the publisher. - GAMEFLAG_DEER = 0x00004000, + GAMEFLAG_DEER = 0x00000400, + GAMEFLAG_RRALL = GAMEFLAG_RR | GAMEFLAG_RRRA | GAMEFLAG_DEER, + GAMEFLAG_BLOOD = 0x00000800, + GAMEFLAG_SW = 0x00001000, + GAMEFLAG_POWERSLAVE = 0x00002000, + GAMEFLAG_EXHUMED = 0x00004000, + GAMEFLAG_PSEXHUMED = GAMEFLAG_POWERSLAVE | GAMEFLAG_EXHUMED, // the two games really are the same, except for the name and the publisher. GAMEFLAG_STANDALONE = 0x00008000, GAMEFLAGMASK = 0x00007FFF, // flags allowed from grpinfo diff --git a/source/common/menu/menudef.cpp b/source/common/menu/menudef.cpp index 013dc35a5..c3276d7d6 100644 --- a/source/common/menu/menudef.cpp +++ b/source/common/menu/menudef.cpp @@ -152,7 +152,7 @@ static const gamefilter games[] = { { "Fury", GAMEFLAG_FURY}, { "Redneck", GAMEFLAG_RR}, { "RedneckRides", GAMEFLAG_RRRA}, - { "RedneckDeer", GAMEFLAG_DEER}, + { "Deer", GAMEFLAG_DEER}, { "Blood", GAMEFLAG_BLOOD}, { "ShadowWarrior", GAMEFLAG_SW}, { "Exhumed", GAMEFLAG_POWERSLAVE|GAMEFLAG_EXHUMED}, @@ -1144,7 +1144,7 @@ void M_ParseMenuDefs() OptionSettings.mFontColorHighlight = CR_ORANGE; OptionSettings.mFontColorSelection = CR_GOLD; } - else if (g_gameType & (GAMEFLAG_RR|GAMEFLAG_RRRA)) + else if (g_gameType & GAMEFLAG_RRALL) { OptionSettings.mFontColor = CR_BROWN; OptionSettings.mFontColorHeader = CR_DARKBROWN; diff --git a/source/common/searchpaths.cpp b/source/common/searchpaths.cpp index fce2b99bf..952362a76 100644 --- a/source/common/searchpaths.cpp +++ b/source/common/searchpaths.cpp @@ -559,7 +559,7 @@ static TArray ParseGrpInfo(const char *fn, FileReader &fr, TMap 40) + { + dword_A99C0 = 0; + dword_A99C4 = 1; + } + switch (dword_A99A0) + { + case 0: + if ((int)totalclock - dword_A99B8 >= 240 && dword_A99C4 && (rrdh_random() & 63) < 32) + { + dword_A99A0 = 1; + dword_A99A4 = 160 - ((rrdh_random() & 255) - 128); + word_A99B0 = ((rrdh_random() & 127) + 1984) & 2047; + dword_A99AC = (rrdh_random() & 4095) - 4090; + word_A99B2 = SPINNINGNUKEICON + (rrdh_random() & 15); + } + break; + case 1: + if (dword_A99A8 < 54) + { + if ((int)totalclock - dword_A99B4 > 2) + { + dword_A99B4 = (int)totalclock; + dword_A99A8 += 2; + } + } + else + { + dword_A99A0 = 2; + dword_A99BC = (int)totalclock; + } + pos.x += dword_A99A4 << 16; + pos.y += (240 - dword_A99A8) << 16; + rotatesprite(pos.x, pos.y, 32768 - dword_A99AC, word_A99B0, word_A99B2, 0, 0, 10, 0, 0, xdim - 1, ydim - 1); + break; + case 2: + if (dword_A99C4 == 1) + { + if ((rrdh_random() & 63) > 32) + word_A99B2--; + else + word_A99B2++; + } + else + { + if ((rrdh_random() & 127) == 48) + { + if ((int)totalclock - dword_A99BC > 240) + dword_A99A0 = 3; + } + } + if (word_A99B2 < SPINNINGNUKEICON) + word_A99B2 = SPINNINGNUKEICON + 15; + if (word_A99B2 > SPINNINGNUKEICON + 15) + word_A99B2 = SPINNINGNUKEICON; + pos.x += dword_A99A4 << 16; + pos.y += (240 - dword_A99A8) << 16; + rotatesprite(pos.x, pos.y, 32768 - dword_A99AC, word_A99B0, word_A99B2, 0, 0, 10, 0, 0, xdim - 1, ydim - 1); + if ((int)totalclock - dword_A99BC > 960) + dword_A99A0 = 3; + break; + case 3: + if (dword_A99A8 > 0) + { + if ((int)totalclock - dword_A99B4 > 2) + { + dword_A99B4 = (int)totalclock; + dword_A99A8 -= 2; + } + pos.x += dword_A99A4 << 16; + pos.y += (240 - dword_A99A8) << 16; + rotatesprite(pos.x, pos.y, 32768 - dword_A99AC, word_A99B0, word_A99B2, 0, 0, 10, 0, 0, xdim - 1, ydim - 1); + } + else + { + dword_A99B8 = (int)totalclock; + dword_A99A0 = 0; + } + break; + } + dword_A99C4 = 0; +} + + //---------------------------------------------------------------------------- // // Implements the native looking menu used for the main menu @@ -266,10 +371,22 @@ protected: class RedneckMainMenu : public RedneckListMenu { + virtual void Init(DMenu* parent = NULL, FListMenuDescriptor* desc = NULL) + { + RedneckListMenu::Init(parent, desc); + Menu_DHLeaonardHeadReset(); + } + void PreDraw() override { RedneckListMenu::PreDraw(); - if (RRRA) + if (DEER) + { + vec2_t forigin = { int(origin.X * 65536), int(origin.Y * 65536) }; + Menu_DHLeaonardHeadDisplay(forigin); + rotatesprite_fs(forigin.x + (MENU_MARGIN_CENTER << 16), forigin.y + ((32) << 16), 20480L, 0, DUKENUKEM, 0, 0, 10); + } + else if (RRRA) { rotatesprite_fs(int(origin.X * 65536) + ((MENU_MARGIN_CENTER - 5) << 16), int(origin.Y * 65536) + ((57) << 16), 16592L, 0, THREEDEE, 0, 0, 10); } @@ -287,6 +404,110 @@ class RedneckMainMenu : public RedneckListMenu } }; + +class RedneckHuntMenu : public RedneckListMenu +{ + void PreDraw() override + { + RedneckListMenu::PreDraw(); + vec2_t forigin = { int(origin.X * 65536), int(origin.Y * 65536) }; + int t1, t2; + short ang; + switch (mDesc->mSelectedItem) + { + case 0: + default: + t1 = 7098; + t2 = 7041; + ang = 16; + break; + case 1: + t1 = 7099; + t2 = 7042; + ang = 2032; + break; + case 2: + t1 = 7100; + t2 = 7043; + ang = 16; + break; + case 3: + t1 = 7101; + t2 = 7044; + ang = 2032; + break; + } + rotatesprite_fs(forigin.x + (240 << 16), forigin.y + (56 << 16), 24576L, ang, t1, 2, 0, 64 + 10); + rotatesprite_fs(forigin.x + (240 << 16), forigin.y + (42 << 16), 24576L, ang, 7104, 2, 0, 10); + rotatesprite_fs(forigin.x + (20 << 16), forigin.y + (10 << 16), 32768L, 0, t2, -64, 0, 128 + 16 + 10); + } +}; + +class RedneckTargetMenu : public RedneckListMenu +{ + void PreDraw() override + { + RedneckListMenu::PreDraw(); + vec2_t forigin = { int(origin.X * 65536), int(origin.Y * 65536) }; + int t1, t2; + short ang; + switch (mDesc->mSelectedItem) + { + case 0: + default: + t1 = 7102; + t2 = 7045; + ang = 16; + break; + case 1: + t1 = 7103; + t2 = 7046; + ang = 2032; + break; + break; + } + rotatesprite_fs(forigin.x + (240 << 16), forigin.y + (56 << 16), 24576L, ang, t1, 2, 0, 64 + 10); + rotatesprite_fs(forigin.x + (240 << 16), forigin.y + (42 << 16), 24576L, ang, 7104, 2, 0, 10); + rotatesprite_fs(forigin.x + (20 << 16), forigin.y + (10 << 16), 32768L, 0, t2, -64, 0, 128 + 16 + 10); + } +}; + +class RedneckWeaponMenu : public RedneckListMenu +{ + void PreDraw() override + { + RedneckListMenu::PreDraw(); + vec2_t forigin = { int(origin.X * 65536), int(origin.Y * 65536) }; + int t1, t2; + switch (mDesc->mSelectedItem) + { + case 0: + default: + t1 = 7124; + t2 = 7066; + break; + case 1: + t1 = 7125; + t2 = 7067; + break; + case 2: + t1 = 7126; + t2 = 7068; + break; + case 3: + t1 = 7127; + t2 = 7069; + break; + case 4: + t1 = 7128; + t2 = 7070; + break; + } + rotatesprite_fs(forigin.x + (240 << 16), forigin.y + (56 << 16), 32768L, 0, t1, 2, 0, 64 + 10); + rotatesprite_fs(forigin.x + (8 << 16), forigin.y + (4 << 16), 32768L, 0, t2, -64, 0, 128 + 16 + 10); + } +}; + //---------------------------------------------------------------------------- // // Menu related game interface functions @@ -518,6 +739,9 @@ END_RR_NS static TMenuClassDescriptor _mm("Redneck.MainMenu"); static TMenuClassDescriptor _lm("Redneck.ListMenu"); +static TMenuClassDescriptor _dhm("Redneck.HuntMenu"); +static TMenuClassDescriptor _dtm("Redneck.TargetMenu"); +static TMenuClassDescriptor _dwm("Redneck.WeaponMenu"); static TMenuClassDescriptor _ism("Redneck.ImageScrollerMenu"); // does not implement a new class, we only need the descriptor. void RegisterRedneckMenus() @@ -525,4 +749,7 @@ void RegisterRedneckMenus() menuClasses.Push(&_mm); menuClasses.Push(&_lm); menuClasses.Push(&_ism); + menuClasses.Push(&_dhm); + menuClasses.Push(&_dtm); + menuClasses.Push(&_dwm); } diff --git a/source/rr/src/gameexec.cpp b/source/rr/src/gameexec.cpp index 485350e9e..7ba8b43b0 100644 --- a/source/rr/src/gameexec.cpp +++ b/source/rr/src/gameexec.cpp @@ -1901,7 +1901,7 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop) continue; } insptr++; - if (g_gameType & GAMEFLAG_RR) + if (RR) { // This check does not exist in Duke Nukem. if ((g_spriteExtra[vm.spriteNum] < 1 || g_spriteExtra[vm.spriteNum] == 128) diff --git a/source/rr/src/rrdh.cpp b/source/rr/src/rrdh.cpp index 0860492e2..391a10d36 100644 --- a/source/rr/src/rrdh.cpp +++ b/source/rr/src/rrdh.cpp @@ -21,9 +21,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ //------------------------------------------------------------------------- +#include "ns.h" + + #include "compat.h" #include "baselayer.h" #include "duke3d.h" +#include "i_time.h" + +BEGIN_RR_NS int rrdh_randseed = 1; @@ -32,7 +38,7 @@ int rrdh_random(void) static int seedinit = 0; if (!seedinit) { - rrdh_randseed = (int)timerGetPerformanceCounter(); + rrdh_randseed = (int)I_nsTime(); seedinit = 1; } rrdh_randseed = (rrdh_randseed*1103515245)+12345; @@ -300,4 +306,5 @@ void sub_5A02C(void) void sub_5A250(int a1) { // TODO -} \ No newline at end of file +} +END_RR_NS diff --git a/source/rr/src/rrdh.h b/source/rr/src/rrdh.h index 295d8cf4e..607a5049b 100644 --- a/source/rr/src/rrdh.h +++ b/source/rr/src/rrdh.h @@ -23,6 +23,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #pragma once +BEGIN_RR_NS + int rrdh_random(void); int ghcons_isanimalescapewall(short w); int ghcons_isanimalescapesect(short s); @@ -44,3 +46,5 @@ void sub_5A02C(void); void sub_579A0(void); void ghsound_ambientlooppoll(void); int sub_51B68(void); + +END_RR_NS diff --git a/source/rr/src/screens.cpp b/source/rr/src/screens.cpp index 80dcc54c9..527a28963 100644 --- a/source/rr/src/screens.cpp +++ b/source/rr/src/screens.cpp @@ -1168,7 +1168,7 @@ void G_DisplayLogo(void) { if (!g_noLogo /* && (!g_netServer && ud.multimode < 2) */) { - if (!I_CheckAllInput() && g_noLogoAnim == 0) + if (!inputState.CheckAllInput() && g_noLogoAnim == 0) { videoClearScreen(0); @@ -1180,7 +1180,7 @@ void G_DisplayLogo(void) fadepaltile(0, 0, 0, 252, 0, -4, 7106); totalclock = 0; - while (totalclock < (120 * 3) && !I_CheckAllInput()) + while (totalclock < (120 * 3) && !inputState.CheckAllInput()) { if (G_FPSLimit()) { @@ -1217,7 +1217,7 @@ void G_DisplayLogo(void) { videoClearScreen(0); - P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8 + 2 + 1); // JBF 20040308 + P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308 fadepal(0, 0, 0, 0, 252, 28); renderFlushPerms(); rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, 7107, 0, 0, 2 + 8 + 64 + BGSTRETCH); @@ -1225,7 +1225,7 @@ void G_DisplayLogo(void) fadepaltile(0, 0, 0, 252, 0, -4, 7107); totalclock = 0; - while (totalclock < (120 * 3) && !I_CheckAllInput()) + while (totalclock < (120 * 3) && !inputState.CheckAllInput()) { if (G_FPSLimit()) { diff --git a/wadsrc/static/engine/grpinfo.txt b/wadsrc/static/engine/grpinfo.txt index 7295a16d1..7b4092a87 100644 --- a/wadsrc/static/engine/grpinfo.txt +++ b/wadsrc/static/engine/grpinfo.txt @@ -332,7 +332,7 @@ grpinfo size 191798609 crc RRRA_CRC defname "rrra.def" - flags GAMEFLAG_RRRA|GAMEFLAG_RR + flags GAMEFLAG_RRRA dependency 0 gamefilter "Redneck.RidesAgain" } @@ -343,7 +343,7 @@ grpinfo size 58061576 crc RRDEER_CRC defname "rrdeer.def" - flags GAMEFLAG_RR|GAMEFLAG_DEER + flags GAMEFLAG_DEER dependency 0 gamefilter "Redneck.Deer" } diff --git a/wadsrc/static/engine/menudef.txt b/wadsrc/static/engine/menudef.txt index eef1bc323..5c76ec167 100644 --- a/wadsrc/static/engine/menudef.txt +++ b/wadsrc/static/engine/menudef.txt @@ -36,6 +36,18 @@ LISTMENU "MainMenu" NativeTextItem "$MNU_CREDITS", "c", "CreditsMenu" NativeTextItem "$MNU_QUITGAME", "q", "QuitMenu" } + ifgame(Deer) + { + position 160, 72, 115 + centermenu + animatedtransition + NativeTextItem "Go Huntin'!", "g", "HuntMenu" + NativeTextItem "Target Range", "r", "TargetMenu" + NativeTextItem "Trophies", "t", "TrophiesMenu" + NativeTextItem "$MNU_OPTIONS", "o", "OptionsMenu" + NativeTextItem "$MNU_HELP", "h", "HelpMenu" + NativeTextItem "$MNU_QUITGAME", "q", "QuitMenu" + } ifgame(Blood) { position 160, 45, 150 @@ -113,6 +125,18 @@ LISTMENU "IngameMenu" NativeTextItem "$MNU_ENDGAME", "e", "EndgameMenu" NativeTextItem "$MNU_QUITGAME", "q", "QuitMenu" } + ifgame(Deer) + { + position 160, 72, 108 + centermenu + animatedtransition + NativeTextItem "Go Huntin'!", "g", "HuntMenu" + NativeTextItem "Target Range", "r", "TargetMenu" + NativeTextItem "Trophies", "t", "TrophiesMenu" + NativeTextItem "$MNU_OPTIONS", "o", "OptionsMenu" + NativeTextItem "$MNU_HELP", "h", "HelpMenu" + NativeTextItem "$MNU_QUITGAME", "q", "QuitMenu" + } ifgame(Blood) { position 160, 45, 150 @@ -194,6 +218,54 @@ LISTMENU "EpisodeMenu" ScriptId 100 } +LISTMENU "HuntMenu" +{ + ifgame(Deer) + { + class "$.HuntMenu" + position 160, 102, 78 + centermenu + animatedtransition + NativeTextItem "LAKE SWAMPY", "q", "WeaponsMenu" + NativeTextItem "SAGEBRUSH FLATS", "q", "WeaponsMenu" + NativeTextItem "OZARK FOREST", "q", "WeaponsMenu" + NativeTextItem "SNOWBUSH RIDGE", "q", "WeaponsMenu" + } +} + +LISTMENU "TargetMenu" +{ + ifgame(Deer) + { + class "$.TargetMenu" + position 160, 102, 78 + centermenu + animatedtransition + NativeTextItem "NORTH RANGE", "q", "WeaponsMenu" + NativeTextItem "SOUTH RANGE", "q", "WeaponsMenu" + } +} + +LISTMENU "TrophiesMenu" +{ +} + +LISTMENU "WeaponsMenu" +{ + ifgame(Deer) + { + class "$.WeaponMenu" + position 160, 102, 98 + centermenu + animatedtransition + NativeTextItem "Pistol", "q", "QuitMenu" + NativeTextItem "Rifle", "q", "QuitMenu" + NativeTextItem "Rifle With Scope", "q", "QuitMenu" + NativeTextItem "Shotgun", "q", "QuitMenu" + NativeTextItem "Crossbow", "q", "QuitMenu" + } +} + LISTMENU "SkillMenu" { ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides) @@ -685,7 +757,7 @@ OptionMenu "ActionControlsMenu"// protected StaticText "" Control "$CNTRLMNU_JUMP" , "+jump" Control "$CNTRLMNU_CROUCH" , "+crouch" - ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides) + ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides, Deer) { // Fixme: Make this work in all games Control "$CNTRLMNU_TOGGLECROUCH" , "+toggle_crouch" @@ -699,7 +771,7 @@ OptionMenu "ActionControlsMenu"// protected Control "$CNTRLMNU_AIMDOWN" , "+aim_down" Control "$CNTRLMNU_LOOKUP" , "+look_up" Control "$CNTRLMNU_LOOKDOWN" , "+look_down" - ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides) + ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides, Deer) { Control "$CNTRLMNU_LOOKLEFT" , "+look_left" Control "$CNTRLMNU_LOOKRIGHT" , "+look_right" @@ -1142,7 +1214,7 @@ OptionMenu "VideoOptions" //protected { Option "$DSPLYMNU_SLOPETILT", "cl_slopetilting", "OnOff" } - ifgame (Duke, Nam, WW2GI, Fury, Redneck, RedneckRides) + ifgame (Duke, Nam, WW2GI, Fury, Redneck, RedneckRides, Deer) { Option "$DSPLYMNU_VIEWBOB", "cl_viewbob", "OnOff" } @@ -1196,7 +1268,7 @@ OptionMenu "HUDOptions" //protected } Option "$DSPLYMNU_LEVELSTATS", "hud_stats", "OnOff" - ifgame(duke, nam, ww2gi, redneck, redneckrides, fury) + ifgame(duke, nam, ww2gi, redneck, redneckrides, fury, Deer) { Slider "$DSPLYMNU_TEXTSCALE", "hud_textscale", 100, 400, 20, 2 } @@ -1204,7 +1276,7 @@ OptionMenu "HUDOptions" //protected Option "$DSPLYMNU_MESSAGES", "hud_messages", "HudMessages" StaticText "" Option "$DSPLYMNU_CROSSHAIR", "cl_crosshair", OnOff - ifgame(duke, nam, ww2gi, redneck, redneckrides, fury) + ifgame(duke, nam, ww2gi, redneck, redneckrides, fury, deer) { Slider "$DSPLYMNU_CROSSHAIRSCALE", "cl_crosshairscale", 50, 100, 10, 1 }