ref: 11f6bf9f168feba5672ee352a02fded0ce453215
parent: 98c5db93f272e1068bc02a3e408737412f207aaa
parent: cc1df04fabc69ad1f0665cef42249a06978bbce6
author: Gabriel Ravier <[email protected]>
date: Mon May 13 15:17:40 EDT 2019
Merge pull request #18 from Clownacy/master Merge Clownacy/master into master
--- a/msvc2003/CSE2.vcproj
+++ b/msvc2003/CSE2.vcproj
@@ -21,7 +21,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="SDL2/include;freetype/include;./"
+ AdditionalIncludeDirectories="SDL2/include;freetype/include"
PreprocessorDefinitions="WIN32;_DEBUG;WINDOWS;NONPORTABLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="0"
@@ -73,7 +73,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="SDL2/include;freetype/include;./"
+ AdditionalIncludeDirectories="SDL2/include;freetype/include"
PreprocessorDefinitions="WIN32;NDEBUG;WINDOWS;NONPORTABLE"
MinimalRebuild="TRUE"
RuntimeLibrary="0"
@@ -123,7 +123,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="SDL2/include;freetype/include;./"
+ AdditionalIncludeDirectories="SDL2/include;freetype/include"
PreprocessorDefinitions="WIN32;NDEBUG;WINDOWS;NONPORTABLE;JAPANESE"
MinimalRebuild="TRUE"
RuntimeLibrary="0"
@@ -173,7 +173,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="SDL2/include;freetype/include;./"
+ AdditionalIncludeDirectories="SDL2/include;freetype/include"
PreprocessorDefinitions="WIN32;_DEBUG;WINDOWS;NONPORTABLE;JAPANESE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="0"
--- a/msvc2003/devilution/comparer-config.toml
+++ b/msvc2003/devilution/comparer-config.toml
@@ -516,6 +516,190 @@
addr = 0x414B40
[[func]]
+name = "InitMyChar"
+addr = 0x414B50
+
+[[func]]
+name = "AnimationMyChar"
+addr = 0x414BF0
+
+[[func]]
+name = "ShowMyChar"
+addr = 0x415220
+
+[[func]]
+name = "PutMyChar"
+addr = 0x415250
+
+[[func]]
+name = "ActMyChar_Normal"
+addr = 0x4156C0
+
+[[func]]
+name = "ActMyChar_Stream"
+addr = 0x416470
+
+[[func]]
+name = "ActMyChar"
+addr = 0x4168C0
+
+[[func]]
+name = "AirProcess"
+addr = 0x416990
+
+[[func]]
+name = "GetMyCharPosition"
+addr = 0x416AA0
+
+[[func]]
+name = "SetMyCharPosition"
+addr = 0x416AC0
+
+[[func]]
+name = "MoveMyChar"
+addr = 0x416B30
+
+[[func]]
+name = "ZeroMyCharXMove"
+addr = 0x416B50
+
+[[func]]
+name = "GetUnitMyChar"
+addr = 0x416B60
+
+[[func]]
+name = "SetMyCharDirect"
+addr = 0x416B70
+
+[[func]]
+name = "ChangeMyUnit"
+addr = 0x416C40
+
+[[func]]
+name = "PitMyChar"
+addr = 0x416C50
+
+[[func]]
+name = "EquipItem"
+addr = 0x416C70
+
+[[func]]
+name = "ResetCheck"
+addr = 0x416CA0
+
+[[func]]
+name = "SetNoise"
+addr = 0x416CC0
+
+[[func]]
+name = "CutNoise"
+addr = 0x416D40
+
+[[func]]
+name = "ResetNoise"
+addr = 0x416D80
+
+[[func]]
+name = "SleepNoise"
+addr = 0x416DF0
+
+[[func]]
+name = "ResetMyCharFlag"
+addr = 0x416E20
+
+[[func]]
+name = "JudgeHitMyCharBlock"
+addr = 0x416E30
+
+[[func]]
+name = "PutlittleStar"
+addr = 0x417160
+
+[[func]]
+name = "JudgeHitMyCharTriangleA"
+addr = 0x4171D0
+
+[[func]]
+name = "JudgeHitMyCharTriangleB"
+addr = 0x4172E0
+
+[[func]]
+name = "JudgeHitMyCharTriangleC"
+addr = 0x4173F0
+
+[[func]]
+name = "JudgeHitMyCharTriangleD"
+addr = 0x417500
+
+[[func]]
+name = "JudgeHitMyCharTriangleE"
+addr = 0x417610
+
+[[func]]
+name = "JudgeHitMyCharTriangleF"
+addr = 0x417720
+
+[[func]]
+name = "JudgeHitMyCharTriangleG"
+addr = 0x417830
+
+[[func]]
+name = "JudgeHitMyCharTriangleH"
+addr = 0x417940
+
+[[func]]
+name = "JudgeHitMyCharWater"
+addr = 0x417A50
+
+[[func]]
+name = "JudgeHitMyCharDamage"
+addr = 0x417AE0
+
+[[func]]
+name = "JudgeHitMyCharDamageW"
+addr = 0x417B70
+
+[[func]]
+name = "JudgeHitMyCharVectLeft"
+addr = 0x417C00
+
+[[func]]
+name = "JudgeHitMyCharVectUp"
+addr = 0x417C90
+
+[[func]]
+name = "JudgeHitMyCharVectRight"
+addr = 0x417D20
+
+[[func]]
+name = "JudgeHitMyCharVectDown"
+addr = 0x417DB0
+
+[[func]]
+name = "HitMyCharMap"
+addr = 0x417E40
+
+[[func]]
+name = "JudgeHitMyCharNPC"
+addr = 0x4187F0
+
+[[func]]
+name = "JudgeHitMyCharNPC3"
+addr = 0x418B10
+
+[[func]]
+name = "JudgeHitMyCharNPC4"
+addr = 0x418C20
+
+[[func]]
+name = "HitMyCharNpChar"
+addr = 0x419030
+
+[[func]]
+name = "HitMyCharBoss"
+addr = 0x419450
+
+[[func]]
name = "AddExpMyChar"
addr = 0x4196F0
@@ -2201,6 +2385,150 @@
[[func]]
name = "ActNpc360"
addr = 0x46EA90
+
+[[func]]
+name = "InitNpChar"
+addr = 0x46EB30
+
+[[func]]
+name = "LoadEvent"
+addr = 0x46EB50
+
+[[func]]
+name = "SetUniqueParameter"
+addr = 0x46EE50
+
+[[func]]
+name = "SetNpChar"
+addr = 0x46EFD0
+
+[[func]]
+name = "SetDestroyNpChar"
+addr = 0x46F150
+
+[[func]]
+name = "SetDestroyNpCharUp"
+addr = 0x46F200
+
+[[func]]
+name = "SetExpObjects"
+addr = 0x46F2B0
+
+[[func]]
+name = "SetBulletObject"
+addr = 0x46F430
+
+[[func]]
+name = "SetLifeObject"
+addr = 0x46F630
+
+[[func]]
+name = "VanishNpChar"
+addr = 0x46F760
+
+[[func]]
+name = "PutNpChar"
+addr = 0x46F810
+
+[[func]]
+name = "ActNpChar"
+addr = 0x46FA00
+
+[[func]]
+name = "ChangeNpCharByEvent"
+addr = 0x46FAB0
+
+[[func]]
+name = "ChangeCheckableNpCharByEvent"
+addr = 0x46FD10
+
+[[func]]
+name = "SetNpCharActionNo"
+addr = 0x46FF90
+
+[[func]]
+name = "MoveNpChar"
+addr = 0x470060
+
+[[func]]
+name = "BackStepMyChar"
+addr = 0x470150
+
+[[func]]
+name = "DeleteNpCharEvent"
+addr = 0x470250
+
+[[func]]
+name = "DeleteNpCharCode"
+addr = 0x4702D0
+
+[[func]]
+name = "GetNpCharPosition"
+addr = 0x470460
+
+[[func]]
+name = "IsNpCharCode"
+addr = 0x470490
+
+[[func]]
+name = "GetNpCharAlive"
+addr = 0x4704F0
+
+[[func]]
+name = "CountAliveNpChar"
+addr = 0x470560
+
+[[func]]
+name = "JadgeHitNpCharBlock"
+addr = 0x4705C0
+
+[[func]]
+name = "JudgeHitNpCharTriangleA"
+addr = 0x470870
+
+[[func]]
+name = "JudgeHitNpCharTriangleB"
+addr = 0x470970
+
+[[func]]
+name = "JudgeHitNpCharTriangleC"
+addr = 0x470A70
+
+[[func]]
+name = "JudgeHitNpCharTriangleD"
+addr = 0x470B70
+
+[[func]]
+name = "JudgeHitNpCharTriangleE"
+addr = 0x470C70
+
+[[func]]
+name = "JudgeHitNpCharTriangleF"
+addr = 0x470D80
+
+[[func]]
+name = "JudgeHitNpCharTriangleG"
+addr = 0x470E90
+
+[[func]]
+name = "JudgeHitNpCharTriangleH"
+addr = 0x470FA0
+
+[[func]]
+name = "JudgeHitNpCharWater"
+addr = 0x4710B0
+
+[[func]]
+name = "HitNpCharMap"
+addr = 0x471160
+
+[[func]]
+name = "LoseNpChar"
+addr = 0x471B80
+
+[[func]]
+name = "HitNpCharBullet"
+addr = 0x471D50
[[func]]
name = "LoadNpcTable"
--- a/msvc2003/stdint.h
+++ /dev/null
@@ -1,13 +1,0 @@
-#ifndef _STDINT_H_
-#define _STDINT_H_
-
-typedef signed __int8 int8_t;
-typedef unsigned __int8 uint8_t;
-typedef signed __int16 int16_t;
-typedef unsigned __int16 uint16_t;
-typedef signed __int32 int32_t;
-typedef unsigned __int32 uint32_t;
-typedef signed __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-
-#endif /*_STDINT_H_*/
--- a/src/Back.cpp
+++ b/src/Back.cpp
@@ -36,8 +36,7 @@
#ifdef NONPORTABLE
// This is ridiculously platform-dependant:
- // It should break on big-endian CPUs, and platforms
- // where short isn't 16-bit and long isn't 32-bit.
+ // It should break on big-endian CPUs, and platforms where short isn't 16-bit and long isn't 32-bit.
unsigned short bmp_header_buffer[7]; // These names aren't the original. This ruins the stack frame layout.
unsigned long bmp_header_buffer2[10];
--- a/src/Boss.cpp
+++ b/src/Boss.cpp
@@ -1,6 +1,5 @@
#include "Boss.h"
-#include <stdint.h>
#include <string.h>
#include "WindowsWrapper.h"
--- a/src/BossBallos.cpp
+++ b/src/BossBallos.cpp
@@ -142,6 +142,7 @@
switch (npc->act_no)
{
case 0:
+ // Initialize main boss
npc->act_no = 1;
npc->cond = 0x80;
npc->exp = 1;
@@ -159,6 +160,7 @@
npc->code_event = 1000;
npc->life = 800;
+ // Initialize eyes
gBoss[1].cond = 0x90;
gBoss[1].direct = 0;
gBoss[1].bits = 8;
@@ -175,6 +177,7 @@
gBoss[2] = gBoss[1];
gBoss[2].direct = 2;
+ // Initialize the body
gBoss[3].cond = 0x90;
gBoss[3].bits = 0xD;
gBoss[3].view.front = 0x7800;
--- a/src/BossFrog.cpp
+++ b/src/BossFrog.cpp
@@ -10,6 +10,7 @@
#include "Sound.h"
#include "Triangle.h"
+// Balfrog's mouth
static void ActBossChar02_01(void)
{
NPCHAR *boss;
@@ -84,6 +85,7 @@
}
}
+// Main boss AI
void ActBossChar_Frog(void)
{
int i;
@@ -91,6 +93,7 @@
int ym;
int xm;
+ // Rects 1-4 are for when Balfrog is a frog, 5-8 for when he reverts and goes into the ceiling
RECT rcLeft[9] = {
{0, 0, 0, 0},
{0, 48, 80, 112},
--- a/src/BossX.cpp
+++ b/src/BossX.cpp
@@ -523,7 +523,7 @@
gBoss[2].direct = 2;
gBoss[3].cond = 0x80;
gBoss[3].life = 60;
- gBoss[3].size = 3; // Redundant: this get overwriten a few lines later
+ gBoss[3].size = 3; // Redundant: this get overwritten a few lines later
gBoss[3].hit_voice = 54;
gBoss[3].destroy_voice = 71;
gBoss[3].size = 2;
--- a/src/BulHit.cpp
+++ b/src/BulHit.cpp
@@ -45,7 +45,7 @@
return hit;
}
-int JudgeHitBulletBlock2(int x, int y, uint8_t *atrb, BULLET *bul)
+int JudgeHitBulletBlock2(int x, int y, unsigned char *atrb, BULLET *bul)
{
int i;
int workX;
--- a/src/Bullet.h
+++ b/src/Bullet.h
@@ -1,7 +1,5 @@
#pragma once
-#include <stdint.h>
-
#include "WindowsWrapper.h"
struct BULLET
@@ -20,7 +18,7 @@
int act_wait;
int ani_wait;
int ani_no;
- uint8_t direct;
+ unsigned char direct;
RECT rect;
int count1;
int count2;
@@ -36,8 +34,8 @@
struct BULLET_TABLE
{
- int8_t damage;
- int8_t life;
+ signed char damage;
+ signed char life;
int life_count;
int bbits;
int enemyXL;
--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -1,5 +1,4 @@
#include <stddef.h>
-#include <stdint.h>
#include <stdio.h>
#include <string.h>
@@ -16,44 +15,44 @@
BOOL LoadConfigData(CONFIG *conf)
{
- //Clear old config data
+ // Clear old configuration data
memset(conf, 0, sizeof(CONFIG));
- //Get path
+ // Get path
char path[PATH_LENGTH];
sprintf(path, "%s/%s", gModulePath, config_filename);
- //Open file
+ // Open file
FILE *fp = fopen(path, "rb");
if (fp == NULL)
return FALSE;
- //Read data
+ // Read data
#ifdef NONPORTABLE
size_t fread_result = fread(conf, sizeof(CONFIG), 1, fp); // Not the original name
#else
- //Read the version id and font name
+ // Read the version id and font name
fread(conf->proof, sizeof(conf->proof), 1, fp);
fread(conf->font_name, sizeof(conf->font_name), 1, fp);
- //Read control settings
+ // Read control settings
conf->move_button_mode = File_ReadLE32(fp);
conf->attack_button_mode = File_ReadLE32(fp);
conf->ok_button_mode = File_ReadLE32(fp);
- //Read display mode (320x240, 640x480, 24-bit fullscreen, 32-bit fullscreen) TODO: add more things?
+ // Read display mode (320x240, 640x480, 24-bit fullscreen, 32-bit fullscreen) TODO: add more things?
conf->display_mode = File_ReadLE32(fp);
- //Read joystick configuration (if enabled, and mappings)
+ // Read joystick configuration (if enabled, and mappings)
conf->bJoystick = File_ReadLE32(fp);
for (int button = 0; button < 8; button++)
conf->joystick_button[button] = File_ReadLE32(fp);
#endif
- //Close file
+ // Close file
fclose(fp);
- //Check if version is not correct, and return if it failed
+ // Check if version is not correct, and return if it failed
#ifdef NONPORTABLE
if (fread_result != 1 || strcmp(conf->proof, config_magic))
#else
@@ -69,13 +68,13 @@
void DefaultConfigData(CONFIG *conf)
{
- //Clear old config data
+ // Clear old configuration data
memset(conf, 0, sizeof(CONFIG));
- //Fun fact: The Linux port added this line:
- //conf->display_mode = 1;
+ // Fun fact: The Linux port added this line:
+ // conf->display_mode = 1;
- //Reset joystick settings (as these can't simply be set to 0)
+ // Reset joystick settings (as these can't simply be set to 0)
conf->bJoystick = 1;
conf->joystick_button[0] = 2;
conf->joystick_button[1] = 1;
--- a/src/Config.h
+++ b/src/Config.h
@@ -1,7 +1,5 @@
#pragma once
-#include <stdint.h>
-
#include "WindowsWrapper.h"
struct CONFIG
@@ -8,12 +6,12 @@
{
char proof[0x20];
char font_name[0x40];
- int32_t move_button_mode;
- int32_t attack_button_mode;
- int32_t ok_button_mode;
- int32_t display_mode;
- int32_t bJoystick;
- int32_t joystick_button[8];
+ long move_button_mode;
+ long attack_button_mode;
+ long ok_button_mode;
+ long display_mode;
+ long bJoystick;
+ long joystick_button[8];
};
BOOL LoadConfigData(CONFIG *conf);
--- a/src/Draw.cpp
+++ b/src/Draw.cpp
@@ -1,5 +1,4 @@
#include <stddef.h>
-#include <stdint.h>
#include <stdio.h>
#include <string.h>
@@ -57,8 +56,8 @@
return FALSE;
// Framerate limiter
- static uint32_t timePrev;
- const uint32_t timeNow = SDL_GetTicks();
+ static Uint32 timePrev;
+ const Uint32 timeNow = SDL_GetTicks();
if (timeNow >= timePrev + FRAMERATE)
{
@@ -359,6 +358,9 @@
if (data)
{
+ // For some dumbass reason, SDL2 measures size with a signed int.
+ // Has anyone ever told the devs that an int can be as little as 16 bits long? Real portable.
+ // But hey, if I ever need to create an RWops from an array that's -32768 bytes long, they've got me covered!
SDL_RWops *fp = SDL_RWFromConstMem(data, size);
printf("Loading surface from resource %s for surface id %d\n", res, surf_no);
@@ -443,7 +445,7 @@
SDL_Rect clipRect = RectToSDLRectScaled(rcView);
SDL_Rect frameRect = RectToSDLRectScaled(rect);
- // Get dest rect
+ // Get destination rect
SDL_Rect destRect = {x * magnification, y * magnification, frameRect.w, frameRect.h};
// Set cliprect
@@ -485,28 +487,28 @@
return col;
}
-void CortBox(RECT *rect, uint32_t col)
+void CortBox(RECT *rect, unsigned long col)
{
// Get rect
SDL_Rect destRect = RectToSDLRectScaled(rect);
// Set colour and draw
- const unsigned char col_red = col & 0x0000FF;
- const unsigned char col_green = (col & 0x00FF00) >> 8;
- const unsigned char col_blue = (col & 0xFF0000) >> 16;
+ const unsigned char col_red = (unsigned char)(col & 0xFF);
+ const unsigned char col_green = (unsigned char)((col >> 8) & 0xFF);
+ const unsigned char col_blue = (unsigned char)((col >> 16) & 0xFF);
SDL_SetRenderDrawColor(gRenderer, col_red, col_green, col_blue, 0xFF);
SDL_RenderFillRect(gRenderer, &destRect);
}
-void CortBox2(RECT *rect, uint32_t col, Surface_Ids surf_no)
+void CortBox2(RECT *rect, unsigned long col, Surface_Ids surf_no)
{
// Get rect
SDL_Rect destRect = RectToSDLRectScaled(rect);
// Set colour and draw
- const unsigned char col_red = col & 0x0000FF;
- const unsigned char col_green = (col & 0x00FF00) >> 8;
- const unsigned char col_blue = (col & 0xFF0000) >> 16;
+ const unsigned char col_red = (unsigned char)(col & 0xFF);
+ const unsigned char col_green = (unsigned char)((col >> 8) & 0xFF);
+ const unsigned char col_blue = (unsigned char)((col >> 16) & 0xFF);
SDL_FillRect(surf[surf_no].surface, &destRect, SDL_MapRGB(surf[surf_no].surface->format, col_red, col_green, col_blue));
surf[surf_no].needs_updating = true;
}
@@ -610,7 +612,7 @@
gFont = LoadFontFromData(res_data, data_size, fontWidth, fontHeight);
}
-void PutText(int x, int y, const char *text, uint32_t color)
+void PutText(int x, int y, const char *text, unsigned long color)
{
int surface_width, surface_height;
SDL_GetRendererOutputSize(gRenderer, &surface_width, &surface_height);
@@ -626,7 +628,7 @@
SDL_DestroyTexture(screen_texture);
}
-void PutText2(int x, int y, const char *text, uint32_t color, Surface_Ids surf_no)
+void PutText2(int x, int y, const char *text, unsigned long color, Surface_Ids surf_no)
{
DrawText(gFont, (unsigned char*)surf[surf_no].surface->pixels, surf[surf_no].surface->pitch, surf[surf_no].surface->w, surf[surf_no].surface->h, x * magnification, y * magnification, color, text, strlen(text));
surf[surf_no].needs_updating = true;
--- a/src/Draw.h
+++ b/src/Draw.h
@@ -1,7 +1,5 @@
#pragma once
-#include <stdint.h>
-
#include "WindowsWrapper.h"
#ifndef RGB
@@ -68,9 +66,9 @@
void PutBitmap4(RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no);
void Surface2Surface(int x, int y, RECT *rect, int to, int from);
unsigned long GetCortBoxColor(unsigned long col);
-void CortBox(RECT *rect, uint32_t col);
-void CortBox2(RECT *rect, uint32_t col, Surface_Ids surf_no);
+void CortBox(RECT *rect, unsigned long col);
+void CortBox2(RECT *rect, unsigned long col, Surface_Ids surf_no);
void InitTextObject(const char *font_name);
-void PutText(int x, int y, const char *text, uint32_t color);
-void PutText2(int x, int y, const char *text, uint32_t color, Surface_Ids surf_no);
+void PutText(int x, int y, const char *text, unsigned long color);
+void PutText2(int x, int y, const char *text, unsigned long color, Surface_Ids surf_no);
void EndTextObject();
--- a/src/Ending.cpp
+++ b/src/Ending.cpp
@@ -1,6 +1,5 @@
#include "Ending.h"
-#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -184,7 +183,7 @@
// Read data
fread(Credit.pData, 1, Credit.size, fp);
- EncryptionBinaryData2((uint8_t*)Credit.pData, Credit.size);
+ EncryptionBinaryData2((unsigned char*)Credit.pData, Credit.size);
#ifdef FIX_BUGS
// The original game forgot to close the file
@@ -229,7 +228,7 @@
while (Credit.offset < Credit.size)
{
// Get character
- uint8_t character = Credit.pData[Credit.offset];
+ unsigned char character = Credit.pData[Credit.offset];
int a, b, len;
switch (character)
--- a/src/Ending.h
+++ b/src/Ending.h
@@ -1,7 +1,5 @@
#pragma once
-#include <stdint.h>
-
struct CREDIT
{
int size;
--- a/src/Frame.cpp
+++ b/src/Frame.cpp
@@ -13,7 +13,7 @@
void MoveFrame3()
{
- int16_t map_w, map_l;
+ short map_w, map_l;
GetMapData(0, &map_w, &map_l);
#if WINDOW_WIDTH != 320 || WINDOW_HEIGHT != 240 // TODO - Really need to make this a compiler flag
@@ -119,7 +119,7 @@
gFrame.quake2 = 0;
//Move frame position
- int16_t map_w, map_l;
+ short map_w, map_l;
GetMapData(0, &map_w, &map_l);
gFrame.x = fx;
@@ -143,7 +143,7 @@
int mc_x, mc_y;
GetMyCharPosition(&mc_x, &mc_y);
- int16_t map_w, map_l;
+ short map_w, map_l;
GetMapData(0, &map_w, &map_l);
gFrame.x = mc_x - (WINDOW_WIDTH << 8);
--- a/src/Game.cpp
+++ b/src/Game.cpp
@@ -58,7 +58,7 @@
void PutNumber4(int x, int y, int value, bool bZero)
{
- //Define rects
+ // Define rects
RECT rcClient = grcFull;
RECT rect[10] = {
@@ -74,19 +74,19 @@
{72, 56, 80, 64},
};
- //Digits
+ // Digits
int tbl[4] = {1000, 100, 10, 1};
- //Limit value
- if ( value > 9999 )
+ // Limit value
+ if (value > 9999)
value = 9999;
- //Go through number and draw digits
+ // Go through number and draw digits
int offset = 0;
int sw = 0;
while (offset < 4)
{
- //Get the digit that this is
+ // Get the digit that this is
int a = 0;
while (tbl[offset] <= value)
@@ -96,11 +96,11 @@
++sw;
}
- //Draw digit
- if ((bZero && offset == 2) || sw != 0 || offset == 3 )
+ // Draw digit
+ if ((bZero && offset == 2) || sw != 0 || offset == 3)
PutBitmap3(&rcClient, x + 8 * offset, y, &rect[a], SURFACE_ID_TEXT_BOX);
- //Go to next digit
+ // Go to next digit
++offset;
}
}
@@ -118,9 +118,9 @@
SetFrameTargetMyChar(16);
SetFadeMask();
- //Reset cliprect and flags
+ // Reset cliprect and flags
grcGame.left = 0;
- //Non-vanilla: these three lines are widescreen-related(?)
+ // Non-vanilla: these three lines are widescreen-related(?)
grcGame.top = 0;
grcGame.right = WINDOW_WIDTH;
grcGame.bottom = WINDOW_HEIGHT;
@@ -132,13 +132,13 @@
unsigned int wait = 0;
while (wait < 500)
{
- //Increase timer
+ // Increase timer
++wait;
- //Get pressed keys
+ // Get pressed keys
GetTrg();
- //Escape menu
+ // Escape menu
if (gKey & KEY_ESCAPE)
{
int escRet = Call_Escape();
@@ -148,11 +148,11 @@
return 1;
}
- //Skip intro if OK is pressed
+ // Skip intro if OK is pressed
if (gKey & gKeyOk)
break;
- //Update everything
+ // Update everything
ActNpChar();
ActBossChar();
ActBack();
@@ -167,7 +167,7 @@
MoveFrame3();
ProcFade();
- //Draw everything
+ // Draw everything
CortBox(&grcFull, 0x000000);
int frame_x, frame_y;
@@ -182,7 +182,7 @@
PutCaret(frame_x, frame_y);
PutFade();
- //Update Text Script
+ // Update Text Script
int tscRet = TextScriptProc();
if (tscRet == 0)
return 0;
@@ -212,7 +212,7 @@
int ModeTitle()
{
- //Set rects
+ // Set rects
RECT rcTitle = {0, 0, 144, 32};
RECT rcPixel = {0, 0, 160, 16};
@@ -222,7 +222,7 @@
RECT rcVersion = {152, 80, 208, 88};
RECT rcPeriod = {152, 88, 208, 96};
- //Character rects
+ // Character rects
RECT rcMyChar[4] = {
{0, 16, 16, 32},
{16, 16, 32, 32},
@@ -258,21 +258,21 @@
{48, 16, 64, 32},
};
- //Reset everything
+ // Reset everything
InitCaret();
InitStar();
CutNoise();
- //Create variables
+ // Create variables
int anime = 0;
int char_type = 0;
int time_counter = 0;
unsigned long back_color = GetCortBoxColor(RGB(0x20, 0x20, 0x20));
- //Set state
+ // Set state
bContinue = IsProfile();
- //Set character
+ // Set character
time_counter = LoadTimeCounter();
if (time_counter && time_counter < 6 * 60 * 50) // 6 minutes
@@ -284,7 +284,7 @@
if (time_counter && time_counter < 3 * 60 * 50) // 3 minutes
char_type = 4;
- //Set music to character's specific music
+ // Set music to character's specific music
switch (char_type)
{
case 1:
@@ -304,9 +304,9 @@
break;
}
- //Reset cliprect, flags, and give the player the nikumaru counter
+ // Reset cliprect, flags, and give the player the Nikumaru counter
grcGame.left = 0;
- //Non-vanilla: these three lines are widescreen-related(?)
+ // Non-vanilla: these three lines are widescreen-related(?)
grcGame.top = 0;
grcGame.right = WINDOW_WIDTH;
grcGame.bottom = WINDOW_HEIGHT;
@@ -314,19 +314,19 @@
g_GameFlags = 0;
gMC.equip |= 0x100;
- //Start loop
+ // Start loop
unsigned int wait = 0;
while (true)
{
- //Don't accept selection for 10 frames
+ // Don't accept selection for 10 frames
if (wait < 10)
++wait;
- //Get pressed keys
+ // Get pressed keys
GetTrg();
- //Quit when OK is pressed
+ // Quit when OK is pressed
if (wait >= 10)
{
if (gKeyTrg & gKeyOk)
@@ -342,7 +342,7 @@
return 1;
}
- //Move cursor
+ // Move cursor
if ((gKeyDown | gKeyUp) & gKeyTrg)
{
PlaySoundObject(1, 1);
@@ -349,17 +349,17 @@
bContinue = !bContinue;
}
- //Update carets
+ // Update carets
ActCaret();
- //Animate character cursor
- if ( ++anime >= 40 )
+ // Animate character cursor
+ if (++anime >= 40)
anime = 0;
- //Draw title
+ // Draw title
CortBox(&grcGame, back_color);
- //Draw version
+ // Draw version
PutBitmap3(&grcGame, (WINDOW_WIDTH - 120) / 2, WINDOW_HEIGHT - 24, &rcVersion, SURFACE_ID_TEXT_BOX);
PutBitmap3(&grcGame, (WINDOW_WIDTH - 8) / 2, WINDOW_HEIGHT - 24, &rcPeriod, SURFACE_ID_TEXT_BOX);
@@ -370,17 +370,17 @@
PutNumber4((WINDOW_WIDTH + 24) / 2, WINDOW_HEIGHT - 24, v3, 0);
PutNumber4((WINDOW_WIDTH + 56) / 2, WINDOW_HEIGHT - 24, v4, 0);
- //Draw main title
+ // Draw main title
PutBitmap3(&grcGame, (WINDOW_WIDTH - 144) / 2, 40, &rcTitle, SURFACE_ID_TITLE);
PutBitmap3(&grcGame, (WINDOW_WIDTH - 48) / 2, (WINDOW_HEIGHT + 16) / 2, &rcNew, SURFACE_ID_TITLE);
PutBitmap3(&grcGame, (WINDOW_WIDTH - 48) / 2, (WINDOW_HEIGHT + 56) / 2, &rcContinue, SURFACE_ID_TITLE);
PutBitmap3(&grcGame, (WINDOW_WIDTH - 160) / 2, WINDOW_HEIGHT - 48, &rcPixel, SURFACE_ID_PIXEL);
- //Draw character cursor
+ // Draw character cursor
RECT char_rc;
Surface_Ids char_surf;
- switch ( char_type )
+ switch (char_type)
{
case 0:
char_rc = rcMyChar[anime / 10 % 4];
@@ -412,7 +412,7 @@
PutBitmap3(&grcGame, (WINDOW_WIDTH - 88) / 2, char_y, &char_rc, char_surf);
- //Draw carets
+ // Draw carets
PutCaret(0, 0);
if (time_counter)
@@ -427,7 +427,7 @@
PlaySoundObject(18, 1);
ChangeMusic(0);
- //Black screen when option is selected
+ // Black screen when option is selected
wait = SDL_GetTicks();
while (SDL_GetTicks() < wait + 1000)
{
@@ -449,12 +449,12 @@
bool swPlay = true;
- //Reset stuff
+ // Reset stuff
gCounter = 0;
grcGame.left = 0;
g_GameFlags = 3;
- //Initialize everything
+ // Initialize everything
InitMyChar();
InitNpChar();
InitBullet();
@@ -473,10 +473,10 @@
{
while (true)
{
- //Get pressed keys
+ // Get pressed keys
GetTrg();
- //Escape menu
+ // Escape menu
if (gKey & KEY_ESCAPE)
{
int escRet = Call_Escape();
@@ -548,7 +548,7 @@
if (!(g_GameFlags & 4))
{
- //Open inventory
+ // Open inventory
if (gKeyTrg & gKeyItem)
{
BackupSurface(SURFACE_ID_SCREEN_GRAB, &grcGame);
@@ -607,8 +607,8 @@
if (g_GameFlags & 8)
{
- PutIllust();
- PutStripper();
+ PutIllust();
+ PutStripper();
}
PutTextScript();
@@ -615,7 +615,7 @@
PutFramePerSecound();
if (!Flip_SystemTask())
- break;
+ break;
++gCounter;
}
}
--- a/src/Generic.cpp
+++ b/src/Generic.cpp
@@ -1,6 +1,5 @@
#include "Generic.h"
-#include <stdint.h>
#include <stdio.h>
#include "CommonDefines.h"
@@ -45,11 +44,11 @@
return false;
}
-bool IsShiftJIS(uint8_t c)
+bool IsShiftJIS(unsigned char c)
{
- if ( c > 0x80 && c < 0xA0 )
+ if (c > 0x80 && c < 0xA0)
return true;
- if ( c < 0xE0 || c >= 0xF0 )
+ if (c < 0xE0 || c >= 0xF0)
return false;
return true;
}
--- a/src/Generic.h
+++ b/src/Generic.h
@@ -1,8 +1,6 @@
#pragma once
-#include <stdint.h>
-
bool GetCompileVersion(int *v1, int *v2, int *v3, int *v4);
long GetFileSizeLong(const char *path);
bool CheckFileExists(const char *name);
-bool IsShiftJIS(uint8_t c);
+bool IsShiftJIS(unsigned char c);
--- a/src/GenericLoad.cpp
+++ b/src/GenericLoad.cpp
@@ -12,145 +12,145 @@
static const PIXTONEPARAMETER gPtpTable[139] =
{
- {1, 5000, {5, 10.0, 32, 0}, {4, 4.0, 32, 0}, {0, 0.0, 63, 0}, 63, 6, 63, 45, 8, 119, 46},
- {1, 1000, {0, 4.0, 32, 0}, {3, 1.0, 63, 0}, {0, 0.0, 63, 0}, 63, 64, 63, 128, 63, 255, 63},
- {1, 10000, {0, 30.0, 32, 0}, {3, 1.0, 32, 0}, {0, 0.0, 63, 0}, 0, 19, 44, 111, 13, 198, 9},
- {1, 10000, {5, 2.0, 31, 0}, {3, 1.0, 57, 219}, {0, 2.0, 32, 0}, 0, 19, 44, 111, 13, 198, 9},
- {1, 4000, {5, 0.4, 32, 0}, {3, 1.0, 53, 0}, {0, 0.0, 63, 0}, 12, 19, 63, 111, 21, 198, 18},
- {1, 1000, {1, 12.0, 32, 0}, {2, 1.0, 63, 0}, {0, 0.0, 63, 0}, 63, 64, 63, 128, 63, 255, 0},
- {1, 1000, {5, 1.0, 32, 0}, {3, 1.0, 63, 0}, {0, 0.0, 63, 0}, 0, 28, 63, 53, 31, 210, 31},
- {1, 1000, {1, 5.0, 32, 0}, {3, 1.0, 63, 0}, {0, 0.0, 0, 0}, 63, 64, 63, 128, 31, 255, 0},
- {1, 3000, {1, 17.0, 34, 0}, {3, 2.0, 40, 0}, {4, 1.0, 31, 0}, 63, 64, 63, 225, 63, 255, 0},
- {1, 6000, {1, 930.0, 22, 0}, {0, 0.7, 53, 0}, {0, 7.0, 32, 0}, 63, 64, 63, 202, 63, 255, 0},
- {1, 6000, {1, 918.0, 23, 0}, {0, 0.7, 53, 0}, {0, 7.0, 32, 0}, 63, 64, 63, 202, 63, 255, 0},
- {1, 10000, {2, 200.0, 32, 0}, {0, 1.0, 51, 0}, {1, 20.0, 31, 0}, 63, 64, 63, 89, 30, 208, 28},
- {1, 10000, {5, 23.0, 16, 0}, {0, 1.0, 58, 0}, {1, 17.0, 32, 0}, 63, 64, 63, 96, 51, 202, 31},
- {1, 20000, {2, 100.0, 21, 0}, {0, 1.0, 46, 0}, {1, 40.0, 32, 0}, 63, 64, 63, 128, 63, 162, 0},
- {1, 20000, {5, 5.0, 21, 0}, {0, 1.0, 51, 0}, {1, 40.0, 32, 0}, 63, 64, 63, 128, 63, 162, 28},
- {1, 10000, {5, 20.0, 23, 0}, {3, 0.7, 26, 235}, {5, 1.0, 9, 0}, 63, 38, 55, 87, 32, 98, 29},
- {1, 2000, {1, 20.0, 32, 0}, {3, 2.0, 63, 0}, {4, 1.0, 29, 0}, 63, 64, 63, 128, 63, 255, 63},
- {1, 15000, {5, 10.0, 32, 0}, {3, 0.7, 26, 235}, {0, 0.0, 63, 0}, 63, 38, 55, 187, 15, 255, 0},
- {1, 4000, {1, 20.0, 32, 0}, {3, 2.0, 63, 0}, {4, 1.0, 29, 0}, 63, 64, 63, 128, 63, 255, 63},
- {1, 22000, {5, 6.0, 32, 0}, {3, 0.7, 26, 246}, {0, 0.0, 63, 0}, 63, 38, 55, 187, 15, 255, 0},
- {1, 8000, {0, 20.0, 32, 0}, {3, 2.0, 63, 0}, {4, 1.0, 29, 0}, 63, 64, 63, 128, 63, 255, 63},
- {1, 10000, {4, 400.0, 13, 0}, {0, 0.8, 63, 0}, {4, 8.0, 31, 0}, 63, 64, 63, 191, 32, 255, 0},
- {1, 10000, {4, 800.0, 14, 0}, {0, 0.8, 63, 0}, {4, 8.0, 30, 125}, 63, 64, 63, 128, 63, 166, 0},
- {1, 5000, {2, 50.0, 39, 0}, {3, 0.5, 40, 217}, {1, 0.0, 32, 0}, 63, 64, 63, 128, 34, 198, 32},
- {1, 5000, {5, 10.0, 39, 0}, {3, 0.5, 24, 217}, {1, 4.0, 32, 0}, 0, 4, 63, 128, 34, 198, 32},
- {1, 40000, {5, 10.0, 32, 0}, {3, 1.0, 32, 241}, {0, 0.0, 32, 0}, 63, 64, 63, 128, 63, 255, 0},
- {1, 40000, {5, 20.0, 32, 0}, {0, 0.0, 32, 0}, {5, 0.1, 32, 0}, 63, 64, 63, 128, 63, 255, 0},
- {1, 30000, {2, 400.0, 32, 0}, {3, 0.3, 60, 250}, {0, 20.0, 32, 0}, 63, 64, 63, 128, 63, 255, 0},
- {1, 10000, {4, 400.0, 13, 0}, {0, 0.8, 63, 0}, {4, 8.0, 50, 0}, 63, 64, 63, 191, 32, 255, 0},
- {1, 10000, {4, 800.0, 5, 0}, {0, 0.8, 63, 0}, {4, 8.0, 63, 125}, 63, 64, 63, 128, 63, 166, 0},
- {1, 6000, {3, 123.0, 32, 0}, {4, 1.0, 16, 222}, {4, 4.0, 37, 0}, 0, 6, 63, 104, 25, 255, 0},
- {1, 4000, {5, 4.5, 32, 0}, {3, 1.0, 46, 102}, {3, 2.5, 47, 0}, 63, 64, 63, 128, 63, 255, 0},
- {1, 5000, {4, 40.0, 52, 0}, {2, 1.0, 63, 0}, {3, 10.0, 63, 0}, 63, 47, 27, 47, 29, 255, 0},
- {1, 3000, {0, 99.0, 32, 0}, {2, 1.0, 55, 197}, {5, 0.0, 0, 0}, 63, 0, 63, 164, 28, 255, 0},
- {1, 10000, {1, 601.0, 32, 0}, {4, 0.5, 15, 235}, {0, 10.0, 54, 0}, 63, 0, 63, 0, 63, 255, 0},
- {1, 8000, {5, 10.0, 15, 0}, {4, 0.5, 16, 239}, {4, 0.0, 50, 0}, 63, 0, 63, 96, 17, 255, 0},
- {1, 20000, {1, 832.0, 32, 0}, {2, 1.0, 46, 0}, {0, 27.0, 63, 0}, 63, 0, 63, 140, 10, 255, 0},
- {1, 20000, {1, 918.0, 32, 0}, {2, 1.0, 46, 0}, {0, 21.0, 63, 0}, 63, 0, 63, 140, 10, 255, 0},
- {1, 4000, {1, 54.0, 32, 0}, {5, 0.1, 33, 0}, {0, 0.0, 32, 0}, 53, 57, 44, 128, 24, 255, 0},
- {1, 10000, {1, 246.0, 23, 0}, {4, 0.6, 22, 239}, {4, 6.0, 63, 0}, 0, 11, 63, 13, 63, 255, 0},
- {1, 10000, {1, 294.0, 23, 0}, {4, 0.6, 22, 247}, {4, 6.0, 63, 140}, 0, 15, 63, 17, 63, 255, 0},
- {1, 22050, {0, 117.0, 63, 0}, {5, 2.0, 18, 0}, {5, 0.0, 0, 0}, 63, 0, 63, 64, 19, 255, 0},
- {1, 5000, {0, 28.0, 32, 0}, {3, 3.0, 27, 0}, {5, 0.0, 0, 0}, 63, 0, 63, 0, 63, 255, 0},
- {1, 10000, {0, 322.0, 32, 0}, {2, 8.0, 37, 0}, {2, 0.0, 0, 0}, 0, 13, 63, 106, 11, 255, 0},
- {1, 10000, {5, 7.3, 32, 0}, {5, 0.2, 29, 0}, {0, 0.0, 32, 0}, 63, 91, 63, 149, 25, 255, 0},
- {1, 1000, {0, 6.0, 32, 0}, {3, 1.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 63, 128, 63, 255, 63},
- {1, 20000, {2, 186.0, 32, 0}, {0, 4.0, 13, 98}, {3, 4.0, 5, 0}, 63, 64, 28, 255, 0, 255, 0},
- {1, 20000, {2, 285.0, 19, 0}, {3, 4.0, 21, 0}, {3, 4.0, 33, 130}, 63, 64, 63, 255, 0, 255, 0},
- {1, 10000, {0, 970.0, 32, 0}, {2, 1.0, 35, 195}, {0, 31.0, 31, 0}, 63, 64, 63, 128, 63, 255, 0},
- {1, 20000, {5, 6.0, 32, 0}, {3, 1.0, 54, 239}, {0, 0.0, 32, 0}, 63, 64, 63, 128, 63, 255, 35},
- {1, 40000, {5, 4.0, 32, 0}, {3, 0.0, 32, 230}, {0, 0.0, 32, 0}, 63, 64, 63, 128, 63, 255, 0},
- {1, 40000, {1, 238.0, 32, 0}, {3, 1.0, 14, 0}, {4, 30.0, 32, 0}, 63, 64, 63, 128, 63, 255, 0},
- {1, 3000, {2, 62.0, 32, 0}, {2, 3.0, 63, 0}, {3, 3.0, 14, 0}, 63, 0, 63, 210, 32, 255, 0},
- {1, 5000, {2, 58.0, 32, 0}, {2, 3.0, 63, 0}, {2, 3.0, 32, 0}, 63, 0, 63, 49, 27, 255, 0},
- {1, 3000, {0, 13.0, 24, 0}, {3, 2.0, 40, 0}, {4, 1.0, 31, 0}, 63, 64, 63, 225, 63, 255, 0},
- {1, 3000, {5, 6.0, 32, 0}, {5, 1.0, 32, 0}, {3, 0.0, 0, 0}, 0, 0, 63, 45, 23, 255, 0},
- {1, 20000, {1, 477.0, 40, 0}, {5, 93.0, 39, 0}, {4, 17.0, 19, 0}, 0, 64, 63, 128, 63, 255, 0},
- {1, 6000, {5, 11.0, 32, 0}, {5, 1.0, 32, 0}, {3, 3.0, 32, 0}, 63, 0, 63, 0, 63, 255, 0},
- {1, 6000, {1, 329.0, 20, 0}, {2, 2.0, 47, 77}, {3, 3.0, 63, 0}, 63, 64, 63, 128, 63, 255, 0},
- {1, 8000, {4, 2000.0, 32, 0}, {2, 1.0, 0, 0}, {0, 0.0, 32, 0}, 43, 21, 7, 255, 0, 255, 0},
- {1, 5000, {1, 231.0, 32, 0}, {4, 1.0, 32, 65}, {3, 2.0, 32, 0}, 63, 64, 63, 128, 63, 255, 63},
- {1, 3000, {0, 107.0, 32, 0}, {4, 1.0, 15, 0}, {0, 0.0, 17, 0}, 63, 64, 63, 128, 63, 255, 63},
- {1, 20000, {5, 4.0, 32, 0}, {5, 1.0, 32, 170}, {5, 0.0, 32, 0}, 63, 38, 22, 255, 0, 255, 0},
- {1, 5000, {1, 16.0, 32, 0}, {3, 1.0, 32, 238}, {0, 0.0, 0, 0}, 63, 64, 63, 128, 63, 255, 63},
- {1, 20000, {5, 4.0, 32, 0}, {0, 0.7, 61, 43}, {3, 1.0, 22, 224}, 63, 64, 63, 204, 46, 255, 0},
- {1, 5000, {0, 880.0, 19, 0}, {0, 0.0, 32, 0}, {0, 8.0, 32, 0}, 0, 11, 63, 34, 25, 255, 0},
- {1, 2000, {5, 3.0, 16, 0}, {3, 2.0, 12, 0}, {3, 1.0, 37, 0}, 0, 51, 63, 132, 24, 255, 0},
- {1, 22050, {1, 400.0, 32, 0}, {0, 20.0, 10, 0}, {3, 10.0, 8, 0}, 0, 6, 63, 60, 21, 255, 0},
- {1, 2000, {5, 2.0, 32, 0}, {2, 3.0, 54, 0}, {0, 0.0, 32, 0}, 0, 17, 63, 98, 22, 255, 0},
- {1, 8000, {1, 814.0, 32, 0}, {2, 11.0, 32, 0}, {3, 16.0, 32, 0}, 63, 23, 63, 74, 12, 255, 0},
- {1, 10000, {5, 21.0, 21, 0}, {0, 5.0, 32, 178}, {0, 3.0, 33, 181}, 63, 38, 63, 104, 20, 255, 0},
- {1, 6000, {5, 1.0, 28, 0}, {3, 6.0, 56, 0}, {0, 8.0, 32, 0}, 63, 57, 63, 98, 20, 255, 0},
- {1, 4000, {5, 6.0, 32, 0}, {3, 2.0, 32, 0}, {3, 2.0, 32, 0}, 63, 26, 30, 66, 29, 255, 0},
- {1, 22050, {5, 711.0, 32, 0}, {5, 7.0, 32, 0}, {0, 0.0, 32, 0}, 0, 13, 0, 17, 63, 255, 0},
- {1, 2000, {5, 2.0, 32, 0}, {5, 1.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 63, 128, 63, 255, 63},
- {1, 62050, {5, 40.0, 32, 0}, {5, 1.0, 32, 0}, {5, 0.0, 0, 0}, 0, 17, 63, 36, 63, 255, 0},
- {1, 8000, {0, 77.0, 32, 0}, {3, 3.0, 56, 189}, {0, 0.0, 17, 0}, 0, 38, 63, 140, 28, 255, 0},
- {1, 8000, {5, 8.0, 32, 0}, {3, 3.0, 54, 189}, {3, 3.0, 32, 0}, 63, 38, 42, 140, 21, 255, 0},
- {1, 9050, {5, 9.0, 26, 0}, {0, 1.0, 32, 209}, {0, 0.0, 32, 0}, 63, 64, 63, 132, 63, 255, 0},
- {1, 9050, {2, 43.0, 32, 0}, {3, 1.0, 47, 172}, {0, 0.0, 32, 0}, 63, 64, 63, 198, 63, 255, 0},
- {1, 22050, {1, 754.0, 32, 0}, {2, 0.5, 14, 126}, {4, 18.0, 17, 0}, 0, 64, 63, 128, 63, 255, 0},
- {1, 22050, {0, 597.0, 12, 0}, {2, 0.5, 14, 126}, {4, 18.0, 17, 0}, 0, 64, 40, 128, 41, 255, 0},
- {1, 6000, {2, 217.0, 32, 0}, {0, 0.7, 16, 0}, {3, 0.0, 32, 0}, 0, 32, 63, 49, 15, 255, 0},
- {1, 5000, {5, 1.0, 32, 0}, {3, 1.0, 32, 0}, {0, 0.0, 32, 0}, 0, 64, 63, 81, 28, 255, 0},
- {1, 10000, {5, 11.0, 32, 0}, {2, 4.0, 32, 0}, {0, 3.0, 32, 0}, 0, 64, 63, 128, 30, 255, 0},
- {1, 10000, {5, 1.0, 32, 0}, {4, 1.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 32, 128, 33, 255, 0},
- {1, 10000, {2, 168.0, 32, 0}, {0, 0.5, 29, 173}, {0, 0.0, 32, 0}, 0, 13, 63, 68, 35, 255, 0},
- {1, 10000, {2, 50.0, 32, 0}, {0, 0.5, 29, 173}, {2, 100.0, 32, 0}, 0, 13, 63, 68, 35, 255, 0},
- {1, 4000, {5, 11.0, 25, 0}, {3, 3.0, 32, 0}, {0, 0.0, 32, 0}, 0, 9, 63, 128, 14, 255, 0},
- {1, 4000, {5, 3.0, 27, 0}, {3, 3.0, 32, 0}, {0, 0.0, 32, 0}, 0, 9, 63, 128, 14, 255, 0},
- {1, 3000, {4, 9.0, 20, 0}, {3, 3.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 63, 128, 63, 255, 0},
- {1, 3000, {4, 18.0, 20, 0}, {3, 3.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 63, 128, 63, 255, 0},
- {1, 3000, {5, 4.0, 32, 0}, {3, 1.0, 32, 0}, {0, 0.0, 32, 0}, 0, 64, 63, 128, 63, 255, 0},
- {1, 12000, {5, 2.0, 32, 0}, {3, 1.7, 53, 0}, {0, 0.0, 32, 0}, 63, 64, 63, 162, 25, 255, 0},
- {1, 12000, {3, 77.0, 32, 0}, {3, 1.0, 61, 200}, {0, 19.0, 22, 0}, 63, 64, 63, 172, 25, 255, 0},
- {1, 5000, {0, 16.0, 63, 0}, {3, 1.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 63, 166, 35, 255, 0},
- {1, 1000, {5, 1.0, 16, 0}, {0, 1.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 63, 91, 28, 255, 0},
- {1, 5000, {0, 20.0, 30, 0}, {3, 1.0, 44, 0}, {0, 0.0, 32, 0}, 63, 64, 63, 111, 19, 255, 0},
- {1, 10000, {5, 14.0, 41, 0}, {5, 3.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 18, 91, 12, 255, 0},
- {1, 1000, {5, 48.0, 30, 0}, {5, 1.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 63, 166, 27, 255, 0},
- {1, 10000, {5, 48.0, 30, 0}, {5, 1.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 43, 166, 41, 255, 7},
- {1, 4000, {5, 35.0, 30, 0}, {3, 35.0, 32, 0}, {0, 0.0, 32, 0}, 63, 53, 21, 166, 13, 255, 0},
- {1, 10000, {1, 63.0, 32, 0}, {3, 1.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 39, 91, 20, 255, 0},
- {1, 22050, {5, 52.0, 22, 0}, {5, 1.0, 32, 0}, {0, 0.0, 32, 0}, 3, 23, 23, 57, 10, 255, 0},
- {1, 22050, {5, 80.0, 22, 0}, {5, 1.0, 32, 0}, {0, 0.0, 32, 0}, 63, 23, 23, 57, 10, 255, 0},
- {1, 44100, {5, 54.0, 12, 0}, {5, 1.0, 32, 0}, {5, 1.0, 27, 0}, 40, 64, 63, 128, 38, 255, 63},
- {1, 44100, {5, 119.0, 9, 0}, {5, 2.0, 32, 0}, {0, 0.0, 32, 0}, 61, 64, 39, 128, 60, 255, 28},
- {1, 4000, {5, 11.0, 32, 0}, {5, 1.0, 17, 197}, {0, 0.0, 32, 0}, 51, 100, 63, 100, 0, 255, 0},
- {1, 4000, {5, 21.0, 32, 0}, {5, 1.0, 17, 197}, {0, 0.0, 32, 0}, 0, 119, 0, 117, 63, 255, 0},
- {1, 5000, {2, 143.0, 25, 0}, {3, 0.5, 40, 217}, {1, 0.0, 32, 0}, 63, 64, 63, 128, 34, 198, 32},
- {1, 5000, {5, 10.0, 23, 0}, {3, 0.5, 24, 217}, {1, 4.0, 32, 0}, 0, 4, 63, 128, 34, 198, 32},
- {1, 4000, {5, 6.0, 32, 0}, {3, 2.0, 32, 0}, {3, 2.0, 32, 0}, 63, 26, 30, 66, 29, 255, 0},
- {1, 4000, {0, 150.0, 32, 0}, {0, 0.0, 32, 0}, {3, 2.0, 32, 0}, 63, 26, 30, 66, 29, 255, 0},
- {1, 40050, {4, 100.0, 32, 0}, {3, 8.0, 22, 0}, {3, 8.0, 8, 0}, 63, 28, 44, 81, 23, 255, 0},
- {1, 40050, {4, 150.0, 32, 0}, {3, 8.0, 22, 0}, {3, 8.0, 8, 0}, 63, 28, 44, 81, 23, 255, 0},
- {1, 40050, {4, 294.0, 32, 0}, {3, 8.0, 22, 0}, {3, 8.0, 8, 0}, 63, 28, 44, 81, 23, 255, 0},
- {1, 5000, {3, 621.0, 32, 0}, {2, 2.0, 22, 0}, {3, 6.0, 32, 0}, 0, 4, 63, 77, 30, 255, 0},
- {1, 30000, {5, 28.0, 44, 0}, {3, 1.0, 45, 0}, {0, 0.0, 32, 0}, 63, 64, 63, 208, 63, 255, 0},
- {1, 30000, {2, 101.0, 44, 0}, {2, 0.5, 63, 118}, {0, 0.0, 32, 0}, 63, 64, 63, 176, 63, 255, 0},
- {1, 30000, {2, 86.0, 44, 0}, {2, 0.5, 63, 118}, {0, 0.0, 32, 0}, 63, 64, 63, 176, 63, 255, 0},
- {1, 2000, {5, 1.0, 32, 0}, {0, 1.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 63, 128, 63, 255, 63},
- {1, 2000, {3, 99.0, 12, 0}, {3, 1.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 63, 128, 63, 255, 63},
- {1, 6000, {3, 388.0, 22, 0}, {0, 0.7, 53, 0}, {0, 7.0, 32, 0}, 25, 64, 63, 202, 63, 255, 0},
- {1, 6000, {1, 918.0, 23, 0}, {0, 0.7, 53, 0}, {0, 7.0, 32, 0}, 63, 64, 63, 202, 63, 255, 0},
- {1, 10000, {5, 118.0, 19, 0}, {3, 1.0, 63, 0}, {0, 3.0, 32, 0}, 0, 19, 63, 66, 41, 255, 0},
- {1, 10000, {5, 6.0, 24, 0}, {3, 1.0, 32, 208}, {2, 8.0, 12, 0}, 63, 64, 63, 128, 38, 255, 0},
- {1, 400, {1, 20.0, 12, 0}, {0, 0.0, 32, 0}, {0, 0.0, 32, 0}, 0, 43, 63, 193, 63, 255, 0},
- {1, 400, {1, 30.0, 12, 0}, {0, 0.0, 32, 0}, {0, 0.0, 32, 0}, 0, 43, 63, 193, 63, 255, 0},
- {1, 400, {1, 40.0, 12, 0}, {0, 0.0, 32, 0}, {0, 0.0, 32, 0}, 0, 43, 63, 193, 63, 255, 0},
- {1, 8000, {3, 800.0, 24, 0}, {0, 8.0, 4, 0}, {0, 0.0, 32, 0}, 0, 13, 63, 138, 63, 255, 0},
- {1, 8000, {5, 53.0, 12, 0}, {5, 1.0, 32, 0}, {0, 0.0, 32, 0}, 0, 0, 63, 68, 63, 255, 0},
- {1, 8000, {3, 400.0, 24, 0}, {0, 8.0, 4, 0}, {0, 0.0, 32, 0}, 0, 13, 63, 138, 63, 255, 0},
- {1, 8000, {5, 53.0, 12, 0}, {5, 1.0, 32, 0}, {0, 0.0, 32, 0}, 0, 0, 63, 68, 63, 255, 0},
- {1, 8000, {3, 200.0, 32, 0}, {0, 8.0, 4, 0}, {0, 0.0, 32, 0}, 0, 13, 63, 138, 63, 255, 0},
- {1, 8000, {5, 25.0, 17, 0}, {3, 1.0, 32, 0}, {0, 0.0, 32, 0}, 0, 0, 63, 68, 63, 255, 0},
- {1, 8000, {4, 800.0, 32, 0}, {4, 2.0, 21, 0}, {4, 8.0, 32, 0}, 0, 106, 63, 130, 27, 255, 0},
- {1, 3000, {4, 31.0, 10, 0}, {3, 2.0, 40, 0}, {4, 1.0, 31, 0}, 0, 9, 63, 94, 63, 255, 0},
- {1, 5000, {2, 168.0, 32, 0}, {0, 0.5, 29, 173}, {0, 0.0, 32, 0}, 0, 13, 63, 68, 35, 255, 0},
- {1, 1000, {0, 20.0, 0, 0}, {0, 0.0, 0, 0}, {0, 0.0, 0, 0}, 0, 64, 0, 128, 0, 255, 0}
+ {1, 5000, {5, 10.0, 32, 0}, {4, 4.0, 32, 0}, {0, 0.0, 63, 0}, 63, 6, 63, 45, 8, 119, 46},
+ {1, 1000, {0, 4.0, 32, 0}, {3, 1.0, 63, 0}, {0, 0.0, 63, 0}, 63, 64, 63, 128, 63, 255, 63},
+ {1, 10000, {0, 30.0, 32, 0}, {3, 1.0, 32, 0}, {0, 0.0, 63, 0}, 0, 19, 44, 111, 13, 198, 9},
+ {1, 10000, {5, 2.0, 31, 0}, {3, 1.0, 57, 219}, {0, 2.0, 32, 0}, 0, 19, 44, 111, 13, 198, 9},
+ {1, 4000, {5, 0.4, 32, 0}, {3, 1.0, 53, 0}, {0, 0.0, 63, 0}, 12, 19, 63, 111, 21, 198, 18},
+ {1, 1000, {1, 12.0, 32, 0}, {2, 1.0, 63, 0}, {0, 0.0, 63, 0}, 63, 64, 63, 128, 63, 255, 0},
+ {1, 1000, {5, 1.0, 32, 0}, {3, 1.0, 63, 0}, {0, 0.0, 63, 0}, 0, 28, 63, 53, 31, 210, 31},
+ {1, 1000, {1, 5.0, 32, 0}, {3, 1.0, 63, 0}, {0, 0.0, 0, 0}, 63, 64, 63, 128, 31, 255, 0},
+ {1, 3000, {1, 17.0, 34, 0}, {3, 2.0, 40, 0}, {4, 1.0, 31, 0}, 63, 64, 63, 225, 63, 255, 0},
+ {1, 6000, {1, 930.0, 22, 0}, {0, 0.7, 53, 0}, {0, 7.0, 32, 0}, 63, 64, 63, 202, 63, 255, 0},
+ {1, 6000, {1, 918.0, 23, 0}, {0, 0.7, 53, 0}, {0, 7.0, 32, 0}, 63, 64, 63, 202, 63, 255, 0},
+ {1, 10000, {2, 200.0, 32, 0}, {0, 1.0, 51, 0}, {1, 20.0, 31, 0}, 63, 64, 63, 89, 30, 208, 28},
+ {1, 10000, {5, 23.0, 16, 0}, {0, 1.0, 58, 0}, {1, 17.0, 32, 0}, 63, 64, 63, 96, 51, 202, 31},
+ {1, 20000, {2, 100.0, 21, 0}, {0, 1.0, 46, 0}, {1, 40.0, 32, 0}, 63, 64, 63, 128, 63, 162, 0},
+ {1, 20000, {5, 5.0, 21, 0}, {0, 1.0, 51, 0}, {1, 40.0, 32, 0}, 63, 64, 63, 128, 63, 162, 28},
+ {1, 10000, {5, 20.0, 23, 0}, {3, 0.7, 26, 235}, {5, 1.0, 9, 0}, 63, 38, 55, 87, 32, 98, 29},
+ {1, 2000, {1, 20.0, 32, 0}, {3, 2.0, 63, 0}, {4, 1.0, 29, 0}, 63, 64, 63, 128, 63, 255, 63},
+ {1, 15000, {5, 10.0, 32, 0}, {3, 0.7, 26, 235}, {0, 0.0, 63, 0}, 63, 38, 55, 187, 15, 255, 0},
+ {1, 4000, {1, 20.0, 32, 0}, {3, 2.0, 63, 0}, {4, 1.0, 29, 0}, 63, 64, 63, 128, 63, 255, 63},
+ {1, 22000, {5, 6.0, 32, 0}, {3, 0.7, 26, 246}, {0, 0.0, 63, 0}, 63, 38, 55, 187, 15, 255, 0},
+ {1, 8000, {0, 20.0, 32, 0}, {3, 2.0, 63, 0}, {4, 1.0, 29, 0}, 63, 64, 63, 128, 63, 255, 63},
+ {1, 10000, {4, 400.0, 13, 0}, {0, 0.8, 63, 0}, {4, 8.0, 31, 0}, 63, 64, 63, 191, 32, 255, 0},
+ {1, 10000, {4, 800.0, 14, 0}, {0, 0.8, 63, 0}, {4, 8.0, 30, 125}, 63, 64, 63, 128, 63, 166, 0},
+ {1, 5000, {2, 50.0, 39, 0}, {3, 0.5, 40, 217}, {1, 0.0, 32, 0}, 63, 64, 63, 128, 34, 198, 32},
+ {1, 5000, {5, 10.0, 39, 0}, {3, 0.5, 24, 217}, {1, 4.0, 32, 0}, 0, 4, 63, 128, 34, 198, 32},
+ {1, 40000, {5, 10.0, 32, 0}, {3, 1.0, 32, 241}, {0, 0.0, 32, 0}, 63, 64, 63, 128, 63, 255, 0},
+ {1, 40000, {5, 20.0, 32, 0}, {0, 0.0, 32, 0}, {5, 0.1, 32, 0}, 63, 64, 63, 128, 63, 255, 0},
+ {1, 30000, {2, 400.0, 32, 0}, {3, 0.3, 60, 250}, {0, 20.0, 32, 0}, 63, 64, 63, 128, 63, 255, 0},
+ {1, 10000, {4, 400.0, 13, 0}, {0, 0.8, 63, 0}, {4, 8.0, 50, 0}, 63, 64, 63, 191, 32, 255, 0},
+ {1, 10000, {4, 800.0, 5, 0}, {0, 0.8, 63, 0}, {4, 8.0, 63, 125}, 63, 64, 63, 128, 63, 166, 0},
+ {1, 6000, {3, 123.0, 32, 0}, {4, 1.0, 16, 222}, {4, 4.0, 37, 0}, 0, 6, 63, 104, 25, 255, 0},
+ {1, 4000, {5, 4.5, 32, 0}, {3, 1.0, 46, 102}, {3, 2.5, 47, 0}, 63, 64, 63, 128, 63, 255, 0},
+ {1, 5000, {4, 40.0, 52, 0}, {2, 1.0, 63, 0}, {3, 10.0, 63, 0}, 63, 47, 27, 47, 29, 255, 0},
+ {1, 3000, {0, 99.0, 32, 0}, {2, 1.0, 55, 197}, {5, 0.0, 0, 0}, 63, 0, 63, 164, 28, 255, 0},
+ {1, 10000, {1, 601.0, 32, 0}, {4, 0.5, 15, 235}, {0, 10.0, 54, 0}, 63, 0, 63, 0, 63, 255, 0},
+ {1, 8000, {5, 10.0, 15, 0}, {4, 0.5, 16, 239}, {4, 0.0, 50, 0}, 63, 0, 63, 96, 17, 255, 0},
+ {1, 20000, {1, 832.0, 32, 0}, {2, 1.0, 46, 0}, {0, 27.0, 63, 0}, 63, 0, 63, 140, 10, 255, 0},
+ {1, 20000, {1, 918.0, 32, 0}, {2, 1.0, 46, 0}, {0, 21.0, 63, 0}, 63, 0, 63, 140, 10, 255, 0},
+ {1, 4000, {1, 54.0, 32, 0}, {5, 0.1, 33, 0}, {0, 0.0, 32, 0}, 53, 57, 44, 128, 24, 255, 0},
+ {1, 10000, {1, 246.0, 23, 0}, {4, 0.6, 22, 239}, {4, 6.0, 63, 0}, 0, 11, 63, 13, 63, 255, 0},
+ {1, 10000, {1, 294.0, 23, 0}, {4, 0.6, 22, 247}, {4, 6.0, 63, 140}, 0, 15, 63, 17, 63, 255, 0},
+ {1, 22050, {0, 117.0, 63, 0}, {5, 2.0, 18, 0}, {5, 0.0, 0, 0}, 63, 0, 63, 64, 19, 255, 0},
+ {1, 5000, {0, 28.0, 32, 0}, {3, 3.0, 27, 0}, {5, 0.0, 0, 0}, 63, 0, 63, 0, 63, 255, 0},
+ {1, 10000, {0, 322.0, 32, 0}, {2, 8.0, 37, 0}, {2, 0.0, 0, 0}, 0, 13, 63, 106, 11, 255, 0},
+ {1, 10000, {5, 7.3, 32, 0}, {5, 0.2, 29, 0}, {0, 0.0, 32, 0}, 63, 91, 63, 149, 25, 255, 0},
+ {1, 1000, {0, 6.0, 32, 0}, {3, 1.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 63, 128, 63, 255, 63},
+ {1, 20000, {2, 186.0, 32, 0}, {0, 4.0, 13, 98}, {3, 4.0, 5, 0}, 63, 64, 28, 255, 0, 255, 0},
+ {1, 20000, {2, 285.0, 19, 0}, {3, 4.0, 21, 0}, {3, 4.0, 33, 130}, 63, 64, 63, 255, 0, 255, 0},
+ {1, 10000, {0, 970.0, 32, 0}, {2, 1.0, 35, 195}, {0, 31.0, 31, 0}, 63, 64, 63, 128, 63, 255, 0},
+ {1, 20000, {5, 6.0, 32, 0}, {3, 1.0, 54, 239}, {0, 0.0, 32, 0}, 63, 64, 63, 128, 63, 255, 35},
+ {1, 40000, {5, 4.0, 32, 0}, {3, 0.0, 32, 230}, {0, 0.0, 32, 0}, 63, 64, 63, 128, 63, 255, 0},
+ {1, 40000, {1, 238.0, 32, 0}, {3, 1.0, 14, 0}, {4, 30.0, 32, 0}, 63, 64, 63, 128, 63, 255, 0},
+ {1, 3000, {2, 62.0, 32, 0}, {2, 3.0, 63, 0}, {3, 3.0, 14, 0}, 63, 0, 63, 210, 32, 255, 0},
+ {1, 5000, {2, 58.0, 32, 0}, {2, 3.0, 63, 0}, {2, 3.0, 32, 0}, 63, 0, 63, 49, 27, 255, 0},
+ {1, 3000, {0, 13.0, 24, 0}, {3, 2.0, 40, 0}, {4, 1.0, 31, 0}, 63, 64, 63, 225, 63, 255, 0},
+ {1, 3000, {5, 6.0, 32, 0}, {5, 1.0, 32, 0}, {3, 0.0, 0, 0}, 0, 0, 63, 45, 23, 255, 0},
+ {1, 20000, {1, 477.0, 40, 0}, {5, 93.0, 39, 0}, {4, 17.0, 19, 0}, 0, 64, 63, 128, 63, 255, 0},
+ {1, 6000, {5, 11.0, 32, 0}, {5, 1.0, 32, 0}, {3, 3.0, 32, 0}, 63, 0, 63, 0, 63, 255, 0},
+ {1, 6000, {1, 329.0, 20, 0}, {2, 2.0, 47, 77}, {3, 3.0, 63, 0}, 63, 64, 63, 128, 63, 255, 0},
+ {1, 8000, {4, 2000.0, 32, 0}, {2, 1.0, 0, 0}, {0, 0.0, 32, 0}, 43, 21, 7, 255, 0, 255, 0},
+ {1, 5000, {1, 231.0, 32, 0}, {4, 1.0, 32, 65}, {3, 2.0, 32, 0}, 63, 64, 63, 128, 63, 255, 63},
+ {1, 3000, {0, 107.0, 32, 0}, {4, 1.0, 15, 0}, {0, 0.0, 17, 0}, 63, 64, 63, 128, 63, 255, 63},
+ {1, 20000, {5, 4.0, 32, 0}, {5, 1.0, 32, 170}, {5, 0.0, 32, 0}, 63, 38, 22, 255, 0, 255, 0},
+ {1, 5000, {1, 16.0, 32, 0}, {3, 1.0, 32, 238}, {0, 0.0, 0, 0}, 63, 64, 63, 128, 63, 255, 63},
+ {1, 20000, {5, 4.0, 32, 0}, {0, 0.7, 61, 43}, {3, 1.0, 22, 224}, 63, 64, 63, 204, 46, 255, 0},
+ {1, 5000, {0, 880.0, 19, 0}, {0, 0.0, 32, 0}, {0, 8.0, 32, 0}, 0, 11, 63, 34, 25, 255, 0},
+ {1, 2000, {5, 3.0, 16, 0}, {3, 2.0, 12, 0}, {3, 1.0, 37, 0}, 0, 51, 63, 132, 24, 255, 0},
+ {1, 22050, {1, 400.0, 32, 0}, {0, 20.0, 10, 0}, {3, 10.0, 8, 0}, 0, 6, 63, 60, 21, 255, 0},
+ {1, 2000, {5, 2.0, 32, 0}, {2, 3.0, 54, 0}, {0, 0.0, 32, 0}, 0, 17, 63, 98, 22, 255, 0},
+ {1, 8000, {1, 814.0, 32, 0}, {2, 11.0, 32, 0}, {3, 16.0, 32, 0}, 63, 23, 63, 74, 12, 255, 0},
+ {1, 10000, {5, 21.0, 21, 0}, {0, 5.0, 32, 178}, {0, 3.0, 33, 181}, 63, 38, 63, 104, 20, 255, 0},
+ {1, 6000, {5, 1.0, 28, 0}, {3, 6.0, 56, 0}, {0, 8.0, 32, 0}, 63, 57, 63, 98, 20, 255, 0},
+ {1, 4000, {5, 6.0, 32, 0}, {3, 2.0, 32, 0}, {3, 2.0, 32, 0}, 63, 26, 30, 66, 29, 255, 0},
+ {1, 22050, {5, 711.0, 32, 0}, {5, 7.0, 32, 0}, {0, 0.0, 32, 0}, 0, 13, 0, 17, 63, 255, 0},
+ {1, 2000, {5, 2.0, 32, 0}, {5, 1.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 63, 128, 63, 255, 63},
+ {1, 62050, {5, 40.0, 32, 0}, {5, 1.0, 32, 0}, {5, 0.0, 0, 0}, 0, 17, 63, 36, 63, 255, 0},
+ {1, 8000, {0, 77.0, 32, 0}, {3, 3.0, 56, 189}, {0, 0.0, 17, 0}, 0, 38, 63, 140, 28, 255, 0},
+ {1, 8000, {5, 8.0, 32, 0}, {3, 3.0, 54, 189}, {3, 3.0, 32, 0}, 63, 38, 42, 140, 21, 255, 0},
+ {1, 9050, {5, 9.0, 26, 0}, {0, 1.0, 32, 209}, {0, 0.0, 32, 0}, 63, 64, 63, 132, 63, 255, 0},
+ {1, 9050, {2, 43.0, 32, 0}, {3, 1.0, 47, 172}, {0, 0.0, 32, 0}, 63, 64, 63, 198, 63, 255, 0},
+ {1, 22050, {1, 754.0, 32, 0}, {2, 0.5, 14, 126}, {4, 18.0, 17, 0}, 0, 64, 63, 128, 63, 255, 0},
+ {1, 22050, {0, 597.0, 12, 0}, {2, 0.5, 14, 126}, {4, 18.0, 17, 0}, 0, 64, 40, 128, 41, 255, 0},
+ {1, 6000, {2, 217.0, 32, 0}, {0, 0.7, 16, 0}, {3, 0.0, 32, 0}, 0, 32, 63, 49, 15, 255, 0},
+ {1, 5000, {5, 1.0, 32, 0}, {3, 1.0, 32, 0}, {0, 0.0, 32, 0}, 0, 64, 63, 81, 28, 255, 0},
+ {1, 10000, {5, 11.0, 32, 0}, {2, 4.0, 32, 0}, {0, 3.0, 32, 0}, 0, 64, 63, 128, 30, 255, 0},
+ {1, 10000, {5, 1.0, 32, 0}, {4, 1.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 32, 128, 33, 255, 0},
+ {1, 10000, {2, 168.0, 32, 0}, {0, 0.5, 29, 173}, {0, 0.0, 32, 0}, 0, 13, 63, 68, 35, 255, 0},
+ {1, 10000, {2, 50.0, 32, 0}, {0, 0.5, 29, 173}, {2, 100.0, 32, 0}, 0, 13, 63, 68, 35, 255, 0},
+ {1, 4000, {5, 11.0, 25, 0}, {3, 3.0, 32, 0}, {0, 0.0, 32, 0}, 0, 9, 63, 128, 14, 255, 0},
+ {1, 4000, {5, 3.0, 27, 0}, {3, 3.0, 32, 0}, {0, 0.0, 32, 0}, 0, 9, 63, 128, 14, 255, 0},
+ {1, 3000, {4, 9.0, 20, 0}, {3, 3.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 63, 128, 63, 255, 0},
+ {1, 3000, {4, 18.0, 20, 0}, {3, 3.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 63, 128, 63, 255, 0},
+ {1, 3000, {5, 4.0, 32, 0}, {3, 1.0, 32, 0}, {0, 0.0, 32, 0}, 0, 64, 63, 128, 63, 255, 0},
+ {1, 12000, {5, 2.0, 32, 0}, {3, 1.7, 53, 0}, {0, 0.0, 32, 0}, 63, 64, 63, 162, 25, 255, 0},
+ {1, 12000, {3, 77.0, 32, 0}, {3, 1.0, 61, 200}, {0, 19.0, 22, 0}, 63, 64, 63, 172, 25, 255, 0},
+ {1, 5000, {0, 16.0, 63, 0}, {3, 1.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 63, 166, 35, 255, 0},
+ {1, 1000, {5, 1.0, 16, 0}, {0, 1.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 63, 91, 28, 255, 0},
+ {1, 5000, {0, 20.0, 30, 0}, {3, 1.0, 44, 0}, {0, 0.0, 32, 0}, 63, 64, 63, 111, 19, 255, 0},
+ {1, 10000, {5, 14.0, 41, 0}, {5, 3.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 18, 91, 12, 255, 0},
+ {1, 1000, {5, 48.0, 30, 0}, {5, 1.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 63, 166, 27, 255, 0},
+ {1, 10000, {5, 48.0, 30, 0}, {5, 1.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 43, 166, 41, 255, 7},
+ {1, 4000, {5, 35.0, 30, 0}, {3, 35.0, 32, 0}, {0, 0.0, 32, 0}, 63, 53, 21, 166, 13, 255, 0},
+ {1, 10000, {1, 63.0, 32, 0}, {3, 1.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 39, 91, 20, 255, 0},
+ {1, 22050, {5, 52.0, 22, 0}, {5, 1.0, 32, 0}, {0, 0.0, 32, 0}, 3, 23, 23, 57, 10, 255, 0},
+ {1, 22050, {5, 80.0, 22, 0}, {5, 1.0, 32, 0}, {0, 0.0, 32, 0}, 63, 23, 23, 57, 10, 255, 0},
+ {1, 44100, {5, 54.0, 12, 0}, {5, 1.0, 32, 0}, {5, 1.0, 27, 0}, 40, 64, 63, 128, 38, 255, 63},
+ {1, 44100, {5, 119.0, 9, 0}, {5, 2.0, 32, 0}, {0, 0.0, 32, 0}, 61, 64, 39, 128, 60, 255, 28},
+ {1, 4000, {5, 11.0, 32, 0}, {5, 1.0, 17, 197}, {0, 0.0, 32, 0}, 51, 100, 63, 100, 0, 255, 0},
+ {1, 4000, {5, 21.0, 32, 0}, {5, 1.0, 17, 197}, {0, 0.0, 32, 0}, 0, 119, 0, 117, 63, 255, 0},
+ {1, 5000, {2, 143.0, 25, 0}, {3, 0.5, 40, 217}, {1, 0.0, 32, 0}, 63, 64, 63, 128, 34, 198, 32},
+ {1, 5000, {5, 10.0, 23, 0}, {3, 0.5, 24, 217}, {1, 4.0, 32, 0}, 0, 4, 63, 128, 34, 198, 32},
+ {1, 4000, {5, 6.0, 32, 0}, {3, 2.0, 32, 0}, {3, 2.0, 32, 0}, 63, 26, 30, 66, 29, 255, 0},
+ {1, 4000, {0, 150.0, 32, 0}, {0, 0.0, 32, 0}, {3, 2.0, 32, 0}, 63, 26, 30, 66, 29, 255, 0},
+ {1, 40050, {4, 100.0, 32, 0}, {3, 8.0, 22, 0}, {3, 8.0, 8, 0}, 63, 28, 44, 81, 23, 255, 0},
+ {1, 40050, {4, 150.0, 32, 0}, {3, 8.0, 22, 0}, {3, 8.0, 8, 0}, 63, 28, 44, 81, 23, 255, 0},
+ {1, 40050, {4, 294.0, 32, 0}, {3, 8.0, 22, 0}, {3, 8.0, 8, 0}, 63, 28, 44, 81, 23, 255, 0},
+ {1, 5000, {3, 621.0, 32, 0}, {2, 2.0, 22, 0}, {3, 6.0, 32, 0}, 0, 4, 63, 77, 30, 255, 0},
+ {1, 30000, {5, 28.0, 44, 0}, {3, 1.0, 45, 0}, {0, 0.0, 32, 0}, 63, 64, 63, 208, 63, 255, 0},
+ {1, 30000, {2, 101.0, 44, 0}, {2, 0.5, 63, 118}, {0, 0.0, 32, 0}, 63, 64, 63, 176, 63, 255, 0},
+ {1, 30000, {2, 86.0, 44, 0}, {2, 0.5, 63, 118}, {0, 0.0, 32, 0}, 63, 64, 63, 176, 63, 255, 0},
+ {1, 2000, {5, 1.0, 32, 0}, {0, 1.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 63, 128, 63, 255, 63},
+ {1, 2000, {3, 99.0, 12, 0}, {3, 1.0, 32, 0}, {0, 0.0, 32, 0}, 63, 64, 63, 128, 63, 255, 63},
+ {1, 6000, {3, 388.0, 22, 0}, {0, 0.7, 53, 0}, {0, 7.0, 32, 0}, 25, 64, 63, 202, 63, 255, 0},
+ {1, 6000, {1, 918.0, 23, 0}, {0, 0.7, 53, 0}, {0, 7.0, 32, 0}, 63, 64, 63, 202, 63, 255, 0},
+ {1, 10000, {5, 118.0, 19, 0}, {3, 1.0, 63, 0}, {0, 3.0, 32, 0}, 0, 19, 63, 66, 41, 255, 0},
+ {1, 10000, {5, 6.0, 24, 0}, {3, 1.0, 32, 208}, {2, 8.0, 12, 0}, 63, 64, 63, 128, 38, 255, 0},
+ {1, 400, {1, 20.0, 12, 0}, {0, 0.0, 32, 0}, {0, 0.0, 32, 0}, 0, 43, 63, 193, 63, 255, 0},
+ {1, 400, {1, 30.0, 12, 0}, {0, 0.0, 32, 0}, {0, 0.0, 32, 0}, 0, 43, 63, 193, 63, 255, 0},
+ {1, 400, {1, 40.0, 12, 0}, {0, 0.0, 32, 0}, {0, 0.0, 32, 0}, 0, 43, 63, 193, 63, 255, 0},
+ {1, 8000, {3, 800.0, 24, 0}, {0, 8.0, 4, 0}, {0, 0.0, 32, 0}, 0, 13, 63, 138, 63, 255, 0},
+ {1, 8000, {5, 53.0, 12, 0}, {5, 1.0, 32, 0}, {0, 0.0, 32, 0}, 0, 0, 63, 68, 63, 255, 0},
+ {1, 8000, {3, 400.0, 24, 0}, {0, 8.0, 4, 0}, {0, 0.0, 32, 0}, 0, 13, 63, 138, 63, 255, 0},
+ {1, 8000, {5, 53.0, 12, 0}, {5, 1.0, 32, 0}, {0, 0.0, 32, 0}, 0, 0, 63, 68, 63, 255, 0},
+ {1, 8000, {3, 200.0, 32, 0}, {0, 8.0, 4, 0}, {0, 0.0, 32, 0}, 0, 13, 63, 138, 63, 255, 0},
+ {1, 8000, {5, 25.0, 17, 0}, {3, 1.0, 32, 0}, {0, 0.0, 32, 0}, 0, 0, 63, 68, 63, 255, 0},
+ {1, 8000, {4, 800.0, 32, 0}, {4, 2.0, 21, 0}, {4, 8.0, 32, 0}, 0, 106, 63, 130, 27, 255, 0},
+ {1, 3000, {4, 31.0, 10, 0}, {3, 2.0, 40, 0}, {4, 1.0, 31, 0}, 0, 9, 63, 94, 63, 255, 0},
+ {1, 5000, {2, 168.0, 32, 0}, {0, 0.5, 29, 173}, {0, 0.0, 32, 0}, 0, 13, 63, 68, 35, 255, 0},
+ {1, 1000, {0, 20.0, 0, 0}, {0, 0.0, 0, 0}, {0, 0.0, 0, 0}, 0, 64, 0, 128, 0, 255, 0}
};
BOOL LoadGenericData()
--- a/src/Input.cpp
+++ b/src/Input.cpp
@@ -1,7 +1,6 @@
#include "Input.h"
#include <stddef.h>
-#include <stdint.h>
#include <string.h>
#include <SDL.h>
@@ -14,11 +13,11 @@
#define JOYSTICK_DEADZONE 10000
-SDL_Joystick *joystick; //This may be a name that was given by Simon, but it fits the rest of Pixel's names so it's fine.
+SDL_Joystick *joystick; // This was probably a name that was given by Simon, but it fits the rest of Pixel's names so it's fine.
void ReleaseDirectInput()
{
- //Close opened joystick (if exists)
+ // Close opened joystick (if exists)
if (joystick)
{
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
@@ -29,7 +28,7 @@
bool InitDirectInput()
{
- //Open first available joystick
+ // Open first available joystick
SDL_InitSubSystem(SDL_INIT_JOYSTICK);
for (int i = 0; i < SDL_NumJoysticks(); i++)
@@ -36,7 +35,7 @@
{
joystick = SDL_JoystickOpen(i);
- //Break as soon as a joystick is properly opened
+ // Break as soon as a joystick is properly opened
if (joystick)
break;
}
@@ -46,13 +45,13 @@
bool GetJoystickStatus(JOYSTICK_STATUS *pStatus)
{
- //Clear status
+ // Clear status
memset(pStatus, 0, sizeof(JOYSTICK_STATUS));
if (joystick)
{
- int32_t x = SDL_JoystickGetAxis(joystick, 0);
- int32_t y = SDL_JoystickGetAxis(joystick, 1);
+ Sint16 x = SDL_JoystickGetAxis(joystick, 0);
+ Sint16 y = SDL_JoystickGetAxis(joystick, 1);
pStatus->bLeft = x <= -JOYSTICK_DEADZONE;
pStatus->bRight = x >= JOYSTICK_DEADZONE;
pStatus->bUp = y <= -JOYSTICK_DEADZONE;
--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -1,7 +1,6 @@
#include "Main.h"
#include <stddef.h>
-#include <stdint.h>
#include <stdio.h>
#include <string.h>
--- a/src/Map.cpp
+++ b/src/Map.cpp
@@ -1,7 +1,6 @@
#include "Map.h"
#include <stddef.h>
-#include <stdint.h>
#include <stdlib.h>
#include <string.h>
@@ -21,7 +20,7 @@
BOOL InitMapData2()
{
- gMap.data = (uint8_t*)malloc(PXM_BUFFER_SIZE);
+ gMap.data = (unsigned char*)malloc(PXM_BUFFER_SIZE);
return TRUE;
}
@@ -103,7 +102,7 @@
ReleaseSurface(SURFACE_ID_LEVEL_TILESET);
}
-void GetMapData(uint8_t **data, int16_t *mw, int16_t *ml)
+void GetMapData(unsigned char **data, short *mw, short *ml)
{
if (data)
*data = gMap.data;
@@ -132,7 +131,7 @@
*(gMap.data + x + gMap.width * y) -= 1;
}
-BOOL ChangeMapParts(int x, int y, uint8_t no)
+BOOL ChangeMapParts(int x, int y, unsigned char no)
{
if (*(gMap.data + x + gMap.width * y) == no)
return FALSE;
--- a/src/Map.h
+++ b/src/Map.h
@@ -1,15 +1,13 @@
#pragma once
-#include <stdint.h>
-
#include "WindowsWrapper.h"
struct MAP_DATA
{
- uint8_t *data;
- uint8_t atrb[0x101]; //Why is this 257 bytes?
- int16_t width;
- int16_t length;
+ unsigned char *data;
+ unsigned char atrb[0x101]; //Why is this 257 bytes?
+ short width;
+ short length;
};
extern MAP_DATA gMap;
@@ -19,11 +17,11 @@
BOOL LoadAttributeData(const char *path_atrb);
void EndMapData();
void ReleasePartsImage();
-void GetMapData(uint8_t **data, int16_t *mw, int16_t *ml);
+void GetMapData(unsigned char **data, short *mw, short *ml);
unsigned char GetAttribute(int x, int y);
void DeleteMapParts(int x, int y);
void ShiftMapParts(int x, int y);
-BOOL ChangeMapParts(int x, int y, uint8_t no);
+BOOL ChangeMapParts(int x, int y, unsigned char no);
void PutStage_Back(int fx, int fy);
void PutStage_Front(int fx, int fy);
void PutMapDataVector(int fx, int fy);
--- a/src/MapName.cpp
+++ b/src/MapName.cpp
@@ -1,6 +1,5 @@
#include "MapName.h"
-#include <stdint.h>
#include <string.h>
#include "CommonDefines.h"
--- a/src/MiniMap.cpp
+++ b/src/MiniMap.cpp
@@ -1,6 +1,5 @@
#include "MiniMap.h"
-#include <stdint.h>
#include <string.h>
#include "WindowsWrapper.h"
@@ -127,7 +126,7 @@
CortBox2(&rcMiniMap, 0, SURFACE_ID_MAP);
int line = 0;
- uint8_t my_wait = 0;
+ unsigned char my_wait = 0;
while (true)
{
GetTrg();
--- a/src/MiniMap.h
+++ b/src/MiniMap.h
@@ -1,7 +1,5 @@
#pragma once
-#include <stdint.h>
-
#include "WindowsWrapper.h"
extern char gMapping[0x80];
--- a/src/MyChar.cpp
+++ b/src/MyChar.cpp
@@ -1,6 +1,5 @@
#include "MyChar.h"
-#include <stdint.h>
#include <string.h>
#include "WindowsWrapper.h"
@@ -44,7 +43,7 @@
gMC.unit = 0;
}
-void AnimationMyChar(bool bKey)
+void AnimationMyChar(BOOL bKey)
{
RECT rcLeft[12] = {
{0, 0, 16, 16},
@@ -76,84 +75,83 @@
{112, 16, 128, 32},
};
- if (!(gMC.cond & 2))
+ if (gMC.cond & 2)
+ return;
+
+ if (gMC.flag & 8)
{
- if (gMC.flag & 8)
+ if (gMC.cond & 1)
{
- if (gMC.cond & 1)
+ gMC.ani_no = 11;
+ }
+ else if (gKey & gKeyUp && (gKeyRight | gKeyLeft) & gKey && bKey)
+ {
+ gMC.cond |= 4;
+
+ if (++gMC.ani_wait > 4)
{
- gMC.ani_no = 11;
+ gMC.ani_wait = 0;
+ if (++gMC.ani_no == 7 || gMC.ani_no == 9)
+ PlaySoundObject(24, 1);
}
- else if (gKey & gKeyUp && (gKeyRight | gKeyLeft) & gKey && bKey)
- {
- gMC.cond |= 4;
- if (++gMC.ani_wait > 4)
- {
- gMC.ani_wait = 0;
- if (++gMC.ani_no == 7 || gMC.ani_no == 9)
- PlaySoundObject(24, 1);
- }
+ if (gMC.ani_no > 9 || gMC.ani_no < 6)
+ gMC.ani_no = 6;
+ }
+ else if ((gKeyRight | gKeyLeft) & gKey && bKey)
+ {
+ gMC.cond |= 4;
- if (gMC.ani_no > 9 || gMC.ani_no < 6)
- gMC.ani_no = 6;
- }
- else if ((gKeyRight | gKeyLeft) & gKey && bKey)
+ if (++gMC.ani_wait > 4)
{
- gMC.cond |= 4;
-
- if (++gMC.ani_wait > 4)
- {
- gMC.ani_wait = 0;
- if (++gMC.ani_no == 2 || gMC.ani_no == 4)
- PlaySoundObject(24, 1);
- }
-
- if (gMC.ani_no > 4 || gMC.ani_no < 1)
- gMC.ani_no = 1;
- }
- else if (gKey & gKeyUp && bKey)
- {
- if (gMC.cond & 4)
+ gMC.ani_wait = 0;
+ if (++gMC.ani_no == 2 || gMC.ani_no == 4)
PlaySoundObject(24, 1);
-
- gMC.cond &= ~4;
- gMC.ani_no = 5;
}
- else
- {
- if (gMC.cond & 4)
- PlaySoundObject(24, 1);
- gMC.cond &= ~4;
- gMC.ani_no = 0;
- }
+ if (gMC.ani_no > 4 || gMC.ani_no < 1)
+ gMC.ani_no = 1;
}
- else if (gMC.up)
+ else if (gKey & gKeyUp && bKey)
{
- gMC.ani_no = 6;
+ if (gMC.cond & 4)
+ PlaySoundObject(24, 1);
+
+ gMC.cond &= ~4;
+ gMC.ani_no = 5;
}
- else if (gMC.down)
- {
- gMC.ani_no = 10;
- }
- else if (gMC.ym <= 0)
- {
- gMC.ani_no = 3;
- }
else
{
- gMC.ani_no = 1;
- }
+ if (gMC.cond & 4)
+ PlaySoundObject(24, 1);
- if (gMC.direct)
- gMC.rect = rcRight[gMC.ani_no];
+ gMC.cond &= ~4;
+ gMC.ani_no = 0;
+ }
+ }
+ else if (gMC.up)
+ {
+ gMC.ani_no = 6;
+ }
+ else if (gMC.down)
+ {
+ gMC.ani_no = 10;
+ }
+ else
+ {
+ if (gMC.ym > 0)
+ gMC.ani_no = 1;
else
- gMC.rect = rcLeft[gMC.ani_no];
+ gMC.ani_no = 3;
}
+
+ if (gMC.direct == 0)
+ gMC.rect = rcLeft[gMC.ani_no];
+ else
+ gMC.rect = rcRight[gMC.ani_no];
}
-void ShowMyChar(bool bShow)
+void ShowMyChar(BOOL bShow)
{
if (bShow)
gMC.cond &= ~2;
@@ -163,498 +161,539 @@
void PutMyChar(int fx, int fy)
{
- if ((gMC.cond & 0x80) && !(gMC.cond & 2))
- {
- // Draw weapon
- gMC.rect_arms.left = 24 * (gArmsData[gSelectedArms].code % 13);
- gMC.rect_arms.right = gMC.rect_arms.left + 24;
- gMC.rect_arms.top = 96 * (gArmsData[gSelectedArms].code / 13);
- gMC.rect_arms.bottom = gMC.rect_arms.top + 16;
+ int arms_offset_y;
- if (gMC.direct == 2)
- {
- gMC.rect_arms.top += 16;
- gMC.rect_arms.bottom += 16;
- }
+ if ((gMC.cond & 0x80) == 0 || (gMC.cond & 2))
+ return;
- int arms_offset_y;
- if (gMC.up)
- {
- arms_offset_y = -4;
- gMC.rect_arms.top += 32;
- gMC.rect_arms.bottom += 32;
- }
- else if (gMC.down)
- {
- arms_offset_y = 4;
- gMC.rect_arms.top += 64;
- gMC.rect_arms.bottom += 64;
- }
- else
- {
- arms_offset_y = 0;
- }
+ // Draw weapon
+ gMC.rect_arms.left = 24 * (gArmsData[gSelectedArms].code % 13);
+ gMC.rect_arms.right = gMC.rect_arms.left + 24;
+ gMC.rect_arms.top = 96 * (gArmsData[gSelectedArms].code / 13);
+ gMC.rect_arms.bottom = gMC.rect_arms.top + 16;
- if (gMC.ani_no == 1 || gMC.ani_no == 3 || gMC.ani_no == 6 || gMC.ani_no == 8)
- ++gMC.rect_arms.top;
+ if (gMC.direct == 2)
+ {
+ gMC.rect_arms.top += 16;
+ gMC.rect_arms.bottom += 16;
+ }
- if (gMC.direct)
- PutBitmap3(
- &grcGame,
- (gMC.x - gMC.view.left) / 0x200 - fx / 0x200,
- (gMC.y - gMC.view.top) / 0x200 - fy / 0x200 + arms_offset_y,
- &gMC.rect_arms,
- SURFACE_ID_ARMS);
- else
- PutBitmap3(
- &grcGame,
- (gMC.x - gMC.view.left) / 0x200 - fx / 0x200 - 8,
- (gMC.y - gMC.view.top) / 0x200 - fy / 0x200 + arms_offset_y,
- &gMC.rect_arms,
- SURFACE_ID_ARMS);
+ if (gMC.up)
+ {
+ arms_offset_y = -4;
+ gMC.rect_arms.top += 32;
+ gMC.rect_arms.bottom += 32;
+ }
+ else if (gMC.down)
+ {
+ arms_offset_y = 4;
+ gMC.rect_arms.top += 64;
+ gMC.rect_arms.bottom += 64;
+ }
+ else
+ {
+ arms_offset_y = 0;
+ }
- if (!((gMC.shock >> 1) & 1))
- {
- // Draw player
- RECT rect = gMC.rect;
- if (gMC.equip & 0x40)
- {
- rect.top += 32;
- rect.bottom += 32;
- }
+ if (gMC.ani_no == 1 || gMC.ani_no == 3 || gMC.ani_no == 6 || gMC.ani_no == 8)
+ ++gMC.rect_arms.top;
- PutBitmap3(&grcGame, (gMC.x - gMC.view.left) / 0x200 - fx / 0x200, (gMC.y - gMC.view.top) / 0x200 - fy / 0x200, &rect, SURFACE_ID_MY_CHAR);
+ if (gMC.direct == 0)
+ PutBitmap3(
+ &grcGame,
+ (gMC.x - gMC.view.left) / 0x200 - fx / 0x200 - 8,
+ (gMC.y - gMC.view.top) / 0x200 - fy / 0x200 + arms_offset_y,
+ &gMC.rect_arms,
+ SURFACE_ID_ARMS);
+ else
+ PutBitmap3(
+ &grcGame,
+ (gMC.x - gMC.view.left) / 0x200 - fx / 0x200,
+ (gMC.y - gMC.view.top) / 0x200 - fy / 0x200 + arms_offset_y,
+ &gMC.rect_arms,
+ SURFACE_ID_ARMS);
- // Draw air tank
- RECT rcBubble[2] = {
- {56, 96, 80, 120},
- {80, 96, 104, 120},
- };
+ if ((gMC.shock / 2) % 2)
+ return;
- ++gMC.bubble;
- if (gMC.equip & 0x10 && gMC.flag & 0x100)
- PutBitmap3(&grcGame, gMC.x / 0x200 - 12 - fx / 0x200, gMC.y / 0x200 - 12 - fy / 0x200, &rcBubble[(gMC.bubble >> 1) & 1], SURFACE_ID_CARET);
- else if (gMC.unit == 1)
- PutBitmap3(&grcGame, gMC.x / 0x200 - 12 - fx / 0x200, gMC.y / 0x200 - 12 - fy / 0x200, &rcBubble[(gMC.bubble >> 1) & 1], SURFACE_ID_CARET);
- }
+ // Draw player
+ RECT rect = gMC.rect;
+ if (gMC.equip & 0x40)
+ {
+ rect.top += 32;
+ rect.bottom += 32;
}
+
+ PutBitmap3(&grcGame, (gMC.x - gMC.view.left) / 0x200 - fx / 0x200, (gMC.y - gMC.view.top) / 0x200 - fy / 0x200, &rect, SURFACE_ID_MY_CHAR);
+
+ // Draw air tank
+ RECT rcBubble[2] = {
+ {56, 96, 80, 120},
+ {80, 96, 104, 120},
+ };
+
+ ++gMC.bubble;
+ if (gMC.equip & 0x10 && gMC.flag & 0x100)
+ PutBitmap3(&grcGame, gMC.x / 0x200 - 12 - fx / 0x200, gMC.y / 0x200 - 12 - fy / 0x200, &rcBubble[(gMC.bubble / 2) % 2], SURFACE_ID_CARET);
+ else if (gMC.unit == 1)
+ PutBitmap3(&grcGame, gMC.x / 0x200 - 12 - fx / 0x200, gMC.y / 0x200 - 12 - fy / 0x200, &rcBubble[(gMC.bubble / 2) % 2], SURFACE_ID_CARET);
}
-void ActMyChar_Normal(bool bKey)
+void ActMyChar_Normal(BOOL bKey)
{
- if (!(gMC.cond & 2))
+ // Get speeds and accelerations
+ int max_move; // Unused
+ int max_dash;
+ int gravity1;
+ int gravity2;
+ int jump;
+ int dash1;
+ int dash2;
+ int resist;
+
+ int a;
+ int x;
+
+ if (gMC.cond & 2)
+ return;
+
+ if (gMC.flag & 0x100)
{
- // Get speeds and accelerations
- int max_dash;
- int gravity1;
- int gravity2;
- int jump;
- int dash1;
- int dash2;
- int resist;
+ max_dash = 0x196;
+ max_move = 0x2FF;
+ gravity1 = 0x28;
+ gravity2 = 0x10;
+ jump = 0x280;
+ dash1 = 0x2A;
+ dash2 = 0x10;
+ resist = 0x19;
+ }
+ else
+ {
+ max_dash = 0x32C;
+ max_move = 0x5FF;
+ gravity1 = 0x50;
+ gravity2 = 0x20;
+ jump = 0x500;
+ dash1 = 0x55;
+ dash2 = 0x20;
+ resist = 0x33;
+ }
- if (gMC.flag & 0x100)
+ // Don't create "?" effect
+ gMC.ques = 0;
+
+ // If can't control player, stop boosting
+ if (!bKey)
+ gMC.boost_sw = 0;
+
+ // Movement on the ground
+ if (gMC.flag & 8 || gMC.flag & 0x10 || gMC.flag & 0x20)
+ {
+ // Stop boosting and refuel
+ gMC.boost_sw = 0;
+
+ if (gMC.equip & 1)
{
- max_dash = 0x196;
- gravity1 = 0x28;
- gravity2 = 0x10;
- jump = 0x280;
- dash1 = 0x2A;
- dash2 = 0x10;
- resist = 0x19;
+ gMC.boost_cnt = 50;
}
+ else if (gMC.equip & 0x20)
+ {
+ gMC.boost_cnt = 50;
+ }
else
{
- max_dash = 0x32C;
- gravity1 = 0x50;
- gravity2 = 0x20;
- jump = 0x500;
- dash1 = 0x55;
- dash2 = 0x20;
- resist = 0x33;
+ gMC.boost_cnt = 0;
}
- // Don't create "?" effect
- gMC.ques = 0;
-
- // If can't control player, stop boosting
- if (!bKey)
- gMC.boost_sw = 0;
-
- // Movement on the ground
- if (gMC.flag & 8 || gMC.flag & 0x10 || gMC.flag & 0x20)
+ // Move in direction held
+ if (bKey)
{
- // Stop boosting and refuel
- gMC.boost_sw = 0;
-
- if (gMC.equip & 1)
+ if (gKeyTrg == gKeyDown && gKey == gKeyDown && (gMC.cond & 1) == 0 && (g_GameFlags & 4) == 0)
{
- gMC.boost_cnt = 50;
+ gMC.cond |= 1;
+ gMC.ques = 1;
}
- else if (gMC.equip & 0x20)
+ else if (gKey == gKeyDown)
{
- gMC.boost_cnt = 50;
+
}
else
{
- gMC.boost_cnt = 0;
+ if (gKey & gKeyLeft && gMC.xm > -max_dash)
+ gMC.xm -= dash1;
+ if (gKey & gKeyRight && gMC.xm < max_dash)
+ gMC.xm += dash1;
+
+ if (gKey & gKeyLeft)
+ gMC.direct = 0;
+ if (gKey & gKeyRight)
+ gMC.direct = 2;
}
+ }
- // Move in direction held
- if (bKey)
+ // Friction
+ if (!(gMC.cond & 0x20))
+ {
+ if (gMC.xm < 0)
{
- if (gKeyTrg != gKeyDown || gKey != gKeyDown || (gMC.cond & 1) || g_GameFlags & 4)
- {
- if (gKey != gKeyDown)
- {
- if (gKey & gKeyLeft && gMC.xm > -max_dash)
- gMC.xm -= dash1;
- if (gKey & gKeyRight && gMC.xm < max_dash)
- gMC.xm += dash1;
-
- if (gKey & gKeyLeft)
- gMC.direct = 0;
- if (gKey & gKeyRight)
- gMC.direct = 2;
- }
- }
+ if (gMC.xm > -resist)
+ gMC.xm = 0;
else
- {
- gMC.cond |= 1;
- gMC.ques = 1;
- }
+ gMC.xm += resist;
}
-
- // Friction
- if (!(gMC.cond & 0x20))
+ if (gMC.xm > 0)
{
- if (gMC.xm < 0)
- {
- if (gMC.xm <= -resist)
- gMC.xm += resist;
- else
- gMC.xm = 0;
- }
- if (gMC.xm > 0)
- {
- if (gMC.xm >= resist)
- gMC.xm -= resist;
- else
- gMC.xm = 0;
- }
+ if (gMC.xm < resist)
+ gMC.xm = 0;
+ else
+ gMC.xm -= resist;
}
}
- else
+ }
+ else
+ {
+ // Start boosting
+ if (bKey)
{
- // Start boosting
- if (bKey)
+ if (gMC.equip & 0x21 && gKeyTrg & gKeyJump && gMC.boost_cnt)
{
- if (gMC.equip & 0x21 && gKeyTrg & gKeyJump && gMC.boost_cnt)
+ // Booster 0.8
+ if (gMC.equip & 1)
{
- // Booster 0.8
- if (gMC.equip & 1)
+ gMC.boost_sw = 1;
+ if (gMC.ym > 0x100)
+ gMC.ym /= 2;
+ }
+
+ // Booster 2.0
+ if (gMC.equip & 0x20)
+ {
+ if (gKey & gKeyUp)
{
+ gMC.boost_sw = 2;
+ gMC.xm = 0;
+ gMC.ym = -0x5FF;
+ }
+ else if (gKey & gKeyLeft)
+ {
gMC.boost_sw = 1;
- if (gMC.ym > 0x100)
- gMC.ym /= 2;
+ gMC.ym = 0;
+ gMC.xm = -0x5FF;
}
-
- // Booster 2.0
- if (gMC.equip & 0x20)
+ else if (gKey & gKeyRight)
{
- if (gKey & gKeyUp)
- {
- gMC.boost_sw = 2;
- gMC.xm = 0;
- gMC.ym = -0x5FF;
- }
- else if (gKey & gKeyLeft)
- {
- gMC.boost_sw = 1;
- gMC.ym = 0;
- gMC.xm = -0x5FF;
- }
- else if (gKey & gKeyRight)
- {
- gMC.boost_sw = 1;
- gMC.ym = 0;
- gMC.xm = 0x5FF;
- }
- else if (gKey & gKeyDown)
- {
- gMC.boost_sw = 3;
- gMC.xm = 0;
- gMC.ym = 0x5FF;
- }
- else
- {
- gMC.boost_sw = 2;
- gMC.xm = 0;
- gMC.ym = -0x5FF;
- }
+ gMC.boost_sw = 1;
+ gMC.ym = 0;
+ gMC.xm = 0x5FF;
}
+ else if (gKey & gKeyDown)
+ {
+ gMC.boost_sw = 3;
+ gMC.xm = 0;
+ gMC.ym = 0x5FF;
+ }
+ else
+ {
+ gMC.boost_sw = 2;
+ gMC.xm = 0;
+ gMC.ym = -0x5FF;
+ }
}
-
- // Move left and right
- if (gKey & gKeyLeft && gMC.xm > -max_dash)
- gMC.xm -= dash2;
- if (gKey & gKeyRight && gMC.xm < max_dash)
- gMC.xm += dash2;
-
- if (gKey & gKeyLeft)
- gMC.direct = 0;
- if (gKey & gKeyRight)
- gMC.direct = 2;
}
- // Slow down when stopped boosting (Booster 2.0)
- if (gMC.equip & 0x20 && gMC.boost_sw && (!(gKey & gKeyJump) || !gMC.boost_cnt))
- {
- if (gMC.boost_sw == 1)
- gMC.xm /= 2;
- else if (gMC.boost_sw == 2)
- gMC.ym /= 2;
- }
+ // Move left and right
+ if (gKey & gKeyLeft && gMC.xm > -max_dash)
+ gMC.xm -= dash2;
+ if (gKey & gKeyRight && gMC.xm < max_dash)
+ gMC.xm += dash2;
- // Stop boosting
- if (!gMC.boost_cnt || !(gKey & gKeyJump))
- gMC.boost_sw = 0;
+ if (gKey & gKeyLeft)
+ gMC.direct = 0;
+ if (gKey & gKeyRight)
+ gMC.direct = 2;
}
- // Jumping
- if (bKey)
+ // Slow down when stopped boosting (Booster 2.0)
+ if (gMC.equip & 0x20 && gMC.boost_sw && (!(gKey & gKeyJump) || !gMC.boost_cnt))
{
- // Look up and down
- gMC.up = (gKey & gKeyUp) != 0;
- gMC.down = gKey & gKeyDown && !(gMC.flag & 8);
+ if (gMC.boost_sw == 1)
+ gMC.xm /= 2;
+ else if (gMC.boost_sw == 2)
+ gMC.ym /= 2;
+ }
- if (gKeyTrg & gKeyJump
- && (gMC.flag & 8 || gMC.flag & 0x10 || gMC.flag & 0x20)
- && !(gMC.flag & 0x2000))
+ // Stop boosting
+ if (!gMC.boost_cnt || !(gKey & gKeyJump))
+ gMC.boost_sw = 0;
+ }
+
+ // Jumping
+ if (bKey)
+ {
+ // Look up and down
+ if (gKey & gKeyUp)
+ gMC.up = TRUE;
+ else
+ gMC.up = FALSE;
+
+ if (gKey & gKeyDown && (gMC.flag & 8) == 0)
+ gMC.down = TRUE;
+ else
+ gMC.down = FALSE;
+
+ if (gKeyTrg & gKeyJump
+ && (gMC.flag & 8 || gMC.flag & 0x10 || gMC.flag & 0x20))
+ {
+ if (gMC.flag & 0x2000)
{
+ // Another weird empty case needed for accurate assembly
+ }
+ else
+ {
gMC.ym = -jump;
PlaySoundObject(15, 1);
}
}
+ }
- // Stop interacting when moved
- if (bKey && (gKeyShot | gKeyJump | gKeyUp | gKeyRight | gKeyLeft) & gKey)
- gMC.cond &= ~1;
+ // Stop interacting when moved
+ if (bKey && (gKeyShot | gKeyJump | gKeyUp | gKeyRight | gKeyLeft) & gKey)
+ gMC.cond &= ~1;
- // Booster losing fuel
- if (gMC.boost_sw && gMC.boost_cnt)
- --gMC.boost_cnt;
+ // Booster losing fuel
+ if (gMC.boost_sw && gMC.boost_cnt)
+ --gMC.boost_cnt;
- // Wind / current forces
- if (gMC.flag & 0x1000)
- gMC.xm -= 0x88;
- if (gMC.flag & 0x2000)
- gMC.ym -= 0x80;
- if (gMC.flag & 0x4000)
- gMC.xm += 0x88;
- if (gMC.flag & 0x8000)
- gMC.ym += 0x55;
+ // Wind / current forces
+ if (gMC.flag & 0x1000)
+ gMC.xm -= 0x88;
+ if (gMC.flag & 0x2000)
+ gMC.ym -= 0x80;
+ if (gMC.flag & 0x4000)
+ gMC.xm += 0x88;
+ if (gMC.flag & 0x8000)
+ gMC.ym += 0x55;
- // Booster 2.0 forces and effects
- if (gMC.equip & 0x20 && gMC.boost_sw)
+ // Booster 2.0 forces and effects
+ if (gMC.equip & 0x20 && gMC.boost_sw)
+ {
+ if (gMC.boost_sw == 1)
{
- if (gMC.boost_sw == 1)
- {
- // Go up when going into a wall
- if (gMC.flag & 5)
- gMC.ym = -0x100;
+ // Go up when going into a wall
+ if (gMC.flag & 5)
+ gMC.ym = -0x100;
- // Move in direction facing
+ // Move in direction facing
+ if (!gMC.direct)
+ gMC.xm -= 0x20;
+ if (gMC.direct == 2)
+ gMC.xm += 0x20;
+
+ // Boost particles (and sound)
+ if (gKeyTrg & gKeyJump || gMC.boost_cnt % 3 == 1)
+ {
if (!gMC.direct)
- gMC.xm -= 0x20;
+ SetCaret(gMC.x + 0x400, gMC.y + 0x400, 7, 2);
if (gMC.direct == 2)
- gMC.xm += 0x20;
+ SetCaret(gMC.x - 0x400, gMC.y + 0x400, 7, 0);
- // Boost particles (and sound)
- if (gKeyTrg & gKeyJump || gMC.boost_cnt % 3 == 1)
- {
- if (!gMC.direct)
- SetCaret(gMC.x + 0x400, gMC.y + 0x400, 7, 2);
- if (gMC.direct == 2)
- SetCaret(gMC.x - 0x400, gMC.y + 0x400, 7, 0);
-
- PlaySoundObject(113, 1);
- }
- }
- else if (gMC.boost_sw == 2)
- {
- // Move upwards
- gMC.ym -= 0x20;
-
- // Boost particles (and sound)
- if (gKeyTrg & gKeyJump || gMC.boost_cnt % 3 == 1)
- {
- SetCaret(gMC.x, gMC.y + 0xC00, 7, 3);
- PlaySoundObject(113, 1);
- }
- }
- else if (gMC.boost_sw == 3 && (gKeyTrg & gKeyJump || gMC.boost_cnt % 3 == 1))
- {
- // Boost particles (and sound)
- SetCaret(gMC.x, gMC.y - 0xC00, 7, 1);
PlaySoundObject(113, 1);
}
}
- // Upwards wind/current
- else if (gMC.flag & 0x2000)
+ else if (gMC.boost_sw == 2)
{
- gMC.ym += gravity1;
- }
- // Booster 0.8
- else if (gMC.equip & 1 && gMC.boost_sw && gMC.ym > -0x400)
- {
- // Upwards force
+ // Move upwards
gMC.ym -= 0x20;
- if (!(gMC.boost_cnt % 3))
+ // Boost particles (and sound)
+ if (gKeyTrg & gKeyJump || gMC.boost_cnt % 3 == 1)
{
- SetCaret(gMC.x, gMC.hit.bottom / 2 + gMC.y, 7, 3);
+ SetCaret(gMC.x, gMC.y + 0xC00, 7, 3);
PlaySoundObject(113, 1);
}
-
- // Bounce off of ceiling
- if (gMC.flag & 2)
- gMC.ym = 0x200;
}
- // Gravity while jump is held
- else if (gMC.ym < 0 && bKey && gKey & gKeyJump)
+ else if (gMC.boost_sw == 3 && (gKeyTrg & gKeyJump || gMC.boost_cnt % 3 == 1))
{
- gMC.ym += gravity2;
+ // Boost particles (and sound)
+ SetCaret(gMC.x, gMC.y - 0xC00, 7, 1);
+ PlaySoundObject(113, 1);
}
- // Normal gravity
- else
- {
- gMC.ym += gravity1;
- }
+ }
+ // Upwards wind/current
+ else if (gMC.flag & 0x2000)
+ {
+ gMC.ym += gravity1;
+ }
+ // Booster 0.8
+ else if (gMC.equip & 1 && gMC.boost_sw && gMC.ym > -0x400)
+ {
+ // Upwards force
+ gMC.ym -= 0x20;
- // Keep player on slopes
- if (bKey && !(gKeyTrg & gKeyJump))
+ if (!(gMC.boost_cnt % 3))
{
- if (gMC.flag & 0x10 && gMC.xm < 0)
- gMC.ym = -gMC.xm;
- if (gMC.flag & 0x20 && gMC.xm > 0)
- gMC.ym = gMC.xm;
- if (gMC.flag & 8 && gMC.flag & 0x80000 && gMC.xm < 0)
- gMC.ym = 0x400;
- if (gMC.flag & 8 && gMC.flag & 0x10000 && gMC.xm > 0)
- gMC.ym = 0x400;
- if (gMC.flag & 8 && gMC.flag & 0x20000 && gMC.flag & 0x40000)
- gMC.ym = 0x400;
+ SetCaret(gMC.x, gMC.hit.bottom / 2 + gMC.y, 7, 3);
+ PlaySoundObject(113, 1);
}
- // Limit speed
- if (!(gMC.flag & 0x100) || gMC.flag & 0xF000)
- {
- if (gMC.xm < -0x5FF)
- gMC.xm = -0x5FF;
- if (gMC.xm > 0x5FF)
- gMC.xm = 0x5FF;
- if (gMC.ym < -0x5FF)
- gMC.ym = -0x5FF;
- if (gMC.ym > 0x5FF)
- gMC.ym = 0x5FF;
- }
+ // Bounce off of ceiling
+ if (gMC.flag & 2)
+ gMC.ym = 0x200;
+ }
+ // Gravity while jump is held
+ else if (gMC.ym < 0 && bKey && gKey & gKeyJump)
+ {
+ gMC.ym += gravity2;
+ }
+ // Normal gravity
+ else
+ {
+ gMC.ym += gravity1;
+ }
+
+ // Keep player on slopes
+ if (!bKey || !(gKeyTrg & gKeyJump))
+ {
+ if (gMC.flag & 0x10 && gMC.xm < 0)
+ gMC.ym = -gMC.xm;
+ if (gMC.flag & 0x20 && gMC.xm > 0)
+ gMC.ym = gMC.xm;
+ if (gMC.flag & 8 && gMC.flag & 0x80000 && gMC.xm < 0)
+ gMC.ym = 0x400;
+ if (gMC.flag & 8 && gMC.flag & 0x10000 && gMC.xm > 0)
+ gMC.ym = 0x400;
+ if (gMC.flag & 8 && gMC.flag & 0x20000 && gMC.flag & 0x40000)
+ gMC.ym = 0x400;
+ }
+
+ if (0)
+ {
+ // There used to be an if here that didn't do anything, but the compiler optimised it out.
+ // We only know this was here because empty ifs mess with the register usage.
+ // Since there's no code, we have no idea what the original condition actually was.
+ }
+
+ // Limit speed
+ if ((gMC.flag & 0x100) && (gMC.flag & 0xF000) == 0)
+ {
+ if (gMC.xm < -0x2FF)
+ gMC.xm = -0x2FF;
+ if (gMC.xm > 0x2FF)
+ gMC.xm = 0x2FF;
+ if (gMC.ym < -0x2FF)
+ gMC.ym = -0x2FF;
+ if (gMC.ym > 0x2FF)
+ gMC.ym = 0x2FF;
+ }
+ else
+ {
+ if (gMC.xm < -0x5FF)
+ gMC.xm = -0x5FF;
+ if (gMC.xm > 0x5FF)
+ gMC.xm = 0x5FF;
+ if (gMC.ym < -0x5FF)
+ gMC.ym = -0x5FF;
+ if (gMC.ym > 0x5FF)
+ gMC.ym = 0x5FF;
+ }
+
+ // Water splashing
+ if (!gMC.sprash && gMC.flag & 0x100)
+ {
+ int dir;
+ if (gMC.flag & 0x800)
+ dir = 2;
else
- {
- if (gMC.xm < -0x2FF)
- gMC.xm = -0x2FF;
- if (gMC.xm > 0x2FF)
- gMC.xm = 0x2FF;
- if (gMC.ym < -0x2FF)
- gMC.ym = -0x2FF;
- if (gMC.ym > 0x2FF)
- gMC.ym = 0x2FF;
- }
+ dir = 0;
- // Water splashing
- if (!gMC.sprash && gMC.flag & 0x100)
+ if ((gMC.flag & 8) == 0 && gMC.ym > 0x200)
{
- int dir;
- if (gMC.flag & 0x800)
- dir = 2;
- else
- dir = 0;
+ for (a = 0; a < 8; a++)
+ {
+ x = gMC.x + (Random(-8, 8) * 0x200);
+ SetNpChar(73, x, gMC.y, gMC.xm + Random(-0x200, 0x200), Random(-0x200, 0x80) - gMC.ym / 2, dir, 0, 0);
+ }
- if (gMC.flag & 8 || gMC.ym <= 0x200)
+ PlaySoundObject(56, 1);
+ }
+ else
+ {
+ if (gMC.xm > 0x200 || gMC.xm < -0x200)
{
- if (gMC.xm > 0x200 || gMC.xm < -0x200)
+ for (a = 0; a < 8; a++)
{
- for (int a = 0; a < 8; a++)
- SetNpChar(73, gMC.x + (Random(-8, 8) << 9), gMC.y, gMC.xm + Random(-0x200, 0x200), Random(-0x200, 0x80), dir, 0, 0);
-
- PlaySoundObject(56, 1);
+ x = gMC.x + (Random(-8, 8) * 0x200);
+ SetNpChar(73, x, gMC.y, gMC.xm + Random(-0x200, 0x200), Random(-0x200, 0x80), dir, 0, 0);
}
- }
- else
- {
- for (int a = 0; a < 8; a++)
- SetNpChar(73, gMC.x + (Random(-8, 8) << 9), gMC.y, gMC.xm + Random(-0x200, 0x200), Random(-0x200, 0x80) - gMC.ym / 2, dir, 0, 0);
PlaySoundObject(56, 1);
}
-
- gMC.sprash = 1;
}
- if (!(gMC.flag & 0x100))
- gMC.sprash = 0;
+ gMC.sprash = 1;
+ }
- // Spike damage
- if (gMC.flag & 0x400)
- DamageMyChar(10);
+ if (!(gMC.flag & 0x100))
+ gMC.sprash = 0;
- // Camera
- if (gMC.direct)
- {
- gMC.index_x += 0x200;
- if (gMC.index_x > 0x8000)
- gMC.index_x = 0x8000;
- }
- else
- {
- gMC.index_x -= 0x200;
- if (gMC.index_x < -0x8000)
- gMC.index_x = -0x8000;
- }
- if (gKey & gKeyUp && bKey)
- {
+ // Spike damage
+ if (gMC.flag & 0x400)
+ DamageMyChar(10);
+
+ // Camera
+ if (gMC.direct == 0)
+ {
+ gMC.index_x -= 0x200;
+ if (gMC.index_x < -0x8000)
+ gMC.index_x = -0x8000;
+ }
+ else
+ {
+ gMC.index_x += 0x200;
+ if (gMC.index_x > 0x8000)
+ gMC.index_x = 0x8000;
+ }
+ if (gKey & gKeyUp && bKey)
+ {
+ gMC.index_y -= 0x200;
+ if (gMC.index_y < -0x8000)
+ gMC.index_y = -0x8000;
+ }
+ else if (gKey & gKeyDown && bKey)
+ {
+ gMC.index_y += 0x200;
+ if (gMC.index_y > 0x8000)
+ gMC.index_y = 0x8000;
+ }
+ else
+ {
+ if (gMC.index_y > 0x200)
gMC.index_y -= 0x200;
- if (gMC.index_y < -0x8000)
- gMC.index_y = -0x8000;
- }
- else if (gKey & gKeyDown && bKey)
- {
+ if (gMC.index_y < -0x200)
gMC.index_y += 0x200;
- if (gMC.index_y > 0x8000)
- gMC.index_y = 0x8000;
- }
- else
- {
- if (gMC.index_y > 0x200)
- gMC.index_y -= 0x200;
- if (gMC.index_y < -0x200)
- gMC.index_y += 0x200;
- }
+ }
- gMC.tgt_x = gMC.x + gMC.index_x;
- gMC.tgt_y = gMC.y + gMC.index_y;
+ gMC.tgt_x = gMC.x + gMC.index_x;
+ gMC.tgt_y = gMC.y + gMC.index_y;
- // Change position
- if (gMC.xm > resist || gMC.xm < -resist)
- gMC.x += gMC.xm;
- gMC.y += gMC.ym;
+ // Change position
+ if (gMC.xm <= resist && gMC.xm >= -resist)
+ {
+ // Okay, this is getting stupid. Why the HELL is the code written like this?
}
+ else
+ {
+ gMC.x += gMC.xm;
+ }
+
+ gMC.y += gMC.ym;
}
-void ActMyChar_Stream(bool bKey)
+void ActMyChar_Stream(BOOL bKey)
{
- gMC.up = false;
- gMC.down = false;
+ gMC.up = FALSE;
+ gMC.down = FALSE;
if (bKey)
{
@@ -666,17 +705,18 @@
if (gKey & gKeyRight)
gMC.xm += 0x100;
}
- else if (gMC.xm > 0x7F || gMC.xm < -0x7F)
+ else if (gMC.xm < 0x80 && gMC.xm > -0x80)
{
- if (gMC.xm > 0)
- gMC.xm -= 0x80;
- else if (gMC.xm < 0)
- gMC.xm += 0x80;
+ gMC.xm = 0;
}
- else
+ else if (gMC.xm > 0)
{
- gMC.xm = 0;
+ gMC.xm -= 0x80;
}
+ else if (gMC.xm < 0)
+ {
+ gMC.xm += 0x80;
+ }
if (gKey & (gKeyDown | gKeyUp))
{
@@ -686,43 +726,34 @@
if (gKey & gKeyDown)
gMC.ym += 0x100;
}
- else if (gMC.ym > 0x7F || gMC.ym < -0x7F)
+ else if (gMC.ym < 0x80 && gMC.ym > -0x80)
{
- if (gMC.ym > 0)
- gMC.ym -= 0x80;
- else if (gMC.ym < 0)
- gMC.ym += 0x80;
+ gMC.ym = 0;
}
- else
+ else if (gMC.ym > 0)
{
- gMC.ym = 0;
+ gMC.ym -= 0x80;
}
+ else if (gMC.ym < 0)
+ {
+ gMC.ym += 0x80;
+ }
}
else
{
- if (gMC.xm > 0x7F || gMC.xm < -0x3F)
- {
- if (gMC.xm > 0)
- gMC.xm -= 0x80;
- else if (gMC.xm < 0)
- gMC.xm += 0x80;
- }
- else
- {
+ if (gMC.xm < 0x80 && gMC.xm > -0x40)
gMC.xm = 0;
- }
+ else if (gMC.xm > 0)
+ gMC.xm -= 0x80;
+ else if (gMC.xm < 0)
+ gMC.xm += 0x80;
- if (gMC.ym > 0x7F || gMC.ym < -0x3F)
- {
- if (gMC.ym > 0)
- gMC.ym -= 0x80;
- else if (gMC.ym < 0)
- gMC.ym += 0x80;
- }
- else
- {
+ if (gMC.ym < 0x80 && gMC.ym > -0x40)
gMC.ym = 0;
- }
+ else if (gMC.ym > 0)
+ gMC.ym -= 0x80;
+ else if (gMC.ym < 0)
+ gMC.ym += 0x80;
}
if (gMC.ym < -0x200 && gMC.flag & 2)
@@ -785,8 +816,12 @@
}
else
{
- if (gMC.flag & 0x100)
+ if ((gMC.flag & 0x100) == 0)
{
+ gMC.air = 1000;
+ }
+ else
+ {
if (--gMC.air <= 0)
{
if (GetNPCFlag(4000))
@@ -799,19 +834,15 @@
// Drown
StartTextScript(41);
- if (gMC.direct)
- SetCaret(gMC.x, gMC.y, 8, 2);
- else
+ if (gMC.direct == 0)
SetCaret(gMC.x, gMC.y, 8, 0);
+ else
+ SetCaret(gMC.x, gMC.y, 8, 2);
gMC.cond &= ~0x80;
}
}
}
- else
- {
- gMC.air = 1000;
- }
if (gMC.flag & 0x100)
{
@@ -824,41 +855,38 @@
}
}
-void ActMyChar(bool bKey)
+void ActMyChar(BOOL bKey)
{
- if (gMC.cond & 0x80)
- {
- if (gMC.exp_wait)
- --gMC.exp_wait;
+ if ((gMC.cond & 0x80) == 0)
+ return;
- if (gMC.shock)
- {
- --gMC.shock;
- }
- else if (gMC.exp_count)
- {
- SetValueView(&gMC.x, &gMC.y, gMC.exp_count);
- gMC.exp_count = 0;
- }
+ if (gMC.exp_wait)
+ --gMC.exp_wait;
- switch (gMC.unit)
- {
- case 0:
- if (!(g_GameFlags & 4) && bKey)
- AirProcess();
- ActMyChar_Normal(bKey);
- break;
+ if (gMC.shock)
+ {
+ --gMC.shock;
+ }
+ else if (gMC.exp_count)
+ {
+ SetValueView(&gMC.x, &gMC.y, gMC.exp_count);
+ gMC.exp_count = 0;
+ }
- case 1:
- ActMyChar_Stream(bKey);
- break;
+ switch (gMC.unit)
+ {
+ case 0:
+ if (!(g_GameFlags & 4) && bKey)
+ AirProcess();
+ ActMyChar_Normal(bKey);
+ break;
- default:
- break;
- }
-
- gMC.cond &= ~0x20;
+ case 1:
+ ActMyChar_Stream(bKey);
+ break;
}
+
+ gMC.cond &= ~0x20;
}
void GetMyCharPosition(int *x, int *y)
@@ -871,8 +899,8 @@
{
gMC.x = x;
gMC.y = y;
- gMC.tgt_x = x;
- gMC.tgt_y = y;
+ gMC.tgt_x = gMC.x;
+ gMC.tgt_y = gMC.y;
gMC.index_x = 0;
gMC.index_y = 0;
gMC.xm = 0;
@@ -897,42 +925,42 @@
return gMC.unit;
}
-void SetMyCharDirect(uint8_t dir)
+void SetMyCharDirect(unsigned char dir)
{
- switch (dir)
+ if (dir == 3)
{
- case 3:
- gMC.cond |= 1;
- break;
+ gMC.cond |= 1;
+ }
+ else
+ {
+ gMC.cond &= ~1;
- default:
- gMC.cond &= ~1;
-
- if (dir < 10)
- {
- gMC.direct = dir;
- break;
- }
-
- for (int i = 0; i < NPC_MAX; i++)
- {
+ if (dir < 10)
+ {
+ gMC.direct = dir;
+ }
+ else
+ {
+ int i;
+ for (i = 0; i < NPC_MAX; i++)
if (gNPC[i].code_event == dir)
- {
- if (gMC.x <= gNPC[i].x)
- gMC.direct = 2;
- else
- gMC.direct = 0;
break;
- }
- }
- break;
+
+ if (i == NPC_MAX)
+ return;
+
+ if (gMC.x > gNPC[i].x)
+ gMC.direct = 0;
+ else
+ gMC.direct = 2;
+ }
}
gMC.xm = 0;
- AnimationMyChar(false);
+ AnimationMyChar(FALSE);
}
-void ChangeMyUnit(uint8_t a)
+void ChangeMyUnit(unsigned char a)
{
gMC.unit = a;
}
@@ -942,7 +970,7 @@
gMC.y += 0x4000;
}
-void EquipItem(int flag, bool b)
+void EquipItem(int flag, BOOL b)
{
if (b)
gMC.equip |= flag;
@@ -960,17 +988,19 @@
noise_freq = freq;
noise_no = no;
- if (no == 1)
+ switch (noise_no)
{
- ChangeSoundFrequency(40, noise_freq);
- ChangeSoundFrequency(41, noise_freq + 100);
- PlaySoundObject(40, -1);
- PlaySoundObject(41, -1);
+ case 1:
+ ChangeSoundFrequency(40, noise_freq);
+ ChangeSoundFrequency(41, noise_freq + 100);
+ PlaySoundObject(40, -1);
+ PlaySoundObject(41, -1);
+ break;
+
+ case 2:
+ PlaySoundObject(58, -1);
+ break;
}
- else if (no == 2)
- {
- PlaySoundObject(58, -1);
- }
}
void CutNoise()
@@ -983,16 +1013,18 @@
void ResetNoise()
{
- if (noise_no == 1)
+ switch (noise_no)
{
- ChangeSoundFrequency(40, noise_freq);
- ChangeSoundFrequency(41, noise_freq + 100);
- PlaySoundObject(40, -1);
- PlaySoundObject(41, -1);
- }
- else if (noise_no == 2)
- {
- PlaySoundObject(58, -1);
+ case 1:
+ ChangeSoundFrequency(40, noise_freq);
+ ChangeSoundFrequency(41, noise_freq + 100);
+ PlaySoundObject(40, -1);
+ PlaySoundObject(41, -1);
+ break;
+
+ case 2:
+ PlaySoundObject(58, -1);
+ break;
}
}
--- a/src/MyChar.h
+++ b/src/MyChar.h
@@ -1,16 +1,14 @@
#pragma once
-#include <stdint.h>
-
#include "WindowsWrapper.h"
struct MYCHAR
{
- uint8_t cond;
+ unsigned char cond;
unsigned int flag;
int direct;
- int up;
- int down;
+ BOOL up;
+ BOOL down;
int unit;
int equip;
int x;
@@ -30,21 +28,21 @@
int level;
int exp_wait;
int exp_count;
- uint8_t shock;
- uint8_t no_life;
- uint8_t rensha;
- uint8_t bubble;
- int16_t life;
- int16_t star;
- int16_t max_life;
- int16_t a;
+ unsigned char shock;
+ unsigned char no_life;
+ unsigned char rensha;
+ unsigned char bubble;
+ short life;
+ short star;
+ short max_life;
+ short a;
int lifeBr;
int lifeBr_count;
int air;
int air_get;
- int8_t sprash;
- int8_t ques;
- int8_t boost_sw;
+ signed char sprash;
+ signed char ques;
+ signed char boost_sw;
int boost_cnt;
};
@@ -51,20 +49,20 @@
extern MYCHAR gMC;
void InitMyChar();
-void AnimationMyChar(bool bKey);
-void ShowMyChar(bool bShow);
+void AnimationMyChar(BOOL bKey);
+void ShowMyChar(BOOL bShow);
void PutMyChar(int fx, int fy);
-void ActMyChar_Normal(bool bKey);
-void ActMyChar(bool bKey);
+void ActMyChar_Normal(BOOL bKey);
+void ActMyChar(BOOL bKey);
void GetMyCharPosition(int *x, int *y);
void SetMyCharPosition(int x, int y);
void MoveMyChar(int x, int y);
void ZeroMyCharXMove();
int GetUnitMyChar();
-void SetMyCharDirect(uint8_t dir);
-void ChangeMyUnit(uint8_t a);
+void SetMyCharDirect(unsigned char dir);
+void ChangeMyUnit(unsigned char a);
void PitMyChar();
-void EquipItem(int flag, bool b);
+void EquipItem(int flag, BOOL b);
void ResetCheck();
void SetNoise(int no, int freq);
void CutNoise();
--- a/src/MycHit.cpp
+++ b/src/MycHit.cpp
@@ -1,7 +1,5 @@
#include "MycHit.h"
-#include <stdint.h>
-
#include "WindowsWrapper.h"
#include "Back.h"
@@ -36,13 +34,13 @@
int hit = 0;
// Left wall
- if (gMC.y - gMC.hit.top < (2 * (2 * y + 1) - 1) << 11
- && gMC.y + gMC.hit.bottom > (2 * (2 * y - 1) + 1) << 11
- && gMC.x - gMC.hit.left < (2 * x + 1) << 12
- && gMC.x - gMC.hit.left > x << 13)
+ if (gMC.y - gMC.hit.top < (y * 0x10 + 4) * 0x200
+ && gMC.y + gMC.hit.bottom > (y * 0x10 - 4) * 0x200
+ && gMC.x - gMC.hit.left < (x * 0x10 + 8) * 0x200
+ && gMC.x - gMC.hit.left > x * 0x10 * 0x200)
{
// Clip
- gMC.x = ((2 * x + 1) << 12) + gMC.hit.left;
+ gMC.x = ((x * 0x10 + 8) * 0x200) + gMC.hit.left;
// Halt momentum
if (gMC.xm < -0x180)
@@ -55,13 +53,13 @@
}
// Right wall
- if (gMC.y - gMC.hit.top < (2 * (2 * y + 1) - 1) << 11
- && gMC.y + gMC.hit.bottom > (2 * (2 * y - 1) + 1) << 11
- && gMC.x + gMC.hit.right > (2 * x - 1) << 12
- && gMC.x + gMC.hit.left < x << 13)
+ if (gMC.y - gMC.hit.top < (y * 0x10 + 4) * 0x200
+ && gMC.y + gMC.hit.bottom > (y * 0x10 - 4) * 0x200
+ && gMC.x + gMC.hit.right > (x * 0x10 - 8) * 0x200
+ && gMC.x + gMC.hit.left < x * 0x10 * 0x200)
{
// Clip
- gMC.x = ((2 * x - 1) << 12) - gMC.hit.right;
+ gMC.x = ((x * 0x10 - 8) * 0x200) - gMC.hit.right;
// Halt momentum
if (gMC.xm > 0x180)
@@ -74,13 +72,13 @@
}
// Ceiling
- if (gMC.x - gMC.hit.right < ((2 * x + 1) << 12) - 0x600
- && gMC.x + gMC.hit.right > ((2 * x - 1) << 12) + 0x600
- && gMC.y - gMC.hit.top < (2 * y + 1) << 12
- && gMC.y - gMC.hit.top > y << 13)
+ if (gMC.x - gMC.hit.right < (x * 0x10 + 5) * 0x200
+ && gMC.x + gMC.hit.right > (x * 0x10 - 5) * 0x200
+ && gMC.y - gMC.hit.top < (y * 0x10 + 8) * 0x200
+ && gMC.y - gMC.hit.top > y * 0x10 * 0x200)
{
// Clip
- gMC.y = ((2 * y + 1) << 12) + gMC.hit.top;
+ gMC.y = ((y * 0x10 + 8) * 0x200) + gMC.hit.top;
// Halt momentum
if (!(gMC.cond & 2) && gMC.ym < -0x200)
@@ -93,13 +91,13 @@
}
// Floor
- if (gMC.x - gMC.hit.right < ((2 * x + 1) << 12) - 0x600
- && gMC.x + gMC.hit.right > ((2 * x - 1) << 12) + 0x600
- && gMC.y + gMC.hit.bottom > (2 * y - 1) << 12
- && gMC.y + gMC.hit.bottom < y << 13)
+ if (gMC.x - gMC.hit.right < (x * 0x10 + 5) * 0x200
+ && gMC.x + gMC.hit.right > ((x * 0x10 - 5) * 0x200)
+ && gMC.y + gMC.hit.bottom > (y * 0x10 - 8) * 0x200
+ && gMC.y + gMC.hit.bottom < y * 0x10 * 0x200)
{
// Clip
- gMC.y = ((2 * y - 1) << 12) - gMC.hit.bottom;
+ gMC.y = ((y * 0x10 - 8) * 0x200) - gMC.hit.bottom;
// Halt momentum
if (gMC.ym > 0x400)
@@ -118,13 +116,13 @@
{
int hit = 0;
- if (gMC.x < (2 * x + 1) << 12
- && gMC.x > (2 * x - 1) << 12
- && gMC.y - gMC.hit.top < (y << 13) - (-0x2000 * x + gMC.x) / 2 + 0x800
- && gMC.y + gMC.hit.bottom > (2 * y - 1) << 12)
+ if (gMC.x < (x * 0x10 + 8) * 0x200
+ && gMC.x > (x * 0x10 - 8) * 0x200
+ && gMC.y - gMC.hit.top < (y * 0x10 * 0x200) - (gMC.x - x * 0x10 * 0x200) / 2 + 0x800
+ && gMC.y + gMC.hit.bottom > (y * 0x10 - 8) * 0x200)
{
// Clip
- gMC.y = (y << 13) - (-0x2000 * x + gMC.x) / 2 + 0x800 + gMC.hit.top;
+ gMC.y = (y * 0x10 * 0x200) - ((gMC.x - x * 0x10 * 0x200) / 2) + 0x800 + gMC.hit.top;
// Halt momentum
if (!(gMC.cond & 2) && gMC.ym < -0x200)
@@ -143,13 +141,13 @@
{
int hit = 0;
- if (gMC.x < (2 * x + 1) << 12
- && gMC.x > (2 * x - 1) << 12
- && gMC.y - gMC.hit.top < (y << 13) - (-0x2000 * x + gMC.x) / 2 - 0x800
- && gMC.y + gMC.hit.bottom > (2 * y - 1) << 12)
+ if (gMC.x < (x * 0x10 + 8) * 0x200
+ && gMC.x > (x * 0x10 - 8) * 0x200
+ && gMC.y - gMC.hit.top < (y * 0x10 * 0x200) - ((gMC.x - x * 0x10 * 0x200) / 2) - 0x800
+ && gMC.y + gMC.hit.bottom > (y * 0x10 - 8) * 0x200)
{
// Clip
- gMC.y = (y << 13) - (-0x2000 * x + gMC.x) / 2 - 0x800 + gMC.hit.top;
+ gMC.y = (y * 0x10 * 0x200) - ((gMC.x - x * 0x10 * 0x200) / 2) - 0x800 + gMC.hit.top;
// Halt momentum
if (!(gMC.cond & 2) && gMC.ym < -0x200)
@@ -168,13 +166,13 @@
{
int hit = 0;
- if (gMC.x < (2 * x + 1) << 12
- && gMC.x > (2 * x - 1) << 12
- && gMC.y - gMC.hit.top < (y << 13) + (-0x2000 * x + gMC.x) / 2 - 0x800
- && gMC.y + gMC.hit.bottom > (2 * y - 1) << 12)
+ if (gMC.x < (x * 0x10 + 8) * 0x200
+ && gMC.x > (x * 0x10 - 8) * 0x200
+ && gMC.y - gMC.hit.top < (y * 0x10 * 0x200) + ((gMC.x - x * 0x10 * 0x200) / 2) - 0x800
+ && gMC.y + gMC.hit.bottom > (y * 0x10 - 8) * 0x200)
{
// Clip
- gMC.y = (y << 13) + (-0x2000 * x + gMC.x) / 2 - 0x800 + gMC.hit.top;
+ gMC.y = (y * 0x10 * 0x200) + ((gMC.x - x * 0x10 * 0x200) / 2) - 0x800 + gMC.hit.top;
// Halt momentum
if (!(gMC.cond & 2) && gMC.ym < -0x200)
@@ -193,13 +191,13 @@
{
int hit = 0;
- if (gMC.x < (2 * x + 1) << 12
- && gMC.x > (2 * x - 1) << 12
- && gMC.y - gMC.hit.top < (y << 13) + (-0x2000 * x + gMC.x) / 2 + 0x800
- && gMC.y + gMC.hit.bottom > (2 * y - 1) << 12)
+ if (gMC.x < (x * 0x10 + 8) * 0x200
+ && gMC.x > (x * 0x10 - 8) * 0x200
+ && gMC.y - gMC.hit.top < (y * 0x10 * 0x200) + ((gMC.x - x * 0x10 * 0x200) / 2) + 0x800
+ && gMC.y + gMC.hit.bottom > (y * 0x10 - 8) * 0x200)
{
// Clip
- gMC.y = (y << 13) + (-0x2000 * x + gMC.x) / 2 + 0x800 + gMC.hit.top;
+ gMC.y = (y * 0x10 * 0x200) + ((gMC.x - x * 0x10 * 0x200) / 2) + 0x800 + gMC.hit.top;
// Halt momentum
if (!(gMC.cond & 2) && gMC.ym < -0x200)
@@ -216,15 +214,17 @@
int JudgeHitMyCharTriangleE(int x, int y)
{
- int hit = 0x10000;
+ int hit = 0;
- if (gMC.x < (2 * x + 1) << 12
- && gMC.x > (2 * x - 1) << 12
- && gMC.y + gMC.hit.bottom > (y << 13) + (-0x2000 * x + gMC.x) / 2 - 0x800
- && gMC.y - gMC.hit.top < (2 * y + 1) << 12)
+ hit |= 0x10000;
+
+ if (gMC.x < (x * 0x10 + 8) * 0x200
+ && gMC.x > (x * 0x10 - 8) * 0x200
+ && gMC.y + gMC.hit.bottom > (y * 0x10 * 0x200) + ((gMC.x - x * 0x10 * 0x200) / 2) - 0x800
+ && gMC.y - gMC.hit.top < (y * 0x10 + 8) * 0x200)
{
// Clip
- gMC.y = (y << 13) + (-0x2000 * x + gMC.x) / 2 - 0x800 - gMC.hit.bottom;
+ gMC.y = (y * 0x10 * 0x200) + ((gMC.x - x * 0x10 * 0x200) / 2) - 0x800 - gMC.hit.bottom;
// Halt momentum
if (gMC.ym > 0x400)
@@ -233,7 +233,7 @@
gMC.ym = 0;
// Set that hit this slope
- hit = 0x10028;
+ hit |= 0x28;
}
return hit;
@@ -241,15 +241,17 @@
int JudgeHitMyCharTriangleF(int x, int y)
{
- int hit = 0x20000;
+ int hit = 0;
- if (gMC.x < (2 * x + 1) << 12
- && gMC.x > (2 * x - 1) << 12
- && gMC.y + gMC.hit.bottom > (y << 13) + (-0x2000 * x + gMC.x) / 2 + 0x800
- && gMC.y - gMC.hit.top < (2 * y + 1) << 12)
+ hit |= 0x20000;
+
+ if (gMC.x < (x * 0x10 + 8) * 0x200
+ && gMC.x > (x * 0x10 - 8) * 0x200
+ && gMC.y + gMC.hit.bottom > (y * 0x10 * 0x200) + ((gMC.x - x * 0x10 * 0x200) / 2) + 0x800
+ && gMC.y - gMC.hit.top < (y * 0x10 + 8) * 0x200)
{
// Clip
- gMC.y = (y << 13) + (-0x2000 * x + gMC.x) / 2 + 0x800 - gMC.hit.bottom;
+ gMC.y = (y * 0x10 * 0x200) + ((gMC.x - x * 0x10 * 0x200) / 2) + 0x800 - gMC.hit.bottom;
// Halt momentum
if (gMC.ym > 0x400)
@@ -258,7 +260,7 @@
gMC.ym = 0;
// Set that hit this slope
- hit = 0x20028;
+ hit |= 0x28;
}
return hit;
@@ -266,15 +268,17 @@
int JudgeHitMyCharTriangleG(int x, int y)
{
- int hit = 0x40000;
+ int hit = 0;
- if (gMC.x < (2 * x + 1) << 12
- && gMC.x > (2 * x - 1) << 12
- && gMC.y + gMC.hit.bottom > (y << 13) - (-0x2000 * x + gMC.x) / 2 + 0x800
- && gMC.y - gMC.hit.top < (2 * y + 1) << 12)
+ hit |= 0x40000;
+
+ if (gMC.x < (x * 0x10 + 8) * 0x200
+ && gMC.x > (x * 0x10 - 8) * 0x200
+ && gMC.y + gMC.hit.bottom > (y * 0x10 * 0x200) - ((gMC.x - x * 0x10 * 0x200) / 2) + 0x800
+ && gMC.y - gMC.hit.top < (y * 0x10 + 8) * 0x200)
{
// Clip
- gMC.y = (y << 13) - (-0x2000 * x + gMC.x) / 2 + 0x800 - gMC.hit.bottom;
+ gMC.y = (y * 0x10 * 0x200) - ((gMC.x - x * 0x10 * 0x200) / 2) + 0x800 - gMC.hit.bottom;
// Halt momentum
if (gMC.ym > 0x400)
@@ -283,7 +287,7 @@
gMC.ym = 0;
// Set that hit this slope
- hit = 0x40018;
+ hit |= 0x18;
}
return hit;
@@ -291,15 +295,17 @@
int JudgeHitMyCharTriangleH(int x, int y)
{
- int hit = 0x80000;
+ int hit = 0;
- if (gMC.x < (2 * x + 1) << 12
- && gMC.x > (2 * x - 1) << 12
- && gMC.y + gMC.hit.bottom > (y << 13) - (-0x2000 * x + gMC.x) / 2 - 0x800
- && gMC.y - gMC.hit.top < (2 * y + 1) << 12)
+ hit |= 0x80000;
+
+ if (gMC.x < (x * 0x10 + 8) * 0x200
+ && gMC.x > (x * 0x10 - 8) * 0x200
+ && gMC.y + gMC.hit.bottom > (y * 0x10 * 0x200) - ((gMC.x - x * 0x10 * 0x200) / 2) - 0x800
+ && gMC.y - gMC.hit.top < (y * 0x10 + 8) * 0x200)
{
// Clip
- gMC.y = (y << 13) - (-0x2000 * x + gMC.x) / 2 - 0x800 - gMC.hit.bottom;
+ gMC.y = (y * 0x10 * 0x200) - ((gMC.x - x * 0x10 * 0x200) / 2) - 0x800 - gMC.hit.bottom;
// Halt momentum
if (gMC.ym > 0x400)
@@ -308,7 +314,7 @@
gMC.ym = 0;
// Set that hit this slope
- hit = 0x80018;
+ hit |= 0x18;
}
return hit;
@@ -318,11 +324,11 @@
{
int hit = 0;
- if (gMC.x - gMC.hit.right < ((2 * x + 1) << 12) - 0x600
- && gMC.x + gMC.hit.right > ((2 * x - 1) << 12) + 0x600
- && gMC.y - gMC.hit.top < ((2 * y + 1) << 12) - 0x600
- && gMC.y + gMC.hit.bottom > y << 13)
- hit = 0x100;
+ if (gMC.x - gMC.hit.right < (x * 0x10 + 5) * 0x200
+ && gMC.x + gMC.hit.right > ((x * 0x10 - 5) * 0x200)
+ && gMC.y - gMC.hit.top < ((y * 0x10 + 5) * 0x200)
+ && gMC.y + gMC.hit.bottom > y * 0x10 * 0x200)
+ hit |= 0x100;
return hit;
}
@@ -331,11 +337,11 @@
{
int hit = 0;
- if (gMC.x - 0x800 < (4 * x + 1) << 11
- && gMC.x + 0x800 > (4 * x - 1) << 11
- && gMC.y - 0x800 < (y << 13) + 0x600
- && gMC.y + 0x800 > (y << 13) - 0x600)
- hit = 0x400;
+ if (gMC.x - 0x800 < (x * 0x10 + 4) * 0x200
+ && gMC.x + 0x800 > (x * 0x10 - 4) * 0x200
+ && gMC.y - 0x800 < (y * 0x10 + 3) * 0x200
+ && gMC.y + 0x800 > (y * 0x10 - 3) * 0x200)
+ hit |= 0x400;
return hit;
}
@@ -344,11 +350,11 @@
{
int hit = 0;
- if (gMC.x - 0x800 < (4 * x + 1) << 11
- && gMC.x + 0x800 > (4 * x - 1) << 11
- && gMC.y - 0x800 < (y << 13) + 0x600
- && gMC.y + 0x800 > (y << 13) - 0x600)
- hit = 0xD00;
+ if (gMC.x - 0x800 < (x * 0x10 + 4) * 0x200
+ && gMC.x + 0x800 > (x * 0x10 - 4) * 0x200
+ && gMC.y - 0x800 < (y * 0x10 + 3) * 0x200
+ && gMC.y + 0x800 > (y * 0x10 - 3) * 0x200)
+ hit |= 0xD00;
return hit;
}
@@ -356,11 +362,11 @@
int JudgeHitMyCharVectLeft(int x, int y)
{
int hit = 0;
- if (gMC.x - gMC.hit.right < (4 * (2 * x + 1) - 1) << 10
- && gMC.x + gMC.hit.right > (4 * (2 * x - 1) + 1) << 10
- && gMC.y - gMC.hit.top < (4 * (2 * y + 1) - 1) << 10
- && gMC.y + gMC.hit.bottom > (4 * (2 * y - 1) + 1) << 10)
- hit = 0x1000;
+ if (gMC.x - gMC.hit.right < (x * 0x10 + 6) * 0x200
+ && gMC.x + gMC.hit.right > (x * 0x10 - 6) * 0x200
+ && gMC.y - gMC.hit.top < (y * 0x10 + 6) * 0x200
+ && gMC.y + gMC.hit.bottom > (y * 0x10 - 6) * 0x200)
+ hit |= 0x1000;
return hit;
}
@@ -368,11 +374,11 @@
int JudgeHitMyCharVectUp(int x, int y)
{
int hit = 0;
- if (gMC.x - gMC.hit.right < (4 * (2 * x + 1) - 1) << 10
- && gMC.x + gMC.hit.right > (4 * (2 * x - 1) + 1) << 10
- && gMC.y - gMC.hit.top < (4 * (2 * y + 1) - 1) << 10
- && gMC.y + gMC.hit.bottom > (4 * (2 * y - 1) + 1) << 10)
- hit = 0x2000;
+ if (gMC.x - gMC.hit.right < (x * 0x10 + 6) * 0x200
+ && gMC.x + gMC.hit.right > (x * 0x10 - 6) * 0x200
+ && gMC.y - gMC.hit.top < (y * 0x10 + 6) * 0x200
+ && gMC.y + gMC.hit.bottom > (y * 0x10 - 6) * 0x200)
+ hit |= 0x2000;
return hit;
}
@@ -380,11 +386,11 @@
int JudgeHitMyCharVectRight(int x, int y)
{
int hit = 0;
- if (gMC.x - gMC.hit.right < (4 * (2 * x + 1) - 1) << 10
- && gMC.x + gMC.hit.right > (4 * (2 * x - 1) + 1) << 10
- && gMC.y - gMC.hit.top < (4 * (2 * y + 1) - 1) << 10
- && gMC.y + gMC.hit.bottom > (4 * (2 * y - 1) + 1) << 10)
- hit = 0x4000;
+ if (gMC.x - gMC.hit.right < (x * 0x10 + 6) * 0x200
+ && gMC.x + gMC.hit.right > (x * 0x10 - 6) * 0x200
+ && gMC.y - gMC.hit.top < (y * 0x10 + 6) * 0x200
+ && gMC.y + gMC.hit.bottom > (y * 0x10 - 6) * 0x200)
+ hit |= 0x4000;
return hit;
}
@@ -392,11 +398,11 @@
int JudgeHitMyCharVectDown(int x, int y)
{
int hit = 0;
- if (gMC.x - gMC.hit.right < (4 * (2 * x + 1) - 1) << 10
- && gMC.x + gMC.hit.right > (4 * (2 * x - 1) + 1) << 10
- && gMC.y - gMC.hit.top < (4 * (2 * y + 1) - 1) << 10
- && gMC.y + gMC.hit.bottom > (4 * (2 * y - 1) + 1) << 10)
- hit = 0x8000;
+ if (gMC.x - gMC.hit.right < (x * 0x10 + 6) * 0x200
+ && gMC.x + gMC.hit.right > (x * 0x10 - 6) * 0x200
+ && gMC.y - gMC.hit.top < (y * 0x10 + 6) * 0x200
+ && gMC.y + gMC.hit.bottom > (y * 0x10 - 6) * 0x200)
+ hit |= 0x8000;
return hit;
}
@@ -403,32 +409,31 @@
void HitMyCharMap()
{
- int x = gMC.x / 0x2000;
- int y = gMC.y / 0x2000;
+ int i;
- int offy[4];
+ int x = gMC.x / 0x10 / 0x200;
+ int y = gMC.y / 0x10 / 0x200;
+
int offx[4];
+ int offy[4];
+
offx[0] = 0;
offx[1] = 1;
offx[2] = 0;
offx[3] = 1;
+
offy[0] = 0;
offy[1] = 0;
offy[2] = 1;
offy[3] = 1;
- uint8_t atrb[4];
- for (int i = 0; i < 4; i++)
+ unsigned char atrb[4];
+ for (i = 0; i < 4; i++)
{
atrb[i] = GetAttribute(x + offx[i], y + offy[i]);
switch (atrb[i])
{
- // Water
- case 0x02:
- gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
- break;
-
// Block
case 0x05:
case 0x41:
@@ -437,11 +442,6 @@
gMC.flag |= JudgeHitMyCharBlock(x + offx[i], y + offy[i]);
break;
- // Spikes
- case 0x42:
- gMC.flag |= JudgeHitMyCharDamage(x + offx[i], y + offy[i]);
- break;
-
// Slopes
case 0x50:
gMC.flag |= JudgeHitMyCharTriangleA(x + offx[i], y + offy[i]);
@@ -475,6 +475,38 @@
gMC.flag |= JudgeHitMyCharTriangleH(x + offx[i], y + offy[i]);
break;
+ // Spikes
+ case 0x42:
+ gMC.flag |= JudgeHitMyCharDamage(x + offx[i], y + offy[i]);
+ break;
+
+ // Water spikes
+ case 0x62:
+ gMC.flag |= JudgeHitMyCharDamageW(x + offx[i], y + offy[i]);
+ break;
+
+ // Wind
+ case 0x80:
+ gMC.flag |= JudgeHitMyCharVectLeft(x + offx[i], y + offy[i]);
+ break;
+
+ case 0x81:
+ gMC.flag |= JudgeHitMyCharVectUp(x + offx[i], y + offy[i]);
+ break;
+
+ case 0x82:
+ gMC.flag |= JudgeHitMyCharVectRight(x + offx[i], y + offy[i]);
+ break;
+
+ case 0x83:
+ gMC.flag |= JudgeHitMyCharVectDown(x + offx[i], y + offy[i]);
+ break;
+
+ // Water
+ case 0x02:
+ gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
+ break;
+
// Water and water blocks
case 0x60:
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
@@ -485,11 +517,6 @@
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
break;
- // Water spikes
- case 0x62:
- gMC.flag |= JudgeHitMyCharDamageW(x + offx[i], y + offy[i]);
- break;
-
// Water slopes
case 0x70:
gMC.flag |= JudgeHitMyCharTriangleA(x + offx[i], y + offy[i]);
@@ -531,23 +558,6 @@
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
break;
- // Wind
- case 0x80:
- gMC.flag |= JudgeHitMyCharVectLeft(x + offx[i], y + offy[i]);
- break;
-
- case 0x81:
- gMC.flag |= JudgeHitMyCharVectUp(x + offx[i], y + offy[i]);
- break;
-
- case 0x82:
- gMC.flag |= JudgeHitMyCharVectRight(x + offx[i], y + offy[i]);
- break;
-
- case 0x83:
- gMC.flag |= JudgeHitMyCharVectDown(x + offx[i], y + offy[i]);
- break;
-
// Water current
case 0xA0:
gMC.flag |= JudgeHitMyCharVectLeft(x + offx[i], y + offy[i]);
@@ -568,9 +578,6 @@
gMC.flag |= JudgeHitMyCharVectDown(x + offx[i], y + offy[i]);
gMC.flag |= JudgeHitMyCharWater(x + offx[i], y + offy[i]);
break;
-
- default:
- break;
}
}
@@ -633,12 +640,12 @@
return hit;
}
-int JudgeHitMyCharNPC3(NPCHAR *npc)
+unsigned char JudgeHitMyCharNPC3(NPCHAR *npc)
{
- if (npc->direct)
+ if (npc->direct == 0)
{
- if (gMC.x + 0x400 > npc->x - npc->hit.back
- && gMC.x - 0x400 < npc->x + npc->hit.front
+ if (gMC.x + 0x400 > npc->x - npc->hit.front
+ && gMC.x - 0x400 < npc->x + npc->hit.back
&& gMC.y + 0x400 > npc->y - npc->hit.top
&& gMC.y - 0x400 < npc->y + npc->hit.bottom)
return 1;
@@ -645,8 +652,8 @@
}
else
{
- if (gMC.x + 0x400 > npc->x - npc->hit.front
- && gMC.x - 0x400 < npc->x + npc->hit.back
+ if (gMC.x + 0x400 > npc->x - npc->hit.back
+ && gMC.x - 0x400 < npc->x + npc->hit.front
&& gMC.y + 0x400 > npc->y - npc->hit.top
&& gMC.y - 0x400 < npc->y + npc->hit.bottom)
return 1;
@@ -658,32 +665,78 @@
int JudgeHitMyCharNPC4(NPCHAR *npc)
{
// TODO: comment this
+ float fx1;
+ float fx2;
+ float fy1;
+ float fy2;
+
int hit = 0;
- long double v1, v2;
- if (npc->x <= gMC.x)
- v1 = (long double)(gMC.x - npc->x);
+ if (npc->x > gMC.x)
+ fx1 = (float)(npc->x - gMC.x);
else
- v1 = (long double)(npc->x - gMC.x);
+ fx1 = (float)(gMC.x - npc->x);
- float fx1 = (float)v1;
-
- if (npc->y <= gMC.y)
- v2 = (long double)(gMC.y - npc->y);
+ if (npc->y > gMC.y)
+ fy1 = (float)(npc->y - gMC.y);
else
- v2 = (long double)(npc->y - gMC.y);
+ fy1 = (float)(gMC.y - npc->y);
- float fx2 = (float)npc->hit.back;
- if (0.0 == fx1)
- fx1 = 1.0;
- if (0.0 == fx2)
- fx2 = 1.0;
+ fx2 = (float)npc->hit.back;
+ fy2 = (float)npc->hit.top;
- float fy1 = (float)v2;
- float fy2 = (float)npc->hit.top;
+ if (fx1 == 0.0f)
+ fx1 = 1.0f;
+ if (fx2 == 0.0f)
+ fx2 = 1.0f;
- if (fy1 / fx1 <= fy2 / fx2)
+ if (fy1 / fx1 > fy2 / fx2)
{
+ if (gMC.x - gMC.hit.right < npc->x + npc->hit.back && gMC.x + gMC.hit.right > npc->x - npc->hit.back)
+ {
+ if (gMC.y - gMC.hit.top < npc->y + npc->hit.bottom && gMC.y - gMC.hit.top > npc->y)
+ {
+ if (gMC.ym < npc->ym)
+ {
+ gMC.y = npc->hit.bottom + npc->y + gMC.hit.top + 0x200;
+ gMC.ym = npc->ym;
+ }
+ else
+ {
+ if (gMC.ym < 0)
+ gMC.ym = 0;
+ }
+
+ hit |= 2;
+ }
+
+ if (gMC.y + gMC.hit.bottom > npc->y - npc->hit.top && gMC.hit.bottom + gMC.y < npc->y + 0x600)
+ {
+ if (gMC.ym - npc->ym > 0x400)
+ PlaySoundObject(23, 1);
+
+ if (gMC.unit == 1)
+ {
+ gMC.y = npc->y - npc->hit.top - gMC.hit.bottom + 0x200;
+ hit |= 8;
+ }
+ else if (npc->bits & npc_bouncy)
+ {
+ gMC.ym = npc->ym - 0x200;
+ hit |= 8;
+ }
+ else if (!(gMC.flag & 8) && gMC.ym > npc->ym)
+ {
+ gMC.y = npc->y - npc->hit.top - gMC.hit.bottom + 0x200;
+ gMC.ym = npc->ym;
+ gMC.x += npc->xm;
+ hit |= 8;
+ }
+ }
+ }
+ }
+ else
+ {
if (gMC.y - gMC.hit.top < npc->y + npc->hit.bottom && gMC.y + gMC.hit.bottom > npc->y - npc->hit.top)
{
if (gMC.x - gMC.hit.right < npc->x + npc->hit.back && gMC.x - gMC.hit.right > npc->x)
@@ -690,7 +743,9 @@
{
if (gMC.xm < npc->xm)
gMC.xm = npc->xm;
+
gMC.x = npc->hit.back + npc->x + gMC.hit.right;
+
hit |= 1;
}
@@ -698,196 +753,163 @@
{
if (gMC.xm > npc->xm)
gMC.xm = npc->xm;
+
gMC.x = npc->x - npc->hit.back - gMC.hit.right;
+
hit |= 4;
}
}
}
- else if (gMC.x - gMC.hit.right < npc->x + npc->hit.back && gMC.x + gMC.hit.right > npc->x - npc->hit.back)
- {
- if (gMC.y - gMC.hit.top < npc->y + npc->hit.bottom && gMC.y - gMC.hit.top > npc->y)
- {
- if (gMC.ym >= npc->ym)
- {
- if (gMC.ym < 0)
- gMC.ym = 0;
- }
- else
- {
- gMC.y = npc->hit.bottom + npc->y + gMC.hit.top + 0x200;
- gMC.ym = npc->ym;
- }
- hit |= 2;
- }
-
- if (gMC.y + gMC.hit.bottom > npc->y - npc->hit.top && gMC.hit.bottom + gMC.y < npc->y + 0x600)
- {
- if (gMC.ym - npc->ym > 0x400)
- PlaySoundObject(23, 1);
-
- if (gMC.unit == 1)
- {
- gMC.y = npc->y - npc->hit.top - gMC.hit.bottom + 0x200;
- hit |= 8;
- }
- else if (npc->bits & npc_bouncy)
- {
- gMC.ym = npc->ym - 0x200;
- hit |= 8;
- }
- else if (!(gMC.flag & 8) && gMC.ym > npc->ym)
- {
- gMC.y = npc->y - npc->hit.top - gMC.hit.bottom + 0x200;
- gMC.ym = npc->ym;
- gMC.x += npc->xm;
- hit |= 8;
- }
- }
- }
-
return hit;
}
void HitMyCharNpChar()
{
- if ((gMC.cond & 0x80) && !(gMC.cond & 2))
+ int i;
+
+ int hit = 0;
+
+ if ((gMC.cond & 0x80) == 0 || (gMC.cond & 2))
+ return;
+
+ for (i = 0; i < NPC_MAX; i++)
{
- int hit;
+ if ((gNPC[i].cond & 0x80) == 0)
+ continue;
- for (int i = 0; i < NPC_MAX; i++)
+ hit = 0;
+
+ if (gNPC[i].bits & npc_solidSoft)
{
- if (gNPC[i].cond & 0x80)
- {
- if (gNPC[i].bits & npc_solidSoft)
- {
- hit = JudgeHitMyCharNPC(&gNPC[i]);
- gMC.flag |= hit;
- }
- else if (gNPC[i].bits & npc_solidHard)
- {
- hit = JudgeHitMyCharNPC4(&gNPC[i]);
- gMC.flag |= hit;
- }
- else
- {
- hit = JudgeHitMyCharNPC3(&gNPC[i]);
- }
+ hit = JudgeHitMyCharNPC(&gNPC[i]);
+ gMC.flag |= hit;
+ }
+ else if (gNPC[i].bits & npc_solidHard)
+ {
+ hit = JudgeHitMyCharNPC4(&gNPC[i]);
+ gMC.flag |= hit;
+ }
+ else
+ {
+ hit = JudgeHitMyCharNPC3(&gNPC[i]);
+ }
- // Special NPCs (pickups)
- if (hit && gNPC[i].code_char == 1)
- {
- PlaySoundObject(14, 1);
- AddExpMyChar(gNPC[i].exp);
- gNPC[i].cond = 0;
- }
+ // Special NPCs (pickups)
+ if (hit && gNPC[i].code_char == 1)
+ {
+ PlaySoundObject(14, 1);
+ AddExpMyChar(gNPC[i].exp);
+ gNPC[i].cond = 0;
+ }
- if (hit && gNPC[i].code_char == 86)
- {
- PlaySoundObject(42, 1);
- AddBulletMyChar(gNPC[i].code_event, gNPC[i].exp);
- gNPC[i].cond = 0;
- }
+ if (hit && gNPC[i].code_char == 86)
+ {
+ PlaySoundObject(42, 1);
+ AddBulletMyChar(gNPC[i].code_event, gNPC[i].exp);
+ gNPC[i].cond = 0;
+ }
- if (hit && gNPC[i].code_char == 87)
- {
- PlaySoundObject(20, 1);
- AddLifeMyChar(gNPC[i].exp);
- gNPC[i].cond = 0;
- }
+ if (hit && gNPC[i].code_char == 87)
+ {
+ PlaySoundObject(20, 1);
+ AddLifeMyChar(gNPC[i].exp);
+ gNPC[i].cond = 0;
+ }
- // Run event on contact
- if (!(g_GameFlags & 4) && hit && gNPC[i].bits & npc_eventTouch)
- StartTextScript(gNPC[i].code_event);
+ // Run event on contact
+ if ((g_GameFlags & 4) == 0 && hit && gNPC[i].bits & npc_eventTouch)
+ StartTextScript(gNPC[i].code_event);
- // NPC damage
- if (g_GameFlags & 2 && !(gNPC[i].bits & npc_interact))
- {
- if (gNPC[i].bits & npc_rearTop)
- {
- if (hit & 4 && gNPC[i].xm < 0)
- DamageMyChar(gNPC[i].damage);
- if (hit & 1 && gNPC[i].xm > 0)
- DamageMyChar(gNPC[i].damage);
- if (hit & 8 && gNPC[i].ym < 0)
- DamageMyChar(gNPC[i].damage);
- if (hit & 2 && gNPC[i].ym > 0)
- DamageMyChar(gNPC[i].damage);
- }
- else if (hit && gNPC[i].damage && !(g_GameFlags & 4))
- {
- DamageMyChar(gNPC[i].damage);
- }
- }
-
- // Interaction
- if (!(g_GameFlags & 4) && hit && gMC.cond & 1 && gNPC[i].bits & npc_interact)
- {
- StartTextScript(gNPC[i].code_event);
- gMC.xm = 0;
- gMC.ques = 0;
- }
+ // NPC damage
+ if (g_GameFlags & 2 && (gNPC[i].bits & npc_interact) == 0)
+ {
+ if (gNPC[i].bits & npc_rearTop)
+ {
+ if (hit & 4 && gNPC[i].xm < 0)
+ DamageMyChar(gNPC[i].damage);
+ if (hit & 1 && gNPC[i].xm > 0)
+ DamageMyChar(gNPC[i].damage);
+ if (hit & 8 && gNPC[i].ym < 0)
+ DamageMyChar(gNPC[i].damage);
+ if (hit & 2 && gNPC[i].ym > 0)
+ DamageMyChar(gNPC[i].damage);
}
+ else if (hit && gNPC[i].damage && !(g_GameFlags & 4))
+ {
+ DamageMyChar(gNPC[i].damage);
+ }
}
- // Create question mark when NPC hasn't been interacted with
- if (gMC.ques)
- SetCaret(gMC.x, gMC.y, 9, 0);
+ // Interaction
+ if ((g_GameFlags & 4) == 0 && hit && gMC.cond & 1 && gNPC[i].bits & npc_interact)
+ {
+ StartTextScript(gNPC[i].code_event);
+ gMC.xm = 0;
+ gMC.ques = 0;
+ }
}
+
+ // Create question mark when NPC hasn't been interacted with
+ if (gMC.ques)
+ SetCaret(gMC.x, gMC.y, 9, 0);
}
void HitMyCharBoss()
{
- if ((gMC.cond & 0x80) && !(gMC.cond & 2))
+ int hit = 0;
+
+ if ((gMC.cond & 0x80) == 0 || (gMC.cond & 2))
+ return;
+
+ for (int b = 0; b < BOSS_MAX; b++)
{
- for (int b = 0; b < BOSS_MAX; b++)
- {
- if (gBoss[b].cond & 0x80)
- {
- int hit;
- if (gBoss[b].bits & npc_solidSoft)
- {
- hit = JudgeHitMyCharNPC(&gBoss[b]);
- gMC.flag |= hit;
- }
- else if (gBoss[b].bits & npc_solidHard)
- {
- hit = JudgeHitMyCharNPC4(&gBoss[b]);
- gMC.flag |= hit;
- }
- else
- {
- hit = JudgeHitMyCharNPC3(&gBoss[b]);
- }
+ if ((gBoss[b].cond & 0x80) == 0)
+ continue;
- if (!(g_GameFlags & 4) && hit && gBoss[b].bits & npc_eventTouch)
- {
- StartTextScript(gBoss[b].code_event);
- gMC.ques = 0;
- }
+ hit = 0;
- if (gBoss[b].bits & npc_rearTop)
- {
- if (hit & 4 && gBoss[b].xm < 0)
- DamageMyChar(gBoss[b].damage);
- if (hit & 1 && gBoss[b].xm > 0)
- DamageMyChar(gBoss[b].damage);
- }
- else if (hit && gBoss[b].damage && !(g_GameFlags & 4))
- {
- DamageMyChar(gBoss[b].damage);
- }
+ if (gBoss[b].bits & npc_solidSoft)
+ {
+ hit = JudgeHitMyCharNPC(&gBoss[b]);
+ gMC.flag |= hit;
+ }
+ else if (gBoss[b].bits & npc_solidHard)
+ {
+ hit = JudgeHitMyCharNPC4(&gBoss[b]);
+ gMC.flag |= hit;
+ }
+ else
+ {
+ hit = JudgeHitMyCharNPC3(&gBoss[b]);
+ }
- if (!(g_GameFlags & 4) && hit && (gMC.cond & 1) && gBoss[b].bits & npc_interact)
- {
- StartTextScript(gBoss[b].code_event);
- gMC.xm = 0;
- gMC.ques = 0;
- }
- }
+ if (!(g_GameFlags & 4) && hit && gBoss[b].bits & npc_eventTouch)
+ {
+ StartTextScript(gBoss[b].code_event);
+ gMC.ques = 0;
}
- if (gMC.ques)
- SetCaret(gMC.x, gMC.y, 9, 0);
+ if (gBoss[b].bits & npc_rearTop)
+ {
+ if (hit & 4 && gBoss[b].xm < 0)
+ DamageMyChar(gBoss[b].damage);
+ if (hit & 1 && gBoss[b].xm > 0)
+ DamageMyChar(gBoss[b].damage);
+ }
+ else if (hit && gBoss[b].damage && !(g_GameFlags & 4))
+ {
+ DamageMyChar(gBoss[b].damage);
+ }
+
+ if (!(g_GameFlags & 4) && hit && (gMC.cond & 1) && gBoss[b].bits & npc_interact)
+ {
+ StartTextScript(gBoss[b].code_event);
+ gMC.xm = 0;
+ gMC.ques = 0;
+ }
}
+
+ if (gMC.ques)
+ SetCaret(gMC.x, gMC.y, 9, 0);
}
--- a/src/MycParam.h
+++ b/src/MycParam.h
@@ -1,7 +1,5 @@
#pragma once
-#include <stdint.h>
-
#include "WindowsWrapper.h"
struct ARMS_LEVEL
@@ -11,8 +9,8 @@
struct REC
{
- int32_t counter[4];
- uint8_t random[4];
+ long counter[4];
+ unsigned char random[4];
};
extern ARMS_LEVEL gArmsLevelTable[14];
--- a/src/NpChar.cpp
+++ b/src/NpChar.cpp
@@ -1,7 +1,6 @@
#include "NpChar.h"
#include <stddef.h>
-#include <stdint.h>
#include <stdio.h>
#include <string.h>
@@ -27,7 +26,7 @@
int gSuperXpos;
int gSuperYpos;
-const char *gPassPixEve = "PXE\0";
+const char *gPassPixEve = "PXE";
void InitNpChar()
{
@@ -55,10 +54,16 @@
BOOL LoadEvent(const char *path_event)
{
+ FILE *fp;
+ int count;
+ int i;
+ int n;
+ EVENT eve;
+
char path[PATH_LENGTH];
sprintf(path, "%s/%s", gDataPath, path_event);
- FILE *fp = fopen(path, "rb");
+ fp = fopen(path, "rb");
if (fp == NULL)
return FALSE;
@@ -75,16 +80,22 @@
}
//Get amount of NPCs
- int count = File_ReadLE32(fp);
+#ifdef NONPORTABLE
+ fread(&count, 4, 1, fp);
+#else
+ count = File_ReadLE32(fp);
+#endif
//Load NPCs
memset(gNPC, 0, sizeof(gNPC));
- int n = 170;
- for (int i = 0; i < count; i++)
+ n = 170;
+ for (i = 0; i < count; i++)
{
//Get data from file
- EVENT eve;
+#ifdef NONPORTABLE
+ fread(&eve, sizeof(EVENT), 1, fp);
+#else
eve.x = File_ReadLE16(fp);
eve.y = File_ReadLE16(fp);
eve.code_flag = File_ReadLE16(fp);
@@ -91,17 +102,15 @@
eve.code_event = File_ReadLE16(fp);
eve.code_char = File_ReadLE16(fp);
eve.bits = File_ReadLE16(fp);
+#endif
//Set NPC parameters
- if (eve.bits & npc_altDir)
- gNPC[n].direct = 2;
- else
- gNPC[n].direct = 0;
+ gNPC[n].direct = (eve.bits & npc_altDir) ? 2 : 0;
gNPC[n].code_char = eve.code_char;
gNPC[n].code_event = eve.code_event;
gNPC[n].code_flag = eve.code_flag;
- gNPC[n].x = eve.x << 13;
- gNPC[n].y = eve.y << 13;
+ gNPC[n].x = eve.x * 0x10 * 0x200;
+ gNPC[n].y = eve.y * 0x10 * 0x200;
gNPC[n].bits = eve.bits;
gNPC[n].bits |= gNpcTable[gNPC[n].code_char].bits;
gNPC[n].exp = gNpcTable[gNPC[n].code_char].exp;
@@ -110,13 +119,13 @@
//Check flags
if (gNPC[n].bits & npc_appearSet)
{
- if (GetNPCFlag(gNPC[n].code_flag))
- gNPC[n].cond |= 0x80u;
+ if (GetNPCFlag(gNPC[n].code_flag) == TRUE)
+ gNPC[n].cond |= 0x80;
}
else if (gNPC[n].bits & npc_hideSet)
{
- if (!GetNPCFlag(gNPC[n].code_flag))
- gNPC[n].cond |= 0x80u;
+ if (GetNPCFlag(gNPC[n].code_flag) == FALSE)
+ gNPC[n].cond |= 0x80;
}
else
{
@@ -133,37 +142,37 @@
void SetNpChar(int code_char, int x, int y, int xm, int ym, int dir, NPCHAR *npc, int start_index)
{
- for (int n = start_index; n < NPC_MAX; n++)
- {
- if (!gNPC[n].cond)
- {
- //Set NPC parameters
- memset(&gNPC[n], 0, sizeof(NPCHAR));
- gNPC[n].cond |= 0x80u;
- gNPC[n].direct = dir;
- gNPC[n].code_char = code_char;
- gNPC[n].x = x;
- gNPC[n].y = y;
- gNPC[n].xm = xm;
- gNPC[n].ym = ym;
- gNPC[n].pNpc = npc;
- gNPC[n].bits = gNpcTable[gNPC[n].code_char].bits;
- gNPC[n].exp = gNpcTable[gNPC[n].code_char].exp;
- SetUniqueParameter(&gNPC[n]);
- break;
- }
- }
+ int n = start_index;
+ while (n < NPC_MAX && gNPC[n].cond)
+ ++n;
+
+ if (n == NPC_MAX)
+ return;
+
+ //Set NPC parameters
+ memset(&gNPC[n], 0, sizeof(NPCHAR));
+ gNPC[n].cond |= 0x80u;
+ gNPC[n].direct = dir;
+ gNPC[n].code_char = code_char;
+ gNPC[n].x = x;
+ gNPC[n].y = y;
+ gNPC[n].xm = xm;
+ gNPC[n].ym = ym;
+ gNPC[n].pNpc = npc;
+ gNPC[n].bits = gNpcTable[gNPC[n].code_char].bits;
+ gNPC[n].exp = gNpcTable[gNPC[n].code_char].exp;
+ SetUniqueParameter(&gNPC[n]);
}
void SetDestroyNpChar(int x, int y, int w, int num)
{
//Create smoke
- int wa = w / 0x200;
+ w /= 0x200;
for (int i = 0; i < num; i++)
{
- int offset_x = Random(-wa, wa) << 9;
- int offset_y = Random(-wa, wa) << 9;
- SetNpChar(4, x + offset_x, offset_y + y, 0, 0, 0, NULL, 0x100);
+ int offset_x = Random(-w, w) * 0x200;
+ int offset_y = Random(-w, w) * 0x200;
+ SetNpChar(4, x + offset_x, y + offset_y, 0, 0, 0, NULL, 0x100);
}
//Flash effect
@@ -173,12 +182,12 @@
void SetDestroyNpCharUp(int x, int y, int w, int num)
{
//Create smoke
- int wa = w / 0x200;
+ w /= 0x200;
for (int i = 0; i < num; i++)
{
- int offset_x = Random(-wa, wa) << 9;
- int offset_y = Random(-wa, wa) << 9;
- SetNpChar(4, x + offset_x, offset_y + y, 0, 0, 1, NULL, 0x100);
+ int offset_x = Random(-w, w) * 0x200;
+ int offset_y = Random(-w, w) * 0x200;
+ SetNpChar(4, x + offset_x, y + offset_y, 0, 0, 1, NULL, 0x100);
}
//Flash effect
@@ -188,15 +197,11 @@
void SetExpObjects(int x, int y, int exp)
{
int sub_exp;
- for (int n = 0x100; exp; SetUniqueParameter(&gNPC[n]))
+ int n = 0x100;
+ while (exp)
{
- while (true)
- {
- bool v3 = n < NPC_MAX && gNPC[n].cond;
- if (!v3)
- break;
+ while (n < NPC_MAX && gNPC[n].cond)
++n;
- }
if (n == NPC_MAX)
break;
@@ -203,29 +208,23 @@
memset(&gNPC[n], 0, sizeof(NPCHAR));
- if (exp < 20)
+ if (exp >= 20)
{
- if (exp < 5)
- {
- if (exp > 0)
- {
- --exp;
- sub_exp = 1;
- }
- }
- else
- {
- exp -= 5;
- sub_exp = 5;
- }
- }
- else
- {
exp -= 20;
sub_exp = 20;
}
+ else if (exp >= 5)
+ {
+ exp -= 5;
+ sub_exp = 5;
+ }
+ else if (exp >= 1)
+ {
+ exp -= 1;
+ sub_exp = 1;
+ }
- gNPC[n].cond |= 0x80u;
+ gNPC[n].cond |= 0x80;
gNPC[n].direct = 0;
gNPC[n].code_char = 1;
gNPC[n].x = x;
@@ -232,73 +231,79 @@
gNPC[n].y = y;
gNPC[n].bits = gNpcTable[gNPC[n].code_char].bits;
gNPC[n].exp = sub_exp;
+
+ SetUniqueParameter(&gNPC[n]);
}
}
BOOL SetBulletObject(int x, int y, int val)
{
+ int t = 0;
+ int bullet_no;
int tamakazu_ari[10];
-
int n;
- int t = 0;
+
memset(tamakazu_ari, 0, sizeof(tamakazu_ari));
- for (n = 0; n < 8; n++)
+ for (n = 0; n < 8; ++n)
{
- int code = gArmsData[n].code;
- if (code == 5)
- tamakazu_ari[t++] = 0;
- else if (code == 10)
- tamakazu_ari[t++] = 1;
- else
- tamakazu_ari[t] = 0;
+ switch (gArmsData[n].code)
+ {
+ case 5:
+ tamakazu_ari[t++] = 0;
+ break;
+ case 10:
+ tamakazu_ari[t++] = 1;
+ break;
+ default:
+ tamakazu_ari[t] = 0;
+ break;
+ }
}
- if (!t)
+ if (t == 0)
return FALSE;
n = Random(1, 10 * t);
- int bullet_no = tamakazu_ari[n % t];
- for (n = 0x100; n < NPC_MAX; n++)
- {
- if (!gNPC[n].cond)
- {
- memset(&gNPC[n], 0, sizeof(NPCHAR));
- gNPC[n].cond |= 0x80u;
- gNPC[n].direct = 0;
- gNPC[n].code_event = bullet_no;
- gNPC[n].code_char = 86;
- gNPC[n].x = x;
- gNPC[n].y = y;
- gNPC[n].bits = gNpcTable[gNPC[n].code_char].bits;
- gNPC[n].exp = val;
- SetUniqueParameter(&gNPC[n]);
- return TRUE;
- }
- }
+ bullet_no = tamakazu_ari[n % t];
+ n = 0x100;
+ while (n < NPC_MAX && gNPC[n].cond)
+ ++n;
- return FALSE;
+ if (n == NPC_MAX)
+ return FALSE;
+
+ memset(&gNPC[n], 0, sizeof(NPCHAR));
+ gNPC[n].cond |= 0x80;
+ gNPC[n].direct = 0;
+ gNPC[n].code_event = bullet_no;
+ gNPC[n].code_char = 86;
+ gNPC[n].x = x;
+ gNPC[n].y = y;
+ gNPC[n].bits = gNpcTable[gNPC[n].code_char].bits;
+ gNPC[n].exp = val;
+ SetUniqueParameter(&gNPC[n]);
+ return TRUE;
}
BOOL SetLifeObject(int x, int y, int val)
{
- for (int n = 0x100; n < NPC_MAX; n++)
- {
- if (!gNPC[n].cond)
- {
- memset(&gNPC[n], 0, sizeof(NPCHAR));
- gNPC[n].cond |= 0x80u;
- gNPC[n].direct = 0;
- gNPC[n].code_char = 87;
- gNPC[n].x = x;
- gNPC[n].y = y;
- gNPC[n].bits = gNpcTable[gNPC[n].code_char].bits;
- gNPC[n].exp = val;
- SetUniqueParameter(&gNPC[n]);
- return TRUE;
- }
- }
+ int n = 0x100;
+ while (n < NPC_MAX && gNPC[n].cond)
+ ++n;
- return FALSE;
+ if (n == NPC_MAX)
+ return FALSE;
+
+ memset(&gNPC[n], 0, sizeof(NPCHAR));
+ gNPC[n].cond |= 0x80;
+ gNPC[n].direct = 0;
+ gNPC[n].code_char = 87;
+ gNPC[n].x = x;
+ gNPC[n].y = y;
+ gNPC[n].bits = gNpcTable[gNPC[n].code_char].bits;
+ gNPC[n].exp = val;
+ SetUniqueParameter(&gNPC[n]);
+ return TRUE;
}
void VanishNpChar(NPCHAR *npc)
@@ -309,7 +314,7 @@
npc->count1 = 0;
npc->x = x;
npc->y = y;
- npc->cond |= 0x80u;
+ npc->cond |= 0x80;
npc->direct = 0;
npc->code_char = 3;
npc->bits = gNpcTable[npc->code_char].bits;
@@ -319,15 +324,15 @@
void PutNpChar(int fx, int fy)
{
- for (int n = 0; n < NPC_MAX; n++)
+ signed char a = 0;
+
+ for (int n = 0; n < NPC_MAX; ++n)
{
if (gNPC[n].cond & 0x80)
{
- int8_t a;
-
if (gNPC[n].shock)
{
- a = 2 * ((gNPC[n].shock >> 1) & 1) - 1;
+ a = 2 * ((gNPC[n].shock / 2) % 2) - 1;
}
else
{
@@ -340,10 +345,10 @@
}
int side;
- if (gNPC[n].direct)
- side = gNPC[n].view.back;
- else
+ if (gNPC[n].direct == 0)
side = gNPC[n].view.front;
+ else
+ side = gNPC[n].view.back;
PutBitmap3(
&grcGame,
@@ -357,12 +362,14 @@
void ActNpChar()
{
- for (int i = 0; i < NPC_MAX; i++)
+ for (int i = 0; i < NPC_MAX; ++i)
{
if (gNPC[i].cond & 0x80)
{
- gpNpcFuncTbl[gNPC[i].code_char](&gNPC[i]);
+ int code_char = gNPC[i].code_char;
+ gpNpcFuncTbl[code_char](&gNPC[i]);
+
if (gNPC[i].shock)
--gNPC[i].shock;
}
@@ -373,7 +380,7 @@
{
for (int n = 0; n < NPC_MAX; n++)
{
- if ((gNPC[n].cond & 0x80u) && gNPC[n].code_event == code_event)
+ if ((gNPC[n].cond & 0x80) && gNPC[n].code_event == code_event)
{
gNPC[n].bits &= (npc_eventTouch | npc_eventDie | 0x400 | npc_appearSet | npc_altDir | npc_interact | npc_hideSet);
gNPC[n].code_char = code_char;
@@ -380,7 +387,7 @@
gNPC[n].bits |= gNpcTable[gNPC[n].code_char].bits;
gNPC[n].exp = gNpcTable[gNPC[n].code_char].exp;
SetUniqueParameter(&gNPC[n]);
- gNPC[n].cond |= 0x80u;
+ gNPC[n].cond |= 0x80;
gNPC[n].act_no = 0;
gNPC[n].act_wait = 0;
gNPC[n].count1 = 0;
@@ -390,20 +397,21 @@
gNPC[n].xm = 0;
gNPC[n].ym = 0;
- if (dir != 5)
+ if (dir == 5)
{
- if (dir == 4)
- {
- if (gNPC[n].x >= gMC.x)
- gNPC[n].direct = 0;
- else
- gNPC[n].direct = 2;
- }
+ // Another empty case that has to exist for the same assembly to be generated
+ }
+ else if (dir == 4)
+ {
+ if (gNPC[n].x < gMC.x)
+ gNPC[n].direct = 2;
else
- {
- gNPC[n].direct = dir;
- }
+ gNPC[n].direct = 0;
}
+ else
+ {
+ gNPC[n].direct = dir;
+ }
gpNpcFuncTbl[code_char](&gNPC[n]);
}
@@ -414,15 +422,15 @@
{
for (int n = 0; n < NPC_MAX; n++)
{
- if ((gNPC[n].cond & 0x80u) != 0 && gNPC[n].code_event == code_event)
+ if ((gNPC[n].cond & 0x80) != 0 && gNPC[n].code_event == code_event)
{
- gNPC[n].bits &= (npc_eventTouch | npc_eventDie | 0x400 | npc_appearSet | npc_altDir | npc_interact | npc_hideSet);
+ gNPC[n].bits &= ~(npc_showDamage | npc_rearTop | npc_solidHard | npc_shootable | npc_bouncy | npc_ignoreSolid | npc_invulnerable | npc_ignore44 | npc_solidSoft);
gNPC[n].bits |= npc_interact;
gNPC[n].code_char = code_char;
gNPC[n].bits |= gNpcTable[gNPC[n].code_char].bits;
gNPC[n].exp = gNpcTable[gNPC[n].code_char].exp;
SetUniqueParameter(&gNPC[n]);
- gNPC[n].cond |= 0x80u;
+ gNPC[n].cond |= 0x80;
gNPC[n].act_no = 0;
gNPC[n].act_wait = 0;
gNPC[n].count1 = 0;
@@ -432,20 +440,21 @@
gNPC[n].xm = 0;
gNPC[n].ym = 0;
- if (dir != 5)
+ if (dir == 5)
{
- if (dir == 4)
- {
- if (gNPC[n].x >= gMC.x)
- gNPC[n].direct = 0;
- else
- gNPC[n].direct = 2;
- }
+ // Another empty case that has to exist for the same assembly to be generated
+ }
+ else if (dir == 4)
+ {
+ if (gNPC[n].x < gMC.x)
+ gNPC[n].direct = 2;
else
- {
- gNPC[n].direct = dir;
- }
+ gNPC[n].direct = 0;
}
+ else
+ {
+ gNPC[n].direct = (signed char)dir;
+ }
gpNpcFuncTbl[code_char](&gNPC[n]);
}
@@ -454,96 +463,112 @@
void SetNpCharActionNo(int code_event, int act_no, int dir)
{
- for (int n = 0; n < NPC_MAX; n++)
+ int n = 0;
+ while (n < NPC_MAX)
{
if ((gNPC[n].cond & 0x80) && gNPC[n].code_event == code_event)
- {
- gNPC[n].act_no = act_no;
-
- if (dir != 5)
- {
- if (dir == 4)
- {
- if (gNPC[n].x >= gMC.x)
- gNPC[n].direct = 0;
- else
- gNPC[n].direct = 2;
- }
- else
- {
- gNPC[n].direct = dir;
- }
- }
break;
- }
+
+ ++n;
}
+
+ if (n == NPC_MAX)
+ return;
+
+ gNPC[n].act_no = act_no;
+
+ if (dir == 5)
+ {
+ // Another empty case that has to exist for the same assembly to be generated
+ }
+ else if (dir == 4)
+ {
+ if (gNPC[n].x < gMC.x)
+ gNPC[n].direct = 2;
+ else
+ gNPC[n].direct = 0;
+ }
+ else
+ {
+ gNPC[n].direct = dir;
+ }
}
void MoveNpChar(int code_event, int x, int y, int dir)
{
- for (int n = 0; n < NPC_MAX; n++)
+ int n = 0;
+ while (n < NPC_MAX)
{
if ((gNPC[n].cond & 0x80) && gNPC[n].code_event == code_event)
- {
- gNPC[n].x = x;
- gNPC[n].y = y;
-
- if (dir != 5)
- {
- if (dir == 4)
- {
- if (gNPC[n].x >= gMC.x)
- gNPC[n].direct = 0;
- else
- gNPC[n].direct = 2;
- }
- else
- {
- gNPC[n].direct = dir;
- }
- }
break;
- }
+
+ ++n;
}
+
+ if (n == NPC_MAX)
+ return;
+
+ gNPC[n].x = x;
+ gNPC[n].y = y;
+
+ if (dir == 5)
+ {
+ // Another empty case that has to exist for the same assembly to be generated
+ }
+ else if (dir == 4)
+ {
+ if (gNPC[n].x < gMC.x)
+ gNPC[n].direct = 2;
+ else
+ gNPC[n].direct = 0;
+ }
+ else
+ {
+ gNPC[n].direct = (signed char)dir;
+ }
}
void BackStepMyChar(int code_event)
{
+ int n = 0;
+
gMC.cond &= ~1;
gMC.ym = -0x200;
- if (code_event)
+ if (code_event == 0)
{
- if (code_event == 2)
+ gMC.direct = 0;
+ gMC.xm = 0x200;
+ }
+ else if (code_event == 2)
+ {
+ gMC.direct = 2;
+ gMC.xm = -0x200;
+ }
+ else
+ {
+ while (n < NPC_MAX)
{
- gMC.direct = 2;
- gMC.xm = -0x200;
+ if ((gNPC[n].cond & 0x80) && gNPC[n].code_event == code_event)
+ break;
+
+ ++n;
}
+
+ if (n == NPC_MAX)
+ return;
+
+ if (gNPC[n].x < gMC.x)
+ {
+ gMC.direct = 0;
+ gMC.xm = 0x200;
+ }
else
{
- for (int n = 0; n < NPC_MAX; n++)
- {
- if ((gNPC[n].cond & 0x80) && gNPC[n].code_event == code_event)
- {
- if (gNPC[n].x >= gMC.x)
- {
- gMC.direct = 2;
- gMC.xm = -0x200;
- }
- else
- {
- gMC.direct = 0;
- gMC.xm = 0x200;
- }
- }
- }
+ gMC.direct = 2;
+ gMC.xm = -0x200;
}
}
- else
- {
- gMC.direct = 0;
- gMC.xm = 0x200;
- }
}
void DeleteNpCharEvent(int code)
@@ -558,7 +583,7 @@
}
}
-void DeleteNpCharCode(int code, bool bSmoke)
+void DeleteNpCharCode(int code, BOOL bSmoke)
{
for (int n = 0; n < NPC_MAX; n++)
{
@@ -573,6 +598,9 @@
switch (gNPC[n].size)
{
+ case 1:
+ SetDestroyNpChar(gNPC[n].x, gNPC[n].y, gNPC[n].view.back, 4);
+ break;
case 2:
SetDestroyNpChar(gNPC[n].x, gNPC[n].y, gNPC[n].view.back, 8);
break;
@@ -579,9 +607,6 @@
case 3:
SetDestroyNpChar(gNPC[n].x, gNPC[n].y, gNPC[n].view.back, 16);
break;
- case 1:
- SetDestroyNpChar(gNPC[n].x, gNPC[n].y, gNPC[n].view.back, 4);
- break;
}
}
}
@@ -590,17 +615,15 @@
void GetNpCharPosition(int *x, int *y, int i)
{
- *x = gNPC[i].x;
- *y = gNPC[i].y;
+ *x = gNPC[i].x;
+ *y = gNPC[i].y;
}
BOOL IsNpCharCode(int code)
{
- for (int i = 0; i < NPC_MAX; i++)
- {
+ for (int i = 0; i < NPC_MAX; ++i)
if ((gNPC[i].cond & 0x80) && gNPC[i].code_char == code)
return TRUE;
- }
return FALSE;
}
@@ -607,13 +630,15 @@
BOOL GetNpCharAlive(int code_event)
{
- for (int i = 0; i < NPC_MAX; i++)
- {
+ int i;
+ for (i = 0; i < NPC_MAX; ++i)
if ((gNPC[i].cond & 0x80) && gNPC[i].code_event == code_event)
- return TRUE;
- }
+ break;
- return FALSE;
+ if (i < NPC_MAX)
+ return TRUE;
+ else
+ return FALSE;
}
int CountAliveNpChar()
--- a/src/NpChar.h
+++ b/src/NpChar.h
@@ -1,7 +1,5 @@
#pragma once
-#include <stdint.h>
-
#include "WindowsWrapper.h"
#include "Draw.h"
@@ -29,7 +27,7 @@
struct NPCHAR
{
- uint8_t cond;
+ unsigned char cond;
int flag;
int x;
int y;
@@ -49,7 +47,7 @@
int exp;
int size;
int direct;
- uint16_t bits;
+ unsigned short bits;
RECT rect;
int ani_wait;
int ani_no;
@@ -59,7 +57,7 @@
int act_wait;
RECT hit;
RECT view;
- uint8_t shock;
+ unsigned char shock;
int damage_view;
int damage;
NPCHAR *pNpc;
@@ -67,12 +65,12 @@
struct EVENT
{
- int16_t x;
- int16_t y;
- int16_t code_flag;
- int16_t code_event;
- int16_t code_char;
- uint16_t bits;
+ short x;
+ short y;
+ short code_flag;
+ short code_event;
+ short code_char;
+ unsigned short bits;
};
extern NPCHAR gNPC[NPC_MAX];
@@ -99,7 +97,7 @@
void MoveNpChar(int code_event, int x, int y, int dir);
void BackStepMyChar(int code_event);
void DeleteNpCharEvent(int code);
-void DeleteNpCharCode(int code, bool bSmoke);
+void DeleteNpCharCode(int code, BOOL bSmoke);
void GetNpCharPosition(int *x, int *y, int i);
BOOL IsNpCharCode(int code);
BOOL GetNpCharAlive(int code_event);
--- a/src/NpcAct100.cpp
+++ b/src/NpcAct100.cpp
@@ -1352,8 +1352,18 @@
break;
case 3:
- // TODO: This code is being problematic, and
- // assembling with the wrong registers.
+ if (0)
+ {
+ // There used to be an if here that didn't do anything, but the compiler optimised it out.
+ // We only know this was here because empty ifs mess with the register usage.
+ // Since there's no code, we have no idea what the original condition actually was.
+ }
+
+ if (0)
+ {
+ // Another empty if
+ }
+
npc->act_no = 4;
npc->ani_no = 1;
npc->ani_wait = 0;
@@ -1382,9 +1392,15 @@
npc->ani_no = 5;
SetDestroyNpChar(npc->x, npc->y, npc->view.back, 8);
break;
- // End of wrong-reg code
case 6:
+ if (0)
+ {
+ // There used to be an if here that didn't do anything, but the compiler optimised it out.
+ // We only know this was here because empty ifs mess with the register usage.
+ // Since there's no code, we have no idea what the original condition actually was.
+ }
+
npc->ani_no = 5;
break;
--- a/src/NpcHit.cpp
+++ b/src/NpcHit.cpp
@@ -1,5 +1,7 @@
#include "NpcHit.h"
+#include "WindowsWrapper.h"
+
#include "Back.h"
#include "Bullet.h"
#include "Caret.h"
@@ -16,40 +18,40 @@
{
int hit = 0;
- if (npc->y - npc->hit.top < ((2 * y + 1) << 12) - 0x600
- && npc->y + npc->hit.bottom > ((2 * y - 1) << 12) + 0x600
- && npc->x - npc->hit.back < (2 * x + 1) << 12
- && npc->x - npc->hit.back > x << 13)
+ if (npc->y - npc->hit.top < (y * 0x10 + 5) * 0x200
+ && npc->y + npc->hit.bottom > (y * 0x10 - 5) * 0x200
+ && npc->x - npc->hit.back < (x * 0x10 + 8) * 0x200
+ && npc->x - npc->hit.back > x * 0x10 * 0x200)
{
- npc->x = ((2 * x + 1) << 12) + npc->hit.back;
+ npc->x = ((x * 0x10 + 8) * 0x200) + npc->hit.back;
hit |= 1;
}
- if (npc->y - npc->hit.top < ((2 * y + 1) << 12) - 0x600
- && npc->y + npc->hit.bottom > ((2 * y - 1) << 12) + 0x600
- && npc->hit.back + npc->x > (2 * x - 1) << 12
- && npc->hit.back + npc->x < x << 13)
+ if (npc->y - npc->hit.top < (y * 0x10 + 5) * 0x200
+ && npc->y + npc->hit.bottom > (y * 0x10 - 5) * 0x200
+ && npc->x + npc->hit.back > (x * 0x10 - 8) * 0x200
+ && npc->x + npc->hit.back < x * 0x10 * 0x200)
{
- npc->x = ((2 * x - 1) << 12) - npc->hit.back;
+ npc->x = ((x * 0x10 - 8) * 0x200) - npc->hit.back;
hit |= 4;
}
- if (npc->x - npc->hit.back < ((2 * x + 1) << 12) - 0x600
- && npc->hit.back + npc->x > ((2 * x - 1) << 12) + 0x600
- && npc->y - npc->hit.top < (2 * y + 1) << 12
- && npc->y - npc->hit.top > y << 13)
+ if (npc->x - npc->hit.back < (x * 0x10 + 5) * 0x200
+ && npc->x + npc->hit.back > (x * 0x10 - 5) * 0x200
+ && npc->y - npc->hit.top < (y * 0x10 + 8) * 0x200
+ && npc->y - npc->hit.top > y * 0x10 * 0x200)
{
- npc->y = ((2 * y + 1) << 12) + npc->hit.top;
+ npc->y = ((y * 0x10 + 8) * 0x200) + npc->hit.top;
npc->ym = 0;
hit |= 2;
}
- if (npc->x - npc->hit.back < ((2 * x + 1) << 12) - 0x600
- && npc->hit.back + npc->x > ((2 * x - 1) << 12) + 0x600
- && npc->y + npc->hit.bottom > (2 * y - 1) << 12
- && npc->y + npc->hit.bottom < y << 13)
+ if (npc->x - npc->hit.back < (x * 0x10 + 5) * 0x200
+ && npc->x + npc->hit.back > (x * 0x10 - 5) * 0x200
+ && npc->y + npc->hit.bottom > (y * 0x10 - 8) * 0x200
+ && npc->y + npc->hit.bottom < y * 0x10 * 0x200)
{
- npc->y = ((2 * y - 1) << 12) - npc->hit.bottom;
+ npc->y = ((y * 0x10 - 8) * 0x200) - npc->hit.bottom;
npc->ym = 0;
hit |= 8;
}
@@ -61,13 +63,13 @@
{
int hit = 0;
- if (npc->x < (2 * x + 1) << 12
- && npc->x > (2 * x - 1) << 12
- && npc->y - npc->hit.top < (y << 13) - (-0x2000 * x + npc->x) / 2 + 0x800
- && npc->y + npc->hit.bottom > (2 * y - 1) << 12)
+ if (npc->x < (x * 0x10 + 8) * 0x200
+ && npc->x > (x * 0x10 - 8) * 0x200
+ && npc->y - npc->hit.top < (y * 0x10 * 0x200) - ((npc->x - (x * 0x10 * 0x200)) / 2) + 0x800
+ && npc->y + npc->hit.bottom > (y * 0x10 - 8) * 0x200)
{
//Clip
- npc->y = npc->hit.top + (y << 13) - (-0x2000 * x + npc->x) / 2 + 0x800;
+ npc->y = (y * 0x10 * 0x200) - ((npc->x - (x * 0x10 * 0x200)) / 2) + 0x800 + npc->hit.top;
//Halt momentum
if (npc->ym < 0)
@@ -74,7 +76,7 @@
npc->ym = 0;
//Set that hit a ceiling
- hit = 2;
+ hit |= 2;
}
npc->flag |= hit;
@@ -84,13 +86,13 @@
{
int hit = 0;
- if (npc->x < (2 * x + 1) << 12
- && npc->x > (2 * x - 1) << 12
- && npc->y - npc->hit.top < (y << 13) - (-0x2000 * x + npc->x) / 2 - 0x800
- && npc->y + npc->hit.bottom > (2 * y - 1) << 12)
+ if (npc->x < (x * 0x10 + 8) * 0x200
+ && npc->x > (x * 0x10 - 8) * 0x200
+ && npc->y - npc->hit.top < (y * 0x10 * 0x200) - ((npc->x - (x * 0x10 * 0x200)) / 2) - 0x800
+ && npc->y + npc->hit.bottom > (y * 0x10 - 8) * 0x200)
{
//Clip
- npc->y = npc->hit.top + (y << 13) - (-0x2000 * x + npc->x) / 2 - 0x800;
+ npc->y = (y * 0x10 * 0x200) - ((npc->x - (x * 0x10 * 0x200)) / 2) - 0x800 + npc->hit.top;
//Halt momentum
if (npc->ym < 0)
@@ -97,7 +99,7 @@
npc->ym = 0;
//Set that hit a ceiling
- hit = 2;
+ hit |= 2;
}
npc->flag |= hit;
@@ -107,13 +109,13 @@
{
int hit = 0;
- if (npc->x < (2 * x + 1) << 12
- && npc->x > (2 * x - 1) << 12
- && npc->y - npc->hit.top < (y << 13) + (-0x2000 * x + npc->x) / 2 - 0x800
- && npc->y + npc->hit.bottom > (2 * y - 1) << 12)
+ if (npc->x < (x * 0x10 + 8) * 0x200
+ && npc->x > (x * 0x10 - 8) * 0x200
+ && npc->y - npc->hit.top < (y * 0x10 * 0x200) + ((npc->x - (x * 0x10 * 0x200)) / 2) - 0x800
+ && npc->y + npc->hit.bottom > (y * 0x10 - 8) * 0x200)
{
//Clip
- npc->y = npc->hit.top + (y << 13) + (-0x2000 * x + npc->x) / 2 - 0x800;
+ npc->y = (y * 0x10 * 0x200) + ((npc->x - (x * 0x10 * 0x200)) / 2) - 0x800 + npc->hit.top;
//Halt momentum
if (npc->ym < 0)
@@ -120,7 +122,7 @@
npc->ym = 0;
//Set that hit a ceiling
- hit = 2;
+ hit |= 2;
}
npc->flag |= hit;
@@ -130,13 +132,13 @@
{
int hit = 0;
- if (npc->x < (2 * x + 1) << 12
- && npc->x > (2 * x - 1) << 12
- && npc->y - npc->hit.top < (y << 13) + (-0x2000 * x + npc->x) / 2 + 0x800
- && npc->y + npc->hit.bottom > (2 * y - 1) << 12)
+ if (npc->x < (x * 0x10 + 8) * 0x200
+ && npc->x > (x * 0x10 - 8) * 0x200
+ && npc->y - npc->hit.top < (y * 0x10 * 0x200) + ((npc->x - (x * 0x10 * 0x200)) / 2) + 0x800
+ && npc->y + npc->hit.bottom > (y * 0x10 - 8) * 0x200)
{
//Clip
- npc->y = npc->hit.top + (y << 13) + (-0x2000 * x + npc->x) / 2 + 0x800;
+ npc->y = (y * 0x10 * 0x200) + ((npc->x - (x * 0x10 * 0x200)) / 2) + 0x800 + npc->hit.top;
//Halt momentum
if (npc->ym < 0)
@@ -143,7 +145,7 @@
npc->ym = 0;
//Set that hit a ceiling
- hit = 2;
+ hit |= 2;
}
npc->flag |= hit;
@@ -151,15 +153,17 @@
void JudgeHitNpCharTriangleE(NPCHAR *npc, int x, int y)
{
- int hit = 0x10000;
+ int hit = 0;
- if ( npc->x < (2 * x + 1) << 12
- && npc->x > (2 * x - 1) << 12
- && npc->y + npc->hit.bottom > (y << 13) + (-0x2000 * x + npc->x) / 2 - 0x800
- && npc->y - npc->hit.top < (2 * y + 1) << 12 )
+ hit |= 0x10000;
+
+ if (npc->x < (x * 0x10 + 8) * 0x200
+ && npc->x > (x * 0x10 - 8) * 0x200
+ && npc->y + npc->hit.bottom > (y * 0x10 * 0x200) + ((npc->x - (x * 0x10 * 0x200)) / 2) - 0x800
+ && npc->y - npc->hit.top < (y * 0x10 + 8) * 0x200)
{
//Clip
- npc->y = (y << 13) + (-0x2000 * x + npc->x) / 2 - 0x800 - npc->hit.bottom;
+ npc->y = (y * 0x10 * 0x200) + ((npc->x - (x * 0x10 * 0x200)) / 2) - 0x800 - npc->hit.bottom;
//Halt momentum
if (npc->ym > 0)
@@ -166,7 +170,7 @@
npc->ym = 0;
//Set that hit this slope
- hit = 0x10028;
+ hit |= 0x28;
}
npc->flag |= hit;
@@ -174,15 +178,17 @@
void JudgeHitNpCharTriangleF(NPCHAR *npc, int x, int y)
{
- int hit = 0x20000;
+ int hit = 0;
- if ( npc->x < (2 * x + 1) << 12
- && npc->x > (2 * x - 1) << 12
- && npc->y + npc->hit.bottom > (y << 13) + (-0x2000 * x + npc->x) / 2 + 0x800
- && npc->y - npc->hit.top < (2 * y + 1) << 12 )
+ hit |= 0x20000;
+
+ if (npc->x < (x * 0x10 + 8) * 0x200
+ && npc->x >= (x * 0x10 - 8) * 0x200 // Note that this function uses '>='. I'm not sure if this is a bug.
+ && npc->y + npc->hit.bottom > (y * 0x10 * 0x200) + ((npc->x - (x * 0x10 * 0x200)) / 2) + 0x800
+ && npc->y - npc->hit.top < (y * 0x10 + 8) * 0x200)
{
//Clip
- npc->y = (y << 13) + (-0x2000 * x + npc->x) / 2 + 0x800 - npc->hit.bottom;
+ npc->y = (y * 0x10 * 0x200) + ((npc->x - (x * 0x10 * 0x200)) / 2) + 0x800 - npc->hit.bottom;
//Halt momentum
if (npc->ym > 0)
@@ -189,7 +195,7 @@
npc->ym = 0;
//Set that hit this slope
- hit = 0x20028;
+ hit |= 0x28;
}
npc->flag |= hit;
@@ -197,15 +203,17 @@
void JudgeHitNpCharTriangleG(NPCHAR *npc, int x, int y)
{
- int hit = 0x40000;
+ int hit = 0;
- if ( npc->x < (2 * x + 1) << 12
- && npc->x > (2 * x - 1) << 12
- && npc->y + npc->hit.bottom > (y << 13) - (-0x2000 * x + npc->x) / 2 + 0x800
- && npc->y - npc->hit.top < (2 * y + 1) << 12 )
+ hit |= 0x40000;
+
+ if (npc->x < (x * 0x10 + 8) * 0x200
+ && npc->x > (x * 0x10 - 8) * 0x200
+ && npc->y + npc->hit.bottom > (y * 0x10 * 0x200) - ((npc->x - (x * 0x10 * 0x200)) / 2) + 0x800
+ && npc->y - npc->hit.top < (y * 0x10 + 8) * 0x200)
{
//Clip
- npc->y = (y << 13) - (-0x2000 * x + npc->x) / 2 + 0x800 - npc->hit.bottom;
+ npc->y = (y * 0x10 * 0x200) - ((npc->x - (x * 0x10 * 0x200)) / 2) + 0x800 - npc->hit.bottom;
//Halt momentum
if (npc->ym > 0)
@@ -212,7 +220,7 @@
npc->ym = 0;
//Set that hit this slope
- hit = 0x40018;
+ hit |= 0x18;
}
npc->flag |= hit;
@@ -220,15 +228,17 @@
void JudgeHitNpCharTriangleH(NPCHAR *npc, int x, int y)
{
- int hit = 0x80000;
+ int hit = 0;
- if ( npc->x < (2 * x + 1) << 12
- && npc->x > (2 * x - 1) << 12
- && npc->y + npc->hit.bottom > (y << 13) - (-0x2000 * x + npc->x) / 2 - 0x800
- && npc->y - npc->hit.top < (2 * y + 1) << 12 )
+ hit |= 0x80000;
+
+ if (npc->x < (x * 0x10 + 8) * 0x200
+ && npc->x > (x * 0x10 - 8) * 0x200
+ && npc->y + npc->hit.bottom > (y * 0x10 * 0x200) - ((npc->x - (x * 0x10 * 0x200)) / 2) - 0x800
+ && npc->y - npc->hit.top < (y * 0x10 + 8) * 0x200)
{
//Clip
- npc->y = (y << 13) - (-0x2000 * x + npc->x) / 2 - 0x800 - npc->hit.bottom;
+ npc->y = (y * 0x10 * 0x200) - ((npc->x - (x * 0x10 * 0x200)) / 2) - 0x800 - npc->hit.bottom;
//Halt momentum
if (npc->ym > 0)
@@ -235,7 +245,7 @@
npc->ym = 0;
//Set that hit this slope
- hit = 0x80018;
+ hit |= 0x18;
}
npc->flag |= hit;
@@ -245,11 +255,11 @@
{
int hit = 0;
- if (npc->x - npc->hit.back < (4 * (2 * x + 1) - 1) << 10
- && npc->hit.back + npc->x > (4 * (2 * x - 1) + 1) << 10
- && npc->y - npc->hit.top < (4 * (2 * y + 1) - 1) << 10
- && npc->y + npc->hit.bottom > (4 * (2 * y - 1) + 1) << 10)
- hit = 0x100;
+ if (npc->x - npc->hit.back < (x * 0x10 + 6) * 0x200
+ && npc->x + npc->hit.back > (x * 0x10 - 6) * 0x200
+ && npc->y - npc->hit.top < (y * 0x10 + 6) * 0x200
+ && npc->y + npc->hit.bottom > (y * 0x10 - 6) * 0x200)
+ hit |= 0x100;
npc->flag |= hit;
}
@@ -256,9 +266,14 @@
void HitNpCharMap()
{
- int offy[9];
+ int judg, x, y;
+
int offx[9];
+ int offy[9];
+ int i;
+ int j;
+
offx[0] = 0;
offx[1] = 1;
offx[2] = 0;
@@ -279,133 +294,162 @@
offy[7] = 2;
offy[8] = 2;
- for (int i = 0; i < NPC_MAX; i++)
+ for (i = 0; i < NPC_MAX; i++)
{
- if ((gNPC[i].cond & 0x80) && !(gNPC[i].bits & 8))
+ if ((gNPC[i].cond & 0x80) == 0)
+ continue;
+
+ if (gNPC[i].bits & 8)
+ continue;
+
+ if (gNPC[i].size >= 3)
{
- int judg, x, y;
- if (gNPC[i].size <= 2)
- {
- judg = 4;
- x = gNPC[i].x / 0x2000;
- y = gNPC[i].y / 0x2000;
- }
- else
- {
- judg = 9;
- x = (gNPC[i].x - 0x1000) / 0x2000;
- y = (gNPC[i].y - 0x1000) / 0x2000;
- }
+ judg = 9;
+ x = (gNPC[i].x - 0x1000) / 0x10 / 0x200;
+ y = (gNPC[i].y - 0x1000) / 0x10 / 0x200;
+ }
+ else
+ {
+ judg = 4;
+ x = gNPC[i].x / 0x10 / 0x200;
+ y = gNPC[i].y / 0x10 / 0x200;
+ }
- gNPC[i].flag = 0;
+ gNPC[i].flag = 0;
- for (int j = 0; j < judg; j++)
+ for (j = 0; j < judg; j++)
+ {
+ switch (GetAttribute(x + offx[j], y + offy[j]))
{
- switch (GetAttribute(x + offx[j], y + offy[j]))
- {
- //Water
- case 0x02:
- case 0x60:
- case 0x62:
- JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
+ //No NPC block
+ case 0x44:
+ if (gNPC[i].bits & npc_ignore44)
break;
+ // Fallthrough
+ //Block
+ case 0x03:
+ case 0x05:
+ case 0x41:
+ case 0x43:
+ JadgeHitNpCharBlock(&gNPC[i], x + offx[j], y + offy[j]);
+ break;
- //Block
- case 0x03:
- case 0x05:
- case 0x41:
- case 0x43:
- JadgeHitNpCharBlock(&gNPC[i], x + offx[j], y + offy[j]);
- break;
+ //Slopes
+ case 0x50:
+ JudgeHitNpCharTriangleA(&gNPC[i], x + offx[j], y + offy[j]);
+ break;
- //Water block
- case 0x04:
- case 0x61:
- case 0x64:
- JadgeHitNpCharBlock(&gNPC[i], x + offx[j], y + offy[j]);
- JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
- break;
+ case 0x51:
+ JudgeHitNpCharTriangleB(&gNPC[i], x + offx[j], y + offy[j]);
+ break;
- //No NPC block
- case 0x44:
- if (!(gNPC[i].bits & npc_ignore44))
- JadgeHitNpCharBlock(&gNPC[i], x + offx[j], y + offy[j]);
- break;
+ case 0x52:
+ JudgeHitNpCharTriangleC(&gNPC[i], x + offx[j], y + offy[j]);
+ break;
- //Slopes
- case 0x50:
- JudgeHitNpCharTriangleA(&gNPC[i], x + offx[j], y + offy[j]);
- break;
+ case 0x53:
+ JudgeHitNpCharTriangleD(&gNPC[i], x + offx[j], y + offy[j]);
+ break;
- case 0x51:
- JudgeHitNpCharTriangleB(&gNPC[i], x + offx[j], y + offy[j]);
- break;
+ case 0x54:
+ JudgeHitNpCharTriangleE(&gNPC[i], x + offx[j], y + offy[j]);
+ break;
- case 0x52:
- JudgeHitNpCharTriangleC(&gNPC[i], x + offx[j], y + offy[j]);
- break;
+ case 0x55:
+ JudgeHitNpCharTriangleF(&gNPC[i], x + offx[j], y + offy[j]);
+ break;
- case 0x53:
- JudgeHitNpCharTriangleD(&gNPC[i], x + offx[j], y + offy[j]);
- break;
+ case 0x56:
+ JudgeHitNpCharTriangleG(&gNPC[i], x + offx[j], y + offy[j]);
+ break;
- case 0x54:
- JudgeHitNpCharTriangleE(&gNPC[i], x + offx[j], y + offy[j]);
- break;
+ case 0x57:
+ JudgeHitNpCharTriangleH(&gNPC[i], x + offx[j], y + offy[j]);
+ break;
- case 0x55:
- JudgeHitNpCharTriangleF(&gNPC[i], x + offx[j], y + offy[j]);
- break;
+ //Water
+ case 0x02:
+ case 0x60:
+ case 0x62:
+ JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
+ break;
- case 0x56:
- JudgeHitNpCharTriangleG(&gNPC[i], x + offx[j], y + offy[j]);
- break;
+ //Water block
+ case 0x04:
+ case 0x61:
+ case 0x64:
+ JadgeHitNpCharBlock(&gNPC[i], x + offx[j], y + offy[j]);
+ JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
+ break;
- case 0x57:
- JudgeHitNpCharTriangleH(&gNPC[i], x + offx[j], y + offy[j]);
- break;
+ //Water slopes
+ case 0x70:
+ JudgeHitNpCharTriangleA(&gNPC[i], x + offx[j], y + offy[j]);
+ JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
+ break;
- //Water slopes
- case 0x70:
- JudgeHitNpCharTriangleA(&gNPC[i], x + offx[j], y + offy[j]);
- JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
- break;
+ case 0x71:
+ JudgeHitNpCharTriangleB(&gNPC[i], x + offx[j], y + offy[j]);
+ JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
+ break;
- case 0x71:
- JudgeHitNpCharTriangleB(&gNPC[i], x + offx[j], y + offy[j]);
- JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
- break;
+ case 0x72:
+ JudgeHitNpCharTriangleC(&gNPC[i], x + offx[j], y + offy[j]);
+ JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
+ break;
- case 0x72:
- JudgeHitNpCharTriangleC(&gNPC[i], x + offx[j], y + offy[j]);
- JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
- break;
+ case 0x73:
+ JudgeHitNpCharTriangleD(&gNPC[i], x + offx[j], y + offy[j]);
+ JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
+ break;
- case 0x73:
- JudgeHitNpCharTriangleD(&gNPC[i], x + offx[j], y + offy[j]);
- JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
- break;
+ case 0x74:
+ JudgeHitNpCharTriangleE(&gNPC[i], x + offx[j], y + offy[j]);
+ JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
+ break;
- case 0x74:
- JudgeHitNpCharTriangleE(&gNPC[i], x + offx[j], y + offy[j]);
- JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
- break;
+ case 0x75:
+ JudgeHitNpCharTriangleF(&gNPC[i], x + offx[j], y + offy[j]);
+ JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
+ break;
- case 0x75:
- JudgeHitNpCharTriangleF(&gNPC[i], x + offx[j], y + offy[j]);
- JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
- break;
+ case 0x76:
+ JudgeHitNpCharTriangleG(&gNPC[i], x + offx[j], y + offy[j]);
+ JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
+ break;
- case 0x76:
- JudgeHitNpCharTriangleG(&gNPC[i], x + offx[j], y + offy[j]);
- JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
- break;
+ case 0x77:
+ JudgeHitNpCharTriangleH(&gNPC[i], x + offx[j], y + offy[j]);
+ JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
+ break;
- case 0x77:
- JudgeHitNpCharTriangleH(&gNPC[i], x + offx[j], y + offy[j]);
- JudgeHitNpCharWater(&gNPC[i], x + offx[j], y + offy[j]);
- break;
- }
+ case 0xA0:
+ gNPC[i].flag |= 0x100;
+ // Fallthrough
+ case 0x80:
+ gNPC[i].flag |= 0x1000;
+ break;
+
+ case 0xA1:
+ gNPC[i].flag |= 0x100;
+ // Fallthrough
+ case 0x81:
+ gNPC[i].flag |= 0x2000;
+ break;
+
+ case 0xA2:
+ gNPC[i].flag |= 0x100;
+ // Fallthrough
+ case 0x82:
+ gNPC[i].flag |= 0x4000;
+ break;
+
+ case 0xA3:
+ gNPC[i].flag |= 0x100;
+ // Fallthrough
+ case 0x83:
+ gNPC[i].flag |= 0x8000;
+ break;
}
if (gNPC[i].y > gWaterY + 0x800)
@@ -414,7 +458,7 @@
}
}
-void LoseNpChar(NPCHAR *npc, bool bVanish)
+void LoseNpChar(NPCHAR *npc, BOOL bVanish)
{
//Play death sound
PlaySoundObject(npc->destroy_voice, 1);
@@ -436,20 +480,36 @@
//Create drop
if (npc->exp)
{
- int v3 = Random(1, 5);
- char v4;
+ int val;
- if (v3 == 1)
+ switch (Random(1, 5))
{
- if (npc->exp <= 6)
- SetLifeObject(npc->x, npc->y, 2);
- else
- SetLifeObject(npc->x, npc->y, 6);
+ case 1:
+ // Spawn health
+ if (npc->exp > 6)
+ val = 6;
+ else
+ val = 2;
+
+ SetLifeObject(npc->x, npc->y, val);
+
+ break;
+
+ case 2:
+ // Spawn missile launcher ammo
+ if (npc->exp > 6)
+ val = 3;
+ else
+ val = 1;
+
+ if (SetBulletObject(npc->x, npc->y, val))
+ break;
+
+ // Fallthrough
+ default:
+ // Spawn weapon energy
+ SetExpObjects(npc->x, npc->y, npc->exp);
}
- else if (v3 != 2 || (npc->exp <= 6 ? (v4 = SetBulletObject(npc->x, npc->y, 1)) : (v4 = SetBulletObject(npc->x, npc->y, 3)), !v4)) //TODO: what the FUCK
- {
- SetExpObjects(npc->x, npc->y, npc->exp);
- }
}
//Set flag
@@ -456,100 +516,113 @@
SetNPCFlag(npc->code_flag);
//Create value view
- if (!(npc->bits & npc_showDamage))
+ if (npc->bits & npc_showDamage)
{
- npc->cond = 0;
- }
- else
- {
if ((npc->bits & npc_showDamage) && npc->damage_view)
SetValueView(&npc->x, &npc->y, npc->damage_view);
if (bVanish)
VanishNpChar(npc);
}
+ else
+ {
+ npc->cond = 0;
+ }
}
void HitNpCharBullet()
{
- for (int n = 0; n < NPC_MAX; n++)
+ int n;
+ int b;
+ BOOL bHit;
+
+ for (n = 0; n < NPC_MAX; n++)
{
- if ((gNPC[n].cond & 0x80) && (!(gNPC[n].bits & npc_shootable) || !(gNPC[n].bits & npc_interact)))
+ if ((gNPC[n].cond & 0x80) == 0)
+ continue;
+
+ if (gNPC[n].bits & npc_shootable && gNPC[n].bits & npc_interact)
+ continue;
+
+ for (b = 0; b < BULLET_MAX; b++)
{
- for (int b = 0; b < BULLET_MAX; b++)
+ if ((gBul[b].cond & 0x80) == 0)
+ continue;
+
+ if (gBul[b].damage == -1)
+ continue;
+
+ //Check if bullet touches npc
+ bHit = FALSE;
+ if (gNPC[n].bits & npc_shootable
+ && gNPC[n].x - gNPC[n].hit.back < gBul[b].x + gBul[b].enemyXL
+ && gNPC[n].x + gNPC[n].hit.back > gBul[b].x - gBul[b].enemyXL
+ && gNPC[n].y - gNPC[n].hit.top < gBul[b].y + gBul[b].enemyYL
+ && gNPC[n].y + gNPC[n].hit.bottom > gBul[b].y - gBul[b].enemyYL)
+ bHit = TRUE;
+ else if (gNPC[n].bits & npc_invulnerable
+ && gNPC[n].x - gNPC[n].hit.back < gBul[b].x + gBul[b].blockXL
+ && gNPC[n].x + gNPC[n].hit.back > gBul[b].x - gBul[b].blockXL
+ && gNPC[n].y - gNPC[n].hit.top < gBul[b].y + gBul[b].blockYL
+ && gNPC[n].y + gNPC[n].hit.bottom > gBul[b].y - gBul[b].blockYL)
+ bHit = TRUE;
+
+ if (bHit)
{
- if (gBul[b].cond & 0x80 && gBul[b].damage != -1)
+ //Damage NPC
+ if (gNPC[n].bits & npc_shootable)
{
- //Check if bullet touches npc
- bool bHit = false;
- if (gNPC[n].bits & npc_shootable
- && gNPC[n].x - gNPC[n].hit.back < gBul[b].x + gBul[b].enemyXL
- && gNPC[n].x + gNPC[n].hit.back > gBul[b].x - gBul[b].enemyXL
- && gNPC[n].y - gNPC[n].hit.top < gBul[b].y + gBul[b].enemyYL
- && gNPC[n].y + gNPC[n].hit.bottom > gBul[b].y - gBul[b].enemyYL)
- bHit = true;
- else if (gNPC[n].bits & npc_invulnerable
- && gNPC[n].x - gNPC[n].hit.back < gBul[b].x + gBul[b].blockXL
- && gNPC[n].x + gNPC[n].hit.back > gBul[b].x - gBul[b].blockXL
- && gNPC[n].y - gNPC[n].hit.top < gBul[b].y + gBul[b].blockYL
- && gNPC[n].y + gNPC[n].hit.bottom > gBul[b].y - gBul[b].blockYL)
- bHit = true;
+ gNPC[n].life -= gBul[b].damage;
- if (bHit)
+ if (gNPC[n].life < 1)
{
- //Damage NPC
- if (gNPC[n].bits & npc_shootable)
- {
- gNPC[n].life -= gBul[b].damage;
+ gNPC[n].life = 0;
- if (gNPC[n].life > 0)
- {
- if (gNPC[n].shock < 14)
- {
- SetCaret((gBul[b].x + gNPC[n].x) / 2, (gBul[b].y + gNPC[n].y) / 2, 11, 0);
- SetCaret((gBul[b].x + gNPC[n].x) / 2, (gBul[b].y + gNPC[n].y) / 2, 11, 0);
- SetCaret((gBul[b].x + gNPC[n].x) / 2, (gBul[b].y + gNPC[n].y) / 2, 11, 0);
- PlaySoundObject(gNPC[n].hit_voice, 1);
- gNPC[n].shock = 16;
- }
+ if (gNPC[n].bits & npc_showDamage)
+ gNPC[n].damage_view -= gBul[b].damage;
- if (gNPC[n].bits & npc_showDamage)
- gNPC[n].damage_view -= gBul[b].damage;
- }
- else
- {
- gNPC[n].life = 0;
-
- if (gNPC[n].bits & npc_showDamage)
- gNPC[n].damage_view -= gBul[b].damage;
-
- if ((gMC.cond & 0x80) && gNPC[n].bits & npc_eventDie)
- StartTextScript(gNPC[n].code_event);
- else
- gNPC[n].cond |= 8;
- }
- }
- //Hit invulnerable NPC
- else if (gBul[b].code_bullet != 13
- && gBul[b].code_bullet != 14
- && gBul[b].code_bullet != 15
- && gBul[b].code_bullet != 28
- && gBul[b].code_bullet != 29
- && gBul[b].code_bullet != 30
- && !(gBul[b].bbits & 0x10))
+ if ((gMC.cond & 0x80) && gNPC[n].bits & npc_eventDie)
+ StartTextScript(gNPC[n].code_event);
+ else
+ gNPC[n].cond |= 8;
+ }
+ else
+ {
+ if (gNPC[n].shock < 14)
{
- SetCaret((gBul[b].x + gNPC[n].x) / 2, (gBul[b].y + gNPC[n].y) / 2, 2, 2);
- PlaySoundObject(31, 1);
- gBul[b].life = 0;
- continue;
+ SetCaret((gBul[b].x + gNPC[n].x) / 2, (gBul[b].y + gNPC[n].y) / 2, 11, 0);
+ SetCaret((gBul[b].x + gNPC[n].x) / 2, (gBul[b].y + gNPC[n].y) / 2, 11, 0);
+ SetCaret((gBul[b].x + gNPC[n].x) / 2, (gBul[b].y + gNPC[n].y) / 2, 11, 0);
+ PlaySoundObject(gNPC[n].hit_voice, 1);
+ gNPC[n].shock = 16;
}
- --gBul[b].life;
+ if (gNPC[n].bits & npc_showDamage)
+ gNPC[n].damage_view -= gBul[b].damage;
}
}
- }
+ else if (gBul[b].code_bullet == 13
+ || gBul[b].code_bullet == 14
+ || gBul[b].code_bullet == 15
+ || gBul[b].code_bullet == 28
+ || gBul[b].code_bullet == 29
+ || gBul[b].code_bullet == 30)
+ {
+ // Strange empty case that's needed for accurate assembly
+ }
+ else if ((gBul[b].bbits & 0x10) == 0)
+ {
+ //Hit invulnerable NPC
+ SetCaret((gBul[b].x + gNPC[n].x) / 2, (gBul[b].y + gNPC[n].y) / 2, 2, 2);
+ PlaySoundObject(31, 1);
+ gBul[b].life = 0;
+ continue;
+ }
- if (gNPC[n].cond & 8)
- LoseNpChar(&gNPC[n], true);
+ --gBul[b].life;
+ }
}
+
+ if (gNPC[n].cond & 8)
+ LoseNpChar(&gNPC[n], TRUE);
}
}
--- a/src/NpcHit.h
+++ b/src/NpcHit.h
@@ -1,5 +1,7 @@
#pragma once
+#include "WindowsWrapper.h"
+
#include "NpChar.h"
void JadgeHitNpCharBlock(NPCHAR *npc, int x, int y);
@@ -13,5 +15,5 @@
void JudgeHitNpCharTriangleH(NPCHAR *npc, int x, int y);
void JudgeHitNpCharWater(NPCHAR *npc, int x, int y);
void HitNpCharMap();
-void LoseNpChar(NPCHAR *npc, bool bVanish);
+void LoseNpChar(NPCHAR *npc, BOOL bVanish);
void HitNpCharBullet();
--- a/src/NpcTbl.h
+++ b/src/NpcTbl.h
@@ -1,7 +1,5 @@
#pragma once
-#include <stdint.h>
-
#include "WindowsWrapper.h"
#include "Draw.h"
@@ -9,22 +7,22 @@
struct NPC_TBL_RECT
{
- uint8_t front;
- uint8_t top;
- uint8_t back;
- uint8_t bottom;
+ unsigned char front;
+ unsigned char top;
+ unsigned char back;
+ unsigned char bottom;
};
struct NPC_TABLE
{
- uint16_t bits;
- uint16_t life;
- uint8_t surf;
- uint8_t hit_voice;
- uint8_t destroy_voice;
- uint8_t size;
- int32_t exp;
- int32_t damage;
+ unsigned short bits;
+ unsigned short life;
+ unsigned char surf;
+ unsigned char hit_voice;
+ unsigned char destroy_voice;
+ unsigned char size;
+ long exp;
+ long damage;
NPC_TBL_RECT hit;
NPC_TBL_RECT view;
};
--- a/src/Organya.cpp
+++ b/src/Organya.cpp
@@ -1,7 +1,6 @@
#include "Organya.h"
#include <stddef.h>
-#include <stdint.h>
#include <stdio.h>
#include <string.h>
@@ -33,7 +32,7 @@
int gOrgVolume = 100;
bool bFadeout = false;
-bool OrganyaNoteAlloc(uint16_t alloc)
+bool OrganyaNoteAlloc(unsigned short alloc)
{
for(int j = 0; j < MAXTRACK; j++)
{
@@ -110,7 +109,7 @@
{ 8,128, 32 }, //7 Oct
};
-bool MakeSoundObject8(int8_t *wavep, int8_t track, int8_t pipi)
+bool MakeSoundObject8(signed char *wavep, signed char track, signed char pipi)
{
for (int j = 0; j < 8; j++)
{
@@ -123,13 +122,13 @@
lpORGANBUFFER[track][j][k] = new SOUNDBUFFER(data_size);
//Get wave data
- uint8_t *wp = new uint8_t[data_size];
- uint8_t *wp_sub = wp;
+ unsigned char *wp = new unsigned char[data_size];
+ unsigned char *wp_sub = wp;
size_t wav_tp = 0;
for (size_t i = 0; i < data_size; i++)
{
- uint8_t work = *(wavep+wav_tp);
+ unsigned char work = *(wavep+wav_tp);
work += 0x80;
*wp_sub = work;
@@ -142,7 +141,7 @@
}
//Copy wave data to sound buffer
- uint8_t *buf;
+ unsigned char *buf;
lpORGANBUFFER[track][j][k]->Lock(&buf, NULL);
memcpy(buf, wp, data_size);
lpORGANBUFFER[track][j][k]->Unlock();
@@ -157,7 +156,7 @@
//Playing melody tracks
short freq_tbl[12] = { 262,277,294,311,330,349,370,392,415,440,466,494 };
-void ChangeOrganFrequency(uint8_t key, int8_t track, int32_t a)
+void ChangeOrganFrequency(unsigned char key, signed char track, long a)
{
for (int j = 0; j < 8; j++) {
for (int i = 0; i < 2; i++) {
@@ -166,24 +165,24 @@
}
}
-int16_t pan_tbl[13] = {0, 43, 86, 129, 172, 215, 256, 297, 340, 383, 426, 469, 512};
-uint8_t old_key[MAXTRACK] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
-uint8_t key_on[MAXTRACK] = {0};
-uint8_t key_twin[MAXTRACK] = {0};
+short pan_tbl[13] = {0, 43, 86, 129, 172, 215, 256, 297, 340, 383, 426, 469, 512};
+unsigned char old_key[MAXTRACK] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+unsigned char key_on[MAXTRACK] = {0};
+unsigned char key_twin[MAXTRACK] = {0};
-void ChangeOrganPan(uint8_t key, uint8_t pan, int8_t track)
+void ChangeOrganPan(unsigned char key, unsigned char pan, signed char track)
{
if(old_key[track] != PANDUMMY)
lpORGANBUFFER[track][old_key[track]/12][key_twin[track]]->SetPan((pan_tbl[pan] - 0x100) * 10);
}
-void ChangeOrganVolume(int no, int32_t volume, int8_t track)
+void ChangeOrganVolume(int no, long volume, signed char track)
{
if(old_key[track] != VOLDUMMY)
lpORGANBUFFER[track][old_key[track]/12][key_twin[track]]->SetVolume((volume - 0xFF) * 8);
}
-void PlayOrganObject(uint8_t key, int mode, int8_t track, int32_t freq)
+void PlayOrganObject(unsigned char key, int mode, signed char track, long freq)
{
if (lpORGANBUFFER[track][key/12][key_twin[track]] != NULL)
{
@@ -240,7 +239,7 @@
}
//Release tracks
-void ReleaseOrganyaObject(int8_t track)
+void ReleaseOrganyaObject(signed char track)
{
for(int i = 0; i < 8; i++)
{
@@ -258,7 +257,7 @@
}
//Handling WAVE100
-int8_t wave_data[100][0x100];
+signed char wave_data[100][0x100];
BOOL InitWaveData100()
{
@@ -273,7 +272,7 @@
}
//Create org wave
-bool MakeOrganyaWave(int8_t track, int8_t wave_no, int8_t pipi)
+bool MakeOrganyaWave(signed char track, signed char wave_no, signed char pipi)
{
if(wave_no > 99)
{
@@ -287,17 +286,17 @@
}
//Dram
-void ChangeDramFrequency(uint8_t key, int8_t track)
+void ChangeDramFrequency(unsigned char key, signed char track)
{
lpDRAMBUFFER[track]->SetFrequency(key * 800 + 100);
}
-void ChangeDramPan(uint8_t pan, int8_t track)
+void ChangeDramPan(unsigned char pan, signed char track)
{
lpDRAMBUFFER[track]->SetPan((pan_tbl[pan] - 0x100) * 10);
}
-void ChangeDramVolume(int32_t volume, int8_t track)
+void ChangeDramVolume(long volume, signed char track)
{
lpDRAMBUFFER[track]->SetVolume((volume - 0xFF) * 8);
}
@@ -324,9 +323,9 @@
}
//Play data
-int32_t play_p;
+long play_p;
NOTELIST *play_np[MAXTRACK];
-int32_t now_leng[MAXMELODY] = {0};
+long now_leng[MAXMELODY] = {0};
void OrganyaPlayData()
{
@@ -393,7 +392,7 @@
}
}
-void SetPlayPointer(int32_t x)
+void SetPlayPointer(long x)
{
for (int i = 0; i < MAXTRACK; i++)
{
@@ -428,7 +427,7 @@
const unsigned char *p = FindResource(name, "ORG", NULL);
//Version Check
- uint8_t ver = 0;
+ unsigned char ver = 0;
char pass_check[6];
memcpy(pass_check, p, 6);
@@ -454,7 +453,7 @@
for (int i = 0; i < 16; i++) {
info.tdata[i].freq = READ_LE16(p);
info.tdata[i].wave_no = *p++;
- const int8_t pipi = *p++;
+ const signed char pipi = *p++;
info.tdata[i].pipi = ver == 1 ? 0 : pipi;
info.tdata[i].note_num = READ_LE16(p);
}
@@ -586,7 +585,7 @@
SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH);
//Set time for next step to play
- uint32_t NextTick = SDL_GetTicks() + info.wait;
+ Uint32 NextTick = SDL_GetTicks() + info.wait;
while (bEndTimer == false)
{
--- a/src/Organya.h
+++ b/src/Organya.h
@@ -1,13 +1,11 @@
#pragma once
-#include <stdint.h>
-
//Below are Organya song data structures
struct NOTELIST {
NOTELIST *from; //Previous address
NOTELIST *to; //Next address
- int32_t x; //Position
+ long x; //Position
unsigned char length; //Sound length
unsigned char y; //Sound height
unsigned char volume; //Volume
@@ -16,10 +14,10 @@
//Track data * 8
struct TRACKDATA {
- uint16_t freq; //Frequency (1000 is default)
- uint8_t wave_no; //Waveform No.
- int8_t pipi;
- uint16_t note_num; //Number of notes
+ unsigned short freq; //Frequency (1000 is default)
+ unsigned char wave_no; //Waveform No.
+ signed char pipi;
+ unsigned short note_num; //Number of notes
NOTELIST *note_p;
NOTELIST *note_list;
@@ -27,20 +25,20 @@
//Unique information held in songs
struct MUSICINFO {
- uint16_t wait;
+ unsigned short wait;
bool loaded;
bool playing;
unsigned char line; //Number of lines in one measure
unsigned char dot; //Number of dots per line
- uint16_t alloc_note; //Number of allocated notes
- int32_t repeat_x; //Repeat
- int32_t end_x; //End of song (Return to repeat)
+ unsigned short alloc_note; //Number of allocated notes
+ long repeat_x; //Repeat
+ long end_x; //End of song (Return to repeat)
TRACKDATA tdata[16];
};
-bool MakeOrganyaWave(int8_t track, int8_t wave_no, int8_t pipi);
+bool MakeOrganyaWave(signed char track, signed char wave_no, signed char pipi);
void OrganyaPlayData();
-void SetPlayPointer(int32_t x);
+void SetPlayPointer(long x);
void LoadOrganya(const char *name);
void SetOrganyaPosition(unsigned int x);
unsigned int GetOrganyaPosition();
--- a/src/Profile.cpp
+++ b/src/Profile.cpp
@@ -1,7 +1,6 @@
#include "Profile.h"
#include <stddef.h>
-#include <stdint.h>
#include <stdio.h>
#include <string.h>
--- a/src/Profile.h
+++ b/src/Profile.h
@@ -1,7 +1,5 @@
#pragma once
-#include <stdint.h>
-
#include "WindowsWrapper.h"
#include "ArmsItem.h"
@@ -15,10 +13,10 @@
int x;
int y;
int direct;
- int16_t max_life;
- int16_t star;
- int16_t life;
- int16_t a;
+ short max_life;
+ short star;
+ short life;
+ short a;
int select_arms;
int select_item;
int equip;
@@ -29,7 +27,7 @@
PERMIT_STAGE permitstage[8];
signed char permit_mapping[0x80];
char FLAG[4];
- uint8_t flags[1000];
+ unsigned char flags[1000];
};
BOOL IsProfile();
--- a/src/Sound.cpp
+++ b/src/Sound.cpp
@@ -2,7 +2,6 @@
#include <algorithm>
#include <cmath>
-#include <stdint.h>
#include <stdio.h>
#include <string>
#include <cstring>
@@ -48,7 +47,7 @@
samplePosition = 0.0;
//Create waveform buffer
- data = new uint8_t[bufSize];
+ data = new unsigned char[bufSize];
memset(data, 0x80, bufSize);
//Add to buffer list
@@ -88,7 +87,7 @@
delete this;
}
-void SOUNDBUFFER::Lock(uint8_t **outBuffer, size_t *outSize)
+void SOUNDBUFFER::Lock(unsigned char **outBuffer, size_t *outSize)
{
SDL_LockAudioDevice(audioDevice);
@@ -104,7 +103,7 @@
SDL_UnlockAudioDevice(audioDevice);
}
-void SOUNDBUFFER::SetCurrentPosition(uint32_t dwNewPosition)
+void SOUNDBUFFER::SetCurrentPosition(unsigned long dwNewPosition)
{
SDL_LockAudioDevice(audioDevice);
samplePosition = dwNewPosition;
@@ -111,7 +110,7 @@
SDL_UnlockAudioDevice(audioDevice);
}
-void SOUNDBUFFER::SetFrequency(uint32_t dwFrequency)
+void SOUNDBUFFER::SetFrequency(unsigned long dwFrequency)
{
SDL_LockAudioDevice(audioDevice);
frequency = (double)dwFrequency;
@@ -118,14 +117,14 @@
SDL_UnlockAudioDevice(audioDevice);
}
-float MillibelToVolume(int32_t lVolume)
+float MillibelToVolume(long lVolume)
{
//Volume is in hundredths of decibels, from 0 to -10000
- lVolume = clamp(lVolume, (int32_t)-10000, (int32_t)0);
+ lVolume = clamp(lVolume, (long)-10000, (long)0);
return (float)pow(10.0, lVolume / 2000.0);
}
-void SOUNDBUFFER::SetVolume(int32_t lVolume)
+void SOUNDBUFFER::SetVolume(long lVolume)
{
SDL_LockAudioDevice(audioDevice);
volume = MillibelToVolume(lVolume);
@@ -132,7 +131,7 @@
SDL_UnlockAudioDevice(audioDevice);
}
-void SOUNDBUFFER::SetPan(int32_t lPan)
+void SOUNDBUFFER::SetPan(long lPan)
{
SDL_LockAudioDevice(audioDevice);
volume_l = MillibelToVolume(-lPan);
@@ -288,19 +287,19 @@
}
}
-void ChangeSoundFrequency(int no, uint32_t rate)
+void ChangeSoundFrequency(int no, unsigned long rate)
{
if (lpSECONDARYBUFFER[no])
lpSECONDARYBUFFER[no]->SetFrequency(10 * rate + 100);
}
-void ChangeSoundVolume(int no, int32_t volume)
+void ChangeSoundVolume(int no, long volume)
{
if (lpSECONDARYBUFFER[no])
lpSECONDARYBUFFER[no]->SetVolume(8 * volume - 2400);
}
-void ChangeSoundPan(int no, int32_t pan)
+void ChangeSoundPan(int no, long pan)
{
if (lpSECONDARYBUFFER[no])
lpSECONDARYBUFFER[no]->SetPan(10 * (pan - 256));
--- a/src/Sound.h
+++ b/src/Sound.h
@@ -1,7 +1,6 @@
#pragma once
#include <stddef.h>
-#include <stdint.h>
#include "PixTone.h"
@@ -13,13 +12,13 @@
void Release();
- void Lock(uint8_t **buffer, size_t *size);
+ void Lock(unsigned char **buffer, size_t *size);
void Unlock();
- void SetCurrentPosition(uint32_t dwNewPosition);
- void SetFrequency(uint32_t dwFrequency);
- void SetVolume(int32_t lVolume);
- void SetPan(int32_t lPan);
+ void SetCurrentPosition(unsigned long dwNewPosition);
+ void SetFrequency(unsigned long dwFrequency);
+ void SetVolume(long lVolume);
+ void SetPan(long lPan);
void Play(bool bLooping);
void Stop();
@@ -28,7 +27,7 @@
SOUNDBUFFER *next;
private:
- uint8_t *data;
+ unsigned char *data;
size_t size;
bool playing;
@@ -95,7 +94,7 @@
bool InitDirectSound();
void EndDirectSound();
void PlaySoundObject(int no, int mode);
-void ChangeSoundFrequency(int no, uint32_t rate);
-void ChangeSoundVolume(int no, int32_t volume);
-void ChangeSoundPan(int no, int32_t pan);
+void ChangeSoundFrequency(int no, unsigned long rate);
+void ChangeSoundVolume(int no, long volume);
+void ChangeSoundPan(int no, long pan);
int MakePixToneObject(const PIXTONEPARAMETER *ptp, int ptp_num, int no);
--- a/src/Stage.cpp
+++ b/src/Stage.cpp
@@ -1,6 +1,5 @@
#include "Stage.h"
-#include <stdint.h>
#include <stdio.h>
#include <string.h>
--- a/src/TextScr.cpp
+++ b/src/TextScr.cpp
@@ -1,6 +1,5 @@
#include "TextScr.h"
-#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -91,7 +90,7 @@
}
//Decrypt .tsc
-void EncryptionBinaryData2(uint8_t *pData, int size)
+void EncryptionBinaryData2(unsigned char *pData, int size)
{
int val1;
@@ -136,7 +135,7 @@
strcpy(gTS.path, name);
//Decrypt data
- EncryptionBinaryData2((uint8_t*)gTS.data, gTS.size);
+ EncryptionBinaryData2((unsigned char*)gTS.data, gTS.size);
return TRUE;
}
@@ -157,7 +156,7 @@
//Read Head.tsc
fread(gTS.data, 1, head_size, fp);
- EncryptionBinaryData2((uint8_t*)gTS.data, head_size);
+ EncryptionBinaryData2((unsigned char*)gTS.data, head_size);
gTS.data[head_size] = 0;
fclose(fp);
@@ -174,7 +173,7 @@
//Read stage's tsc
fread(&gTS.data[head_size], 1, body_size, fp);
- EncryptionBinaryData2((uint8_t*)&gTS.data[head_size], body_size);
+ EncryptionBinaryData2((unsigned char*)&gTS.data[head_size], body_size);
gTS.data[head_size + body_size] = 0;
fclose(fp);
--- a/src/TextScr.h
+++ b/src/TextScr.h
@@ -1,7 +1,5 @@
#pragma once
-#include <stdint.h>
-
#include "WindowsWrapper.h"
#include "CommonDefines.h"
@@ -54,12 +52,12 @@
int offsetY;
//NOD cursor blink
- uint8_t wait_beam;
+ unsigned char wait_beam;
};
BOOL InitTextScript2();
void EndTextScript();
-void EncryptionBinaryData2(uint8_t *pData, int size);
+void EncryptionBinaryData2(unsigned char *pData, int size);
BOOL LoadTextScript2(const char *name);
BOOL LoadTextScript_Stage(const char *name);
void GetTextScriptPath(char *path);
--- a/src/Triangle.cpp
+++ b/src/Triangle.cpp
@@ -1,10 +1,9 @@
#include "Triangle.h"
-#include <stdint.h>
#include <math.h>
int gSin[0x100];
-int16_t gTan[0x21];
+short gTan[0x21];
void InitTriangleTable()
{
@@ -23,27 +22,27 @@
{
a = (float)(i * 6.2831855f / 256.0f);
b = sinf(a) / cosf(a);
- gTan[i] = (int16_t)(b * 8192.0f);
+ gTan[i] = (short)(b * 8192.0f);
}
}
-int GetSin(uint8_t deg)
+int GetSin(unsigned char deg)
{
return gSin[deg];
}
-int GetCos(uint8_t deg)
+int GetCos(unsigned char deg)
{
deg += 0x40;
return gSin[deg];
}
-uint8_t GetArktan(int x, int y)
+unsigned char GetArktan(int x, int y)
{
x *= -1;
y *= -1;
- uint8_t a = 0;
- int16_t k;
+ unsigned char a = 0;
+ short k;
if (x > 0)
{
--- a/src/Triangle.h
+++ b/src/Triangle.h
@@ -1,8 +1,6 @@
#pragma once
-#include <stdint.h>
-
void InitTriangleTable();
-int GetSin(uint8_t deg);
-int GetCos(uint8_t deg);
-uint8_t GetArktan(int x, int y);
+int GetSin(unsigned char deg);
+int GetCos(unsigned char deg);
+unsigned char GetArktan(int x, int y);