Merge pull request #4 from GabrielRavier/autoNormalizeLineEndings
Automatically normalize line endings
This commit is contained in:
commit
b83365f09b
10 changed files with 1095 additions and 1085 deletions
10
.gitattributes
vendored
Normal file
10
.gitattributes
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
# Automatically normalize line endings.
|
||||
* text=auto
|
||||
|
||||
# MSVC files have to be CRLF
|
||||
*.vcproj text eol=crlf
|
||||
*.sln text eol=crlf
|
||||
|
||||
# Do not change external files
|
||||
external/** -text
|
||||
DoConfig/fltk/** -text
|
486
Makefile
486
Makefile
|
@ -1,243 +1,243 @@
|
|||
ifeq ($(RELEASE), 1)
|
||||
CXXFLAGS = -O3 -flto
|
||||
LDFLAGS = -s
|
||||
FILENAME_DEF = release
|
||||
else
|
||||
CXXFLAGS = -O0 -g
|
||||
FILENAME_DEF = debug
|
||||
endif
|
||||
|
||||
ifeq ($(JAPANESE), 1)
|
||||
BUILD_DIR = build_jp
|
||||
|
||||
CXXFLAGS += -DJAPANESE
|
||||
|
||||
ifeq ($(RELEASE), 1)
|
||||
FILENAME_DEF = releasejp
|
||||
else
|
||||
FILENAME_DEF = debugjp
|
||||
endif
|
||||
else
|
||||
BUILD_DIR = build_en
|
||||
endif
|
||||
|
||||
FILENAME ?= $(FILENAME_DEF)
|
||||
|
||||
ifeq ($(FIX_BUGS), 1)
|
||||
CXXFLAGS += -DFIX_BUGS
|
||||
endif
|
||||
|
||||
ifeq ($(WINDOWS), 1)
|
||||
ifeq ($(CONSOLE), 1)
|
||||
CXXFLAGS += -mconsole
|
||||
endif
|
||||
|
||||
CXXFLAGS += -DWINDOWS
|
||||
LIBS += -lkernel32
|
||||
endif
|
||||
|
||||
ifeq ($(RASPBERRY_PI), 1)
|
||||
CXXFLAGS += -DRASPBERRY_PI
|
||||
endif
|
||||
|
||||
CXXFLAGS += -std=c++98 `pkg-config sdl2 --cflags` `pkg-config freetype2 --cflags` -MMD -MP -MF $@.d
|
||||
|
||||
ifeq ($(STATIC), 1)
|
||||
LDFLAGS += -static
|
||||
LIBS += `pkg-config sdl2 --libs --static` `pkg-config freetype2 --libs --static` -lfreetype
|
||||
else
|
||||
LIBS += `pkg-config sdl2 --libs` `pkg-config freetype2 --libs`
|
||||
endif
|
||||
|
||||
# For an accurate result to the original's code, compile in alphabetical order
|
||||
SOURCES = \
|
||||
ArmsItem \
|
||||
Back \
|
||||
Boss \
|
||||
BossAlmo1 \
|
||||
BossAlmo2 \
|
||||
BossBallos \
|
||||
BossFrog \
|
||||
BossIronH \
|
||||
BossLife \
|
||||
BossOhm \
|
||||
BossPress \
|
||||
BossTwinD \
|
||||
BossX \
|
||||
BulHit \
|
||||
Bullet \
|
||||
Caret \
|
||||
Config \
|
||||
Draw \
|
||||
Ending \
|
||||
Escape \
|
||||
Fade \
|
||||
File \
|
||||
Flags \
|
||||
Flash \
|
||||
Font \
|
||||
Frame \
|
||||
Game \
|
||||
Generic \
|
||||
GenericLoad \
|
||||
Input \
|
||||
KeyControl \
|
||||
Main \
|
||||
Map \
|
||||
MapName \
|
||||
MiniMap \
|
||||
MyChar \
|
||||
MycHit \
|
||||
MycParam \
|
||||
NpcAct000 \
|
||||
NpcAct020 \
|
||||
NpcAct040 \
|
||||
NpcAct060 \
|
||||
NpcAct080 \
|
||||
NpcAct100 \
|
||||
NpcAct120 \
|
||||
NpcAct140 \
|
||||
NpcAct160 \
|
||||
NpcAct180 \
|
||||
NpcAct200 \
|
||||
NpcAct220 \
|
||||
NpcAct240 \
|
||||
NpcAct260 \
|
||||
NpcAct280 \
|
||||
NpcAct300 \
|
||||
NpcAct320 \
|
||||
NpcAct340 \
|
||||
NpChar \
|
||||
NpcHit \
|
||||
NpcTbl \
|
||||
Organya \
|
||||
PixTone \
|
||||
Profile \
|
||||
Resource \
|
||||
SelStage \
|
||||
Shoot \
|
||||
Sound \
|
||||
Stage \
|
||||
Star \
|
||||
TextScr \
|
||||
Triangle \
|
||||
ValueView
|
||||
|
||||
RESOURCES = \
|
||||
BITMAP/CREDIT01.bmp \
|
||||
BITMAP/CREDIT02.bmp \
|
||||
BITMAP/CREDIT03.bmp \
|
||||
BITMAP/CREDIT04.bmp \
|
||||
BITMAP/CREDIT05.bmp \
|
||||
BITMAP/CREDIT06.bmp \
|
||||
BITMAP/CREDIT07.bmp \
|
||||
BITMAP/CREDIT08.bmp \
|
||||
BITMAP/CREDIT09.bmp \
|
||||
BITMAP/CREDIT10.bmp \
|
||||
BITMAP/CREDIT11.bmp \
|
||||
BITMAP/CREDIT12.bmp \
|
||||
BITMAP/CREDIT14.bmp \
|
||||
BITMAP/CREDIT15.bmp \
|
||||
BITMAP/CREDIT16.bmp \
|
||||
BITMAP/CREDIT17.bmp \
|
||||
BITMAP/CREDIT18.bmp \
|
||||
CURSOR/CURSOR_IKA.bmp \
|
||||
CURSOR/CURSOR_NORMAL.bmp \
|
||||
ORG/ACCESS.org \
|
||||
ORG/ANZEN.org \
|
||||
ORG/BALCONY.org \
|
||||
ORG/BALLOS.org \
|
||||
ORG/BDOWN.org \
|
||||
ORG/CEMETERY.org \
|
||||
ORG/CURLY.org \
|
||||
ORG/DR.org \
|
||||
ORG/ENDING.org \
|
||||
ORG/ESCAPE.org \
|
||||
ORG/FANFALE1.org \
|
||||
ORG/FANFALE2.org \
|
||||
ORG/FANFALE3.org \
|
||||
ORG/FIREEYE.org \
|
||||
ORG/GAMEOVER.org \
|
||||
ORG/GINSUKE.org \
|
||||
ORG/GRAND.org \
|
||||
ORG/GRAVITY.org \
|
||||
ORG/HELL.org \
|
||||
ORG/IRONH.org \
|
||||
ORG/JENKA.org \
|
||||
ORG/JENKA2.org \
|
||||
ORG/KODOU.org \
|
||||
ORG/LASTBT3.org \
|
||||
ORG/LASTBTL.org \
|
||||
ORG/LASTCAVE.org \
|
||||
ORG/MARINE.org \
|
||||
ORG/MAZE.org \
|
||||
ORG/MDOWN2.org \
|
||||
ORG/MURA.org \
|
||||
ORG/OSIDE.org \
|
||||
ORG/PLANT.org \
|
||||
ORG/QUIET.org \
|
||||
ORG/REQUIEM.org \
|
||||
ORG/TOROKO.org \
|
||||
ORG/VIVI.org \
|
||||
ORG/WANPAK2.org \
|
||||
ORG/WANPAKU.org \
|
||||
ORG/WEED.org \
|
||||
ORG/WHITE.org \
|
||||
ORG/XXXX.org \
|
||||
ORG/ZONBIE.org \
|
||||
WAVE/WAVE100
|
||||
|
||||
ifeq ($(JAPANESE), 1)
|
||||
RESOURCES += BITMAP/PIXEL_JP.bmp
|
||||
else
|
||||
RESOURCES += BITMAP/PIXEL.bmp
|
||||
endif
|
||||
|
||||
ifneq ($(WINDOWS), 1)
|
||||
RESOURCES += ICON/ICON_MINI.bmp
|
||||
endif
|
||||
|
||||
OBJECTS = $(addprefix obj/$(FILENAME)/, $(addsuffix .o, $(SOURCES)))
|
||||
DEPENDENCIES = $(addprefix obj/$(FILENAME)/, $(addsuffix .o.d, $(SOURCES)))
|
||||
|
||||
ifeq ($(WINDOWS), 1)
|
||||
OBJECTS += obj/$(FILENAME)/win_icon.o
|
||||
endif
|
||||
|
||||
all: $(BUILD_DIR)/$(FILENAME)
|
||||
|
||||
$(BUILD_DIR)/$(FILENAME): $(OBJECTS)
|
||||
@mkdir -p $(@D)
|
||||
@echo Linking
|
||||
@$(CXX) $(CXXFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS)
|
||||
@echo Finished compiling: $@
|
||||
|
||||
obj/$(FILENAME)/%.o: src/%.cpp
|
||||
@mkdir -p $(@D)
|
||||
@echo Compiling $<
|
||||
@$(CXX) $(CXXFLAGS) $< -o $@ -c
|
||||
|
||||
obj/$(FILENAME)/Resource.o: src/Resource.cpp $(addprefix src/Resource/, $(addsuffix .h, $(RESOURCES)))
|
||||
@mkdir -p $(@D)
|
||||
@echo Compiling $<
|
||||
@$(CXX) $(CXXFLAGS) $< -o $@ -c
|
||||
|
||||
src/Resource/%.h: res/% obj/bin2h
|
||||
@mkdir -p $(@D)
|
||||
@echo Converting $<
|
||||
@obj/bin2h $< $@
|
||||
|
||||
obj/bin2h: src/misc/bin2h.c
|
||||
@mkdir -p $(@D)
|
||||
@echo Compiling $^
|
||||
@$(CC) -O3 -s -std=c90 $^ -o $@
|
||||
|
||||
include $(wildcard $(DEPENDENCIES))
|
||||
|
||||
obj/$(FILENAME)/win_icon.o: res/ICON/ICON.rc res/ICON/0.ico res/ICON/ICON_MINI.ico
|
||||
@mkdir -p $(@D)
|
||||
@windres $< $@
|
||||
|
||||
# TODO
|
||||
clean:
|
||||
@rm -rf obj
|
||||
ifeq ($(RELEASE), 1)
|
||||
CXXFLAGS = -O3 -flto
|
||||
LDFLAGS = -s
|
||||
FILENAME_DEF = release
|
||||
else
|
||||
CXXFLAGS = -O0 -g
|
||||
FILENAME_DEF = debug
|
||||
endif
|
||||
|
||||
ifeq ($(JAPANESE), 1)
|
||||
BUILD_DIR = build_jp
|
||||
|
||||
CXXFLAGS += -DJAPANESE
|
||||
|
||||
ifeq ($(RELEASE), 1)
|
||||
FILENAME_DEF = releasejp
|
||||
else
|
||||
FILENAME_DEF = debugjp
|
||||
endif
|
||||
else
|
||||
BUILD_DIR = build_en
|
||||
endif
|
||||
|
||||
FILENAME ?= $(FILENAME_DEF)
|
||||
|
||||
ifeq ($(FIX_BUGS), 1)
|
||||
CXXFLAGS += -DFIX_BUGS
|
||||
endif
|
||||
|
||||
ifeq ($(WINDOWS), 1)
|
||||
ifeq ($(CONSOLE), 1)
|
||||
CXXFLAGS += -mconsole
|
||||
endif
|
||||
|
||||
CXXFLAGS += -DWINDOWS
|
||||
LIBS += -lkernel32
|
||||
endif
|
||||
|
||||
ifeq ($(RASPBERRY_PI), 1)
|
||||
CXXFLAGS += -DRASPBERRY_PI
|
||||
endif
|
||||
|
||||
CXXFLAGS += -std=c++98 `pkg-config sdl2 --cflags` `pkg-config freetype2 --cflags` -MMD -MP -MF $@.d
|
||||
|
||||
ifeq ($(STATIC), 1)
|
||||
LDFLAGS += -static
|
||||
LIBS += `pkg-config sdl2 --libs --static` `pkg-config freetype2 --libs --static` -lfreetype
|
||||
else
|
||||
LIBS += `pkg-config sdl2 --libs` `pkg-config freetype2 --libs`
|
||||
endif
|
||||
|
||||
# For an accurate result to the original's code, compile in alphabetical order
|
||||
SOURCES = \
|
||||
ArmsItem \
|
||||
Back \
|
||||
Boss \
|
||||
BossAlmo1 \
|
||||
BossAlmo2 \
|
||||
BossBallos \
|
||||
BossFrog \
|
||||
BossIronH \
|
||||
BossLife \
|
||||
BossOhm \
|
||||
BossPress \
|
||||
BossTwinD \
|
||||
BossX \
|
||||
BulHit \
|
||||
Bullet \
|
||||
Caret \
|
||||
Config \
|
||||
Draw \
|
||||
Ending \
|
||||
Escape \
|
||||
Fade \
|
||||
File \
|
||||
Flags \
|
||||
Flash \
|
||||
Font \
|
||||
Frame \
|
||||
Game \
|
||||
Generic \
|
||||
GenericLoad \
|
||||
Input \
|
||||
KeyControl \
|
||||
Main \
|
||||
Map \
|
||||
MapName \
|
||||
MiniMap \
|
||||
MyChar \
|
||||
MycHit \
|
||||
MycParam \
|
||||
NpcAct000 \
|
||||
NpcAct020 \
|
||||
NpcAct040 \
|
||||
NpcAct060 \
|
||||
NpcAct080 \
|
||||
NpcAct100 \
|
||||
NpcAct120 \
|
||||
NpcAct140 \
|
||||
NpcAct160 \
|
||||
NpcAct180 \
|
||||
NpcAct200 \
|
||||
NpcAct220 \
|
||||
NpcAct240 \
|
||||
NpcAct260 \
|
||||
NpcAct280 \
|
||||
NpcAct300 \
|
||||
NpcAct320 \
|
||||
NpcAct340 \
|
||||
NpChar \
|
||||
NpcHit \
|
||||
NpcTbl \
|
||||
Organya \
|
||||
PixTone \
|
||||
Profile \
|
||||
Resource \
|
||||
SelStage \
|
||||
Shoot \
|
||||
Sound \
|
||||
Stage \
|
||||
Star \
|
||||
TextScr \
|
||||
Triangle \
|
||||
ValueView
|
||||
|
||||
RESOURCES = \
|
||||
BITMAP/CREDIT01.bmp \
|
||||
BITMAP/CREDIT02.bmp \
|
||||
BITMAP/CREDIT03.bmp \
|
||||
BITMAP/CREDIT04.bmp \
|
||||
BITMAP/CREDIT05.bmp \
|
||||
BITMAP/CREDIT06.bmp \
|
||||
BITMAP/CREDIT07.bmp \
|
||||
BITMAP/CREDIT08.bmp \
|
||||
BITMAP/CREDIT09.bmp \
|
||||
BITMAP/CREDIT10.bmp \
|
||||
BITMAP/CREDIT11.bmp \
|
||||
BITMAP/CREDIT12.bmp \
|
||||
BITMAP/CREDIT14.bmp \
|
||||
BITMAP/CREDIT15.bmp \
|
||||
BITMAP/CREDIT16.bmp \
|
||||
BITMAP/CREDIT17.bmp \
|
||||
BITMAP/CREDIT18.bmp \
|
||||
CURSOR/CURSOR_IKA.bmp \
|
||||
CURSOR/CURSOR_NORMAL.bmp \
|
||||
ORG/ACCESS.org \
|
||||
ORG/ANZEN.org \
|
||||
ORG/BALCONY.org \
|
||||
ORG/BALLOS.org \
|
||||
ORG/BDOWN.org \
|
||||
ORG/CEMETERY.org \
|
||||
ORG/CURLY.org \
|
||||
ORG/DR.org \
|
||||
ORG/ENDING.org \
|
||||
ORG/ESCAPE.org \
|
||||
ORG/FANFALE1.org \
|
||||
ORG/FANFALE2.org \
|
||||
ORG/FANFALE3.org \
|
||||
ORG/FIREEYE.org \
|
||||
ORG/GAMEOVER.org \
|
||||
ORG/GINSUKE.org \
|
||||
ORG/GRAND.org \
|
||||
ORG/GRAVITY.org \
|
||||
ORG/HELL.org \
|
||||
ORG/IRONH.org \
|
||||
ORG/JENKA.org \
|
||||
ORG/JENKA2.org \
|
||||
ORG/KODOU.org \
|
||||
ORG/LASTBT3.org \
|
||||
ORG/LASTBTL.org \
|
||||
ORG/LASTCAVE.org \
|
||||
ORG/MARINE.org \
|
||||
ORG/MAZE.org \
|
||||
ORG/MDOWN2.org \
|
||||
ORG/MURA.org \
|
||||
ORG/OSIDE.org \
|
||||
ORG/PLANT.org \
|
||||
ORG/QUIET.org \
|
||||
ORG/REQUIEM.org \
|
||||
ORG/TOROKO.org \
|
||||
ORG/VIVI.org \
|
||||
ORG/WANPAK2.org \
|
||||
ORG/WANPAKU.org \
|
||||
ORG/WEED.org \
|
||||
ORG/WHITE.org \
|
||||
ORG/XXXX.org \
|
||||
ORG/ZONBIE.org \
|
||||
WAVE/WAVE100
|
||||
|
||||
ifeq ($(JAPANESE), 1)
|
||||
RESOURCES += BITMAP/PIXEL_JP.bmp
|
||||
else
|
||||
RESOURCES += BITMAP/PIXEL.bmp
|
||||
endif
|
||||
|
||||
ifneq ($(WINDOWS), 1)
|
||||
RESOURCES += ICON/ICON_MINI.bmp
|
||||
endif
|
||||
|
||||
OBJECTS = $(addprefix obj/$(FILENAME)/, $(addsuffix .o, $(SOURCES)))
|
||||
DEPENDENCIES = $(addprefix obj/$(FILENAME)/, $(addsuffix .o.d, $(SOURCES)))
|
||||
|
||||
ifeq ($(WINDOWS), 1)
|
||||
OBJECTS += obj/$(FILENAME)/win_icon.o
|
||||
endif
|
||||
|
||||
all: $(BUILD_DIR)/$(FILENAME)
|
||||
|
||||
$(BUILD_DIR)/$(FILENAME): $(OBJECTS)
|
||||
@mkdir -p $(@D)
|
||||
@echo Linking
|
||||
@$(CXX) $(CXXFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS)
|
||||
@echo Finished compiling: $@
|
||||
|
||||
obj/$(FILENAME)/%.o: src/%.cpp
|
||||
@mkdir -p $(@D)
|
||||
@echo Compiling $<
|
||||
@$(CXX) $(CXXFLAGS) $< -o $@ -c
|
||||
|
||||
obj/$(FILENAME)/Resource.o: src/Resource.cpp $(addprefix src/Resource/, $(addsuffix .h, $(RESOURCES)))
|
||||
@mkdir -p $(@D)
|
||||
@echo Compiling $<
|
||||
@$(CXX) $(CXXFLAGS) $< -o $@ -c
|
||||
|
||||
src/Resource/%.h: res/% obj/bin2h
|
||||
@mkdir -p $(@D)
|
||||
@echo Converting $<
|
||||
@obj/bin2h $< $@
|
||||
|
||||
obj/bin2h: src/misc/bin2h.c
|
||||
@mkdir -p $(@D)
|
||||
@echo Compiling $^
|
||||
@$(CC) -O3 -s -std=c90 $^ -o $@
|
||||
|
||||
include $(wildcard $(DEPENDENCIES))
|
||||
|
||||
obj/$(FILENAME)/win_icon.o: res/ICON/ICON.rc res/ICON/0.ico res/ICON/ICON_MINI.ico
|
||||
@mkdir -p $(@D)
|
||||
@windres $< $@
|
||||
|
||||
# TODO
|
||||
clean:
|
||||
@rm -rf obj
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#define PATH_LENGTH 260 //Pixel had the path size locked to 260 (dangerously low), if you tried to open the executable in a path with more than around 220 characters, it'd crash.
|
||||
|
||||
#define WINDOW_WIDTH 320
|
||||
#define WINDOW_HEIGHT 240
|
||||
#pragma once
|
||||
|
||||
#define PATH_LENGTH 260 //Pixel had the path size locked to 260 (dangerously low), if you tried to open the executable in a path with more than around 220 characters, it'd crash.
|
||||
|
||||
#define WINDOW_WIDTH 320
|
||||
#define WINDOW_HEIGHT 240
|
||||
|
|
144
src/Config.cpp
144
src/Config.cpp
|
@ -1,72 +1,72 @@
|
|||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "CommonDefines.h"
|
||||
#include "Config.h"
|
||||
#include "File.h"
|
||||
#include "Tags.h"
|
||||
#include "Types.h"
|
||||
|
||||
bool LoadConfigData(CONFIG *conf)
|
||||
{
|
||||
//Clear old config data
|
||||
memset(conf, 0, sizeof(CONFIG));
|
||||
|
||||
//Get path
|
||||
char path[PATH_LENGTH];
|
||||
sprintf(path, "%s/%s", gModulePath, "Config.dat");
|
||||
|
||||
//Open file
|
||||
FILE *fp = fopen(path, "rb");
|
||||
if (fp == NULL)
|
||||
return false;
|
||||
|
||||
//Read data
|
||||
//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
|
||||
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?
|
||||
conf->display_mode = File_ReadLE32(fp);
|
||||
|
||||
//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);
|
||||
|
||||
//Close file
|
||||
fclose(fp);
|
||||
|
||||
//Check if version is correct, return that it succeeded
|
||||
if (!strcmp(conf->proof, "DOUKUTSU20041206"))
|
||||
return true;
|
||||
|
||||
//If not, return that it failed
|
||||
return false;
|
||||
}
|
||||
|
||||
void DefaultConfigData(CONFIG *conf)
|
||||
{
|
||||
//Claer old config data
|
||||
memset(conf, 0, sizeof(CONFIG));
|
||||
|
||||
//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;
|
||||
conf->joystick_button[2] = 5;
|
||||
conf->joystick_button[3] = 6;
|
||||
conf->joystick_button[4] = 3;
|
||||
conf->joystick_button[5] = 4;
|
||||
conf->joystick_button[6] = 6;
|
||||
conf->joystick_button[7] = 3;
|
||||
}
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "CommonDefines.h"
|
||||
#include "Config.h"
|
||||
#include "File.h"
|
||||
#include "Tags.h"
|
||||
#include "Types.h"
|
||||
|
||||
bool LoadConfigData(CONFIG *conf)
|
||||
{
|
||||
//Clear old config data
|
||||
memset(conf, 0, sizeof(CONFIG));
|
||||
|
||||
//Get path
|
||||
char path[PATH_LENGTH];
|
||||
sprintf(path, "%s/%s", gModulePath, "Config.dat");
|
||||
|
||||
//Open file
|
||||
FILE *fp = fopen(path, "rb");
|
||||
if (fp == NULL)
|
||||
return false;
|
||||
|
||||
//Read data
|
||||
//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
|
||||
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?
|
||||
conf->display_mode = File_ReadLE32(fp);
|
||||
|
||||
//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);
|
||||
|
||||
//Close file
|
||||
fclose(fp);
|
||||
|
||||
//Check if version is correct, return that it succeeded
|
||||
if (!strcmp(conf->proof, "DOUKUTSU20041206"))
|
||||
return true;
|
||||
|
||||
//If not, return that it failed
|
||||
return false;
|
||||
}
|
||||
|
||||
void DefaultConfigData(CONFIG *conf)
|
||||
{
|
||||
//Claer old config data
|
||||
memset(conf, 0, sizeof(CONFIG));
|
||||
|
||||
//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;
|
||||
conf->joystick_button[2] = 5;
|
||||
conf->joystick_button[3] = 6;
|
||||
conf->joystick_button[4] = 3;
|
||||
conf->joystick_button[5] = 4;
|
||||
conf->joystick_button[6] = 6;
|
||||
conf->joystick_button[7] = 3;
|
||||
}
|
||||
|
|
36
src/Config.h
36
src/Config.h
|
@ -1,18 +1,18 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct CONFIG
|
||||
{
|
||||
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];
|
||||
};
|
||||
|
||||
bool LoadConfigData(CONFIG *conf);
|
||||
void DefaultConfigData(CONFIG *conf);
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct CONFIG
|
||||
{
|
||||
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];
|
||||
};
|
||||
|
||||
bool LoadConfigData(CONFIG *conf);
|
||||
void DefaultConfigData(CONFIG *conf);
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
#include "KeyControl.h"
|
||||
|
||||
int gKey;
|
||||
int gKeyTrg;
|
||||
|
||||
int gKeyJump = KEY_Z;
|
||||
int gKeyShot = KEY_X;
|
||||
int gKeyArms = KEY_ARMS;
|
||||
int gKeyArmsRev = KEY_ARMSREV;
|
||||
int gKeyItem = KEY_ITEM;
|
||||
int gKeyMap = KEY_MAP;
|
||||
int gKeyOk = KEY_Z;
|
||||
int gKeyCancel = KEY_X;
|
||||
int gKeyLeft = KEY_LEFT;
|
||||
int gKeyUp = KEY_UP;
|
||||
int gKeyRight = KEY_RIGHT;
|
||||
int gKeyDown = KEY_DOWN;
|
||||
|
||||
void GetTrg()
|
||||
{
|
||||
static int key_old;
|
||||
gKeyTrg = gKey & (gKey ^ key_old);
|
||||
key_old = gKey;
|
||||
}
|
||||
#include "KeyControl.h"
|
||||
|
||||
int gKey;
|
||||
int gKeyTrg;
|
||||
|
||||
int gKeyJump = KEY_Z;
|
||||
int gKeyShot = KEY_X;
|
||||
int gKeyArms = KEY_ARMS;
|
||||
int gKeyArmsRev = KEY_ARMSREV;
|
||||
int gKeyItem = KEY_ITEM;
|
||||
int gKeyMap = KEY_MAP;
|
||||
int gKeyOk = KEY_Z;
|
||||
int gKeyCancel = KEY_X;
|
||||
int gKeyLeft = KEY_LEFT;
|
||||
int gKeyUp = KEY_UP;
|
||||
int gKeyRight = KEY_RIGHT;
|
||||
int gKeyDown = KEY_DOWN;
|
||||
|
||||
void GetTrg()
|
||||
{
|
||||
static int key_old;
|
||||
gKeyTrg = gKey & (gKey ^ key_old);
|
||||
key_old = gKey;
|
||||
}
|
||||
|
|
106
src/KeyControl.h
106
src/KeyControl.h
|
@ -1,53 +1,53 @@
|
|||
#pragma once
|
||||
|
||||
enum KEYBIND
|
||||
{
|
||||
//The movement keys go in the order of left, right, up and down
|
||||
KEY_LEFT = 0x00000001,
|
||||
KEY_RIGHT = 0x00000002,
|
||||
KEY_UP = 0x00000004,
|
||||
KEY_DOWN = 0x00000008,
|
||||
//Map key
|
||||
KEY_MAP = 0x00000010,
|
||||
//Okay and cancel / Jump and Shoot keys
|
||||
KEY_X = 0x00000020,
|
||||
KEY_Z = 0x00000040,
|
||||
//Left and right weapon switch keys
|
||||
KEY_ARMS = 0x00000080,
|
||||
KEY_ARMSREV = 0x00000100,
|
||||
//Unused?
|
||||
KEY_SHIFT = 0x00000200,
|
||||
//Function keys
|
||||
KEY_F1 = 0x00000400,
|
||||
KEY_F2 = 0x00000800,
|
||||
//Inventory
|
||||
KEY_ITEM = 0x00001000,
|
||||
//Escape key
|
||||
KEY_ESCAPE = 0x00008000,
|
||||
//The alt movement keys go in the order of left, up, right and down
|
||||
KEY_ALT_LEFT = 0x00010000,
|
||||
KEY_ALT_DOWN = 0x00020000,
|
||||
KEY_ALT_RIGHT = 0x00040000,
|
||||
KEY_ALT_UP = 0x00180000,
|
||||
//Alt up actually has 2 seperate keys, but they're kind of merged together (and also for some reason the second one is +/=)
|
||||
KEY_L = 0x00080000,
|
||||
KEY_PLUS = 0x00100000
|
||||
};
|
||||
|
||||
extern int gKey;
|
||||
extern int gKeyTrg;
|
||||
|
||||
extern int gKeyJump;
|
||||
extern int gKeyShot;
|
||||
extern int gKeyArms;
|
||||
extern int gKeyArmsRev;
|
||||
extern int gKeyItem;
|
||||
extern int gKeyMap;
|
||||
extern int gKeyOk;
|
||||
extern int gKeyCancel;
|
||||
extern int gKeyLeft;
|
||||
extern int gKeyUp;
|
||||
extern int gKeyRight;
|
||||
extern int gKeyDown;
|
||||
|
||||
void GetTrg();
|
||||
#pragma once
|
||||
|
||||
enum KEYBIND
|
||||
{
|
||||
//The movement keys go in the order of left, right, up and down
|
||||
KEY_LEFT = 0x00000001,
|
||||
KEY_RIGHT = 0x00000002,
|
||||
KEY_UP = 0x00000004,
|
||||
KEY_DOWN = 0x00000008,
|
||||
//Map key
|
||||
KEY_MAP = 0x00000010,
|
||||
//Okay and cancel / Jump and Shoot keys
|
||||
KEY_X = 0x00000020,
|
||||
KEY_Z = 0x00000040,
|
||||
//Left and right weapon switch keys
|
||||
KEY_ARMS = 0x00000080,
|
||||
KEY_ARMSREV = 0x00000100,
|
||||
//Unused?
|
||||
KEY_SHIFT = 0x00000200,
|
||||
//Function keys
|
||||
KEY_F1 = 0x00000400,
|
||||
KEY_F2 = 0x00000800,
|
||||
//Inventory
|
||||
KEY_ITEM = 0x00001000,
|
||||
//Escape key
|
||||
KEY_ESCAPE = 0x00008000,
|
||||
//The alt movement keys go in the order of left, up, right and down
|
||||
KEY_ALT_LEFT = 0x00010000,
|
||||
KEY_ALT_DOWN = 0x00020000,
|
||||
KEY_ALT_RIGHT = 0x00040000,
|
||||
KEY_ALT_UP = 0x00180000,
|
||||
//Alt up actually has 2 seperate keys, but they're kind of merged together (and also for some reason the second one is +/=)
|
||||
KEY_L = 0x00080000,
|
||||
KEY_PLUS = 0x00100000
|
||||
};
|
||||
|
||||
extern int gKey;
|
||||
extern int gKeyTrg;
|
||||
|
||||
extern int gKeyJump;
|
||||
extern int gKeyShot;
|
||||
extern int gKeyArms;
|
||||
extern int gKeyArmsRev;
|
||||
extern int gKeyItem;
|
||||
extern int gKeyMap;
|
||||
extern int gKeyOk;
|
||||
extern int gKeyCancel;
|
||||
extern int gKeyLeft;
|
||||
extern int gKeyUp;
|
||||
extern int gKeyRight;
|
||||
extern int gKeyDown;
|
||||
|
||||
void GetTrg();
|
||||
|
|
1268
src/Main.cpp
1268
src/Main.cpp
File diff suppressed because it is too large
Load diff
|
@ -1,3 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
//This was originally some sort of POSIX standard thing? leftover from the linux port
|
||||
#pragma once
|
||||
|
||||
//This was originally some sort of POSIX standard thing? leftover from the linux port
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
#pragma once
|
||||
|
||||
int rep_rand();
|
||||
void rep_srand(unsigned int seed);
|
||||
|
||||
typedef int BOOL;
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
struct RECT
|
||||
{
|
||||
union
|
||||
{
|
||||
int left;
|
||||
int front;
|
||||
};
|
||||
int top;
|
||||
union
|
||||
{
|
||||
int right;
|
||||
int back;
|
||||
};
|
||||
int bottom;
|
||||
};
|
||||
|
||||
bool SystemTask();
|
||||
#pragma once
|
||||
|
||||
int rep_rand();
|
||||
void rep_srand(unsigned int seed);
|
||||
|
||||
typedef int BOOL;
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
struct RECT
|
||||
{
|
||||
union
|
||||
{
|
||||
int left;
|
||||
int front;
|
||||
};
|
||||
int top;
|
||||
union
|
||||
{
|
||||
int right;
|
||||
int back;
|
||||
};
|
||||
int bottom;
|
||||
};
|
||||
|
||||
bool SystemTask();
|
||||
|
|
Loading…
Add table
Reference in a new issue