Skip to content

Commit e2e4ff2

Browse files
committed
Added ChocolateFan decompilation PR.
- Link to the PR: Arsunt/TR2Main#27 - Fixed shotgun ammo count gived at start.
1 parent 61c06f1 commit e2e4ff2

33 files changed

+2747
-338
lines changed

TR2Main-VS/TR2_progress.txt

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ x function is unused / included in another function
125125
0x0040CB50: BoatCheckGeton
126126
0x0040CCC0: BoatCollision
127127
0x0040CE20: TestWaterHeight
128-
0x0040CF20: DoBoatShift
128+
0x0040CF20: + DoBoatShift
129129
0x0040D0F0: + DoWakeEffect
130130
0x0040D270: DoBoatDynamics
131131
0x0040D2C0: BoatDynamics
@@ -164,13 +164,13 @@ x function is unused / included in another function
164164
game/camera.cpp
165165
0x00410580: + InitialiseCamera
166166
0x00410630: + MoveCamera
167-
0x004109B0: * ClipCamera
168-
0x00410A90: * ShiftCamera
169-
0x00410BF0: * GoodPosition
170-
0x00410C40: * SmartShift
171-
0x004113D0: * ChaseCamera
172-
0x004114C0: * ShiftClamp
173-
0x00411660: * CombatCamera
167+
0x004109B0: + ClipCamera
168+
0x00410A90: + ShiftCamera
169+
0x00410BF0: + GoodPosition
170+
0x00410C40: + SmartShift
171+
0x004113D0: + ChaseCamera
172+
0x004114C0: + ShiftClamp
173+
0x00411660: + CombatCamera
174174
0x004117F0: + LookCamera
175175
0x004119E0: + FixedCamera
176176
0x00411A80: + CalculateCamera
@@ -180,31 +180,31 @@ x function is unused / included in another function
180180
0x00411F40: + StartCinematic
181181
0x00412060: + InitCinematicRooms
182182
0x00412100: + DoCinematic
183-
0x00412270: * CalculateCinematicCamera
184-
0x004123B0: * GetCinematicRoom
185-
0x00412430: * ControlCinematicPlayer
186-
0x00412510: * LaraControlCinematic
187-
0x004125B0: * InitialisePlayer1
188-
0x00412640: * InitialiseGenPlayer
189-
0x00412680: * InGameCinematicCamera
183+
0x00412270: + CalculateCinematicCamera
184+
0x004123B0: + GetCinematicRoom
185+
0x00412430: + ControlCinematicPlayer
186+
0x00412510: + LaraControlCinematic
187+
0x004125B0: + InitialisePlayer1
188+
0x00412640: + InitialiseGenPlayer
189+
0x00412680: + InGameCinematicCamera
190190

191191
game/collide.cpp
192-
0x004128D0: GetCollisionInfo
193-
0x00412F90: FindGridShift
192+
0x004128D0: + GetCollisionInfo
193+
0x00412F90: * FindGridShift
194194
0x00412FC0: + CollideStaticObjects
195195
0x004133B0: + GetNearByRooms
196196
0x00413480: + GetNewRoom
197197
0x004134E0: ShiftItem
198198
0x00413520: * UpdateLaraRoom
199-
0x00413580: GetTiltType
199+
0x00413580: * GetTiltType
200200
0x00413620: LaraBaddieCollision
201201
0x004137C0: EffectSpaz
202202
0x00413840: * CreatureCollision
203203
0x004138C0: * ObjectCollision
204204
0x00413920: DoorCollision
205205
0x004139A0: TrapCollision
206-
0x00413A10: ItemPushLara
207-
0x00413D20: TestBoundsCollide
206+
0x00413A10: * ItemPushLara
207+
0x00413D20: * TestBoundsCollide
208208
0x00413DF0: * TestLaraPosition
209209
0x00413F30: * AlignLaraPosition
210210
0x00414070: * MoveLaraPosition
@@ -223,10 +223,10 @@ x function is unused / included in another function
223223
0x004158A0: * TriggerActive
224224
0x00415900: * GetCeiling
225225
0x00415B60: GetDoor
226-
0x00415BB0: * LOS
227-
0x00415C50: zLOS
228-
0x00415F40: xLOS
229-
0x00416230: ClipTarget
226+
0x00415BB0: + LOS
227+
0x00415C50: + zLOS
228+
0x00415F40: + xLOS
229+
0x00416230: + ClipTarget
230230
0x00416310: * ObjectOnLOS
231231
0x00416610: * FlipMap
232232
0x004166D0: RemoveRoomFlipItems
@@ -235,10 +235,10 @@ x function is unused / included in another function
235235
0x00416800: + TriggerNormalCDTrack
236236

