commit
eaf7b08f27
7 changed files with 71 additions and 45 deletions
28
Makefile
28
Makefile
|
@ -1,22 +1,20 @@
|
||||||
RELEASE = 0
|
RELEASE = 0
|
||||||
|
|
||||||
|
ifeq ($(RELEASE), 0)
|
||||||
|
CXXFLAGS := -O0 -g -static -mconsole
|
||||||
|
FILENAME := debug
|
||||||
|
else
|
||||||
|
CXXFLAGS := -O3 -s -static
|
||||||
|
FILENAME := release
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(JAPANESE), 1)
|
ifeq ($(JAPANESE), 1)
|
||||||
|
CXXFLAGS += -DJAPANESE
|
||||||
ifeq ($(RELEASE), 0)
|
ifeq ($(RELEASE), 0)
|
||||||
CXXFLAGS := -DJAPANESE -O0 -g -static -mconsole
|
|
||||||
FILENAME := debugjp
|
FILENAME := debugjp
|
||||||
else
|
else
|
||||||
CXXFLAGS := -DJAPANESE -O3 -s -static
|
|
||||||
FILENAME := releasejp
|
FILENAME := releasejp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
else
|
|
||||||
ifeq ($(RELEASE), 0)
|
|
||||||
CXXFLAGS := -O0 -g -static -mconsole
|
|
||||||
FILENAME := debug
|
|
||||||
else
|
|
||||||
CXXFLAGS := -O3 -s -static
|
|
||||||
FILENAME := release
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(FIX_BUGS), 1)
|
ifeq ($(FIX_BUGS), 1)
|
||||||
|
@ -76,8 +74,6 @@ RESOURCES = \
|
||||||
BITMAP/CREDIT16.bmp \
|
BITMAP/CREDIT16.bmp \
|
||||||
BITMAP/CREDIT17.bmp \
|
BITMAP/CREDIT17.bmp \
|
||||||
BITMAP/CREDIT18.bmp \
|
BITMAP/CREDIT18.bmp \
|
||||||
BITMAP/PIXEL.bmp \
|
|
||||||
BITMAP/PIXEL_JP.bmp \
|
|
||||||
ICON/4.bmp \
|
ICON/4.bmp \
|
||||||
ORG/ACCESS \
|
ORG/ACCESS \
|
||||||
ORG/ANZEN \
|
ORG/ANZEN \
|
||||||
|
@ -123,6 +119,12 @@ RESOURCES = \
|
||||||
ORG/ZONBIE \
|
ORG/ZONBIE \
|
||||||
WAVE/WAVE100
|
WAVE/WAVE100
|
||||||
|
|
||||||
|
ifeq ($(JAPANESE), 1)
|
||||||
|
RESOURCES += BITMAP/PIXEL_JP.bmp
|
||||||
|
else
|
||||||
|
RESOURCES += BITMAP/PIXEL.bmp
|
||||||
|
endif
|
||||||
|
|
||||||
OBJECTS = $(addprefix obj/$(FILENAME)/, $(addsuffix .o, $(SOURCES)))
|
OBJECTS = $(addprefix obj/$(FILENAME)/, $(addsuffix .o, $(SOURCES)))
|
||||||
|
|
||||||
all: build/$(FILENAME).exe
|
all: build/$(FILENAME).exe
|
||||||
|
|
|
@ -316,7 +316,7 @@ void Surface2Surface(int x, int y, RECT *rect, int to, int from)
|
||||||
//Target surface
|
//Target surface
|
||||||
if (!surf[to].texture)
|
if (!surf[to].texture)
|
||||||
{
|
{
|
||||||
printf("Tried to draw to surface %s, which doesn't exist\n", to);
|
printf("Tried to draw to surface %d, which doesn't exist\n", to);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ void CortBox2(RECT *rect, uint32_t col, int surf_no)
|
||||||
//Target surface
|
//Target surface
|
||||||
if (!surf[surf_no].texture)
|
if (!surf[surf_no].texture)
|
||||||
{
|
{
|
||||||
printf("Tried to draw a rectangle to surface %s, which doesn't exist\n", surf_no);
|
printf("Tried to draw a rectangle to surface %d, which doesn't exist\n", surf_no);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ void PutIllust()
|
||||||
void ReloadIllust(int a)
|
void ReloadIllust(int a)
|
||||||
{
|
{
|
||||||
char name[16];
|
char name[16];
|
||||||
sprintf(name, "CREDIT%02ld", a);
|
sprintf(name, "CREDIT%02d", a);
|
||||||
ReloadBitmap_Resource(name, SURFACE_ID_CREDITS_IMAGE);
|
ReloadBitmap_Resource(name, SURFACE_ID_CREDITS_IMAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
60
src/Font.cpp
60
src/Font.cpp
|
@ -4,7 +4,9 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifdef JAPANESE
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
#include FT_FREETYPE_H
|
#include FT_FREETYPE_H
|
||||||
|
@ -38,25 +40,47 @@ static unsigned long UTF8ToCode(const unsigned char *string, unsigned int *bytes
|
||||||
unsigned int length;
|
unsigned int length;
|
||||||
unsigned long charcode;
|
unsigned long charcode;
|
||||||
|
|
||||||
if ((string[0] & 0x80) == 0)
|
unsigned int zero_bit = 0;
|
||||||
|
for (unsigned char lead_byte = string[0]; zero_bit < 5 && (lead_byte & 0x80); ++zero_bit, lead_byte <<= 1);
|
||||||
|
|
||||||
|
switch (zero_bit)
|
||||||
{
|
{
|
||||||
length = 1;
|
case 0:
|
||||||
charcode = string[0] & 0x7F;
|
// Single-byte character
|
||||||
}
|
length = 1;
|
||||||
else if ((string[0] & 0xE0) == 0xC0)
|
charcode = string[0];
|
||||||
{
|
break;
|
||||||
length = 2;
|
|
||||||
charcode = ((string[0] & ~0xE0) << 6) | (string[1] & 0x3F);
|
case 2:
|
||||||
}
|
case 3:
|
||||||
else if ((string[0] & 0xF0) == 0xE0)
|
case 4:
|
||||||
{
|
length = zero_bit;
|
||||||
length = 3;
|
charcode = string[0] & (1 << (8 - zero_bit)) - 1;
|
||||||
charcode = ((string[0] & ~0xF0) << (6 * 2)) | ((string[1] & 0x3F) << 6) | (string[2] & 0x3F);
|
|
||||||
}
|
for (unsigned int i = 1; i < zero_bit; ++i)
|
||||||
else //if (string[0] & 0xF8 == 0xF0)
|
{
|
||||||
{
|
if ((string[i] & 0xC0) == 0x80)
|
||||||
length = 4;
|
{
|
||||||
charcode = ((string[0] & ~0xF8) << (6 * 3)) | ((string[1] & 0x3F) << (6 * 2)) | ((string[2] & 0x3F) << 6) | (string[3] & 0x3F);
|
charcode <<= 6;
|
||||||
|
charcode |= string[i] & ~0xC0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Error: Invalid continuation byte
|
||||||
|
length = 1;
|
||||||
|
charcode = 0xFFFD;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Error: Invalid lead byte
|
||||||
|
length = 1;
|
||||||
|
charcode = 0xFFFD;
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bytes_read)
|
if (bytes_read)
|
||||||
|
|
|
@ -3,11 +3,7 @@
|
||||||
|
|
||||||
bool LoadGenericData()
|
bool LoadGenericData()
|
||||||
{
|
{
|
||||||
#ifdef JAPANESE
|
|
||||||
MakeSurface_Resource("PIXEL_JP", 1);
|
|
||||||
#else
|
|
||||||
MakeSurface_Resource("PIXEL", 1);
|
MakeSurface_Resource("PIXEL", 1);
|
||||||
#endif
|
|
||||||
|
|
||||||
bool bError = false;
|
bool bError = false;
|
||||||
if (!MakeSurface_File("MyChar", 16))
|
if (!MakeSurface_File("MyChar", 16))
|
||||||
|
|
|
@ -64,8 +64,11 @@
|
||||||
#include "Resource/BITMAP/CREDIT16.bmp.h"
|
#include "Resource/BITMAP/CREDIT16.bmp.h"
|
||||||
#include "Resource/BITMAP/CREDIT17.bmp.h"
|
#include "Resource/BITMAP/CREDIT17.bmp.h"
|
||||||
#include "Resource/BITMAP/CREDIT18.bmp.h"
|
#include "Resource/BITMAP/CREDIT18.bmp.h"
|
||||||
#include "Resource/BITMAP/PIXEL.bmp.h"
|
#ifdef JAPANESE
|
||||||
#include "Resource/BITMAP/PIXEL_JP.bmp.h"
|
#include "Resource/BITMAP/PIXEL_JP.bmp.h"
|
||||||
|
#else
|
||||||
|
#include "Resource/BITMAP/PIXEL.bmp.h"
|
||||||
|
#endif
|
||||||
#include "Resource/ICON/4.bmp.h"
|
#include "Resource/ICON/4.bmp.h"
|
||||||
|
|
||||||
const unsigned char* GetResource(const char *name, size_t *size)
|
const unsigned char* GetResource(const char *name, size_t *size)
|
||||||
|
@ -377,13 +380,13 @@ const unsigned char* GetResource(const char *name, size_t *size)
|
||||||
}
|
}
|
||||||
if (!strcmp(name, "PIXEL"))
|
if (!strcmp(name, "PIXEL"))
|
||||||
{
|
{
|
||||||
*size = sizeof(rPIXEL);
|
#ifdef JAPANESE
|
||||||
return rPIXEL;
|
|
||||||
}
|
|
||||||
if (!strcmp(name, "PIXEL_JP"))
|
|
||||||
{
|
|
||||||
*size = sizeof(rPIXEL_JP);
|
*size = sizeof(rPIXEL_JP);
|
||||||
return rPIXEL_JP;
|
return rPIXEL_JP;
|
||||||
|
#else
|
||||||
|
*size = sizeof(rPIXEL);
|
||||||
|
return rPIXEL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//ICON
|
//ICON
|
||||||
|
|
|
@ -31,6 +31,7 @@ SOUNDBUFFER::SOUNDBUFFER(size_t bufSize)
|
||||||
|
|
||||||
playing = false;
|
playing = false;
|
||||||
looping = false;
|
looping = false;
|
||||||
|
looped = false;
|
||||||
|
|
||||||
frequency = 0.0;
|
frequency = 0.0;
|
||||||
volume = 1.0;
|
volume = 1.0;
|
||||||
|
@ -274,7 +275,7 @@ bool InitDirectSound()
|
||||||
uint8_t *buf = nullptr;
|
uint8_t *buf = nullptr;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
for (size_t n = 0; n < SOUND_NO; n++)
|
for (unsigned int n = 0; n < SOUND_NO; n++)
|
||||||
{
|
{
|
||||||
sprintf(path, "%2.2X.pxt", n);
|
sprintf(path, "%2.2X.pxt", n);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue