From d853b63a1a41ba19245f92dede24431dc49479d1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 23 Apr 2021 16:03:25 +0200 Subject: [PATCH] - RR summary screen --- source/games/duke/src/namelist_r.h | 1 + source/games/duke/src/sounds.cpp | 15 +- wadsrc/static/zscript/games/duke/dukegame.zs | 508 ++++++++++++++++++ .../static/zscript/games/duke/ui/screens.zs | 282 +++++++++- wadsrc/static/zscript/screenjob.zs | 6 + 5 files changed, 789 insertions(+), 23 deletions(-) diff --git a/source/games/duke/src/namelist_r.h b/source/games/duke/src/namelist_r.h index 9429bf35c..46696dd5e 100644 --- a/source/games/duke/src/namelist_r.h +++ b/source/games/duke/src/namelist_r.h @@ -1241,6 +1241,7 @@ y(RRTILE8640, 8640) y(RRTILE8651, 8651) y(RRTILE8660, 8660) x(ENDGAME, 8677) +x(ENDGAME2, 8678) y(RRTILE8679, 8679) y(RRTILE8680, 8680) y(RRTILE8681, 8681) diff --git a/source/games/duke/src/sounds.cpp b/source/games/duke/src/sounds.cpp index f5a693dc3..9617b033e 100644 --- a/source/games/duke/src/sounds.cpp +++ b/source/games/duke/src/sounds.cpp @@ -887,7 +887,7 @@ static int PlaySound(int num, int chan, int flags, double vol) return S_PlaySound(num, chan, EChanFlags::FromInt(flags), float(vol)); } -DEFINE_ACTION_FUNCTION_NATIVE(_Duke, PLaySound, PlaySound) +DEFINE_ACTION_FUNCTION_NATIVE(_Duke, PlaySound, PlaySound) { PARAM_PROLOGUE; PARAM_INT(snd); @@ -896,6 +896,19 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Duke, PLaySound, PlaySound) PARAM_FLOAT(vol); ACTION_RETURN_INT(PlaySound(snd, chan, flags, vol)); } +static void StopSound(int num) +{ + S_StopSound(num); +} + + +DEFINE_ACTION_FUNCTION_NATIVE(_Duke, StopSound, StopSound) +{ + PARAM_PROLOGUE; + PARAM_INT(snd); + StopSound(snd); + return 0; +} DEFINE_ACTION_FUNCTION_NATIVE(_Duke, CheckSoundPlaying, S_CheckSoundPlaying) { diff --git a/wadsrc/static/zscript/games/duke/dukegame.zs b/wadsrc/static/zscript/games/duke/dukegame.zs index 9bc375d13..189f4e85e 100644 --- a/wadsrc/static/zscript/games/duke/dukegame.zs +++ b/wadsrc/static/zscript/games/duke/dukegame.zs @@ -23,6 +23,7 @@ struct Duke native native static void PlaySpecialMusic(int which); native static int PlaySound(int num, int channel = CHAN_AUTO, int flags = 0, float vol =0.8f); + native static void StopSound(int num); native static bool CheckSoundPlaying(int num); static void PlayBonusMusic() @@ -488,4 +489,511 @@ struct DukeSnd native FLAMETHROWER_END =400, E5L7_DUKE_QUIT_YOU =401, } +} + +struct RRSnd native +{ + enum ESnd + { + KICK_HIT = 0 , + RICOCHET = 1 , + BULITHIT = 2 , + CASUL_FIRE = 3 , + PISCOCK = 4 , + PISLOAD = 5 , + AK3 = 6 , + XBOWFIRE = 7 , + BUB_HRT1 = 8 , + XBOWEXPL = 9 , + LASERA = 10 , + SHRINKER = 11 , + CRAPFLOW = 12 , + DYNOCLMP = 13 , + DYNEW = 14 , + CRAPSTIR = 15 , + BRICDOOR = 16 , + BOMBEXPL = 17 , + VENTBUST = 18 , + GLASSSND = 19 , + GLASSHVY = 20 , + BUBBLES = 21 , + SPLASH = 22 , + BUB_HRT2 = 23 , + BUB_HRT3 = 24 , + GASP = 25 , + BUB_HRT4 = 26 , + MIRROR1 = 27 , + MIRROR2 = 28 , + MIRROR3 = 29 , + COMPUTER = 30 , + NEON = 31 , + VX_FINAL = 32 , + LN_WAIT = 33 , + BUB_LN1 = 34 , + LN_FINAL = 35 , + CLOCKTK = 36 , + LN_STANK = 37 , + LNRD_GRUNT = 38 , + CLOCKCHM = 39 , + WETFEET = 40 , + LNRD_DEAD = 41 , + LAND = 42 , + END_PIPE = 43 , + ICARUMBA = 44 , + BUB_LN2 = 45 , + LN_CRAP = 46 , + WOODBREK = 47 , + SCUBA = 48 , + TRUCK_LP2 = 49 , + COW1 = 50 , + COW2 = 51 , + COW3 = 52 , + COW4 = 53 , + COW5 = 54 , + BUB_LN3 = 55 , + LATCH = 56 , + BUB_LN5 = 57 , + BUB_LN6 = 58 , + BUB_LN7 = 59 , + BUB_PIK1 = 60 , + BUB_PIK2 = 61 , + BUB_PISS = 62 , + E1L1 = 63 , + E1L2 = 64 , + UFOINSID = 65 , + LN_RODE = 66 , + CURTAIN = 67 , + FIRE09 = 68 , + SQUISHED = 69 , + TELEPORT = 70 , + GBELEV01 = 71 , + LN_BNCH = 72 , + GBELEV02 = 73 , + FROG1 = 74 , + TRUCK_LP = 75 , + SWITCH1 = 76 , + E1L3 = 77 , + LN_HOTDM = 78 , + FLUSH = 79 , + E1L4 = 80 , + QUAKE = 81 , + CHKAMMO = 82 , + MONITORA = 83 , + FROG2 = 84 , + AS_AMB2 = 85 , + AS_AMB1 = 86 , + FBOATIDL = 87 , + FBOATRUN = 88 , + FBOATUP = 89 , + FBOATDN = 90 , + FBOATTRN = 91 , + DRIP3 = 92 , + SWAMPAMB = 93 , + MORTAR = 94 , + JUKEBOX = 95 , + AS_DROPN = 96 , + AS_CRYPT = 97 , + AS_DRCLS = 98 , + LOKGATE = 99 , + METLGAT2 = 100, + METLGAT1 = 101, + E1L5 = 102, + E1L6 = 103, + E1L7 = 104, + E2L1 = 105, + PADDLE = 106, + LN_HOLD = 107, + VX_TAKIT = 108, + SHOT6 = 109, + CT_LAF2 = 110, + CT_GET = 111, + CT_LAF = 112, + CT_PAIN = 113, + CT_DIE = 114, + PIGSOUND1 = 115, + PIGSOUND2 = 116, + PIGSOUND3 = 117, + PIGSOUND4 = 118, + PIGSOUND5 = 119, + BR_ROAM1 = 120, + BR_RECOG = 121, + WHISTLE = 122, + BR_PAIN = 123, + BR_DTH = 124, + VX_ISTHT = 125, + LASERH = 126, + PIGSOUND6 = 127, + PIGSOUND7 = 128, + VX_DIE1 = 129, + MJ_JIB1 = 130, + VX_DIE4 = 131, + VX_DIE5 = 132, + VX_DIE6 = 133, + VX_DIE7 = 134, + VX_OOH = 135, + VX_PAIN1 = 136, + VX_SEX1 = 137, + VX_SEX2 = 138, + VX_SEX3 = 139, + VX_GRNT = 140, + RENO = 141, + BK_MAKE1 = 142, + BK_MAKE2 = 143, + VX_BRNG3 = 144, + VX_CLSR1 = 145, + VX_CLSR2 = 146, + VX_2FAR = 147, + KINGHUH = 148, + VX_BRING = 149, + VX_BITE = 150, + MJ_FART = 151, + VX_LAFF2 = 152, + VX_LAFF3 = 153, + VX_HMMM2 = 154, + VX_HURT2 = 155, + VX_BABY2 = 156, + VX_MHMM = 157, + THUD = 158, + VX_ITSOK = 159, + MJ_RECO2 = 160, + // VX_TPOT1 = 161, + VX_TPOT4 = 162, + // VX_TPIN1 = 163, + ROPECRK = 164, + DR_CRK8 = 165, + DR_ROLL = 166, + STEELAMB = 167, + ROULETTE = 168, + GUNCHANG = 169, + FLIES = 170, + AMB_1 = 171, + GRAVAMB = 172, + HOOTOWL = 173, + WOODS2 = 174, + CATAMB = 175, + E2L2 = 176, + E2L3 = 177, + FBOATX_1 = 178, + FBOATX_2 = 179, + FBOATX_3 = 180, + FBOATX_4 = 181, + FBOATSLW = 182, + PLANE = 183, + CNTAMB = 184, + JUNKAMB2 = 185, + BIKESTRT = 186, + BIKEIDLE = 187, + BIKELOOP = 188, + BIKEJMPS = 189, + BIKEJMPL = 190, + BIKELAND = 191, + JACKJMP1 = 192, + JACKJMP2 = 193, + FIRE_CRACKLE = 194, + BNS_SPCH1 = 195, + BNS_SPCH2 = 196, + BNS_SPCH3 = 197, + E2L4 = 198, + BNS_SPCH4 = 199, + LN_LNDHT = 200, + JACKATK2 = 201, + JACKPAIN = 202, + LN_BITCH = 203, + CT_LAND = 204, + BR_ROAM2 = 205, + LN_HUSH = 206, + LN_PAIN4 = 207, + LN_SLOW = 208, + LN_PAIN4A = 209, + JUG = 210, + LN_PAIN8 = 211, + MONITOR = 212, + JACKATK1 = 213, + BIKEUP = 214, + PLANEXP = 215, + JUGALUG7 = 216, + DIDDLP = 217, + ELVISMOD = 218, + // PISCOCK = 219, + BIKESKID = 220, + LN_STINK = 221, + JIBBED1 = 222, + JIBBED2 = 223, + JIBBED3 = 224, + JIBBED4 = 225, + JIBBED5 = 226, + JIBBED6 = 227, + JIBBED7 = 228, + LN_BACON = 229, + E2L5 = 230, + REGISTER = 231, + BBQGRILL = 232, + CRSSBELL = 233, + TRAIN = 234, + SLOTS = 235, + INDIANS = 236, + RADIO = 237, + BIKEX_1 = 238, + BIKEX_2 = 239, + BIKEX_3 = 240, + TVSNOW = 241, + WINDLITE = 242, + EXITMENU = 243, + CHKBOWFR = 244, + DSCREM04 = 245, + SHRNK_HIT = 246, + CHKBOWEX = 247, + INTOMENU = 248, + LAVAFLOW = 249, + LAVA_RK = 250, + BIKELOO2 = 251, + SLINGBL = 252, + BR_ROAM3 = 253, + KILLME = 254, + E2L6 = 255, + RINTRO = 256, + MIRROR4 = 257, + MIRROR5 = 258, + GAMBELEV = 259, + SLINGHIT = 260, + PIANO_P1 = 261, + BANJO1 = 262, + JIBBED13 = 263, + LN_BBQ = 264, + JIBBED8 = 265, + JIBBED9 = 266, + JIBBED10 = 267, + JIBBED11 = 268, + JIBBED12 = 269, + LNRD_KILLED4 = 270, + LNRD_KILLED5 = 271, + BANJO2 = 272, + BANJO3 = 273, + LN_PAIN2 = 274, + LN_PAIN3 = 275, + BK_ALIVE = 276, + BK_BOURB = 277, + BK_CHEER = 278, + BK_DIENB = 279, + BK_DNTLK = 280, + BK_FUN = 281, + BK_HEY = 282, + E2L7 = 283, + BK_HEYNB = 284, + BK_JOYRD = 285, + BK_KEEPA = 286, + BK_PLEAS = 287, + BK_RIDE = 288, + BK_ROAD = 289, + BK_SCRAT = 290, + BK_SHTUP = 291, + BK_SNORT = 292, + BK_TOHEL = 293, + WHIPYOU = 294, + BK_TRYIN = 295, + BK_PAIN1 = 296, + BK_PAIN2 = 297, + BK_PAIN3 = 298, + CH_BALD = 299, + CH_TEAS1 = 300, + CH_TEAS2 = 301, + CH_TEAS3 = 302, + CH_SANDP = 303, + LN_PAIN5 = 304, + LN_PAIN6 = 305, + LN_PAIN7 = 306, + CH_DONIT = 307, + CH_WHOOP = 308, + CH_NIPPL = 309, + CH_BARN = 310, + CH_GTEAM = 311, + CH_GOGOG = 312, + CH_REDOK = 313, + CH_2468 = 314, + CH_BIGON = 315, + HULK_ROAM = 316, + HULK_RECOG = 317, + HULK_ATTACK = 318, + HULK_PAIN = 319, + HULK_DYING = 320, + HULK_SPIT = 321, + CH_PAIN1 = 322, + CH_PAIN2 = 323, + CH_PAIN3 = 324, + CH_HURT = 325, + AK4 = 326, + CHKSCR1 = 327, + SHIPWREK = 328, + HYDROGLY = 329, + PIANO_P2 = 330, + FROGTOSS = 331, + TRAIN2 = 332, + CRICKET1 = 333, + CRICKET2 = 334, + PIGRUNT = 335, + GOCATGO = 336, + ANNOUNC1 = 337, + ANNOUNC2 = 338, + TRACTOR = 339, + PIANO_P3 = 340, + RESIZE = 341, + VX_TPIN2 = 342, + VX_TPIN4 = 343, + VX_HLPME = 344, + ATFSPEAK = 345, + WINDCAVE = 346, + ALARM = 347, + SF_THLAW = 348, + SF_TLAW2 = 349, + LN_SCREW = 350, + THUNDER1 = 351, + THUNDER2 = 352, + THUNDER3 = 353, + BOWLSTRT = 354, + BOWLPIN = 355, + BOWLLOOP = 356, + MJ_JIB2 = 357, + VX_KICK2 = 358, + VX_KICK3 = 359, + MJ_RECO1 = 360, + VX_HIYA = 361, + VX_HIYA2 = 362, + SF_ATTN = 363, + SF_DETH1 = 364, + SF_DETH2 = 365, + SF_DETH3 = 366, + TEDOUT = 367, + SF_FREZ2 = 368, + SF_GETYA = 369, + SF_HANDS = 370, + STEELAM2 = 371, + STEELAM3 = 372, + SF_HEY = 373, + SF_HOLD = 374, + SF_LAFF1 = 375, + LN_FLYOP = 376, + LN_SHTHD = 377, + SF_NAME = 378, + SF_OVER = 379, + SF_PAIN1 = 380, + SF_PAIN2 = 381, + SF_PAIN3 = 382, + SF_RLOAD = 383, + SF_RLOD2 = 384, + SF_SHOOT = 385, + JAWHARP = 386, + LN_TIGHT = 387, + DR_CLS = 388, + SCRAPE_1 = 389, + YEHAA16 = 390, + LN_WHUP = 391, + CHKNFLAP = 392, + CHKN_1 = 393, + CHKN_2 = 394, + CHIKDETH = 395, + AMB_ROOM = 396, + BR_ITCH = 397, + BR_SCRTH = 398, + BR_SNIFF = 399, + TRUKDIE = 400, + ZIPOPEN = 401, + ZIPPSTRK = 402, + MOSQUI4 = 403, + FART1 = 404, + SWITCH2 = 405, + SQUEAKY = 406, + CATDOOR = 407, + JUNKSWCH = 408, + CONVEYR = 409, + SWITCH3 = 410, + BIKEENEM = 411, + BIGDOOR = 412, + FLOODGAT = 413, + JACK_RM1 = 414, + MN_FREAK = 415, + MN_PN = 416, + MN_REC = 417, + MN_AMB = 418, + LOKDOOR = 419, + VOMIT = 420, + TOSS = 421, + FART2 = 422, + FART3 = 423, + FART4 = 424, + CHUG = 425, + CROWUSH = 426, + WUSSLAF = 427, + LN_CITY = 428, + MUNCH2 = 429, + TESLARC = 430, + BUZSAWSND = 431, + ELEVLOOP = 432, + PISSEND = 433, + PISSLOOP = 434, + PISSSTRT = 435, + CRAP = 436, + PEE = 437, + JACK_RM2 = 438, + BELL = 439, + TRAINWRK = 440, + DOOR_PKT = 441, + GAMBDOOR = 442, + OVEN = 443, + CREMATOR = 444, + JOE9000A = 445, + JOE9000B = 446, + JOE9000C = 447, + CHINESE = 448, + SIGNROT = 449, + XBOWCOCK = 450, + PWDERKEG = 451, + DG_BARK1 = 452, + DG_GRWL1 = 453, + DG_YELP = 454, + DG_DIE = 455, + UFO = 456, + UFOLET = 457, + JACKJIB1 = 458, + JACKJIB2 = 459, + JACKJIB3 = 460, + JACKJIB4 = 461, + JACKJIB5 = 462, + WTRFALL = 463, + BK_JIB1 = 464, + FRIDGEOP = 465, + FRIDGECL = 466, + DG_LUNGE = 467, + DRIVTHRU = 468, + FAN = 469, + CRUSHER = 470, + BALLOON = 471, + POOLBUD = 472, + STAMPER = 473, + BK_JIB2 = 474, + MORNING = 475, + DG_BARK2 = 476, + DG_GRWL2 = 477, + REDNECK2 = 478, + XATRIX = 479, + MJ_ATTK1 = 480, + MJ_JUMP = 485, + MJ_PAIN1 = 481, + MJ_PAIN2 = 482, + MJ_ROAM1 = 483, + MJ_ROAM2 = 484, + MJ_ROLL = 486, + DISHES = 487, + BUB_ELV1 = 488, + BUB_ELV2 = 489, + BUB_ELV3 = 490, + BK_JIB3 = 491, + CH_JIB1 = 492, + CH_JIB2 = 493, + CH_JIB3 = 494, + SIGNHIT = 495, + UMHUM = 496, + COYOTE = 497, + BUB_HEY1 = 498, + BUB_HEY2 = 499, + } } \ No newline at end of file diff --git a/wadsrc/static/zscript/games/duke/ui/screens.zs b/wadsrc/static/zscript/games/duke/ui/screens.zs index 680873f63..8a8d0ed0c 100644 --- a/wadsrc/static/zscript/games/duke/ui/screens.zs +++ b/wadsrc/static/zscript/games/duke/ui/screens.zs @@ -413,7 +413,7 @@ class Episode5End : ImageScreen //--------------------------------------------------------------------------- // -// +// This handles both Duke and RR. // //--------------------------------------------------------------------------- @@ -421,10 +421,10 @@ class DukeMultiplayerBonusScreen : SkippableScreenJob { int playerswhenstarted; - void Init(int pos) + void Init(int pws) { Super.Init(fadein|fadeout); - playerswhenstarted = pos; + playerswhenstarted = pws; } override void Start() @@ -434,26 +434,29 @@ class DukeMultiplayerBonusScreen : SkippableScreenJob override void Draw(double smoothratio) { + bool isRR = Raze.isRR(); + double titlescale = isRR? 0.36 : 1; + String tempbuf; int currentclock = int((ticks + smoothratio) * 120 / GameTicRate); Screen.ClearScreen(); Screen.DrawTexture(TexMan.CheckForTexture("MENUSCREEN"), false, 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_Color, 0xff808080, DTA_LegacyRenderStyle, STYLE_Normal); - Screen.DrawTexture(TexMan.CheckForTexture("INGAMEDUKETHREEDEE"), true, 160, 34, DTA_FullscreenScale, FSMode_Fit320x200, DTA_CenterOffsetRel, true); + Screen.DrawTexture(TexMan.CheckForTexture("INGAMEDUKETHREEDEE"), true, 160, 34, DTA_FullscreenScale, FSMode_Fit320x200, DTA_CenterOffsetRel, true, DTA_ScaleX, titlescale, DTA_ScaleY, titlescale); if (Raze.isPlutoPak()) Screen.DrawTexture(TexMan.CheckForTexture("MENUPLUTOPAKSPRITE"), true, 260, 36, DTA_FullscreenScale, FSMode_Fit320x200, DTA_CenterOffsetRel, true); - Duke.GameText(160, 58 + 2, "$Multiplayer Totals", 0, 0); + Duke.GameText(160, isRR? 58 : 58 + 2, "$Multiplayer Totals", 0, 0); Duke.GameText(160, 58 + 10, currentLevel.DisplayName(), 0, 0); Duke.GameText(160, 165, "$Presskey", 8 - int(sin(currentclock / 10.) * 8), 0); int t = 0; - Duke.MiniText(38, 80, "$Name", 0, -1, 8); - Duke.MiniText(269+20, 80, "$Kills", 0, 1, 8); + Duke.MiniText(38, 80, "$Name", 0, -1, isRR? 0 : 8); + Duke.MiniText(269+20, 80, "$Kills", 0, 1, isRR? 0: 8); for (int i = 0; i < playerswhenstarted; i++) { tempbuf = String.Format("%-4d", i + 1); - Duke.MiniText(92 + (i * 23), 80, tempbuf, 0, -1, 3); + Duke.MiniText(92 + (i * 23), 80, tempbuf, 0, -1, isRR? 0: 3); } for (int i = 0; i < playerswhenstarted; i++) @@ -471,7 +474,7 @@ class DukeMultiplayerBonusScreen : SkippableScreenJob { int fraggedself = Raze.playerFraggedSelf(y); tempbuf = String.Format("%-4d", fraggedself); - Duke.MiniText(92 + (y * 23), 90 + t, tempbuf, 0, -1, 2); + Duke.MiniText(92 + (y * 23), 90 + t, tempbuf, 0, -1, isRR? 0: 2); xfragtotal -= fraggedself; } else @@ -490,7 +493,7 @@ class DukeMultiplayerBonusScreen : SkippableScreenJob } tempbuf = String.Format("%-4d", xfragtotal); - Duke.MiniText(101 + (8 * 23), 90 + t, tempbuf, 0, -1, 2); + Duke.MiniText(101 + (8 * 23), 90 + t, tempbuf, 0, -1, isRR? 0: 2); t += 7; } @@ -506,10 +509,10 @@ class DukeMultiplayerBonusScreen : SkippableScreenJob yfragtotal += frag; } tempbuf = String.Format("%-4d", yfragtotal); - Duke.MiniText(92 + (y * 23), 96 + (8 * 7), tempbuf, 0, -1, 2); + Duke.MiniText(92 + (y * 23), 96 + (8 * 7), tempbuf, 0, -1, isRR? 0: 2); } - Duke.MiniText(45, 96 + (8 * 7), "$Deaths", 0, -1, 8); + Duke.MiniText(45, 96 + (8 * 7), "$Deaths", 0, -1, isRR? 0: 8); } } @@ -522,7 +525,6 @@ class DukeMultiplayerBonusScreen : SkippableScreenJob class DukeLevelSummaryScreen : SummaryScreenBase { String lastmapname; - int gfx_offset; int speech; int displaystate; int dukeAnimStart; @@ -547,7 +549,7 @@ class DukeLevelSummaryScreen : SummaryScreenBase void Init() { Super.Init(fadein | fadeout); - int vol = currentLevel.volumeNum(); + int vol = level.volumeNum(); String basetex = vol == 1? "BONUSSCREEN2" : "BONUSSCREEN"; texBg = TexMan.CheckForTexture(basetex); for(int i = 0; i < 4; i++) @@ -555,17 +557,12 @@ class DukeLevelSummaryScreen : SummaryScreenBase String otex = String.Format("%s_O%d", basetex, i+1); texOv[i] = TexMan.CheckForTexture(otex); } - lastmapname = currentLevel.DisplayName(); + lastmapname = level.DisplayName(); speech = -1; displaystate = 0; } - String FormatTime(int time) - { - return String.Format("%02d:%02d", (time / (26 * 60)) % 60, (time / 26) % 60); - } - override bool OnEvent(InputEvent ev) { if (ev.type == InputEvent.Type_KeyDown && !Raze.specialKeyEvent(ev)) @@ -759,6 +756,238 @@ class DukeLevelSummaryScreen : SummaryScreenBase } +//--------------------------------------------------------------------------- +// +// TBD: fold this into DukeLevelSummaryScreen? +// +//--------------------------------------------------------------------------- + +class RRLevelSummaryScreen : SummaryScreenBase +{ + String lastmapname; + int speech; + int displaystate; + int exitSoundStart; + TextureID texBg; + + enum EFlags + { + printTimeText = 1, + printTimeVal = 2, + printKillsText = 4, + printKillsVal = 8, + printSecretsText = 16, + printSecretsVal = 32, + printStatsAll = 63, + exitSound = 64, + exitWait = 128, + + } + + void Init(bool dofadeout = true) + { + Super.Init(dofadeout? (fadein | fadeout) : fadein); + String s; + if (level.flags & MapRecord.USERMAP) + s = "BONUSPIC01"; + else if (!Raze.isRRRA()) + s = String.Format("BONUSPIC%02d", 1 + clamp((level.levelNumber / 1000) * 7 + (level.levelNumber % 1000), 0, 13)); + else + s = String.Format("LEVELMAP%02d", 1 + clamp((level.levelNumber / 1000) * 7 + (level.levelNumber % 1000), 0, 13)); + + lastmapname = level.DisplayName(); + texBg = TexMan.CheckForTexture(s); + } + + override bool OnEvent(InputEvent ev) + { + if (ev.type == InputEvent.Type_KeyDown && !Raze.specialKeyEvent(ev)) + { + if ((displaystate & printStatsAll) != printStatsAll) + { + Duke.PlaySound(RRSnd.FART1, CHAN_AUTO, CHANF_UI); + displaystate = printStatsAll; + } + else if (!(displaystate & exitSound)) + { + displaystate |= exitSound; + exitSoundStart = ticks; + Duke.PlaySound(RRSnd.CHUG, CHAN_AUTO, CHANF_UI); + static const int speeches[] = { RRSnd.BNS_SPCH1, RRSnd.BNS_SPCH2, RRSnd.BNS_SPCH3, RRSnd.BNS_SPCH4 }; + speech = speeches[random(0, 3)]; + Duke.PlaySound(speech, CHAN_AUTO, CHANF_UI); + } + return true; + } + return false; + } + + override void Start() + { + Duke.PlayBonusMusic(); + } + + override void OnTick() + { + if ((displaystate & printStatsAll) != printStatsAll) + { + if (ticks == 15 * 3) + { + displaystate |= printTimeText; + } + else if (ticks == 15 * 4) + { + displaystate |= printTimeVal; + Duke.PlaySound(RRSnd.FART1, CHAN_AUTO, CHANF_UI); + } + else if (ticks == 15 * 6) + { + displaystate |= printKillsText; + } + else if (ticks == 15 * 7) + { + displaystate |= printKillsVal; + Duke.PlaySound(RRSnd.FART1, CHAN_AUTO, CHANF_UI); + } + else if (ticks == 15 * 9) + { + displaystate |= printSecretsText; + } + else if (ticks == 15 * 10) + { + displaystate |= printSecretsVal; + Duke.PlaySound(RRSnd.FART1, CHAN_AUTO, CHANF_UI); + } + } + if (displaystate & exitSound) + { + if (ticks >= exitSoundStart + 60) + { + displaystate ^= exitSound | exitWait; + } + } + if (displaystate & exitWait) + { + if (speech <= 0 || !Duke.CheckSoundPlaying(speech)) + jobstate = finished; + } + } + + void PrintTime() + { + String tempbuf; + Duke.BigText(30, 48, "$TXT_YerTime", -1); + Duke.BigText(30, 64, "$TXT_ParTime", -1); + Duke.BigText(30, 80, "$TXT_XTRTIME", -1); + + if (displaystate & printTimeVal) + { + tempbuf = FormatTime(playtime); + Duke.BigText(191, 48, tempbuf, -1); + + tempbuf = FormatTime(level.parTime); + Duke.BigText(191, 64, tempbuf, -1); + + tempbuf = FormatTime(level.designerTime); + Duke.BigText(191, 80, tempbuf, -1); + } + } + + void PrintKills() + { + String tempbuf; + Duke.BigText(30, 112, "$TXT_VarmintsKilled", -1); + Duke.BigText(30, 128, "$TXT_VarmintsLeft", -1); + + if (displaystate & printKillsVal) + { + tempbuf.Format("%-3d", kills); + Duke.BigText(231, 112, tempbuf, -1); + if (maxkills < 0) + { + tempbuf = "$TXT_N_A"; + } + else + { + tempbuf = String.Format("%-3d", max(0, maxkills - kills)); + } + Duke.BigText(231, 128, tempbuf, -1); + } + } + + void PrintSecrets() + { + String tempbuf; + Duke.BigText(30, 144, "$TXT_SECFND", -1); + Duke.BigText(30, 160, "$TXT_SECMISS", -1); + + if (displaystate & printSecretsVal) + { + tempbuf = String.Format("%-3d", secrets); + Duke.BigText(231, 144, tempbuf, -1); + tempbuf = String.Format("%-3d", max(0, maxsecrets - secrets)); + Duke.BigText(231, 160, tempbuf, -1); + } + } + + override void Draw(double sr) + { + Screen.ClearScreen(); + Screen.DrawTexture(texBg, true, 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_LegacyRenderStyle, STYLE_Normal); + + if (lastmapname) Duke.BigText(80, 16, lastmapname, -1); + Duke.BigText(15, 192, "$PRESSKEY", -1); + + if (displaystate & printTimeText) + { + PrintTime(); + } + if (displaystate & printKillsText) + { + PrintKills(); + } + if (displaystate & printSecretsText) + { + PrintSecrets(); + } + } +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +class RRRAEndOfGame : SkippableScreenJob +{ + void Init() + { + Super.Init(fadein|fadeout); + } + + override void OnSkip() + { + Duke.StopSound(RRSnd.LN_FINAL); + } + + override void Start() + { + Duke.PlaySound(RRSnd.LN_FINAL, CHAN_AUTO, CHANF_UI); + } + + override void OnTick() + { + if (!Duke.CheckSoundPlaying(RRSnd.LN_FINAL) && ticks > 15 * GameTicRate) jobstate = finished; // make sure it stays, even if sound is off. + } + + override void Draw(double sr) + { + let tex = TexMan.CheckForTexture(((ticks >> 2) & 1)? "ENDGAME2" : "ENDGAME"); + Screen.DrawTexture(tex, true, 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43); + } +} + //--------------------------------------------------------------------------- // // @@ -780,8 +1009,17 @@ class DukeLoadScreen : ScreenJob Screen.ClearScreen(); Screen.DrawTexture(TexMan.CheckForTexture("LOADSCREEN"), false, 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_LegacyRenderStyle, STYLE_Normal); - Duke.BigText(160, 90, (rec.flags & MapRecord.USERMAP)? "$TXT_LOADUM" : "$TXT_LOADING"); - Duke.BigText(160, 114, rec.DisplayName()); + if (!Raze.IsRR()) + { + Duke.BigText(160, 90, (rec.flags & MapRecord.USERMAP)? "$TXT_LOADUM" : "$TXT_LOADING"); + Duke.BigText(160, 114, rec.DisplayName()); + } + else + { + int y = Raze.isRRRA()? 140 : 90; + Duke.BigText(160, y, (rec.flags & MapRecord.USERMAP)? "$TXT_ENTRUM" : "$TXT_ENTERIN", 0); + Duke.BigText(160, y+24, rec.DisplayName(), 0); + } } } diff --git a/wadsrc/static/zscript/screenjob.zs b/wadsrc/static/zscript/screenjob.zs index 89d190b29..696215310 100644 --- a/wadsrc/static/zscript/screenjob.zs +++ b/wadsrc/static/zscript/screenjob.zs @@ -112,4 +112,10 @@ class SummaryScreenBase : ScreenJob playtime = time_; cheatflag = cheated; } + + String FormatTime(int time) + { + return String.Format("%02d:%02d", (time / (26 * 60)) % 60, (time / 26) % 60); + } + }