shithub: cstory

Download patch

ref: 02133ba1afbdf4af9b8c509faae6b3429762528c
parent: 9fb2e33e17c0e3266c37654fda110f79e63c3779
parent: eab0523c7c872494e73490eafcc41adeab9a8ffb
author: Cucky <[email protected]>
date: Fri Feb 1 10:56:57 EST 2019

Merge pull request #35 from Clownacy/master

Font improvements and more NPCs

--- a/src/Bullet.cpp
+++ b/src/Bullet.cpp
@@ -4,53 +4,52 @@
 
 BULLET_TABLE gBulTbl[46] =
 {
-	//TODO: un-ugly this
-	{'\0', '\0', 0, 0, 0, 0, 0, 0, {0, 0, 0, 0}},
-	{'\x04', '\x01', 20, 36, 4, 4, 2, 2, {8, 8, 8, 8}},
-	{'\x06', '\x01', 23, 36, 4, 4, 2, 2, {8, 8, 8, 8}},
-	{'\b', '\x01', 30, 36, 4, 4, 2, 2, {8, 8, 8, 8}},
-	{'\x01', '\x01', 8, 32, 6, 6, 2, 2, {8, 8, 8, 8}},
-	{'\x02', '\x01', 12, 32, 6, 6, 2, 2, {8, 8, 8, 8}},
-	{'\x04', '\x01', 16, 32, 6, 6, 2, 2, {8, 8, 8, 8}},
-	{'\x02', '\x02', 100, 8, 8, 16, 4, 2, {8, 8, 8, 8}},
-	{'\x03', '\x02', 100, 8, 4, 4, 4, 2, {8, 8, 8, 8}},
-	{'\x03', '\x02', 100, 8, 4, 4, 4, 2, {8, 8, 8, 8}},
-	{'\x02', '\x01', 20, 32, 2, 2, 2, 2, {8, 8, 8, 8}},
-	{'\x04', '\x01', 20, 32, 2, 2, 2, 2, {8, 8, 8, 8}},
-	{'\x06', '\x01', 20, 32, 2, 2, 2, 2, {8, 8, 8, 8}},
-	{'\0', '\n', 50, 40, 2, 2, 2, 2, {8, 8, 8, 8}},
-	{'\0', '\n', 70, 40, 4, 4, 4, 4, {8, 8, 8, 8}},
-	{'\0', '\n', 90, 40, 4, 4, 0, 0, {8, 8, 8, 8}},
-	{'\x01', 'd', 100, 20, 16, 16, 0, 0, {0, 0, 0, 0}},
-	{'\x01', 'd', 100, 20, 16, 16, 0, 0, {0, 0, 0, 0}},
-	{'\x01', 'd', 100, 20, 16, 16, 0, 0, {0, 0, 0, 0}},
-	{'\x01', '\x01', 20, 8, 2, 2, 2, 2, {4, 4, 4, 4}},
-	{'\x02', '\x01', 20, 8, 2, 2, 2, 2, {4, 4, 4, 4}},
-	{'\x02', '\x01', 20, 8, 4, 4, 4, 4, {4, 4, 4, 4}},
-	{'\x03', '\x01', 32, 32, 2, 2, 2, 2, {4, 4, 4, 4}},
-	{'\0', 'd', 0, 36, 8, 8, 8, 8, {12, 12, 12, 12}},
-	{'\x7F', '\x01', 2, 4, 8, 4, 8, 4, {0, 0, 0, 0}},
-	{'\x0F', '\x01', 30, 36, 8, 8, 4, 2, {8, 8, 8, 8}},
-	{'\x06', '\x03', 18, 36, 10, 10, 4, 2, {12, 12, 12, 12}},
-	{'\x01', 'd', 30, 36, 6, 6, 4, 4, {12, 12, 12, 12}},
-	{'\0', '\n', 30, 40, 2, 2, 2, 2, {8, 8, 8, 8}},
-	{'\0', '\n', 40, 40, 4, 4, 4, 4, {8, 8, 8, 8}},
-	{'\0', '\n', 40, 40, 4, 4, 0, 0, {8, 8, 8, 8}},
-	{'\x02', 'd', 100, 20, 12, 12, 0, 0, {0, 0, 0, 0}},
-	{'\x02', 'd', 100, 20, 12, 12, 0, 0, {0, 0, 0, 0}},
-	{'\x02', 'd', 100, 20, 12, 12, 0, 0, {0, 0, 0, 0}},
-	{'\x04', '\x04', 20, 32, 4, 4, 3, 3, {8, 8, 24, 8}},
-	{'\x04', '\x02', 20, 32, 2, 2, 2, 2, {8, 8, 24, 8}},
-	{'\x01', '\x01', 20, 32, 2, 2, 2, 2, {8, 8, 24, 8}},
-	{'\x04', '\x04', 30, 64, 6, 6, 3, 3, {8, 8, 8, 8}},
-	{'\b', '\b', 30, 64, 6, 6, 3, 3, {8, 8, 8, 8}},
-	{'\f', '\f', 30, 64, 6, 6, 3, 3, {8, 8, 8, 8}},
-	{'\x03', 'd', 30, 32, 6, 6, 3, 3, {4, 4, 4, 4}},
-	{'\x06', 'd', 30, 32, 6, 6, 3, 3, {4, 4, 4, 4}},
-	{'\v', 'd', 30, 32, 6, 6, 3, 3, {4, 4, 4, 4}},
-	{'\x04', '\x04', 20, 32, 4, 4, 3, 3, {8, 8, 24, 8}},
-	{'\0', '\x04', 4, 4, 0, 0, 0, 0, {0, 0, 0, 0}},
-	{'\x01', '\x01', 1, 36, 1, 1, 1, 1, {1, 1, 1, 1}}
+	{0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0}},
+	{4, 1, 20, 36, 4, 4, 2, 2, {8, 8, 8, 8}},
+	{6, 1, 23, 36, 4, 4, 2, 2, {8, 8, 8, 8}},
+	{8, 1, 30, 36, 4, 4, 2, 2, {8, 8, 8, 8}},
+	{1, 1, 8, 32, 6, 6, 2, 2, {8, 8, 8, 8}},
+	{2, 1, 12, 32, 6, 6, 2, 2, {8, 8, 8, 8}},
+	{4, 1, 16, 32, 6, 6, 2, 2, {8, 8, 8, 8}},
+	{2, 2, 100, 8, 8, 16, 4, 2, {8, 8, 8, 8}},
+	{3, 2, 100, 8, 4, 4, 4, 2, {8, 8, 8, 8}},
+	{3, 2, 100, 8, 4, 4, 4, 2, {8, 8, 8, 8}},
+	{2, 1, 20, 32, 2, 2, 2, 2, {8, 8, 8, 8}},
+	{4, 1, 20, 32, 2, 2, 2, 2, {8, 8, 8, 8}},
+	{6, 1, 20, 32, 2, 2, 2, 2, {8, 8, 8, 8}},
+	{0, 10, 50, 40, 2, 2, 2, 2, {8, 8, 8, 8}},
+	{0, 10, 70, 40, 4, 4, 4, 4, {8, 8, 8, 8}},
+	{0, 10, 90, 40, 4, 4, 0, 0, {8, 8, 8, 8}},
+	{1, 100, 100, 20, 16, 16, 0, 0, {0, 0, 0, 0}},
+	{1, 100, 100, 20, 16, 16, 0, 0, {0, 0, 0, 0}},
+	{1, 100, 100, 20, 16, 16, 0, 0, {0, 0, 0, 0}},
+	{1, 1, 20, 8, 2, 2, 2, 2, {4, 4, 4, 4}},
+	{2, 1, 20, 8, 2, 2, 2, 2, {4, 4, 4, 4}},
+	{2, 1, 20, 8, 4, 4, 4, 4, {4, 4, 4, 4}},
+	{3, 1, 32, 32, 2, 2, 2, 2, {4, 4, 4, 4}},
+	{0, 100, 0, 36, 8, 8, 8, 8, {12, 12, 12, 12}},
+	{127, 1, 2, 4, 8, 4, 8, 4, {0, 0, 0, 0}},
+	{15, 1, 30, 36, 8, 8, 4, 2, {8, 8, 8, 8}},
+	{6, 3, 18, 36, 10, 10, 4, 2, {12, 12, 12, 12}},
+	{1, 100, 30, 36, 6, 6, 4, 4, {12, 12, 12, 12}},
+	{0, 10, 30, 40, 2, 2, 2, 2, {8, 8, 8, 8}},
+	{0, 10, 40, 40, 4, 4, 4, 4, {8, 8, 8, 8}},
+	{0, 10, 40, 40, 4, 4, 0, 0, {8, 8, 8, 8}},
+	{2, 100, 100, 20, 12, 12, 0, 0, {0, 0, 0, 0}},
+	{2, 100, 100, 20, 12, 12, 0, 0, {0, 0, 0, 0}},
+	{2, 100, 100, 20, 12, 12, 0, 0, {0, 0, 0, 0}},
+	{4, 4, 20, 32, 4, 4, 3, 3, {8, 8, 24, 8}},
+	{4, 2, 20, 32, 2, 2, 2, 2, {8, 8, 24, 8}},
+	{1, 1, 20, 32, 2, 2, 2, 2, {8, 8, 24, 8}},
+	{4, 4, 30, 64, 6, 6, 3, 3, {8, 8, 8, 8}},
+	{8, 8, 30, 64, 6, 6, 3, 3, {8, 8, 8, 8}},
+	{12, 12, 30, 64, 6, 6, 3, 3, {8, 8, 8, 8}},
+	{3, 100, 30, 32, 6, 6, 3, 3, {4, 4, 4, 4}},
+	{6, 100, 30, 32, 6, 6, 3, 3, {4, 4, 4, 4}},
+	{11, 100, 30, 32, 6, 6, 3, 3, {4, 4, 4, 4}},
+	{4, 4, 20, 32, 4, 4, 3, 3, {8, 8, 24, 8}},
+	{0, 4, 4, 4, 0, 0, 0, 0, {0, 0, 0, 0}},
+	{1, 1, 1, 36, 1, 1, 1, 1, {1, 1, 1, 1}}
 };
 
 BULLET gBul[BULLET_MAX];
