Skip to content

Commit

Permalink
port S_DumpScreen
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Mar 29, 2021
1 parent e4e0138 commit 0f73743
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 15 deletions.
20 changes: 10 additions & 10 deletions docs/progress.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions docs/progress.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ phd_RotYXZ 0x00401500 0x000001E8 +
phd_RotYXZpack 0x004016F0 0x000001F3 +
phd_TranslateRel 0x004018F0 0x000000AB +
phd_TranslateAbs 0x004019A0 0x0000007A +
visible_zclip 0x00401A20 0x000000A9 +
HWR_VisibleZClip 0x00401A20 0x000000A9 +
phd_PutPolygons 0x00401AD0 0x000000F3 *
S_InsertRoom 0x00401BD0 0x0000006E *
calc_object_vertices 0x00401C40 0x000001B6 -
Expand Down Expand Up @@ -89,7 +89,7 @@ sub_408409 0x00408409 0x000000D5 x
HWR_DownloadTextures 0x004084DE 0x0000030C *
HWR_SetPalette 0x004087EA 0x0000020A *
HWR_SwitchResolution 0x004089F4 0x0000007C *
HWR_DumpScreen 0x00408A70 0x00000057 -
HWR_DumpScreen 0x00408A70 0x00000057 *
HWR_ClearSurfaceDepth 0x00408AC7 0x00000065 -
HWR_BlitSurface 0x00408B2C 0x00000059 +
HWR_CopyPicture 0x00408B85 0x000000B5 *
Expand All @@ -116,7 +116,7 @@ HWR_DrawTranslucentQuad 0x0040C8E7 0x000001F4 +
HWR_PrintShadow 0x0040CADB 0x00000182 -
HWR_RenderLightningSegment 0x0040CC5D 0x000003F9 +
HWR_DrawLightningSegment 0x0040D056 0x000000A1 +
sub_40D0F7 0x0040D0F7 0x00000049 -
HWR_InitPolyList 0x0040D0F7 0x00000049 -
HWR_CacheTexture 0x0040D140 0x000001A0 -
HWR_OutputPolyList 0x0040D2E0 0x00000185 -
DoNothing 0x0040D465 0x00000005 -
Expand Down Expand Up @@ -741,7 +741,7 @@ DisplayRequester 0x0042F6F0 0x0000056B +

# shell/output.cpp
S_InitialisePolyList 0x0042FC60 0x00000005 +
S_DumpScreen 0x0042FC70 0x00000044 *
S_DumpScreen 0x0042FC70 0x00000044 +
S_ClearScreen 0x0042FCC0 0x00000013 *
S_InitialiseScreen 0x0042FCE0 0x00000027 +
S_OutputPolyList 0x0042FD10 0x00000018 *
Expand Down
1 change: 1 addition & 0 deletions src/specific/hwr.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define HWR_CopyPicture ((void (*)())0x00408B85)
#define HWR_DownloadPicture ((void (*)())0x00408C3A)
#define HWR_SwitchResolution ((void (*)())0x004089F4)
#define HWR_DumpScreen ((void (*)())0x00408A70)
// clang-format on

void HWR_Error(HRESULT result);
Expand Down
19 changes: 19 additions & 0 deletions src/specific/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "specific/file.h"
#include "specific/frontend.h"
#include "specific/hwr.h"
#include "specific/smain.h"
#include "util.h"

#include <math.h>
Expand Down Expand Up @@ -237,6 +238,23 @@ void S_InitialisePolyList()
phd_InitPolyList();
}

int32_t S_DumpScreen()
{
HWR_DumpScreen();
int32_t ticks = WinSpinMessageLoop();
int32_t ret = ticks;
if (ticks < TICKS_PER_FRAME) {
ret = TICKS_PER_FRAME;
int32_t it = TICKS_PER_FRAME - ret;
while (it) {
while (!WinSpinMessageLoop())
;
it--;
}
}
return ret;
}

void S_InitialiseScreen()
{
if (CurrentLevel != GF.title_level_num) {
Expand Down Expand Up @@ -459,6 +477,7 @@ void T1MInjectSpecificOutput()
{
INJECT(0x00402710, S_Draw2DLine);
INJECT(0x0042FC60, S_InitialisePolyList);
INJECT(0x0042FC70, S_DumpScreen);
INJECT(0x0042FCE0, S_InitialiseScreen);
INJECT(0x00430100, S_CalculateLight);
INJECT(0x00430290, S_CalculateStaticLight);
Expand Down
2 changes: 1 addition & 1 deletion src/specific/output.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
#include <stdint.h>

// clang-format off
#define S_DumpScreen ((int32_t (*)())0x0042FC70)
#define S_ClearScreen ((void (*)())0x0042FCC0)
#define S_OutputPolyList ((void (*)())0x0042FD10)
#define S_GetObjectBounds ((int32_t (*)(int16_t* bptr))0x0042FD30)
// clang-format on

void S_InitialisePolyList();
int32_t S_DumpScreen();
void S_InitialiseScreen();
void S_CalculateLight(int32_t x, int32_t y, int32_t z, int16_t room_num);
void S_CalculateStaticLight(int16_t adder);
Expand Down

0 comments on commit 0f73743

Please sign in to comment.