Merge branch 'accurate' into portable

This commit is contained in:
Clownacy 2020-09-14 20:04:41 +01:00
commit ba797d0fea
12 changed files with 32 additions and 20 deletions

View file

@ -649,7 +649,7 @@ void ActBossChar_Undead(void)
{
gBoss[0].act_wait = 0;
gBoss[0].act_no = 1001;
SetFlash(gBoss[0].x, gBoss[0].y, 1);
SetFlash(gBoss[0].x, gBoss[0].y, FLASH_MODE_EXPLOSION);
PlaySoundObject(35, SOUND_MODE_PLAY);
}

View file

@ -656,7 +656,7 @@ void ActBossChar_Ballos(void)
{
gBoss[0].act_wait = 0;
gBoss[0].act_no = 1002;
SetFlash(gBoss[0].x, gBoss[0].y, 1);
SetFlash(gBoss[0].x, gBoss[0].y, FLASH_MODE_EXPLOSION);
PlaySoundObject(35, SOUND_MODE_PLAY);
}

View file

@ -1,3 +1,4 @@
#include "BossOhm.h"
#include <stddef.h>
@ -470,7 +471,7 @@ void ActBossChar_Omega(void)
{
gBoss[0].act_wait = 0;
gBoss[0].act_no = 160;
SetFlash(gBoss[0].x, gBoss[0].y, 1);
SetFlash(gBoss[0].x, gBoss[0].y, FLASH_MODE_EXPLOSION);
PlaySoundObject(35, SOUND_MODE_PLAY);
}

View file

@ -517,7 +517,7 @@ void ActBossChar_Twin(void)
{
npc->act_no = 1020;
npc->act_wait = 0;
SetFlash(gBoss[0].x, gBoss[0].y, 1);
SetFlash(gBoss[0].x, gBoss[0].y, FLASH_MODE_EXPLOSION);
PlaySoundObject(35, SOUND_MODE_PLAY);
}

View file

@ -844,7 +844,7 @@ void ActBossChar_MonstX(void)
{
npc->act_wait = 0;
npc->act_no = 1001;
SetFlash(npc->x, npc->y, 1);
SetFlash(npc->x, npc->y, FLASH_MODE_EXPLOSION);
PlaySoundObject(35, SOUND_MODE_PLAY);
}

View file

@ -6,7 +6,7 @@
static struct
{
int mode;
FlashMode mode;
int act_no;
BOOL flag;
int cnt;
@ -24,7 +24,7 @@ void InitFlash(void)
gFlashColor = GetCortBoxColor(RGB(0xFF, 0xFF, 0xFE));
}
void SetFlash(int x, int y, int mode)
void SetFlash(int x, int y, FlashMode mode)
{
flash.act_no = 0;
flash.flag = TRUE;
@ -41,7 +41,7 @@ void ActFlash_Explosion(int flx, int fly)
switch (flash.act_no)
{
case 0:
case 0: // Expand
flash.cnt += 0x200;
flash.width += flash.cnt;
@ -59,26 +59,28 @@ void ActFlash_Explosion(int flx, int fly)
if (bottom > WINDOW_HEIGHT)
bottom = WINDOW_HEIGHT;
// The tall part of the explosion
flash.rect1.left = left;
flash.rect1.right = right;
flash.rect1.top = 0;
flash.rect1.bottom = WINDOW_HEIGHT;
// The wide part of the explosion
flash.rect2.left = 0;
flash.rect2.right = WINDOW_WIDTH;
flash.rect2.top = top;
flash.rect2.bottom = bottom;
if (flash.width > (WINDOW_WIDTH * 0x200 * 4))
if (flash.width > WINDOW_WIDTH * 0x200 * 4) // I guess in theory this means that the explosion would take longer in widescreen...
{
flash.act_no = 1;
flash.cnt = 0;
flash.width = (WINDOW_HEIGHT * 0x200);
flash.width = WINDOW_HEIGHT * 0x200;
}
break;
case 1:
case 1: // Shrink
flash.width -= flash.width / 8;
if ((flash.width / 0x100) == 0)
@ -92,11 +94,13 @@ void ActFlash_Explosion(int flx, int fly)
if (bottom > WINDOW_HEIGHT)
bottom = WINDOW_HEIGHT;
// The tall part of the explosion
flash.rect1.left = 0;
flash.rect1.right = 0;
flash.rect1.top = 0;
flash.rect1.bottom = 0;
// The wide part of the explosion
flash.rect2.top = top;
flash.rect2.bottom = bottom;
flash.rect2.left = 0;
@ -141,10 +145,11 @@ void ActFlash(int flx, int fly)
switch (flash.mode)
{
case 1:
case FLASH_MODE_EXPLOSION:
ActFlash_Explosion(flx, fly);
break;
case 2:
case FLASH_MODE_FLASH:
ActFlash_Flash();
break;
}

View file

@ -1,9 +1,15 @@
#pragma once
enum FlashMode
{
FLASH_MODE_EXPLOSION = 1,
FLASH_MODE_FLASH = 2
};
extern unsigned long gFlashColor;
void InitFlash(void);
void SetFlash(int x, int y, int mode);
void SetFlash(int x, int y, FlashMode mode);
void ActFlash_Explosion(int flx, int fly);
void ActFlash_Flash(void);
void ActFlash(int flx, int fly);

View file

@ -1001,7 +1001,7 @@ void ActNpc067(NPCHAR *npc)
if (++npc->act_wait == 30)
{
PlaySoundObject(101, SOUND_MODE_PLAY);
SetFlash(0, 0, 2);
SetFlash(0, 0, FLASH_MODE_FLASH);
npc->act_no = 27;
npc->ani_no = 7;
}

View file

@ -389,7 +389,7 @@ void ActNpc082(NPCHAR *npc)
if (++npc->act_wait == 30)
{
PlaySoundObject(101, SOUND_MODE_PLAY);
SetFlash(0, 0, 2);
SetFlash(0, 0, FLASH_MODE_FLASH);
npc->act_no = 27;
npc->ani_no = 7;
}

View file

@ -728,7 +728,7 @@ void ActNpc146(NPCHAR *npc)
npc->act_no = 1;
if (npc->direct == 2)
SetFlash(0, 0, 2);
SetFlash(0, 0, FLASH_MODE_FLASH);
// Fallthrough
case 1:
if (++npc->act_wait > 10)

View file

@ -432,7 +432,7 @@ void ActNpc340(NPCHAR *npc)
npc->direct = 2;
if (++npc->act_wait == 40)
SetFlash(0, 0, 2);
SetFlash(0, 0, FLASH_MODE_FLASH);
if (npc->act_wait > 50 && npc->act_wait % 10 == 1)
{
@ -513,7 +513,7 @@ void ActNpc340(NPCHAR *npc)
npc->ym = 0;
npc->act_no = 1005;
npc->act_wait = 0;
SetFlash(0, 0, 2);
SetFlash(0, 0, FLASH_MODE_FLASH);
PlaySoundObject(29, SOUND_MODE_PLAY);
}

View file

@ -1034,7 +1034,7 @@ int TextScriptProc(void)
}
else if (IS_COMMAND('F','L','A'))
{
SetFlash(0, 0, 2);
SetFlash(0, 0, FLASH_MODE_FLASH);
gTS.p_read += 4;
}
else if (IS_COMMAND('F','A','I'))