Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
lakilester.c File Reference

Go to the source code of this file.

Macros

#define TEST_MOVE_AT_ANGLE(testFunc, angle)
 

Enumerations

enum  {
  RIDE_STATE_BEGIN = 40 , RIDE_STATE_DELAY = 41 , RIDE_STATE_MOUNT_1 = 100 , RIDE_STATE_MOUNT_2 = 101 ,
  RIDE_STATE_MOUNT_3 = 102 , RIDE_STATE_MOUNT_4 = 103 , RIDE_STATE_START_RIDING = 104 , RIDE_STATE_RIDING = 1 ,
  RIDE_STATE_DISMOUNT_1 = 3 , RIDE_STATE_DISMOUNT_2 = 4 , RIDE_STATE_DISMOUNT_3 = 5 , RIDE_STATE_FINISH_1 = 10 ,
  RIDE_STATE_FINISH_2 = 11
}
 
enum  {
  PUT_AWAY_DISMOUNT_1 = 0 , PUT_AWAY_DISMOUNT_2 = 1 , PUT_AWAY_DISMOUNT_3 = 2 , PUT_AWAY_FINISH_1 = 3 ,
  PUT_AWAY_FINISH_2 = 4 , PUT_AWAY_FINISH_3 = 5
}
 
enum  { MOUNT_STATE_NONE = 0 , MOUNT_STATE_IN_PROGRESS = 1 , MOUNT_STATE_DONE = 2 }
 

Functions

void N offset_player_from_camera (f32 arg0)
 
void N sync_player_position (void)
 
void N init (Npc *lakilester)
 
void N try_cancel_tweester (Npc *lakilester)
 
void N get_movement_from_input (f32 *outAngle, f32 *outSpeed)
 
s32 N can_dismount (void)
 
s32 N test_mounting_height_adjustment (Npc *lakilester, f32 height, f32 dist)
 
void N apply_riding_static_collisions (Npc *lakilester)
 
void N update_riding_physics (Npc *lakilester)
 
s32 N test_dismount_height (f32 *posY)
 
void N pre_battle (Npc *lakilester)
 
void N post_battle (Npc *lakilester)
 

Variables

EvtScript EVS_WorldLakilester_TakeOut
 
EvtScript EVS_WorldLakilester_Update
 
EvtScript EVS_WorldLakilester_UseAbility
 
EvtScript EVS_WorldLakilester_PutAway
 
EvtScript EVS_WorldLakilester_EnterMap
 

Macro Definition Documentation

◆ TEST_MOVE_AT_ANGLE

#define TEST_MOVE_AT_ANGLE ( testFunc,
angle )
Value:
( \
yaw = clamp_angle(angle), \
x = lakilester->pos.x, \
y = lakilester->moveToPos.y, \
z = lakilester->pos.z, \
testFunc(lakilester->collisionChannel, &x, &y, &z, 0.0f, yaw, lakilester->collisionHeight, radius) \
)
#define clamp_angle

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
RIDE_STATE_BEGIN 
RIDE_STATE_DELAY 
RIDE_STATE_MOUNT_1 
RIDE_STATE_MOUNT_2 
RIDE_STATE_MOUNT_3 
RIDE_STATE_MOUNT_4 
RIDE_STATE_START_RIDING 
RIDE_STATE_RIDING 
RIDE_STATE_DISMOUNT_1 
RIDE_STATE_DISMOUNT_2 
RIDE_STATE_DISMOUNT_3 
RIDE_STATE_FINISH_1 
RIDE_STATE_FINISH_2 

Definition at line 22 of file lakilester.c.

22 {
29 RIDE_STATE_START_RIDING = 104, // cannot dismount until this state is done
36};
@ RIDE_STATE_MOUNT_1
Definition lakilester.c:25
@ RIDE_STATE_START_RIDING
Definition lakilester.c:29
@ RIDE_STATE_DISMOUNT_1
Definition lakilester.c:31
@ RIDE_STATE_MOUNT_4
Definition lakilester.c:28
@ RIDE_STATE_DELAY
Definition lakilester.c:24
@ RIDE_STATE_BEGIN
Definition lakilester.c:23
@ RIDE_STATE_DISMOUNT_2
Definition lakilester.c:32
@ RIDE_STATE_FINISH_1
Definition lakilester.c:34
@ RIDE_STATE_RIDING
Definition lakilester.c:30
@ RIDE_STATE_MOUNT_3
Definition lakilester.c:27
@ RIDE_STATE_FINISH_2
Definition lakilester.c:35
@ RIDE_STATE_DISMOUNT_3
Definition lakilester.c:33
@ RIDE_STATE_MOUNT_2
Definition lakilester.c:26

