pret merge

This commit is contained in:
AlexOn1ine 2025-11-16 12:01:13 +01:00
commit ba74c076f6
10 changed files with 695 additions and 617 deletions

View File

@ -169,7 +169,10 @@
.endm
@ Copies the value of source into destination.
.macro copyvar destination:req, source:req
.macro copyvar destination:req, source:req, warn=TRUE
.if \warn && !((\source >= VARS_START && \source <= VARS_END) || (\source >= SPECIAL_VARS_START && \source <= SPECIAL_VARS_END))
.warning "copyvar with a value that is not a VAR_ constant; did you mean setvar instead?"
.endif
.byte SCR_OP_COPYVAR
.2byte \destination
.2byte \source

View File

@ -349,7 +349,11 @@ LilycoveCity_ContestLobby_EventScript_SetMasterContestType::
@ Functionally unused
LilycoveCity_ContestLobby_EventScript_SetDebug::
setflag FLAG_HIDE_LILYCOVE_MUSEUM_CURATOR
copyvar VAR_LILYCOVE_MUSEUM_2F_STATE, 1
#ifdef UBFIX
setvar VAR_LILYCOVE_MUSEUM_2F_STATE, 1
#else
copyvar VAR_LILYCOVE_MUSEUM_2F_STATE, 1, warn=FALSE
#endif
additem ITEM_CONTEST_PASS
setvar VAR_0x800B, 8
setvar VAR_CONTEST_RANK, CONTEST_RANK_MASTER

View File

@ -76,7 +76,11 @@ LilycoveCity_LilycoveMuseum_2F_EventScript_ShowExhibitHall::
applymovement LOCALID_PLAYER, LilycoveCity_LilycoveMuseum_2F_Movement_PlayerWalkInPlaceLeft
waitmovement 0
msgbox LilycoveCity_LilycoveMuseum_2F_Text_PleaseObtainPaintingsForExhibit, MSGBOX_SIGN
copyvar VAR_LILYCOVE_MUSEUM_2F_STATE, 1
#ifdef UBFIX
setvar VAR_LILYCOVE_MUSEUM_2F_STATE, 1
#else
copyvar VAR_LILYCOVE_MUSEUM_2F_STATE, 1, warn=FALSE
#endif
releaseall
end

View File

@ -6,7 +6,11 @@ SkyPillar_2F_MapScripts::
SkyPillar_2F_OnTransition:
call_if_lt VAR_SKY_PILLAR_STATE, 2, SkyPillar_2F_EventScript_CleanFloor
copyvar VAR_ICE_STEP_COUNT, 1
#ifdef UBFIX
setvar VAR_ICE_STEP_COUNT, 1
#else
copyvar VAR_ICE_STEP_COUNT, 1, warn=FALSE
#endif
end
SkyPillar_2F_EventScript_CleanFloor::

View File

@ -6,7 +6,11 @@ SkyPillar_4F_MapScripts::
SkyPillar_4F_OnTransition:
call_if_lt VAR_SKY_PILLAR_STATE, 2, SkyPillar_4F_EventScript_CleanFloor
copyvar VAR_ICE_STEP_COUNT, 1
#ifdef UBFIX
setvar VAR_ICE_STEP_COUNT, 1
#else
copyvar VAR_ICE_STEP_COUNT, 1, warn=FALSE
#endif
end
SkyPillar_4F_EventScript_CleanFloor::

View File

@ -3,7 +3,11 @@ CaveHole_CheckFallDownHole:
.2byte 0
CaveHole_FixCrackedGround:
copyvar VAR_ICE_STEP_COUNT, 1
#ifdef UBFIX
setvar VAR_ICE_STEP_COUNT, 1
#else
copyvar VAR_ICE_STEP_COUNT, 1, warn=FALSE
#endif
end
EventScript_FallDownHole::

File diff suppressed because it is too large Load Diff

View File

@ -34,6 +34,7 @@ static void Task_Fanfare(u8 taskId);
static void CreateFanfareTask(void);
static void RestoreBGMVolumeAfterPokemonCry(void);
// The 1st argument in the table is the length of the fanfare, measured in frames. This is calculated by taking the duration of the midi file, multiplying by 59.72750056960583, and rounding up to the next nearest integer.
static const struct Fanfare sFanfares[] = {
[FANFARE_LEVEL_UP] = { MUS_LEVEL_UP, 80 },
[FANFARE_OBTAIN_ITEM] = { MUS_OBTAIN_ITEM, 160 },

View File

@ -633,7 +633,11 @@ bool AsmFile::ParseEnum()
RaiseError("%s:%ld: empty enum is invalid", headerFilename.c_str(), currentHeaderLine);
}
if (m_buffer[m_pos] != ',')
if (m_buffer[m_pos] == '#')
{
currentHeaderLine = ParseLineSkipInEnum();
}
else if (m_buffer[m_pos] != ',')
{
currentHeaderLine += SkipWhitespaceAndEol();
if (m_buffer[m_pos++] == '}' && m_buffer[m_pos++] == ';')
@ -737,6 +741,50 @@ int AsmFile::SkipWhitespaceAndEol()
return newlines;
}
int AsmFile::ParseLineSkipInEnum(void)
{
m_pos++;
while (m_buffer[m_pos] == ' ' || m_buffer[m_pos] == '\t')
m_pos++;
if (!IsAsciiDigit(m_buffer[m_pos]))
RaiseError("malformatted line indicator found inside `enum`, expected line number");
unsigned n = 0;
int digit = 0;
while ((digit = ConvertDigit(m_buffer[m_pos++], 10)) != -1)
n = 10 * n + digit;
while (m_buffer[m_pos] == ' ' || m_buffer[m_pos] == '\t')
m_pos++;
if (m_buffer[m_pos++] != '"')
RaiseError("malformatted line indicator found before `enum`, expected filename");
while (m_buffer[m_pos] != '"')
{
unsigned char c = m_buffer[m_pos++];
if (c == 0)
{
if (m_pos >= m_size)
RaiseError("unexpected EOF in line indicator");
else
RaiseError("unexpected null character in line indicator");
}
if (!IsAsciiPrintable(c))
RaiseError("unexpected character '\\x%02X' in line indicator", c);
if (c == '\\')
{
c = m_buffer[m_pos];
RaiseError("unexpected escape '\\%c' in line indicator", c);
}
}
return n - 1;
}
// returns the last line indicator and its corresponding file name without modifying the token index
int AsmFile::FindLastLineNumber(std::string& filename)
{

View File

@ -73,6 +73,7 @@ private:
void VerifyStringLength(int length);
int SkipWhitespaceAndEol();
int FindLastLineNumber(std::string& filename);
int ParseLineSkipInEnum(void);
std::string ReadIdentifier();
long ReadInteger(std::string filename, long line);
};