Merge branch 'accurate' into portable

This commit is contained in:
Clownacy 2020-09-29 16:44:49 +01:00
commit 603cfdd9db
10 changed files with 130 additions and 110 deletions

View file

@ -263,9 +263,9 @@ void ActBossChar_Omega(void)
if (gBoss[0].act_wait > 20 && gBoss[0].act_wait < 80 && !(gBoss[0].act_wait % 3))
{
if (Random(0, 9) < 8)
SetNpChar(48, gBoss[0].x, gBoss[0].y - (16 * 0x200), Random(-0x100, 0x100), -0x333, 0, NULL, 0x100);
SetNpChar(48, gBoss[0].x, gBoss[0].y - (16 * 0x200), Random(-0x100, 0x100), -0x10 * 0x200 / 10, 0, NULL, 0x100);
else
SetNpChar(48, gBoss[0].x, gBoss[0].y - (16 * 0x200), Random(-0x100, 0x100), -0x333, 2, NULL, 0x100);
SetNpChar(48, gBoss[0].x, gBoss[0].y - (16 * 0x200), Random(-0x100, 0x100), -0x10 * 0x200 / 10, 2, NULL, 0x100);
PlaySoundObject(39, SOUND_MODE_PLAY);
}
@ -384,7 +384,7 @@ void ActBossChar_Omega(void)
if (gBoss[0].act_wait < 30 && gBoss[0].act_wait % 5 == 0)
{
SetNpChar(48, gBoss[0].x, gBoss[0].y - (16 * 0x200), Random(-341, 341), -0x333, 0, NULL, 0x100);
SetNpChar(48, gBoss[0].x, gBoss[0].y - (16 * 0x200), Random(-341, 341), -0x10 * 0x200 / 10, 0, NULL, 0x100);
PlaySoundObject(39, SOUND_MODE_PLAY);
}

View file