◆ anonymous enum

anonymous enum
Enumerator
PUT_AWAY_DISMOUNT_1 
PUT_AWAY_DISMOUNT_2 
PUT_AWAY_DISMOUNT_3 
PUT_AWAY_FINISH_1 
PUT_AWAY_FINISH_2 
PUT_AWAY_FINISH_3 

Definition at line 39 of file lakilester.c.

39 {
46};
@ PUT_AWAY_FINISH_2
Definition lakilester.c:44
@ PUT_AWAY_FINISH_3
Definition lakilester.c:45
@ PUT_AWAY_DISMOUNT_3
Definition lakilester.c:42
@ PUT_AWAY_DISMOUNT_2
Definition lakilester.c:41
@ PUT_AWAY_FINISH_1
Definition lakilester.c:43
@ PUT_AWAY_DISMOUNT_1
Definition lakilester.c:40

◆ anonymous enum

anonymous enum
Enumerator
MOUNT_STATE_NONE 
MOUNT_STATE_IN_PROGRESS 
MOUNT_STATE_DONE 

Definition at line 48 of file lakilester.c.

48 {
52};
@ MOUNT_STATE_IN_PROGRESS
Definition lakilester.c:50
@ MOUNT_STATE_DONE
Definition lakilester.c:51
@ MOUNT_STATE_NONE
Definition lakilester.c:49

Function Documentation

◆ offset_player_from_camera()

void N offset_player_from_camera ( f32 arg0)

Definition at line 1168 of file lakilester.c.

1168 {
1169 Camera* currentCamera = &gCameras[gCurrentCameraID];
1170 PlayerStatus* playerStatus = &gPlayerStatus;
1171
1172 add_vec2D_polar(&playerStatus->pos.x, &playerStatus->pos.z, speed, currentCamera->curYaw);
1173}
void add_vec2D_polar(f32 *x, f32 *y, f32 r, f32 theta)
Definition 43F0.c:685
Camera gCameras[4]
Definition cam_main.c:17
PlayerStatus gPlayerStatus
Definition 77480.c:39
s32 gCurrentCameraID
Definition cam_math.c:4

◆ sync_player_position()

void N sync_player_position ( void )

Definition at line 56 of file lakilester.c.

56 {
57 PlayerStatus* playerStatus = &gPlayerStatus;
58 Npc* lakilester = get_npc_unsafe(NPC_PARTNER);
59 f32 speed;
60
61 if (playerStatus->flags & PS_FLAG_CUTSCENE_MOVEMENT) {
62 speed = playerStatus->curSpeed;
63 if (playerStatus->flags & PS_FLAG_ENTERING_BATTLE) {
64 speed *= 0.5f;
65 }
66
67 add_vec2D_polar(&lakilester->pos.x, &lakilester->pos.z, speed, playerStatus->heading);
68 lakilester->yaw = playerStatus->targetYaw;
69 }
70
71 playerStatus->pos.x = lakilester->pos.x;
72 playerStatus->pos.y = lakilester->pos.y + 10.0f + abs(N(PlayerBounceOffset)) * 0.34f;
73 playerStatus->pos.z = lakilester->pos.z;
74 add_vec2D_polar(&playerStatus->pos.x, &playerStatus->pos.z, 2.0f, gCameras[gCurrentCameraID].curYaw);
75}
@ PS_FLAG_ENTERING_BATTLE
Definition enums.h:3061
@ PS_FLAG_CUTSCENE_MOVEMENT
Definition enums.h:3054
@ NPC_PARTNER
Definition enums.h:2528
Npc * get_npc_unsafe(s32 npcID)
Definition npc.c:995
Vec3f pos

◆ init()

void N init ( Npc * lakilester)

Definition at line 77 of file lakilester.c.

