Add death text tests

This commit is contained in:
Lorenzo Carletti 2021-11-30 22:44:26 +01:00
parent 40dbb00b22
commit 3132e180cc
4 changed files with 43 additions and 7 deletions

View File

@ -22,7 +22,8 @@ void __attribute__((naked)) m2_sub_d3c50() {}
void __attribute__((naked)) m2_sub_d6844() {} void __attribute__((naked)) m2_sub_d6844() {}
byte __attribute__((naked)) m2_sub_daf84(short value) {} byte __attribute__((naked)) m2_sub_daf84(short value) {}
byte __attribute__((naked)) m2_battletext_loadstr(char* string) {} byte __attribute__((naked)) m2_battletext_loadstr(char* string) {}
void __attribute__((naked)) m2_set_enemy_name(int val) {} void __attribute__((naked)) m2_set_user_name(int val) {}
void __attribute__((naked)) m2_set_target_name() {}
int __attribute__((naked)) m2_setupwindow(WINDOW* window, short window_x, short window_y, short window_width, short window_height) {} int __attribute__((naked)) m2_setupwindow(WINDOW* window, short window_x, short window_y, short window_width, short window_height) {}
int __attribute__((naked)) m2_clearwindowtiles(WINDOW* window) {} int __attribute__((naked)) m2_clearwindowtiles(WINDOW* window) {}
void __attribute__((naked)) m2_printstr(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight) {} void __attribute__((naked)) m2_printstr(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight) {}

View File

@ -7,6 +7,7 @@ bool text_stayed_inside(WINDOW* window);
void test_encounter_text() void test_encounter_text()
{ {
m2_btl_user_ptr->is_enemy = true; m2_btl_user_ptr->is_enemy = true;
m2_btl_user_ptr->letter = 1;
for(int i = 1; i <= 3; i++) for(int i = 1; i <= 3; i++)
{ {
m2_btl_enemies_size = i; m2_btl_enemies_size = i;
@ -14,18 +15,49 @@ void test_encounter_text()
for(int j = 0; j <= 230; j++) for(int j = 0; j <= 230; j++)
{ {
m2_btl_user_ptr->id = j; m2_btl_user_ptr->id = j;
m2_set_enemy_name(1); m2_btl_user_ptr->enemy_id = j;
m2_set_user_name(1);
m2_battletext_loadstr(m2_enemies[j].encounter_text); m2_battletext_loadstr(m2_enemies[j].encounter_text);
if(m2_btl_enemies_size == 1) if(m2_btl_enemies_size == 1)
assert_message(text_stayed_inside(window_pointers[2]), "Enemy %d", j); assert_message(text_stayed_inside(window_pointers[2]), "Encounter text for Enemy %d", j);
else if (m2_btl_enemies_size == 2) else if (m2_btl_enemies_size == 2)
assert_message(text_stayed_inside(window_pointers[2]), "Enemy %d - cohort", j); assert_message(text_stayed_inside(window_pointers[2]), "Encounter text for Enemy %d - cohort", j);
else else
assert_message(text_stayed_inside(window_pointers[2]), "Enemy %d - cohorts", j); assert_message(text_stayed_inside(window_pointers[2]), "Encounter text for Enemy %d - cohorts", j);
} }
} }
} }
void test_death_text()
{
m2_btl_user_ptr->is_enemy = true;
m2_btl_enemies_size = 1;
m2_btl_user_ptr->letter = 1;
m2_btl_user_ptr->unknown_3[0] = 1;
for(int j = 0; j <= 230; j++)
{
m2_btl_user_ptr->id = j;
m2_btl_user_ptr->enemy_id = j;
m2_set_target_name();
m2_battletext_loadstr(m2_enemies[j].death_text);
assert_message(text_stayed_inside(window_pointers[2]), "Death text for Enemy %d", j);
}
m2_btl_user_ptr->letter = 0x17;
m2_btl_user_ptr->unknown_3[0] = 0;
for(int j = 0; j <= 230; j++)
{
m2_btl_user_ptr->id = j;
m2_btl_user_ptr->enemy_id = j;
m2_set_target_name();
m2_battletext_loadstr(m2_enemies[j].death_text);
assert_message(text_stayed_inside(window_pointers[2]), "Death text for Enemy %d - W", j);
}
}
bool text_stayed_inside(WINDOW* window) bool text_stayed_inside(WINDOW* window)
{ {
for(int i = 0; i < window->window_height; i++) for(int i = 0; i < window->window_height; i++)
@ -74,6 +106,7 @@ void setup_battle_tests()
void do_battle_tests() void do_battle_tests()
{ {
test_encounter_text(); test_encounter_text();
test_death_text();
} }
void start_battle_tests() void start_battle_tests()

View File

@ -15,4 +15,5 @@ extern short m2_is_battle;
extern byte m2_btl_enemies_size; extern byte m2_btl_enemies_size;
extern BATTLE_DATA* m2_btl_user_ptr; extern BATTLE_DATA* m2_btl_user_ptr;
extern BATTLE_DATA* m2_btl_target_ptr; extern BATTLE_DATA* m2_btl_target_ptr;
extern void m2_set_enemy_name(int val); extern void m2_set_user_name(int val);
extern void m2_set_target_name();

View File

@ -2407,7 +2407,8 @@ disclaimer_map:
.definelabel m2_sub_d6844 ,0x80D6844 .definelabel m2_sub_d6844 ,0x80D6844
.definelabel m2_sub_daf84 ,0x80DAF84 .definelabel m2_sub_daf84 ,0x80DAF84
.definelabel m2_battletext_loadstr ,0x80DB168 .definelabel m2_battletext_loadstr ,0x80DB168
.definelabel m2_set_enemy_name ,0x80DB04C .definelabel m2_set_user_name ,0x80DB04C
.definelabel m2_set_target_name ,0x80DAE00
.definelabel m2_setupbattlename ,0x80DCD00 .definelabel m2_setupbattlename ,0x80DCD00
.definelabel m2_stat_symb_checker ,0x8B0EDA4 .definelabel m2_stat_symb_checker ,0x8B0EDA4
.definelabel vblank ,0x80F47E4 .definelabel vblank ,0x80F47E4