From bb3009c8a7fb5f03a471ade2a0d8ca3257bcaf0b Mon Sep 17 00:00:00 2001 From: nukeykt Date: Thu, 27 Feb 2020 21:52:38 +0900 Subject: [PATCH] Rednukem: dh wip # Conflicts: # source/rr/src/rrdh.h --- source/rr/src/actors.cpp | 10 ++++++++++ source/rr/src/game.cpp | 2 +- source/rr/src/gameexec.cpp | 3 ++- source/rr/src/player.cpp | 26 ++++++++++++++++++++++++++ source/rr/src/premap.cpp | 29 ++++++++++++++++------------- source/rr/src/rrdh.cpp | 26 ++++++++++++++------------ source/rr/src/rrdh.h | 12 ++++++++++++ source/rr/src/screens.cpp | 3 +++ 8 files changed, 84 insertions(+), 27 deletions(-) diff --git a/source/rr/src/actors.cpp b/source/rr/src/actors.cpp index ec8593137..3735d6388 100644 --- a/source/rr/src/actors.cpp +++ b/source/rr/src/actors.cpp @@ -9710,6 +9710,16 @@ void G_MoveWorld(void) g_moveActorsTime = (1-0.033)*g_moveActorsTime + 0.033*(timerGetHiTicks()-actorsTime); + if (DEER) + { + sub_56EA8(); + ghtarget_move(); + gharrow_move(); + ghdeploy_move(); + sub_519E8(ud.level_number); + sub_5524C(); + } + // XXX: Has to be before effectors, in particular movers? // TODO: lights in moving sectors ought to be interpolated G_DoEffectorLights(); diff --git a/source/rr/src/game.cpp b/source/rr/src/game.cpp index c44b3dd02..3e0ff6cc1 100644 --- a/source/rr/src/game.cpp +++ b/source/rr/src/game.cpp @@ -1700,7 +1700,7 @@ int A_Spawn(int spriteNum, int tileNum) pSprite->picnum = BOLT1; else if (!RR && pSprite->picnum >= SIDEBOLT1 && pSprite->picnum <= SIDEBOLT1 + 3) pSprite->picnum = SIDEBOLT1; - if (DEER && pSprite->picnum != APLAYER) + if (DEER && pSprite->picnum != APLAYER && pSprite->picnum != RRTILE7936) { goto default_case; } diff --git a/source/rr/src/gameexec.cpp b/source/rr/src/gameexec.cpp index 7ba8b43b0..25c8da986 100644 --- a/source/rr/src/gameexec.cpp +++ b/source/rr/src/gameexec.cpp @@ -1492,7 +1492,8 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop) continue; case CON_IFPDISTL: - VM_CONDITIONAL(!(DEER && sub_535EC()) && vm.playerDist < *(++insptr)); + insptr++; + VM_CONDITIONAL(!(DEER && sub_535EC()) && vm.playerDist < *(insptr)); if (vm.playerDist > MAXSLEEPDIST && vm.pActor->timetosleep == 0) vm.pActor->timetosleep = SLEEPTIME; continue; diff --git a/source/rr/src/player.cpp b/source/rr/src/player.cpp index cbb22e702..d182bd183 100644 --- a/source/rr/src/player.cpp +++ b/source/rr/src/player.cpp @@ -1863,6 +1863,29 @@ void P_DisplayWeapon(void) g_snum = screenpeek; #endif + if (DEER) + { + switch (pPlayer->dhat61f) + { + case 0: + ghpistol_render(screenpeek); + break; + case 1: + ghrifle_render(screenpeek, 0); + break; + case 2: + ghrifle_render(screenpeek, 1); + break; + case 3: + ghshtgn_render(screenpeek); + break; + case 4: + ghbow_render(screenpeek); + break; + } + return; + } + if (pPlayer->newowner >= 0 || ud.camerasprite >= 0 || (!RR && pPlayer->over_shoulder_on > 0) || (sprite[pPlayer->i].pal != 1 && sprite[pPlayer->i].extra <= 0)) return; @@ -4081,6 +4104,9 @@ void P_DHGetInput(int const playerNum) input.fvel = clamp(input.fvel, -MAXVEL, MAXVEL); input.svel = clamp(input.svel, -MAXSVEL, MAXSVEL); + + if (playerRunning && sub_535EC()) + input.fvel <<= 3; input.q16avel = fix16_clamp(input.q16avel, F16(-MAXANGVEL), F16(MAXANGVEL)); input.q16horz = fix16_clamp(input.q16horz, F16(-MAXHORIZ), F16(MAXHORIZ)); diff --git a/source/rr/src/premap.cpp b/source/rr/src/premap.cpp index 749cd88bb..c0fbc8aa3 100644 --- a/source/rr/src/premap.cpp +++ b/source/rr/src/premap.cpp @@ -493,7 +493,7 @@ static void G_DoLoadScreen(const char *statustext, int32_t percent) videoClearScreen(0); - int const loadScreenTile = VM_OnEventWithReturn(EVENT_GETLOADTILE, g_player[screenpeek].ps->i, screenpeek, LOADSCREEN); + int const loadScreenTile = VM_OnEventWithReturn(EVENT_GETLOADTILE, g_player[screenpeek].ps->i, screenpeek, DEER ? 7040 : LOADSCREEN); rotatesprite_fs(320<<15,200<<15,65536L,0,loadScreenTile,0,0,2+8+64+BGSTRETCH); @@ -1279,19 +1279,22 @@ static void prelevel(char g) g_mamaSpawnCnt = 15; g_banjoSong = 0; g_RAendLevel = 0; - for (bssize_t TRAVERSE_CONNECT(playerNum)) + if (!DEER) { - DukePlayer_t *ps = g_player[playerNum].ps; - ps->sea_sick_stat = 0; - if (ud.level_number == 4 && ud.volume_number == 1) - ps->inv_amount[GET_STEROIDS] = 0; + for (bssize_t TRAVERSE_CONNECT(playerNum)) + { + DukePlayer_t *ps = g_player[playerNum].ps; + ps->sea_sick_stat = 0; + if (ud.level_number == 4 && ud.volume_number == 1) + ps->inv_amount[GET_STEROIDS] = 0; + } + if (ud.level_number == 3 && ud.volume_number == 0) + g_mamaSpawnCnt = 5; + else if (ud.level_number == 2 && ud.volume_number == 1) + g_mamaSpawnCnt = 10; + else if (ud.level_number == 6 && ud.volume_number == 1) + g_mamaSpawnCnt = 15; } - if (ud.level_number == 3 && ud.volume_number == 0) - g_mamaSpawnCnt = 5; - else if (ud.level_number == 2 && ud.volume_number == 1) - g_mamaSpawnCnt = 10; - else if (ud.level_number == 6 && ud.volume_number == 1) - g_mamaSpawnCnt = 15; } Bmemset(g_spriteExtra, 0, sizeof(g_spriteExtra)); @@ -1575,7 +1578,7 @@ static void prelevel(char g) // break; } } - if (RR) + if (RR && !DEER) { for (bssize_t i = 0; i < MAXSPRITES; i++) { diff --git a/source/rr/src/rrdh.cpp b/source/rr/src/rrdh.cpp index ce0c85313..7c8770047 100644 --- a/source/rr/src/rrdh.cpp +++ b/source/rr/src/rrdh.cpp @@ -837,7 +837,7 @@ void sub_52BA8(void) { sprite[i].cstat = 0; sprite[i].pal = 0; - sprite[i].statnum = 0; + changespritestat(i, 0); sect = sprite[i].sectnum; if (sub_52AF0(i)) { @@ -1024,8 +1024,8 @@ void sub_53194(void) void sub_53304(void) { - ControlInfo info; - CONTROL_GetInput(&info); + //ControlInfo info; + //CONTROL_GetInput(&info); if (KB_KeyPressed(sc_RightAlt) || KB_KeyPressed(sc_LeftAlt) || KB_KeyPressed(sc_RightShift) || KB_KeyPressed(sc_LeftShift)) return; @@ -1860,6 +1860,7 @@ void sub_54FA4(int a1, int a2) ptr1 = (char*)waloff[7050]; if (!ptr1) return; + videoBeginDrawing(); ptr2 = (char*)frameplace; if (!ptr2) return; @@ -1874,6 +1875,7 @@ void sub_54FA4(int a1, int a2) ptr1++; } } + videoEndDrawing(); rotatesprite(a1<<16, a2<<16, 57344, 512, 7050, 0, 0, 4+2, windowxy1.x, windowxy1.y, windowxy2.x, windowxy2.y); rotatesprite(a1<<16, a2<<16, 57344, 512, 7050, -8, 0, 4+2+1, windowxy1.x, windowxy1.y, windowxy2.x, windowxy2.y); rotatesprite(a1<<16, a2<<16, 32768, 0, 7063, -24, 0, 32+2+1, windowxy1.x, windowxy1.y, windowxy2.x, windowxy2.y); @@ -2254,8 +2256,8 @@ void ghshtgn_render(short snum) } sub_54D90(); rotatesprite_win((fAA3D0[dword_AA3BC].f_8+dword_AA4FC[dword_AA540])<<16, - (fAA3D0[dword_AA3BC].f_c+dword_AA51C[dword_AA540])<<16, 40960, - 0, fAA3D0[dword_AA3BC].f_4, 0, 0, 10); + (fAA3D0[dword_AA3BC].f_c+dword_AA51C[dword_AA540]+17)<<16, 40960, + 0, fAA3D0[dword_AA3BC].f_4, 0, 0, 2); if (dword_AA3BC == 5 && p->dhat617) ghshtgn_setmode(3); else @@ -2504,13 +2506,13 @@ void ghrifle_render(short snum, int a2) if (a2 == 1) { x = fAA558[dword_AA544].f_8 + dword_AA800[dword_AA844]; - y = fAA558[dword_AA544].f_c + dword_AA820[dword_AA844]; + y = fAA558[dword_AA544].f_c + dword_AA820[dword_AA844] + 17; tile = fAA558[dword_AA544].f_4; } else { x = fAA6AC[dword_AA544].f_8 + dword_AA800[dword_AA844]; - y = fAA6AC[dword_AA544].f_c + dword_AA820[dword_AA844]; + y = fAA6AC[dword_AA544].f_c + dword_AA820[dword_AA844] + 17; tile = fAA6AC[dword_AA544].f_4; } @@ -2519,7 +2521,7 @@ void ghrifle_render(short snum, int a2) else sub_54D90(); - rotatesprite_win(x<<16, y<<16, 32768, 0, tile, 0, 0, 10); + rotatesprite_win(x<<16, y<<16, 32768, 0, tile, 0, 0, 2); if (a2 == 1 && dword_AA544 == 5 && (p->dhat613 || p->dhat617)) { @@ -2750,8 +2752,8 @@ void ghpistol_render(short snum) } sub_54D90(); rotatesprite_win((fAA858[dword_AA848].f_8+dword_AA984[dword_AA9C8])<<16, - (fAA858[dword_AA848].f_c+dword_AA9A4[dword_AA9C8])<<16, 40960, - 0, fAA858[dword_AA848].f_4, 0, 0, 10); + (fAA858[dword_AA848].f_c+dword_AA9A4[dword_AA9C8]+17)<<16, 40960, + 0, fAA858[dword_AA848].f_4, 0, 0, 2); ghpistol_setmode(fAA858[dword_AA848].f_10); } @@ -2904,8 +2906,8 @@ void ghbow_render(short snum) } sub_54D90(); rotatesprite_win((fAA9DC[dword_AA9CC].f_8+dword_AAA68[dword_AAAAC])<<16, - (fAA9DC[dword_AA9CC].f_c+dword_AAA88[dword_AAAAC])<<16, 40960, - 0, fAA9DC[dword_AA9CC].f_4, 0, 0, 10); + (fAA9DC[dword_AA9CC].f_c+dword_AAA88[dword_AAAAC]+17)<<16, 40960, + 0, fAA9DC[dword_AA9CC].f_4, 0, 0, 2); ghbow_setmode(fAA9DC[dword_AA9CC].f_10); } diff --git a/source/rr/src/rrdh.h b/source/rr/src/rrdh.h index ba31d4d60..95e2d6c21 100644 --- a/source/rr/src/rrdh.h +++ b/source/rr/src/rrdh.h @@ -94,5 +94,17 @@ void sub_58A30(int a1); int sub_59B44(void); void ghtarget_setanimal(short a1); +void ghpistol_render(short); +void ghrifle_render(short, int); +void ghshtgn_render(short); +void ghbow_render(short); +void sub_56EA8(void); +void ghtarget_move(void); +void gharrow_move(void); +void ghdeploy_move(void); +void sub_5524C(void); +void sub_519E8(int a1); +void sub_57B38(long cposx, long cposy, long czoom, short cang); + END_RR_NS diff --git a/source/rr/src/screens.cpp b/source/rr/src/screens.cpp index 17f80c8d1..b50d890dc 100644 --- a/source/rr/src/screens.cpp +++ b/source/rr/src/screens.cpp @@ -804,6 +804,9 @@ void G_DisplayRest(int32_t smoothratio) G_MoveClouds(); } + if (DEER) + sub_57B38(pp->opos.x, pp->opos.y, 20, 1536); + if (ud.overhead_on > 0) { // smoothratio = min(max(smoothratio,0),65536);