Merge branch 'accurate' into portable

This commit is contained in:
Clownacy 2020-01-07 04:55:10 +00:00
commit 84626ea710
34 changed files with 109 additions and 155 deletions

View file

@ -2,16 +2,12 @@
#include "WindowsWrapper.h"
#ifdef __cplusplus
extern "C" {
#endif
// "Arms" is a synonym of "weapon" here
// "Code" means "ID" here
// "Num" often means "ammo" here
/// Weapon struct
struct ARMS
typedef struct ARMS
{
/// ID of the weapon
int code;
@ -27,13 +23,13 @@ struct ARMS
/// Current ammunition
int num;
};
} ARMS;
struct ITEM
typedef struct ITEM
{
/// ID of the item
int code;
};
} ITEM;
// Limits for the amount of weapons and items
@ -114,7 +110,3 @@ int RotationArmsRev(void);
/// Change the current weapon to be the first one and play the usual rotation animation
void ChangeToFirstArms(void);
#ifdef __cplusplus
}
#endif

View file

@ -10,9 +10,9 @@
#include "File.h"
#include "Frame.h"
#include "Game.h"
#include "Main.h"
#include "Map.h"
#include "Stage.h"
#include "Tags.h"
BACK gBack;
int gWaterY;

View file

@ -2,7 +2,7 @@
#include "WindowsWrapper.h"
struct BACK
typedef struct BACK
{
BOOL flag; // Basically unused
int partsW;
@ -11,7 +11,7 @@ struct BACK
int numY;
int type;
int fx;
};
} BACK;
extern BACK gBack;
extern int gWaterY;

View file

@ -2,10 +2,6 @@
#include "WindowsWrapper.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct BULLET
{
int flag;
@ -73,7 +69,3 @@ void PutBullet(int fx, int fy);
void SetBullet(int no, int x, int y, int dir);
void ActBullet(void);
BOOL IsActiveSomeBullet(void);
#ifdef __cplusplus
}
#endif

View file

@ -6,7 +6,7 @@
#include "Config.h"
#include "File.h"
#include "Tags.h"
#include "Main.h"
static const char* const config_filename = "Config.dat"; // Not the original name
static const char* const config_magic = "DOUKUTSU20041206"; // Not the original name

View file

@ -17,7 +17,6 @@
#include "Main.h"
#include "MapName.h"
#include "Resource.h"
#include "Tags.h"
#include "TextScr.h"
typedef enum SurfaceType

View file

@ -4,10 +4,6 @@
#include "WindowsWrapper.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef RGB
#define RGB(r,g,b) ((r) | ((g) << 8) | ((b) << 16))
#endif
@ -76,7 +72,3 @@ void InitTextObject(const char *font_name);
void PutText(int x, int y, const char *text, unsigned long color);
void PutText2(int x, int y, const char *text, unsigned long color, SurfaceID surf_no);
void EndTextObject(void);
#ifdef __cplusplus
}
#endif

View file

@ -16,7 +16,6 @@
#include "Organya.h"
#include "Stage.h"
#include "TextScr.h"
#include "Tags.h"
CREDIT Credit;
STRIP Strip[MAX_STRIP];

View file

@ -1,6 +1,6 @@
#pragma once
struct FRAME
typedef struct FRAME
{
int x;
int y;
@ -9,7 +9,7 @@ struct FRAME
int wait;
int quake;
int quake2;
};
} FRAME;
extern FRAME gFrame;

View file

@ -43,7 +43,6 @@
#include "Sound.h"
#include "Stage.h"
#include "Star.h"
#include "Tags.h"
#include "TextScr.h"
#include "ValueView.h"

View file

