From 0c60b28ea17559e0e7cf8aea71aec0b9d8c9cb84 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 6 Sep 2020 23:54:40 +0200 Subject: [PATCH 01/11] - fixed positioning of World Tour status bar Fixes #355. --- source/games/duke/src/sbar_d.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/games/duke/src/sbar_d.cpp b/source/games/duke/src/sbar_d.cpp index f644cab14..664803328 100644 --- a/source/games/duke/src/sbar_d.cpp +++ b/source/games/duke/src/sbar_d.cpp @@ -383,9 +383,10 @@ public: auto p = &ps[snum]; int h = tilesiz[TILE_BOTTOMSTATUSBAR].y; int top = 200 - h; + int left = (320 - tilesiz[TILE_BOTTOMSTATUSBAR].x) / 2; BeginStatusBar(320, 200, h); DrawInventory(p, 160, 154, 0); - DrawGraphic(tileGetTexture(TILE_BOTTOMSTATUSBAR), 0, top, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1); + DrawGraphic(tileGetTexture(TILE_BOTTOMSTATUSBAR), left, top, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1); FString format; From bd183ad68213085b7b7932cbd36a8455eec14738 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 7 Sep 2020 00:45:11 +0200 Subject: [PATCH 02/11] - fixed World Tour weapon display and property parsing, resulting in incorrect ammo count for the flamethrower. Fixes #356 --- source/games/duke/src/gamedef.cpp | 3 +- source/games/duke/src/hudweapon_d.cpp | 43 +++++++++++++-------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/source/games/duke/src/gamedef.cpp b/source/games/duke/src/gamedef.cpp index 2b0be79e7..322357067 100644 --- a/source/games/duke/src/gamedef.cpp +++ b/source/games/duke/src/gamedef.cpp @@ -1799,7 +1799,7 @@ int ConCompiler::parsecommand() max_ammo_amount[8] = parseone(); max_ammo_amount[9] = parseone(); if (isPlutoPak() || isRR()) max_ammo_amount[11] = parseone(); - if (isRR() || isWorldTour()) max_ammo_amount[12] = parseone(); + if (isRR()) max_ammo_amount[12] = parseone(); camerashitable = parseone(); numfreezebounces = parseone(); freezerhurtowner = parseone(); @@ -1808,6 +1808,7 @@ int ConCompiler::parsecommand() spriteqamount = clamp(parseone(), 0, 1024); lasermode = parseone(); } + if (isWorldTour()) max_ammo_amount[12] = parseone(); if (isRRRA()) { max_ammo_amount[13] = parseone(); diff --git a/source/games/duke/src/hudweapon_d.cpp b/source/games/duke/src/hudweapon_d.cpp index ea105a413..5b3eefde6 100644 --- a/source/games/duke/src/hudweapon_d.cpp +++ b/source/games/duke/src/hudweapon_d.cpp @@ -175,8 +175,7 @@ int animateknuckles(int gs, int snum, double hard_landing, double look_anghalf, else pal = sector[ps[snum].cursectnum].floorpal; - auto pic = isWorldTour() ? CRACKKNUCKLESWIDE : CRACKKNUCKLES; - hud_drawpal(160 + (getavel(snum) / 16.) - look_anghalf, looking_arc + 180 - horiz16th, pic + knuckle_frames[ps[snum].knuckle_incs >> 1], gs, 4, pal); + hud_drawpal(160 + (getavel(snum) / 16.) - look_anghalf, looking_arc + 180 - horiz16th, CRACKKNUCKLES + knuckle_frames[ps[snum].knuckle_incs >> 1], gs, 4, pal); return 1; } @@ -477,7 +476,7 @@ void displayweapon_d(int snum, double smoothratio) if (*kb < (isWW2GI() ? aplWeaponTotalTime[RPG_WEAPON][snum] : 8)) { hud_drawpal(weapon_xoffset + 164, (looking_arc * 2.) + 176 - gun_pos, - rpgpic + (*kb >> 1), gs, o | pin, pal); + RPGGUN + (*kb >> 1), gs, o | pin, pal); } else if (isWW2GI()) { @@ -852,46 +851,46 @@ void displayweapon_d(int snum, double smoothratio) else { pin = (isWW2GI() || isWorldTour() || (duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) ? 0 : RS_ALIGN_R; - auto pic = isWorldTour() ? FIRSTGUNRELOAD - 4 : FIRSTGUN; // I do not want to edit all code below + auto pic_5 = isWorldTour() ? FIRSTGUNRELOADWIDE : FIRSTGUN+5; const int WEAPON2_RELOAD_TIME = 50; auto reload_time = isWW2GI() ? aplWeaponReload[PISTOL_WEAPON][snum] : WEAPON2_RELOAD_TIME; if (*kb < 10) - hud_drawpal(194 - look_anghalf, looking_arc + 230 - gun_pos, pic + 4, gs, o|pin, pal); + hud_drawpal(194 - look_anghalf, looking_arc + 230 - gun_pos, FIRSTGUN + 4, gs, o|pin, pal); else if (*kb < 15) { - hud_drawpal(244 - (kickback_pic * 8.) - look_anghalf, looking_arc + 130 - gun_pos + (kickback_pic * 16.), pic + 6, gs, o | pin, pal); - hud_drawpal(224 - look_anghalf, looking_arc + 220 - gun_pos, pic + 5, gs, o | pin, pal); + hud_drawpal(244 - (kickback_pic * 8.) - look_anghalf, looking_arc + 130 - gun_pos + (kickback_pic * 16.), FIRSTGUN + 6, gs, o | pin, pal); + hud_drawpal(224 - look_anghalf, looking_arc + 220 - gun_pos, pic_5, gs, o | pin, pal); } else if (*kb < 20) { - hud_drawpal(124 + (kickback_pic * 2.) - look_anghalf, looking_arc + 430 - gun_pos - (kickback_pic * 8.), pic + 6, gs, o | pin, pal); - hud_drawpal(224 - look_anghalf, looking_arc + 220 - gun_pos, pic + 5, gs, o | pin, pal); + hud_drawpal(124 + (kickback_pic * 2.) - look_anghalf, looking_arc + 430 - gun_pos - (kickback_pic * 8.), FIRSTGUN + 6, gs, o | pin, pal); + hud_drawpal(224 - look_anghalf, looking_arc + 220 - gun_pos, pic_5, gs, o | pin, pal); } else if (*kb < (reload_time - 12)) { - hud_drawpal(184 - look_anghalf, looking_arc + 235 - gun_pos, pic + 8, gs, o | pin, pal); - hud_drawpal(224 - look_anghalf, looking_arc + 210 - gun_pos, pic + 5, gs, o | pin, pal); + hud_drawpal(184 - look_anghalf, looking_arc + 235 - gun_pos, FIRSTGUN + 8, gs, o | pin, pal); + hud_drawpal(224 - look_anghalf, looking_arc + 210 - gun_pos, pic_5, gs, o | pin, pal); } else if (*kb < (reload_time - 6)) { - hud_drawpal(164 - look_anghalf, looking_arc + 245 - gun_pos, pic + 8, gs, o | pin, pal); - hud_drawpal(224 - look_anghalf, looking_arc + 220 - gun_pos, pic + 5, gs, o | pin, pal); + hud_drawpal(164 - look_anghalf, looking_arc + 245 - gun_pos, FIRSTGUN + 8, gs, o | pin, pal); + hud_drawpal(224 - look_anghalf, looking_arc + 220 - gun_pos, pic_5, gs, o | pin, pal); } else if (*kb < (reload_time)) - hud_drawpal(194 - look_anghalf, looking_arc + 235 - gun_pos, pic + 5, gs, o, pal); + hud_drawpal(194 - look_anghalf, looking_arc + 235 - gun_pos, pic_5, gs, o, pal); else if (*kb < 23) { - hud_drawpal(184 - look_anghalf, looking_arc + 235 - gun_pos, pic + 8, gs, o | pin, pal); - hud_drawpal(224 - look_anghalf, looking_arc + 210 - gun_pos, pic + 5, gs, o | pin, pal); + hud_drawpal(184 - look_anghalf, looking_arc + 235 - gun_pos, FIRSTGUN + 8, gs, o | pin, pal); + hud_drawpal(224 - look_anghalf, looking_arc + 210 - gun_pos, pic_5, gs, o | pin, pal); } else if (*kb < 25) { - hud_drawpal(164 - look_anghalf, looking_arc + 245 - gun_pos, pic + 8, gs, o | pin, pal); - hud_drawpal(224 - look_anghalf, looking_arc + 220 - gun_pos, pic + 5, gs, o | pin, pal); + hud_drawpal(164 - look_anghalf, looking_arc + 245 - gun_pos, FIRSTGUN + 8, gs, o | pin, pal); + hud_drawpal(224 - look_anghalf, looking_arc + 220 - gun_pos, pic_5, gs, o | pin, pal); } else if (*kb < 27) - hud_drawpal(194 - look_anghalf, looking_arc + 235 - gun_pos, pic + 5, gs, o | pin, pal); + hud_drawpal(194 - look_anghalf, looking_arc + 235 - gun_pos, pic_5, gs, o | pin, pal); } }; @@ -1100,10 +1099,10 @@ void displayweapon_d(int snum, double smoothratio) looking_arc += rand() & 3; } gun_pos -= 16; - hud_drawpal(weapon_xoffset + 210 - look_anghalf, looking_arc + 261 - gun_pos, pic + 2, -32, o|pin, pal); - hud_drawpal(weapon_xoffset + 210 - look_anghalf, looking_arc + 235 - gun_pos, pic + 3 + cat_frames[*kb % 6], -32, o | pin, pal); + hud_drawpal(weapon_xoffset + 210 - look_anghalf, looking_arc + 261 - gun_pos, isWorldTour() ? FREEZEFIREWIDE : FREEZE + 2, -32, o|pin, pal); + hud_drawpal(weapon_xoffset + 210 - look_anghalf, looking_arc + 235 - gun_pos, FREEZE + 3 + cat_frames[*kb % 6], -32, o | pin, pal); } - else hud_drawpal(weapon_xoffset + 210 - look_anghalf, looking_arc + 261 - gun_pos, pic, gs, o | pin, pal); + else hud_drawpal(weapon_xoffset + 210 - look_anghalf, looking_arc + 261 - gun_pos, isWorldTour() ? FREEZEWIDE : FREEZE, gs, o | pin, pal); }; //--------------------------------------------------------------------------- From fc435565af521bcd500e39dca62e6d93a7059a3e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 7 Sep 2020 19:43:46 +0200 Subject: [PATCH 03/11] - always use the narrow status bar for overlay mode. --- source/games/duke/src/sbar_d.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/games/duke/src/sbar_d.cpp b/source/games/duke/src/sbar_d.cpp index 664803328..71bba951a 100644 --- a/source/games/duke/src/sbar_d.cpp +++ b/source/games/duke/src/sbar_d.cpp @@ -380,13 +380,14 @@ public: void Statusbar(int snum) { + int tile = hud_size < Hud_StbarOverlay ? TILE_BOTTOMSTATUSBAR : BOTTOMSTATUSBAR; // always use the narrow version for the overlay. auto p = &ps[snum]; - int h = tilesiz[TILE_BOTTOMSTATUSBAR].y; + int h = tilesiz[tile].y; int top = 200 - h; - int left = (320 - tilesiz[TILE_BOTTOMSTATUSBAR].x) / 2; + int left = (320 - tilesiz[tile].x) / 2; BeginStatusBar(320, 200, h); DrawInventory(p, 160, 154, 0); - DrawGraphic(tileGetTexture(TILE_BOTTOMSTATUSBAR), left, top, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1); + DrawGraphic(tileGetTexture(tile), left, top, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1); FString format; From 6b89bf97fe0b13e8dc5a7923606301354cfad3eb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 7 Sep 2020 19:45:20 +0200 Subject: [PATCH 04/11] fixed #362 - misnamed CVAR in MENUDEF. --- wadsrc/static/engine/menudef.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/static/engine/menudef.txt b/wadsrc/static/engine/menudef.txt index 7b708bcc1..105df4f0c 100644 --- a/wadsrc/static/engine/menudef.txt +++ b/wadsrc/static/engine/menudef.txt @@ -1009,7 +1009,7 @@ OptionMenu "AutomapOptions" Submenu "$MAPCNTRLMNU_CONTROLS" , "MapControlsMenu" StaticText "" Option "$AUTOMAPMNU_ROTATE", "am_rotate", "OnOff" - Option "$AUTOMAPMNU_FOLLOW", "am_follow", "OnOff" + Option "$AUTOMAPMNU_FOLLOW", "am_followplayer", "OnOff" // move map controls here. // todo: From 9bb99e5c057568a1d8f7ca46a3029b58351beb3f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 7 Sep 2020 19:56:28 +0200 Subject: [PATCH 05/11] - fixed 361 - togglerotate CCMD still had some bugs. --- source/core/automap.cpp | 3 +-- wadsrc/static/language.csv | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/source/core/automap.cpp b/source/core/automap.cpp index fd23c843b..c83e1fbb2 100644 --- a/source/core/automap.cpp +++ b/source/core/automap.cpp @@ -105,9 +105,8 @@ CCMD(togglefollow) CCMD(togglerotate) { am_rotate = !am_rotate; - auto msg = am_followplayer ? GStrings("TXT_ROTATE_ON") : GStrings("TXT_ROTATE_OFF"); + auto msg = am_rotate ? GStrings("TXT_ROTATE_ON") : GStrings("TXT_ROTATE_OFF"); Printf(PRINT_NOTIFY, "%s\n", msg); - if (am_followplayer) follow_x = INT_MAX; } diff --git a/wadsrc/static/language.csv b/wadsrc/static/language.csv index ce1a0f0b0..f2cd9bd89 100644 --- a/wadsrc/static/language.csv +++ b/wadsrc/static/language.csv @@ -201,6 +201,8 @@ Apasă Y sau N.","Загрузить быстрое сохранение Yes,TXT_YES,,,,Ano,Ja,Ναι,Jes,Sí,,Kyllä,Oui,Igen,Si,はい,네,Ja,Tak,Sim,,Da,Да,Да No,TXT_NO,,,,Ne,Nein,Όχι,Ne,No,,Ei,Non,Nem,No,いいえ,아니요,Nee,Nie,Não,,Nu,Нет,Не %s cheats,TXT_X_CHEATS,This is a gender sensitive message where %s represents the player,,,%s cheatuje,%s schummelt,@[art_gr] %s απατάει,%s trompas,%s hace trampa,,%s huijaa,%s triche.,,%s imbroglia,%s はチート使用,%s 이(가) 치트를 사용 함,%s bedriegt,%s oszukuje,%s está trapaceando,%s está a fazer batota,%s trișează,%s использует чит-коды,%s вара +Rotate mode on,TXT_ROTATE_ON,,,,,Rotiermodus an,,,,,,,,,,,,,,,,, +Rotate mode off,TXT_ROTATE_OFF,,,,,Rotiermodus aus,,,,,,,,,,,,,,,,, ,,Savegame,,,,,,,,,,,,,,,,,,,,, Empty slot,EMPTYSTRING,,,,Prázdný slot,nicht belegt,,Malplena Ingo,Ranura Vacía,,Tyhjä lokero,Emplacement Vide,Üres,Slot libero,空きスロット,빈 슬롯,Lege sleuf,Puste miejsce,Vazio,,Loc disponibil,Пустой слот,Празни слот ,NEWSAVE,,,,,,,,,,,,<Új mentés>,,<新規セーブ>,<새로운 게임 저장>,,,,,,<Новое сохранение>,<Нова сачувана игра> @@ -2218,7 +2220,7 @@ into the heart of karnak... Home to the celebrated burial crypt of the great King Ramses. -",TXT_EX_CINEMA1,,,,,,,,,,,,,,,,,,,,,, +",TXT_EX_CINEMA1,Intro movie subtitles,,,,,,,,,,,,,,,,,,,,, "An evil force known as the Kilmaat has besieged the sanctity of my palace and @@ -2235,7 +2237,7 @@ chaos will prevail. I am being torn between worlds and this insidious experiment must be stopped. -",TXT_EX_CINEMA1,,,,,,,,,,,,,,,,,,,,,, +",TXT_EX_CINEMA1,Level 1,,,,,,,,,,,,,,,,,,,,, "I have hidden a mystical gauntlet at el kab that will channel my energy through @@ -2251,13 +2253,13 @@ restless with your progress. Seek out a temple in this citadel where I will provide more information. -",TXT_EX_CINEMA3,,,,,,,,,,,,,,,,,,,,,, +",TXT_EX_CINEMA3,After Level 10,,,,,,,,,,,,,,,,,,,,, "Set was a formidable foe. No mortal has even conquered their own fear, much less entered mortal battle and taken his life. -",TXT_EX_CINEMA4,,,,,,,,,,,,,,,,,,,,,, +",TXT_EX_CINEMA4,Before Level 11,,,,,,,,,,,,,,,,,,,,, "the Kilmaat race has continued their monsterous animal-human experiments in @@ -2274,7 +2276,7 @@ and insect intent on slaying you. Prepare yourself for battle as she will be waiting for you at the Luxor temple. -",TXT_EX_CINEMA5,,,,,,,,,,,,,,,,,,,,,, +",TXT_EX_CINEMA5,In Level 11,,,,,,,,,,,,,,,,,,,,, "You've done well to defeat Selkis. You have distracted the Kilmaat with your @@ -2287,7 +2289,7 @@ against you. Arrogance is her weakness, and if you can defeat Kilmaatikhan, the battle will be won. -",TXT_EX_CINEMA6,,,,,,,,,,,,,,,,,,,,,, +",TXT_EX_CINEMA6,After Level 15,,,,,,,,,,,,,,,,,,,,, "The Kilmaat have been destroyed. Unfortunately, your recklessness has @@ -2295,7 +2297,7 @@ destroyed the Earth and all of its inhabitants. All that remains is a smoldering hunk of rock. -",TXT_EX_CINEMA7,,,,,,,,,,,,,,,,,,,,,, +",TXT_EX_CINEMA7,Bad ending,,,,,,,,,,,,,,,,,,,,, "The Kilmaat have been defeated and you single handedly saved the Earth @@ -2305,7 +2307,7 @@ from destruction. Your bravery and heroism are legendary. -",TXT_EX_CINEMA8,,,,,,,,,,,,,,,,,,,,,, +",TXT_EX_CINEMA8,After Level 20,,,,,,,,,,,,,,,,,,,,, "LOBOTOMY SOFTWARE, INC.,",TXT_EX_COPYRIGHT1,,,,,,,,,,,,,,,,,,,,,, "3D ENGINE BY 3D REALMS,",TXT_EX_COPYRIGHT2,,,,,,,,,,,,,,,,,,,,,, Life Blood,TXT_EX_PICKUP1,,,,,,,,,,,,,,,,,,,,,, From de7da0d4d70a9ef00e491d85f509aa28bfe75676 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 7 Sep 2020 20:09:53 +0200 Subject: [PATCH 06/11] - fixed: The summary screen in Duke and RR was blocking without explicit user input. It must check for the actual sound that was played, because at least in Duke the looping music is still playing. Fixes #367 --- source/games/duke/src/2d_d.cpp | 6 ++++-- source/games/duke/src/2d_r.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/source/games/duke/src/2d_d.cpp b/source/games/duke/src/2d_d.cpp index 42c4505d7..291e88296 100644 --- a/source/games/duke/src/2d_d.cpp +++ b/source/games/duke/src/2d_d.cpp @@ -767,6 +767,7 @@ class DDukeLevelSummaryScreen : public DScreenJob const char* lastmapname; int gfx_offset; int bonuscnt = 0; + int speech = -1; void SetTotalClock(int tc) { @@ -911,7 +912,8 @@ public: bonuscnt++; S_PlaySound(SHOTGUN_COCK, CHAN_AUTO, CHANF_UI); static const uint16_t speeches[] = { BONUS_SPEECH1, BONUS_SPEECH2, BONUS_SPEECH3, BONUS_SPEECH4}; - S_PlaySound(speeches[(rand() & 3)], CHAN_AUTO, CHANF_UI, 1); + speech = speeches[(rand() & 3)]; + S_PlaySound(speech, CHAN_AUTO, CHANF_UI, 1); } case 1: case 4: @@ -926,7 +928,7 @@ public: } else if (currentclock > (10240 + 120L)) { - if (!skiprequest && soundEngine->GetSoundPlayingInfo(SOURCE_None, nullptr, -1)) return 1; + if (speech > 0 && !skiprequest && soundEngine->GetSoundPlayingInfo(SOURCE_None, nullptr, speech)) return 1; return 0; } else diff --git a/source/games/duke/src/2d_r.cpp b/source/games/duke/src/2d_r.cpp index b7d5bca54..1c0739d1f 100644 --- a/source/games/duke/src/2d_r.cpp +++ b/source/games/duke/src/2d_r.cpp @@ -358,6 +358,7 @@ class DRRLevelSummaryScreen : public DScreenJob const char* lastmapname; int gfx_offset; int bonuscnt = 0; + int speech = -1; void SetTotalClock(int tc) { @@ -502,13 +503,14 @@ public: { bonuscnt++; S_PlaySound(425, CHAN_AUTO, CHANF_UI); - S_PlaySound(BONUS_SPEECH1 + (rand() & 3), CHAN_AUTO, CHANF_UI); + speech = BONUS_SPEECH1 + (rand() & 3); + S_PlaySound(speech, CHAN_AUTO, CHANF_UI); } } } else if (currentclock > (10240 + 120L)) { - if (!skiprequest && soundEngine->GetSoundPlayingInfo(SOURCE_None, nullptr, -1)) return 1; + if (speech > 0 && !skiprequest && soundEngine->GetSoundPlayingInfo(SOURCE_None, nullptr, speech)) return 1; return 0; } From e4fa695b573b8c5f68ac833d5cfbbb51b1ae7b1c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 7 Sep 2020 20:39:07 +0200 Subject: [PATCH 07/11] - fixed the movement factor for automap panning. Fixes #363 --- source/core/automap.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/core/automap.cpp b/source/core/automap.cpp index c83e1fbb2..172e52e65 100644 --- a/source/core/automap.cpp +++ b/source/core/automap.cpp @@ -212,7 +212,7 @@ void AutomapControl() } am_zoomdir = 0; - double j = interval * (120. / 1000); + double j = interval * 35. / gZoom; if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen)) gZoom += (int)fmulscale6(j, max(gZoom, 256)); @@ -241,8 +241,8 @@ void AutomapControl() momx += mulscale9(panhorz, sintable[(follow_a) & 2047]); momy += mulscale9(panhorz, sintable[(follow_a + 1536) & 2047]); - follow_x += int((momx * j) / (gZoom * 4000.)); - follow_y += int((momy * j) / (gZoom * 4000.)); + follow_x += int(momx * j); + follow_y += int(momy * j); if (x_min_bound == INT_MAX) CalcMapBounds(); follow_x = clamp(follow_x, x_min_bound, x_max_bound); From 775c4a3b51f8b957f1b48b7a801a94f5399f5fce Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 7 Sep 2020 21:00:27 +0200 Subject: [PATCH 08/11] - fixed explosions in World Tour. A classic result of trying to add new stuff to Duke's spaghetti code, shit like this would not happen if this code wasn't this poorly structured. Fixes #360 and most of #357 --- source/games/duke/src/actors_d.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 981670e95..5c11e588e 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -473,7 +473,7 @@ SKIPWALLCHECK: hittype[j].picnum = FLAMETHROWERFLAME; } - if (s->picnum != SHRINKSPARK && (!isWorldTour() && s->picnum != LAVAPOOL)) + if (s->picnum != SHRINKSPARK && (!isWorldTour() || s->picnum != LAVAPOOL)) { if (d < r / 3) { From 703b142bad8affc87b066b007c765d98570399f9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 7 Sep 2020 21:26:07 +0200 Subject: [PATCH 09/11] - added a CVAR to disable WT's ogg music and a fallback for when it cannot be found. Fixes #354 --- source/common/audio/music/music.cpp | 2 +- source/core/raze_music.cpp | 2 +- source/games/duke/src/sounds.cpp | 36 +++++++++++++++++++++++++++-- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/source/common/audio/music/music.cpp b/source/common/audio/music/music.cpp index f78c1901d..198b9975f 100644 --- a/source/common/audio/music/music.cpp +++ b/source/common/audio/music/music.cpp @@ -319,7 +319,7 @@ bool S_ChangeMusic(const char* musicname, int order, bool looping, bool force) if (!force && PlayList.GetNumSongs()) { // Don't change if a playlist is active - return false; + return true; // do not report an error here. } // Do game specific lookup. FString musicname_; diff --git a/source/core/raze_music.cpp b/source/core/raze_music.cpp index 2a6fd69f6..9ee2d1c72 100644 --- a/source/core/raze_music.cpp +++ b/source/core/raze_music.cpp @@ -197,7 +197,7 @@ int Mus_Play(const char *mapname, const char *fn, bool loop) if (!MusicEnabled()) { - return 0; + return 1; } // Allow per level music substitution. diff --git a/source/games/duke/src/sounds.cpp b/source/games/duke/src/sounds.cpp index a1afcf51d..713e7eaa0 100644 --- a/source/games/duke/src/sounds.cpp +++ b/source/games/duke/src/sounds.cpp @@ -587,12 +587,44 @@ void S_MenuSound(void) // //========================================================================== +CVAR(Bool, wt_forcemidi, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) // quick hack to disable the oggs, which are of lower quality than playing the MIDIs with a good synth and sound font. + static bool cd_disabled = false; // This is in case mus_redbook is enabled but no tracks found so that the regular music system can be switched on. +static void MusPlay(const char* label, const char* music, bool loop) +{ + if (isWorldTour()) + { + if (wt_forcemidi) + { + FString alternative = music; + alternative.Substitute(".ogg", ".mid"); + int num = fileSystem.FindFile(alternative); + if (num >= 0) + { + int file = fileSystem.GetFileContainer(num); + if (file == 1) + { + Mus_Play(label, alternative, loop); + return; + } + } + } + } + int result = Mus_Play(label, music, loop); + // do not remain silent if playing World Tour when the user has deleted the music. + if (!result && isWorldTour()) + { + FString alternative = music; + alternative.Substitute(".ogg", ".mid"); + Mus_Play(label, alternative, loop); + } +} + void S_PlayLevelMusic(MapRecord *mi) { if (isRR() && mi->music.IsEmpty() && mus_redbook && !cd_disabled) return; - Mus_Play(mi->labelName, mi->music, true); + MusPlay(mi->labelName, mi->music, true); } void S_PlaySpecialMusic(unsigned int m) @@ -601,7 +633,7 @@ void S_PlaySpecialMusic(unsigned int m) auto& musicfn = specialmusic[m]; if (musicfn.IsNotEmpty()) { - Mus_Play(nullptr, musicfn, true); + MusPlay(nullptr, musicfn, true); } } From a2e3bb57259e4a6475938dc50ac0568c5ce3454e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 7 Sep 2020 21:38:17 +0200 Subject: [PATCH 10/11] - fixed WT's incinerator and a few other minor things I found while comparing Raze's WT support code with BuildGDX's. Fixes #357 --- source/games/duke/src/actors_d.cpp | 10 ++++++---- source/games/duke/src/constants.h | 1 + source/games/duke/src/flags_d.cpp | 3 ++- source/games/duke/src/inlines.h | 10 ++++++++++ source/games/duke/src/player_d.cpp | 19 ++++++++++++++++++- source/games/duke/src/sectors_d.cpp | 16 +++++++++++++++- source/games/duke/src/spawn_d.cpp | 8 ++++++++ 7 files changed, 60 insertions(+), 7 deletions(-) diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 5c11e588e..2045325d4 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -491,7 +491,7 @@ SKIPWALLCHECK: hittype[j].extra = hp1 + (krand() % (hp2 - hp1)); } - if (sprite[j].picnum != TANK && sprite[j].picnum != ROTATEGUN && sprite[j].picnum != RECON && sprite[j].picnum != BOSS1 && sprite[j].picnum != BOSS2 && sprite[j].picnum != BOSS3 && sprite[j].picnum != BOSS4) + if (sprite[j].picnum != TANK && sprite[j].picnum != ROTATEGUN && sprite[j].picnum != RECON && !bossguy(&sprite[j])) { if (sj->xvel < 0) sj->xvel = 0; sj->xvel += (s->extra << 2); @@ -2807,6 +2807,8 @@ static void flamethrowerflame(int i) int dax = s->x; int day = s->y; int daz = s->z; + int xvel = s->xvel; + int zvel = s->zvel; getglobalz(i); @@ -2823,8 +2825,8 @@ static void flamethrowerflame(int i) return; } - j = fi.movesprite(i, (s->xvel * (sintable[(s->ang + 512) & 2047])) >> 14, - (s->xvel * (sintable[s->ang & 2047])) >> 14, s->zvel, CLIPMASK1); + j = fi.movesprite(i, (xvel * (sintable[(s->ang + 512) & 2047])) >> 14, + (xvel * (sintable[s->ang & 2047])) >> 14, s->zvel, CLIPMASK1); if (s->sectnum < 0) { @@ -2849,7 +2851,7 @@ static void flamethrowerflame(int i) } if (j != 0) { - s->xvel = s->yvel = 0; + s->xvel = s->yvel = s->zvel = 0; if ((j & kHitTypeMask) == kHitSprite) { j &= (MAXSPRITES - 1); diff --git a/source/games/duke/src/constants.h b/source/games/duke/src/constants.h index b0c8bc45e..29c436434 100644 --- a/source/games/duke/src/constants.h +++ b/source/games/duke/src/constants.h @@ -301,6 +301,7 @@ enum sflags_t SFLAG_BADGUY = 0x00000020, SFLAG_NOPAL = 0x00000040, SFLAG_FORCEAUTOAIM = 0x00000080, + SFLAG_BOSS = 0x00000100, SFLAG_USEACTIVATOR = 0x00000200, SFLAG_NOFLOORSHADOW = 0x00001000, // for temp. internal use, per-tile flag not checked SFLAG_BADGUYSTAYPUT = 0x00008000, diff --git a/source/games/duke/src/flags_d.cpp b/source/games/duke/src/flags_d.cpp index 85682bf7a..3332f1e45 100644 --- a/source/games/duke/src/flags_d.cpp +++ b/source/games/duke/src/flags_d.cpp @@ -81,13 +81,14 @@ void initactorflags_d() // Some flags taken from RedNukem's init code. This is a good start as any to reduce the insane dependency on tile numbers for making decisions in the play code. A lot more will be added here later. setflag(SFLAG_NODAMAGEPUSH, { TANK, BOSS1, BOSS2, BOSS3, BOSS4, RECON, ROTATEGUN }); + setflag(SFLAG_BOSS, { BOSS1, BOSS2, BOSS3, BOSS4 }); setflag(SFLAG_NOWATERDIP, { OCTABRAIN, COMMANDER, DRONE }); setflag(SFLAG_GREENSLIMEFOOD, { LIZTROOP, LIZMAN, PIGCOP, NEWBEAST }); if (isWorldTour()) { setflag(SFLAG_INTERNAL_BADGUY, { FIREFLY }); - setflag(SFLAG_INTERNAL_BADGUY|SFLAG_NODAMAGEPUSH, { BOSS5, BOSS5STAYPUT, BOSS2STAYPUT, BOSS3STAYPUT }); + setflag(SFLAG_INTERNAL_BADGUY|SFLAG_NODAMAGEPUSH|SFLAG_BOSS, { BOSS5 }); } settileflag(TFLAG_WALLSWITCH, { diff --git a/source/games/duke/src/inlines.h b/source/games/duke/src/inlines.h index 0b7732a28..c6d7e428d 100644 --- a/source/games/duke/src/inlines.h +++ b/source/games/duke/src/inlines.h @@ -27,6 +27,16 @@ inline int badguy(void const * const pSprite) return badguypic(((uspritetype const *) pSprite)->picnum); } +inline int bossguypic(int const tileNum) +{ + return ((actorinfo[tileNum].flags & (SFLAG_BOSS)) != 0); +} + +inline int bossguy(void const* const pSprite) +{ + return badguypic(((uspritetype const*)pSprite)->picnum); +} + inline int actorflag(int spritenum, int mask) { return (((actorinfo[sprite[spritenum].picnum].flags/* ^ hittype[spritenum].flags*/) & mask) != 0); diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 4e96eb1cc..71142a5f4 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -158,7 +158,7 @@ void shoot_d(int i, int atwith) } else { - zvel = 98 * (100 + ps[p].gethorizsum()); + zvel = 98 * (100 - ps[p].gethorizsum()); sx += sintable[(sa + 860) & 0x7FF] / 448; sy += sintable[(sa + 348) & 0x7FF] / 448; sz += (3 << 8); @@ -849,11 +849,28 @@ void shoot_d(int i, int atwith) } else if (s->picnum == BOSS2) { + int xoffs = sintable[sa & 2047] / 56; + int yoffs = sintable[(sa + 1024 + 512) & 2047] / 56; + int aoffs = 8 + (krand() & 255) - 128; + + if (isWorldTour()) { // Twentieth Anniversary World Tour + int siz = sprite[i].yrepeat; + xoffs = Scale(xoffs, siz, 80); + yoffs = Scale(yoffs, siz, 80); + aoffs = Scale(aoffs, siz, 80); + } + + sprite[j].x -= xoffs; + sprite[j].y -= yoffs; + sprite[j].ang -= aoffs; + sprite[j].x -= sintable[sa & 2047] / 56; sprite[j].y -= sintable[(sa + 1024 + 512) & 2047] / 56; sprite[j].ang -= 8 + (krand() & 255) - 128; sprite[j].xrepeat = 24; sprite[j].yrepeat = 24; + + } else if (atwith != FREEZEBLAST) { diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index d7cc97477..afad2d096 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -1381,6 +1381,9 @@ void checkhitsprite_d(int i, int sn) { if (badguy(&sprite[i]) == 1) { + if (isWorldTour() && sprite[i].picnum == FIREFLY && sprite[i].xrepeat < 48) + break; + if (sprite[sn].picnum == RPG) sprite[sn].extra <<= 1; if ((sprite[i].picnum != DRONE) && (sprite[i].picnum != ROTATEGUN) && (sprite[i].picnum != COMMANDER) && (sprite[i].picnum < GREENSLIME || sprite[i].picnum > GREENSLIME + 7)) @@ -1407,7 +1410,7 @@ void checkhitsprite_d(int i, int sn) fi.shoot(i, BLOODSPLAT4); } - if (sprite[i].picnum != TANK && sprite[i].picnum != BOSS1 && sprite[i].picnum != BOSS4 && sprite[i].picnum != BOSS2 && sprite[i].picnum != BOSS3 && sprite[i].picnum != RECON && sprite[i].picnum != ROTATEGUN) + if (sprite[i].picnum != TANK && !bossguy(&sprite[i]) && sprite[i].picnum != RECON && sprite[i].picnum != ROTATEGUN) { if ((sprite[i].cstat & 48) == 0) sprite[i].ang = (sprite[sn].ang + 1024) & 2047; @@ -1431,6 +1434,17 @@ void checkhitsprite_d(int i, int sn) if (sprite[sn].picnum == FREEZEBLAST && ((sprite[i].picnum == APLAYER && sprite[i].pal == 1) || (freezerhurtowner == 0 && sprite[sn].owner == i))) return; + + int hitpic = sprite[sn].picnum; + if (sprite[sprite[sn].owner].picnum == APLAYER) + { + if (sprite[i].picnum == APLAYER && ud.coop != 0 && ud.ffire == 0) + return; + + if (isWorldTour() && hitpic == FIREBALL && sprite[sprite[i].owner].picnum != FIREBALL) + hitpic = FLAMETHROWERFLAME; + } + hittype[i].picnum = sprite[sn].picnum; hittype[i].extra += sprite[sn].extra; hittype[i].ang = sprite[sn].ang; diff --git a/source/games/duke/src/spawn_d.cpp b/source/games/duke/src/spawn_d.cpp index 9316b1724..24a2a1298 100644 --- a/source/games/duke/src/spawn_d.cpp +++ b/source/games/duke/src/spawn_d.cpp @@ -624,6 +624,14 @@ int spawn_d(int j, int pn) sp->z = x-(12<<8); } + if (sp->picnum == ONFIRE) + { + sp->x += krand() % 256 - 128; + sp->y += krand() % 256 - 128; + sp->z -= krand() % 10240; + sp->cstat |= 0x80; + } + changespritestat(i,5); break; From 04ec21d6b6c6471abd3dd677cbfc074106122889 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 7 Sep 2020 22:19:37 +0200 Subject: [PATCH 11/11] - fixed key alignment on Exhumed's status bar. Fixes #281 --- source/exhumed/src/names.h | 2 +- source/exhumed/src/status.cpp | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/source/exhumed/src/names.h b/source/exhumed/src/names.h index 9bb8225b6..a81d83371 100644 --- a/source/exhumed/src/names.h +++ b/source/exhumed/src/names.h @@ -676,7 +676,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define kTile654 654 #define kTile655 655 #define kTile656 656 -#define kTile657 657 +#define kTileStatusBar 657 #define kTile658 658 #define kTile659 659 #define kTile660 660 diff --git a/source/exhumed/src/status.cpp b/source/exhumed/src/status.cpp index 00a6b8a8b..42bbfcb3c 100644 --- a/source/exhumed/src/status.cpp +++ b/source/exhumed/src/status.cpp @@ -545,8 +545,13 @@ private: int flags = DI_ITEM_RELCENTER; - int x = ChunkXpos[nFrameBase]; - int y = ChunkYpos[nFrameBase] + ebx; + double x = ChunkXpos[nFrameBase]; + double y = ChunkYpos[nFrameBase] + ebx; + + if (x > 0) + { + if (xoffset == 0) { x += 0.5; y += 0.5; } + } if (hud_size <= Hud_StbarOverlay) { @@ -710,7 +715,7 @@ private: { // draw the main bar itself BeginStatusBar(320, 200, 40); - DrawStatusSequence(nStatusSeqOffset, 0, 0); + DrawGraphic(tileGetTexture(kTileStatusBar), 160, 200, DI_ITEM_CENTER_BOTTOM, 1, -1, -1, 1, 1); } else if (hud_size == Hud_Mini) {