77 {
78 lakilester->collisionHeight = 38;
79 lakilester->collisionDiameter = 36;
81 N(PlayerBounceOffset) = 0;
82 N(LockingPlayerInput) = FALSE;
83 N(PlayerCollisionDisabled) = FALSE;
84 N(MountState) = MOUNT_STATE_NONE;
85 N(UpdatePushingWall) = TRUE;
86 N(MoveSoundsTime) = 0;
87 N(MovePitchAdjustment) = 0;
88 N(MountingDeltaY) = 0;
89 N(CurrentGroundPitch) = 0;
90 lakilester->moveToPos.x = lakilester->pos.x;
91 lakilester->moveToPos.y = lakilester->pos.y;
92 lakilester->moveToPos.z = lakilester->pos.z;
93}
@ COLLIDER_FLAG_IGNORE_PLAYER
Definition enums.h:4696
s16 collisionDiameter
Vec3f moveToPos
s32 collisionChannel
s16 collisionHeight

◆ try_cancel_tweester()

void N try_cancel_tweester ( Npc * lakilester)

Definition at line 206 of file lakilester.c.

206 {
207 if (TweesterTouchingPartner != NULL) {
209 lakilester->flags = N(TweesterPhysicsPtr)->prevFlags;
210 N(TweesterPhysicsPtr)->state = TWEESTER_PARTNER_INIT;
212 }
213}
@ TWEESTER_PARTNER_INIT
Definition enums.h:2475
void partner_clear_player_tracking(Npc *partner)
Definition partners.c:2436
s32 flags
Entity * TweesterTouchingPartner
Definition 7B440.c:5

◆ get_movement_from_input()

void N get_movement_from_input ( f32 * outAngle,
f32 * outSpeed )

Definition at line 215 of file lakilester.c.

215 {
216 PartnerStatus* partnerStatus = &gPartnerStatus;
217 f32 stickX = partnerStatus->stickX;
218 f32 stickY = partnerStatus->stickY;
219 f32 moveAngle = clamp_angle(atan2(0.0f, 0.0f, stickX, -stickY) + gCameras[CAM_DEFAULT].curYaw);
220 f32 moveSpeed = 0.0f;
221
222 if (dist2D(0.0f, 0.0f, stickX, -stickY) >= 1.0) {
223 moveSpeed = 3.0f;
224 if (SQ(stickX) + SQ(stickY) > SQ(55)) {
225 moveSpeed = 6.0f;
226 }
227 }
228
229 *outAngle = moveAngle;
230 *outSpeed = moveSpeed;
231}
#define atan2
@ CAM_DEFAULT
Definition enums.h:1800
f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by)
Definition 43F0.c:670
#define SQ(x)
Definition macros.h:166
PartnerStatus gPartnerStatus
Definition partners.c:42

Referenced by update_riding_physics().

◆ can_dismount()

s32 N can_dismount ( void )

Definition at line 233 of file lakilester.c.

