port Output_DrawPickup

This commit is contained in:
Marcin Kurczewski 2023-11-16 11:28:46 +01:00
parent b3e688b58d
commit 6b97adc707
No known key found for this signature in database
GPG Key ID: CC65E6FD28CAE42A
7 changed files with 28 additions and 10 deletions

View File

@ -69,10 +69,10 @@
</g>
<g transform="translate(0 116)">
<text x="0" y="7.50">Tomb2.exe progress according to the physical function order:</text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">28.08% (342)</tspan> · <tspan class="known">69.46% (846)</tspan> · <tspan class="todo">0.66% (8)</tspan> · <tspan class="unused">1.81% (22)</tspan></tspan></text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">28.16% (343)</tspan> · <tspan class="known">69.38% (845)</tspan> · <tspan class="todo">0.66% (8)</tspan> · <tspan class="unused">1.81% (22)</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="209.75" height="6" x="0" y="0" class="decompiled"/>
<rect width="518.85" height="6" x="209.75" y="0" class="known"/>
<rect width="210.36" height="6" x="0" y="0" class="decompiled"/>
<rect width="518.24" height="6" x="210.36" y="0" class="known"/>
<rect width="4.91" height="6" x="728.60" y="0" class="todo"/>
<rect width="13.49" height="6" x="733.51" y="0" class="unused"/>
</g>
@ -156,7 +156,7 @@
<rect width="12" height="12" x="390" y="15" class="decompiled"><title>void __cdecl Output_InsertTransQuad_Sorted(int32_t x, int32_t y, int32_t width, int32_t height, int32_t z);</title></rect>
<rect width="12" height="12" x="405" y="15" class="decompiled"><title>void __cdecl Output_InsertSprite(int32_t z, int32_t x0, int32_t y0, int32_t x1, int32_t y1, int32_t sprite_idx, int16_t shade);</title></rect>
<rect width="12" height="12" x="420" y="15" class="decompiled"><title>void __cdecl Output_DrawSprite(uint32_t flags, int32_t x, int32_t y, int32_t z, int16_t sprite_idx, int16_t shade, int16_t scale);</title></rect>
<rect width="12" height="12" x="435" y="15" class="known"><title>void __cdecl Output_DrawPickup(int32_t sx, int32_t sy, int32_t scale, int16_t sprite_idx, int16_t shade);</title></rect>
<rect width="12" height="12" x="435" y="15" class="decompiled"><title>void __cdecl Output_DrawPickup(int32_t sx, int32_t sy, int32_t scale, int16_t sprite_idx, int16_t shade);</title></rect>
<rect width="12" height="12" x="450" y="15" class="decompiled"><title>const int16_t *__cdecl Output_InsertRoomSprite(const int16_t *obj_ptr, int32_t vtx_count);</title></rect>
<rect width="12" height="12" x="465" y="15" class="known"><title>void __cdecl Output_DrawScreenSprite2D(int32_t sx, int32_t sy, int32_t sz, int32_t scale_h, int32_t scale_v, int16_t sprite_idx, int16_t shade, uint16_t flags);</title></rect>
<rect width="12" height="12" x="480" y="15" class="known"><title>void __cdecl Output_DrawScreenSprite(int32_t sx, int32_t sy, int32_t sz, int32_t scale_h, int32_t scale_v, int16_t sprite_idx, int16_t shade, uint16_t flags);</title></rect>
@ -1299,10 +1299,10 @@
</g>
<g transform="translate(0 546)">
<text x="0" y="7.50">Tomb2.exe progress according to the function sizes:</text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">26.32%</tspan> · <tspan class="known">73.35%</tspan> · <tspan class="todo">0.02%</tspan> · <tspan class="unused">0.31%</tspan></tspan></text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">26.36%</tspan> · <tspan class="known">73.31%</tspan> · <tspan class="todo">0.02%</tspan> · <tspan class="unused">0.31%</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="196.61" height="6" x="0" y="0" class="decompiled"/>
<rect width="547.95" height="6" x="196.61" y="0" class="known"/>
<rect width="196.90" height="6" x="0" y="0" class="decompiled"/>
<rect width="547.66" height="6" x="196.90" y="0" class="known"/>
<rect width="0.13" height="6" x="744.56" y="0" class="todo"/>
<rect width="2.31" height="6" x="744.69" y="0" class="unused"/>
</g>
@ -1917,7 +1917,7 @@
<rect width="7.92" height="7.19" x="578.55" y="196.57" class="decompiled"><title>void __cdecl Lara_SwimTurn(struct ITEM_INFO *item);</title></rect>
<rect width="7.92" height="7.19" x="589.47" y="196.57" class="known"><title>void __cdecl Sound_UpdateContinued(void);</title></rect>
<rect width="7.92" height="7.19" x="600.39" y="196.57" class="known"><title>void __cdecl HookControl(int16_t item_num);</title></rect>
<rect width="7.84" height="7.19" x="611.31" y="196.57" class="known"><title>void __cdecl Output_DrawPickup(int32_t sx, int32_t sy, int32_t scale, int16_t sprite_idx, int16_t shade);</title></rect>
<rect width="7.84" height="7.19" x="611.31" y="196.57" class="decompiled"><title>void __cdecl Output_DrawPickup(int32_t sx, int32_t sy, int32_t scale, int16_t sprite_idx, int16_t shade);</title></rect>
<rect width="7.84" height="7.19" x="622.15" y="196.57" class="decompiled"><title>void __cdecl Lara_State_Tread(struct ITEM_INFO *item, struct COLL_INFO *coll);</title></rect>
<rect width="7.84" height="7.19" x="632.98" y="196.57" class="known"><title>int32_t __cdecl Targetable(struct ITEM_INFO *item, AI_INFO *info);</title></rect>
<rect width="7.76" height="7.19" x="643.82" y="196.57" class="decompiled"><title>void __cdecl Lara_State_Back(struct ITEM_INFO *item, struct COLL_INFO *coll);</title></rect>

Before

Width:  |  Height:  |  Size: 367 KiB

After

Width:  |  Height:  |  Size: 367 KiB

View File

@ -1364,7 +1364,7 @@ typedef enum LARA_MESH {
# 3dsystem/scalespr.c
0040C050 000002C7 + void __cdecl Output_DrawSprite(uint32_t flags, int32_t x, int32_t y, int32_t z, int16_t sprite_idx, int16_t shade, int16_t scale);
0040C320 00000085 - void __cdecl Output_DrawPickup(int32_t sx, int32_t sy, int32_t scale, int16_t sprite_idx, int16_t shade);
0040C320 00000085 + void __cdecl Output_DrawPickup(int32_t sx, int32_t sy, int32_t scale, int16_t sprite_idx, int16_t shade);
0040C3B0 00000152 + const int16_t *__cdecl Output_InsertRoomSprite(const int16_t *obj_ptr, int32_t vtx_count);
0040C510 00000096 - void __cdecl Output_DrawScreenSprite2D(int32_t sx, int32_t sy, int32_t sz, int32_t scale_h, int32_t scale_v, int16_t sprite_idx, int16_t shade, uint16_t flags);
0040C5B0 0000009D - void __cdecl Output_DrawScreenSprite(int32_t sx, int32_t sy, int32_t sz, int32_t scale_h, int32_t scale_v, int16_t sprite_idx, int16_t shade, uint16_t flags);

View File

@ -4301,3 +4301,17 @@ void __cdecl Output_DrawSprite(
g_Output_InsertSprite(zv, x0, y0, x1, y1, sprite_idx, shade);
}
void __cdecl Output_DrawPickup(
const int32_t sx, const int32_t sy, const int32_t scale,
const int16_t sprite_idx, const int16_t shade)
{
const struct PHD_SPRITE *const sprite = &g_PhdSprites[sprite_idx];
const int32_t x0 = sx + ((sprite->x0 * scale) / PHD_ONE);
const int32_t y0 = sy + ((sprite->y0 * scale) / PHD_ONE);
const int32_t x1 = sx + ((sprite->x1 * scale) / PHD_ONE);
const int32_t y1 = sy + ((sprite->y1 * scale) / PHD_ONE);
if (x1 >= 0 && y1 >= 0 && x0 < g_PhdWinWidth && y0 < g_PhdWinHeight) {
g_Output_InsertSprite(200, x0, y0, x1, y1, sprite_idx, shade);
}
}

View File

@ -165,3 +165,6 @@ void __cdecl Output_DrawPoly_Gouraud(
void __cdecl Output_DrawSprite(
uint32_t flags, int32_t x, int32_t y, int32_t z, int16_t sprite_idx,
int16_t shade, int16_t scale);
void __cdecl Output_DrawPickup(
int32_t sx, int32_t sy, int32_t scale, int16_t sprite_idx, int16_t shade);

View File

@ -1,5 +1,6 @@
#include "game/text.h"
#include "game/output.h"
#include "global/const.h"
#include "global/funcs.h"
#include "global/vars.h"

View File

@ -6,7 +6,6 @@
// clang-format off
#define Output_InsertInventoryBackground ((void __cdecl (*)(const int16_t *obj_ptr))0x00401D50)
#define Output_DrawPickup ((void __cdecl (*)(int32_t sx, int32_t sy, int32_t scale, int16_t sprite_idx, int16_t shade))0x0040C320)
#define Output_DrawScreenSprite2D ((void __cdecl (*)(int32_t sx, int32_t sy, int32_t sz, int32_t scale_h, int32_t scale_v, int16_t sprite_idx, int16_t shade, uint16_t flags))0x0040C510)
#define Output_DrawScreenSprite ((void __cdecl (*)(int32_t sx, int32_t sy, int32_t sz, int32_t scale_h, int32_t scale_v, int16_t sprite_idx, int16_t shade, uint16_t flags))0x0040C5B0)
#define Output_DrawScaledSpriteC ((void __cdecl (*)(const int16_t *obj_ptr))0x0040C650)

View File

@ -194,6 +194,7 @@ static void Inject_Output(void)
INJECT(1, 0x0040BE60, Output_InsertTransQuad_Sorted);
INJECT(1, 0x0040BFA0, Output_InsertSprite);
INJECT(1, 0x0040C050, Output_DrawSprite);
INJECT(1, 0x0040C320, Output_DrawPickup);
INJECT(1, 0x0040C3B0, Output_InsertRoomSprite);
INJECT(1, 0x0041BA50, Output_InsertPolygons_I);
}