mirror of
https://github.com/LostArtefacts/TR2X.git
synced 2024-11-23 13:59:45 +00:00
port BodyPart_Control
This commit is contained in:
parent
2f7736aeb6
commit
5158912523
@ -681,7 +681,7 @@
|
||||
<rect width="12" height="12" x="30" y="180" class="known"><title>void __cdecl ControlMissile(int16_t fx_num);</title></rect>
|
||||
<rect width="12" height="12" x="45" y="180" class="known"><title>void __cdecl ShootAtLara(FX_INFO *fx);</title></rect>
|
||||
<rect width="12" height="12" x="60" y="180" class="decompiled"><title>int32_t __cdecl Effect_ExplodingDeath(int16_t item_num, int32_t mesh_bits, int16_t damage);</title></rect>
|
||||
<rect width="12" height="12" x="75" y="180" class="known"><title>void __cdecl ControlBodyPart(int16_t fx_num);</title></rect>
|
||||
<rect width="12" height="12" x="75" y="180" class="known"><title>void __cdecl BodyPart_Control(int16_t fx_num);</title></rect>
|
||||
<rect width="12" height="12" x="90" y="180" class="known"><title>void __cdecl InitialiseMovingBlock(int16_t item_num);</title></rect>
|
||||
<rect width="12" height="12" x="105" y="180" class="known"><title>void __cdecl MovableBlock(int16_t item_num);</title></rect>
|
||||
<rect width="12" height="12" x="120" y="180" class="known"><title>void __cdecl MovableBlockCollision(int16_t item_num, ITEM_INFO *lara_item, COLL_INFO *coll);</title></rect>
|
||||
@ -1482,7 +1482,7 @@
|
||||
<rect width="17.36" height="18.04" x="390.95" y="171.84" class="decompiled"><title>bool __cdecl ApplySettings(APP_SETTINGS *new_settings);</title></rect>
|
||||
<rect width="17.36" height="17.91" x="390.95" y="192.88" class="known"><title>void __cdecl CreateStartInfo(int32_t level_num);</title></rect>
|
||||
<rect width="17.36" height="17.87" x="390.95" y="213.79" class="decompiled"><title>void __cdecl Bird_Control(int16_t item_num);</title></rect>
|
||||
<rect width="17.36" height="17.87" x="390.95" y="234.66" class="known"><title>void __cdecl ControlBodyPart(int16_t fx_num);</title></rect>
|
||||
<rect width="17.36" height="17.87" x="390.95" y="234.66" class="known"><title>void __cdecl BodyPart_Control(int16_t fx_num);</title></rect>
|
||||
<rect width="17.36" height="17.59" x="390.95" y="255.54" class="known"><title>void __cdecl SkidooBaddieCollision(ITEM_INFO *skidoo);</title></rect>
|
||||
<rect width="17.36" height="17.46" x="390.95" y="276.12" class="known"><title>void __cdecl S_DrawAirBar(int32_t percent);</title></rect>
|
||||
<rect width="17.36" height="17.42" x="390.95" y="296.59" class="decompiled"><title>void __cdecl Screenshot(LPDDS screen);</title></rect>
|
||||
|
Before Width: | Height: | Size: 364 KiB After Width: | Height: | Size: 364 KiB |
@ -3505,7 +3505,7 @@ typedef enum {
|
||||
0x00432FE0 0x02D0 -R void __cdecl ControlMissile(int16_t fx_num);
|
||||
0x004332B0 0x00A7 -R void __cdecl ShootAtLara(FX_INFO *fx);
|
||||
0x00433360 0x0386 +R int32_t __cdecl Effect_ExplodingDeath(int16_t item_num, int32_t mesh_bits, int16_t damage);
|
||||
0x004336F0 0x0200 -R void __cdecl ControlBodyPart(int16_t fx_num);
|
||||
0x004336F0 0x0200 -R void __cdecl BodyPart_Control(int16_t fx_num);
|
||||
|
||||
# game/moveblock.c
|
||||
0x004338F0 0x002C -R void __cdecl InitialiseMovingBlock(int16_t item_num);
|
||||
|
@ -117,6 +117,7 @@ dll_sources = [
|
||||
'src/game/objects/common.c',
|
||||
'src/game/objects/creatures/bird.c',
|
||||
'src/game/objects/creatures/diver.c',
|
||||
'src/game/objects/general/body_part.c',
|
||||
'src/game/objects/general/door.c',
|
||||
'src/game/objects/general/final_level_counter.c',
|
||||
'src/game/objects/names.c',
|
||||
|
@ -1005,3 +1005,8 @@ int16_t Lara_GetNearestEnemy(void)
|
||||
|
||||
return best_item_num;
|
||||
}
|
||||
|
||||
void Lara_TakeDamage(const int16_t damage, const bool hit_status)
|
||||
{
|
||||
Item_TakeDamage(g_LaraItem, damage, hit_status);
|
||||
}
|
||||
|
@ -27,3 +27,4 @@ void Lara_GetOffVehicle(void);
|
||||
void Lara_SwapSingleMesh(LARA_MESH mesh, GAME_OBJECT_ID);
|
||||
|
||||
int16_t Lara_GetNearestEnemy(void);
|
||||
void Lara_TakeDamage(int16_t damage, bool hit_status);
|
||||
|
82
src/game/objects/general/body_part.c
Normal file
82
src/game/objects/general/body_part.c
Normal file
@ -0,0 +1,82 @@
|
||||
#include "game/objects/general/body_part.h"
|
||||
|
||||
#include "game/effects.h"
|
||||
#include "game/lara/lara_control.h"
|
||||
#include "game/lara/lara_misc.h"
|
||||
#include "game/math.h"
|
||||
#include "game/room.h"
|
||||
#include "game/sound.h"
|
||||
#include "global/types.h"
|
||||
#include "global/vars.h"
|
||||
|
||||
void __cdecl BodyPart_Control(const int16_t fx_num)
|
||||
{
|
||||
FX_INFO *const fx = &g_Effects[fx_num];
|
||||
fx->rot.x += 5 * PHD_DEGREE;
|
||||
fx->rot.z += 10 * PHD_DEGREE;
|
||||
fx->pos.x += (fx->speed * Math_Sin(fx->rot.y)) >> W2V_SHIFT;
|
||||
fx->pos.z += (fx->speed * Math_Cos(fx->rot.y)) >> W2V_SHIFT;
|
||||
fx->pos.y += fx->fall_speed;
|
||||
fx->fall_speed += GRAVITY;
|
||||
|
||||
int16_t room_num = fx->room_num;
|
||||
const SECTOR_INFO *const sector =
|
||||
Room_GetSector(fx->pos.x, fx->pos.y, fx->pos.z, &room_num);
|
||||
|
||||
if (!(g_Rooms[fx->room_num].flags & RF_UNDERWATER)
|
||||
&& (g_Rooms[room_num].flags & RF_UNDERWATER)) {
|
||||
const int16_t fx_num = Effect_Create(fx->room_num);
|
||||
if (fx_num != NO_ITEM) {
|
||||
FX_INFO *const splash_fx = &g_Effects[fx_num];
|
||||
splash_fx->pos.x = fx->pos.x;
|
||||
splash_fx->pos.y = fx->pos.y;
|
||||
splash_fx->pos.z = fx->pos.z;
|
||||
splash_fx->rot.y = 0;
|
||||
splash_fx->speed = 0;
|
||||
splash_fx->frame_num = 0;
|
||||
splash_fx->object_num = O_SPLASH;
|
||||
}
|
||||
}
|
||||
|
||||
const int32_t ceiling =
|
||||
Room_GetCeiling(sector, fx->pos.x, fx->pos.y, fx->pos.z);
|
||||
if (fx->pos.y < ceiling) {
|
||||
fx->pos.y = ceiling;
|
||||
fx->fall_speed = -fx->fall_speed;
|
||||
}
|
||||
|
||||
const int32_t height =
|
||||
Room_GetHeight(sector, fx->pos.x, fx->pos.y, fx->pos.z);
|
||||
if (fx->pos.y >= height) {
|
||||
if (fx->counter) {
|
||||
fx->speed = 0;
|
||||
fx->frame_num = 0;
|
||||
fx->counter = 0;
|
||||
fx->object_num = O_EXPLOSION;
|
||||
Sound_Effect(SFX_EXPLOSION1, &fx->pos, SPM_NORMAL);
|
||||
} else {
|
||||
Effect_Kill(fx_num);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (Lara_IsNearItem(&fx->pos, 2 * fx->counter)) {
|
||||
Lara_TakeDamage(fx->counter, true);
|
||||
|
||||
if (fx->counter == 0) {
|
||||
fx->speed = 0;
|
||||
fx->frame_num = 0;
|
||||
fx->counter = 0;
|
||||
fx->object_num = O_EXPLOSION;
|
||||
Sound_Effect(SFX_EXPLOSION1, &fx->pos, SPM_NORMAL);
|
||||
g_Lara.spaz_effect_count = 5;
|
||||
g_Lara.spaz_effect = fx;
|
||||
} else {
|
||||
Effect_Kill(fx_num);
|
||||
}
|
||||
}
|
||||
|
||||
if (room_num != fx->room_num) {
|
||||
Effect_NewRoom(fx_num, room_num);
|
||||
}
|
||||
}
|
5
src/game/objects/general/body_part.h
Normal file
5
src/game/objects/general/body_part.h
Normal file
@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void __cdecl BodyPart_Control(int16_t fx_num);
|
@ -145,7 +145,7 @@
|
||||
#define Flare_Control ((void __cdecl (*)(int16_t item_num))0x00430070)
|
||||
#define ControlMissile ((void __cdecl (*)(int16_t fx_num))0x00432FE0)
|
||||
#define ShootAtLara ((void __cdecl (*)(FX_INFO *fx))0x004332B0)
|
||||
#define ControlBodyPart ((void __cdecl (*)(int16_t fx_num))0x004336F0)
|
||||
#define BodyPart_Control ((void __cdecl (*)(int16_t fx_num))0x004336F0)
|
||||
#define InitialiseMovingBlock ((void __cdecl (*)(int16_t item_num))0x004338F0)
|
||||
#define MovableBlock ((void __cdecl (*)(int16_t item_num))0x00433920)
|
||||
#define MovableBlockCollision ((void __cdecl (*)(int16_t item_num, ITEM_INFO *lara_item, COLL_INFO *coll))0x00433A70)
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "game/objects/common.h"
|
||||
#include "game/objects/creatures/bird.h"
|
||||
#include "game/objects/creatures/diver.h"
|
||||
#include "game/objects/general/body_part.h"
|
||||
#include "game/objects/general/door.h"
|
||||
#include "game/objects/general/final_level_counter.h"
|
||||
#include "game/objects/vehicles/boat.h"
|
||||
@ -898,6 +899,7 @@ static void Inject_Objects(const bool enable)
|
||||
INJECT(enable, 0x00413940, Door_Collision);
|
||||
INJECT(enable, 0x004139C0, Object_Collision_Trap);
|
||||
INJECT(enable, 0x00416DB0, Diver_Control);
|
||||
INJECT(enable, 0x004336F0, BodyPart_Control);
|
||||
INJECT(enable, 0x00434400, FinalLevelCounter_Control);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user