233 {
234 PlayerStatus* playerStatus = &gPlayerStatus;
235 Camera* currentCamera;
236 f32 hitDirX, hitDirZ;
237 f32 hitRx, hitRz;
238 f32 outX, outY, outZ, outLength;
239 Npc* lakilester = get_npc_unsafe(NPC_PARTNER);
240 s32 temp;
241 HitID hitID;
242 s32 canDismount;
243 s32 entityType;
244
245 if (playerStatus->animFlags & PA_FLAG_DISMOUNTING_ALLOWED) {
246 playerStatus->animFlags &= ~PA_FLAG_DISMOUNTING_ALLOWED;
247 return TRUE;
248 }
249
250 canDismount = FALSE;
251 outLength = 16.0f;
252 outY = lakilester->moveToPos.y + 7.0f;
253 outX = playerStatus->pos.x;
254 outZ = playerStatus->pos.z;
255 currentCamera = &gCameras[gCurrentCameraID];
256 add_vec2D_polar(&outX, &outZ, 2.0f, currentCamera->curYaw);
257 hitID = player_raycast_below_cam_relative(playerStatus, &outX, &outY, &outZ, &outLength, &hitRx, &hitRz,
258 &hitDirX, &hitDirZ);
259 temp = hitID;
260
261 //TODO find better match
262 if (outLength <= 16.0f && temp > NO_COLLIDER) {
263 if (!(temp & COLLISION_WITH_ENTITY_BIT) ||
264 (entityType = get_entity_type(temp),
265 !(entityType == ENTITY_TYPE_SIMPLE_SPRING || entityType == ENTITY_TYPE_SCRIPT_SPRING))
266 ) {
267 temp = get_collider_flags(temp) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; //TODO 'temp' is now 'surfaceType'
268 if (!(temp == SURFACE_TYPE_WATER || temp == SURFACE_TYPE_SPIKES || temp == SURFACE_TYPE_LAVA)) {
269 if (temp != SURFACE_TYPE_SLIDE) {
270 lakilester->moveToPos.x = outX;
271 lakilester->moveToPos.y = outY;
272 lakilester->moveToPos.z = outZ;
273 canDismount = TRUE;
274 }
275 }
276 }
277 }
278 return canDismount;
279}
s32 HitID
@ SURFACE_TYPE_WATER
Definition enums.h:4671
@ SURFACE_TYPE_SLIDE
Definition enums.h:4675
@ SURFACE_TYPE_LAVA
Definition enums.h:4673
@ SURFACE_TYPE_SPIKES
Definition enums.h:4672
@ COLLIDER_FLAGS_SURFACE_TYPE_MASK
Definition enums.h:4693
@ ENTITY_TYPE_SCRIPT_SPRING
Definition enums.h:2584
@ ENTITY_TYPE_SIMPLE_SPRING
Definition enums.h:2583
@ PA_FLAG_DISMOUNTING_ALLOWED
Definition enums.h:3123
HitID player_raycast_below_cam_relative(PlayerStatus *playerStatus, f32 *outX, f32 *outY, f32 *outZ, f32 *outLength, f32 *hitRx, f32 *hitRz, f32 *hitDirX, f32 *hitDirZ)
Definition 77480.c:193
s32 get_collider_flags(s32 colliderID)
Definition collision.c:481
u32 get_entity_type(s32 arg0)
Definition entity.c:568
#define COLLISION_WITH_ENTITY_BIT
Definition macros.h:152
#define NO_COLLIDER
Definition macros.h:156

◆ test_mounting_height_adjustment()

s32 N test_mounting_height_adjustment ( Npc * lakilester,
f32 height,
f32 dist )

Definition at line 282 of file lakilester.c.

282 {
283 f32 x = gPlayerStatus.pos.x;
284 f32 y = gPlayerStatus.pos.y + height;
285 f32 z = gPlayerStatus.pos.z;
286 f32 depth = dist;
287 f32 hitRx, hitRz;
288 f32 hitDirX, hitDirZ;
289 f32 deltaY;
290
291 N(MountingDeltaY) = 0;
292
293 if (player_raycast_below_cam_relative(&gPlayerStatus, &x, &y, &z, &depth,
294 &hitRx, &hitRz, &hitDirX, &hitDirZ) > NO_COLLIDER)
295 {
296 deltaY = y - lakilester->moveToPos.y;
297 if (deltaY != 0.0f) {
298 if (fabs(deltaY) < 10.0) {
299 N(MountingDeltaY) = deltaY;
300 lakilester->moveToPos.y = y;
301 return TRUE;
302 } else {
303 return FALSE;
304 }
305 }
306 return TRUE;
307 }
308 return FALSE;
309}
f64 fabs(f64 f)

◆ apply_riding_static_collisions()

void N apply_riding_static_collisions ( Npc * lakilester)

Definition at line 312 of file lakilester.c.

312 {
313 f32 radius = lakilester->collisionDiameter * 0.8f;
314 f32 x, y, z, yaw;
315
316 // combine testing boilerplate
317 #define TEST_MOVE_AT_ANGLE(testFunc, angle) \
318 ( \
319 yaw = clamp_angle(angle), \
320 x = lakilester->pos.x, \
321 y = lakilester->moveToPos.y, \
322 z = lakilester->pos.z, \
323 testFunc(lakilester->collisionChannel, &x, &y, &z, 0.0f, yaw, lakilester->collisionHeight, radius) \
324 )
325
328 lakilester->curWall = NpcHitQueryColliderID;
329 lakilester->pos.x = x;
330 lakilester->pos.z = z;
331 } else {
333 }
334
336 lakilester->pos.x = x;
337 lakilester->pos.z = z;
338 lakilester->flags |= NPC_FLAG_COLLDING_WITH_WORLD;
339 } else {
340 lakilester->flags &= ~NPC_FLAG_COLLDING_WITH_WORLD;
341 }
342
344 lakilester->pos.x = x;
345 lakilester->pos.z = z;
346 lakilester->flags |= NPC_FLAG_COLLDING_WITH_WORLD;
347 } else {
348 lakilester->flags &= ~NPC_FLAG_COLLDING_WITH_WORLD;
349 }
350
351 if (TEST_MOVE_AT_ANGLE(npc_test_move_simple_with_slipping, lakilester->yaw + 45.0f + 180.0f)) {
352 lakilester->flags |= NPC_FLAG_COLLDING_WITH_WORLD;
353 lakilester->pos.x = x;
354 lakilester->pos.z = z;
355 } else {
356 lakilester->flags &= ~NPC_FLAG_COLLDING_WITH_WORLD;
357 }
358
359 if (TEST_MOVE_AT_ANGLE(npc_test_move_simple_with_slipping, lakilester->yaw - 45.0f + 180.0f)) {
360 lakilester->flags |= NPC_FLAG_COLLDING_WITH_WORLD;
361 lakilester->pos.x = x;
362 lakilester->pos.z = z;
363 } else {
364 lakilester->flags &= ~NPC_FLAG_COLLDING_WITH_WORLD;
365 }
366}
@ NPC_FLAG_COLLDING_FORWARD_WITH_WORLD
Definition enums.h:3012
@ NPC_FLAG_COLLDING_WITH_WORLD
Definition enums.h:3011
s32 npc_test_move_complex_with_slipping(s32, f32 *, f32 *, f32 *, f32, f32, f32, f32)
b32 npc_test_move_simple_with_slipping(s32, f32 *, f32 *, f32 *, f32, f32, f32, f32)
b32 npc_test_move_taller_with_slipping(s32, f32 *, f32 *, f32 *, f32, f32, f32, f32)
s16 curWall
s32 NpcHitQueryColliderID
#define TEST_MOVE_AT_ANGLE(testFunc, angle)

Referenced by update_riding_physics().

◆ update_riding_physics()

void N update_riding_physics ( Npc * lakilester)

Definition at line 368 of file lakilester.c.

368 {
369 PlayerStatus* playerStatus = &gPlayerStatus;
370 CollisionStatus* collisionStatus = &gCollisionStatus;
371 PartnerStatus* partnerStatus = &gPartnerStatus;
372 f32 hitDepth, sp40, sp44, sp48, sp4C, sinAngle, cosAngle;
373 f32 moveAngle, moveSpeed;
374 f32 x, y, z;
375 f32 temp_f0_3;
376 s32 raycastBelowResult;
377 s32 currentSurfaceType;
378 s32 belowSurfaceType;
379 s32 pitchShift;
380 f32 height;
381
382 moveAngle = 0.0f;
383 moveSpeed = 0.0f;
384 N(get_movement_from_input)(&moveAngle, &moveSpeed);
385
386 currentSurfaceType = get_collider_flags(lakilester->curFloor) & COLLIDER_FLAGS_SURFACE_TYPE_MASK;
387 if (currentSurfaceType == SURFACE_TYPE_LAVA) {
388 moveSpeed *= 0.5f;
389 }
390
391 if (N(CurrentGroundPitch) >= 20.0f) {
392 moveSpeed *= 0.8f;
393 }
394
395 lakilester->moveSpeed = moveSpeed;
396
397 if (moveSpeed != 0.0f) {
398 N(MoveSoundsTime)++;
399 N(MovePitchAdjustment)++;
400 if (N(MoveSoundsTime) % 8 == 0) {
401 if (N(MovePitchAdjustment) >= 120) {
402 N(MovePitchAdjustment) = 0;
403 }
404
405 if (N(MovePitchAdjustment) < 60) {
406 pitchShift = update_lerp(EASING_LINEAR, 0.0f, 100.0f, N(MovePitchAdjustment), 60);
407 sfx_play_sound_with_params(SOUND_FLIGHT, 0, 64, pitchShift);
408 } else {
409 pitchShift = update_lerp(EASING_LINEAR, 100.0f, 0.0f, N(MovePitchAdjustment) - 60, 60);
410 sfx_play_sound_with_params(SOUND_FLIGHT, 0, 64, pitchShift);
411 }
412 }
413 }
414
415 x = lakilester->pos.x;
416 y = lakilester->moveToPos.y;
417 z = lakilester->pos.z;
418
419 if (npc_test_move_taller_with_slipping(lakilester->collisionChannel, &x, &y, &z,
420 lakilester->collisionDiameter, lakilester->yaw, lakilester->collisionHeight, lakilester->collisionDiameter))
421 {
422 collisionStatus->curInspect = (partnerStatus->pressedButtons & BUTTON_A) ? NpcHitQueryColliderID : NO_COLLIDER;
423 }
424
425 if (moveSpeed != 0.0f) {
426 lakilester->yaw = moveAngle;
427 x = lakilester->pos.x;
428 y = lakilester->moveToPos.y;
429 z = lakilester->pos.z;
430 if (npc_test_move_complex_with_slipping(lakilester->collisionChannel, &x, &y, &z,
431 lakilester->moveSpeed, lakilester->yaw, lakilester->collisionHeight, lakilester->collisionDiameter))
432 {
433 if (N(UpdatePushingWall)) {
434 collisionStatus->pushingAgainstWall = NpcHitQueryColliderID;
435 }
436 lakilester->pos.x += (x - lakilester->pos.x) / 5.0f;
437 lakilester->pos.z += (z - lakilester->pos.z) / 5.0f;
438 } else {
439 npc_move_heading(lakilester, lakilester->moveSpeed, moveAngle);
440 if (N(UpdatePushingWall)) {
441 collisionStatus->pushingAgainstWall = NO_COLLIDER;
442 }
443 }
444
445 moveAngle = clamp_angle(lakilester->yaw - 30.0f);
446 x = lakilester->pos.x;
447 y = lakilester->moveToPos.y;
448 z = lakilester->pos.z;
449 if (npc_test_move_taller_with_slipping(lakilester->collisionChannel, &x, &y, &z,
450 lakilester->moveSpeed, moveAngle, lakilester->collisionHeight, lakilester->collisionDiameter))
451 {
452 lakilester->pos.x += (x - lakilester->pos.x) / 5.0f;
453 lakilester->pos.z += (z - lakilester->pos.z) / 5.0f;
454 }
455
456 moveAngle = clamp_angle(lakilester->yaw + 30.0f);
457 x = lakilester->pos.x;
458 y = lakilester->moveToPos.y;
459 z = lakilester->pos.z;
460 if (npc_test_move_taller_with_slipping(lakilester->collisionChannel, &x, &y, &z,
461 lakilester->moveSpeed, moveAngle, lakilester->collisionHeight, lakilester->collisionDiameter))
462 {
463 lakilester->pos.x += (x - lakilester->pos.x) / 5.0f;
464 lakilester->pos.z += (z - lakilester->pos.z) / 5.0f;
465 }
466
468
469 } else {
470 moveAngle = 90.0f;
471 x = lakilester->pos.x;
472 y = lakilester->moveToPos.y;
473 z = lakilester->pos.z;
474 if (npc_test_move_taller_with_slipping(lakilester->collisionChannel, &x, &y, &z,
475 4.0f, moveAngle, lakilester->collisionHeight, lakilester->collisionDiameter))
476 {
477 lakilester->pos.x += (x - lakilester->pos.x) / 5.0f;
478 lakilester->pos.z += (z - lakilester->pos.z) / 5.0f;
479 }
480
481 moveAngle = 270.0f;
482 x = lakilester->pos.x;
483 y = lakilester->moveToPos.y;
484 z = lakilester->pos.z;
485 if (npc_test_move_taller_with_slipping(lakilester->collisionChannel, &x, &y, &z,
486 4.0f, moveAngle, lakilester->collisionHeight, lakilester->collisionDiameter))
487 {
488 lakilester->pos.x += (x - lakilester->pos.x) / 5.0f;
489 lakilester->pos.z += (z - lakilester->pos.z) / 5.0f;
490 }
491 }
492
493 N(apply_riding_static_collisions)(lakilester);
494 lakilester->moveToPos.y -= lakilester->jumpScale;
495 hitDepth = lakilester->collisionHeight + 2;
496 y = lakilester->moveToPos.y + 12.0f;
497 x = playerStatus->pos.x;
498 z = playerStatus->pos.z;
499 add_vec2D_polar(&x, &z, 2.0f, gCameras[gCurrentCameraID].curYaw);
500 raycastBelowResult = player_raycast_below_cam_relative(playerStatus, &x, &y, &z, &hitDepth, &sp40,
501 &sp44, &sp48, &sp4C);
502 N(CurrentGroundPitch) = get_player_normal_pitch();
503 height = 12.0f;
504
505 if (N(CurrentGroundPitch) != 0.0f) {
506 height = 32.0f;
507 }
508
509 if (N(CurrentGroundPitch) > 0.0f && raycastBelowResult >= 0) {
510 sin_cos_rad(DEG_TO_RAD(N(CurrentGroundPitch)), &sinAngle, &cosAngle);
511 lakilester->pos.y = (lakilester->pos.y + fabs((sinAngle / cosAngle) * playerStatus->runSpeed));
512 }
513
514 if (hitDepth <= height && raycastBelowResult > NO_COLLIDER) {
515 playerStatus->lastGoodPos.x = lakilester->pos.x;
516 playerStatus->lastGoodPos.y = lakilester->pos.y;
517 playerStatus->lastGoodPos.z = lakilester->pos.z;
518 collisionStatus->curFloor = raycastBelowResult;
519
520 lakilester->curFloor = raycastBelowResult;
521 lakilester->moveToPos.y = y;
522 lakilester->moveToPos.x = x;
523 lakilester->moveToPos.z = z;
524 lakilester->jumpScale = 0.0f;
525 playerStatus->timeInAir = 0;
526
527 belowSurfaceType = get_collider_flags(raycastBelowResult) & COLLIDER_FLAGS_SURFACE_TYPE_MASK;
528 if (belowSurfaceType == SURFACE_TYPE_LAVA) {
529 lakilester->curAnim = ANIM_WorldLakilester_StrainWalk;
530 lakilester->moveSpeed = moveSpeed * 0.5f;
531 } else {
532 lakilester->curAnim = ANIM_WorldLakilester_Walk;
533 lakilester->moveSpeed = moveSpeed;
534 }
535 return;
536 }
537
538 collisionStatus->curFloor = NO_COLLIDER;
539 playerStatus->timeInAir++;
540 lakilester->curFloor = NO_COLLIDER;
541 lakilester->jumpScale += 1.8;
542
543 if (lakilester->jumpScale > 12.0f) {
544 lakilester->jumpScale = 12.0f;
545 }
546}
@ BUTTON_A
Definition enums.h:2790
@ EASING_LINEAR
Definition enums.h:510
@ SOUND_FLIGHT
Definition enums.h:1012
@ SURFACE_INTERACT_RUN
Definition enums.h:4685
f32 update_lerp(s32 easing, f32 start, f32 end, s32 elapsed, s32 duration)
Definition 43F0.c:735
f32 get_player_normal_pitch(void)
Definition 43F0.c:662
void sin_cos_rad(f32 rad, f32 *outSinTheta, f32 *outCosTheta)
Definition 43F0.c:706
void npc_surface_spawn_fx(Npc *npc, SurfaceInteractMode mode)
Definition surfaces.c:394
void npc_move_heading(Npc *npc, f32 speed, f32 yaw)
Definition npc.c:986
void sfx_play_sound_with_params(s32 soundID, u8 volume, u8 pan, s16 pitchShift)
Definition sfx.c:458
#define DEG_TO_RAD(deg)
Definition macros.h:134
f32 jumpScale
AnimID curAnim
s16 curFloor
f32 moveSpeed
CollisionStatus gCollisionStatus
Definition 7BB60.c:6
void N get_movement_from_input(f32 *outAngle, f32 *outSpeed)
Definition lakilester.c:215
void N apply_riding_static_collisions(Npc *lakilester)
Definition lakilester.c:312

