Summary of Exercises |
|
Exercise | Contents |
Exercise 1: The Magic Flare |
[Magic Flare] Give to Lara the chance to fly when she holds the flare [Dangerous Walls] Lara will be injured when she touches red walls [Ceiling TeethSpikes] Activate teeth-spikes placed on the ceiling when lara will be very closed to the ceiling Introduction to Get() and Find() functions. How to build the project. Description of auto enumerate facility: enumGET, enumFIND ect. Introduction to C++ syntax: brackets, functions, for statement, vectors, conditional operators, structures. How to manage input game commands, working with collision box of moveables. Introducion of MyData structure, local and global variables. Coordinate system in tomb raider: room structure. Introduction to usage of trng trigger called from plugin code: the PerformActionTrigger() function |
Exercise 2: Lost in Space |
[Robotic Cube] code to move a cube like a robot, avoiding walls,ceiling or bad slopes How to create new triggers. Syntax of TRG file. Hot to catch the activation of our triggers in game. The Progressive Actions The PerformMyProgrAction() function The CheckFloor() function and its FLOOR structure Slope types. The IsFreeWay() function The UpdateItemRoom() function The GetIncrements() function The GetItemSize() function |
Exercise 3: The Cleaner Robot |
[Cleaner Robot] How to create a new standard moveable object. The Slot structure. The management procedures of moveable objects. How to detect the collisions between robot and Lara or other moveables How to add special effects to some mesh of moveables Usage of some tomb4 functions: bool TriggerActive(StrItemTr4 *pItem); bool TestBoundCollide(StrItemTr4 *pItem, StrItemTr4 *pLara, int LaraRadius); bool TestCollision(StrItemTr4 *pItem, StrItemTr4 *pLara); void ItemPushLara(StrItemTr4 *pItem, StrItemTr4, *pLaraStrCollisionLara *pCollLara, bool TestChangeLaraAnim, int Parameter); void AnimateItem(StrItemTr4 *pItem); void TriggerFlareSparks(int CordX, int CordY, int CordZ, int Red, int Green, int Blue, DWORD TestSmoke, DWORD Unused); void GetJointAbsPosition(StrItemTr4 *pItem, StrMovePosition *pCoordinate, int JointIndex); |
Exercise 4: The Star Wars Robot |
[Star Wars Robot] How to discover the rasing/declivity respect to the item: the DiscoverySectorType() funcion How to detect the presence of Lara: the CheckDirection() function How to detect the presence of static items: the DetectCollisionWithStatics() function How to detect the presence of Box (gray) sectors. How to create our own Customize command How to discover the height of items in game units How to use the Debugger of Microsoft Visual Express How to handle triggers requiring Param commands in the script How to create new script commands Input arguments of SoundEffect() function |
Exercise 5: The Swinging Crane |
[Swinging Crane] In automatic mode The AssignSlot command to support new Objects How to read from code the data of AssignSlot commands The default draw procedure How to move an object (The Crane) to get it near to Lara How to get the chance to customize the sounds for our new objects How to read data from Customize=CUST_SFX_DEMO command: the GetSFX() function How to create a proportional Shadow: the Crane_ShowShadow() function |
Exercise 6: Driving the Crane |
[Drivable Crane] In manual mode - The default procedures used by Animating objects - The CheckPositionAlignment() function - How to enable a vehicle - How to animate lara during a vechicle phase: the AnimateItem() function - How to set a new global trigger event: the DetectedGlobalTriggerEvent() function - The flowcharts used to describe a procedure - How detect collisions between items: The IsCollidingWithSomeItem() function - How to forbid that an item enters in other item: The ItemPushAwayItem() function - How to initialise a new progressive action - Adding splash and ripples on the water surface: the SetupRipple(), TriggerSmallSplash() and Splash() functions - How to do align lara to ideal position for switching: The AlignLaraAtPosition() function - How to handle a numeric value in ocb field: the bit mask - How to move pushable items with ng features: The StartMoveItem() and EndMoveItem() functions - How to add ocb descriptions in OCB list of NG_Center: the ".ocb" plugin file - How to enable triggers of some sector: The TestTriggers() function |
Exercise 7: The Mech Warrior |
[MechWarrior] - How to handle a real "moving" vehicle - How to handle get-in and get-out actions - How to fix the collision box of vehicle to manage get-in action - How to have a customizable Camera View for vehicles: the SetCamera() function - How to get a Set Position anim command from code - How to handle an object/vechicle only with State-id changes - How to handle collisions for large objects/vehicles - How to align vechicle in according with wall collisions - How to create an advanced collision function using mnemonic constants to remember different collision types - How to manage continue input commands - How to avoid skipping of collision control in whiletime of swap animations - How to filter input commands in according with current state-id - Homeworks: suggestion about how to complete Mech-Warrior vehicle |
Sections to use for Arguments |
|||
Argument Type | FLIPEFFECT | ACTION | CONDITON |
(Object to trigger <#>) | ... |
START_ACTION_nn_O_H Example: <START_ACTION_43_O_H> |
START_CONDITION_nn_O_H Example: <START_CONDITION_14_O_H> |
Timer (Parameter <&>) |
START_EFFECT_nn_T_H Example: <START_EFFECT_47_T_H> |
... | ... |
(E)xtra |
START_EFFECT_nn_E_H Example: <START_EFFECT_48_E_H> |
START_ACTION_nn_E_H Example: <START_ACTION_43_E_H> |
START_CONDITION_nn_B_H Example: <START_CONDITION_14_B_H> |
Changed Variables |
||
Old Variable | New Variable | Description |
pAction->VetArgShort[0] | pItem->Reserved_34 | This value is the absolute increment value, to turn vertically the cube of degrees about a slope of one click, in same number of times (frames) required to move the object for one sector |
pAction->VetArgShort[1] | VerticalOrientWished | This variable has been converted as local variable. The value is the vertical orienting that is realtive to next sector in front of the object. |
pAction->VetArgShort[2] | VerticalOrientInc | This variable has been converted as local variable. This value is the signed increment to add to current vertical orient of the object to reach the wished (final) vertical orient, in N times, where N is the number of frame required to the object to cover the distance of one sector |
pAction->Arg2 | pItem->Reserved_36 | The increment to move the object in horizontal direction for each frame, i.e. the horizontal speed |
Animations of Star Wars Robot |
|||
Anim | Next | State | Description |
0 | 0 | 0 |
Flat feet, down fixed head The robot moves forward |
1 | 2 | 1 | From flat feet to rising, head down fixed forward |
2 | 2 | 1 | Feet for fix rising. Fixed down forward Head |
3 | 4 | 1 | Feet from flat to declivity. Fixed down forward Head |
4 | 4 | 1 | Fixed declivity feet. Fixed down forward Head |
5 | 0 | 1 | Feet from rising to flat. Fixed down forward Head |
6 | 0 | 1 | Feet from declivity to flat. Fixed down forward head. |
7 | 0 | 2 | Lower head moves at left and back to forward. Fixed flat feet. No moving forward |
8 | 0 | 2 | Lower head moves at right and back to forward. Fixed flat feet. Do not move forward |
9 | 10 | 3 | Move up the head to reach middle height. |
10 | 10 | 4 | Fixed middle height for head |
11 | 0 | 3 | Move down head, from middle height to standard |
12 | 13 | 3 | Moving up head, from standard to super high |
13 | 13 | 4 | Fixed highest head |
14 | 13 | 2 | Highest head, turning at left and back to forward |
15 | 13 | 2 | Highest head, turning at right and back to forward |
16 | 0 | 5 | Steer at left by 90 degrees |
17 | 0 | 5 | Steer at right by 90 degrees |
18 | 0 | 5 | Steer by 180 degrees to reverse direction |
19 | 19 | 6 | Not move, no change feet, no turn head. In this animation it is like an animating. To use to manage the robot avoiding interference with AnimateItem() tomb function |
20 | 10 | 2 | Middle height head, turn at left and come back |
21 | 10 | 2 | Middle heigth head turns at right and the come back |
22 | 0 | 3 | Move down head, from highest position to standard |
State IDs of Star Wars Robot |
|
State | Description |
0 | Moving forward with down forward head and flat feet |
1 |
Robot is moving forward, turning its feet to change from slope to flat floor or viceversa. In this phase it cann't turn on itself and neither shooting or looking around moving the head. Anyway also in this situation it will be able to detect lara but only if she is in front of it, since it is not able to turn the head to control other directions |
2 |
It is moving its head at left or right to detect Lara. In this state id it's not able to move forward. |
3 | It is moving up or down the head. In this phase it is not able to move, to shoot or to change direction turning on itself, but it could detect lara if she is where it is looking, in front itself |
4 | It is fixed with head in high position and in this state it could shoot lara if she had been detected just a moment before of this state. |
5 | The robot is turning on itself to change direction. The change could be by 90 or 180 degrees. In this state-id it could detect lara only when she is in front of it |
6 | In this state-id the robot is fully frozen, no speed, no change about feet or head. This state it will be used to move manually it avoiding interference with AnimateItem() function |
Turning head Animations |
||||
# | Description | Frames | From Degrees | To degrees |
7 | Turn head at its left by 90 degrees and comes back | 60 | 0 | -90 |
8 | Turn head at its right by 90 degrees and comes back | 61 | 0 | +90 |
14 | Turn head at its left by 90 degrees and comes back | 61 | 0 | -90 |
15 | Turn head at its right by 90 degrees and comes back | 61 | 0 | +90 |
20 | Turn head at its left by 90 degrees and comes back | 60 | 0 | -90 |
21 | Turn head at its right by 90 degrees and comes back | 60 | 0 | +90 |
Animation of the Crane |
|||
#Anim | #Next | StateId | Description |
0 | 0 | 0 | Always Closed jaws |
1 | 5 | 1 | From closed to open |
2 | 0 | 0 | From open to closed |
3 | 6 | 2 |
From open to large grabbing. Note: the grabbing is when the jaws is a bit closer, like it was grabbing some object |
4 | 5 | 1 | From Large Grabbing to open |
5 | 5 | 1 | Always Open Jaws |
6 | 6 | 2 | Always Large Grabbing jaws |
7 | 8 | 3 | From large grabbing to slim grabbing |
8 | 8 | 3 | Always Slim Grabbing |
9 | 5 | 1 | From Slim Grabbing to Open |
10 | 0 | 0 | From Large Grabbing to Close |
11 | 0 | 0 | From Slim Grabbing to Close |
12 | 8 | 3 | From open to slim grabbing |
Sound Effect used in our code |
|||
#Sound | Name | Function | Description |
183 | THUNDER_CRACK | CollisionRobotCleaner() | It will be played when Cleaner Robot touch Lara killing her. |
198 | ELEC_ONE_SHOT | ShootLightning() |
It will be used to create the Parameters=PARAM_LIGHTNING command to shoot the lightning to hit Lara. We pass as argument the number of sound effect to use for this trng action. |
306 | MAPPER_SWITCH_ON | ControlCraneAutomatic() | It will be played when the crane will be released to fall down |
309 | MAPPER_MOVE |
Crane_MoveUpDown() ControlCraneAutomatic() |
It will be played when the crane is moving horizontally or when it is pulling up the crane |
314 | HAMMER_TRAP_BANG | Crane_MoveUpDown() | It will be played when the crane touch the floor after the falling down |
Animations to handle get-in and get-off code |
|||
Anim | Next | StateId | Description |
0 | 2 | 7 | Get-In animation. Lara gets in the mechwarrior. |
1 | 30 | 3 | Get-off animation. Lara gets off the mechwarrior. |
2 | 2 | 1 | Idle animation. Lara is on board, the mechwarrior is still in stand-up position. |
30 | 30 | 3 | Quit driving. Lara is on the floor in stand-up position, waiting the quit of driving. |
Animation to move forward MechWarrior |
|||
NAnim | NextAnim | StateId | Description |
2 | 2 | 1 | Idle Animation. Mechwarrior is still. |
3 | 4 | 4 |
Start Moving Forward Animation. Mech perform first step forward. Speed 16 |
4 | 4 | 4 |
Run forward Animation. Looped animation with mech walking forward. Speed 32 |
5 | 2 | 6 | Stop animation rigth foot. Mech pass from run to idle animation while it had right foot forward |
6 | 2 | 6 | Stop animation left foot. Mech pass from run to idle while it had left foot forward |
All animations of Mechwarrior |
|||
Anim | NextAnim | StateId | Description |
0 | 2 | 2 | Get-in animation. Lara gets in mechwarrior |
1 | 30 | 3 | Get-off animation. Lara gets off from the mechwarrior and the driving quits |
2 | 2 | 1 | Idle animation. Mech is still in stand-up position |
3 | 4 | 4 | Start Moving Forward Animation. Mech perform first step forward. |
4 | 4 | 4 | Run forward Animation. Looped animation with mech walking forward. |
5 | 2 | 6 | From run to idle. Begins with forward right foot |
6 | 2 | 6 | From run to idle. Begins with forward left foot |
7 | 8 | 9 | From idle to reverse |
8 | 8 | 9 | Reverse animation, looped |
9 | 2 | 6 | From reverse, right foot, to idle animation |
10 | 2 | 6 | From reverse, left foot, to idle animation |
11 | 12 | 5 | Start right turning, with right foot |
12 | 12 | 5 | Right turning, looped animation turning at right |
13 | 4 | 4 | From right turning to move newly forward |
14 | 2 | 6 | From right turning to idle animation from left foot |
15 | 2 | 6 | From right turning to idle animation. From right foot |
16 | 17 | 7 | Start left turning with right foot |
17 | 17 | 7 | Left turning, looped animation. |
18 | 4 | 4 | From left turning to move forward |
19 | 2 | 6 | From left turning to idle animation, from left foot |
20 | 2 | 6 | From left turning to idle, from right foot |
21 | 2 | 8 | Climb a 2 click heigh floor in front of mechwarrior, beginning from idle animation |
22 | 2 | 9 | Reverse climb down 2 clicks and then come back to idle animation |
23 | 24 | 10 | From running to start jump down, when it has in front a steep gorge |
24 | 24 | 10 | Jumping down, looped animation |
25 | 2 | 6 | From jumping down to idle animation. Mechwarrior touch the ground |
26 | 2 | 11 | Kicking animation. Mechwarrior kicks with right foot and then comes back to idle animation |
27 | 2 | 12 | Beating animation. Mechwarrior hits with both arms in front of it and then comes back to idle animation |
28 | 31 | 13 | From running to right sliding |
29 | 29 | 0 | Dying animation. Lara lost her life. This animation is looped but only for last frame, waiting the end of game |
30 | 30 | 3 | Waiting in board animation. Mech is still, in position to get in Lara |
31 | 31 | 13 | Right sliding, looped animation |
32 | 2 | 6 | From right sliding to idle animation |
33 | 34 | 14 | From running to left sliding |
34 | 34 | 14 | Left sliding, looped animation |
35 | 2 | 6 | From left sliding to idle animation |
36 | 12 | 5 | Start right turning with left foot |
37 | 17 | 7 | Start left turning with left foot |
38 | 38 | 15 | Looped turning on itself at left |
39 | 39 | 16 | Looped turning on itself at right |
40 | 34 | 14 | From running to left sliding (from other frame) |
41 | 31 | 13 | From running to right sliding (from other frame) |
42 | 2 | 6 | Finish right turning on itself |
43 | 2 | 6 | Finish left turning on itself |
Input Commands for Mech Warrior |
||
Command | Action | Description |
ACTION | Get-in or Special Move |
When lara is not on board with ACTION key she will get in (if she in correct, in-front, position) When Lara is already on board this command works only if mech is idle (no movements) Currently there two special moves already working: If Mech has in front a two click obstacle, hitting ACTION + UP (just a moment first ACTION and then UP), mech will climb that obstacle with a single long step. If Mech has backward a two clicks hole, hitting ACTION = DOWN (just a moment first ACTION and then DOWN), mech will move down in the back hole with a single long step |
ROLL | Get-Out | Lara will get off from mech. This action will be performed only if in front of mech there will be the required free space and the floor has the same height of floor where the mech stands |
UP | Move Forward | UP can be mixed with LEFT or RIGHT to turn running forward or with ACTION command (see ACTION description) |
DOWN | Move backward | To use with no other movement command excepting Action (see description of ACTION command. Mech warrior will move backward |
STEP LEFT | Move to left side | A step at left It's possible only from idle state or previous step left |
STEP RIGHT | Move to right side | A step at right It's possible only from idle state or previous step right |
LEFT | Turn itself at left | Used alone (no UP command) it will turn mechwarrior on itself turning at left on its axis |
RIGHT | Turn itself at right | Used alone (no UP command) it will turn mechwarrior on itself turning at right on its axis |
WALK | Proteced Moving | When you keep down WALK command while mech is moving it will be removed the risk to fall in the empty |