237237
game/demo.cpp
238-
0x004168E0: * DoDemoSequence
238+
0x004168E0: + DoDemoSequence
239239
0x00416940: + StartDemo
240-
0x00416AF0: * LoadLaraDemoPos
241-
0x00416BC0: * GetDemoInput
240+
0x00416AF0: + LoadLaraDemoPos
241+
0x00416BC0: + GetDemoInput
242242

243243
game/diver.cpp
244244
0x00416BF0: Harpoon
@@ -290,7 +290,7 @@ x function is unused / included in another function
290290
0x0041BA60: * InterpolateMatrix
291291
0x0041BC10: * InterpolateArmMatrix
292292
0x0041BD10: + DrawGunFlash
293-
0x0041BE80: * CalculateObjectLighting
293+
0x0041BE80: + CalculateObjectLighting
294294
0x0041BF70: * GetFrames
295295
0x0041C010: * GetBoundsAccurate
296296
0x0041C090: * GetBestFrame
@@ -380,9 +380,9 @@ x function is unused / included in another function
380380
0x004201A0: + GF_ModifyInventory
381381

382382
game/hair.cpp
383-
0x00420E80: * InitialiseHair
384-
0x00420F00: * HairControl
385-
0x00421900: * DrawHair
383+
0x00420E80: + InitialiseHair
384+
0x00420F00: + HairControl
385+
0x00421900: + DrawHair
386386

387387
game/health.cpp
388388
0x00421980: + FlashIt
@@ -634,15 +634,15 @@ x function is unused / included in another function
634634
0x0042CC50: + AnimateShotgun
635635

636636
game/lara2gun.cpp
637-
0x0042D000: set_pistol_arm
638-
0x0042D050: draw_pistols
639-
0x0042D0D0: undraw_pistols
637+
0x0042D000: + set_pistol_arm
638+
0x0042D050: * draw_pistols
639+
0x0042D0D0: * undraw_pistols
640640
0x0042D300: ready_pistols
641641
0x0042D360: draw_pistol_meshes
642642
0x0042D3B0: undraw_pistol_mesh_left
643643
0x0042D3F0: undraw_pistol_mesh_right
644644
0x0042D430: + PistolHandler
645-
0x0042D5C0: * AnimatePistols
645+
0x0042D5C0: + AnimatePistols
646646

647647
game/laraclimb.cpp
648648
0x0042D8F0: lara_as_climbleft
@@ -664,7 +664,7 @@ x function is unused / included in another function
664664
0x0042E4F0: LaraTestClimbUpPos
665665

666666
game/larafire.cpp
667-
0x0042E740: * LaraGun
667+
0x0042E740: + LaraGun
668668
0x0042ECB0: * CheckForHoldingState
669669
0x0042ECF0: * InitialiseNewWeapon
670670
0x0042EE30: * LaraTargetInfo
@@ -673,21 +673,21 @@ x function is unused / included in another function
673673
0x0042F2A0: * AimWeapon
674674
0x0042F370: + FireWeapon
675675
0x0042F6E0: + HitTarget
676-
0x0042F780: * SmashItem
676+
0x0042F780: + SmashItem
677677
0x0042F7E0: * WeaponObject
678678

