Compare commits
17 Commits
Author | SHA1 | Date |
---|---|---|
Steve | 118b99ccf6 | |
Steve | 5e82c957cd | |
Steve | fc09a7d598 | |
Stephen J Sweeney | 7023a48723 | |
oglinuk | 793b1b95a8 | |
Stephen J Sweeney | 40cb97049c | |
Stephen M. Cameron | 2d3856d3ad | |
Steve | ef46a97a67 | |
Steve | 786df47e09 | |
Steve | 732a86aefd | |
Steve | 69c2fdf680 | |
Steve | b145541ed4 | |
Steve | 6b89d7e8e7 | |
Steve | 7e14550cc1 | |
Steve | f3bb77ca81 | |
Steve | 10eca1eb60 | |
Steve | a7a3cdb567 |
|
@ -0,0 +1,230 @@
|
|||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: Google
|
||||
AccessModifierOffset: -1
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignArrayOfStructures: None
|
||||
AlignConsecutiveMacros: Consecutive
|
||||
AlignConsecutiveAssignments: None
|
||||
AlignConsecutiveBitFields: None
|
||||
AlignConsecutiveDeclarations: Consecutive
|
||||
AlignEscapedNewlines: Left
|
||||
AlignOperands: Align
|
||||
AlignTrailingComments: true
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortEnumsOnASingleLine: true
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: None
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: WithoutElse
|
||||
AllowShortLoopsOnASingleLine: true
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
AttributeMacros:
|
||||
- __capability
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: false
|
||||
AfterControlStatement: Never
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
BeforeLambdaBody: false
|
||||
BeforeWhile: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeConceptDeclarations: true
|
||||
BreakBeforeBraces: Allman
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakInheritanceList: BeforeColon
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 1024
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
QualifierAlignment: Leave
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DeriveLineEnding: true
|
||||
DerivePointerAlignment: true
|
||||
DisableFormat: false
|
||||
EmptyLineAfterAccessModifier: Never
|
||||
EmptyLineBeforeAccessModifier: LogicalBlock
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
PackConstructorInitializers: NextLine
|
||||
BasedOnStyle: ''
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
AllowAllConstructorInitializersOnNextLine: true
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IfMacros:
|
||||
- KJ_IF_MAYBE
|
||||
IncludeBlocks: Regroup
|
||||
IncludeCategories:
|
||||
- Regex: '^<ext/.*\.h>'
|
||||
Priority: 2
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: '^<.*\.h>'
|
||||
Priority: 1
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: '^<.*'
|
||||
Priority: 2
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: '.*common.h'
|
||||
Priority: 2
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: '.*'
|
||||
Priority: 3
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
IncludeIsMainRegex: 'common.h'
|
||||
IncludeIsMainSourceRegex: 'common.h'
|
||||
IndentAccessModifiers: false
|
||||
IndentCaseLabels: true
|
||||
IndentCaseBlocks: false
|
||||
IndentGotoLabels: true
|
||||
IndentPPDirectives: None
|
||||
IndentExternBlock: AfterExternBlock
|
||||
IndentRequires: false
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
InsertTrailingCommas: None
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
LambdaBodyIndentation: Signature
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBinPackProtocolList: Never
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCBreakBeforeNestedBlockParam: true
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 1
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakOpenParenthesis: 0
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 200
|
||||
PenaltyIndentedWhitespace: 0
|
||||
PointerAlignment: Left
|
||||
PPIndentWidth: -1
|
||||
RawStringFormats:
|
||||
- Language: Cpp
|
||||
Delimiters:
|
||||
- cc
|
||||
- CC
|
||||
- cpp
|
||||
- Cpp
|
||||
- CPP
|
||||
- 'c++'
|
||||
- 'C++'
|
||||
CanonicalDelimiter: ''
|
||||
BasedOnStyle: google
|
||||
- Language: TextProto
|
||||
Delimiters:
|
||||
- pb
|
||||
- PB
|
||||
- proto
|
||||
- PROTO
|
||||
EnclosingFunctions:
|
||||
- EqualsProto
|
||||
- EquivToProto
|
||||
- PARSE_PARTIAL_TEXT_PROTO
|
||||
- PARSE_TEST_PROTO
|
||||
- PARSE_TEXT_PROTO
|
||||
- ParseTextOrDie
|
||||
- ParseTextProtoOrDie
|
||||
- ParseTestProto
|
||||
- ParsePartialTestProto
|
||||
CanonicalDelimiter: pb
|
||||
BasedOnStyle: google
|
||||
ReferenceAlignment: Pointer
|
||||
ReflowComments: true
|
||||
RemoveBracesLLVM: false
|
||||
SeparateDefinitionBlocks: Leave
|
||||
ShortNamespaceLines: 1
|
||||
SortIncludes: CaseInsensitive
|
||||
SortJavaStaticImport: Before
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCaseColon: false
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeParensOptions:
|
||||
AfterControlStatements: true
|
||||
AfterForeachMacros: true
|
||||
AfterFunctionDefinitionName: false
|
||||
AfterFunctionDeclarationName: false
|
||||
AfterIfMacros: true
|
||||
AfterOverloadedOperator: false
|
||||
BeforeNonEmptyParentheses: false
|
||||
SpaceAroundPointerQualifiers: Default
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 2
|
||||
SpacesInAngles: Never
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInLineCommentPrefix:
|
||||
Minimum: 1
|
||||
Maximum: -1
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
SpaceBeforeSquareBrackets: false
|
||||
BitFieldColonSpacing: Both
|
||||
Standard: Auto
|
||||
StatementAttributeLikeMacros:
|
||||
- Q_EMIT
|
||||
StatementMacros:
|
||||
- Q_UNUSED
|
||||
- QT_REQUIRE_VERSION
|
||||
TabWidth: 4
|
||||
UseCRLF: false
|
||||
UseTab: Always
|
||||
WhitespaceSensitiveMacros:
|
||||
- STRINGIZE
|
||||
- PP_STRINGIZE
|
||||
- BOOST_PP_STRINGIZE
|
||||
- NS_SWIFT_NAME
|
||||
- CF_SWIFT_NAME
|
||||
...
|
||||
|
|
@ -43,5 +43,5 @@ build/*
|
|||
|
||||
# Misc
|
||||
.DS_Store
|
||||
|
||||
/.errors
|
||||
tools
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
# The Battle for the Solar System : The Pandoran War
|
||||
|
||||
This is the port of the "The Battle for the Solar System : The Pandoran War"
|
||||
v1.50.1 for the AmigaOS 4.
|
||||
|
||||
The Pandoran War is a 2D mission-based space shooter based on the BATTLE FOR
|
||||
THE SOLAR SYSTEM space opera and set between books two and three: THE THIRD
|
||||
SIDE and THE ATTTRIBUTE OF THE STRONG. The game features many missions,
|
||||
with many different objectives and craft.
|
||||
|
||||
It requires a fast system to play the game as fast as possible, and a
|
||||
graphics card that supports either opengl/opengles2 with SDL2.
|
||||
It is tested and runs well on X5000/40 with a RadeonRX 550.
|
||||
|
||||
This archive does not contain any data files. In order to play the game, you
|
||||
need to download the data separately. From the following website download
|
||||
the "tbftss-1.5.1.linux-x86_64.tar.gz" file.
|
||||
|
||||
https://www.battleforthesolarsystem.com/games/pw/#downloads
|
||||
|
||||
To install it, extract the data file anywhere at you hard disk
|
||||
and copy over all the files from this archive. A requester will show up
|
||||
to replace some files, which you need to confirm for all of them.
|
||||
|
||||
If you like the game and would like to support its developer, you can go and
|
||||
buy it at:
|
||||
https://parallelrealities.itch.io/tbftss-the-pandoran-war
|
||||
|
||||
### How to make it faster
|
||||
|
||||
The game should run in 60fps but on my test system I get around 30fps with all
|
||||
the effects enabled. That's why I introduced an option at the Options screen,
|
||||
named "Effects Reduction" with values from 0 to 3. With 0 you have full effects
|
||||
everywhere, and with 3 you have less effects shown. That increases a lot the
|
||||
speed, but you might still see slowdowns in situations where there is a lot of
|
||||
action on the screen.
|
||||
|
||||
It is recommended to open the SDL2 prefs and set the Driver to opengl/opengl2
|
||||
depending your gfx card and the drivers you have installed.
|
||||
|
||||
On my system "Batching Mode: enabled" leads to some crashes. I recommend you
|
||||
to set this to default. But feel free to experiment with it, in case it
|
||||
works better for you.
|
||||
|
||||
I'd love to hear how it works on your system.
|
||||
|
||||
### Changelog
|
||||
1.50.1r1 (2022-08-22)
|
||||
* First release
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
![Alt text](dev/screenshots/v0.6-06.png?raw=true "Screenshot")
|
||||
|
||||
The develop branch on GitHub (https://github.com/stephenjsweeney/tbftss/tree/develop) is where all the dev work happens. Stable(ish) releases will go in to master (https://github.com/stephenjsweeney/tbftss/tree/master).
|
||||
The develop branch on GitHub (https://github.com/stephenjsweeney/tbftss/tree/develop) is where all the dev work happens. Stable releases will go in to master (https://github.com/stephenjsweeney/tbftss/tree/master).
|
||||
|
||||
Website: www.battleforthesolarsystem.com
|
||||
Email: stephenjsweeney@battleforthesolarsystem.com
|
||||
|
|
|
@ -50,11 +50,8 @@ $(OUT)/%.o: %.c %.h $(DEPS)
|
|||
$(CC) $(CFLAGS) $(CXXFLAGS) -c -o $@ $<
|
||||
|
||||
%.mo: %.po
|
||||
ifneq ($(shell uname), AmigaOS)
|
||||
msgfmt -c -o $@ $<
|
||||
endif
|
||||
|
||||
# cleaning everything that can be automatically recreated with "make".
|
||||
clean:
|
||||
$(RM) $(OBJS) $(PROG) $(LOCALE_MO)
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
"winWidth" : 1280,
|
||||
"winHeight" : 720,
|
||||
"effects" : 0,
|
||||
"fullscreen" : 0,
|
||||
"musicVolume" : 8,
|
||||
"soundVolume" : 10,
|
||||
|
@ -42,4 +41,3 @@
|
|||
"healthBars" : 1
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
"number" : 12,
|
||||
"scatter" : 5000,
|
||||
"aiFlags" : "+AIF_UNLIMITED_RANGE",
|
||||
"flags" : "+EF_AI_LEADER"
|
||||
"flags" : "+EF_AI_LEADER+EF_MUST_DISABLE"
|
||||
},
|
||||
{
|
||||
"types" : "Sphinx;Thunderhead",
|
||||
|
@ -158,7 +158,9 @@
|
|||
"lines" : [
|
||||
"MSG_BOX CSN Griffin;White Knights, the enemy tugs are already in position and are attaching tow ropes. They must not be allowed to get those fighters and pilots to the jumpgate.",
|
||||
"MSG_BOX de Winter;Can you disable the gate remotely?",
|
||||
"MSG_BOX CSN Griffin;Negative, the Pandorans have control. We're working take back command functions. Stand by."
|
||||
"MSG_BOX CSN Griffin;Negative, the Pandorans have control. We're working take back command functions. Stand by.",
|
||||
"MSG_BOX de Winter;Understood. Kelly, we should mag the tugs first and destroy them when its safe. Stray plasma fire could hit our pilots.",
|
||||
"MSG_BOX Taylor;Agreed."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
@ -10,17 +10,6 @@
|
|||
"w" : 400,
|
||||
"h": 34
|
||||
},
|
||||
{
|
||||
"name" : "effects",
|
||||
"group" : "options",
|
||||
"type" : "WT_SELECT",
|
||||
"text" : "Effects Reduction",
|
||||
"options" : "0;1;2;3",
|
||||
"x" : -1,
|
||||
"y" : 225,
|
||||
"w" : 400,
|
||||
"h": 34
|
||||
},
|
||||
{
|
||||
"name" : "soundVolume",
|
||||
"group" : "options",
|
||||
|
@ -28,7 +17,7 @@
|
|||
"text" : "Sound Volume",
|
||||
"options" : "0;1;2;3;4;5;6;7;8;9;10",
|
||||
"x" : -1,
|
||||
"y" : 275,
|
||||
"y" : 250,
|
||||
"w" : 400,
|
||||
"h": 34
|
||||
},
|
||||
|
@ -75,4 +64,3 @@
|
|||
"h": 34
|
||||
}
|
||||
]
|
||||
|
||||
|
|
Binary file not shown.
2
makefile
2
makefile
|
@ -25,9 +25,7 @@ MAKEFLAGS += -j$(NPROCS)
|
|||
CXXFLAGS += `sdl2-config --cflags` -DVERSION=$(VERSION) -DREVISION=$(REVISION) -DDATA_DIR=\"$(DATA_DIR)\" -DLOCALE_DIR=\"$(LOCALE_DIR)\"
|
||||
CXXFLAGS += -ansi -pedantic
|
||||
CXXFLAGS += -g -lefence
|
||||
ifneq ("$(wildcard .errors)","")
|
||||
CXXFLAGS += -Wall -Wempty-body -Werror -Wstrict-prototypes -Werror=maybe-uninitialized -Warray-bounds
|
||||
endif
|
||||
|
||||
LDFLAGS += `sdl2-config --libs` -lSDL2_mixer -lSDL2_image -lSDL2_ttf -lm
|
||||
|
||||
|
|
53
makefile.os4
53
makefile.os4
|
@ -1,53 +0,0 @@
|
|||
PROG = tbftss
|
||||
CC = gcc-11
|
||||
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 += -DVERSION=$(VERSION) -DREVISION=$(REVISION) -DDATA_DIR=\"$(DATA_DIR)\" -DLOCALE_DIR=\"$(LOCALE_DIR)\" -D__USE_INLINE__
|
||||
CXXFLAGS += -pedantic
|
||||
CXXFLAGS += -g -lefence
|
||||
CXXFLAGS += -Wall -Wempty-body -Werror -Wstrict-prototypes -Werror=maybe-uninitialized -Warray-bounds
|
||||
# CXXFLAGS += -gstabs
|
||||
|
||||
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++
|
||||
# LDFLAGS += -gstabs
|
||||
|
||||
# linking the program.
|
||||
$(PROG): $(OBJS)
|
||||
$(CC) -o $@ $(OBJS) $(LDFLAGS)
|
||||
|
||||
# prepare an archive for the program
|
||||
dist:
|
||||
mkdir -p release/$(PROG)-$(VERSION).$(REVISION)/data/app
|
||||
mkdir -p release/$(PROG)-$(VERSION).$(REVISION)/data/widgets
|
||||
cp $(PROG) release/$(PROG)-$(VERSION).$(REVISION)/
|
||||
strip release/$(PROG)-$(VERSION).$(REVISION)/$(PROG)
|
||||
cp icons/tbftss.info release/$(PROG)-$(VERSION).$(REVISION)/$(PROG).info
|
||||
cp data/app/config.json release/$(PROG)-$(VERSION).$(REVISION)/data/app/
|
||||
cp data/widgets/options.json release/$(PROG)-$(VERSION).$(REVISION)/data/widgets/
|
||||
cp LICENSE release/$(PROG)-$(VERSION).$(REVISION)/
|
||||
cp README.md release/$(PROG)-$(VERSION).$(REVISION)/
|
||||
cp README-OS4.md release/$(PROG)-$(VERSION).$(REVISION)/
|
||||
lha -aeqr3 a $(PROG)-$(VERSION).$(REVISION).lha release/
|
||||
|
||||
|
||||
.PHONY: dist
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body {background-color:#000; color: #fff; font-family: "sans"; background-image: url("background02.jpg");}
|
||||
body {background-color:#000; color: #fff; font-family: Arial; font-size: 18px; background-image: url("background02.jpg");}
|
||||
h3 {background-color:#47c; padding:0.25em; color:#fff; margin-top:3em; border: 1px solid #fff;}
|
||||
h4 {background-color:#000; padding:0.25em; color:#fff; margin-top:3em; border: 1px solid #5ad;}
|
||||
h5 {border-bottom: 1px solid #5ad; width: 50%;}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,29 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/bullets.h"
|
||||
#include "../battle/fighters.h"
|
||||
#include "../battle/hud.h"
|
||||
#include "../battle/mine.h"
|
||||
#include "../battle/quadtree.h"
|
||||
#include "../battle/script.h"
|
||||
#include "../system/util.h"
|
||||
#include "ai.h"
|
||||
|
||||
#define AI_EVADE 0
|
||||
#define AI_FALLBACK 1
|
||||
#define AI_HUNT 2
|
||||
#define TURN_SPEED 4
|
||||
#define TURN_THRESHOLD 2
|
||||
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Dev dev;
|
||||
extern Entity *player;
|
||||
extern Entity *self;
|
||||
|
||||
static void faceTarget(Entity *e);
|
||||
static int isInFOV(Entity *e, int fov);
|
||||
static void preAttack(void);
|
||||
|
@ -131,7 +152,7 @@ void doAI(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if ((self->aiFlags & (AIF_FOLLOWS_PLAYER|AIF_MOVES_TO_PLAYER)) && lookForPlayer())
|
||||
if ((self->aiFlags & (AIF_FOLLOWS_PLAYER | AIF_MOVES_TO_PLAYER)) && lookForPlayer())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -330,7 +351,7 @@ static void findTarget(void)
|
|||
|
||||
self->target = NULL;
|
||||
|
||||
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
||||
for (i = 0, e = candidates[i]; e != NULL; e = candidates[++i])
|
||||
{
|
||||
if (canAttack(e) && selectWeaponForTarget(e))
|
||||
{
|
||||
|
@ -417,7 +438,7 @@ static int selectWeapon(int type)
|
|||
{
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < MAX_FIGHTER_GUNS ; i++)
|
||||
for (i = 0; i < MAX_FIGHTER_GUNS; i++)
|
||||
{
|
||||
if (self->guns[i].type == type)
|
||||
{
|
||||
|
@ -468,7 +489,7 @@ static int hasClearShot(void)
|
|||
{
|
||||
dist = getDistance(self->x, self->y, self->target->x, self->target->y);
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (self->owner != NULL && self->owner == e->owner)
|
||||
{
|
||||
|
@ -503,7 +524,7 @@ static void preAttack(void)
|
|||
{
|
||||
fireGuns(self);
|
||||
}
|
||||
else if (self->missiles && (!(self->target->flags & (EF_NO_KILL|EF_MUST_DISABLE|EF_FRIENDLY_HEALTH_BAR))) && getDistance(self->x, self->y, self->target->x, self->target->y) >= 350)
|
||||
else if (self->missiles && (!(self->target->flags & (EF_NO_KILL | EF_MUST_DISABLE | EF_FRIENDLY_HEALTH_BAR))) && getDistance(self->x, self->y, self->target->x, self->target->y) >= 350)
|
||||
{
|
||||
fireMissile(self);
|
||||
|
||||
|
@ -665,7 +686,7 @@ static int nearEnemies(void)
|
|||
|
||||
numEnemies = 0;
|
||||
|
||||
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
||||
for (i = 0, e = candidates[i]; e != NULL; e = candidates[++i])
|
||||
{
|
||||
if ((e->flags & EF_TAKES_DAMAGE) && e->side != SIDE_NONE && e->side != self->side && !(e->flags & EF_DISABLED))
|
||||
{
|
||||
|
@ -705,7 +726,7 @@ static int evadeNonKillTargets(void)
|
|||
|
||||
numEnemies = 0;
|
||||
|
||||
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
||||
for (i = 0, e = candidates[i]; e != NULL; e = candidates[++i])
|
||||
{
|
||||
if ((e->flags & EF_TAKES_DAMAGE) && e->side != SIDE_NONE && e->side != self->side && (!(e->flags & EF_DISABLED)))
|
||||
{
|
||||
|
@ -795,7 +816,7 @@ static int nearMines(void)
|
|||
|
||||
numMines = 0;
|
||||
|
||||
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
||||
for (i = 0, e = candidates[i]; e != NULL; e = candidates[++i])
|
||||
{
|
||||
if (e->side != self->side && e->type == ET_MINE && getDistance(e->x, e->y, self->x, self->y) <= SCREEN_HEIGHT)
|
||||
{
|
||||
|
@ -903,7 +924,7 @@ static int nearItems(void)
|
|||
|
||||
self->target = NULL;
|
||||
|
||||
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
||||
for (i = 0, e = candidates[i]; e != NULL; e = candidates[++i])
|
||||
{
|
||||
if (e->type == ET_ITEM)
|
||||
{
|
||||
|
@ -951,9 +972,9 @@ static int nearTowableCraft(void)
|
|||
|
||||
self->target = NULL;
|
||||
|
||||
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
||||
for (i = 0, e = candidates[i]; e != NULL; e = candidates[++i])
|
||||
{
|
||||
if (!e->owner && (e->flags & (EF_DISABLED|EF_MISSION_TARGET)) == (EF_DISABLED|EF_MISSION_TARGET) && (e->flags & EF_ROPED_ATTACHED) == 0)
|
||||
if (!e->owner && (e->flags & (EF_DISABLED | EF_MISSION_TARGET)) == (EF_DISABLED | EF_MISSION_TARGET) && (e->flags & EF_ROPED_ATTACHED) == 0)
|
||||
{
|
||||
dist = getDistance(self->x, self->y, e->x, e->y);
|
||||
|
||||
|
@ -1004,7 +1025,7 @@ static int lookForLeader(void)
|
|||
self->leader = NULL;
|
||||
closest = 0;
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (e->active && e->flags & EF_AI_LEADER && e->side == self->side)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,29 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#define AI_EVADE 0
|
||||
#define AI_FALLBACK 1
|
||||
#define AI_HUNT 2
|
||||
#define TURN_SPEED 4
|
||||
#define TURN_THRESHOLD 2
|
||||
|
||||
extern void addHudMessage(SDL_Color c, char *format, ...);
|
||||
extern void applyFighterBrakes(void);
|
||||
extern void applyFighterThrust(void);
|
||||
extern void fireGuns(Entity *owner);
|
||||
extern void fireMissile(Entity *owner);
|
||||
extern void fireRocket(Entity *owner);
|
||||
extern Entity **getAllEntsInRadius(int x, int y, int radius, Entity *ignore);
|
||||
extern float getAngle(int x1, int y1, int x2, int y2);
|
||||
extern int getDistance(int x1, int y1, int x2, int y2);
|
||||
extern float mod(float n, float x);
|
||||
extern void runScriptFunction(char *format, ...);
|
||||
extern Entity *spawnMine(int type);
|
||||
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Dev dev;
|
||||
extern Entity *player;
|
||||
extern Entity *self;
|
||||
void checkZackariaSuspicionLevel(void);
|
||||
void checkSuspicionLevel(void);
|
||||
void doAI(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,13 +18,56 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/bullets.h"
|
||||
#include "../battle/debris.h"
|
||||
#include "../battle/effects.h"
|
||||
#include "../battle/entities.h"
|
||||
#include "../battle/hud.h"
|
||||
#include "../battle/locations.h"
|
||||
#include "../battle/messageBox.h"
|
||||
#include "../battle/missionInfo.h"
|
||||
#include "../battle/objectives.h"
|
||||
#include "../battle/player.h"
|
||||
#include "../battle/quadtree.h"
|
||||
#include "../battle/radar.h"
|
||||
#include "../battle/script.h"
|
||||
#include "../battle/spawners.h"
|
||||
#include "../battle/starfield.h"
|
||||
#include "../battle/waypoints.h"
|
||||
#include "../challenges/challengeHome.h"
|
||||
#include "../challenges/challenges.h"
|
||||
#include "../galaxy/galacticMap.h"
|
||||
#include "../galaxy/mission.h"
|
||||
#include "../game/credits.h"
|
||||
#include "../game/options.h"
|
||||
#include "../game/stats.h"
|
||||
#include "../game/trophies.h"
|
||||
#include "../json/cJSON.h"
|
||||
#include "../system/atlas.h"
|
||||
#include "../system/draw.h"
|
||||
#include "../system/input.h"
|
||||
#include "../system/modalDialog.h"
|
||||
#include "../system/sound.h"
|
||||
#include "../system/widgets.h"
|
||||
#include "battle.h"
|
||||
|
||||
#define SHOW_BATTLE 0
|
||||
#define SHOW_MENU 1
|
||||
#define SHOW_OBJECTIVES 2
|
||||
#define SHOW_OPTIONS 3
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Dev dev;
|
||||
extern Entity *player;
|
||||
extern Game game;
|
||||
|
||||
static void logic(void);
|
||||
static void draw(void);
|
||||
static void handleKeyboard(void);
|
||||
static void postBattle(void);
|
||||
void destroyBattle(void);
|
||||
static void doBattle(void);
|
||||
static void optQuitBattle(void);
|
||||
static void quitBattle(void);
|
||||
|
@ -434,7 +477,7 @@ static void postBattle(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < STAT_MAX ; i++)
|
||||
for (i = 0; i < STAT_MAX; i++)
|
||||
{
|
||||
if (i != STAT_TIME && i != STAT_EPIC_KILL_STREAK)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,80 +18,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../json/cJSON.h"
|
||||
|
||||
#define SHOW_BATTLE 0
|
||||
#define SHOW_MENU 1
|
||||
#define SHOW_OBJECTIVES 2
|
||||
#define SHOW_OPTIONS 3
|
||||
|
||||
extern void awardTrophy(char *id);
|
||||
extern void blitScaled(AtlasImage *atlasImage, int x, int y, int w, int h, int center);
|
||||
extern void cancelScript(void);
|
||||
extern void clearInput(void);
|
||||
extern void destroyBullets(void);
|
||||
extern void destroyDebris(void);
|
||||
extern void destroyEffects(void);
|
||||
extern void destroyEntities(void);
|
||||
extern void destroyQuadtree(void);
|
||||
extern void destroyScript(void);
|
||||
extern void doBullets(void);
|
||||
extern void doChallenges(void);
|
||||
extern void doDebris(void);
|
||||
extern void doEffects(void);
|
||||
extern void doEntities(void);
|
||||
extern void doHud(void);
|
||||
extern void doLocations(void);
|
||||
extern void doMessageBox(void);
|
||||
extern void doObjectives(void);
|
||||
extern void doPlayer(void);
|
||||
extern void doPlayerSelect(void);
|
||||
extern void doScript(void);
|
||||
extern void doSpawners(void);
|
||||
extern void doStars(float dx, float dy);
|
||||
extern void doWidgets(void);
|
||||
extern void drawBackground(SDL_Texture *texture);
|
||||
extern void drawBullets(void);
|
||||
extern void drawDebris(void);
|
||||
extern void drawEffects(void);
|
||||
extern void drawEntities(void);
|
||||
extern void drawHud(void);
|
||||
extern void drawLocations(void);
|
||||
extern void drawMessageBox(void);
|
||||
extern void drawMissionInfo(void);
|
||||
extern void drawOptions(void);
|
||||
extern void drawStars(void);
|
||||
extern void drawWidgets(char *groupName);
|
||||
extern Widget *getWidget(const char *name, const char *group);
|
||||
extern void initBullets(void);
|
||||
extern void initChallengeHome(void);
|
||||
extern void initCredits(void);
|
||||
extern void initDebris(void);
|
||||
extern void initEffects(void);
|
||||
extern void initEntities(void);
|
||||
extern void initGalacticMap(void);
|
||||
extern void initHud(void);
|
||||
extern void initMessageBox(void);
|
||||
extern void initOptions(void (*returnFromOptions)(void));
|
||||
extern void initQuadtree(Quadtree *root);
|
||||
extern void initRadar(void);
|
||||
extern void initStars(void);
|
||||
extern void loadMission(char *filename);
|
||||
extern void playSound(int id);
|
||||
extern void resetHud(void);
|
||||
extern void resetMessageBox(void);
|
||||
extern void resetWaypoints(void);
|
||||
extern void runScriptFunction(const char *format, ...);
|
||||
extern void scrollBackground(float x, float y);
|
||||
extern void selectWidget(const char *name, const char *group);
|
||||
extern void setAtlasColor(int r, int g, int b, int a);
|
||||
extern void showOKCancelDialog(void (*okCallback)(void), void (*cancelCallback)(void), const char *format, ...);
|
||||
extern void updateAccuracyStats(unsigned int *stats);
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Dev dev;
|
||||
extern Entity *player;
|
||||
extern Game game;
|
||||
void destroyBattle(void);
|
||||
void initBattle(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,30 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/effects.h"
|
||||
#include "../battle/fighters.h"
|
||||
#include "../battle/quadtree.h"
|
||||
#include "../game/trophies.h"
|
||||
#include "../json/cJSON.h"
|
||||
#include "../system/atlas.h"
|
||||
#include "../system/draw.h"
|
||||
#include "../system/io.h"
|
||||
#include "../system/lookup.h"
|
||||
#include "../system/sound.h"
|
||||
#include "../system/util.h"
|
||||
#include "bullets.h"
|
||||
|
||||
#define INITIAL_BULLET_DRAW_CAPACITY 32
|
||||
#define MISSILE_LIFE (FPS * 30)
|
||||
#define TURN_SPEED 2
|
||||
#define TURN_THRESHOLD 3
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Entity *player;
|
||||
|
||||
static void huntTarget(Bullet *b);
|
||||
static void checkCollisions(Bullet *b);
|
||||
static void resizeDrawList(void);
|
||||
|
@ -34,8 +56,8 @@ void initBullets(void)
|
|||
{
|
||||
drawCapacity = INITIAL_BULLET_DRAW_CAPACITY;
|
||||
|
||||
bulletsToDraw = malloc(sizeof(Bullet*) * drawCapacity);
|
||||
memset(bulletsToDraw, 0, sizeof(Bullet*) * drawCapacity);
|
||||
bulletsToDraw = malloc(sizeof(Bullet *) * drawCapacity);
|
||||
memset(bulletsToDraw, 0, sizeof(Bullet *) * drawCapacity);
|
||||
}
|
||||
|
||||
void initBulletDefs(void)
|
||||
|
@ -51,7 +73,7 @@ void initBulletDefs(void)
|
|||
|
||||
root = cJSON_Parse(text);
|
||||
|
||||
for (node = root->child ; node != NULL ; node = node->next)
|
||||
for (node = root->child; node != NULL; node = node->next)
|
||||
{
|
||||
type = lookup(cJSON_GetObjectItem(node, "type")->valuestring);
|
||||
|
||||
|
@ -78,9 +100,9 @@ void doBullets(void)
|
|||
|
||||
battle.incomingMissile = 0;
|
||||
|
||||
memset(bulletsToDraw, 0, sizeof(Bullet*) * drawCapacity);
|
||||
memset(bulletsToDraw, 0, sizeof(Bullet *) * drawCapacity);
|
||||
|
||||
for (b = battle.bulletHead.next ; b != NULL ; b = b->next)
|
||||
for (b = battle.bulletHead.next; b != NULL; b = b->next)
|
||||
{
|
||||
b->x += b->dx;
|
||||
b->y += b->dy;
|
||||
|
@ -142,7 +164,7 @@ static void resizeDrawList(void)
|
|||
|
||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, "Resizing bullet draw capacity: %d -> %d", drawCapacity, n);
|
||||
|
||||
bulletsToDraw = resize(bulletsToDraw, sizeof(Bullet*) * drawCapacity, sizeof(Bullet*) * n);
|
||||
bulletsToDraw = resize(bulletsToDraw, sizeof(Bullet *) * drawCapacity, sizeof(Bullet *) * n);
|
||||
|
||||
drawCapacity = n;
|
||||
}
|
||||
|
@ -154,7 +176,7 @@ static void checkCollisions(Bullet *b)
|
|||
|
||||
candidates = getAllEntsWithin(b->x - (b->w / 2), b->y - (b->h / 2), b->w, b->h, NULL);
|
||||
|
||||
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
||||
for (i = 0, e = candidates[i]; e != NULL; e = candidates[++i])
|
||||
{
|
||||
if (e->flags & EF_TAKES_DAMAGE)
|
||||
{
|
||||
|
@ -182,7 +204,7 @@ static void checkCollisions(Bullet *b)
|
|||
|
||||
if (battle.hasSuspicionLevel)
|
||||
{
|
||||
if (e->aiFlags & (AIF_AVOIDS_COMBAT|AIF_DEFENSIVE))
|
||||
if (e->aiFlags & (AIF_AVOIDS_COMBAT | AIF_DEFENSIVE))
|
||||
{
|
||||
battle.suspicionLevel -= (MAX_SUSPICION_LEVEL * 0.1);
|
||||
}
|
||||
|
@ -261,7 +283,7 @@ static void checkCollisions(Bullet *b)
|
|||
}
|
||||
}
|
||||
|
||||
void doBulletHitEffect(Bullet *b)
|
||||
static void doBulletHitEffect(Bullet *b)
|
||||
{
|
||||
switch (b->type)
|
||||
{
|
||||
|
@ -294,7 +316,7 @@ void drawBullets(void)
|
|||
|
||||
setAtlasColor(255, 255, 255, 255);
|
||||
|
||||
for (i = 0, b = bulletsToDraw[i] ; b != NULL ; b = bulletsToDraw[++i])
|
||||
for (i = 0, b = bulletsToDraw[i]; b != NULL; b = bulletsToDraw[++i])
|
||||
{
|
||||
blitRotated(b->texture, b->x - battle.camera.x, b->y - battle.camera.y, b->angle);
|
||||
}
|
||||
|
@ -385,7 +407,7 @@ static void selectNewTarget(Bullet *b)
|
|||
|
||||
candidates = getAllEntsInRadius(b->x, b->y, SCREEN_HEIGHT, NULL);
|
||||
|
||||
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
||||
for (i = 0, e = candidates[i]; e != NULL; e = candidates[++i])
|
||||
{
|
||||
if (e->type == ET_FIGHTER && e->side != b->owner->side && e->health > 0)
|
||||
{
|
||||
|
@ -441,7 +463,7 @@ void fireGuns(Entity *owner)
|
|||
|
||||
b = NULL;
|
||||
|
||||
for (i = 0 ; i < MAX_FIGHTER_GUNS ; i++)
|
||||
for (i = 0; i < MAX_FIGHTER_GUNS; i++)
|
||||
{
|
||||
if (owner->guns[i].type != BT_NONE && (owner->guns[i].type == owner->selectedGunType || owner->combinedGuns))
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,37 +18,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../json/cJSON.h"
|
||||
|
||||
#define INITIAL_BULLET_DRAW_CAPACITY 32
|
||||
#define MISSILE_LIFE (FPS * 30)
|
||||
#define TURN_SPEED 2
|
||||
#define TURN_THRESHOLD 3
|
||||
|
||||
extern void addBulletHitEffect(int x, int y, int r, int g, int b);
|
||||
extern void addMissileEngineEffect(Bullet *b);
|
||||
extern void addMissileExplosion(Bullet *b);
|
||||
extern void awardTrophy(char *id);
|
||||
extern void blitRotated(AtlasImage *atlasImage, int x, int y, float angle);
|
||||
extern int collision(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2);
|
||||
extern void damageFighter(Entity *e, int damage, long flags);
|
||||
extern long flagsToLong(char *flags, int *add);
|
||||
extern Entity **getAllEntsInRadius(int x, int y, int radius, Entity *ignore);
|
||||
extern Entity **getAllEntsWithin(int x, int y, int w, int h, Entity *ignore);
|
||||
extern float getAngle(int x1, int y1, int x2, int y2);
|
||||
extern AtlasImage *getAtlasImage(char *filename);
|
||||
extern int getDistance(int x1, int y1, int x2, int y2);
|
||||
extern int isOnBattleScreen(int x, int y, int w, int h);
|
||||
extern long lookup(char *name);
|
||||
extern float mod(float n, float x);
|
||||
extern void playBattleSound(int id, int x, int y);
|
||||
extern void playSound(int id);
|
||||
extern char *readFile(char *filename);
|
||||
extern void *resize(void *array, int oldSize, int newSize);
|
||||
extern void setAtlasColor(int r, int g, int b, int a);
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Entity *player;
|
||||
void destroyBullets(void);
|
||||
void destroyBulletDefs(void);
|
||||
void fireMissile(Entity *owner);
|
||||
void fireRocket(Entity *owner);
|
||||
void fireGuns(Entity *owner);
|
||||
void drawBullets(void);
|
||||
void doBullets(void);
|
||||
void initBulletDefs(void);
|
||||
void initBullets(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,32 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/ai.h"
|
||||
#include "../battle/debris.h"
|
||||
#include "../battle/effects.h"
|
||||
#include "../battle/entities.h"
|
||||
#include "../battle/fighters.h"
|
||||
#include "../battle/messageBox.h"
|
||||
#include "../battle/objectives.h"
|
||||
#include "../battle/quadtree.h"
|
||||
#include "../battle/script.h"
|
||||
#include "../json/cJSON.h"
|
||||
#include "../system/atlas.h"
|
||||
#include "../system/io.h"
|
||||
#include "../system/lookup.h"
|
||||
#include "../system/sound.h"
|
||||
#include "../system/util.h"
|
||||
#include "capitalShips.h"
|
||||
|
||||
#define TURN_SPEED 0.1
|
||||
#define TURN_THRESHOLD 2
|
||||
|
||||
extern Battle battle;
|
||||
extern Entity *player;
|
||||
extern Entity *self;
|
||||
|
||||
static int steer(void);
|
||||
static void think(void);
|
||||
static void gunThink(void);
|
||||
|
@ -46,7 +70,7 @@ Entity *spawnCapitalShip(char *name, int x, int y, int side)
|
|||
|
||||
capitalShip = NULL;
|
||||
|
||||
for (def = defHead.next ; def != NULL ; def = def->next)
|
||||
for (def = defHead.next; def != NULL; def = def->next)
|
||||
{
|
||||
if ((strcmp(def->name, name) == 0) || (def->owner != NULL && strcmp(def->owner->name, name) == 0))
|
||||
{
|
||||
|
@ -151,7 +175,7 @@ static void findAITarget(void)
|
|||
self->target = NULL;
|
||||
dist = closest = MAX_TARGET_RANGE;
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (e->active && e->side != self->side && e->flags & EF_AI_TARGET)
|
||||
{
|
||||
|
@ -197,7 +221,7 @@ static int steer(void)
|
|||
|
||||
candidates = getAllEntsInRadius(self->x, self->y, 2000, self);
|
||||
|
||||
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
||||
for (i = 0, e = candidates[i]; e != NULL; e = candidates[++i])
|
||||
{
|
||||
if (e->type == ET_CAPITAL_SHIP)
|
||||
{
|
||||
|
@ -276,7 +300,7 @@ static void gunDie(void)
|
|||
playBattleSound(SND_EXPLOSION_1 + rand() % 4, self->x, self->y);
|
||||
addDebris(self->x, self->y, 3 + rand() % 4);
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (e != self && e->health > 0 && e->owner == self->owner && e->type == ET_COMPONENT_GUN)
|
||||
{
|
||||
|
@ -313,7 +337,7 @@ static void engineDie(void)
|
|||
playBattleSound(SND_EXPLOSION_1 + rand() % 4, self->x, self->y);
|
||||
addDebris(self->x, self->y, 4 + rand() % 9);
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (e != self && e->health > 0 && e->owner == self->owner && e->type == ET_COMPONENT_ENGINE)
|
||||
{
|
||||
|
@ -354,7 +378,7 @@ static void die(void)
|
|||
|
||||
addDebris(self->x, self->y, 12);
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (e->owner == self)
|
||||
{
|
||||
|
@ -387,7 +411,7 @@ static void disable(void)
|
|||
|
||||
runScriptFunction("CAP_DISABLED %s", self->owner->name);
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (e->owner == self->owner || e == self->owner)
|
||||
{
|
||||
|
@ -411,7 +435,7 @@ void loadCapitalShipDefs(void)
|
|||
|
||||
filenames = getFileList("data/capitalShips", &count);
|
||||
|
||||
for (i = 0 ; i < count ; i++)
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
sprintf(path, "data/capitalShips/%s", filenames[i]);
|
||||
|
||||
|
@ -637,7 +661,7 @@ void updateCapitalShipComponentProperties(Entity *parent, long flags)
|
|||
flags &= ~EF_AI_LEADER;
|
||||
}
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (e->owner == parent)
|
||||
{
|
||||
|
@ -706,7 +730,7 @@ void loadCapitalShips(cJSON *node)
|
|||
flags = flagsToLong(cJSON_GetObjectItem(node, "flags")->valuestring, &addFlags);
|
||||
}
|
||||
|
||||
for (i = 0 ; i < number ; i++)
|
||||
for (i = 0; i < number; i++)
|
||||
{
|
||||
type = types[rand() % numTypes];
|
||||
|
||||
|
@ -751,7 +775,7 @@ void loadCapitalShips(cJSON *node)
|
|||
|
||||
node = node->next;
|
||||
|
||||
for (i = 0 ; i < numTypes ; i++)
|
||||
for (i = 0; i < numTypes; i++)
|
||||
{
|
||||
free(types[i]);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,39 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../json/cJSON.h"
|
||||
|
||||
#define TURN_SPEED 0.1
|
||||
#define TURN_THRESHOLD 2
|
||||
|
||||
extern void addDebris(int x, int y, int amount);
|
||||
extern void addLargeEngineEffect(void);
|
||||
extern void addLargeExplosion(void);
|
||||
extern void addMessageBox(char *title, char *body, int type);
|
||||
extern void addSmallExplosion(void);
|
||||
extern void applyFighterThrust(void);
|
||||
extern void doAI(void);
|
||||
extern long flagsToLong(char *flags, int *add);
|
||||
extern Entity **getAllEntsInRadius(int x, int y, int radius, Entity *ignore);
|
||||
extern float getAngle(int x1, int y1, int x2, int y2);
|
||||
extern AtlasImage *getAtlasImage(char *filename);
|
||||
extern int getDistance(int x1, int y1, int x2, int y2);
|
||||
extern char **getFileList(char *dir, int *count);
|
||||
extern int getJSONValue(cJSON *node, char *name, int defValue);
|
||||
extern char *getJSONValueStr(cJSON *node, char *name, char *defValue);
|
||||
extern long lookup(char *name);
|
||||
extern float mod(float n, float x);
|
||||
extern void playBattleSound(int id, int x, int y);
|
||||
extern char *readFile(char *filename);
|
||||
extern void runScriptFunction(char *format, ...);
|
||||
extern Entity *spawnEntity(void);
|
||||
extern char **toTypeArray(char *types, int *numTypes);
|
||||
extern void updateCondition(char *name, int type);
|
||||
extern void updateObjective(char *name, int type);
|
||||
|
||||
extern Battle battle;
|
||||
extern Entity *player;
|
||||
extern Entity *self;
|
||||
void destroyCapitalShipDefs(void);
|
||||
void loadCapitalShips(struct cJSON *node);
|
||||
void updateCapitalShipComponentProperties(Entity *parent, long flags);
|
||||
void loadCapitalShipDefs(void);
|
||||
void doCapitalShip(void);
|
||||
Entity *spawnCapitalShip(char *name, int x, int y, int side);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/effects.h"
|
||||
#include "../json/cJSON.h"
|
||||
#include "../system/atlas.h"
|
||||
#include "../system/draw.h"
|
||||
#include "../system/util.h"
|
||||
#include "debris.h"
|
||||
|
||||
#define INITIAL_DEBRIS_DRAW_CAPACITY 32
|
||||
#define MAX_DEBRIS_TEXTURES 6
|
||||
|
||||
extern Battle battle;
|
||||
|
||||
static void changeCourse(Debris *d);
|
||||
static void resizeDrawList(void);
|
||||
|
||||
|
@ -38,8 +50,8 @@ void initDebris(void)
|
|||
|
||||
drawCapacity = INITIAL_DEBRIS_DRAW_CAPACITY;
|
||||
|
||||
debrisToDraw = malloc(sizeof(Bullet*) * drawCapacity);
|
||||
memset(debrisToDraw, 0, sizeof(Bullet*) * drawCapacity);
|
||||
debrisToDraw = malloc(sizeof(Bullet *) * drawCapacity);
|
||||
memset(debrisToDraw, 0, sizeof(Bullet *) * drawCapacity);
|
||||
}
|
||||
|
||||
void addDebris(int x, int y, int amount)
|
||||
|
@ -47,7 +59,7 @@ void addDebris(int x, int y, int amount)
|
|||
int i;
|
||||
Debris *d;
|
||||
|
||||
for (i = 0 ; i < amount ; i++)
|
||||
for (i = 0; i < amount; i++)
|
||||
{
|
||||
d = malloc(sizeof(Debris));
|
||||
memset(d, 0, sizeof(Debris));
|
||||
|
@ -71,13 +83,13 @@ void doDebris(void)
|
|||
int i;
|
||||
Debris *d, *prev;
|
||||
|
||||
memset(debrisToDraw, 0, sizeof(Debris*) * drawCapacity);
|
||||
memset(debrisToDraw, 0, sizeof(Debris *) * drawCapacity);
|
||||
|
||||
prev = &battle.debrisHead;
|
||||
|
||||
i = 0;
|
||||
|
||||
for (d = battle.debrisHead.next ; d != NULL ; d = d->next)
|
||||
for (d = battle.debrisHead.next; d != NULL; d = d->next)
|
||||
{
|
||||
d->x += d->dx;
|
||||
d->y += d->dy;
|
||||
|
@ -127,7 +139,7 @@ static void resizeDrawList(void)
|
|||
|
||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, "Resizing debris draw capacity: %d -> %d", drawCapacity, n);
|
||||
|
||||
debrisToDraw = resize(debrisToDraw, sizeof(Debris*) * drawCapacity, sizeof(Debris*) * n);
|
||||
debrisToDraw = resize(debrisToDraw, sizeof(Debris *) * drawCapacity, sizeof(Debris *) * n);
|
||||
drawCapacity = n;
|
||||
}
|
||||
|
||||
|
@ -151,7 +163,7 @@ void drawDebris(void)
|
|||
int i;
|
||||
Debris *d;
|
||||
|
||||
for (i = 0, d = debrisToDraw[i] ; d != NULL ; d = debrisToDraw[++i])
|
||||
for (i = 0, d = debrisToDraw[i]; d != NULL; d = debrisToDraw[++i])
|
||||
{
|
||||
blitRotated(d->texture, d->x - battle.camera.x, d->y - battle.camera.y, d->angle);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,18 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../json/cJSON.h"
|
||||
|
||||
#define INITIAL_DEBRIS_DRAW_CAPACITY 32
|
||||
#define MAX_DEBRIS_TEXTURES 6
|
||||
|
||||
extern void addDebrisFire(int x, int y);
|
||||
extern void blitRotated(AtlasImage *atlasImage, int x, int y, float angle);
|
||||
extern AtlasImage *getAtlasImage(char *filename);
|
||||
extern int isOnBattleScreen(int x, int y, int w, int h);
|
||||
extern float mod(float n, float x);
|
||||
extern void *resize(void *array, int oldSize, int newSize);
|
||||
|
||||
extern Battle battle;
|
||||
void destroyDebris(void);
|
||||
void drawDebris(void);
|
||||
void doDebris(void);
|
||||
void addDebris(int x, int y, int amount);
|
||||
void initDebris(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,13 +18,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../system/atlas.h"
|
||||
#include "../system/draw.h"
|
||||
#include "../system/util.h"
|
||||
#include "effects.h"
|
||||
|
||||
#define INITIAL_EFFECT_DRAW_CAPACITY 128
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Entity *self;
|
||||
|
||||
static void setRandomFlameHue(Effect *e);
|
||||
static void setRandomShieldHue(Effect *e);
|
||||
static void resizeDrawList(void);
|
||||
static int pointOnScreen(float x, float y);
|
||||
static float calculateEffectsValue(unsigned int);
|
||||
|
||||
static AtlasImage *explosionTexture;
|
||||
static AtlasImage *shieldHitTexture;
|
||||
|
@ -40,8 +50,8 @@ void initEffects(void)
|
|||
|
||||
drawCapacity = INITIAL_EFFECT_DRAW_CAPACITY;
|
||||
|
||||
effectsToDraw = malloc(sizeof(Effect*) * drawCapacity);
|
||||
memset(effectsToDraw, 0, sizeof(Effect*) * drawCapacity);
|
||||
effectsToDraw = malloc(sizeof(Effect *) * drawCapacity);
|
||||
memset(effectsToDraw, 0, sizeof(Effect *) * drawCapacity);
|
||||
}
|
||||
|
||||
void doEffects(void)
|
||||
|
@ -52,9 +62,9 @@ void doEffects(void)
|
|||
|
||||
i = 0;
|
||||
|
||||
memset(effectsToDraw, 0, sizeof(Effect*) * drawCapacity);
|
||||
memset(effectsToDraw, 0, sizeof(Effect *) * drawCapacity);
|
||||
|
||||
for (e = battle.effectHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.effectHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
e->x += e->dx;
|
||||
e->y += e->dy;
|
||||
|
@ -124,7 +134,7 @@ static void resizeDrawList(void)
|
|||
|
||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, "Resizing effect draw capacity: %d -> %d", drawCapacity, n);
|
||||
|
||||
effectsToDraw = resize(effectsToDraw, sizeof(Effect*) * drawCapacity, sizeof(Effect*) * n);
|
||||
effectsToDraw = resize(effectsToDraw, sizeof(Effect *) * drawCapacity, sizeof(Effect *) * n);
|
||||
|
||||
drawCapacity = n;
|
||||
}
|
||||
|
@ -136,7 +146,7 @@ void drawEffects(void)
|
|||
|
||||
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
|
||||
|
||||
for (i = 0, e = effectsToDraw[i] ; e != NULL ; e = effectsToDraw[++i])
|
||||
for (i = 0, e = effectsToDraw[i]; e != NULL; e = effectsToDraw[++i])
|
||||
{
|
||||
SDL_SetRenderDrawColor(app.renderer, e->r, e->g, e->b, e->a);
|
||||
|
||||
|
@ -194,7 +204,7 @@ void addBulletHitEffect(int x, int y, int r, int g, int b)
|
|||
Effect *e;
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < 4 ; i++)
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
e = malloc(sizeof(Effect));
|
||||
memset(e, 0, sizeof(Effect));
|
||||
|
@ -203,7 +213,7 @@ void addBulletHitEffect(int x, int y, int r, int g, int b)
|
|||
|
||||
e->type = EFFECT_TEXTURE;
|
||||
e->texture = explosionTexture;
|
||||
e->size = calculateEffectsValue(16);
|
||||
e->size = 16;
|
||||
e->x = x;
|
||||
e->y = y;
|
||||
|
||||
|
@ -216,7 +226,7 @@ void addBulletHitEffect(int x, int y, int r, int g, int b)
|
|||
e->g = g;
|
||||
e->b = b;
|
||||
e->a = 64;
|
||||
e->health = calculateEffectsValue(e->a);
|
||||
e->health = e->a;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -234,12 +244,12 @@ void addSmallFighterExplosion(void)
|
|||
e->x = self->x + (rand() % 16 - rand() % 16);
|
||||
e->y = self->y + (rand() % 16 - rand() % 16);
|
||||
e->texture = explosionTexture;
|
||||
e->size = calculateEffectsValue(32);
|
||||
e->size = 32;
|
||||
|
||||
setRandomFlameHue(e);
|
||||
|
||||
e->a = 128 + (rand() % 128);
|
||||
e->health = calculateEffectsValue(e->a);
|
||||
e->health = e->a;
|
||||
|
||||
e->x -= e->size / 2;
|
||||
e->y -= e->size / 2;
|
||||
|
@ -259,12 +269,12 @@ void addDebrisFire(int x, int y)
|
|||
e->x = x + (rand() % 8 - rand() % 8);
|
||||
e->y = y + (rand() % 8 - rand() % 8);
|
||||
e->texture = explosionTexture;
|
||||
e->size = calculateEffectsValue(4 + rand() % 12);
|
||||
e->size = 4 + rand() % 12;
|
||||
|
||||
setRandomFlameHue(e);
|
||||
|
||||
e->a = rand() % 256;
|
||||
e->health = calculateEffectsValue(e->a);
|
||||
e->health = e->a;
|
||||
|
||||
e->x -= e->size / 2;
|
||||
e->y -= e->size / 2;
|
||||
|
@ -275,7 +285,7 @@ void addSmallExplosion(void)
|
|||
int i;
|
||||
Effect *e;
|
||||
|
||||
for (i = 0 ; i < 32 ; i++)
|
||||
for (i = 0; i < 32; i++)
|
||||
{
|
||||
e = malloc(sizeof(Effect));
|
||||
memset(e, 0, sizeof(Effect));
|
||||
|
@ -291,19 +301,19 @@ void addSmallExplosion(void)
|
|||
e->dy = (rand() % 25) - (rand() % 25);
|
||||
e->dy *= 0.025;
|
||||
e->texture = explosionTexture;
|
||||
e->size = calculateEffectsValue(32 + (rand() % 64));
|
||||
e->size = 32 + (rand() % 64);
|
||||
e->r = 255;
|
||||
|
||||
setRandomFlameHue(e);
|
||||
|
||||
e->a = 128 + (rand() % 128);
|
||||
e->health = calculateEffectsValue(e->a);
|
||||
e->health = e->a;
|
||||
|
||||
e->x -= e->size / 2;
|
||||
e->y -= e->size / 2;
|
||||
}
|
||||
|
||||
for (i = 0 ; i < 96 ; i++)
|
||||
for (i = 0; i < 96; i++)
|
||||
{
|
||||
e = malloc(sizeof(Effect));
|
||||
memset(e, 0, sizeof(Effect));
|
||||
|
@ -319,7 +329,7 @@ void addSmallExplosion(void)
|
|||
e->dy *= 0.1;
|
||||
|
||||
e->a = 128;
|
||||
e->health = calculateEffectsValue(e->a);
|
||||
e->health = e->a;
|
||||
|
||||
setRandomFlameHue(e);
|
||||
}
|
||||
|
@ -330,7 +340,7 @@ void addMineExplosion(void)
|
|||
int i;
|
||||
Effect *e;
|
||||
|
||||
for (i = 0 ; i < 64 ; i++)
|
||||
for (i = 0; i < 64; i++)
|
||||
{
|
||||
e = malloc(sizeof(Effect));
|
||||
memset(e, 0, sizeof(Effect));
|
||||
|
@ -342,13 +352,13 @@ void addMineExplosion(void)
|
|||
e->x = self->x + rand() % 64 - rand() % 64;
|
||||
e->y = self->y + rand() % 64 - rand() % 64;
|
||||
e->texture = explosionTexture;
|
||||
e->size = calculateEffectsValue(64 + (rand() % 64));
|
||||
e->size = 64 + (rand() % 64);
|
||||
e->r = 255;
|
||||
|
||||
setRandomFlameHue(e);
|
||||
|
||||
e->a = 32 + (rand() % 192);
|
||||
e->health = calculateEffectsValue(e->a);
|
||||
e->health = e->a;
|
||||
|
||||
e->x -= e->size / 2;
|
||||
e->y -= e->size / 2;
|
||||
|
@ -363,7 +373,7 @@ void addMineExplosion(void)
|
|||
e->type = EFFECT_HALO;
|
||||
e->x = self->x;
|
||||
e->y = self->y;
|
||||
e->size = calculateEffectsValue(64);
|
||||
e->size = 64;
|
||||
e->scaleAmount = 6;
|
||||
e->texture = haloTexture;
|
||||
|
||||
|
@ -372,7 +382,7 @@ void addMineExplosion(void)
|
|||
e->b = 255;
|
||||
e->a = 128;
|
||||
|
||||
e->health = calculateEffectsValue(128);
|
||||
e->health = 128;
|
||||
}
|
||||
|
||||
void addLargeExplosion(void)
|
||||
|
@ -380,7 +390,7 @@ void addLargeExplosion(void)
|
|||
int i;
|
||||
Effect *e;
|
||||
|
||||
for (i = 0 ; i < 64 ; i++)
|
||||
for (i = 0; i < 64; i++)
|
||||
{
|
||||
e = malloc(sizeof(Effect));
|
||||
memset(e, 0, sizeof(Effect));
|
||||
|
@ -396,13 +406,13 @@ void addLargeExplosion(void)
|
|||
e->dy = (rand() % 25) - (rand() % 25);
|
||||
e->dy *= 0.01;
|
||||
e->texture = explosionTexture;
|
||||
e->size = calculateEffectsValue(128 + (rand() % 512));
|
||||
e->size = 128 + (rand() % 512);
|
||||
e->r = 255;
|
||||
|
||||
setRandomFlameHue(e);
|
||||
|
||||
e->a = 128 + (rand() % 128);
|
||||
e->health = calculateEffectsValue(e->a);
|
||||
e->health = e->a;
|
||||
|
||||
e->x -= e->size / 2;
|
||||
e->y -= e->size / 2;
|
||||
|
@ -417,7 +427,7 @@ void addLargeExplosion(void)
|
|||
e->type = EFFECT_HALO;
|
||||
e->x = self->x;
|
||||
e->y = self->y;
|
||||
e->size = calculateEffectsValue(256);
|
||||
e->size = 256;
|
||||
e->scaleAmount = 4;
|
||||
e->texture = haloTexture;
|
||||
|
||||
|
@ -426,7 +436,7 @@ void addLargeExplosion(void)
|
|||
e->b = 255;
|
||||
e->a = 255;
|
||||
|
||||
e->health = calculateEffectsValue(255);
|
||||
e->health = 255;
|
||||
}
|
||||
|
||||
void addMissileExplosion(Bullet *b)
|
||||
|
@ -434,7 +444,7 @@ void addMissileExplosion(Bullet *b)
|
|||
int i;
|
||||
Effect *e;
|
||||
|
||||
for (i = 0 ; i < 8 ; i++)
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
e = malloc(sizeof(Effect));
|
||||
memset(e, 0, sizeof(Effect));
|
||||
|
@ -450,19 +460,19 @@ void addMissileExplosion(Bullet *b)
|
|||
e->dy = (rand() % 25) - (rand() % 25);
|
||||
e->dy *= 0.025;
|
||||
e->texture = explosionTexture;
|
||||
e->size = calculateEffectsValue(32 + (rand() % 64));
|
||||
e->size = 32 + (rand() % 64);
|
||||
e->r = 255;
|
||||
|
||||
setRandomFlameHue(e);
|
||||
|
||||
e->a = 128 + (rand() % 128);
|
||||
e->health = calculateEffectsValue(e->a);
|
||||
e->health = e->a;
|
||||
|
||||
e->x -= e->size / 2;
|
||||
e->y -= e->size / 2;
|
||||
}
|
||||
|
||||
for (i = 0 ; i < 24 ; i++)
|
||||
for (i = 0; i < 24; i++)
|
||||
{
|
||||
e = malloc(sizeof(Effect));
|
||||
memset(e, 0, sizeof(Effect));
|
||||
|
@ -478,7 +488,7 @@ void addMissileExplosion(Bullet *b)
|
|||
e->dy *= 0.1;
|
||||
|
||||
e->a = 128;
|
||||
e->health = calculateEffectsValue(e->a);
|
||||
e->health = e->a;
|
||||
|
||||
setRandomFlameHue(e);
|
||||
}
|
||||
|
@ -508,13 +518,13 @@ void addEngineEffect(void)
|
|||
e->x += rand() % 4 - rand() % 4;
|
||||
|
||||
e->texture = explosionTexture;
|
||||
e->size = calculateEffectsValue(16);
|
||||
e->size = 16;
|
||||
e->r = 128;
|
||||
e->g = 128;
|
||||
e->b = 255;
|
||||
e->a = 64;
|
||||
|
||||
e->health = calculateEffectsValue(e->a);
|
||||
e->health = e->a;
|
||||
|
||||
e->x -= e->size / 2;
|
||||
e->y -= e->size / 2;
|
||||
|
@ -541,13 +551,13 @@ void addLargeEngineEffect(void)
|
|||
e->x -= rand() % 4;
|
||||
|
||||
e->texture = explosionTexture;
|
||||
e->size = calculateEffectsValue(64);
|
||||
e->size = 64;
|
||||
e->r = 128;
|
||||
e->g = 128;
|
||||
e->b = 255;
|
||||
e->a = 64;
|
||||
|
||||
e->health = calculateEffectsValue(e->a);
|
||||
e->health = e->a;
|
||||
|
||||
e->x -= e->size / 2;
|
||||
e->y -= e->size / 2;
|
||||
|
@ -574,11 +584,11 @@ void addMissileEngineEffect(Bullet *b)
|
|||
e->x -= rand() % 4;
|
||||
|
||||
e->texture = explosionTexture;
|
||||
e->size = calculateEffectsValue(12);
|
||||
e->size = 12;
|
||||
setRandomFlameHue(e);
|
||||
e->a = 128;
|
||||
|
||||
e->health = calculateEffectsValue(e->a);
|
||||
e->health = e->a;
|
||||
|
||||
e->x -= e->size / 2;
|
||||
e->y -= e->size / 2;
|
||||
|
@ -589,7 +599,7 @@ void addShieldSplinterEffect(Entity *ent)
|
|||
int i;
|
||||
Effect *e;
|
||||
|
||||
for (i = 0 ; i < 48 ; i++)
|
||||
for (i = 0; i < 48; i++)
|
||||
{
|
||||
e = malloc(sizeof(Effect));
|
||||
memset(e, 0, sizeof(Effect));
|
||||
|
@ -616,7 +626,7 @@ void addECMEffect(Entity *ent)
|
|||
int i;
|
||||
Effect *e;
|
||||
|
||||
for (i = 0 ; i < 3 ; i++)
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
e = malloc(sizeof(Effect));
|
||||
|
||||
|
@ -696,16 +706,3 @@ void destroyEffects(void)
|
|||
|
||||
effectsToDraw = NULL;
|
||||
}
|
||||
|
||||
static float calculateEffectsValue(unsigned int val)
|
||||
{
|
||||
#if defined(__amigaos4__)
|
||||
if (app.effects)
|
||||
{
|
||||
return val / (app.effects * 2);
|
||||
}
|
||||
#endif
|
||||
|
||||
return (float)val;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,17 +18,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#define INITIAL_EFFECT_DRAW_CAPACITY 128
|
||||
|
||||
extern void blitScaled(AtlasImage *atlasImage, int x, int y, int w, int h, int center);
|
||||
extern int collision(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2);
|
||||
extern AtlasImage *getAtlasImage(char *name);
|
||||
extern int isOnBattleScreen(int x, int y, int w, int h);
|
||||
extern void *resize(void *array, int oldSize, int newSize);
|
||||
extern void setAtlasColor(int r, int g, int b, int a);
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Entity *self;
|
||||
void destroyEffects(void);
|
||||
void addECMEffect(Entity *ent);
|
||||
void addShieldSplinterEffect(Entity *ent);
|
||||
void addMissileEngineEffect(Bullet *b);
|
||||
void addLargeEngineEffect(void);
|
||||
void addEngineEffect(void);
|
||||
void addMissileExplosion(Bullet *b);
|
||||
void addLargeExplosion(void);
|
||||
void addMineExplosion(void);
|
||||
void addSmallExplosion(void);
|
||||
void addDebrisFire(int x, int y);
|
||||
void addSmallFighterExplosion(void);
|
||||
void addBulletHitEffect(int x, int y, int r, int g, int b);
|
||||
void drawShieldHitEffect(Entity *e);
|
||||
void drawEffects(void);
|
||||
void doEffects(void);
|
||||
void initEffects(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,29 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/capitalShips.h"
|
||||
#include "../battle/effects.h"
|
||||
#include "../battle/fighters.h"
|
||||
#include "../battle/quadtree.h"
|
||||
#include "../battle/rope.h"
|
||||
#include "../game/trophies.h"
|
||||
#include "../system/atlas.h"
|
||||
#include "../system/draw.h"
|
||||
#include "../system/lookup.h"
|
||||
#include "entities.h"
|
||||
|
||||
#define DISABLED_GLOW_MAX 255
|
||||
#define DISABLED_GLOW_MIN 128
|
||||
#define DISABLED_GLOW_SPEED 3
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Dev dev;
|
||||
extern Entity *player;
|
||||
extern Entity *self;
|
||||
|
||||
static void drawEntity(Entity *e);
|
||||
static void doEntity(void);
|
||||
static void alignComponents(void);
|
||||
|
@ -75,7 +96,7 @@ void doEntities(void)
|
|||
player->shield = player->maxShield;
|
||||
}
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
removeFromQuadtree(e, &battle.quadtree);
|
||||
|
||||
|
@ -178,7 +199,7 @@ void doEntities(void)
|
|||
|
||||
if (e->killedBy == player && battle.hasSuspicionLevel)
|
||||
{
|
||||
if (e->aiFlags & (AIF_AVOIDS_COMBAT|AIF_DEFENSIVE))
|
||||
if (e->aiFlags & (AIF_AVOIDS_COMBAT | AIF_DEFENSIVE))
|
||||
{
|
||||
battle.suspicionLevel -= (MAX_SUSPICION_LEVEL * 0.5);
|
||||
}
|
||||
|
@ -352,7 +373,7 @@ static void alignComponents(void)
|
|||
float x, y;
|
||||
float c, s;
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (isComponent(e))
|
||||
{
|
||||
|
@ -393,11 +414,13 @@ void drawEntities(void)
|
|||
candidates = getAllEntsWithin(battle.camera.x, battle.camera.y, app.winWidth, app.winHeight, NULL);
|
||||
|
||||
/* counting entities to draw */
|
||||
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i]) {};
|
||||
for (i = 0, e = candidates[i]; e != NULL; e = candidates[++i])
|
||||
{
|
||||
};
|
||||
|
||||
qsort(candidates, i, sizeof(Entity*), drawComparator);
|
||||
qsort(candidates, i, sizeof(Entity *), drawComparator);
|
||||
|
||||
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
||||
for (i = 0, e = candidates[i]; e != NULL; e = candidates[++i])
|
||||
{
|
||||
self = e;
|
||||
|
||||
|
@ -531,7 +554,7 @@ void activateEntities(char *names)
|
|||
|
||||
while (name)
|
||||
{
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (strcmp(e->name, name) == 0)
|
||||
{
|
||||
|
@ -559,7 +582,7 @@ void activateEntityGroups(char *groupNames)
|
|||
|
||||
while (groupName)
|
||||
{
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (strcmp(e->groupName, groupName) == 0)
|
||||
{
|
||||
|
@ -588,7 +611,7 @@ static void notifyNewArrivals(void)
|
|||
{
|
||||
Entity *e;
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (e->active && (e->type == ET_FIGHTER || e->type == ET_CAPITAL_SHIP))
|
||||
{
|
||||
|
@ -601,7 +624,7 @@ static void activateEpicFighters(int side)
|
|||
{
|
||||
Entity *e;
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (!e->active && e->type == ET_FIGHTER && !(e->flags & EF_NO_EPIC) && ((side == SIDE_ALLIES && e->side == SIDE_ALLIES) || (side != SIDE_ALLIES && e->side != SIDE_ALLIES)))
|
||||
{
|
||||
|
@ -626,7 +649,7 @@ void countNumEnemies(void)
|
|||
{
|
||||
Entity *e;
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (e->side != SIDE_ALLIES && (e->type == ET_FIGHTER || e->type == ET_CAPITAL_SHIP) && (!(e->flags & EF_NO_THREAT)))
|
||||
{
|
||||
|
@ -641,7 +664,7 @@ void addAllToQuadtree(void)
|
|||
{
|
||||
Entity *e;
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (e->active)
|
||||
{
|
||||
|
@ -652,8 +675,8 @@ void addAllToQuadtree(void)
|
|||
|
||||
static int drawComparator(const void *a, const void *b)
|
||||
{
|
||||
Entity *e1 = *((Entity**)a);
|
||||
Entity *e2 = *((Entity**)b);
|
||||
Entity *e1 = *((Entity **)a);
|
||||
Entity *e2 = *((Entity **)b);
|
||||
|
||||
return e2->type - e1->type;
|
||||
}
|
||||
|
@ -662,7 +685,7 @@ void killEntity(char *name)
|
|||
{
|
||||
Entity *e;
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (strcmp(e->name, name) == 0)
|
||||
{
|
||||
|
@ -683,7 +706,7 @@ void updateEntitySide(char *sideStr, char *name)
|
|||
|
||||
side = lookup(sideStr);
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (strcmp(e->name, name) == 0)
|
||||
{
|
||||
|
@ -701,7 +724,7 @@ void awardPandoranCraftTrophy(void)
|
|||
{
|
||||
Entity *e;
|
||||
|
||||
for (e = deadHead.next ; e != NULL ; e = e->next)
|
||||
for (e = deadHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (e->killedBy == player && e->side == SIDE_PANDORAN)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,31 +18,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#define DISABLED_GLOW_MAX 255
|
||||
#define DISABLED_GLOW_MIN 128
|
||||
#define DISABLED_GLOW_SPEED 3
|
||||
|
||||
extern void addToQuadtree(Entity *e, Quadtree *root);
|
||||
extern void awardTrophy(char *id);
|
||||
extern void blitRotated(AtlasImage *atlasImage, int x, int y, float angle);
|
||||
extern void cutRope(Entity *e);
|
||||
extern void doCapitalShip(void);
|
||||
extern void doFighter(void);
|
||||
extern void doRope(Entity *e);
|
||||
extern void drawRope(Entity *e);
|
||||
extern void drawShieldHitEffect(Entity *e);
|
||||
extern Entity **getAllEntsWithin(int x, int y, int w, int h, Entity *ignore);
|
||||
extern int isOnBattleScreen(int x, int y, int w, int h);
|
||||
extern long lookup(char *name);
|
||||
extern void removeFromQuadtree(Entity *e, Quadtree *root);
|
||||
extern void resetFighter(Entity *e);
|
||||
extern void setAtlasColor(int r, int g, int b, int a);
|
||||
extern void updateCapitalShipComponentProperties(Entity *parent, long flags);
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Dev dev;
|
||||
extern Entity *player;
|
||||
extern Entity *self;
|
||||
void destroyEntities(void);
|
||||
void awardPandoranCraftTrophy(void);
|
||||
void updateEntitySide(char *sideStr, char *name);
|
||||
void killEntity(char *name);
|
||||
void addAllToQuadtree(void);
|
||||
void countNumEnemies(void);
|
||||
void activateEntityGroups(char *groupNames);
|
||||
void activateEntities(char *names);
|
||||
void drawEntities(void);
|
||||
void doEntities(void);
|
||||
Entity *spawnEntity(void);
|
||||
void initEntities(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,33 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/ai.h"
|
||||
#include "../battle/debris.h"
|
||||
#include "../battle/effects.h"
|
||||
#include "../battle/entities.h"
|
||||
#include "../battle/hud.h"
|
||||
#include "../battle/items.h"
|
||||
#include "../battle/objectives.h"
|
||||
#include "../battle/quadtree.h"
|
||||
#include "../battle/rope.h"
|
||||
#include "../battle/script.h"
|
||||
#include "../galaxy/mission.h"
|
||||
#include "../json/cJSON.h"
|
||||
#include "../system/atlas.h"
|
||||
#include "../system/io.h"
|
||||
#include "../system/lookup.h"
|
||||
#include "../system/sound.h"
|
||||
#include "../system/util.h"
|
||||
#include "fighters.h"
|
||||
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Entity *player;
|
||||
extern Entity *self;
|
||||
extern Game game;
|
||||
|
||||
static void separate(void);
|
||||
static void die(void);
|
||||
static void immediateDie(void);
|
||||
|
@ -151,7 +176,7 @@ static void randomizeDartGuns(Entity *dart)
|
|||
dart->guns[0].type = BT_PLASMA;
|
||||
dart->guns[0].x = dart->guns[0].y = 0;
|
||||
|
||||
for (i = 1 ; i < MAX_FIGHTER_GUNS ; i++)
|
||||
for (i = 1; i < MAX_FIGHTER_GUNS; i++)
|
||||
{
|
||||
if (dart->guns[i].type)
|
||||
{
|
||||
|
@ -172,7 +197,6 @@ static void randomizeDartGuns(Entity *dart)
|
|||
dart->guns[2].y = -10;
|
||||
break;
|
||||
|
||||
|
||||
/* Plasma / Laser cannons */
|
||||
case 3:
|
||||
dart->guns[0].type = BT_PLASMA;
|
||||
|
@ -398,7 +422,7 @@ static void separate(void)
|
|||
|
||||
candidates = getAllEntsInRadius(self->x, self->y, self->separationRadius, self);
|
||||
|
||||
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
||||
for (i = 0, e = candidates[i]; e != NULL; e = candidates[++i])
|
||||
{
|
||||
if ((e->flags & EF_TAKES_DAMAGE) && (!(e->flags & EF_NON_SOLID)))
|
||||
{
|
||||
|
@ -683,7 +707,7 @@ void retreatEnemies(void)
|
|||
{
|
||||
Entity *e;
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (e->type == ET_FIGHTER && e->side != player->side)
|
||||
{
|
||||
|
@ -708,7 +732,7 @@ void retreatAllies(void)
|
|||
{
|
||||
Entity *e;
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (e->type == ET_FIGHTER && e->side == player->side)
|
||||
{
|
||||
|
@ -735,7 +759,7 @@ static Entity *getFighterDef(char *name)
|
|||
{
|
||||
Entity *e;
|
||||
|
||||
for (e = defHead.next ; e != NULL ; e = e->next)
|
||||
for (e = defHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (strcmp(e->name, name) == 0)
|
||||
{
|
||||
|
@ -754,7 +778,7 @@ Entity **getDBFighters(int *num)
|
|||
|
||||
i = *num = 0;
|
||||
|
||||
for (e = defHead.next ; e != NULL ; e = e->next)
|
||||
for (e = defHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (e->description != NULL)
|
||||
{
|
||||
|
@ -762,9 +786,9 @@ Entity **getDBFighters(int *num)
|
|||
}
|
||||
}
|
||||
|
||||
dbFighters = malloc(sizeof(Entity*) * *num);
|
||||
dbFighters = malloc(sizeof(Entity *) * *num);
|
||||
|
||||
for (e = defHead.next ; e != NULL ; e = e->next)
|
||||
for (e = defHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (e->description != NULL)
|
||||
{
|
||||
|
@ -795,7 +819,7 @@ static void loadFighterDefList(char *dir)
|
|||
|
||||
filenames = getFileList(dir, &count);
|
||||
|
||||
for (i = 0 ; i < count ; i++)
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
sprintf(path, "%s/%s", dir, filenames[i]);
|
||||
|
||||
|
@ -854,7 +878,7 @@ static void loadFighterDef(char *filename)
|
|||
{
|
||||
i = 0;
|
||||
|
||||
for (node = cJSON_GetObjectItem(root, "guns")->child ; node != NULL ; node = node->next)
|
||||
for (node = cJSON_GetObjectItem(root, "guns")->child; node != NULL; node = node->next)
|
||||
{
|
||||
e->guns[i].type = lookup(cJSON_GetObjectItem(node, "type")->valuestring);
|
||||
e->guns[i].x = cJSON_GetObjectItem(node, "x")->valueint;
|
||||
|
@ -916,7 +940,7 @@ static void addFighterStat(char *key)
|
|||
|
||||
tail = &game.fighterStatHead;
|
||||
|
||||
for (t = game.fighterStatHead.next ; t != NULL ; t = t->next)
|
||||
for (t = game.fighterStatHead.next; t != NULL; t = t->next)
|
||||
{
|
||||
if (strcmp(t->key, key) == 0)
|
||||
{
|
||||
|
@ -940,7 +964,7 @@ static void incFighterStat(char *key)
|
|||
{
|
||||
Tuple *t;
|
||||
|
||||
for (t = game.fighterStatHead.next ; t != NULL ; t = t->next)
|
||||
for (t = game.fighterStatHead.next; t != NULL; t = t->next)
|
||||
{
|
||||
if (strcmp(t->key, key) == 0)
|
||||
{
|
||||
|
@ -992,7 +1016,7 @@ void loadFighters(cJSON *node)
|
|||
aiFlags = flagsToLong(cJSON_GetObjectItem(node, "aiFlags")->valuestring, &addAIFlags);
|
||||
}
|
||||
|
||||
for (i = 0 ; i < number ; i++)
|
||||
for (i = 0; i < number; i++)
|
||||
{
|
||||
type = types[rand() % numTypes];
|
||||
|
||||
|
@ -1060,7 +1084,7 @@ void loadFighters(cJSON *node)
|
|||
|
||||
node = node->next;
|
||||
|
||||
for (i = 0 ; i < numTypes ; i++)
|
||||
for (i = 0; i < numTypes; i++)
|
||||
{
|
||||
free(types[i]);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,42 +18,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../json/cJSON.h"
|
||||
|
||||
extern void addDebris(int x, int y, int amount);
|
||||
extern void addEngineEffect(void);
|
||||
extern void addHudMessage(SDL_Color c, char *format, ...);
|
||||
extern void addRandomItem(int x, int y);
|
||||
extern void addShieldSplinterEffect(Entity *ent);
|
||||
extern void addSmallExplosion(void);
|
||||
extern void addSmallFighterExplosion(void);
|
||||
extern void adjustObjectiveTargetValue(char *name, int type, int amount);
|
||||
extern void attachRope(void);
|
||||
extern void checkSuspicionLevel(void);
|
||||
extern void checkZackariaSuspicionLevel(void);
|
||||
extern void completeMission(void);
|
||||
extern void doAI(void);
|
||||
extern long flagsToLong(char *flags, int *add);
|
||||
extern Entity **getAllEntsInRadius(int x, int y, int radius, Entity *ignore);
|
||||
extern float getAngle(int x1, int y1, int x2, int y2);
|
||||
extern AtlasImage *getAtlasImage(char *filename);
|
||||
extern int getDistance(int x1, int y1, int x2, int y2);
|
||||
extern char **getFileList(char *dir, int *count);
|
||||
extern int getJSONValue(cJSON *node, char *name, int defValue);
|
||||
extern char *getJSONValueStr(cJSON *node, char *name, char *defValue);
|
||||
extern long lookup(char *name);
|
||||
extern void playBattleSound(int id, int x, int y);
|
||||
extern char *readFile(char *filename);
|
||||
extern void runScriptFunction(char *format, ...);
|
||||
extern Entity *spawnEntity(void);
|
||||
extern char **toTypeArray(char *types, int *numTypes);
|
||||
extern void updateCondition(char *name, int type);
|
||||
extern void updateObjective(char *name, int type);
|
||||
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Entity *player;
|
||||
extern Entity *self;
|
||||
extern Game game;
|
||||
void destroyFighterStats(void);
|
||||
void destroyFighterDefs(void);
|
||||
void loadFighters(struct cJSON *node);
|
||||
void loadFighterDefs(void);
|
||||
Entity **getDBFighters(int *num);
|
||||
void retreatAllies(void);
|
||||
void retreatEnemies(void);
|
||||
void damageFighter(Entity *e, int amount, long flags);
|
||||
void applyFighterBrakes(void);
|
||||
void applyFighterThrust(void);
|
||||
void doFighter(void);
|
||||
void resetFighter(Entity *fighter);
|
||||
Entity *spawnFighter(char *name, int x, int y, int side);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/jumpgate.h"
|
||||
#include "../battle/player.h"
|
||||
#include "../battle/radar.h"
|
||||
#include "../system/atlas.h"
|
||||
#include "../system/draw.h"
|
||||
#include "../system/text.h"
|
||||
#include "../system/util.h"
|
||||
#include "hud.h"
|
||||
|
||||
#define MAX_HUD_MESSAGES 6
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Entity *player;
|
||||
extern Game game;
|
||||
|
||||
static void drawPlayerTargeter(void);
|
||||
static void drawNumFighters(void);
|
||||
static void drawHealthBars(void);
|
||||
|
@ -113,7 +130,7 @@ void doHud(void)
|
|||
|
||||
prev = &hudMessageHead;
|
||||
|
||||
for (hudMessage = hudMessageHead.next ; hudMessage != NULL ; hudMessage = hudMessage->next)
|
||||
for (hudMessage = hudMessageHead.next; hudMessage != NULL; hudMessage = hudMessage->next)
|
||||
{
|
||||
hudMessage->life--;
|
||||
|
||||
|
@ -332,7 +349,7 @@ static void drawWeaponInfo(void)
|
|||
{
|
||||
y = 70;
|
||||
|
||||
for (i = 0 ; i < BT_MAX ; i++)
|
||||
for (i = 0; i < BT_MAX; i++)
|
||||
{
|
||||
if (playerHasGun(i))
|
||||
{
|
||||
|
@ -601,7 +618,7 @@ static void drawHudMessages(void)
|
|||
HudMessage *hudMessage;
|
||||
int y = app.winHeight - 25;
|
||||
|
||||
for (hudMessage = hudMessageHead.next ; hudMessage != NULL ; hudMessage = hudMessage->next)
|
||||
for (hudMessage = hudMessageHead.next; hudMessage != NULL; hudMessage = hudMessage->next)
|
||||
{
|
||||
drawText(10, y, 14, TA_LEFT, hudMessage->color, hudMessage->message);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,26 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#define MAX_HUD_MESSAGES 6
|
||||
|
||||
extern void blit(AtlasImage *atlasImage, int x, int y, int center);
|
||||
extern void blitRotated(AtlasImage *atlasImage, int x, int y, float angle);
|
||||
extern void drawRadar(void);
|
||||
extern void drawRadarRangeWarning(void);
|
||||
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
|
||||
extern float getAngle(int x1, int y1, int x2, int y2);
|
||||
extern AtlasImage *getAtlasImage(char *filename);
|
||||
extern int getDistance(int x1, int y1, int x2, int y2);
|
||||
extern int getPercent(float current, float total);
|
||||
extern int jumpgateEnabled(void);
|
||||
extern int playerHasGun(int type);
|
||||
extern void setAtlasColor(int r, int g, int b, int a);
|
||||
extern char *timeToString(long millis, int showHours);
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Entity *player;
|
||||
extern Game game;
|
||||
void resetHud(void);
|
||||
void drawHud(void);
|
||||
void addHudMessage(SDL_Color c, char *format, ...);
|
||||
void doHud(void);
|
||||
void initHud(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/entities.h"
|
||||
#include "../battle/hud.h"
|
||||
#include "../battle/objectives.h"
|
||||
#include "../battle/quadtree.h"
|
||||
#include "../json/cJSON.h"
|
||||
#include "../system/atlas.h"
|
||||
#include "../system/io.h"
|
||||
#include "../system/lookup.h"
|
||||
#include "../system/sound.h"
|
||||
#include "../system/util.h"
|
||||
#include "items.h"
|
||||
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Entity *player;
|
||||
extern Entity *self;
|
||||
|
||||
static void action(void);
|
||||
static Entity *getItemDef(char *name);
|
||||
|
||||
|
@ -38,7 +55,7 @@ void loadItemDefs(void)
|
|||
memset(&defHead, 0, sizeof(Entity));
|
||||
defTail = &defHead;
|
||||
|
||||
for (node = root->child ; node != NULL ; node = node->next)
|
||||
for (node = root->child; node != NULL; node = node->next)
|
||||
{
|
||||
e = malloc(sizeof(Entity));
|
||||
memset(e, 0, sizeof(Entity));
|
||||
|
@ -76,7 +93,7 @@ Entity *spawnItem(char *name)
|
|||
}
|
||||
else
|
||||
{
|
||||
for (e = defHead.next ; e != NULL ; e = e->next)
|
||||
for (e = defHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (!def || rand() % 2)
|
||||
{
|
||||
|
@ -113,7 +130,7 @@ static Entity *getItemDef(char *defName)
|
|||
{
|
||||
Entity *e;
|
||||
|
||||
for (e = defHead.next ; e != NULL ; e = e->next)
|
||||
for (e = defHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (strcmp(e->defName, defName) == 0)
|
||||
{
|
||||
|
@ -132,7 +149,7 @@ static void action(void)
|
|||
|
||||
candidates = getAllEntsInRadius(self->x, self->y, MAX(self->w, self->h), self);
|
||||
|
||||
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
||||
for (i = 0, e = candidates[i]; e != NULL; e = candidates[++i])
|
||||
{
|
||||
if (e->alive == ALIVE_ALIVE && (e->flags & EF_COLLECTS_ITEMS) && collision(self->x - (self->w / 2), self->y - (self->h / 2), self->w, self->h, e->x - (e->w / 2), e->y - (e->h / 2), e->w, e->h))
|
||||
{
|
||||
|
@ -190,7 +207,7 @@ void loadItems(cJSON *node)
|
|||
flags = flagsToLong(cJSON_GetObjectItem(node, "flags")->valuestring, &addFlags);
|
||||
}
|
||||
|
||||
for (i = 0 ; i < number ; i++)
|
||||
for (i = 0; i < number; i++)
|
||||
{
|
||||
e = spawnItem(type);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,23 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../json/cJSON.h"
|
||||
|
||||
extern void addHudMessage(SDL_Color c, char *format, ...);
|
||||
extern int collision(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2);
|
||||
extern long flagsToLong(char *flags, int *add);
|
||||
extern Entity **getAllEntsInRadius(int x, int y, int radius, Entity *ignore);
|
||||
extern AtlasImage *getAtlasImage(char *filename);
|
||||
extern int getJSONValue(cJSON *node, char *name, int defValue);
|
||||
extern char *getJSONValueStr(cJSON *node, char *name, char *defValue);
|
||||
extern void playBattleSound(int id, int x, int y);
|
||||
extern char *readFile(char *filename);
|
||||
extern Entity *spawnEntity(void);
|
||||
extern void updateObjective(char *name, int type);
|
||||
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Entity *player;
|
||||
extern Entity *self;
|
||||
void destroyItemDefs(void);
|
||||
void loadItems(struct cJSON *node);
|
||||
void addRandomItem(int x, int y);
|
||||
Entity *spawnItem(char *name);
|
||||
void loadItemDefs(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/debris.h"
|
||||
#include "../battle/effects.h"
|
||||
#include "../battle/entities.h"
|
||||
#include "../battle/objectives.h"
|
||||
#include "../battle/quadtree.h"
|
||||
#include "../battle/script.h"
|
||||
#include "../system/atlas.h"
|
||||
#include "../system/draw.h"
|
||||
#include "../system/sound.h"
|
||||
#include "../system/util.h"
|
||||
#include "jumpgate.h"
|
||||
|
||||
#define ESCAPE_DISTANCE 256
|
||||
|
||||
extern Battle battle;
|
||||
extern Entity *self;
|
||||
|
||||
static void think(void);
|
||||
static void draw(void);
|
||||
static void handleFleeingEntities(void);
|
||||
|
@ -47,7 +64,7 @@ Entity *spawnJumpgate(int side, long flags)
|
|||
jumpgate->action = think;
|
||||
jumpgate->draw = draw;
|
||||
jumpgate->side = side;
|
||||
jumpgate->flags = EF_NO_MT_BOX+EF_IMMORTAL+EF_AI_IGNORE+EF_NON_SOLID+EF_NO_HEALTH_BAR;
|
||||
jumpgate->flags = EF_NO_MT_BOX + EF_IMMORTAL + EF_AI_IGNORE + EF_NON_SOLID + EF_NO_HEALTH_BAR;
|
||||
|
||||
if (flags != -1 && flags & EF_DISABLED)
|
||||
{
|
||||
|
@ -75,7 +92,7 @@ static void addNodes(Entity *jumpgate, long flags)
|
|||
|
||||
nodeTexture = getAtlasImage("gfx/entities/jumpgateNode.png");
|
||||
|
||||
for (i = 0 ; i < 360 ; i += 36)
|
||||
for (i = 0; i < 360; i += 36)
|
||||
{
|
||||
node = spawnEntity();
|
||||
STRNCPY(node->name, _("Jumpgate System Node"), MAX_NAME_LENGTH);
|
||||
|
@ -86,7 +103,7 @@ static void addNodes(Entity *jumpgate, long flags)
|
|||
node->owner = jumpgate;
|
||||
node->side = jumpgate->side;
|
||||
node->texture = nodeTexture;
|
||||
node->flags = EF_TAKES_DAMAGE+EF_AI_IGNORE;
|
||||
node->flags = EF_TAKES_DAMAGE + EF_AI_IGNORE;
|
||||
node->die = nodeDie;
|
||||
node->w = node->texture->rect.w;
|
||||
node->h = node->texture->rect.h;
|
||||
|
@ -136,7 +153,7 @@ void activateJumpgate(int activate)
|
|||
|
||||
if (battle.jumpgate && battle.jumpgate->health > 1)
|
||||
{
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (e == battle.jumpgate || e->owner == battle.jumpgate)
|
||||
{
|
||||
|
@ -184,7 +201,7 @@ static void handleFleeingEntities(void)
|
|||
|
||||
candidates = getAllEntsInRadius(self->x, self->y, ESCAPE_DISTANCE * 2, self);
|
||||
|
||||
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
||||
for (i = 0, e = candidates[i]; e != NULL; e = candidates[++i])
|
||||
{
|
||||
if (e->health > 0 && (e->flags & EF_RETREATING) && getDistance(self->x, self->y, e->x, e->y) <= ESCAPE_DISTANCE)
|
||||
{
|
||||
|
@ -204,7 +221,7 @@ static void addEscapeEffect(Entity *ent)
|
|||
|
||||
n = ent->w * ent->h;
|
||||
|
||||
for (i = 0 ; i < n ; i++)
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
e = malloc(sizeof(Effect));
|
||||
memset(e, 0, sizeof(Effect));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,21 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#define ESCAPE_DISTANCE 256
|
||||
|
||||
extern void addDebris(int x, int y, int amount);
|
||||
extern void addSmallExplosion(void);
|
||||
extern void blitRotated(AtlasImage *atlasImage, int x, int y, float angle);
|
||||
extern Entity **getAllEntsInRadius(int x, int y, int radius, Entity *ignore);
|
||||
extern AtlasImage *getAtlasImage(char *filename);
|
||||
extern int getDistance(int x1, int y1, int x2, int y2);
|
||||
extern void playBattleSound(int id, int x, int y);
|
||||
extern void runScriptFunction(char *format, ...);
|
||||
extern Entity *spawnEntity(void);
|
||||
extern void updateCondition(char *name, int type);
|
||||
extern void updateObjective(char *name, int type);
|
||||
|
||||
extern Battle battle;
|
||||
extern Entity *self;
|
||||
void activateJumpgate(int activate);
|
||||
int jumpgateEnabled(void);
|
||||
Entity *spawnJumpgate(int side, long flags);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,15 +18,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/script.h"
|
||||
#include "../json/cJSON.h"
|
||||
#include "../system/draw.h"
|
||||
#include "../system/util.h"
|
||||
#include "locations.h"
|
||||
|
||||
extern Battle battle;
|
||||
extern Entity *player;
|
||||
|
||||
void doLocations(void)
|
||||
{
|
||||
Location *l, *prev;
|
||||
|
||||
prev = &battle.locationHead;
|
||||
|
||||
for (l = battle.locationHead.next ; l != NULL ; l = l->next)
|
||||
for (l = battle.locationHead.next; l != NULL; l = l->next)
|
||||
{
|
||||
if (l->active && getDistance(player->x, player->y, l->x, l->y) <= l->size)
|
||||
{
|
||||
|
@ -45,7 +54,7 @@ void drawLocations(void)
|
|||
{
|
||||
Location *l;
|
||||
|
||||
for (l = battle.locationHead.next ; l != NULL ; l = l->next)
|
||||
for (l = battle.locationHead.next; l != NULL; l = l->next)
|
||||
{
|
||||
if (l->active)
|
||||
{
|
||||
|
@ -63,7 +72,7 @@ void activateLocations(char *locations)
|
|||
|
||||
while (token)
|
||||
{
|
||||
for (l = battle.locationHead.next ; l != NULL ; l = l->next)
|
||||
for (l = battle.locationHead.next; l != NULL; l = l->next)
|
||||
{
|
||||
if (strcmp(token, l->name) == 0)
|
||||
{
|
||||
|
@ -83,7 +92,7 @@ void createChristabelLocation(void)
|
|||
Location *l;
|
||||
Entity *e;
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (strcmp(e->name, "Christabel") == 0)
|
||||
{
|
||||
|
@ -131,7 +140,6 @@ void loadLocations(cJSON *node)
|
|||
l->x += (SCREEN_WIDTH / 2);
|
||||
l->y += (SCREEN_HEIGHT / 2);
|
||||
|
||||
|
||||
node = node->next;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,14 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../json/cJSON.h"
|
||||
|
||||
extern void drawCircle(int cx, int cy, int radius, int r, int g, int b, int a);
|
||||
extern int getDistance(int x1, int y1, int x2, int y2);
|
||||
extern int getJSONValue(cJSON *node, char *name, int defValue);
|
||||
extern void runScriptFunction(char *format, ...);
|
||||
|
||||
extern Battle battle;
|
||||
extern Entity *player;
|
||||
void loadLocations(struct cJSON *node);
|
||||
void createChristabelLocation(void);
|
||||
void activateLocations(char *locations);
|
||||
void drawLocations(void);
|
||||
void doLocations(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../system/sound.h"
|
||||
#include "../system/text.h"
|
||||
#include "messageBox.h"
|
||||
|
||||
#define MSG_BOX_TEXT_WIDTH 600
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Entity *player;
|
||||
|
||||
static void calculateMessageBoxHeight(MessageBox *msg);
|
||||
static void nextMessage(void);
|
||||
|
||||
|
@ -181,7 +192,7 @@ static void nextMessage(void)
|
|||
|
||||
playSound(SND_RADIO);
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (e->active && e != player)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,16 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#define MSG_BOX_TEXT_WIDTH 600
|
||||
|
||||
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
|
||||
extern int getWrappedTextHeight(char *text, int size);
|
||||
extern void playSound(int sound);
|
||||
extern void useFont(char *name);
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Entity *player;
|
||||
void resetMessageBox(void);
|
||||
void drawMessageBox(void);
|
||||
int showingMessageBoxes(void);
|
||||
void doMessageBox(void);
|
||||
void addMessageBox(char *title, char *body, int type);
|
||||
void initMessageBox(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,28 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/effects.h"
|
||||
#include "../battle/entities.h"
|
||||
#include "../battle/fighters.h"
|
||||
#include "../battle/objectives.h"
|
||||
#include "../battle/quadtree.h"
|
||||
#include "../battle/script.h"
|
||||
#include "../game/trophies.h"
|
||||
#include "../system/atlas.h"
|
||||
#include "../system/sound.h"
|
||||
#include "../system/util.h"
|
||||
#include "mine.h"
|
||||
|
||||
#define DAMAGE_RANGE 250
|
||||
#define SYSTEM_POWER 50
|
||||
#define TRIGGER_RANGE 150
|
||||
|
||||
extern Battle battle;
|
||||
extern Entity *player;
|
||||
extern Entity *self;
|
||||
|
||||
static void think(void);
|
||||
static void die(void);
|
||||
static void lookForFighters(void);
|
||||
|
@ -49,7 +69,7 @@ Entity *spawnMine(int type)
|
|||
mine->texture = (type == ET_MINE) ? mineNormal : shadowMine;
|
||||
mine->action = think;
|
||||
mine->die = die;
|
||||
mine->flags = EF_TAKES_DAMAGE+EF_NO_PLAYER_TARGET+EF_SHORT_RADAR_RANGE+EF_NON_SOLID+EF_NO_HEALTH_BAR;
|
||||
mine->flags = EF_TAKES_DAMAGE + EF_NO_PLAYER_TARGET + EF_SHORT_RADAR_RANGE + EF_NON_SOLID + EF_NO_HEALTH_BAR;
|
||||
|
||||
if (type == ET_SHADOW_MINE)
|
||||
{
|
||||
|
@ -102,7 +122,7 @@ static void lookForFighters(void)
|
|||
|
||||
candidates = getAllEntsInRadius(self->x, self->y, DAMAGE_RANGE, self);
|
||||
|
||||
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
||||
for (i = 0, e = candidates[i]; e != NULL; e = candidates[++i])
|
||||
{
|
||||
if (e->side != self->side && e->health > 0 && e->type == ET_FIGHTER && getDistance(self->x, self->y, e->x, e->y) <= TRIGGER_RANGE)
|
||||
{
|
||||
|
@ -204,7 +224,7 @@ static void doSplashDamage(void)
|
|||
|
||||
kills = 0;
|
||||
|
||||
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
||||
for (i = 0, e = candidates[i]; e != NULL; e = candidates[++i])
|
||||
{
|
||||
if (e->health > 0 && (e->type == ET_FIGHTER || e->type == ET_MINE) && !(e->flags & EF_IMMORTAL))
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,23 +18,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#define DAMAGE_RANGE 250
|
||||
#define SYSTEM_POWER 50
|
||||
#define TRIGGER_RANGE 150
|
||||
|
||||
extern void addMineExplosion(void);
|
||||
extern void awardTrophy(char *id);
|
||||
extern void damageFighter(Entity *e, int amount, long flags);
|
||||
extern Entity **getAllEntsInRadius(int x, int y, int radius, Entity *ignore);
|
||||
extern AtlasImage *getAtlasImage(char *filename);
|
||||
extern int getDistance(int x1, int y1, int x2, int y2);
|
||||
extern void playBattleSound(int id, int x, int y);
|
||||
extern void runScriptFunction(const char *format, ...);
|
||||
extern Entity *spawnEntity(void);
|
||||
extern void updateObjective(char *name, int type);
|
||||
|
||||
extern Battle battle;
|
||||
extern Entity *player;
|
||||
extern Entity *self;
|
||||
Entity *spawnMine(int type);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../challenges/challenges.h"
|
||||
#include "../system/atlas.h"
|
||||
#include "../system/draw.h"
|
||||
#include "../system/text.h"
|
||||
#include "../system/util.h"
|
||||
#include "../system/widgets.h"
|
||||
#include "missionInfo.h"
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Game game;
|
||||
|
||||
static void drawMissionSummary(AtlasImage *title);
|
||||
static void drawObjectives(void);
|
||||
static void drawChallenges(void);
|
||||
|
@ -133,7 +146,7 @@ static void drawObjectives(void)
|
|||
|
||||
y += 10;
|
||||
|
||||
for (o = battle.objectiveHead.next ; o != NULL ; o = o->next)
|
||||
for (o = battle.objectiveHead.next; o != NULL; o = o->next)
|
||||
{
|
||||
if (o->active)
|
||||
{
|
||||
|
@ -187,14 +200,14 @@ static void drawChallenges(void)
|
|||
|
||||
if (battle.status == MS_START && game.currentMission->challengeData.timeLimit)
|
||||
{
|
||||
y+= 50;
|
||||
y += 50;
|
||||
|
||||
drawText(UI_WIDTH / 2, y, 20, TA_CENTER, colors.white, TIME_LIMIT_TEXT, timeToString(game.currentMission->challengeData.timeLimit, 0));
|
||||
}
|
||||
|
||||
y += 25;
|
||||
|
||||
for (i = 0 ; i < MAX_CHALLENGES ; i++)
|
||||
for (i = 0; i < MAX_CHALLENGES; i++)
|
||||
{
|
||||
c = game.currentMission->challengeData.challenges[i];
|
||||
|
||||
|
@ -212,7 +225,7 @@ static void drawChallenges(void)
|
|||
|
||||
challengeStatus = _("Complete");
|
||||
}
|
||||
else if (battle.status == MS_COMPLETE ||battle.status == MS_FAILED)
|
||||
else if (battle.status == MS_COMPLETE || battle.status == MS_FAILED)
|
||||
{
|
||||
color = colors.red;
|
||||
|
||||
|
@ -224,4 +237,3 @@ static void drawChallenges(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,17 +18,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
extern void blit(AtlasImage *atlasImage, int x, int y, int center);
|
||||
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
|
||||
extern void drawWidgets(char *groupName);
|
||||
extern AtlasImage *getAtlasImage(char *filename);
|
||||
extern char *getChallengeDescription(Challenge *c);
|
||||
extern void setAtlasColor(int r, int g, int b, int a);
|
||||
extern char *timeToString(long millis, int showHours);
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Game game;
|
||||
void drawMissionInfo(void);
|
||||
void initMissionInfo(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/hud.h"
|
||||
#include "../battle/script.h"
|
||||
#include "../galaxy/mission.h"
|
||||
#include "../json/cJSON.h"
|
||||
#include "../system/lookup.h"
|
||||
#include "../system/sound.h"
|
||||
#include "../system/util.h"
|
||||
#include "objectives.h"
|
||||
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
|
||||
static int fireObjectivesComplete;
|
||||
|
||||
void doObjectives(void)
|
||||
|
@ -32,7 +44,7 @@ void doObjectives(void)
|
|||
objectiveFailed = 0;
|
||||
hasHidden = 0;
|
||||
|
||||
for (o = battle.objectiveHead.next ; o != NULL ; o = o->next)
|
||||
for (o = battle.objectiveHead.next; o != NULL; o = o->next)
|
||||
{
|
||||
if (o->active)
|
||||
{
|
||||
|
@ -113,7 +125,7 @@ void updateObjective(char *name, int type)
|
|||
|
||||
hasHidden = 0;
|
||||
|
||||
for (o = battle.objectiveHead.next ; o != NULL ; o = o->next)
|
||||
for (o = battle.objectiveHead.next; o != NULL; o = o->next)
|
||||
{
|
||||
if (o->active && o->status != OS_COMPLETE)
|
||||
{
|
||||
|
@ -167,7 +179,7 @@ void adjustObjectiveTargetValue(char *name, int type, int amount)
|
|||
{
|
||||
Objective *o;
|
||||
|
||||
for (o = battle.objectiveHead.next ; o != NULL ; o = o->next)
|
||||
for (o = battle.objectiveHead.next; o != NULL; o = o->next)
|
||||
{
|
||||
if (o->active && !o->isCondition && o->targetType == type && o->currentValue < o->targetValue && strcmp(o->targetName, name) == 0)
|
||||
{
|
||||
|
@ -192,7 +204,7 @@ void updateCondition(char *name, int type)
|
|||
|
||||
if (strlen(name))
|
||||
{
|
||||
for (o = battle.objectiveHead.next ; o != NULL ; o = o->next)
|
||||
for (o = battle.objectiveHead.next; o != NULL; o = o->next)
|
||||
{
|
||||
if (o->active && o->isCondition && o->targetType == type && o->currentValue < o->targetValue && strcmp(o->targetName, name) == 0)
|
||||
{
|
||||
|
@ -217,7 +229,7 @@ void completeAllObjectives(void)
|
|||
{
|
||||
Objective *o;
|
||||
|
||||
for (o = battle.objectiveHead.next ; o != NULL ; o = o->next)
|
||||
for (o = battle.objectiveHead.next; o != NULL; o = o->next)
|
||||
{
|
||||
o->status = OS_COMPLETE;
|
||||
}
|
||||
|
@ -227,7 +239,7 @@ void completeConditions(void)
|
|||
{
|
||||
Objective *o;
|
||||
|
||||
for (o = battle.objectiveHead.next ; o != NULL ; o = o->next)
|
||||
for (o = battle.objectiveHead.next; o != NULL; o = o->next)
|
||||
{
|
||||
if (o->isCondition)
|
||||
{
|
||||
|
@ -238,12 +250,11 @@ void completeConditions(void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void failIncompleteObjectives(void)
|
||||
{
|
||||
Objective *o;
|
||||
|
||||
for (o = battle.objectiveHead.next ; o != NULL ; o = o->next)
|
||||
for (o = battle.objectiveHead.next; o != NULL; o = o->next)
|
||||
{
|
||||
if (o->status != OS_COMPLETE)
|
||||
{
|
||||
|
@ -264,7 +275,7 @@ void activateObjectives(char *objectives)
|
|||
|
||||
while (token)
|
||||
{
|
||||
for (o = battle.objectiveHead.next ; o != NULL ; o = o->next)
|
||||
for (o = battle.objectiveHead.next; o != NULL; o = o->next)
|
||||
{
|
||||
if (strcmp(token, o->id) == 0)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,16 +18,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
#include "../json/cJSON.h"
|
||||
|
||||
extern void addHudMessage(SDL_Color c, char *format, ...);
|
||||
extern void completeMission(void);
|
||||
extern void failMission(void);
|
||||
extern int getJSONValue(cJSON *node, char *name, int defValue);
|
||||
extern long lookup(char *name);
|
||||
extern void playSound(int id);
|
||||
extern void runScriptFunction(char *format, ...);
|
||||
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
void addEpicKillsObjective(void);
|
||||
void addEpicLivesObjective(void);
|
||||
void loadObjectives(struct cJSON *node);
|
||||
void activateObjectives(char *objectives);
|
||||
void failIncompleteObjectives(void);
|
||||
void completeConditions(void);
|
||||
void completeAllObjectives(void);
|
||||
void updateCondition(char *name, int type);
|
||||
void adjustObjectiveTargetValue(char *name, int type, int amount);
|
||||
void updateObjective(char *name, int type);
|
||||
void doObjectives(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,33 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/bullets.h"
|
||||
#include "../battle/effects.h"
|
||||
#include "../battle/fighters.h"
|
||||
#include "../battle/hud.h"
|
||||
#include "../battle/objectives.h"
|
||||
#include "../galaxy/mission.h"
|
||||
#include "../game/trophies.h"
|
||||
#include "../json/cJSON.h"
|
||||
#include "../system/controls.h"
|
||||
#include "../system/lookup.h"
|
||||
#include "../system/sound.h"
|
||||
#include "../system/util.h"
|
||||
#include "player.h"
|
||||
|
||||
#define MAX_SELECTABLE_PLAYERS 8
|
||||
#define MAX_SELECTABLE_TARGETS 8
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Dev dev;
|
||||
extern Entity *player;
|
||||
extern Entity *self;
|
||||
extern Game game;
|
||||
|
||||
static void selectTarget(void);
|
||||
static void switchGuns(void);
|
||||
static void cycleRadarZoom(void);
|
||||
|
@ -57,7 +82,7 @@ void initPlayer(void)
|
|||
|
||||
if (!player->combinedGuns)
|
||||
{
|
||||
for (i = 0 ; i < MAX_FIGHTER_GUNS ; i++)
|
||||
for (i = 0; i < MAX_FIGHTER_GUNS; i++)
|
||||
{
|
||||
n = player->guns[i].type;
|
||||
|
||||
|
@ -105,7 +130,7 @@ static void setPilotName(void)
|
|||
|
||||
pos = -1;
|
||||
|
||||
for (i = 0 ; i < strlen(game.currentMission->pilot) ; i++)
|
||||
for (i = 0; i < strlen(game.currentMission->pilot); i++)
|
||||
{
|
||||
if (game.currentMission->pilot[i] == ' ')
|
||||
{
|
||||
|
@ -441,13 +466,13 @@ static void initPlayerSelect(void)
|
|||
{
|
||||
Entity *e;
|
||||
|
||||
memset(&availablePlayerUnits, 0, sizeof(Entity*) * MAX_SELECTABLE_PLAYERS);
|
||||
memset(&availablePlayerUnits, 0, sizeof(Entity *) * MAX_SELECTABLE_PLAYERS);
|
||||
|
||||
selectedPlayerIndex = 0;
|
||||
|
||||
if (battle.epicLives == 0 || (battle.epicLives > 0 && --battle.epicLives > 0))
|
||||
{
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (e->active && e->type == ET_FIGHTER && e->health > 0 && e->side == SIDE_ALLIES && selectedPlayerIndex < MAX_SELECTABLE_PLAYERS)
|
||||
{
|
||||
|
@ -512,8 +537,7 @@ static void selectNewPlayer(int dir)
|
|||
selectedPlayerIndex = mod(selectedPlayerIndex, MAX_SELECTABLE_PLAYERS);
|
||||
|
||||
player = availablePlayerUnits[selectedPlayerIndex];
|
||||
}
|
||||
while (player == NULL);
|
||||
} while (player == NULL);
|
||||
|
||||
battle.camera.x = player->x - (app.winWidth / 2);
|
||||
battle.camera.y = player->y - (app.winHeight / 2);
|
||||
|
@ -572,8 +596,7 @@ static void switchGuns(void)
|
|||
do
|
||||
{
|
||||
i = (i + 1) % BT_MAX;
|
||||
}
|
||||
while (!availableGuns[i]);
|
||||
} while (!availableGuns[i]);
|
||||
}
|
||||
|
||||
if (player->selectedGunType != i)
|
||||
|
@ -593,14 +616,14 @@ static void selectTarget(void)
|
|||
|
||||
i = 0;
|
||||
near = NULL;
|
||||
memset(targets, 0, sizeof(Entity*) * MAX_SELECTABLE_TARGETS);
|
||||
memset(targets, 0, sizeof(Entity *) * MAX_SELECTABLE_TARGETS);
|
||||
|
||||
if (player->target && (!player->target->health || !player->target->systemPower))
|
||||
{
|
||||
player->target = NULL;
|
||||
}
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (e->active && e != player && (e->flags & EF_TAKES_DAMAGE) && (!(e->flags & EF_NO_PLAYER_TARGET)) && e->side != player->side && e->alive == ALIVE_ALIVE && e->systemPower > 0 && i < MAX_SELECTABLE_TARGETS)
|
||||
{
|
||||
|
@ -625,7 +648,7 @@ static void selectTarget(void)
|
|||
|
||||
total = i;
|
||||
|
||||
for (i = 0 ; i < total ; i++)
|
||||
for (i = 0; i < total; i++)
|
||||
{
|
||||
if (targets[i] == player->target)
|
||||
{
|
||||
|
@ -655,7 +678,7 @@ static void selectMissionTarget(void)
|
|||
|
||||
battle.missionTarget = NULL;
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (e->active && e->flags & EF_MISSION_TARGET && e->alive == ALIVE_ALIVE)
|
||||
{
|
||||
|
@ -731,7 +754,7 @@ void setInitialPlayerAngle(void)
|
|||
}
|
||||
}
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (e->side == player->side)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,39 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
#include "../json/cJSON.h"
|
||||
|
||||
#define MAX_SELECTABLE_PLAYERS 8
|
||||
#define MAX_SELECTABLE_TARGETS 8
|
||||
|
||||
extern void addECMEffect(Entity *ent);
|
||||
extern void addHudMessage(SDL_Color c, char *format, ...);
|
||||
extern void applyFighterBrakes(void);
|
||||
extern void applyFighterThrust(void);
|
||||
extern void awardTrophy(char *id);
|
||||
extern void clearControl(int type);
|
||||
extern int collision(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2);
|
||||
extern void failMission(void);
|
||||
extern void fireGuns(Entity *owner);
|
||||
extern void fireMissile(Entity *owner);
|
||||
extern void fireRocket(Entity *owner);
|
||||
extern long flagsToLong(char *flags, int *add);
|
||||
extern float getAngle(int x1, int y1, int x2, int y2);
|
||||
extern int getDistance(int x1, int y1, int x2, int y2);
|
||||
extern int isAcceptControl(void);
|
||||
extern int isControl(int type);
|
||||
extern long lookup(char *name);
|
||||
extern float mod(float n, float x);
|
||||
extern void playSound(int id);
|
||||
extern void resetAcceptControls(void);
|
||||
extern Entity *spawnFighter(char *name, int x, int y, int side);
|
||||
extern void updateCondition(char *name, int type);
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Dev dev;
|
||||
extern Entity *player;
|
||||
extern Entity *self;
|
||||
extern Game game;
|
||||
void loadPlayer(struct cJSON *node);
|
||||
int playerHasGun(int type);
|
||||
void setInitialPlayerAngle(void);
|
||||
void doPlayerSelect(void);
|
||||
void doPlayer(void);
|
||||
void initPlayer(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../system/util.h"
|
||||
#include "quadtree.h"
|
||||
|
||||
#define QT_INITIAL_CAPACITY 8
|
||||
#define QT_MAX_DEPTH 5
|
||||
|
||||
extern Battle battle;
|
||||
|
||||
static Entity **candidates;
|
||||
static int cIndex;
|
||||
static int cCapacity;
|
||||
|
@ -43,13 +51,13 @@ void initQuadtree(Quadtree *root)
|
|||
root->w = BATTLE_AREA_WIDTH;
|
||||
root->h = BATTLE_AREA_HEIGHT;
|
||||
root->capacity = QT_INITIAL_CAPACITY;
|
||||
root->ents = malloc(sizeof(Entity*) * root->capacity);
|
||||
memset(root->ents, 0, sizeof(Entity*) * root->capacity);
|
||||
root->ents = malloc(sizeof(Entity *) * root->capacity);
|
||||
memset(root->ents, 0, sizeof(Entity *) * root->capacity);
|
||||
|
||||
cIndex = 0;
|
||||
cCapacity = QT_INITIAL_CAPACITY;
|
||||
candidates = malloc(sizeof(Entity*) * cCapacity);
|
||||
memset(candidates, 0, sizeof(Entity*) * cCapacity);
|
||||
candidates = malloc(sizeof(Entity *) * cCapacity);
|
||||
memset(candidates, 0, sizeof(Entity *) * cCapacity);
|
||||
}
|
||||
|
||||
w = root->w / 2;
|
||||
|
@ -57,7 +65,7 @@ void initQuadtree(Quadtree *root)
|
|||
|
||||
if (root->depth + 1 < QT_MAX_DEPTH)
|
||||
{
|
||||
for (i = 0 ; i < 4 ; i++)
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
node = malloc(sizeof(Quadtree));
|
||||
memset(node, 0, sizeof(Quadtree));
|
||||
|
@ -65,8 +73,8 @@ void initQuadtree(Quadtree *root)
|
|||
|
||||
node->depth = root->depth + 1;
|
||||
node->capacity = QT_INITIAL_CAPACITY;
|
||||
node->ents = malloc(sizeof(Entity*) * node->capacity);
|
||||
memset(node->ents, 0, sizeof(Entity*) * node->capacity);
|
||||
node->ents = malloc(sizeof(Entity *) * node->capacity);
|
||||
memset(node->ents, 0, sizeof(Entity *) * node->capacity);
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
|
@ -135,7 +143,7 @@ static void resizeQTEntCapacity(Quadtree *root)
|
|||
|
||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, "Resizing QT node: %d -> %d", root->capacity, n);
|
||||
|
||||
root->ents = resize(root->ents, sizeof(Entity*) * root->capacity, sizeof(Entity*) * n);
|
||||
root->ents = resize(root->ents, sizeof(Entity *) * root->capacity, sizeof(Entity *) * n);
|
||||
root->capacity = n;
|
||||
}
|
||||
|
||||
|
@ -211,7 +219,7 @@ static void removeEntity(Entity *e, Quadtree *root)
|
|||
|
||||
n = root->numEnts;
|
||||
|
||||
for (i = 0 ; i < root->capacity ; i++)
|
||||
for (i = 0; i < root->capacity; i++)
|
||||
{
|
||||
if (root->ents[i] == e)
|
||||
{
|
||||
|
@ -220,13 +228,13 @@ static void removeEntity(Entity *e, Quadtree *root)
|
|||
}
|
||||
}
|
||||
|
||||
qsort(root->ents, n, sizeof(Entity*), candidatesComparator);
|
||||
qsort(root->ents, n, sizeof(Entity *), candidatesComparator);
|
||||
}
|
||||
|
||||
Entity **getAllEntsWithin(int x, int y, int w, int h, Entity *ignore)
|
||||
{
|
||||
cIndex = 0;
|
||||
memset(candidates, 0, sizeof(Entity*) * cCapacity);
|
||||
memset(candidates, 0, sizeof(Entity *) * cCapacity);
|
||||
|
||||
getAllEntsWithinNode(x, y, w, h, ignore, &battle.quadtree);
|
||||
|
||||
|
@ -254,14 +262,14 @@ static void getAllEntsWithinNode(int x, int y, int w, int h, Entity *ignore, Qua
|
|||
}
|
||||
else
|
||||
{
|
||||
for (i = 0 ; i < 4 ; i++)
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
getAllEntsWithinNode(x, y, w, h, ignore, root->node[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0 ; i < root->numEnts ; i++)
|
||||
for (i = 0; i < root->numEnts; i++)
|
||||
{
|
||||
candidates[cIndex++] = root->ents[i];
|
||||
|
||||
|
@ -281,7 +289,7 @@ static void resizeCandidates(void)
|
|||
|
||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, "Resizing candidates: %d -> %d", cCapacity, n);
|
||||
|
||||
candidates = resize(candidates, sizeof(Entity*) * cCapacity, sizeof(Entity*) * n);
|
||||
candidates = resize(candidates, sizeof(Entity *) * cCapacity, sizeof(Entity *) * n);
|
||||
cCapacity = n;
|
||||
}
|
||||
|
||||
|
@ -307,7 +315,7 @@ static void destroyQuadtreeNode(Quadtree *root)
|
|||
|
||||
if (root->node[0])
|
||||
{
|
||||
for (i = 0 ; i < 4 ; i++)
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
destroyQuadtreeNode(root->node[i]);
|
||||
|
||||
|
@ -320,8 +328,8 @@ static void destroyQuadtreeNode(Quadtree *root)
|
|||
|
||||
static int candidatesComparator(const void *a, const void *b)
|
||||
{
|
||||
Entity *e1 = *((Entity**)a);
|
||||
Entity *e2 = *((Entity**)b);
|
||||
Entity *e1 = *((Entity **)a);
|
||||
Entity *e2 = *((Entity **)b);
|
||||
|
||||
if (!e1)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,11 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#define QT_INITIAL_CAPACITY 8
|
||||
#define QT_MAX_DEPTH 5
|
||||
|
||||
extern void *resize(void *array, int oldSize, int newSize);
|
||||
|
||||
extern Battle battle;
|
||||
void destroyQuadtree(void);
|
||||
Entity **getAllEntsInRadius(int x, int y, int radius, Entity *ignore);
|
||||
Entity **getAllEntsWithin(int x, int y, int w, int h, Entity *ignore);
|
||||
void removeFromQuadtree(Entity *e, Quadtree *root);
|
||||
void addToQuadtree(Entity *e, Quadtree *root);
|
||||
void initQuadtree(Quadtree *root);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../system/atlas.h"
|
||||
#include "../system/draw.h"
|
||||
#include "../system/text.h"
|
||||
#include "../system/util.h"
|
||||
#include "radar.h"
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Entity *player;
|
||||
|
||||
static AtlasImage *radarTexture;
|
||||
static AtlasImage *radarWarningTexture;
|
||||
static int radarRanges[] = {20, 40, 60};
|
||||
|
@ -50,7 +61,7 @@ void drawRadar(void)
|
|||
|
||||
blink = battle.stats[STAT_TIME] % 60 < 30;
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
dist = getDistance(e->x, e->y, player->x, player->y);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,15 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
extern void blit(AtlasImage *atlasImage, int x, int y, int center);
|
||||
extern void blitRotated(AtlasImage *atlasImage, int x, int y, float angle);
|
||||
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
|
||||
extern AtlasImage *getAtlasImage(char *filename);
|
||||
extern int getDistance(int x1, int y1, int x2, int y2);
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Entity *player;
|
||||
void drawRadarRangeWarning(void);
|
||||
void drawRadar(void);
|
||||
void initRadar(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/hud.h"
|
||||
#include "../battle/quadtree.h"
|
||||
#include "../battle/script.h"
|
||||
#include "../system/sound.h"
|
||||
#include "../system/util.h"
|
||||
#include "rope.h"
|
||||
|
||||
#define ROPE_DISTANCE 128
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Entity *player;
|
||||
extern Entity *self;
|
||||
|
||||
void attachRope(void)
|
||||
{
|
||||
int i, distance;
|
||||
|
@ -29,7 +44,7 @@ void attachRope(void)
|
|||
{
|
||||
candidates = getAllEntsInRadius(self->x, self->y, self->separationRadius, self);
|
||||
|
||||
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
||||
for (i = 0, e = candidates[i]; e != NULL; e = candidates[++i])
|
||||
{
|
||||
if (!e->owner && e->type == ET_FIGHTER && (e->flags & EF_DISABLED) && (e->flags & EF_ROPED_ATTACHED) == 0 && e->alive == ALIVE_ALIVE)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,19 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#define ROPE_DISTANCE 128
|
||||
|
||||
extern void addHudMessage(SDL_Color c, char *format, ...);
|
||||
extern Entity **getAllEntsInRadius(int x, int y, int radius, Entity *ignore);
|
||||
extern float getAngle(int x1, int y1, int x2, int y2);
|
||||
extern int getDistance(int x1, int y1, int x2, int y2);
|
||||
extern void playBattleSound(int id, int x, int y);
|
||||
extern void runScriptFunction(char *format, ...);
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Entity *player;
|
||||
extern Entity *self;
|
||||
void cutRope(Entity *e);
|
||||
void drawRope(Entity *e);
|
||||
void doRope(Entity *owner);
|
||||
void attachRope(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,10 +18,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/entities.h"
|
||||
#include "../battle/fighters.h"
|
||||
#include "../battle/hud.h"
|
||||
#include "../battle/jumpgate.h"
|
||||
#include "../battle/locations.h"
|
||||
#include "../battle/messageBox.h"
|
||||
#include "../battle/objectives.h"
|
||||
#include "../battle/spawners.h"
|
||||
#include "../battle/waypoints.h"
|
||||
#include "../galaxy/mission.h"
|
||||
#include "../json/cJSON.h"
|
||||
#include "script.h"
|
||||
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
|
||||
static void executeNextLine(ScriptRunner *runner);
|
||||
void destroyScript(void);
|
||||
|
||||
static cJSON *scriptJSON, *rootJSON;
|
||||
static ScriptRunner head;
|
||||
|
@ -64,7 +79,7 @@ void doScript(void)
|
|||
{
|
||||
prev = &head;
|
||||
|
||||
for (runner = head.next ; runner != NULL ; runner = runner->next)
|
||||
for (runner = head.next; runner != NULL; runner = runner->next)
|
||||
{
|
||||
runner->delay = MAX(0, runner->delay - 1);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,29 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../json/cJSON.h"
|
||||
|
||||
extern void activateEntities(char *name);
|
||||
extern void activateEntityGroups(char *groupName);
|
||||
extern void activateJumpgate(int activate);
|
||||
extern void activateLocations(char *locations);
|
||||
extern void activateNextWaypoint(void);
|
||||
extern void activateObjectives(char *objectives);
|
||||
extern void activateSpawner(char *name, int active);
|
||||
extern void activateTrespasserSpawner(void);
|
||||
extern void addHudMessage(SDL_Color c, char *format, ...);
|
||||
extern void addMessageBox(char *title, char *body, int type);
|
||||
extern void completeAllObjectives(void);
|
||||
extern void completeMission(void);
|
||||
extern void createChristabelLocation(void);
|
||||
extern void failMission(void);
|
||||
extern void killEntity(char *name);
|
||||
extern void retreatAllies(void);
|
||||
extern void retreatEnemies(void);
|
||||
extern int showingMessageBoxes(void);
|
||||
extern void updateEntitySide(char *side, char *entity);
|
||||
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
void destroyScript(void);
|
||||
void cancelScript(void);
|
||||
void runScriptFunction(const char *format, ...);
|
||||
void doScript(void);
|
||||
void initScript(struct cJSON *root);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/fighters.h"
|
||||
#include "../json/cJSON.h"
|
||||
#include "../system/lookup.h"
|
||||
#include "../system/util.h"
|
||||
#include "spawners.h"
|
||||
|
||||
extern Battle battle;
|
||||
extern Entity *player;
|
||||
|
||||
void doSpawners(void)
|
||||
{
|
||||
Entity *e;
|
||||
|
@ -28,7 +37,7 @@ void doSpawners(void)
|
|||
int i, num, addFlags, addAIFlags;
|
||||
long flags, aiFlags;
|
||||
|
||||
for (s = battle.spawnerHead.next ; s != NULL ; s = s->next)
|
||||
for (s = battle.spawnerHead.next; s != NULL; s = s->next)
|
||||
{
|
||||
if (s->active && --s->time <= 0)
|
||||
{
|
||||
|
@ -58,7 +67,7 @@ void doSpawners(void)
|
|||
aiFlags = flagsToLong(s->aiFlags, &addAIFlags);
|
||||
}
|
||||
|
||||
for (i = 0 ; i < num ; i++)
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
type = s->types[rand() % s->numTypes];
|
||||
|
||||
|
@ -114,7 +123,7 @@ void activateSpawner(char *name, int active)
|
|||
{
|
||||
Spawner *s;
|
||||
|
||||
for (s = battle.spawnerHead.next ; s != NULL ; s = s->next)
|
||||
for (s = battle.spawnerHead.next; s != NULL; s = s->next)
|
||||
{
|
||||
if (strcmp(s->name, name) == 0)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,16 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../json/cJSON.h"
|
||||
|
||||
extern long flagsToLong(char *flags, int *add);
|
||||
extern int getJSONValue(cJSON *node, char *name, int defValue);
|
||||
extern char *getJSONValueStr(cJSON *node, char *name, char *defValue);
|
||||
extern long lookup(char *name);
|
||||
extern Entity *spawnFighter(char *name, int x, int y, int side);
|
||||
extern char **toTypeArray(char *types, int *numTypes);
|
||||
|
||||
extern Battle battle;
|
||||
extern Entity *player;
|
||||
void loadSpawners(struct cJSON *node);
|
||||
void activateTrespasserSpawner(void);
|
||||
void activateSpawner(char *name, int active);
|
||||
void doSpawners(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../system/util.h"
|
||||
#include "starfield.h"
|
||||
|
||||
extern App app;
|
||||
|
||||
static Star stars[MAX_STARS];
|
||||
|
||||
void initStars(void)
|
||||
|
@ -28,7 +33,7 @@ void initStars(void)
|
|||
|
||||
memset(stars, 0, sizeof(Star) * MAX_STARS);
|
||||
|
||||
for (i = 0 ; i < MAX_STARS ; i++)
|
||||
for (i = 0; i < MAX_STARS; i++)
|
||||
{
|
||||
stars[i].x = rand() % app.winWidth;
|
||||
stars[i].y = rand() % app.winHeight;
|
||||
|
@ -42,7 +47,7 @@ void doStars(float dx, float dy)
|
|||
{
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < MAX_STARS ; i++)
|
||||
for (i = 0; i < MAX_STARS; i++)
|
||||
{
|
||||
stars[i].x -= (dx * stars[i].speed);
|
||||
stars[i].y -= (dy * stars[i].speed);
|
||||
|
@ -57,7 +62,7 @@ void drawStars(void)
|
|||
int i;
|
||||
int c;
|
||||
|
||||
for (i = 0 ; i < MAX_STARS ; i++)
|
||||
for (i = 0; i < MAX_STARS; i++)
|
||||
{
|
||||
c = 64 * stars[i].speed;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
extern float mod(float n, float x);
|
||||
|
||||
extern App app;
|
||||
void drawStars(void);
|
||||
void doStars(float dx, float dy);
|
||||
void initStars(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,12 +18,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/entities.h"
|
||||
#include "../battle/hud.h"
|
||||
#include "../battle/objectives.h"
|
||||
#include "../battle/script.h"
|
||||
#include "../system/atlas.h"
|
||||
#include "../system/sound.h"
|
||||
#include "../system/util.h"
|
||||
#include "waypoints.h"
|
||||
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Entity *player;
|
||||
extern Entity *self;
|
||||
extern Game game;
|
||||
|
||||
static void think(void);
|
||||
static int teamMatesClose(void);
|
||||
static int isCurrentObjective(void);
|
||||
void activateNextWaypoint(void);
|
||||
|
||||
static int waypointId;
|
||||
static int currentWaypointId;
|
||||
|
@ -44,7 +58,7 @@ Entity *spawnWaypoint(void)
|
|||
waypoint->active = 0;
|
||||
waypoint->health = waypoint->maxHealth = FPS;
|
||||
waypoint->texture = getAtlasImage("gfx/entities/waypoint.png");
|
||||
waypoint->flags = EF_NO_MT_BOX+EF_MISSION_TARGET+EF_NO_HEALTH_BAR;
|
||||
waypoint->flags = EF_NO_MT_BOX + EF_MISSION_TARGET + EF_NO_HEALTH_BAR;
|
||||
waypoint->action = think;
|
||||
|
||||
waypoint->w = waypoint->texture->rect.w;
|
||||
|
@ -115,7 +129,7 @@ static int teamMatesClose(void)
|
|||
|
||||
if (player->side != SIDE_PANDORAN)
|
||||
{
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (e->active && e->type == ET_FIGHTER && e->side == SIDE_ALLIES)
|
||||
{
|
||||
|
@ -139,7 +153,7 @@ void activateNextWaypoint(void)
|
|||
|
||||
currentWaypointId++;
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (e->type == ET_WAYPOINT && e->id == currentWaypointId)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,18 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
extern void addHudMessage(SDL_Color c, char *format, ...);
|
||||
extern AtlasImage *getAtlasImage(char *filename);
|
||||
extern int getDistance(int x1, int y1, int x2, int y2);
|
||||
extern void playSound(int id);
|
||||
extern void runScriptFunction(char *format, ...);
|
||||
extern Entity *spawnEntity(void);
|
||||
extern void updateObjective(char *name, int type);
|
||||
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Entity *player;
|
||||
extern Entity *self;
|
||||
extern Game game;
|
||||
void activateNextWaypoint(void);
|
||||
Entity *spawnWaypoint(void);
|
||||
void resetWaypoints(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,13 +18,48 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/battle.h"
|
||||
#include "../battle/starfield.h"
|
||||
#include "../challenges/challenges.h"
|
||||
#include "../galaxy/mission.h"
|
||||
#include "../game/fighterDatabase.h"
|
||||
#include "../game/options.h"
|
||||
#include "../game/stats.h"
|
||||
#include "../game/title.h"
|
||||
#include "../game/trophies.h"
|
||||
#include "../system/atlas.h"
|
||||
#include "../system/draw.h"
|
||||
#include "../system/input.h"
|
||||
#include "../system/resources.h"
|
||||
#include "../system/sound.h"
|
||||
#include "../system/text.h"
|
||||
#include "../system/textures.h"
|
||||
#include "../system/transition.h"
|
||||
#include "../system/util.h"
|
||||
#include "../system/widgets.h"
|
||||
#include "challengeHome.h"
|
||||
|
||||
#define CHALLENGES_PER_PAGE 14
|
||||
#define SHOW_CHALLENGES 0
|
||||
#define SHOW_FIGHTER_DB 5
|
||||
#define SHOW_MENU 1
|
||||
#define SHOW_OPTIONS 2
|
||||
#define SHOW_STATS 3
|
||||
#define SHOW_TROPHIES 4
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Dev dev;
|
||||
extern Game game;
|
||||
|
||||
static void logic(void);
|
||||
static void draw(void);
|
||||
static void handleKeyboard(void);
|
||||
static void drawChallenges(void);
|
||||
static void doChallenges(void);
|
||||
static void doChallengeList(void);
|
||||
static void startChallengeMission(void);
|
||||
static void drawMenu(void);
|
||||
static void resume(void);
|
||||
|
@ -105,7 +140,7 @@ void initChallengeHome(void)
|
|||
|
||||
maxPages = page = 0;
|
||||
|
||||
for (m = game.challengeMissionHead.next ; m != NULL ; m = m->next)
|
||||
for (m = game.challengeMissionHead.next; m != NULL; m = m->next)
|
||||
{
|
||||
maxPages++;
|
||||
}
|
||||
|
@ -179,7 +214,7 @@ static void unlockChallenges(void)
|
|||
|
||||
prevCompleted = 1;
|
||||
|
||||
for (m = game.challengeMissionHead.next ; m != NULL ; m = m->next)
|
||||
for (m = game.challengeMissionHead.next; m != NULL; m = m->next)
|
||||
{
|
||||
m->available = (prevCompleted > 0 || dev.debug);
|
||||
|
||||
|
@ -209,7 +244,7 @@ static void logic(void)
|
|||
switch (show)
|
||||
{
|
||||
case SHOW_CHALLENGES:
|
||||
doChallenges();
|
||||
doChallengeList();
|
||||
break;
|
||||
|
||||
case SHOW_MENU:
|
||||
|
@ -232,7 +267,7 @@ static void logic(void)
|
|||
app.doTrophyAlerts = 1;
|
||||
}
|
||||
|
||||
static void doChallenges(void)
|
||||
static void doChallengeList(void)
|
||||
{
|
||||
Mission *c;
|
||||
int i, startIndex, end;
|
||||
|
@ -241,7 +276,7 @@ static void doChallenges(void)
|
|||
startIndex = page * CHALLENGES_PER_PAGE;
|
||||
end = startIndex + CHALLENGES_PER_PAGE;
|
||||
|
||||
for (c = game.challengeMissionHead.next ; c != NULL ; c = c->next)
|
||||
for (c = game.challengeMissionHead.next; c != NULL; c = c->next)
|
||||
{
|
||||
if (i >= startIndex && i < end && app.mouse.button[SDL_BUTTON_LEFT] && collision(app.uiMouse.x, app.uiMouse.y, 3, 3, c->rect.x, c->rect.y, c->rect.w, c->rect.h))
|
||||
{
|
||||
|
@ -370,7 +405,7 @@ static void drawChallenges(void)
|
|||
|
||||
i = 0;
|
||||
|
||||
for (m = game.challengeMissionHead.next ; m != NULL ; m = m->next)
|
||||
for (m = game.challengeMissionHead.next; m != NULL; m = m->next)
|
||||
{
|
||||
m->rect = r;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,58 +18,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#define CHALLENGES_PER_PAGE 14
|
||||
#define SHOW_CHALLENGES 0
|
||||
#define SHOW_FIGHTER_DB 5
|
||||
#define SHOW_MENU 1
|
||||
#define SHOW_OPTIONS 2
|
||||
#define SHOW_STATS 3
|
||||
#define SHOW_TROPHIES 4
|
||||
|
||||
extern void autoSizeWidgetButtons(char *group, int recenter);
|
||||
extern void awardChallengeTrophies(void);
|
||||
extern void awardStatsTrophies(void);
|
||||
extern void blit(AtlasImage *atlasImage, int x, int y, int centered);
|
||||
extern void clearInput(void);
|
||||
extern int collision(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2);
|
||||
extern void doFighterDatabase(void);
|
||||
extern void doStars(float dx, float dy);
|
||||
extern void doWidgets(void);
|
||||
extern void drawBackground(SDL_Texture *texture);
|
||||
extern void drawFighterDatabase(void);
|
||||
extern void drawOptions(void);
|
||||
extern void drawStars(void);
|
||||
extern void drawStats(void);
|
||||
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
|
||||
extern void drawTrophies(void);
|
||||
extern void drawWidgets(char *groupName);
|
||||
extern void endSectionTransition(void);
|
||||
extern AtlasImage *getAtlasImage(const char *filename);
|
||||
extern char *getBackgroundTextureName(int n);
|
||||
extern char *getChallengeDescription(Challenge *c);
|
||||
extern char *getPlanetTextureName(int n);
|
||||
extern SDL_Texture *getTexture(char *filename);
|
||||
extern Widget *getWidget(const char *name, const char *group);
|
||||
extern void initBattle(void);
|
||||
extern void initFighterDatabaseDisplay(void);
|
||||
extern void initOptions(void (*returnFromOptions)(void));
|
||||
extern void initStatsDisplay(void);
|
||||
extern void initTitle(void);
|
||||
extern void initTrophiesDisplay(void);
|
||||
extern void loadMission(char *filename);
|
||||
extern void playMusic(char *filename, int loop);
|
||||
extern void playSound(int sound);
|
||||
extern void scrollBackground(float x, float y);
|
||||
extern void selectWidget(const char *name, const char *group);
|
||||
extern void startSectionTransition(void);
|
||||
extern void stopMusic(void);
|
||||
extern char *timeToString(long millis, int showHours);
|
||||
extern void updateAllMissions(void);
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Dev dev;
|
||||
extern Game game;
|
||||
void initChallengeHome(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/fighters.h"
|
||||
#include "../galaxy/mission.h"
|
||||
#include "../game/stats.h"
|
||||
#include "../game/trophies.h"
|
||||
#include "../json/cJSON.h"
|
||||
#include "../system/io.h"
|
||||
#include "../system/lookup.h"
|
||||
#include "../system/util.h"
|
||||
#include "../system/widgets.h"
|
||||
#include "challenges.h"
|
||||
|
||||
extern Battle battle;
|
||||
extern Dev dev;
|
||||
extern Entity *player;
|
||||
extern Game game;
|
||||
|
||||
static void updateTimeChallenge(Challenge *c);
|
||||
static void updateSurvivalChallenge(Challenge *c);
|
||||
static void updateAccuracyChallenge(Challenge *c);
|
||||
|
@ -35,7 +51,6 @@ static void completeChallenge(void);
|
|||
static void failChallenge(void);
|
||||
static int updateChallenges(void);
|
||||
static char *getFormattedChallengeDescription(const char *format, ...);
|
||||
char *getChallengeDescription(Challenge *c);
|
||||
static int challengeFinished(void);
|
||||
static int alreadyPassed(void);
|
||||
static void printStats(void);
|
||||
|
@ -71,7 +86,7 @@ void initChallenges(void)
|
|||
|
||||
filenames = getFileList("data/challenges", &count);
|
||||
|
||||
for (i = 0 ; i < count ; i++)
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
sprintf(path, "data/challenges/%s", filenames[i]);
|
||||
|
||||
|
@ -241,7 +256,7 @@ static int updateChallenges(void)
|
|||
|
||||
numPassed = 0;
|
||||
|
||||
for (i = 0 ; i < MAX_CHALLENGES ; i++)
|
||||
for (i = 0; i < MAX_CHALLENGES; i++)
|
||||
{
|
||||
c = game.currentMission->challengeData.challenges[i];
|
||||
|
||||
|
@ -321,7 +336,7 @@ static void printStats(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < STAT_MAX ; i++)
|
||||
for (i = 0; i < STAT_MAX; i++)
|
||||
{
|
||||
if (battle.stats[i])
|
||||
{
|
||||
|
@ -481,7 +496,7 @@ Challenge *getChallenge(Mission *mission, int type, int value)
|
|||
int i;
|
||||
Challenge *c;
|
||||
|
||||
for (i = 0 ; i < MAX_CHALLENGES ; i++)
|
||||
for (i = 0; i < MAX_CHALLENGES; i++)
|
||||
{
|
||||
c = mission->challengeData.challenges[i];
|
||||
|
||||
|
@ -513,11 +528,11 @@ void updateChallengeMissions(void)
|
|||
Mission *m;
|
||||
Challenge *c;
|
||||
|
||||
for (m = game.challengeMissionHead.next ; m != NULL ; m = m->next)
|
||||
for (m = game.challengeMissionHead.next; m != NULL; m = m->next)
|
||||
{
|
||||
m->totalChallenges = m->completedChallenges = 0;
|
||||
|
||||
for (i = 0 ; i < MAX_CHALLENGES ; i++)
|
||||
for (i = 0; i < MAX_CHALLENGES; i++)
|
||||
{
|
||||
c = m->challengeData.challenges[i];
|
||||
|
||||
|
@ -584,7 +599,7 @@ static int alreadyPassed(void)
|
|||
int i;
|
||||
Challenge *c;
|
||||
|
||||
for (i = 0 ; i < MAX_CHALLENGES ; i++)
|
||||
for (i = 0; i < MAX_CHALLENGES; i++)
|
||||
{
|
||||
c = game.currentMission->challengeData.challenges[i];
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,23 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
#include "../json/cJSON.h"
|
||||
|
||||
extern void awardCraftTrophy(void);
|
||||
extern void awardStatsTrophies(void);
|
||||
extern char **getFileList(char *dir, int *count);
|
||||
extern int getJSONValue(cJSON *node, char *name, int defValue);
|
||||
extern char *getLookupName(char *prefix, long num);
|
||||
extern Mission *loadMissionMeta(char *filename);
|
||||
extern long lookup(char *name);
|
||||
extern void retreatAllies(void);
|
||||
extern void retreatEnemies(void);
|
||||
extern void selectWidget(const char *name, const char *group);
|
||||
extern char *timeToString(long millis, int showHours);
|
||||
extern void updateAccuracyStats(unsigned int *stats);
|
||||
|
||||
extern Battle battle;
|
||||
extern Dev dev;
|
||||
extern Entity *player;
|
||||
extern Game game;
|
||||
void updateChallengeMissions(void);
|
||||
Challenge *getChallenge(Mission *mission, int type, int value);
|
||||
char *getChallengeDescription(Challenge *c);
|
||||
void doChallenges(void);
|
||||
void loadChallenge(Mission *mission, struct cJSON *node);
|
||||
void initChallenges(void);
|
||||
|
|
14
src/common.h
14
src/common.h
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,15 +18,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "stdlib.h"
|
||||
#include "stdio.h"
|
||||
#include "string.h"
|
||||
#include "math.h"
|
||||
#include "ctype.h"
|
||||
|
||||
#include "SDL2/SDL.h"
|
||||
|
||||
#include "defs.h"
|
||||
#include "math.h"
|
||||
#include "SDL2/SDL.h"
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include "string.h"
|
||||
#include "structs.h"
|
||||
|
||||
extern char *getTranslatedString(char *string);
|
||||
|
|
18
src/defs.h
18
src/defs.h
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -49,10 +49,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define _(string) getTranslatedString(string)
|
||||
|
||||
#define PI 3.14159265358979323846
|
||||
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
#define MAX(a,b) (((a)>(b))?(a):(b))
|
||||
#define CAROLINE(a,b) MIN(a,b)
|
||||
#define STRNCPY(dest, src, n) strncpy(dest, src, n); dest[n - 1] = '\0'
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define CAROLINE(a, b) MIN(a, b)
|
||||
#define STRNCPY(dest, src, n) \
|
||||
strncpy(dest, src, n); \
|
||||
dest[n - 1] = '\0'
|
||||
#define TO_RAIDANS(angleDegrees) (angleDegrees * PI / 180.0)
|
||||
#define TO_DEGREES(angleRadians) (angleRadians * 180.0 / PI)
|
||||
|
||||
|
@ -78,9 +80,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#define NUM_TEXTURE_BUCKETS 32
|
||||
#define NUM_ATLAS_BUCKETS 64
|
||||
#define NUM_GLYPH_BUCKETS 128
|
||||
|
||||
#define MAX_STARS 100
|
||||
#define MAX_GLYPHS 400
|
||||
|
||||
#define MAX_STARS 500
|
||||
|
||||
#define MAX_CHALLENGES 3
|
||||
|
||||
|
@ -421,4 +424,3 @@ enum
|
|||
TROPHY_UNEARNED,
|
||||
TROPHY_MAX
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,42 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/battle.h"
|
||||
#include "../battle/starfield.h"
|
||||
#include "../galaxy/mission.h"
|
||||
#include "../galaxy/starSystems.h"
|
||||
#include "../game/fighterDatabase.h"
|
||||
#include "../game/options.h"
|
||||
#include "../game/stats.h"
|
||||
#include "../game/title.h"
|
||||
#include "../game/trophies.h"
|
||||
#include "../system/atlas.h"
|
||||
#include "../system/draw.h"
|
||||
#include "../system/input.h"
|
||||
#include "../system/modalDialog.h"
|
||||
#include "../system/sound.h"
|
||||
#include "../system/text.h"
|
||||
#include "../system/textures.h"
|
||||
#include "../system/transition.h"
|
||||
#include "../system/util.h"
|
||||
#include "../system/widgets.h"
|
||||
#include "galacticMap.h"
|
||||
|
||||
#define MAX_LISTED_MISSIONS 9
|
||||
#define SHOW_FIGHTER_DB 6
|
||||
#define SHOW_GALAXY 0
|
||||
#define SHOW_MENU 2
|
||||
#define SHOW_OPTIONS 3
|
||||
#define SHOW_STAR_SYSTEM 1
|
||||
#define SHOW_STATS 4
|
||||
#define SHOW_TROPHIES 5
|
||||
|
||||
extern App app;
|
||||
extern Colors colors;
|
||||
extern Game game;
|
||||
|
||||
static void logic(void);
|
||||
static void draw(void);
|
||||
static void handleKeyboard(void);
|
||||
|
@ -30,7 +64,6 @@ static void selectStarSystem(void);
|
|||
static void drawGalaxy(void);
|
||||
static void centerOnSelectedStarSystem(void);
|
||||
static void doStarSystems(void);
|
||||
void destroyGalacticMap(void);
|
||||
static void drawPulses(void);
|
||||
static void drawInfoBars(void);
|
||||
static void doPulses(void);
|
||||
|
@ -161,7 +194,7 @@ static void updateCampaignProgress(void)
|
|||
|
||||
if (!campaignComplete && game.completedMissions == game.totalMissions)
|
||||
{
|
||||
for (starSystem = game.starSystemHead.next ; starSystem != NULL ; starSystem = starSystem->next)
|
||||
for (starSystem = game.starSystemHead.next; starSystem != NULL; starSystem = starSystem->next)
|
||||
{
|
||||
if (starSystem->missionHead.next && starSystem->missionHead.next->available)
|
||||
{
|
||||
|
@ -181,7 +214,7 @@ static void updatePandoranAdvance(void)
|
|||
|
||||
fallenStarSystem = NULL;
|
||||
|
||||
for (starSystem = game.starSystemHead.next ; starSystem != NULL ; starSystem = starSystem->next)
|
||||
for (starSystem = game.starSystemHead.next; starSystem != NULL; starSystem = starSystem->next)
|
||||
{
|
||||
if (starSystem->side != SIDE_PANDORAN && starSystem->fallsToPandorans && starSystem->completedMissions == starSystem->totalMissions && starSystem->totalMissions > 0)
|
||||
{
|
||||
|
@ -254,7 +287,7 @@ static void doStarSystems(void)
|
|||
|
||||
selectedStarSystem = NULL;
|
||||
|
||||
for (starSystem = game.starSystemHead.next ; starSystem != NULL ; starSystem = starSystem->next)
|
||||
for (starSystem = game.starSystemHead.next; starSystem != NULL; starSystem = starSystem->next)
|
||||
{
|
||||
cameraMin.x = MIN(cameraMin.x, starSystem->x);
|
||||
cameraMin.y = MIN(cameraMin.y, starSystem->y);
|
||||
|
@ -325,7 +358,7 @@ static void doStarSystemView(void)
|
|||
{
|
||||
Mission *mission;
|
||||
|
||||
for (mission = selectedStarSystem->missionHead.next ; mission != NULL ; mission = mission->next)
|
||||
for (mission = selectedStarSystem->missionHead.next; mission != NULL; mission = mission->next)
|
||||
{
|
||||
if (mission->available && collision(app.uiMouse.x - app.mouse.w / 2, app.uiMouse.y - app.mouse.h / 2, app.mouse.w, app.mouse.h, mission->rect.x, mission->rect.y, mission->rect.w, mission->rect.h))
|
||||
{
|
||||
|
@ -358,7 +391,7 @@ static void addPulses(void)
|
|||
Pulse *pulse;
|
||||
StarSystem *starSystem;
|
||||
|
||||
for (starSystem = game.starSystemHead.next ; starSystem != NULL ; starSystem = starSystem->next)
|
||||
for (starSystem = game.starSystemHead.next; starSystem != NULL; starSystem = starSystem->next)
|
||||
{
|
||||
if (starSystem->completedMissions < starSystem->availableMissions || (campaignComplete && starSystem->activeMission))
|
||||
{
|
||||
|
@ -407,7 +440,7 @@ static void doPulses(void)
|
|||
|
||||
prev = &pulseHead;
|
||||
|
||||
for (pulse = pulseHead.next ; pulse != NULL ; pulse = pulse->next)
|
||||
for (pulse = pulseHead.next; pulse != NULL; pulse = pulse->next)
|
||||
{
|
||||
pulse->size += 0.5;
|
||||
pulse->life--;
|
||||
|
@ -472,7 +505,7 @@ static void drawPulses(void)
|
|||
{
|
||||
Pulse *pulse;
|
||||
|
||||
for (pulse = pulseHead.next ; pulse != NULL ; pulse = pulse->next)
|
||||
for (pulse = pulseHead.next; pulse != NULL; pulse = pulse->next)
|
||||
{
|
||||
drawCircle(pulse->x - camera.x, pulse->y - camera.y, pulse->size, pulse->r, pulse->g, pulse->b, pulse->life);
|
||||
}
|
||||
|
@ -494,7 +527,7 @@ static void drawGalaxy(void)
|
|||
SDL_Color color;
|
||||
float ax, ay, aa;
|
||||
|
||||
for (starSystem = game.starSystemHead.next ; starSystem != NULL ; starSystem = starSystem->next)
|
||||
for (starSystem = game.starSystemHead.next; starSystem != NULL; starSystem = starSystem->next)
|
||||
{
|
||||
r.x = starSystem->x - camera.x;
|
||||
r.y = starSystem->y - camera.y;
|
||||
|
@ -619,7 +652,7 @@ static Mission *nextAvailableMission(StarSystem *starSystem)
|
|||
{
|
||||
Mission *m;
|
||||
|
||||
for (m = starSystem->missionHead.next ; m != NULL ; m = m->next)
|
||||
for (m = starSystem->missionHead.next; m != NULL; m = m->next)
|
||||
{
|
||||
if (m->available && !m->completed)
|
||||
{
|
||||
|
@ -662,7 +695,7 @@ static void drawStarSystemDetail(void)
|
|||
|
||||
y += 80;
|
||||
|
||||
for (mission = selectedStarSystem->missionHead.next ; mission != NULL ; mission = mission->next)
|
||||
for (mission = selectedStarSystem->missionHead.next; mission != NULL; mission = mission->next)
|
||||
{
|
||||
mission->rect.x = 200;
|
||||
mission->rect.y = y - 2;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,59 +18,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#define MAX_LISTED_MISSIONS 9
|
||||
#define SHOW_FIGHTER_DB 6
|
||||
#define SHOW_GALAXY 0
|
||||
#define SHOW_MENU 2
|
||||
#define SHOW_OPTIONS 3
|
||||
#define SHOW_STAR_SYSTEM 1
|
||||
#define SHOW_STATS 4
|
||||
#define SHOW_TROPHIES 5
|
||||
|
||||
extern void autoSizeWidgetButtons(char *group, int recenter);
|
||||
extern void awardCampaignTrophies(void);
|
||||
extern void awardStatsTrophies(void);
|
||||
extern void blit(AtlasImage *atlasImage, int x, int y, int centered);
|
||||
extern void blitRotated(AtlasImage *atlasImage, int x, int y, float angle);
|
||||
extern void clearInput(void);
|
||||
extern int collision(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2);
|
||||
extern void doFighterDatabase(void);
|
||||
extern void doStars(float dx, float dy);
|
||||
extern void doWidgets(void);
|
||||
extern void drawBackground(SDL_Texture *texture);
|
||||
extern void drawCircle(int cx, int cy, int radius, int r, int g, int b, int a);
|
||||
extern void drawFighterDatabase(void);
|
||||
extern void drawOptions(void);
|
||||
extern void drawStars(void);
|
||||
extern void drawStats(void);
|
||||
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
|
||||
extern void drawTrophies(void);
|
||||
extern void drawWidgets(char *groupName);
|
||||
extern void endSectionTransition(void);
|
||||
extern AtlasImage *getAtlasImage(char *filename);
|
||||
extern StarSystem *getStarSystem(char *name);
|
||||
extern SDL_Texture *getTexture(char *filename);
|
||||
extern Widget *getWidget(const char *name, const char *group);
|
||||
extern void initBattle(void);
|
||||
extern void initFighterDatabaseDisplay(void);
|
||||
extern void initOptions(void (*returnFromOptions)(void));
|
||||
extern void initStatsDisplay(void);
|
||||
extern void initTitle(void);
|
||||
extern void initTrophiesDisplay(void);
|
||||
extern void loadMission(char *filename);
|
||||
extern void playMusic(char *filename, int loop);
|
||||
extern void playSound(int id);
|
||||
extern void scrollBackground(float x, float y);
|
||||
extern void selectWidget(const char *name, const char *group);
|
||||
extern void setAtlasColor(int r, int g, int b, int a);
|
||||
extern void setMouseCursor(int isDrag);
|
||||
extern void showOKDialog(void (*callback)(void), const char *format, ...);
|
||||
extern void startSectionTransition(void);
|
||||
extern void stopMusic(void);
|
||||
extern void updateAllMissions(void);
|
||||
|
||||
extern App app;
|
||||
extern Colors colors;
|
||||
extern Game game;
|
||||
void destroyGalacticMap(void);
|
||||
void initGalacticMap(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,10 +18,45 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/capitalShips.h"
|
||||
#include "../battle/entities.h"
|
||||
#include "../battle/fighters.h"
|
||||
#include "../battle/items.h"
|
||||
#include "../battle/jumpgate.h"
|
||||
#include "../battle/locations.h"
|
||||
#include "../battle/mine.h"
|
||||
#include "../battle/missionInfo.h"
|
||||
#include "../battle/objectives.h"
|
||||
#include "../battle/player.h"
|
||||
#include "../battle/script.h"
|
||||
#include "../battle/spawners.h"
|
||||
#include "../battle/waypoints.h"
|
||||
#include "../challenges/challenges.h"
|
||||
#include "../galaxy/starSystems.h"
|
||||
#include "../game/trophies.h"
|
||||
#include "../json/cJSON.h"
|
||||
#include "../system/atlas.h"
|
||||
#include "../system/io.h"
|
||||
#include "../system/lookup.h"
|
||||
#include "../system/resources.h"
|
||||
#include "../system/sound.h"
|
||||
#include "../system/textures.h"
|
||||
#include "../system/transition.h"
|
||||
#include "../system/util.h"
|
||||
#include "../system/widgets.h"
|
||||
#include "mission.h"
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Dev dev;
|
||||
extern Entity *player;
|
||||
extern Game game;
|
||||
|
||||
static void loadEntities(cJSON *node);
|
||||
static unsigned long hashcode(const char *str);
|
||||
static void loadEpicData(cJSON *node);
|
||||
static char *getAutoBackground(char *filename);
|
||||
static char *getAutoPlanet(char *filename);
|
||||
|
@ -344,7 +379,7 @@ static void loadEntities(cJSON *node)
|
|||
flags = flagsToLong(cJSON_GetObjectItem(node, "flags")->valuestring, &addFlags);
|
||||
}
|
||||
|
||||
for (i = 0 ; i < number ; i++)
|
||||
for (i = 0; i < number; i++)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
|
@ -434,7 +469,7 @@ static void loadEpicData(cJSON *node)
|
|||
addEpicKillsObjective();
|
||||
}
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
for (e = battle.entityHead.next; e != NULL; e = e->next)
|
||||
{
|
||||
if (e->active && e->type == ET_FIGHTER && numFighters[e->side]++ >= battle.epicFighterLimit)
|
||||
{
|
||||
|
@ -449,9 +484,9 @@ Mission *getMission(char *filename)
|
|||
Mission *mission;
|
||||
|
||||
/* First, search the star systems */
|
||||
for (starSystem = game.starSystemHead.next ; starSystem != NULL ; starSystem = starSystem->next)
|
||||
for (starSystem = game.starSystemHead.next; starSystem != NULL; starSystem = starSystem->next)
|
||||
{
|
||||
for (mission = starSystem->missionHead.next ; mission != NULL ; mission = mission->next)
|
||||
for (mission = starSystem->missionHead.next; mission != NULL; mission = mission->next)
|
||||
{
|
||||
if (strcmp(mission->filename, filename) == 0)
|
||||
{
|
||||
|
@ -461,7 +496,7 @@ Mission *getMission(char *filename)
|
|||
}
|
||||
|
||||
/* now search the challenges */
|
||||
for (mission = game.challengeMissionHead.next ; mission != NULL ; mission = mission->next)
|
||||
for (mission = game.challengeMissionHead.next; mission != NULL; mission = mission->next)
|
||||
{
|
||||
if (strcmp(mission->filename, filename) == 0)
|
||||
{
|
||||
|
@ -489,27 +524,6 @@ int isMissionAvailable(Mission *mission, Mission *prev)
|
|||
}
|
||||
else
|
||||
{
|
||||
return mission->completed || (
|
||||
game.completedMissions >= mission->requires &&
|
||||
game.stats[STAT_OPTIONAL_COMPLETED] >= mission->requiresOptional &&
|
||||
game.completedMissions < mission->expires
|
||||
) || dev.debug;
|
||||
return mission->completed || (game.completedMissions >= mission->requires && game.stats[STAT_OPTIONAL_COMPLETED] >= mission->requiresOptional && game.completedMissions < mission->expires) || dev.debug;
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned long hashcode(const char *str)
|
||||
{
|
||||
unsigned long hash = 5381;
|
||||
int c;
|
||||
|
||||
c = *str;
|
||||
|
||||
while (c)
|
||||
{
|
||||
hash = ((hash << 5) + hash) + c;
|
||||
|
||||
c = *str++;
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,57 +18,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
#include "../json/cJSON.h"
|
||||
|
||||
#include "time.h"
|
||||
|
||||
extern void activateNextWaypoint(void);
|
||||
extern void addAllToQuadtree(void);
|
||||
extern void addEpicKillsObjective(void);
|
||||
extern void addEpicLivesObjective(void);
|
||||
extern void awardCraftTrophy(void);
|
||||
extern void awardPostMissionTrophies(void);
|
||||
extern void awardStatsTrophies(void);
|
||||
extern void completeConditions(void);
|
||||
extern void countNumEnemies(void);
|
||||
extern void endSectionTransition(void);
|
||||
extern void failIncompleteObjectives(void);
|
||||
extern long flagsToLong(char *flags, int *add);
|
||||
extern AtlasImage *getAtlasImage(char *filename);
|
||||
extern char *getBackgroundTextureName(unsigned long n);
|
||||
extern int getJSONValue(cJSON *node, char *name, int defValue);
|
||||
extern char *getJSONValueStr(cJSON *node, char *name, char *defValue);
|
||||
extern char *getMusicFilename(unsigned long n);
|
||||
extern char *getPlanetTextureName(unsigned long n);
|
||||
extern SDL_Texture *getTexture(char *filename);
|
||||
extern void initMissionInfo(void);
|
||||
extern void initPlayer(void);
|
||||
extern void initScript(cJSON *missionJSON);
|
||||
extern void loadCapitalShips(cJSON *node);
|
||||
extern void loadChallenge(Mission *mission, cJSON *node);
|
||||
extern void loadFighters(cJSON *node);
|
||||
extern void loadItems(cJSON *node);
|
||||
extern void loadLocations(cJSON *node);
|
||||
extern void loadObjectives(cJSON *node);
|
||||
extern void loadPlayer(cJSON *node);
|
||||
extern void loadSpawners(cJSON *node);
|
||||
extern long lookup(char *name);
|
||||
extern void playMusic(char *filename, int loop);
|
||||
extern char *readFile(char *filename);
|
||||
extern void retreatEnemies(void);
|
||||
extern void selectWidget(const char *name, const char *group);
|
||||
extern void setInitialPlayerAngle(void);
|
||||
extern Entity *spawnJumpgate(int side, long flags);
|
||||
extern Entity *spawnMine(int type);
|
||||
extern Entity *spawnWaypoint(void);
|
||||
extern void startSectionTransition(void);
|
||||
extern void stopMusic(void);
|
||||
extern void updateChallengeMissions(void);
|
||||
extern void updateStarSystemMissions(void);
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Dev dev;
|
||||
extern Entity *player;
|
||||
extern Game game;
|
||||
int isMissionAvailable(Mission *mission, Mission *prev);
|
||||
void updateAllMissions(void);
|
||||
Mission *getMission(char *filename);
|
||||
void failMission(void);
|
||||
void completeMission(void);
|
||||
void loadMission(char *filename);
|
||||
Mission *loadMissionMeta(char *filename);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../galaxy/mission.h"
|
||||
#include "../json/cJSON.h"
|
||||
#include "../system/io.h"
|
||||
#include "../system/lookup.h"
|
||||
#include "../system/util.h"
|
||||
#include "starSystems.h"
|
||||
|
||||
extern Game game;
|
||||
|
||||
static void loadMissions(StarSystem *starSystem);
|
||||
static StarSystem *loadStarSystem(cJSON *starSystemJSON);
|
||||
|
||||
|
@ -34,7 +43,7 @@ void initStarSystems(void)
|
|||
text = readFile("data/galaxy/starSystems.json");
|
||||
root = cJSON_Parse(text);
|
||||
|
||||
for (node = cJSON_GetObjectItem(root, "starSystems")->child ; node != NULL ; node = node->next)
|
||||
for (node = cJSON_GetObjectItem(root, "starSystems")->child; node != NULL; node = node->next)
|
||||
{
|
||||
starSystem = loadStarSystem(node);
|
||||
tail->next = starSystem;
|
||||
|
@ -87,7 +96,7 @@ static void loadMissions(StarSystem *starSystem)
|
|||
|
||||
STRNCPY(name, starSystem->name, MAX_NAME_LENGTH);
|
||||
|
||||
for (i = 0 ; name[i] ; i++)
|
||||
for (i = 0; name[i]; i++)
|
||||
{
|
||||
name[i] = tolower(name[i]);
|
||||
}
|
||||
|
@ -96,7 +105,7 @@ static void loadMissions(StarSystem *starSystem)
|
|||
|
||||
filenames = getFileList(path, &count);
|
||||
|
||||
for (i = 0 ; i < count ; i++)
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
sprintf(path, "data/missions/%s/%s", name, filenames[i]);
|
||||
|
||||
|
@ -118,7 +127,7 @@ StarSystem *getStarSystem(char *name)
|
|||
{
|
||||
StarSystem *starSystem;
|
||||
|
||||
for (starSystem = game.starSystemHead.next ; starSystem != NULL ; starSystem = starSystem->next)
|
||||
for (starSystem = game.starSystemHead.next; starSystem != NULL; starSystem = starSystem->next)
|
||||
{
|
||||
if (strcmp(starSystem->name, name) == 0)
|
||||
{
|
||||
|
@ -136,11 +145,11 @@ void updateStarSystemMissions(void)
|
|||
|
||||
game.completedMissions = game.totalMissions = game.availableMissions = 0;
|
||||
|
||||
for (starSystem = game.starSystemHead.next ; starSystem != NULL ; starSystem = starSystem->next)
|
||||
for (starSystem = game.starSystemHead.next; starSystem != NULL; starSystem = starSystem->next)
|
||||
{
|
||||
starSystem->completedMissions = starSystem->availableMissions = starSystem->totalMissions = 0;
|
||||
|
||||
for (mission = starSystem->missionHead.next ; mission != NULL ; mission = mission->next)
|
||||
for (mission = starSystem->missionHead.next; mission != NULL; mission = mission->next)
|
||||
{
|
||||
starSystem->totalMissions++;
|
||||
|
||||
|
@ -161,11 +170,11 @@ void updateStarSystemMissions(void)
|
|||
}
|
||||
}
|
||||
|
||||
for (starSystem = game.starSystemHead.next ; starSystem != NULL ; starSystem = starSystem->next)
|
||||
for (starSystem = game.starSystemHead.next; starSystem != NULL; starSystem = starSystem->next)
|
||||
{
|
||||
prev = &starSystem->missionHead;
|
||||
|
||||
for (mission = starSystem->missionHead.next ; mission != NULL ; mission = mission->next)
|
||||
for (mission = starSystem->missionHead.next; mission != NULL; mission = mission->next)
|
||||
{
|
||||
mission->available = starSystem->type == SS_SOL || isMissionAvailable(mission, prev);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,15 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../json/cJSON.h"
|
||||
|
||||
extern char **getFileList(char *dir, int *count);
|
||||
extern int getJSONValue(cJSON *node, char *name, int defValue);
|
||||
extern int isMissionAvailable(Mission *mission, Mission *prev);
|
||||
extern Mission *loadMissionMeta(char *filename);
|
||||
extern long lookup(char *name);
|
||||
extern char *readFile(char *filename);
|
||||
|
||||
extern Game game;
|
||||
void destroyStarSystems(void);
|
||||
void updateStarSystemMissions(void);
|
||||
StarSystem *getStarSystem(char *name);
|
||||
void initStarSystems(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,13 +18,28 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../game/title.h"
|
||||
#include "../json/cJSON.h"
|
||||
#include "../system/atlas.h"
|
||||
#include "../system/draw.h"
|
||||
#include "../system/io.h"
|
||||
#include "../system/sound.h"
|
||||
#include "../system/text.h"
|
||||
#include "../system/textures.h"
|
||||
#include "../system/transition.h"
|
||||
#include "credits.h"
|
||||
|
||||
#define CREDIT_LINE_LIMIT (UI_WIDTH - 300)
|
||||
|
||||
extern App app;
|
||||
extern Colors colors;
|
||||
|
||||
static void loadCredits(void);
|
||||
static void logic(void);
|
||||
static void draw(void);
|
||||
static void handleKeyboard(void);
|
||||
void destroyCredits(void);
|
||||
|
||||
static SDL_Texture *background;
|
||||
static AtlasImage *earthTexture;
|
||||
|
@ -65,7 +80,7 @@ static void logic(void)
|
|||
|
||||
handleKeyboard();
|
||||
|
||||
for (c = head.next ; c != NULL ; c = c->next)
|
||||
for (c = head.next; c != NULL; c = c->next)
|
||||
{
|
||||
c->y -= creditSpeed;
|
||||
|
||||
|
@ -95,7 +110,7 @@ static void draw(void)
|
|||
|
||||
app.textWidth = CREDIT_LINE_LIMIT;
|
||||
|
||||
for (c = head.next ; c != NULL ; c = c->next)
|
||||
for (c = head.next; c != NULL; c = c->next)
|
||||
{
|
||||
if (c->y > -c->h && c->y < app.winHeight)
|
||||
{
|
||||
|
@ -120,7 +135,7 @@ static void loadCredits(void)
|
|||
|
||||
app.textWidth = CREDIT_LINE_LIMIT;
|
||||
|
||||
for (node = root->child ; node != NULL ; node = node->next)
|
||||
for (node = root->child; node != NULL; node = node->next)
|
||||
{
|
||||
c = malloc(sizeof(Credit));
|
||||
memset(c, 0, sizeof(Credit));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,23 +18,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
#include "../json/cJSON.h"
|
||||
|
||||
#define CREDIT_LINE_LIMIT (UI_WIDTH - 300)
|
||||
|
||||
extern void blit(AtlasImage *atlasImage, int x, int y, int centered);
|
||||
extern void drawBackground(SDL_Texture *texture);
|
||||
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
|
||||
extern void endSectionTransition(void);
|
||||
extern AtlasImage *getAtlasImage(const char *filename);
|
||||
extern SDL_Texture *getTexture(const char *filename);
|
||||
extern int getWrappedTextHeight(char *text, int size);
|
||||
extern void initTitle(void);
|
||||
extern void playMusic(char *filename, int loop);
|
||||
extern char *readFile(char *filename);
|
||||
extern void startSectionTransition(void);
|
||||
extern void stopMusic(void);
|
||||
|
||||
extern App app;
|
||||
extern Colors colors;
|
||||
void destroyCredits(void);
|
||||
void initCredits(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/fighters.h"
|
||||
#include "../system/draw.h"
|
||||
#include "../system/text.h"
|
||||
#include "../system/util.h"
|
||||
#include "../system/widgets.h"
|
||||
#include "fighterDatabase.h"
|
||||
|
||||
extern App app;
|
||||
extern Colors colors;
|
||||
extern Game game;
|
||||
|
||||
static void prevFighter(void);
|
||||
static void nextFighter(void);
|
||||
static int countFighterGuns(Entity *fighter, int type);
|
||||
|
@ -141,7 +152,7 @@ void drawFighterDatabase(void)
|
|||
|
||||
y = 200;
|
||||
|
||||
for (i = 1 ; i < BT_MAX ; i++)
|
||||
for (i = 1; i < BT_MAX; i++)
|
||||
{
|
||||
numCannons = countFighterGuns(fighter, i);
|
||||
if (numCannons > 0)
|
||||
|
@ -176,7 +187,7 @@ static int countFighterGuns(Entity *fighter, int type)
|
|||
|
||||
num = 0;
|
||||
|
||||
for (i = 0 ; i < MAX_FIGHTER_GUNS ; i++)
|
||||
for (i = 0; i < MAX_FIGHTER_GUNS; i++)
|
||||
{
|
||||
if (fighter->guns[i].type == type)
|
||||
{
|
||||
|
@ -210,7 +221,7 @@ static void setNumDestroyed(void)
|
|||
|
||||
numDestroyed = 0;
|
||||
|
||||
for (t = game.fighterStatHead.next ; t != NULL ; t = t->next)
|
||||
for (t = game.fighterStatHead.next; t != NULL; t = t->next)
|
||||
{
|
||||
if (strcmp(t->key, fighter->name) == 0)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,15 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
extern void blitRotated(AtlasImage *atlasImage, int x, int y, float angle);
|
||||
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
|
||||
extern void drawWidgets(char *groupName);
|
||||
extern Entity **getDBFighters(int *num);
|
||||
extern Widget *getWidget(const char *name, const char *group);
|
||||
extern float mod(float n, float x);
|
||||
|
||||
extern App app;
|
||||
extern Colors colors;
|
||||
extern Game game;
|
||||
void drawFighterDatabase(void);
|
||||
void doFighterDatabase(void);
|
||||
void initFighterDatabaseDisplay(void);
|
||||
void destroyFighterDatabase(void);
|
||||
void initFighterDatabase(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "game.h"
|
||||
|
||||
extern Game game;
|
||||
|
||||
void initGame(void)
|
||||
{
|
||||
memset(&game, 0, sizeof(Game));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,6 +18,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
extern Game game;
|
||||
void destroyGame(void);
|
||||
void initGame(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/fighters.h"
|
||||
#include "../challenges/challenges.h"
|
||||
#include "../galaxy/mission.h"
|
||||
#include "../galaxy/starSystems.h"
|
||||
#include "../game/trophies.h"
|
||||
#include "../json/cJSON.h"
|
||||
#include "../system/io.h"
|
||||
#include "../system/lookup.h"
|
||||
#include "load.h"
|
||||
|
||||
extern Game game;
|
||||
|
||||
static void loadStats(cJSON *statsJSON);
|
||||
static void loadStarSystems(cJSON *starSystemsJSON);
|
||||
static void loadMissions(cJSON *missionsCJSON);
|
||||
|
@ -58,7 +70,7 @@ static void loadStarSystems(cJSON *starSystemsJSON)
|
|||
StarSystem *starSystem;
|
||||
cJSON *starSystemJSON;
|
||||
|
||||
for (starSystemJSON = starSystemsJSON->child ; starSystemJSON != NULL ; starSystemJSON = starSystemJSON->next)
|
||||
for (starSystemJSON = starSystemsJSON->child; starSystemJSON != NULL; starSystemJSON = starSystemJSON->next)
|
||||
{
|
||||
starSystem = getStarSystem(cJSON_GetObjectItem(starSystemJSON, "name")->valuestring);
|
||||
|
||||
|
@ -73,7 +85,7 @@ static void loadMissions(cJSON *missionsJSON)
|
|||
Mission *mission;
|
||||
cJSON *missionJSON;
|
||||
|
||||
for (missionJSON = missionsJSON->child ; missionJSON != NULL ; missionJSON = missionJSON->next)
|
||||
for (missionJSON = missionsJSON->child; missionJSON != NULL; missionJSON = missionJSON->next)
|
||||
{
|
||||
mission = getMission(cJSON_GetObjectItem(missionJSON, "filename")->valuestring);
|
||||
|
||||
|
@ -93,11 +105,11 @@ static void loadChallenges(cJSON *missionsJSON)
|
|||
|
||||
if (missionsJSON)
|
||||
{
|
||||
for (missionJSON = missionsJSON->child ; missionJSON != NULL ; missionJSON = missionJSON->next)
|
||||
for (missionJSON = missionsJSON->child; missionJSON != NULL; missionJSON = missionJSON->next)
|
||||
{
|
||||
mission = getMission(cJSON_GetObjectItem(missionJSON, "filename")->valuestring);
|
||||
|
||||
for (challengeJSON = cJSON_GetObjectItem(missionJSON, "challenges")->child ; challengeJSON != NULL ; challengeJSON = challengeJSON->next)
|
||||
for (challengeJSON = cJSON_GetObjectItem(missionJSON, "challenges")->child; challengeJSON != NULL; challengeJSON = challengeJSON->next)
|
||||
{
|
||||
type = lookup(cJSON_GetObjectItem(challengeJSON, "type")->valuestring);
|
||||
value = cJSON_GetObjectItem(challengeJSON, "value")->valueint;
|
||||
|
@ -118,7 +130,7 @@ static void loadStats(cJSON *statsJSON)
|
|||
int i;
|
||||
char *statName;
|
||||
|
||||
for (i = 0 ; i < STAT_MAX ; i++)
|
||||
for (i = 0; i < STAT_MAX; i++)
|
||||
{
|
||||
statName = getLookupName("STAT_", i);
|
||||
|
||||
|
@ -136,7 +148,7 @@ static void loadTrophies(cJSON *trophiesJSON)
|
|||
|
||||
if (trophiesJSON)
|
||||
{
|
||||
for (trophyJSON = trophiesJSON->child ; trophyJSON != NULL ; trophyJSON = trophyJSON->next)
|
||||
for (trophyJSON = trophiesJSON->child; trophyJSON != NULL; trophyJSON = trophyJSON->next)
|
||||
{
|
||||
t = getTrophy(cJSON_GetObjectItem(trophyJSON, "id")->valuestring);
|
||||
|
||||
|
@ -160,7 +172,7 @@ static void loadFighterStats(cJSON *fighterStatsJSON)
|
|||
|
||||
if (fighterStatsJSON)
|
||||
{
|
||||
for (fighterStatJSON = fighterStatsJSON->child ; fighterStatJSON != NULL ; fighterStatJSON = fighterStatJSON->next)
|
||||
for (fighterStatJSON = fighterStatsJSON->child; fighterStatJSON != NULL; fighterStatJSON = fighterStatJSON->next)
|
||||
{
|
||||
t = malloc(sizeof(Tuple));
|
||||
memset(t, 0, sizeof(Tuple));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,18 +18,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../json/cJSON.h"
|
||||
|
||||
extern void destroyFighterStats(void);
|
||||
extern Challenge *getChallenge(Mission *mission, int type, int value);
|
||||
extern char *getLookupName(char *prefix, long num);
|
||||
extern Mission *getMission(char *filename);
|
||||
extern char *getSaveFilePath(char *filename);
|
||||
extern StarSystem *getStarSystem(char *name);
|
||||
extern Trophy *getTrophy(char *id);
|
||||
extern int lookup(char *lookup);
|
||||
extern char *readFile(char *filename);
|
||||
|
||||
extern Game game;
|
||||
void loadGame(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,10 +18,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include <SDL2/SDL_mixer.h>
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/starfield.h"
|
||||
#include "../system/controls.h"
|
||||
#include "../system/draw.h"
|
||||
#include "../system/init.h"
|
||||
#include "../system/text.h"
|
||||
#include "../system/widgets.h"
|
||||
#include "options.h"
|
||||
|
||||
#define SHOW_CONTROLS 1
|
||||
#define SHOW_MAIN 0
|
||||
|
||||
extern App app;
|
||||
extern Colors colors;
|
||||
|
||||
static void changeWindowSize(char *value);
|
||||
static void changeEffectsReduction(char *value);
|
||||
static void changeSoundVolume(char *value);
|
||||
static void changeMusicVolume(char *value);
|
||||
static void changeFullscreen(char *value);
|
||||
|
@ -42,7 +57,6 @@ void initOptions(void (*rtn)(void))
|
|||
selectWidget("windowSize", "options");
|
||||
|
||||
getWidget("windowSize", "options")->onChange = changeWindowSize;
|
||||
getWidget("effects", "options")->onChange = changeEffectsReduction;
|
||||
getWidget("soundVolume", "options")->onChange = changeSoundVolume;
|
||||
getWidget("musicVolume", "options")->onChange = changeMusicVolume;
|
||||
getWidget("fullscreen", "options")->onChange = changeFullscreen;
|
||||
|
@ -53,9 +67,6 @@ void initOptions(void (*rtn)(void))
|
|||
sprintf(optionStr, "%d x %d", app.winWidth, app.winHeight);
|
||||
setWidgetOption("windowSize", "options", optionStr);
|
||||
|
||||
sprintf(optionStr, "%d", app.effects);
|
||||
setWidgetOption("effects", "options", optionStr);
|
||||
|
||||
sprintf(optionStr, "%d", app.soundVolume);
|
||||
setWidgetOption("soundVolume", "options", optionStr);
|
||||
|
||||
|
@ -67,11 +78,11 @@ void initOptions(void (*rtn)(void))
|
|||
OPTIONS_TEXT = _("Options");
|
||||
RESOLUTION_TEXT = _("Note: you must restart the game for window size and fullscreen options to take effect.");
|
||||
|
||||
#if FIXED_RESOLUTION
|
||||
#if FIXED_RESOLUTION
|
||||
getWidget("windowSize", "options")->enabled = 0;
|
||||
getWidget("fullscreen", "options")->enabled = 0;
|
||||
RESOLUTION_TEXT = _("Note: this device does not support changing the screen resolution.");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
returnFromOptions = rtn;
|
||||
|
||||
|
@ -122,9 +133,7 @@ static void drawMain(void)
|
|||
|
||||
app.textWidth = r.w - 100;
|
||||
|
||||
#if !defined(__amigaos4__)
|
||||
drawText(UI_WIDTH / 2, r.y + r.h - 135, 16, TA_CENTER, colors.yellow, RESOLUTION_TEXT);
|
||||
#endif
|
||||
|
||||
app.textWidth = 0;
|
||||
|
||||
|
@ -141,7 +150,7 @@ void updateCustomResolutionOption(void)
|
|||
|
||||
w = getWidget("windowSize", "options");
|
||||
|
||||
for (i = 0 ; i < w->numOptions - 1 ; i++)
|
||||
for (i = 0; i < w->numOptions - 1; i++)
|
||||
{
|
||||
if (strcmp(w->options[i], value) == 0)
|
||||
{
|
||||
|
@ -179,11 +188,6 @@ static void changeWindowSize(char *value)
|
|||
initStars();
|
||||
}
|
||||
|
||||
static void changeEffectsReduction(char *value)
|
||||
{
|
||||
app.effects = atoi(value);
|
||||
}
|
||||
|
||||
static void changeSoundVolume(char *value)
|
||||
{
|
||||
app.soundVolume = atoi(value);
|
||||
|
@ -202,7 +206,7 @@ static void changeFullscreen(char *value)
|
|||
{
|
||||
app.fullscreen = strcmp(value, "On") == 0;
|
||||
|
||||
SDL_SetWindowFullscreen(app.window, app.fullscreen? SDL_WINDOW_FULLSCREEN : 0);
|
||||
SDL_SetWindowFullscreen(app.window, app.fullscreen ? SDL_WINDOW_FULLSCREEN : 0);
|
||||
}
|
||||
|
||||
static void ok(void)
|
||||
|
@ -216,4 +220,3 @@ static void controlsOK(void)
|
|||
{
|
||||
show = SHOW_MAIN;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,23 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "SDL2/SDL_mixer.h"
|
||||
|
||||
#define SHOW_CONTROLS 1
|
||||
#define SHOW_MAIN 0
|
||||
|
||||
extern void drawControls(void);
|
||||
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
|
||||
extern void drawWidgets(char *groupName);
|
||||
extern Widget *getWidget(const char *name, const char *group);
|
||||
extern void initControlsDisplay(void);
|
||||
extern void initGraphics(void);
|
||||
extern void initStars(void);
|
||||
extern void saveConfig(void);
|
||||
extern void selectWidget(const char *name, const char *group);
|
||||
extern void setWidgetOption(const char *name, const char *group, const char *value);
|
||||
|
||||
extern App app;
|
||||
extern Colors colors;
|
||||
void updateCustomResolutionOption(void);
|
||||
void drawOptions(void);
|
||||
void initOptions(void (*rtn)(void));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../json/cJSON.h"
|
||||
#include "../system/io.h"
|
||||
#include "../system/lookup.h"
|
||||
#include "save.h"
|
||||
|
||||
extern Game game;
|
||||
|
||||
static void saveStarSystems(cJSON *gameJSON);
|
||||
static void saveChallenges(cJSON *gameJSON);
|
||||
static cJSON *getMissionsJSON(StarSystem *starSystem);
|
||||
|
@ -65,7 +72,7 @@ static void saveStarSystems(cJSON *gameJSON)
|
|||
|
||||
starSystemsJSON = cJSON_CreateArray();
|
||||
|
||||
for (starSystem = game.starSystemHead.next ; starSystem != NULL ; starSystem = starSystem->next)
|
||||
for (starSystem = game.starSystemHead.next; starSystem != NULL; starSystem = starSystem->next)
|
||||
{
|
||||
if (starSystem->totalMissions > 0)
|
||||
{
|
||||
|
@ -89,7 +96,7 @@ static cJSON *getMissionsJSON(StarSystem *starSystem)
|
|||
|
||||
missionsJSON = cJSON_CreateArray();
|
||||
|
||||
for (mission = starSystem->missionHead.next ; mission != NULL ; mission = mission->next)
|
||||
for (mission = starSystem->missionHead.next; mission != NULL; mission = mission->next)
|
||||
{
|
||||
missionJSON = cJSON_CreateObject();
|
||||
|
||||
|
@ -111,7 +118,7 @@ static void saveChallenges(cJSON *gameJSON)
|
|||
|
||||
missionsJSON = cJSON_CreateArray();
|
||||
|
||||
for (mission = game.challengeMissionHead.next ; mission != NULL ; mission = mission->next)
|
||||
for (mission = game.challengeMissionHead.next; mission != NULL; mission = mission->next)
|
||||
{
|
||||
missionJSON = cJSON_CreateObject();
|
||||
|
||||
|
@ -119,7 +126,7 @@ static void saveChallenges(cJSON *gameJSON)
|
|||
|
||||
challengesJSON = cJSON_CreateArray();
|
||||
|
||||
for (i = 0 ; i < MAX_CHALLENGES ; i++)
|
||||
for (i = 0; i < MAX_CHALLENGES; i++)
|
||||
{
|
||||
c = mission->challengeData.challenges[i];
|
||||
|
||||
|
@ -148,7 +155,7 @@ static void saveStats(cJSON *gameJSON)
|
|||
|
||||
cJSON *stats = cJSON_CreateObject();
|
||||
|
||||
for (i = 0 ; i < STAT_MAX ; i++)
|
||||
for (i = 0; i < STAT_MAX; i++)
|
||||
{
|
||||
cJSON_AddNumberToObject(stats, getLookupName("STAT_", i), game.stats[i]);
|
||||
}
|
||||
|
@ -163,7 +170,7 @@ static void saveTrophies(cJSON *gameJSON)
|
|||
|
||||
trophiesJSON = cJSON_CreateArray();
|
||||
|
||||
for (t = game.trophyHead.next ; t != NULL ; t = t->next)
|
||||
for (t = game.trophyHead.next; t != NULL; t = t->next)
|
||||
{
|
||||
if (t->awarded)
|
||||
{
|
||||
|
@ -186,7 +193,7 @@ static void saveFighterStats(cJSON *gameJSON)
|
|||
|
||||
fighterStatsJSON = cJSON_CreateArray();
|
||||
|
||||
for (t = game.fighterStatHead.next ; t != NULL ; t = t->next)
|
||||
for (t = game.fighterStatHead.next; t != NULL; t = t->next)
|
||||
{
|
||||
fighterStatJSON = cJSON_CreateObject();
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,12 +18,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../json/cJSON.h"
|
||||
|
||||
extern char *getLookupName(char *prefix, long num);
|
||||
extern char *getSaveFilePath(char *filename);
|
||||
extern int writeFile(char *filename, char *data);
|
||||
|
||||
extern Game game;
|
||||
void saveGame(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,12 +18,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../system/text.h"
|
||||
#include "../system/util.h"
|
||||
#include "../system/widgets.h"
|
||||
#include "stats.h"
|
||||
|
||||
#define STATS_PER_PAGE 9
|
||||
|
||||
extern App app;
|
||||
extern Colors colors;
|
||||
extern Game game;
|
||||
|
||||
static void prevPage(void);
|
||||
static void nextPage(void);
|
||||
static void calculatePercentComplete(void);
|
||||
void updateAccuracyStats(unsigned int *stats);
|
||||
|
||||
static char *statDescription[STAT_MAX];
|
||||
static int page;
|
||||
|
@ -108,7 +118,7 @@ static void calculatePercentComplete(void)
|
|||
|
||||
completed = total = 0;
|
||||
|
||||
for (starSystem = game.starSystemHead.next ; starSystem != NULL ; starSystem = starSystem->next)
|
||||
for (starSystem = game.starSystemHead.next; starSystem != NULL; starSystem = starSystem->next)
|
||||
{
|
||||
if (starSystem->type == SS_NORMAL)
|
||||
{
|
||||
|
@ -117,7 +127,7 @@ static void calculatePercentComplete(void)
|
|||
}
|
||||
}
|
||||
|
||||
for (mission = game.challengeMissionHead.next ; mission != NULL ; mission = mission->next)
|
||||
for (mission = game.challengeMissionHead.next; mission != NULL; mission = mission->next)
|
||||
{
|
||||
completed += mission->completedChallenges;
|
||||
total += mission->totalChallenges;
|
||||
|
@ -159,7 +169,7 @@ void drawStats(void)
|
|||
|
||||
startIndex = (page * STATS_PER_PAGE);
|
||||
|
||||
for (i = startIndex ; i < startIndex + STATS_PER_PAGE ; i++)
|
||||
for (i = startIndex; i < startIndex + STATS_PER_PAGE; i++)
|
||||
{
|
||||
if (i < STAT_TIME)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,16 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#define STATS_PER_PAGE 9
|
||||
|
||||
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
|
||||
extern void drawWidgets(char *groupName);
|
||||
extern int getPercent(float current, float total);
|
||||
extern Widget *getWidget(const char *name, const char *group);
|
||||
extern char *timeToString(long millis, int showHours);
|
||||
|
||||
extern App app;
|
||||
extern Colors colors;
|
||||
extern Game game;
|
||||
void updateAccuracyStats(unsigned int *stats);
|
||||
void drawStats(void);
|
||||
void initStatsDisplay(void);
|
||||
void initStats(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,42 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/battle.h"
|
||||
#include "../battle/effects.h"
|
||||
#include "../battle/starfield.h"
|
||||
#include "../challenges/challengeHome.h"
|
||||
#include "../galaxy/galacticMap.h"
|
||||
#include "../galaxy/mission.h"
|
||||
#include "../game/credits.h"
|
||||
#include "../game/fighterDatabase.h"
|
||||
#include "../game/options.h"
|
||||
#include "../game/stats.h"
|
||||
#include "../game/trophies.h"
|
||||
#include "../system/atlas.h"
|
||||
#include "../system/draw.h"
|
||||
#include "../system/input.h"
|
||||
#include "../system/sound.h"
|
||||
#include "../system/text.h"
|
||||
#include "../system/textures.h"
|
||||
#include "../system/transition.h"
|
||||
#include "../system/widgets.h"
|
||||
#include "title.h"
|
||||
|
||||
#define NUM_FIGHTERS 12
|
||||
#define SHOW_FIGHTER_DB 4
|
||||
#define SHOW_OPTIONS 2
|
||||
#define SHOW_STATS 1
|
||||
#define SHOW_TITLE 0
|
||||
#define SHOW_TROPHIES 3
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Entity *self;
|
||||
extern Game game;
|
||||
|
||||
static void logic(void);
|
||||
static void draw(void);
|
||||
static void handleKeyboard(void);
|
||||
|
@ -104,11 +138,11 @@ static void initFighters(void)
|
|||
{
|
||||
int i, numTextures;
|
||||
|
||||
numTextures = sizeof(fighterTextures) / sizeof(char*);
|
||||
numTextures = sizeof(fighterTextures) / sizeof(char *);
|
||||
|
||||
memset(&fighters, 0, sizeof(Entity) * NUM_FIGHTERS);
|
||||
|
||||
for (i = 0 ; i < NUM_FIGHTERS ; i++)
|
||||
for (i = 0; i < NUM_FIGHTERS; i++)
|
||||
{
|
||||
fighters[i].x = rand() % (app.winWidth - 32);
|
||||
fighters[i].y = app.winHeight + (rand() % app.winHeight);
|
||||
|
@ -151,9 +185,9 @@ static void doFighters(void)
|
|||
{
|
||||
int i, numTextures;
|
||||
|
||||
numTextures = sizeof(fighterTextures) / sizeof(char*);
|
||||
numTextures = sizeof(fighterTextures) / sizeof(char *);
|
||||
|
||||
for (i = 0 ; i < NUM_FIGHTERS ; i++)
|
||||
for (i = 0; i < NUM_FIGHTERS; i++)
|
||||
{
|
||||
self = &fighters[i];
|
||||
|
||||
|
@ -195,7 +229,7 @@ static void draw(void)
|
|||
|
||||
blit(pandoranWar, app.winWidth / 2, 110, 1);
|
||||
|
||||
drawText(10, app.winHeight - 25, 14, TA_LEFT, colors.white, "Copyright Parallel Realities, 2015-2019");
|
||||
drawText(10, app.winHeight - 25, 14, TA_LEFT, colors.white, "Copyright,2022 Parallel Realities, 2015-2019,2022");
|
||||
drawText(app.winWidth - 10, app.winHeight - 25, 14, TA_RIGHT, colors.white, "Version %.2f.%d", VERSION, REVISION);
|
||||
|
||||
switch (show)
|
||||
|
@ -230,7 +264,7 @@ static void drawFighters(void)
|
|||
|
||||
setAtlasColor(255, 255, 255, 255);
|
||||
|
||||
for (i = 0 ; i < NUM_FIGHTERS ; i++)
|
||||
for (i = 0; i < NUM_FIGHTERS; i++)
|
||||
{
|
||||
blit(fighters[i].texture, fighters[i].x, fighters[i].y, 1);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,56 +18,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#define NUM_FIGHTERS 12
|
||||
#define SHOW_FIGHTER_DB 4
|
||||
#define SHOW_OPTIONS 2
|
||||
#define SHOW_STATS 1
|
||||
#define SHOW_TITLE 0
|
||||
#define SHOW_TROPHIES 3
|
||||
|
||||
extern void addEngineEffect(void);
|
||||
extern void autoSizeWidgetButtons(char *group, int recenter);
|
||||
extern void blit(AtlasImage *atlasImage, int x, int y, int centered);
|
||||
extern void clearInput(void);
|
||||
extern void destroyBattle(void);
|
||||
extern void doEffects(void);
|
||||
extern void doFighterDatabase(void);
|
||||
extern void doStars(float dx, float dy);
|
||||
extern void doWidgets(void);
|
||||
extern void drawBackground(SDL_Texture *texture);
|
||||
extern void drawEffects(void);
|
||||
extern void drawFighterDatabase(void);
|
||||
extern void drawOptions(void);
|
||||
extern void drawStars(void);
|
||||
extern void drawStats(void);
|
||||
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
|
||||
extern void drawTrophies(void);
|
||||
extern void drawWidgets(char *groupName);
|
||||
extern void endSectionTransition(void);
|
||||
extern AtlasImage *getAtlasImage(const char *filename);
|
||||
extern SDL_Texture *getTexture(const char *filename);
|
||||
extern Widget *getWidget(const char *name, const char *group);
|
||||
extern void initChallengeHome(void);
|
||||
extern void initCredits(void);
|
||||
extern void initEffects(void);
|
||||
extern void initFighterDatabaseDisplay(void);
|
||||
extern void initGalacticMap(void);
|
||||
extern void initOptions(void (*returnFromOptions)(void));
|
||||
extern void initStatsDisplay(void);
|
||||
extern void initTrophiesDisplay(void);
|
||||
extern void playMusic(char *filename, int loop);
|
||||
extern void playSound(int id);
|
||||
extern void scrollBackground(float x, float y);
|
||||
extern void selectWidget(const char *name, const char *group);
|
||||
extern void setAtlasColor(int r, int g, int b, int a);
|
||||
extern void startSectionTransition(void);
|
||||
extern void stopMusic(void);
|
||||
extern void updateAllMissions(void);
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Entity *self;
|
||||
extern Game game;
|
||||
void initTitle(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,30 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include "../battle/entities.h"
|
||||
#include "../json/cJSON.h"
|
||||
#include "../system/atlas.h"
|
||||
#include "../system/draw.h"
|
||||
#include "../system/io.h"
|
||||
#include "../system/lookup.h"
|
||||
#include "../system/sound.h"
|
||||
#include "../system/text.h"
|
||||
#include "../system/util.h"
|
||||
#include "../system/widgets.h"
|
||||
#include "trophies.h"
|
||||
|
||||
#define TROPHIES_PER_PAGE 4
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Entity *player;
|
||||
extern Game game;
|
||||
|
||||
static void prevPage(void);
|
||||
static void nextPage(void);
|
||||
static void loadTrophyData(char *filename);
|
||||
|
@ -78,7 +100,7 @@ void initTrophiesDisplay(void)
|
|||
|
||||
boxWidth = total = awarded = 0;
|
||||
|
||||
for (t = game.trophyHead.next ; t != NULL ; t = t->next)
|
||||
for (t = game.trophyHead.next; t != NULL; t = t->next)
|
||||
{
|
||||
total++;
|
||||
|
||||
|
@ -163,7 +185,7 @@ void drawTrophies(void)
|
|||
end = start + TROPHIES_PER_PAGE;
|
||||
i = 0;
|
||||
|
||||
for (t = game.trophyHead.next ; t != NULL ; t = t->next)
|
||||
for (t = game.trophyHead.next; t != NULL; t = t->next)
|
||||
{
|
||||
if (i >= start && i < end)
|
||||
{
|
||||
|
@ -214,7 +236,7 @@ void awardTrophy(char *id)
|
|||
|
||||
numRemaining = 0;
|
||||
|
||||
for (t = game.trophyHead.next ; t != NULL ; t = t->next)
|
||||
for (t = game.trophyHead.next; t != NULL; t = t->next)
|
||||
{
|
||||
if (!t->awarded && strcmp(t->id, id) == 0)
|
||||
{
|
||||
|
@ -273,7 +295,7 @@ static void nextAlert(void)
|
|||
int w, h;
|
||||
Trophy *t;
|
||||
|
||||
for (t = game.trophyHead.next ; t != NULL ; t = t->next)
|
||||
for (t = game.trophyHead.next; t != NULL; t = t->next)
|
||||
{
|
||||
if (t->notify)
|
||||
{
|
||||
|
@ -336,7 +358,7 @@ Trophy *getTrophy(char *id)
|
|||
{
|
||||
Trophy *t;
|
||||
|
||||
for (t = game.trophyHead.next ; t != NULL ; t = t->next)
|
||||
for (t = game.trophyHead.next; t != NULL; t = t->next)
|
||||
{
|
||||
if (strcmp(t->id, id) == 0)
|
||||
{
|
||||
|
@ -363,7 +385,7 @@ static void loadTrophyData(char *filename)
|
|||
|
||||
memset(count, 0, sizeof(int) * TROPHY_MAX);
|
||||
|
||||
for (node = root->child ; node != NULL ; node = node->next)
|
||||
for (node = root->child; node != NULL; node = node->next)
|
||||
{
|
||||
if (cJSON_GetObjectItem(node, "id")->valuestring[0] != '_')
|
||||
{
|
||||
|
@ -404,7 +426,7 @@ void awardStatsTrophies(void)
|
|||
Trophy *t;
|
||||
Tuple *tp;
|
||||
|
||||
for (t = game.trophyHead.next ; t != NULL ; t = t->next)
|
||||
for (t = game.trophyHead.next; t != NULL; t = t->next)
|
||||
{
|
||||
if (t->stat != -1 && !t->awarded && (game.stats[t->stat] + battle.stats[t->stat]) >= t->statValue)
|
||||
{
|
||||
|
@ -413,7 +435,7 @@ void awardStatsTrophies(void)
|
|||
}
|
||||
|
||||
/* check to see if we've destroyed one of each common starfighter */
|
||||
for (tp = game.fighterStatHead.next ; tp != NULL ; tp = tp->next)
|
||||
for (tp = game.fighterStatHead.next; tp != NULL; tp = tp->next)
|
||||
{
|
||||
if (tp->value == 0)
|
||||
{
|
||||
|
@ -437,7 +459,7 @@ void awardCampaignTrophies(void)
|
|||
}
|
||||
|
||||
/* check if all star system missions are completed */
|
||||
for (starSystem = game.starSystemHead.next ; starSystem != NULL ; starSystem = starSystem->next)
|
||||
for (starSystem = game.starSystemHead.next; starSystem != NULL; starSystem = starSystem->next)
|
||||
{
|
||||
if (starSystem->totalMissions && starSystem->completedMissions == starSystem->totalMissions)
|
||||
{
|
||||
|
@ -445,7 +467,7 @@ void awardCampaignTrophies(void)
|
|||
|
||||
len = strlen(starSystem->name);
|
||||
|
||||
for (i = 0 ; i < len ; i++)
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
name[i] = toupper(starSystem->name[i]);
|
||||
}
|
||||
|
@ -533,4 +555,3 @@ static void setSparkleColor(Trophy *t)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,34 +18,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
|
||||
#include "../common.h"
|
||||
#include "../json/cJSON.h"
|
||||
|
||||
#include "time.h"
|
||||
|
||||
#define TROPHIES_PER_PAGE 4
|
||||
|
||||
extern void awardPandoranCraftTrophy(void);
|
||||
extern void blit(AtlasImage *atlasImage, int x, int y, int centered);
|
||||
extern void blitRotated(AtlasImage *atlasImage, int x, int y, float angle);
|
||||
extern void blitScaled(AtlasImage *atlasImage, int x, int y, int w, int h, int center);
|
||||
extern void calcTextDimensions(char *text, int size, int *w, int *h);
|
||||
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
|
||||
extern void drawWidgets(char *groupName);
|
||||
extern AtlasImage *getAtlasImage(char *filename);
|
||||
extern int getJSONValue(cJSON *node, char *name, int defValue);
|
||||
extern int getPercent(float current, float total);
|
||||
extern Widget *getWidget(const char *name, const char *group);
|
||||
extern long lookup(char *name);
|
||||
extern float mod(float n, float x);
|
||||
extern void playSound(int id);
|
||||
extern char *readFile(char *filename);
|
||||
extern void setAtlasColor(int r, int g, int b, int a);
|
||||
extern char *timeToDate(long millis);
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
extern Entity *player;
|
||||
extern Game game;
|
||||
void awardCraftTrophy(void);
|
||||
void awardPostMissionTrophies(void);
|
||||
void awardChallengeTrophies(void);
|
||||
void awardCampaignTrophies(void);
|
||||
void awardStatsTrophies(void);
|
||||
Trophy *getTrophy(char *id);
|
||||
void drawTrophyAlert(void);
|
||||
void doTrophyAlerts(void);
|
||||
void awardTrophy(char *id);
|
||||
void drawTrophies(void);
|
||||
void initTrophiesDisplay(void);
|
||||
void initTrophies(void);
|
||||
|
|
761
src/json/cJSON.c
761
src/json/cJSON.c
File diff suppressed because it is too large
Load Diff
147
src/json/cJSON.h
147
src/json/cJSON.h
|
@ -40,9 +40,10 @@ extern "C"
|
|||
#define cJSON_IsReference 256
|
||||
#define cJSON_StringIsConst 512
|
||||
|
||||
/* The cJSON structure: */
|
||||
typedef struct cJSON {
|
||||
struct cJSON *next,*prev; /* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
|
||||
/* The cJSON structure: */
|
||||
typedef struct cJSON
|
||||
{
|
||||
struct cJSON *next, *prev; /* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
|
||||
struct cJSON *child; /* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
|
||||
|
||||
int type; /* The type of the item, as above. */
|
||||
|
@ -52,95 +53,95 @@ typedef struct cJSON {
|
|||
double valuedouble; /* The item's number, if type==cJSON_Number */
|
||||
|
||||
char *string; /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */
|
||||
} cJSON;
|
||||
} cJSON;
|
||||
|
||||
typedef struct cJSON_Hooks {
|
||||
typedef struct cJSON_Hooks
|
||||
{
|
||||
void *(*malloc_fn)(size_t sz);
|
||||
void (*free_fn)(void *ptr);
|
||||
} cJSON_Hooks;
|
||||
} cJSON_Hooks;
|
||||
|
||||
/* Supply malloc, realloc and free functions to cJSON */
|
||||
extern void cJSON_InitHooks(cJSON_Hooks* hooks);
|
||||
/* Supply malloc, realloc and free functions to cJSON */
|
||||
extern void cJSON_InitHooks(cJSON_Hooks *hooks);
|
||||
|
||||
/* Supply a block of JSON, and this returns a cJSON object you can interrogate. Call cJSON_Delete when finished. */
|
||||
extern cJSON *cJSON_Parse(const char *value);
|
||||
/* Render a cJSON entity to text for transfer/storage. Free the char* when finished. */
|
||||
extern char *cJSON_Print(cJSON *item);
|
||||
/* Render a cJSON entity to text for transfer/storage without any formatting. Free the char* when finished. */
|
||||
extern char *cJSON_PrintUnformatted(cJSON *item);
|
||||
/* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */
|
||||
extern char *cJSON_PrintBuffered(cJSON *item, int prebuffer, int fmt);
|
||||
/* Delete a cJSON entity and all subentities. */
|
||||
extern void cJSON_Delete(cJSON *c);
|
||||
|
||||
/* Supply a block of JSON, and this returns a cJSON object you can interrogate. Call cJSON_Delete when finished. */
|
||||
extern cJSON *cJSON_Parse(const char *value);
|
||||
/* Render a cJSON entity to text for transfer/storage. Free the char* when finished. */
|
||||
extern char *cJSON_Print(cJSON *item);
|
||||
/* Render a cJSON entity to text for transfer/storage without any formatting. Free the char* when finished. */
|
||||
extern char *cJSON_PrintUnformatted(cJSON *item);
|
||||
/* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */
|
||||
extern char *cJSON_PrintBuffered(cJSON *item,int prebuffer,int fmt);
|
||||
/* Delete a cJSON entity and all subentities. */
|
||||
extern void cJSON_Delete(cJSON *c);
|
||||
/* Returns the number of items in an array (or object). */
|
||||
extern int cJSON_GetArraySize(cJSON *array);
|
||||
/* Retrieve item number "item" from array "array". Returns NULL if unsuccessful. */
|
||||
extern cJSON *cJSON_GetArrayItem(cJSON *array, int item);
|
||||
/* Get item "string" from object. Case insensitive. */
|
||||
extern cJSON *cJSON_GetObjectItem(cJSON *object, const char *string);
|
||||
|
||||
/* Returns the number of items in an array (or object). */
|
||||
extern int cJSON_GetArraySize(cJSON *array);
|
||||
/* Retrieve item number "item" from array "array". Returns NULL if unsuccessful. */
|
||||
extern cJSON *cJSON_GetArrayItem(cJSON *array,int item);
|
||||
/* Get item "string" from object. Case insensitive. */
|
||||
extern cJSON *cJSON_GetObjectItem(cJSON *object,const char *string);
|
||||
/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
|
||||
extern const char *cJSON_GetErrorPtr(void);
|
||||
|
||||
/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
|
||||
extern const char *cJSON_GetErrorPtr(void);
|
||||
/* These calls create a cJSON item of the appropriate type. */
|
||||
extern cJSON *cJSON_CreateNull(void);
|
||||
extern cJSON *cJSON_CreateTrue(void);
|
||||
extern cJSON *cJSON_CreateFalse(void);
|
||||
extern cJSON *cJSON_CreateBool(int b);
|
||||
extern cJSON *cJSON_CreateNumber(double num);
|
||||
extern cJSON *cJSON_CreateString(const char *string);
|
||||
extern cJSON *cJSON_CreateArray(void);
|
||||
extern cJSON *cJSON_CreateObject(void);
|
||||
|
||||
/* These calls create a cJSON item of the appropriate type. */
|
||||
extern cJSON *cJSON_CreateNull(void);
|
||||
extern cJSON *cJSON_CreateTrue(void);
|
||||
extern cJSON *cJSON_CreateFalse(void);
|
||||
extern cJSON *cJSON_CreateBool(int b);
|
||||
extern cJSON *cJSON_CreateNumber(double num);
|
||||
extern cJSON *cJSON_CreateString(const char *string);
|
||||
extern cJSON *cJSON_CreateArray(void);
|
||||
extern cJSON *cJSON_CreateObject(void);
|
||||
/* These utilities create an Array of count items. */
|
||||
extern cJSON *cJSON_CreateIntArray(const int *numbers, int count);
|
||||
extern cJSON *cJSON_CreateFloatArray(const float *numbers, int count);
|
||||
extern cJSON *cJSON_CreateDoubleArray(const double *numbers, int count);
|
||||
extern cJSON *cJSON_CreateStringArray(const char **strings, int count);
|
||||
|
||||
/* These utilities create an Array of count items. */
|
||||
extern cJSON *cJSON_CreateIntArray(const int *numbers,int count);
|
||||
extern cJSON *cJSON_CreateFloatArray(const float *numbers,int count);
|
||||
extern cJSON *cJSON_CreateDoubleArray(const double *numbers,int count);
|
||||
extern cJSON *cJSON_CreateStringArray(const char **strings,int count);
|
||||
/* Append item to the specified array/object. */
|
||||
extern void cJSON_AddItemToArray(cJSON *array, cJSON *item);
|
||||
extern void cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item);
|
||||
extern void cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item); /* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object */
|
||||
/* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */
|
||||
extern void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
|
||||
extern void cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item);
|
||||
|
||||
/* Append item to the specified array/object. */
|
||||
extern void cJSON_AddItemToArray(cJSON *array, cJSON *item);
|
||||
extern void cJSON_AddItemToObject(cJSON *object,const char *string,cJSON *item);
|
||||
extern void cJSON_AddItemToObjectCS(cJSON *object,const char *string,cJSON *item); /* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object */
|
||||
/* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */
|
||||
extern void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
|
||||
extern void cJSON_AddItemReferenceToObject(cJSON *object,const char *string,cJSON *item);
|
||||
/* Remove/Detatch items from Arrays/Objects. */
|
||||
extern cJSON *cJSON_DetachItemFromArray(cJSON *array, int which);
|
||||
extern void cJSON_DeleteItemFromArray(cJSON *array, int which);
|
||||
extern cJSON *cJSON_DetachItemFromObject(cJSON *object, const char *string);
|
||||
extern void cJSON_DeleteItemFromObject(cJSON *object, const char *string);
|
||||
|
||||
/* Remove/Detatch items from Arrays/Objects. */
|
||||
extern cJSON *cJSON_DetachItemFromArray(cJSON *array,int which);
|
||||
extern void cJSON_DeleteItemFromArray(cJSON *array,int which);
|
||||
extern cJSON *cJSON_DetachItemFromObject(cJSON *object,const char *string);
|
||||
extern void cJSON_DeleteItemFromObject(cJSON *object,const char *string);
|
||||
/* Update array items. */
|
||||
extern void cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */
|
||||
extern void cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem);
|
||||
extern void cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem);
|
||||
|
||||
/* Update array items. */
|
||||
extern void cJSON_InsertItemInArray(cJSON *array,int which,cJSON *newitem); /* Shifts pre-existing items to the right. */
|
||||
extern void cJSON_ReplaceItemInArray(cJSON *array,int which,cJSON *newitem);
|
||||
extern void cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
|
||||
/* Duplicate a cJSON item */
|
||||
extern cJSON *cJSON_Duplicate(cJSON *item, int recurse);
|
||||
/* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will
|
||||
need to be released. With recurse!=0, it will duplicate any children connected to the item.
|
||||
The item->next and ->prev pointers are always zero on return from Duplicate. */
|
||||
|
||||
/* Duplicate a cJSON item */
|
||||
extern cJSON *cJSON_Duplicate(cJSON *item,int recurse);
|
||||
/* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will
|
||||
need to be released. With recurse!=0, it will duplicate any children connected to the item.
|
||||
The item->next and ->prev pointers are always zero on return from Duplicate. */
|
||||
/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */
|
||||
extern cJSON *cJSON_ParseWithOpts(const char *value, const char **return_parse_end, int require_null_terminated);
|
||||
|
||||
/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */
|
||||
extern cJSON *cJSON_ParseWithOpts(const char *value,const char **return_parse_end,int require_null_terminated);
|
||||
|
||||
extern void cJSON_Minify(char *json);
|
||||
extern void cJSON_Minify(char *json);
|
||||
|
||||
/* Macros for creating things quickly. */
|
||||
#define cJSON_AddNullToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateNull())
|
||||
#define cJSON_AddTrueToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateTrue())
|
||||
#define cJSON_AddFalseToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateFalse())
|
||||
#define cJSON_AddBoolToObject(object,name,b) cJSON_AddItemToObject(object, name, cJSON_CreateBool(b))
|
||||
#define cJSON_AddNumberToObject(object,name,n) cJSON_AddItemToObject(object, name, cJSON_CreateNumber(n))
|
||||
#define cJSON_AddStringToObject(object,name,s) cJSON_AddItemToObject(object, name, cJSON_CreateString(s))
|
||||
#define cJSON_AddNullToObject(object, name) cJSON_AddItemToObject(object, name, cJSON_CreateNull())
|
||||
#define cJSON_AddTrueToObject(object, name) cJSON_AddItemToObject(object, name, cJSON_CreateTrue())
|
||||
#define cJSON_AddFalseToObject(object, name) cJSON_AddItemToObject(object, name, cJSON_CreateFalse())
|
||||
#define cJSON_AddBoolToObject(object, name, b) cJSON_AddItemToObject(object, name, cJSON_CreateBool(b))
|
||||
#define cJSON_AddNumberToObject(object, name, n) cJSON_AddItemToObject(object, name, cJSON_CreateNumber(n))
|
||||
#define cJSON_AddStringToObject(object, name, s) cJSON_AddItemToObject(object, name, cJSON_CreateString(s))
|
||||
|
||||
/* When assigning an integer value, it needs to be propagated to valuedouble too. */
|
||||
#define cJSON_SetIntValue(object,val) ((object)?(object)->valueint=(object)->valuedouble=(val):(val))
|
||||
#define cJSON_SetNumberValue(object,val) ((object)?(object)->valueint=(object)->valuedouble=(val):(val))
|
||||
#define cJSON_SetIntValue(object, val) ((object) ? (object)->valueint = (object)->valuedouble = (val) : (val))
|
||||
#define cJSON_SetNumberValue(object, val) ((object) ? (object)->valueint = (object)->valuedouble = (val) : (val))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
33
src/main.c
33
src/main.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,7 +18,34 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include "game/credits.h"
|
||||
#include "game/load.h"
|
||||
#include "game/save.h"
|
||||
#include "game/title.h"
|
||||
#include "game/trophies.h"
|
||||
#include "main.h"
|
||||
#include "plat/win32/win32Init.h"
|
||||
#include "system/controls.h"
|
||||
#include "system/dev.h"
|
||||
#include "system/draw.h"
|
||||
#include "system/init.h"
|
||||
#include "system/input.h"
|
||||
#include "system/io.h"
|
||||
#include "system/lookup.h"
|
||||
#include "system/modalDialog.h"
|
||||
#include "test/testMission.h"
|
||||
|
||||
App app;
|
||||
Battle battle;
|
||||
Colors colors;
|
||||
Dev dev;
|
||||
Entity *player;
|
||||
Entity *self;
|
||||
Game game;
|
||||
|
||||
static void handleMissionArgs(int argc, char *argv[]);
|
||||
static void handleLoggingArgs(int argc, char *argv[]);
|
||||
|
@ -166,7 +193,7 @@ static void handleLoggingArgs(int argc, char *argv[])
|
|||
|
||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN);
|
||||
|
||||
for (i = 1 ; i < argc ; i++)
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if (strcmp(argv[i], "-debug") == 0)
|
||||
{
|
||||
|
@ -188,7 +215,7 @@ static void handleMissionArgs(int argc, char *argv[])
|
|||
|
||||
showCredits = testingMission = 0;
|
||||
|
||||
for (i = 1 ; i < argc ; i++)
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
/* assume this is filename for testing */
|
||||
if (strcmp(argv[i], "-mission") == 0)
|
||||
|
|
41
src/main.h
41
src/main.h
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,41 +18,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "SDL2/SDL.h"
|
||||
#include "time.h"
|
||||
|
||||
#include "defs.h"
|
||||
#include "structs.h"
|
||||
|
||||
extern void cleanup(void);
|
||||
extern void clearControl(int type);
|
||||
extern void createScreenshotFolder(void);
|
||||
extern void doDevKeys(void);
|
||||
extern void doInput(void);
|
||||
extern void doModalDialog(void);
|
||||
extern void doTrophyAlerts(void);
|
||||
extern void drawModalDialog(void);
|
||||
extern void drawTrophyAlert(void);
|
||||
extern int fileExists(char *filename);
|
||||
extern char *getSaveFilePath(char *filename);
|
||||
extern void init18N(int argc, char *argv[]);
|
||||
extern void initCredits(void);
|
||||
extern void initGameSystem(void);
|
||||
extern void initLookups(void);
|
||||
extern void initSDL(int argc, char *argv[]);
|
||||
extern void initTitle(void);
|
||||
extern int isControl(int type);
|
||||
extern void loadGame(void);
|
||||
extern void loadTestMission(char *filename);
|
||||
extern void prepareScene(void);
|
||||
extern void presentScene(void);
|
||||
extern void saveGame(void);
|
||||
extern void saveScreenshot(void);
|
||||
|
||||
App app;
|
||||
Battle battle;
|
||||
Colors colors;
|
||||
Dev dev;
|
||||
Entity *player;
|
||||
Entity *self;
|
||||
Game game;
|
||||
int main(int argc, char *argv[]);
|
||||
|
|
|
@ -1,101 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019,2022 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 <errno.h>
|
||||
#include <pwd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <proto/dos.h>
|
||||
#include <proto/exec.h>
|
||||
|
||||
#include "../../common.h"
|
||||
|
||||
#include "os4Init.h"
|
||||
|
||||
#define VSTRING "tbftss 1.50.1r1 (22.08.2022)"
|
||||
#define VERSTAG "\0$VER: " VSTRING
|
||||
static CONST_STRPTR stack USED = "$STACK:102400";
|
||||
static CONST_STRPTR version USED = VERSTAG;
|
||||
|
||||
extern App app;
|
||||
extern Dev dev;
|
||||
|
||||
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");
|
||||
if (mkdir("PROGDIR:saves", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0 && errno != EEXIST)
|
||||
{
|
||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "Failed to create save dir.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
UnLock(savesPathLock);
|
||||
}
|
||||
|
||||
// for (i = 0 ; i < MAX_SAVE_SLOTS ; i++)
|
||||
// {
|
||||
// dir = buildFormattedString("saves/%d", i);
|
||||
|
||||
// mkpath(dir);
|
||||
|
||||
// free(dir);
|
||||
// }
|
||||
// app.saveDir = "saves";
|
||||
STRNCPY(app.saveDir, "saves", MAX_FILENAME_LENGTH);
|
||||
|
||||
// char *userHome;
|
||||
// char dir[MAX_FILENAME_LENGTH];
|
||||
|
||||
// userHome = getenv("HOME");
|
||||
|
||||
// if (!userHome)
|
||||
// {
|
||||
// SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "Unable to determine user save folder. Will save to current dir.");
|
||||
// return;
|
||||
// }
|
||||
|
||||
// SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "User home = %s", userHome);
|
||||
|
||||
// sprintf(dir, "%s/.local/share/tbftss", userHome);
|
||||
// if (mkdir(dir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0 && errno != EEXIST)
|
||||
// {
|
||||
// SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "Failed to create save dir '%s'. Will save to current dir.", dir);
|
||||
// return;
|
||||
// }
|
||||
|
||||
// STRNCPY(app.saveDir, dir, MAX_FILENAME_LENGTH);
|
||||
}
|
||||
|
||||
void createScreenshotFolder(void)
|
||||
{
|
||||
mkdir("PROGDIR:screenshots", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
||||
|
||||
dev.screenshotFolder = "screenshots";
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019,2022 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.
|
||||
|
||||
*/
|
||||
|
||||
void createScreenshotFolder(void);
|
||||
void createSaveFolder(void);
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <pwd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../../common.h"
|
||||
|
||||
#include "unixInit.h"
|
||||
|
||||
extern App app;
|
||||
extern Dev dev;
|
||||
|
||||
void createSaveFolder(void)
|
||||
{
|
||||
char *userHome;
|
||||
|
@ -36,7 +46,7 @@ void createSaveFolder(void)
|
|||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "User home = %s", userHome);
|
||||
|
||||
sprintf(dir, "%s/.local/share/tbftss", userHome);
|
||||
if (mkdir(dir, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH) != 0 && errno != EEXIST)
|
||||
if (mkdir(dir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0 && errno != EEXIST)
|
||||
{
|
||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "Failed to create save dir '%s'. Will save to current dir.", dir);
|
||||
return;
|
||||
|
@ -47,7 +57,7 @@ void createSaveFolder(void)
|
|||
|
||||
void createScreenshotFolder(void)
|
||||
{
|
||||
mkdir("/tmp/tbftss", S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
|
||||
mkdir("/tmp/tbftss", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
||||
|
||||
dev.screenshotFolder = "/tmp/tbftss";
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,12 +18,5 @@ 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 App app;
|
||||
extern Dev dev;
|
||||
void createScreenshotFolder(void);
|
||||
void createSaveFolder(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,8 +18,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../../common.h"
|
||||
|
||||
#include "win32Init.h"
|
||||
|
||||
extern App app;
|
||||
extern Dev dev;
|
||||
|
||||
void createSaveFolder(void)
|
||||
{
|
||||
char *userHome;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015-2019 Parallel Realities
|
||||
Copyright (C) 2015-2019,2022 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -18,11 +18,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "../../common.h"
|
||||
|
||||
extern App app;
|
||||
extern Dev dev;
|
||||
void createScreenshotFolder(void);
|
||||
void createSaveFolder(void);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue