Skip to content

Commit

Permalink
Allow partial 2x mode
Browse files Browse the repository at this point in the history
  • Loading branch information
TellowKrinkle committed Jan 31, 2021
1 parent c56ae5e commit d2b5d19
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/PonscripterLabel_animation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ void PonscripterLabel::parseTaggedString(AnimationInfo* anim, bool is_mask)

anim->removeTag();

int multiplier = multiplier_style <= ScriptHandler::UMINEKO ? 1 : res_multiplier;

int i;
const char* buffer = anim->image_name;
anim->num_of_cells = 1;
Expand Down Expand Up @@ -321,9 +323,9 @@ void PonscripterLabel::parseTaggedString(AnimationInfo* anim, bool is_mask)
script_h.getNext();

script_h.pushCurrent((char*) buffer); // FIXME: unsafe
anim->font_size_x = script_h.readIntValue() * res_multiplier;
anim->font_size_x = script_h.readIntValue() * multiplier;
anim->font_size_y = script_h.hasMoreArgs()
? script_h.readIntValue() * res_multiplier
? script_h.readIntValue() * multiplier
: anim->font_size_x;
anim->font_pitch = script_h.hasMoreArgs()
? script_h.readIntValue()
Expand Down
8 changes: 8 additions & 0 deletions src/ScriptHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ ScriptHandler::ScriptHandler()

screen_size = SCREEN_SIZE_640x480;
res_multiplier = 2; // Default to 2x mode for Umineko
multiplier_style = UMINEKO;
global_variable_border = 200;

// Prefer Ponscripter files over NScripter files, and prefer
Expand Down Expand Up @@ -1034,6 +1035,13 @@ int ScriptHandler::readScript(DirPaths *path, const char* prefer_name)
} else {
res_multiplier = 1;
}

if (!strncmp(buf, "@umineko", 8)) {
buf += 8;
multiplier_style = UMINEKO;
} else {
multiplier_style = FULL;
}
}
else if (!strncmp(buf, "value", 5)) {
buf += 5;
Expand Down
7 changes: 7 additions & 0 deletions src/ScriptHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,13 @@ class ScriptHandler {

int screen_size;
int res_multiplier;
/// Which things should `res_multiplier` apply to?
/// @Note When adding new enum values, order them by the amount of things `res_multiplier` should change (rather than trying to preserve old IDs) so that individual usages can depend on <= checks rather than individually checking enum values
enum MultiplierStyle {
UMINEKO = 0, ///< Apply multiplier to things identically to the build used for the Steam release of Umineko
FULL = 1, ///< Apply multiplier to all things (for maximum compatibility with nscripter upscales)
};
MultiplierStyle multiplier_style;
enum {
SCREEN_SIZE_640x480,
SCREEN_SIZE_800x600,
Expand Down
1 change: 1 addition & 0 deletions src/ScriptParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ int ScriptParser::open(const char* preferred_script)
screen_ratio1 = 1;
screen_ratio2 = 1;
res_multiplier = script_h.res_multiplier;
multiplier_style = script_h.multiplier_style;

switch (script_h.screen_size) {
case ScriptHandler::SCREEN_SIZE_960x600:
Expand Down
1 change: 1 addition & 0 deletions src/ScriptParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ class ScriptParser {
/* Global definitions */
int preferred_width;
int script_width, script_height, res_multiplier;
ScriptHandler::MultiplierStyle multiplier_style;
uint16_t screen_width, screen_height;
int screen_texture_width, screen_texture_height;
int screen_bpp;
Expand Down

0 comments on commit d2b5d19

Please sign in to comment.