679679
game/laraflare.cpp
680-
0x0042F840: DoFlareLight
681-
0x0042F8E0: DoFlareInHand
680+
0x0042F840: + DoFlareLight
681+
0x0042F8E0: + DoFlareInHand
682682
0x0042F9C0: + DrawFlareInAir
683-
0x0042FAC0: CreateFlare
684-
0x0042FCA0: set_flare_arm
685-
0x0042FCF0: draw_flare
686-
0x0042FE60: undraw_flare
687-
0x00430090: * draw_flare_meshes
688-
0x004300B0: undraw_flare_meshes
689-
0x004300D0: ready_flare
690-
0x00430110: FlareControl
683+
0x0042FAC0: + CreateFlare
684+
0x0042FCA0: + set_flare_arm
685+
0x0042FCF0: + draw_flare
686+
0x0042FE60: + undraw_flare
687+
0x00430090: + draw_flare_meshes
688+
0x004300B0: + undraw_flare_meshes
689+
0x004300D0: + ready_flare
690+
0x00430110: + FlareControl
691691

692692
game/laramisc.cpp
693693
0x00430380: + LaraControl
@@ -773,10 +773,10 @@ x function is unused / included in another function
773773
0x00434970: DeathSlideCollision
774774
0x00434A30: ControlDeathSlide
775775
0x00434CC0: BigBowlControl
776-
0x00434DB0: BellControl
777-
0x00434E30: InitialiseWindow
778-
0x00434EB0: * SmashWindow
779-
0x00434F80: WindowControl
776+
0x00434DB0: + BellControl
777+
0x00434E30: + InitialiseWindow
778+
0x00434EB0: + SmashWindow
779+
0x00434F80: + WindowControl
780780
0x00435020: SmashIceControl
781781
0x00435100: ShutThatDoor
782782
0x00435150: OpenThatDoor
@@ -786,11 +786,11 @@ x function is unused / included in another function
786786
0x00435700: DrawBridgeFloor
787787
0x00435740: DrawBridgeCeiling
788788
0x00435780: DrawBridgeCollision
789-
0x004357B0: InitialiseLift
790-
0x004357F0: LiftControl
791-
0x004358D0: LiftFloorCeiling
792-
0x00435A50: LiftFloor
793-
0x00435A90: LiftCeiling
789+
0x004357B0: + InitialiseLift
790+
0x004357F0: + LiftControl
791+
0x004358D0: + LiftFloorCeiling
792+
0x00435A50: + LiftFloor
793+
0x00435A90: + LiftCeiling
794794
0x00435AD0: BridgeFlatFloor
795795
0x00435AF0: BridgeFlatCeiling
796796
0x00435B10: GetOffset
@@ -803,7 +803,7 @@ x function is unused / included in another function
803803
0x00435E20: DetonatorControl
804804

805805
game/people.cpp
806-
0x00435EB0: * Targetable
806+
0x00435EB0: + Targetable
807807
0x00435F40: ControlGlow
808808
0x00435F80: ControlGunShot
809809
0x00435FD0: + GunShot
@@ -818,7 +818,7 @@ x function is unused / included in another function
818818
0x004371C0: * Worker2Control
819819
0x00437620: * BanditControl
820820
0x00437960: * Bandit2Control
821-
0x00437DA0: * WinstonControl
821+
0x00437DA0: + WinstonControl
822822

823823
game/pickup.cpp
824824
0x00437F20: + PickUpCollision
@@ -894,7 +894,7 @@ x function is unused / included in another function
894894
0x0043FA30: + SOUND_Init
895895

896896
game/sphere.cpp
897-
0x0043FA60: TestCollision
897+
0x0043FA60: * TestCollision
898898
0x0043FB90: * GetSpheres
899899
0x0043FE70: * GetJointAbsPosition
900900
0x00440010: * BaddieBiteEffect
@@ -939,10 +939,10 @@ x function is unused / included in another function
939939
0x00441900: + BladeControl
940940
0x004419A0: + InitialiseKillerStatue
941941
0x004419F0: + KillerStatueControl
942-
0x00441B00: SpringBoardControl
943-
0x00441BE0: InitialiseRollingBall
944-
0x00441C20: RollingBallControl
945-
0x00441F70: RollingBallCollision
942+
0x00441B00: + SpringBoardControl
943+
0x00441BE0: + InitialiseRollingBall
944+
0x00441C20: + RollingBallControl
945+
0x00441F70: + RollingBallCollision
946946
0x004421C0: SpikeCollision
947947
0x00442320: TrapDoorControl
948948
0x00442370: TrapDoorFloor

TR2Main-VS/game/boat.cpp

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,50 @@
2525
#include "game/control.h"
2626
#include "game/items.h"
2727
#include "game/missile.h"
28+
#include "game/sound.h"
2829
#include "specific/game.h"
2930
#include "specific/output.h"
3031
#include "global/vars.h"
3132

33+
void DoBoatShift(int itemID) {
34+
ITEM_INFO* item, *link = NULL;
35+
short linkID;
36+
int x, z, dx, dz;
37+
38+
item = &Items[itemID];
39+
for (linkID = RoomInfo[item->roomNumber].itemNumber; linkID != -1; linkID = link->nextItem) {
40+
link = &Items[linkID];
41+
if (link->objectID == ID_BOAT && linkID != itemID && Lara.skidoo != linkID) {
42+
dz = link->pos.z - item->pos.z;
43+
dx = link->pos.x - item->pos.x;
44+
if (SQR(dx) + SQR(dz) < SQR(1000)) {
45+
item->pos.x = link->pos.x - SQR(1000) * dx / (SQR(dx) + SQR(dz));
46+
item->pos.z = link->pos.z - SQR(1000) * dz / (SQR(dx) + SQR(dz));
47+
}
48+
}
49+
else {
50+
if (link->objectID == ID_GONDOLA && link->currentAnimState == 1) {
51+
x = link->pos.x - (512 * phd_sin(link->pos.rotY) >> W2V_SHIFT);
52+
z = link->pos.z - (512 * phd_cos(link->pos.rotY) >> W2V_SHIFT);
53+
dx = x - item->pos.x;
54+
dz = z - item->pos.z;
55+
if (SQR(dx) + SQR(dz) < SQR(1000)) {
56+
if (item->speed < 80) {
57+
item->pos.x = x - SQR(1000) * dx / (SQR(dx) + SQR(dz));
58+
item->pos.z = z - SQR(1000) * dz / (SQR(dx) + SQR(dz));
59+
}
60+
else {
61+
if (link->pos.y - item->pos.y < 2048) {
62+
PlaySoundEffect(337, &link->pos, 0);
63+
link->goalAnimState = 2;
64+
}
65+
}
66+
}
67+
}
68+
}
69+
}
70+
}
71+
3272
void DoWakeEffect(ITEM_INFO* item) {
3373
short frame_number, fxID;
3474
int i;
@@ -97,15 +137,12 @@ void Inject_Boat() {
97137
//INJECT(0x0040CB50, BoatCheckGeton);
98138
//INJECT(0x0040CCC0, BoatCollision);
99139
//INJECT(0x0040CE20, TestWaterHeight);
100-
//INJECT(0x0040CF20, DoBoatShift);
101-
140+
INJECT(0x0040CF20, DoBoatShift);
102141
INJECT(0x0040D0F0, DoWakeEffect);
103-
104142
//INJECT(0x0040D270, DoBoatDynamics);
105143
//INJECT(0x0040D2C0, BoatDynamics);
106144
//INJECT(0x0040D7A0, BoatUserControl);
107145
//INJECT(0x0040D930, BoatAnimation);
108146
//INJECT(0x0040DAA0, BoatControl);
109-
110147
INJECT(0x0040E0D0, GondolaControl);
111148
}

TR2Main-VS/game/boat.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
//0x0040CE20: TestWaterHeight
3434
//0x0040CF20: DoBoatShift
3535

36+
void DoBoatShift(int itemID); // 0x0040CF20
3637
void DoWakeEffect(ITEM_INFO* item); // 0x0040D0F0
3738

3839
//0x0040D270: DoBoatDynamics

0 commit comments

Comments
 (0)