--- a/src/Draw.cpp
+++ b/src/Draw.cpp
@@ -447,16 +447,18 @@
 {
 	//Get font size
 	unsigned int fontWidth, fontHeight;
-	if (gWindowScale == 1)
+
+	// The original did this, but Windows would downscale it to 5/10 anyway.
+/*	if (gWindowScale == 1)
 	{
 		fontWidth = 6;
 		fontHeight = 12;
 	}
 	else
-	{
+	{*/
 		fontWidth = 5 * gWindowScale;
 		fontHeight = 10 * gWindowScale;
-	}
+//	}
 	
 #ifdef WINDOWS
 	// Actually use the font Config.dat specifies
--- a/src/Escape.cpp
+++ b/src/Escape.cpp
@@ -1,12 +1,15 @@
+#include "Escape.h"
+
 #include "WindowsWrapper.h"
 #include "Draw.h"
 #include "KeyControl.h"
+#include "Main.h"
 
 int Call_Escape()
 {
 	RECT rc = {0, 128, 208, 144};
 	
-	while (Flip_SystemTask())
+	do
 	{
 		//Get pressed keys
 		GetTrg();
@@ -30,8 +33,9 @@
 		//Draw screen
 		CortBox(&grcFull, 0x000000);
 		PutBitmap3(&grcFull, 56, 112, &rc, 26);
-		//PutFramePerSecound();
+		PutFramePerSecound();
 	}
+	while (Flip_SystemTask());
 	
 	//Quit if window is closed
 	gKeyTrg = 0;
--- a/src/Flags.cpp
+++ b/src/Flags.cpp
@@ -1,3 +1,5 @@
+#include "Flags.h"
+
 #include <cstring>
 #include <stdint.h>
 
--- a/src/Font.cpp
+++ b/src/Font.cpp
@@ -228,7 +228,7 @@
 			FT_Bitmap_Convert(font_object->library, &face->glyph->bitmap, &converted, 1);
 
 			const int letter_x = x + pen_x + face->glyph->bitmap_left;
-			const int letter_y = y + ((FT_MulFix(face->ascender, face->size->metrics.y_scale) + (64 - 1)) / 64) - (face->glyph->metrics.horiBearingY / 64);
+			const int letter_y = y + ((FT_MulFix(face->ascender, face->size->metrics.y_scale) - face->glyph->metrics.horiBearingY + (64 / 2)) / 64);
 
 			for (int iy = MAX(-letter_y, 0); letter_y + iy < MIN(letter_y + converted.rows, surface->h); ++iy)
 			{
--- a/src/NpcAct.h
+++ b/src/NpcAct.h
@@ -11,9 +11,12 @@
 void ActNpc006(NPCHAR *npc);
 void ActNpc007(NPCHAR *npc);
 void ActNpc008(NPCHAR *npc);
-
+void ActNpc009(NPCHAR *npc);
+void ActNpc010(NPCHAR *npc);
+void ActNpc011(NPCHAR *npc);
 void ActNpc012(NPCHAR *npc);
-
+void ActNpc013(NPCHAR *npc);
+void ActNpc014(NPCHAR *npc);
 void ActNpc015(NPCHAR *npc);
 void ActNpc016(NPCHAR *npc);
 void ActNpc017(NPCHAR *npc);
@@ -68,12 +71,17 @@
 void ActNpc079(NPCHAR *npc);
 void ActNpc080(NPCHAR *npc);
 void ActNpc081(NPCHAR *npc);
-
+void ActNpc082(NPCHAR *npc);
 void ActNpc083(NPCHAR *npc);
 void ActNpc084(NPCHAR *npc);
 void ActNpc085(NPCHAR *npc);
 void ActNpc086(NPCHAR *npc);
 void ActNpc087(NPCHAR *npc);
+void ActNpc088(NPCHAR *npc);
+void ActNpc089(NPCHAR *npc);
+void ActNpc090(NPCHAR *npc);
+void ActNpc091(NPCHAR *npc);
+void ActNpc092(NPCHAR *npc);
 
 void ActNpc116(NPCHAR *npc);
 
--- a/src/NpcAct000.cpp
+++ b/src/NpcAct000.cpp
@@ -12,6 +12,7 @@
 #include "Triangle.h"
 #include "Frame.h"
 #include "Map.h"
+#include "Caret.h"
 
 //Null
 void ActNpc000(NPCHAR *npc)
@@ -806,6 +807,231 @@
 		npc->rect = rcRight[npc->ani_no];
 }
 
+//Balrog (drop-in)
+void ActNpc009(NPCHAR *npc)
+{
+	switch (npc->act_no)
+	{
+		case 0:
+			npc->act_no = 1;
+			npc->ani_no = 2;
+			// Fallthrough
+		case 1:
+			npc->ym += 0x20;
+
+			if (npc->count1 >= 40)
+			{
+				npc->bits &= ~8;
+				npc->bits |= 1;
+			}
+			else
+			{
+				++npc->count1;
+			}
+
+			if (npc->flag & 8)
+			{
+				for (int i = 0; i < 4; ++i)
+					SetNpChar(4, npc->x + (Random(-12, 12) * 0x200), npc->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
+
+				npc->act_no = 2;
+				npc->ani_no = 1;
+				npc->act_wait = 0;
+				PlaySoundObject(26, 1);
+				SetQuake(30);
+			}
+
+			break;
+
+		case 2:
+			if (++npc->act_wait > 16)
+			{
+				npc->act_no = 3;
+				npc->ani_no = 0;
+				npc->ani_wait = 0;
+			}
+
+			break;
+	}
+
+	if (npc->ym > 0x5FF)
+		npc->ym = 0x5FF;
+	if (npc->ym < -0x5FF)
+		npc->ym = -0x5FF;
+
+	npc->x += npc->xm;
+	npc->y += npc->ym;
+
+	RECT rect_left[3];
+	RECT rect_right[3];
+
+	rect_left[0] = {0, 0, 40, 24};
+	rect_left[1] = {80, 0, 120, 24};
+	rect_left[2] = {120, 0, 160, 24};
+
+	rect_right[0] = {0, 24, 40, 48};
+	rect_right[1] = {80, 24, 120, 48};
+	rect_right[2] = {120, 24, 160, 48};
+
+	if (npc->direct == 0)
+		npc->rect = rect_left[npc->ani_no];
+	else
+		npc->rect = rect_right[npc->ani_no];
+}
+
+//Balrog (shooting) (super-secret version from prototype)
+void ActNpc010(NPCHAR *npc)
+{
+	switch (npc->act_no)
+	{
+		case 0:
+			npc->act_no = 1;
+			// Fallthrough
+		case 1:
+			if (++npc->act_wait > 12)
+			{
+				npc->act_no = 2;
+				npc->act_wait = 0;
+				npc->count1 = 3;
+				npc->ani_no = 1;
+			}
+
+			break;
+
+		case 2:
+			if (++npc->act_wait > 16)
+			{
+				--npc->count1;
+				npc->act_wait = 0;
+
+				unsigned char deg = GetArktan(npc->x - gMC.x, npc->y + 0x800 - gMC.y);
+				deg += Random(-0x10, 0x10);
+				int ym = GetSin(deg);
+				int xm = GetCos(deg);
+				SetNpChar(11, npc->x, npc->y + 0x800, xm, ym, 0, 0, 0x100);
+
+				PlaySoundObject(39, 1);
+
+				if (npc->count1 == 0)
+				{
+					npc->act_no = 3;
+					npc->act_wait = 0;
+				}
+			}
+
+			break;
+
+		case 3:
+			if (++npc->act_wait > 3)
+			{
+				npc->act_no = 4;
+				npc->act_wait = 0;
+				npc->xm = (gMC.x - npc->x) / 100;
+				npc->ym = -0x600;
+				npc->ani_no = 3;
+			}
+
+			break;
+
+		case 4:
+			if (npc->flag & 5)
+				npc->xm = 0;
+
+			if (gMC.y > npc->y + 0x2000)
+				npc->damage = 5;
+			else
+				npc->damage = 0;
+
+			if (npc->flag & 8)
+			{
+				npc->act_no = 5;
+				npc->act_wait = 0;
+				npc->ani_no = 2;
+				PlaySoundObject(26, 1);
+				SetQuake(30);
+				npc->damage = 0;
+			}
+
+			break;
+
+		case 5:
+			npc->xm = 0;
+
+			if (++npc->act_wait > 3)
+			{
+				npc->act_no = 1;
+				npc->act_wait = 0;
+			}
+
+			break;
+	}
+
+	npc->ym += 0x20;
+	if (npc->ym > 0x5FF)
+		npc->ym = 0x5FF;
+
+	npc->x += npc->xm;
+	npc->y += npc->ym;
+
+	RECT rect_left[4];
+	RECT rect_right[4];
+
+	rect_left[0] = {0, 0, 40, 24};
+	rect_left[1] = {40, 0, 80, 24};
+	rect_left[2] = {80, 0, 120, 24};
+	rect_left[3] = {120, 0, 160, 24};
+
+	rect_right[0] = {0, 24, 40, 48};
+	rect_right[1] = {40, 24, 80, 48};
+	rect_right[2] = {80, 24, 120, 48};
+	rect_right[3] = {120, 24, 160, 48};
+
+	if (gMC.x > npc->x)
+		npc->direct = 2;
+	else
+		npc->direct = 0;
+
+	if (npc->direct == 0)
+		npc->rect = rect_left[npc->ani_no];
+	else
+		npc->rect = rect_right[npc->ani_no];
+}
+
+//Proto-Balrog's projectile
+void ActNpc011(NPCHAR *npc)
+{
+	if (npc->flag & 0xFF)
+	{
+		npc->cond = 0;
+		SetCaret(npc->x, npc->y, 2, 0);
+	}
+
+	npc->y += npc->ym;
+	npc->x += npc->xm;
+
+	RECT rect_left[3];
+
+	rect_left[0] = {208, 104, 224, 120};
+	rect_left[1] = {224, 104, 240, 120};
+	rect_left[2] = {240, 104, 256, 120};
+
+	if (++npc->ani_wait > 1)
+	{
+		npc->ani_wait = 0;
+
+		if (++npc->ani_no > 2)
+			npc->ani_no = 0;
+	}
+
+	npc->rect = rect_left[npc->ani_no];
+
+	if (++npc->count1 > 150)
+	{
+		SetCaret(npc->x, npc->y, 2, 0);
+		npc->cond = 0;
+	}
+}
+
 //Balrog (cutscene)
 void ActNpc012(NPCHAR *npc)
 {
@@ -1132,6 +1358,68 @@
 		if (npc->act_wait % 2)
 			++npc->rect.left;
 	}
+}
+
+//Forcefield
+void ActNpc013(NPCHAR *npc)
+{
+	RECT rect[4];
+
+	rect[0] = {128, 0, 144, 16};
+	rect[1] = {144, 0, 160, 16};
+	rect[2] = {160, 0, 176, 16};
+	rect[3] = {176, 0, 192, 16};
+
+	if (++npc->ani_wait > 0)
+	{
+		npc->ani_wait = 0;
+		++npc->ani_no;
+	}
+
+	if (npc->ani_no > 3)
+		npc->ani_no = 0;
+
+	npc->rect = rect[npc->ani_no];
+}
+
+//Santa's Key
+void ActNpc014(NPCHAR *npc)
+{
+	RECT rect[3];
+
+	rect[0] = {192, 0, 208, 16};
+	rect[1] = {208, 0, 224, 16};
+	rect[2] = {224, 0, 240, 16};
+
+	if (npc->act_no == 0)
+	{
+		npc->act_no = 1;
+
+		if (npc->direct == 2)
+		{
+			npc->ym = -0x200;
+
+			for (int i = 0; i < 4; ++i)
+				SetNpChar(4, npc->x + (Random(-12, 12) * 0x200), npc->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
+		}
+	}
+
+	if (++npc->ani_wait > 1)
+	{
+		npc->ani_wait = 0;
+		++npc->ani_no;
+	}
+
+	if (npc->ani_no > 2)
+		npc->ani_no = 0;
+
+	npc->ym += 0x40;
+	if (npc->ym > 0x5FF)
+		npc->ym = 0x5FF;
+
+	npc->y += npc->ym;
+
+	npc->rect = rect[npc->ani_no];
 }
 
 //Chest (closed)
--- a/src/NpcAct080.cpp
+++ b/src/NpcAct080.cpp
@@ -9,6 +9,8 @@
 #include "Back.h"
 #include "Triangle.h"
 #include "Caret.h"
+#include "Flash.h"
+#include "Frame.h"
 
 //Gravekeeper
 void ActNpc080(NPCHAR *npc)
@@ -302,6 +304,209 @@
 		npc->rect = rcRight[npc->ani_no];
 }
 
+//Misery (standing)
+void ActNpc082(NPCHAR *npc)
+{
+	switch (npc->act_no)
+	{
+		case 0:
+			npc->act_no = 1;
+			npc->ani_no = 2;
+			// Fallthrough
+		case 1:
+			if (Random(0, 120) == 10)
+			{
+				npc->act_no = 2;
+				npc->act_wait = 0;
+				npc->ani_no = 3;
+			}
+
+			break;
+
+		case 2:
+			if (++npc->act_wait > 8)
+			{
+				npc->act_no = 1;
+				npc->ani_no = 2;
+			}
+
+			break;
+
+		case 15:
+			npc->act_no = 16;
+			npc->act_wait = 0;
+			npc->ani_no = 4;
+			// Fallthrough
+		case 16:
+			if (++npc->act_wait == 30)
+			{
+				PlaySoundObject(21, 1);
+				SetNpChar(66, npc->x, npc->y - 0x2000, 0, 0, 0, npc, 0);
+			}
+
+			if (npc->act_wait == 50)
+				npc->act_no = 14;
+
+			break;
+
+		case 20:
+			npc->act_no = 21;
+			npc->ani_no = 0;
+			npc->ym = 0;
+			npc->bits |= 8;
+			// Fallthrough
+		case 21:
+			npc->ym -= 0x20;
+
+			if (npc->y < -0x1000)
+				npc->cond = 0;
+
+			break;
+
+		case 25:
+			npc->act_no = 26;
+			npc->act_wait = 0;
+			npc->ani_no = 5;
+			npc->ani_wait = 0;
+			// Fallthrough
+		case 26:
+			if (++npc->ani_no > 7)
+				npc->ani_no = 5;
+
+			if (++npc->act_wait == 30)
+			{
+				PlaySoundObject(101, 1);
+				SetFlash(0, 0, 2);
+				npc->act_no = 27;
+				npc->ani_no = 7;
+			}
+
+			break;
+
+		case 27:
+			if (++npc->act_wait == 50)
+			{
+				npc->act_no = 0;
+				npc->ani_no = 0;
+			}
+
+			break;
+
+		case 30:
+			npc->act_no = 31;
+			npc->ani_no = 3;
+			npc->ani_wait = 0;
+			// Fallthrough
+		case 31:
+			if (++npc->ani_wait > 10)
+			{
+				npc->act_no = 32;
+				npc->ani_no = 4;
+				npc->ani_wait = 0;
+			}
+
+			break;
+
+		case 32:
+			if (++npc->ani_wait > 100)
+			{
+				npc->act_no = 1;
+				npc->ani_no = 2;
+			}
+
+			break;
+
+		case 40:
+			npc->act_no = 41;
+			npc->act_wait = 0;
+			// Fallthrough
+		case 41:
+			npc->ani_no = 4;
+
+			switch (++npc->act_wait)
+			{
+				case 30:
+				case 40:
+				case 50:
+					SetNpChar(11, npc->x + 0x1000, npc->y - 0x1000, 0x600, Random(-0x200, 0), 0, 0, 0x100);
+					PlaySoundObject(33, 1);
+					break;
+			}
+
+			if (npc->act_wait > 50)
+				npc->act_no = 0;
+
+			break;
+
+		case 50:
+			npc->ani_no = 8;
+			break;
+	}
+
+	npc->x += npc->xm;
+	npc->y += npc->ym;
+
+	RECT rcLeft[9];
+	RECT rcRight[9];
+
+	rcLeft[0] = {80, 0, 96, 16};
+	rcLeft[1] = {96, 0, 112, 16};
+	rcLeft[2] = {112, 0, 128, 16};
+	rcLeft[3] = {128, 0, 144, 16};
+	rcLeft[4] = {144, 0, 160, 16};
+	rcLeft[5] = {160, 0, 176, 16};
+	rcLeft[6] = {176, 0, 192, 16};
+	rcLeft[7] = {144, 0, 160, 16};
+	rcLeft[8] = {208, 64, 224, 80};
+
+	rcRight[0] = {80, 16, 96, 32};
+	rcRight[1] = {96, 16, 112, 32};
+	rcRight[2] = {112, 16, 128, 32};
+	rcRight[3] = {128, 16, 144, 32};
+	rcRight[4] = {144, 16, 160, 32};
+	rcRight[5] = {160, 16, 176, 32};
+	rcRight[6] = {176, 16, 192, 32};
+	rcRight[7] = {144, 16, 160, 32};
+	rcRight[8] = {208, 80, 224, 96};
+
+	if (npc->act_no == 11)
+	{
+		if (npc->ani_wait)
+		{
+			--npc->ani_wait;
+			npc->ani_no = 1;
+		}
+		else
+		{
+			if (Random(0, 100) == 1)
+				npc->ani_wait = 30;
+
+			npc->ani_no = 0;
+		}
+	}
+
+	if (npc->act_no == 14)
+	{
+		if (npc->ani_wait)
+		{
+			--npc->ani_wait;
+			npc->ani_no = 3;
+		}
+		else
+		{
+			if (Random(0, 100) == 1)
+				npc->ani_wait = 30;
+
+			npc->ani_no = 2;
+		}
+	}
+
+	if (npc->direct == 0)
+		npc->rect = rcLeft[npc->ani_no];
+	else
+		npc->rect = rcRight[npc->ani_no];
+}
+
 //Igor (cutscene)
 void ActNpc083(NPCHAR *npc)
 {
@@ -649,4 +854,452 @@
 
 	if (npc->count1 > 547)
 		npc->rect = rcLast[0];
+}
+
+// Igor (boss)
+void ActNpc088(NPCHAR *npc)
+{
+	RECT rcLeft[12];
+	RECT rcRight[12];
+
+	rcLeft[0] = {0, 0, 40, 40};
+	rcLeft[1] = {40, 0, 80, 40};
+	rcLeft[2] = {80, 0, 120, 40};
+	rcLeft[3] = {0, 0, 40, 40};
+	rcLeft[4] = {120, 0, 160, 40};
+	rcLeft[5] = {0, 0, 40, 40};
+	rcLeft[6] = {160, 0, 200, 40};
+	rcLeft[7] = {200, 0, 240, 40};
+	rcLeft[8] = {0, 80, 40, 120};
+	rcLeft[9] = {40, 80, 80, 120};
+	rcLeft[10] = {240, 0, 280, 40};
+	rcLeft[11] = {280, 0, 320, 40};
+
+	rcRight[0] = {0, 40, 40, 80};
+	rcRight[1] = {40, 40, 80, 80};
+	rcRight[2] = {80, 40, 120, 80};
+	rcRight[3] = {0, 40, 40, 80};
+	rcRight[4] = {120, 40, 160, 80};
+	rcRight[5] = {0, 40, 40, 80};
+	rcRight[6] = {160, 40, 200, 80};
+	rcRight[7] = {200, 40, 240, 80};
+	rcRight[8] = {120, 80, 160, 120};
+	rcRight[9] = {160, 80, 200, 120};
+	rcRight[10] = {240, 40, 280, 80};
+	rcRight[11] = {280, 40, 320, 80};
+
+	switch (npc->act_no)
+	{
+		case 0:
+			npc->xm = 0;
+			npc->act_no = 1;
+			npc->ani_no = 0;
+			npc->ani_wait = 0;
+			// Fallthrough
+		case 1:
+			if (++npc->ani_wait > 5)
+			{
+				npc->ani_wait = 0;
+				++npc->ani_no;
+			}
+
+			if (npc->ani_no > 1)
+				npc->ani_no = 0;
+
+			if (++npc->act_wait > 50)
+				npc->act_no = 2;
+
+			break;
+
+		case 2:
+			npc->act_no = 3;
+			npc->act_wait = 0;
+			npc->ani_no = 2;
+			npc->ani_wait = 0;
+
+			if (++npc->count1 < 3 || npc->life > 150)
+			{
+				npc->count2 = 0;
+				if (gMC.x < npc->x)
+					npc->direct = 0;
+				else
+					npc->direct = 2;
+			}
+			else
+			{
+				npc->count2 = 1;
+
+				if (gMC.x < npc->x)
+					npc->direct = 2;
+				else
+					npc->direct = 0;
+			}
+			// Fallthrough
+		case 3:
+			++npc->act_wait;
+
+			if (++npc->ani_wait > 3)
+			{
+				npc->ani_wait = 0;
+				++npc->ani_no;
+			}
+
+			if (npc->ani_no > 5)
+				npc->ani_no = 2;
+
+			if (npc->direct == 0)
+				npc->xm = -0x200;
+			else
+				npc->xm = 0x200;
+
+			if (npc->count2)
+			{
+				if (npc->act_wait > 16)
+				{
+					npc->act_no = 9;
+					npc->xm = 0;
+					npc->ani_no = 10;
+				}
+			}
+			else if (npc->act_wait > 50)
+			{
+				npc->ani_no = 8;
+				npc->ym = -0x400;
+				npc->act_no = 7;
+				npc->act_wait = 0;
+				npc->xm = 3 * npc->xm / 2;
+				npc->damage = 2;
+			}
+			else
+			{
+				if (npc->direct == 0)
+				{
+					if ( npc->x - 0x3000 < gMC.x )
+						npc->act_no = 4;
+				}
+				else
+				{
+					if ( npc->x + 0x3000 > gMC.x )
+						npc->act_no = 4;
+				}
+			}
+
+			break;
+
+		case 4:
+			npc->xm = 0;
+			npc->act_no = 5;
+			npc->act_wait = 0;
+			npc->ani_no = 6;
+			// Fallthrough
+		case 5:
+			if (++npc->act_wait > 12)
+			{
+				npc->act_wait = 0;
+				npc->act_no = 6;
+				npc->ani_no = 7;
+				PlaySoundObject(70, 1);
+				npc->damage = 5;
+				npc->hit.front = 0x3000;
+				npc->hit.top = 1;
+			}
+
+			break;
+
+		case 6:
+			if (++npc->act_wait > 10)
+			{
+				npc->act_no = 0;
+				npc->ani_no = 0;
+				npc->damage = 0;
+				npc->hit.front = 0x1000;
+				npc->hit.top = 0x2000;
+			}
+
+			break;
+
+		case 7:
+			if (npc->flag & 8)
+			{
+				npc->act_no = 8;
+				npc->ani_no = 9;
+				PlaySoundObject(26, 1);
+				SetQuake(30);
+				npc->damage = 0;
+
+				for (int i = 0; i < 4; ++i)
+					SetNpChar(4, npc->x + (Random(-12, 12) * 0x200), npc->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
+			}
+
+			break;
+
+		case 8:
+			npc->xm = 0;
+
+			if (++npc->act_wait > 10)
+			{
+				npc->act_no = 0;
+				npc->ani_no = 0;
+				npc->damage = 0;
+			}
+
+			break;
+
+		case 9:
+			npc->act_no = 10;
+			npc->act_wait = 0;
+
+			if (gMC.x < npc->x)
+				npc->direct = 0;
+			else
+				npc->direct = 2;
+
+			// Fallthrough
+		case 10:
+			if (++npc->act_wait > 100 && npc->act_wait % 6 == 1)
+			{
+				unsigned char deg;
+
+				if (npc->direct == 0)
+					deg = -120;
+				else
+					deg = -8;
+
+				deg += Random(-16, 16);
+				int ym = 3 * GetSin(deg);
+				int xm = 3 * GetCos(deg);
+				SetNpChar(11, npc->x, npc->y + 0x800, xm, ym, 0, 0, 0x100);
+
+				PlaySoundObject(12, 1);
+			}
+
+			if (npc->act_wait > 50 && npc->act_wait / 2 % 2)
+				npc->ani_no = 11;
+			else
+				npc->ani_no = 10;
+
+			if (npc->act_wait > 132)
+			{
+				npc->act_no = 0;
+				npc->ani_no = 0;
+				npc->count1 = 0;
+			}
+
+			break;
+	}
+
+	npc->ym += 0x40;
+	if (npc->ym > 0x5FF)
+		npc->ym = 0x5FF;
+
+	npc->x += npc->xm;
+	npc->y += npc->ym;
+
+	if (npc->direct == 0)
+		npc->rect = rcLeft[npc->ani_no];
+	else
+		npc->rect = rcRight[npc->ani_no];
+}
+
+// Igor (defeated)
+void ActNpc089(NPCHAR *npc)
+{
+	RECT rcLeft[4];
+	RECT rcRight[4];
+
+	rcLeft[0] = {80, 80, 120, 120};
+	rcLeft[1] = {240, 80, 264, 104};
+	rcLeft[2] = {264, 80, 288, 104};
+	rcLeft[3] = {288, 80, 312, 104};
+
+	rcRight[0] = {200, 80, 240, 120};
+	rcRight[1] = {240, 104, 264, 128};
+	rcRight[2] = {264, 104, 288, 128};
+	rcRight[3] = {288, 104, 312, 128};
+
+	switch (npc->act_no)
+	{
+		case 0:
+			PlaySoundObject(72, 1);
+
+			if (gMC.x < npc->x)
+				npc->direct = 0;
+			else
+				npc->direct = 2;
+
+			for (int i = 0; i < 8; ++i)
+				SetNpChar(4, npc->x + (Random(-12, 12) * 0x200), npc->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
+
+			npc->act_no = 1;
+			// Fallthrough
+		case 1:
+			if (++npc->act_wait > 100)
+			{
+				npc->act_wait = 0;
+				npc->act_no = 2;
+			}
+
+			if (npc->act_wait % 5 == 0)
+				SetNpChar(4, npc->x + (Random(-12, 12) * 0x200), npc->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
+
+			if (npc->direct == 0)
+				npc->rect = rcLeft[0];
+			else
+				npc->rect = rcRight[0];
+
+			if (npc->act_wait / 2 % 2)
+				--npc->rect.left;
+
+			break;
+
+		case 2:
+			if (++npc->act_wait / 2 % 2 && npc->act_wait < 100)
+			{
+				npc->ani_no = 0;
+				npc->view.back = 0x2800;
+				npc->view.front = 0x2800;
+				npc->view.top = 0x2800;
+			}
+			else
+			{
+				npc->ani_no = 1;
+				npc->view.back = 0x1800;
+				npc->view.front = 0x1800;
+				npc->view.top = 0x1000;
+			}
+
+			if (npc->act_wait > 150)
+			{
+				npc->act_wait = 0;
+				npc->act_no = 3;
+				npc->ani_no = 1;
+			}
+
+			if (npc->act_wait % 9 == 0)
+				SetNpChar(4, npc->x + (Random(-12, 12) * 0x200), npc->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100);
+
+			if (npc->direct == 0)
+				npc->rect = rcLeft[npc->ani_no];
+			else
+				npc->rect = rcRight[npc->ani_no];
+
+			break;
+
+		case 3:
+			if (++npc->ani_wait > 50)
+			{
+				npc->ani_wait = 0;
+				++npc->ani_no;
+			}
+
+			if (npc->ani_no == 3)
+				npc->act_no = 4;
+
+			if (npc->direct == 0)
+				npc->rect = rcLeft[npc->ani_no];
+			else
+				npc->rect = rcRight[npc->ani_no];
+
+			break;
+	}
+
+	npc->ym += 0x40;
+	if (npc->ym > 0x5FF)
+		npc->ym = 0x5FF;
+
+	npc->x += npc->xm;
+	npc->y += npc->ym;
+}
+
+// Unknown
+void ActNpc090(NPCHAR *npc)
+{
+	RECT rect[1];
+
+	rect[0] = {280, 80, 296, 104};
+
+	npc->rect = rect[0];
+}
+
+// Cage
+void ActNpc091(NPCHAR *npc)
+{
+	RECT rect[1];
+
+	rect[0] = {96, 88, 128, 112};
+
+	if (npc->act_no == 0)
+	{
+		++npc->act_no;
+		npc->y += 0x10 * 0x200;
+	}
+
+	npc->rect = rect[0];
+}
+
+// Sue at PC
+void ActNpc092(NPCHAR *npc)
+{
+	RECT rcLeft[3];
+
+	rcLeft[0] = {272, 216, 288, 240};
+	rcLeft[1] = {288, 216, 304, 240};
+	rcLeft[2] = {304, 216, 320, 240};
+
+	switch (npc->act_no)
+	{
+		case 0:
+			npc->x -= 0x800;
+			npc->y += 0x2000;
+			npc->act_no = 1;
+			npc->ani_no = 0;
+			npc->ani_wait = 0;
+			// Fallthrough
+		case 1:
+			if (++npc->ani_wait > 2)
+			{
+				npc->ani_wait = 0;
+				++npc->ani_no;
+			}
+
+			if (npc->ani_no > 1)
+				npc->ani_no = 0;
+
+			if (Random(0, 80) == 1)
+			{
+				npc->act_no = 2;
+				npc->act_wait = 0;
+				npc->ani_no = 1;
+			}
+
+			if (Random(0, 120) == 10)
+			{
+				npc->act_no = 3;
+				npc->act_wait = 0;
+				npc->ani_no = 2;
+			}
+
+			break;
+
+		case 2:
+			if (++npc->act_wait > 40)
+			{
+				npc->act_no = 3;
+				npc->act_wait = 0;
+				npc->ani_no = 2;
+			}
+
+			break;
+
+		case 3:
+			if (++npc->act_wait > 80)
+			{
+				npc->act_no = 1;
+				npc->ani_no = 0;
+			}
+
+			break;
+	}
+
+	npc->rect = rcLeft[npc->ani_no];
 }
--- a/src/NpcTbl.cpp
+++ b/src/NpcTbl.cpp
@@ -65,12 +65,12 @@
 	ActNpc006,
 	ActNpc007,
 	ActNpc008,
-	nullptr,
-	nullptr,
-	nullptr,
+	ActNpc009,
+	ActNpc010,
+	ActNpc011,
 	ActNpc012,
-	nullptr,
-	nullptr,
+	ActNpc013,
+	ActNpc014,
 	ActNpc015,
 	ActNpc016,
 	ActNpc017,
@@ -138,17 +138,17 @@
 	ActNpc079,
 	ActNpc080,
 	ActNpc081,
-	nullptr,
+	ActNpc082,
 	ActNpc083,
 	ActNpc084,
 	ActNpc085,
 	ActNpc086,
 	ActNpc087,
-	nullptr,
-	nullptr,
-	nullptr,
-	nullptr,
-	nullptr,
+	ActNpc088,
+	ActNpc089,
+	ActNpc090,
+	ActNpc091,
+	ActNpc092,
 	nullptr,
 	nullptr,
 	nullptr,
--- a/src/Triangle.cpp
+++ b/src/Triangle.cpp
@@ -9,17 +9,17 @@
 	//Sine
 	for (int i = 0; i < 0x100; ++i )
 	{
-		float v0 = (float)i * 6.2831998 / 256.0;
+		float v0 = i * 6.2831998 / 256.0;
 		gSin[i] = (int)(sinf(v0) * 512.0);
 	}
 	
 	//Tangent
-	for (int ia = 0; ia < 0x21; ++ia )
+	for (int i = 0; i < 0x21; ++i )
 	{
-		float a = (float)ia * 6.2831855 / 256.0;
+		float a = i * 6.2831855 / 256.0;
 		float v2 = sinf(a);
 		float b = v2 / cosf(a);
-		gTan[ia] = (int16_t)(b * 8192.0);
+		gTan[i] = (int16_t)(b * 8192.0);
 	}
 }