You've already forked HackerSM64
mirror of
https://github.com/HackerN64/HackerSM64.git
synced 2026-01-21 10:35:32 -08:00
Klepto and Unagi have transparent stars after they are collected
This commit is contained in:
@@ -252,14 +252,14 @@ extern const Gfx sand_seg3_dl_0302BCD0[];
|
||||
// star
|
||||
extern const GeoLayout star_geo[];
|
||||
extern const Gfx star_seg3_dl_0302B7B0[];
|
||||
extern const Gfx star_seg3_dl_0302B870[];
|
||||
extern const Gfx star_seg3_dl_body[];
|
||||
extern const Gfx star_seg3_dl_0302B9C0[];
|
||||
extern const Gfx star_seg3_dl_0302BA18[];
|
||||
extern const Gfx star_seg3_dl_eyes[];
|
||||
|
||||
// transparent_star
|
||||
extern const GeoLayout transparent_star_geo[];
|
||||
extern const Gfx transparent_star_seg3_dl_0302C560[];
|
||||
extern const Gfx transparent_star_seg3_dl_0302C620[];
|
||||
extern const Gfx transparent_star_seg3_dl_body[];
|
||||
|
||||
// tree
|
||||
extern const GeoLayout bubbly_tree_geo[];
|
||||
|
||||
@@ -26,8 +26,8 @@ const GeoLayout klepto_geo[] = {
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_SWITCH_CASE(4, geo_switch_anim_state),
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_NODE_START(),
|
||||
GEO_NODE_START(),
|
||||
GEO_NODE_START(), // KLEPTO_ANIM_STATE_HOLDING_NOTHING
|
||||
GEO_NODE_START(), // KLEPTO_ANIM_STATE_HOLDING_CAP
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_SCALE(0x00, 16384),
|
||||
GEO_OPEN_NODE(),
|
||||
@@ -35,22 +35,22 @@ const GeoLayout klepto_geo[] = {
|
||||
GEO_TRANSLATE_ROTATE_WITH_DL(LAYER_OPAQUE, 0, 100, 0, 180, 270, 0, mario_cap_seg3_dl_03022F48),
|
||||
GEO_CLOSE_NODE(),
|
||||
GEO_CLOSE_NODE(),
|
||||
GEO_NODE_START(),
|
||||
GEO_NODE_START(), // KLEPTO_ANIM_STATE_HOLDING_STAR
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_SCALE(0x00, 16384),
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_ASM(0, geo_offset_klepto_held_object),
|
||||
GEO_TRANSLATE_ROTATE_WITH_DL(LAYER_OCCLUDE_SILHOUETTE_OPAQUE, 0, 100, 0, 180, 270, 0, star_seg3_dl_0302B870),
|
||||
GEO_TRANSLATE_ROTATE_WITH_DL(LAYER_OCCLUDE_SILHOUETTE_OPAQUE, 0, 100, 0, 180, 270, 0, star_seg3_dl_body),
|
||||
GEO_ASM(0, geo_offset_klepto_held_object),
|
||||
GEO_TRANSLATE_ROTATE_WITH_DL(LAYER_OCCLUDE_SILHOUETTE_ALPHA, 0, 100, 0, 180, 270, 0, star_seg3_dl_0302BA18),
|
||||
GEO_TRANSLATE_ROTATE_WITH_DL(LAYER_OCCLUDE_SILHOUETTE_ALPHA, 0, 100, 0, 180, 270, 0, star_seg3_dl_eyes),
|
||||
GEO_CLOSE_NODE(),
|
||||
GEO_CLOSE_NODE(),
|
||||
GEO_NODE_START(),
|
||||
GEO_NODE_START(), // KLEPTO_ANIM_STATE_HOLDING_TRANSPARENT_STAR
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_SCALE(0x00, 16384),
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_ASM(0, geo_offset_klepto_held_object),
|
||||
GEO_TRANSLATE_ROTATE_WITH_DL(LAYER_OCCLUDE_SILHOUETTE_OPAQUE, 0, 100, 0, 180, 270, 0, transparent_star_seg3_dl_0302C620),
|
||||
GEO_TRANSLATE_ROTATE_WITH_DL(LAYER_OCCLUDE_SILHOUETTE_OPAQUE, 0, 100, 0, 180, 270, 0, transparent_star_seg3_dl_body),
|
||||
GEO_CLOSE_NODE(),
|
||||
GEO_CLOSE_NODE(),
|
||||
GEO_CLOSE_NODE(),
|
||||
|
||||
@@ -4,8 +4,8 @@ const GeoLayout star_geo[] = {
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_SCALE(0x00, 16384),
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_OPAQUE, star_seg3_dl_0302B870),
|
||||
GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, star_seg3_dl_0302BA18),
|
||||
GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_OPAQUE, star_seg3_dl_body),
|
||||
GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, star_seg3_dl_eyes),
|
||||
GEO_CLOSE_NODE(),
|
||||
GEO_CLOSE_NODE(),
|
||||
GEO_END(),
|
||||
|
||||
@@ -51,7 +51,7 @@ const Gfx star_seg3_dl_0302B7B0[] = {
|
||||
};
|
||||
|
||||
// 0x0302B870 - 0x0302B908
|
||||
const Gfx star_seg3_dl_0302B870[] = {
|
||||
const Gfx star_seg3_dl_body[] = {
|
||||
gsDPPipeSync(),
|
||||
gsSPSetGeometryMode(G_TEXTURE_GEN),
|
||||
gsDPSetEnvColor(255, 255, 255, 255),
|
||||
@@ -101,7 +101,7 @@ const Gfx star_seg3_dl_0302B9C0[] = {
|
||||
};
|
||||
|
||||
// 0x0302BA18 - 0x0302BA88
|
||||
const Gfx star_seg3_dl_0302BA18[] = {
|
||||
const Gfx star_seg3_dl_eyes[] = {
|
||||
gsDPPipeSync(),
|
||||
gsDPSetCombineMode(G_CC_MODULATERGBA, G_CC_MODULATERGBA),
|
||||
gsSPClearGeometryMode(G_SHADING_SMOOTH),
|
||||
|
||||
@@ -4,7 +4,7 @@ const GeoLayout transparent_star_geo[] = {
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_SCALE(0x00, 16384),
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_DISPLAY_LIST(LAYER_TRANSPARENT, transparent_star_seg3_dl_0302C620),
|
||||
GEO_DISPLAY_LIST(LAYER_TRANSPARENT, transparent_star_seg3_dl_body),
|
||||
GEO_CLOSE_NODE(),
|
||||
GEO_CLOSE_NODE(),
|
||||
GEO_END(),
|
||||
|
||||
@@ -41,7 +41,7 @@ const Gfx transparent_star_seg3_dl_0302C560[] = {
|
||||
};
|
||||
|
||||
// 0x0302C620 - 0x0302C658
|
||||
const Gfx transparent_star_seg3_dl_0302C620[] = {
|
||||
const Gfx transparent_star_seg3_dl_body[] = {
|
||||
gsDPPipeSync(),
|
||||
gsDPSetCombineMode(G_CC_SHADEFADEA, G_CC_SHADEFADEA),
|
||||
gsDPSetEnvColor(255, 255, 255, 120),
|
||||
|
||||
@@ -14,15 +14,22 @@ const GeoLayout unagi_geo[] = {
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_ANIMATED_PART(LAYER_OPAQUE, 475, 0, 0, unagi_seg5_dl_0500D828),
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_SWITCH_CASE(2, geo_switch_anim_state),
|
||||
GEO_SWITCH_CASE(3, geo_switch_anim_state),
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_NODE_START(),
|
||||
GEO_NODE_START(),
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_SCALE(0x00, 16384),
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_TRANSLATE_ROTATE_WITH_DL(LAYER_OCCLUDE_SILHOUETTE_OPAQUE, 2000, 0, 0, 0, 0, 0, star_seg3_dl_0302B870),
|
||||
GEO_TRANSLATE_ROTATE_WITH_DL(LAYER_OCCLUDE_SILHOUETTE_ALPHA, 2000, 0, 0, 0, 0, 0, star_seg3_dl_0302BA18),
|
||||
GEO_TRANSLATE_ROTATE_WITH_DL(LAYER_OCCLUDE_SILHOUETTE_OPAQUE, 2000, 0, 0, 0, 0, 0, star_seg3_dl_body),
|
||||
GEO_TRANSLATE_ROTATE_WITH_DL(LAYER_OCCLUDE_SILHOUETTE_ALPHA, 2000, 0, 0, 0, 0, 0, star_seg3_dl_eyes),
|
||||
GEO_CLOSE_NODE(),
|
||||
GEO_CLOSE_NODE(),
|
||||
GEO_NODE_START(),
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_SCALE(LAYER_FORCE, 16384),
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_TRANSLATE_ROTATE_WITH_DL(LAYER_TRANSPARENT, 2000, 0, 0, 0, 0, 0, transparent_star_seg3_dl_body),
|
||||
GEO_CLOSE_NODE(),
|
||||
GEO_CLOSE_NODE(),
|
||||
GEO_CLOSE_NODE(),
|
||||
|
||||
@@ -74,13 +74,14 @@ static void klepto_anim_dive(void) {
|
||||
}
|
||||
|
||||
void bhv_klepto_init(void) {
|
||||
if (o->oBehParams2ndByte != 0) {
|
||||
o->oAnimState = KLEPTO_ANIM_STATE_HOLDING_STAR;
|
||||
if (o->oBehParams2ndByte != KLEPTO_BP_NO_STAR) {
|
||||
if (save_file_get_star_flags((gCurrSaveFileNum - 1), (COURSE_SSL - 1)) & STAR_FLAG_ACT_1) {
|
||||
o->oAnimState = KLEPTO_ANIM_STATE_HOLDING_TRANSPARENT_STAR;
|
||||
} else {
|
||||
o->oAnimState = KLEPTO_ANIM_STATE_HOLDING_STAR;
|
||||
}
|
||||
} else {
|
||||
o->oKleptoStartPosX = o->oPosX;
|
||||
o->oKleptoStartPosY = o->oPosY;
|
||||
o->oKleptoStartPosZ = o->oPosZ;
|
||||
|
||||
vec3_copy(&o->oKleptoStartPosVec, &o->oPosVec);
|
||||
if (save_file_get_flags() & SAVE_FLAG_CAP_ON_KLEPTO) {
|
||||
o->oAnimState = KLEPTO_ANIM_STATE_HOLDING_CAP;
|
||||
} else {
|
||||
@@ -92,8 +93,7 @@ void bhv_klepto_init(void) {
|
||||
static void klepto_change_target(void) {
|
||||
s32 newTarget = 0;
|
||||
s32 i;
|
||||
f32 dx;
|
||||
f32 dz;
|
||||
f32 dx, dz;
|
||||
f32 targetDist;
|
||||
f32 minTargetDist;
|
||||
|
||||
|
||||
@@ -13,17 +13,21 @@ struct ObjectHitbox sUnagiHitbox = {
|
||||
};
|
||||
|
||||
void bhv_unagi_init(void) {
|
||||
if (o->oBehParams2ndByte != 1) {
|
||||
if (o->oBehParams2ndByte != UNAGI_BP_IN_CAVE) {
|
||||
o->oPathedStartWaypoint = segmented_to_virtual(jrb_seg7_trajectory_unagi_1);
|
||||
if (o->oBehParams2ndByte == 0) {
|
||||
o->oFaceAnglePitch = -7600;
|
||||
if (o->oBehParams2ndByte == UNAGI_BP_IN_SHIP) {
|
||||
o->oFaceAnglePitch = -0x1DB0;
|
||||
} else {
|
||||
o->oAction = 1;
|
||||
o->oAction = UNAGI_ACT_SHIP_PATH;
|
||||
}
|
||||
} else {
|
||||
o->oPathedStartWaypoint = segmented_to_virtual(jrb_seg7_trajectory_unagi_2);
|
||||
o->oAction = 3;
|
||||
o->oAnimState = 1;
|
||||
o->oAction = UNAGI_ACT_IN_CAVE;
|
||||
if (save_file_get_star_flags((gCurrSaveFileNum - 1), COURSE_JRB) & STAR_FLAG_ACT_2) {
|
||||
o->oAnimState = UNAGI_ANIM_STATE_HAS_TRANSPARENT_STAR;
|
||||
} else {
|
||||
o->oAnimState = UNAGI_ANIM_STATE_HAS_STAR;
|
||||
}
|
||||
|
||||
o->oUnagiInitMoveYaw = o->oMoveAngleYaw;
|
||||
}
|
||||
@@ -32,27 +36,25 @@ void bhv_unagi_init(void) {
|
||||
}
|
||||
|
||||
void unagi_act_0(void) {
|
||||
if (o->oDistanceToMario > 4500.0f && o->oSubAction != 0) {
|
||||
o->oAction = 1;
|
||||
o->oPosX = o->oPathedStartWaypoint->pos[0];
|
||||
o->oPosY = o->oPathedStartWaypoint->pos[1];
|
||||
o->oPosZ = o->oPathedStartWaypoint->pos[2];
|
||||
if (o->oDistanceToMario > 4500.0f && o->oSubAction != UNAGI_SUB_ACT_SHIP_RESET_PATH_WAIT_FOR_MARIO) {
|
||||
o->oAction = UNAGI_ACT_SHIP_PATH;
|
||||
vec3_copy(&o->oPosVec, o->oPathedStartWaypoint->pos);
|
||||
} else if (o->oUnagiDistanceToMario < 700.0f) {
|
||||
o->oSubAction = 1;
|
||||
o->oSubAction = UNAGI_SUB_ACT_SHIP_RESET_PATH_DO_RESET;
|
||||
}
|
||||
}
|
||||
|
||||
void unagi_act_1_4(s32 arg0) {
|
||||
void unagi_act_1_4(s32 nextAction) {
|
||||
if (o->oSoundStateID == 3) {
|
||||
if (cur_obj_check_anim_frame(30)) {
|
||||
o->oForwardVel = 40.0f;
|
||||
}
|
||||
} else {
|
||||
if (cur_obj_check_if_at_animation_end()) {
|
||||
if (o->oAction != arg0 && (o->oPathedPrevWaypointFlags & 0xFF) >= 7) {
|
||||
cur_obj_init_animation_with_sound(3);
|
||||
if (o->oAction != nextAction && (o->oPathedPrevWaypointFlags & 0xFF) >= 7) {
|
||||
cur_obj_init_animation_with_sound(UNAGI_ANIM_STATIC_STRAIGHT);
|
||||
} else {
|
||||
cur_obj_init_animation_with_sound(2);
|
||||
cur_obj_init_animation_with_sound(UNAGI_ANIM_SWIM);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,8 +63,8 @@ void unagi_act_1_4(s32 arg0) {
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_MOVING_WATER);
|
||||
}
|
||||
|
||||
if (cur_obj_follow_path(0) == -1) {
|
||||
o->oAction = arg0;
|
||||
if (cur_obj_follow_path(0) == PATH_REACHED_END) {
|
||||
o->oAction = nextAction;
|
||||
}
|
||||
|
||||
o->oMoveAnglePitch = o->oFaceAnglePitch =
|
||||
@@ -89,19 +91,19 @@ void unagi_act_2(void) {
|
||||
|
||||
o->oUnagiDistFromHome = -800.0f;
|
||||
|
||||
o->oAction = 3;
|
||||
o->oAction = UNAGI_ACT_IN_CAVE;
|
||||
}
|
||||
|
||||
void unagi_act_3(void) {
|
||||
if (o->oUnagiDistFromHome < 0.0f) {
|
||||
cur_obj_init_animation_with_sound(6);
|
||||
cur_obj_init_animation_with_sound(UNAGI_ANIM_IDLE_2);
|
||||
|
||||
if ((o->oUnagiDistFromHome += 10.0f) > 0.0f) {
|
||||
o->oUnagiDistFromHome = 0.0f;
|
||||
}
|
||||
} else {
|
||||
if (o->oUnagiDistFromHome == 0.0f) {
|
||||
cur_obj_init_animation_with_sound(6);
|
||||
cur_obj_init_animation_with_sound(UNAGI_ANIM_IDLE_2);
|
||||
|
||||
if (o->oTimer > 60 && o->oUnagiDistanceToMario < 1000.0f) {
|
||||
cur_obj_play_sound_2(SOUND_OBJ_EEL_2);
|
||||
@@ -110,19 +112,19 @@ void unagi_act_3(void) {
|
||||
o->oUnagiTargetNextForwardVel = 0.0f;
|
||||
}
|
||||
} else if (o->oUnagiTargetNextForwardVel > 0.0f) {
|
||||
if (cur_obj_init_anim_and_check_if_end(5)) {
|
||||
if (cur_obj_init_anim_and_check_if_end(UNAGI_ANIM_OPEN_MOUTH)) {
|
||||
o->oUnagiTargetNextForwardVel = 0.0f;
|
||||
}
|
||||
} else if (o->oUnagiTargetNextForwardVel == 0.0f) {
|
||||
cur_obj_init_animation_with_sound(0);
|
||||
cur_obj_init_animation_with_sound(UNAGI_ANIM_YAWN);
|
||||
if (cur_obj_check_if_at_animation_end()) {
|
||||
if (o->oUnagiDistanceToMario < 1000.0f) {
|
||||
o->oAction = 4;
|
||||
o->oAction = UNAGI_ACT_CAVE_PATH;
|
||||
o->oForwardVel = o->oUnagiNextForwardVel;
|
||||
cur_obj_init_animation_with_sound(1);
|
||||
cur_obj_init_animation_with_sound(UNAGI_ANIM_BITE);
|
||||
} else {
|
||||
o->oUnagiTargetNextForwardVel = -50.0f;
|
||||
cur_obj_init_animation_with_sound(4);
|
||||
cur_obj_init_animation_with_sound(UNAGI_ANIM_IDLE_2_1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -142,33 +144,33 @@ void unagi_act_3(void) {
|
||||
void bhv_unagi_loop(void) {
|
||||
s32 i;
|
||||
|
||||
if (o->oUnagiHasStar == 0) {
|
||||
if (!o->oUnagiHasStar) {
|
||||
o->oUnagiDistanceToMario = 99999.0f;
|
||||
if (o->oDistanceToMario < 3000.0f) {
|
||||
for (i = -4; i < 4; i++) {
|
||||
for (i = UNAGI_PART_BP_BACK; i < UNAGI_PART_BP_FRONT; i++) {
|
||||
spawn_object_relative(i, 0, 0, 0, o, MODEL_NONE, bhvUnagiSubobject);
|
||||
}
|
||||
o->oUnagiHasStar = 1;
|
||||
o->oUnagiHasStar = TRUE;
|
||||
}
|
||||
} else if (o->oDistanceToMario > 4000.0f) {
|
||||
o->oUnagiHasStar = 0;
|
||||
o->oUnagiHasStar = FALSE;
|
||||
}
|
||||
|
||||
switch (o->oAction) {
|
||||
case 0:
|
||||
case UNAGI_ACT_SHIP_RESET_PATH:
|
||||
unagi_act_0();
|
||||
break;
|
||||
case 1:
|
||||
case UNAGI_ACT_SHIP_PATH:
|
||||
unagi_act_1_4(o->oAction);
|
||||
break;
|
||||
case 2:
|
||||
case UNAGI_ACT_RETURN_TO_CAVE:
|
||||
unagi_act_2();
|
||||
// fall through
|
||||
case 3:
|
||||
case UNAGI_ACT_IN_CAVE:
|
||||
unagi_act_3();
|
||||
break;
|
||||
case 4:
|
||||
unagi_act_1_4(2);
|
||||
case UNAGI_ACT_CAVE_PATH:
|
||||
unagi_act_1_4(UNAGI_ACT_RETURN_TO_CAVE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -176,7 +178,7 @@ void bhv_unagi_loop(void) {
|
||||
void bhv_unagi_subobject_loop(void) {
|
||||
f32 offset;
|
||||
|
||||
if (o->parentObj->oUnagiHasStar == 0) {
|
||||
if (!o->parentObj->oUnagiHasStar) {
|
||||
obj_mark_for_deletion(o);
|
||||
} else {
|
||||
offset = 300.0f * o->oBehParams2ndByte;
|
||||
@@ -188,15 +190,15 @@ void bhv_unagi_subobject_loop(void) {
|
||||
o->oPosX = o->parentObj->oPosX + offset * sins(o->parentObj->oFaceAngleYaw);
|
||||
o->oPosZ = o->parentObj->oPosZ + offset * coss(o->parentObj->oFaceAngleYaw);
|
||||
|
||||
if (o->oBehParams2ndByte == -4) {
|
||||
if (o->parentObj->oAnimState != 0 && o->oDistanceToMario < 150.0f) {
|
||||
if (o->oBehParams2ndByte == UNAGI_PART_BP_BACK) {
|
||||
if (o->parentObj->oAnimState != UNAGI_ANIM_STATE_NO_STAR && o->oDistanceToMario < 150.0f) {
|
||||
o->oBehParams = o->parentObj->oBehParams;
|
||||
spawn_default_star(6833.0f, -3654.0f, 2230.0f);
|
||||
o->parentObj->oAnimState = 0;
|
||||
o->parentObj->oAnimState = UNAGI_ANIM_STATE_NO_STAR;
|
||||
}
|
||||
} else {
|
||||
obj_check_attacks(&sUnagiHitbox, o->oAction);
|
||||
if (o->oBehParams2ndByte == 3) {
|
||||
if (o->oBehParams2ndByte == UNAGI_PART_BP_CONTROL_DISTANCE) {
|
||||
o->parentObj->oUnagiDistanceToMario = o->oDistanceToMario;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,6 +140,16 @@ extern s8 gLevelToCourseNumTable[];
|
||||
#define SAVE_FLAG_COLLECTED_MIPS_STAR_1 /* 0x08000000 */ (1 << 27)
|
||||
#define SAVE_FLAG_COLLECTED_MIPS_STAR_2 /* 0x10000000 */ (1 << 28)
|
||||
|
||||
#define STAR_FLAGS_NONE (0 << 0) // 0x00
|
||||
#define STAR_FLAG_ACT_1 (1 << 0) // 0x01
|
||||
#define STAR_FLAG_ACT_2 (1 << 1) // 0x02
|
||||
#define STAR_FLAG_ACT_3 (1 << 2) // 0x04
|
||||
#define STAR_FLAG_ACT_4 (1 << 3) // 0x08
|
||||
#define STAR_FLAG_ACT_5 (1 << 4) // 0x10
|
||||
#define STAR_FLAG_ACT_6 (1 << 5) // 0x20
|
||||
#define STAR_FLAG_ACT_100_COINS (1 << 6) // 0x40
|
||||
#define STAR_FLAG_LAST STAR_FLAG_ACT_100_COINS
|
||||
|
||||
#define SAVE_FLAG_TO_STAR_FLAG(cmd) (((cmd) >> 24) & 0x7F)
|
||||
#define STAR_FLAG_TO_SAVE_FLAG(cmd) ((cmd) << 24)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user