mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 01:59:43 +01:00
Add setfont scripting command
The <font> in the level file is basically the starting font, but it can be changed at any time via scripting.
This commit is contained in:
parent
7db0e73109
commit
cc6b00a711
4 changed files with 21 additions and 1 deletions
|
@ -404,7 +404,7 @@ uint8_t get_font_idx_8x8(void)
|
||||||
return font_idx_8x8;
|
return font_idx_8x8;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_custom_font(const char* name)
|
void set_custom_font(const char* name)
|
||||||
{
|
{
|
||||||
/* Apply the choice for a certain level-specific font. */
|
/* Apply the choice for a certain level-specific font. */
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,7 @@ bool find_main_font_by_name(const char* name, uint8_t* idx);
|
||||||
const char* get_main_font_name(uint8_t idx);
|
const char* get_main_font_name(uint8_t idx);
|
||||||
uint8_t get_font_idx_8x8(void);
|
uint8_t get_font_idx_8x8(void);
|
||||||
|
|
||||||
|
void set_custom_font(const char* name);
|
||||||
void load_main(void);
|
void load_main(void);
|
||||||
void load_custom(const char* name);
|
void load_custom(const char* name);
|
||||||
void unload_custom(void);
|
void unload_custom(void);
|
||||||
|
|
|
@ -7185,6 +7185,9 @@ void Game::returntoeditor(void)
|
||||||
ed.notedelay = 0;
|
ed.notedelay = 0;
|
||||||
ed.roomnamehide = 0;
|
ed.roomnamehide = 0;
|
||||||
|
|
||||||
|
// Might've been changed in a script
|
||||||
|
font::set_custom_font(cl.level_font_name.c_str());
|
||||||
|
|
||||||
DEFER_CALLBACK(resetbg);
|
DEFER_CALLBACK(resetbg);
|
||||||
music.fadeout();
|
music.fadeout();
|
||||||
//If warpdir() is used during playtesting, we need to set it back after!
|
//If warpdir() is used during playtesting, we need to set it back after!
|
||||||
|
|
|
@ -2424,6 +2424,19 @@ void scriptclass::run(void)
|
||||||
position--;
|
position--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (words[0] == "setfont")
|
||||||
|
{
|
||||||
|
#ifndef NO_CUSTOM_LEVELS
|
||||||
|
if (words[1] == "")
|
||||||
|
{
|
||||||
|
font::set_custom_font(cl.level_font_name.c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
font::set_custom_font(words[1].c_str());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
position++;
|
position++;
|
||||||
}
|
}
|
||||||
|
@ -3433,6 +3446,9 @@ bool scriptclass::loadcustom(const std::string& t)
|
||||||
}else if(words[0] == "loadtext"){
|
}else if(words[0] == "loadtext"){
|
||||||
if(customtextmode==1){ add("endtext"); customtextmode=0;}
|
if(customtextmode==1){ add("endtext"); customtextmode=0;}
|
||||||
add(lines[i]);
|
add(lines[i]);
|
||||||
|
}else if(words[0] == "setfont"){
|
||||||
|
if(customtextmode==1){ add("endtext"); customtextmode=0;}
|
||||||
|
add(lines[i]);
|
||||||
}else if(words[0] == "destroy"){
|
}else if(words[0] == "destroy"){
|
||||||
if(customtextmode==1){ add("endtext"); customtextmode=0;}
|
if(customtextmode==1){ add("endtext"); customtextmode=0;}
|
||||||
add(lines[i]);
|
add(lines[i]);
|
||||||
|
|
Loading…
Reference in a new issue