Changes to compile and work under AmigaOS 4
This commit is contained in:
parent
1a684a9737
commit
575b701190
|
@ -0,0 +1,103 @@
|
|||
PROG = blobwarsAttrition
|
||||
CC = gcc
|
||||
PREFIX ?= /usr
|
||||
BIN_DIR ?= $(PREFIX)/bin
|
||||
DATA_DIR ?= data
|
||||
LOCALE_DIR = locale
|
||||
ICON_DIR = $(PREFIX)/share/icons/hicolor
|
||||
DESKTOP_DIR = $(PREFIX)/share/applications
|
||||
|
||||
DESTDIR ?=
|
||||
INST_BIN_DIR = $(DESTDIR)$(BIN_DIR)
|
||||
INST_DATA_DIR = $(DESTDIR)$(DATA_DIR)
|
||||
INST_LOCALE_DIR = $(DESTDIR)$(LOCALE_DIR)
|
||||
INST_ICON_DIR = $(DESTDIR)$(ICON_DIR)
|
||||
INST_DESKTOP_DIR = $(DESTDIR)$(DESKTOP_DIR)
|
||||
|
||||
SEARCHPATH += src/plat/os4
|
||||
_OBJS += os4Init.o
|
||||
|
||||
include common.mk
|
||||
|
||||
CXXFLAGS += -O3 -DVERSION=$(VERSION) -DREVISION=$(REVISION) -DDATA_DIR=\"$(DATA_DIR)\" -DLOCALE_DIR=\"$(LOCALE_DIR)\" -D__USE_INLINE__
|
||||
CXXFLAGS += -g -lefence
|
||||
CXXFLAGS += -fms-extensions -std=gnu11
|
||||
ifneq ("$(wildcard .errors)","")
|
||||
CXXFLAGS += -Wall -Wempty-body -Werror -Wstrict-prototypes -Werror=maybe-uninitialized -Warray-bounds
|
||||
endif
|
||||
|
||||
LDFLAGS += -lauto -lSDL2_image -lSDL2_ttf -lft2 -ltiff -lwebp -lpng -ljpeg -lz -lm
|
||||
LDFLAGS += -lSDL2_mixer -lmikmod -lmodplug -lFLAC -lsmpeg2 -lvorbisfile -lvorbis -logg
|
||||
LDFLAGS += -lSDL2 -lpthread -athread=native -lstdc++
|
||||
|
||||
SHARED_FILES = LICENSE README.md data gfx manual music sound icons
|
||||
DIST_FILES = $(SHARED_FILES) locale $(PROG)
|
||||
SRC_DIST_FILES = $(SHARED_FILES) src makefile* common.mk
|
||||
|
||||
# linking the program.
|
||||
$(PROG): $(OBJS)
|
||||
$(CC) -o $@ $(OBJS) $(LDFLAGS)
|
||||
|
||||
install:
|
||||
mkdir -p $(INST_BIN_DIR)
|
||||
install -m 0755 $(PROG) $(INST_BIN_DIR)
|
||||
mkdir -p $(INST_DATA_DIR)
|
||||
cp -r data $(INST_DATA_DIR)
|
||||
cp -r gfx $(INST_DATA_DIR)
|
||||
cp -r manual $(INST_DATA_DIR)
|
||||
cp -r music $(INST_DATA_DIR)
|
||||
cp -r sound $(INST_DATA_DIR)
|
||||
mkdir -p $(INST_ICON_DIR)/16x16/apps
|
||||
mkdir -p $(INST_ICON_DIR)/32x32/apps
|
||||
mkdir -p $(INST_ICON_DIR)/64x64/apps
|
||||
mkdir -p $(INST_ICON_DIR)/128x128/apps
|
||||
cp -p icons/$(PROG)-16x16.png $(INST_ICON_DIR)/16x16/apps/$(PROG).png
|
||||
cp -p icons/$(PROG)-32x32.png $(INST_ICON_DIR)/32x32/apps/$(PROG).png
|
||||
cp -p icons/$(PROG)-64x64.png $(INST_ICON_DIR)/64x64/apps/$(PROG).png
|
||||
cp -p icons/$(PROG)-128x128.png $(INST_ICON_DIR)/128x128/apps/$(PROG).png
|
||||
mkdir -p $(INST_DESKTOP_DIR)
|
||||
cp -p icons/$(PROG).desktop $(INST_DESKTOP_DIR)
|
||||
|
||||
@for f in $(LOCALE_MO); do \
|
||||
lang=`echo $$f | sed -e 's/^locale\///;s/\.mo$$//'`; \
|
||||
mkdir -p $(INST_LOCALE_DIR)/$$lang/LC_MESSAGES; \
|
||||
cp -v $$f $(INST_LOCALE_DIR)/$$lang/LC_MESSAGES/$(PROG).mo; \
|
||||
done
|
||||
|
||||
uninstall:
|
||||
$(RM) $(BIN_DIR)/$(PROG)
|
||||
$(RM) -rf $(DATA_DIR)
|
||||
$(RM) $(ICON_DIR)/16x16/apps/$(PROG).png
|
||||
$(RM) $(ICON_DIR)/32x32/apps/$(PROG).png
|
||||
$(RM) $(ICON_DIR)/64x64/apps/$(PROG).png
|
||||
$(RM) $(ICON_DIR)/128x128/apps/$(PROG).png
|
||||
$(RM) $(DESKTOP_DIR)/$(PROG).desktop
|
||||
|
||||
@for f in $(LOCALE_MO); do \
|
||||
lang=`echo $$f | sed -e 's/^locale\///;s/\.mo$$//'`; \
|
||||
$(RM) -v $(LOCALE_DIR)/$$lang/LC_MESSAGES/$(PROG).mo; \
|
||||
done
|
||||
|
||||
# prepare an archive for the program
|
||||
dist:
|
||||
$(RM) -rf $(PROG)-$(VERSION).$(REVISION)
|
||||
mkdir $(PROG)-$(VERSION).$(REVISION)
|
||||
cp -rL $(DIST_FILES) $(PROG)-$(VERSION).$(REVISION)
|
||||
# tar czf $(PROG)-$(VERSION).$(REVISION).linux-x86.tar.gz $(PROG)-$(VERSION).$(REVISION)
|
||||
# mkdir -p dist
|
||||
# mv $(PROG)-$(VERSION).$(REVISION).linux-x86.tar.gz dist
|
||||
# $(RM) -rf $(PROG)-$(VERSION).$(REVISION)
|
||||
|
||||
# prepare an archive for the program
|
||||
src-dist:
|
||||
$(RM) -rf $(PROG)-$(VERSION).$(REVISION)
|
||||
mkdir $(PROG)-$(VERSION).$(REVISION)
|
||||
cp -rL $(SRC_DIST_FILES) $(PROG)-$(VERSION).$(REVISION)
|
||||
git log --pretty=format:"%h%x09%an%x09%ad%x09%s" --date=short >$(PROG)-$(VERSION).$(REVISION)/CHANGELOG.raw
|
||||
tar czf $(PROG)-$(VERSION).$(REVISION).src.tar.gz $(PROG)-$(VERSION).$(REVISION)
|
||||
mkdir -p dist
|
||||
mv $(PROG)-$(VERSION).$(REVISION).src.tar.gz dist
|
||||
$(RM) -rf $(PROG)-$(VERSION).$(REVISION)
|
||||
|
||||
.PHONY: dist
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
/*
|
||||
Copyright (C) 2018-2019 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include <proto/dos.h>
|
||||
#include <proto/exec.h>
|
||||
|
||||
#include "os4Init.h"
|
||||
|
||||
#define VSTRING "Blob Wars Attrition 1.2.2r1 (13.08.2022)"
|
||||
#define VERSTAG "\0$VER: " VSTRING
|
||||
static CONST_STRPTR stack USED = "$STACK:102400";
|
||||
static CONST_STRPTR version USED = VERSTAG;
|
||||
|
||||
static void mkpath(const char *path);
|
||||
|
||||
void createSaveFolder(void)
|
||||
{
|
||||
char *dir;
|
||||
int i;
|
||||
|
||||
BPTR savesPathLock = Lock("PROGDIR:saves", SHARED_LOCK);
|
||||
if (!savesPathLock)
|
||||
{
|
||||
mkpath("PROGDIR:saves");
|
||||
}
|
||||
else {
|
||||
UnLock(savesPathLock);
|
||||
}
|
||||
|
||||
for (i = 0 ; i < MAX_SAVE_SLOTS ; i++)
|
||||
{
|
||||
dir = buildFormattedString("saves/%d", i);
|
||||
|
||||
mkpath(dir);
|
||||
|
||||
free(dir);
|
||||
}
|
||||
app.saveDir = "saves";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// char *userHome, *dir;
|
||||
// int i;
|
||||
|
||||
// userHome = getenv("HOME");
|
||||
// SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "User home = %s", userHome);
|
||||
|
||||
// if (!userHome)
|
||||
// {
|
||||
// SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_ERROR, "Unable to determine user save folder.");
|
||||
// exit(1);
|
||||
// }
|
||||
|
||||
// SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "User home = %s", userHome);
|
||||
|
||||
// for (i = 0 ; i < MAX_SAVE_SLOTS ; i++)
|
||||
// {
|
||||
// dir = buildFormattedString("%s/.local/share/blobwarsAttrition/%d", userHome, i);
|
||||
|
||||
// mkpath(dir);
|
||||
|
||||
// free(dir);
|
||||
// }
|
||||
|
||||
// app.saveDir = buildFormattedString("%s/.local/share/blobwarsAttrition", userHome);
|
||||
// app.saveDir = "/save";
|
||||
}
|
||||
|
||||
static void mkpath(const char *path)
|
||||
{
|
||||
char dir[MAX_FILENAME_LENGTH];
|
||||
int i, rootPath;
|
||||
|
||||
strcpy(dir, "");
|
||||
|
||||
rootPath = 1;
|
||||
|
||||
for (i = 0 ; i < strlen(path) ; i++)
|
||||
{
|
||||
if (path[i] == '/')
|
||||
{
|
||||
if (!rootPath)
|
||||
{
|
||||
if (mkdir(dir, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH) != 0 && errno != EEXIST)
|
||||
{
|
||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_ERROR, "Failed to create save dir '%s'.", dir);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
rootPath = 0;
|
||||
}
|
||||
|
||||
dir[i] = path[i];
|
||||
dir[i + 1] = '\0';
|
||||
}
|
||||
|
||||
if (mkdir(dir, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH) != 0 && errno != EEXIST)
|
||||
{
|
||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_ERROR, "Failed to create save dir '%s'.", dir);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
void createScreenshotFolder(void)
|
||||
{
|
||||
mkdir("/tmp/blobwarsAttrition", S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
|
||||
|
||||
dev.screenshotFolder = "/tmp/blobwarsAttrition";
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
Copyright (C) 2018-2019 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <pwd.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "../../common.h"
|
||||
|
||||
extern char *buildFormattedString(const char *format, ...);
|
||||
|
||||
extern App app;
|
||||
extern Dev dev;
|
||||
|
|
@ -48,7 +48,7 @@ typedef struct Item Item;
|
|||
typedef struct MIA MIA;
|
||||
typedef struct Structure Structure;
|
||||
typedef struct Trap Trap;
|
||||
typedef struct Unit Unit;
|
||||
typedef struct BlobUnit Unit;
|
||||
|
||||
typedef struct {
|
||||
int debug;
|
||||
|
@ -164,7 +164,7 @@ struct EntityExt {
|
|||
Item *carriedItem;
|
||||
};
|
||||
|
||||
struct Unit {
|
||||
struct BlobUnit {
|
||||
struct EntityExt;
|
||||
char *unitType;
|
||||
int weaponType;
|
||||
|
@ -183,14 +183,14 @@ struct Unit {
|
|||
};
|
||||
|
||||
struct MIA {
|
||||
struct Unit;
|
||||
struct BlobUnit;
|
||||
int shudderTimer;
|
||||
int starTimer;
|
||||
int teleportTimer;
|
||||
};
|
||||
|
||||
struct Boss {
|
||||
struct Unit;
|
||||
struct BlobUnit;
|
||||
int weakAgainst;
|
||||
int teleportTimer;
|
||||
int stunTimer;
|
||||
|
@ -209,7 +209,7 @@ struct Item {
|
|||
};
|
||||
|
||||
struct Bob {
|
||||
struct Unit;
|
||||
struct BlobUnit;
|
||||
int outTimer;
|
||||
int stunTimer;
|
||||
int immuneTimer;
|
||||
|
@ -552,3 +552,4 @@ typedef struct {
|
|||
typedef struct {
|
||||
int32_t length, offset;
|
||||
} MOEntry;
|
||||
|
||||
|
|
Loading…
Reference in New Issue