@ -2,10 +2,6 @@
#include "WindowsWrapper.h"
#ifdef __cplusplus
extern "C" {
#endif
enum GameFlagsValues
{
// To be continued
@ -37,7 +33,3 @@ int Random(int min, int max);
void PutNumber4(int x, int y, int value, BOOL bZero);
BOOL Game(void);
#ifdef __cplusplus
}
#endif

View file

@ -6,7 +6,7 @@
#include "WindowsWrapper.h"
#include "Tags.h"
#include "Main.h"
void GetCompileDate(int *year, int *month, int *day)
{

View file

@ -2,6 +2,9 @@
#include "WindowsWrapper.h"
extern char gModulePath[MAX_PATH];
extern char gDataPath[MAX_PATH];
extern BOOL bFullscreen;
void PutFramePerSecound(void);

View file

@ -10,8 +10,8 @@
#include "CommonDefines.h"
#include "Draw.h"
#include "File.h"
#include "Main.h"
#include "NpChar.h"
#include "Tags.h"
#define PXM_BUFFER_SIZE 0x4B000

View file

@ -2,10 +2,6 @@
#include "WindowsWrapper.h"
#ifdef __cplusplus
extern "C" {
#endif
// TODO - When I add bitmask constants for gMC.flags...
// 0x100 is a 'player is underwater' flag
@ -87,7 +83,3 @@ void SetNoise(int no, int freq);
void CutNoise(void);
void ResetNoise(void);
void SleepNoise(void);
#ifdef __cplusplus
}
#endif

View file

@ -12,10 +12,10 @@
#include "Draw.h"
#include "File.h"
#include "Game.h"
#include "Main.h"
#include "MyChar.h"
#include "NpChar.h"
#include "Sound.h"
#include "Tags.h"
#include "TextScr.h"
#include "ValueView.h"

View file

@ -2,16 +2,16 @@
#include "WindowsWrapper.h"
struct ARMS_LEVEL
typedef struct ARMS_LEVEL
{
int exp[3];
};
} ARMS_LEVEL;
struct REC
typedef struct REC
{
long counter[4];
unsigned char random[4];
};
} REC;
extern ARMS_LEVEL gArmsLevelTable[14];

View file

@ -12,10 +12,10 @@
#include "File.h"
#include "Flags.h"
#include "Game.h"
#include "Main.h"
#include "MyChar.h"
#include "NpcTbl.h"
#include "Sound.h"
#include "Tags.h"
#include "ValueView.h"
NPCHAR gNPC[NPC_MAX];

View file

@ -51,7 +51,7 @@ enum NPCNames
// To be continued
};
struct NPCHAR
typedef struct NPCHAR
{
unsigned char cond;
int flag;
@ -98,8 +98,8 @@ struct NPCHAR
unsigned char shock;
int damage_view;
int damage;
NPCHAR *pNpc;
};
struct NPCHAR *pNpc;
} NPCHAR;
struct EVENT
{

View file

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include "WindowsWrapper.h"

View file

@ -2,15 +2,15 @@
#include "WindowsWrapper.h"
struct PIXTONEPARAMETER2
typedef struct PIXTONEPARAMETER2
{
int model;
double num;
int top;
int offset;
};
} PIXTONEPARAMETER2;
struct PIXTONEPARAMETER
typedef struct PIXTONEPARAMETER
{
int use;
int size;
@ -24,7 +24,7 @@ struct PIXTONEPARAMETER
int pointBy;
int pointCx;
int pointCy;
};
} PIXTONEPARAMETER;
void MakeWaveTables(void);
BOOL MakePixelWaveData(const PIXTONEPARAMETER *ptp, unsigned char *pData);

View file

@ -13,13 +13,13 @@
#include "Flags.h"
#include "Frame.h"
#include "Game.h"
#include "Main.h"
#include "MiniMap.h"
#include "MyChar.h"
#include "NpChar.h"
#include "SelStage.h"
#include "Stage.h"
#include "Star.h"
#include "Tags.h"
#include "ValueView.h"
const char *gDefaultName = "Profile.dat";

View file

@ -6,7 +6,7 @@
#include "SelStage.h"
#include "Stage.h"
struct PROFILE
typedef struct PROFILE
{
char code[8];
int stage;
@ -29,7 +29,7 @@ struct PROFILE
signed char permit_mapping[0x80];
char FLAG[4];
unsigned char flags[1000];
};
} PROFILE;
BOOL IsProfile(void);
BOOL SaveProfile(const char *name);

