shithub: cstory

Download patch

ref: ba797d0fead03c555cf199250f6fb94a36fb15ad
parent: 95f370a720f5c719b5b6d82ae5b0cb9b784b9c8d
parent: 55b473a4901321ecd9506fbab6734b4bc3269d36
author: Clownacy <Clownacy@users.noreply.github.com>
date: Mon Sep 14 16:04:41 EDT 2020

Merge branch 'accurate' into portable

--- a/src/BossAlmo2.cpp
+++ b/src/BossAlmo2.cpp
@@ -649,7 +649,7 @@
 			{
 				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);
 			}
 
--- a/src/BossBallos.cpp
+++ b/src/BossBallos.cpp
@@ -656,7 +656,7 @@
 			{
 				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);
 			}
 
--- a/src/BossOhm.cpp
+++ b/src/BossOhm.cpp
@@ -1,3 +1,4 @@
+
 #include "BossOhm.h"
 
 #include <stddef.h>
@@ -470,7 +471,7 @@
 			{
 				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);
 			}
 
--- a/src/BossTwinD.cpp
+++ b/src/BossTwinD.cpp
@@ -517,7 +517,7 @@
 			{
 				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);
 			}
 
--- a/src/BossX.cpp
+++ b/src/BossX.cpp
@@ -844,7 +844,7 @@
 			{
 				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);
 			}
 
--- a/src/Flash.cpp
+++ b/src/Flash.cpp
@@ -6,7 +6,7 @@
 
 static struct
 {
-	int mode;
+	FlashMode mode;
 	int act_no;
 	BOOL flag;
 	int cnt;
@@ -24,7 +24,7 @@
 	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 @@
 
 	switch (flash.act_no)
 	{
-		case 0:
+		case 0: // Expand
 			flash.cnt += 0x200;
 			flash.width += flash.cnt;
 
@@ -59,26 +59,28 @@
 			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 @@
 			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 @@
 
 	switch (flash.mode)
 	{
-		case 1:
+		case FLASH_MODE_EXPLOSION:
 			ActFlash_Explosion(flx, fly);
 			break;
-		case 2:
+
+		case FLASH_MODE_FLASH:
 			ActFlash_Flash();
 			break;
 	}
--- a/src/Flash.h
+++ b/src/Flash.h
@@ -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);
--- a/src/NpcAct060.cpp
+++ b/src/NpcAct060.cpp
@@ -1001,7 +1001,7 @@
 			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;
 			}
--- a/src/NpcAct080.cpp
+++ b/src/NpcAct080.cpp
@@ -389,7 +389,7 @@
 			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;
 			}
--- a/src/NpcAct140.cpp
+++ b/src/NpcAct140.cpp
@@ -728,7 +728,7 @@
 			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)
--- a/src/NpcAct340.cpp
+++ b/src/NpcAct340.cpp
@@ -432,7 +432,7 @@
 			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 @@
 				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);
 			}
 
--- a/src/TextScr.cpp
+++ b/src/TextScr.cpp
@@ -1034,7 +1034,7 @@
 					}
 					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'))