@@ -60,7 +60,7 @@ def convert_mode_lit(mode):
60
60
return "INVALID"
61
61
62
62
def print_animation_header (target_name , file_version ):
63
- """! Print the beginning of s4c header for a target."""
63
+ """! Print the beginning of animation header for a target."""
64
64
print (f"#ifndef { target_name .upper ()} _S4C_H_" )
65
65
print (f"#define { target_name .upper ()} _S4C_H_" )
66
66
print (f"#define { target_name .upper ()} _S4C_H_VERSION \" { file_version } \" " )
@@ -69,8 +69,20 @@ def print_animation_header(target_name, file_version):
69
69
print (f" * Declares animation matrix vector for { target_name } ." )
70
70
print (" */" )
71
71
72
+ def print_wrapped_s4c_inclusion (s4c_path ):
73
+ """! Print the wrapped s4c.h inclusion."""
74
+ print ("#ifndef S4C_HAS_ANIMATE" )
75
+ print ("#define S4C_SCRIPTS_PALETTE_ANIMATE_CLEANUP" )
76
+ print ("#define S4C_HAS_ANIMATE" )
77
+ print ("#endif //!S4C_HAS_ANIMATE" )
78
+ print (f"#include \" { s4c_path } /sprites4curses/src/s4c.h\" " )
79
+ print ("#ifdef PALETTE_ANIMATE_CLEANUP" )
80
+ print ("#undef S4C_HAS_ANIMATE" )
81
+ print ("#undef S4C_SCRIPTS_PALETTE_ANIMATE_CLEANUP" )
82
+ print ("#endif //PALETTE_ANIMATE_CLEANUP\n " )
83
+
72
84
def print_heading (mode , target_name , file_version , num_frames , s4c_path ):
73
- """! Print the actual s4c header for a target."""
85
+ """! Print the actual header for a target."""
74
86
if mode == "s4c" :
75
87
print (f"{ file_version } " )
76
88
elif mode == "header" :
@@ -82,8 +94,8 @@ def print_heading(mode, target_name, file_version, num_frames, s4c_path):
82
94
elif mode == "header-exp" :
83
95
print_animation_header (target_name , file_version )
84
96
#s4c_path = args[0]
97
+ print_wrapped_s4c_inclusion (s4c_path )
85
98
print (f"extern S4C_Sprite { target_name } [{ num_frames } ];\n " )
86
- print (f"#include \" { s4c_path } /sprites4curses/src/s4c.h\" \n " )
87
99
print (f"\n #endif // { target_name .upper ()} _S4C_H_" )
88
100
return True
89
101
elif mode in ('cfile' , 'cfile-exp' ):
0 commit comments