View file

@ -2,11 +2,11 @@
#include "WindowsWrapper.h"
struct PERMIT_STAGE
typedef struct PERMIT_STAGE
{
int index;
int event;
};
} PERMIT_STAGE;
extern PERMIT_STAGE gPermitStage[8];

View file

@ -20,9 +20,9 @@ equivalents.
#include "WindowsWrapper.h"
#include "Backends/Audio.h"
#include "Main.h"
#include "Organya.h"
#include "PixTone.h"
#include "Tags.h"
BOOL audio_backend_initialised;
AudioBackend_Sound *lpSECONDARYBUFFER[SE_MAX];

View file

@ -246,9 +246,9 @@ const char *gMusicTable[42] = {
"WHITE"
};
MusicID gMusicNo;
unsigned int gOldPos;
MusicID gOldNo;
MusicID gMusicNo;
void ChangeMusic(MusicID no)
{

View file

@ -2,7 +2,7 @@
#include "WindowsWrapper.h"
enum MusicID
typedef enum MusicID
{
MUS_SILENCE = 0x0,
MUS_MISCHIEVOUS_ROBOT = 0x1,
@ -46,9 +46,9 @@ enum MusicID
MUS_SEAL_CHAMBER = 0x27,
MUS_TOROKOS_THEME = 0x28,
MUS_WHITE = 0x29
};
} MusicID;
struct STAGE_TABLE
typedef struct STAGE_TABLE
{
char parts[0x20];
char map[0x20];
@ -58,7 +58,7 @@ struct STAGE_TABLE
char boss[0x20];
signed char boss_no;
char name[0x20];
};
} STAGE_TABLE;
extern int gStageNo;
extern MusicID gMusicNo;

View file

@ -1,13 +1,5 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
void InitStar(void);
void ActStar(void);
void PutStar(int fx, int fy);
#ifdef __cplusplus
}
#endif

View file

@ -1,6 +1,4 @@
#pragma once
#include "WindowsWrapper.h"
extern char gModulePath[MAX_PATH];
extern char gDataPath[MAX_PATH];
// Apparently this used to contain a bunch of structs?
// For now, the structs are in header files matching their purpose.

View file