◆ test_dismount_height()

s32 N test_dismount_height ( f32 * posY)

Definition at line 579 of file lakilester.c.

579 {
580 f32 colliderHeight = gPlayerStatus.colliderHeight;
581 f32 hitDirX, hitDirZ;
582 f32 hitRx, hitRz;
583 f32 posX, posZ;
584
585 *posY = gPlayerStatus.pos.y + colliderHeight;
586 posX = gPlayerStatus.pos.x;
587 posZ = gPlayerStatus.pos.z;
588
589 return player_raycast_below_cam_relative(&gPlayerStatus, &posX, posY, &posZ,
590 &colliderHeight, &hitRx, &hitRz, &hitDirX, &hitDirZ);
591}

◆ pre_battle()

void N pre_battle ( Npc * lakilester)

Definition at line 1136 of file lakilester.c.

1136 {
1137 PartnerStatus* partnerStatus = &gPartnerStatus;
1138
1139 if (N(MountState) != MOUNT_STATE_NONE) {
1140 partnerStatus->npc = *lakilester;
1141 partnerStatus->shouldResumeAbility = TRUE;
1146 }
1147
1148 partnerStatus->actingPartner = PARTNER_LAKILESTER;
1149 N(PlayerBounceOffset) = 0;
1150}
@ PARTNER_LAKILESTER
Definition enums.h:2893
@ ACTION_STATE_IDLE
Definition enums.h:2426
s32 enable_player_input(void)
Definition 77480.c:998
void set_action_state(s32 actionState)
Definition 7E9D0.c:209
s32 enable_player_static_collisions(void)
Definition 77480.c:980

