mirror of
https://github.com/LostArtefacts/TR2X.git
synced 2024-12-02 19:06:47 +00:00
port Item_GetFrames
This commit is contained in:
parent
84647f2727
commit
974119e2ee
@ -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">48.44% (590)</tspan> · <tspan class="known">49.10% (598)</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">48.52% (591)</tspan> · <tspan class="known">49.01% (597)</tspan> · <tspan class="todo">0% (0)</tspan> · <tspan class="unused">2.46% (30)</tspan></tspan></text>
|
||||
<g transform="translate(0 20)">
|
||||
<rect width="361.85" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="366.75" height="6" x="361.85" y="0" class="known"/>
|
||||
<rect width="362.46" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="366.14" height="6" x="362.46" y="0" class="known"/>
|
||||
<rect width="18.40" height="6" x="728.60" y="0" class="unused"/>
|
||||
</g>
|
||||
<g transform="translate(0 31)">
|
||||
@ -311,7 +311,7 @@
|
||||
<rect width="12" height="12" x="480" y="60" class="decompiled"><title>void __cdecl Matrix_InterpolateArm(void);</title></rect>
|
||||
<rect width="12" height="12" x="495" y="60" class="known"><title>void __cdecl Gun_DrawFlash(int32_t weapon_type, int32_t clip);</title></rect>
|
||||
<rect width="12" height="12" x="510" y="60" class="known"><title>void __cdecl Output_CalculateObjectLighting(ITEM_INFO *item, int16_t *frame);</title></rect>
|
||||
<rect width="12" height="12" x="525" y="60" class="known"><title>int32_t __cdecl Item_GetFrames(const ITEM_INFO *item, int16_t *frmptr[], int32_t *rate);</title></rect>
|
||||
<rect width="12" height="12" x="525" y="60" class="decompiled"><title>int32_t __cdecl Item_GetFrames(const ITEM_INFO *item, int16_t *frmptr[], int32_t *rate);</title></rect>
|
||||
<rect width="12" height="12" x="540" y="60" class="known"><title>int16_t *__cdecl Item_GetBoundsAccurate(const ITEM_INFO *item);</title></rect>
|
||||
<rect width="12" height="12" x="555" y="60" class="known"><title>int16_t *__cdecl Item_GetBestFrame(const ITEM_INFO *item);</title></rect>
|
||||
<rect width="12" height="12" x="570" y="60" class="known"><title>void __cdecl AddDynamicLight(int32_t x, int32_t y, int32_t z, int32_t intensity, int32_t falloff);</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">46.56%</tspan> · <tspan class="known">53.11%</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">46.60%</tspan> · <tspan class="known">53.07%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.33%</tspan></tspan></text>
|
||||
<g transform="translate(0 20)">
|
||||
<rect width="347.81" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="396.75" height="6" x="347.81" y="0" class="known"/>
|
||||
<rect width="348.13" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="396.43" height="6" x="348.13" y="0" class="known"/>
|
||||
<rect width="2.44" height="6" x="744.56" y="0" class="unused"/>
|
||||
</g>
|
||||
<g transform="translate(0 31)">
|
||||
@ -1875,7 +1875,7 @@
|
||||
<rect width="7.88" height="8.22" x="557.01" y="311" class="decompiled"><title>void __cdecl Misc_InitCinematicRooms(void);</title></rect>
|
||||
<rect width="7.88" height="8.22" x="557.01" y="322.22" class="decompiled"><title>void __cdecl Effect_NewRoom(int16_t fx_num, int16_t room_num);</title></rect>
|
||||
<rect width="7.88" height="8.22" x="557.01" y="333.43" class="known"><title>void __cdecl SE_AdvancedDlgUpdate(HWND hwndDlg);</title></rect>
|
||||
<rect width="7.88" height="8.14" x="557.01" y="344.65" class="known"><title>int32_t __cdecl Item_GetFrames(const ITEM_INFO *item, int16_t *frmptr[], int32_t *rate);</title></rect>
|
||||
<rect width="7.88" height="8.14" x="557.01" y="344.65" class="decompiled"><title>int32_t __cdecl Item_GetFrames(const ITEM_INFO *item, int16_t *frmptr[], int32_t *rate);</title></rect>
|
||||
<rect width="7.88" height="8.14" x="557.01" y="355.79" class="decompiled"><title>void __cdecl Music_SetVolume(int32_t volume);</title></rect>
|
||||
<rect width="7.88" height="8.07" x="557.01" y="366.93" class="decompiled"><title>const int16_t *__cdecl Output_InsertObjectGT4_ZBuffered(const int16_t *obj_ptr, int32_t num, SORT_TYPE sort_type);</title></rect>
|
||||
<rect width="7.91" height="8.03" x="567.89" y="185.54" class="decompiled"><title>void __cdecl Lara_State_Extra_SharkKill(ITEM_INFO *item, COLL_INFO *coll);</title></rect>
|
||||
|
Before Width: | Height: | Size: 361 KiB After Width: | Height: | Size: 361 KiB |
@ -2915,7 +2915,7 @@ typedef enum {
|
||||
0x0041BC30 0x00FC + void __cdecl Matrix_InterpolateArm(void);
|
||||
0x0041BD30 0x014B - void __cdecl Gun_DrawFlash(int32_t weapon_type, int32_t clip);
|
||||
0x0041BEA0 0x00E8 - void __cdecl Output_CalculateObjectLighting(ITEM_INFO *item, int16_t *frame);
|
||||
0x0041BF90 0x0092 * int32_t __cdecl Item_GetFrames(const ITEM_INFO *item, int16_t *frmptr[], int32_t *rate);
|
||||
0x0041BF90 0x0092 + int32_t __cdecl Item_GetFrames(const ITEM_INFO *item, int16_t *frmptr[], int32_t *rate);
|
||||
0x0041C030 0x007C * int16_t *__cdecl Item_GetBoundsAccurate(const ITEM_INFO *item);
|
||||
0x0041C0B0 0x0035 - int16_t *__cdecl Item_GetBestFrame(const ITEM_INFO *item);
|
||||
0x0041C0F0 0x0048 -R void __cdecl AddDynamicLight(int32_t x, int32_t y, int32_t z, int32_t intensity, int32_t falloff);
|
||||
|
@ -660,3 +660,31 @@ int32_t __cdecl Item_IsTriggerActive(ITEM_INFO *const item)
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
int32_t __cdecl Item_GetFrames(
|
||||
const ITEM_INFO *item, int16_t *frmptr[], int32_t *rate)
|
||||
{
|
||||
const ANIM_STRUCT *const anim = &g_Anims[item->anim_num];
|
||||
const int32_t key_frame_span = anim->interpolation & 0xFF;
|
||||
const int32_t size = anim->interpolation >> 8;
|
||||
const int32_t cur_frame_num = item->frame_num - anim->frame_base;
|
||||
const int32_t first_key_frame_num = cur_frame_num / key_frame_span * size;
|
||||
const int32_t second_key_frame_num = first_key_frame_num + size;
|
||||
frmptr[0] = anim->frame_ptr + first_key_frame_num;
|
||||
frmptr[1] = anim->frame_ptr + second_key_frame_num;
|
||||
const int32_t key_frame_shift = cur_frame_num % key_frame_span;
|
||||
if (!key_frame_shift) {
|
||||
return 0;
|
||||
}
|
||||
// TODO: ??
|
||||
const int32_t second_key_frame_num2 =
|
||||
key_frame_span * (cur_frame_num / key_frame_span + 1);
|
||||
const int32_t numerator = key_frame_shift;
|
||||
int32_t denominator = key_frame_span;
|
||||
if (second_key_frame_num2 > anim->frame_end) {
|
||||
denominator += anim->frame_end - second_key_frame_num2;
|
||||
}
|
||||
|
||||
*rate = denominator;
|
||||
return numerator;
|
||||
}
|
||||
|
@ -27,5 +27,7 @@ void __cdecl Item_Animate(ITEM_INFO *item);
|
||||
int32_t __cdecl Item_GetAnimChange(ITEM_INFO *item, const ANIM_STRUCT *anim);
|
||||
void __cdecl Item_Translate(ITEM_INFO *item, int32_t x, int32_t y, int32_t z);
|
||||
int32_t __cdecl Item_IsTriggerActive(ITEM_INFO *item);
|
||||
int32_t __cdecl Item_GetFrames(
|
||||
const ITEM_INFO *item, int16_t *frmptr[], int32_t *rate);
|
||||
|
||||
bool Item_IsSmashable(const ITEM_INFO *item);
|
||||
|
@ -35,7 +35,6 @@
|
||||
#define Lara_Draw_I ((void __cdecl (*)(ITEM_INFO *item, int16_t *frame1, int16_t *frame2, int32_t frac, int32_t rate))0x0041AB20)
|
||||
#define Gun_DrawFlash ((void __cdecl (*)(int32_t weapon_type, int32_t clip))0x0041BD30)
|
||||
#define Output_CalculateObjectLighting ((void __cdecl (*)(ITEM_INFO *item, int16_t *frame))0x0041BEA0)
|
||||
#define Item_GetFrames ((int32_t __cdecl (*)(const ITEM_INFO *item, int16_t *frmptr[], int32_t *rate))0x0041BF90)
|
||||
#define Item_GetBoundsAccurate ((int16_t *__cdecl (*)(const ITEM_INFO *item))0x0041C030)
|
||||
#define Item_GetBestFrame ((int16_t *__cdecl (*)(const ITEM_INFO *item))0x0041C0B0)
|
||||
#define AddDynamicLight ((void __cdecl (*)(int32_t x, int32_t y, int32_t z, int32_t intensity, int32_t falloff))0x0041C0F0)
|
||||
|
@ -484,6 +484,7 @@ static void Inject_Items(const bool enable)
|
||||
INJECT(enable, 0x00414A60, Item_GetAnimChange);
|
||||
INJECT(enable, 0x00414B10, Item_Translate);
|
||||
INJECT(enable, 0x004158D0, Item_IsTriggerActive);
|
||||
INJECT(enable, 0x0041BF90, Item_GetFrames);
|
||||
}
|
||||
|
||||
static void Inject_Effects(const bool enable)
|
||||
|
Loading…
Reference in New Issue
Block a user