@ -32,7 +32,6 @@
#include "SelStage.h"
#include "Sound.h"
#include "Stage.h"
#include "Tags.h"
#define TSC_BUFFER_SIZE 0x5000
@ -42,7 +41,6 @@
TEXT_SCRIPT gTS;
int gNumberTextScript[4];
char text[4][0x40];
RECT gRect_line = {0, 0, 216, 16};
@ -89,6 +87,7 @@ void EndTextScript(void)
// Release buffers
ReleaseSurface(SURFACE_ID_TEXT_BOX);
for (i = 0; i < 4; ++i)
ReleaseSurface((SurfaceID)(SURFACE_ID_TEXT_LINE1 + i));
}
@ -96,12 +95,14 @@ void EndTextScript(void)
// Decrypt .tsc
void EncryptionBinaryData2(unsigned char *pData, long size)
{
int val1;
int work;
int i;
int work;
int half;
int val1;
half = size / 2;
if (pData[half] == 0)
val1 = -7;
else
@ -120,8 +121,10 @@ void EncryptionBinaryData2(unsigned char *pData, long size)
// Load generic .tsc
BOOL LoadTextScript2(const char *name)
{
// Get path
FILE *fp;
char path[MAX_PATH];
// Get path
sprintf(path, "%s/%s", gDataPath, name);
gTS.size = GetFileSizeLong(path);
@ -129,7 +132,7 @@ BOOL LoadTextScript2(const char *name)
return FALSE;
// Open file
FILE *fp = fopen(path, "rb");
fp = fopen(path, "rb");
if (fp == NULL)
return FALSE;
@ -150,15 +153,19 @@ BOOL LoadTextScript2(const char *name)
// Load stage .tsc
BOOL LoadTextScript_Stage(const char *name)
{
// Open Head.tsc
FILE *fp;
char path[MAX_PATH];
long head_size;
long body_size;
// Open Head.tsc
sprintf(path, "%s/%s", gDataPath, "Head.tsc");
long head_size = GetFileSizeLong(path);
head_size = GetFileSizeLong(path);
if (head_size == -1)
return FALSE;
FILE *fp = fopen(path, "rb");
fp = fopen(path, "rb");
if (fp == NULL)
return FALSE;
@ -171,7 +178,7 @@ BOOL LoadTextScript_Stage(const char *name)
// Open stage's .tsc
sprintf(path, "%s/%s", gDataPath, name);
long body_size = GetFileSizeLong(path);
body_size = GetFileSizeLong(path);
if (body_size == -1)
return FALSE;
@ -295,6 +302,7 @@ BOOL JumpTextScript(int no)
// Find where event starts
gTS.p_read = 0;
while(1)
{
// Check if we are still in the proper range
@ -319,6 +327,7 @@ BOOL JumpTextScript(int no)
// Advance until new-line
while (gTS.data[gTS.p_read] != '\n')
++gTS.p_read;
++gTS.p_read;
return TRUE;
@ -346,15 +355,17 @@ void CheckNewLine(void)
}
}
int gNumberTextScript[4];
// Type a number into the text buffer
void SetNumberTextScript(int index)
{
char str[5];
BOOL bZero;
int a;
int b;
int i;
BOOL bZero;
int offset;
char str[5];
int i;
// Get digit table
int table[3];
@ -424,15 +435,7 @@ void ClearTextLine(void)
// Draw textbox and whatever else
void PutTextScript(void)
{
RECT rcFace;
RECT rcItemBox1;
RECT rcItemBox2;
RECT rcItemBox3;
RECT rcItemBox4;
RECT rcItemBox5;
int i;
RECT rect_yesno;
RECT rect_cur;
RECT rect;
int text_offset;
@ -468,6 +471,7 @@ void PutTextScript(void)
}
// Draw face picture
RECT rcFace;
rcFace.left = (gTS.face % 6) * 48;
rcFace.top = (gTS.face / 6) * 48;
rcFace.right = rcFace.left + 48;
@ -517,11 +521,11 @@ void PutTextScript(void)
}
// Draw GIT
SET_RECT(rcItemBox1, 0, 0, 72, 16)
SET_RECT(rcItemBox2, 0, 8, 72, 24)
SET_RECT(rcItemBox3, 240, 0, 244, 8)
SET_RECT(rcItemBox4, 240, 8, 244, 16)
SET_RECT(rcItemBox5, 240, 16, 244, 24)
RECT rcItemBox1 = {0, 0, 72, 16};
RECT rcItemBox2 = {0, 8, 72, 24};
RECT rcItemBox3 = {240, 0, 244, 8};
RECT rcItemBox4 = {240, 8, 244, 16};
RECT rcItemBox5 = {240, 16, 244, 24};
if (gTS.item != 0)
{
@ -554,8 +558,8 @@ void PutTextScript(void)
}
// Draw Yes / No selection
SET_RECT(rect_yesno, 152, 48, 244, 80)
SET_RECT(rect_cur, 112, 88, 128, 104)
RECT rect_yesno = {152, 48, 244, 80};
RECT rect_cur = {112, 88, 128, 104};
if (gTS.mode == 6)
{
@ -573,11 +577,12 @@ void PutTextScript(void)
// Parse TSC
int TextScriptProc(void)
{
BOOL bExit;
char c[3];
int w, x, y, z;
int i;
char c[3];
char str[72];
int w, x, y, z;
BOOL bExit;
RECT rcSymbol = {64, 48, 72, 56};

View file

@ -2,7 +2,7 @@
#include "WindowsWrapper.h"
struct TEXT_SCRIPT
typedef struct TEXT_SCRIPT
{
// Path (reload when exit teleporter menu/inventory)
char path[MAX_PATH];
@ -51,7 +51,7 @@ struct TEXT_SCRIPT
// NOD cursor blink
unsigned char wait_beam;
};
} TEXT_SCRIPT;
BOOL InitTextScript2(void);
void EndTextScript(void);

View file

@ -1,3 +0,0 @@
#pragma once
//This was originally some sort of POSIX standard thing? leftover from the Linux port

View file

@ -1,9 +1,10 @@
#include "ValueView.h"
#include <string.h>
#include "WindowsWrapper.h"
#include "Draw.h"
#include "ValueView.h"
#define VALUEVIEW_MAX 0x10
@ -26,6 +27,9 @@ void SetValueView(int *px, int *py, int value)
int fig[4];
BOOL sw;
int i;
RECT rect[20];
RECT rcPlus;
RECT rcMinus;
for (i = 0; i < VALUEVIEW_MAX; ++i)
{
@ -91,28 +95,26 @@ void SetValueView(int *px, int *py, int value)
gVV[index].rect.right = 40;
gVV[index].rect.bottom = 8 * (index + 1);
RECT rect[20] = {
{0, 56, 8, 64},
{8, 56, 16, 64},
{16, 56, 24, 64},
{24, 56, 32, 64},
{32, 56, 40, 64},
{40, 56, 48, 64},
{48, 56, 56, 64},
{56, 56, 64, 64},
{64, 56, 72, 64},
{72, 56, 80, 64},
{0, 64, 8, 72},
{8, 64, 16, 72},
{16, 64, 24, 72},
{24, 64, 32, 72},
{32, 64, 40, 72},
{40, 64, 48, 72},
{48, 64, 56, 72},
{56, 64, 64, 72},
{64, 64, 72, 72},
{72, 64, 80, 72},
};
SET_RECT(rect[0], 0, 56, 8, 64);
SET_RECT(rect[1], 8, 56, 16, 64);
SET_RECT(rect[2], 16, 56, 24, 64);
SET_RECT(rect[3], 24, 56, 32, 64);
SET_RECT(rect[4], 32, 56, 40, 64);
SET_RECT(rect[5], 40, 56, 48, 64);
SET_RECT(rect[6], 48, 56, 56, 64);
SET_RECT(rect[7], 56, 56, 64, 64);
SET_RECT(rect[8], 64, 56, 72, 64);
SET_RECT(rect[9], 72, 56, 80, 64);
SET_RECT(rect[10], 0, 64, 8, 72);
SET_RECT(rect[11], 8, 64, 16, 72);
SET_RECT(rect[12], 16, 64, 24, 72);
SET_RECT(rect[13], 24, 64, 32, 72);
SET_RECT(rect[14], 32, 64, 40, 72);
SET_RECT(rect[15], 40, 64, 48, 72);
SET_RECT(rect[16], 48, 64, 56, 72);
SET_RECT(rect[17], 56, 64, 64, 72);
SET_RECT(rect[18], 64, 64, 72, 72);
SET_RECT(rect[19], 72, 64, 80, 72);
// Get digits
dig[0] = 1;
@ -133,8 +135,8 @@ void SetValueView(int *px, int *py, int value)
sw = FALSE;
RECT rcPlus = {32, 48, 40, 56};
RECT rcMinus = {40, 48, 48, 56};
SET_RECT(rcPlus, 32, 48, 40, 56);
SET_RECT(rcMinus, 40, 48, 48, 56);
// Draw value
CortBox2(&gVV[index].rect, 0x000000, SURFACE_ID_VALUE_VIEW);

View file

@ -2,7 +2,7 @@
#include "WindowsWrapper.h"
struct VALUEVIEW
typedef struct VALUEVIEW
{
BOOL flag;
int *px;
@ -11,7 +11,7 @@ struct VALUEVIEW
int value;
int count;
RECT rect;
};
} VALUEVIEW;
void ClearValueView(void);
void SetValueView(int *px, int *py, int value);