◆ post_battle()

void N post_battle ( Npc * lakilester)

Definition at line 1152 of file lakilester.c.

1152 {
1153 PartnerStatus* partnerStatus = &gPartnerStatus;
1154
1155 if (partnerStatus->shouldResumeAbility) {
1156 if (N(MountState) != MOUNT_STATE_NONE) {
1157 *lakilester = partnerStatus->npc;
1160 partnerStatus->actingPartner = PARTNER_NONE;
1161 partnerStatus->partnerActionState = PARTNER_ACTION_NONE;
1164 }
1165 }
1166}
s32 partner_use_ability(void)
Definition partners.c:964
b8 keepUsingPartnerOnMapChange
@ PARTNER_ACTION_NONE
Definition enums.h:2932
@ PARTNER_NONE
Definition enums.h:2885
@ ACTION_STATE_RIDE
Definition enums.h:2461
s32 disable_player_input(void)
Definition 77480.c:990
GameStatus * gGameStatusPtr
Definition main_loop.c:32

Variable Documentation

◆ EVS_WorldLakilester_TakeOut

EvtScript EVS_WorldLakilester_TakeOut
Initial value:
= {
Call(N(TakeOut))
}
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:213
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
Definition macros.h:576
#define Return
Kills the current EVT thread.
Definition macros.h:217

Definition at line 109 of file lakilester.c.

109 {
110 Call(N(TakeOut))
111 Return
112 End
113};

◆ EVS_WorldLakilester_Update

EvtScript EVS_WorldLakilester_Update
Initial value:
= {
Call(N(Update))
}

Definition at line 200 of file lakilester.c.

200 {
201 Call(N(Update))
202 Return
203 End
204};

◆ EVS_WorldLakilester_UseAbility

EvtScript EVS_WorldLakilester_UseAbility
Initial value:
= {
Call(N(UseAbility))
}

Definition at line 992 of file lakilester.c.

992 {
993 Call(N(UseAbility))
994 Return
995 End
996};

◆ EVS_WorldLakilester_PutAway

EvtScript EVS_WorldLakilester_PutAway
Initial value:
= {
Call(N(PutAway))
}

Definition at line 1130 of file lakilester.c.

1130 {
1131 Call(N(PutAway))
1132 Return
1133 End
1134};

◆ EVS_WorldLakilester_EnterMap

EvtScript EVS_WorldLakilester_EnterMap
Initial value:
= {
Call(N(EnterMap))
}

Definition at line 1260 of file lakilester.c.

1260 {
1261 Call(N(EnterMap))
1262 Return
1263 End
1264};