forked from DizzyEggg/pokeemerald
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix getboxmondata for evolutiontracker if compiled with agbcc * refactored move animation scripts as part of gMovesInfo * migration script for move anims * default animation, migration for battle_anim_scripts.s * added warning for missing animation * add include to migration * add struct member in migration script * removed include and struct member from migration script --------- Co-authored-by: Alex <[email protected]>
- Loading branch information
1 parent
941e32a
commit 97143e0
Showing
8 changed files
with
3,084 additions
and
2,088 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import re | ||
|
||
def IsCommaMissing(line: str): | ||
sanitized_line = line.removesuffix('\n').strip() | ||
if sanitized_line.endswith('{') or sanitized_line.endswith('(') or sanitized_line.endswith(','): | ||
return False | ||
if not re.search(r'\.[A-Za-z0-9_]+', sanitized_line): | ||
return False | ||
return True | ||
|
||
input_file = open('./src/data/moves_info.h', 'r') | ||
lines = input_file.readlines() | ||
input_file.close() | ||
|
||
|
||
battle_anim_lines = [] | ||
moves_info_lines = [] | ||
|
||
move = None | ||
bracketCount = 0 | ||
for line in lines: | ||
m = re.search(r'\[MOVE_([A-Za-z0-9_]+)\] =', line) | ||
if m: | ||
move = m.group(1) | ||
bracketCount = 0 | ||
battle_anim_lines.append('extern const u8 Move_' + move + '[];\n') | ||
|
||
if move and re.search(r'\{', line): | ||
bracketCount = bracketCount + 1 | ||
|
||
if move and re.search(r'\}', line): | ||
if (bracketCount == 1): | ||
moves_info_lines.append(8 * ' ' + '.battleAnimScript = Move_' + move + ',\n') | ||
move = None | ||
bracketCount = bracketCount - 1 | ||
|
||
comment_split = line.split('//') | ||
if move and IsCommaMissing(comment_split[0]): | ||
line = comment_split[0].removesuffix('\n') + ',' + line[len(comment_split[0]):-1] + '\n' | ||
|
||
|
||
moves_info_lines.append(line) | ||
|
||
output_file_mi = open('./src/data/moves_info.h', 'w') | ||
output_file_mi.writelines(moves_info_lines) | ||
output_file_mi.close() | ||
|
||
output_file_bas = open('./include/battle_anim_scripts.h', 'w') | ||
output_file_bas.writelines('#ifndef GUARD_BATTLE_ANIM_SCRIPTS_H\n') | ||
output_file_bas.writelines('#define GUARD_BATTLE_ANIM_SCRIPTS_H\n\n') | ||
output_file_bas.writelines(battle_anim_lines) | ||
output_file_bas.writelines('\n#endif // GUARD_BATTLE_ANIM_SCRIPTS_H\n') | ||
output_file_bas.close() | ||
|
||
b_anim_scripts_s = open('./data/battle_anim_scripts.s', 'r') | ||
lines = b_anim_scripts_s.read() | ||
b_anim_scripts_s.close() | ||
|
||
lines = re.sub(r'(Move_[A-Za-z0-9_]*)([:]+)', r'\1::', lines) | ||
|
||
b_anim_scripts_s = open('./data/battle_anim_scripts.s', 'w') | ||
b_anim_scripts_s.write(lines) | ||
b_anim_scripts_s.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.