Compare commits
No commits in common. "amigaos" and "develop" have entirely different histories.
|
@ -1,53 +0,0 @@
|
||||||
# Blob Wars : Attrition
|
|
||||||
|
|
||||||
This is the port of the Blob Wars Attrition 1.2.2 for the AmigaOS 4 and
|
|
||||||
MorphOS.
|
|
||||||
|
|
||||||
The AmigaOS 4 versions is tested and runs well on X5000/40. Also I tested
|
|
||||||
it on microAmigaOne but the lack of graphics memory (32MB total) makes it
|
|
||||||
really slow.
|
|
||||||
|
|
||||||
The MorphOS version was tested on PowerBook G4 and runs pretty fine and
|
|
||||||
quickly.
|
|
||||||
|
|
||||||
I'd love to hear how it works on your system.
|
|
||||||
|
|
||||||
### Installation
|
|
||||||
|
|
||||||
This archive does not contain any data files. In order to play the game, you
|
|
||||||
will need to purchase the data. You can do so here:
|
|
||||||
|
|
||||||
http://www.parallelrealities.co.uk/games/attrition/#purchase
|
|
||||||
|
|
||||||
To install it, extract all the files from the bought Linux archive
|
|
||||||
(blobwarsAttrition-1.2.2.linux-x86.tar.gz) anywhere at you hard disk
|
|
||||||
and copy over all the files from this archive. A requester will show up
|
|
||||||
to replace the blobwarsAttrition binary, which you need to confirm.
|
|
||||||
|
|
||||||
I do not recommend to use the demo data provided from the official website,
|
|
||||||
because they do not work correctly.
|
|
||||||
|
|
||||||
It is recommended to have the following SDL2 options enabled at its prefs:
|
|
||||||
- Driver: opengl/opengl2 depending your gfx card and the drivers you have
|
|
||||||
installed in your system
|
|
||||||
- Batching Mode: enabled
|
|
||||||
|
|
||||||
### Support
|
|
||||||
|
|
||||||
If you like what I am doing and my ports and you would like to support me,
|
|
||||||
and my future releases please visit https://ko-fi.com/walkero where you
|
|
||||||
can find all the latest updates by me and you can donate.
|
|
||||||
|
|
||||||
### Changelog
|
|
||||||
|
|
||||||
1.2.2r2 (2022-09-19)
|
|
||||||
* Did a few changes at the code that speeds up the game a lot
|
|
||||||
* Removed the white shadow from texts in some renderers
|
|
||||||
* Changed the freetype library with the latest version
|
|
||||||
* Removed the debug info at the start of the game
|
|
||||||
* MorphOS version released
|
|
||||||
* Some code cleanup at the repo
|
|
||||||
|
|
||||||
1.2.2r1 (2022-08-13)
|
|
||||||
* First release
|
|
||||||
|
|
|
@ -65,11 +65,8 @@ $(OUT)/%.o: %.c %.h $(DEPS)
|
||||||
$(CC) $(CFLAGS) $(CXXFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) $(CXXFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
%.mo: %.po
|
%.mo: %.po
|
||||||
ifneq ($(shell uname), AmigaOS)
|
|
||||||
msgfmt -c -o $@ $<
|
msgfmt -c -o $@ $<
|
||||||
endif
|
|
||||||
|
|
||||||
# cleaning everything that can be automatically recreated with "make".
|
# cleaning everything that can be automatically recreated with "make".
|
||||||
clean:
|
clean:
|
||||||
$(RM) $(OBJS) $(PROG) $(LOCALE_MO)
|
$(RM) $(OBJS) $(PROG) $(LOCALE_MO)
|
||||||
|
|
||||||
|
|
BIN
icons/blob.info
BIN
icons/blob.info
Binary file not shown.
65
makefile.mos
65
makefile.mos
|
@ -1,65 +0,0 @@
|
||||||
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/mos
|
|
||||||
_OBJS += mosInit.o
|
|
||||||
|
|
||||||
include common.mk
|
|
||||||
|
|
||||||
CXXFLAGS += -O3 -DVERSION=$(VERSION) -DREVISION=$(REVISION) -DDATA_DIR=\"$(DATA_DIR)\" -DLOCALE_DIR=\"$(LOCALE_DIR)\" -D__USE_INLINE__
|
|
||||||
CXXFLAGS += -I/sdk/gg/usr/local/include -g -lefence
|
|
||||||
CXXFLAGS += -fms-extensions -std=gnu11 -noixemul
|
|
||||||
ifneq ("$(wildcard .errors)","")
|
|
||||||
CXXFLAGS += -Wall -Wempty-body -Werror -Wstrict-prototypes -Werror=maybe-uninitialized -Warray-bounds
|
|
||||||
endif
|
|
||||||
|
|
||||||
LDFLAGS += -noixemul -lSDL2_image -lSDL2_ttf -lfreetype -ltiff -lpng16 -ljpeg -lz -lm
|
|
||||||
LDFLAGS += -lSDL2_mixer -lmikmod -lmodplug -lFLAC -lvorbisfile -lvorbis -logg
|
|
||||||
LDFLAGS += -lSDL2 -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)
|
|
||||||
|
|
||||||
# prepare an archive for the program
|
|
||||||
dist:
|
|
||||||
mkdir -p release/$(PROG)-$(VERSION).$(REVISION)
|
|
||||||
cp $(PROG) release/$(PROG)-$(VERSION).$(REVISION)/
|
|
||||||
strip release/$(PROG)-$(VERSION).$(REVISION)/$(PROG)
|
|
||||||
cp icons/blob.info release/$(PROG)-$(VERSION).$(REVISION)/$(PROG).info
|
|
||||||
cp LICENSE release/$(PROG)-$(VERSION).$(REVISION)/
|
|
||||||
cp README.md release/$(PROG)-$(VERSION).$(REVISION)/
|
|
||||||
cp README-Amiga.md release/$(PROG)-$(VERSION).$(REVISION)/
|
|
||||||
lha -aeqr3 a $(PROG)-MOS-$(VERSION).$(REVISION).lha release/
|
|
||||||
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
65
makefile.os4
65
makefile.os4
|
@ -1,65 +0,0 @@
|
||||||
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 -lfreetype -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)
|
|
||||||
|
|
||||||
# prepare an archive for the program
|
|
||||||
dist:
|
|
||||||
mkdir -p release/$(PROG)-$(VERSION).$(REVISION)
|
|
||||||
cp $(PROG) release/$(PROG)-$(VERSION).$(REVISION)/
|
|
||||||
strip release/$(PROG)-$(VERSION).$(REVISION)/$(PROG)
|
|
||||||
cp icons/blob.info release/$(PROG)-$(VERSION).$(REVISION)/$(PROG).info
|
|
||||||
cp LICENSE release/$(PROG)-$(VERSION).$(REVISION)/
|
|
||||||
cp README.md release/$(PROG)-$(VERSION).$(REVISION)/
|
|
||||||
cp README-Amiga.md release/$(PROG)-$(VERSION).$(REVISION)/
|
|
||||||
lha -aeqr3 a $(PROG)-OS4-$(VERSION).$(REVISION).lha release/
|
|
||||||
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
|
@ -172,9 +172,9 @@ void drawTrophies(void)
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
#if !defined(__amigaos4__) && !defined(__morphos__)
|
|
||||||
SDL_SetTextureColorMod(atlasTexture->texture, 255, 255, 255);
|
SDL_SetTextureColorMod(atlasTexture->texture, 255, 255, 255);
|
||||||
#endif
|
|
||||||
drawWidgets();
|
drawWidgets();
|
||||||
|
|
||||||
SDL_SetRenderTarget(app.renderer, app.backBuffer);
|
SDL_SetRenderTarget(app.renderer, app.backBuffer);
|
||||||
|
@ -332,9 +332,7 @@ void drawTrophyAlert(void)
|
||||||
blitRectRotated(atlasTexture->texture, x + 24, y + 24, &sparkle->rect, sparkleAngle);
|
blitRectRotated(atlasTexture->texture, x + 24, y + 24, &sparkle->rect, sparkleAngle);
|
||||||
blitRectRotated(atlasTexture->texture, x + 24, y + 24, &sparkle->rect, -sparkleAngle);
|
blitRectRotated(atlasTexture->texture, x + 24, y + 24, &sparkle->rect, -sparkleAngle);
|
||||||
blitRectScaled(atlasTexture->texture, x, y, 48, 48, &trophyIcons[alertTrophy->value]->rect, 0);
|
blitRectScaled(atlasTexture->texture, x, y, 48, 48, &trophyIcons[alertTrophy->value]->rect, 0);
|
||||||
#if !defined(__amigaos4__) && !defined(__morphos__)
|
|
||||||
SDL_SetTextureColorMod(atlasTexture->texture, 255, 255, 255);
|
SDL_SetTextureColorMod(atlasTexture->texture, 255, 255, 255);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,4 +412,3 @@ static void setSparkleColor(Trophy *t)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -904,4 +904,3 @@ void destroyHub(void)
|
||||||
memset(&hubMissionHead, 0, sizeof(HubMission));
|
memset(&hubMissionHead, 0, sizeof(HubMission));
|
||||||
hubMissionTail = &hubMissionHead;
|
hubMissionTail = &hubMissionHead;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,9 +36,11 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
initLookups();
|
initLookups();
|
||||||
|
|
||||||
|
init18N(argc, argv);
|
||||||
|
|
||||||
initSDL();
|
initSDL();
|
||||||
|
|
||||||
init18N(argc, argv);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN);
|
||||||
|
|
||||||
initGameSystem();
|
initGameSystem();
|
||||||
|
|
||||||
|
@ -200,4 +202,3 @@ static void handleCommandLine(int argc, char *argv[])
|
||||||
initTitle();
|
initTitle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,101 +0,0 @@
|
||||||
/*
|
|
||||||
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 "mosInit.h"
|
|
||||||
|
|
||||||
#define VSTRING "Blob Wars Attrition 1.2.2r2 (19.09.2022)"
|
|
||||||
#define VERSTAG "\0$VER: " VSTRING
|
|
||||||
unsigned long __stack = 1000000;
|
|
||||||
UBYTE VString[] = VERSTAG;
|
|
||||||
|
|
||||||
static void mkpath(const char *path);
|
|
||||||
|
|
||||||
void createSaveFolder(void)
|
|
||||||
{
|
|
||||||
char *dir;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
BPTR savesPathLock = Lock("PROGDIR:saves", SHARED_LOCK);
|
|
||||||
if (!savesPathLock)
|
|
||||||
{
|
|
||||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "Saves folder not found. I am going to create it.");
|
|
||||||
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";
|
|
||||||
}
|
|
||||||
|
|
||||||
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("PROGDIR:screenshots", S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
|
|
||||||
|
|
||||||
dev.screenshotFolder = "screenshots";
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
/*
|
|
||||||
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;
|
|
||||||
|
|
|
@ -1,101 +0,0 @@
|
||||||
/*
|
|
||||||
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.2r2 (19.09.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)
|
|
||||||
{
|
|
||||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "Saves folder not found. I am going to create it.");
|
|
||||||
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";
|
|
||||||
}
|
|
||||||
|
|
||||||
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("PROGDIR:screenshots", S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
|
|
||||||
|
|
||||||
dev.screenshotFolder = "screenshots";
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
/*
|
|
||||||
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 MIA MIA;
|
||||||
typedef struct Structure Structure;
|
typedef struct Structure Structure;
|
||||||
typedef struct Trap Trap;
|
typedef struct Trap Trap;
|
||||||
typedef struct BlobUnit Unit;
|
typedef struct Unit Unit;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int debug;
|
int debug;
|
||||||
|
@ -164,7 +164,7 @@ struct EntityExt {
|
||||||
Item *carriedItem;
|
Item *carriedItem;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BlobUnit {
|
struct Unit {
|
||||||
struct EntityExt;
|
struct EntityExt;
|
||||||
char *unitType;
|
char *unitType;
|
||||||
int weaponType;
|
int weaponType;
|
||||||
|
@ -183,14 +183,14 @@ struct BlobUnit {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MIA {
|
struct MIA {
|
||||||
struct BlobUnit;
|
struct Unit;
|
||||||
int shudderTimer;
|
int shudderTimer;
|
||||||
int starTimer;
|
int starTimer;
|
||||||
int teleportTimer;
|
int teleportTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Boss {
|
struct Boss {
|
||||||
struct BlobUnit;
|
struct Unit;
|
||||||
int weakAgainst;
|
int weakAgainst;
|
||||||
int teleportTimer;
|
int teleportTimer;
|
||||||
int stunTimer;
|
int stunTimer;
|
||||||
|
@ -209,7 +209,7 @@ struct Item {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Bob {
|
struct Bob {
|
||||||
struct BlobUnit;
|
struct Unit;
|
||||||
int outTimer;
|
int outTimer;
|
||||||
int stunTimer;
|
int stunTimer;
|
||||||
int immuneTimer;
|
int immuneTimer;
|
||||||
|
@ -552,4 +552,3 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t length, offset;
|
int32_t length, offset;
|
||||||
} MOEntry;
|
} MOEntry;
|
||||||
|
|
||||||
|
|
|
@ -74,8 +74,6 @@ void initSDL(void)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN);
|
|
||||||
|
|
||||||
if (Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 1024) == -1)
|
if (Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 1024) == -1)
|
||||||
{
|
{
|
||||||
printf("Couldn't initialize SDL Mixer\n");
|
printf("Couldn't initialize SDL Mixer\n");
|
||||||
|
@ -372,4 +370,3 @@ void cleanup(void)
|
||||||
|
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,6 @@ void drawText(int x, int y, int size, int align, SDL_Color color, const char *fo
|
||||||
|
|
||||||
if (app.textWidth == 0)
|
if (app.textWidth == 0)
|
||||||
{
|
{
|
||||||
#if !defined(__amigaos4__) && !defined(__morphos__)
|
|
||||||
SDL_SetTextureColorMod(activeFont->texture, 0, 0, 0);
|
SDL_SetTextureColorMod(activeFont->texture, 0, 0, 0);
|
||||||
SDL_SetTextureAlphaMod(activeFont->texture, 255);
|
SDL_SetTextureAlphaMod(activeFont->texture, 255);
|
||||||
|
|
||||||
|
@ -173,13 +172,11 @@ void drawText(int x, int y, int size, int align, SDL_Color color, const char *fo
|
||||||
|
|
||||||
SDL_SetTextureColorMod(activeFont->texture, color.r, color.g, color.b);
|
SDL_SetTextureColorMod(activeFont->texture, color.r, color.g, color.b);
|
||||||
SDL_SetTextureAlphaMod(activeFont->texture, color.a);
|
SDL_SetTextureAlphaMod(activeFont->texture, color.a);
|
||||||
#endif
|
|
||||||
|
|
||||||
drawTextLine(x, y, size, align, drawTextBuffer);
|
drawTextLine(x, y, size, align, drawTextBuffer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if !defined(__amigaos4__) && !defined(__morphos__)
|
|
||||||
SDL_SetTextureColorMod(activeFont->texture, 0, 0, 0);
|
SDL_SetTextureColorMod(activeFont->texture, 0, 0, 0);
|
||||||
SDL_SetTextureAlphaMod(activeFont->texture, 255);
|
SDL_SetTextureAlphaMod(activeFont->texture, 255);
|
||||||
|
|
||||||
|
@ -188,7 +185,6 @@ void drawText(int x, int y, int size, int align, SDL_Color color, const char *fo
|
||||||
|
|
||||||
SDL_SetTextureColorMod(activeFont->texture, color.r, color.g, color.b);
|
SDL_SetTextureColorMod(activeFont->texture, color.r, color.g, color.b);
|
||||||
SDL_SetTextureAlphaMod(activeFont->texture, color.a);
|
SDL_SetTextureAlphaMod(activeFont->texture, color.a);
|
||||||
#endif
|
|
||||||
|
|
||||||
drawTextLines(x, y, size, align);
|
drawTextLines(x, y, size, align);
|
||||||
}
|
}
|
||||||
|
@ -437,4 +433,3 @@ static char *nextCharacter(const char *str, int *i)
|
||||||
*i = *i + 1;
|
*i = *i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,6 @@ char *buildFormattedString(const char *format, ...)
|
||||||
* (Declaration that it's public domain):
|
* (Declaration that it's public domain):
|
||||||
* http://groups.google.com/group/comp.lang.c/msg/7c7b39328fefab9c
|
* http://groups.google.com/group/comp.lang.c/msg/7c7b39328fefab9c
|
||||||
*/
|
*/
|
||||||
#if !defined(__morphos__)
|
|
||||||
char *strtok_r(char *str, const char *delim, char **nextp)
|
char *strtok_r(char *str, const char *delim, char **nextp)
|
||||||
{
|
{
|
||||||
char *ret;
|
char *ret;
|
||||||
|
@ -140,5 +139,3 @@ char *strtok_r(char *str, const char *delim, char **nextp)
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue