port Inv_Ring_Init

This commit is contained in:
Marcin Kurczewski 2024-09-05 16:27:02 +02:00
parent 0c8b76985d
commit d788d308ca
No known key found for this signature in database
GPG Key ID: CC65E6FD28CAE42A
8 changed files with 97 additions and 24 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">59.03% (719)</tspan> · <tspan class="known">38.51% (469)</tspan> · <tspan class="todo">0% (0)</tspan> · <tspan class="unused">2.46% (30)</tspan></tspan></text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">59.11% (720)</tspan> · <tspan class="known">38.42% (468)</tspan> · <tspan class="todo">0% (0)</tspan> · <tspan class="unused">2.46% (30)</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="440.96" height="6" x="0" y="0" class="decompiled"/>
<rect width="287.64" height="6" x="440.96" y="0" class="known"/>
<rect width="441.58" height="6" x="0" y="0" class="decompiled"/>
<rect width="287.02" height="6" x="441.58" y="0" class="known"/>
<rect width="18.40" height="6" x="728.60" y="0" class="unused"/>
</g>
<g transform="translate(0 31)">
@ -422,7 +422,7 @@
<rect width="12" height="12" x="645" y="90" class="known"><title>int32_t __cdecl Inv_RemoveItem(GAME_OBJECT_ID object_num);</title></rect>
<rect width="12" height="12" x="660" y="90" class="decompiled"><title>int32_t __cdecl Inv_GetItemOption(GAME_OBJECT_ID object_num);</title></rect>
<rect width="12" height="12" x="675" y="90" class="known"><title>void __cdecl RemoveInventoryText(void);</title></rect>
<rect width="12" height="12" x="690" y="90" class="known"><title>void __cdecl Inv_Ring_Init(RING_INFO *ring, int16_t type, INVENTORY_ITEM **list, int16_t qty, int16_t current, IMOTION_INFO *imo);</title></rect>
<rect width="12" height="12" x="690" y="90" class="decompiled"><title>void __cdecl Inv_Ring_Init(RING_INFO *ring, int16_t type, INVENTORY_ITEM **list, int16_t qty, int16_t current, IMOTION_INFO *imo);</title></rect>
<rect width="12" height="12" x="705" y="90" class="known"><title>void __cdecl Inv_Ring_GetView(RING_INFO *ring, PHD_3DPOS *viewer);</title></rect>
<rect width="12" height="12" x="720" y="90" class="known"><title>void __cdecl Inv_Ring_Light(RING_INFO *ring);</title></rect>
<rect width="12" height="12" x="735" y="90" class="known"><title>void __cdecl Inv_Ring_CalcAdders(RING_INFO *ring, int16_t rotation_duration);</title></rect>
@ -1298,10 +1298,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">63.76%</tspan> · <tspan class="known">35.91%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.33%</tspan></tspan></text>
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">63.84%</tspan> · <tspan class="known">35.83%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.33%</tspan></tspan></text>
<g transform="translate(0 20)">
<rect width="476.29" height="6" x="0" y="0" class="decompiled"/>
<rect width="268.27" height="6" x="476.29" y="0" class="known"/>
<rect width="476.88" height="6" x="0" y="0" class="decompiled"/>
<rect width="267.68" height="6" x="476.88" y="0" class="known"/>
<rect width="2.44" height="6" x="744.56" y="0" class="unused"/>
</g>
<g transform="translate(0 31)">
@ -1643,7 +1643,7 @@
<rect width="12.25" height="11.91" x="465.10" y="260.11" class="decompiled"><title>int32_t __cdecl Game_Cutscene_Start(int32_t level_num);</title></rect>
<rect width="12.25" height="11.80" x="465.10" y="275.02" class="known"><title>int32_t __cdecl Inv_RemoveItem(GAME_OBJECT_ID object_num);</title></rect>
<rect width="12.25" height="11.80" x="465.10" y="289.83" class="decompiled"><title>int16_t __cdecl TitleSequence(void);</title></rect>
<rect width="12.25" height="11.75" x="465.10" y="304.63" class="known"><title>void __cdecl Inv_Ring_Init(RING_INFO *ring, int16_t type, INVENTORY_ITEM **list, int16_t qty, int16_t current, IMOTION_INFO *imo);</title></rect>
<rect width="12.25" height="11.75" x="465.10" y="304.63" class="decompiled"><title>void __cdecl Inv_Ring_Init(RING_INFO *ring, int16_t type, INVENTORY_ITEM **list, int16_t qty, int16_t current, IMOTION_INFO *imo);</title></rect>
<rect width="12.25" height="11.75" x="465.10" y="319.38" class="decompiled"><title>void __cdecl ScreenshotPCX(void);</title></rect>
<rect width="12.25" height="11.70" x="465.10" y="334.13" class="decompiled"><title>bool __cdecl S_Audio_Sample_Load(int32_t sample_id, LPWAVEFORMATEX format, const void *data, int32_t data_size);</title></rect>
<rect width="12.25" height="11.59" x="465.10" y="348.83" class="decompiled"><title>void __cdecl Lara_State_Compress(ITEM_INFO *item, COLL_INFO *coll);</title></rect>

Before

Width:  |  Height:  |  Size: 364 KiB

After

Width:  |  Height:  |  Size: 364 KiB

View File

@ -3220,21 +3220,21 @@ typedef enum {
0x00424CD0 0x0110 - int32_t __cdecl Inv_RemoveItem(GAME_OBJECT_ID object_num);
0x00424DE0 0x00C1 + int32_t __cdecl Inv_GetItemOption(GAME_OBJECT_ID object_num);
0x00424FD0 0x0024 -R void __cdecl RemoveInventoryText(void);
0x00425000 0x010F -R void __cdecl Inv_Ring_Init(RING_INFO *ring, int16_t type, INVENTORY_ITEM **list, int16_t qty, int16_t current, IMOTION_INFO *imo);
0x00425110 0x0060 -R void __cdecl Inv_Ring_GetView(RING_INFO *ring, PHD_3DPOS *viewer);
0x00425170 0x0040 -R void __cdecl Inv_Ring_Light(RING_INFO *ring);
0x004251B0 0x002C -R void __cdecl Inv_Ring_CalcAdders(RING_INFO *ring, int16_t rotation_duration);
0x004251E0 0x013E -R void __cdecl Inv_Ring_DoMotions(RING_INFO *ring);
0x00425320 0x002F -R void __cdecl Inv_Ring_RotateLeft(RING_INFO *ring);
0x00425350 0x002F -R void __cdecl Inv_Ring_RotateRight(RING_INFO *ring);
0x00425380 0x0063 -R void __cdecl Inv_Ring_MotionInit(RING_INFO *ring, int16_t frames, int16_t status, int16_t status_target);
0x004253F0 0x002C -R void __cdecl Inv_Ring_MotionSetup(RING_INFO *ring, int16_t status, int16_t status_target, int16_t frames);
0x00425420 0x0026 -R void __cdecl Inv_Ring_MotionRadius(RING_INFO *ring, int16_t target);
0x00425450 0x0022 -R void __cdecl Inv_Ring_MotionRotation(RING_INFO *ring, int16_t rotation, int16_t target);
0x00425480 0x0025 -R void __cdecl Inv_Ring_MotionCameraPos(RING_INFO *ring, int16_t target);
0x004254B0 0x0020 -R void __cdecl Inv_Ring_MotionCameraPitch(RING_INFO *ring, int16_t target);
0x004254D0 0x005D -R void __cdecl Inv_Ring_MotionItemSelect(RING_INFO *ring, INVENTORY_ITEM *inv_item);
0x00425530 0x0063 -R void __cdecl Inv_Ring_MotionItemDeselect(RING_INFO *ring, INVENTORY_ITEM *inv_item);
0x00425000 0x010F + void __cdecl Inv_Ring_Init(RING_INFO *ring, int16_t type, INVENTORY_ITEM **list, int16_t qty, int16_t current, IMOTION_INFO *imo);
0x00425110 0x0060 - void __cdecl Inv_Ring_GetView(RING_INFO *ring, PHD_3DPOS *viewer);
0x00425170 0x0040 - void __cdecl Inv_Ring_Light(RING_INFO *ring);
0x004251B0 0x002C - void __cdecl Inv_Ring_CalcAdders(RING_INFO *ring, int16_t rotation_duration);
0x004251E0 0x013E - void __cdecl Inv_Ring_DoMotions(RING_INFO *ring);
0x00425320 0x002F - void __cdecl Inv_Ring_RotateLeft(RING_INFO *ring);
0x00425350 0x002F - void __cdecl Inv_Ring_RotateRight(RING_INFO *ring);
0x00425380 0x0063 - void __cdecl Inv_Ring_MotionInit(RING_INFO *ring, int16_t frames, int16_t status, int16_t status_target);
0x004253F0 0x002C - void __cdecl Inv_Ring_MotionSetup(RING_INFO *ring, int16_t status, int16_t status_target, int16_t frames);
0x00425420 0x0026 - void __cdecl Inv_Ring_MotionRadius(RING_INFO *ring, int16_t target);
0x00425450 0x0022 - void __cdecl Inv_Ring_MotionRotation(RING_INFO *ring, int16_t rotation, int16_t target);
0x00425480 0x0025 - void __cdecl Inv_Ring_MotionCameraPos(RING_INFO *ring, int16_t target);
0x004254B0 0x0020 - void __cdecl Inv_Ring_MotionCameraPitch(RING_INFO *ring, int16_t target);
0x004254D0 0x005D - void __cdecl Inv_Ring_MotionItemSelect(RING_INFO *ring, INVENTORY_ITEM *inv_item);
0x00425530 0x0063 - void __cdecl Inv_Ring_MotionItemDeselect(RING_INFO *ring, INVENTORY_ITEM *inv_item);
# game/invtext.c
0x004255A0 0x0082 + void __cdecl Requester_Init(REQUEST_INFO *req);

View File

@ -97,6 +97,7 @@ dll_sources = [
'src/game/hwr.c',
'src/game/input.c',
'src/game/inventory/common.c',
'src/game/inventory/ring.c',
'src/game/inventory/vars.c',
'src/game/items.c',
'src/game/lara/lara_cheat.c',

View File

@ -2,6 +2,7 @@
#include "game/demo.h"
#include "game/input.h"
#include "game/inventory/ring.h"
#include "game/inventory/vars.h"
#include "game/items.h"
#include "game/lara/lara_control.h"

63
src/game/inventory/ring.c Normal file
View File

@ -0,0 +1,63 @@
#include "game/inventory/ring.h"
#include "global/funcs.h"
#include "global/vars.h"
#define RING_OPEN_FRAMES 32
#define RING_OPEN_ROTATION PHD_180
#define RING_OPEN_ROTATION PHD_180
#define RING_RADIUS 688
#define RING_CAMERA_START_HEIGHT (-1536)
#define RING_CAMERA_HEIGHT (-256)
void __cdecl Inv_Ring_Init(
RING_INFO *const ring, const RING_TYPE type, INVENTORY_ITEM **const list,
const int16_t qty, const int16_t current, IMOTION_INFO *const imo)
{
ring->type = type;
ring->list = list;
ring->number_of_objects = qty;
ring->current_object = current;
ring->radius = 0;
ring->angle_adder = 0x10000 / qty;
if (g_Inv_Mode == INV_TITLE_MODE) {
ring->camera_pitch = 1024;
} else {
ring->camera_pitch = 0;
}
ring->rotating = 0;
ring->rot_count = 0;
ring->target_object = 0;
ring->rot_adder = 0;
ring->rot_adder_l = 0;
ring->rot_adder_r = 0;
ring->imo = imo;
ring->camera.pos.x = 0;
ring->camera.pos.y = RING_CAMERA_START_HEIGHT;
ring->camera.pos.z = 896;
ring->camera.rot.x = 0;
ring->camera.rot.y = 0;
ring->camera.rot.z = 0;
Inv_Ring_MotionInit(ring, RING_OPEN_FRAMES, RNG_OPENING, RNG_OPEN);
Inv_Ring_MotionRadius(ring, RING_RADIUS);
Inv_Ring_MotionCameraPos(ring, RING_CAMERA_HEIGHT);
Inv_Ring_MotionRotation(
ring, RING_OPEN_ROTATION,
-PHD_90 - ring->current_object * ring->angle_adder);
ring->ring_pos.pos.x = 0;
ring->ring_pos.pos.y = 0;
ring->ring_pos.pos.z = 0;
ring->ring_pos.rot.x = 0;
ring->ring_pos.rot.y = imo->rotate_target + RING_OPEN_ROTATION;
ring->ring_pos.rot.z = 0;
ring->light.x = -1536;
ring->light.y = 256;
ring->light.z = 1024;
}

View File

@ -0,0 +1,7 @@
#pragma once
#include "global/types.h"
void __cdecl Inv_Ring_Init(
RING_INFO *ring, RING_TYPE type, INVENTORY_ITEM **list, int16_t qty,
int16_t current, IMOTION_INFO *imo);

View File

@ -105,7 +105,6 @@
#define Inv_RemoveAllItems ((void __cdecl (*)(void))0x00424CB0)
#define Inv_RemoveItem ((int32_t __cdecl (*)(GAME_OBJECT_ID object_num))0x00424CD0)
#define RemoveInventoryText ((void __cdecl (*)(void))0x00424FD0)
#define Inv_Ring_Init ((void __cdecl (*)(RING_INFO *ring, int16_t type, INVENTORY_ITEM **list, int16_t qty, int16_t current, IMOTION_INFO *imo))0x00425000)
#define Inv_Ring_GetView ((void __cdecl (*)(RING_INFO *ring, PHD_3DPOS *viewer))0x00425110)
#define Inv_Ring_Light ((void __cdecl (*)(RING_INFO *ring))0x00425170)
#define Inv_Ring_CalcAdders ((void __cdecl (*)(RING_INFO *ring, int16_t rotation_duration))0x004251B0)

View File

@ -19,6 +19,7 @@
#include "game/hwr.h"
#include "game/input.h"
#include "game/inventory/common.h"
#include "game/inventory/ring.h"
#include "game/items.h"
#include "game/lara/lara_cheat.h"
#include "game/lara/lara_col.h"
@ -621,6 +622,7 @@ static void Inject_Inventory(const bool enable)
INJECT(enable, 0x00423590, Inv_DrawInventoryItem);
INJECT(enable, 0x004242F0, Inv_AddItem);
INJECT(enable, 0x00424DE0, Inv_GetItemOption);
INJECT(enable, 0x00425000, Inv_Ring_Init);
}
static void Inject_Lara_Control(const bool enable)