Skip to content

Commit

Permalink
FF7: Fix Barret's eyebrow not loading
Browse files Browse the repository at this point in the history
Fixes #107
  • Loading branch information
julianxhokaxhiu committed Oct 30, 2022
1 parent 0582d91 commit 8b25cb9
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

## FF7

- Core: Fix Barret's eyebrow not loading ( https://github.com/julianxhokaxhiu/FFNx/issues/107 )
- 60FPS: Fix fading speed in FIELD mode screen transitions ( https://github.com/julianxhokaxhiu/FFNx/pull/503 )
- Renderer: Fixed graphical glitch happening in battle when 3d models rendered in front of UI ( https://github.com/julianxhokaxhiu/FFNx/issues/131 )
- Voice: Add play voice for enemy actions during BATTLE mode ( https://github.com/julianxhokaxhiu/FFNx/pull/502 )
Expand Down
1 change: 1 addition & 0 deletions src/ff7.h
Original file line number Diff line number Diff line change
Expand Up @@ -2354,6 +2354,7 @@ struct ff7_externals
uint32_t load_animation;
uint32_t field_load_animation;
uint32_t field_load_models;
uint32_t field_models_eye_to_model;
uint32_t field_models_eye_blink_buffer;
uint32_t field_sub_60DCED;
void (*destroy_animation)(struct anim_header *);
Expand Down
1 change: 1 addition & 0 deletions src/ff7/field/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ namespace ff7::field
void field_update_scripted_bg_movement();
bool ff7_field_do_draw_3d_model(short x, short y);
void ff7_field_set_fade_quad_size(int x, int y, int width, int height);
int ff7_field_models_eye_to_model(char* model_name);
}
28 changes: 28 additions & 0 deletions src/ff7/field/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,4 +253,32 @@ namespace ff7::field

model_event_data.animation_speed = original_animation_speed;
}

int ff7_field_models_eye_to_model(char* model_name)
{
if ( !_strcmpi(model_name, "AAAA") ) // Cloud
return 0;
if ( !_strcmpi(model_name, "ACGD") ) // Barret
return 3;
if ( !_strcmpi(model_name, "AAGB") ) // Tifa
return 1;
if ( !_strcmpi(model_name, "ADDA") ) // Red XIII
return 4;
if ( !_strcmpi(model_name, "ABDA") ) // Cid
return 5;
if ( !_strcmpi(model_name, "ABJB") ) // Yuffie
return 7;
if ( !_strcmpi(model_name, "AEBC") ) // Cait Sith
return 8;
if ( !_strcmpi(model_name, "AEHD") ) // Vincent
return 6;
if ( !_strcmpi(model_name, "AUFF") ) // Aerith
return 2;
if ( !_strcmpi(model_name, "CAHC") ) // Aerith
return 2;
if ( !_strcmpi(model_name, "FQCB") ) // Young Barret
return 3;

return 9; // Defaults to Cloud eye
}
}
1 change: 1 addition & 0 deletions src/ff7/field/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@ namespace ff7::field
void ff7_field_update_models_rotation_new();
void ff7_field_blink_3d_model(field_animation_data* anim_data, field_model_blink_data* blink_data);
void ff7_field_update_model_animation_frame(short model_id);
int ff7_field_models_eye_to_model(char* model_name);
}
1 change: 1 addition & 0 deletions src/ff7_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ void ff7_find_externals(struct ff7_game_obj* game_object)

ff7_externals.field_sub_60DCED = get_relative_call(field_main_loop, 0x37A);
ff7_externals.field_load_models = get_relative_call(ff7_externals.field_sub_60DCED, 0x168);
ff7_externals.field_models_eye_to_model = get_relative_call(ff7_externals.field_load_models, 0xA79);
ff7_externals.field_load_animation = get_relative_call(ff7_externals.field_load_models, 0x8DF);
ff7_externals.load_animation = get_relative_call(ff7_externals.field_load_animation, 0x16D);
ff7_externals.destroy_animation = (void (*)(anim_header*))get_relative_call(ff7_externals.load_animation, 0x162);
Expand Down
5 changes: 5 additions & 0 deletions src/ff7_opengl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,11 @@ void ff7_init_hooks(struct game_obj *_game_object)
// Field FPS fix (60FPS, 30FPS movies)
ff7::field::ff7_field_hook_init();

// ##########################
// field eye to model mapping
// ##########################
replace_function(ff7_externals.field_models_eye_to_model, ff7::field::ff7_field_models_eye_to_model);

// #####################
// red XIII eye blinking
// #####################
Expand Down

0 comments on commit 8b25cb9

Please sign in to comment.