@ -19,13 +19,27 @@
#include "Stage.h"
#include "TextScr.h"
enum CREDIT_MODE
{
CREDIT_MODE_STOP,
CREDIT_MODE_SCROLL_READ,
CREDIT_MODE_SCROLL_WAIT
};
enum ILLUSTRATION_ACTION
{
ILLUSTRATION_ACTION_IDLE,
ILLUSTRATION_ACTION_SLIDE_IN,
ILLUSTRATION_ACTION_SLIDE_OUT
};
struct CREDIT
{
long size;
char *pData;
int offset;
int wait;
int mode;
CREDIT_MODE mode;
int start_x;
};
@ -40,7 +54,7 @@ struct STRIP
struct ILLUSTRATION
{
int act_no;
ILLUSTRATION_ACTION act_no;
int x;
};
@ -62,10 +76,10 @@ void ActionStripper(void)
for (s = 0; s < MAX_STRIP; ++s)
{
// Move up
if (Strip[s].flag & 0x80 && Credit.mode)
if (Strip[s].flag & 0x80 && Credit.mode != CREDIT_MODE_STOP)
Strip[s].y -= 0x100;
// Get removed when off-screen
if (Strip[s].y <= -0x2000)
if (Strip[s].y <= -16 * 0x200)
Strip[s].flag = 0;
}
}
@ -155,18 +169,18 @@ void ActionIllust(void)
{
switch (Illust.act_no)
{
case 0: // Off-screen to the left
case ILLUSTRATION_ACTION_IDLE: // Off-screen to the left
Illust.x = -160 * 0x200;
break;
case 1: // Move in from the left
case ILLUSTRATION_ACTION_SLIDE_IN: // Move in from the left
Illust.x += 40 * 0x200;
if (Illust.x > 0)
Illust.x = 0;
break;
case 2: // Move out from the right
Illust.x -= 0x5000;
case ILLUSTRATION_ACTION_SLIDE_OUT: // Move out from the right
Illust.x -= 40 * 0x200;
if (Illust.x < -160 * 0x200)
Illust.x = -160 * 0x200;
break;
@ -177,7 +191,7 @@ void ActionIllust(void)
void PutIllust(void)
{
RECT rcIllust = {0, 0, 160, 240};
#if WINDOW_WIDTH != 320 || WINDOW_HEIGHT != 240
#if WINDOW_WIDTH != 320 || WINDOW_HEIGHT != 240 // TODO - Move this to CSE2EX
// Widescreen edit
RECT rcClip = {(WINDOW_WIDTH - 320) / 2, 0, WINDOW_WIDTH, WINDOW_HEIGHT};
PutBitmap3(&rcClip, (Illust.x / 0x200) + ((WINDOW_WIDTH - 320) / 2), (WINDOW_HEIGHT - 240) / 2, &rcIllust, SURFACE_ID_CREDITS_IMAGE);
@ -248,23 +262,24 @@ BOOL StartCreditScript(void)
// Read data
fread(Credit.pData, 1, Credit.size, fp);
EncryptionBinaryData2((unsigned char*)Credit.pData, Credit.size);
#ifdef FIX_MAJOR_BUGS
// The original game forgot to close the file
fclose(fp);
#endif
EncryptionBinaryData2((unsigned char*)Credit.pData, Credit.size);
// Reset credits
Credit.offset = 0;
Credit.wait = 0;
Credit.mode = 1;
Credit.mode = CREDIT_MODE_SCROLL_READ;
Illust.x = -160 * 0x200;
Illust.act_no = 0;
Illust.act_no = ILLUSTRATION_ACTION_IDLE;
// Modify cliprect
grcGame.left = WINDOW_WIDTH / 2;
#if WINDOW_WIDTH != 320 || WINDOW_HEIGHT != 240
#if WINDOW_WIDTH != 320 || WINDOW_HEIGHT != 240 // TODO - Move to CSE2EX
// These three are non-vanilla: for wide/tallscreen support
grcGame.right = ((WINDOW_WIDTH - 320) / 2) + 320;
grcGame.top = (WINDOW_HEIGHT - 240) / 2;
@ -283,10 +298,10 @@ BOOL StartCreditScript(void)
// Get number from text (4 digit)
static int GetScriptNumber(const char *text)
{
return (text[0] - '0') * 1000 +
(text[1] - '0') * 100 +
(text[2] - '0') * 10 +
text[3] - '0';
return (text[0] - '0') * 1000
+ (text[1] - '0') * 100
+ (text[2] - '0') * 10
+ (text[3] - '0') * 1;
}
// Parse credits
@ -304,7 +319,7 @@ static void ActionCredit_Read(void)
{
case '[': // Create cast
// Get the range for the cast text
++Credit.offset;
Credit.offset += 1;
a = Credit.offset;
@ -320,50 +335,51 @@ static void ActionCredit_Read(void)
// Copy the text to the cast text
memcpy(text, &Credit.pData[Credit.offset], len);
text[len] = 0;
text[len] = '\0';
// Get cast id
// Get cast ID
Credit.offset = a;
len = GetScriptNumber(&Credit.pData[++Credit.offset]);
Credit.offset += 1;
len = GetScriptNumber(&Credit.pData[Credit.offset]);
// Create cast object
SetStripper(Credit.start_x, (WINDOW_HEIGHT * 0x200) + (8 * 0x200), text, len);
SetStripper(Credit.start_x, (WINDOW_HEIGHT + 8) * 0x200, text, len);
// Change offset
Credit.offset += 4;
return;
case '-': // Wait for X amount of frames
++Credit.offset;
Credit.offset += 1;
Credit.wait = GetScriptNumber(&Credit.pData[Credit.offset]);
Credit.offset += 4;
Credit.mode = 2;
Credit.mode = CREDIT_MODE_SCROLL_WAIT;
return;
case '+': // Change casts x-position
++Credit.offset;
Credit.offset += 1;
Credit.start_x = GetScriptNumber(&Credit.pData[Credit.offset]) * 0x200;
Credit.offset += 4;
return;
case '/': // Stop credits
Credit.mode = 0;
Credit.mode = CREDIT_MODE_STOP;
return;
case '!': // Change music
++Credit.offset;
Credit.offset += 1;
a = GetScriptNumber(&Credit.pData[Credit.offset]);
Credit.offset += 4;
ChangeMusic((MusicID)a);
return;
case '~': // Start fading out music
++Credit.offset;
Credit.offset += 1;
SetOrganyaFadeout();
return;
case 'j': // Jump to label
++Credit.offset;
Credit.offset += 1;
// Get number
b = GetScriptNumber(&Credit.pData[Credit.offset]);
@ -372,25 +388,25 @@ static void ActionCredit_Read(void)
Credit.offset += 4;
// Jump to specific label
if (1)
if (1) // This appears to be a hacked-up duplicate of some code from the below 'f' condition
{
while (Credit.offset < Credit.size)
{
if (Credit.pData[Credit.offset] == 'l')
{
// What is this
a = GetScriptNumber(&Credit.pData[++Credit.offset]);
Credit.offset += 1;
a = GetScriptNumber(&Credit.pData[Credit.offset]);
Credit.offset += 4;
if (b == a)
break;
}
else if (IsShiftJIS(Credit.pData[Credit.offset]))
{
Credit.offset += 2;
}
else
{
++Credit.offset;
if (IsShiftJIS(Credit.pData[Credit.offset]))
Credit.offset += 2;
else
Credit.offset += 1;
}
}
}
@ -398,7 +414,7 @@ static void ActionCredit_Read(void)
return;
case 'f': // Flag jump
++Credit.offset;
Credit.offset += 1;
// Read numbers XXXX:YYYY
a = GetScriptNumber(&Credit.pData[Credit.offset]);
@ -414,18 +430,19 @@ static void ActionCredit_Read(void)
{
if (Credit.pData[Credit.offset] == 'l')
{
a = GetScriptNumber(&Credit.pData[++Credit.offset]);
Credit.offset += 1;
a = GetScriptNumber(&Credit.pData[Credit.offset]);
Credit.offset += 4;
if (b == a)
break;
}
else if (IsShiftJIS(Credit.pData[Credit.offset]))
{
Credit.offset += 2;
}
else
{
++Credit.offset;
if (IsShiftJIS(Credit.pData[Credit.offset]))
Credit.offset += 2;
else
Credit.offset += 1;
}
}
}
@ -433,7 +450,7 @@ static void ActionCredit_Read(void)
default:
// Progress through file
++Credit.offset;
Credit.offset += 1;
break;
}
}
@ -448,13 +465,13 @@ void ActionCredit(void)
// Update script, or if waiting, decrement the wait value
switch (Credit.mode)
{
case 1:
case CREDIT_MODE_SCROLL_READ:
ActionCredit_Read();
break;
case 2:
case CREDIT_MODE_SCROLL_WAIT:
if (--Credit.wait <= 0)
Credit.mode = 1;
Credit.mode = CREDIT_MODE_SCROLL_READ;
break;
}
}
@ -463,13 +480,13 @@ void ActionCredit(void)
void SetCreditIllust(int a)
{
ReloadIllust(a);
Illust.act_no = 1;
Illust.act_no = ILLUSTRATION_ACTION_SLIDE_IN;
}
// Slide illustration off-screen
void CutCreditIllust(void)
{
Illust.act_no = 2;
Illust.act_no = ILLUSTRATION_ACTION_SLIDE_OUT;
}
// Scene of the island falling
@ -511,24 +528,24 @@ int Scene_DownIsland(int mode)
{
case 0:
// Move down
sprite.y += 0x33;
sprite.y += 0x200 / 10;
break;
case 1:
if (wait < 350)
{
// Move down at normal speed
sprite.y += 0x33;
sprite.y += 0x200 / 10;
}
else if (wait < 500)
{
// Move down slower
sprite.y += 0x19;
sprite.y += 0x200 / 20;
}
else if (wait < 600)
{
// Move down slow
sprite.y += 0xC;
sprite.y += 0x200 / 40;
}
else if (wait == 750)
{

View file

@ -34,39 +34,39 @@ void WriteMiniMapLine(int line)
// No switch here.
if (a == 0)
Surface2Surface(x, line, &rcLevel[0], SURFACE_ID_MAP, SURFACE_ID_TEXT_BOX);
else if (a == 68 ||
a == 1 ||
a == 64 ||
a == 128 ||
a == 129 ||
a == 130 ||
a == 131 ||
a == 81 ||
a == 82 ||
a == 85 ||
a == 86 ||
a == 2 ||
a == 96 ||
a == 113 ||
a == 114 ||
a == 117 ||
a == 118 ||
a == 160 ||
a == 161 ||
a == 162 ||
a == 163)
else if (a == 68 ||
a == 1 ||
a == 64 ||
a == 128 ||
a == 129 ||
a == 130 ||
a == 131 ||
a == 81 ||
a == 82 ||
a == 85 ||
a == 86 ||
a == 2 ||
a == 96 ||
a == 113 ||
a == 114 ||
a == 117 ||
a == 118 ||
a == 160 ||
a == 161 ||
a == 162 ||
a == 163)
Surface2Surface(x, line, &rcLevel[1], SURFACE_ID_MAP, SURFACE_ID_TEXT_BOX);
else if (a == 67 ||
a == 99 ||
a == 80 ||
a == 83 ||
a == 84 ||
a == 87 ||
a == 96 || // This is already listed above, so that part of the expression is always false
a == 112 ||
a == 115 ||
a == 116 ||
a == 119)
else if (a == 67 ||
a == 99 ||
a == 80 ||
a == 83 ||
a == 84 ||
a == 87 ||
a == 96 || // This is already listed above, so this part of the expression is always false
a == 112 ||
a == 115 ||
a == 116 ||
a == 119)
Surface2Surface(x, line, &rcLevel[2], SURFACE_ID_MAP, SURFACE_ID_TEXT_BOX);
else
Surface2Surface(x, line, &rcLevel[3], SURFACE_ID_MAP, SURFACE_ID_TEXT_BOX);
@ -123,8 +123,10 @@ int MiniMapLoop(void)
rcMiniMap.top = 0;
rcMiniMap.bottom = gMap.length;
rcView.right = --rcView.left + gMap.width + 2;
rcView.bottom = --rcView.top + gMap.length + 2;
rcView.left -= 1;
rcView.right = rcView.left + gMap.width + 2;
rcView.top -= 1;
rcView.bottom = rcView.top + gMap.length + 2;
CortBox2(&rcMiniMap, 0, SURFACE_ID_MAP);
line = 0;

View file

@ -259,14 +259,14 @@ void ActMyChar_Normal(BOOL bKey)
if (gMC.flag & 0x100)
{
max_dash = 0x196;
max_move = 0x2FF;
gravity1 = 0x28;
gravity2 = 0x10;
jump = 0x280;
dash1 = 0x2A;
dash2 = 0x10;
resist = 0x19;
max_dash = 0x32C / 2;
max_move = 0x5FF / 2;
gravity1 = 0x50 / 2;
gravity2 = 0x20 / 2;
jump = 0x500 / 2;
dash1 = 0x200 / 6 / 2;
dash2 = 0x200 / 16 / 2;
resist = 0x200 / 10 / 2;
}
else
{
@ -275,9 +275,9 @@ void ActMyChar_Normal(BOOL bKey)
gravity1 = 0x50;
gravity2 = 0x20;
jump = 0x500;
dash1 = 0x55;
dash2 = 0x20;
resist = 0x33;
dash1 = 0x200 / 6;
dash2 = 0x200 / 16;
resist = 0x200 / 10;
}
// Don't create "?" effect

View file

@ -175,7 +175,7 @@ void DamageMyChar(int damage)
{
PlaySoundObject(17, SOUND_MODE_PLAY);
gMC.cond = 0;
SetDestroyNpChar(gMC.x, gMC.y, 0x1400, 0x40);
SetDestroyNpChar(gMC.x, gMC.y, 10 * 0x200, 0x40);
StartTextScript(40);
}
}

View file

@ -1241,7 +1241,7 @@ void ActNpc036(NPCHAR *npc)
if (npc->act_no != 5)
{
npc->ym += 0x33;
npc->ym += 0x200 / 10;
if (npc->x < gMC.x)
npc->direct = 2;

View file

@ -1203,7 +1203,7 @@ void ActNpc135(NPCHAR *npc)
npc->direct = 2;
}
npc->ym += 0x33;
npc->ym += 0x200 / 10;
if (npc->ym > 0x5FF)
npc->ym = 0x5FF;

View file

@ -271,13 +271,13 @@ void ActNpc180(NPCHAR *npc)
#else
if (npc->flag && 5)
#endif
npc->ym += 0x10;
npc->ym += 0x200 / 32;
else
npc->ym += 0x33;
npc->ym += 0x200 / 10;
}
else
{
npc->ym += 0x33;
npc->ym += 0x200 / 10;
}
}

View file

@ -1320,7 +1320,7 @@ void ActNpc268(NPCHAR *npc)
break;
}
npc->ym += 0x33;
npc->ym += 0x200 / 10;
if (npc->ym > 0x5FF)
npc->ym = 0x5FF;

View file

@ -212,7 +212,8 @@ int StageSelectLoop(int *p_event)
StopTextScript();
break;
}
else if (gKeyTrg & gKeyCancel)
if (gKeyTrg & gKeyCancel)
{
StopTextScript();
LoadTextScript_Stage(old_script_path.c_str());