This commit is contained in:
Clownacy 2019-02-10 00:43:48 +00:00
commit 545dcdf18d
9 changed files with 92 additions and 17 deletions

View file

@ -1,25 +1,25 @@
ifeq ($(RELEASE), 1)
CXXFLAGS := -O3 -s
FILENAME_DEF = release
CXXFLAGS := -O3 -s
FILENAME_DEF = release
else
CXXFLAGS := -O0 -g
FILENAME_DEF = debug
CXXFLAGS := -O0 -g
FILENAME_DEF = debug
endif
ifeq ($(JAPANESE), 1)
CXXFLAGS += -DJAPANESE
LIBS += -liconv
CXXFLAGS += -DJAPANESE
LIBS += -liconv
ifeq ($(RELEASE), 1)
FILENAME_DEF = releasejp
FILENAME_DEF = releasejp
else
FILENAME_DEF = debugjp
FILENAME_DEF = debugjp
endif
endif
FILENAME ?= $(FILENAME_DEF)
ifeq ($(FIX_BUGS), 1)
CXXFLAGS += -DFIX_BUGS
CXXFLAGS += -DFIX_BUGS
endif
ifeq ($(WINDOWS), 1)

Binary file not shown.

Binary file not shown.

BIN
build/data/HeadJapanese.tsc Normal file

Binary file not shown.

View file

@ -0,0 +1 @@
drqqqNK}傑嘲飼<E598B2>楓屯榑リフラハ<>眦)テテ愑2ツマ<EFBE82>額zzz}<7D><>KdrqqrNK}傑嘲飼<E598B2>楓篤淨セト般2ル閤<EFBE99>額zzz}<7D><>KdrqqsNK}傑嘲飼<E598B2>楓篤焼米チトハ}連額zzz}<7D><>KdrqqtNK}傑嘲飼<E598B2>楓鳶<E6A593>'}<7D>額zzz}<7D><>KdrqquNK}傑嘲飼<E598B2>楓沌フシ}<7D>額zzz}<7D><>KdrqqvNK}傑嘲飼<E598B2>楓瀞&ユ<>ハチ}<7D>額zzz}<7D><>KNK

View file

@ -431,6 +431,10 @@ int Scene_DownIsland(int mode)
sprite.y += 0x19;
}
}
else
{
sprite.y += 0x33;
}
break;
}

View file

@ -382,6 +382,75 @@ void PutTimeCounter(int x, int y)
}
}
bool SaveTimeCounter()
{
REC rec;
//Quit if player doesn't have the Nikumaru Counter
if (!(gMC.equip & 0x100))
return true;
//Get last time
char path[PATH_LENGTH];
sprintf(path, "%s/290.rec", gModulePath);
SDL_RWops *fp = SDL_RWFromFile(path, "rb");
if (fp)
{
//Read data
rec.counter[0] = SDL_ReadLE32(fp);
rec.counter[1] = SDL_ReadLE32(fp);
rec.counter[2] = SDL_ReadLE32(fp);
rec.counter[3] = SDL_ReadLE32(fp);
rec.random[0] = SDL_ReadU8(fp);
rec.random[1] = SDL_ReadU8(fp);
rec.random[2] = SDL_ReadU8(fp);
rec.random[3] = SDL_ReadU8(fp);
SDL_RWclose(fp);
//Decode from checksum
for (int i = 0; i < 4; i++)
{
uint8_t *p = (uint8_t*)&rec.counter[i];
p[0] -= (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? (rec.random[i]) : (rec.random[i] >> 1);
p[1] -= rec.random[i];
p[2] -= rec.random[i];
p[3] -= (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? (rec.random[i] >> 1) : (rec.random[i]);
}
//If this is faster than our new time, quit
if (rec.counter[0] < time_count)
return true;
}
//Save new time
for (int i = 0; i < 4; i++)
{
rec.counter[i] = time_count;
rec.random[i] = Random(0, 250) + i;
uint8_t *p = (uint8_t*)&rec.counter[i];
p[0] -= (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? (rec.random[i]) : (rec.random[i] >> 1);
p[1] -= rec.random[i];
p[2] -= rec.random[i];
p[3] -= (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? (rec.random[i] >> 1) : (rec.random[i]);
}
fp = SDL_RWFromFile(path, "wb");
if (!fp)
return false;
SDL_WriteLE32(fp, rec.counter[0]);
SDL_WriteLE32(fp, rec.counter[1]);
SDL_WriteLE32(fp, rec.counter[2]);
SDL_WriteLE32(fp, rec.counter[3]);
SDL_WriteU8(fp, rec.random[0]);
SDL_WriteU8(fp, rec.random[1]);
SDL_WriteU8(fp, rec.random[2]);
SDL_WriteU8(fp, rec.random[3]);
SDL_RWclose(fp);
return true;
}
int LoadTimeCounter()
{
//Open file
@ -405,18 +474,14 @@ int LoadTimeCounter()
rec.random[3] = SDL_ReadU8(fp);
SDL_RWclose(fp);
//HACK: this swaps the random values to correspond to the correct bytes
*((uint32_t*)rec.random) = SDL_SwapLE32(*((uint32_t*)rec.random));
//Decode from checksum
uint8_t *p;
for (int i = 0; i < 4; i++)
{
p = (uint8_t*)&rec.counter[i];
p[0] -= rec.random[i];
uint8_t *p = (uint8_t*)&rec.counter[i];
p[0] -= (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? (rec.random[i]) : (rec.random[i] >> 1);
p[1] -= rec.random[i];
p[2] -= rec.random[i];
p[3] -= rec.random[i] >> 1;
p[3] -= (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? (rec.random[i] >> 1) : (rec.random[i]);
}
//Verify checksum's result

View file

@ -26,5 +26,5 @@ void PutActiveArmsList();
void PutMyLife(bool flash);
void PutMyAir(int x, int y);
void PutTimeCounter(int x, int y);
bool SaveTimeCounter();
int LoadTimeCounter();

View file

@ -706,6 +706,11 @@ int TextScriptProc()
ChangeMyUnit(z);
gTS.p_read += 8;
}
else if (IS_COMMAND('S','T','C'))
{
SaveTimeCounter();
gTS.p_read += 4;
}
else if (IS_COMMAND('T','R','A'))
{
z = GetTextScriptNo(gTS.p_read + 4);