Merge pull request #149 from Lorenzooone/testing_branch
Add death text tests
This commit is contained in:
commit
01c80662df
|
@ -18,9 +18,33 @@ typedef struct BATTLE_DATA {
|
||||||
} BATTLE_DATA;
|
} BATTLE_DATA;
|
||||||
|
|
||||||
typedef struct ENEMY_DATA {
|
typedef struct ENEMY_DATA {
|
||||||
byte unknown[0x14];
|
/* 0 */ byte unk0[6];
|
||||||
char* encounter_text;
|
/* 6 */ unsigned short hp;
|
||||||
byte unknown_2[0x28];
|
/* 8 */ unsigned short pp;
|
||||||
|
/* A */ byte unkA[2];
|
||||||
|
/* C */ unsigned int exp;
|
||||||
|
/* 10 */ unsigned short money;
|
||||||
|
/* 12 */ unsigned short overworldAnim;
|
||||||
|
/* 14 */ char *encounter_text;
|
||||||
|
/* 18 */ char *death_text;
|
||||||
|
/* 1C */ byte palette;
|
||||||
|
/* 1D */ byte level;
|
||||||
|
/* 1E */ byte bgm;
|
||||||
|
/* 1F */ byte offense;
|
||||||
|
/* 20 */ byte defense;
|
||||||
|
/* 21 */ byte unk21;
|
||||||
|
/* 22 */ byte speed;
|
||||||
|
/* 23 */ byte guts;
|
||||||
|
/* 24 */ byte luck;
|
||||||
|
/* 25 */ byte unk25[3];
|
||||||
|
/* 28 */ unsigned short actions[4];
|
||||||
|
/* 30 */ unsigned short finalAction;
|
||||||
|
/* 32 */ unsigned short actionArgs[4];
|
||||||
|
/* 3A */ byte unk3A[2];
|
||||||
|
/* 3C */ byte unk3C;
|
||||||
|
/* 3D */ byte itemDropped;
|
||||||
|
/* 3E */ byte unk3E;
|
||||||
|
/* 3F */ byte mirrorSuccess;
|
||||||
} ENEMY_DATA;
|
} ENEMY_DATA;
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -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) {}
|
||||||
|
|
|
@ -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++)
|
||||||
|
@ -64,15 +96,17 @@ void setup_battle_tests()
|
||||||
setup_king_name();
|
setup_king_name();
|
||||||
m2_is_battle = 1;
|
m2_is_battle = 1;
|
||||||
(*(byte*)(0x3005050)) = 0xFF;
|
(*(byte*)(0x3005050)) = 0xFF;
|
||||||
(*(short*)(0x30023DC)) = 0; //Default delay between prints
|
(*(short*)(0x30023DC)) = 0; // Default delay between prints
|
||||||
(*(int*)(0x3005220)) = 0x2028820;
|
(*(int*)(0x3005220)) = 0x2028820;
|
||||||
*tilemap_pointer= (unsigned short*)0x2028018;
|
*tilemap_pointer= (unsigned short*)0x2028018;
|
||||||
|
(*(unsigned short*)(0x500001E)) = 0x7FFF; // Make it so it's easy to check what's being written
|
||||||
m2_script_readability = false;
|
m2_script_readability = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
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()
|
||||||
|
|
|
@ -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();
|
|
@ -6,10 +6,24 @@ void start_tests()
|
||||||
{
|
{
|
||||||
start_session();
|
start_session();
|
||||||
|
|
||||||
|
blank_memory();
|
||||||
start_battle_tests();
|
start_battle_tests();
|
||||||
|
|
||||||
|
blank_memory();
|
||||||
|
|
||||||
end_session();
|
end_session();
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
vblank();
|
vblank();
|
||||||
|
}
|
||||||
|
|
||||||
|
void blank_memory()
|
||||||
|
{
|
||||||
|
int blank_value = 0;
|
||||||
|
cpufastset(&blank_value, (void*)EWRAM, CPUFASTSET_FILL | (EWRAM_SIZE >> 2));
|
||||||
|
cpufastset(&blank_value, (void*)IWRAM, CPUFASTSET_FILL | (IWRAM_SIZE >> 3));
|
||||||
|
cpufastset(&blank_value, (void*)IO, CPUFASTSET_FILL | (IO_SIZE >> 2));
|
||||||
|
cpufastset(&blank_value, (void*)PALETTES, CPUFASTSET_FILL | (PALETTES_SIZE >> 2));
|
||||||
|
cpufastset(&blank_value, (void*)VRAM, CPUFASTSET_FILL | (VRAM_SIZE >> 2));
|
||||||
|
cpufastset(&blank_value, (void*)OBJECTS, CPUFASTSET_FILL | (OBJECTS_SIZE >> 2));
|
||||||
}
|
}
|
|
@ -1,5 +1,21 @@
|
||||||
#include "debug_printf/test_print.h"
|
#include "debug_printf/test_print.h"
|
||||||
|
|
||||||
void start_tests();
|
#define CPUFASTSET_FILL (0x1000000)
|
||||||
|
#define EWRAM (0x2000000)
|
||||||
|
#define EWRAM_SIZE (0x40000)
|
||||||
|
#define IWRAM (0x3000000)
|
||||||
|
#define IWRAM_SIZE (0x8000)
|
||||||
|
#define IO (0x4000000)
|
||||||
|
#define IO_SIZE (0x400)
|
||||||
|
#define PALETTES (0x5000000)
|
||||||
|
#define PALETTES_SIZE (0x400)
|
||||||
|
#define VRAM (0x6000000)
|
||||||
|
#define VRAM_SIZE (0x18000)
|
||||||
|
#define OBJECTS (0x7000000)
|
||||||
|
#define OBJECTS_SIZE (0x400)
|
||||||
|
|
||||||
extern void vblank();
|
void start_tests();
|
||||||
|
void blank_memory();
|
||||||
|
|
||||||
|
extern void vblank();
|
||||||
|
extern void cpufastset(void *source, void *dest, int mode);
|
|
@ -2408,7 +2408,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
|
||||||
|
|
Loading…
Reference in New Issue