mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 21:45:12 +00:00
Lives/Game over fix, exposed initiate_warp() and improved enemy lakitu (#143)
This commit is contained in:
parent
1dab06f476
commit
f1c2715fe7
7 changed files with 100 additions and 31 deletions
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Behavior for bhvEnemyLakitu.
|
||||
* Lakitu comes before it spawned spinies in processing order.
|
||||
* TODO: bhvCloud processing oredr
|
||||
* TODO: bhvCloud processing order
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -24,11 +24,16 @@ static struct ObjectHitbox sEnemyLakituHitbox = {
|
|||
* Wait for mario to approach, then spawn the cloud and become visible.
|
||||
*/
|
||||
static void enemy_lakitu_act_uninitialized(void) {
|
||||
struct Object *player = nearest_player_to_object(o);
|
||||
s32 distanceToPlayer = dist_between_objects(o, player);
|
||||
|
||||
if (distanceToPlayer < 2000.0f) {
|
||||
spawn_object_relative_with_scale(CLOUD_BP_LAKITU_CLOUD, 0, 0, 0, 2.0f, o, MODEL_MIST, bhvCloud);
|
||||
|
||||
cur_obj_unhide();
|
||||
o->oAction = ENEMY_LAKITU_ACT_MAIN;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Accelerate toward mario vertically.
|
||||
|
|
|
@ -411,11 +411,6 @@ void init_mario_after_warp(void) {
|
|||
init_door_warp(&gPlayerSpawnInfos[i], sWarpDest.arg);
|
||||
}
|
||||
|
||||
// set to a minimum of two lives on level change
|
||||
if (sWarpDest.type == WARP_TYPE_CHANGE_LEVEL) {
|
||||
gMarioStates[i].numLives = max(gMarioStates[i].numLives, 2);
|
||||
}
|
||||
|
||||
if (sWarpDest.type == WARP_TYPE_CHANGE_LEVEL || sWarpDest.type == WARP_TYPE_CHANGE_AREA) {
|
||||
gPlayerSpawnInfos[i].areaIndex = sWarpDest.areaIdx;
|
||||
// reset health
|
||||
|
@ -667,6 +662,10 @@ void check_instant_warp(void) {
|
|||
}
|
||||
|
||||
s16 music_changed_through_warp(s16 arg) {
|
||||
if (arg == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
struct ObjectWarpNode *warpNode = area_get_warp_node(arg);
|
||||
s16 levelNum = warpNode->node.destLevel & 0x7F;
|
||||
|
||||
|
@ -842,12 +841,9 @@ s16 level_trigger_warp(struct MarioState *m, s32 warpOp) {
|
|||
break;
|
||||
|
||||
case WARP_OP_DEATH:
|
||||
if (m->numLives < 2) {
|
||||
m->numLives = 2;
|
||||
}
|
||||
/*if (m->numLives == 0) {
|
||||
if (m->numLives <= 0) {
|
||||
sDelayedWarpOp = WARP_OP_GAME_OVER;
|
||||
}*/
|
||||
}
|
||||
sDelayedWarpTimer = 48;
|
||||
sSourceWarpNodeId = WARP_NODE_DEATH;
|
||||
play_transition(WARP_TRANSITION_FADE_INTO_BOWSER, 0x30, 0x00, 0x00, 0x00);
|
||||
|
@ -863,11 +859,11 @@ s16 level_trigger_warp(struct MarioState *m, s32 warpOp) {
|
|||
case WARP_OP_WARP_FLOOR:
|
||||
sSourceWarpNodeId = WARP_NODE_WARP_FLOOR;
|
||||
if (area_get_warp_node(sSourceWarpNodeId) == NULL) {
|
||||
/*if (m->numLives == 0) {
|
||||
if (m->numLives <= 0) {
|
||||
sDelayedWarpOp = WARP_OP_GAME_OVER;
|
||||
} else {*/
|
||||
} else {
|
||||
sSourceWarpNodeId = WARP_NODE_DEATH;
|
||||
//}
|
||||
}
|
||||
}
|
||||
sDelayedWarpTimer = 20;
|
||||
play_transition(WARP_TRANSITION_FADE_INTO_CIRCLE, 0x14, 0x00, 0x00, 0x00);
|
||||
|
@ -960,8 +956,9 @@ void initiate_delayed_warp(void) {
|
|||
} else {
|
||||
switch (sDelayedWarpOp) {
|
||||
case WARP_OP_GAME_OVER:
|
||||
save_file_reload();
|
||||
warp_special(-3);
|
||||
gChangeLevel = gLevelValues.entryLevel;
|
||||
gMarioStates[0].numLives = 3;
|
||||
gMarioStates[0].health = 0x880;
|
||||
break;
|
||||
|
||||
case WARP_OP_CREDITS_END:
|
||||
|
@ -1341,7 +1338,11 @@ s32 update_level(void) {
|
|||
changeLevel = play_mode_normal();
|
||||
break;
|
||||
case PLAY_MODE_PAUSED:
|
||||
#ifndef DEVELOPMENT
|
||||
#ifdef DEVELOPMENT
|
||||
if (configDisableDevPause) {
|
||||
changeLevel = play_mode_normal();
|
||||
}
|
||||
#else
|
||||
changeLevel = play_mode_normal();
|
||||
#endif
|
||||
if (sCurrPlayMode == PLAY_MODE_PAUSED) {
|
||||
|
|
|
@ -1360,7 +1360,7 @@ s32 act_death_exit(struct MarioState *m) {
|
|||
play_character_sound(m, CHAR_SOUND_OOOF2);
|
||||
#endif
|
||||
queue_rumble_data_mario(m, 5, 80);
|
||||
//m->numLives--;
|
||||
m->numLives--;
|
||||
// restore 7.75 units of health
|
||||
m->healCounter = 31;
|
||||
}
|
||||
|
@ -1376,7 +1376,7 @@ s32 act_unused_death_exit(struct MarioState *m) {
|
|||
#else
|
||||
play_character_sound(m, CHAR_SOUND_OOOF2);
|
||||
#endif
|
||||
//m->numLives--;
|
||||
m->numLives--;
|
||||
// restore 7.75 units of health
|
||||
m->healCounter = 31;
|
||||
}
|
||||
|
@ -1393,7 +1393,7 @@ s32 act_falling_death_exit(struct MarioState *m) {
|
|||
play_character_sound(m, CHAR_SOUND_OOOF2);
|
||||
#endif
|
||||
queue_rumble_data_mario(m, 5, 80);
|
||||
//m->numLives--;
|
||||
m->numLives--;
|
||||
// restore 7.75 units of health
|
||||
m->healCounter = 31;
|
||||
}
|
||||
|
@ -1438,7 +1438,7 @@ s32 act_special_death_exit(struct MarioState *m) {
|
|||
|
||||
if (launch_mario_until_land(m, ACT_HARD_BACKWARD_GROUND_KB, MARIO_ANIM_BACKWARD_AIR_KB, -24.0f)) {
|
||||
queue_rumble_data_mario(m, 5, 80);
|
||||
//m->numLives--;
|
||||
m->numLives--;
|
||||
m->healCounter = 31;
|
||||
}
|
||||
// show Mario
|
||||
|
|
|
@ -137,6 +137,9 @@ bool configUncappedFramerate = true;
|
|||
unsigned int configFrameLimit = 60;
|
||||
unsigned int configDrawDistance = 5;
|
||||
bool configDisablePopups = 0;
|
||||
#ifdef DEVELOPMENT
|
||||
bool configDisableDevPause = 1;
|
||||
#endif
|
||||
bool configDisableDownloadedModels = 0;
|
||||
unsigned int configInterpolationMode = 1;
|
||||
unsigned int configGamepadNumber = 0;
|
||||
|
@ -220,6 +223,9 @@ static const struct ConfigOption options[] = {
|
|||
{.name = "coop_stay_in_level_after_star", .type = CONFIG_TYPE_UINT , .uintValue = &configStayInLevelAfterStar},
|
||||
{.name = "share_lives", .type = CONFIG_TYPE_BOOL , .boolValue = &configShareLives},
|
||||
{.name = "disable_popups", .type = CONFIG_TYPE_BOOL , .boolValue = &configDisablePopups},
|
||||
#ifdef DEVELOPMENT
|
||||
{.name = "disable_devpause", .type = CONFIG_TYPE_BOOL , .boolValue = &configDisableDevPause},
|
||||
#endif
|
||||
{.name = "disable_downloaded_models", .type = CONFIG_TYPE_BOOL , .boolValue = &configDisableDownloadedModels},
|
||||
{.name = "interpolation_mode", .type = CONFIG_TYPE_UINT , .uintValue = &configInterpolationMode},
|
||||
{.name = "gamepad_number", .type = CONFIG_TYPE_UINT , .uintValue = &configGamepadNumber},
|
||||
|
|
|
@ -93,6 +93,9 @@ extern bool configUncappedFramerate;
|
|||
extern unsigned int configFrameLimit;
|
||||
extern unsigned int configDrawDistance;
|
||||
extern bool configDisablePopups;
|
||||
#ifdef DEVELOPMENT
|
||||
extern bool configDisableDevPause;
|
||||
#endif
|
||||
extern bool configDisableDownloadedModels;
|
||||
extern unsigned int configInterpolationMode;
|
||||
|
||||
|
|
|
@ -6,9 +6,36 @@ void djui_panel_options_back(struct DjuiBase* caller) {
|
|||
configfile_save(configfile_name());
|
||||
djui_panel_menu_back(caller);
|
||||
}
|
||||
#ifdef DEVELOPMENT
|
||||
void djui_panel_options_debug_create(struct DjuiBase* caller) {
|
||||
f32 bodyHeight = 32 * 4 + 64 * 1 + 16 * 1;
|
||||
|
||||
struct DjuiBase* defaultBase = NULL;
|
||||
struct DjuiThreePanel* panel = djui_panel_menu_create(bodyHeight, "\\#ff0800\\D\\#1be700\\E\\#00b3ff\\B\\#ffef00\\U\\#ff0800\\G");
|
||||
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel);
|
||||
|
||||
{
|
||||
struct DjuiCheckbox* checkbox1 = djui_checkbox_create(&body->base, "Disable Development Pause", &configDisableDevPause);
|
||||
djui_base_set_size_type(&checkbox1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&checkbox1->base, 1.0f, 32);
|
||||
|
||||
struct DjuiButton* button2 = djui_button_create(&body->base, "Back");
|
||||
djui_base_set_size_type(&button2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&button2->base, 1.0f, 64);
|
||||
djui_button_set_style(button2, 1);
|
||||
djui_interactable_hook_click(&button2->base, djui_panel_menu_back);
|
||||
}
|
||||
|
||||
djui_panel_add(caller, &panel->base, defaultBase);
|
||||
}
|
||||
#endif
|
||||
|
||||
void djui_panel_options_create(struct DjuiBase* caller) {
|
||||
#ifdef DEVELOPMENT
|
||||
f32 bodyHeight = 64 * 7 + 16 * 6;
|
||||
#else
|
||||
f32 bodyHeight = 64 * 6 + 16 * 5;
|
||||
#endif
|
||||
|
||||
struct DjuiBase* defaultBase = NULL;
|
||||
struct DjuiThreePanel* panel = djui_panel_menu_create(bodyHeight, "\\#ff0800\\O\\#1be700\\P\\#00b3ff\\T\\#ffef00\\I\\#ff0800\\O\\#1be700\\N\\#00b3ff\\S");
|
||||
|
@ -42,12 +69,20 @@ void djui_panel_options_create(struct DjuiBase* caller) {
|
|||
djui_base_set_size_type(&button5->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&button5->base, 1.0f, 64);
|
||||
djui_interactable_hook_click(&button5->base, djui_panel_sound_create);
|
||||
|
||||
struct DjuiButton* button6 = djui_button_create(&body->base, "Back");
|
||||
#ifdef DEVELOPMENT
|
||||
struct DjuiButton* button6 = djui_button_create(&body->base, "Debug");
|
||||
djui_base_set_size_type(&button6->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&button6->base, 1.0f, 64);
|
||||
djui_button_set_style(button6, 1);
|
||||
djui_interactable_hook_click(&button6->base, djui_panel_options_back);
|
||||
djui_interactable_hook_click(&button6->base, djui_panel_options_debug_create);
|
||||
#endif
|
||||
|
||||
struct DjuiButton* button7 = djui_button_create(&body->base, "Back");
|
||||
djui_base_set_size_type(&button7->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&button7->base, 1.0f, 64);
|
||||
djui_button_set_style(button7, 1);
|
||||
djui_interactable_hook_click(&button7->base, djui_panel_options_back);
|
||||
|
||||
|
||||
}
|
||||
|
||||
djui_panel_add(caller, &panel->base, defaultBase);
|
||||
|
|
|
@ -79,6 +79,24 @@ int smlua_func_init_mario_after_warp(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_initiate_warp(lua_State* L) {
|
||||
if(!smlua_functions_valid_param_count(L, 4)) { return 0; }
|
||||
|
||||
s16 destLevel = smlua_to_number(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1"); return 0; }
|
||||
s16 destArea = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2"); return 0; }
|
||||
s16 destWarpNode = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3"); return 0; }
|
||||
s32 arg3 = smlua_to_number(L, 4);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4"); return 0; }
|
||||
|
||||
extern void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 arg3);
|
||||
initiate_warp(destLevel, destArea, destWarpNode, arg3);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_reset_level(lua_State* L) {
|
||||
if (network_player_connected_count() >= 2) {
|
||||
LOG_LUA_LINE("This function can only be used in single-player");
|
||||
|
@ -339,6 +357,7 @@ void smlua_bind_functions(void) {
|
|||
smlua_bind_function(L, "coss", smlua_func_coss);
|
||||
smlua_bind_function(L, "atan2s", smlua_func_atan2s);
|
||||
smlua_bind_function(L, "init_mario_after_warp", smlua_func_init_mario_after_warp);
|
||||
smlua_bind_function(L, "initiate_warp", smlua_func_initiate_warp);
|
||||
smlua_bind_function(L, "network_init_object", smlua_func_network_init_object);
|
||||
smlua_bind_function(L, "network_send_object", smlua_func_network_send_object);
|
||||
smlua_bind_function(L, "reset_level", smlua_func_reset_level);
|
||||
|
|
Loading…
Reference in a new issue