[Scummvm-git-logs] scummvm master -> 7772850f300a41209c007c3d6bf577e0df50fc0d
sev-
sev at scummvm.org
Wed Nov 13 22:08:52 CET 2019
This automated email contains information about 168 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
541b2e473a GRIFFON: Added skeleton engine with detection
d1af98a842 GRIFFON: Added original code from GCW0 port by Dmitry Smagin
2f66646acd GRIFFON: Pass the original code via astyle
f73cd4e57a GRIFFON: Added proper copyright headers
c8769b3846 GRIFFON: Added namespaces and include guards
1a38a0e8ec JANITORIAL: Fix line endings
4cf00359c9 GRIFFON: Removed unneeded config file handling
dcab06be65 GRIFFON: Split single line if() statements
e848f22b71 GRIFFON: Using TransparentSurface
2320c515a9 GRIFFON: Formatted more oneliners
1e2d89b7cb GRIFFON: Further work on compilation fixes
7ef71a98c2 GRIFFON: Get rid of engine.h
848539905d GRIFFON: Ported keyboard input
56ffd0b3ca GRIFFON: Ported Rectangle code
561d7dbbbb GRIFFON: More compilation fixes. The code compiles now
d3de41aa5d GRIFFON: Fix some warnings
c890f95cf6 GRIFFON: More compilation fixes
5a74f56227 GRIFFON: First graphics output
17e1cb80c8 GRIFFON: Got main menu displayed
84f02e2f73 GRIFFON: Implement engine quitting
7ade9001c5 GRIFFON: Handle color key
c450854165 GRAPHICS: Added setAlpha() method to TransparentSurface
8259a8aa33 GRIFFON: Handle transparency
b45cadb065 GRAPHICS: Enhanced setAlpha method
8f399b95b3 GRIFFON: Properly process transparency together with keycolor
2364c6b457 GRIFFON: Simplify code
70f61cda0b GRIFFON: Fix collision detection
091789fb98 GRIFFON: Replaced some SDL calls
1b102b3aa8 GRIFFON: Replaced rest of the SDL calls
4531c5b110 GRIFFON: Removed rendering artifacts
bdff046e06 GRIFFON: Move save/load functions to saveload.cpp
62066b530f GRIFFON: Implement save/load
5c4016b482 GRIFFON: Implemented cheat mode via debug console
d82854b0c9 GRIFFON: Move all global variables to class
6bc45a55f5 GRIFFON: Renamed several class member vars
f07567c4b3 GRIFFON: Fix warnings
5f8b6851e0 GRIFFON: const'ness
20270594f7 GRIFFON: Fix some warning in MSVC9 by enforcing the use of float numbers.
8fb85f40dd GRIFFON: Avoid direct equality on floats, some janitorial work
a69ed08ec9 GRIFFON: Reduce the scope of variables, change some variables to boolean
b444a9ffc4 GRIFFON: Preload sound files, simplify sound API
022b6316dd GRIFFON: Unstubbed more sound functionality
c3eb075efe GRIFFON: Change some integer by booleans
b790f82374 GRIFFON: Preload sounds into memory
85e0ffff32 GRIFFON: Implement sound looping
e541ae9dc5 GRIFFON: Rename class variables
6ebcdaeed4 GRIFFON: Rename more class variables
bcbadaee94 GRIFFON: Variable renaming
f4ef04dc0a GRIFFON: Variable renaming
3796916033 GRIFFON: Variable renaming
5fc1d7a6d8 GRIFFON: Vraiable renames
c1accc049e GRIFFON: Variable renames
f00fd96e54 GRIFFON: Turned defines into enums
0873e6ef4e GRIFFON: Rename data types
1714d20a4f GRIFFON: Turn some more variables to boolean, rename some variables
abc99b86ea GRIFFON: Some more renaming and refactoring
712cb5858b GRIFFON: Use enum for game scripts
fbfc82acf5 GRIFFON: Fix regressions
afb67042c8 GRIFFON: Rename sound method
0648af2b88 GRIFFON: Remove useless code from game_configmenu, enable the part handlign Return key
daa06c0c7d GRIFFON: Remove menabled as it's unused (always true)
e313bc167d GRIFFON: Add a check after calls to file.open
204c7893c0 GRIFFON: Rename sound methods
297fd21e76 GRIFFON: Move sound-related method to separate file
128f852b27 GRIFFON: Some function renames
5bedf5e177 GRIFFON: Simplified main engine function
1795573d13 GRIFFON: More function renames
23bd7eddf3 GRIFFON: Move another method to sound.cpp
227ba89077 GRIFFON: Renamed remaining methods
83ef0f3b4d GRIFFON: Moved methods to combat.cpp
49e5040606 GRIFFON: Moved functions to cutscenes.cpp
0efb016e36 GRIFFON: Added dialogs.cpp
f1c9e91381 GRIFFON: Created draw.cpp
3660f483b5 GRIFFON: Added resources.cpp
8b62fa8947 GRIFFON: Added input.cpp
24edfa07ec GRIFFON: Added gfx.cpp
f7459b027c GRIFFON: Added monsters enum
040513ae5d GRIFFON: Added logic.cpp
775aa1a63b GRIFFON: Use CLIP where possible
ac362bafa7 GRIFFON: Fix bug introduced in original C conversion
b1bd677ad0 GRIFFON: Fix broken comparison
a27a54433c GRIFFON: Simplify some assignments, reduce some variable scopes
92e22e4153 GRIFFON: Remove some dead code
57af73cb18 GRIFFON: Various code simplifications and renaming
bfd5abdee3 GRIFFON: Rename _ticks1 to ticks1 as it's at function level
4f8753d839 GRIFFON: Change volume in option menu
7ce2045ae0 GRIFFON: Synchronize sound settings
51c1a11a46 GRIFFON: Remove unused macros in config
cb9603b624 GRIFFON: Fix define name in griffon.h
3af6c2132a GRIFFON: Remove some unused class members
1a1c663ddd GRIFFON: Some renaming
d87897a5c4 GRIFFON: make loopseta a local static, reduce size of sfx array, use constants for sfx loading
499e427c28 GRIFFON: Add a de fine for Pi, change some casts to int16
c8dd272de8 GRIFFON: Fix to for loop in drawNPCs
98e53ece57 GRIFFON: Fix uninitialized variables (game crash)
7a549f8520 GRIFFON: Fix another game crash due to an uninitialized variable
83e41cd04b GRIFFON: Some refactoring in dialogs
bf94210ad9 GRIFFON: simplify some code in draw by using clip
47e2733469 GRIFFON: Some refactoring
ddb4e2eb3e GRIFFON: Start refactoring Combat + rename constant due to typo
f69cce13e5 GRIFFON: Some more changes in Combat
d384cc83e7 GRIFFON: Refactor castSpell()
4a822bc21d GRIFFON: Change some types to boolean, some code simplifications
9142bea885 GRIFFON: start renaming members of Griffon engine class
b4b6f249f8 GRIFFON: More renaming
8438b9c9bb GRIFFON: Some more renaming
78d2dc32b2 GRIFFON: Introduce some new structures and refactoring, more renaming
3112d2e7d9 GRIFFON: Fix namespace comment
2eec117a5c GRIFFON: Get rid of config.h/cpp
473f253e49 GRIFFON: Fix compilation
0bc9ee6389 GRIFFON: Some refactoring in saveLoadNew(), som renaming
138d364e24 GRIFFON: Fix a bug introduced in the original C conversion
008fbcab5b GRIFFON: Introduce ObjectInfoStruct, some refactoring
972a1474af GRIFFON: Remove recursiveness of the main menu
7b2e103ea3 GRIFFON: FIx config window drawing
651e7ef9f0 GRIFFON: Fixed sluggishness of the main menu and config menu
98216d9738 GRIFFON: Fixed rendering of config menu
623686382d GRIFFON: Fixed config menu fade-in
ce0f0f62e9 GRIFFON: Optimized transparent blitting
16386016ef GRIFFON: More alpha blitting optimizations
4d97f9c654 GRIFFON: Optimized even handling in cutscenes
f6da621008 GRIFFON: Removed recursiveness on end game
7b05a02a97 GRIFFON: Fixed music stopping
6409c3804e GRIFFON: Implement quitting from the endgame
dfadc426b7 GRIFFON: Made theEnd() work properly
dadd6e4cf0 GRIFFON: Fixed endgame fadeouts
04cc6a1518 GRIFFON: Fix TheEnd screen fadeout
fc1e3f62be GRIFFON: Load savestate info only once
57922cde67 GRIFFON: Fix saveload menu fadein
0a21e646fd GRIFFON: Fix newgame menu sluggishnes and simplify code
29b3a58f04 GRIFFON: Resolve todo
7d594e0fb6 GRIFFON: Refactored config menu to switch statements
d4bdfa1853 GRIFFON: Remove obsolete FIXMEs
e52d6c96f0 JANITORIAL: Indentation fixes
84e6e1b8c5 GRIFFON: Fix sluggishness in the inventory menu
85918451d1 GRIFFON: Fix warning
fe78429fc7 GRIFFON: Mark engine as 16bit
b85b7fec08 GRIFFON: Added copyright reference
24c52e32ae GRIFFON: Initialize variable
8ad0a0fd6a GRIFFON: Use smaller data type for static array
356e4014a7 GRIFFON: Implemented Player::reset()
4f98377ee0 GRIFFON: cleanup
d45e036221 GRIFFON: Simplified quit event handling
417678ce41 GRIFFON: Fixes for engineId changes
a4ffe2cf55 GRIFFON: Reduce the scope of two variables
6e7260c3f8 GRIFFON: Fix regressions in newsaveload function
7384a8c35e GRIFFON: Initialize variables
417ce00577 GRIFFON: Fix engine id
d89e3f8176 GRIFFON: Fix misleading comments
1b2e826e71 GRIFFON: Fix unitialize variable breaking the save screen
3e1431d4ea GRIFFON: Fix save screen
87d46434e3 GRIFFON: Some renaming
a28bf11ca6 GRIFFON: Initial code for game modes
f1eabe26f5 GRIFFON: More work on game states
97451785c4 GRIFFON: Fix GCC Compiler Warnings
6827277eb0 GRIFFON: Render savestates after save
6116ed3a25 GRIFFON: Added 'nodamage' console command
477e12c1e1 GRIFFON: More work on game modes
93be6abf58 GRIFFON: Fix the menu logic. Finally!
8f492cf877 GRIFFON: Hide 'save' item from menu when there is nothing to save
1911d459df GRIFFON: Fix color fill for hidden 'save', and skip it in the navigation
4fbf91e829 ENGINES: Extend MetaEngine class with ExtendedSaves support
50f964770c GRIFFON: Added support for extended saves
06909eb320 GRIFFON: Implemented loading from launcher
3457f67e9a GRIFFON: Fix loading from launcher
cc9d8b030a GRIFFON: Fix random loading time
3d6e22ec37 GRIFFON: Fix loading from GMM
7772850f30 GRIFFON: Fix GMM loading from options and title
Commit: 541b2e473a28eee8b591065529a4b37616317d0c
https://github.com/scummvm/scummvm/commit/541b2e473a28eee8b591065529a4b37616317d0c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Added skeleton engine with detection
Changed paths:
A engines/griffon/configure.engine
A engines/griffon/detection.cpp
A engines/griffon/griffon.cpp
A engines/griffon/griffon.h
A engines/griffon/module.mk
diff --git a/engines/griffon/configure.engine b/engines/griffon/configure.engine
new file mode 100644
index 0000000..fedaef3
--- /dev/null
+++ b/engines/griffon/configure.engine
@@ -0,0 +1,3 @@
+# This file is included from the main "configure" script
+# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
+add_engine griffon "The Griffon Legend" no
diff --git a/engines/griffon/detection.cpp b/engines/griffon/detection.cpp
new file mode 100644
index 0000000..099c855
--- /dev/null
+++ b/engines/griffon/detection.cpp
@@ -0,0 +1,79 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "base/plugins.h"
+#include "engines/advancedDetector.h"
+
+#include "griffon/griffon.h"
+
+static const PlainGameDescriptor griffonGames[] = {
+ {"griffon", "The Griffon Legend"},
+ {NULL, NULL}
+};
+
+namespace Griffon {
+static const ADGameDescription gameDescriptions[] = {
+ {
+ "griffon",
+ NULL,
+ AD_ENTRY1s("objectdb.dat", "ec5371da28f01ccf88980b32d9de2232", 27754),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NONE)
+ },
+
+ AD_TABLE_END_MARKER
+};
+}
+
+class GriffonMetaEngine: public AdvancedMetaEngine {
+public:
+ GriffonMetaEngine() : AdvancedMetaEngine(Griffon::gameDescriptions, sizeof(ADGameDescription), griffonGames) {
+ _singleId = "griffon";
+ }
+
+ virtual const char *getName() const {
+ return "Griffon Engine";
+ }
+
+ virtual const char *getOriginalCopyright() const {
+ return "The Griffon Legend (c) 2005 Syn9 (Daniel Kennedy)";
+ }
+
+ virtual bool hasFeature(MetaEngineFeature f) const;
+ virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
+};
+
+bool GriffonMetaEngine::hasFeature(MetaEngineFeature f) const {
+ return false;
+}
+
+bool GriffonMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
+ return false;
+}
+
+#if PLUGIN_ENABLED_DYNAMIC(GRIFFON)
+REGISTER_PLUGIN_DYNAMIC(GRIFFON, PLUGIN_TYPE_ENGINE, GriffonMetaEngine);
+#else
+REGISTER_PLUGIN_STATIC(GRIFFON, PLUGIN_TYPE_ENGINE, GriffonMetaEngine);
+#endif
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
new file mode 100644
index 0000000..f787ac8
--- /dev/null
+++ b/engines/griffon/griffon.cpp
@@ -0,0 +1,53 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/config-manager.h"
+#include "common/debug.h"
+#include "common/debug-channels.h"
+#include "common/error.h"
+#include "common/file.h"
+#include "common/fs.h"
+
+#include "engines/util.h"
+
+#include "griffon/griffon.h"
+
+namespace Griffon {
+
+GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
+ const Common::FSNode gameDataDir(ConfMan.get("path"));
+ SearchMan.addSubDirectoryMatching(gameDataDir, "sound");
+
+ _rnd = new Common::RandomSource("griffon");
+}
+
+GriffonEngine::~GriffonEngine() {
+ delete _rnd;
+}
+
+Common::Error GriffonEngine::run() {
+ initGraphics(320, 200);
+
+ return Common::kNoError;
+}
+
+}
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
new file mode 100644
index 0000000..dc250fd
--- /dev/null
+++ b/engines/griffon/griffon.h
@@ -0,0 +1,45 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef GRIFFON_H
+#define GRIFFON_H
+
+#include "common/scummsys.h"
+#include "common/random.h"
+#include "engines/engine.h"
+
+namespace Griffon {
+
+class GriffonEngine : public Engine {
+public:
+ GriffonEngine(OSystem *syst);
+ ~GriffonEngine();
+
+ virtual Common::Error run();
+
+private:
+ Common::RandomSource *_rnd;
+};
+
+}
+
+#endif
diff --git a/engines/griffon/module.mk b/engines/griffon/module.mk
new file mode 100644
index 0000000..5b24baf
--- /dev/null
+++ b/engines/griffon/module.mk
@@ -0,0 +1,16 @@
+MODULE := engines/griffon
+
+MODULE_OBJS := \
+ griffon.o \
+ detection.o
+
+MODULE_DIRS += \
+ engines/griffon
+
+# This module can be built as a plugin
+ifeq ($(ENABLE_GRIFFON), DYNAMIC_PLUGIN)
+PLUGIN := 1
+endif
+
+# Include common rules
+include $(srcdir)/rules.mk
Commit: d1af98a842f0a237a1afd184e79ae237318bb34e
https://github.com/scummvm/scummvm/commit/d1af98a842f0a237a1afd184e79ae237318bb34e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Added original code from GCW0 port by Dmitry Smagin
Changed paths:
A engines/griffon/config.cpp
A engines/griffon/config.h
A engines/griffon/engine.cpp
A engines/griffon/engine.h
A engines/griffon/state.cpp
A engines/griffon/state.h
diff --git a/engines/griffon/config.cpp b/engines/griffon/config.cpp
new file mode 100644
index 0000000..3cfc791
--- /dev/null
+++ b/engines/griffon/config.cpp
@@ -0,0 +1,123 @@
+/*
+ * 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 <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include <sys/stat.h>
+
+#include <SDL/SDL.h>
+
+#include "config.h"
+
+ CONFIG config = {
+ 320, 240, 16, 0, 0, 0, 1, 127, 1, 127
+};
+
+char config_ini[64] = "config.ini";
+
+#define PRINT(A,B) \
+do { \
+ char line[256]; \
+ sprintf(line, A "\n", B); \
+ fputs(line, fp); \
+} while(0)
+
+#define INPUT(A, B) \
+do { \
+ char line[256]; \
+ fgets(line, sizeof(line), fp); \
+ sscanf(line, A, B); \
+} while(0)
+
+void config_load(CONFIG *config)
+{
+ char line[128];
+ char arg[128];
+ FILE *fp;
+
+ fp = fopen(config_ini, "r");
+ if(fp) {
+ while(fgets(line, sizeof(line), fp) != NULL) {
+ sscanf(line, "%s", arg); // eliminate eol and eof by this
+
+ if(strcmp(arg, "SCR_WIDTH:") == 0) {
+ fgets(line, sizeof(line), fp);
+ sscanf(line, "%i", &config->scr_width);
+ } else if(strcmp(arg, "SCR_HEIGHT:") == 0) {
+ fgets(line, sizeof(line), fp);
+ sscanf(line, "%i", &config->scr_height);
+ } else if(strcmp(arg, "SCR_BITS:") == 0) {
+ fgets(line, sizeof(line), fp);
+ sscanf(line, "%i", &config->scr_bpp);
+ } else if(strcmp(arg, "HWACCEL:YES") == 0) {
+ config->hwaccel = SDL_HWACCEL;
+ } else if(strcmp(arg, "HWACCEL:NO") == 0) {
+ config->hwaccel = 0;
+ } else if(strcmp(arg, "HWSURFACE:YES") == 0) {
+ config->hwsurface = SDL_HWSURFACE;
+ } else if(strcmp(arg, "HWSURFACE:NO") == 0) {
+ config->hwsurface = 0;
+ } else if(strcmp(arg, "FULLSCREEN:YES") == 0) {
+ config->fullscreen = SDL_FULLSCREEN;
+ } else if(strcmp(arg, "FULLSCREEN:NO") == 0) {
+ config->fullscreen = 0;
+ } else if(strcmp(arg, "MUSIC:YES") == 0) {
+ config->music = 1;
+ } else if(strcmp(arg, "MUSIC:NO") == 0) {
+ config->music = 0;
+ } else if(strcmp(arg, "SNDEFFECTS:YES") == 0) {
+ config->effects = 1;
+ } else if(strcmp(arg, "SNDEFFECTS:NO") == 0) {
+ config->effects = 0;
+ } else if(strcmp(arg, "opmusicvol:") == 0) {
+ fgets(line, sizeof(line), fp);
+ sscanf(line, "%i", &config->musicvol);
+ } else if(strcmp(arg, "opeffectsvol:") == 0) {
+ fgets(line, sizeof(line), fp);
+ sscanf(line, "%i", &config->effectsvol);
+ }
+ }
+
+ fclose(fp);
+ }
+}
+
+void config_save(CONFIG *config)
+{
+ FILE *fp = fopen(config_ini, "w");
+
+ if(fp) {
+ PRINT("%s", "SCR_WIDTH:");
+ PRINT("%i", config->scr_width);
+ PRINT("%s", "SCR_HEIGHT:");
+ PRINT("%i", config->scr_height);
+ PRINT("%s", "SCR_BITS:");
+ PRINT("%i", config->scr_bpp);
+ PRINT("%s", config->hwaccel ? "HWACCEL:YES" : "HWACCEL:NO");
+ PRINT("%s", config->hwsurface ? "HWSURFACE:YES" : "HWSURFACE:NO");
+ PRINT("%s", config->fullscreen ? "FULLSCREEN:YES" : "FULLSCREEN:NO");
+ PRINT("%s", config->music ? "MUSIC:YES" : "MUSIC:NO");
+ PRINT("%s", config->effects ? "SNDEFFECTS:YES" : "SNDEFFECTS:NO");
+ PRINT("%s", "opmusicvol:");
+ PRINT("%i", config->musicvol);
+ PRINT("%s", "opeffectsvol:");
+ PRINT("%i", config->effectsvol);
+ fclose(fp);
+ }
+}
\ No newline at end of file
diff --git a/engines/griffon/config.h b/engines/griffon/config.h
new file mode 100644
index 0000000..f0af9b9
--- /dev/null
+++ b/engines/griffon/config.h
@@ -0,0 +1,40 @@
+/*
+ * 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
+ *
+ */
+
+#ifndef _CONFIG_H_
+#define _CONFIG_H_
+
+typedef struct {
+ int scr_width;
+ int scr_height;
+ int scr_bpp;
+ int fullscreen;
+ int hwaccel;
+ int hwsurface;
+ int music;
+ int musicvol;
+ int effects;
+ int effectsvol;
+} CONFIG;
+
+extern CONFIG config;
+extern char config_ini[];
+
+void config_load(CONFIG *config);
+void config_save(CONFIG *config);
+
+#endif // _CONFIG_H_
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
new file mode 100644
index 0000000..6ced367
--- /dev/null
+++ b/engines/griffon/engine.cpp
@@ -0,0 +1,8234 @@
+/*
+ * 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 <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include <sys/stat.h>
+
+#include <SDL/SDL.h>
+#include <SDL/SDL_image.h>
+#include <SDL/SDL_mixer.h>
+#include <SDL/SDL_rotozoom.h>
+
+#include "griffon.h"
+#include "config.h"
+#include "state.h"
+
+// memo
+/*
+ in game scripts
+ 2 - find master key
+ 3 - find crystal
+ 4 - find shield - obj 8
+ 5 - find sword - obj 9
+ 6 - regular key chest
+ 7 - blue flask
+ 8 - garden's master key
+ 9 - lightning bomb
+ 10 - blue flask chest
+ 11 - lightning chest
+ 12 - armour chest
+ 13 - citadel master key
+ 14 - end of game
+ 15 - get sword3
+ 16 - shield3
+ 17 - armour3
+ 20 key chest 1
+ 60-lever
+
+ monsters
+ 1 - baby dragon
+ 2 - one wing
+ 3 - boss 1
+ 4 - black knight
+ 5 - fire hydra
+ 6 - red dragon
+ 7 - priest
+ 8 - yellow fire dragon
+ 9 - two wing
+10 - dragon2
+11 - final boss
+12 - bat kitty
+
+ chests
+ 0 - regular flask
+ 11 - key chest
+ 14 - blue flask chest
+ 15 - lightning chest
+ 16 - armour chest
+ 17 - citadel master key
+ 18 - sword3
+ 19 - shield3
+ 20 - armour3
+
+*/
+
+// system
+SDL_Surface *video, *videobuffer, *videobuffer2, *videobuffer3;
+SDL_Surface *titleimg, *titleimg2, *inventoryimg;
+SDL_Surface *logosimg, *theendimg;
+SDL_Event event;
+
+SDL_Surface *mapbg, *clipbg, *clipbg2;
+unsigned int clipsurround[4][4];
+int fullscreen;
+
+Uint8 *keys;
+float animspd;
+int rampdata[40][24];
+
+int curmap;
+SDL_Surface *fontchr[224][5]; // 256 - 32
+SDL_Surface *itemimg[21], *windowimg;
+SDL_Surface *spellimg;
+
+int itemselon, curitem, itemticks;
+float itemyloc;
+int selenemyon, curenemy, forcepause;
+int roomlock; // set to disable any room jumps while in the room
+int scriptflag[100][10], saveslot; // script, flag
+
+// timer related - move to local later
+int ticks, tickspassed, nextticks;
+float fp, fps, fpsr;
+int secsingame, secstart;
+
+extern char *story[48];
+SDL_Surface *mapimg[4];
+extern int invmap[4][7][13];
+extern char *story2[27];
+
+SDL_Rect rcSrc, rcDest;
+
+// -----------special case
+int dontdrawover; // used in map24 so that the candles dont draw over the boss, default set to 0
+
+// saveload info
+SDL_Surface *saveloadimg;
+
+
+// post info
+float postinfo[21][3];
+int nposts;
+
+// cloud info
+SDL_Surface *cloudimg;
+float clouddeg = 0;
+int cloudson;
+
+// spell info
+SPELLTYPE spellinfo[MAXSPELL];
+
+// player info
+int movingup, movingdown, movingleft, movingright;
+PLAYERTYPE player;
+int attacking;
+PLAYERTYPE playera;
+int asecstart;
+
+// tile info
+SDL_Surface *tiles[4];
+int tileinfo[3][40][24][3]; // maplayer, x, y, tiledata (tile, tilelayer)
+
+extern int elementmap[15][20];
+
+
+// animation info
+SDL_Surface *anims[100];
+ // id number 0&1 = players
+SDL_Surface *animsa[100];
+ // attack anims
+float playerattackofs[4][16][3];
+ // [dir] [frame] [x,y ofs, completed(0/1)]
+
+float floattext[MAXFLOAT][4]; // [id] [framesleft, x, y, col]
+char *floatstri[MAXFLOAT];
+float floaticon[MAXFLOAT][4]; // [id] [framesleft, x, y, ico]
+
+// special for animset2
+ANIMSET2TYPE animset2[7], animset9[7];
+
+// object info
+float objectframe[256][2];
+int lastobj;
+ // frame!, curframe
+int objectinfo[33][6];
+ // nframes,xtiles,ytiles,speed,type,script, update?
+int objecttile[33][9][3][3][2];
+ // [objnum] [frame] [x] [y] [tile/layer]
+int objmap[21][15];
+
+int objmapf[1000][21][15];
+ // [mapnum] x, y set to 1 to make this objmap spot stay at -1
+
+// trigger info
+int triggers[10000][9];
+ // [map#][index], [var]
+ // map#,x,y
+int triggerloc[320][240], ntriggers;
+
+// npc info
+NPCTYPE npcinfo[MAXNPC];
+int lastnpc;
+
+// music info
+Mix_Chunk *mgardens, *mgardens2, *mgardens3, *mgardens4, *mboss, *mmenu, *mendofgame;
+int menabled=1, musicchannel = -1, menuchannel = -1;
+int pgardens, pboss, ptown, pacademy, pcitadel;
+int loopseta = 0;
+
+Mix_Chunk *sfx[21];
+
+// room locks
+int roomlocks[201], saidlocked, canusekey, locktype, roomtounlock, saidjammed;
+// set to 1 for normal key, set to 2 for master, set to 0 if unlocked
+
+// ysort
+int ysort[2401], lasty, firsty;
+
+int pmenu;
+
+#undef main
+int main()
+{
+ sys_initialize();
+ game_showlogos();
+ game_main();
+
+ return 0;
+}
+
+// element tile locations
+int elementmap[15][20] = {
+ { 2, 2, 2, 2,-1,-1,-1, 2, 2, 2, 2, 2, 2,-1,-1,-1,-1,-1,-1,-1 },
+ { 2,-1,-1,-1,-1,-1,-1, 2, 2, 2, 2, 2, 2,-1,-1,-1,-1,-1,-1,-1 },
+ { 2,-1, 2, 2,-1,-1,-1, 2, 2, 2, 2, 2, 2,-1,-1,-1,-1,-1,-1,-1 },
+ { 2,-1, 2,-1, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 },
+ { 2, 2, 2, 2, 2,-1,-1,-1, 2,-1,-1, 2,-1,-1,-1,-1,-1,-1,-1,-1 },
+ { -1,-1,-1,-1, 2,-1, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 },
+ { -1,-1,-1,-1,-1, 0, 0, 2, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 },
+ { -1,-1,-1,-1,-1, 2, 2, 2, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 },
+ { -1,-1,-1,-1,-1, 2, 2, 2, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 },
+ { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 },
+ { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 },
+ { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 },
+ { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 },
+ { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 },
+ { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }
+};
+
+char *story[48] = {
+ "The Griffon Legend",
+ "http://syn9.thehideoutgames.com/",
+ "",
+ "Programming/Graphics: Daniel Kennedy",
+ "Music/Sound effects: David Turner",
+ "",
+ "Porting to GCW-Zero: Dmitry Smagin",
+ "",
+ "",
+ "Story",
+ "Ever since I was a child",
+ "I remember being told the",
+ "Legend of the Griffon Knights,",
+ "who rid the world of the",
+ "Dragon Empire. These great",
+ "heroes inspired us to become",
+ "knights as well.",
+ " ",
+ "Now, 500 years after the war",
+ "ended, the Dragons have",
+ "returned. Cities are falling",
+ "from the lack of knights to",
+ "protect them.",
+ " ",
+ "We never saw it coming.",
+ " ",
+ "And now, here I am, making",
+ "my way into the lower town",
+ "of Fidelis, a small city on",
+ "the main continent. The rest",
+ "of my men have died over",
+ "the last couple days from",
+ "aerial attacks.",
+ " ",
+ "We believed we could find",
+ "shelter here, only to find",
+ "every last griffon dead,",
+ "the town burned to the ground,",
+ "and transformed into a garrison",
+ "for the Dragon forces.",
+ " ",
+ "In these dark times, I try to",
+ "draw strength from the stories",
+ "of those knights that risked",
+ "everything to protect their homeland,",
+ " ",
+ "and hope that I can die",
+ "with that honor as well."
+};
+
+char *story2[27] = {
+ "After the fall of Margrave Gradius,",
+ "All the dragons, struck with panic,",
+ "evacuated the city immediately.",
+ " ",
+ "It\'s funny how without a leader",
+ "everyone is so weak.",
+ " ",
+ " ",
+ "But yet another leader will rise,",
+ "and another city will fall.",
+ " ",
+ " ",
+ "I should return home to Asherton",
+ "It\'s time to leave this place",
+ "and cleanse this blood stained",
+ "life of mine.",
+ " ",
+ "No one should have to see as much",
+ "death as I have.",
+ " ",
+ " ",
+ "Before, I said that I wanted",
+ "to die an honorable death.",
+ " ",
+ "Now I say that I have lived an",
+ "honorable life,",
+ "and I am free to die as I please."
+};
+
+// map in inventory menu
+int invmap[4][7][13] = {
+ // map 0
+ {
+ {0,0,0,0,0,0,0,0,0,0,0,0,0},
+ {0,0,0,0,0,0,0,0,0,0,0,0,0},
+ {0,0,0,0,0,43,44,45,46,0,0,0,0},
+ {0,0,0,0,0,42,0,0,0,0,0,0,0},
+ {0,0,0,0,3,2,0,0,0,0,0,0,0},
+ {0,0,0,0,4,5,0,0,0,0,0,0,0},
+ {0,0,0,0,0,0,0,0,0,0,0,0,0}
+ },
+ // map 1
+ {
+ {0,0,0,0,0,0,0,0,0,0,0,0,0},
+ {0,0,0,24,0,0,0,0,0,0,0,0,0},
+ {0,0,19,20,21,22,0,0,0,27,0,0,0},
+ {0,0,16,17,18,0,0,0,29,30,31,0,0},
+ {0,0,12,0,13,14,0,32,33,34,35,36,0},
+ {0,8,7,6,9,10,0,37,38,39,40,41,0},
+ {0,0,0,0,0,0,0,0,0,0,0,0,0}
+ },
+ // map 2
+ {
+ {0,0,0,0,0,0,67,0,0,0,0,0,0},
+ {0,0,0,0,0,0,66,0,0,0,0,0,0},
+ {0,0,0,0,0,63,64,65,0,0,0,0,0},
+ {0,0,0,0,58,59,60,61,62,0,0,0,0},
+ {0,0,0,0,0,55,56,57,0,0,0,0,0},
+ {0,0,0,0,50,51,52,53,54,0,0,0,0},
+ {0,0,0,0,0,48,47,49,0,0,0,0,0}
+ },
+
+ // map 3
+ {
+ {0,0,0,0,0,0,0,0,0,0,0,0,0},
+ {0,0,0,82,0,0,0,0,0,0,0,0,0},
+ {0,0,0,79,80,81,0,74,72,0,0,0,0},
+ {0,0,0,78,0,0,0,73,70,69,68,0,0},
+ {0,0,77,76,75,0,0,0,71,0,0,0,0},
+ {0,0,0,0,0,0,0,0,0,0,0,0,0},
+ {0,0,0,0,0,0,0,0,0,0,0,0,0}
+ }
+};
+
+// HELPER MACRO ---------------------------------------------------------------
+#define PRINT(A,B) \
+do { \
+ char line[256]; \
+ sprintf(line, A "\n", B); \
+ fputs(line, fp); \
+} while(0)
+
+#define INPUT(A, B) \
+do { \
+ char line[256]; \
+ fgets(line, sizeof(line), fp); \
+ sscanf(line, A, B); \
+} while(0)
+
+// CODE GOES HERE -------------------------------------------------------------
+
+#ifdef OPENDINGUX
+ #define SDL_BLITVIDEO(X, Y, C, F) SDL_BlitSurface((X), (Y), (C), (F))
+#else
+ #define SDL_BLITVIDEO(X, Y, C, F) sdl_blitscale((X), (Y), (C), NULL)
+#endif
+
+void sdl_blitscale(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect)
+{
+ if(src->w != dst->w) {
+ SDL_Surface *scale2x = NULL;
+
+ scale2x = zoomSurface(src, 2, 2, 0);
+ SDL_BlitSurface(scale2x, NULL, dst, NULL);
+ SDL_FreeSurface(scale2x);
+ } else {
+ SDL_BlitSurface(src, NULL, dst, NULL);
+ }
+
+}
+
+void game_fillrect(SDL_Surface *surface, int x, int y, int w, int h, int color)
+{
+ SDL_Rect src;
+
+ src.x = x;
+ src.y = y;
+ src.w = w;
+ src.h = h;
+
+ SDL_FillRect(surface, &src, color);
+}
+
+// copypaste from hRnd_CRT()
+static float RND()
+{
+ /* return between 0 and 1 (but never 1) */
+ return (float)rand() * (1.0 / ((float)RAND_MAX + 1.0));
+}
+
+void game_addFloatIcon(int ico, float xloc, float yloc)
+{
+ for(int i = 0; i < MAXFLOAT; i++) {
+ if(floaticon[i][0] == 0) {
+ floaticon[i][0] = 32;
+ floaticon[i][1] = xloc;
+ floaticon[i][2] = yloc;
+ floaticon[i][3] = ico;
+ return;
+ }
+ }
+}
+
+void game_addFloatText(char *stri, float xloc, float yloc, int col)
+{
+ for(int i = 0; i < MAXFLOAT; i++) {
+ if(floattext[i][0] == 0) {
+ floattext[i][0] = 32;
+ floattext[i][1] = xloc;
+ floattext[i][2] = yloc;
+ floattext[i][3] = col;
+ strcpy(floatstri[i], stri);
+ return;
+ }
+ }
+}
+
+void game_attack()
+{
+ float npx, npy;
+
+ npx = player.px + 12;
+ npy = player.py + 20;
+
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
+
+ // if facing up
+ if(player.walkdir == 0) {
+ if(ly > 0) {
+ int o2 = 0; // ??
+ int o = objmap[lx][ly - 1];
+ if(ly > 1 && curmap == 58) o2 = objmap[lx][ly - 2];
+ if(ly > 1 && curmap == 54) o2 = objmap[lx][ly - 2];
+
+ // cst
+ if((objectinfo[o][4] == 1 && (o == 0 || o > 4)) || (objectinfo[o2][4] == 0 && o2 == 10)) {
+ if(o2 == 10) o = 10;
+
+ int oscript = objectinfo[o][5];
+ if(oscript == 0 && player.inventory[INV_FLASK] < 9) {
+ player.inventory[INV_FLASK]++;
+ game_addFloatIcon(6, lx * 16, (ly - 1) * 16);
+
+ objmapf[curmap][lx][ly - 1] = 1;
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+
+ game_eventtext("Found Flask!");
+ itemticks = ticks + 215;
+ return;
+ }
+
+ if(oscript == 0 && player.inventory[INV_FLASK] == 9) {
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndchest], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ game_eventtext("Cannot Carry any more Flasks!");
+ itemticks = ticks + 215;
+ return;
+ }
+
+ if(oscript == 2) {
+ player.inventory[INV_MASTERKEY]++;
+
+ game_addFloatIcon(14, lx * 16, (ly - 1) * 16);
+
+ itemticks = ticks + 215;
+
+ if(curmap == 34) scriptflag[2][0] = 2;
+ if(curmap == 62) scriptflag[8][0] = 2;
+ if(curmap == 81) scriptflag[13][0] = 2;
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ game_eventtext("Found the Temple Key!");
+ return;
+ }
+
+ if(oscript == 3) {
+ player.foundspell[0] = 1;
+ player.spellcharge[0] = 0;
+
+ game_addFloatIcon(7, lx * 16, (ly - 1) * 16);
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+
+ game_eventtext("Found the Infinite Crystal!");
+ itemticks = ticks + 215;
+ return;
+ }
+
+ if(oscript == 4 && player.shield == 1) {
+ player.shield = 2;
+
+ game_addFloatIcon(4, lx * 16, (ly - 1) * 16);
+
+ itemticks = ticks + 215;
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+
+ game_eventtext("Found the Obsidian Shield!");
+ objmapf[4][1][2] = 1;
+ return;
+ }
+
+ if(oscript == 5 && player.sword == 1) {
+ player.sword = 2;
+
+ game_addFloatIcon(3, lx * 16, (ly - 1) * 16);
+
+ itemticks = ticks + 215;
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ game_eventtext("Found the Fidelis Sword!");
+ return;
+ }
+
+ if(oscript == 6) {
+ if(player.inventory[INV_NORMALKEY] < 9) {
+ player.inventory[INV_NORMALKEY]++;
+
+ for(int s = 20; s <= 23; s++) {
+ if(scriptflag[s][0] == 1) {
+ scriptflag[s][0] = 2;
+ }
+ }
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ objmapf[curmap][lx][ly - 1] = 1;
+
+ if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+
+ game_eventtext("Found Key");
+ game_addFloatIcon(16, lx * 16, (ly - 1) * 16);
+ } else {
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndchest], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ game_eventtext("Cannot Carry Any More Keys");
+ }
+ }
+
+ if(oscript == 7 && player.inventory[INV_DOUBLEFLASK] < 9) {
+ player.inventory[INV_DOUBLEFLASK]++;
+ game_addFloatIcon(12, lx * 16, (ly - 1) * 16);
+
+ objmapf[curmap][lx][ly - 1] = 1;
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+
+ game_eventtext("Found Mega Flask!");
+ itemticks = ticks + 215;
+ return;
+ }
+
+ if(oscript == 7 && player.inventory[INV_DOUBLEFLASK] == 9) {
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndchest], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ game_eventtext("Cannot Carry any more Mega Flasks!");
+ itemticks = ticks + 215;
+ return;
+ }
+
+ if(oscript == 10 && player.inventory[INV_DOUBLEFLASK] < 9) {
+ player.inventory[INV_DOUBLEFLASK]++;
+ game_addFloatIcon(12, lx * 16, (ly - 1) * 16);
+
+ objmapf[curmap][lx][ly - 1] = 1;
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+
+ game_eventtext("Found Mega Flask!");
+ itemticks = ticks + 215;
+ return;
+ }
+
+ if(oscript == 10 && player.inventory[INV_DOUBLEFLASK] == 9) {
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndchest], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ game_eventtext("Cannot Carry any more Mega Flasks!");
+ itemticks = ticks + 215;
+ return;
+ }
+
+ if(oscript == 11 && player.inventory[INV_SHOCK] < 9) {
+ player.inventory[INV_SHOCK]++;
+ game_addFloatIcon(17, lx * 16, (ly - 1) * 16);
+
+ objmapf[curmap][lx][ly - 1] = 1;
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+
+ game_eventtext("Found Lightning Bomb!");
+ itemticks = ticks + 215;
+ return;
+ }
+
+ if(oscript == 11 && player.inventory[INV_SHOCK] == 9) {
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndchest], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ game_eventtext("Cannot Carry any more Lightning Bombs!");
+ itemticks = ticks + 215;
+ return;
+ }
+
+ if(oscript == 12 && player.armour == 1) {
+ player.armour = 2;
+
+ game_addFloatIcon(5, lx * 16, (ly - 1) * 16);
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+
+ game_eventtext("Found the Fidelis Mail!");
+ itemticks = ticks + 215;
+ return;
+ }
+
+ if(oscript == 60) {
+ if(curmap == 58 && scriptflag[60][0] == 0) {
+ scriptflag[60][0] = 1;
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndlever], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ } else if(curmap == 58 && scriptflag[60][0] > 0) {
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[snddoor], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ game_eventtext("It's stuck!");
+ }
+
+ if(curmap == 54 && scriptflag[60][0] == 1) {
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndlever], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ scriptflag[60][0] = 2;
+ } else if(curmap == 54 && scriptflag[60][0] > 1) {
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[snddoor], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ game_eventtext("It's stuck!");
+ }
+
+ }
+
+ if(oscript == 15 && player.sword < 3) {
+ player.sword = 3;
+
+ game_addFloatIcon(18, lx * 16, (ly - 1) * 16);
+
+ itemticks = ticks + 215;
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ game_eventtext("Found the Blood Sword!");
+ objmapf[4][1][2] = 1;
+ return;
+ }
+
+ if(oscript == 16 && player.shield < 3) {
+ player.shield = 3;
+ game_addFloatIcon(19, lx * 16, (ly - 1) * 16);
+ itemticks = ticks + 215;
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ game_eventtext("Found the Entropy Shield!");
+ objmapf[4][1][2] = 1;
+ return;
+ }
+
+ if(oscript == 17 && player.armour < 3) {
+ player.armour = 3;
+ game_addFloatIcon(20, lx * 16, (ly - 1) * 16);
+ itemticks = ticks + 215;
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ game_eventtext("Found the Rubyscale Armour!");
+ objmapf[4][1][2] = 1;
+ return;
+ }
+
+ }
+ }
+ }
+
+ attacking = 1;
+ player.attackframe = 0;
+ movingup = 0;
+ movingdown = 0;
+ movingleft = 0;
+ movingright = 0;
+
+ for(int i = 0; i <= 15; i++) {
+ for(int a = 0; a <= 3; a++) {
+ playerattackofs[a][i][2] = 0;
+ }
+ }
+}
+
+void game_castspell(int spellnum, float homex, float homey, float enemyx, float enemyy, int damagewho)
+{
+ // spellnum 7 = sprite 6 spitfire
+
+ for(int i = 0; i < MAXSPELL; i++) {
+ if(spellinfo[i].frame == 0) {
+ spellinfo[i].homex = homex;
+ spellinfo[i].homey = homey;
+ spellinfo[i].enemyx = enemyx;
+ spellinfo[i].enemyy = enemyy;
+ spellinfo[i].spellnum = spellnum;
+ int dw = 0;
+ int npc = 0;
+ if(damagewho > 0) {
+ dw = 1;
+ npc = damagewho;
+ }
+
+ spellinfo[i].damagewho = dw;
+ spellinfo[i].npc = npc;
+
+ spellinfo[i].frame = 32;
+ if(damagewho == 0) {
+ spellinfo[i].strength = player.spellstrength / 100;
+ if(player.spellstrength == 100) spellinfo[i].strength = 1.5;
+ }
+
+ // set earthslide vars
+ if(spellnum == 2) {
+ for(int f = 0; f <= 8; f++) {
+ spellinfo[i].rocky[f] = 0;
+ spellinfo[i].rockimg[f] = (int)(RND() * 4);
+ spellinfo[i].rockdeflect[f] = ((int)(RND() * 128) - 64) * 1.5;
+ }
+ }
+
+ // set fire vars
+ if(spellnum == 3) {
+ for(int f = 0; f <= 4; f++) {
+ spellinfo[i].legalive[f] = 32;
+ }
+ }
+
+
+ // room fireball vars
+ if(spellnum == 6) {
+ int nballs = 0;
+ for(int x = 0; x <= 19; x++) {
+ for(int y = 0; y <= 14; y++) {
+ if((objmap[x][y] == 1 || objmap[x][y] == 2) && nballs < 5 && (int)(RND() * 4) == 0) {
+ int ax = x * 16;
+ int ay = y * 16;
+
+ spellinfo[i].fireballs[nballs][0] = ax;
+ spellinfo[i].fireballs[nballs][1] = ay;
+ spellinfo[i].fireballs[nballs][2] = 0;
+ spellinfo[i].fireballs[nballs][3] = 0;
+
+ spellinfo[i].ballon[nballs] = 1;
+ nballs = nballs + 1;
+ }
+ }
+ }
+ spellinfo[i].nfballs = nballs;
+ }
+
+ if(menabled == 1 && config.effects == 1) {
+ if(spellnum == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndthrow], 0);
+ Mix_Volume(snd, config.effectsvol);
+ } else if(spellnum == 5) {
+ int snd = Mix_PlayChannel(-1, sfx[sndcrystal], 0);
+ Mix_Volume(snd, config.effectsvol);
+ } else if(spellnum == 8 || spellnum == 9) {
+ int snd = Mix_PlayChannel(-1, sfx[sndlightning], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+ }
+
+ return;
+ }
+ }
+}
+
+void game_checkhit()
+{
+ float npx, npy;
+ float damage;
+
+ if(attacking == 1) {
+ for(int i = 1; i <= lastnpc; i++) {
+ if(npcinfo[i].hp > 0 && npcinfo[i].pause < ticks && (int)(RND() * 2) == 0) {
+ npx = npcinfo[i].x;
+ npy = npcinfo[i].y;
+
+ float xdif = player.px - npx;
+ float ydif = player.py - npy;
+
+ float ps = player.sword;
+ if(ps > 1) ps = ps * 0.75;
+ damage = (float)player.sworddamage * (1.0 + RND() * 1.0) * player.attackstrength / 100.0 * ps;
+ if(player.attackstrength == 100) damage = damage * 1.5;
+
+ int hit = 0;
+ if(player.walkdir == 0) {
+ if(abs(xdif) <= 8 && ydif >= 0 && ydif < 8) hit = 1;
+ } else if(player.walkdir == 1) {
+ if(abs(xdif) <= 8 && ydif <= 0 && ydif > -8) hit = 1;
+ } else if(player.walkdir == 2) {
+ if(abs(ydif) <= 8 && xdif >= -8 && xdif < 8) hit = 1;
+ } else if(player.walkdir == 3) {
+ if(abs(ydif) <= 8 && xdif <= 8 && xdif > -8) hit = 1;
+ }
+
+ if(hit == 1) {
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndswordhit], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ game_damagenpc(i, damage, 0);
+ }
+ }
+ }
+ }
+}
+
+void game_checkinputs()
+{
+ int ntickdelay;
+
+ ntickdelay = 175;
+
+ SDL_PollEvent(&event);
+ keys = SDL_GetKeyState(NULL);
+
+ nposts = 0;
+
+ for(int i = 0; i <= 20; i++) {
+ postinfo[i][0] = 0;
+ postinfo[i][1] = 0;
+ }
+
+ for(int x = 0; x <= 19; x++) {
+ for(int y = 0; y <= 14; y++) {
+ int o = objmap[x][y];
+ if(objectinfo[o][4] == 3) {
+ postinfo[nposts][0] = x * 16;
+ postinfo[nposts][1] = y * 16;
+ nposts = nposts + 1;
+ }
+ }
+ }
+
+ if(attacking == 1 || (forcepause == 1 && itemselon == 0)) return;
+
+ if(event.type == SDL_KEYDOWN) {
+ switch(event.key.keysym.sym) {
+ case SDLK_ESCAPE:
+ if(itemticks < ticks) game_title(1);
+ break;
+ case SDLK_RETURN:
+ if(keys[SDLK_LALT] || keys[SDLK_RALT]) {
+ if(fullscreen & SDL_FULLSCREEN) {
+ fullscreen = config.hwaccel | config.hwsurface;
+ } else {
+ fullscreen = SDL_FULLSCREEN | config.hwaccel | config.hwsurface;
+ }
+
+ config.fullscreen = fullscreen & SDL_FULLSCREEN;
+
+ video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
+ SDL_UpdateRect(video, 0, 0, config.scr_width, config.scr_height);
+ }
+ break;
+
+ case SDLK_LCTRL:
+ if(itemselon == 0 && itemticks < ticks) game_attack();
+
+ if(itemselon == 1 && itemticks < ticks) {
+ if(curitem == 0 && player.inventory[INV_FLASK] > 0) {
+ itemticks = ticks + ntickdelay;
+
+ int heal = 50;
+ int maxh = player.maxhp - player.hp;
+
+ if(heal > maxh) heal = maxh;
+
+ player.hp = player.hp + heal;
+
+ char text[256];
+ sprintf(text, "+%i", heal);
+ game_addFloatText(text, player.px + 16 - 4 * strlen(text), player.py + 16, 5);
+
+ player.inventory[INV_FLASK]--;
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ itemselon = 0;
+ forcepause = 0;
+ }
+
+ if(curitem == 1 && player.inventory[INV_DOUBLEFLASK] > 0) {
+ itemticks = ticks + ntickdelay;
+
+ int heal = 200;
+ int maxh = player.maxhp - player.hp;
+
+ if(heal > maxh) heal = maxh;
+
+ player.hp = player.hp + heal;
+
+ char text[256];
+ sprintf(text, "+%i", heal);
+ game_addFloatText(text, player.px + 16 - 4 * strlen(text), player.py + 16, 5);
+
+ player.inventory[INV_DOUBLEFLASK]--;
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ itemselon = 0;
+ forcepause = 0;
+
+ }
+
+ if(curitem == 2 && player.inventory[INV_SHOCK] > 0) {
+ game_castspell(8, player.px, player.py, npcinfo[curenemy].x, npcinfo[curenemy].y, 0);
+
+ forcepause = 1;
+
+ player.inventory[INV_SHOCK]--;
+
+ itemticks = ticks + ntickdelay;
+ selenemyon = 0;
+ itemselon = 0;
+
+ }
+
+ if(curitem == 3 && player.inventory[INV_NORMALKEY] > 0 && canusekey == 1 && locktype == 1) {
+ roomlocks[roomtounlock] = 0;
+ game_eventtext("UnLocked!");
+
+ player.inventory[INV_NORMALKEY]--;
+
+ itemticks = ticks + ntickdelay;
+ selenemyon = 0;
+ itemselon = 0;
+ return;
+ }
+
+ if(curitem == 4 && player.inventory[INV_MASTERKEY] > 0 && canusekey == 1 && locktype == 2) {
+ roomlocks[roomtounlock] = 0;
+ game_eventtext("UnLocked!");
+
+ player.inventory[INV_MASTERKEY]--;
+
+ itemticks = ticks + ntickdelay;
+ selenemyon = 0;
+ itemselon = 0;
+ return;
+ }
+
+ if(curitem == 5 && player.spellcharge[0] == 100) {
+ game_castspell(5, player.px, player.py, npcinfo[curenemy].x, npcinfo[curenemy].y, 0);
+
+ player.spellcharge[0] = 0;
+
+ forcepause = 1;
+
+ itemticks = ticks + ntickdelay;
+ selenemyon = 0;
+ itemselon = 0;
+ }
+
+ if(curitem > 5 && selenemyon == 1) {
+ if(curenemy <= lastnpc) {
+ game_castspell(curitem - 6, player.px, player.py, npcinfo[curenemy].x, npcinfo[curenemy].y, 0);
+ } else {
+ int pst = curenemy - lastnpc - 1;
+ game_castspell(curitem - 6, player.px, player.py, postinfo[pst][0], postinfo[pst][1], 0);
+ }
+
+ player.spellcharge[curitem - 5] = 0;
+
+ player.spellstrength = 0;
+
+ itemticks = ticks + ntickdelay;
+ selenemyon = 0;
+ itemselon = 0;
+ forcepause = 0;
+ }
+
+ if(curitem > 5 && selenemyon == 0 && itemselon == 1) {
+ if(player.spellcharge[curitem - 5] == 100) {
+ itemticks = ticks + ntickdelay;
+
+ selenemyon = 1;
+
+ int i = 0;
+ do {
+ if(npcinfo[i].hp > 0) {
+ curenemy = i;
+ goto __exit_do;
+ }
+ i = i + 1;
+ if(i == lastnpc + 1) {
+ selenemyon = 0;
+ goto __exit_do;
+ }
+ } while(1);
+ __exit_do:
+
+ if(nposts > 0 && selenemyon == 0) {
+ selenemyon = 1;
+ curenemy = lastnpc + 1;
+ }
+ }
+
+ }
+ }
+ break;
+
+ case SDLK_LALT:
+ if(itemticks < ticks) {
+ selenemyon = 0;
+ if(itemselon == 1) {
+ itemselon = 0;
+ itemticks = ticks + 220;
+ forcepause = 0;
+ } else {
+ itemselon = 1;
+ itemticks = ticks + 220;
+ forcepause = 1;
+ player.itemselshade = 0;
+ }
+ }
+ break;
+
+ default:
+ ;
+ }
+ }
+
+ if(itemselon == 0) {
+ movingup = 0;
+ movingdown = 0;
+ movingleft = 0;
+ movingright = 0;
+ if(keys[SDLK_UP]) movingup = 1;
+ if(keys[SDLK_DOWN]) movingdown = 1;
+ if(keys[SDLK_LEFT]) movingleft = 1;
+ if(keys[SDLK_RIGHT]) movingright = 1;
+ } else {
+ movingup = 0;
+ movingdown = 0;
+ movingleft = 0;
+ movingright = 0;
+
+ if(selenemyon == 1) {
+ if(itemticks < ticks) {
+ if(keys[SDLK_LEFT]) {
+ int origin = curenemy;
+ do {
+ curenemy = curenemy - 1;
+ if(curenemy < 1) curenemy = lastnpc + nposts;
+ if(curenemy == origin) break;
+ if(curenemy <= lastnpc && npcinfo[curenemy].hp > 0) break;
+ if(curenemy > lastnpc) break;
+ } while(1);
+ itemticks = ticks + ntickdelay;
+ }
+ if(keys[SDLK_RIGHT]) {
+ int origin = curenemy;
+ do {
+ curenemy = curenemy + 1;
+ if(curenemy > lastnpc + nposts) curenemy = 1;
+ if(curenemy == origin) break;
+ if(curenemy <= lastnpc && npcinfo[curenemy].hp > 0) break;
+ if(curenemy > lastnpc) break;
+ } while(1);
+ itemticks = ticks + ntickdelay;
+ }
+
+
+ if(curenemy > lastnpc + nposts) curenemy = 1;
+ if(curenemy < 1) curenemy = lastnpc + nposts;
+ }
+ } else {
+ if(itemticks < ticks) {
+ if(keys[SDLK_UP]) {
+ curitem = curitem - 1;
+ itemticks = ticks + ntickdelay;
+ if(curitem == 4) curitem = 9;
+ if(curitem == -1) curitem = 4;
+ }
+ if(keys[SDLK_DOWN]) {
+ curitem = curitem + 1;
+ itemticks = ticks + ntickdelay;
+ if(curitem == 5) curitem = 0;
+ if(curitem == 10) curitem = 5;
+ }
+ if(keys[SDLK_LEFT]) {
+ curitem = curitem - 5;
+ itemticks = ticks + ntickdelay;
+ }
+ if(keys[SDLK_RIGHT]) {
+ curitem = curitem + 5;
+ itemticks = ticks + ntickdelay;
+ }
+
+ if(curitem > 9) curitem = curitem - 10;
+ if(curitem < 0) curitem = curitem + 10;
+ }
+ }
+ }
+}
+
+void game_checktrigger()
+{
+ int npx, npy, lx, ly;
+
+ npx = player.px + 12;
+ npy = player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ canusekey = 0;
+
+ if(triggerloc[lx][ly] > -1) game_processtrigger(triggerloc[lx][ly]);
+}
+
+#ifdef OPENDINGUX
+ #define MINCURSEL 7
+ #define MAXCURSEL 14
+ #define SY 22
+#else
+ #define MINCURSEL 0
+ #define MAXCURSEL 14
+ #define SY (38 + (240 - 38) / 2 - 88)
+#endif
+
+void game_configmenu()
+{
+ SDL_Surface *configwindow;
+ SDL_Rect rc;
+ int cursel, curselt, ofullscreen;
+ int tickwait, keypause, ticks1;
+
+ cursel = MINCURSEL;
+
+ ticks = SDL_GetTicks();
+ tickwait = 100;
+ keypause = ticks + tickwait;
+
+ configwindow = SDL_DisplayFormat(videobuffer);
+
+ configwindow = IMG_Load("art/configwindow.bmp");
+ SDL_SetColorKey(configwindow, SDL_SRCCOLORKEY, SDL_MapRGB(configwindow->format, 255, 0, 255));
+ SDL_SetAlpha(configwindow, SDL_SRCALPHA, 160);
+
+ ticks1 = ticks;
+ do {
+ SDL_FillRect(videobuffer, NULL, 0);
+
+ rcDest.x = 256 + 256 * cos(3.141592 / 180 * clouddeg * 40);
+ rcDest.y = 192 + 192 * sin(3.141592 / 180 * clouddeg * 40);
+ rcDest.w = 320;
+ rcDest.h = 240;
+
+ SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 128);
+ SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
+ SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 64);
+
+ rcDest.x = 256;
+ rcDest.y = 192;
+ rcDest.w = 320;
+ rcDest.h = 240;
+
+ SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 128);
+ SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
+ SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 64);
+
+ SDL_BlitSurface(configwindow, NULL, videobuffer, NULL);
+
+ int sy = SY;
+
+ for(int i = 0; i <= 21; i++) {
+ static char *vr[22] = {
+#ifdef OPENDINGUX
+ "", "",
+ "", "", "", "",
+ "", "", "",
+#else
+ "Resolution:", "",
+ "Bit Depth:", "", "", "",
+ "Start Fullscreen:", "", "",
+#endif
+ "Music:", "", "",
+ "Sound Effects:", "", "",
+ "Music Volume:", "",
+ "Effects Volume:", "", "", "", ""
+ };
+ static char *vl[22] = {
+#ifdef OPENDINGUX
+ "", "",
+ "", "", "", "",
+ "", "", "",
+#else
+ "320x240", "640x480",
+ "16", "24", "32", "",
+ "Yes", "No", "",
+#endif
+ "On", "Off", "",
+ "On", "Off", "",
+ "[----------]", "",
+ "[----------]", "",
+ "Exit + Save", "",
+ "Exit"
+ };
+ static char line[24];
+
+ if(i == 15 || i == 17) {
+ int vol = (i == 15 ? config.musicvol : config.effectsvol) * 9 / 255;
+ if(vol < 0) vol = 0;
+ if(vol > 9) vol = 9;
+
+ strcpy(line, "[----------]");
+ line[vol+1] = 'X';
+ vl[i] = line;
+ }
+
+ int cl = 3;
+ if(i == 0 && config.scr_width == 320) cl = 0;
+ if(i == 1 && config.scr_width == 640) cl = 0;
+ if(i == 2 && config.scr_bpp == 16) cl = 0;
+ if(i == 3 && config.scr_bpp == 24) cl = 0;
+ if(i == 4 && config.scr_bpp == 32) cl = 0;
+ if(i == 6 && config.fullscreen != 0) cl = 0;
+ if(i == 7 && config.fullscreen == 0) cl = 0;
+ if(i == 9 && config.music == 1) cl = 0;
+ if(i == 10 && config.music == 0) cl = 0;
+ if(i == 12 && config.effects == 1) cl = 0;
+ if(i == 13 && config.effects == 0) cl = 0;
+
+ if(i > 18) cl = 0;
+
+ sys_print(videobuffer, vr[i], 156 - 8 * strlen(vr[i]), sy + i * 8, 0);
+ sys_print(videobuffer, vl[i], 164, sy + i * 8, cl);
+ }
+
+ curselt = cursel;
+ if(cursel > 4) curselt = curselt + 1;
+ if(cursel > 6) curselt = curselt + 1;
+ if(cursel > 8) curselt = curselt + 1;
+ if(cursel > 10) curselt = curselt + 1;
+ if(cursel > 11) curselt = curselt + 1;
+ if(cursel > 12) curselt = curselt + 1;
+ if(cursel > 13) curselt = curselt + 1;
+
+ rc.x = 148 + 3 * cos(3.14159 * 2 * itemyloc / 16.0);
+ rc.y = sy + 8 * curselt - 4;
+
+ SDL_BlitSurface(itemimg[15], NULL, videobuffer, &rc);
+
+ float yy = 255.0;
+ if(ticks < ticks1 + 1000) {
+ yy = 255.0 * ((float)(ticks - ticks1) / 1000.0);
+ if(yy < 0.0) yy = 0.0;
+ if(yy > 255.0) yy = 255.0;
+ }
+
+ SDL_SetAlpha(videobuffer, SDL_SRCALPHA, (int)yy);
+ SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
+ SDL_SetAlpha(videobuffer, SDL_SRCALPHA, 255);
+
+ SDL_Flip(video);
+ SDL_PumpEvents();
+
+ tickspassed = ticks;
+ ticks = SDL_GetTicks();
+
+ tickspassed = ticks - tickspassed;
+ fpsr = (float)tickspassed / 24;
+
+ fp++;
+ if(ticks > nextticks) {
+ nextticks = ticks + 1000;
+ fps = fp;
+ fp = 0;
+ }
+
+ itemyloc += 0.75 * fpsr;
+ while(itemyloc >= 16) itemyloc -= 16;
+
+ if(keypause < ticks) {
+ SDL_PollEvent(&event);
+ keys = SDL_GetKeyState(NULL);
+
+ if(event.type == SDL_KEYDOWN) {
+ keypause = ticks + tickwait;
+
+ if(keys[SDLK_ESCAPE] || keys[SDLK_LALT]) break;
+
+ if(keys[SDLK_LEFT]) {
+ if(cursel == 11) {
+ config.musicvol = config.musicvol - 25;
+ if(config.musicvol < 0) config.musicvol = 0;
+
+ Mix_Volume(musicchannel, config.musicvol);
+ Mix_Volume(menuchannel, config.musicvol);
+ } else if(cursel == 12) {
+ config.effectsvol = config.effectsvol - 25;
+ if(config.effectsvol < 0) config.effectsvol = 0;
+
+ Mix_Volume(-1, config.effectsvol);
+ Mix_Volume(musicchannel, config.musicvol);
+ Mix_Volume(menuchannel, config.musicvol);
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[snddoor], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+ }
+ }
+ if(keys[SDLK_RIGHT]) {
+ if(cursel == 11) {
+ config.musicvol = config.musicvol + 25;
+ if(config.musicvol > 255) config.musicvol = 255;
+
+ Mix_Volume(musicchannel, config.musicvol);
+ Mix_Volume(menuchannel, config.musicvol);
+ } else if(cursel == 12) {
+ config.effectsvol = config.effectsvol + 25;
+ if(config.effectsvol > 255) config.effectsvol = 255;
+
+ Mix_Volume(-1, config.effectsvol);
+ Mix_Volume(musicchannel, config.musicvol);
+ Mix_Volume(menuchannel, config.musicvol);
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[snddoor], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+ }
+ }
+
+ if(keys[SDLK_UP]) {
+ cursel--;
+ if(cursel < MINCURSEL) cursel = 14;
+ }
+ if(keys[SDLK_DOWN]) {
+ cursel++;
+ if(cursel > 14) cursel = MINCURSEL;
+ }
+
+ if(keys[SDLK_LCTRL] || keys[SDLK_RETURN]) {
+ if(cursel == 0) {
+ fullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
+
+ video = SDL_SetVideoMode(320, 240, config.scr_bpp, fullscreen);
+ if(video == 0) {
+ video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
+ } else {
+ config.scr_width = 320;
+ config.scr_height = 240;
+ }
+
+ SDL_UpdateRect(video, 0, 0, config.scr_width, config.scr_height);
+ }
+ if(cursel == 1) {
+ fullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
+
+ video = SDL_SetVideoMode(640, 480, config.scr_bpp, fullscreen);
+ if(video == 0) {
+ video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
+ } else {
+ config.scr_width = 640;
+ config.scr_height = 480;
+ }
+
+ SDL_UpdateRect(video, 0, 0, config.scr_width, config.scr_height);
+ }
+ if(cursel == 2 || cursel == 3 || cursel == 4) {
+ fullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
+
+ int b = 16;
+ if(cursel == 3) b = 24;
+ if(cursel == 4) b = 32;
+ video = SDL_SetVideoMode(config.scr_width, config.scr_height, b, fullscreen);
+ if(video == 0) {
+ video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
+ } else {
+ config.scr_bpp = b;
+ }
+
+ SDL_UpdateRect(video, 0, 0, config.scr_width, config.scr_height);
+ }
+ if(cursel == 5) {
+ ofullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
+ fullscreen = SDL_FULLSCREEN | config.hwaccel | config.hwsurface;
+
+ video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
+ if(video == 0) {
+ video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, ofullscreen);
+ } else {
+ config.fullscreen = SDL_FULLSCREEN;
+ }
+
+ SDL_UpdateRect(video, 0, 0, config.scr_width, config.scr_height);
+ }
+ if(cursel == 6) {
+ ofullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
+ fullscreen = 0 | config.hwaccel | config.hwsurface;
+
+ video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
+ if(video == 0) {
+ video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, ofullscreen);
+ } else {
+ config.fullscreen = 0;
+ }
+
+ SDL_UpdateRect(video, 0, 0, config.scr_width, config.scr_height);
+ }
+ if(cursel == 7 && config.music == 0) {
+ config.music = 1;
+ if(menabled == 1) {
+ menuchannel = Mix_PlayChannel(-1, mmenu, -1);
+ Mix_Volume(menuchannel, config.musicvol);
+ }
+ }
+ if(cursel == 8 && config.music == 1) {
+ config.music = 0;
+ Mix_HaltChannel(musicchannel);
+ Mix_HaltChannel(menuchannel);
+ }
+ if(cursel == 9 && config.effects == 0) {
+ config.effects = 1;
+ if(menabled == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[snddoor], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+ }
+
+ if(cursel == 10 && config.effects == 1) config.effects = 0;
+
+ if(cursel == 13) {
+ config_save(&config);
+ break;
+ }
+
+ if(cursel == 14) {
+ // reset keys to avoid returning
+ keys[SDLK_SPACE] = keys[SDLK_RETURN] = 0;
+ break;
+ }
+ }
+ }
+ }
+
+ clouddeg += 0.01 * fpsr;
+ while(clouddeg >= 360) clouddeg = clouddeg - 360;
+
+ SDL_Delay(10);
+ } while(1);
+
+ SDL_FreeSurface(configwindow);
+ itemticks = ticks + 210;
+
+ SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 64);
+}
+
+void game_damagenpc(int npcnum, int damage, int spell)
+{
+ float npx, npy;
+ int lx, ly, cx, cy, alive;
+ char line[256];
+ int ratio;
+ int fcol, heal, ff;
+
+ if(damage == 0) {
+ strcpy(line, "miss!");
+ fcol = 2;
+ } else {
+ ratio = 0;
+ heal = 0;
+ if(damage < 0) heal = 1;
+ damage = abs(damage);
+
+ if(heal == 0) {
+ if(damage > npcinfo[npcnum].hp) {
+ ratio = (damage - npcinfo[npcnum].hp) * 100 / damage;
+ damage = npcinfo[npcnum].hp;
+ }
+
+ npcinfo[npcnum].hp -= damage;
+ if(npcinfo[npcnum].hp < 0) npcinfo[npcnum].hp = 0;
+
+ sprintf(line, "-%i", damage);
+ fcol = 1;
+ } else {
+ npcinfo[npcnum].hp += damage;
+ if(npcinfo[npcnum].hp > npcinfo[npcnum].maxhp) npcinfo[npcnum].hp = npcinfo[npcnum].maxhp;
+
+ sprintf(line, "+%i", damage);
+ fcol = 5;
+ }
+
+ npcinfo[npcnum].pause = ticks + 900;
+
+ if(spell == 0) player.attackstrength = ratio;
+ }
+
+ game_addFloatText(line, npcinfo[npcnum].x + 12 - 4 * strlen(line), npcinfo[npcnum].y + 16, fcol);
+
+ if(npcinfo[npcnum].spriteset == 12) game_castspell(9, npcinfo[npcnum].x, npcinfo[npcnum].y, player.px, player.py, npcnum);
+
+ // if enemy is killed
+ if(npcinfo[npcnum].hp == 0) {
+ player.exp = player.exp + npcinfo[npcnum].maxhp;
+
+ if(npcinfo[npcnum].spriteset == 1 || npcinfo[npcnum].spriteset == 7 || npcinfo[npcnum].spriteset == 6) {
+ ff = (int)(RND() * player.level * 3);
+ if(ff == 0) {
+ npx = npcinfo[npcnum].x + 12;
+ npy = npcinfo[npcnum].y + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if(objmap[lx][ly] == -1) objmap[lx][ly] = 4;
+ }
+ }
+
+ if(npcinfo[npcnum].spriteset == 2 || npcinfo[npcnum].spriteset == 9 || npcinfo[npcnum].spriteset == 4 || npcinfo[npcnum].spriteset == 5) {
+ ff = (int)(RND() * player.level);
+ if(ff == 0) {
+ npx = npcinfo[npcnum].x + 12;
+ npy = npcinfo[npcnum].y + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if(objmap[lx][ly] == -1) objmap[lx][ly] = 12;
+ }
+ }
+
+ if(npcinfo[npcnum].spriteset == 9 || npcinfo[npcnum].spriteset == 10 || npcinfo[npcnum].spriteset == 5) {
+ ff = (int)(RND() * player.level * 2);
+ if(ff == 0) {
+ npx = npcinfo[npcnum].x + 12;
+ npy = npcinfo[npcnum].y + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if(objmap[lx][ly] == -1) objmap[lx][ly] = 13;
+ }
+ }
+
+ // academy master key chest script
+ if(npcinfo[npcnum].script == 2) {
+ cx = 9;
+ cy = 7;
+
+ alive = 0;
+ for(int i = 1; i <= lastnpc; i++) {
+ if(npcinfo[i].hp > 0) alive = 1;
+ }
+
+ if(alive == 0) {
+ objmap[cx][cy] = 5;
+
+ rcDest.x = cx * 8;
+ rcDest.y = cy * 8;
+ rcDest.w = 8;
+ rcDest.h = 8;
+
+ npx = player.px + 12;
+ npy = player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if(lx == cx && ly == cy) player.py = player.py + 16;
+ SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ scriptflag[2][0] = 1;
+ }
+ }
+
+ // academy crystal chest script
+ if(npcinfo[npcnum].script == 3) {
+ cx = 9;
+ cy = 7;
+
+ alive = 0;
+ for(int i = 1; i <= lastnpc; i++) {
+ if(npcinfo[i].hp > 0) alive = 1;
+ }
+
+ if(alive == 0) {
+ objmap[cx][cy] = 6;
+
+ rcDest.x = cx * 8;
+ rcDest.y = cy * 8;
+ rcDest.w = 8;
+ rcDest.h = 8;
+
+ npx = player.px + 12;
+ npy = player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if(lx == cx && ly == cy) player.py = player.py + 16;
+ scriptflag[3][0] = 1;
+ SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ }
+ }
+
+ // tower shield chest script
+ if(npcinfo[npcnum].script == 4 && scriptflag[4][0] == 0) {
+ triggerloc[9][7] = 5004;
+
+ int curtile = 40;
+ int curtilel = 0;
+ int curtilex = curtile % 20;
+ int curtiley = (curtile - curtilex) / 20;
+
+ int l = 0; // ?? not defined in original code
+ tileinfo[l][9][7][0] = curtile + 1;
+ tileinfo[l][9][7][1] = 0;
+
+ rcSrc.x = curtilex * 16;
+ rcSrc.y = curtiley * 16;
+ rcSrc.w = 16;
+ rcSrc.h = 16;
+
+ rcDest.x = 9 * 16;
+ rcDest.y = 7 * 16;
+ rcDest.w = 16;
+ rcDest.h = 16;
+
+ SDL_BlitSurface(tiles[curtilel], &rcSrc, mapbg, &rcDest);
+ }
+
+ // firehydra sword chest
+ if(npcinfo[npcnum].script == 5) {
+ cx = 9;
+ cy = 6;
+
+ alive = 0;
+ for(int i = 1; i <= lastnpc; i++) {
+ if(npcinfo[i].hp > 0) alive = 1;
+ }
+
+ if(alive == 0) {
+ objmap[cx][cy] = 9;
+
+ rcDest.x = cx * 8;
+ rcDest.y = cy * 8;
+ rcDest.w = 8;
+ rcDest.h = 8;
+
+ npx = player.px + 12;
+ npy = player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if(lx == cx && ly == cy) player.py = player.py + 16;
+ scriptflag[5][0] = 1;
+ SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ }
+
+ }
+
+ // gardens master key script
+ if(npcinfo[npcnum].script == 8 && scriptflag[6][0] == 0) {
+ cx = 13;
+ cy = 7;
+
+ alive = 0;
+ for(int i = 1; i <= lastnpc; i++) {
+ if(npcinfo[i].hp > 0) alive = 1;
+ }
+
+ if(alive == 0) {
+ objmap[cx][cy] = 5;
+
+ rcDest.x = cx * 8;
+ rcDest.y = cy * 8;
+ rcDest.w = 8;
+ rcDest.h = 8;
+
+ npx = player.px + 12;
+ npy = player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if(lx == cx && ly == cy) player.py = player.py + 16;
+ SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ scriptflag[8][0] = 1;
+ }
+ }
+
+ // regular key chest 1
+ for(int s = 20; s <= 23; s++) {
+ if(npcinfo[npcnum].script == s && scriptflag[s][0] < 2) {
+ cx = 9;
+ cy = 7;
+
+ alive = 0;
+ for(int i = 1; i <= lastnpc; i++) {
+ if(npcinfo[i].hp > 0) alive = 1;
+ }
+
+ if(alive == 0) {
+ objmap[cx][cy] = 11;
+
+ rcDest.x = cx * 8;
+ rcDest.y = cy * 8;
+ rcDest.w = 8;
+ rcDest.h = 8;
+
+ npx = player.px + 12;
+ npy = player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if(lx == cx && ly == cy) player.py = player.py + 16;
+ scriptflag[s][0] = 1;
+ SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ }
+ }
+ }
+
+ // pickup lightning bomb
+ if(npcinfo[npcnum].script == 9 && (curmap == 41 && scriptflag[9][1] == 0)) {
+ cx = 9;
+ cy = 7;
+
+ alive = 0;
+ for(int i = 1; i <= lastnpc; i++) {
+ if(npcinfo[i].hp > 0) alive = 1;
+ }
+
+ if(alive == 0) {
+ objmap[cx][cy] = 13;
+
+ rcDest.x = cx * 8;
+ rcDest.y = cy * 8;
+ rcDest.w = 8;
+ rcDest.h = 8;
+
+ npx = player.px + 12;
+ npy = player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if(lx == cx && ly == cy) player.py = player.py + 16;
+ }
+ }
+
+ // citadel armour chest
+ if(npcinfo[npcnum].script == 12) {
+ cx = 8;
+ cy = 7;
+
+ alive = 0;
+ for(int i = 1; i <= lastnpc; i++) {
+ if(npcinfo[i].hp > 0) alive = 1;
+ }
+
+ if(alive == 0) {
+ objmap[cx][cy] = 16;
+
+ rcDest.x = cx * 8;
+ rcDest.y = cy * 8;
+ rcDest.w = 8;
+ rcDest.h = 8;
+
+ npx = player.px + 12;
+ npy = player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if(lx == cx && ly == cy) player.py = player.py + 16;
+ scriptflag[12][0] = 1;
+ SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ }
+ }
+
+ // citadel master key script
+ if(npcinfo[npcnum].script == 13 && scriptflag[13][0] == 0) {
+ cx = 11;
+ cy = 10;
+
+ alive = 0;
+ for(int i = 1; i <= lastnpc; i++) {
+ if(npcinfo[i].hp > 0) alive = 1;
+ }
+
+ if(alive == 0) {
+ objmap[cx][cy] = 5;
+
+ rcDest.x = cx * 8;
+ rcDest.y = cy * 8;
+ rcDest.w = 8;
+ rcDest.h = 8;
+
+ npx = player.px + 12;
+ npy = player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if(lx == cx && ly == cy) player.py = player.py + 16;
+ SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ scriptflag[13][0] = 1;
+ }
+ }
+
+ // max ups
+ if(npcinfo[npcnum].script == 15 && scriptflag[15][0] == 0) {
+ alive = 0;
+ for(int i = 1; i <= lastnpc; i++) {
+ if(npcinfo[i].hp > 0) alive = 1;
+ }
+
+ if(alive == 0) {
+ cx = 6;
+ cy = 8;
+
+ objmap[cx][cy] = 18;
+
+ rcDest.x = cx * 8;
+ rcDest.y = cy * 8;
+ rcDest.w = 8;
+ rcDest.h = 8;
+
+ npx = player.px + 12;
+ npy = player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if(lx == cx && ly == cy) player.py = player.py + 16;
+ SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ scriptflag[15][0] = 1;
+
+ cx = 9;
+ cy = 8;
+
+ objmap[cx][cy] = 19;
+
+ rcDest.x = cx * 8;
+ rcDest.y = cy * 8;
+ rcDest.w = 8;
+ rcDest.h = 8;
+
+ npx = player.px + 12;
+ npy = player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if(lx == cx && ly == cy) player.py = player.py + 16;
+ SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+
+ scriptflag[16][0] = 1;
+
+ cx = 12;
+ cy = 8;
+
+ objmap[cx][cy] = 20;
+
+ rcDest.x = cx * 8;
+ rcDest.y = cy * 8;
+ rcDest.w = 8;
+ rcDest.h = 8;
+
+ npx = player.px + 12;
+ npy = player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if(lx == cx && ly == cy) player.py = player.py + 16;
+ SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ scriptflag[17][0] = 1;
+ }
+ }
+
+ if(npcinfo[npcnum].script == 14) game_endofgame();
+ }
+}
+
+void game_damageplayer(int damage)
+{
+ char line[256];
+
+ player.hp -= damage;
+ if(player.hp < 0) player.hp = 0;
+
+ sprintf(line, "-%i", damage);
+ if(damage == 0) strcpy(line, "miss!");
+
+ game_addFloatText(line, player.px + 12 - 4 * strlen(line), player.py + 16, 4);
+
+ player.pause = ticks + 1000;
+}
+
+void game_drawanims(int Layer)
+{
+ for(int sx = 0; sx <= 19; sx++) {
+ for(int sy = 0; sy <= 14; sy++) {
+ int o = objmap[sx][sy];
+
+ if(o > -1) {
+ int xtiles = objectinfo[o][1];
+ int ytiles = objectinfo[o][2];
+ int cframe = objectframe[o][1];
+
+ for(int x = 0; x <= xtiles - 1; x++) {
+ for(int y = 0; y <= ytiles - 1; y++) {
+ int x1 = (sx + x) * 16;
+ int y1 = (sy + y) * 16;
+
+ if(objecttile[o][cframe][x][y][1] == Layer) {
+ int c = objecttile[o][cframe][x][y][0];
+ c = c - 1;
+ int curtilel = 3;
+ int curtilex = c % 20;
+ int curtiley = (c - curtilex) / 20;
+
+ if(curmap == 58 && scriptflag[60][0] > 0) curtilex = 1;
+ if(curmap == 54 && scriptflag[60][0] > 1) curtilex = 1;
+ rcSrc.x = curtilex * 16;
+ rcSrc.y = curtiley * 16;
+ rcSrc.w = 16;
+ rcSrc.h = 16;
+
+ rcDest.x = x1;
+ rcDest.y = y1;
+ rcDest.w = 16;
+ rcDest.h = 16;
+
+ SDL_BlitSurface(tiles[curtilel], &rcSrc, videobuffer, &rcDest);
+ }
+
+ if(Layer == 1) {
+ for(int l = 1; l <= 2; l++) {
+ int c = tileinfo[l][sx + x][sy + y][0];
+ if(c > 0) {
+ int cl = tileinfo[l][sx + x][sy + y][1];
+
+ c = c - 1;
+ int curtile = c;
+ int curtilel = cl;
+ int curtilex = c % 20;
+ int curtiley = (c - curtilex) / 20;
+
+ rcSrc.x = curtilex * 16;
+ rcSrc.y = curtiley * 16;
+ rcSrc.w = 16;
+ rcSrc.h = 16;
+
+ rcDest.x = (sx + x) * 16;
+ rcDest.y = (sy + y) * 16;
+ rcDest.w = 16;
+ rcDest.h = 16;
+
+ int pass = 1;
+ if(curtilel == 1) {
+ for(int ff = 0; ff <= 5; ff++) {
+ int ffa = 20 * 5 - 1 + ff * 20;
+ int ffb = 20 * 5 + 4 + ff * 20;
+ if(curtile > ffa && curtile < ffb) pass = 0;
+ }
+ }
+
+ if(pass == 1) SDL_BlitSurface(tiles[curtilel], &rcSrc, videobuffer, &rcDest);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+int hud_recalc(int a, int b, int c)
+{
+ int result = a * b / c;
+
+ return result > b ? b : result;
+}
+
+#define RGB(R, G, B) (SDL_MapRGB(videobuffer->format, (R), (G), (B)))
+
+void game_drawhud()
+{
+ char line[128];
+ //sprintf(line, "fps: %i, map: %i, exp: %i/%i", (int)fps, curmap, player.exp, player.nextlevel);
+ //sys_print(videobuffer, line, 0, 0, 0);
+
+ long ccc;
+
+ game_fillrect(videobuffer2, 0, 0, 320, 240, 0);
+
+ for(int i = 0; i < MAXFLOAT; i++) {
+ if(floattext[i][0] > 0) {
+ int fc = (int)floattext[i][3];
+ int c = fc, c2 = 3;
+
+ if(fc == 4) c = 1; else if(fc == 5) c = 0;
+
+ if(fc == 1 || fc == 3) c2 = 2;
+
+ if(fc != 0) {
+ sys_print(videobuffer, floatstri[i], (int)(floattext[i][1]) + 0, (int)(floattext[i][2]) - 1, c2);
+ sys_print(videobuffer, floatstri[i], (int)(floattext[i][1]) + 0, (int)(floattext[i][2]) + 1, c2);
+ sys_print(videobuffer, floatstri[i], (int)(floattext[i][1]) - 1, (int)(floattext[i][2]) + 0, c2);
+ sys_print(videobuffer, floatstri[i], (int)(floattext[i][1]) + 1, (int)(floattext[i][2]) + 0, c2);
+ }
+
+ sys_print(videobuffer, floatstri[i], (int)(floattext[i][1]), (int)(floattext[i][2]), c);
+ }
+
+ if(floaticon[i][0] > 0) {
+ int ico = floaticon[i][3];
+ int ix = floaticon[i][1];
+ int iy = floaticon[i][2];
+
+ rcDest.x = ix;
+ rcDest.y = iy;
+
+ if(ico != 99) SDL_BlitSurface(itemimg[ico], NULL, videobuffer, &rcDest);
+ if(ico == 99) {
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, (int)(RND() * 96) + 96);
+
+ rcSrc.x = 16 * (int)(RND() * 2);
+ rcSrc.y = 80;
+ rcSrc.w = 16;
+ rcSrc.h = 16;
+
+ rcDest.x = ix;
+ rcDest.y = iy;
+
+ SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
+ }
+ }
+ }
+
+ if(itemselon == 0) {
+ int sy = 211;
+
+
+ int nx = 19 * 8 + 13;
+ rcSrc.x = nx - 17 + 48;
+ rcSrc.y = sy;
+
+ // spells in game
+ if(player.foundspell[0] == 1) {
+ for(int i = 0; i < 5; i++) {
+ rcSrc.x = rcSrc.x + 17;
+
+ if(player.foundspell[i] == 1) {
+ SDL_BlitSurface(itemimg[7 + i], NULL, videobuffer, &rcSrc);
+
+ game_fillrect(videobuffer, rcSrc.x, sy + 16, 16, 4, RGB(0, 32, 32));
+ game_fillrect(videobuffer, rcSrc.x + 1, sy + 17,
+ hud_recalc(player.spellcharge[i], 14, 100), 2,
+ player.spellcharge[i] == 100 ? RGB(255, 128, 32) : RGB(0, 224, 64));
+ }
+ }
+ }
+ return;
+ }
+
+ if(selenemyon == 0) {
+ rcDest.x = 0;
+ rcDest.y = 0;
+ rcDest.w = 320;
+ rcDest.h = 240;
+ SDL_SetAlpha(videobuffer2, SDL_SRCALPHA, (int)(player.itemselshade * 4));
+ SDL_FillRect(videobuffer2, &rcDest, 0);
+ SDL_BlitSurface(videobuffer2, NULL, videobuffer, NULL);
+
+ int sy = 202;
+ rcSrc.x = 46;
+ rcSrc.y = 46;
+
+ SDL_SetAlpha(inventoryimg, SDL_SRCALPHA, 160); // 128
+ SDL_BlitSurface(inventoryimg, NULL, videobuffer, &rcSrc);
+ SDL_SetAlpha(inventoryimg, SDL_SRCALPHA, 255);
+
+ int sx = 54;
+ sy = 55;
+
+ // draw map 9,77
+ rcDest.x = 46 + 9;
+ rcDest.y = 46 + 77;
+
+ int amap = 0;
+ if(curmap > 46) amap = 2;
+ if(curmap > 67) amap = 3;
+ if(curmap > 5 && curmap < 42) amap = 1;
+ SDL_BlitSurface(mapimg[amap], NULL, videobuffer, &rcDest);
+
+ ccc = SDL_MapRGB(videobuffer->format, 128 + 127 * sin(3.141592 * 2 * itemyloc / 16), 0, 0);
+
+ for(int b = 0; b <= 6; b++) {
+ for(int a = 0; a <= 12; a++) {
+ if(invmap[amap][b][a] == curmap) {
+ game_fillrect(videobuffer, 46 + 9 + a * 9 + 2, 46 + 77 + b * 9 + 1, 6, 6, ccc);
+ }
+ }
+ }
+
+ if(amap == 1) {
+ sys_print(videobuffer, "L1", 46 + 9, 46 + 77, 0);
+ sys_print(videobuffer, "L2", 46 + 9 + 7 * 9, 46 + 77, 0);
+ }
+
+ sprintf(line, "Health: %i/%i", player.hp, player.maxhp);
+ sys_print(videobuffer, line, sx, sy, player.hp <= player.maxhp * 0.25 ? (int)player.hpflash : 0);
+
+ sprintf(line, "Level : %i", player.level);
+ if(player.level == player.maxlevel) strcpy(line, "Level : MAX");
+ sys_print(videobuffer, line, sx, sy + 8, 0);
+
+ // experience
+ game_fillrect(videobuffer, sx + 64, sy + 16, 16, 4, RGB(0, 32, 32));
+ game_fillrect(videobuffer, sx + 65, sy + 17,
+ hud_recalc(player.exp, 14, player.nextlevel), 2, RGB(0, 224, 64));
+
+ // attack strength
+ game_fillrect(videobuffer, sx + 1, sy + 16, 56, 6, RGB(0, 32, 32));
+ game_fillrect(videobuffer, sx + 1, sy + 17,
+ hud_recalc(player.attackstrength, 54, 100), 2,
+ player.attackstrength == 100 ? RGB(255, 128, 32) : RGB(0, 64, 224));
+
+ // spell strength
+ game_fillrect(videobuffer, sx + 1, sy + 19,
+ hud_recalc(player.spellstrength, 54, 100), 2,
+ player.spellstrength == 100 ? RGB(224, 0, 0) : RGB(128, 0, 224));
+
+ // time
+ int ase = secstart + secsingame;
+ int h = ((ase - (ase % 3600)) / 3600);
+ ase = (ase - h * 3600);
+ int m = ((ase - (ase % 60)) / 60);
+ int s = (ase - m * 60);
+
+ sprintf(line, "%02i:%02i:%02i", h, m, s);
+ sys_print(videobuffer, line, 46 + 38 - strlen(line) * 4, 46 + 49, 0);
+
+ sys_print(videobuffer, "Use", 193, 55, 0);
+ sys_print(videobuffer, "Cast", 236, 55, 0);
+
+ rcSrc.x = 128;
+ rcSrc.y = 91;
+
+ int ss = (player.sword - 1) * 3;
+ if(player.sword == 3) ss = 18;
+ SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
+
+ rcSrc.x = rcSrc.x + 16;
+ ss = (player.shield - 1) * 3 + 1;
+ if(player.shield == 3) ss = 19;
+ SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
+
+ rcSrc.x = rcSrc.x + 16;
+ ss = (player.armour - 1) * 3 + 2;
+ if(player.armour == 3) ss = 20;
+ SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
+
+ for(int i = 0; i <= 4; i++) {
+ sx = 188;
+ sy = 70 + i * 24;
+ rcSrc.x = sx;
+ rcSrc.y = sy;
+ if(i == 0) SDL_BlitSurface(itemimg[6], NULL, videobuffer, &rcSrc);
+ if(i == 1) SDL_BlitSurface(itemimg[12], NULL, videobuffer, &rcSrc);
+ if(i == 2) SDL_BlitSurface(itemimg[17], NULL, videobuffer, &rcSrc);
+ if(i == 3) SDL_BlitSurface(itemimg[16], NULL, videobuffer, &rcSrc);
+ if(i == 4) SDL_BlitSurface(itemimg[14], NULL, videobuffer, &rcSrc);
+
+ sprintf(line, "x%i", player.inventory[i]);
+ sys_print(videobuffer, line, sx + 17, sy + 7, 0);
+ }
+
+ // spells in menu
+ if(player.foundspell[0] == 1) {
+ for(int i = 0; i < 5; i++) {
+ rcSrc.x = 243;
+ rcSrc.y = 67 + i * 24;
+ sy = rcSrc.y;
+
+ if(player.foundspell[i] == 1) {
+ SDL_BlitSurface(itemimg[7 + i], NULL, videobuffer, &rcSrc);
+
+ game_fillrect(videobuffer, rcSrc.x, sy + 16, 16, 4, RGB(0, 32, 32));
+ game_fillrect(videobuffer, rcSrc.x + 1, sy + 17,
+ hud_recalc(player.spellcharge[i], 14, 100), 2,
+ player.spellcharge[i] == 100 ? RGB(255, 128, 32) : RGB(0, 224, 64));
+ }
+ }
+ }
+
+ if(itemselon == 1) {
+ for(int i = 0; i <= 4; i++) {
+ if(curitem == 5 + i) {
+ rcDest.x = (float)(243 - 12 + 3 * sin(3.141592 * 2 * itemyloc / 16));
+ rcDest.y = 67 + 24 * i;
+ SDL_BlitSurface(itemimg[15], NULL, videobuffer, &rcDest);
+ }
+
+ if(curitem == i) {
+ rcDest.x = (float)(189 - 12 + 3 * sin(3.141592 * 2 * itemyloc / 16));
+ rcDest.y = 70 + 24 * i;
+ SDL_BlitSurface(itemimg[15], NULL, videobuffer, &rcDest);
+ }
+ }
+ }
+ }
+
+ if(selenemyon == 1) {
+ if(curenemy > lastnpc) {
+ int pst = curenemy - lastnpc - 1;
+ rcDest.x = postinfo[pst][0];
+ rcDest.y = (float)(postinfo[pst][1] - 4 - sin(3.141592 / 8 * itemyloc));
+ } else {
+ rcDest.x = npcinfo[curenemy].x + 4;
+ rcDest.y = (float)(npcinfo[curenemy].y + 4 - 16 - sin(3.141592 / 8 * itemyloc));
+ }
+
+ SDL_BlitSurface(itemimg[13], NULL, videobuffer, &rcDest);
+ }
+}
+
+void game_drawnpcs(int mode)
+{
+ unsigned int ccc;
+
+ ccc = SDL_MapRGB(videobuffer->format, 255, 128, 32);
+
+ int fst = firsty;
+ int lst = lasty;
+
+ if(mode == 0) lst = player.ysort;
+ if(mode == 1) fst = player.ysort;
+
+ for(int yy = fst; yy <= lst; yy++) {
+
+ if(ysort[yy] > 0) {
+ int i = ysort[yy];
+
+ if(npcinfo[i].hp > 0) {
+ int npx = (int)(npcinfo[i].x);
+ int npy = (int)(npcinfo[i].y);
+
+ int sprite = npcinfo[i].spriteset;
+
+ int wdir = npcinfo[i].walkdir;
+
+ // spriteset1 specific
+ if(npcinfo[i].spriteset == 1) {
+
+ if(npcinfo[i].attacking == 0) {
+
+ int cframe = npcinfo[i].cframe;
+
+ rcSrc.x = (int)(cframe / 4) * 24;
+ rcSrc.y = wdir * 24;
+ rcSrc.w = 24;
+ rcSrc.h = 24;
+
+ rcDest.x = npx;
+ rcDest.y = npy;
+ rcDest.w = 24;
+ rcDest.h = 24;
+
+ if(npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
+ npcinfo[i].shake = ticks + 50;
+ rcDest.x = rcDest.x + (int)(RND() * 3) - 1;
+ rcDest.y = rcDest.y + (int)(RND() * 3) - 1;
+ }
+
+ SDL_BlitSurface(anims[sprite], &rcSrc, videobuffer, &rcDest);
+ } else {
+ int cframe = npcinfo[i].cattackframe;
+
+ rcSrc.x = (int)(cframe / 4) * 24;
+ rcSrc.y = wdir * 24;
+ rcSrc.w = 24;
+ rcSrc.h = 24;
+
+ rcDest.x = npx;
+ rcDest.y = npy;
+ rcDest.w = 24;
+ rcDest.h = 24;
+
+ SDL_BlitSurface(animsa[sprite], &rcSrc, videobuffer, &rcDest);
+ }
+
+ }
+
+ // onewing
+ if(npcinfo[i].spriteset == 2) {
+ for(int f = 0; f <= 7; f++) {
+ int s = npcinfo[i].bodysection[f].sprite;
+ rcSrc.x = animset2[s].x;
+ rcSrc.y = animset2[s].y;
+ rcSrc.w = animset2[s].w;
+ rcSrc.h = animset2[s].h;
+
+ rcDest.x = npcinfo[i].bodysection[f].x - animset2[s].xofs;
+ rcDest.y = npcinfo[i].bodysection[f].y - animset2[s].yofs + 2;
+
+ SDL_BlitSurface(anims[2], &rcSrc, videobuffer, &rcDest);
+ }
+
+ }
+
+ // twowing
+ if(npcinfo[i].spriteset == 9) {
+ for(int f = 0; f <= 7; f++) {
+ int yp = 0;
+
+ if(f == 0 && (curmap == 53 || curmap == 57 || curmap == 61 || curmap == 65 || curmap == 56 || curmap > 66) && scriptflag[60][0] > 0) yp = 16;
+ int s = npcinfo[i].bodysection[f].sprite;
+ rcSrc.x = animset9[s].x;
+ rcSrc.y = animset9[s].y + yp;
+ rcSrc.w = animset9[s].w;
+ rcSrc.h = animset9[s].h;
+
+ rcDest.x = npcinfo[i].bodysection[f].x - animset9[s].xofs;
+ rcDest.y = npcinfo[i].bodysection[f].y - animset9[s].yofs + 2;
+
+ SDL_BlitSurface(anims[9], &rcSrc, videobuffer, &rcDest);
+ }
+
+ }
+
+
+ // boss 1
+ if(npcinfo[i].spriteset == 3) {
+ if(npcinfo[i].attacking == 0) {
+ int cframe = npcinfo[i].cframe;
+
+ rcSrc.x = (int)(cframe / 4) * 24;
+ rcSrc.y = 0;
+ rcSrc.w = 24;
+ rcSrc.h = 48;
+
+ rcDest.x = npx - 2;
+ rcDest.y = npy - 24;
+
+ SDL_BlitSurface(anims[3], &rcSrc, videobuffer, &rcDest);
+ } else {
+ rcSrc.x = 4 * 24;
+ rcSrc.y = 0;
+ rcSrc.w = 24;
+ rcSrc.h = 48;
+
+ rcDest.x = npx - 2;
+ rcDest.y = npy - 24;
+
+ SDL_BlitSurface(anims[3], &rcSrc, videobuffer, &rcDest);
+ }
+
+ }
+
+ // black knight
+ if(npcinfo[i].spriteset == 4) {
+ if(npcinfo[i].attacking == 0) {
+ int cframe = npcinfo[i].cframe;
+
+ rcSrc.x = (int)(cframe / 4) * 24;
+ rcSrc.y = 0;
+ rcSrc.w = 24;
+ rcSrc.h = 48;
+
+ rcDest.x = npx - 2;
+ rcDest.y = npy - 24;
+
+ SDL_BlitSurface(anims[4], &rcSrc, videobuffer, &rcDest);
+ } else {
+ rcSrc.x = 4 * 24;
+ rcSrc.y = 0;
+ rcSrc.w = 24;
+ rcSrc.h = 48;
+
+ rcDest.x = npx - 2;
+ rcDest.y = npy - 24;
+
+ SDL_BlitSurface(anims[4], &rcSrc, videobuffer, &rcDest);
+ }
+ }
+
+
+ // firehydra
+ if(npcinfo[i].spriteset == 5) {
+ for(int ff = 0; ff <= 2; ff++) {
+ if(npcinfo[i].hp > 10 * ff * 20) {
+ rcSrc.x = 16 * (int)(RND() * 2);
+ rcSrc.y = 80;
+ rcSrc.w = 16;
+ rcSrc.h = 16;
+
+ rcDest.x = npcinfo[i].bodysection[10 * ff].x - 8;
+ rcDest.y = npcinfo[i].bodysection[10 * ff].y - 8;
+
+ int x = 192 + ((int)(itemyloc + ff * 5) % 3) * 64;
+ if(x > 255) x = 255;
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, x);
+ SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
+
+ for(int f = 1; f <= 8; f++) {
+ rcSrc.x = 16 * (int)(RND() * 2);
+ rcSrc.y = 80;
+ rcSrc.w = 16;
+ rcSrc.h = 16;
+
+ rcDest.x = npcinfo[i].bodysection[ff * 10 + f].x - 8 + (int)(RND() * 3) - 1;
+ rcDest.y = npcinfo[i].bodysection[ff * 10 + f].y - 8 + (int)(RND() * 3) - 1;
+
+ x = 192 + f % 3 * 64;
+ if(x > 255) x = 255;
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, x);
+ SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
+ }
+
+ rcSrc.x = 0;
+ rcSrc.y = 0;
+ rcSrc.w = 42;
+ rcSrc.h = 36;
+
+ rcDest.x = npcinfo[i].bodysection[10 * ff + 9].x - 21;
+ rcDest.y = npcinfo[i].bodysection[10 * ff + 9].y - 21;
+
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, 192);
+ SDL_BlitSurface(anims[5], &rcSrc, videobuffer, &rcDest);
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
+
+ }
+
+ }
+
+ }
+
+ // red dragon
+ if(npcinfo[i].spriteset == 6) {
+ int cframe = npcinfo[i].cframe;
+
+ rcSrc.x = (int)(cframe / 4) * 24;
+ rcSrc.y = wdir * 24;
+ rcSrc.w = 24;
+ rcSrc.h = 24;
+
+ rcDest.x = npx;
+ rcDest.y = npy;
+ rcDest.w = 24;
+ rcDest.h = 24;
+
+ if(npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
+ npcinfo[i].shake = ticks + 50;
+ rcDest.x = rcDest.x + (int)(RND() * 3) - 1;
+ rcDest.y = rcDest.y + (int)(RND() * 3) - 1;
+ }
+
+ SDL_BlitSurface(anims[sprite], &rcSrc, videobuffer, &rcDest);
+ }
+
+ // wizard
+ if(npcinfo[i].spriteset == 7) {
+ // if(npcinfo[i].attacking == 0) {
+ int cframe = npcinfo[i].cframe;
+
+ rcSrc.x = (int)(cframe / 4) * 24;
+ rcSrc.y = wdir * 24;
+ rcSrc.w = 24;
+ rcSrc.h = 24;
+
+ rcDest.x = npx;
+ rcDest.y = npy;
+ rcDest.w = 24;
+ rcDest.h = 24;
+
+ if(npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
+ npcinfo[i].shake = ticks + 50;
+ rcDest.x = rcDest.x + (int)(RND() * 3) - 1;
+ rcDest.y = rcDest.y + (int)(RND() * 3) - 1;
+ }
+ SDL_BlitSurface(anims[sprite], &rcSrc, videobuffer, &rcDest);
+ // } else {
+ //cframe = npcinfo[i].cattackframe;
+
+ //rcSrc.x = (int)(cframe / 4) * 24;
+ //rcSrc.y = wdir * 24;
+ //rcSrc.w = 24;
+ //rcSrc.h = 24;
+
+ //rcDest.x = npx;
+ //rcDest.y = npy;
+ //rcDest.w = 24;
+ //rcDest.h = 24;
+ // SDL_BlitSurface(animsa(sprite), &rcSrc, videobuffer, &rcDest);
+ // }
+ }
+
+
+ // yellow dragon
+ if(npcinfo[i].spriteset == 8) {
+ int cframe = npcinfo[i].cframe;
+
+ rcSrc.x = (int)(cframe / 4) * 24;
+ rcSrc.y = wdir * 24;
+ rcSrc.w = 24;
+ rcSrc.h = 24;
+
+ rcDest.x = npx;
+ rcDest.y = npy;
+ rcDest.w = 24;
+ rcDest.h = 24;
+
+ if(npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
+ npcinfo[i].shake = ticks + 50;
+ rcDest.x = rcDest.x + (int)(RND() * 3) - 1;
+ rcDest.y = rcDest.y + (int)(RND() * 3) - 1;
+ }
+ SDL_BlitSurface(anims[sprite], &rcSrc, videobuffer, &rcDest);
+ }
+
+
+ // dragon2
+ if(npcinfo[i].spriteset == 10) {
+ if(npcinfo[i].attacking == 0) {
+ npcinfo[i].floating = npcinfo[i].floating + 0.25 * fpsr;
+ while(npcinfo[i].floating >= 16) npcinfo[i].floating = npcinfo[i].floating - 16;
+
+ float frame = npcinfo[i].frame;
+ int cframe = npcinfo[i].cframe;
+
+ frame = frame + 0.5 * fpsr;
+ while(frame >= 16)
+ frame = frame - 16;
+
+ cframe = (int)(frame);
+ if(cframe > 16) cframe = 16 - 1;
+ if(cframe < 0) cframe = 0;
+
+ npcinfo[i].frame = frame;
+ npcinfo[i].cframe = cframe;
+
+ cframe = npcinfo[i].cframe;
+
+ rcSrc.x = 74 * wdir;
+ rcSrc.y = (int)(cframe / 4) * 48;
+ rcSrc.w = 74;
+ rcSrc.h = 48;
+
+ rcDest.x = npx + 12 - 37;
+ rcDest.y = (float)(npy + 12 - 32 - 3 * sin(3.141592 * 2 * npcinfo[i].floating / 16));
+ rcDest.w = 24;
+ rcDest.h = 24;
+
+ if(npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
+ npcinfo[i].shake = ticks + 50;
+ rcDest.x = rcDest.x + (int)(RND() * 3) - 1;
+ rcDest.y = rcDest.y + (int)(RND() * 3) - 1;
+ }
+
+ SDL_BlitSurface(anims[sprite], &rcSrc, videobuffer, &rcDest);
+ } else {
+ npcinfo[i].floating = npcinfo[i].floating + 0.25 * fpsr;
+ while(npcinfo[i].floating >= 16) npcinfo[i].floating = npcinfo[i].floating - 16;
+
+ int cframe = npcinfo[i].cattackframe;
+
+ rcSrc.x = 74 * wdir;
+ rcSrc.y = (int)(cframe / 4) * 48;
+ rcSrc.w = 74;
+ rcSrc.h = 48;
+
+ rcDest.x = npx + 12 - 37;
+ rcDest.y = (float)(npy + 12 - 32 - 3 * sin(3.141592 * 2 * npcinfo[i].floating / 16));
+ rcDest.w = 24;
+ rcDest.h = 24;
+
+ SDL_BlitSurface(animsa[sprite], &rcSrc, videobuffer, &rcDest);
+ }
+ }
+
+ // end boss
+ if(npcinfo[i].spriteset == 11) {
+
+ npcinfo[i].floating = npcinfo[i].floating + .3 * fpsr;
+ while(npcinfo[i].floating >= 16) npcinfo[i].floating = npcinfo[i].floating - 16;
+
+
+ float frame = npcinfo[i].frame2;
+
+ frame = frame + 0.5 * fpsr;
+ while(frame >= 16)
+ frame = frame - 16;
+
+ npcinfo[i].frame2 = frame;
+
+ int sx = npx + 12 - 40;
+ int sy = (float)(npy + 12 - 50 - 3 * sin(3.141592 * 2 * npcinfo[i].floating / 16));
+
+ for(int fr = 0; fr <= 3; fr++) {
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, 128 + (int)(RND() * 96));
+
+ rcSrc.x = 16 * (int)(RND() * 2);
+ rcSrc.y = 80;
+ rcSrc.w = 16;
+ rcSrc.h = 16;
+
+ rcDest.x = sx + 32 + (int)(RND() * 3) - 1;
+ rcDest.y = sy - (int)(RND() * 6);
+
+ SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+ }
+
+ for(int ii = 0; ii <= 8; ii++) {
+ for(int i2 = 0; i2 <= 3; i2++) {
+ rcSrc.x = 16 * (int)(RND() * 2);
+ rcSrc.y = 80;
+ rcSrc.w = 16;
+ rcSrc.h = 16;
+
+ float fr3 = frame - 3 + i2;
+ if(fr3 < 0) fr3 = fr3 + 16;
+
+ rcDest.x = (float)(sx + 36 + ii * 8 - ii * cos(3.14159 * 2 * (fr3 - ii) / 16) * 2);
+ rcDest.y = (float)(sy + 16 + ii * sin(3.14159 * 2 * (fr3 - ii) / 16) * 3 - ii); // * 4
+
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, i2 / 3 * 224);
+
+ SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+
+ int xloc = rcDest.x;
+ int yloc = rcDest.y;
+ int xdif = (xloc + 8) - (player.px + 12);
+ int ydif = (yloc + 8) - (player.py + 12);
+
+ if((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks) {
+ float damage = (float)npcinfo[i].spelldamage * (1.0 + RND() * 0.5);
+
+ if(player.hp > 0) {
+ game_damageplayer(damage);
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndfire], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+ }
+
+ }
+
+
+ rcDest.x = (float)(sx + 36 - ii * 8 + ii * cos(3.14159 * 2 * (fr3 - ii) / 16) * 2);
+ rcDest.y = (float)(sy + 16 + ii * sin(3.14159 * 2 * (fr3 - ii) / 16) * 3 - ii); // * 4
+
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, i2 / 3 * 224);
+
+ SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+
+ xloc = rcDest.x;
+ yloc = rcDest.y;
+ xdif = (xloc + 8) - (player.px + 12);
+ ydif = (yloc + 8) - (player.py + 12);
+
+ if((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks) {
+ float damage = (float)npcinfo[i].spelldamage * (1.0 + RND() * 0.5);
+
+ if(player.hp > 0) {
+ game_damageplayer(damage);
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndfire], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+ }
+ }
+ }
+ }
+
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
+
+ if(npcinfo[i].attacking == 0) {
+ int cframe = (int)(frame);
+ rcSrc.x = 0;
+ rcSrc.y = 72 * (int)(cframe / 4);
+ rcSrc.w = 80;
+ rcSrc.h = 72;
+
+ rcDest.x = sx;
+ rcDest.y = sy;
+
+ if(npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
+ npcinfo[i].shake = ticks + 50;
+ rcDest.x = rcDest.x + (int)(RND() * 3) - 1;
+ rcDest.y = rcDest.y + (int)(RND() * 3) - 1;
+ }
+
+ SDL_BlitSurface(anims[sprite], &rcSrc, videobuffer, &rcDest);
+ } else {
+ int cframe = (int)(npcinfo[i].cattackframe);
+
+ rcSrc.x = 0;
+ rcSrc.y = 72 * (int)(cframe / 4);
+ rcSrc.w = 80;
+ rcSrc.h = 72;
+
+ rcDest.x = sx;
+ rcDest.y = sy;
+
+ SDL_BlitSurface(animsa[sprite], &rcSrc, videobuffer, &rcDest);
+ }
+ }
+
+ // bat kitty
+ if(npcinfo[i].spriteset == 12) {
+ npcinfo[i].floating = npcinfo[i].floating + 1 * fpsr;
+ while(npcinfo[i].floating >= 16) npcinfo[i].floating = npcinfo[i].floating - 16;
+
+ float frame = npcinfo[i].frame;
+ int cframe = npcinfo[i].cframe;
+
+ frame = frame + 0.5 * fpsr;
+ while(frame >= 16)
+ frame = frame - 16;
+
+ cframe = (int)(frame);
+ if(cframe > 16) cframe = 16 - 1;
+ if(cframe < 0) cframe = 0;
+
+ npcinfo[i].frame = frame;
+ npcinfo[i].cframe = cframe;
+
+ cframe = npcinfo[i].cframe;
+
+ rcSrc.x = 0;
+ rcSrc.y = 0;
+ rcSrc.w = 99;
+ rcSrc.h = 80;
+
+ rcDest.x = npx + 12 - 50;
+ rcDest.y = (float)(npy + 12 - 64 + 2 * sin(3.141592 * 2 * npcinfo[i].floating / 16));
+ rcDest.w = 99;
+ rcDest.h = 80;
+
+ if(npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
+ npcinfo[i].shake = ticks + 50;
+ rcDest.x = rcDest.x + (int)(RND() * 3) - 1;
+ rcDest.y = rcDest.y + (int)(RND() * 3) - 1;
+ }
+
+ SDL_BlitSurface(anims[sprite], &rcSrc, videobuffer, &rcDest);
+ }
+
+ rcDest.x = npx + 4;
+ rcDest.y = npy + 22;
+ rcDest.w = 16;
+ rcDest.h = 4;
+
+ SDL_FillRect(videobuffer, &rcDest, 0);
+
+ rcDest.x = npx + 5;
+ rcDest.y = npy + 23;
+
+
+ int ww = 14 * npcinfo[i].hp / npcinfo[i].maxhp;
+ if(ww > 14) ww = 14;
+ if(ww < 1) ww = 1;
+
+ rcDest.w = ww;
+ rcDest.h = 2;
+
+
+ SDL_FillRect(videobuffer, &rcDest, ccc);
+
+ int pass = 1;
+
+ if(npcinfo[i].spriteset == 3) pass = 0;
+ if(pass == 1) game_drawover(npx, npy);
+
+ }
+ }
+ }
+}
+
+void game_drawover(int modx, int mody)
+{
+ int npx = modx + 12;
+ int npy = mody + 20;
+
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
+
+ for(int xo = -1; xo <= 1; xo++) {
+ for(int yo = -1; yo <= 1; yo++) {
+
+ int sx = lx + xo;
+ int sy = ly + yo;
+
+ int sx2 = sx * 16;
+ int sy2 = sy * 16;
+
+ if(sx > -1 && sx < 40 && sy > -1 && sy < 24) {
+
+ int curtile = tileinfo[2][sx][sy][0];
+ int curtilel = tileinfo[2][sx][sy][1];
+
+ if(curtile > 0) {
+ curtile = curtile - 1;
+ int curtilex = curtile % 20;
+ int curtiley = (curtile - curtilex) / 20;
+
+ rcSrc.x = curtilex * 16;
+ rcSrc.y = curtiley * 16;
+ rcSrc.w = 16;
+ rcSrc.h = 16;
+
+ rcDest.x = sx2;
+ rcDest.y = sy2;
+ rcDest.w = 16;
+ rcDest.h = 16;
+
+ int pass = 1;
+ if(curtilel == 1) {
+ for(int ff = 0; ff <= 5; ff++) {
+ int ffa = 20 * 5 - 1 + ff * 20;
+ int ffb = 20 * 5 + 4 + ff * 20;
+ if(curtile > ffa && curtile < ffb) pass = 0;
+ }
+ }
+
+ if(pass == 1) SDL_BlitSurface(tiles[curtilel], &rcSrc, videobuffer, &rcDest);
+ }
+ }
+ }
+ }
+}
+
+void game_drawplayer()
+{
+ long ccc;
+
+ int f = 0;
+ if(player.armour == 3) f = 13;
+
+ if(attacking == 0) {
+ rcSrc.x = (int)(player.walkframe / 4) * 24;
+ rcSrc.y = player.walkdir * 24;
+ rcSrc.w = 24;
+ rcSrc.h = 24;
+
+ rcDest.x = (int)(player.px);
+ rcDest.y = (int)(player.py);
+ rcDest.w = 24;
+ rcDest.h = 24;
+
+ SDL_BlitSurface(anims[f], &rcSrc, videobuffer, &rcDest);
+ } else {
+ rcSrc.x = (int)(player.attackframe / 4) * 24;
+ rcSrc.y = player.walkdir * 24;
+ rcSrc.w = 24;
+ rcSrc.h = 24;
+
+ rcDest.x = (int)(player.px);
+ rcDest.y = (int)(player.py);
+ rcDest.w = 24;
+ rcDest.h = 24;
+
+ SDL_BlitSurface(animsa[f], &rcSrc, videobuffer, &rcDest);
+
+ }
+
+ ccc = SDL_MapRGB(videobuffer->format, 224, 224, 64);
+
+ int pass = 0;
+ if(player.hp <= player.maxhp * 0.25) pass = 1;
+
+ if(pass == 1) {
+ ccc = SDL_MapRGB(videobuffer->format, 255, 255, 255);
+ if((int)(player.hpflash) == 1) ccc = SDL_MapRGB(videobuffer->format, 255, 0, 0);
+ }
+
+ int sss = 6;
+ if(player.foundspell[0]) sss = 8;
+ int npx = player.px;
+ int npy = player.py;
+ rcDest.x = npx + 4;
+ rcDest.y = npy + 22;
+ rcDest.w = 16;
+ rcDest.h = sss;
+
+ SDL_FillRect(videobuffer, &rcDest, 0);
+
+ rcDest.x = npx + 5;
+ rcDest.y = npy + 23;
+
+
+ int ww = 14 * player.hp / player.maxhp;
+ if(ww > 14) ww = 14;
+ if(ww < 1) ww = 1;
+
+ rcDest.w = ww;
+ rcDest.h = 2;
+
+ SDL_FillRect(videobuffer, &rcDest, ccc);
+
+ ccc = SDL_MapRGB(videobuffer->format, 0, 224, 64);
+ if(player.attackstrength == 100) ccc = SDL_MapRGB(videobuffer->format, 255, 128, 32);
+
+ ww = 14 * player.attackstrength / 100;
+ if(ww > 14) ww = 14;
+
+ int ww2 = 14 * player.spellstrength / 100;
+ if(ww2 > 14) ww2 = 14;
+
+ rcDest.w = ww;
+ rcDest.h = 2;
+ rcDest.y = rcDest.y + 2;
+
+ SDL_FillRect(videobuffer, &rcDest, ccc);
+
+ ccc = SDL_MapRGB(videobuffer->format, 128, 0, 224);
+ if(player.spellstrength == 100) ccc = SDL_MapRGB(videobuffer->format, 224, 0, 0);
+
+ rcDest.w = ww2;
+ rcDest.h = 2;
+ rcDest.y = rcDest.y + 2;
+
+ SDL_FillRect(videobuffer, &rcDest, ccc);
+}
+
+void game_drawview()
+{
+ SDL_Rect rc;
+
+ SDL_BlitSurface(mapbg, NULL, videobuffer, NULL);
+
+ game_updspellsunder();
+
+ game_drawanims(0);
+
+ // ------dontdrawover = special case to make boss work right in room 24
+ if(dontdrawover == 1) game_drawanims(1);
+ game_drawnpcs(0);
+
+ game_drawplayer();
+
+ game_drawnpcs(1);
+ if(dontdrawover == 0) game_drawanims(1);
+
+ game_drawover((int)player.px, (int)player.py);
+
+ game_updspells();
+
+ if(cloudson == 1) {
+ rc.x = (float)(256 + 256 * cos(3.141592 / 180 * clouddeg));
+ rc.y = (float)(192 + 192 * sin(3.141592 / 180 * clouddeg));
+ rc.w = 320;
+ rc.h = 240;
+
+ SDL_BlitSurface(cloudimg, &rc, videobuffer, NULL);
+ }
+
+ game_drawhud();
+
+ SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
+}
+
+void game_endofgame()
+{
+ float xofs = 0;
+ int ticks1;
+
+ ticks = SDL_GetTicks();
+
+ float spd = 0.2;
+
+ if(menabled == 1 && config.music == 1) {
+ Mix_HaltChannel(-1);
+ musicchannel = Mix_PlayChannel(-1, mendofgame, -1);
+ Mix_Volume(musicchannel, 0);
+ }
+
+ ticks1 = ticks;
+ int ya = 0;
+
+ SDL_FillRect(videobuffer2, NULL, 0);
+ SDL_FillRect(videobuffer3, NULL, 0);
+ SDL_BlitSurface(videobuffer, NULL, videobuffer2, NULL);
+
+ float ld = 0;
+ int ldstop = 0;
+
+ do {
+ ld = ld + 4 * fpsr;
+ if(ld > config.musicvol) ld = config.musicvol;
+ if(menabled == 1 && ldstop == 0) {
+ Mix_Volume(musicchannel, (int)ld);
+ if((int)ld == config.musicvol) ldstop = 1;
+ }
+
+ ya = 0;
+ if(ticks < ticks1 + 1500) {
+ ya = (255 * (ticks - ticks1)) / 1500;
+ if(ya < 0) ya = 0;
+ if(ya > 255) ya = 255;
+ } else {
+ break;
+ }
+
+ SDL_FillRect(videobuffer, NULL, 0);
+
+ SDL_SetAlpha(videobuffer, SDL_SRCALPHA, ya);
+ SDL_BlitSurface(videobuffer2, NULL, videobuffer3, NULL);
+ SDL_BlitSurface(videobuffer, NULL, videobuffer3, NULL);
+ SDL_BlitSurface(videobuffer3, NULL, video, NULL);
+ SDL_SetAlpha(videobuffer, SDL_SRCALPHA, 255);
+
+ SDL_Flip(video);
+ SDL_PumpEvents();
+
+ tickspassed = ticks;
+ ticks = SDL_GetTicks();
+
+ tickspassed = ticks - tickspassed;
+ fpsr = (float)tickspassed / 24;
+
+ fp++;
+ if(ticks > nextticks) {
+ nextticks = ticks + 1000;
+ fps = fp;
+ fp = 0;
+ }
+ } while(1);
+
+ ticks1 = ticks;
+ ya = 0;
+ float y = 140;
+
+ do {
+ SDL_Rect rc;
+
+ rc.x = -xofs;
+ rc.y = 0;
+
+ SDL_BlitSurface(titleimg, NULL, videobuffer, &rc);
+
+ rc.x = -xofs + 320;
+ rc.y = 0;
+
+ SDL_BlitSurface(titleimg, NULL, videobuffer, &rc);
+
+ y = y - spd * fpsr;
+ for(int i = 0; i <= 26; i++) {
+ int yy = y + i * 10;
+ if(yy > -8 && yy < 240) {
+ int x = 160 - strlen(story2[i]) * 4;
+ sys_print(videobuffer, story2[i], x, yy, 4);
+ }
+
+ if(yy < 10 && i == 25) break;
+ }
+
+ int ya = 255;
+ if(ticks < ticks1 + 1000) {
+ ya = 255 * (ticks - ticks1) / 1000;
+ if(ya < 0) ya = 0;
+ if(ya > 255) ya = 255;
+ }
+
+ SDL_SetAlpha(videobuffer, SDL_SRCALPHA, ya);
+ SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
+ SDL_SetAlpha(videobuffer, SDL_SRCALPHA, 255);
+
+ SDL_Flip(video);
+ SDL_PumpEvents();
+
+ tickspassed = ticks;
+ ticks = SDL_GetTicks();
+
+ tickspassed = ticks - tickspassed;
+ fpsr = (float)tickspassed / 24;
+
+ fp++;
+ if(ticks > nextticks) {
+ nextticks = ticks + 1000;
+ fps = fp;
+ fp = 0;
+ }
+
+ float add = 0.5 * fpsr;
+ if(add > 1) add = 1;
+ xofs = xofs + add;
+ if(xofs >= 320) xofs = xofs - 320;
+
+ SDL_PollEvent(&event);
+ keys = SDL_GetKeyState(NULL);
+
+ if(event.type == SDL_KEYDOWN) spd = 1;
+ if(event.type == SDL_KEYUP) spd = 0.2;
+
+ if(keys[SDLK_ESCAPE] || keys[SDLK_LALT]) break;
+ } while(1);
+
+
+ ticks1 = ticks;
+ y = 0;
+
+ SDL_BlitSurface(videobuffer, NULL, videobuffer2, NULL);
+
+ do {
+ if(ticks < ticks1 + 1500) {
+ int y = 255 * (ticks - ticks1) / 1500;
+ if(y < 0) y = 0;
+ if(y > 255) y = 255;
+ else
+ break;
+ }
+
+ SDL_FillRect(videobuffer, NULL, 0);
+
+ SDL_SetAlpha(videobuffer, SDL_SRCALPHA, y);
+ SDL_BlitSurface(videobuffer2, NULL, videobuffer3, NULL);
+ SDL_BlitSurface(videobuffer, NULL, videobuffer3, NULL);
+ SDL_BlitSurface(videobuffer3, NULL, video, NULL);
+ SDL_SetAlpha(videobuffer, SDL_SRCALPHA, 255);
+
+ SDL_Flip(video);
+ SDL_PumpEvents();
+
+ tickspassed = ticks;
+ ticks = SDL_GetTicks();
+
+ tickspassed = ticks - tickspassed;
+ fpsr = (float)tickspassed / 24;
+
+ fp++;
+ if(ticks > nextticks) {
+ nextticks = ticks + 1000;
+ fps = fp;
+ fp = 0;
+ }
+ } while(1);
+
+
+ int keywait = 2000 + ticks;
+
+ ticks1 = ticks;
+ y = 0;
+ do {
+
+ SDL_BlitSurface(theendimg, NULL, videobuffer, NULL);
+
+ y = 255;
+ if(ticks < ticks1 + 1000) {
+ y = 255 * (ticks - ticks1) / 1000;
+ if(y < 0) y = 0;
+ if(y > 255) y = 255;
+ }
+
+ SDL_SetAlpha(videobuffer, SDL_SRCALPHA, y);
+ SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
+ SDL_SetAlpha(videobuffer, SDL_SRCALPHA, 255);
+
+ SDL_Flip(video);
+ SDL_PumpEvents();
+
+ tickspassed = ticks;
+ ticks = SDL_GetTicks();
+
+ tickspassed = ticks - tickspassed;
+ fpsr = (float)tickspassed / 24;
+
+ fp++;
+ if(ticks > nextticks) {
+ nextticks = ticks + 1000;
+ fps = fp;
+ fp = 0;
+ }
+
+ SDL_PollEvent(&event);
+ keys = SDL_GetKeyState(NULL);
+
+ if(event.type == SDL_KEYDOWN && keywait < ticks) break;
+
+ } while(1);
+
+ SDL_FillRect(videobuffer2, NULL, 0);
+ SDL_FillRect(videobuffer3, NULL, 0);
+
+ game_theend();
+
+}
+
+void game_eventtext(char *stri)
+{
+ int x, fr, pauseticks, bticks;
+
+ SDL_FillRect(videobuffer2, NULL, 0);
+ SDL_FillRect(videobuffer3, NULL, 0);
+
+ x = 160 - 4 * strlen(stri);
+
+ ticks = SDL_GetTicks();
+ pauseticks = ticks + 500;
+ bticks = ticks;
+
+ SDL_BlitSurface(videobuffer, NULL, videobuffer3, NULL);
+ SDL_BlitSurface(videobuffer, NULL, videobuffer2, NULL);
+
+ do {
+ SDL_PollEvent(&event);
+ keys = SDL_GetKeyState(NULL);
+
+ if(event.type == SDL_KEYDOWN && pauseticks < ticks) break;
+ SDL_BlitSurface(videobuffer2, NULL, videobuffer, NULL);
+
+ fr = 192;
+
+ if(pauseticks > ticks) fr = 192 * (ticks - bticks) / 500;
+ if(fr > 192) fr = 192;
+
+ SDL_SetAlpha(windowimg, SDL_SRCALPHA, fr);
+
+ SDL_BlitSurface(windowimg, NULL, videobuffer, NULL);
+ if(pauseticks < ticks) sys_print(videobuffer, stri, x, 15, 0);
+
+ SDL_SetAlpha(windowimg, SDL_SRCALPHA, 255);
+ SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
+
+ SDL_Flip(video);
+ SDL_PumpEvents();
+
+ tickspassed = ticks;
+ ticks = SDL_GetTicks();
+
+ tickspassed = ticks - tickspassed;
+ fpsr = (float)tickspassed / 24.0;
+
+ fp++;
+ if(ticks > nextticks) {
+ nextticks = ticks + 1000;
+ fps = fp;
+ fp = 0;
+ }
+
+ SDL_Delay(10);
+ } while(1);
+
+ SDL_BlitSurface(videobuffer3, NULL, videobuffer, NULL);
+
+ itemticks = ticks + 210;
+}
+
+
+void game_handlewalking()
+{
+ unsigned int *temp/*, c*/, bgc;
+ float spd, /*ppx, ppy,*/ px, py, opx, opy;
+ float nx, ny, npx, npy;
+
+ int xmax = 20 * 16 - 25;
+ int ymax = 15 * 16 - 25;
+
+ px = player.px;
+ py = player.py;
+ opx = px;
+ opy = py;
+
+ spd = player.walkspd * fpsr;
+
+ nx = (px / 2 + 6);
+ ny = (py / 2 + 10);
+
+ npx = px + 12;
+ npy = py + 20;
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
+
+ int ramp = rampdata[lx][ly];
+ if(ramp == 1 && movingup) spd = spd * 2;
+ if(ramp == 1 && movingdown) spd = spd * 2;
+
+ if(ramp == 2 && movingleft) movingup = 1;
+ if(ramp == 2 && movingright) movingdown = 1;
+
+ if(ramp == 3 && movingright) movingup = 1;
+ if(ramp == 3 && movingleft) movingdown = 1;
+
+ for(int x = -1; x <= 1; x++) {
+ for(int y = -1; y <= 1; y++) {
+ int sx = nx + x;
+ int sy = ny + y;
+
+ clipsurround[x + 1][y + 1] = 0;
+ if(sx > -1 && sx < 320 && sy > -1 && sy < 192) {
+ temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ clipsurround[x + 1][y + 1] = *temp;
+ }
+ }
+ }
+
+ if(movingup) player.walkdir = 0;
+ if(movingdown) player.walkdir = 1;
+ if(movingleft) player.walkdir = 2;
+ if(movingright) player.walkdir = 3;
+
+ if(movingup && clipsurround[1][0] == 0) {
+ py = py - spd;
+ player.walkdir = 0;
+ } else if(movingup && clipsurround[1][0] > 0) {
+ // move upleft
+ if(movingright == 0 && clipsurround[0][0] == 0) {
+ py = py - spd;
+ px = px - spd;
+ }
+
+ // move upright
+ if(movingleft == 0 && clipsurround[2][0] == 0) {
+ py = py - spd;
+ px = px + spd;
+ }
+ }
+ if(movingdown && clipsurround[1][2] == 0) {
+ py = py + spd;
+ player.walkdir = 1;
+ } else if(movingdown && clipsurround[1][2] > 0) {
+ // move downleft
+ if(movingright == 0 && clipsurround[0][2] == 0) {
+ py = py + spd;
+ px = px - spd;
+ }
+
+ // move downright
+ if(movingleft == 0 && clipsurround[2][2] == 0) {
+ py = py + spd;
+ px = px + spd;
+ }
+ }
+ if(movingleft && clipsurround[0][1] == 0) {
+ px = px - spd;
+ player.walkdir = 2;
+ } else if(movingleft && clipsurround[0][1] > 0) {
+ // move leftup
+ if(movingdown == 0 && clipsurround[0][0] == 0) {
+ py = py - spd;
+ px = px - spd;
+ }
+
+ // move leftdown
+ if(movingup == 0 && clipsurround[0][2] == 0) {
+ py = py + spd;
+ px = px - spd;
+ }
+ }
+ if(movingright && clipsurround[2][1] == 0) {
+ px = px + spd;
+ player.walkdir = 3;
+ } else if(movingright && clipsurround[2][1] > 0) {
+ // move rightup
+ if(movingdown == 0 && clipsurround[2][0] == 0) {
+ px = px + spd;
+ py = py - spd;
+ }
+
+ // move rightdown
+ if(movingup == 0 && clipsurround[2][2] == 0) {
+ py = py + spd;
+ px = px + spd;
+ }
+ }
+
+ if(px < -8) px = -8;
+ if(px > xmax) px = xmax;
+ if(py < -8) py = -8;
+ if(py > ymax) py = ymax;
+
+ int pass = 1;
+
+ int sx = (px / 2 + 6);
+ int sy = (py / 2 + 10);
+ temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ bgc = *temp;
+ if(bgc > 0 && bgc != 1000) {
+ px = opx;
+ py = opy;
+ pass = 0;
+ }
+
+ // push npc
+ if(pass == 1) {
+ for(int i = 1; i <= lastnpc; i++) {
+ if(npcinfo[i].hp > 0) {
+ npx = npcinfo[i].x;
+ npy = npcinfo[i].y;
+
+ opx = npx;
+ opy = npy;
+
+ int xdif = player.px - npx;
+ int ydif = player.py - npy;
+
+ if(player.walkdir == 0) {
+ if(abs(xdif) <= 8 && ydif > 0 && ydif < 8) npcinfo[i].y = npcinfo[i].y - spd;
+ } else if(player.walkdir == 1) {
+ if(abs(xdif) <= 8 && ydif < 0 && ydif > -8) npcinfo[i].y = npcinfo[i].y + spd;
+ } else if(player.walkdir == 2) {
+ if(abs(ydif) <= 8 && xdif > 0 && xdif < 8) npcinfo[i].x = npcinfo[i].x - spd;
+ } else if(player.walkdir == 3) {
+ if(abs(ydif) <= 8 && xdif < 0 && xdif > -8) npcinfo[i].x = npcinfo[i].x + spd;
+ }
+
+ npx = npcinfo[i].x;
+ npy = npcinfo[i].y;
+
+ sx = (int)(npx / 2 + 6);
+ sy = (int)(npy / 2 + 10);
+ temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ bgc = *temp;
+
+ if(bgc > 0) {
+ npcinfo[i].x = opx;
+ npcinfo[i].y = opy;
+ }
+ }
+ }
+ }
+
+ player.opx = player.px;
+ player.opy = player.py;
+ player.px = px;
+ player.py = py;
+
+ if(player.px != player.opx || player.py != player.opy) player.walkframe = player.walkframe + animspd * fpsr;
+ if(player.walkframe >= 16) player.walkframe = player.walkframe - 16;
+
+ // walking over items to pickup :::
+ int o = objmap[lx][ly];
+
+ if(o > -1) {
+ // fsk
+ if(objectinfo[o][4] == 2 && player.inventory[INV_FLASK] < 9) {
+ objmap[lx][ly] = -1;
+
+ player.inventory[INV_FLASK]++;
+ game_addFloatIcon(6, lx * 16, ly * 16);
+
+ objmapf[curmap][lx][ly] = 1;
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+ }
+
+ if(objectinfo[o][5] == 7 && player.inventory[INV_DOUBLEFLASK] < 9) {
+ objmap[lx][ly] = -1;
+
+ player.inventory[INV_DOUBLEFLASK]++;
+ game_addFloatIcon(12, lx * 16, ly * 16);
+
+ objmapf[curmap][lx][ly] = 1;
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+ }
+
+ if(objectinfo[o][5] == 9 && player.inventory[INV_SHOCK] < 9 && (curmap == 41 && scriptflag[9][1] == 0)) {
+ objmap[lx][ly] = -1;
+
+ player.inventory[INV_SHOCK]++;
+ game_addFloatIcon(17, lx * 16, ly * 16);
+
+ objmapf[curmap][lx][ly] = 1;
+ if(curmap == 41) scriptflag[9][1] = 1;
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ }
+
+ if(objectinfo[o][5] == 9 && player.inventory[INV_SHOCK] < 9) {
+ objmap[lx][ly] = -1;
+
+ player.inventory[INV_SHOCK]++;
+ game_addFloatIcon(17, lx * 16, ly * 16);
+
+ objmapf[curmap][lx][ly] = 1;
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ }
+ }
+}
+
+void game_loadmap(int mapnum)
+{
+ unsigned int ccc;
+ SDL_Rect trect;
+ FILE *fp;
+ char name[256];
+ int tempmap[320][200];
+
+ ccc = SDL_MapRGB(clipbg->format, 255,255,255);
+
+ curmap = mapnum;
+
+ trect.x = 0;
+ trect.y = 0;
+ trect.w = 320;
+ trect.h = 240;
+ SDL_FillRect(mapbg, &trect, 0);
+ SDL_FillRect(clipbg, &trect, ccc);
+ SDL_FillRect(clipbg2, &trect, ccc);
+
+ forcepause = 0;
+ cloudson = 0;
+ if(mapnum < 6) cloudson = 1;
+ if(mapnum > 41) cloudson = 1;
+ if(mapnum > 47) cloudson = 0;
+ if(mapnum == 52) cloudson = 1;
+ if(mapnum == 60) cloudson = 1;
+ if(mapnum == 50) cloudson = 1;
+ if(mapnum == 54) cloudson = 1;
+ if(mapnum == 58) cloudson = 1;
+ if(mapnum == 62) cloudson = 1;
+ if(mapnum == 83) cloudson = 1;
+
+ // -----------special case
+ dontdrawover = 0;
+ if(mapnum == 24) dontdrawover = 1;
+
+ if((mapnum == 53 || mapnum == 57 || mapnum == 61 || mapnum == 65 || mapnum == 62) && scriptflag[60][0] > 0) mapnum = mapnum + 100;
+ if((mapnum == 161 || mapnum == 162) && scriptflag[60][0] == 2) mapnum = mapnum + 100;
+
+ for(int i = 0; i < MAXSPELL; i++)
+ spellinfo[i].frame = 0;
+
+ roomlock = 0;
+
+ // read *.map file
+ sprintf(name, "mapdb/%04i.map", mapnum); printf("Reading %s\n", name);
+ fp = fopen(name, "r");
+ for(int x = 0; x <= 319; x++)
+ for(int y = 0; y <= 199; y++) {
+ INPUT("%i", &tempmap[x][y]);
+ }
+ fclose(fp);
+
+ for(int x = 0; x <= 319; x++)
+ for(int y = 0; y <= 239; y++) {
+ triggerloc[x][y] = -1;
+ }
+
+ // read *.trg file
+ sprintf(name, "mapdb/%04i.trg", mapnum); printf("Reading %s\n", name);
+ fp = fopen(name, "r");
+
+ INPUT("%i", &ntriggers);
+
+ for(int i = 0; i < ntriggers; i++) {
+ int mapx, mapy, trig;
+
+ INPUT("%i", &mapx);
+ INPUT("%i", &mapy);
+ INPUT("%i", &trig);
+
+ triggerloc[mapx][mapy] = trig;
+ }
+ fclose(fp);
+
+
+ for(int y = 0; y <= 23; y++)
+ for(int x = 0; x <= 39; x++)
+ rampdata[x][y] = tempmap[3 * 40 + x][y + 40];
+
+
+ for(int y = 0; y <= 23; y++)
+ for(int x = 0; x <= 39; x++)
+ for(int l = 0; l <= 2; l++)
+ for(int a = 0; a <= 2; a++)
+ tileinfo[l][x][y][a] = 0;
+
+ if(scriptflag[4][0] == 1 && curmap == 4) {
+ triggerloc[9][7] = 5004;
+ tempmap[9][7] = 41;
+ tempmap[9][7 + 40] = 0;
+ }
+
+ for(int y = 0; y <= 23; y++) {
+ for(int x = 0; x <= 39; x++) {
+ for(int l = 0; l <= 2; l++) {
+ int lx, ly, curtile, curtilelayer;
+ int curtilel, curtilex, curtiley;
+ int ffa, ffb;
+
+ ly = y;
+ lx = x + l * 40;
+
+ // tile
+ curtile = tempmap[lx][ly];
+ curtilelayer = tempmap[lx][ly + 40];
+
+ if(curtile > 0) {
+ curtile = curtile - 1;
+ curtilel = curtilelayer;
+ curtilex = curtile % 20;
+ curtiley = (curtile - curtilex) / 20;
+
+ tileinfo[l][x][y][0] = curtile + 1;
+ tileinfo[l][x][y][1] = curtilelayer;
+
+ rcSrc.x = curtilex * 16;
+ rcSrc.y = curtiley * 16;
+ rcSrc.w = 16;
+ rcSrc.h = 16;
+
+ rcDest.x = x * 16;
+ rcDest.y = y * 16;
+ rcDest.w = 16;
+ rcDest.h = 16;
+
+ if(l == 2 && curtilel == 1) {
+ for(int ff = 0; ff <= 5; ff++) {
+ ffa = 20 * 5 - 1 + ff * 20;
+ ffb = 20 * 5 + 4 + ff * 20;
+ if(curtile > ffa && curtile < ffb) {
+ SDL_SetAlpha(tiles[curtilel], SDL_SRCALPHA, 128);
+ }
+ }
+ }
+ if(l == 1 && curtilel == 2) {
+ for(int ff = 0; ff <= 4; ff++) {
+ ffa = 20 * (5 + ff) + 3;
+ if(curtile == ffa) {
+ SDL_SetAlpha(tiles[curtilel], SDL_SRCALPHA, 192);
+ }
+ }
+ }
+
+ SDL_BlitSurface(tiles[curtilel], &rcSrc, mapbg, &rcDest);
+ SDL_SetAlpha(tiles[curtilel], SDL_SRCALPHA, 255);
+
+ rcDest.x = x * 8;
+ rcDest.y = y * 8;
+ rcDest.w = 8;
+ rcDest.h = 8;
+
+ SDL_FillRect(clipbg, &rcDest, 0);
+ }
+
+ }
+ }
+ }
+
+
+ for(int x = 0; x <= 39; x++) {
+ for(int y = 0; y <= 23; y++) {
+
+ int d = tempmap[3 * 40 + x][y];
+
+ int clip = 0;
+ int npc = 0;
+
+ if(scriptflag[4][0] == 1 && x == 9 && y == 7) d = 99;
+
+ if(d > 0) {
+ clip = d % 2;
+ d = (d - clip) / 2;
+ npc = d % 2;
+ d = (d - npc) / 2;
+
+ if(d == 99 && x == 9 && y == 7) clip = 1;
+
+ if(clip) {
+ if(d != 99) d = tempmap[6 * 40 + x][y];
+ if(d == 99) d = 1;
+
+ int x1 = x * 8;
+ int y1 = y * 8;
+
+ if(d == 1) {
+ for(int i = 0; i <= 7; i++) {
+ sys_line(clipbg, x1, y1 + i, x1 + 7 - i, y1 + i, ccc);
+ }
+ } else if(d == 2) {
+ sys_line(clipbg, x1, y1, x1 + 7, y1, ccc);
+ sys_line(clipbg, x1, y1 + 1, x1 + 7, y1 + 1, ccc);
+ } else if(d == 3) {
+ for(int i = 0; i <= 7; i++) {
+ sys_line(clipbg, x1 + i, y1 + i, x1 + 7, y1 + i, ccc);
+ }
+ } else if(d == 4) {
+ sys_line(clipbg, x1, y1, x1, y1 + 7, ccc);
+ sys_line(clipbg, x1 + 1, y1, x1 + 1, y1 + 7, ccc);
+ } else if(d == 5) {
+ rcDest.x = x1;
+ rcDest.y = y1;
+ rcDest.w = 8;
+ rcDest.h = 8;
+ SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ } else if(d == 6) {
+ sys_line(clipbg, x1 + 7, y1, x1 + 7, y1 + 7, ccc);
+ sys_line(clipbg, x1 + 6, y1, x1 + 6, y1 + 7, ccc);
+ } else if(d == 7) {
+ for(int i = 0; i <= 7; i++) {
+ sys_line(clipbg, x1, y1 + i, x1 + i, y1 + i, ccc);
+ }
+ } else if(d == 8) {
+ sys_line(clipbg, x1, y1 + 7, x1 + 7, y1 + 7, ccc);
+ sys_line(clipbg, x1, y1 + 7, x1 + 6, y1 + 6, ccc);
+ } else if(d == 9) {
+ for(int i = 0; i <= 7; i++) {
+ sys_line(clipbg, x1 + 7 - i, y1 + i, x1 + 7, y1 + i, ccc);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ lastobj = 0;
+ lastnpc = 0;
+
+ for(int i = 0; i < MAXNPC; i++)
+ npcinfo[i].onmap = 0;
+
+ for(int x = 0; x <= 19; x++) {
+ for(int y = 0; y <= 19; y++) {
+ int d = tempmap[3 * 40 + x][y];
+
+ int clip = 0;
+ int npc = 0;
+ int obj = 0;
+ if(d > 0) {
+ clip = d % 2;
+ d = (d - clip) / 2;
+ npc = d % 2;
+ d = (d - npc) / 2;
+ obj = d % 2;
+ }
+
+ objmap[x][y] = -1;
+
+ if(obj == 1) {
+
+ int o = tempmap[5 * 40 + x][y];
+
+ if(objmapf[curmap][x][y] == 0) {
+ objmap[x][y] = o;
+
+ if(objectinfo[o][0] > 1) {
+ if(o > lastobj) lastobj = o;
+ }
+
+ int x1 = x * 8;
+ int y1 = y * 8;
+
+ rcDest.x = x1;
+ rcDest.y = y1;
+ rcDest.w = 8;
+ rcDest.h = 8;
+
+ if(objectinfo[o][4] == 1) SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ if(objectinfo[o][4] == 3) SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ }
+ }
+ if(npc == 1) {
+ int o = tempmap[4 * 40 + x][y];
+
+ if(o > lastnpc) lastnpc = o;
+
+ npcinfo[o].x = x * 16 - 4;
+ npcinfo[o].y = y * 16 - 5;
+
+ npcinfo[o].walkdir = 1;
+ npcinfo[o].onmap = 1;
+ }
+ }
+ }
+
+
+ if(curmap == 62 && scriptflag[8][0] > 0) lastnpc = 0;
+ if(curmap == 73 && scriptflag[12][0] > 0) lastnpc = 0;
+ if(curmap == 81 && scriptflag[13][0] > 0) lastnpc = 0;
+
+ if(curmap == 73 && scriptflag[12][0] == 0) roomlock = 1;
+ if(curmap == 81 && scriptflag[13][0] == 0) roomlock = 1;
+ if(curmap == 83 && scriptflag[15][0] == 0) roomlock = 1;
+ if(curmap == 82) roomlock = 1;
+
+ // read *.npc file
+ sprintf(name, "mapdb/%04i.npc", mapnum); printf("Reading %s\n", name);
+ fp = fopen(name, "r");
+
+ for(int i = 0; i < MAXNPC; i++) {
+ INPUT("%i", &npcinfo[i].spriteset);
+ INPUT("%i", &npcinfo[i].x1);
+ INPUT("%i", &npcinfo[i].y1);
+ INPUT("%i", &npcinfo[i].x2);
+ INPUT("%i", &npcinfo[i].y2);
+ INPUT("%i", &npcinfo[i].movementmode);
+ INPUT("%i", &npcinfo[i].hp);
+ INPUT("%i", &npcinfo[i].item1);
+ INPUT("%i", &npcinfo[i].item2);
+ INPUT("%i", &npcinfo[i].item3);
+ INPUT("%i", &npcinfo[i].script);
+
+ // baby dragon
+ if(npcinfo[i].spriteset == 1) {
+ npcinfo[i].hp = 12;
+ npcinfo[i].attackdelay = 2000;
+
+ npcinfo[i].attackdamage = 2;
+ npcinfo[i].spelldamage = 0;
+
+ npcinfo[i].walkspd = 1;
+
+ if(RND() * 5 == 0) npcinfo[i].hp = 0;
+ }
+
+ // onewing
+ if(npcinfo[i].spriteset == 2) {
+ npcinfo[i].hp = 200;
+ npcinfo[i].attackdelay = 2000;
+ npcinfo[i].swayspd = 1;
+
+ npcinfo[i].attackdamage = 24;
+ npcinfo[i].spelldamage = 30;
+
+ npcinfo[i].walkspd = 1.4;
+ npcinfo[i].castpause = ticks;
+ }
+
+ // boss1
+ if(npcinfo[i].spriteset == 3) {
+ npcinfo[i].hp = 300;
+ npcinfo[i].attackdelay = 2200;
+
+ npcinfo[i].attackdamage = 0;
+ npcinfo[i].spelldamage = 30;
+
+ npcinfo[i].walkspd = 1.2;
+ }
+
+ // black knights
+ if(npcinfo[i].spriteset == 4) {
+ npcinfo[i].hp = 200;
+ npcinfo[i].attackdelay = 2800;
+
+ npcinfo[i].attackdamage = 0;
+ npcinfo[i].spelldamage = 30;
+
+ npcinfo[i].walkspd = 1;
+ }
+
+ // boss2 firehydra
+ if(npcinfo[i].spriteset == 5) {
+ npcinfo[i].hp = 600;
+ npcinfo[i].attackdelay = 2200;
+
+ npcinfo[i].attackdamage = 50;
+ npcinfo[i].spelldamage = 30;
+
+ npcinfo[i].walkspd = 1.3;
+
+ npcinfo[i].swayangle = 0;
+ }
+
+ // baby fire dragon
+ if(npcinfo[i].spriteset == 6) {
+ npcinfo[i].hp = 20;
+ npcinfo[i].attackdelay = 1500;
+
+ npcinfo[i].attackdamage = 0;
+ npcinfo[i].spelldamage = 12;
+
+ npcinfo[i].walkspd = 1;
+
+ if(RND() * 5 == 0) npcinfo[i].hp = 0;
+ }
+
+ // priest1
+ if(npcinfo[i].spriteset == 7) {
+ npcinfo[i].hp = 40;
+ npcinfo[i].attackdelay = 5000;
+
+ npcinfo[i].attackdamage = 0;
+ npcinfo[i].spelldamage = 8;
+
+ npcinfo[i].walkspd = 1;
+
+ if(RND() * 8 == 0) npcinfo[i].hp = 0;
+ }
+
+ // yellow fire dragon
+ if(npcinfo[i].spriteset == 8) {
+ npcinfo[i].hp = 100;
+ npcinfo[i].attackdelay = 1500;
+
+ npcinfo[i].attackdamage = 0;
+ npcinfo[i].spelldamage = 24;
+
+ npcinfo[i].walkspd = 1;
+
+ if(RND() * 5 == 0) npcinfo[i].hp = 0;
+ }
+
+ // twowing
+ if(npcinfo[i].spriteset == 9) {
+ npcinfo[i].hp = 140;
+ npcinfo[i].attackdelay = 2000;
+ npcinfo[i].swayspd = 1;
+
+ npcinfo[i].attackdamage = 30;
+ npcinfo[i].spelldamage = 0;
+
+ npcinfo[i].walkspd = 1;
+
+ npcinfo[i].castpause = 0;
+ }
+
+ // dragon2
+ if(npcinfo[i].spriteset == 10) {
+ npcinfo[i].hp = 80;
+ npcinfo[i].attackdelay = 1500;
+
+ npcinfo[i].attackdamage = 24;
+ npcinfo[i].spelldamage = 0;
+
+ npcinfo[i].walkspd = 1;
+
+ npcinfo[i].floating = RND() * 16;
+ }
+
+ // end boss
+ if(npcinfo[i].spriteset == 11) {
+ npcinfo[i].hp = 1200;
+ npcinfo[i].attackdelay = 2000;
+
+ npcinfo[i].attackdamage = 100;
+ npcinfo[i].spelldamage = 60;
+
+ npcinfo[i].walkspd = 1;
+
+ npcinfo[i].floating = RND() * 16;
+ }
+
+ // bat kitty
+ if(npcinfo[i].spriteset == 12) {
+ npcinfo[i].hp = 800;
+ npcinfo[i].attackdelay = 2000;
+
+ npcinfo[i].attackdamage = 100;
+ npcinfo[i].spelldamage = 50;
+
+ npcinfo[i].walkspd = 1;
+
+ npcinfo[i].floating = RND() * 16;
+ }
+
+ if(npcinfo[i].onmap == 0) npcinfo[i].hp = 0;
+
+ npcinfo[i].maxhp = npcinfo[i].hp;
+
+ npcinfo[i].attacking = 0;
+ npcinfo[i].attackframe = 0;
+ npcinfo[i].cattackframe = 0;
+ npcinfo[i].attackspd = 1.5;
+ npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay * (1 + RND() * 2);
+
+ if(npcinfo[i].spriteset == 2 || npcinfo[i].spriteset == 9) {
+ npcinfo[i].bodysection[0].sprite = 0;
+ npcinfo[i].bodysection[1].sprite = 1;
+ npcinfo[i].bodysection[2].sprite = 2;
+ npcinfo[i].bodysection[3].sprite = 3;
+ npcinfo[i].bodysection[4].sprite = 4;
+ npcinfo[i].bodysection[5].sprite = 3;
+ npcinfo[i].bodysection[6].sprite = 3;
+ npcinfo[i].bodysection[7].sprite = 5;
+
+ npcinfo[i].bodysection[0].bonelength = 8;
+ npcinfo[i].bodysection[1].bonelength = 7;
+ npcinfo[i].bodysection[2].bonelength = 6;
+ npcinfo[i].bodysection[3].bonelength = 4;
+ npcinfo[i].bodysection[4].bonelength = 4;
+ npcinfo[i].bodysection[5].bonelength = 4;
+ npcinfo[i].bodysection[6].bonelength = 4;
+
+ for(int f = 0; f <= 7; f++) {
+ npcinfo[i].bodysection[f].x = npcinfo[i].x + 12;
+ npcinfo[i].bodysection[f].y = npcinfo[i].y + 14;
+ }
+
+ npcinfo[i].headtargetx[0] = npcinfo[i].x + 12;
+ npcinfo[i].headtargety[0] = npcinfo[i].y + 14;
+
+ }
+
+ if(npcinfo[i].spriteset == 5) {
+ for(int f = 0; f <= 29; f++) {
+ npcinfo[i].bodysection[f].x = npcinfo[i].x + 12;
+ npcinfo[i].bodysection[f].y = npcinfo[i].y + 14;
+ }
+
+ for(int f = 0; f <= 2; f++) {
+ npcinfo[i].headtargetx[f] = npcinfo[i].x + 12;
+ npcinfo[i].headtargety[f] = npcinfo[i].y + 14;
+
+ npcinfo[i].attacking2[f] = 0;
+ npcinfo[i].attackframe2[f] = 0;
+ }
+ }
+
+ if(npcinfo[i].script == 2) {
+ roomlock = 1;
+ if(scriptflag[2][0] > 0) {
+ roomlock = 0;
+ npcinfo[i].hp = 0;
+ }
+ }
+
+ if(npcinfo[i].script == 3) {
+ roomlock = 1;
+ if(scriptflag[3][0] > 0) {
+ roomlock = 0;
+ npcinfo[i].hp = 0;
+ }
+ }
+
+ if(npcinfo[i].script == 5) {
+ roomlock = 1;
+ if(scriptflag[5][0] > 0) {
+ roomlock = 0;
+ npcinfo[i].hp = 0;
+ }
+ }
+
+ if(npcinfo[i].script == 15) {
+ roomlock = 1;
+ if(scriptflag[15][0] > 0) {
+ roomlock = 0;
+ npcinfo[i].hp = 0;
+ }
+ }
+
+ npcinfo[i].pause = ticks;
+ }
+
+ fclose(fp);
+
+
+ int cx, cy, npx, npy, lx, ly;
+
+ // academy master key
+ if(curmap == 34 && scriptflag[2][0] == 1) {
+ cx = 9;
+ cy = 7;
+
+ objmap[cx][cy] = 5;
+
+ rcDest.x = cx * 8;
+ rcDest.y = cy * 8;
+ rcDest.w = 8;
+ rcDest.h = 8;
+
+ npx = player.px + 12;
+ npy = player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if(lx == cx && ly == cy) player.py = player.py + 16;
+
+ SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ }
+
+ // academy crystal
+ if(curmap == 24 && player.foundspell[0] == 0 && scriptflag[3][0] == 1) {
+ cx = 9;
+ cy = 7;
+
+ objmap[cx][cy] = 6;
+
+ rcDest.x = cx * 8;
+ rcDest.y = cy * 8;
+ rcDest.w = 8;
+ rcDest.h = 8;
+
+ npx = player.px + 12;
+ npy = player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if(lx == cx && ly == cy) player.py = player.py + 16;
+
+ SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ }
+
+ // gardens master key
+ if(curmap == 62 && scriptflag[8][0] == 1) {
+ cx = 13;
+ cy = 7;
+
+ objmap[cx][cy] = 5;
+
+ rcDest.x = cx * 8;
+ rcDest.y = cy * 8;
+ rcDest.w = 8;
+ rcDest.h = 8;
+
+ npx = player.px + 12;
+ npy = player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if(lx == cx && ly == cy) player.py = player.py + 16;
+
+ SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ }
+
+ // gardens fidelis sword
+ if(curmap == 66 && scriptflag[5][0] == 1 && player.sword == 1) {
+ cx = 9;
+ cy = 6;
+
+ objmap[cx][cy] = 9;
+
+ rcDest.x = cx * 8;
+ rcDest.y = cy * 8;
+ rcDest.w = 8;
+ rcDest.h = 8;
+
+ npx = player.px + 12;
+ npy = player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if(lx == cx && ly == cy) player.py = player.py + 16;
+
+ SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ }
+
+ // citadel armour
+ if(curmap == 73 && scriptflag[12][0] == 1 && player.armour == 1) {
+ cx = 8;
+ cy = 7;
+
+ objmap[cx][cy] = 16;
+
+ rcDest.x = cx * 8;
+ rcDest.y = cy * 8;
+ rcDest.w = 8;
+ rcDest.h = 8;
+
+ npx = player.px + 12;
+ npy = player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if(lx == cx && ly == cy) player.py = player.py + 16;
+
+ SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ }
+
+ // citadel master key
+ if(curmap == 81 && scriptflag[13][0] == 1) {
+ cx = 11;
+ cy = 10;
+
+ objmap[cx][cy] = 5;
+
+ rcDest.x = cx * 8;
+ rcDest.y = cy * 8;
+ rcDest.w = 8;
+ rcDest.h = 8;
+
+ npx = player.px + 12;
+ npy = player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if(lx == cx && ly == cy) player.py = player.py + 16;
+
+ SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ }
+
+
+ // max ups
+ if(curmap == 83 && scriptflag[15][0] == 1 && player.sword < 3) {
+ cx = 6;
+ cy = 8;
+
+ objmap[cx][cy] = 18;
+
+ rcDest.x = cx * 8;
+ rcDest.y = cy * 8;
+ rcDest.w = 8;
+ rcDest.h = 8;
+
+ npx = player.px + 12;
+ npy = player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if(lx == cx && ly == cy) player.py = player.py + 16;
+
+ SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ }
+
+ if(curmap == 83 && scriptflag[16][0] == 1 && player.shield < 3) {
+ cx = 9;
+ cy = 8;
+
+ objmap[cx][cy] = 19;
+
+ rcDest.x = cx * 8;
+ rcDest.y = cy * 8;
+ rcDest.w = 8;
+ rcDest.h = 8;
+
+ npx = player.px + 12;
+ npy = player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if(lx == cx && ly == cy) player.py = player.py + 16;
+
+ SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ }
+
+ if(curmap == 83 && scriptflag[17][0] == 1 && player.armour < 3) {
+ cx = 12;
+ cy = 8;
+
+ objmap[cx][cy] = 20;
+
+ rcDest.x = cx * 8;
+ rcDest.y = cy * 8;
+ rcDest.w = 8;
+ rcDest.h = 8;
+
+ npx = player.px + 12;
+ npy = player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if(lx == cx && ly == cy) player.py = player.py + 16;
+
+ SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ }
+
+ SDL_BlitSurface(clipbg, NULL, clipbg2, NULL);
+}
+
+void game_main()
+{
+ game_title(0);
+ game_saveloadnew();
+}
+
+void game_newgame()
+{
+ float xofs = 0;
+ float ld = 0, add;
+ int ticks, cnt = 0;
+
+ SDL_FillRect(videobuffer2, NULL, 0);
+ SDL_FillRect(videobuffer3, NULL, 0);
+
+ ticks = SDL_GetTicks();
+
+ SDL_BlitSurface(videobuffer, NULL, videobuffer3, NULL);
+ SDL_BlitSurface(videobuffer, NULL, videobuffer2, NULL);
+
+ fpsr = 0.0;
+ int y = 140;
+
+ if(menabled == 1 && config.music == 1) {
+ Mix_HaltChannel(-1);
+ musicchannel = Mix_PlayChannel(-1, mendofgame, -1);
+ Mix_Volume(musicchannel, 0);
+ }
+
+ secsingame = 0;
+ secstart = 0;
+
+ int ldstop = 0;
+
+ do {
+ SDL_Rect rc;
+
+ ld += 4 * fpsr;
+ if((int)ld > config.musicvol) ld = config.musicvol;
+ if(menabled == 1 && ldstop == 0) {
+ Mix_Volume(musicchannel, (int)ld);
+ if((int)ld == config.musicvol) ldstop = 1;
+ }
+
+ rc.x = -xofs;
+ rc.y = 0;
+
+ SDL_BlitSurface(titleimg, NULL, videobuffer, &rc);
+
+ rc.x = -xofs + 320;
+ rc.y = 0;
+
+ SDL_BlitSurface(titleimg, NULL, videobuffer, &rc);
+
+ if(++cnt >= 6) {
+ cnt = 0;
+ y--;
+ }
+
+ for(int i = 0; i <= 37; i++) {
+ int yy, x;
+
+ yy = y + i * 10;
+ if(yy > -8 && yy < 240) {
+ x = 160 - strlen(story[i]) * 4;
+ sys_print(videobuffer, story[i], x, yy, 4);
+ }
+
+ if(yy < 10 && i == 47) goto __exit_do;
+ }
+
+ SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
+ SDL_Flip(video);
+
+ tickspassed = ticks;
+ ticks = SDL_GetTicks();
+
+ tickspassed = ticks - tickspassed;
+ fpsr = (float)tickspassed / 24.0;
+
+ fp++;
+ if(ticks > nextticks) {
+ nextticks = ticks + 1000;
+ fps = fp;
+ fp = 0;
+ }
+
+ add = 0.5 * fpsr;
+ if(add > 1) add = 1;
+ xofs += add;
+ if(xofs >= 320) xofs = xofs - 320;
+
+ SDL_PollEvent(&event);
+ keys = SDL_GetKeyState(NULL);
+
+ if(event.type == SDL_KEYDOWN) cnt = 6;
+ if(keys[SDLK_ESCAPE] || keys[SDLK_LALT]) goto __exit_do;
+
+ SDL_Delay(10);
+ } while(1);
+__exit_do:
+
+ player.px = 0;
+ player.py = 0;
+ player.opx = 0;
+ player.opy = 0;
+ player.walkdir = 0;
+ player.walkframe = 0;
+ player.walkspd = 0;
+ player.attackframe = 0;
+ player.attackspd = 0;
+ player.hp = 0;
+ player.maxhp = 0;
+ player.hpflash = 0;
+ player.level = 0;
+ player.maxlevel = 0;
+ player.sword = 0;
+ player.shield = 0;
+ player.armour = 0;
+ for(int i = 0; i < 5; i++) {
+ player.foundspell[i] = 0;
+ player.spellcharge[i] = 0;
+ player.inventory[i] = 0;
+ }
+ player.attackstrength = 0;
+ player.spelldamage = 0;
+ player.sworddamage = 0;
+ player.exp = 0;
+ player.nextlevel = 0;
+
+ memset(scriptflag, 0, sizeof(scriptflag));
+ memset(objmapf, 0, sizeof(objmapf));
+ memset(roomlocks, 0, sizeof(roomlocks));
+
+ roomlocks[66] = 2;
+ roomlocks[24] = 2;
+ roomlocks[17] = 1;
+ roomlocks[34] = 1;
+ roomlocks[50] = 1;
+ roomlocks[73] = 1;
+ roomlocks[82] = 2;
+
+ player.walkspd = 1.1;
+ animspd = 0.5;
+ attacking = 0;
+ player.attackspd = 1.5;
+
+ player.sword = 1;
+ player.level = 1;
+ player.maxlevel = 22;
+ player.nextlevel = 50;
+ player.shield = 1;
+ player.armour = 1;
+ player.hp = 14;
+ player.maxhp = player.hp;
+
+ player.sworddamage = player.level * 2;
+ player.spelldamage = player.level * 3 / 2;
+
+ player.px = 15*16 - 4;
+ player.py = 6*16 - 4;
+ player.walkdir = 1;
+
+ pgardens = 0;
+ ptown = 0;
+ pboss = 0;
+ pacademy = 0;
+ pcitadel = 0;
+
+ game_loadmap(2);
+
+ game_playgame();
+}
+
+void game_playgame()
+{
+ game_swash();
+
+ if(pmenu == 1 && menabled == 1) {
+ Mix_HaltChannel(menuchannel);
+ pmenu = 0;
+ }
+
+ do {
+ if(forcepause == 0) {
+ game_updanims();
+ game_updnpcs();
+ }
+
+ game_checktrigger();
+ game_checkinputs();
+
+ if(forcepause == 0) game_handlewalking();
+
+ game_updatey();
+ game_drawview();
+
+ game_updmusic();
+
+ sys_update();
+ } while(1);
+}
+
+void game_processtrigger(int trignum)
+{
+ int trigtype, tx, ty, tmap, tjumpstyle, tsx, tsy;
+
+ trigtype = triggers[trignum][0];
+
+ if(roomlock == 1) return;
+ // map jump------------------------------
+ if(trigtype == 0) {
+ tx = triggers[trignum][1];
+ ty = triggers[trignum][2];
+ tmap = triggers[trignum][3];
+ tjumpstyle = triggers[trignum][4];
+
+ if(roomlocks[tmap] > 0) {
+ if(saidlocked == 0) game_eventtext("Locked");
+ saidlocked = 1;
+ canusekey = 1;
+ locktype = roomlocks[tmap];
+ roomtounlock = tmap;
+ return;
+ }
+
+ if(tmap == 1) {
+ if(saidjammed == 0) game_eventtext("Door Jammed!");
+ saidjammed = 1;
+ return;
+ }
+
+ saidlocked = 0;
+ saidjammed = 0;
+
+ // loc-sxy+oldmaploc
+ if(tjumpstyle == 0) {
+
+ tsx = triggers[trignum][5];
+ tsy = triggers[trignum][6];
+
+ player.px += (tx - tsx) * 16;
+ player.py += (ty - tsy) * 16;
+
+ // HACKFIX
+ if(player.px < 0) player.px = 0;
+ if(player.py < 0) player.py = 0;
+
+ if(tmap > 0) {
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[snddoor], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ game_loadmap(tmap);
+ game_swash();
+ }
+ }
+ }
+
+ for(int i = 0; i < MAXFLOAT; i++) {
+ floattext[i][0] = 0;
+ floaticon[i][0] = 0;
+ }
+}
+
+void game_saveloadnew()
+{
+ float y; int yy;
+ int currow, curcol, lowerlock;
+ int ticks, ticks1, tickpause;
+
+ clouddeg = 0;
+
+ SDL_SetAlpha(videobuffer, SDL_SRCALPHA, 255);
+ SDL_SetAlpha(saveloadimg, SDL_SRCALPHA, 192);
+
+ currow = 0;
+ curcol = 0;
+
+ lowerlock = 0;
+
+ ticks = SDL_GetTicks();
+ ticks1 = ticks;
+ tickpause = ticks + 150;
+
+ do {
+ SDL_FillRect(videobuffer, NULL, 0);
+
+ y = y + 1 * fpsr;
+
+ rcDest.x = 256 + 256 * cos(3.141592 / 180 * clouddeg * 40);
+ rcDest.y = 192 + 192 * sin(3.141592 / 180 * clouddeg * 40);
+ rcDest.w = 320;
+ rcDest.h = 240;
+
+ SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 128);
+ SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
+ SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 64);
+
+
+ rcDest.x = 256;
+ rcDest.y = 192;
+ rcDest.w = 320;
+ rcDest.h = 240;
+
+ SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 128);
+ SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
+ SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 64);
+
+ SDL_BlitSurface(saveloadimg, NULL, videobuffer, NULL);
+
+ SDL_PollEvent(&event);
+ keys = SDL_GetKeyState(NULL);
+
+ if(tickpause < ticks) {
+ if(event.type == SDL_KEYDOWN) {
+ itemticks = ticks + 220;
+
+ if(keys[SDLK_LCTRL] || keys[SDLK_RETURN]) {
+ // QUIT - non existent :)
+ if(currow == 0 && curcol == 4) {
+ exit(1);
+ }
+ // RETURN
+ if(currow == 0 && curcol == 3) {
+ // reset keys to avoid returning
+ keys[SDLK_RETURN] = keys[SDLK_SPACE] = 0;
+ return;
+ }
+ // NEW GAME
+ if(currow == 0 && curcol == 0) game_newgame();
+
+ // LOAD GAME
+ if(currow == 0 && curcol == 1) {
+ lowerlock = 1;
+ currow = 1 + saveslot;
+ tickpause = ticks + 125;
+ }
+ // SAVE GAME
+ if(currow == 0 && curcol == 2) {
+ lowerlock = 1;
+ currow = 1;
+ tickpause = ticks + 125;
+ }
+
+
+ if(lowerlock == 1 && curcol == 1 && tickpause < ticks) {
+ if(state_save(currow - 1)) {
+ secstart = secstart + secsingame;
+ secsingame = 0;
+ lowerlock = 0;
+ saveslot = currow - 1;
+ currow = 0;
+ }
+ }
+
+ if(lowerlock == 1 && curcol == 2 && tickpause < ticks) {
+ if(state_load(currow - 1)) {
+ player.walkspd = 1.1;
+ animspd = .5;
+ attacking = 0;
+ player.attackspd = 1.5;
+
+ pgardens = 0;
+ ptown = 0;
+ pboss = 0;
+ pacademy = 0;
+ pcitadel = 0;
+
+ Mix_HaltChannel(-1);
+
+ secsingame = 0;
+ saveslot = currow - 1;
+ game_loadmap(curmap);
+ game_playgame();
+ }
+ }
+
+ tickpause = ticks + 125;
+ }
+
+ switch(event.key.keysym.sym) {
+ case SDLK_ESCAPE:
+ case SDLK_LALT:
+ if(lowerlock == 0) return;
+ lowerlock = 0;
+ currow = 0;
+ tickpause = ticks + 125;
+ break;
+ case SDLK_DOWN:
+ if(lowerlock == 1) {
+ currow = currow + 1;
+ if(currow == 5) currow = 1;
+ tickpause = ticks + 125;
+ }
+ break;
+
+ case SDLK_UP:
+ if(lowerlock == 1) {
+ currow = currow - 1;
+ if(currow == 0) currow = 4;
+ tickpause = ticks + 125;
+ }
+ break;
+
+ case SDLK_LEFT:
+ if(lowerlock == 0) {
+ curcol = curcol - 1;
+ if(curcol == -1) curcol = 3;
+ tickpause = ticks + 125;
+ }
+ break;
+
+ case SDLK_RIGHT:
+ if(lowerlock == 0) {
+ curcol = curcol + 1;
+ if(curcol == 4) curcol = 0;
+ tickpause = ticks + 125;
+ }
+ break;
+ default:
+ ;
+ }
+ }
+ }
+
+
+ // savestates---------------------------------
+ // read it only when needed!
+
+ for(int ff = 0; ff <= 3; ff++) {
+ state_load_player(ff);
+
+ if(playera.level > 0) {
+ char line[256];
+ int sx, sy, cc, ss, nx;
+
+ sx = 8;
+ sy = 57 + ff * 48;
+
+ // time
+ int ase = asecstart;
+ int h = ((ase - (ase % 3600)) / 3600);
+ ase = (ase - h * 3600);
+ int m = ((ase - (ase % 60)) / 60);
+ int s = (ase - m * 60);
+
+ sprintf(line, "Game Time: %02i:%02i:%02i", h, m, s);
+ sys_print(videobuffer, line, 160 - strlen(line) * 4, sy, 0);
+
+ sx = 12;
+ sy = sy + 11;
+ cc = 0;
+
+ sprintf(line, "Health: %i/%i", playera.hp, playera.maxhp);
+ sys_print(videobuffer, line, sx, sy, cc);
+
+ if(playera.level == 22)
+ strcpy(line, "Level: MAX");
+ else
+ sprintf(line, "Level: %i", playera.level);
+
+ sys_print(videobuffer, line, sx, sy + 11, 0);
+
+ rcSrc.x = sx + 15 * 8 + 24;
+ rcSrc.y = sy + 1;
+
+ ss = (playera.sword - 1) * 3;
+ if(playera.sword == 3) ss = 18;
+ SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
+
+ rcSrc.x = rcSrc.x + 16;
+ ss = (playera.shield - 1) * 3 + 1;
+ if(playera.shield == 3) ss = 19;
+ SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
+
+ rcSrc.x = rcSrc.x + 16;
+ ss = (playera.armour - 1) * 3 + 2;
+ if(playera.armour == 3) ss = 20;
+ SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
+
+ nx = rcSrc.x + 13 + 3 * 8;
+ rcSrc.x = nx - 17;
+
+ if(playera.foundspell[0] == 1) {
+ for(int i = 0; i < 5; i++) {
+ rcSrc.x = rcSrc.x + 17;
+ if(playera.foundspell[i] == 1) SDL_BlitSurface(itemimg[7 + i], NULL, videobuffer, &rcSrc);
+ }
+ }
+ } else {
+ int sy = 57 + ff * 48;
+ sys_print(videobuffer, "Empty", 160 - 5 * 4, sy, 0);
+ }
+ }
+ // ------------------------------------------
+
+
+ if(currow == 0) {
+ rcDest.y = 18;
+ if(curcol == 0) rcDest.x = 10;
+ if(curcol == 1) rcDest.x = 108;
+ if(curcol == 2) rcDest.x = 170;
+ if(curcol == 3) rcDest.x = 230;
+ rcDest.x = (float)(rcDest.x + 2 + 2 * sin(3.14159 * 2 * itemyloc / 16));
+ }
+
+ if(currow > 0) {
+ rcDest.x = (float)(0 + 2 * sin(3.14159 * 2 * itemyloc / 16));
+ rcDest.y = (float)(53 + (currow - 1) * 48);
+ }
+
+ SDL_BlitSurface(itemimg[15], NULL, videobuffer, &rcDest);
+
+
+ if(lowerlock == 1) {
+ rcDest.y = 18;
+ if(curcol == 1) rcDest.x = 108;
+ if(curcol == 2) rcDest.x = 170;
+ rcDest.x = rcDest.x; // + 2 + 2 * sin(-3.14159 * 2 * itemyloc / 16)
+
+ SDL_BlitSurface(itemimg[15], NULL, videobuffer, &rcDest);
+ }
+
+ yy = 255;
+ if(ticks < ticks1 + 1000) {
+ yy = 255 * (ticks - ticks1) / 1000;
+ if(yy < 0) yy = 0;
+ if(yy > 255) yy = 255;
+ }
+
+ SDL_SetAlpha(videobuffer, SDL_SRCALPHA, (int)yy);
+ SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
+ SDL_SetAlpha(videobuffer, SDL_SRCALPHA, 255);
+
+ SDL_Flip(video);
+ SDL_PumpEvents();
+
+ tickspassed = ticks;
+ ticks = SDL_GetTicks();
+
+ tickspassed = ticks - tickspassed;
+ fpsr = (float)tickspassed / 24;
+
+ fp++;
+ if(ticks > nextticks) {
+ nextticks = ticks + 1000;
+ fps = fp;
+ fp = 0;
+ }
+
+ clouddeg += 0.01 * fpsr;
+ while(clouddeg >= 360) clouddeg -= 360;
+
+ itemyloc += 0.6 * fpsr;
+ while(itemyloc >= 16) itemyloc -= 16;
+
+ SDL_Delay(10);
+ } while(1);
+
+ SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 64);
+}
+
+void game_showlogos()
+{
+ float y;
+ int ticks1;
+
+ ticks = SDL_GetTicks();
+ ticks1 = ticks;
+
+ y = 0.0;
+
+ do {
+ y = 255.0;
+ if(ticks < ticks1 + 1000) {
+ y = 255.0 * ((float)(ticks - ticks1) / 1000.0);
+ if(y < 0.0) y = 0.0;
+ if(y > 255.0) y = 255.0;
+ }
+
+ if(ticks > ticks1 + 3000) {
+ y = 255.0 - 255.0 * ((float)(ticks - ticks1 - 3000.0) / 1000.0);
+ if(y < 0.0) y = 0.0;
+ if(y > 255.0) y = 255.0;
+ }
+
+ SDL_FillRect(videobuffer, NULL, 0);
+
+ SDL_SetAlpha(logosimg, SDL_SRCALPHA, (int)y);
+ SDL_BlitSurface(logosimg, NULL, videobuffer, NULL);
+ SDL_SetAlpha(logosimg, SDL_SRCALPHA, 255);
+
+ SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
+
+ SDL_Flip(video);
+ SDL_PumpEvents();
+
+ tickspassed = ticks;
+ ticks = SDL_GetTicks();
+
+ tickspassed = ticks - tickspassed;
+ fpsr = (float)tickspassed / 24;
+
+ fp++;
+ if(ticks > nextticks) {
+ nextticks = ticks + 1000;
+ fps = fp;
+ fp = 0;
+ }
+
+ SDL_Delay(10);
+ if(ticks > ticks1 + 4000) break;
+ } while(1);
+}
+
+
+void game_swash()
+{
+ float y;
+
+ y = 0;
+
+ do {
+ y = y + 1 * fpsr;
+
+ SDL_SetAlpha(videobuffer, SDL_SRCALPHA, (int)y);
+ SDL_FillRect(videobuffer, NULL, 0);
+ SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
+
+ SDL_Flip(video);
+ SDL_PumpEvents();
+
+ tickspassed = ticks;
+ ticks = SDL_GetTicks();
+
+ tickspassed = ticks - tickspassed;
+ fpsr = (float)tickspassed / 24.0;
+
+ fp++;
+ if(ticks > nextticks) {
+ nextticks = ticks + 1000;
+ fps = fp;
+ fp = 0;
+ }
+
+ clouddeg += 0.01 * fpsr;
+ while(clouddeg >= 360) clouddeg = clouddeg - 360;
+
+ if(y > 10) break;
+ } while(1);
+
+ y = 0;
+ do {
+ y = y + 1 * fpsr;
+
+ SDL_SetAlpha(videobuffer, SDL_SRCALPHA, (int)(y * 25));
+ SDL_BlitSurface(mapbg, NULL, videobuffer, NULL);
+
+ if(cloudson == 1) {
+ rcDest.x = (float)(256 + 256 * cos(3.141592 / 180 * clouddeg));
+ rcDest.y = (float)(192 + 192 * sin(3.141592 / 180 * clouddeg));
+ rcDest.w = 320;
+ rcDest.h = 240;
+
+ SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
+ }
+
+ SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
+ SDL_Flip(video);
+ SDL_PumpEvents();
+
+ tickspassed = ticks;
+ ticks = SDL_GetTicks();
+
+ tickspassed = ticks - tickspassed;
+ fpsr = (float)tickspassed / 24.0;
+
+ fp++;
+ if(ticks > nextticks) {
+ nextticks = ticks + 1000;
+ fps = fp;
+ fp = 0;
+ }
+
+ clouddeg += 0.01 * fpsr;
+ while(clouddeg >= 360) clouddeg = clouddeg - 360;
+
+ if(y > 10) break;
+ } while(1);
+
+
+ SDL_SetAlpha(videobuffer, SDL_SRCALPHA, 255);
+}
+
+void game_theend()
+{
+ for(int i = 0; i < MAXFLOAT; i++) {
+ floattext[i][0] = 0;
+ floaticon[i][0] = 0;
+ }
+
+ for(float y = 0; y < 100; y += fpsr) {
+ SDL_SetAlpha(videobuffer, SDL_SRCALPHA, (int)y);
+ SDL_FillRect(videobuffer, NULL, 0);
+ SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
+
+ SDL_Flip(video);
+ SDL_PumpEvents();
+
+ tickspassed = ticks;
+ ticks = SDL_GetTicks();
+
+ tickspassed = ticks - tickspassed;
+ fpsr = (float)tickspassed / 24.0;
+
+ fp++;
+ if(ticks > nextticks) {
+ nextticks = ticks + 1000;
+ fps = fp;
+ fp = 0;
+ }
+ }
+
+ game_title(0);
+}
+
+void game_title(int mode)
+{
+ float xofs = 0;
+ int ticks, ticks1, keypause;
+ int cursel, ldstop;
+ int x, y;
+
+ rcSrc.x = 0;
+ rcSrc.y = 0;
+ rcSrc.w = 320;
+ rcSrc.h = 240;
+
+ SDL_FillRect(videobuffer2, &rcSrc, 0);
+ SDL_FillRect(videobuffer3, &rcSrc, 0);
+
+ ticks = SDL_GetTicks();
+
+ SDL_BlitSurface(videobuffer, NULL, videobuffer3, NULL);
+ SDL_BlitSurface(videobuffer, NULL, videobuffer2, NULL);
+
+ cursel = 0;
+
+ keypause = ticks + 220;
+
+ ticks1 = ticks;
+
+ if(menabled == 1 && config.music == 1) {
+ Mix_Volume(musicchannel, 0);
+ Mix_Pause(musicchannel);
+
+ menuchannel = Mix_PlayChannel(-1, mmenu, -1);
+ Mix_Volume(menuchannel, config.musicvol);
+ pmenu = 1;
+ }
+
+ ldstop = 0;
+
+ float ld = 0;
+ do {
+ SDL_Rect rc;
+
+ ld += 4.0 * fpsr;
+ if(ld > config.musicvol) ld = config.musicvol;
+ if(menabled == 1 && ldstop == 0) {
+ Mix_Volume(menuchannel, (int)ld);
+ if((int)ld == config.musicvol) ldstop = 1;
+ }
+
+ rc.x = -xofs;
+ rc.y = 0;
+
+ SDL_BlitSurface(titleimg, NULL, videobuffer, &rc);
+
+ rc.x = -xofs + 320.0;
+ rc.y = 0;
+
+ SDL_BlitSurface(titleimg, NULL, videobuffer, &rc);
+
+ rc.x = 0;
+ rc.y = 0;
+
+ SDL_BlitSurface(titleimg2, NULL, videobuffer, &rc);
+
+ y = 172;
+ x = 160 - 14 * 4;
+
+ sys_print(videobuffer, "new game/save/load", x, y, 4);
+ sys_print(videobuffer, "options", x, y + 16, 4);
+ sys_print(videobuffer, "quit game", x, y + 32, 4);
+
+ if(mode == 1) sys_print(videobuffer, "return", x, y + 48, 4);
+ else sys_print(videobuffer, "(c) 2005 by Daniel 'Syn9' Kennedy", 28, 224, 4);
+
+ rc.x = (float)(x - 16 - 4 * cos(3.14159 * 2 * itemyloc / 16));
+ rc.y = (float)(y - 4 + 16 * cursel);
+
+ SDL_BlitSurface(itemimg[15], NULL, videobuffer, &rc);
+
+ float yf = 255.0;
+ if(ticks < ticks1 + 1000) {
+ yf = 255.0 * ((float)(ticks - ticks1) / 1000.0);
+ if(y < 0.0) yf = 0.0;
+ if(y > 255.0) yf = 255.0;
+ }
+
+ SDL_SetAlpha(videobuffer, SDL_SRCALPHA, (int)yf);
+ SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
+ SDL_SetAlpha(videobuffer, SDL_SRCALPHA, 255);
+
+ tickspassed = ticks;
+ ticks = SDL_GetTicks();
+
+ tickspassed = ticks - tickspassed;
+ fpsr = (float)tickspassed / 24.0;
+
+ fp++;
+ if(ticks > nextticks) {
+ nextticks = ticks + 1000;
+ fps = fp;
+ fp = 0;
+ }
+
+ float add = 0.5 * fpsr;
+ if(add > 1) add = 1;
+
+ xofs = xofs + add;
+ if(xofs >= 320.0) xofs -= 320.0;
+
+ itemyloc += 0.75 * fpsr;
+
+ while(itemyloc >= 16)
+ itemyloc = itemyloc - 16;
+
+ SDL_PollEvent(&event);
+
+ if(keypause < ticks) {
+ keys = SDL_GetKeyState(NULL);
+
+ if(event.type == SDL_KEYDOWN) {
+ keypause = ticks + 150;
+
+ if((keys[SDLK_ESCAPE] || keys[SDLK_LALT]) && mode == 1) break;
+ else if(keys[SDLK_UP]) {
+ cursel--;
+ if(cursel < 0) cursel = (mode == 1 ? 3 : 2);
+ } else if(keys[SDLK_DOWN]) {
+ cursel++;
+ if(cursel >= (mode == 1 ? 4 : 3)) cursel = 0;
+ } else if(keys[SDLK_LCTRL] || keys[SDLK_RETURN]) {
+ if(cursel == 0) {
+ game_saveloadnew();
+ ticks = SDL_GetTicks();
+ keypause = ticks + 150;
+ ticks1 = ticks;
+ } else if(cursel == 1) {
+ game_configmenu();
+ ticks = SDL_GetTicks();
+ keypause = ticks + 150;
+ ticks1 = ticks;
+ } else if(cursel == 2) {
+ exit(1);
+ } else if(cursel == 3) break;
+ }
+ }
+ }
+
+ SDL_Flip(video);
+ SDL_Delay(10);
+ } while(1);
+
+ itemticks = ticks + 210;
+
+ if(menabled == 1 && config.music == 1) {
+ Mix_HaltChannel(menuchannel);
+ Mix_Resume(musicchannel);
+ Mix_Volume(musicchannel, config.musicvol);
+ pmenu = 0;
+ }
+}
+
+void game_updanims()
+{
+ for(int i = 0; i <= lastobj; i++) {
+ int nframes = objectinfo[i][0];
+ int oanimspd = objectinfo[i][3];
+ float frame = objectframe[i][0];
+ int cframe = objectframe[i][1];
+ // objectinfo[i][6] = 0; // ?? out of bounds
+
+ if(nframes > 1) {
+ frame = frame + oanimspd / 50 * fpsr;
+ while(frame >= nframes)
+ frame = frame - nframes;
+
+ cframe = (int)frame; // truncate fractional part
+ if(cframe > nframes) cframe = nframes - 1;
+ if(cframe < 0) cframe = 0;
+
+ objectframe[i][0] = frame;
+ objectframe[i][1] = cframe;
+ }
+ }
+}
+
+void game_updatey()
+{
+ int yy, ff;
+
+ for(int i = 0; i <= 2400; i++)
+ ysort[i] = -1;
+
+ ff = (int)(player.py * 10);
+ if(ff < 0) ff = 0; // HACKFIX or ysort[yy] may go out of bounds
+ player.ysort = ff;
+ ysort[ff] = 0;
+
+ firsty = 2400;
+ lasty = 0;
+
+ for(int i = 1; i <= lastnpc; i++) {
+ yy = (int)(npcinfo[i].y * 10);
+
+ do {
+ if(ysort[yy] == -1 || yy == 2400) break;
+ yy = yy + 1;
+ } while(1);
+
+ ysort[yy] = i;
+ if(yy < firsty) firsty = yy;
+ if(yy > lasty) lasty = yy;
+ }
+}
+
+void game_updmusic()
+{
+ Mix_Chunk *iplaysound = NULL;
+
+ if(menabled == 1 && config.music == 1) {
+
+ // if(curmap > 5 && curmap < 42) iplaysound = macademy;
+ // if(curmap > 47) iplaysound = mgardens;
+ iplaysound = mgardens;
+ if(roomlock == 1) iplaysound = mboss;
+
+ if(iplaysound == mboss && pboss) iplaysound = NULL;
+ if(iplaysound == mgardens && pgardens) iplaysound = NULL;
+
+ if(iplaysound != NULL) {
+ Mix_HaltChannel(musicchannel);
+
+ pboss = 0;
+ pgardens = 0;
+ ptown = 0;
+ pacademy = 0;
+ pcitadel = 0;
+
+ if(iplaysound == mboss) pboss = 1;
+ if(iplaysound == mgardens) pgardens = 1;
+
+ musicchannel = Mix_PlayChannel(-1, iplaysound, -1);
+ Mix_Volume(musicchannel, config.musicvol);
+ } else {
+ if(!Mix_Playing(musicchannel)) {
+ loopseta = loopseta + 1;
+ if(loopseta == 4) loopseta = 0;
+
+ if(pgardens == 1) {
+ Mix_HaltChannel(musicchannel);
+ if(pgardens == 1 && loopseta == 0) musicchannel = Mix_PlayChannel(-1, mgardens, 0);
+ if(pgardens == 1 && loopseta == 1) musicchannel = Mix_PlayChannel(-1, mgardens2, 0);
+ if(pgardens == 1 && loopseta == 2) musicchannel = Mix_PlayChannel(-1, mgardens3, 0);
+ if(pgardens == 1 && loopseta == 3) musicchannel = Mix_PlayChannel(-1, mgardens4, 0);
+ }
+
+ Mix_Volume(musicchannel, config.musicvol);
+ }
+ }
+ }
+}
+
+void game_updnpcs()
+{
+ float npx, npy, onpx, onpy;
+ unsigned int *temp, dq, bgc;
+ float nnxa = 0, nnya = 0, nnxb = 0, nnyb = 0;
+ int pass = 0, checkpass;
+ float wspd, xdif, ydif;
+ int sx, sy;
+ int dospell = 0;
+
+ for(int i = 1; i <= lastnpc; i++) {
+ if(npcinfo[i].hp > 0) {
+ // is npc walking
+ pass = 0;
+ if(npcinfo[i].attacking == 0) pass = 1;
+ if(npcinfo[i].spriteset == 5) pass = 1;
+ if(pass == 1) {
+ int moveup = 0;
+ int movedown = 0;
+ int moveleft = 0;
+ int moveright = 0;
+
+ npx = npcinfo[i].x;
+ npy = npcinfo[i].y;
+
+ onpx = npx;
+ onpy = npy;
+
+ wspd = npcinfo[i].walkspd / 4;
+
+ if(npcinfo[i].spriteset == 10) wspd = wspd * 2;
+ int wdir = npcinfo[i].walkdir;
+
+ int mode = npcinfo[i].movementmode;
+
+ xdif = player.px - npx;
+ ydif = player.py - npy;
+
+ if(abs(xdif) < 4 * 16 && abs(ydif) < 4 * 16 && mode < 3) mode = 0;
+ if(npcinfo[i].hp < npcinfo[i].maxhp * 0.25) mode = 3;
+
+ if(npcinfo[i].pause > ticks) mode = -1;
+ if(npcinfo[i].spriteset == 2 && npcinfo[i].castpause > ticks) mode = -1;
+
+ if(mode == 3) {
+ mode = 1;
+ if(abs(xdif) < 4 * 16 && abs(ydif) < 4 * 16) mode = 3;
+ }
+
+ checkpass = 0;
+
+ // npc AI CODE
+ // --------------
+
+ // *** aggressive
+ if(mode == 0) {
+ wspd = npcinfo[i].walkspd / 2;
+
+ xdif = player.px - npx;
+ ydif = player.py - npy;
+
+ if(abs(xdif) > abs(ydif)) {
+ if(xdif < 4) wdir = 2;
+ if(xdif > -4) wdir = 3;
+ } else {
+ if(ydif < 4) wdir = 0;
+ if(ydif > -4) wdir = 1;
+ }
+
+ if(xdif < 4) moveleft = 1;
+ if(xdif > -4) moveright = 1;
+ if(ydif < 4) moveup = 1;
+ if(ydif > -4) movedown = 1;
+ }
+ // *******************
+
+ // *** defensive
+ if(mode == 1) {
+
+ int movingdir = npcinfo[i].movingdir;
+
+ if(npcinfo[i].ticks > ticks + 100000) npcinfo[i].ticks = ticks;
+
+ if(npcinfo[i].ticks < ticks) {
+ npcinfo[i].ticks = ticks + 2000;
+ movingdir = (int)(RND() * 8);
+ npcinfo[i].movingdir = movingdir;
+ }
+
+ if(movingdir == 0) {
+ wdir = 2; // left
+ moveup = 1;
+ moveleft = 1;
+ } else if(movingdir == 1) {
+ wdir = 0; // up
+ moveup = 1;
+ } else if(movingdir == 2) {
+ wdir = 3; // right
+ moveup = 1;
+ moveright = 1;
+ } else if(movingdir == 3) {
+ wdir = 3; // right
+ moveright = 1;
+ } else if(movingdir == 4) {
+ wdir = 3; // right
+ moveright = 1;
+ movedown = 1;
+ } else if(movingdir == 5) {
+ wdir = 1; // down
+ movedown = 1;
+ } else if(movingdir == 6) {
+ wdir = 2; // left
+ movedown = 1;
+ moveleft = 1;
+ } else if(movingdir == 7) {
+ wdir = 2; // left
+ moveleft = 1;
+ }
+
+ checkpass = 1;
+ }
+ // *******************
+
+ // *** run away
+ if(mode == 3) {
+ wspd = npcinfo[i].walkspd / 2;
+
+ xdif = player.px - npx;
+ ydif = player.py - npy;
+
+ if(abs(xdif) > abs(ydif)) {
+ if(xdif < 4) wdir = 3;
+ if(xdif > -4) wdir = 2;
+ } else {
+ if(ydif < 4) wdir = 1;
+ if(ydif > -4) wdir = 0;
+ }
+
+ if(xdif < 4) moveright = 1;
+ if(xdif > -4) moveleft = 1;
+ if(ydif < 4) movedown = 1;
+ if(ydif > -4) moveup = 1;
+ }
+ // *******************
+
+ // -------------- ?? move*** vs movin***
+ int movinup = 0;
+ int movindown = 0;
+ int movinleft = 0;
+ int movinright = 0;
+
+ float xp = (npx / 2 + 6);
+ float yp = (npy / 2 + 10);
+
+ if(npcinfo[i].spriteset == 10) wspd = wspd * 2;
+
+ float ii = wspd * fpsr;
+ if(ii < 1) ii = 1;
+
+ SDL_LockSurface(clipbg);
+
+ if(moveup) {
+ sx = xp;
+ sy = yp - ii;
+ temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ dq = *temp;
+ if(npcinfo[i].spriteset == 11) dq = 0;
+
+ if(dq == 0) movinup = 1;
+ if(dq > 0) {
+ sx = xp - ii;
+ sy = yp - ii;
+ temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ dq = *temp;
+ if(npcinfo[i].spriteset == 11) dq = 0;
+ if(dq == 0) {
+ movinup = 1;
+ movinleft = 1;
+ }
+ }
+ if(dq > 0) {
+ sx = xp + ii;
+ sy = yp - ii;
+ temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ dq = *temp;
+ if(npcinfo[i].spriteset == 11) dq = 0;
+ if(dq == 0) {
+ movinup = 1;
+ movinright = 1;
+ }
+ }
+ }
+
+ if(movedown) {
+ sx = xp;
+ sy = yp + ii;
+ temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ dq = *temp;
+ if(npcinfo[i].spriteset == 11) dq = 0;
+ if(dq == 0) movindown = 1;
+ if(dq > 0) {
+ sx = xp - ii;
+ sy = yp + ii;
+ temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ dq = *temp;
+ if(npcinfo[i].spriteset == 11) dq = 0;
+ if(dq == 0) {
+ movindown = 1;
+ movinleft = 1;
+ }
+ }
+ if(dq > 0) {
+ sx = xp + ii;
+ sy = yp + ii;
+ temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ dq = *temp;
+ if(npcinfo[i].spriteset == 11) dq = 0;
+ if(dq == 0 ) {
+ movindown = 1;
+ movinright = 1;
+ }
+ }
+ }
+
+ if(moveleft) {
+ sx = xp - ii;
+ sy = yp;
+ temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ dq = *temp;
+ if(npcinfo[i].spriteset == 11) dq = 0;
+ if(dq == 0) movinleft = 1;
+ if(dq > 0) {
+ sx = xp - ii;
+ sy = yp - ii;
+ temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ dq = *temp;
+ if(npcinfo[i].spriteset == 11) dq = 0;
+ if(dq == 0) {
+ movinleft = 1;
+ movinup = 1;
+ }
+ }
+ if(dq > 0) {
+ sx = xp - ii;
+ sy = yp + ii;
+ temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ dq = *temp;
+ if(npcinfo[i].spriteset == 11) dq = 0;
+ if(dq == 0) {
+ movinleft = 1;
+ movindown = 1;
+ }
+ }
+ }
+
+ if(moveright) {
+ sx = xp + ii;
+ sy = yp;
+ temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ dq = *temp;
+ if(npcinfo[i].spriteset == 11) dq = 0;
+ if(dq == 0) movinright = 1;
+ if(dq > 0) {
+ sx = xp + ii;
+ sy = yp - ii;
+ temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ dq = *temp;
+ if(npcinfo[i].spriteset == 11) dq = 0;
+ if(dq == 0) {
+ movinright = 1;
+ movinup = 1;
+ }
+ }
+ if(dq > 0) {
+ sx = xp + ii;
+ sy = yp + ii;
+ temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ dq = *temp;
+ if(npcinfo[i].spriteset == 11) dq = 0;
+ if(dq == 0) {
+ movinright = 1;
+ movindown = 1;
+ }
+ }
+ }
+
+ if(movinup) npy = npy - wspd * fpsr;
+ if(movindown) npy = npy + wspd * fpsr;
+ if(movinleft) npx = npx - wspd * fpsr;
+ if(movinright) npx = npx + wspd * fpsr;
+
+ if(checkpass == 1) {
+ pass = 0;
+ if(npx >= npcinfo[i].x1 * 16 - 8 && npx <= npcinfo[i].x2 * 16 + 8 && npy >= npcinfo[i].y1 * 16 - 8 && npy <= npcinfo[i].y2 * 16 + 8) pass = 1;
+ if(pass == 0) {
+ npx = onpx;
+ npy = onpy;
+ npcinfo[i].ticks = ticks;
+ }
+ }
+
+ float aspd = wspd;
+
+ if(npcinfo[i].spriteset == 10) aspd = wspd / 2;
+
+ xp = (npx / 2 + 6);
+ yp = (npy / 2 + 10);
+
+ sx = xp;
+ sy = yp;
+ temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ bgc = *temp;
+
+ SDL_UnlockSurface(clipbg);
+
+ float anpx = npx + 12;
+ float anpy = npy + 20;
+
+ int lx = (int)anpx / 16;
+ int ly = (int)anpy / 16;
+
+ if(triggerloc[lx][ly] > -1) bgc = 1;
+ if(npcinfo[i].spriteset == 11) bgc = 0;
+
+ int rst = 0;
+
+ if(npcinfo[i].spriteset == 11) {
+ if(npx < 40 || npx > 280 || npy < 36 || npy > 204) rst = 1;
+ }
+
+ if(bgc > 0 || rst == 1) {
+ npx = onpx;
+ npy = onpy;
+ }
+
+ npcinfo[i].x = npx;
+ npcinfo[i].y = npy;
+
+ npcinfo[i].walkdir = wdir;
+ npcinfo[i].moving = 0;
+
+ if(npx != onpx || npy != onpy) npcinfo[i].moving = 1;
+
+ if(npcinfo[i].moving == 1) {
+ float frame = npcinfo[i].frame;
+ int cframe = npcinfo[i].cframe;
+
+ frame = frame + aspd * fpsr;
+ while(frame >= 16)
+ frame = frame - 16;
+
+ cframe = (int)(frame);
+ if(cframe > 16) cframe = 16 - 1;
+ if(cframe < 0) cframe = 0;
+
+ npcinfo[i].frame = frame;
+ npcinfo[i].cframe = cframe;
+ }
+
+ // spriteset1 specific
+ if(npcinfo[i].spriteset == 1 && npcinfo[i].attackattempt < ticks) {
+ if(npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ npx = npcinfo[i].x;
+ npy = npcinfo[i].y;
+
+ xdif = player.px - npx;
+ ydif = player.py - npy;
+
+ if(abs(xdif) < 20 && abs(ydif) < 20) {
+ npcinfo[i].attackattempt = ticks + 100;
+ if((int)(RND() * 2) == 0) {
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndenemyhit], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ npcinfo[i].attacking = 1;
+ npcinfo[i].attackframe = 0;
+ }
+ }
+ }
+ }
+
+ // onewing specific
+ if(npcinfo[i].spriteset == 2) {
+ if(npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ npx = npcinfo[i].x;
+ npy = npcinfo[i].y;
+
+ xdif = player.px - npx;
+ ydif = player.py - npy;
+
+ if(abs(xdif) < 24 && abs(ydif) < 24) {
+ float dist = sqrt(xdif * xdif + ydif * ydif);
+
+ if((dist) < 24) {
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndbite], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ npcinfo[i].attacking = 1;
+ npcinfo[i].attackframe = 0;
+
+ npcinfo[i].headtargetx[0] = player.px + 12;
+ npcinfo[i].headtargety[0] = player.py - 4;
+ }
+ }
+
+ }
+
+ dospell = 0;
+
+ if(npcinfo[i].attacking == 0 && npcinfo[i].castpause < ticks) {
+ npcinfo[i].swayspd = npcinfo[i].swayspd + npcinfo[i].swayspd / 200 * fpsr;
+ if(npcinfo[i].swayspd > 15) {
+ dospell = 1;
+ npcinfo[i].swayspd = 1;
+ }
+
+ // sway code
+ npcinfo[i].swayangle = npcinfo[i].swayangle + npcinfo[i].swayspd * fpsr;
+ if(npcinfo[i].swayangle >= 360) npcinfo[i].swayangle = npcinfo[i].swayangle - 360;
+
+ npcinfo[i].headtargetx[0] = npcinfo[i].x + (24 - npcinfo[i].swayspd / 2) * sin(3.14159 / 180 * npcinfo[i].swayangle) + 12;
+ npcinfo[i].headtargety[0] = npcinfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * npcinfo[i].swayangle);
+ }
+
+ if(dospell == 1) {
+ npcinfo[i].pause = ticks + 3000;
+ npcinfo[i].attacknext = ticks + 4500;
+ npcinfo[i].castpause = ticks + 4500;
+
+ game_castspell(3, npcinfo[i].x, npcinfo[i].y, npcinfo[i].x, npcinfo[i].y, i);
+
+ npcinfo[i].headtargetx[0] = npcinfo[i].x;
+ npcinfo[i].headtargety[0] = npcinfo[i].y - 36 + 16;
+ }
+
+ // targethead code
+ xdif = npcinfo[i].bodysection[7].x - npcinfo[i].headtargetx[0];
+ ydif = npcinfo[i].bodysection[7].y - npcinfo[i].headtargety[0];
+
+
+ npcinfo[i].bodysection[7].x = npcinfo[i].bodysection[7].x - xdif * 0.4 * fpsr;
+ npcinfo[i].bodysection[7].y = npcinfo[i].bodysection[7].y - ydif * 0.4 * fpsr;
+
+
+ npcinfo[i].bodysection[0].x = npcinfo[i].x + 12;
+ npcinfo[i].bodysection[0].y = npcinfo[i].y + 12;
+
+ for(int f = 6; f >= 1; f--) {
+ xdif = npcinfo[i].bodysection[f + 1].x - npcinfo[i].bodysection[f - 1].x;
+ ydif = npcinfo[i].bodysection[f + 1].y - npcinfo[i].bodysection[f - 1].y;
+
+ float tx = npcinfo[i].bodysection[f - 1].x + xdif / 2;
+ float ty = npcinfo[i].bodysection[f - 1].y + ydif / 2;
+
+ npcinfo[i].bodysection[f].x = npcinfo[i].bodysection[f].x - (npcinfo[i].bodysection[f].x - tx) / 3;
+ npcinfo[i].bodysection[f].y = npcinfo[i].bodysection[f].y - (npcinfo[i].bodysection[f].y - ty) / 3;
+ }
+ }
+
+ // boss1 specific and blackknight
+ if(npcinfo[i].spriteset == 3 || npcinfo[i].spriteset == 4) {
+ if(npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ npcinfo[i].attacking = 1;
+ npcinfo[i].attackframe = 0;
+
+ game_castspell(1, npcinfo[i].x, npcinfo[i].y, player.px, player.py, i);
+ }
+
+ if(npcinfo[i].castpause < ticks) {
+ game_castspell(6, npcinfo[i].x, npcinfo[i].y, player.px, player.py, i);
+ npcinfo[i].castpause = ticks + 12000;
+ }
+ }
+
+
+ // firehydra specific
+ if(npcinfo[i].spriteset == 5) {
+ npcinfo[i].swayspd = 4;
+
+ // sway code
+ npcinfo[i].swayangle = npcinfo[i].swayangle + npcinfo[i].swayspd * fpsr;
+ if(npcinfo[i].swayangle >= 360) npcinfo[i].swayangle = npcinfo[i].swayangle - 360;
+
+ for(int ff = 0; ff <= 2; ff++) {
+ if(npcinfo[i].hp > 10 * ff * 20) {
+ if(npcinfo[i].pause < ticks && npcinfo[i].attacking2[ff] == 0 && npcinfo[i].attacknext2[ff] < ticks) {
+ npx = npcinfo[i].x;
+ npy = npcinfo[i].y;
+
+ xdif = player.px - npx;
+ ydif = player.py - npy;
+
+ if(abs(xdif) < 48 && abs(ydif) < 48) {
+ float dist = sqrt(xdif * xdif + ydif * ydif);
+
+ if((dist) < 36) {
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndbite], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ npcinfo[i].attacking = 1;
+ npcinfo[i].attacking2[ff] = 1;
+ npcinfo[i].attackframe2[ff] = 0;
+
+ npcinfo[i].headtargetx[ff] = player.px + 12;
+ npcinfo[i].headtargety[ff] = player.py - 4;
+
+ npcinfo[i].swayangle = 0;
+ }
+ }
+
+ }
+
+ if(npcinfo[i].attacking2[ff] == 0) {
+ npcinfo[i].headtargetx[ff] = npcinfo[i].x + 38 * sin(3.14159 / 180 * (npcinfo[i].swayangle + 120 * ff)) + 12;
+ npcinfo[i].headtargety[ff] = npcinfo[i].y - 46 + 16 + 16 * sin(3.14159 * 2 / 180 * (npcinfo[i].swayangle + 120 * ff));
+ }
+
+ // targethead code
+ xdif = npcinfo[i].bodysection[10 * ff + 9].x - npcinfo[i].headtargetx[ff];
+ ydif = npcinfo[i].bodysection[10 * ff + 9].y - npcinfo[i].headtargety[ff];
+
+ npcinfo[i].bodysection[10 * ff + 9].x = npcinfo[i].bodysection[10 * ff + 9].x - xdif * 0.4 * fpsr;
+ npcinfo[i].bodysection[10 * ff + 9].y = npcinfo[i].bodysection[10 * ff + 9].y - ydif * 0.4 * fpsr;
+
+ npcinfo[i].bodysection[10 * ff].x = npcinfo[i].x + 12 + 8 * cos(3.141592 * 2 * (itemyloc / 16 + ff * 120 / 360));
+ npcinfo[i].bodysection[10 * ff].y = npcinfo[i].y + 12 + 8 * sin(3.141592 * 2 * (itemyloc / 16 + ff * 120 / 360));
+
+ for(int f = 8; f >= 1; f--) {
+ xdif = npcinfo[i].bodysection[ff * 10 + f + 1].x - npcinfo[i].bodysection[ff * 10 + f - 1].x;
+ ydif = npcinfo[i].bodysection[ff * 10 + f + 1].y - npcinfo[i].bodysection[ff * 10 + f - 1].y;
+
+ float tx = npcinfo[i].bodysection[ff * 10 + f - 1].x + xdif / 2;
+ float ty = npcinfo[i].bodysection[ff * 10 + f - 1].y + ydif / 2;
+
+ npcinfo[i].bodysection[ff * 10 + f].x = npcinfo[i].bodysection[ff * 10 + f].x - (npcinfo[i].bodysection[ff * 10 + f].x - tx) / 3;
+ npcinfo[i].bodysection[ff * 10 + f].y = npcinfo[i].bodysection[ff * 10 + f].y - (npcinfo[i].bodysection[ff * 10 + f].y - ty) / 3;
+ }
+ }
+ }
+ }
+
+ // spriteset6 specific
+ if(npcinfo[i].spriteset == 6 && npcinfo[i].attackattempt < ticks) {
+ if(npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ npx = npcinfo[i].x;
+ npy = npcinfo[i].y;
+
+ xdif = player.px - npx;
+ ydif = player.py - npy;
+
+ pass = 0;
+ if(abs(xdif) < 48 && abs(ydif) < 6) pass = 1;
+ if(abs(ydif) < 48 && abs(xdif) < 6) pass = 2;
+
+ if(pass > 0) {
+ npcinfo[i].attackattempt = ticks + 100;
+ if((int)(RND() * 2) == 0) {
+ npcinfo[i].attacking = 1;
+ npcinfo[i].attackframe = 0;
+
+ if(pass == 1 && xdif < 0) {
+ nnxa = npx - 8;
+ nnya = npy + 4;
+ nnxb = npx - 48 - 8;
+ nnyb = npy + 4;
+ } else if(pass == 1 && xdif > 0) {
+ nnxa = npx + 16;
+ nnya = npy + 4;
+ nnxb = npx + 16 + 48;
+ nnyb = npy + 4;
+ } else if(pass == 2 && ydif < 0) {
+ nnya = npy;
+ nnxa = npx + 4;
+ nnyb = npy - 48;
+ nnxb = npx + 4;
+ } else if(pass == 2 && ydif > 0) {
+ nnya = npy + 20;
+ nnxa = npx + 4;
+ nnyb = npy + 20 + 48;
+ nnxb = npx + 4;
+ }
+
+ game_castspell(7, nnxa, nnya, nnxb, nnyb, i);
+ }
+ }
+ }
+ }
+
+ // wizard1 specific
+ if(npcinfo[i].spriteset == 7) {
+ if(npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ npcinfo[i].attacking = 1;
+ npcinfo[i].attackframe = 0;
+
+ game_castspell(9, npcinfo[i].x, npcinfo[i].y, player.px, player.py, i);
+ }
+
+ if(npcinfo[i].castpause < ticks) {
+ // game_castspell 6, npcinfo[i].x, npcinfo[i].y, player.px, player.py, i
+ // npcinfo[i].castpause = ticks + 12000
+ }
+
+ }
+
+ // spriteset6 specific
+ if(npcinfo[i].spriteset == 8 && npcinfo[i].attackattempt < ticks) {
+ if(npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ npx = npcinfo[i].x;
+ npy = npcinfo[i].y;
+
+ xdif = player.px - npx;
+ ydif = player.py - npy;
+
+ pass = 0;
+ if(abs(xdif) < 56 && abs(ydif) < 6) pass = 1;
+ if(abs(ydif) < 56 && abs(xdif) < 6) pass = 2;
+
+ if(pass > 0) {
+ npcinfo[i].attackattempt = ticks + 100;
+ if((int)(RND() * 2) == 0) {
+ npcinfo[i].attacking = 1;
+ npcinfo[i].attackframe = 0;
+
+ if(pass == 1 && xdif < 0) {
+ nnxa = npx - 8;
+ nnya = npy + 4;
+ nnxb = npx - 56 - 8;
+ nnyb = npy + 4;
+ npcinfo[i].walkdir = 2;
+ } else if(pass == 1 && xdif > 0) {
+ nnxa = npx + 16;
+ nnya = npy + 4;
+ nnxb = npx + 16 + 56;
+ nnyb = npy + 4;
+ npcinfo[i].walkdir = 3;
+ } else if(pass == 2 && ydif < 0) {
+ nnya = npy;
+ nnxa = npx + 4;
+ nnyb = npy - 56;
+ nnxb = npx + 4;
+ npcinfo[i].walkdir = 0;
+ } else if(pass == 2 && ydif > 0) {
+ nnya = npy + 20;
+ nnxa = npx + 4;
+ nnyb = npy + 20 + 56;
+ nnxb = npx + 4;
+ npcinfo[i].walkdir = 1;
+ }
+
+ game_castspell(7, nnxa, nnya, nnxb, nnyb, i);
+ }
+ }
+ }
+ }
+
+ // twowing specific
+ if(npcinfo[i].spriteset == 9) {
+ if(npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ npx = npcinfo[i].bodysection[7].x;
+ npy = npcinfo[i].bodysection[7].y;
+
+ xdif = player.px - npx;
+ ydif = player.py - npy;
+
+ if(abs(xdif) < 24 && abs(ydif) < 24) {
+ float dist = sqrt(xdif * xdif + ydif * ydif);
+
+ if((dist) < 24) {
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndbite], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ npcinfo[i].attacking = 1;
+ npcinfo[i].attackframe = 0;
+
+ npcinfo[i].headtargetx[0] = player.px + 12;
+ npcinfo[i].headtargety[0] = player.py - 4;
+ }
+ }
+
+ }
+
+ if(npcinfo[i].attacking == 0 && npcinfo[i].castpause < ticks) {
+ npcinfo[i].swayspd = 4;
+
+ // sway code
+ npcinfo[i].swayangle = npcinfo[i].swayangle + npcinfo[i].swayspd * fpsr;
+ if(npcinfo[i].swayangle >= 360) npcinfo[i].swayangle = npcinfo[i].swayangle - 360;
+
+ npcinfo[i].headtargetx[0] = npcinfo[i].x + (24 - npcinfo[i].swayspd / 2) * sin(3.14159 / 180 * npcinfo[i].swayangle) + 12;
+ npcinfo[i].headtargety[0] = npcinfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * npcinfo[i].swayangle);
+ }
+
+ if(dospell == 1) {
+ npcinfo[i].pause = ticks + 3000;
+ npcinfo[i].attacknext = ticks + 5000;
+ npcinfo[i].castpause = ticks + 3000;
+
+ game_castspell(3, npcinfo[i].x, npcinfo[i].y, npcinfo[i].x, npcinfo[i].y, i);
+
+ npcinfo[i].headtargetx[0] = npcinfo[i].x;
+ npcinfo[i].headtargety[0] = npcinfo[i].y - 36 + 16;
+ }
+
+ // targethead code
+ xdif = npcinfo[i].bodysection[7].x - npcinfo[i].headtargetx[0];
+ ydif = npcinfo[i].bodysection[7].y - npcinfo[i].headtargety[0];
+
+
+ npcinfo[i].bodysection[7].x = npcinfo[i].bodysection[7].x - xdif * 0.4 * fpsr;
+ npcinfo[i].bodysection[7].y = npcinfo[i].bodysection[7].y - ydif * 0.4 * fpsr;
+
+ npcinfo[i].bodysection[0].x = npcinfo[i].x + 12;
+ npcinfo[i].bodysection[0].y = npcinfo[i].y + 12;
+
+ for(int f = 6; f >= 1; f--) {
+ xdif = npcinfo[i].bodysection[f + 1].x - npcinfo[i].bodysection[f - 1].x;
+ ydif = npcinfo[i].bodysection[f + 1].y - npcinfo[i].bodysection[f - 1].y;
+
+ float tx = npcinfo[i].bodysection[f - 1].x + xdif / 2;
+ float ty = npcinfo[i].bodysection[f - 1].y + ydif / 2;
+
+ npcinfo[i].bodysection[f].x = npcinfo[i].bodysection[f].x - (npcinfo[i].bodysection[f].x - tx) / 3;
+ npcinfo[i].bodysection[f].y = npcinfo[i].bodysection[f].y - (npcinfo[i].bodysection[f].y - ty) / 3;
+ }
+
+ }
+
+ // dragon2 specific
+ if(npcinfo[i].spriteset == 10 && npcinfo[i].attackattempt < ticks) {
+ if(npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ npx = npcinfo[i].x;
+ npy = npcinfo[i].y;
+
+ xdif = player.px - npx;
+ ydif = player.py - npy;
+
+ if(abs(xdif) < 32 && abs(ydif) < 32) {
+ npcinfo[i].attackattempt = ticks + 100;
+ if((int)(RND() * 2) == 0) {
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndenemyhit], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ npcinfo[i].attacking = 1;
+ npcinfo[i].attackframe = 0;
+ }
+ }
+ }
+ }
+
+
+ // endboss specific
+ if(npcinfo[i].spriteset == 11 && npcinfo[i].attackattempt < ticks) {
+ if(npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ npx = npcinfo[i].x;
+ npy = npcinfo[i].y;
+
+ xdif = player.px - npx;
+ ydif = player.py - npy;
+
+ if(abs(xdif) < 38 && abs(ydif) < 38) {
+ npcinfo[i].attackattempt = ticks + 100;
+ if((int)(RND() * 2) == 0) {
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndice], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+ npcinfo[i].attacking = 1;
+ npcinfo[i].attackframe = 0;
+ }
+ }
+ }
+ }
+ }
+
+
+ int dist; float damage;
+
+ npx = npcinfo[i].x;
+ npy = npcinfo[i].y;
+
+ int xp = (npx / 2 + 6);
+ int yp = (npy / 2 + 10);
+
+ rcSrc.x = xp - 1;
+ rcSrc.y = yp - 1;
+ rcSrc.w = 3;
+ rcSrc.h = 3;
+
+ if(npcinfo[i].pause < ticks) SDL_FillRect(clipbg, &rcSrc, i);
+
+
+ pass = 0;
+ if(npcinfo[i].attacking == 1) pass = 1;
+ if(npcinfo[i].spriteset == 5) {
+ if(npcinfo[i].attacking2[0] == 1) pass = 1;
+ if(npcinfo[i].attacking2[1] == 1) pass = 1;
+ if(npcinfo[i].attacking2[2] == 1) pass = 1;
+ }
+
+ if(pass == 1) {
+ // spriteset1 specific
+ if(npcinfo[i].spriteset == 1) {
+ npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * fpsr;
+ if(npcinfo[i].attackframe >= 16) {
+ npcinfo[i].attackframe = 0;
+ npcinfo[i].attacking = 0;
+ npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
+ }
+
+ npcinfo[i].cattackframe = (int)(npcinfo[i].attackframe);
+
+ npx = npcinfo[i].x;
+ npy = npcinfo[i].y;
+
+ xdif = player.px - npx;
+ ydif = player.py - npy;
+
+ dist = 10;
+
+ if(abs(xdif) < dist && abs(ydif) < dist && player.pause < ticks) {
+ npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
+ // npcinfo[i].attackframe = 0;
+ // npcinfo[i].attacking = 0;
+
+ damage = (float)npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
+
+ if(player.hp > 0) game_damageplayer(damage);
+ }
+ }
+
+ if(npcinfo[i].spriteset == 2) {
+ // targethead code
+ xdif = npcinfo[i].bodysection[7].x - npcinfo[i].headtargetx[0];
+ ydif = npcinfo[i].bodysection[7].y - npcinfo[i].headtargety[0];
+
+ npcinfo[i].bodysection[7].x = npcinfo[i].bodysection[7].x - xdif * 0.4 * fpsr;
+ npcinfo[i].bodysection[7].y = npcinfo[i].bodysection[7].y - ydif * 0.4 * fpsr;
+
+ npcinfo[i].bodysection[0].x = npcinfo[i].x + 12;
+ npcinfo[i].bodysection[0].y = npcinfo[i].y + 12;
+
+ for(int f = 6; f >= 1; f--) {
+ xdif = npcinfo[i].bodysection[f + 1].x - npcinfo[i].bodysection[f - 1].x;
+ ydif = npcinfo[i].bodysection[f + 1].y - npcinfo[i].bodysection[f - 1].y;
+
+ float tx = npcinfo[i].bodysection[f - 1].x + xdif / 2;
+ float ty = npcinfo[i].bodysection[f - 1].y + ydif / 2;
+
+ npcinfo[i].bodysection[f].x = npcinfo[i].bodysection[f].x - (npcinfo[i].bodysection[f].x - tx);
+ npcinfo[i].bodysection[f].y = npcinfo[i].bodysection[f].y - (npcinfo[i].bodysection[f].y - ty);
+ }
+
+ npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * fpsr;
+ if(npcinfo[i].attackframe >= 16) {
+ npcinfo[i].attackframe = 0;
+ npcinfo[i].attacking = 0;
+ npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
+ }
+
+ npcinfo[i].cattackframe = (int)(npcinfo[i].attackframe);
+
+ npx = npcinfo[i].bodysection[7].x;
+ npy = (npcinfo[i].bodysection[7].y + 16);
+
+ xdif = (player.px + 12) - npx;
+ ydif = (player.py + 12) - npy;
+
+ dist = 8;
+
+ if(abs(xdif) < dist && abs(ydif) < dist && player.pause < ticks) {
+ npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
+ // npcinfo[i].attackframe = 0
+ // npcinfo[i].attacking = 0
+ damage = (float)npcinfo[i].attackdamage * (1.0 + (RND() * 0.5));
+ if(player.hp > 0) game_damageplayer(damage);
+ }
+ }
+
+
+ // firehydra
+ if(npcinfo[i].spriteset == 5) {
+ for(int ff = 0; ff <= 2; ff++) {
+ if(npcinfo[i].attacking2[ff] == 1) {
+ xdif = npcinfo[i].bodysection[10 * ff + 9].x - npcinfo[i].headtargetx[ff];
+ ydif = npcinfo[i].bodysection[10 * ff + 9].y - npcinfo[i].headtargety[ff];
+
+ npcinfo[i].bodysection[10 * ff + 9].x = npcinfo[i].bodysection[10 * ff + 9].x - xdif * .2 * fpsr;
+ npcinfo[i].bodysection[10 * ff + 9].y = npcinfo[i].bodysection[10 * ff + 9].y - ydif * .2 * fpsr;
+
+ npcinfo[i].bodysection[10 * ff].x = npcinfo[i].x + 12 + 8 * cos(3.141592 * 2 * (itemyloc / 16 + ff * 120 / 360));
+ npcinfo[i].bodysection[10 * ff].y = npcinfo[i].y + 12 + 8 * sin(3.141592 * 2 * (itemyloc / 16 + ff * 120 / 360));
+
+ for(int f = 8; f >= 1; f--) {
+ xdif = npcinfo[i].bodysection[ff * 10 + f + 1].x - npcinfo[i].bodysection[ff * 10 + f - 1].x;
+ ydif = npcinfo[i].bodysection[ff * 10 + f + 1].y - npcinfo[i].bodysection[ff * 10 + f - 1].y;
+
+ float tx = npcinfo[i].bodysection[ff * 10 + f - 1].x + xdif / 2;
+ float ty = npcinfo[i].bodysection[ff * 10 + f - 1].y + ydif / 2;
+
+ npcinfo[i].bodysection[ff * 10 + f].x = npcinfo[i].bodysection[ff * 10 + f].x - (npcinfo[i].bodysection[ff * 10 + f].x - tx) / 3;
+ npcinfo[i].bodysection[ff * 10 + f].y = npcinfo[i].bodysection[ff * 10 + f].y - (npcinfo[i].bodysection[ff * 10 + f].y - ty) / 3;
+ }
+
+ npcinfo[i].attackframe2[ff] = npcinfo[i].attackframe2[ff] + npcinfo[i].attackspd * fpsr;
+ if(npcinfo[i].attackframe2[ff] >= 16) {
+ npcinfo[i].attackframe2[ff] = 0;
+ npcinfo[i].attacking2[ff] = 0;
+ npcinfo[i].attacknext2[ff] = ticks + npcinfo[i].attackdelay;
+ }
+
+ npcinfo[i].cattackframe = (int)(npcinfo[i].attackframe);
+
+ npx = npcinfo[i].bodysection[10 * ff + 9].x;
+ npy = (npcinfo[i].bodysection[10 * ff + 9].y + 16);
+
+ xdif = (player.px + 12) - npx;
+ ydif = (player.py + 12) - npy;
+
+ dist = 8;
+
+ if(abs(xdif) < dist && abs(ydif) < dist && player.pause < ticks) {
+ npcinfo[i].attacknext2[ff] = ticks + npcinfo[i].attackdelay;
+ // npcinfo[i].attackframe2(ff) = 0
+ // npcinfo[i].attacking2(ff) = 0
+ damage = (float)npcinfo[i].attackdamage * (1.0 + RND() * 0.5);
+ if(player.hp > 0) game_damageplayer(damage);
+ }
+ }
+ }
+
+ }
+
+ // twowing specific
+ if(npcinfo[i].spriteset == 9) {
+ // targethead code
+ xdif = npcinfo[i].bodysection[7].x - npcinfo[i].headtargetx[0];
+ ydif = npcinfo[i].bodysection[7].y - npcinfo[i].headtargety[0];
+
+ npcinfo[i].bodysection[7].x = npcinfo[i].bodysection[7].x - xdif * 0.4 * fpsr;
+ npcinfo[i].bodysection[7].y = npcinfo[i].bodysection[7].y - ydif * 0.4 * fpsr;
+
+ npcinfo[i].bodysection[0].x = npcinfo[i].x + 12;
+ npcinfo[i].bodysection[0].y = npcinfo[i].y + 12;
+
+ for(int f = 6; f >= 1; f--) {
+ xdif = npcinfo[i].bodysection[f + 1].x - npcinfo[i].bodysection[f - 1].x;
+ ydif = npcinfo[i].bodysection[f + 1].y - npcinfo[i].bodysection[f - 1].y;
+
+ float tx = npcinfo[i].bodysection[f - 1].x + xdif / 2;
+ float ty = npcinfo[i].bodysection[f - 1].y + ydif / 2;
+
+ npcinfo[i].bodysection[f].x = npcinfo[i].bodysection[f].x - (npcinfo[i].bodysection[f].x - tx);
+ npcinfo[i].bodysection[f].y = npcinfo[i].bodysection[f].y - (npcinfo[i].bodysection[f].y - ty);
+ }
+
+ npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * fpsr;
+ if(npcinfo[i].attackframe >= 16) {
+ npcinfo[i].attackframe = 0;
+ npcinfo[i].attacking = 0;
+ npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
+ }
+
+ npcinfo[i].cattackframe = (int)(npcinfo[i].attackframe);
+
+ npx = npcinfo[i].bodysection[7].x;
+ npy = (npcinfo[i].bodysection[7].y + 16);
+
+ xdif = (player.px + 12) - npx;
+ ydif = (player.py + 12) - npy;
+
+ dist = 8;
+
+ if(abs(xdif) < dist && abs(ydif) < dist && player.pause < ticks) {
+ npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
+ // npcinfo[i].attackframe = 0
+ // npcinfo[i].attacking = 0
+ damage = (float)npcinfo[i].attackdamage * (1.0 + RND() * 0.5);
+ if(player.hp > 0) game_damageplayer(damage);
+ }
+ }
+
+ // dragon 2 specific
+ if(npcinfo[i].spriteset == 10) {
+
+ npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * fpsr;
+ if(npcinfo[i].attackframe >= 16) {
+ npcinfo[i].attackframe = 0;
+ npcinfo[i].attacking = 0;
+ npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
+ }
+
+ npcinfo[i].cattackframe = (int)(npcinfo[i].attackframe);
+
+ npx = npcinfo[i].x;
+ npy = npcinfo[i].y;
+
+ xdif = player.px - npx;
+ ydif = player.py - npy;
+
+ dist = 16 + npcinfo[i].attackframe;
+
+ if(abs(xdif) < dist && abs(ydif) < dist && player.pause < ticks) {
+ npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
+ // npcinfo[i].attackframe = 0
+ // npcinfo[i].attacking = 0
+ damage = (float)npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
+ if(player.hp > 0) game_damageplayer(damage);
+ }
+ }
+
+ // endboss specific
+ if(npcinfo[i].spriteset == 11) {
+ npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * fpsr;
+ if(npcinfo[i].attackframe >= 16) {
+ npcinfo[i].attackframe = 0;
+ npcinfo[i].attacking = 0;
+ npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
+ }
+
+ npcinfo[i].cattackframe = (int)(npcinfo[i].attackframe);
+
+ npx = npcinfo[i].x;
+ npy = npcinfo[i].y;
+
+ xdif = player.px - npx;
+ ydif = player.py - npy;
+
+ dist = 36;
+
+ if(abs(xdif) < dist && abs(ydif) < dist && player.pause < ticks) {
+ npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
+ // npcinfo[i].attackframe = 0
+ // npcinfo[i].attacking = 0
+ damage = (float)npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
+ if(player.hp > 0) game_damageplayer(damage);
+ }
+ }
+ }
+ // -------end fight code
+ }
+ }
+}
+
+void game_updspells()
+{
+ int foundel[5];
+ float npx, npy;
+ long cl1, cl2, cl3;
+ int ll[4][2];
+
+ float xloc = 0, yloc = 0, xst, yst, xdif, ydif;
+
+ for(int i = 0; i < MAXSPELL; i++) {
+ if(spellinfo[i].frame > 0) {
+ int spellnum = spellinfo[i].spellnum;
+
+ // water
+ if(spellnum == 0 && forcepause == 0) {
+ float fr = (32 - spellinfo[i].frame);
+
+ ll[0][0] = -2;
+ ll[0][1] = -3;
+ ll[1][0] = 2;
+ ll[1][1] = -3;
+ ll[2][0] = -4;
+ ll[2][1] = -2;
+ ll[3][0] = 4;
+ ll[3][1] = -2;
+
+ for(int f = 0; f <= 3; f++) {
+ if(fr > f * 4 && fr < f * 4 + 16) {
+ float alf = 255;
+
+ if(fr < f * 4 + 8) {
+ int fi = (int)((fr - f * 4) * 3) % 4;
+ rcSrc.x = 32 + fi * 16;
+ rcSrc.y = 80;
+ rcSrc.w = 16;
+ rcSrc.h = 16;
+
+ xloc = spellinfo[i].enemyx + 12 + ll[f][0] * 16;
+ yloc = spellinfo[i].enemyy + 16 + ll[f][1] * 16;
+
+ rcDest.x = xloc;
+ rcDest.y = yloc;
+
+ alf = 255 * ((fr - f * 4) / 8);
+ }
+
+ if(fr >= f * 4 + 8) {
+ int fi = 0; // ??
+
+ if(f == 0 || f == 2) fi = 0;
+ if(f == 1 || f == 3) fi = 1;
+ rcSrc.x = 32 + fi * 16;
+ rcSrc.y = 80;
+ rcSrc.w = 16;
+ rcSrc.h = 16;
+
+ xst = spellinfo[i].enemyx + 12 + ll[f][0] * 16;
+ yst = spellinfo[i].enemyy + 16 + ll[f][1] * 16;
+
+ float xi = (spellinfo[i].enemyx - xst) * 2 / 8;
+ float yi = (spellinfo[i].enemyy - yst) * 2 / 8;
+
+ float fl = (fr - f * 4 - 8) / 2;
+ xloc = xst + xi * fl * fl;
+ yloc = yst + yi * fl * fl;
+
+ rcDest.x = xloc;
+ rcDest.y = yloc;
+
+ alf = 255;
+ }
+
+ if(xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, alf);
+ SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
+
+ if(spellinfo[i].damagewho == 0) {
+ for(int e = 1; e <= lastnpc; e++) {
+
+ xdif = (xloc + 16) - (npcinfo[e].x + 12);
+ ydif = (yloc + 16) - (npcinfo[e].y + 12);
+
+ if((abs(xdif) < 16 && abs(ydif) < 16)) {
+ float damage = (float)player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
+
+ if(npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
+ game_damagenpc(e, damage, 1);
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndice], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+ }
+ }
+ }
+ }
+
+ // check for post damage
+ if(nposts > 0) {
+ for(int e = 0; e <= nposts - 1; e++) {
+ xdif = (xloc + 16) - (postinfo[e][0] + 8);
+ ydif = (yloc + 16) - (postinfo[e][1] + 8);
+
+ if((abs(xdif) < 16 && abs(ydif) < 16)) {
+ objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+
+ rcSrc.x = postinfo[e][0] / 2;
+ rcSrc.y = postinfo[e][1] / 2;
+ rcSrc.w = 8;
+ rcSrc.h = 8;
+
+ SDL_FillRect(clipbg2, &rcSrc, 0);
+
+ game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndice], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // metal
+ if(spellnum == 1 && forcepause == 0) {
+ float xdif, ydif;
+ int npc;
+ int fr = (int)((32 - spellinfo[i].frame)*4) % 3;
+
+ rcSrc.x = fr * 48;
+ rcSrc.y = 0;
+ rcSrc.w = 48;
+ rcSrc.h = 48;
+
+ float c1 = (32 - spellinfo[i].frame) / 16;
+
+ float halfx = (spellinfo[i].homex-12) + ((spellinfo[i].enemyx-12) - (spellinfo[i].homex-12)) / 2;
+ float halfy = (spellinfo[i].homey-12) + ((spellinfo[i].enemyy-12) - (spellinfo[i].homey-12)) / 2;
+
+ float wdth = (halfx - spellinfo[i].homex) * 1.2;
+ float hight = (halfy - spellinfo[i].homey) * 1.2;
+
+ xloc = halfx + wdth * cos(3.14159 + 3.14159 * 2 * c1);
+ yloc = halfy + hight * sin(3.14159 + 3.14159 * 2 * c1);
+
+ rcDest.x = xloc;
+ rcDest.y = yloc;
+
+ SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+
+ spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
+ if(spellinfo[i].frame < 0) spellinfo[i].frame = 0;
+
+ if(spellinfo[i].damagewho == 0) {
+ for(int e = 1; e <= lastnpc; e++) {
+ xdif = (xloc + 24) - (npcinfo[e].x + 12);
+ ydif = (yloc + 24) - (npcinfo[e].y + 12);
+
+ if((abs(xdif) < 24 && abs(ydif) < 24)) {
+ float damage = (float)player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
+
+ if(npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
+ game_damagenpc(e, damage, 1);
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndmetalhit], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+ }
+ }
+ }
+ }
+
+ if(spellinfo[i].damagewho == 1) {
+
+ // --------- boss 1 specific
+ if(spellinfo[i].frame == 0 && npcinfo[spellinfo[i].npc].spriteset == 3) {
+ npc = spellinfo[i].npc;
+ npcinfo[npc].attackframe = 0;
+ npcinfo[npc].attacking = 0;
+
+ npcinfo[npc].pause = ticks + 1000;
+ npcinfo[npc].attacknext = ticks + 4000;
+ }
+ // ---------------
+
+ // --------- blackknight specific
+ if(spellinfo[i].frame == 0 && npcinfo[spellinfo[i].npc].spriteset == 4) {
+ npc = spellinfo[i].npc;
+ npcinfo[npc].attackframe = 0;
+ npcinfo[npc].attacking = 0;
+
+ npcinfo[npc].pause = ticks + 1000;
+ npcinfo[npc].attacknext = ticks + 3500;
+ }
+ // ---------------
+
+ xdif = (xloc + 24) - (player.px + 12);
+ ydif = (yloc + 24) - (player.py + 12);
+
+ if((abs(xdif) < 24 && abs(ydif) < 24) && player.pause < ticks) {
+ npx = player.px;
+ npy = player.py;
+
+ float damage = (float)npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
+
+ if(player.hp > 0) {
+ game_damageplayer(damage);
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndmetalhit], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+ }
+ }
+ }
+
+
+ // check for(int post damage
+ if(nposts > 0) {
+ for(int e = 0; e <= nposts - 1; e++) {
+ xdif = (xloc + 24) - (postinfo[e][0] + 8);
+ ydif = (yloc + 24) - (postinfo[e][1] + 8);
+
+ if((abs(xdif) < 24 && abs(ydif) < 24)) {
+ objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+
+ rcSrc.x = postinfo[e][0] / 2;
+ rcSrc.y = postinfo[e][1] / 2;
+ rcSrc.w = 8;
+ rcSrc.h = 8;
+
+ SDL_FillRect(clipbg2, &rcSrc, 0);
+
+ game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndmetalhit], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+ }
+ }
+ }
+ }
+
+ // earth
+ if(spellnum == 2 && forcepause == 0) {
+ float hght = 240 - spellinfo[i].enemyy;
+
+ for(int f = 8; f >= 0; f--) {
+
+ float fr = (32 - spellinfo[i].frame);
+
+ if(fr > f && fr < f + 16) {
+ rcSrc.x = 32 * spellinfo[i].rockimg[f];
+ rcSrc.y = 48;
+ rcSrc.w = 32;
+ rcSrc.h = 32;
+
+ int scatter = 0;
+ if(fr < 8 + f) {
+ xloc = spellinfo[i].enemyx - 4;
+ yloc = spellinfo[i].enemyy * (1 - cos(3.14159 / 2 * (fr - f) / 8)); // ^ 2;
+ yloc *= yloc;
+ } else {
+ scatter = 1;
+ xloc = spellinfo[i].enemyx - 4 - spellinfo[i].rockdeflect[f] * sin(3.14159 / 2* ((fr - f) - 8) / 8);
+ yloc = spellinfo[i].enemyy + hght * (1 - cos(3.14159 / 2 * ((fr - f) - 8) / 8));
+ }
+
+ rcDest.x = xloc;
+ rcDest.y = yloc;
+
+ if(xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
+ SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+
+ if(scatter == 1) {
+ if(spellinfo[i].damagewho == 0) {
+ for(int e = 1; e <= lastnpc; e++) {
+ xdif = (xloc + 16) - (npcinfo[e].x + 12);
+ ydif = (yloc + 16) - (npcinfo[e].y + 12);
+
+ if((abs(xdif) < 16 && abs(ydif) < 16)) {
+ float damage = (float)player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
+
+ if(npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
+ game_damagenpc(e, damage, 1);
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndrocks], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+ }
+ }
+ }
+ }
+
+
+ // check for(int post damage
+ if(nposts > 0) {
+ for(int e = 0; e <= nposts - 1; e++) {
+ xdif = (xloc + 16) - (postinfo[e][0] + 8);
+ ydif = (yloc + 16) - (postinfo[e][1] + 8);
+
+ if((abs(xdif) < 16 && abs(ydif) < 16)) {
+ objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+
+ rcSrc.x = postinfo[e][0] / 2;
+ rcSrc.y = postinfo[e][1] / 2;
+ rcSrc.w = 8;
+ rcSrc.h = 8;
+
+ SDL_FillRect(clipbg2, &rcSrc, 0);
+
+ game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndrocks], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
+ if(spellinfo[i].frame < 0) spellinfo[i].frame = 0;
+ }
+
+ // crystal
+ if(spellnum == 5) {
+
+ float fra = (32 - spellinfo[i].frame);
+ int fr = (int)((spellinfo[i].frame) * 2) % 8;
+
+ rcSrc.x = fr * 32;
+ rcSrc.y = 96 + 48;
+ rcSrc.w = 32;
+ rcSrc.h = 64;
+
+ rcDest.x = player.px - 4;
+ rcDest.y = player.py + 16 - 48;
+
+ int f = 160;
+ if(fra < 8) f = 192 * fra / 8;
+ if(fra > 24) f = 192 * (1 - (fra - 24) / 8);
+
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, f);
+ SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
+
+ spellinfo[i].frame = spellinfo[i].frame - 0.3 * fpsr;
+ if(spellinfo[i].frame < 0) {
+ spellinfo[i].frame = 0;
+ forcepause = 0;
+
+ npx = player.px + 12;
+ npy = player.py + 20;
+
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
+
+ for(int f = 0; f < 5; f++) { // !! f < 5
+ foundel[f] = 0;
+ }
+
+ for(int xo = -2; xo <= 2; xo++) {
+ for(int yo = -2; yo <= 2; yo++) {
+
+ int sx = lx + xo;
+ int sy = ly + yo;
+
+ if(sx > -1 && sx < 20 && sy > -1 && sy < 15) {
+ for(int l = 0; l <= 2; l++) {
+ int curtile = tileinfo[l][sx][sy][0];
+ int curtilel = tileinfo[l][sx][sy][1];
+
+ if(curtile > 0) {
+ curtile = curtile - 1;
+ int curtilex = curtile % 20;
+ int curtiley = (curtile - curtilex) / 20;
+
+ int element = elementmap[curtiley][curtilex];
+ if(element > -1 && curtilel == 0) foundel[element + 1] = 1;
+ }
+ }
+
+ int o = objmap[sx][sy];
+ if(o > -1) {
+ if(objectinfo[o][4] == 1) foundel[2] = 1;
+ if(o == 1 || o == 2) {
+ foundel[2] = 1;
+ foundel[4] = 1;
+ }
+ }
+ }
+ }
+ }
+
+ char line[256];
+ strcpy(line, "Found... nothing...");
+
+ for(int f = 0; f < 5; f++) {
+ if(foundel[f] == 1 && player.foundspell[f] == 0) {
+ player.foundspell[f] = 1;
+ player.spellcharge[f] = 0;
+ if(f == 1) strcpy(line, "Found... Water Essence");
+ if(f == 2) strcpy(line, "Found... Metal Essence");
+ if(f == 3) strcpy(line, "Found... Earth Essence");
+ if(f == 4) strcpy(line, "Found... Fire Essence");
+ break;
+ }
+ }
+
+ game_eventtext(line);
+ }
+ }
+
+ // room fireballs
+ if(spellnum == 6 && forcepause == 0) {
+
+ if(spellinfo[i].frame > 16) {
+ float fr = (32 - spellinfo[i].frame);
+
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, 192 * sin(3.14159 * fr / 4));
+
+ rcSrc.x = 16 * (int)(RND() * 2);
+ rcSrc.y = 80;
+ rcSrc.w = 16;
+ rcSrc.h = 16;
+
+ for(int ff = 0; ff <= spellinfo[i].nfballs - 1; ff++) {
+
+ xloc = spellinfo[i].fireballs[ff][0] + (int)(RND() * 3) - 1;
+ yloc = spellinfo[i].fireballs[ff][1] + (int)(RND() * 3) - 1;
+
+ rcDest.x = xloc;
+ rcDest.y = yloc;
+
+ SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+ }
+
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
+ } else {
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, 192);
+
+ rcSrc.x = 16 * (int)(RND() * 2);
+ rcSrc.y = 80;
+ rcSrc.w = 16;
+ rcSrc.h = 16;
+
+ for(int ff = 0; ff <= spellinfo[i].nfballs - 1; ff++) {
+ float ax = spellinfo[i].fireballs[ff][0];
+ float ay = spellinfo[i].fireballs[ff][1];
+ float bx = player.px + 4;
+ float by = player.py + 4;
+ float d = sqrt((bx - ax) * (bx - ax) + (by - ay) * (by - ay));
+
+ float tx = (bx - ax) / d;
+ float ty = (by - ay) / d;
+
+ spellinfo[i].fireballs[ff][2] += tx * 1.2 * fpsr;
+ spellinfo[i].fireballs[ff][3] += ty * 1.2 * fpsr;
+
+ if(spellinfo[i].ballon[ff] == 1) {
+ spellinfo[i].fireballs[ff][0] = ax + spellinfo[i].fireballs[ff][2] * 0.2 * fpsr;
+ spellinfo[i].fireballs[ff][1] = ay + spellinfo[i].fireballs[ff][3] * 0.2 * fpsr;
+
+ xloc = spellinfo[i].fireballs[ff][0] + (int)(RND() * 3) - 1;
+ yloc = spellinfo[i].fireballs[ff][1] + (int)(RND() * 3) - 1;
+
+ rcDest.x = xloc;
+ rcDest.y = yloc;
+
+ SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+ }
+
+ if(xloc < -1 || yloc < -1 || xloc > 304 || yloc > 224) spellinfo[i].ballon[ff] = 0;
+ }
+
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
+ }
+
+ spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
+ if(spellinfo[i].frame < 0) spellinfo[i].frame = 0;
+
+ if(spellinfo[i].damagewho == 1) {
+ for(int ff = 0; ff <= spellinfo[i].nfballs - 1; ff++) {
+ if(spellinfo[i].ballon[ff] == 1) {
+ xloc = spellinfo[i].fireballs[ff][0] + (int)(RND() * 3) - 1;
+ yloc = spellinfo[i].fireballs[ff][1] + (int)(RND() * 3) - 1;
+
+ xdif = (xloc + 8) - (player.px + 12);
+ ydif = (yloc + 8) - (player.py + 12);
+
+ if((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks) {
+ float damage = npcinfo[spellinfo[i].npc].spelldamage * (1 + RND() * 0.5) / 3;
+
+ if(player.hp > 0) game_damageplayer(damage);
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndfire], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // lightning bomb
+ if(spellnum == 8) {
+
+ cl1 = SDL_MapRGB(videobuffer->format, 0, 32, 204);
+ cl2 = SDL_MapRGB(videobuffer->format, 142, 173, 191);
+ cl3 = SDL_MapRGB(videobuffer->format, 240, 240, 240);
+
+ float px = player.px + 12;
+ float py = player.py + 12;
+
+ int apx = px + (int)(RND() * 5 - 2);
+ int apy = py + (int)(RND() * 5 - 2);
+
+ for(int f = 0; f <= 0; f++) { // ??
+ int y = apy;
+ int orn = 0;
+ for(int x = apx; x <= 319; x++) {
+ int rn = (int)(RND() * 3);
+
+ if(orn == 0) y = y - 1;
+ if(orn == 2) y = y + 1;
+
+ sys_line(videobuffer,x, y - 1, x, y + 2, cl1);
+ sys_line(videobuffer,x, y, x, y + 1, cl3);
+
+ if(rn == 0) sys_line(videobuffer, x, y + 1, x, y + 1, cl2);
+ if(rn == 2) sys_line(videobuffer, x, y, x, y, cl2);
+
+ orn = rn;
+
+ if(spellinfo[i].damagewho == 0) {
+ for(int e = 1; e <= lastnpc; e++) {
+
+ xdif = (x + 16) - (npcinfo[e].x + 12);
+ ydif = (y + 16) - (npcinfo[e].y + 12);
+
+ if((abs(xdif) < 8 && abs(ydif) < 8)) {
+ float damage = 30 * (1 + RND() * 0.5);
+
+ if(npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) game_damagenpc(e, damage, 1);
+ }
+ }
+ }
+
+ // check for post damage
+ if(nposts > 0) {
+ for(int e = 0; e <= nposts - 1; e++) {
+ xdif = (xloc + 16) - (postinfo[e][0] + 8);
+ ydif = (yloc + 16) - (postinfo[e][1] + 8);
+
+ if((abs(xdif) < 16 && abs(ydif) < 16)) {
+ objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+
+ rcSrc.x = postinfo[e][0] / 2;
+ rcSrc.y = postinfo[e][1] / 2;
+ rcSrc.w = 8;
+ rcSrc.h = 8;
+
+ SDL_FillRect(clipbg2, &rcSrc, 0);
+
+ game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ }
+ }
+ }
+ }
+
+ y = apy;
+ orn = 0;
+ for(int x = apx; x >= 0; x--) {
+ int rn = (int)(RND() * 3);
+
+ if(orn == 0) y = y - 1;
+ if(orn == 2) y = y + 1;
+
+ sys_line(videobuffer,x, y - 1, x, y + 2, cl1);
+ sys_line(videobuffer,x, y, x, y + 1, cl3);
+
+ if(rn == 0) sys_line(videobuffer, x, y + 1, x, y + 1, cl2);
+ if(rn == 2) sys_line(videobuffer, x, y, x, y, cl2);
+
+ orn = rn;
+
+ if(spellinfo[i].damagewho == 0) {
+ for(int e = 1; e <= lastnpc; e++) {
+
+ xdif = (x + 16) - (npcinfo[e].x + 12);
+ ydif = (y + 16) - (npcinfo[e].y + 12);
+
+ if((abs(xdif) < 8 && abs(ydif) < 8)) {
+ float damage = 30 * (1 + RND() * 0.5);
+
+ if(npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) game_damagenpc(e, damage, 1);
+ }
+ }
+ }
+
+ // check for post damage
+ if(nposts > 0) {
+ for(int e = 0; e <= nposts - 1; e++) {
+ xdif = (xloc + 16) - (postinfo[e][0] + 8);
+ ydif = (yloc + 16) - (postinfo[e][1] + 8);
+
+ if((abs(xdif) < 16 && abs(ydif) < 16)) {
+ objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+
+ rcSrc.x = postinfo[e][0] / 2;
+ rcSrc.y = postinfo[e][1] / 2;
+ rcSrc.w = 8;
+ rcSrc.h = 8;
+
+ SDL_FillRect(clipbg2, &rcSrc, 0);
+
+ game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ }
+ }
+ }
+ }
+
+ int x = apx;
+ orn = 0;
+ for(int y = apy; y <= 239; y++) {
+ int rn = (int)(RND() * 3);
+
+ if(orn == 0) x = x - 1;
+ if(orn == 2) x = x + 1;
+
+ sys_line(videobuffer,x - 1, y, x + 2, y, cl1);
+ sys_line(videobuffer,x, y, x + 1, y, cl3);
+
+ if(rn == 0) sys_line(videobuffer, x + 1, y, x + 1, y, cl2);
+ if(rn == 2) sys_line(videobuffer, x, y, x, y, cl2);
+
+ orn = rn;
+
+ if(spellinfo[i].damagewho == 0) {
+ for(int e = 1; e <= lastnpc; e++) {
+ xdif = (x + 16) - (npcinfo[e].x + 12);
+ ydif = (y + 16) - (npcinfo[e].y + 12);
+
+ if((abs(xdif) < 8 && abs(ydif) < 8)) {
+ float damage = 30 * (1 + RND() * 0.5);
+
+ if(npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) game_damagenpc(e, damage, 1);
+ }
+ }
+ }
+
+ // check for post damage
+ if(nposts > 0) {
+ for(int e = 0; e <= nposts - 1; e++) {
+ xdif = (xloc + 16) - (postinfo[e][0] + 8);
+ ydif = (yloc + 16) - (postinfo[e][1] + 8);
+
+ if((abs(xdif) < 16 && abs(ydif) < 16)) {
+ objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+
+ rcSrc.x = postinfo[e][0] / 2;
+ rcSrc.y = postinfo[e][1] / 2;
+ rcSrc.w = 8;
+ rcSrc.h = 8;
+
+ SDL_FillRect(clipbg2, &rcSrc, 0);
+
+ game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ }
+ }
+ }
+ }
+
+ x = apx;
+ orn = 0;
+ for(int y = apy; y >= 0; y--) {
+ int rn = (int)(RND() * 3);
+
+ if(orn == 0) x = x - 1;
+ if(orn == 2) x = x + 1;
+
+ sys_line(videobuffer,x - 1, y, x + 2, y, cl1);
+ sys_line(videobuffer,x, y, x + 1, y, cl3);
+
+ if(rn == 0) sys_line(videobuffer, x + 1, y, x + 1, y, cl2);
+ if(rn == 2) sys_line(videobuffer, x, y, x, y, cl2);
+
+ orn = rn;
+
+ if(spellinfo[i].damagewho == 0) {
+ for(int e = 1; e <= lastnpc; e++) {
+ xdif = (x + 16) - (npcinfo[e].x + 12);
+ ydif = (y + 16) - (npcinfo[e].y + 12);
+
+ if((abs(xdif) < 8 && abs(ydif) < 8)) {
+ float damage = 30 * (1 + RND() * 0.5);
+
+ if(npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) game_damagenpc(e, damage, 1);
+ }
+ }
+ }
+
+ // check for post damage
+ if(nposts > 0) {
+ for(int e = 0; e <= nposts - 1; e++) {
+ xdif = (xloc + 16) - (postinfo[e][0] + 8);
+ ydif = (yloc + 16) - (postinfo[e][1] + 8);
+
+ if((abs(xdif) < 16 && abs(ydif) < 16)) {
+ objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+
+ rcSrc.x = postinfo[e][0] / 2;
+ rcSrc.y = postinfo[e][1] / 2;
+ rcSrc.w = 8;
+ rcSrc.h = 8;
+
+ SDL_FillRect(clipbg2, &rcSrc, 0);
+
+ game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ }
+ }
+ }
+ }
+ }
+
+ spellinfo[i].frame -= 0.5 * fpsr;
+ if(spellinfo[i].frame < 0) {
+ spellinfo[i].frame = 0;
+ forcepause = 0;
+ }
+ }
+
+ // wizard 1 lightning
+ if(spellnum == 9) {
+
+ cl1 = SDL_MapRGB(videobuffer->format, 0, 32, 204);
+ cl2 = SDL_MapRGB(videobuffer->format, 142, 173, 191);
+ cl3 = SDL_MapRGB(videobuffer->format, 240, 240, 240);
+
+ int px = spellinfo[i].enemyx + 12;
+ int py = spellinfo[i].enemyy + 24;
+
+ int apx = px + (int)(RND() * 20 - 10);
+ int apy = py + (int)(RND() * 20 - 10);
+
+ int x = apx;
+ int orn = 0;
+ for(int y = 0; y <= apy; y++) {
+ if(y < 240) {
+ float xdif, ydif;
+ int rn = (int)(RND() * 3);
+
+ if(orn == 0) x = x - 1;
+ if(orn == 2) x = x + 1;
+
+ sys_line(videobuffer,x - 1, y, x + 2, y, cl1);
+ sys_line(videobuffer,x, y, x + 1, y, cl3);
+
+ if(rn == 0) sys_line(videobuffer, x + 1, y, x + 1, y, cl2);
+ if(rn == 2) sys_line(videobuffer, x, y, x, y, cl2);
+
+ orn = rn;
+
+ if(spellinfo[i].damagewho == 1) {
+
+ xdif = (x + 8) - (player.px + 12);
+ ydif = (y + 8) - (player.py + 12);
+
+ if((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks) {
+ float damage = ((float)player.hp * 0.75) * (RND() * 0.5 + 0.5);
+ if(damage < 5) damage = 5;
+
+ if(npcinfo[spellinfo[i].npc].spriteset == 12) {
+ if(damage < 50) damage = 40 + (int)(RND() * 40);
+ }
+
+ if(player.hp > 0) game_damageplayer(damage);
+ }
+ }
+ }
+ }
+
+ spellinfo[i].frame -= 0.5 * fpsr;
+ if(spellinfo[i].frame < 0) {
+ spellinfo[i].frame = 0;
+
+ npcinfo[spellinfo[i].npc].attacking = 0;
+ npcinfo[spellinfo[i].npc].attacknext = ticks + npcinfo[spellinfo[i].npc].attackdelay;
+ }
+ }
+ }
+ }
+}
+
+
+
+void game_updspellsunder()
+{
+
+ unsigned int dq, *temp;
+
+ if(forcepause == 1) return;
+
+ for(int i = 0; i < MAXSPELL; i++) {
+ if(spellinfo[i].frame > 0) {
+ int spellnum = spellinfo[i].spellnum;
+
+ // water
+ if(spellnum == 0) {
+ int fra = (32 - spellinfo[i].frame);
+ int fr = (int)((32 - spellinfo[i].frame) * 2) % 4;
+
+ rcSrc.x = fr * 48;
+ rcSrc.y = 96;
+ rcSrc.w = 48;
+ rcSrc.h = 48;
+
+ rcDest.x = spellinfo[i].enemyx - 12;
+ rcDest.y = spellinfo[i].enemyy - 8;
+
+ int f = 160;
+ if(fra < 8) f = 160 * fra / 8;
+ if(fra > 24) f = 160 * (1 - (fra - 24) / 8);
+
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, f);
+ SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
+
+ spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
+ if(spellinfo[i].frame < 0) spellinfo[i].frame = 0;
+
+
+ for(int f = 1; f <= lastnpc; f++) {
+ int xdif = spellinfo[i].enemyx - npcinfo[f].x;
+ int ydif = spellinfo[i].enemyy - npcinfo[f].y;
+
+ float dist = sqrt(xdif * xdif + ydif * ydif);
+
+ if(dist > 20) dist = 20;
+
+ if(dist > 5) {
+ float ratio = (1 - dist / 25);
+
+ float newx = npcinfo[f].x + ratio * xdif / 3 * fpsr;
+ float newy = npcinfo[f].y + ratio * ydif / 3 * fpsr;
+
+ int sx = (newx / 2 + 6);
+ int sy = (newy / 2 + 10);
+ temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ dq = *temp;
+
+ // SDL_UnLockSurface clipbg
+
+ if(dq == 0) {
+ npcinfo[f].x = newx;
+ npcinfo[f].y = newy;
+ // npcinfo[f].castpause = ticks + 200;
+ } else {
+ int xpass = 0;
+ int ypass = 0;
+
+ sx = (newx / 2 + 6);
+ sy = (npcinfo[f].y / 2 + 10);
+ temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ dq = *temp;
+
+ if(dq == 0) xpass = 1;
+
+
+ sx = (npcinfo[f].x / 2 + 6);
+ sy = (newy / 2 + 10);
+ temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ dq = *temp;
+
+ if(dq == 0) ypass = 1;
+
+ if(ypass == 1) {
+ newx = npcinfo[f].x;
+ } else if(xpass == 1) {
+ newy = npcinfo[f].y;
+ }
+
+ if(xpass == 1 || ypass == 1) {
+ npcinfo[f].x = newx;
+ npcinfo[f].y = newy;
+ // npcinfo[f].castpause = ticks + 200;
+ }
+ }
+ }
+ }
+ }
+
+ // fire
+ if(spellnum == 3) {
+ float fr = (32 - spellinfo[i].frame);
+
+ fr = fr*fr * (1 - cos(3.14159 / 4 + 3.14159 / 4 * fr / 32));
+
+ if(fr > 32) fr = 32;
+
+ float s = 8;
+ if(spellinfo[i].frame < 8) s = spellinfo[i].frame;
+
+ int fra = (int)fr;
+
+ for(int f = 0; f <= 4; f++) {
+ for(int x = 0; x <= fra; x += 2) {
+ if(spellinfo[i].legalive[f] >= x) {
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, 192 * sin(3.14159 * x / 32) * s / 8);
+
+ float an = 360 / 5 * f + x / 32 * 180;
+
+ rcSrc.x = 16 * (int)(RND() * 2);
+ rcSrc.y = 80;
+ rcSrc.w = 16;
+ rcSrc.h = 16;
+
+ float xloc = (float)(spellinfo[i].enemyx + 4 + x * 2 * cos(3.14159 / 180 * an) + (int)(RND() * 3) - 1);
+ float yloc = (float)(spellinfo[i].enemyy + 4 + x * 2 * sin(3.14159 / 180 * an) + (int)(RND() * 3) - 1);
+ rcDest.x = (int)xloc;
+ rcDest.y = (int)yloc;
+
+ if(xloc > -1 && xloc < 304 && yloc > -1 && yloc < 224) {
+ SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+
+ int sx = (xloc / 2 + 4);
+ int sy = (yloc / 2 + 8);
+ temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ dq = *temp;
+
+ if(dq > 1000 && x > 4) spellinfo[i].legalive[f] = x;
+
+ if(spellinfo[i].damagewho == 0) {
+ for(int e = 1; e <= lastnpc; e++) {
+ float xdif = (xloc + 8) - (npcinfo[e].x + 12);
+ float ydif = (yloc + 8) - (npcinfo[e].y + 12);
+
+ if((abs(xdif) < 8 && abs(ydif) < 8)) {
+ float damage = (float)player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
+
+ if(npcinfo[e].spriteset == 5) damage = -damage;
+ if(npcinfo[e].spriteset == 11) damage = -damage;
+ if(npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
+ game_damagenpc(e, damage, 1);
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndfire], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+ }
+ }
+ }
+ }
+
+ if(spellinfo[i].damagewho == 1) {
+ float xdif = (xloc + 8) - (player.px + 12);
+ float ydif = (yloc + 8) - (player.py + 12);
+
+ if((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks) {
+ float damage = (float)npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
+
+ if(player.hp > 0) {
+ game_damageplayer(damage);
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndfire], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+ }
+ }
+ }
+
+ // check for post damage
+ if(nposts > 0) {
+ for(int e = 0; e <= nposts - 1; e++) {
+ float xdif = (xloc + 8) - (postinfo[e][0] + 8);
+ float ydif = (yloc + 8) - (postinfo[e][1] + 8);
+
+ if((abs(xdif) < 8 && abs(ydif) < 8)) {
+ objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+
+ rcSrc.x = postinfo[e][0] / 2;
+ rcSrc.y = postinfo[e][1] / 2;
+ rcSrc.w = 8;
+ rcSrc.h = 8;
+
+ SDL_FillRect(clipbg2, &rcSrc, 0);
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndfire], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+
+ game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
+
+ spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
+ if(spellinfo[i].frame < 0) spellinfo[i].frame = 0;
+
+
+ }
+
+
+ // sprite 6 spitfire
+ if(spellnum == 7) {
+ float xspan = spellinfo[i].enemyx - spellinfo[i].homex;
+ float yspan = spellinfo[i].enemyy - spellinfo[i].homey;
+ float fr = (32 - spellinfo[i].frame);
+
+ for(int f = 0; f <= 7; f++) {
+ int alpha = 0;
+ float xx = 0;
+ if(fr > f * 2 && fr < f * 2 + 16) xx = fr - f * 2;
+ if(xx < 8) alpha = 255 * xx / 8;
+ if(xx > 8) alpha = 255 * (1 - (xx - 8) / 8);
+ float yy = 16 * sin(3.141592 / 2 * xx / 16) - 8;
+
+ if(alpha < 0) alpha = 0;
+ if(alpha > 255) alpha = 255;
+
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, alpha);
+
+ rcSrc.x = 16 * (int)(RND() * 2);
+ rcSrc.y = 80;
+ rcSrc.w = 16;
+ rcSrc.h = 16;
+
+ float xloc = spellinfo[i].homex + xspan / 7 * f;
+ float yloc = spellinfo[i].homey + yspan / 7 * f - yy;
+
+ rcDest.x = xloc;
+ rcDest.y = yloc;
+
+ if(xloc > -16 && xloc < 320 && yloc > -16 && yloc < 240) {
+ SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+
+ if(spellinfo[i].damagewho == 1) {
+ float xdif = (xloc + 8) - (player.px + 12);
+ float ydif = (yloc + 8) - (player.py + 12);
+
+ if((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks && alpha > 64) {
+ float damage = (float)npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
+
+ if(player.hp > 0) {
+ game_damageplayer(damage);
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndfire], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+ }
+
+ }
+ }
+
+ }
+
+ }
+
+ SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
+ spellinfo[i].frame = spellinfo[i].frame - 0.5 * fpsr;
+ if(spellinfo[i].frame < 0) spellinfo[i].frame = 0;
+
+ if(spellinfo[i].frame == 0) {
+ npcinfo[spellinfo[i].npc].attacking = 0;
+ npcinfo[spellinfo[i].npc].attacknext = ticks + npcinfo[spellinfo[i].npc].attackdelay;
+ }
+ }
+ }
+ }
+}
+
+void sys_initpaths()
+{
+#ifdef __unix__
+ char line[256];
+ char *home = getenv("HOME");
+ if(!home) return;
+
+ sprintf(line, "%s/.griffon", home);
+ mkdir(line, 0777);
+
+ strcpy(config_ini, line);
+ strcat(config_ini, "/config.ini");
+
+ strcpy(player_sav, line);
+ strcat(player_sav, "/player%i.sav");
+#endif
+}
+
+void sys_initialize()
+{
+ int result;
+
+ sys_initpaths();
+
+ // init char *floatstri[MAXFLOAT]
+ for(int i = 0; i < MAXFLOAT; i++)
+ floatstri[i] = malloc(64); // 64 bytes each string (should be enough)
+
+ // set default values
+ config.scr_width = 320;
+ config.scr_height = 240;
+ config.scr_bpp = 32;
+ config.hwaccel = 0;
+ config.hwsurface = SDL_SWSURFACE;
+ config.fullscreen = 0;
+ config.music = 1;
+ config.effects = 1;
+ config.musicvol = 127;
+ config.effectsvol = 127;
+
+ config_load(&config);
+
+ printf("SCR_WIDTH: %i\n", config.scr_width);
+ printf("SCR_HEIGHT: %i\n", config.scr_height);
+ printf("SCR_BITS: %i\n", config.scr_bpp);
+
+ fullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
+
+ result = SDL_Init(SDL_INIT_EVERYTHING);
+ if(result) {
+ printf("Failed to init SDL\n");
+ exit(1);
+ }
+
+ atexit(SDL_Quit);
+
+ video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen); // SDL_FULLSCREEN
+ if(!video) {
+ printf("Failed to init Video\n");
+ exit(1);
+ }
+
+
+ SDL_WM_SetCaption("The Griffon Legend", NULL);
+
+ SDL_ShowCursor(SDL_DISABLE);
+
+ videobuffer = SDL_CreateRGBSurface(config.hwsurface, 320, 240, config.scr_bpp, video->format->Rmask, video->format->Gmask, video->format->Bmask, video->format->Amask);
+ videobuffer2 = SDL_CreateRGBSurface(config.hwsurface, 320, 240, config.scr_bpp, video->format->Rmask, video->format->Gmask, video->format->Bmask, video->format->Amask);
+ videobuffer3 = SDL_CreateRGBSurface(config.hwsurface, 320, 240, config.scr_bpp, video->format->Rmask, video->format->Gmask, video->format->Bmask, video->format->Amask);
+ mapbg = SDL_CreateRGBSurface(config.hwsurface, 320, 240, config.scr_bpp, video->format->Rmask, video->format->Gmask, video->format->Bmask, video->format->Amask);
+ clipbg = SDL_CreateRGBSurface(SDL_SWSURFACE, 320, 240, config.scr_bpp, video->format->Rmask, video->format->Gmask, video->format->Bmask, video->format->Amask);
+ clipbg2 = SDL_DisplayFormat(video);
+
+ for(int i = 0; i <= 3; i++) {
+ char name[128];
+
+ sprintf(name, "art/map%i.bmp", i + 1);
+ mapimg[i] = SDL_DisplayFormat(video);
+ mapimg[i] = IMG_Load(name);
+ SDL_SetColorKey(mapimg[i], SDL_SRCCOLORKEY, SDL_MapRGB(mapimg[i]->format, 255, 0, 255));
+ }
+
+ cloudimg = IMG_Load("art/clouds.bmp");
+ SDL_SetColorKey(cloudimg, SDL_SRCCOLORKEY, SDL_MapRGB(cloudimg->format, 255, 0, 255));
+ SDL_SetAlpha(cloudimg, 0 | SDL_SRCALPHA, 96);
+
+
+ saveloadimg = IMG_Load("art/saveloadnew.bmp");
+ SDL_SetColorKey(saveloadimg, SDL_SRCCOLORKEY, SDL_MapRGB(saveloadimg->format, 255, 0, 255));
+ SDL_SetAlpha(saveloadimg, 0 | SDL_SRCALPHA, 160);
+
+ titleimg = IMG_Load("art/titleb.bmp");
+ titleimg2 = IMG_Load("art/titlea.bmp");
+ SDL_SetColorKey(titleimg2, SDL_SRCCOLORKEY, SDL_MapRGB(titleimg2->format, 255, 0, 255));
+ //SDL_SetAlpha(titleimg2, 0 | SDL_SRCALPHA, 204);
+
+ inventoryimg = IMG_Load("art/inventory.bmp");
+ SDL_SetColorKey(inventoryimg, SDL_SRCCOLORKEY, SDL_MapRGB(inventoryimg->format, 255, 0, 255));
+
+ logosimg = SDL_DisplayFormat(video);
+ theendimg = SDL_DisplayFormat(video);
+ logosimg = IMG_Load("art/logos.bmp");
+ theendimg = IMG_Load("art/theend.bmp");
+
+
+ sys_LoadTiles();
+ sys_LoadTriggers();
+ sys_LoadObjectDB();
+ sys_LoadAnims();
+ sys_LoadFont();
+ sys_LoadItemImgs();
+
+ fpsr = 1;
+ nextticks = ticks + 1000;
+
+ for(int i = 0; i <= 15; i++) {
+ playerattackofs[0][i][0] = 0; // -1// -(i + 1)
+ playerattackofs[0][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2 - 1;
+
+ playerattackofs[1][i][0] = 0; // i + 1
+ playerattackofs[1][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2 + 1;
+
+ playerattackofs[2][i][0] = -1; // -(i + 1)
+ playerattackofs[2][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2;
+
+ playerattackofs[3][i][0] = 1; // i + 1
+ playerattackofs[3][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2;
+ }
+
+ sys_setupAudio();
+}
+
+void sys_line(SDL_Surface *buffer, int x1, int y1, int x2, int y2, int col)
+{
+ unsigned int *temp;
+
+ SDL_LockSurface(buffer);
+
+ int xdif = x2 - x1;
+ int ydif = y2 - y1;
+
+ if(xdif == 0) {
+ for(int y = y1; y <= y2; y++) {
+ temp = buffer->pixels + y * buffer->pitch + x1 * buffer->format->BytesPerPixel;
+ *temp = col;
+ }
+ }
+
+ if(ydif == 0) {
+ for(int x = x1; x <= x2; x++) {
+ temp = buffer->pixels + y1 * buffer->pitch + x * buffer->format->BytesPerPixel;
+ *temp = col;
+ }
+ }
+
+ SDL_UnlockSurface(buffer);
+}
+
+void sys_LoadAnims()
+{
+ spellimg = IMG_Load("art/spells.bmp");
+ SDL_SetColorKey(spellimg, SDL_SRCCOLORKEY, SDL_MapRGB(spellimg->format, 255, 0, 255));
+
+ anims[0] = IMG_Load("art/anims0.bmp");
+ SDL_SetColorKey(anims[0], SDL_SRCCOLORKEY, SDL_MapRGB(anims[0]->format, 255, 0, 255));
+
+ animsa[0] = IMG_Load("art/anims0a.bmp");
+ SDL_SetColorKey(animsa[0], SDL_SRCCOLORKEY, SDL_MapRGB(animsa[0]->format, 255, 0, 255));
+
+ anims[13] = IMG_Load("art/anims0x.bmp");
+ SDL_SetColorKey(anims[13], SDL_SRCCOLORKEY, SDL_MapRGB(anims[13]->format, 255, 0, 255));
+
+ animsa[13] = IMG_Load("art/anims0xa.bmp");
+ SDL_SetColorKey(animsa[13], SDL_SRCCOLORKEY, SDL_MapRGB(animsa[13]->format, 255, 0, 255));
+
+ anims[1] = IMG_Load("art/anims1.bmp");
+ SDL_SetColorKey(anims[1], SDL_SRCCOLORKEY, SDL_MapRGB(anims[1]->format, 255, 0, 255));
+
+ animsa[1] = IMG_Load("art/anims1a.bmp");
+ SDL_SetColorKey(animsa[1], SDL_SRCCOLORKEY, SDL_MapRGB(animsa[1]->format, 255, 0, 255));
+
+ anims[2] = IMG_Load("art/anims2.bmp");
+ SDL_SetColorKey(anims[2], SDL_SRCCOLORKEY, SDL_MapRGB(anims[2]->format, 255, 0, 255));
+
+ // huge
+ animset2[0].xofs = 8;
+ animset2[0].yofs = 7;
+ animset2[0].x = 123;
+ animset2[0].y = 0;
+ animset2[0].w = 18;
+ animset2[0].h = 16;
+ // big
+ animset2[1].xofs = 7;
+ animset2[1].yofs = 7;
+ animset2[1].x = 107;
+ animset2[1].y = 0;
+ animset2[1].w = 16;
+ animset2[1].h = 14;
+ // med
+ animset2[2].xofs = 6;
+ animset2[2].yofs = 6;
+ animset2[2].x = 93;
+ animset2[2].y = 0;
+ animset2[2].w = 14;
+ animset2[2].h = 13;
+ // small
+ animset2[3].xofs = 4;
+ animset2[3].yofs = 4;
+ animset2[3].x = 83;
+ animset2[3].y = 0;
+ animset2[3].w = 10;
+ animset2[3].h = 10;
+ // wing
+ animset2[4].xofs = 4;
+ animset2[4].yofs = 20;
+ animset2[4].x = 42;
+ animset2[4].y = 0;
+ animset2[4].w = 41;
+ animset2[4].h = 33;
+ // head
+ animset2[5].xofs = 20;
+ animset2[5].yofs = 18;
+ animset2[5].x = 0;
+ animset2[5].y = 0;
+ animset2[5].w = 42;
+ animset2[5].h = 36;
+
+ anims[9] = IMG_Load("art/anims9.bmp");
+ SDL_SetColorKey(anims[9], SDL_SRCCOLORKEY, SDL_MapRGB(anims[9]->format, 255, 0, 255));
+
+ // huge
+ animset9[0].xofs = 8;
+ animset9[0].yofs = 7;
+ animset9[0].x = 154;
+ animset9[0].y = 0;
+ animset9[0].w = 18;
+ animset9[0].h = 16;
+ // big
+ animset9[1].xofs = 7;
+ animset9[1].yofs = 7;
+ animset9[1].x = 138;
+ animset9[1].y = 0;
+ animset9[1].w = 16;
+ animset9[1].h = 14;
+ // med
+ animset9[2].xofs = 6;
+ animset9[2].yofs = 6;
+ animset9[2].x = 93 + 31;
+ animset9[2].y = 0;
+ animset9[2].w = 14;
+ animset9[2].h = 13;
+ // small
+ animset9[3].xofs = 4;
+ animset9[3].yofs = 4;
+ animset9[3].x = 83 + 31;
+ animset9[3].y = 0;
+ animset9[3].w = 10;
+ animset9[3].h = 10;
+ // wing
+ animset9[4].xofs = 36;
+ animset9[4].yofs = 20;
+ animset9[4].x = 42;
+ animset9[4].y = 0;
+ animset9[4].w = 72;
+ animset9[4].h = 33;
+ // head
+ animset9[5].xofs = 20;
+ animset9[5].yofs = 18;
+ animset9[5].x = 0;
+ animset9[5].y = 0;
+ animset9[5].w = 42;
+ animset9[5].h = 36;
+
+ anims[3] = IMG_Load("art/anims3.bmp");
+ SDL_SetColorKey(anims[3], SDL_SRCCOLORKEY, SDL_MapRGB(anims[3]->format, 255, 0, 255));
+
+ anims[4] = IMG_Load("art/anims4.bmp");
+ SDL_SetColorKey(anims[4], SDL_SRCCOLORKEY, SDL_MapRGB(anims[4]->format, 255, 0, 255));
+
+ anims[5] = IMG_Load("art/anims5.bmp");
+ SDL_SetColorKey(anims[5], SDL_SRCCOLORKEY, SDL_MapRGB(anims[5]->format, 255, 0, 255));
+
+ anims[6] = IMG_Load("art/anims6.bmp");
+ SDL_SetColorKey(anims[6], SDL_SRCCOLORKEY, SDL_MapRGB(anims[6]->format, 255, 0, 255));
+
+ anims[7] = IMG_Load("art/anims7.bmp");
+ SDL_SetColorKey(anims[7], SDL_SRCCOLORKEY, SDL_MapRGB(anims[7]->format, 255, 0, 255));
+
+ anims[8] = IMG_Load("art/anims8.bmp");
+ SDL_SetColorKey(anims[8], SDL_SRCCOLORKEY, SDL_MapRGB(anims[8]->format, 255, 0, 255));
+
+ anims[10] = IMG_Load("art/anims10.bmp");
+ SDL_SetColorKey(anims[10], SDL_SRCCOLORKEY, SDL_MapRGB(anims[10]->format, 255, 0, 255));
+
+ animsa[10] = IMG_Load("art/anims10a.bmp");
+ SDL_SetColorKey(animsa[10], SDL_SRCCOLORKEY, SDL_MapRGB(animsa[10]->format, 255, 0, 255));
+
+ anims[11] = IMG_Load("art/anims11.bmp");
+ SDL_SetColorKey(anims[11], SDL_SRCCOLORKEY, SDL_MapRGB(anims[11]->format, 255, 0, 255));
+
+ animsa[11] = IMG_Load("art/anims11a.bmp");
+ SDL_SetColorKey(animsa[11], SDL_SRCCOLORKEY, SDL_MapRGB(animsa[11]->format, 255, 0, 255));
+
+ anims[12] = IMG_Load("art/anims12.bmp");
+ SDL_SetColorKey(anims[12], SDL_SRCCOLORKEY, SDL_MapRGB(anims[12]->format, 255, 0, 255));
+}
+
+void sys_LoadItemImgs()
+{
+ SDL_Surface *temp;
+
+ temp = IMG_Load("art/icons.bmp");
+
+ for(int i = 0; i <= 20; i++) {
+ itemimg[i] = SDL_CreateRGBSurface(SDL_SWSURFACE, 16, 16, config.scr_bpp, video->format->Rmask, video->format->Gmask, video->format->Bmask, video->format->Amask);
+ SDL_SetColorKey(itemimg[i], SDL_SRCCOLORKEY, SDL_MapRGB(itemimg[i]->format, 255, 0, 255));
+
+ rcSrc.x = i * 16;
+ rcSrc.y = 0;
+ rcSrc.w = 16;
+ rcSrc.h = 16;
+
+ SDL_BlitSurface(temp, &rcSrc, itemimg[i], NULL);
+ }
+
+ SDL_FreeSurface(temp);
+}
+
+void sys_LoadFont()
+{
+ SDL_Surface *font;
+
+ font = IMG_Load("art/font.bmp");
+
+ for(int i = 32; i <= 255; i++)
+ for(int f = 0; f <= 4; f++) {
+ int i2 = i - 32;
+
+ fontchr[i2][f] = SDL_CreateRGBSurface(SDL_SWSURFACE, 8, 8, config.scr_bpp, video->format->Rmask, video->format->Gmask, video->format->Bmask, video->format->Amask);
+ SDL_SetColorKey(fontchr[i2][f], SDL_SRCCOLORKEY, SDL_MapRGB(fontchr[i2][f]->format, 255, 0, 255));
+
+ int col = i2 % 40;
+
+ int row = (i2 - col) / 40;
+
+ rcSrc.x = col * 8;
+ rcSrc.y = row * 8 + f * 48;
+ rcSrc.w = 8;
+ rcSrc.h = 8;
+
+ rcDest.x = 0;
+ rcDest.y = 0;
+ SDL_BlitSurface(font, &rcSrc, fontchr[i2][f], &rcDest);
+ }
+
+ SDL_FreeSurface(font);
+}
+
+void sys_LoadTiles()
+{
+ tiles[0] = IMG_Load("art/tx.bmp");
+ tiles[1] = IMG_Load("art/tx1.bmp");
+ tiles[2] = IMG_Load("art/tx2.bmp");
+ tiles[3] = IMG_Load("art/tx3.bmp");
+
+ for(int i = 0; i <= 3; i++)
+ SDL_SetColorKey(tiles[i], SDL_SRCCOLORKEY, SDL_MapRGB(tiles[i]->format, 255, 0, 255));
+
+ windowimg = IMG_Load("art/window.bmp");
+ SDL_SetColorKey(windowimg, SDL_SRCCOLORKEY, SDL_MapRGB(windowimg->format, 255, 0, 255));
+}
+
+void sys_LoadTriggers()
+{
+ FILE *fp;
+ char line[512];
+
+ fp = fopen("data/triggers.dat", "r");
+
+ for(int i = 0; i <= 9999; i++)
+ for(int a = 0; a <= 8; a++) {
+ fgets(line, sizeof(line), fp);
+ sscanf(line, "%i", &triggers[i][a]);
+ }
+
+ fclose(fp);
+}
+
+void sys_LoadObjectDB()
+{
+ FILE *fp;
+ char line[512];
+
+ fp = fopen("objectdb.dat", "r");
+
+ for(int a = 0; a <= 32; a++) {
+ for(int b = 0; b <= 5; b++) {
+ fgets(line, sizeof(line), fp);
+ sscanf(line, "%i", &objectinfo[a][b]);
+ }
+
+ for(int b = 0; b <= 8; b++) {
+ for(int c = 0; c <= 2; c++) {
+ for(int d = 0; d <= 2; d++) {
+ for(int e = 0; e <= 1; e++) {
+ fgets(line, sizeof(line), fp);
+ sscanf(line, "%i", &objecttile[a][b][c][d][e]);
+ }
+ }
+ }
+ }
+ }
+
+ fclose(fp);
+}
+
+void sys_print(SDL_Surface *buffer, char *stri, int xloc, int yloc, int col)
+{
+ int l = strlen(stri);
+
+ for(int i = 0; i < l; i++) {
+ rcDest.x = xloc + i * 8;
+ rcDest.y = yloc;
+
+ SDL_BlitSurface(fontchr[stri[i] - 32][col], NULL, buffer, &rcDest);
+ }
+}
+
+void sys_progress(int w, int wm)
+{
+ long ccc;
+
+ ccc = SDL_MapRGB(videobuffer->format, 0, 255, 0);
+
+ rcDest.w = w * 74 / wm;
+ SDL_FillRect(videobuffer, &rcDest, ccc);
+ SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
+ SDL_Flip(video);
+ SDL_PumpEvents();
+}
+
+void sys_setupAudio()
+{
+ SDL_Surface *loadimg;
+
+ menabled = 1;
+
+ if((Mix_Init(MIX_INIT_OGG) & MIX_INIT_OGG) != MIX_INIT_OGG) {
+ printf("Failed to init OGG support\n");
+ exit(1);
+ }
+
+ Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 1024);
+
+ atexit(Mix_Quit);
+ atexit(Mix_CloseAudio);
+
+ char *stri = "Loading...";
+ sys_print(videobuffer, stri, 160 - 4 * strlen(stri), 116, 0);
+
+ loadimg = IMG_Load("art/load.bmp");
+ SDL_SetColorKey(loadimg, SDL_SRCCOLORKEY, SDL_MapRGB(loadimg->format, 255, 0, 255));
+
+ rcSrc.x = 0;
+ rcSrc.y = 0;
+ rcSrc.w = 88;
+ rcSrc.h = 32;
+
+ rcDest.x = 160 - 44;
+ rcDest.y = 116 + 12;
+
+ SDL_SetAlpha(loadimg, 0 | SDL_SRCALPHA, 160); // 128
+ SDL_BlitSurface(loadimg, &rcSrc, videobuffer, &rcDest);
+ SDL_SetAlpha(loadimg, 0 | SDL_SRCALPHA, 255);
+
+ SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
+ SDL_Flip(video);
+
+ rcDest.x = 160 - 44 + 7;
+ rcDest.y = 116 + 12 + 12;
+ rcDest.h = 8;
+
+ if(menabled == 1) {
+ mboss = Mix_LoadWAV("music/boss.ogg");
+ sys_progress(1, 21);
+ mgardens = Mix_LoadWAV("music/gardens.ogg");
+ sys_progress(2, 21);
+ mgardens2 = Mix_LoadWAV("music/gardens2.ogg");
+ sys_progress(3, 21);
+ mgardens3 = Mix_LoadWAV("music/gardens3.ogg");
+ sys_progress(4, 21);
+ mgardens4 = Mix_LoadWAV("music/gardens4.ogg");
+ sys_progress(5, 21);
+ mendofgame = Mix_LoadWAV("music/endofgame.ogg");
+ sys_progress(6, 21);
+ mmenu = Mix_LoadWAV("music/menu.ogg");
+ sys_progress(7, 21);
+
+ sfx[0] = Mix_LoadWAV("sfx/bite.ogg");
+ sys_progress(8, 21);
+ sfx[1] = Mix_LoadWAV("sfx/crystal.ogg");
+ sys_progress(9, 21);
+ sfx[2] = Mix_LoadWAV("sfx/door.ogg");
+ sys_progress(10, 21);
+ sfx[3] = Mix_LoadWAV("sfx/enemyhit.ogg");
+ sys_progress(11, 21);
+ sfx[4] = Mix_LoadWAV("sfx/ice.ogg");
+ sys_progress(12, 21);
+ sfx[5] = Mix_LoadWAV("sfx/lever.ogg");
+ sys_progress(13, 21);
+ sfx[6] = Mix_LoadWAV("sfx/lightning.ogg");
+ sys_progress(14, 21);
+ sfx[7] = Mix_LoadWAV("sfx/metalhit.ogg");
+ sys_progress(15, 21);
+ sfx[8] = Mix_LoadWAV("sfx/powerup.ogg");
+ sys_progress(16, 21);
+ sfx[9] = Mix_LoadWAV("sfx/rocks.ogg");
+ sys_progress(17, 21);
+ sfx[10] = Mix_LoadWAV("sfx/swordhit.ogg");
+ sys_progress(18, 21);
+ sfx[11] = Mix_LoadWAV("sfx/throw.ogg");
+ sys_progress(19, 21);
+ sfx[12] = Mix_LoadWAV("sfx/chest.ogg");
+ sys_progress(20, 21);
+ sfx[13] = Mix_LoadWAV("sfx/fire.ogg");
+ sys_progress(21, 21);
+ sfx[14] = Mix_LoadWAV("sfx/beep.ogg");
+ }
+}
+
+void sys_update()
+{
+ unsigned int *temp, bgc;
+ int pa, sx, sy;
+ float opx, opy, spd;
+
+ SDL_Flip(video);
+ SDL_PumpEvents();
+
+ tickspassed = ticks;
+ ticks = SDL_GetTicks();
+
+ tickspassed = ticks - tickspassed;
+ fpsr = (float)tickspassed / 24.0;
+
+ fp++;
+ if(ticks > nextticks) {
+ nextticks = ticks + 1000;
+ fps = fp;
+ fp = 0;
+ secsingame = secsingame + 1;
+ }
+
+ SDL_LockSurface(clipbg);
+
+ if(attacking == 1) {
+ player.attackframe += player.attackspd * fpsr;
+ if(player.attackframe >= 16) {
+ attacking = 0;
+ player.attackframe = 0;
+ player.walkframe = 0;
+ }
+
+ pa = (int)(player.attackframe);
+
+ for(int i = 0; i <= pa; i++) {
+ if(playerattackofs[player.walkdir][i][2] == 0) {
+ playerattackofs[player.walkdir][i][2] = 1;
+
+ opx = player.px;
+ opy = player.py;
+
+ player.px = player.px + playerattackofs[player.walkdir][i][0];
+ player.py = player.py + playerattackofs[player.walkdir][i][1];
+
+ sx = (int)(player.px / 2 + 6);
+ sy = (int)(player.py / 2 + 10);
+ temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ bgc = *temp;
+ if(bgc > 0) {
+ player.px = opx;
+ player.py = opy;
+ }
+ }
+ }
+
+ player.opx = player.px;
+ player.opy = player.py;
+
+ game_checkhit();
+ }
+
+ for(int i = 0; i < MAXFLOAT; i++) {
+ if(floattext[i][0] > 0) {
+ spd = 0.5 * fpsr;
+ floattext[i][0] = floattext[i][0] - spd;
+ floattext[i][2] = floattext[i][2] - spd;
+ if(floattext[i][0] < 0) floattext[i][0] = 0;
+ }
+
+ if(floaticon[i][0] > 0) {
+ spd = 0.5 * fpsr;
+ floaticon[i][0] = floaticon[i][0] - spd;
+ floaticon[i][2] = floaticon[i][2] - spd;
+ if(floaticon[i][0] < 0) floaticon[i][0] = 0;
+ }
+ }
+
+ if(player.level == player.maxlevel) player.exp = 0;
+
+ if(player.exp >= player.nextlevel) {
+ player.level = player.level + 1;
+ game_addFloatText("LEVEL UP!", player.px + 16 - 36, player.py + 16, 3);
+ player.exp = player.exp - player.nextlevel;
+ player.nextlevel = player.nextlevel * 3 / 2; // 1.5
+ player.maxhp = player.maxhp + player.level * 3;
+ if(player.maxhp > 999) player.maxhp = 999;
+ player.hp = player.maxhp;
+
+ player.sworddamage = player.level * 14 / 10;
+ player.spelldamage = player.level * 13 / 10;
+
+ if(menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+ }
+
+ SDL_UnlockSurface(clipbg);
+ SDL_BlitSurface(clipbg2, NULL, clipbg, NULL);
+
+ SDL_Rect rc;
+
+ rc.x = player.px - 2;
+ rc.y = player.py - 2;
+ rc.w = 5;
+ rc.h = 5;
+
+ SDL_FillRect(clipbg, &rc, 1000);
+
+ if(forcepause == 0) {
+ for(int i = 0; i < 5; i++) {
+ if(player.foundspell[i] == 1) player.spellcharge[i] += 1 * player.level * 0.01 * fpsr;
+ if(player.spellcharge[i] > 100) player.spellcharge[i] = 100;
+ }
+
+ if(player.foundspell[0]) {
+ player.spellstrength += 3 * player.level * .01 * fpsr;
+ }
+
+ player.attackstrength += (30 + 3 * (float)player.level) / 50 * fpsr;
+ }
+
+ if(player.attackstrength > 100) player.attackstrength = 100;
+
+ if(player.spellstrength > 100) player.spellstrength = 100;
+
+ itemyloc += 0.75 * fpsr;
+ while(itemyloc >= 16) itemyloc -= 16;
+
+ if(player.hp <= 0) game_theend();
+
+ if(roomlock == 1) {
+ roomlock = 0;
+ for(int i = 1; i <= lastnpc; i++)
+ if(npcinfo[i].hp > 0) roomlock = 1;
+ }
+
+ clouddeg += 0.1 * fpsr;
+ while(clouddeg >= 360) clouddeg = clouddeg - 360;
+
+ player.hpflash = player.hpflash + 0.1 * fpsr;
+ if(player.hpflash >=2) {
+ player.hpflash = 0;
+ player.hpflashb = player.hpflashb + 1;
+ if(player.hpflashb == 2) player.hpflashb = 0;
+ if(menabled == 1 && config.effects == 1 && player.hpflashb == 0 && player.hp < player.maxhp / 4) {
+ int snd = Mix_PlayChannel(-1, sfx[sndbeep], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
+ }
+
+ // cloudson = 0
+
+ if(itemselon == 1) player.itemselshade = player.itemselshade + 2 * fpsr;
+ if(player.itemselshade > 24) player.itemselshade = 24;
+
+ for(int i = 0; i <= 4; i++)
+ if(player.inventory[i] > 9) player.inventory[i] = 9;
+}
diff --git a/engines/griffon/engine.h b/engines/griffon/engine.h
new file mode 100644
index 0000000..aec0e6e
--- /dev/null
+++ b/engines/griffon/engine.h
@@ -0,0 +1,254 @@
+/*
+ * 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
+ *
+ */
+
+#ifndef _GRIFFON_H_
+#define _GRIFFON_H_
+
+#define MAXNPC 32
+#define MAXFLOAT 32
+#define MAXSPELL 32
+
+// spells
+#define ice 0
+#define steel 1
+#define wood 2
+#define rock 3
+#define fire 4
+
+// inventory items
+#define INV_FLASK 0
+#define INV_DOUBLEFLASK 1
+#define INV_SHOCK 2
+#define INV_NORMALKEY 3
+#define INV_MASTERKEY 4
+
+#define sndbite 0
+#define sndcrystal 1
+#define snddoor 2
+#define sndenemyhit 3
+#define sndice 4
+#define sndlever 5
+#define sndlightning 6
+#define sndmetalhit 7
+#define sndpowerup 8
+#define sndrocks 9
+#define sndswordhit 10
+#define sndthrow 11
+#define sndchest 12
+#define sndfire 13
+#define sndbeep 14
+
+typedef struct {
+ float px;
+ float py;
+ float opx;
+ float opy;
+ int walkdir;
+ float walkframe;
+ float walkspd;
+ float attackframe;
+ float attackspd;
+
+ int hp;
+ int maxhp;
+ float hpflash;
+ int hpflashb;
+ int level;
+ int maxlevel;
+ int sword;
+ int shield;
+ int armour;
+ int foundspell[5];
+ float spellcharge[5];
+ int inventory[5];
+ float attackstrength;
+ float spellstrength;
+ int spelldamage;
+ int sworddamage;
+
+ int exp;
+ int nextlevel;
+
+ int pause;
+
+ float itemselshade;
+ int ysort;
+} PLAYERTYPE;
+
+typedef struct {
+ float x;
+ float y;
+ int parentID;
+ int isbase;
+ int sprite;
+ int bonelength; // the 'bone' that connects the body sections
+} BODYSECTIONTYPE;
+
+typedef struct {
+ float x;
+ float y;
+ int spriteset;
+ int x1; // patrol area
+ int y1;
+ int x2;
+ int y2;
+ int attitude;
+ int hp;
+
+ int maxhp;
+ int item1;
+ int item2;
+ int item3;
+ int script;
+ float frame;
+ float frame2; // end boss specific
+ int cframe;
+ int onmap; // is this npc set to be genned in the mapfile
+
+ int ticks;
+ int pause;
+ int shake;
+
+ int movementmode;
+ int walkdir;
+ float walkspd;
+ int movingdir;
+ int moving;
+
+ int attacking;
+ float attackframe;
+ int cattackframe;
+ float attackspd;
+ int attackdelay;
+ int attacknext;
+ int attackattempt;
+
+ int spelldamage;
+ int attackdamage;
+
+
+ // one wing and firehydra specific
+ BODYSECTIONTYPE bodysection[31];
+ float swayangle;
+ float swayspd;
+ float headtargetx[4];
+ float headtargety[4];
+ int castpause;
+
+ // firehydra specific
+ int attacknext2[4];
+ int attacking2[4];
+ int attackframe2[4];
+
+ // dragon2 specific
+ float floating;
+} NPCTYPE;
+
+typedef struct {
+ int spellnum;
+ float homex;
+ float homey;
+ float enemyx;
+ float enemyy;
+
+ float frame;
+
+ int damagewho; // 0 = npc, 1 = player
+
+ // for earthslide
+ float rocky[9];
+ int rockimg[9];
+ int rockdeflect[9];
+
+ float strength;
+
+ // fire
+ int legalive[5];
+
+ // spell 6 specific
+ float fireballs[7][4]; // x,y,targetx, targety
+ int nfballs;
+ int ballon[7];
+
+ int npc;
+} SPELLTYPE;
+
+typedef struct {
+ int x; // xyloc on spriteimageset
+ int y;
+ int xofs; // the actual place to paste the sprite in reference to the bodypart loc on screen
+ int yofs;
+ int w; // w/h of the sprite in the imageset
+ int h;
+} ANIMSET2TYPE;
+
+extern PLAYERTYPE player;
+extern int curmap;
+extern int scriptflag[100][10];
+extern int objmapf[1000][21][15];
+extern int roomlocks[201];
+extern int secsingame, secstart;
+
+void game_addFloatIcon(int ico, float xloc, float yloc);
+void game_addFloatText(char *stri, float xloc, float yloc, int col);
+void game_attack();
+void game_castspell(int spellnum, float homex, float homey, float enemyx, float enemyy, int damagewho);
+void game_checkhit();
+void game_checkinputs();
+void game_configmenu();
+void game_damagenpc(int npcnum, int damage, int spell);
+void game_damageplayer(int damage);
+void game_drawanims(int Layer);
+void game_drawhud();
+void game_drawnpcs(int mode);
+void game_drawover(int modx, int mody);
+void game_drawplayer();
+void game_drawview();
+void game_endofgame();
+void game_eventtext(char *stri);
+void game_handlewalking();
+void game_loadmap(int mapnum);
+void game_main();
+void game_newgame();
+void game_playgame();
+void game_processtrigger(int trignum);
+void game_saveloadnew();
+void game_showlogos();
+void game_swash();
+void game_theend();
+void game_title(int mode);
+void game_updanims();
+void game_updatey();
+void game_updmusic();
+void game_updnpcs();
+void game_updspells();
+void game_updspellsunder();
+
+void sys_initialize();
+void sys_line(SDL_Surface *buffer, int x1, int y1, int x2, int y2, int col);
+void sys_LoadAnims();
+void sys_LoadFont();
+void sys_LoadItemImgs();
+void sys_LoadTiles();
+void sys_LoadTriggers();
+void sys_print(SDL_Surface *buffer, char *stri, int xloc, int yloc, int col);
+void sys_progress(int w, int wm);
+void sys_LoadObjectDB();
+void sys_setupAudio();
+void sys_update();
+
+#endif // _GRIFFON_H_
diff --git a/engines/griffon/state.cpp b/engines/griffon/state.cpp
new file mode 100644
index 0000000..a68132e
--- /dev/null
+++ b/engines/griffon/state.cpp
@@ -0,0 +1,256 @@
+/*
+ * 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 <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include <sys/stat.h>
+
+#include <SDL/SDL.h>
+
+#include "griffon.h"
+#include "state.h"
+
+char player_sav[256] = "data/player%i.sav";
+
+#define PRINT(A,B) \
+do { \
+ char line[256]; \
+ sprintf(line, A "\n", B); \
+ fputs(line, fp); \
+} while(0)
+
+#define INPUT(A, B) \
+do { \
+ char line[256]; \
+ fgets(line, sizeof(line), fp); \
+ sscanf(line, A, B); \
+} while(0)
+
+// externs (to be removed later)
+extern PLAYERTYPE playera;
+extern int asecstart;
+
+int state_load(int slotnum)
+{
+ FILE *fp;
+ char line[256];
+
+ sprintf(line, player_sav, slotnum);
+
+ fp = fopen(line, "r");
+ if(fp) {
+ INPUT("%i", &player.level);
+
+ if(player.level > 0) {
+ INPUT("%i", &secstart);
+ INPUT("%s", line);
+
+ INPUT("%f", &player.px);
+ INPUT("%f", &player.py);
+ INPUT("%f", &player.opx);
+ INPUT("%f", &player.opy);
+ INPUT("%i", &player.walkdir);
+ INPUT("%f", &player.walkframe);
+ INPUT("%f", &player.walkspd);
+ INPUT("%f", &player.attackframe);
+ INPUT("%f", &player.attackspd);
+ INPUT("%i", &player.hp);
+ INPUT("%i", &player.maxhp);
+ INPUT("%f", &player.hpflash);
+ INPUT("%i", &player.level);
+ INPUT("%i", &player.maxlevel);
+ INPUT("%i", &player.sword);
+ INPUT("%i", &player.shield);
+ INPUT("%i", &player.armour);
+ for(int i = 0; i < 5; i++) {
+ INPUT("%i", &player.foundspell[i]);
+ INPUT("%f", &player.spellcharge[i]);
+ }
+ for(int a = 0; a < 5; a++) {
+ INPUT("%i", &player.inventory[a]);
+ }
+ INPUT("%f", &player.attackstrength);
+ INPUT("%i", &player.spelldamage);
+ INPUT("%i", &player.sworddamage);
+ INPUT("%i", &player.exp);
+ INPUT("%i", &player.nextlevel);
+ for(int a = 0; a <= 99; a++) {
+ for(int b = 0; b <= 9; b++) {
+ INPUT("%i", &scriptflag[a][b]);
+ }
+ }
+ INPUT("%i", &curmap);
+
+ for(int a = 0; a <= 999; a++) {
+ for(int b = 0; b <= 20; b++) {
+ for(int c = 0; c <= 14; c++) {
+ INPUT("%i", &objmapf[a][b][c]);
+ }
+ }
+ }
+
+ for(int a = 0; a <= 200; a++) {
+ INPUT("%i", &roomlocks[a]);
+ }
+
+ INPUT("%f", &player.spellstrength);
+
+ fclose(fp);
+
+ return 1; // success
+ }
+
+ fclose(fp);
+ }
+
+ return 0; // fail
+}
+
+/* fill PLAYERTYPE playera; */
+int state_load_player(int slotnum)
+{
+ FILE *fp;
+ char line[256];
+
+ sprintf(line, player_sav, slotnum);
+
+ playera.level = 0;
+
+ fp = fopen(line, "r");
+ if(fp) {
+ INPUT("%i", &playera.level);
+
+ if(playera.level > 0) {
+ INPUT("%i", &asecstart);
+ INPUT("%s", line);
+
+ INPUT("%f", &playera.px);
+ INPUT("%f", &playera.py);
+ INPUT("%f", &playera.opx);
+ INPUT("%f", &playera.opy);
+ INPUT("%i", &playera.walkdir);
+ INPUT("%f", &playera.walkframe);
+ INPUT("%f", &playera.walkspd);
+ INPUT("%f", &playera.attackframe);
+ INPUT("%f", &playera.attackspd);
+ INPUT("%i", &playera.hp);
+ INPUT("%i", &playera.maxhp);
+ INPUT("%f", &playera.hpflash);
+ INPUT("%i", &playera.level);
+ INPUT("%i", &playera.maxlevel);
+ INPUT("%i", &playera.sword);
+ INPUT("%i", &playera.shield);
+ INPUT("%i", &playera.armour);
+ for(int i = 0; i < 5; i++) {
+ INPUT("%i", &playera.foundspell[i]);
+ INPUT("%f", &playera.spellcharge[i]);
+ }
+ for(int a = 0; a < 5; a++) {
+ INPUT("%i", &playera.inventory[a]);
+ }
+ INPUT("%f", &playera.attackstrength);
+ INPUT("%i", &playera.spelldamage);
+ INPUT("%i", &playera.sworddamage);
+ INPUT("%i", &playera.exp);
+ INPUT("%i", &playera.nextlevel);
+
+ fclose(fp);
+
+ return 1; // success
+ }
+
+ fclose(fp);
+ }
+
+ return 0; // fail
+}
+
+int state_save(int slotnum)
+{
+ FILE *fp;
+ char line[256];
+
+ sprintf(line, player_sav, slotnum);
+
+ fp = fopen(line, "w");
+ if(fp) {
+ PRINT("%i", player.level);
+
+ if(player.level > 0) {
+ PRINT("%i", (secstart + secsingame));
+ PRINT("%s", "a");
+
+ PRINT("%f", player.px);
+ PRINT("%f", player.py);
+ PRINT("%f", player.opx);
+ PRINT("%f", player.opy);
+ PRINT("%i", player.walkdir);
+ PRINT("%f", player.walkframe);
+ PRINT("%f", player.walkspd);
+ PRINT("%f", player.attackframe);
+ PRINT("%f", player.attackspd);
+ PRINT("%i", player.hp);
+ PRINT("%i", player.maxhp);
+ PRINT("%f", player.hpflash);
+ PRINT("%i", player.level);
+ PRINT("%i", player.maxlevel);
+ PRINT("%i", player.sword);
+ PRINT("%i", player.shield);
+ PRINT("%i", player.armour);
+ for(int i = 0; i < 5; i++) {
+ PRINT("%i", player.foundspell[i]);
+ PRINT("%f", player.spellcharge[i]);
+ }
+ for(int a = 0; a < 5; a++) {
+ PRINT("%i", player.inventory[a]);
+ }
+ PRINT("%f", player.attackstrength);
+ PRINT("%i", player.spelldamage);
+ PRINT("%i", player.sworddamage);
+ PRINT("%i", player.exp);
+ PRINT("%i", player.nextlevel);
+ for(int a = 0; a <= 99; a++) {
+ for(int b = 0; b <= 9; b++) {
+ PRINT("%i", scriptflag[a][b]);
+ }
+ }
+ PRINT("%i", curmap);
+
+ for(int a = 0; a <= 999; a++) {
+ for(int b = 0; b <= 20; b++) {
+ for(int c = 0; c <= 14; c++) {
+ PRINT("%i", objmapf[a][b][c]);
+ }
+ }
+ }
+
+ for(int a = 0; a <= 200; a++) {
+ PRINT("%i", roomlocks[a]);
+ }
+
+ PRINT("%f", player.spellstrength);
+ }
+
+ fclose(fp);
+
+ return 1; // success
+ }
+
+ return 0; // fail
+}
diff --git a/engines/griffon/state.h b/engines/griffon/state.h
new file mode 100644
index 0000000..d7f93aa
--- /dev/null
+++ b/engines/griffon/state.h
@@ -0,0 +1,27 @@
+/*
+ * 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
+ *
+ */
+
+#ifndef _STATE_H_
+#define _STATE_H_
+
+extern char player_sav[];
+
+int state_load(int slotnum);
+int state_load_player(int slotnum);
+int state_save(int slotnum);
+
+#endif // _STATE_H_
Commit: 2f66646acd718a9e93bc11c952d9e4b4d6d8aa80
https://github.com/scummvm/scummvm/commit/2f66646acd718a9e93bc11c952d9e4b4d6d8aa80
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Pass the original code via astyle
Changed paths:
engines/griffon/config.cpp
engines/griffon/engine.cpp
engines/griffon/engine.h
engines/griffon/state.cpp
diff --git a/engines/griffon/config.cpp b/engines/griffon/config.cpp
index 3cfc791..d430380 100644
--- a/engines/griffon/config.cpp
+++ b/engines/griffon/config.cpp
@@ -14,7 +14,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -24,71 +24,70 @@
#include <SDL/SDL.h>
#include "config.h"
-
- CONFIG config = {
+
+CONFIG config = {
320, 240, 16, 0, 0, 0, 1, 127, 1, 127
};
char config_ini[64] = "config.ini";
-#define PRINT(A,B) \
-do { \
- char line[256]; \
- sprintf(line, A "\n", B); \
- fputs(line, fp); \
-} while(0)
+#define PRINT(A,B) \
+ do { \
+ char line[256]; \
+ sprintf(line, A "\n", B); \
+ fputs(line, fp); \
+ } while(0)
-#define INPUT(A, B) \
-do { \
- char line[256]; \
- fgets(line, sizeof(line), fp); \
- sscanf(line, A, B); \
-} while(0)
+#define INPUT(A, B) \
+ do { \
+ char line[256]; \
+ fgets(line, sizeof(line), fp); \
+ sscanf(line, A, B); \
+ } while(0)
-void config_load(CONFIG *config)
-{
+void config_load(CONFIG *config) {
char line[128];
char arg[128];
FILE *fp;
fp = fopen(config_ini, "r");
- if(fp) {
- while(fgets(line, sizeof(line), fp) != NULL) {
+ if (fp) {
+ while (fgets(line, sizeof(line), fp) != NULL) {
sscanf(line, "%s", arg); // eliminate eol and eof by this
- if(strcmp(arg, "SCR_WIDTH:") == 0) {
+ if (strcmp(arg, "SCR_WIDTH:") == 0) {
fgets(line, sizeof(line), fp);
sscanf(line, "%i", &config->scr_width);
- } else if(strcmp(arg, "SCR_HEIGHT:") == 0) {
+ } else if (strcmp(arg, "SCR_HEIGHT:") == 0) {
fgets(line, sizeof(line), fp);
sscanf(line, "%i", &config->scr_height);
- } else if(strcmp(arg, "SCR_BITS:") == 0) {
+ } else if (strcmp(arg, "SCR_BITS:") == 0) {
fgets(line, sizeof(line), fp);
sscanf(line, "%i", &config->scr_bpp);
- } else if(strcmp(arg, "HWACCEL:YES") == 0) {
+ } else if (strcmp(arg, "HWACCEL:YES") == 0) {
config->hwaccel = SDL_HWACCEL;
- } else if(strcmp(arg, "HWACCEL:NO") == 0) {
+ } else if (strcmp(arg, "HWACCEL:NO") == 0) {
config->hwaccel = 0;
- } else if(strcmp(arg, "HWSURFACE:YES") == 0) {
+ } else if (strcmp(arg, "HWSURFACE:YES") == 0) {
config->hwsurface = SDL_HWSURFACE;
- } else if(strcmp(arg, "HWSURFACE:NO") == 0) {
+ } else if (strcmp(arg, "HWSURFACE:NO") == 0) {
config->hwsurface = 0;
- } else if(strcmp(arg, "FULLSCREEN:YES") == 0) {
+ } else if (strcmp(arg, "FULLSCREEN:YES") == 0) {
config->fullscreen = SDL_FULLSCREEN;
- } else if(strcmp(arg, "FULLSCREEN:NO") == 0) {
+ } else if (strcmp(arg, "FULLSCREEN:NO") == 0) {
config->fullscreen = 0;
- } else if(strcmp(arg, "MUSIC:YES") == 0) {
+ } else if (strcmp(arg, "MUSIC:YES") == 0) {
config->music = 1;
- } else if(strcmp(arg, "MUSIC:NO") == 0) {
+ } else if (strcmp(arg, "MUSIC:NO") == 0) {
config->music = 0;
- } else if(strcmp(arg, "SNDEFFECTS:YES") == 0) {
+ } else if (strcmp(arg, "SNDEFFECTS:YES") == 0) {
config->effects = 1;
- } else if(strcmp(arg, "SNDEFFECTS:NO") == 0) {
+ } else if (strcmp(arg, "SNDEFFECTS:NO") == 0) {
config->effects = 0;
- } else if(strcmp(arg, "opmusicvol:") == 0) {
+ } else if (strcmp(arg, "opmusicvol:") == 0) {
fgets(line, sizeof(line), fp);
sscanf(line, "%i", &config->musicvol);
- } else if(strcmp(arg, "opeffectsvol:") == 0) {
+ } else if (strcmp(arg, "opeffectsvol:") == 0) {
fgets(line, sizeof(line), fp);
sscanf(line, "%i", &config->effectsvol);
}
@@ -98,11 +97,10 @@ void config_load(CONFIG *config)
}
}
-void config_save(CONFIG *config)
-{
+void config_save(CONFIG *config) {
FILE *fp = fopen(config_ini, "w");
- if(fp) {
+ if (fp) {
PRINT("%s", "SCR_WIDTH:");
PRINT("%i", config->scr_width);
PRINT("%s", "SCR_HEIGHT:");
@@ -120,4 +118,4 @@ void config_save(CONFIG *config)
PRINT("%i", config->effectsvol);
fclose(fp);
}
-}
\ No newline at end of file
+}
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 6ced367..228b5d1 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -30,7 +30,7 @@
#include "config.h"
#include "state.h"
-// memo
+// memo
/*
in game scripts
2 - find master key
@@ -102,7 +102,7 @@ int itemselon, curitem, itemticks;
float itemyloc;
int selenemyon, curenemy, forcepause;
int roomlock; // set to disable any room jumps while in the room
-int scriptflag[100][10], saveslot; // script, flag
+int scriptflag[100][10], saveslot; // script, flag
// timer related - move to local later
int ticks, tickspassed, nextticks;
@@ -117,7 +117,7 @@ extern char *story2[27];
SDL_Rect rcSrc, rcDest;
// -----------special case
-int dontdrawover; // used in map24 so that the candles dont draw over the boss, default set to 0
+int dontdrawover; // used in map24 so that the candles dont draw over the boss, default set to 0
// saveload info
SDL_Surface *saveloadimg;
@@ -151,11 +151,11 @@ extern int elementmap[15][20];
// animation info
SDL_Surface *anims[100];
- // id number 0&1 = players
+// id number 0&1 = players
SDL_Surface *animsa[100];
- // attack anims
+// attack anims
float playerattackofs[4][16][3];
- // [dir] [frame] [x,y ofs, completed(0/1)]
+// [dir] [frame] [x,y ofs, completed(0/1)]
float floattext[MAXFLOAT][4]; // [id] [framesleft, x, y, col]
char *floatstri[MAXFLOAT];
@@ -167,20 +167,20 @@ ANIMSET2TYPE animset2[7], animset9[7];
// object info
float objectframe[256][2];
int lastobj;
- // frame!, curframe
+// frame!, curframe
int objectinfo[33][6];
- // nframes,xtiles,ytiles,speed,type,script, update?
+// nframes,xtiles,ytiles,speed,type,script, update?
int objecttile[33][9][3][3][2];
- // [objnum] [frame] [x] [y] [tile/layer]
+// [objnum] [frame] [x] [y] [tile/layer]
int objmap[21][15];
int objmapf[1000][21][15];
- // [mapnum] x, y set to 1 to make this objmap spot stay at -1
+// [mapnum] x, y set to 1 to make this objmap spot stay at -1
// trigger info
int triggers[10000][9];
- // [map#][index], [var]
- // map#,x,y
+// [map#][index], [var]
+// map#,x,y
int triggerloc[320][240], ntriggers;
// npc info
@@ -189,7 +189,7 @@ int lastnpc;
// music info
Mix_Chunk *mgardens, *mgardens2, *mgardens3, *mgardens4, *mboss, *mmenu, *mendofgame;
-int menabled=1, musicchannel = -1, menuchannel = -1;
+int menabled = 1, musicchannel = -1, menuchannel = -1;
int pgardens, pboss, ptown, pacademy, pcitadel;
int loopseta = 0;
@@ -205,8 +205,7 @@ int ysort[2401], lasty, firsty;
int pmenu;
#undef main
-int main()
-{
+int main() {
sys_initialize();
game_showlogos();
game_main();
@@ -216,21 +215,21 @@ int main()
// element tile locations
int elementmap[15][20] = {
- { 2, 2, 2, 2,-1,-1,-1, 2, 2, 2, 2, 2, 2,-1,-1,-1,-1,-1,-1,-1 },
- { 2,-1,-1,-1,-1,-1,-1, 2, 2, 2, 2, 2, 2,-1,-1,-1,-1,-1,-1,-1 },
- { 2,-1, 2, 2,-1,-1,-1, 2, 2, 2, 2, 2, 2,-1,-1,-1,-1,-1,-1,-1 },
- { 2,-1, 2,-1, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 },
- { 2, 2, 2, 2, 2,-1,-1,-1, 2,-1,-1, 2,-1,-1,-1,-1,-1,-1,-1,-1 },
- { -1,-1,-1,-1, 2,-1, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 },
- { -1,-1,-1,-1,-1, 0, 0, 2, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 },
- { -1,-1,-1,-1,-1, 2, 2, 2, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 },
- { -1,-1,-1,-1,-1, 2, 2, 2, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 },
- { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 },
- { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 },
- { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 },
- { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 },
- { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 },
- { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }
+ { 2, 2, 2, 2, -1, -1, -1, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1 },
+ { 2, -1, -1, -1, -1, -1, -1, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1 },
+ { 2, -1, 2, 2, -1, -1, -1, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1 },
+ { 2, -1, 2, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ { 2, 2, 2, 2, 2, -1, -1, -1, 2, -1, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1 },
+ { -1, -1, -1, -1, 2, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ { -1, -1, -1, -1, -1, 0, 0, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ { -1, -1, -1, -1, -1, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ { -1, -1, -1, -1, -1, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
};
char *story[48] = {
@@ -318,73 +317,72 @@ char *story2[27] = {
int invmap[4][7][13] = {
// map 0
{
- {0,0,0,0,0,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,43,44,45,46,0,0,0,0},
- {0,0,0,0,0,42,0,0,0,0,0,0,0},
- {0,0,0,0,3,2,0,0,0,0,0,0,0},
- {0,0,0,0,4,5,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,0,0,0,0,0}
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 43, 44, 45, 46, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 3, 2, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 4, 5, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
},
// map 1
{
- {0,0,0,0,0,0,0,0,0,0,0,0,0},
- {0,0,0,24,0,0,0,0,0,0,0,0,0},
- {0,0,19,20,21,22,0,0,0,27,0,0,0},
- {0,0,16,17,18,0,0,0,29,30,31,0,0},
- {0,0,12,0,13,14,0,32,33,34,35,36,0},
- {0,8,7,6,9,10,0,37,38,39,40,41,0},
- {0,0,0,0,0,0,0,0,0,0,0,0,0}
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 19, 20, 21, 22, 0, 0, 0, 27, 0, 0, 0},
+ {0, 0, 16, 17, 18, 0, 0, 0, 29, 30, 31, 0, 0},
+ {0, 0, 12, 0, 13, 14, 0, 32, 33, 34, 35, 36, 0},
+ {0, 8, 7, 6, 9, 10, 0, 37, 38, 39, 40, 41, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
},
// map 2
{
- {0,0,0,0,0,0,67,0,0,0,0,0,0},
- {0,0,0,0,0,0,66,0,0,0,0,0,0},
- {0,0,0,0,0,63,64,65,0,0,0,0,0},
- {0,0,0,0,58,59,60,61,62,0,0,0,0},
- {0,0,0,0,0,55,56,57,0,0,0,0,0},
- {0,0,0,0,50,51,52,53,54,0,0,0,0},
- {0,0,0,0,0,48,47,49,0,0,0,0,0}
+ {0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 63, 64, 65, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 58, 59, 60, 61, 62, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 55, 56, 57, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 50, 51, 52, 53, 54, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 48, 47, 49, 0, 0, 0, 0, 0}
},
// map 3
{
- {0,0,0,0,0,0,0,0,0,0,0,0,0},
- {0,0,0,82,0,0,0,0,0,0,0,0,0},
- {0,0,0,79,80,81,0,74,72,0,0,0,0},
- {0,0,0,78,0,0,0,73,70,69,68,0,0},
- {0,0,77,76,75,0,0,0,71,0,0,0,0},
- {0,0,0,0,0,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,0,0,0,0,0}
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 79, 80, 81, 0, 74, 72, 0, 0, 0, 0},
+ {0, 0, 0, 78, 0, 0, 0, 73, 70, 69, 68, 0, 0},
+ {0, 0, 77, 76, 75, 0, 0, 0, 71, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}
};
// HELPER MACRO ---------------------------------------------------------------
-#define PRINT(A,B) \
-do { \
- char line[256]; \
- sprintf(line, A "\n", B); \
- fputs(line, fp); \
-} while(0)
-
-#define INPUT(A, B) \
-do { \
- char line[256]; \
- fgets(line, sizeof(line), fp); \
- sscanf(line, A, B); \
-} while(0)
+#define PRINT(A,B) \
+ do { \
+ char line[256]; \
+ sprintf(line, A "\n", B); \
+ fputs(line, fp); \
+ } while(0)
+
+#define INPUT(A, B) \
+ do { \
+ char line[256]; \
+ fgets(line, sizeof(line), fp); \
+ sscanf(line, A, B); \
+ } while(0)
// CODE GOES HERE -------------------------------------------------------------
#ifdef OPENDINGUX
- #define SDL_BLITVIDEO(X, Y, C, F) SDL_BlitSurface((X), (Y), (C), (F))
+#define SDL_BLITVIDEO(X, Y, C, F) SDL_BlitSurface((X), (Y), (C), (F))
#else
- #define SDL_BLITVIDEO(X, Y, C, F) sdl_blitscale((X), (Y), (C), NULL)
+#define SDL_BLITVIDEO(X, Y, C, F) sdl_blitscale((X), (Y), (C), NULL)
#endif
-void sdl_blitscale(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect)
-{
- if(src->w != dst->w) {
+void sdl_blitscale(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) {
+ if (src->w != dst->w) {
SDL_Surface *scale2x = NULL;
scale2x = zoomSurface(src, 2, 2, 0);
@@ -396,8 +394,7 @@ void sdl_blitscale(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Re
}
-void game_fillrect(SDL_Surface *surface, int x, int y, int w, int h, int color)
-{
+void game_fillrect(SDL_Surface *surface, int x, int y, int w, int h, int color) {
SDL_Rect src;
src.x = x;
@@ -409,16 +406,14 @@ void game_fillrect(SDL_Surface *surface, int x, int y, int w, int h, int color)
}
// copypaste from hRnd_CRT()
-static float RND()
-{
+static float RND() {
/* return between 0 and 1 (but never 1) */
return (float)rand() * (1.0 / ((float)RAND_MAX + 1.0));
}
-void game_addFloatIcon(int ico, float xloc, float yloc)
-{
- for(int i = 0; i < MAXFLOAT; i++) {
- if(floaticon[i][0] == 0) {
+void game_addFloatIcon(int ico, float xloc, float yloc) {
+ for (int i = 0; i < MAXFLOAT; i++) {
+ if (floaticon[i][0] == 0) {
floaticon[i][0] = 32;
floaticon[i][1] = xloc;
floaticon[i][2] = yloc;
@@ -428,10 +423,9 @@ void game_addFloatIcon(int ico, float xloc, float yloc)
}
}
-void game_addFloatText(char *stri, float xloc, float yloc, int col)
-{
- for(int i = 0; i < MAXFLOAT; i++) {
- if(floattext[i][0] == 0) {
+void game_addFloatText(char *stri, float xloc, float yloc, int col) {
+ for (int i = 0; i < MAXFLOAT; i++) {
+ if (floattext[i][0] == 0) {
floattext[i][0] = 32;
floattext[i][1] = xloc;
floattext[i][2] = yloc;
@@ -442,8 +436,7 @@ void game_addFloatText(char *stri, float xloc, float yloc, int col)
}
}
-void game_attack()
-{
+void game_attack() {
float npx, npy;
npx = player.px + 12;
@@ -453,38 +446,38 @@ void game_attack()
int ly = (int)npy / 16;
// if facing up
- if(player.walkdir == 0) {
- if(ly > 0) {
+ if (player.walkdir == 0) {
+ if (ly > 0) {
int o2 = 0; // ??
int o = objmap[lx][ly - 1];
- if(ly > 1 && curmap == 58) o2 = objmap[lx][ly - 2];
- if(ly > 1 && curmap == 54) o2 = objmap[lx][ly - 2];
+ if (ly > 1 && curmap == 58) o2 = objmap[lx][ly - 2];
+ if (ly > 1 && curmap == 54) o2 = objmap[lx][ly - 2];
// cst
- if((objectinfo[o][4] == 1 && (o == 0 || o > 4)) || (objectinfo[o2][4] == 0 && o2 == 10)) {
- if(o2 == 10) o = 10;
+ if ((objectinfo[o][4] == 1 && (o == 0 || o > 4)) || (objectinfo[o2][4] == 0 && o2 == 10)) {
+ if (o2 == 10) o = 10;
int oscript = objectinfo[o][5];
- if(oscript == 0 && player.inventory[INV_FLASK] < 9) {
+ if (oscript == 0 && player.inventory[INV_FLASK] < 9) {
player.inventory[INV_FLASK]++;
game_addFloatIcon(6, lx * 16, (ly - 1) * 16);
objmapf[curmap][lx][ly - 1] = 1;
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
- if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
game_eventtext("Found Flask!");
itemticks = ticks + 215;
return;
}
- if(oscript == 0 && player.inventory[INV_FLASK] == 9) {
- if(menabled == 1 && config.effects == 1) {
+ if (oscript == 0 && player.inventory[INV_FLASK] == 9) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndchest], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -494,104 +487,104 @@ void game_attack()
return;
}
- if(oscript == 2) {
+ if (oscript == 2) {
player.inventory[INV_MASTERKEY]++;
game_addFloatIcon(14, lx * 16, (ly - 1) * 16);
itemticks = ticks + 215;
- if(curmap == 34) scriptflag[2][0] = 2;
- if(curmap == 62) scriptflag[8][0] = 2;
- if(curmap == 81) scriptflag[13][0] = 2;
+ if (curmap == 34) scriptflag[2][0] = 2;
+ if (curmap == 62) scriptflag[8][0] = 2;
+ if (curmap == 81) scriptflag[13][0] = 2;
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
- if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
game_eventtext("Found the Temple Key!");
return;
}
- if(oscript == 3) {
+ if (oscript == 3) {
player.foundspell[0] = 1;
player.spellcharge[0] = 0;
game_addFloatIcon(7, lx * 16, (ly - 1) * 16);
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
- if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
game_eventtext("Found the Infinite Crystal!");
itemticks = ticks + 215;
return;
}
- if(oscript == 4 && player.shield == 1) {
+ if (oscript == 4 && player.shield == 1) {
player.shield = 2;
game_addFloatIcon(4, lx * 16, (ly - 1) * 16);
itemticks = ticks + 215;
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
- if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
game_eventtext("Found the Obsidian Shield!");
objmapf[4][1][2] = 1;
return;
}
- if(oscript == 5 && player.sword == 1) {
+ if (oscript == 5 && player.sword == 1) {
player.sword = 2;
game_addFloatIcon(3, lx * 16, (ly - 1) * 16);
itemticks = ticks + 215;
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
- if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
game_eventtext("Found the Fidelis Sword!");
return;
}
- if(oscript == 6) {
- if(player.inventory[INV_NORMALKEY] < 9) {
+ if (oscript == 6) {
+ if (player.inventory[INV_NORMALKEY] < 9) {
player.inventory[INV_NORMALKEY]++;
- for(int s = 20; s <= 23; s++) {
- if(scriptflag[s][0] == 1) {
+ for (int s = 20; s <= 23; s++) {
+ if (scriptflag[s][0] == 1) {
scriptflag[s][0] = 2;
}
}
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
objmapf[curmap][lx][ly - 1] = 1;
- if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
game_eventtext("Found Key");
game_addFloatIcon(16, lx * 16, (ly - 1) * 16);
} else {
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndchest], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -600,26 +593,26 @@ void game_attack()
}
}
- if(oscript == 7 && player.inventory[INV_DOUBLEFLASK] < 9) {
+ if (oscript == 7 && player.inventory[INV_DOUBLEFLASK] < 9) {
player.inventory[INV_DOUBLEFLASK]++;
game_addFloatIcon(12, lx * 16, (ly - 1) * 16);
objmapf[curmap][lx][ly - 1] = 1;
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
- if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
game_eventtext("Found Mega Flask!");
itemticks = ticks + 215;
return;
}
- if(oscript == 7 && player.inventory[INV_DOUBLEFLASK] == 9) {
- if(menabled == 1 && config.effects == 1) {
+ if (oscript == 7 && player.inventory[INV_DOUBLEFLASK] == 9) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndchest], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -629,26 +622,26 @@ void game_attack()
return;
}
- if(oscript == 10 && player.inventory[INV_DOUBLEFLASK] < 9) {
+ if (oscript == 10 && player.inventory[INV_DOUBLEFLASK] < 9) {
player.inventory[INV_DOUBLEFLASK]++;
game_addFloatIcon(12, lx * 16, (ly - 1) * 16);
objmapf[curmap][lx][ly - 1] = 1;
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
- if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
game_eventtext("Found Mega Flask!");
itemticks = ticks + 215;
return;
}
- if(oscript == 10 && player.inventory[INV_DOUBLEFLASK] == 9) {
- if(menabled == 1 && config.effects == 1) {
+ if (oscript == 10 && player.inventory[INV_DOUBLEFLASK] == 9) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndchest], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -658,26 +651,26 @@ void game_attack()
return;
}
- if(oscript == 11 && player.inventory[INV_SHOCK] < 9) {
+ if (oscript == 11 && player.inventory[INV_SHOCK] < 9) {
player.inventory[INV_SHOCK]++;
game_addFloatIcon(17, lx * 16, (ly - 1) * 16);
objmapf[curmap][lx][ly - 1] = 1;
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
- if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
game_eventtext("Found Lightning Bomb!");
itemticks = ticks + 215;
return;
}
- if(oscript == 11 && player.inventory[INV_SHOCK] == 9) {
- if(menabled == 1 && config.effects == 1) {
+ if (oscript == 11 && player.inventory[INV_SHOCK] == 9) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndchest], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -687,34 +680,34 @@ void game_attack()
return;
}
- if(oscript == 12 && player.armour == 1) {
+ if (oscript == 12 && player.armour == 1) {
player.armour = 2;
game_addFloatIcon(5, lx * 16, (ly - 1) * 16);
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
- if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
game_eventtext("Found the Fidelis Mail!");
itemticks = ticks + 215;
return;
}
- if(oscript == 60) {
- if(curmap == 58 && scriptflag[60][0] == 0) {
+ if (oscript == 60) {
+ if (curmap == 58 && scriptflag[60][0] == 0) {
scriptflag[60][0] = 1;
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndlever], 0);
Mix_Volume(snd, config.effectsvol);
}
- } else if(curmap == 58 && scriptflag[60][0] > 0) {
- if(menabled == 1 && config.effects == 1) {
+ } else if (curmap == 58 && scriptflag[60][0] > 0) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[snddoor], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -722,15 +715,15 @@ void game_attack()
game_eventtext("It's stuck!");
}
- if(curmap == 54 && scriptflag[60][0] == 1) {
- if(menabled == 1 && config.effects == 1) {
+ if (curmap == 54 && scriptflag[60][0] == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndlever], 0);
Mix_Volume(snd, config.effectsvol);
}
scriptflag[60][0] = 2;
- } else if(curmap == 54 && scriptflag[60][0] > 1) {
- if(menabled == 1 && config.effects == 1) {
+ } else if (curmap == 54 && scriptflag[60][0] > 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[snddoor], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -740,51 +733,51 @@ void game_attack()
}
- if(oscript == 15 && player.sword < 3) {
+ if (oscript == 15 && player.sword < 3) {
player.sword = 3;
game_addFloatIcon(18, lx * 16, (ly - 1) * 16);
itemticks = ticks + 215;
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
- if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
game_eventtext("Found the Blood Sword!");
objmapf[4][1][2] = 1;
return;
}
- if(oscript == 16 && player.shield < 3) {
+ if (oscript == 16 && player.shield < 3) {
player.shield = 3;
game_addFloatIcon(19, lx * 16, (ly - 1) * 16);
itemticks = ticks + 215;
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
- if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
game_eventtext("Found the Entropy Shield!");
objmapf[4][1][2] = 1;
return;
}
- if(oscript == 17 && player.armour < 3) {
+ if (oscript == 17 && player.armour < 3) {
player.armour = 3;
game_addFloatIcon(20, lx * 16, (ly - 1) * 16);
itemticks = ticks + 215;
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
- if(objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
game_eventtext("Found the Rubyscale Armour!");
objmapf[4][1][2] = 1;
return;
@@ -801,19 +794,18 @@ void game_attack()
movingleft = 0;
movingright = 0;
- for(int i = 0; i <= 15; i++) {
- for(int a = 0; a <= 3; a++) {
+ for (int i = 0; i <= 15; i++) {
+ for (int a = 0; a <= 3; a++) {
playerattackofs[a][i][2] = 0;
}
}
}
-void game_castspell(int spellnum, float homex, float homey, float enemyx, float enemyy, int damagewho)
-{
+void game_castspell(int spellnum, float homex, float homey, float enemyx, float enemyy, int damagewho) {
// spellnum 7 = sprite 6 spitfire
- for(int i = 0; i < MAXSPELL; i++) {
- if(spellinfo[i].frame == 0) {
+ for (int i = 0; i < MAXSPELL; i++) {
+ if (spellinfo[i].frame == 0) {
spellinfo[i].homex = homex;
spellinfo[i].homey = homey;
spellinfo[i].enemyx = enemyx;
@@ -821,7 +813,7 @@ void game_castspell(int spellnum, float homex, float homey, float enemyx, float
spellinfo[i].spellnum = spellnum;
int dw = 0;
int npc = 0;
- if(damagewho > 0) {
+ if (damagewho > 0) {
dw = 1;
npc = damagewho;
}
@@ -830,14 +822,14 @@ void game_castspell(int spellnum, float homex, float homey, float enemyx, float
spellinfo[i].npc = npc;
spellinfo[i].frame = 32;
- if(damagewho == 0) {
+ if (damagewho == 0) {
spellinfo[i].strength = player.spellstrength / 100;
- if(player.spellstrength == 100) spellinfo[i].strength = 1.5;
+ if (player.spellstrength == 100) spellinfo[i].strength = 1.5;
}
// set earthslide vars
- if(spellnum == 2) {
- for(int f = 0; f <= 8; f++) {
+ if (spellnum == 2) {
+ for (int f = 0; f <= 8; f++) {
spellinfo[i].rocky[f] = 0;
spellinfo[i].rockimg[f] = (int)(RND() * 4);
spellinfo[i].rockdeflect[f] = ((int)(RND() * 128) - 64) * 1.5;
@@ -845,19 +837,19 @@ void game_castspell(int spellnum, float homex, float homey, float enemyx, float
}
// set fire vars
- if(spellnum == 3) {
- for(int f = 0; f <= 4; f++) {
+ if (spellnum == 3) {
+ for (int f = 0; f <= 4; f++) {
spellinfo[i].legalive[f] = 32;
}
}
// room fireball vars
- if(spellnum == 6) {
+ if (spellnum == 6) {
int nballs = 0;
- for(int x = 0; x <= 19; x++) {
- for(int y = 0; y <= 14; y++) {
- if((objmap[x][y] == 1 || objmap[x][y] == 2) && nballs < 5 && (int)(RND() * 4) == 0) {
+ for (int x = 0; x <= 19; x++) {
+ for (int y = 0; y <= 14; y++) {
+ if ((objmap[x][y] == 1 || objmap[x][y] == 2) && nballs < 5 && (int)(RND() * 4) == 0) {
int ax = x * 16;
int ay = y * 16;
@@ -874,14 +866,14 @@ void game_castspell(int spellnum, float homex, float homey, float enemyx, float
spellinfo[i].nfballs = nballs;
}
- if(menabled == 1 && config.effects == 1) {
- if(spellnum == 1) {
+ if (menabled == 1 && config.effects == 1) {
+ if (spellnum == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndthrow], 0);
Mix_Volume(snd, config.effectsvol);
- } else if(spellnum == 5) {
+ } else if (spellnum == 5) {
int snd = Mix_PlayChannel(-1, sfx[sndcrystal], 0);
Mix_Volume(snd, config.effectsvol);
- } else if(spellnum == 8 || spellnum == 9) {
+ } else if (spellnum == 8 || spellnum == 9) {
int snd = Mix_PlayChannel(-1, sfx[sndlightning], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -892,14 +884,13 @@ void game_castspell(int spellnum, float homex, float homey, float enemyx, float
}
}
-void game_checkhit()
-{
+void game_checkhit() {
float npx, npy;
float damage;
- if(attacking == 1) {
- for(int i = 1; i <= lastnpc; i++) {
- if(npcinfo[i].hp > 0 && npcinfo[i].pause < ticks && (int)(RND() * 2) == 0) {
+ if (attacking == 1) {
+ for (int i = 1; i <= lastnpc; i++) {
+ if (npcinfo[i].hp > 0 && npcinfo[i].pause < ticks && (int)(RND() * 2) == 0) {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
@@ -907,36 +898,35 @@ void game_checkhit()
float ydif = player.py - npy;
float ps = player.sword;
- if(ps > 1) ps = ps * 0.75;
- damage = (float)player.sworddamage * (1.0 + RND() * 1.0) * player.attackstrength / 100.0 * ps;
- if(player.attackstrength == 100) damage = damage * 1.5;
-
- int hit = 0;
- if(player.walkdir == 0) {
- if(abs(xdif) <= 8 && ydif >= 0 && ydif < 8) hit = 1;
- } else if(player.walkdir == 1) {
- if(abs(xdif) <= 8 && ydif <= 0 && ydif > -8) hit = 1;
- } else if(player.walkdir == 2) {
- if(abs(ydif) <= 8 && xdif >= -8 && xdif < 8) hit = 1;
- } else if(player.walkdir == 3) {
- if(abs(ydif) <= 8 && xdif <= 8 && xdif > -8) hit = 1;
- }
-
- if(hit == 1) {
- if(menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndswordhit], 0);
- Mix_Volume(snd, config.effectsvol);
- }
+ if (ps > 1) ps = ps * 0.75;
+ damage = (float)player.sworddamage * (1.0 + RND() * 1.0) * player.attackstrength / 100.0 * ps;
+ if (player.attackstrength == 100) damage = damage * 1.5;
+
+ int hit = 0;
+ if (player.walkdir == 0) {
+ if (abs(xdif) <= 8 && ydif >= 0 && ydif < 8) hit = 1;
+ } else if (player.walkdir == 1) {
+ if (abs(xdif) <= 8 && ydif <= 0 && ydif > -8) hit = 1;
+ } else if (player.walkdir == 2) {
+ if (abs(ydif) <= 8 && xdif >= -8 && xdif < 8) hit = 1;
+ } else if (player.walkdir == 3) {
+ if (abs(ydif) <= 8 && xdif <= 8 && xdif > -8) hit = 1;
+ }
- game_damagenpc(i, damage, 0);
+ if (hit == 1) {
+ if (menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndswordhit], 0);
+ Mix_Volume(snd, config.effectsvol);
}
+
+ game_damagenpc(i, damage, 0);
+ }
}
}
}
}
-void game_checkinputs()
-{
+void game_checkinputs() {
int ntickdelay;
ntickdelay = 175;
@@ -946,15 +936,15 @@ void game_checkinputs()
nposts = 0;
- for(int i = 0; i <= 20; i++) {
+ for (int i = 0; i <= 20; i++) {
postinfo[i][0] = 0;
postinfo[i][1] = 0;
}
- for(int x = 0; x <= 19; x++) {
- for(int y = 0; y <= 14; y++) {
+ for (int x = 0; x <= 19; x++) {
+ for (int y = 0; y <= 14; y++) {
int o = objmap[x][y];
- if(objectinfo[o][4] == 3) {
+ if (objectinfo[o][4] == 3) {
postinfo[nposts][0] = x * 16;
postinfo[nposts][1] = y * 16;
nposts = nposts + 1;
@@ -962,16 +952,16 @@ void game_checkinputs()
}
}
- if(attacking == 1 || (forcepause == 1 && itemselon == 0)) return;
+ if (attacking == 1 || (forcepause == 1 && itemselon == 0)) return;
- if(event.type == SDL_KEYDOWN) {
- switch(event.key.keysym.sym) {
+ if (event.type == SDL_KEYDOWN) {
+ switch (event.key.keysym.sym) {
case SDLK_ESCAPE:
- if(itemticks < ticks) game_title(1);
+ if (itemticks < ticks) game_title(1);
break;
case SDLK_RETURN:
- if(keys[SDLK_LALT] || keys[SDLK_RALT]) {
- if(fullscreen & SDL_FULLSCREEN) {
+ if (keys[SDLK_LALT] || keys[SDLK_RALT]) {
+ if (fullscreen & SDL_FULLSCREEN) {
fullscreen = config.hwaccel | config.hwsurface;
} else {
fullscreen = SDL_FULLSCREEN | config.hwaccel | config.hwsurface;
@@ -985,16 +975,16 @@ void game_checkinputs()
break;
case SDLK_LCTRL:
- if(itemselon == 0 && itemticks < ticks) game_attack();
+ if (itemselon == 0 && itemticks < ticks) game_attack();
- if(itemselon == 1 && itemticks < ticks) {
- if(curitem == 0 && player.inventory[INV_FLASK] > 0) {
+ if (itemselon == 1 && itemticks < ticks) {
+ if (curitem == 0 && player.inventory[INV_FLASK] > 0) {
itemticks = ticks + ntickdelay;
int heal = 50;
int maxh = player.maxhp - player.hp;
- if(heal > maxh) heal = maxh;
+ if (heal > maxh) heal = maxh;
player.hp = player.hp + heal;
@@ -1004,7 +994,7 @@ void game_checkinputs()
player.inventory[INV_FLASK]--;
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -1013,13 +1003,13 @@ void game_checkinputs()
forcepause = 0;
}
- if(curitem == 1 && player.inventory[INV_DOUBLEFLASK] > 0) {
+ if (curitem == 1 && player.inventory[INV_DOUBLEFLASK] > 0) {
itemticks = ticks + ntickdelay;
int heal = 200;
int maxh = player.maxhp - player.hp;
- if(heal > maxh) heal = maxh;
+ if (heal > maxh) heal = maxh;
player.hp = player.hp + heal;
@@ -1029,7 +1019,7 @@ void game_checkinputs()
player.inventory[INV_DOUBLEFLASK]--;
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -1039,7 +1029,7 @@ void game_checkinputs()
}
- if(curitem == 2 && player.inventory[INV_SHOCK] > 0) {
+ if (curitem == 2 && player.inventory[INV_SHOCK] > 0) {
game_castspell(8, player.px, player.py, npcinfo[curenemy].x, npcinfo[curenemy].y, 0);
forcepause = 1;
@@ -1052,7 +1042,7 @@ void game_checkinputs()
}
- if(curitem == 3 && player.inventory[INV_NORMALKEY] > 0 && canusekey == 1 && locktype == 1) {
+ if (curitem == 3 && player.inventory[INV_NORMALKEY] > 0 && canusekey == 1 && locktype == 1) {
roomlocks[roomtounlock] = 0;
game_eventtext("UnLocked!");
@@ -1064,7 +1054,7 @@ void game_checkinputs()
return;
}
- if(curitem == 4 && player.inventory[INV_MASTERKEY] > 0 && canusekey == 1 && locktype == 2) {
+ if (curitem == 4 && player.inventory[INV_MASTERKEY] > 0 && canusekey == 1 && locktype == 2) {
roomlocks[roomtounlock] = 0;
game_eventtext("UnLocked!");
@@ -1076,7 +1066,7 @@ void game_checkinputs()
return;
}
- if(curitem == 5 && player.spellcharge[0] == 100) {
+ if (curitem == 5 && player.spellcharge[0] == 100) {
game_castspell(5, player.px, player.py, npcinfo[curenemy].x, npcinfo[curenemy].y, 0);
player.spellcharge[0] = 0;
@@ -1088,8 +1078,8 @@ void game_checkinputs()
itemselon = 0;
}
- if(curitem > 5 && selenemyon == 1) {
- if(curenemy <= lastnpc) {
+ if (curitem > 5 && selenemyon == 1) {
+ if (curenemy <= lastnpc) {
game_castspell(curitem - 6, player.px, player.py, npcinfo[curenemy].x, npcinfo[curenemy].y, 0);
} else {
int pst = curenemy - lastnpc - 1;
@@ -1106,27 +1096,27 @@ void game_checkinputs()
forcepause = 0;
}
- if(curitem > 5 && selenemyon == 0 && itemselon == 1) {
- if(player.spellcharge[curitem - 5] == 100) {
+ if (curitem > 5 && selenemyon == 0 && itemselon == 1) {
+ if (player.spellcharge[curitem - 5] == 100) {
itemticks = ticks + ntickdelay;
selenemyon = 1;
int i = 0;
do {
- if(npcinfo[i].hp > 0) {
+ if (npcinfo[i].hp > 0) {
curenemy = i;
goto __exit_do;
}
i = i + 1;
- if(i == lastnpc + 1) {
+ if (i == lastnpc + 1) {
selenemyon = 0;
goto __exit_do;
}
- } while(1);
- __exit_do:
+ } while (1);
+__exit_do:
- if(nposts > 0 && selenemyon == 0) {
+ if (nposts > 0 && selenemyon == 0) {
selenemyon = 1;
curenemy = lastnpc + 1;
}
@@ -1137,9 +1127,9 @@ void game_checkinputs()
break;
case SDLK_LALT:
- if(itemticks < ticks) {
+ if (itemticks < ticks) {
selenemyon = 0;
- if(itemselon == 1) {
+ if (itemselon == 1) {
itemselon = 0;
itemticks = ticks + 220;
forcepause = 0;
@@ -1157,82 +1147,81 @@ void game_checkinputs()
}
}
- if(itemselon == 0) {
+ if (itemselon == 0) {
movingup = 0;
movingdown = 0;
movingleft = 0;
movingright = 0;
- if(keys[SDLK_UP]) movingup = 1;
- if(keys[SDLK_DOWN]) movingdown = 1;
- if(keys[SDLK_LEFT]) movingleft = 1;
- if(keys[SDLK_RIGHT]) movingright = 1;
+ if (keys[SDLK_UP]) movingup = 1;
+ if (keys[SDLK_DOWN]) movingdown = 1;
+ if (keys[SDLK_LEFT]) movingleft = 1;
+ if (keys[SDLK_RIGHT]) movingright = 1;
} else {
movingup = 0;
movingdown = 0;
movingleft = 0;
movingright = 0;
- if(selenemyon == 1) {
- if(itemticks < ticks) {
- if(keys[SDLK_LEFT]) {
+ if (selenemyon == 1) {
+ if (itemticks < ticks) {
+ if (keys[SDLK_LEFT]) {
int origin = curenemy;
do {
curenemy = curenemy - 1;
- if(curenemy < 1) curenemy = lastnpc + nposts;
- if(curenemy == origin) break;
- if(curenemy <= lastnpc && npcinfo[curenemy].hp > 0) break;
- if(curenemy > lastnpc) break;
- } while(1);
+ if (curenemy < 1) curenemy = lastnpc + nposts;
+ if (curenemy == origin) break;
+ if (curenemy <= lastnpc && npcinfo[curenemy].hp > 0) break;
+ if (curenemy > lastnpc) break;
+ } while (1);
itemticks = ticks + ntickdelay;
}
- if(keys[SDLK_RIGHT]) {
+ if (keys[SDLK_RIGHT]) {
int origin = curenemy;
do {
curenemy = curenemy + 1;
- if(curenemy > lastnpc + nposts) curenemy = 1;
- if(curenemy == origin) break;
- if(curenemy <= lastnpc && npcinfo[curenemy].hp > 0) break;
- if(curenemy > lastnpc) break;
- } while(1);
+ if (curenemy > lastnpc + nposts) curenemy = 1;
+ if (curenemy == origin) break;
+ if (curenemy <= lastnpc && npcinfo[curenemy].hp > 0) break;
+ if (curenemy > lastnpc) break;
+ } while (1);
itemticks = ticks + ntickdelay;
}
- if(curenemy > lastnpc + nposts) curenemy = 1;
- if(curenemy < 1) curenemy = lastnpc + nposts;
+ if (curenemy > lastnpc + nposts) curenemy = 1;
+ if (curenemy < 1) curenemy = lastnpc + nposts;
}
} else {
- if(itemticks < ticks) {
- if(keys[SDLK_UP]) {
+ if (itemticks < ticks) {
+ if (keys[SDLK_UP]) {
curitem = curitem - 1;
itemticks = ticks + ntickdelay;
- if(curitem == 4) curitem = 9;
- if(curitem == -1) curitem = 4;
+ if (curitem == 4) curitem = 9;
+ if (curitem == -1) curitem = 4;
}
- if(keys[SDLK_DOWN]) {
+ if (keys[SDLK_DOWN]) {
curitem = curitem + 1;
itemticks = ticks + ntickdelay;
- if(curitem == 5) curitem = 0;
- if(curitem == 10) curitem = 5;
+ if (curitem == 5) curitem = 0;
+ if (curitem == 10) curitem = 5;
}
- if(keys[SDLK_LEFT]) {
+ if (keys[SDLK_LEFT]) {
curitem = curitem - 5;
itemticks = ticks + ntickdelay;
}
- if(keys[SDLK_RIGHT]) {
+ if (keys[SDLK_RIGHT]) {
curitem = curitem + 5;
itemticks = ticks + ntickdelay;
}
- if(curitem > 9) curitem = curitem - 10;
- if(curitem < 0) curitem = curitem + 10;
+ if (curitem > 9) curitem = curitem - 10;
+ if (curitem < 0) curitem = curitem + 10;
}
}
}
}
-void game_checktrigger()
-{
+void game_checktrigger() {
int npx, npy, lx, ly;
npx = player.px + 12;
@@ -1243,21 +1232,20 @@ void game_checktrigger()
canusekey = 0;
- if(triggerloc[lx][ly] > -1) game_processtrigger(triggerloc[lx][ly]);
+ if (triggerloc[lx][ly] > -1) game_processtrigger(triggerloc[lx][ly]);
}
#ifdef OPENDINGUX
- #define MINCURSEL 7
- #define MAXCURSEL 14
- #define SY 22
+#define MINCURSEL 7
+#define MAXCURSEL 14
+#define SY 22
#else
- #define MINCURSEL 0
- #define MAXCURSEL 14
- #define SY (38 + (240 - 38) / 2 - 88)
+#define MINCURSEL 0
+#define MAXCURSEL 14
+#define SY (38 + (240 - 38) / 2 - 88)
#endif
-void game_configmenu()
-{
+void game_configmenu() {
SDL_Surface *configwindow;
SDL_Rect rc;
int cursel, curselt, ofullscreen;
@@ -1301,7 +1289,7 @@ void game_configmenu()
int sy = SY;
- for(int i = 0; i <= 21; i++) {
+ for (int i = 0; i <= 21; i++) {
static char *vr[22] = {
#ifdef OPENDINGUX
"", "",
@@ -1336,43 +1324,43 @@ void game_configmenu()
};
static char line[24];
- if(i == 15 || i == 17) {
+ if (i == 15 || i == 17) {
int vol = (i == 15 ? config.musicvol : config.effectsvol) * 9 / 255;
- if(vol < 0) vol = 0;
- if(vol > 9) vol = 9;
+ if (vol < 0) vol = 0;
+ if (vol > 9) vol = 9;
strcpy(line, "[----------]");
- line[vol+1] = 'X';
+ line[vol + 1] = 'X';
vl[i] = line;
}
int cl = 3;
- if(i == 0 && config.scr_width == 320) cl = 0;
- if(i == 1 && config.scr_width == 640) cl = 0;
- if(i == 2 && config.scr_bpp == 16) cl = 0;
- if(i == 3 && config.scr_bpp == 24) cl = 0;
- if(i == 4 && config.scr_bpp == 32) cl = 0;
- if(i == 6 && config.fullscreen != 0) cl = 0;
- if(i == 7 && config.fullscreen == 0) cl = 0;
- if(i == 9 && config.music == 1) cl = 0;
- if(i == 10 && config.music == 0) cl = 0;
- if(i == 12 && config.effects == 1) cl = 0;
- if(i == 13 && config.effects == 0) cl = 0;
-
- if(i > 18) cl = 0;
+ if (i == 0 && config.scr_width == 320) cl = 0;
+ if (i == 1 && config.scr_width == 640) cl = 0;
+ if (i == 2 && config.scr_bpp == 16) cl = 0;
+ if (i == 3 && config.scr_bpp == 24) cl = 0;
+ if (i == 4 && config.scr_bpp == 32) cl = 0;
+ if (i == 6 && config.fullscreen != 0) cl = 0;
+ if (i == 7 && config.fullscreen == 0) cl = 0;
+ if (i == 9 && config.music == 1) cl = 0;
+ if (i == 10 && config.music == 0) cl = 0;
+ if (i == 12 && config.effects == 1) cl = 0;
+ if (i == 13 && config.effects == 0) cl = 0;
+
+ if (i > 18) cl = 0;
sys_print(videobuffer, vr[i], 156 - 8 * strlen(vr[i]), sy + i * 8, 0);
sys_print(videobuffer, vl[i], 164, sy + i * 8, cl);
}
curselt = cursel;
- if(cursel > 4) curselt = curselt + 1;
- if(cursel > 6) curselt = curselt + 1;
- if(cursel > 8) curselt = curselt + 1;
- if(cursel > 10) curselt = curselt + 1;
- if(cursel > 11) curselt = curselt + 1;
- if(cursel > 12) curselt = curselt + 1;
- if(cursel > 13) curselt = curselt + 1;
+ if (cursel > 4) curselt = curselt + 1;
+ if (cursel > 6) curselt = curselt + 1;
+ if (cursel > 8) curselt = curselt + 1;
+ if (cursel > 10) curselt = curselt + 1;
+ if (cursel > 11) curselt = curselt + 1;
+ if (cursel > 12) curselt = curselt + 1;
+ if (cursel > 13) curselt = curselt + 1;
rc.x = 148 + 3 * cos(3.14159 * 2 * itemyloc / 16.0);
rc.y = sy + 8 * curselt - 4;
@@ -1380,10 +1368,10 @@ void game_configmenu()
SDL_BlitSurface(itemimg[15], NULL, videobuffer, &rc);
float yy = 255.0;
- if(ticks < ticks1 + 1000) {
+ if (ticks < ticks1 + 1000) {
yy = 255.0 * ((float)(ticks - ticks1) / 1000.0);
- if(yy < 0.0) yy = 0.0;
- if(yy > 255.0) yy = 255.0;
+ if (yy < 0.0) yy = 0.0;
+ if (yy > 255.0) yy = 255.0;
}
SDL_SetAlpha(videobuffer, SDL_SRCALPHA, (int)yy);
@@ -1400,82 +1388,82 @@ void game_configmenu()
fpsr = (float)tickspassed / 24;
fp++;
- if(ticks > nextticks) {
+ if (ticks > nextticks) {
nextticks = ticks + 1000;
fps = fp;
fp = 0;
}
itemyloc += 0.75 * fpsr;
- while(itemyloc >= 16) itemyloc -= 16;
+ while (itemyloc >= 16) itemyloc -= 16;
- if(keypause < ticks) {
+ if (keypause < ticks) {
SDL_PollEvent(&event);
keys = SDL_GetKeyState(NULL);
- if(event.type == SDL_KEYDOWN) {
+ if (event.type == SDL_KEYDOWN) {
keypause = ticks + tickwait;
- if(keys[SDLK_ESCAPE] || keys[SDLK_LALT]) break;
+ if (keys[SDLK_ESCAPE] || keys[SDLK_LALT]) break;
- if(keys[SDLK_LEFT]) {
- if(cursel == 11) {
+ if (keys[SDLK_LEFT]) {
+ if (cursel == 11) {
config.musicvol = config.musicvol - 25;
- if(config.musicvol < 0) config.musicvol = 0;
+ if (config.musicvol < 0) config.musicvol = 0;
Mix_Volume(musicchannel, config.musicvol);
Mix_Volume(menuchannel, config.musicvol);
- } else if(cursel == 12) {
+ } else if (cursel == 12) {
config.effectsvol = config.effectsvol - 25;
- if(config.effectsvol < 0) config.effectsvol = 0;
+ if (config.effectsvol < 0) config.effectsvol = 0;
Mix_Volume(-1, config.effectsvol);
Mix_Volume(musicchannel, config.musicvol);
Mix_Volume(menuchannel, config.musicvol);
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[snddoor], 0);
Mix_Volume(snd, config.effectsvol);
}
}
}
- if(keys[SDLK_RIGHT]) {
- if(cursel == 11) {
+ if (keys[SDLK_RIGHT]) {
+ if (cursel == 11) {
config.musicvol = config.musicvol + 25;
- if(config.musicvol > 255) config.musicvol = 255;
+ if (config.musicvol > 255) config.musicvol = 255;
Mix_Volume(musicchannel, config.musicvol);
Mix_Volume(menuchannel, config.musicvol);
- } else if(cursel == 12) {
+ } else if (cursel == 12) {
config.effectsvol = config.effectsvol + 25;
- if(config.effectsvol > 255) config.effectsvol = 255;
+ if (config.effectsvol > 255) config.effectsvol = 255;
Mix_Volume(-1, config.effectsvol);
Mix_Volume(musicchannel, config.musicvol);
Mix_Volume(menuchannel, config.musicvol);
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[snddoor], 0);
Mix_Volume(snd, config.effectsvol);
}
}
}
- if(keys[SDLK_UP]) {
+ if (keys[SDLK_UP]) {
cursel--;
- if(cursel < MINCURSEL) cursel = 14;
+ if (cursel < MINCURSEL) cursel = 14;
}
- if(keys[SDLK_DOWN]) {
+ if (keys[SDLK_DOWN]) {
cursel++;
- if(cursel > 14) cursel = MINCURSEL;
+ if (cursel > 14) cursel = MINCURSEL;
}
- if(keys[SDLK_LCTRL] || keys[SDLK_RETURN]) {
- if(cursel == 0) {
+ if (keys[SDLK_LCTRL] || keys[SDLK_RETURN]) {
+ if (cursel == 0) {
fullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
video = SDL_SetVideoMode(320, 240, config.scr_bpp, fullscreen);
- if(video == 0) {
+ if (video == 0) {
video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
} else {
config.scr_width = 320;
@@ -1484,11 +1472,11 @@ void game_configmenu()
SDL_UpdateRect(video, 0, 0, config.scr_width, config.scr_height);
}
- if(cursel == 1) {
+ if (cursel == 1) {
fullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
video = SDL_SetVideoMode(640, 480, config.scr_bpp, fullscreen);
- if(video == 0) {
+ if (video == 0) {
video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
} else {
config.scr_width = 640;
@@ -1497,14 +1485,14 @@ void game_configmenu()
SDL_UpdateRect(video, 0, 0, config.scr_width, config.scr_height);
}
- if(cursel == 2 || cursel == 3 || cursel == 4) {
+ if (cursel == 2 || cursel == 3 || cursel == 4) {
fullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
int b = 16;
- if(cursel == 3) b = 24;
- if(cursel == 4) b = 32;
+ if (cursel == 3) b = 24;
+ if (cursel == 4) b = 32;
video = SDL_SetVideoMode(config.scr_width, config.scr_height, b, fullscreen);
- if(video == 0) {
+ if (video == 0) {
video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
} else {
config.scr_bpp = b;
@@ -1512,12 +1500,12 @@ void game_configmenu()
SDL_UpdateRect(video, 0, 0, config.scr_width, config.scr_height);
}
- if(cursel == 5) {
+ if (cursel == 5) {
ofullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
fullscreen = SDL_FULLSCREEN | config.hwaccel | config.hwsurface;
video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
- if(video == 0) {
+ if (video == 0) {
video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, ofullscreen);
} else {
config.fullscreen = SDL_FULLSCREEN;
@@ -1525,12 +1513,12 @@ void game_configmenu()
SDL_UpdateRect(video, 0, 0, config.scr_width, config.scr_height);
}
- if(cursel == 6) {
+ if (cursel == 6) {
ofullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
fullscreen = 0 | config.hwaccel | config.hwsurface;
video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
- if(video == 0) {
+ if (video == 0) {
video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, ofullscreen);
} else {
config.fullscreen = 0;
@@ -1538,34 +1526,34 @@ void game_configmenu()
SDL_UpdateRect(video, 0, 0, config.scr_width, config.scr_height);
}
- if(cursel == 7 && config.music == 0) {
+ if (cursel == 7 && config.music == 0) {
config.music = 1;
- if(menabled == 1) {
+ if (menabled == 1) {
menuchannel = Mix_PlayChannel(-1, mmenu, -1);
Mix_Volume(menuchannel, config.musicvol);
}
}
- if(cursel == 8 && config.music == 1) {
+ if (cursel == 8 && config.music == 1) {
config.music = 0;
Mix_HaltChannel(musicchannel);
Mix_HaltChannel(menuchannel);
}
- if(cursel == 9 && config.effects == 0) {
+ if (cursel == 9 && config.effects == 0) {
config.effects = 1;
- if(menabled == 1) {
+ if (menabled == 1) {
int snd = Mix_PlayChannel(-1, sfx[snddoor], 0);
Mix_Volume(snd, config.effectsvol);
}
}
- if(cursel == 10 && config.effects == 1) config.effects = 0;
+ if (cursel == 10 && config.effects == 1) config.effects = 0;
- if(cursel == 13) {
+ if (cursel == 13) {
config_save(&config);
break;
}
- if(cursel == 14) {
+ if (cursel == 14) {
// reset keys to avoid returning
keys[SDLK_SPACE] = keys[SDLK_RETURN] = 0;
break;
@@ -1575,10 +1563,10 @@ void game_configmenu()
}
clouddeg += 0.01 * fpsr;
- while(clouddeg >= 360) clouddeg = clouddeg - 360;
+ while (clouddeg >= 360) clouddeg = clouddeg - 360;
SDL_Delay(10);
- } while(1);
+ } while (1);
SDL_FreeSurface(configwindow);
itemticks = ticks + 210;
@@ -1586,37 +1574,36 @@ void game_configmenu()
SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 64);
}
-void game_damagenpc(int npcnum, int damage, int spell)
-{
+void game_damagenpc(int npcnum, int damage, int spell) {
float npx, npy;
int lx, ly, cx, cy, alive;
char line[256];
int ratio;
int fcol, heal, ff;
- if(damage == 0) {
+ if (damage == 0) {
strcpy(line, "miss!");
fcol = 2;
} else {
ratio = 0;
heal = 0;
- if(damage < 0) heal = 1;
+ if (damage < 0) heal = 1;
damage = abs(damage);
- if(heal == 0) {
- if(damage > npcinfo[npcnum].hp) {
+ if (heal == 0) {
+ if (damage > npcinfo[npcnum].hp) {
ratio = (damage - npcinfo[npcnum].hp) * 100 / damage;
damage = npcinfo[npcnum].hp;
}
npcinfo[npcnum].hp -= damage;
- if(npcinfo[npcnum].hp < 0) npcinfo[npcnum].hp = 0;
+ if (npcinfo[npcnum].hp < 0) npcinfo[npcnum].hp = 0;
sprintf(line, "-%i", damage);
fcol = 1;
} else {
npcinfo[npcnum].hp += damage;
- if(npcinfo[npcnum].hp > npcinfo[npcnum].maxhp) npcinfo[npcnum].hp = npcinfo[npcnum].maxhp;
+ if (npcinfo[npcnum].hp > npcinfo[npcnum].maxhp) npcinfo[npcnum].hp = npcinfo[npcnum].maxhp;
sprintf(line, "+%i", damage);
fcol = 5;
@@ -1624,67 +1611,67 @@ void game_damagenpc(int npcnum, int damage, int spell)
npcinfo[npcnum].pause = ticks + 900;
- if(spell == 0) player.attackstrength = ratio;
+ if (spell == 0) player.attackstrength = ratio;
}
game_addFloatText(line, npcinfo[npcnum].x + 12 - 4 * strlen(line), npcinfo[npcnum].y + 16, fcol);
- if(npcinfo[npcnum].spriteset == 12) game_castspell(9, npcinfo[npcnum].x, npcinfo[npcnum].y, player.px, player.py, npcnum);
+ if (npcinfo[npcnum].spriteset == 12) game_castspell(9, npcinfo[npcnum].x, npcinfo[npcnum].y, player.px, player.py, npcnum);
// if enemy is killed
- if(npcinfo[npcnum].hp == 0) {
+ if (npcinfo[npcnum].hp == 0) {
player.exp = player.exp + npcinfo[npcnum].maxhp;
- if(npcinfo[npcnum].spriteset == 1 || npcinfo[npcnum].spriteset == 7 || npcinfo[npcnum].spriteset == 6) {
+ if (npcinfo[npcnum].spriteset == 1 || npcinfo[npcnum].spriteset == 7 || npcinfo[npcnum].spriteset == 6) {
ff = (int)(RND() * player.level * 3);
- if(ff == 0) {
+ if (ff == 0) {
npx = npcinfo[npcnum].x + 12;
npy = npcinfo[npcnum].y + 20;
lx = (int)npx / 16;
ly = (int)npy / 16;
- if(objmap[lx][ly] == -1) objmap[lx][ly] = 4;
+ if (objmap[lx][ly] == -1) objmap[lx][ly] = 4;
}
}
- if(npcinfo[npcnum].spriteset == 2 || npcinfo[npcnum].spriteset == 9 || npcinfo[npcnum].spriteset == 4 || npcinfo[npcnum].spriteset == 5) {
+ if (npcinfo[npcnum].spriteset == 2 || npcinfo[npcnum].spriteset == 9 || npcinfo[npcnum].spriteset == 4 || npcinfo[npcnum].spriteset == 5) {
ff = (int)(RND() * player.level);
- if(ff == 0) {
+ if (ff == 0) {
npx = npcinfo[npcnum].x + 12;
npy = npcinfo[npcnum].y + 20;
lx = (int)npx / 16;
ly = (int)npy / 16;
- if(objmap[lx][ly] == -1) objmap[lx][ly] = 12;
+ if (objmap[lx][ly] == -1) objmap[lx][ly] = 12;
}
}
- if(npcinfo[npcnum].spriteset == 9 || npcinfo[npcnum].spriteset == 10 || npcinfo[npcnum].spriteset == 5) {
+ if (npcinfo[npcnum].spriteset == 9 || npcinfo[npcnum].spriteset == 10 || npcinfo[npcnum].spriteset == 5) {
ff = (int)(RND() * player.level * 2);
- if(ff == 0) {
+ if (ff == 0) {
npx = npcinfo[npcnum].x + 12;
npy = npcinfo[npcnum].y + 20;
lx = (int)npx / 16;
ly = (int)npy / 16;
- if(objmap[lx][ly] == -1) objmap[lx][ly] = 13;
+ if (objmap[lx][ly] == -1) objmap[lx][ly] = 13;
}
}
// academy master key chest script
- if(npcinfo[npcnum].script == 2) {
+ if (npcinfo[npcnum].script == 2) {
cx = 9;
cy = 7;
alive = 0;
- for(int i = 1; i <= lastnpc; i++) {
- if(npcinfo[i].hp > 0) alive = 1;
+ for (int i = 1; i <= lastnpc; i++) {
+ if (npcinfo[i].hp > 0) alive = 1;
}
- if(alive == 0) {
+ if (alive == 0) {
objmap[cx][cy] = 5;
rcDest.x = cx * 8;
@@ -1698,23 +1685,23 @@ void game_damagenpc(int npcnum, int damage, int spell)
lx = (int)npx / 16;
ly = (int)npy / 16;
- if(lx == cx && ly == cy) player.py = player.py + 16;
- SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ if (lx == cx && ly == cy) player.py = player.py + 16;
+ SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
scriptflag[2][0] = 1;
}
}
// academy crystal chest script
- if(npcinfo[npcnum].script == 3) {
+ if (npcinfo[npcnum].script == 3) {
cx = 9;
cy = 7;
alive = 0;
- for(int i = 1; i <= lastnpc; i++) {
- if(npcinfo[i].hp > 0) alive = 1;
+ for (int i = 1; i <= lastnpc; i++) {
+ if (npcinfo[i].hp > 0) alive = 1;
}
- if(alive == 0) {
+ if (alive == 0) {
objmap[cx][cy] = 6;
rcDest.x = cx * 8;
@@ -1728,49 +1715,49 @@ void game_damagenpc(int npcnum, int damage, int spell)
lx = (int)npx / 16;
ly = (int)npy / 16;
- if(lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy) player.py = player.py + 16;
scriptflag[3][0] = 1;
- SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
}
// tower shield chest script
- if(npcinfo[npcnum].script == 4 && scriptflag[4][0] == 0) {
- triggerloc[9][7] = 5004;
+ if (npcinfo[npcnum].script == 4 && scriptflag[4][0] == 0) {
+ triggerloc[9][7] = 5004;
- int curtile = 40;
- int curtilel = 0;
- int curtilex = curtile % 20;
- int curtiley = (curtile - curtilex) / 20;
+ int curtile = 40;
+ int curtilel = 0;
+ int curtilex = curtile % 20;
+ int curtiley = (curtile - curtilex) / 20;
- int l = 0; // ?? not defined in original code
- tileinfo[l][9][7][0] = curtile + 1;
- tileinfo[l][9][7][1] = 0;
+ int l = 0; // ?? not defined in original code
+ tileinfo[l][9][7][0] = curtile + 1;
+ tileinfo[l][9][7][1] = 0;
- rcSrc.x = curtilex * 16;
- rcSrc.y = curtiley * 16;
- rcSrc.w = 16;
- rcSrc.h = 16;
+ rcSrc.x = curtilex * 16;
+ rcSrc.y = curtiley * 16;
+ rcSrc.w = 16;
+ rcSrc.h = 16;
- rcDest.x = 9 * 16;
- rcDest.y = 7 * 16;
- rcDest.w = 16;
- rcDest.h = 16;
+ rcDest.x = 9 * 16;
+ rcDest.y = 7 * 16;
+ rcDest.w = 16;
+ rcDest.h = 16;
- SDL_BlitSurface(tiles[curtilel], &rcSrc, mapbg, &rcDest);
+ SDL_BlitSurface(tiles[curtilel], &rcSrc, mapbg, &rcDest);
}
// firehydra sword chest
- if(npcinfo[npcnum].script == 5) {
+ if (npcinfo[npcnum].script == 5) {
cx = 9;
cy = 6;
alive = 0;
- for(int i = 1; i <= lastnpc; i++) {
- if(npcinfo[i].hp > 0) alive = 1;
+ for (int i = 1; i <= lastnpc; i++) {
+ if (npcinfo[i].hp > 0) alive = 1;
}
- if(alive == 0) {
+ if (alive == 0) {
objmap[cx][cy] = 9;
rcDest.x = cx * 8;
@@ -1784,24 +1771,24 @@ void game_damagenpc(int npcnum, int damage, int spell)
lx = (int)npx / 16;
ly = (int)npy / 16;
- if(lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy) player.py = player.py + 16;
scriptflag[5][0] = 1;
- SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
}
// gardens master key script
- if(npcinfo[npcnum].script == 8 && scriptflag[6][0] == 0) {
+ if (npcinfo[npcnum].script == 8 && scriptflag[6][0] == 0) {
cx = 13;
cy = 7;
alive = 0;
- for(int i = 1; i <= lastnpc; i++) {
- if(npcinfo[i].hp > 0) alive = 1;
+ for (int i = 1; i <= lastnpc; i++) {
+ if (npcinfo[i].hp > 0) alive = 1;
}
- if(alive == 0) {
+ if (alive == 0) {
objmap[cx][cy] = 5;
rcDest.x = cx * 8;
@@ -1815,24 +1802,24 @@ void game_damagenpc(int npcnum, int damage, int spell)
lx = (int)npx / 16;
ly = (int)npy / 16;
- if(lx == cx && ly == cy) player.py = player.py + 16;
- SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ if (lx == cx && ly == cy) player.py = player.py + 16;
+ SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
scriptflag[8][0] = 1;
}
}
// regular key chest 1
- for(int s = 20; s <= 23; s++) {
- if(npcinfo[npcnum].script == s && scriptflag[s][0] < 2) {
+ for (int s = 20; s <= 23; s++) {
+ if (npcinfo[npcnum].script == s && scriptflag[s][0] < 2) {
cx = 9;
cy = 7;
alive = 0;
- for(int i = 1; i <= lastnpc; i++) {
- if(npcinfo[i].hp > 0) alive = 1;
+ for (int i = 1; i <= lastnpc; i++) {
+ if (npcinfo[i].hp > 0) alive = 1;
}
- if(alive == 0) {
+ if (alive == 0) {
objmap[cx][cy] = 11;
rcDest.x = cx * 8;
@@ -1846,24 +1833,24 @@ void game_damagenpc(int npcnum, int damage, int spell)
lx = (int)npx / 16;
ly = (int)npy / 16;
- if(lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy) player.py = player.py + 16;
scriptflag[s][0] = 1;
- SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
}
}
// pickup lightning bomb
- if(npcinfo[npcnum].script == 9 && (curmap == 41 && scriptflag[9][1] == 0)) {
+ if (npcinfo[npcnum].script == 9 && (curmap == 41 && scriptflag[9][1] == 0)) {
cx = 9;
cy = 7;
alive = 0;
- for(int i = 1; i <= lastnpc; i++) {
- if(npcinfo[i].hp > 0) alive = 1;
+ for (int i = 1; i <= lastnpc; i++) {
+ if (npcinfo[i].hp > 0) alive = 1;
}
- if(alive == 0) {
+ if (alive == 0) {
objmap[cx][cy] = 13;
rcDest.x = cx * 8;
@@ -1877,21 +1864,21 @@ void game_damagenpc(int npcnum, int damage, int spell)
lx = (int)npx / 16;
ly = (int)npy / 16;
- if(lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy) player.py = player.py + 16;
}
}
// citadel armour chest
- if(npcinfo[npcnum].script == 12) {
+ if (npcinfo[npcnum].script == 12) {
cx = 8;
cy = 7;
alive = 0;
- for(int i = 1; i <= lastnpc; i++) {
- if(npcinfo[i].hp > 0) alive = 1;
+ for (int i = 1; i <= lastnpc; i++) {
+ if (npcinfo[i].hp > 0) alive = 1;
}
- if(alive == 0) {
+ if (alive == 0) {
objmap[cx][cy] = 16;
rcDest.x = cx * 8;
@@ -1905,23 +1892,23 @@ void game_damagenpc(int npcnum, int damage, int spell)
lx = (int)npx / 16;
ly = (int)npy / 16;
- if(lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy) player.py = player.py + 16;
scriptflag[12][0] = 1;
- SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
}
// citadel master key script
- if(npcinfo[npcnum].script == 13 && scriptflag[13][0] == 0) {
+ if (npcinfo[npcnum].script == 13 && scriptflag[13][0] == 0) {
cx = 11;
cy = 10;
alive = 0;
- for(int i = 1; i <= lastnpc; i++) {
- if(npcinfo[i].hp > 0) alive = 1;
+ for (int i = 1; i <= lastnpc; i++) {
+ if (npcinfo[i].hp > 0) alive = 1;
}
- if(alive == 0) {
+ if (alive == 0) {
objmap[cx][cy] = 5;
rcDest.x = cx * 8;
@@ -1935,20 +1922,20 @@ void game_damagenpc(int npcnum, int damage, int spell)
lx = (int)npx / 16;
ly = (int)npy / 16;
- if(lx == cx && ly == cy) player.py = player.py + 16;
- SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ if (lx == cx && ly == cy) player.py = player.py + 16;
+ SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
scriptflag[13][0] = 1;
}
}
// max ups
- if(npcinfo[npcnum].script == 15 && scriptflag[15][0] == 0) {
+ if (npcinfo[npcnum].script == 15 && scriptflag[15][0] == 0) {
alive = 0;
- for(int i = 1; i <= lastnpc; i++) {
- if(npcinfo[i].hp > 0) alive = 1;
+ for (int i = 1; i <= lastnpc; i++) {
+ if (npcinfo[i].hp > 0) alive = 1;
}
- if(alive == 0) {
+ if (alive == 0) {
cx = 6;
cy = 8;
@@ -1965,8 +1952,8 @@ void game_damagenpc(int npcnum, int damage, int spell)
lx = (int)npx / 16;
ly = (int)npy / 16;
- if(lx == cx && ly == cy) player.py = player.py + 16;
- SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ if (lx == cx && ly == cy) player.py = player.py + 16;
+ SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
scriptflag[15][0] = 1;
cx = 9;
@@ -1985,8 +1972,8 @@ void game_damagenpc(int npcnum, int damage, int spell)
lx = (int)npx / 16;
ly = (int)npy / 16;
- if(lx == cx && ly == cy) player.py = player.py + 16;
- SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ if (lx == cx && ly == cy) player.py = player.py + 16;
+ SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
scriptflag[16][0] = 1;
@@ -2006,56 +1993,54 @@ void game_damagenpc(int npcnum, int damage, int spell)
lx = (int)npx / 16;
ly = (int)npy / 16;
- if(lx == cx && ly == cy) player.py = player.py + 16;
- SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ if (lx == cx && ly == cy) player.py = player.py + 16;
+ SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
scriptflag[17][0] = 1;
}
}
- if(npcinfo[npcnum].script == 14) game_endofgame();
+ if (npcinfo[npcnum].script == 14) game_endofgame();
}
}
-void game_damageplayer(int damage)
-{
+void game_damageplayer(int damage) {
char line[256];
player.hp -= damage;
- if(player.hp < 0) player.hp = 0;
+ if (player.hp < 0) player.hp = 0;
sprintf(line, "-%i", damage);
- if(damage == 0) strcpy(line, "miss!");
+ if (damage == 0) strcpy(line, "miss!");
game_addFloatText(line, player.px + 12 - 4 * strlen(line), player.py + 16, 4);
player.pause = ticks + 1000;
}
-void game_drawanims(int Layer)
-{
- for(int sx = 0; sx <= 19; sx++) {
- for(int sy = 0; sy <= 14; sy++) {
+void game_drawanims(int Layer) {
+ for (int sx = 0; sx <= 19; sx++) {
+ for (int sy = 0; sy <= 14; sy++) {
int o = objmap[sx][sy];
- if(o > -1) {
+ if (o > -1) {
int xtiles = objectinfo[o][1];
int ytiles = objectinfo[o][2];
int cframe = objectframe[o][1];
- for(int x = 0; x <= xtiles - 1; x++) {
- for(int y = 0; y <= ytiles - 1; y++) {
+ for (int x = 0; x <= xtiles - 1; x++) {
+ for (int y = 0; y <= ytiles - 1; y++) {
int x1 = (sx + x) * 16;
int y1 = (sy + y) * 16;
- if(objecttile[o][cframe][x][y][1] == Layer) {
+ if (objecttile[o][cframe][x][y][1] == Layer) {
int c = objecttile[o][cframe][x][y][0];
c = c - 1;
int curtilel = 3;
int curtilex = c % 20;
int curtiley = (c - curtilex) / 20;
- if(curmap == 58 && scriptflag[60][0] > 0) curtilex = 1;
- if(curmap == 54 && scriptflag[60][0] > 1) curtilex = 1;
+ if (curmap == 58 && scriptflag[60][0] > 0) curtilex = 1;
+ if (curmap == 54 && scriptflag[60][0] > 1) curtilex = 1;
rcSrc.x = curtilex * 16;
rcSrc.y = curtiley * 16;
rcSrc.w = 16;
@@ -2069,10 +2054,10 @@ void game_drawanims(int Layer)
SDL_BlitSurface(tiles[curtilel], &rcSrc, videobuffer, &rcDest);
}
- if(Layer == 1) {
- for(int l = 1; l <= 2; l++) {
+ if (Layer == 1) {
+ for (int l = 1; l <= 2; l++) {
int c = tileinfo[l][sx + x][sy + y][0];
- if(c > 0) {
+ if (c > 0) {
int cl = tileinfo[l][sx + x][sy + y][1];
c = c - 1;
@@ -2092,15 +2077,15 @@ void game_drawanims(int Layer)
rcDest.h = 16;
int pass = 1;
- if(curtilel == 1) {
- for(int ff = 0; ff <= 5; ff++) {
+ if (curtilel == 1) {
+ for (int ff = 0; ff <= 5; ff++) {
int ffa = 20 * 5 - 1 + ff * 20;
int ffb = 20 * 5 + 4 + ff * 20;
- if(curtile > ffa && curtile < ffb) pass = 0;
+ if (curtile > ffa && curtile < ffb) pass = 0;
}
}
- if(pass == 1) SDL_BlitSurface(tiles[curtilel], &rcSrc, videobuffer, &rcDest);
+ if (pass == 1) SDL_BlitSurface(tiles[curtilel], &rcSrc, videobuffer, &rcDest);
}
}
}
@@ -2111,8 +2096,7 @@ void game_drawanims(int Layer)
}
}
-int hud_recalc(int a, int b, int c)
-{
+int hud_recalc(int a, int b, int c) {
int result = a * b / c;
return result > b ? b : result;
@@ -2120,8 +2104,7 @@ int hud_recalc(int a, int b, int c)
#define RGB(R, G, B) (SDL_MapRGB(videobuffer->format, (R), (G), (B)))
-void game_drawhud()
-{
+void game_drawhud() {
char line[128];
//sprintf(line, "fps: %i, map: %i, exp: %i/%i", (int)fps, curmap, player.exp, player.nextlevel);
//sys_print(videobuffer, line, 0, 0, 0);
@@ -2130,16 +2113,17 @@ void game_drawhud()
game_fillrect(videobuffer2, 0, 0, 320, 240, 0);
- for(int i = 0; i < MAXFLOAT; i++) {
- if(floattext[i][0] > 0) {
+ for (int i = 0; i < MAXFLOAT; i++) {
+ if (floattext[i][0] > 0) {
int fc = (int)floattext[i][3];
int c = fc, c2 = 3;
- if(fc == 4) c = 1; else if(fc == 5) c = 0;
+ if (fc == 4) c = 1;
+ else if (fc == 5) c = 0;
- if(fc == 1 || fc == 3) c2 = 2;
+ if (fc == 1 || fc == 3) c2 = 2;
- if(fc != 0) {
+ if (fc != 0) {
sys_print(videobuffer, floatstri[i], (int)(floattext[i][1]) + 0, (int)(floattext[i][2]) - 1, c2);
sys_print(videobuffer, floatstri[i], (int)(floattext[i][1]) + 0, (int)(floattext[i][2]) + 1, c2);
sys_print(videobuffer, floatstri[i], (int)(floattext[i][1]) - 1, (int)(floattext[i][2]) + 0, c2);
@@ -2149,7 +2133,7 @@ void game_drawhud()
sys_print(videobuffer, floatstri[i], (int)(floattext[i][1]), (int)(floattext[i][2]), c);
}
- if(floaticon[i][0] > 0) {
+ if (floaticon[i][0] > 0) {
int ico = floaticon[i][3];
int ix = floaticon[i][1];
int iy = floaticon[i][2];
@@ -2157,8 +2141,8 @@ void game_drawhud()
rcDest.x = ix;
rcDest.y = iy;
- if(ico != 99) SDL_BlitSurface(itemimg[ico], NULL, videobuffer, &rcDest);
- if(ico == 99) {
+ if (ico != 99) SDL_BlitSurface(itemimg[ico], NULL, videobuffer, &rcDest);
+ if (ico == 99) {
SDL_SetAlpha(spellimg, SDL_SRCALPHA, (int)(RND() * 96) + 96);
rcSrc.x = 16 * (int)(RND() * 2);
@@ -2176,7 +2160,7 @@ void game_drawhud()
}
}
- if(itemselon == 0) {
+ if (itemselon == 0) {
int sy = 211;
@@ -2185,24 +2169,24 @@ void game_drawhud()
rcSrc.y = sy;
// spells in game
- if(player.foundspell[0] == 1) {
- for(int i = 0; i < 5; i++) {
+ if (player.foundspell[0] == 1) {
+ for (int i = 0; i < 5; i++) {
rcSrc.x = rcSrc.x + 17;
- if(player.foundspell[i] == 1) {
+ if (player.foundspell[i] == 1) {
SDL_BlitSurface(itemimg[7 + i], NULL, videobuffer, &rcSrc);
game_fillrect(videobuffer, rcSrc.x, sy + 16, 16, 4, RGB(0, 32, 32));
game_fillrect(videobuffer, rcSrc.x + 1, sy + 17,
- hud_recalc(player.spellcharge[i], 14, 100), 2,
- player.spellcharge[i] == 100 ? RGB(255, 128, 32) : RGB(0, 224, 64));
+ hud_recalc(player.spellcharge[i], 14, 100), 2,
+ player.spellcharge[i] == 100 ? RGB(255, 128, 32) : RGB(0, 224, 64));
}
}
}
return;
}
- if(selenemyon == 0) {
+ if (selenemyon == 0) {
rcDest.x = 0;
rcDest.y = 0;
rcDest.w = 320;
@@ -2227,22 +2211,22 @@ void game_drawhud()
rcDest.y = 46 + 77;
int amap = 0;
- if(curmap > 46) amap = 2;
- if(curmap > 67) amap = 3;
- if(curmap > 5 && curmap < 42) amap = 1;
+ if (curmap > 46) amap = 2;
+ if (curmap > 67) amap = 3;
+ if (curmap > 5 && curmap < 42) amap = 1;
SDL_BlitSurface(mapimg[amap], NULL, videobuffer, &rcDest);
ccc = SDL_MapRGB(videobuffer->format, 128 + 127 * sin(3.141592 * 2 * itemyloc / 16), 0, 0);
- for(int b = 0; b <= 6; b++) {
- for(int a = 0; a <= 12; a++) {
- if(invmap[amap][b][a] == curmap) {
+ for (int b = 0; b <= 6; b++) {
+ for (int a = 0; a <= 12; a++) {
+ if (invmap[amap][b][a] == curmap) {
game_fillrect(videobuffer, 46 + 9 + a * 9 + 2, 46 + 77 + b * 9 + 1, 6, 6, ccc);
}
}
}
- if(amap == 1) {
+ if (amap == 1) {
sys_print(videobuffer, "L1", 46 + 9, 46 + 77, 0);
sys_print(videobuffer, "L2", 46 + 9 + 7 * 9, 46 + 77, 0);
}
@@ -2251,24 +2235,24 @@ void game_drawhud()
sys_print(videobuffer, line, sx, sy, player.hp <= player.maxhp * 0.25 ? (int)player.hpflash : 0);
sprintf(line, "Level : %i", player.level);
- if(player.level == player.maxlevel) strcpy(line, "Level : MAX");
+ if (player.level == player.maxlevel) strcpy(line, "Level : MAX");
sys_print(videobuffer, line, sx, sy + 8, 0);
// experience
game_fillrect(videobuffer, sx + 64, sy + 16, 16, 4, RGB(0, 32, 32));
game_fillrect(videobuffer, sx + 65, sy + 17,
- hud_recalc(player.exp, 14, player.nextlevel), 2, RGB(0, 224, 64));
+ hud_recalc(player.exp, 14, player.nextlevel), 2, RGB(0, 224, 64));
// attack strength
game_fillrect(videobuffer, sx + 1, sy + 16, 56, 6, RGB(0, 32, 32));
game_fillrect(videobuffer, sx + 1, sy + 17,
- hud_recalc(player.attackstrength, 54, 100), 2,
- player.attackstrength == 100 ? RGB(255, 128, 32) : RGB(0, 64, 224));
+ hud_recalc(player.attackstrength, 54, 100), 2,
+ player.attackstrength == 100 ? RGB(255, 128, 32) : RGB(0, 64, 224));
// spell strength
game_fillrect(videobuffer, sx + 1, sy + 19,
- hud_recalc(player.spellstrength, 54, 100), 2,
- player.spellstrength == 100 ? RGB(224, 0, 0) : RGB(128, 0, 224));
+ hud_recalc(player.spellstrength, 54, 100), 2,
+ player.spellstrength == 100 ? RGB(224, 0, 0) : RGB(128, 0, 224));
// time
int ase = secstart + secsingame;
@@ -2287,61 +2271,61 @@ void game_drawhud()
rcSrc.y = 91;
int ss = (player.sword - 1) * 3;
- if(player.sword == 3) ss = 18;
+ if (player.sword == 3) ss = 18;
SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
rcSrc.x = rcSrc.x + 16;
ss = (player.shield - 1) * 3 + 1;
- if(player.shield == 3) ss = 19;
+ if (player.shield == 3) ss = 19;
SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
rcSrc.x = rcSrc.x + 16;
ss = (player.armour - 1) * 3 + 2;
- if(player.armour == 3) ss = 20;
+ if (player.armour == 3) ss = 20;
SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
- for(int i = 0; i <= 4; i++) {
+ for (int i = 0; i <= 4; i++) {
sx = 188;
sy = 70 + i * 24;
rcSrc.x = sx;
rcSrc.y = sy;
- if(i == 0) SDL_BlitSurface(itemimg[6], NULL, videobuffer, &rcSrc);
- if(i == 1) SDL_BlitSurface(itemimg[12], NULL, videobuffer, &rcSrc);
- if(i == 2) SDL_BlitSurface(itemimg[17], NULL, videobuffer, &rcSrc);
- if(i == 3) SDL_BlitSurface(itemimg[16], NULL, videobuffer, &rcSrc);
- if(i == 4) SDL_BlitSurface(itemimg[14], NULL, videobuffer, &rcSrc);
+ if (i == 0) SDL_BlitSurface(itemimg[6], NULL, videobuffer, &rcSrc);
+ if (i == 1) SDL_BlitSurface(itemimg[12], NULL, videobuffer, &rcSrc);
+ if (i == 2) SDL_BlitSurface(itemimg[17], NULL, videobuffer, &rcSrc);
+ if (i == 3) SDL_BlitSurface(itemimg[16], NULL, videobuffer, &rcSrc);
+ if (i == 4) SDL_BlitSurface(itemimg[14], NULL, videobuffer, &rcSrc);
sprintf(line, "x%i", player.inventory[i]);
sys_print(videobuffer, line, sx + 17, sy + 7, 0);
}
// spells in menu
- if(player.foundspell[0] == 1) {
- for(int i = 0; i < 5; i++) {
+ if (player.foundspell[0] == 1) {
+ for (int i = 0; i < 5; i++) {
rcSrc.x = 243;
rcSrc.y = 67 + i * 24;
sy = rcSrc.y;
- if(player.foundspell[i] == 1) {
+ if (player.foundspell[i] == 1) {
SDL_BlitSurface(itemimg[7 + i], NULL, videobuffer, &rcSrc);
game_fillrect(videobuffer, rcSrc.x, sy + 16, 16, 4, RGB(0, 32, 32));
game_fillrect(videobuffer, rcSrc.x + 1, sy + 17,
- hud_recalc(player.spellcharge[i], 14, 100), 2,
- player.spellcharge[i] == 100 ? RGB(255, 128, 32) : RGB(0, 224, 64));
+ hud_recalc(player.spellcharge[i], 14, 100), 2,
+ player.spellcharge[i] == 100 ? RGB(255, 128, 32) : RGB(0, 224, 64));
}
}
}
- if(itemselon == 1) {
- for(int i = 0; i <= 4; i++) {
- if(curitem == 5 + i) {
+ if (itemselon == 1) {
+ for (int i = 0; i <= 4; i++) {
+ if (curitem == 5 + i) {
rcDest.x = (float)(243 - 12 + 3 * sin(3.141592 * 2 * itemyloc / 16));
rcDest.y = 67 + 24 * i;
SDL_BlitSurface(itemimg[15], NULL, videobuffer, &rcDest);
}
- if(curitem == i) {
+ if (curitem == i) {
rcDest.x = (float)(189 - 12 + 3 * sin(3.141592 * 2 * itemyloc / 16));
rcDest.y = 70 + 24 * i;
SDL_BlitSurface(itemimg[15], NULL, videobuffer, &rcDest);
@@ -2350,8 +2334,8 @@ void game_drawhud()
}
}
- if(selenemyon == 1) {
- if(curenemy > lastnpc) {
+ if (selenemyon == 1) {
+ if (curenemy > lastnpc) {
int pst = curenemy - lastnpc - 1;
rcDest.x = postinfo[pst][0];
rcDest.y = (float)(postinfo[pst][1] - 4 - sin(3.141592 / 8 * itemyloc));
@@ -2364,8 +2348,7 @@ void game_drawhud()
}
}
-void game_drawnpcs(int mode)
-{
+void game_drawnpcs(int mode) {
unsigned int ccc;
ccc = SDL_MapRGB(videobuffer->format, 255, 128, 32);
@@ -2373,15 +2356,15 @@ void game_drawnpcs(int mode)
int fst = firsty;
int lst = lasty;
- if(mode == 0) lst = player.ysort;
- if(mode == 1) fst = player.ysort;
+ if (mode == 0) lst = player.ysort;
+ if (mode == 1) fst = player.ysort;
- for(int yy = fst; yy <= lst; yy++) {
+ for (int yy = fst; yy <= lst; yy++) {
- if(ysort[yy] > 0) {
+ if (ysort[yy] > 0) {
int i = ysort[yy];
- if(npcinfo[i].hp > 0) {
+ if (npcinfo[i].hp > 0) {
int npx = (int)(npcinfo[i].x);
int npy = (int)(npcinfo[i].y);
@@ -2390,9 +2373,9 @@ void game_drawnpcs(int mode)
int wdir = npcinfo[i].walkdir;
// spriteset1 specific
- if(npcinfo[i].spriteset == 1) {
+ if (npcinfo[i].spriteset == 1) {
- if(npcinfo[i].attacking == 0) {
+ if (npcinfo[i].attacking == 0) {
int cframe = npcinfo[i].cframe;
@@ -2406,7 +2389,7 @@ void game_drawnpcs(int mode)
rcDest.w = 24;
rcDest.h = 24;
- if(npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
+ if (npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
npcinfo[i].shake = ticks + 50;
rcDest.x = rcDest.x + (int)(RND() * 3) - 1;
rcDest.y = rcDest.y + (int)(RND() * 3) - 1;
@@ -2432,8 +2415,8 @@ void game_drawnpcs(int mode)
}
// onewing
- if(npcinfo[i].spriteset == 2) {
- for(int f = 0; f <= 7; f++) {
+ if (npcinfo[i].spriteset == 2) {
+ for (int f = 0; f <= 7; f++) {
int s = npcinfo[i].bodysection[f].sprite;
rcSrc.x = animset2[s].x;
rcSrc.y = animset2[s].y;
@@ -2449,11 +2432,11 @@ void game_drawnpcs(int mode)
}
// twowing
- if(npcinfo[i].spriteset == 9) {
- for(int f = 0; f <= 7; f++) {
+ if (npcinfo[i].spriteset == 9) {
+ for (int f = 0; f <= 7; f++) {
int yp = 0;
- if(f == 0 && (curmap == 53 || curmap == 57 || curmap == 61 || curmap == 65 || curmap == 56 || curmap > 66) && scriptflag[60][0] > 0) yp = 16;
+ if (f == 0 && (curmap == 53 || curmap == 57 || curmap == 61 || curmap == 65 || curmap == 56 || curmap > 66) && scriptflag[60][0] > 0) yp = 16;
int s = npcinfo[i].bodysection[f].sprite;
rcSrc.x = animset9[s].x;
rcSrc.y = animset9[s].y + yp;
@@ -2470,8 +2453,8 @@ void game_drawnpcs(int mode)
// boss 1
- if(npcinfo[i].spriteset == 3) {
- if(npcinfo[i].attacking == 0) {
+ if (npcinfo[i].spriteset == 3) {
+ if (npcinfo[i].attacking == 0) {
int cframe = npcinfo[i].cframe;
rcSrc.x = (int)(cframe / 4) * 24;
@@ -2498,8 +2481,8 @@ void game_drawnpcs(int mode)
}
// black knight
- if(npcinfo[i].spriteset == 4) {
- if(npcinfo[i].attacking == 0) {
+ if (npcinfo[i].spriteset == 4) {
+ if (npcinfo[i].attacking == 0) {
int cframe = npcinfo[i].cframe;
rcSrc.x = (int)(cframe / 4) * 24;
@@ -2526,9 +2509,9 @@ void game_drawnpcs(int mode)
// firehydra
- if(npcinfo[i].spriteset == 5) {
- for(int ff = 0; ff <= 2; ff++) {
- if(npcinfo[i].hp > 10 * ff * 20) {
+ if (npcinfo[i].spriteset == 5) {
+ for (int ff = 0; ff <= 2; ff++) {
+ if (npcinfo[i].hp > 10 * ff * 20) {
rcSrc.x = 16 * (int)(RND() * 2);
rcSrc.y = 80;
rcSrc.w = 16;
@@ -2538,12 +2521,12 @@ void game_drawnpcs(int mode)
rcDest.y = npcinfo[i].bodysection[10 * ff].y - 8;
int x = 192 + ((int)(itemyloc + ff * 5) % 3) * 64;
- if(x > 255) x = 255;
+ if (x > 255) x = 255;
SDL_SetAlpha(spellimg, SDL_SRCALPHA, x);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
- for(int f = 1; f <= 8; f++) {
+ for (int f = 1; f <= 8; f++) {
rcSrc.x = 16 * (int)(RND() * 2);
rcSrc.y = 80;
rcSrc.w = 16;
@@ -2553,7 +2536,7 @@ void game_drawnpcs(int mode)
rcDest.y = npcinfo[i].bodysection[ff * 10 + f].y - 8 + (int)(RND() * 3) - 1;
x = 192 + f % 3 * 64;
- if(x > 255) x = 255;
+ if (x > 255) x = 255;
SDL_SetAlpha(spellimg, SDL_SRCALPHA, x);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
@@ -2578,7 +2561,7 @@ void game_drawnpcs(int mode)
}
// red dragon
- if(npcinfo[i].spriteset == 6) {
+ if (npcinfo[i].spriteset == 6) {
int cframe = npcinfo[i].cframe;
rcSrc.x = (int)(cframe / 4) * 24;
@@ -2591,7 +2574,7 @@ void game_drawnpcs(int mode)
rcDest.w = 24;
rcDest.h = 24;
- if(npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
+ if (npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
npcinfo[i].shake = ticks + 50;
rcDest.x = rcDest.x + (int)(RND() * 3) - 1;
rcDest.y = rcDest.y + (int)(RND() * 3) - 1;
@@ -2601,45 +2584,45 @@ void game_drawnpcs(int mode)
}
// wizard
- if(npcinfo[i].spriteset == 7) {
+ if (npcinfo[i].spriteset == 7) {
// if(npcinfo[i].attacking == 0) {
- int cframe = npcinfo[i].cframe;
+ int cframe = npcinfo[i].cframe;
- rcSrc.x = (int)(cframe / 4) * 24;
- rcSrc.y = wdir * 24;
- rcSrc.w = 24;
- rcSrc.h = 24;
+ rcSrc.x = (int)(cframe / 4) * 24;
+ rcSrc.y = wdir * 24;
+ rcSrc.w = 24;
+ rcSrc.h = 24;
- rcDest.x = npx;
- rcDest.y = npy;
- rcDest.w = 24;
- rcDest.h = 24;
+ rcDest.x = npx;
+ rcDest.y = npy;
+ rcDest.w = 24;
+ rcDest.h = 24;
- if(npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
- npcinfo[i].shake = ticks + 50;
- rcDest.x = rcDest.x + (int)(RND() * 3) - 1;
- rcDest.y = rcDest.y + (int)(RND() * 3) - 1;
- }
- SDL_BlitSurface(anims[sprite], &rcSrc, videobuffer, &rcDest);
+ if (npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
+ npcinfo[i].shake = ticks + 50;
+ rcDest.x = rcDest.x + (int)(RND() * 3) - 1;
+ rcDest.y = rcDest.y + (int)(RND() * 3) - 1;
+ }
+ SDL_BlitSurface(anims[sprite], &rcSrc, videobuffer, &rcDest);
// } else {
- //cframe = npcinfo[i].cattackframe;
+ //cframe = npcinfo[i].cattackframe;
- //rcSrc.x = (int)(cframe / 4) * 24;
- //rcSrc.y = wdir * 24;
- //rcSrc.w = 24;
- //rcSrc.h = 24;
+ //rcSrc.x = (int)(cframe / 4) * 24;
+ //rcSrc.y = wdir * 24;
+ //rcSrc.w = 24;
+ //rcSrc.h = 24;
- //rcDest.x = npx;
- //rcDest.y = npy;
- //rcDest.w = 24;
- //rcDest.h = 24;
+ //rcDest.x = npx;
+ //rcDest.y = npy;
+ //rcDest.w = 24;
+ //rcDest.h = 24;
// SDL_BlitSurface(animsa(sprite), &rcSrc, videobuffer, &rcDest);
// }
}
// yellow dragon
- if(npcinfo[i].spriteset == 8) {
+ if (npcinfo[i].spriteset == 8) {
int cframe = npcinfo[i].cframe;
rcSrc.x = (int)(cframe / 4) * 24;
@@ -2652,7 +2635,7 @@ void game_drawnpcs(int mode)
rcDest.w = 24;
rcDest.h = 24;
- if(npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
+ if (npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
npcinfo[i].shake = ticks + 50;
rcDest.x = rcDest.x + (int)(RND() * 3) - 1;
rcDest.y = rcDest.y + (int)(RND() * 3) - 1;
@@ -2662,21 +2645,21 @@ void game_drawnpcs(int mode)
// dragon2
- if(npcinfo[i].spriteset == 10) {
- if(npcinfo[i].attacking == 0) {
+ if (npcinfo[i].spriteset == 10) {
+ if (npcinfo[i].attacking == 0) {
npcinfo[i].floating = npcinfo[i].floating + 0.25 * fpsr;
- while(npcinfo[i].floating >= 16) npcinfo[i].floating = npcinfo[i].floating - 16;
+ while (npcinfo[i].floating >= 16) npcinfo[i].floating = npcinfo[i].floating - 16;
float frame = npcinfo[i].frame;
int cframe = npcinfo[i].cframe;
frame = frame + 0.5 * fpsr;
- while(frame >= 16)
+ while (frame >= 16)
frame = frame - 16;
cframe = (int)(frame);
- if(cframe > 16) cframe = 16 - 1;
- if(cframe < 0) cframe = 0;
+ if (cframe > 16) cframe = 16 - 1;
+ if (cframe < 0) cframe = 0;
npcinfo[i].frame = frame;
npcinfo[i].cframe = cframe;
@@ -2693,7 +2676,7 @@ void game_drawnpcs(int mode)
rcDest.w = 24;
rcDest.h = 24;
- if(npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
+ if (npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
npcinfo[i].shake = ticks + 50;
rcDest.x = rcDest.x + (int)(RND() * 3) - 1;
rcDest.y = rcDest.y + (int)(RND() * 3) - 1;
@@ -2702,7 +2685,7 @@ void game_drawnpcs(int mode)
SDL_BlitSurface(anims[sprite], &rcSrc, videobuffer, &rcDest);
} else {
npcinfo[i].floating = npcinfo[i].floating + 0.25 * fpsr;
- while(npcinfo[i].floating >= 16) npcinfo[i].floating = npcinfo[i].floating - 16;
+ while (npcinfo[i].floating >= 16) npcinfo[i].floating = npcinfo[i].floating - 16;
int cframe = npcinfo[i].cattackframe;
@@ -2721,16 +2704,16 @@ void game_drawnpcs(int mode)
}
// end boss
- if(npcinfo[i].spriteset == 11) {
+ if (npcinfo[i].spriteset == 11) {
npcinfo[i].floating = npcinfo[i].floating + .3 * fpsr;
- while(npcinfo[i].floating >= 16) npcinfo[i].floating = npcinfo[i].floating - 16;
+ while (npcinfo[i].floating >= 16) npcinfo[i].floating = npcinfo[i].floating - 16;
float frame = npcinfo[i].frame2;
frame = frame + 0.5 * fpsr;
- while(frame >= 16)
+ while (frame >= 16)
frame = frame - 16;
npcinfo[i].frame2 = frame;
@@ -2738,7 +2721,7 @@ void game_drawnpcs(int mode)
int sx = npx + 12 - 40;
int sy = (float)(npy + 12 - 50 - 3 * sin(3.141592 * 2 * npcinfo[i].floating / 16));
- for(int fr = 0; fr <= 3; fr++) {
+ for (int fr = 0; fr <= 3; fr++) {
SDL_SetAlpha(spellimg, SDL_SRCALPHA, 128 + (int)(RND() * 96));
rcSrc.x = 16 * (int)(RND() * 2);
@@ -2752,15 +2735,15 @@ void game_drawnpcs(int mode)
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
}
- for(int ii = 0; ii <= 8; ii++) {
- for(int i2 = 0; i2 <= 3; i2++) {
+ for (int ii = 0; ii <= 8; ii++) {
+ for (int i2 = 0; i2 <= 3; i2++) {
rcSrc.x = 16 * (int)(RND() * 2);
rcSrc.y = 80;
rcSrc.w = 16;
rcSrc.h = 16;
float fr3 = frame - 3 + i2;
- if(fr3 < 0) fr3 = fr3 + 16;
+ if (fr3 < 0) fr3 = fr3 + 16;
rcDest.x = (float)(sx + 36 + ii * 8 - ii * cos(3.14159 * 2 * (fr3 - ii) / 16) * 2);
rcDest.y = (float)(sy + 16 + ii * sin(3.14159 * 2 * (fr3 - ii) / 16) * 3 - ii); // * 4
@@ -2774,12 +2757,12 @@ void game_drawnpcs(int mode)
int xdif = (xloc + 8) - (player.px + 12);
int ydif = (yloc + 8) - (player.py + 12);
- if((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks) {
+ if ((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks) {
float damage = (float)npcinfo[i].spelldamage * (1.0 + RND() * 0.5);
- if(player.hp > 0) {
+ if (player.hp > 0) {
game_damageplayer(damage);
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndfire], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -2800,12 +2783,12 @@ void game_drawnpcs(int mode)
xdif = (xloc + 8) - (player.px + 12);
ydif = (yloc + 8) - (player.py + 12);
- if((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks) {
+ if ((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks) {
float damage = (float)npcinfo[i].spelldamage * (1.0 + RND() * 0.5);
- if(player.hp > 0) {
+ if (player.hp > 0) {
game_damageplayer(damage);
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndfire], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -2816,7 +2799,7 @@ void game_drawnpcs(int mode)
SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
- if(npcinfo[i].attacking == 0) {
+ if (npcinfo[i].attacking == 0) {
int cframe = (int)(frame);
rcSrc.x = 0;
rcSrc.y = 72 * (int)(cframe / 4);
@@ -2826,7 +2809,7 @@ void game_drawnpcs(int mode)
rcDest.x = sx;
rcDest.y = sy;
- if(npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
+ if (npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
npcinfo[i].shake = ticks + 50;
rcDest.x = rcDest.x + (int)(RND() * 3) - 1;
rcDest.y = rcDest.y + (int)(RND() * 3) - 1;
@@ -2849,20 +2832,20 @@ void game_drawnpcs(int mode)
}
// bat kitty
- if(npcinfo[i].spriteset == 12) {
+ if (npcinfo[i].spriteset == 12) {
npcinfo[i].floating = npcinfo[i].floating + 1 * fpsr;
- while(npcinfo[i].floating >= 16) npcinfo[i].floating = npcinfo[i].floating - 16;
+ while (npcinfo[i].floating >= 16) npcinfo[i].floating = npcinfo[i].floating - 16;
float frame = npcinfo[i].frame;
int cframe = npcinfo[i].cframe;
frame = frame + 0.5 * fpsr;
- while(frame >= 16)
+ while (frame >= 16)
frame = frame - 16;
cframe = (int)(frame);
- if(cframe > 16) cframe = 16 - 1;
- if(cframe < 0) cframe = 0;
+ if (cframe > 16) cframe = 16 - 1;
+ if (cframe < 0) cframe = 0;
npcinfo[i].frame = frame;
npcinfo[i].cframe = cframe;
@@ -2879,7 +2862,7 @@ void game_drawnpcs(int mode)
rcDest.w = 99;
rcDest.h = 80;
- if(npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
+ if (npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
npcinfo[i].shake = ticks + 50;
rcDest.x = rcDest.x + (int)(RND() * 3) - 1;
rcDest.y = rcDest.y + (int)(RND() * 3) - 1;
@@ -2900,8 +2883,8 @@ void game_drawnpcs(int mode)
int ww = 14 * npcinfo[i].hp / npcinfo[i].maxhp;
- if(ww > 14) ww = 14;
- if(ww < 1) ww = 1;
+ if (ww > 14) ww = 14;
+ if (ww < 1) ww = 1;
rcDest.w = ww;
rcDest.h = 2;
@@ -2911,24 +2894,23 @@ void game_drawnpcs(int mode)
int pass = 1;
- if(npcinfo[i].spriteset == 3) pass = 0;
- if(pass == 1) game_drawover(npx, npy);
+ if (npcinfo[i].spriteset == 3) pass = 0;
+ if (pass == 1) game_drawover(npx, npy);
}
}
}
}
-void game_drawover(int modx, int mody)
-{
+void game_drawover(int modx, int mody) {
int npx = modx + 12;
int npy = mody + 20;
int lx = (int)npx / 16;
int ly = (int)npy / 16;
- for(int xo = -1; xo <= 1; xo++) {
- for(int yo = -1; yo <= 1; yo++) {
+ for (int xo = -1; xo <= 1; xo++) {
+ for (int yo = -1; yo <= 1; yo++) {
int sx = lx + xo;
int sy = ly + yo;
@@ -2936,12 +2918,12 @@ void game_drawover(int modx, int mody)
int sx2 = sx * 16;
int sy2 = sy * 16;
- if(sx > -1 && sx < 40 && sy > -1 && sy < 24) {
+ if (sx > -1 && sx < 40 && sy > -1 && sy < 24) {
int curtile = tileinfo[2][sx][sy][0];
int curtilel = tileinfo[2][sx][sy][1];
- if(curtile > 0) {
+ if (curtile > 0) {
curtile = curtile - 1;
int curtilex = curtile % 20;
int curtiley = (curtile - curtilex) / 20;
@@ -2957,29 +2939,28 @@ void game_drawover(int modx, int mody)
rcDest.h = 16;
int pass = 1;
- if(curtilel == 1) {
- for(int ff = 0; ff <= 5; ff++) {
+ if (curtilel == 1) {
+ for (int ff = 0; ff <= 5; ff++) {
int ffa = 20 * 5 - 1 + ff * 20;
int ffb = 20 * 5 + 4 + ff * 20;
- if(curtile > ffa && curtile < ffb) pass = 0;
+ if (curtile > ffa && curtile < ffb) pass = 0;
}
}
- if(pass == 1) SDL_BlitSurface(tiles[curtilel], &rcSrc, videobuffer, &rcDest);
+ if (pass == 1) SDL_BlitSurface(tiles[curtilel], &rcSrc, videobuffer, &rcDest);
}
}
}
}
}
-void game_drawplayer()
-{
+void game_drawplayer() {
long ccc;
int f = 0;
- if(player.armour == 3) f = 13;
+ if (player.armour == 3) f = 13;
- if(attacking == 0) {
+ if (attacking == 0) {
rcSrc.x = (int)(player.walkframe / 4) * 24;
rcSrc.y = player.walkdir * 24;
rcSrc.w = 24;
@@ -3009,15 +2990,15 @@ void game_drawplayer()
ccc = SDL_MapRGB(videobuffer->format, 224, 224, 64);
int pass = 0;
- if(player.hp <= player.maxhp * 0.25) pass = 1;
+ if (player.hp <= player.maxhp * 0.25) pass = 1;
- if(pass == 1) {
+ if (pass == 1) {
ccc = SDL_MapRGB(videobuffer->format, 255, 255, 255);
- if((int)(player.hpflash) == 1) ccc = SDL_MapRGB(videobuffer->format, 255, 0, 0);
+ if ((int)(player.hpflash) == 1) ccc = SDL_MapRGB(videobuffer->format, 255, 0, 0);
}
int sss = 6;
- if(player.foundspell[0]) sss = 8;
+ if (player.foundspell[0]) sss = 8;
int npx = player.px;
int npy = player.py;
rcDest.x = npx + 4;
@@ -3032,8 +3013,8 @@ void game_drawplayer()
int ww = 14 * player.hp / player.maxhp;
- if(ww > 14) ww = 14;
- if(ww < 1) ww = 1;
+ if (ww > 14) ww = 14;
+ if (ww < 1) ww = 1;
rcDest.w = ww;
rcDest.h = 2;
@@ -3041,13 +3022,13 @@ void game_drawplayer()
SDL_FillRect(videobuffer, &rcDest, ccc);
ccc = SDL_MapRGB(videobuffer->format, 0, 224, 64);
- if(player.attackstrength == 100) ccc = SDL_MapRGB(videobuffer->format, 255, 128, 32);
+ if (player.attackstrength == 100) ccc = SDL_MapRGB(videobuffer->format, 255, 128, 32);
ww = 14 * player.attackstrength / 100;
- if(ww > 14) ww = 14;
+ if (ww > 14) ww = 14;
int ww2 = 14 * player.spellstrength / 100;
- if(ww2 > 14) ww2 = 14;
+ if (ww2 > 14) ww2 = 14;
rcDest.w = ww;
rcDest.h = 2;
@@ -3056,7 +3037,7 @@ void game_drawplayer()
SDL_FillRect(videobuffer, &rcDest, ccc);
ccc = SDL_MapRGB(videobuffer->format, 128, 0, 224);
- if(player.spellstrength == 100) ccc = SDL_MapRGB(videobuffer->format, 224, 0, 0);
+ if (player.spellstrength == 100) ccc = SDL_MapRGB(videobuffer->format, 224, 0, 0);
rcDest.w = ww2;
rcDest.h = 2;
@@ -3065,8 +3046,7 @@ void game_drawplayer()
SDL_FillRect(videobuffer, &rcDest, ccc);
}
-void game_drawview()
-{
+void game_drawview() {
SDL_Rect rc;
SDL_BlitSurface(mapbg, NULL, videobuffer, NULL);
@@ -3076,19 +3056,19 @@ void game_drawview()
game_drawanims(0);
// ------dontdrawover = special case to make boss work right in room 24
- if(dontdrawover == 1) game_drawanims(1);
+ if (dontdrawover == 1) game_drawanims(1);
game_drawnpcs(0);
game_drawplayer();
game_drawnpcs(1);
- if(dontdrawover == 0) game_drawanims(1);
+ if (dontdrawover == 0) game_drawanims(1);
game_drawover((int)player.px, (int)player.py);
game_updspells();
- if(cloudson == 1) {
+ if (cloudson == 1) {
rc.x = (float)(256 + 256 * cos(3.141592 / 180 * clouddeg));
rc.y = (float)(192 + 192 * sin(3.141592 / 180 * clouddeg));
rc.w = 320;
@@ -3102,8 +3082,7 @@ void game_drawview()
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
}
-void game_endofgame()
-{
+void game_endofgame() {
float xofs = 0;
int ticks1;
@@ -3111,7 +3090,7 @@ void game_endofgame()
float spd = 0.2;
- if(menabled == 1 && config.music == 1) {
+ if (menabled == 1 && config.music == 1) {
Mix_HaltChannel(-1);
musicchannel = Mix_PlayChannel(-1, mendofgame, -1);
Mix_Volume(musicchannel, 0);
@@ -3129,17 +3108,17 @@ void game_endofgame()
do {
ld = ld + 4 * fpsr;
- if(ld > config.musicvol) ld = config.musicvol;
- if(menabled == 1 && ldstop == 0) {
+ if (ld > config.musicvol) ld = config.musicvol;
+ if (menabled == 1 && ldstop == 0) {
Mix_Volume(musicchannel, (int)ld);
- if((int)ld == config.musicvol) ldstop = 1;
+ if ((int)ld == config.musicvol) ldstop = 1;
}
ya = 0;
- if(ticks < ticks1 + 1500) {
+ if (ticks < ticks1 + 1500) {
ya = (255 * (ticks - ticks1)) / 1500;
- if(ya < 0) ya = 0;
- if(ya > 255) ya = 255;
+ if (ya < 0) ya = 0;
+ if (ya > 255) ya = 255;
} else {
break;
}
@@ -3162,12 +3141,12 @@ void game_endofgame()
fpsr = (float)tickspassed / 24;
fp++;
- if(ticks > nextticks) {
+ if (ticks > nextticks) {
nextticks = ticks + 1000;
fps = fp;
fp = 0;
}
- } while(1);
+ } while (1);
ticks1 = ticks;
ya = 0;
@@ -3176,32 +3155,32 @@ void game_endofgame()
do {
SDL_Rect rc;
- rc.x = -xofs;
+ rc.x = -xofs;
rc.y = 0;
SDL_BlitSurface(titleimg, NULL, videobuffer, &rc);
- rc.x = -xofs + 320;
+ rc.x = -xofs + 320;
rc.y = 0;
SDL_BlitSurface(titleimg, NULL, videobuffer, &rc);
y = y - spd * fpsr;
- for(int i = 0; i <= 26; i++) {
+ for (int i = 0; i <= 26; i++) {
int yy = y + i * 10;
- if(yy > -8 && yy < 240) {
+ if (yy > -8 && yy < 240) {
int x = 160 - strlen(story2[i]) * 4;
sys_print(videobuffer, story2[i], x, yy, 4);
}
- if(yy < 10 && i == 25) break;
+ if (yy < 10 && i == 25) break;
}
int ya = 255;
- if(ticks < ticks1 + 1000) {
+ if (ticks < ticks1 + 1000) {
ya = 255 * (ticks - ticks1) / 1000;
- if(ya < 0) ya = 0;
- if(ya > 255) ya = 255;
+ if (ya < 0) ya = 0;
+ if (ya > 255) ya = 255;
}
SDL_SetAlpha(videobuffer, SDL_SRCALPHA, ya);
@@ -3218,25 +3197,25 @@ void game_endofgame()
fpsr = (float)tickspassed / 24;
fp++;
- if(ticks > nextticks) {
+ if (ticks > nextticks) {
nextticks = ticks + 1000;
fps = fp;
fp = 0;
}
float add = 0.5 * fpsr;
- if(add > 1) add = 1;
+ if (add > 1) add = 1;
xofs = xofs + add;
- if(xofs >= 320) xofs = xofs - 320;
+ if (xofs >= 320) xofs = xofs - 320;
SDL_PollEvent(&event);
keys = SDL_GetKeyState(NULL);
- if(event.type == SDL_KEYDOWN) spd = 1;
- if(event.type == SDL_KEYUP) spd = 0.2;
+ if (event.type == SDL_KEYDOWN) spd = 1;
+ if (event.type == SDL_KEYUP) spd = 0.2;
- if(keys[SDLK_ESCAPE] || keys[SDLK_LALT]) break;
- } while(1);
+ if (keys[SDLK_ESCAPE] || keys[SDLK_LALT]) break;
+ } while (1);
ticks1 = ticks;
@@ -3245,12 +3224,12 @@ void game_endofgame()
SDL_BlitSurface(videobuffer, NULL, videobuffer2, NULL);
do {
- if(ticks < ticks1 + 1500) {
+ if (ticks < ticks1 + 1500) {
int y = 255 * (ticks - ticks1) / 1500;
- if(y < 0) y = 0;
- if(y > 255) y = 255;
- else
- break;
+ if (y < 0) y = 0;
+ if (y > 255) y = 255;
+ else
+ break;
}
SDL_FillRect(videobuffer, NULL, 0);
@@ -3271,12 +3250,12 @@ void game_endofgame()
fpsr = (float)tickspassed / 24;
fp++;
- if(ticks > nextticks) {
+ if (ticks > nextticks) {
nextticks = ticks + 1000;
fps = fp;
fp = 0;
}
- } while(1);
+ } while (1);
int keywait = 2000 + ticks;
@@ -3288,10 +3267,10 @@ void game_endofgame()
SDL_BlitSurface(theendimg, NULL, videobuffer, NULL);
y = 255;
- if(ticks < ticks1 + 1000) {
+ if (ticks < ticks1 + 1000) {
y = 255 * (ticks - ticks1) / 1000;
- if(y < 0) y = 0;
- if(y > 255) y = 255;
+ if (y < 0) y = 0;
+ if (y > 255) y = 255;
}
SDL_SetAlpha(videobuffer, SDL_SRCALPHA, y);
@@ -3308,7 +3287,7 @@ void game_endofgame()
fpsr = (float)tickspassed / 24;
fp++;
- if(ticks > nextticks) {
+ if (ticks > nextticks) {
nextticks = ticks + 1000;
fps = fp;
fp = 0;
@@ -3317,9 +3296,9 @@ void game_endofgame()
SDL_PollEvent(&event);
keys = SDL_GetKeyState(NULL);
- if(event.type == SDL_KEYDOWN && keywait < ticks) break;
+ if (event.type == SDL_KEYDOWN && keywait < ticks) break;
- } while(1);
+ } while (1);
SDL_FillRect(videobuffer2, NULL, 0);
SDL_FillRect(videobuffer3, NULL, 0);
@@ -3328,8 +3307,7 @@ void game_endofgame()
}
-void game_eventtext(char *stri)
-{
+void game_eventtext(char *stri) {
int x, fr, pauseticks, bticks;
SDL_FillRect(videobuffer2, NULL, 0);
@@ -3348,18 +3326,18 @@ void game_eventtext(char *stri)
SDL_PollEvent(&event);
keys = SDL_GetKeyState(NULL);
- if(event.type == SDL_KEYDOWN && pauseticks < ticks) break;
+ if (event.type == SDL_KEYDOWN && pauseticks < ticks) break;
SDL_BlitSurface(videobuffer2, NULL, videobuffer, NULL);
fr = 192;
- if(pauseticks > ticks) fr = 192 * (ticks - bticks) / 500;
- if(fr > 192) fr = 192;
+ if (pauseticks > ticks) fr = 192 * (ticks - bticks) / 500;
+ if (fr > 192) fr = 192;
SDL_SetAlpha(windowimg, SDL_SRCALPHA, fr);
SDL_BlitSurface(windowimg, NULL, videobuffer, NULL);
- if(pauseticks < ticks) sys_print(videobuffer, stri, x, 15, 0);
+ if (pauseticks < ticks) sys_print(videobuffer, stri, x, 15, 0);
SDL_SetAlpha(windowimg, SDL_SRCALPHA, 255);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
@@ -3374,14 +3352,14 @@ void game_eventtext(char *stri)
fpsr = (float)tickspassed / 24.0;
fp++;
- if(ticks > nextticks) {
+ if (ticks > nextticks) {
nextticks = ticks + 1000;
fps = fp;
fp = 0;
}
SDL_Delay(10);
- } while(1);
+ } while (1);
SDL_BlitSurface(videobuffer3, NULL, videobuffer, NULL);
@@ -3389,8 +3367,7 @@ void game_eventtext(char *stri)
}
-void game_handlewalking()
-{
+void game_handlewalking() {
unsigned int *temp/*, c*/, bgc;
float spd, /*ppx, ppy,*/ px, py, opx, opy;
float nx, ny, npx, npy;
@@ -3414,102 +3391,102 @@ void game_handlewalking()
int ly = (int)npy / 16;
int ramp = rampdata[lx][ly];
- if(ramp == 1 && movingup) spd = spd * 2;
- if(ramp == 1 && movingdown) spd = spd * 2;
+ if (ramp == 1 && movingup) spd = spd * 2;
+ if (ramp == 1 && movingdown) spd = spd * 2;
- if(ramp == 2 && movingleft) movingup = 1;
- if(ramp == 2 && movingright) movingdown = 1;
+ if (ramp == 2 && movingleft) movingup = 1;
+ if (ramp == 2 && movingright) movingdown = 1;
- if(ramp == 3 && movingright) movingup = 1;
- if(ramp == 3 && movingleft) movingdown = 1;
+ if (ramp == 3 && movingright) movingup = 1;
+ if (ramp == 3 && movingleft) movingdown = 1;
- for(int x = -1; x <= 1; x++) {
- for(int y = -1; y <= 1; y++) {
+ for (int x = -1; x <= 1; x++) {
+ for (int y = -1; y <= 1; y++) {
int sx = nx + x;
int sy = ny + y;
clipsurround[x + 1][y + 1] = 0;
- if(sx > -1 && sx < 320 && sy > -1 && sy < 192) {
+ if (sx > -1 && sx < 320 && sy > -1 && sy < 192) {
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
clipsurround[x + 1][y + 1] = *temp;
}
}
}
- if(movingup) player.walkdir = 0;
- if(movingdown) player.walkdir = 1;
- if(movingleft) player.walkdir = 2;
- if(movingright) player.walkdir = 3;
+ if (movingup) player.walkdir = 0;
+ if (movingdown) player.walkdir = 1;
+ if (movingleft) player.walkdir = 2;
+ if (movingright) player.walkdir = 3;
- if(movingup && clipsurround[1][0] == 0) {
+ if (movingup && clipsurround[1][0] == 0) {
py = py - spd;
player.walkdir = 0;
- } else if(movingup && clipsurround[1][0] > 0) {
+ } else if (movingup && clipsurround[1][0] > 0) {
// move upleft
- if(movingright == 0 && clipsurround[0][0] == 0) {
+ if (movingright == 0 && clipsurround[0][0] == 0) {
py = py - spd;
px = px - spd;
}
// move upright
- if(movingleft == 0 && clipsurround[2][0] == 0) {
+ if (movingleft == 0 && clipsurround[2][0] == 0) {
py = py - spd;
px = px + spd;
}
}
- if(movingdown && clipsurround[1][2] == 0) {
+ if (movingdown && clipsurround[1][2] == 0) {
py = py + spd;
player.walkdir = 1;
- } else if(movingdown && clipsurround[1][2] > 0) {
+ } else if (movingdown && clipsurround[1][2] > 0) {
// move downleft
- if(movingright == 0 && clipsurround[0][2] == 0) {
+ if (movingright == 0 && clipsurround[0][2] == 0) {
py = py + spd;
px = px - spd;
}
// move downright
- if(movingleft == 0 && clipsurround[2][2] == 0) {
+ if (movingleft == 0 && clipsurround[2][2] == 0) {
py = py + spd;
px = px + spd;
}
}
- if(movingleft && clipsurround[0][1] == 0) {
+ if (movingleft && clipsurround[0][1] == 0) {
px = px - spd;
player.walkdir = 2;
- } else if(movingleft && clipsurround[0][1] > 0) {
+ } else if (movingleft && clipsurround[0][1] > 0) {
// move leftup
- if(movingdown == 0 && clipsurround[0][0] == 0) {
+ if (movingdown == 0 && clipsurround[0][0] == 0) {
py = py - spd;
px = px - spd;
}
// move leftdown
- if(movingup == 0 && clipsurround[0][2] == 0) {
+ if (movingup == 0 && clipsurround[0][2] == 0) {
py = py + spd;
px = px - spd;
}
}
- if(movingright && clipsurround[2][1] == 0) {
+ if (movingright && clipsurround[2][1] == 0) {
px = px + spd;
player.walkdir = 3;
- } else if(movingright && clipsurround[2][1] > 0) {
+ } else if (movingright && clipsurround[2][1] > 0) {
// move rightup
- if(movingdown == 0 && clipsurround[2][0] == 0) {
+ if (movingdown == 0 && clipsurround[2][0] == 0) {
px = px + spd;
py = py - spd;
}
// move rightdown
- if(movingup == 0 && clipsurround[2][2] == 0) {
+ if (movingup == 0 && clipsurround[2][2] == 0) {
py = py + spd;
px = px + spd;
}
}
- if(px < -8) px = -8;
- if(px > xmax) px = xmax;
- if(py < -8) py = -8;
- if(py > ymax) py = ymax;
+ if (px < -8) px = -8;
+ if (px > xmax) px = xmax;
+ if (py < -8) py = -8;
+ if (py > ymax) py = ymax;
int pass = 1;
@@ -3517,16 +3494,16 @@ void game_handlewalking()
int sy = (py / 2 + 10);
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
bgc = *temp;
- if(bgc > 0 && bgc != 1000) {
+ if (bgc > 0 && bgc != 1000) {
px = opx;
py = opy;
pass = 0;
}
// push npc
- if(pass == 1) {
- for(int i = 1; i <= lastnpc; i++) {
- if(npcinfo[i].hp > 0) {
+ if (pass == 1) {
+ for (int i = 1; i <= lastnpc; i++) {
+ if (npcinfo[i].hp > 0) {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
@@ -3536,14 +3513,14 @@ void game_handlewalking()
int xdif = player.px - npx;
int ydif = player.py - npy;
- if(player.walkdir == 0) {
- if(abs(xdif) <= 8 && ydif > 0 && ydif < 8) npcinfo[i].y = npcinfo[i].y - spd;
- } else if(player.walkdir == 1) {
- if(abs(xdif) <= 8 && ydif < 0 && ydif > -8) npcinfo[i].y = npcinfo[i].y + spd;
- } else if(player.walkdir == 2) {
- if(abs(ydif) <= 8 && xdif > 0 && xdif < 8) npcinfo[i].x = npcinfo[i].x - spd;
- } else if(player.walkdir == 3) {
- if(abs(ydif) <= 8 && xdif < 0 && xdif > -8) npcinfo[i].x = npcinfo[i].x + spd;
+ if (player.walkdir == 0) {
+ if (abs(xdif) <= 8 && ydif > 0 && ydif < 8) npcinfo[i].y = npcinfo[i].y - spd;
+ } else if (player.walkdir == 1) {
+ if (abs(xdif) <= 8 && ydif < 0 && ydif > -8) npcinfo[i].y = npcinfo[i].y + spd;
+ } else if (player.walkdir == 2) {
+ if (abs(ydif) <= 8 && xdif > 0 && xdif < 8) npcinfo[i].x = npcinfo[i].x - spd;
+ } else if (player.walkdir == 3) {
+ if (abs(ydif) <= 8 && xdif < 0 && xdif > -8) npcinfo[i].x = npcinfo[i].x + spd;
}
npx = npcinfo[i].x;
@@ -3554,7 +3531,7 @@ void game_handlewalking()
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
bgc = *temp;
- if(bgc > 0) {
+ if (bgc > 0) {
npcinfo[i].x = opx;
npcinfo[i].y = opy;
}
@@ -3567,15 +3544,15 @@ void game_handlewalking()
player.px = px;
player.py = py;
- if(player.px != player.opx || player.py != player.opy) player.walkframe = player.walkframe + animspd * fpsr;
- if(player.walkframe >= 16) player.walkframe = player.walkframe - 16;
+ if (player.px != player.opx || player.py != player.opy) player.walkframe = player.walkframe + animspd * fpsr;
+ if (player.walkframe >= 16) player.walkframe = player.walkframe - 16;
// walking over items to pickup :::
int o = objmap[lx][ly];
- if(o > -1) {
+ if (o > -1) {
// fsk
- if(objectinfo[o][4] == 2 && player.inventory[INV_FLASK] < 9) {
+ if (objectinfo[o][4] == 2 && player.inventory[INV_FLASK] < 9) {
objmap[lx][ly] = -1;
player.inventory[INV_FLASK]++;
@@ -3583,13 +3560,13 @@ void game_handlewalking()
objmapf[curmap][lx][ly] = 1;
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
}
- if(objectinfo[o][5] == 7 && player.inventory[INV_DOUBLEFLASK] < 9) {
+ if (objectinfo[o][5] == 7 && player.inventory[INV_DOUBLEFLASK] < 9) {
objmap[lx][ly] = -1;
player.inventory[INV_DOUBLEFLASK]++;
@@ -3597,29 +3574,29 @@ void game_handlewalking()
objmapf[curmap][lx][ly] = 1;
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
}
- if(objectinfo[o][5] == 9 && player.inventory[INV_SHOCK] < 9 && (curmap == 41 && scriptflag[9][1] == 0)) {
+ if (objectinfo[o][5] == 9 && player.inventory[INV_SHOCK] < 9 && (curmap == 41 && scriptflag[9][1] == 0)) {
objmap[lx][ly] = -1;
player.inventory[INV_SHOCK]++;
game_addFloatIcon(17, lx * 16, ly * 16);
objmapf[curmap][lx][ly] = 1;
- if(curmap == 41) scriptflag[9][1] = 1;
+ if (curmap == 41) scriptflag[9][1] = 1;
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
}
- if(objectinfo[o][5] == 9 && player.inventory[INV_SHOCK] < 9) {
+ if (objectinfo[o][5] == 9 && player.inventory[INV_SHOCK] < 9) {
objmap[lx][ly] = -1;
player.inventory[INV_SHOCK]++;
@@ -3627,7 +3604,7 @@ void game_handlewalking()
objmapf[curmap][lx][ly] = 1;
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -3636,20 +3613,19 @@ void game_handlewalking()
}
}
-void game_loadmap(int mapnum)
-{
+void game_loadmap(int mapnum) {
unsigned int ccc;
SDL_Rect trect;
FILE *fp;
char name[256];
int tempmap[320][200];
- ccc = SDL_MapRGB(clipbg->format, 255,255,255);
+ ccc = SDL_MapRGB(clipbg->format, 255, 255, 255);
curmap = mapnum;
trect.x = 0;
- trect.y = 0;
+ trect.y = 0;
trect.w = 320;
trect.h = 240;
SDL_FillRect(mapbg, &trect, 0);
@@ -3658,50 +3634,52 @@ void game_loadmap(int mapnum)
forcepause = 0;
cloudson = 0;
- if(mapnum < 6) cloudson = 1;
- if(mapnum > 41) cloudson = 1;
- if(mapnum > 47) cloudson = 0;
- if(mapnum == 52) cloudson = 1;
- if(mapnum == 60) cloudson = 1;
- if(mapnum == 50) cloudson = 1;
- if(mapnum == 54) cloudson = 1;
- if(mapnum == 58) cloudson = 1;
- if(mapnum == 62) cloudson = 1;
- if(mapnum == 83) cloudson = 1;
+ if (mapnum < 6) cloudson = 1;
+ if (mapnum > 41) cloudson = 1;
+ if (mapnum > 47) cloudson = 0;
+ if (mapnum == 52) cloudson = 1;
+ if (mapnum == 60) cloudson = 1;
+ if (mapnum == 50) cloudson = 1;
+ if (mapnum == 54) cloudson = 1;
+ if (mapnum == 58) cloudson = 1;
+ if (mapnum == 62) cloudson = 1;
+ if (mapnum == 83) cloudson = 1;
// -----------special case
dontdrawover = 0;
- if(mapnum == 24) dontdrawover = 1;
+ if (mapnum == 24) dontdrawover = 1;
- if((mapnum == 53 || mapnum == 57 || mapnum == 61 || mapnum == 65 || mapnum == 62) && scriptflag[60][0] > 0) mapnum = mapnum + 100;
- if((mapnum == 161 || mapnum == 162) && scriptflag[60][0] == 2) mapnum = mapnum + 100;
+ if ((mapnum == 53 || mapnum == 57 || mapnum == 61 || mapnum == 65 || mapnum == 62) && scriptflag[60][0] > 0) mapnum = mapnum + 100;
+ if ((mapnum == 161 || mapnum == 162) && scriptflag[60][0] == 2) mapnum = mapnum + 100;
- for(int i = 0; i < MAXSPELL; i++)
+ for (int i = 0; i < MAXSPELL; i++)
spellinfo[i].frame = 0;
roomlock = 0;
// read *.map file
- sprintf(name, "mapdb/%04i.map", mapnum); printf("Reading %s\n", name);
+ sprintf(name, "mapdb/%04i.map", mapnum);
+ printf("Reading %s\n", name);
fp = fopen(name, "r");
- for(int x = 0; x <= 319; x++)
- for(int y = 0; y <= 199; y++) {
+ for (int x = 0; x <= 319; x++)
+ for (int y = 0; y <= 199; y++) {
INPUT("%i", &tempmap[x][y]);
}
fclose(fp);
- for(int x = 0; x <= 319; x++)
- for(int y = 0; y <= 239; y++) {
+ for (int x = 0; x <= 319; x++)
+ for (int y = 0; y <= 239; y++) {
triggerloc[x][y] = -1;
}
// read *.trg file
- sprintf(name, "mapdb/%04i.trg", mapnum); printf("Reading %s\n", name);
+ sprintf(name, "mapdb/%04i.trg", mapnum);
+ printf("Reading %s\n", name);
fp = fopen(name, "r");
INPUT("%i", &ntriggers);
- for(int i = 0; i < ntriggers; i++) {
+ for (int i = 0; i < ntriggers; i++) {
int mapx, mapy, trig;
INPUT("%i", &mapx);
@@ -3713,26 +3691,26 @@ void game_loadmap(int mapnum)
fclose(fp);
- for(int y = 0; y <= 23; y++)
- for(int x = 0; x <= 39; x++)
+ for (int y = 0; y <= 23; y++)
+ for (int x = 0; x <= 39; x++)
rampdata[x][y] = tempmap[3 * 40 + x][y + 40];
- for(int y = 0; y <= 23; y++)
- for(int x = 0; x <= 39; x++)
- for(int l = 0; l <= 2; l++)
- for(int a = 0; a <= 2; a++)
+ for (int y = 0; y <= 23; y++)
+ for (int x = 0; x <= 39; x++)
+ for (int l = 0; l <= 2; l++)
+ for (int a = 0; a <= 2; a++)
tileinfo[l][x][y][a] = 0;
- if(scriptflag[4][0] == 1 && curmap == 4) {
+ if (scriptflag[4][0] == 1 && curmap == 4) {
triggerloc[9][7] = 5004;
tempmap[9][7] = 41;
tempmap[9][7 + 40] = 0;
}
- for(int y = 0; y <= 23; y++) {
- for(int x = 0; x <= 39; x++) {
- for(int l = 0; l <= 2; l++) {
+ for (int y = 0; y <= 23; y++) {
+ for (int x = 0; x <= 39; x++) {
+ for (int l = 0; l <= 2; l++) {
int lx, ly, curtile, curtilelayer;
int curtilel, curtilex, curtiley;
int ffa, ffb;
@@ -3744,7 +3722,7 @@ void game_loadmap(int mapnum)
curtile = tempmap[lx][ly];
curtilelayer = tempmap[lx][ly + 40];
- if(curtile > 0) {
+ if (curtile > 0) {
curtile = curtile - 1;
curtilel = curtilelayer;
curtilex = curtile % 20;
@@ -3763,19 +3741,19 @@ void game_loadmap(int mapnum)
rcDest.w = 16;
rcDest.h = 16;
- if(l == 2 && curtilel == 1) {
- for(int ff = 0; ff <= 5; ff++) {
+ if (l == 2 && curtilel == 1) {
+ for (int ff = 0; ff <= 5; ff++) {
ffa = 20 * 5 - 1 + ff * 20;
ffb = 20 * 5 + 4 + ff * 20;
- if(curtile > ffa && curtile < ffb) {
+ if (curtile > ffa && curtile < ffb) {
SDL_SetAlpha(tiles[curtilel], SDL_SRCALPHA, 128);
}
}
}
- if(l == 1 && curtilel == 2) {
- for(int ff = 0; ff <= 4; ff++) {
+ if (l == 1 && curtilel == 2) {
+ for (int ff = 0; ff <= 4; ff++) {
ffa = 20 * (5 + ff) + 3;
- if(curtile == ffa) {
+ if (curtile == ffa) {
SDL_SetAlpha(tiles[curtilel], SDL_SRCALPHA, 192);
}
}
@@ -3797,63 +3775,63 @@ void game_loadmap(int mapnum)
}
- for(int x = 0; x <= 39; x++) {
- for(int y = 0; y <= 23; y++) {
+ for (int x = 0; x <= 39; x++) {
+ for (int y = 0; y <= 23; y++) {
int d = tempmap[3 * 40 + x][y];
int clip = 0;
int npc = 0;
- if(scriptflag[4][0] == 1 && x == 9 && y == 7) d = 99;
+ if (scriptflag[4][0] == 1 && x == 9 && y == 7) d = 99;
- if(d > 0) {
+ if (d > 0) {
clip = d % 2;
d = (d - clip) / 2;
npc = d % 2;
d = (d - npc) / 2;
- if(d == 99 && x == 9 && y == 7) clip = 1;
+ if (d == 99 && x == 9 && y == 7) clip = 1;
- if(clip) {
- if(d != 99) d = tempmap[6 * 40 + x][y];
- if(d == 99) d = 1;
+ if (clip) {
+ if (d != 99) d = tempmap[6 * 40 + x][y];
+ if (d == 99) d = 1;
int x1 = x * 8;
int y1 = y * 8;
- if(d == 1) {
- for(int i = 0; i <= 7; i++) {
+ if (d == 1) {
+ for (int i = 0; i <= 7; i++) {
sys_line(clipbg, x1, y1 + i, x1 + 7 - i, y1 + i, ccc);
}
- } else if(d == 2) {
+ } else if (d == 2) {
sys_line(clipbg, x1, y1, x1 + 7, y1, ccc);
sys_line(clipbg, x1, y1 + 1, x1 + 7, y1 + 1, ccc);
- } else if(d == 3) {
- for(int i = 0; i <= 7; i++) {
+ } else if (d == 3) {
+ for (int i = 0; i <= 7; i++) {
sys_line(clipbg, x1 + i, y1 + i, x1 + 7, y1 + i, ccc);
}
- } else if(d == 4) {
+ } else if (d == 4) {
sys_line(clipbg, x1, y1, x1, y1 + 7, ccc);
sys_line(clipbg, x1 + 1, y1, x1 + 1, y1 + 7, ccc);
- } else if(d == 5) {
+ } else if (d == 5) {
rcDest.x = x1;
rcDest.y = y1;
rcDest.w = 8;
rcDest.h = 8;
- SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
- } else if(d == 6) {
+ SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ } else if (d == 6) {
sys_line(clipbg, x1 + 7, y1, x1 + 7, y1 + 7, ccc);
sys_line(clipbg, x1 + 6, y1, x1 + 6, y1 + 7, ccc);
- } else if(d == 7) {
- for(int i = 0; i <= 7; i++) {
+ } else if (d == 7) {
+ for (int i = 0; i <= 7; i++) {
sys_line(clipbg, x1, y1 + i, x1 + i, y1 + i, ccc);
}
- } else if(d == 8) {
+ } else if (d == 8) {
sys_line(clipbg, x1, y1 + 7, x1 + 7, y1 + 7, ccc);
sys_line(clipbg, x1, y1 + 7, x1 + 6, y1 + 6, ccc);
- } else if(d == 9) {
- for(int i = 0; i <= 7; i++) {
+ } else if (d == 9) {
+ for (int i = 0; i <= 7; i++) {
sys_line(clipbg, x1 + 7 - i, y1 + i, x1 + 7, y1 + i, ccc);
}
}
@@ -3865,17 +3843,17 @@ void game_loadmap(int mapnum)
lastobj = 0;
lastnpc = 0;
- for(int i = 0; i < MAXNPC; i++)
+ for (int i = 0; i < MAXNPC; i++)
npcinfo[i].onmap = 0;
- for(int x = 0; x <= 19; x++) {
- for(int y = 0; y <= 19; y++) {
+ for (int x = 0; x <= 19; x++) {
+ for (int y = 0; y <= 19; y++) {
int d = tempmap[3 * 40 + x][y];
int clip = 0;
int npc = 0;
int obj = 0;
- if(d > 0) {
+ if (d > 0) {
clip = d % 2;
d = (d - clip) / 2;
npc = d % 2;
@@ -3885,15 +3863,15 @@ void game_loadmap(int mapnum)
objmap[x][y] = -1;
- if(obj == 1) {
+ if (obj == 1) {
int o = tempmap[5 * 40 + x][y];
- if(objmapf[curmap][x][y] == 0) {
+ if (objmapf[curmap][x][y] == 0) {
objmap[x][y] = o;
- if(objectinfo[o][0] > 1) {
- if(o > lastobj) lastobj = o;
+ if (objectinfo[o][0] > 1) {
+ if (o > lastobj) lastobj = o;
}
int x1 = x * 8;
@@ -3904,14 +3882,14 @@ void game_loadmap(int mapnum)
rcDest.w = 8;
rcDest.h = 8;
- if(objectinfo[o][4] == 1) SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
- if(objectinfo[o][4] == 3) SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ if (objectinfo[o][4] == 1) SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ if (objectinfo[o][4] == 3) SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
}
- if(npc == 1) {
+ if (npc == 1) {
int o = tempmap[4 * 40 + x][y];
- if(o > lastnpc) lastnpc = o;
+ if (o > lastnpc) lastnpc = o;
npcinfo[o].x = x * 16 - 4;
npcinfo[o].y = y * 16 - 5;
@@ -3923,20 +3901,21 @@ void game_loadmap(int mapnum)
}
- if(curmap == 62 && scriptflag[8][0] > 0) lastnpc = 0;
- if(curmap == 73 && scriptflag[12][0] > 0) lastnpc = 0;
- if(curmap == 81 && scriptflag[13][0] > 0) lastnpc = 0;
+ if (curmap == 62 && scriptflag[8][0] > 0) lastnpc = 0;
+ if (curmap == 73 && scriptflag[12][0] > 0) lastnpc = 0;
+ if (curmap == 81 && scriptflag[13][0] > 0) lastnpc = 0;
- if(curmap == 73 && scriptflag[12][0] == 0) roomlock = 1;
- if(curmap == 81 && scriptflag[13][0] == 0) roomlock = 1;
- if(curmap == 83 && scriptflag[15][0] == 0) roomlock = 1;
- if(curmap == 82) roomlock = 1;
+ if (curmap == 73 && scriptflag[12][0] == 0) roomlock = 1;
+ if (curmap == 81 && scriptflag[13][0] == 0) roomlock = 1;
+ if (curmap == 83 && scriptflag[15][0] == 0) roomlock = 1;
+ if (curmap == 82) roomlock = 1;
// read *.npc file
- sprintf(name, "mapdb/%04i.npc", mapnum); printf("Reading %s\n", name);
+ sprintf(name, "mapdb/%04i.npc", mapnum);
+ printf("Reading %s\n", name);
fp = fopen(name, "r");
- for(int i = 0; i < MAXNPC; i++) {
+ for (int i = 0; i < MAXNPC; i++) {
INPUT("%i", &npcinfo[i].spriteset);
INPUT("%i", &npcinfo[i].x1);
INPUT("%i", &npcinfo[i].y1);
@@ -3950,7 +3929,7 @@ void game_loadmap(int mapnum)
INPUT("%i", &npcinfo[i].script);
// baby dragon
- if(npcinfo[i].spriteset == 1) {
+ if (npcinfo[i].spriteset == 1) {
npcinfo[i].hp = 12;
npcinfo[i].attackdelay = 2000;
@@ -3959,11 +3938,11 @@ void game_loadmap(int mapnum)
npcinfo[i].walkspd = 1;
- if(RND() * 5 == 0) npcinfo[i].hp = 0;
+ if (RND() * 5 == 0) npcinfo[i].hp = 0;
}
// onewing
- if(npcinfo[i].spriteset == 2) {
+ if (npcinfo[i].spriteset == 2) {
npcinfo[i].hp = 200;
npcinfo[i].attackdelay = 2000;
npcinfo[i].swayspd = 1;
@@ -3976,7 +3955,7 @@ void game_loadmap(int mapnum)
}
// boss1
- if(npcinfo[i].spriteset == 3) {
+ if (npcinfo[i].spriteset == 3) {
npcinfo[i].hp = 300;
npcinfo[i].attackdelay = 2200;
@@ -3987,7 +3966,7 @@ void game_loadmap(int mapnum)
}
// black knights
- if(npcinfo[i].spriteset == 4) {
+ if (npcinfo[i].spriteset == 4) {
npcinfo[i].hp = 200;
npcinfo[i].attackdelay = 2800;
@@ -3998,7 +3977,7 @@ void game_loadmap(int mapnum)
}
// boss2 firehydra
- if(npcinfo[i].spriteset == 5) {
+ if (npcinfo[i].spriteset == 5) {
npcinfo[i].hp = 600;
npcinfo[i].attackdelay = 2200;
@@ -4011,7 +3990,7 @@ void game_loadmap(int mapnum)
}
// baby fire dragon
- if(npcinfo[i].spriteset == 6) {
+ if (npcinfo[i].spriteset == 6) {
npcinfo[i].hp = 20;
npcinfo[i].attackdelay = 1500;
@@ -4020,11 +3999,11 @@ void game_loadmap(int mapnum)
npcinfo[i].walkspd = 1;
- if(RND() * 5 == 0) npcinfo[i].hp = 0;
+ if (RND() * 5 == 0) npcinfo[i].hp = 0;
}
// priest1
- if(npcinfo[i].spriteset == 7) {
+ if (npcinfo[i].spriteset == 7) {
npcinfo[i].hp = 40;
npcinfo[i].attackdelay = 5000;
@@ -4033,11 +4012,11 @@ void game_loadmap(int mapnum)
npcinfo[i].walkspd = 1;
- if(RND() * 8 == 0) npcinfo[i].hp = 0;
+ if (RND() * 8 == 0) npcinfo[i].hp = 0;
}
// yellow fire dragon
- if(npcinfo[i].spriteset == 8) {
+ if (npcinfo[i].spriteset == 8) {
npcinfo[i].hp = 100;
npcinfo[i].attackdelay = 1500;
@@ -4046,11 +4025,11 @@ void game_loadmap(int mapnum)
npcinfo[i].walkspd = 1;
- if(RND() * 5 == 0) npcinfo[i].hp = 0;
+ if (RND() * 5 == 0) npcinfo[i].hp = 0;
}
// twowing
- if(npcinfo[i].spriteset == 9) {
+ if (npcinfo[i].spriteset == 9) {
npcinfo[i].hp = 140;
npcinfo[i].attackdelay = 2000;
npcinfo[i].swayspd = 1;
@@ -4064,7 +4043,7 @@ void game_loadmap(int mapnum)
}
// dragon2
- if(npcinfo[i].spriteset == 10) {
+ if (npcinfo[i].spriteset == 10) {
npcinfo[i].hp = 80;
npcinfo[i].attackdelay = 1500;
@@ -4077,7 +4056,7 @@ void game_loadmap(int mapnum)
}
// end boss
- if(npcinfo[i].spriteset == 11) {
+ if (npcinfo[i].spriteset == 11) {
npcinfo[i].hp = 1200;
npcinfo[i].attackdelay = 2000;
@@ -4090,7 +4069,7 @@ void game_loadmap(int mapnum)
}
// bat kitty
- if(npcinfo[i].spriteset == 12) {
+ if (npcinfo[i].spriteset == 12) {
npcinfo[i].hp = 800;
npcinfo[i].attackdelay = 2000;
@@ -4102,7 +4081,7 @@ void game_loadmap(int mapnum)
npcinfo[i].floating = RND() * 16;
}
- if(npcinfo[i].onmap == 0) npcinfo[i].hp = 0;
+ if (npcinfo[i].onmap == 0) npcinfo[i].hp = 0;
npcinfo[i].maxhp = npcinfo[i].hp;
@@ -4112,7 +4091,7 @@ void game_loadmap(int mapnum)
npcinfo[i].attackspd = 1.5;
npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay * (1 + RND() * 2);
- if(npcinfo[i].spriteset == 2 || npcinfo[i].spriteset == 9) {
+ if (npcinfo[i].spriteset == 2 || npcinfo[i].spriteset == 9) {
npcinfo[i].bodysection[0].sprite = 0;
npcinfo[i].bodysection[1].sprite = 1;
npcinfo[i].bodysection[2].sprite = 2;
@@ -4130,7 +4109,7 @@ void game_loadmap(int mapnum)
npcinfo[i].bodysection[5].bonelength = 4;
npcinfo[i].bodysection[6].bonelength = 4;
- for(int f = 0; f <= 7; f++) {
+ for (int f = 0; f <= 7; f++) {
npcinfo[i].bodysection[f].x = npcinfo[i].x + 12;
npcinfo[i].bodysection[f].y = npcinfo[i].y + 14;
}
@@ -4140,13 +4119,13 @@ void game_loadmap(int mapnum)
}
- if(npcinfo[i].spriteset == 5) {
- for(int f = 0; f <= 29; f++) {
+ if (npcinfo[i].spriteset == 5) {
+ for (int f = 0; f <= 29; f++) {
npcinfo[i].bodysection[f].x = npcinfo[i].x + 12;
npcinfo[i].bodysection[f].y = npcinfo[i].y + 14;
}
- for(int f = 0; f <= 2; f++) {
+ for (int f = 0; f <= 2; f++) {
npcinfo[i].headtargetx[f] = npcinfo[i].x + 12;
npcinfo[i].headtargety[f] = npcinfo[i].y + 14;
@@ -4155,33 +4134,33 @@ void game_loadmap(int mapnum)
}
}
- if(npcinfo[i].script == 2) {
+ if (npcinfo[i].script == 2) {
roomlock = 1;
- if(scriptflag[2][0] > 0) {
+ if (scriptflag[2][0] > 0) {
roomlock = 0;
npcinfo[i].hp = 0;
}
}
- if(npcinfo[i].script == 3) {
+ if (npcinfo[i].script == 3) {
roomlock = 1;
- if(scriptflag[3][0] > 0) {
+ if (scriptflag[3][0] > 0) {
roomlock = 0;
npcinfo[i].hp = 0;
}
}
- if(npcinfo[i].script == 5) {
+ if (npcinfo[i].script == 5) {
roomlock = 1;
- if(scriptflag[5][0] > 0) {
+ if (scriptflag[5][0] > 0) {
roomlock = 0;
npcinfo[i].hp = 0;
}
}
- if(npcinfo[i].script == 15) {
+ if (npcinfo[i].script == 15) {
roomlock = 1;
- if(scriptflag[15][0] > 0) {
+ if (scriptflag[15][0] > 0) {
roomlock = 0;
npcinfo[i].hp = 0;
}
@@ -4196,7 +4175,7 @@ void game_loadmap(int mapnum)
int cx, cy, npx, npy, lx, ly;
// academy master key
- if(curmap == 34 && scriptflag[2][0] == 1) {
+ if (curmap == 34 && scriptflag[2][0] == 1) {
cx = 9;
cy = 7;
@@ -4213,13 +4192,13 @@ void game_loadmap(int mapnum)
lx = (int)npx / 16;
ly = (int)npy / 16;
- if(lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy) player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
// academy crystal
- if(curmap == 24 && player.foundspell[0] == 0 && scriptflag[3][0] == 1) {
+ if (curmap == 24 && player.foundspell[0] == 0 && scriptflag[3][0] == 1) {
cx = 9;
cy = 7;
@@ -4236,13 +4215,13 @@ void game_loadmap(int mapnum)
lx = (int)npx / 16;
ly = (int)npy / 16;
- if(lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy) player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
// gardens master key
- if(curmap == 62 && scriptflag[8][0] == 1) {
+ if (curmap == 62 && scriptflag[8][0] == 1) {
cx = 13;
cy = 7;
@@ -4259,13 +4238,13 @@ void game_loadmap(int mapnum)
lx = (int)npx / 16;
ly = (int)npy / 16;
- if(lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy) player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
// gardens fidelis sword
- if(curmap == 66 && scriptflag[5][0] == 1 && player.sword == 1) {
+ if (curmap == 66 && scriptflag[5][0] == 1 && player.sword == 1) {
cx = 9;
cy = 6;
@@ -4282,13 +4261,13 @@ void game_loadmap(int mapnum)
lx = (int)npx / 16;
ly = (int)npy / 16;
- if(lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy) player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
// citadel armour
- if(curmap == 73 && scriptflag[12][0] == 1 && player.armour == 1) {
+ if (curmap == 73 && scriptflag[12][0] == 1 && player.armour == 1) {
cx = 8;
cy = 7;
@@ -4305,13 +4284,13 @@ void game_loadmap(int mapnum)
lx = (int)npx / 16;
ly = (int)npy / 16;
- if(lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy) player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
// citadel master key
- if(curmap == 81 && scriptflag[13][0] == 1) {
+ if (curmap == 81 && scriptflag[13][0] == 1) {
cx = 11;
cy = 10;
@@ -4328,14 +4307,14 @@ void game_loadmap(int mapnum)
lx = (int)npx / 16;
ly = (int)npy / 16;
- if(lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy) player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
// max ups
- if(curmap == 83 && scriptflag[15][0] == 1 && player.sword < 3) {
+ if (curmap == 83 && scriptflag[15][0] == 1 && player.sword < 3) {
cx = 6;
cy = 8;
@@ -4352,12 +4331,12 @@ void game_loadmap(int mapnum)
lx = (int)npx / 16;
ly = (int)npy / 16;
- if(lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy) player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
- if(curmap == 83 && scriptflag[16][0] == 1 && player.shield < 3) {
+ if (curmap == 83 && scriptflag[16][0] == 1 && player.shield < 3) {
cx = 9;
cy = 8;
@@ -4374,12 +4353,12 @@ void game_loadmap(int mapnum)
lx = (int)npx / 16;
ly = (int)npy / 16;
- if(lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy) player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
+ SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
- if(curmap == 83 && scriptflag[17][0] == 1 && player.armour < 3) {
+ if (curmap == 83 && scriptflag[17][0] == 1 && player.armour < 3) {
cx = 12;
cy = 8;
@@ -4396,22 +4375,20 @@ void game_loadmap(int mapnum)
lx = (int)npx / 16;
ly = (int)npy / 16;
- if(lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy) player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255,255,255));
- }
+ SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ }
SDL_BlitSurface(clipbg, NULL, clipbg2, NULL);
}
-void game_main()
-{
+void game_main() {
game_title(0);
game_saveloadnew();
}
-void game_newgame()
-{
+void game_newgame() {
float xofs = 0;
float ld = 0, add;
int ticks, cnt = 0;
@@ -4427,7 +4404,7 @@ void game_newgame()
fpsr = 0.0;
int y = 140;
- if(menabled == 1 && config.music == 1) {
+ if (menabled == 1 && config.music == 1) {
Mix_HaltChannel(-1);
musicchannel = Mix_PlayChannel(-1, mendofgame, -1);
Mix_Volume(musicchannel, 0);
@@ -4442,37 +4419,37 @@ void game_newgame()
SDL_Rect rc;
ld += 4 * fpsr;
- if((int)ld > config.musicvol) ld = config.musicvol;
- if(menabled == 1 && ldstop == 0) {
+ if ((int)ld > config.musicvol) ld = config.musicvol;
+ if (menabled == 1 && ldstop == 0) {
Mix_Volume(musicchannel, (int)ld);
- if((int)ld == config.musicvol) ldstop = 1;
+ if ((int)ld == config.musicvol) ldstop = 1;
}
- rc.x = -xofs;
+ rc.x = -xofs;
rc.y = 0;
SDL_BlitSurface(titleimg, NULL, videobuffer, &rc);
- rc.x = -xofs + 320;
+ rc.x = -xofs + 320;
rc.y = 0;
SDL_BlitSurface(titleimg, NULL, videobuffer, &rc);
- if(++cnt >= 6) {
+ if (++cnt >= 6) {
cnt = 0;
y--;
}
- for(int i = 0; i <= 37; i++) {
+ for (int i = 0; i <= 37; i++) {
int yy, x;
yy = y + i * 10;
- if(yy > -8 && yy < 240) {
+ if (yy > -8 && yy < 240) {
x = 160 - strlen(story[i]) * 4;
sys_print(videobuffer, story[i], x, yy, 4);
}
- if(yy < 10 && i == 47) goto __exit_do;
+ if (yy < 10 && i == 47) goto __exit_do;
}
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
@@ -4485,25 +4462,25 @@ void game_newgame()
fpsr = (float)tickspassed / 24.0;
fp++;
- if(ticks > nextticks) {
+ if (ticks > nextticks) {
nextticks = ticks + 1000;
fps = fp;
fp = 0;
}
add = 0.5 * fpsr;
- if(add > 1) add = 1;
+ if (add > 1) add = 1;
xofs += add;
- if(xofs >= 320) xofs = xofs - 320;
+ if (xofs >= 320) xofs = xofs - 320;
SDL_PollEvent(&event);
keys = SDL_GetKeyState(NULL);
- if(event.type == SDL_KEYDOWN) cnt = 6;
- if(keys[SDLK_ESCAPE] || keys[SDLK_LALT]) goto __exit_do;
+ if (event.type == SDL_KEYDOWN) cnt = 6;
+ if (keys[SDLK_ESCAPE] || keys[SDLK_LALT]) goto __exit_do;
SDL_Delay(10);
- } while(1);
+ } while (1);
__exit_do:
player.px = 0;
@@ -4523,7 +4500,7 @@ __exit_do:
player.sword = 0;
player.shield = 0;
player.armour = 0;
- for(int i = 0; i < 5; i++) {
+ for (int i = 0; i < 5; i++) {
player.foundspell[i] = 0;
player.spellcharge[i] = 0;
player.inventory[i] = 0;
@@ -4563,8 +4540,8 @@ __exit_do:
player.sworddamage = player.level * 2;
player.spelldamage = player.level * 3 / 2;
- player.px = 15*16 - 4;
- player.py = 6*16 - 4;
+ player.px = 15 * 16 - 4;
+ player.py = 6 * 16 - 4;
player.walkdir = 1;
pgardens = 0;
@@ -4578,17 +4555,16 @@ __exit_do:
game_playgame();
}
-void game_playgame()
-{
+void game_playgame() {
game_swash();
- if(pmenu == 1 && menabled == 1) {
+ if (pmenu == 1 && menabled == 1) {
Mix_HaltChannel(menuchannel);
pmenu = 0;
}
do {
- if(forcepause == 0) {
+ if (forcepause == 0) {
game_updanims();
game_updnpcs();
}
@@ -4596,7 +4572,7 @@ void game_playgame()
game_checktrigger();
game_checkinputs();
- if(forcepause == 0) game_handlewalking();
+ if (forcepause == 0) game_handlewalking();
game_updatey();
game_drawview();
@@ -4604,25 +4580,24 @@ void game_playgame()
game_updmusic();
sys_update();
- } while(1);
+ } while (1);
}
-void game_processtrigger(int trignum)
-{
+void game_processtrigger(int trignum) {
int trigtype, tx, ty, tmap, tjumpstyle, tsx, tsy;
trigtype = triggers[trignum][0];
- if(roomlock == 1) return;
+ if (roomlock == 1) return;
// map jump------------------------------
- if(trigtype == 0) {
+ if (trigtype == 0) {
tx = triggers[trignum][1];
ty = triggers[trignum][2];
tmap = triggers[trignum][3];
tjumpstyle = triggers[trignum][4];
- if(roomlocks[tmap] > 0) {
- if(saidlocked == 0) game_eventtext("Locked");
+ if (roomlocks[tmap] > 0) {
+ if (saidlocked == 0) game_eventtext("Locked");
saidlocked = 1;
canusekey = 1;
locktype = roomlocks[tmap];
@@ -4630,8 +4605,8 @@ void game_processtrigger(int trignum)
return;
}
- if(tmap == 1) {
- if(saidjammed == 0) game_eventtext("Door Jammed!");
+ if (tmap == 1) {
+ if (saidjammed == 0) game_eventtext("Door Jammed!");
saidjammed = 1;
return;
}
@@ -4640,7 +4615,7 @@ void game_processtrigger(int trignum)
saidjammed = 0;
// loc-sxy+oldmaploc
- if(tjumpstyle == 0) {
+ if (tjumpstyle == 0) {
tsx = triggers[trignum][5];
tsy = triggers[trignum][6];
@@ -4649,11 +4624,11 @@ void game_processtrigger(int trignum)
player.py += (ty - tsy) * 16;
// HACKFIX
- if(player.px < 0) player.px = 0;
- if(player.py < 0) player.py = 0;
+ if (player.px < 0) player.px = 0;
+ if (player.py < 0) player.py = 0;
- if(tmap > 0) {
- if(menabled == 1 && config.effects == 1) {
+ if (tmap > 0) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[snddoor], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -4664,15 +4639,15 @@ void game_processtrigger(int trignum)
}
}
- for(int i = 0; i < MAXFLOAT; i++) {
+ for (int i = 0; i < MAXFLOAT; i++) {
floattext[i][0] = 0;
floaticon[i][0] = 0;
}
}
-void game_saveloadnew()
-{
- float y; int yy;
+void game_saveloadnew() {
+ float y;
+ int yy;
int currow, curcol, lowerlock;
int ticks, ticks1, tickpause;
@@ -4719,40 +4694,40 @@ void game_saveloadnew()
SDL_PollEvent(&event);
keys = SDL_GetKeyState(NULL);
- if(tickpause < ticks) {
- if(event.type == SDL_KEYDOWN) {
+ if (tickpause < ticks) {
+ if (event.type == SDL_KEYDOWN) {
itemticks = ticks + 220;
- if(keys[SDLK_LCTRL] || keys[SDLK_RETURN]) {
+ if (keys[SDLK_LCTRL] || keys[SDLK_RETURN]) {
// QUIT - non existent :)
- if(currow == 0 && curcol == 4) {
+ if (currow == 0 && curcol == 4) {
exit(1);
}
// RETURN
- if(currow == 0 && curcol == 3) {
+ if (currow == 0 && curcol == 3) {
// reset keys to avoid returning
keys[SDLK_RETURN] = keys[SDLK_SPACE] = 0;
return;
}
// NEW GAME
- if(currow == 0 && curcol == 0) game_newgame();
+ if (currow == 0 && curcol == 0) game_newgame();
// LOAD GAME
- if(currow == 0 && curcol == 1) {
+ if (currow == 0 && curcol == 1) {
lowerlock = 1;
currow = 1 + saveslot;
tickpause = ticks + 125;
}
// SAVE GAME
- if(currow == 0 && curcol == 2) {
+ if (currow == 0 && curcol == 2) {
lowerlock = 1;
currow = 1;
tickpause = ticks + 125;
}
- if(lowerlock == 1 && curcol == 1 && tickpause < ticks) {
- if(state_save(currow - 1)) {
+ if (lowerlock == 1 && curcol == 1 && tickpause < ticks) {
+ if (state_save(currow - 1)) {
secstart = secstart + secsingame;
secsingame = 0;
lowerlock = 0;
@@ -4761,8 +4736,8 @@ void game_saveloadnew()
}
}
- if(lowerlock == 1 && curcol == 2 && tickpause < ticks) {
- if(state_load(currow - 1)) {
+ if (lowerlock == 1 && curcol == 2 && tickpause < ticks) {
+ if (state_load(currow - 1)) {
player.walkspd = 1.1;
animspd = .5;
attacking = 0;
@@ -4786,42 +4761,42 @@ void game_saveloadnew()
tickpause = ticks + 125;
}
- switch(event.key.keysym.sym) {
+ switch (event.key.keysym.sym) {
case SDLK_ESCAPE:
case SDLK_LALT:
- if(lowerlock == 0) return;
+ if (lowerlock == 0) return;
lowerlock = 0;
currow = 0;
tickpause = ticks + 125;
break;
case SDLK_DOWN:
- if(lowerlock == 1) {
+ if (lowerlock == 1) {
currow = currow + 1;
- if(currow == 5) currow = 1;
+ if (currow == 5) currow = 1;
tickpause = ticks + 125;
}
break;
case SDLK_UP:
- if(lowerlock == 1) {
+ if (lowerlock == 1) {
currow = currow - 1;
- if(currow == 0) currow = 4;
+ if (currow == 0) currow = 4;
tickpause = ticks + 125;
}
break;
case SDLK_LEFT:
- if(lowerlock == 0) {
+ if (lowerlock == 0) {
curcol = curcol - 1;
- if(curcol == -1) curcol = 3;
+ if (curcol == -1) curcol = 3;
tickpause = ticks + 125;
}
break;
case SDLK_RIGHT:
- if(lowerlock == 0) {
+ if (lowerlock == 0) {
curcol = curcol + 1;
- if(curcol == 4) curcol = 0;
+ if (curcol == 4) curcol = 0;
tickpause = ticks + 125;
}
break;
@@ -4835,10 +4810,10 @@ void game_saveloadnew()
// savestates---------------------------------
// read it only when needed!
- for(int ff = 0; ff <= 3; ff++) {
+ for (int ff = 0; ff <= 3; ff++) {
state_load_player(ff);
- if(playera.level > 0) {
+ if (playera.level > 0) {
char line[256];
int sx, sy, cc, ss, nx;
@@ -4862,7 +4837,7 @@ void game_saveloadnew()
sprintf(line, "Health: %i/%i", playera.hp, playera.maxhp);
sys_print(videobuffer, line, sx, sy, cc);
- if(playera.level == 22)
+ if (playera.level == 22)
strcpy(line, "Level: MAX");
else
sprintf(line, "Level: %i", playera.level);
@@ -4873,26 +4848,26 @@ void game_saveloadnew()
rcSrc.y = sy + 1;
ss = (playera.sword - 1) * 3;
- if(playera.sword == 3) ss = 18;
+ if (playera.sword == 3) ss = 18;
SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
rcSrc.x = rcSrc.x + 16;
ss = (playera.shield - 1) * 3 + 1;
- if(playera.shield == 3) ss = 19;
+ if (playera.shield == 3) ss = 19;
SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
rcSrc.x = rcSrc.x + 16;
ss = (playera.armour - 1) * 3 + 2;
- if(playera.armour == 3) ss = 20;
+ if (playera.armour == 3) ss = 20;
SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
nx = rcSrc.x + 13 + 3 * 8;
rcSrc.x = nx - 17;
- if(playera.foundspell[0] == 1) {
- for(int i = 0; i < 5; i++) {
+ if (playera.foundspell[0] == 1) {
+ for (int i = 0; i < 5; i++) {
rcSrc.x = rcSrc.x + 17;
- if(playera.foundspell[i] == 1) SDL_BlitSurface(itemimg[7 + i], NULL, videobuffer, &rcSrc);
+ if (playera.foundspell[i] == 1) SDL_BlitSurface(itemimg[7 + i], NULL, videobuffer, &rcSrc);
}
}
} else {
@@ -4903,16 +4878,16 @@ void game_saveloadnew()
// ------------------------------------------
- if(currow == 0) {
+ if (currow == 0) {
rcDest.y = 18;
- if(curcol == 0) rcDest.x = 10;
- if(curcol == 1) rcDest.x = 108;
- if(curcol == 2) rcDest.x = 170;
- if(curcol == 3) rcDest.x = 230;
+ if (curcol == 0) rcDest.x = 10;
+ if (curcol == 1) rcDest.x = 108;
+ if (curcol == 2) rcDest.x = 170;
+ if (curcol == 3) rcDest.x = 230;
rcDest.x = (float)(rcDest.x + 2 + 2 * sin(3.14159 * 2 * itemyloc / 16));
}
- if(currow > 0) {
+ if (currow > 0) {
rcDest.x = (float)(0 + 2 * sin(3.14159 * 2 * itemyloc / 16));
rcDest.y = (float)(53 + (currow - 1) * 48);
}
@@ -4920,20 +4895,20 @@ void game_saveloadnew()
SDL_BlitSurface(itemimg[15], NULL, videobuffer, &rcDest);
- if(lowerlock == 1) {
+ if (lowerlock == 1) {
rcDest.y = 18;
- if(curcol == 1) rcDest.x = 108;
- if(curcol == 2) rcDest.x = 170;
+ if (curcol == 1) rcDest.x = 108;
+ if (curcol == 2) rcDest.x = 170;
rcDest.x = rcDest.x; // + 2 + 2 * sin(-3.14159 * 2 * itemyloc / 16)
SDL_BlitSurface(itemimg[15], NULL, videobuffer, &rcDest);
}
yy = 255;
- if(ticks < ticks1 + 1000) {
+ if (ticks < ticks1 + 1000) {
yy = 255 * (ticks - ticks1) / 1000;
- if(yy < 0) yy = 0;
- if(yy > 255) yy = 255;
+ if (yy < 0) yy = 0;
+ if (yy > 255) yy = 255;
}
SDL_SetAlpha(videobuffer, SDL_SRCALPHA, (int)yy);
@@ -4950,26 +4925,25 @@ void game_saveloadnew()
fpsr = (float)tickspassed / 24;
fp++;
- if(ticks > nextticks) {
+ if (ticks > nextticks) {
nextticks = ticks + 1000;
fps = fp;
fp = 0;
}
clouddeg += 0.01 * fpsr;
- while(clouddeg >= 360) clouddeg -= 360;
+ while (clouddeg >= 360) clouddeg -= 360;
itemyloc += 0.6 * fpsr;
- while(itemyloc >= 16) itemyloc -= 16;
+ while (itemyloc >= 16) itemyloc -= 16;
SDL_Delay(10);
- } while(1);
+ } while (1);
SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 64);
}
-void game_showlogos()
-{
+void game_showlogos() {
float y;
int ticks1;
@@ -4980,16 +4954,16 @@ void game_showlogos()
do {
y = 255.0;
- if(ticks < ticks1 + 1000) {
+ if (ticks < ticks1 + 1000) {
y = 255.0 * ((float)(ticks - ticks1) / 1000.0);
- if(y < 0.0) y = 0.0;
- if(y > 255.0) y = 255.0;
+ if (y < 0.0) y = 0.0;
+ if (y > 255.0) y = 255.0;
}
- if(ticks > ticks1 + 3000) {
+ if (ticks > ticks1 + 3000) {
y = 255.0 - 255.0 * ((float)(ticks - ticks1 - 3000.0) / 1000.0);
- if(y < 0.0) y = 0.0;
- if(y > 255.0) y = 255.0;
+ if (y < 0.0) y = 0.0;
+ if (y > 255.0) y = 255.0;
}
SDL_FillRect(videobuffer, NULL, 0);
@@ -5010,20 +4984,19 @@ void game_showlogos()
fpsr = (float)tickspassed / 24;
fp++;
- if(ticks > nextticks) {
+ if (ticks > nextticks) {
nextticks = ticks + 1000;
fps = fp;
fp = 0;
}
SDL_Delay(10);
- if(ticks > ticks1 + 4000) break;
- } while(1);
+ if (ticks > ticks1 + 4000) break;
+ } while (1);
}
-void game_swash()
-{
+void game_swash() {
float y;
y = 0;
@@ -5045,17 +5018,17 @@ void game_swash()
fpsr = (float)tickspassed / 24.0;
fp++;
- if(ticks > nextticks) {
+ if (ticks > nextticks) {
nextticks = ticks + 1000;
fps = fp;
fp = 0;
}
clouddeg += 0.01 * fpsr;
- while(clouddeg >= 360) clouddeg = clouddeg - 360;
+ while (clouddeg >= 360) clouddeg = clouddeg - 360;
- if(y > 10) break;
- } while(1);
+ if (y > 10) break;
+ } while (1);
y = 0;
do {
@@ -5064,7 +5037,7 @@ void game_swash()
SDL_SetAlpha(videobuffer, SDL_SRCALPHA, (int)(y * 25));
SDL_BlitSurface(mapbg, NULL, videobuffer, NULL);
- if(cloudson == 1) {
+ if (cloudson == 1) {
rcDest.x = (float)(256 + 256 * cos(3.141592 / 180 * clouddeg));
rcDest.y = (float)(192 + 192 * sin(3.141592 / 180 * clouddeg));
rcDest.w = 320;
@@ -5084,30 +5057,29 @@ void game_swash()
fpsr = (float)tickspassed / 24.0;
fp++;
- if(ticks > nextticks) {
+ if (ticks > nextticks) {
nextticks = ticks + 1000;
fps = fp;
fp = 0;
}
clouddeg += 0.01 * fpsr;
- while(clouddeg >= 360) clouddeg = clouddeg - 360;
+ while (clouddeg >= 360) clouddeg = clouddeg - 360;
- if(y > 10) break;
- } while(1);
+ if (y > 10) break;
+ } while (1);
SDL_SetAlpha(videobuffer, SDL_SRCALPHA, 255);
}
-void game_theend()
-{
- for(int i = 0; i < MAXFLOAT; i++) {
+void game_theend() {
+ for (int i = 0; i < MAXFLOAT; i++) {
floattext[i][0] = 0;
floaticon[i][0] = 0;
}
- for(float y = 0; y < 100; y += fpsr) {
+ for (float y = 0; y < 100; y += fpsr) {
SDL_SetAlpha(videobuffer, SDL_SRCALPHA, (int)y);
SDL_FillRect(videobuffer, NULL, 0);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
@@ -5122,7 +5094,7 @@ void game_theend()
fpsr = (float)tickspassed / 24.0;
fp++;
- if(ticks > nextticks) {
+ if (ticks > nextticks) {
nextticks = ticks + 1000;
fps = fp;
fp = 0;
@@ -5132,8 +5104,7 @@ void game_theend()
game_title(0);
}
-void game_title(int mode)
-{
+void game_title(int mode) {
float xofs = 0;
int ticks, ticks1, keypause;
int cursel, ldstop;
@@ -5158,7 +5129,7 @@ void game_title(int mode)
ticks1 = ticks;
- if(menabled == 1 && config.music == 1) {
+ if (menabled == 1 && config.music == 1) {
Mix_Volume(musicchannel, 0);
Mix_Pause(musicchannel);
@@ -5174,10 +5145,10 @@ void game_title(int mode)
SDL_Rect rc;
ld += 4.0 * fpsr;
- if(ld > config.musicvol) ld = config.musicvol;
- if(menabled == 1 && ldstop == 0) {
+ if (ld > config.musicvol) ld = config.musicvol;
+ if (menabled == 1 && ldstop == 0) {
Mix_Volume(menuchannel, (int)ld);
- if((int)ld == config.musicvol) ldstop = 1;
+ if ((int)ld == config.musicvol) ldstop = 1;
}
rc.x = -xofs;
@@ -5202,8 +5173,8 @@ void game_title(int mode)
sys_print(videobuffer, "options", x, y + 16, 4);
sys_print(videobuffer, "quit game", x, y + 32, 4);
- if(mode == 1) sys_print(videobuffer, "return", x, y + 48, 4);
- else sys_print(videobuffer, "(c) 2005 by Daniel 'Syn9' Kennedy", 28, 224, 4);
+ if (mode == 1) sys_print(videobuffer, "return", x, y + 48, 4);
+ else sys_print(videobuffer, "(c) 2005 by Daniel 'Syn9' Kennedy", 28, 224, 4);
rc.x = (float)(x - 16 - 4 * cos(3.14159 * 2 * itemyloc / 16));
rc.y = (float)(y - 4 + 16 * cursel);
@@ -5211,10 +5182,10 @@ void game_title(int mode)
SDL_BlitSurface(itemimg[15], NULL, videobuffer, &rc);
float yf = 255.0;
- if(ticks < ticks1 + 1000) {
+ if (ticks < ticks1 + 1000) {
yf = 255.0 * ((float)(ticks - ticks1) / 1000.0);
- if(y < 0.0) yf = 0.0;
- if(y > 255.0) yf = 255.0;
+ if (y < 0.0) yf = 0.0;
+ if (y > 255.0) yf = 255.0;
}
SDL_SetAlpha(videobuffer, SDL_SRCALPHA, (int)yf);
@@ -5228,63 +5199,63 @@ void game_title(int mode)
fpsr = (float)tickspassed / 24.0;
fp++;
- if(ticks > nextticks) {
+ if (ticks > nextticks) {
nextticks = ticks + 1000;
fps = fp;
fp = 0;
}
float add = 0.5 * fpsr;
- if(add > 1) add = 1;
+ if (add > 1) add = 1;
xofs = xofs + add;
- if(xofs >= 320.0) xofs -= 320.0;
+ if (xofs >= 320.0) xofs -= 320.0;
itemyloc += 0.75 * fpsr;
- while(itemyloc >= 16)
+ while (itemyloc >= 16)
itemyloc = itemyloc - 16;
SDL_PollEvent(&event);
- if(keypause < ticks) {
+ if (keypause < ticks) {
keys = SDL_GetKeyState(NULL);
- if(event.type == SDL_KEYDOWN) {
+ if (event.type == SDL_KEYDOWN) {
keypause = ticks + 150;
- if((keys[SDLK_ESCAPE] || keys[SDLK_LALT]) && mode == 1) break;
- else if(keys[SDLK_UP]) {
+ if ((keys[SDLK_ESCAPE] || keys[SDLK_LALT]) && mode == 1) break;
+ else if (keys[SDLK_UP]) {
cursel--;
- if(cursel < 0) cursel = (mode == 1 ? 3 : 2);
- } else if(keys[SDLK_DOWN]) {
+ if (cursel < 0) cursel = (mode == 1 ? 3 : 2);
+ } else if (keys[SDLK_DOWN]) {
cursel++;
- if(cursel >= (mode == 1 ? 4 : 3)) cursel = 0;
- } else if(keys[SDLK_LCTRL] || keys[SDLK_RETURN]) {
- if(cursel == 0) {
+ if (cursel >= (mode == 1 ? 4 : 3)) cursel = 0;
+ } else if (keys[SDLK_LCTRL] || keys[SDLK_RETURN]) {
+ if (cursel == 0) {
game_saveloadnew();
ticks = SDL_GetTicks();
keypause = ticks + 150;
ticks1 = ticks;
- } else if(cursel == 1) {
+ } else if (cursel == 1) {
game_configmenu();
ticks = SDL_GetTicks();
keypause = ticks + 150;
ticks1 = ticks;
- } else if(cursel == 2) {
+ } else if (cursel == 2) {
exit(1);
- } else if(cursel == 3) break;
+ } else if (cursel == 3) break;
}
}
}
SDL_Flip(video);
SDL_Delay(10);
- } while(1);
+ } while (1);
itemticks = ticks + 210;
- if(menabled == 1 && config.music == 1) {
+ if (menabled == 1 && config.music == 1) {
Mix_HaltChannel(menuchannel);
Mix_Resume(musicchannel);
Mix_Volume(musicchannel, config.musicvol);
@@ -5292,23 +5263,22 @@ void game_title(int mode)
}
}
-void game_updanims()
-{
- for(int i = 0; i <= lastobj; i++) {
+void game_updanims() {
+ for (int i = 0; i <= lastobj; i++) {
int nframes = objectinfo[i][0];
int oanimspd = objectinfo[i][3];
float frame = objectframe[i][0];
int cframe = objectframe[i][1];
// objectinfo[i][6] = 0; // ?? out of bounds
- if(nframes > 1) {
+ if (nframes > 1) {
frame = frame + oanimspd / 50 * fpsr;
- while(frame >= nframes)
+ while (frame >= nframes)
frame = frame - nframes;
cframe = (int)frame; // truncate fractional part
- if(cframe > nframes) cframe = nframes - 1;
- if(cframe < 0) cframe = 0;
+ if (cframe > nframes) cframe = nframes - 1;
+ if (cframe < 0) cframe = 0;
objectframe[i][0] = frame;
objectframe[i][1] = cframe;
@@ -5316,50 +5286,48 @@ void game_updanims()
}
}
-void game_updatey()
-{
+void game_updatey() {
int yy, ff;
- for(int i = 0; i <= 2400; i++)
+ for (int i = 0; i <= 2400; i++)
ysort[i] = -1;
ff = (int)(player.py * 10);
- if(ff < 0) ff = 0; // HACKFIX or ysort[yy] may go out of bounds
+ if (ff < 0) ff = 0; // HACKFIX or ysort[yy] may go out of bounds
player.ysort = ff;
ysort[ff] = 0;
firsty = 2400;
lasty = 0;
- for(int i = 1; i <= lastnpc; i++) {
+ for (int i = 1; i <= lastnpc; i++) {
yy = (int)(npcinfo[i].y * 10);
do {
- if(ysort[yy] == -1 || yy == 2400) break;
+ if (ysort[yy] == -1 || yy == 2400) break;
yy = yy + 1;
- } while(1);
+ } while (1);
ysort[yy] = i;
- if(yy < firsty) firsty = yy;
- if(yy > lasty) lasty = yy;
+ if (yy < firsty) firsty = yy;
+ if (yy > lasty) lasty = yy;
}
}
-void game_updmusic()
-{
+void game_updmusic() {
Mix_Chunk *iplaysound = NULL;
- if(menabled == 1 && config.music == 1) {
+ if (menabled == 1 && config.music == 1) {
// if(curmap > 5 && curmap < 42) iplaysound = macademy;
// if(curmap > 47) iplaysound = mgardens;
iplaysound = mgardens;
- if(roomlock == 1) iplaysound = mboss;
+ if (roomlock == 1) iplaysound = mboss;
- if(iplaysound == mboss && pboss) iplaysound = NULL;
- if(iplaysound == mgardens && pgardens) iplaysound = NULL;
+ if (iplaysound == mboss && pboss) iplaysound = NULL;
+ if (iplaysound == mgardens && pgardens) iplaysound = NULL;
- if(iplaysound != NULL) {
+ if (iplaysound != NULL) {
Mix_HaltChannel(musicchannel);
pboss = 0;
@@ -5368,22 +5336,22 @@ void game_updmusic()
pacademy = 0;
pcitadel = 0;
- if(iplaysound == mboss) pboss = 1;
- if(iplaysound == mgardens) pgardens = 1;
+ if (iplaysound == mboss) pboss = 1;
+ if (iplaysound == mgardens) pgardens = 1;
musicchannel = Mix_PlayChannel(-1, iplaysound, -1);
Mix_Volume(musicchannel, config.musicvol);
} else {
- if(!Mix_Playing(musicchannel)) {
+ if (!Mix_Playing(musicchannel)) {
loopseta = loopseta + 1;
- if(loopseta == 4) loopseta = 0;
+ if (loopseta == 4) loopseta = 0;
- if(pgardens == 1) {
+ if (pgardens == 1) {
Mix_HaltChannel(musicchannel);
- if(pgardens == 1 && loopseta == 0) musicchannel = Mix_PlayChannel(-1, mgardens, 0);
- if(pgardens == 1 && loopseta == 1) musicchannel = Mix_PlayChannel(-1, mgardens2, 0);
- if(pgardens == 1 && loopseta == 2) musicchannel = Mix_PlayChannel(-1, mgardens3, 0);
- if(pgardens == 1 && loopseta == 3) musicchannel = Mix_PlayChannel(-1, mgardens4, 0);
+ if (pgardens == 1 && loopseta == 0) musicchannel = Mix_PlayChannel(-1, mgardens, 0);
+ if (pgardens == 1 && loopseta == 1) musicchannel = Mix_PlayChannel(-1, mgardens2, 0);
+ if (pgardens == 1 && loopseta == 2) musicchannel = Mix_PlayChannel(-1, mgardens3, 0);
+ if (pgardens == 1 && loopseta == 3) musicchannel = Mix_PlayChannel(-1, mgardens4, 0);
}
Mix_Volume(musicchannel, config.musicvol);
@@ -5392,8 +5360,7 @@ void game_updmusic()
}
}
-void game_updnpcs()
-{
+void game_updnpcs() {
float npx, npy, onpx, onpy;
unsigned int *temp, dq, bgc;
float nnxa = 0, nnya = 0, nnxb = 0, nnyb = 0;
@@ -5402,13 +5369,13 @@ void game_updnpcs()
int sx, sy;
int dospell = 0;
- for(int i = 1; i <= lastnpc; i++) {
- if(npcinfo[i].hp > 0) {
+ for (int i = 1; i <= lastnpc; i++) {
+ if (npcinfo[i].hp > 0) {
// is npc walking
pass = 0;
- if(npcinfo[i].attacking == 0) pass = 1;
- if(npcinfo[i].spriteset == 5) pass = 1;
- if(pass == 1) {
+ if (npcinfo[i].attacking == 0) pass = 1;
+ if (npcinfo[i].spriteset == 5) pass = 1;
+ if (pass == 1) {
int moveup = 0;
int movedown = 0;
int moveleft = 0;
@@ -5422,7 +5389,7 @@ void game_updnpcs()
wspd = npcinfo[i].walkspd / 4;
- if(npcinfo[i].spriteset == 10) wspd = wspd * 2;
+ if (npcinfo[i].spriteset == 10) wspd = wspd * 2;
int wdir = npcinfo[i].walkdir;
int mode = npcinfo[i].movementmode;
@@ -5430,15 +5397,15 @@ void game_updnpcs()
xdif = player.px - npx;
ydif = player.py - npy;
- if(abs(xdif) < 4 * 16 && abs(ydif) < 4 * 16 && mode < 3) mode = 0;
- if(npcinfo[i].hp < npcinfo[i].maxhp * 0.25) mode = 3;
+ if (abs(xdif) < 4 * 16 && abs(ydif) < 4 * 16 && mode < 3) mode = 0;
+ if (npcinfo[i].hp < npcinfo[i].maxhp * 0.25) mode = 3;
- if(npcinfo[i].pause > ticks) mode = -1;
- if(npcinfo[i].spriteset == 2 && npcinfo[i].castpause > ticks) mode = -1;
+ if (npcinfo[i].pause > ticks) mode = -1;
+ if (npcinfo[i].spriteset == 2 && npcinfo[i].castpause > ticks) mode = -1;
- if(mode == 3) {
+ if (mode == 3) {
mode = 1;
- if(abs(xdif) < 4 * 16 && abs(ydif) < 4 * 16) mode = 3;
+ if (abs(xdif) < 4 * 16 && abs(ydif) < 4 * 16) mode = 3;
}
checkpass = 0;
@@ -5447,66 +5414,66 @@ void game_updnpcs()
// --------------
// *** aggressive
- if(mode == 0) {
+ if (mode == 0) {
wspd = npcinfo[i].walkspd / 2;
xdif = player.px - npx;
ydif = player.py - npy;
- if(abs(xdif) > abs(ydif)) {
- if(xdif < 4) wdir = 2;
- if(xdif > -4) wdir = 3;
+ if (abs(xdif) > abs(ydif)) {
+ if (xdif < 4) wdir = 2;
+ if (xdif > -4) wdir = 3;
} else {
- if(ydif < 4) wdir = 0;
- if(ydif > -4) wdir = 1;
+ if (ydif < 4) wdir = 0;
+ if (ydif > -4) wdir = 1;
}
- if(xdif < 4) moveleft = 1;
- if(xdif > -4) moveright = 1;
- if(ydif < 4) moveup = 1;
- if(ydif > -4) movedown = 1;
+ if (xdif < 4) moveleft = 1;
+ if (xdif > -4) moveright = 1;
+ if (ydif < 4) moveup = 1;
+ if (ydif > -4) movedown = 1;
}
// *******************
// *** defensive
- if(mode == 1) {
+ if (mode == 1) {
int movingdir = npcinfo[i].movingdir;
- if(npcinfo[i].ticks > ticks + 100000) npcinfo[i].ticks = ticks;
+ if (npcinfo[i].ticks > ticks + 100000) npcinfo[i].ticks = ticks;
- if(npcinfo[i].ticks < ticks) {
+ if (npcinfo[i].ticks < ticks) {
npcinfo[i].ticks = ticks + 2000;
movingdir = (int)(RND() * 8);
npcinfo[i].movingdir = movingdir;
}
- if(movingdir == 0) {
+ if (movingdir == 0) {
wdir = 2; // left
moveup = 1;
moveleft = 1;
- } else if(movingdir == 1) {
+ } else if (movingdir == 1) {
wdir = 0; // up
moveup = 1;
- } else if(movingdir == 2) {
+ } else if (movingdir == 2) {
wdir = 3; // right
moveup = 1;
moveright = 1;
- } else if(movingdir == 3) {
+ } else if (movingdir == 3) {
wdir = 3; // right
moveright = 1;
- } else if(movingdir == 4) {
+ } else if (movingdir == 4) {
wdir = 3; // right
moveright = 1;
movedown = 1;
- } else if(movingdir == 5) {
+ } else if (movingdir == 5) {
wdir = 1; // down
movedown = 1;
- } else if(movingdir == 6) {
+ } else if (movingdir == 6) {
wdir = 2; // left
movedown = 1;
moveleft = 1;
- } else if(movingdir == 7) {
+ } else if (movingdir == 7) {
wdir = 2; // left
moveleft = 1;
}
@@ -5516,24 +5483,24 @@ void game_updnpcs()
// *******************
// *** run away
- if(mode == 3) {
+ if (mode == 3) {
wspd = npcinfo[i].walkspd / 2;
xdif = player.px - npx;
ydif = player.py - npy;
- if(abs(xdif) > abs(ydif)) {
- if(xdif < 4) wdir = 3;
- if(xdif > -4) wdir = 2;
+ if (abs(xdif) > abs(ydif)) {
+ if (xdif < 4) wdir = 3;
+ if (xdif > -4) wdir = 2;
} else {
- if(ydif < 4) wdir = 1;
- if(ydif > -4) wdir = 0;
+ if (ydif < 4) wdir = 1;
+ if (ydif > -4) wdir = 0;
}
- if(xdif < 4) moveright = 1;
- if(xdif > -4) moveleft = 1;
- if(ydif < 4) movedown = 1;
- if(ydif > -4) moveup = 1;
+ if (xdif < 4) moveright = 1;
+ if (xdif > -4) moveleft = 1;
+ if (ydif < 4) movedown = 1;
+ if (ydif > -4) moveup = 1;
}
// *******************
@@ -5546,147 +5513,147 @@ void game_updnpcs()
float xp = (npx / 2 + 6);
float yp = (npy / 2 + 10);
- if(npcinfo[i].spriteset == 10) wspd = wspd * 2;
+ if (npcinfo[i].spriteset == 10) wspd = wspd * 2;
float ii = wspd * fpsr;
- if(ii < 1) ii = 1;
+ if (ii < 1) ii = 1;
SDL_LockSurface(clipbg);
- if(moveup) {
+ if (moveup) {
sx = xp;
sy = yp - ii;
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if(npcinfo[i].spriteset == 11) dq = 0;
+ if (npcinfo[i].spriteset == 11) dq = 0;
- if(dq == 0) movinup = 1;
- if(dq > 0) {
+ if (dq == 0) movinup = 1;
+ if (dq > 0) {
sx = xp - ii;
sy = yp - ii;
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if(npcinfo[i].spriteset == 11) dq = 0;
- if(dq == 0) {
+ if (npcinfo[i].spriteset == 11) dq = 0;
+ if (dq == 0) {
movinup = 1;
movinleft = 1;
}
}
- if(dq > 0) {
+ if (dq > 0) {
sx = xp + ii;
sy = yp - ii;
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if(npcinfo[i].spriteset == 11) dq = 0;
- if(dq == 0) {
+ if (npcinfo[i].spriteset == 11) dq = 0;
+ if (dq == 0) {
movinup = 1;
movinright = 1;
}
}
}
- if(movedown) {
+ if (movedown) {
sx = xp;
sy = yp + ii;
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if(npcinfo[i].spriteset == 11) dq = 0;
- if(dq == 0) movindown = 1;
- if(dq > 0) {
+ if (npcinfo[i].spriteset == 11) dq = 0;
+ if (dq == 0) movindown = 1;
+ if (dq > 0) {
sx = xp - ii;
sy = yp + ii;
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if(npcinfo[i].spriteset == 11) dq = 0;
- if(dq == 0) {
+ if (npcinfo[i].spriteset == 11) dq = 0;
+ if (dq == 0) {
movindown = 1;
movinleft = 1;
}
}
- if(dq > 0) {
+ if (dq > 0) {
sx = xp + ii;
sy = yp + ii;
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if(npcinfo[i].spriteset == 11) dq = 0;
- if(dq == 0 ) {
+ if (npcinfo[i].spriteset == 11) dq = 0;
+ if (dq == 0) {
movindown = 1;
movinright = 1;
}
}
}
- if(moveleft) {
+ if (moveleft) {
sx = xp - ii;
sy = yp;
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if(npcinfo[i].spriteset == 11) dq = 0;
- if(dq == 0) movinleft = 1;
- if(dq > 0) {
+ if (npcinfo[i].spriteset == 11) dq = 0;
+ if (dq == 0) movinleft = 1;
+ if (dq > 0) {
sx = xp - ii;
sy = yp - ii;
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if(npcinfo[i].spriteset == 11) dq = 0;
- if(dq == 0) {
+ if (npcinfo[i].spriteset == 11) dq = 0;
+ if (dq == 0) {
movinleft = 1;
movinup = 1;
}
}
- if(dq > 0) {
+ if (dq > 0) {
sx = xp - ii;
sy = yp + ii;
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if(npcinfo[i].spriteset == 11) dq = 0;
- if(dq == 0) {
+ if (npcinfo[i].spriteset == 11) dq = 0;
+ if (dq == 0) {
movinleft = 1;
movindown = 1;
}
}
}
- if(moveright) {
+ if (moveright) {
sx = xp + ii;
sy = yp;
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if(npcinfo[i].spriteset == 11) dq = 0;
- if(dq == 0) movinright = 1;
- if(dq > 0) {
+ if (npcinfo[i].spriteset == 11) dq = 0;
+ if (dq == 0) movinright = 1;
+ if (dq > 0) {
sx = xp + ii;
sy = yp - ii;
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if(npcinfo[i].spriteset == 11) dq = 0;
- if(dq == 0) {
+ if (npcinfo[i].spriteset == 11) dq = 0;
+ if (dq == 0) {
movinright = 1;
movinup = 1;
}
}
- if(dq > 0) {
+ if (dq > 0) {
sx = xp + ii;
sy = yp + ii;
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if(npcinfo[i].spriteset == 11) dq = 0;
- if(dq == 0) {
+ if (npcinfo[i].spriteset == 11) dq = 0;
+ if (dq == 0) {
movinright = 1;
movindown = 1;
}
}
}
- if(movinup) npy = npy - wspd * fpsr;
- if(movindown) npy = npy + wspd * fpsr;
- if(movinleft) npx = npx - wspd * fpsr;
- if(movinright) npx = npx + wspd * fpsr;
+ if (movinup) npy = npy - wspd * fpsr;
+ if (movindown) npy = npy + wspd * fpsr;
+ if (movinleft) npx = npx - wspd * fpsr;
+ if (movinright) npx = npx + wspd * fpsr;
- if(checkpass == 1) {
+ if (checkpass == 1) {
pass = 0;
- if(npx >= npcinfo[i].x1 * 16 - 8 && npx <= npcinfo[i].x2 * 16 + 8 && npy >= npcinfo[i].y1 * 16 - 8 && npy <= npcinfo[i].y2 * 16 + 8) pass = 1;
- if(pass == 0) {
+ if (npx >= npcinfo[i].x1 * 16 - 8 && npx <= npcinfo[i].x2 * 16 + 8 && npy >= npcinfo[i].y1 * 16 - 8 && npy <= npcinfo[i].y2 * 16 + 8) pass = 1;
+ if (pass == 0) {
npx = onpx;
npy = onpy;
npcinfo[i].ticks = ticks;
@@ -5695,7 +5662,7 @@ void game_updnpcs()
float aspd = wspd;
- if(npcinfo[i].spriteset == 10) aspd = wspd / 2;
+ if (npcinfo[i].spriteset == 10) aspd = wspd / 2;
xp = (npx / 2 + 6);
yp = (npy / 2 + 10);
@@ -5713,16 +5680,16 @@ void game_updnpcs()
int lx = (int)anpx / 16;
int ly = (int)anpy / 16;
- if(triggerloc[lx][ly] > -1) bgc = 1;
- if(npcinfo[i].spriteset == 11) bgc = 0;
+ if (triggerloc[lx][ly] > -1) bgc = 1;
+ if (npcinfo[i].spriteset == 11) bgc = 0;
int rst = 0;
- if(npcinfo[i].spriteset == 11) {
- if(npx < 40 || npx > 280 || npy < 36 || npy > 204) rst = 1;
+ if (npcinfo[i].spriteset == 11) {
+ if (npx < 40 || npx > 280 || npy < 36 || npy > 204) rst = 1;
}
- if(bgc > 0 || rst == 1) {
+ if (bgc > 0 || rst == 1) {
npx = onpx;
npy = onpy;
}
@@ -5733,37 +5700,37 @@ void game_updnpcs()
npcinfo[i].walkdir = wdir;
npcinfo[i].moving = 0;
- if(npx != onpx || npy != onpy) npcinfo[i].moving = 1;
+ if (npx != onpx || npy != onpy) npcinfo[i].moving = 1;
- if(npcinfo[i].moving == 1) {
+ if (npcinfo[i].moving == 1) {
float frame = npcinfo[i].frame;
int cframe = npcinfo[i].cframe;
frame = frame + aspd * fpsr;
- while(frame >= 16)
+ while (frame >= 16)
frame = frame - 16;
cframe = (int)(frame);
- if(cframe > 16) cframe = 16 - 1;
- if(cframe < 0) cframe = 0;
+ if (cframe > 16) cframe = 16 - 1;
+ if (cframe < 0) cframe = 0;
npcinfo[i].frame = frame;
npcinfo[i].cframe = cframe;
}
// spriteset1 specific
- if(npcinfo[i].spriteset == 1 && npcinfo[i].attackattempt < ticks) {
- if(npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ if (npcinfo[i].spriteset == 1 && npcinfo[i].attackattempt < ticks) {
+ if (npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
xdif = player.px - npx;
ydif = player.py - npy;
- if(abs(xdif) < 20 && abs(ydif) < 20) {
+ if (abs(xdif) < 20 && abs(ydif) < 20) {
npcinfo[i].attackattempt = ticks + 100;
- if((int)(RND() * 2) == 0) {
- if(menabled == 1 && config.effects == 1) {
+ if ((int)(RND() * 2) == 0) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndenemyhit], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -5776,51 +5743,51 @@ void game_updnpcs()
}
// onewing specific
- if(npcinfo[i].spriteset == 2) {
- if(npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
- npx = npcinfo[i].x;
- npy = npcinfo[i].y;
+ if (npcinfo[i].spriteset == 2) {
+ if (npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ npx = npcinfo[i].x;
+ npy = npcinfo[i].y;
- xdif = player.px - npx;
- ydif = player.py - npy;
+ xdif = player.px - npx;
+ ydif = player.py - npy;
- if(abs(xdif) < 24 && abs(ydif) < 24) {
- float dist = sqrt(xdif * xdif + ydif * ydif);
+ if (abs(xdif) < 24 && abs(ydif) < 24) {
+ float dist = sqrt(xdif * xdif + ydif * ydif);
- if((dist) < 24) {
- if(menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndbite], 0);
- Mix_Volume(snd, config.effectsvol);
- }
+ if ((dist) < 24) {
+ if (menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndbite], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
- npcinfo[i].attacking = 1;
- npcinfo[i].attackframe = 0;
+ npcinfo[i].attacking = 1;
+ npcinfo[i].attackframe = 0;
- npcinfo[i].headtargetx[0] = player.px + 12;
- npcinfo[i].headtargety[0] = player.py - 4;
- }
+ npcinfo[i].headtargetx[0] = player.px + 12;
+ npcinfo[i].headtargety[0] = player.py - 4;
}
+ }
}
dospell = 0;
- if(npcinfo[i].attacking == 0 && npcinfo[i].castpause < ticks) {
+ if (npcinfo[i].attacking == 0 && npcinfo[i].castpause < ticks) {
npcinfo[i].swayspd = npcinfo[i].swayspd + npcinfo[i].swayspd / 200 * fpsr;
- if(npcinfo[i].swayspd > 15) {
+ if (npcinfo[i].swayspd > 15) {
dospell = 1;
npcinfo[i].swayspd = 1;
}
// sway code
npcinfo[i].swayangle = npcinfo[i].swayangle + npcinfo[i].swayspd * fpsr;
- if(npcinfo[i].swayangle >= 360) npcinfo[i].swayangle = npcinfo[i].swayangle - 360;
+ if (npcinfo[i].swayangle >= 360) npcinfo[i].swayangle = npcinfo[i].swayangle - 360;
npcinfo[i].headtargetx[0] = npcinfo[i].x + (24 - npcinfo[i].swayspd / 2) * sin(3.14159 / 180 * npcinfo[i].swayangle) + 12;
npcinfo[i].headtargety[0] = npcinfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * npcinfo[i].swayangle);
}
- if(dospell == 1) {
+ if (dospell == 1) {
npcinfo[i].pause = ticks + 3000;
npcinfo[i].attacknext = ticks + 4500;
npcinfo[i].castpause = ticks + 4500;
@@ -5843,7 +5810,7 @@ void game_updnpcs()
npcinfo[i].bodysection[0].x = npcinfo[i].x + 12;
npcinfo[i].bodysection[0].y = npcinfo[i].y + 12;
- for(int f = 6; f >= 1; f--) {
+ for (int f = 6; f >= 1; f--) {
xdif = npcinfo[i].bodysection[f + 1].x - npcinfo[i].bodysection[f - 1].x;
ydif = npcinfo[i].bodysection[f + 1].y - npcinfo[i].bodysection[f - 1].y;
@@ -5856,15 +5823,15 @@ void game_updnpcs()
}
// boss1 specific and blackknight
- if(npcinfo[i].spriteset == 3 || npcinfo[i].spriteset == 4) {
- if(npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ if (npcinfo[i].spriteset == 3 || npcinfo[i].spriteset == 4) {
+ if (npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
npcinfo[i].attacking = 1;
npcinfo[i].attackframe = 0;
game_castspell(1, npcinfo[i].x, npcinfo[i].y, player.px, player.py, i);
}
- if(npcinfo[i].castpause < ticks) {
+ if (npcinfo[i].castpause < ticks) {
game_castspell(6, npcinfo[i].x, npcinfo[i].y, player.px, player.py, i);
npcinfo[i].castpause = ticks + 12000;
}
@@ -5872,27 +5839,27 @@ void game_updnpcs()
// firehydra specific
- if(npcinfo[i].spriteset == 5) {
+ if (npcinfo[i].spriteset == 5) {
npcinfo[i].swayspd = 4;
// sway code
npcinfo[i].swayangle = npcinfo[i].swayangle + npcinfo[i].swayspd * fpsr;
- if(npcinfo[i].swayangle >= 360) npcinfo[i].swayangle = npcinfo[i].swayangle - 360;
+ if (npcinfo[i].swayangle >= 360) npcinfo[i].swayangle = npcinfo[i].swayangle - 360;
- for(int ff = 0; ff <= 2; ff++) {
- if(npcinfo[i].hp > 10 * ff * 20) {
- if(npcinfo[i].pause < ticks && npcinfo[i].attacking2[ff] == 0 && npcinfo[i].attacknext2[ff] < ticks) {
+ for (int ff = 0; ff <= 2; ff++) {
+ if (npcinfo[i].hp > 10 * ff * 20) {
+ if (npcinfo[i].pause < ticks && npcinfo[i].attacking2[ff] == 0 && npcinfo[i].attacknext2[ff] < ticks) {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
xdif = player.px - npx;
ydif = player.py - npy;
- if(abs(xdif) < 48 && abs(ydif) < 48) {
+ if (abs(xdif) < 48 && abs(ydif) < 48) {
float dist = sqrt(xdif * xdif + ydif * ydif);
- if((dist) < 36) {
- if(menabled == 1 && config.effects == 1) {
+ if ((dist) < 36) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndbite], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -5910,7 +5877,7 @@ void game_updnpcs()
}
- if(npcinfo[i].attacking2[ff] == 0) {
+ if (npcinfo[i].attacking2[ff] == 0) {
npcinfo[i].headtargetx[ff] = npcinfo[i].x + 38 * sin(3.14159 / 180 * (npcinfo[i].swayangle + 120 * ff)) + 12;
npcinfo[i].headtargety[ff] = npcinfo[i].y - 46 + 16 + 16 * sin(3.14159 * 2 / 180 * (npcinfo[i].swayangle + 120 * ff));
}
@@ -5925,7 +5892,7 @@ void game_updnpcs()
npcinfo[i].bodysection[10 * ff].x = npcinfo[i].x + 12 + 8 * cos(3.141592 * 2 * (itemyloc / 16 + ff * 120 / 360));
npcinfo[i].bodysection[10 * ff].y = npcinfo[i].y + 12 + 8 * sin(3.141592 * 2 * (itemyloc / 16 + ff * 120 / 360));
- for(int f = 8; f >= 1; f--) {
+ for (int f = 8; f >= 1; f--) {
xdif = npcinfo[i].bodysection[ff * 10 + f + 1].x - npcinfo[i].bodysection[ff * 10 + f - 1].x;
ydif = npcinfo[i].bodysection[ff * 10 + f + 1].y - npcinfo[i].bodysection[ff * 10 + f - 1].y;
@@ -5940,8 +5907,8 @@ void game_updnpcs()
}
// spriteset6 specific
- if(npcinfo[i].spriteset == 6 && npcinfo[i].attackattempt < ticks) {
- if(npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ if (npcinfo[i].spriteset == 6 && npcinfo[i].attackattempt < ticks) {
+ if (npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
@@ -5949,31 +5916,31 @@ void game_updnpcs()
ydif = player.py - npy;
pass = 0;
- if(abs(xdif) < 48 && abs(ydif) < 6) pass = 1;
- if(abs(ydif) < 48 && abs(xdif) < 6) pass = 2;
+ if (abs(xdif) < 48 && abs(ydif) < 6) pass = 1;
+ if (abs(ydif) < 48 && abs(xdif) < 6) pass = 2;
- if(pass > 0) {
+ if (pass > 0) {
npcinfo[i].attackattempt = ticks + 100;
- if((int)(RND() * 2) == 0) {
+ if ((int)(RND() * 2) == 0) {
npcinfo[i].attacking = 1;
npcinfo[i].attackframe = 0;
- if(pass == 1 && xdif < 0) {
+ if (pass == 1 && xdif < 0) {
nnxa = npx - 8;
nnya = npy + 4;
nnxb = npx - 48 - 8;
nnyb = npy + 4;
- } else if(pass == 1 && xdif > 0) {
+ } else if (pass == 1 && xdif > 0) {
nnxa = npx + 16;
nnya = npy + 4;
nnxb = npx + 16 + 48;
nnyb = npy + 4;
- } else if(pass == 2 && ydif < 0) {
+ } else if (pass == 2 && ydif < 0) {
nnya = npy;
nnxa = npx + 4;
nnyb = npy - 48;
nnxb = npx + 4;
- } else if(pass == 2 && ydif > 0) {
+ } else if (pass == 2 && ydif > 0) {
nnya = npy + 20;
nnxa = npx + 4;
nnyb = npy + 20 + 48;
@@ -5987,15 +5954,15 @@ void game_updnpcs()
}
// wizard1 specific
- if(npcinfo[i].spriteset == 7) {
- if(npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ if (npcinfo[i].spriteset == 7) {
+ if (npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
npcinfo[i].attacking = 1;
npcinfo[i].attackframe = 0;
game_castspell(9, npcinfo[i].x, npcinfo[i].y, player.px, player.py, i);
}
- if(npcinfo[i].castpause < ticks) {
+ if (npcinfo[i].castpause < ticks) {
// game_castspell 6, npcinfo[i].x, npcinfo[i].y, player.px, player.py, i
// npcinfo[i].castpause = ticks + 12000
}
@@ -6003,8 +5970,8 @@ void game_updnpcs()
}
// spriteset6 specific
- if(npcinfo[i].spriteset == 8 && npcinfo[i].attackattempt < ticks) {
- if(npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ if (npcinfo[i].spriteset == 8 && npcinfo[i].attackattempt < ticks) {
+ if (npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
@@ -6012,34 +5979,34 @@ void game_updnpcs()
ydif = player.py - npy;
pass = 0;
- if(abs(xdif) < 56 && abs(ydif) < 6) pass = 1;
- if(abs(ydif) < 56 && abs(xdif) < 6) pass = 2;
+ if (abs(xdif) < 56 && abs(ydif) < 6) pass = 1;
+ if (abs(ydif) < 56 && abs(xdif) < 6) pass = 2;
- if(pass > 0) {
+ if (pass > 0) {
npcinfo[i].attackattempt = ticks + 100;
- if((int)(RND() * 2) == 0) {
+ if ((int)(RND() * 2) == 0) {
npcinfo[i].attacking = 1;
npcinfo[i].attackframe = 0;
- if(pass == 1 && xdif < 0) {
+ if (pass == 1 && xdif < 0) {
nnxa = npx - 8;
nnya = npy + 4;
nnxb = npx - 56 - 8;
nnyb = npy + 4;
npcinfo[i].walkdir = 2;
- } else if(pass == 1 && xdif > 0) {
+ } else if (pass == 1 && xdif > 0) {
nnxa = npx + 16;
nnya = npy + 4;
nnxb = npx + 16 + 56;
nnyb = npy + 4;
npcinfo[i].walkdir = 3;
- } else if(pass == 2 && ydif < 0) {
+ } else if (pass == 2 && ydif < 0) {
nnya = npy;
nnxa = npx + 4;
nnyb = npy - 56;
nnxb = npx + 4;
npcinfo[i].walkdir = 0;
- } else if(pass == 2 && ydif > 0) {
+ } else if (pass == 2 && ydif > 0) {
nnya = npy + 20;
nnxa = npx + 4;
nnyb = npy + 20 + 56;
@@ -6054,45 +6021,45 @@ void game_updnpcs()
}
// twowing specific
- if(npcinfo[i].spriteset == 9) {
- if(npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
- npx = npcinfo[i].bodysection[7].x;
- npy = npcinfo[i].bodysection[7].y;
+ if (npcinfo[i].spriteset == 9) {
+ if (npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ npx = npcinfo[i].bodysection[7].x;
+ npy = npcinfo[i].bodysection[7].y;
- xdif = player.px - npx;
- ydif = player.py - npy;
+ xdif = player.px - npx;
+ ydif = player.py - npy;
- if(abs(xdif) < 24 && abs(ydif) < 24) {
- float dist = sqrt(xdif * xdif + ydif * ydif);
+ if (abs(xdif) < 24 && abs(ydif) < 24) {
+ float dist = sqrt(xdif * xdif + ydif * ydif);
- if((dist) < 24) {
- if(menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndbite], 0);
- Mix_Volume(snd, config.effectsvol);
- }
+ if ((dist) < 24) {
+ if (menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndbite], 0);
+ Mix_Volume(snd, config.effectsvol);
+ }
- npcinfo[i].attacking = 1;
- npcinfo[i].attackframe = 0;
+ npcinfo[i].attacking = 1;
+ npcinfo[i].attackframe = 0;
- npcinfo[i].headtargetx[0] = player.px + 12;
- npcinfo[i].headtargety[0] = player.py - 4;
- }
+ npcinfo[i].headtargetx[0] = player.px + 12;
+ npcinfo[i].headtargety[0] = player.py - 4;
}
+ }
}
- if(npcinfo[i].attacking == 0 && npcinfo[i].castpause < ticks) {
+ if (npcinfo[i].attacking == 0 && npcinfo[i].castpause < ticks) {
npcinfo[i].swayspd = 4;
// sway code
npcinfo[i].swayangle = npcinfo[i].swayangle + npcinfo[i].swayspd * fpsr;
- if(npcinfo[i].swayangle >= 360) npcinfo[i].swayangle = npcinfo[i].swayangle - 360;
+ if (npcinfo[i].swayangle >= 360) npcinfo[i].swayangle = npcinfo[i].swayangle - 360;
npcinfo[i].headtargetx[0] = npcinfo[i].x + (24 - npcinfo[i].swayspd / 2) * sin(3.14159 / 180 * npcinfo[i].swayangle) + 12;
npcinfo[i].headtargety[0] = npcinfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * npcinfo[i].swayangle);
}
- if(dospell == 1) {
+ if (dospell == 1) {
npcinfo[i].pause = ticks + 3000;
npcinfo[i].attacknext = ticks + 5000;
npcinfo[i].castpause = ticks + 3000;
@@ -6114,7 +6081,7 @@ void game_updnpcs()
npcinfo[i].bodysection[0].x = npcinfo[i].x + 12;
npcinfo[i].bodysection[0].y = npcinfo[i].y + 12;
- for(int f = 6; f >= 1; f--) {
+ for (int f = 6; f >= 1; f--) {
xdif = npcinfo[i].bodysection[f + 1].x - npcinfo[i].bodysection[f - 1].x;
ydif = npcinfo[i].bodysection[f + 1].y - npcinfo[i].bodysection[f - 1].y;
@@ -6128,18 +6095,18 @@ void game_updnpcs()
}
// dragon2 specific
- if(npcinfo[i].spriteset == 10 && npcinfo[i].attackattempt < ticks) {
- if(npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ if (npcinfo[i].spriteset == 10 && npcinfo[i].attackattempt < ticks) {
+ if (npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
xdif = player.px - npx;
ydif = player.py - npy;
- if(abs(xdif) < 32 && abs(ydif) < 32) {
+ if (abs(xdif) < 32 && abs(ydif) < 32) {
npcinfo[i].attackattempt = ticks + 100;
- if((int)(RND() * 2) == 0) {
- if(menabled == 1 && config.effects == 1) {
+ if ((int)(RND() * 2) == 0) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndenemyhit], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -6153,18 +6120,18 @@ void game_updnpcs()
// endboss specific
- if(npcinfo[i].spriteset == 11 && npcinfo[i].attackattempt < ticks) {
- if(npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ if (npcinfo[i].spriteset == 11 && npcinfo[i].attackattempt < ticks) {
+ if (npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
xdif = player.px - npx;
ydif = player.py - npy;
- if(abs(xdif) < 38 && abs(ydif) < 38) {
+ if (abs(xdif) < 38 && abs(ydif) < 38) {
npcinfo[i].attackattempt = ticks + 100;
- if((int)(RND() * 2) == 0) {
- if(menabled == 1 && config.effects == 1) {
+ if ((int)(RND() * 2) == 0) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndice], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -6177,7 +6144,8 @@ void game_updnpcs()
}
- int dist; float damage;
+ int dist;
+ float damage;
npx = npcinfo[i].x;
npy = npcinfo[i].y;
@@ -6190,22 +6158,22 @@ void game_updnpcs()
rcSrc.w = 3;
rcSrc.h = 3;
- if(npcinfo[i].pause < ticks) SDL_FillRect(clipbg, &rcSrc, i);
+ if (npcinfo[i].pause < ticks) SDL_FillRect(clipbg, &rcSrc, i);
pass = 0;
- if(npcinfo[i].attacking == 1) pass = 1;
- if(npcinfo[i].spriteset == 5) {
- if(npcinfo[i].attacking2[0] == 1) pass = 1;
- if(npcinfo[i].attacking2[1] == 1) pass = 1;
- if(npcinfo[i].attacking2[2] == 1) pass = 1;
+ if (npcinfo[i].attacking == 1) pass = 1;
+ if (npcinfo[i].spriteset == 5) {
+ if (npcinfo[i].attacking2[0] == 1) pass = 1;
+ if (npcinfo[i].attacking2[1] == 1) pass = 1;
+ if (npcinfo[i].attacking2[2] == 1) pass = 1;
}
- if(pass == 1) {
+ if (pass == 1) {
// spriteset1 specific
- if(npcinfo[i].spriteset == 1) {
+ if (npcinfo[i].spriteset == 1) {
npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * fpsr;
- if(npcinfo[i].attackframe >= 16) {
+ if (npcinfo[i].attackframe >= 16) {
npcinfo[i].attackframe = 0;
npcinfo[i].attacking = 0;
npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
@@ -6221,18 +6189,18 @@ void game_updnpcs()
dist = 10;
- if(abs(xdif) < dist && abs(ydif) < dist && player.pause < ticks) {
+ if (abs(xdif) < dist && abs(ydif) < dist && player.pause < ticks) {
npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
// npcinfo[i].attackframe = 0;
// npcinfo[i].attacking = 0;
damage = (float)npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
- if(player.hp > 0) game_damageplayer(damage);
+ if (player.hp > 0) game_damageplayer(damage);
}
}
- if(npcinfo[i].spriteset == 2) {
+ if (npcinfo[i].spriteset == 2) {
// targethead code
xdif = npcinfo[i].bodysection[7].x - npcinfo[i].headtargetx[0];
ydif = npcinfo[i].bodysection[7].y - npcinfo[i].headtargety[0];
@@ -6243,7 +6211,7 @@ void game_updnpcs()
npcinfo[i].bodysection[0].x = npcinfo[i].x + 12;
npcinfo[i].bodysection[0].y = npcinfo[i].y + 12;
- for(int f = 6; f >= 1; f--) {
+ for (int f = 6; f >= 1; f--) {
xdif = npcinfo[i].bodysection[f + 1].x - npcinfo[i].bodysection[f - 1].x;
ydif = npcinfo[i].bodysection[f + 1].y - npcinfo[i].bodysection[f - 1].y;
@@ -6255,7 +6223,7 @@ void game_updnpcs()
}
npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * fpsr;
- if(npcinfo[i].attackframe >= 16) {
+ if (npcinfo[i].attackframe >= 16) {
npcinfo[i].attackframe = 0;
npcinfo[i].attacking = 0;
npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
@@ -6271,20 +6239,20 @@ void game_updnpcs()
dist = 8;
- if(abs(xdif) < dist && abs(ydif) < dist && player.pause < ticks) {
+ if (abs(xdif) < dist && abs(ydif) < dist && player.pause < ticks) {
npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
// npcinfo[i].attackframe = 0
// npcinfo[i].attacking = 0
damage = (float)npcinfo[i].attackdamage * (1.0 + (RND() * 0.5));
- if(player.hp > 0) game_damageplayer(damage);
+ if (player.hp > 0) game_damageplayer(damage);
}
}
// firehydra
- if(npcinfo[i].spriteset == 5) {
- for(int ff = 0; ff <= 2; ff++) {
- if(npcinfo[i].attacking2[ff] == 1) {
+ if (npcinfo[i].spriteset == 5) {
+ for (int ff = 0; ff <= 2; ff++) {
+ if (npcinfo[i].attacking2[ff] == 1) {
xdif = npcinfo[i].bodysection[10 * ff + 9].x - npcinfo[i].headtargetx[ff];
ydif = npcinfo[i].bodysection[10 * ff + 9].y - npcinfo[i].headtargety[ff];
@@ -6294,7 +6262,7 @@ void game_updnpcs()
npcinfo[i].bodysection[10 * ff].x = npcinfo[i].x + 12 + 8 * cos(3.141592 * 2 * (itemyloc / 16 + ff * 120 / 360));
npcinfo[i].bodysection[10 * ff].y = npcinfo[i].y + 12 + 8 * sin(3.141592 * 2 * (itemyloc / 16 + ff * 120 / 360));
- for(int f = 8; f >= 1; f--) {
+ for (int f = 8; f >= 1; f--) {
xdif = npcinfo[i].bodysection[ff * 10 + f + 1].x - npcinfo[i].bodysection[ff * 10 + f - 1].x;
ydif = npcinfo[i].bodysection[ff * 10 + f + 1].y - npcinfo[i].bodysection[ff * 10 + f - 1].y;
@@ -6306,7 +6274,7 @@ void game_updnpcs()
}
npcinfo[i].attackframe2[ff] = npcinfo[i].attackframe2[ff] + npcinfo[i].attackspd * fpsr;
- if(npcinfo[i].attackframe2[ff] >= 16) {
+ if (npcinfo[i].attackframe2[ff] >= 16) {
npcinfo[i].attackframe2[ff] = 0;
npcinfo[i].attacking2[ff] = 0;
npcinfo[i].attacknext2[ff] = ticks + npcinfo[i].attackdelay;
@@ -6322,12 +6290,12 @@ void game_updnpcs()
dist = 8;
- if(abs(xdif) < dist && abs(ydif) < dist && player.pause < ticks) {
+ if (abs(xdif) < dist && abs(ydif) < dist && player.pause < ticks) {
npcinfo[i].attacknext2[ff] = ticks + npcinfo[i].attackdelay;
// npcinfo[i].attackframe2(ff) = 0
// npcinfo[i].attacking2(ff) = 0
damage = (float)npcinfo[i].attackdamage * (1.0 + RND() * 0.5);
- if(player.hp > 0) game_damageplayer(damage);
+ if (player.hp > 0) game_damageplayer(damage);
}
}
}
@@ -6335,7 +6303,7 @@ void game_updnpcs()
}
// twowing specific
- if(npcinfo[i].spriteset == 9) {
+ if (npcinfo[i].spriteset == 9) {
// targethead code
xdif = npcinfo[i].bodysection[7].x - npcinfo[i].headtargetx[0];
ydif = npcinfo[i].bodysection[7].y - npcinfo[i].headtargety[0];
@@ -6346,7 +6314,7 @@ void game_updnpcs()
npcinfo[i].bodysection[0].x = npcinfo[i].x + 12;
npcinfo[i].bodysection[0].y = npcinfo[i].y + 12;
- for(int f = 6; f >= 1; f--) {
+ for (int f = 6; f >= 1; f--) {
xdif = npcinfo[i].bodysection[f + 1].x - npcinfo[i].bodysection[f - 1].x;
ydif = npcinfo[i].bodysection[f + 1].y - npcinfo[i].bodysection[f - 1].y;
@@ -6358,7 +6326,7 @@ void game_updnpcs()
}
npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * fpsr;
- if(npcinfo[i].attackframe >= 16) {
+ if (npcinfo[i].attackframe >= 16) {
npcinfo[i].attackframe = 0;
npcinfo[i].attacking = 0;
npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
@@ -6374,20 +6342,20 @@ void game_updnpcs()
dist = 8;
- if(abs(xdif) < dist && abs(ydif) < dist && player.pause < ticks) {
+ if (abs(xdif) < dist && abs(ydif) < dist && player.pause < ticks) {
npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
// npcinfo[i].attackframe = 0
// npcinfo[i].attacking = 0
damage = (float)npcinfo[i].attackdamage * (1.0 + RND() * 0.5);
- if(player.hp > 0) game_damageplayer(damage);
+ if (player.hp > 0) game_damageplayer(damage);
}
}
// dragon 2 specific
- if(npcinfo[i].spriteset == 10) {
+ if (npcinfo[i].spriteset == 10) {
npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * fpsr;
- if(npcinfo[i].attackframe >= 16) {
+ if (npcinfo[i].attackframe >= 16) {
npcinfo[i].attackframe = 0;
npcinfo[i].attacking = 0;
npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
@@ -6403,19 +6371,19 @@ void game_updnpcs()
dist = 16 + npcinfo[i].attackframe;
- if(abs(xdif) < dist && abs(ydif) < dist && player.pause < ticks) {
+ if (abs(xdif) < dist && abs(ydif) < dist && player.pause < ticks) {
npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
// npcinfo[i].attackframe = 0
// npcinfo[i].attacking = 0
damage = (float)npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
- if(player.hp > 0) game_damageplayer(damage);
+ if (player.hp > 0) game_damageplayer(damage);
}
}
// endboss specific
- if(npcinfo[i].spriteset == 11) {
+ if (npcinfo[i].spriteset == 11) {
npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * fpsr;
- if(npcinfo[i].attackframe >= 16) {
+ if (npcinfo[i].attackframe >= 16) {
npcinfo[i].attackframe = 0;
npcinfo[i].attacking = 0;
npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
@@ -6431,12 +6399,12 @@ void game_updnpcs()
dist = 36;
- if(abs(xdif) < dist && abs(ydif) < dist && player.pause < ticks) {
+ if (abs(xdif) < dist && abs(ydif) < dist && player.pause < ticks) {
npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
// npcinfo[i].attackframe = 0
// npcinfo[i].attacking = 0
damage = (float)npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
- if(player.hp > 0) game_damageplayer(damage);
+ if (player.hp > 0) game_damageplayer(damage);
}
}
}
@@ -6445,8 +6413,7 @@ void game_updnpcs()
}
}
-void game_updspells()
-{
+void game_updspells() {
int foundel[5];
float npx, npy;
long cl1, cl2, cl3;
@@ -6454,12 +6421,12 @@ void game_updspells()
float xloc = 0, yloc = 0, xst, yst, xdif, ydif;
- for(int i = 0; i < MAXSPELL; i++) {
- if(spellinfo[i].frame > 0) {
+ for (int i = 0; i < MAXSPELL; i++) {
+ if (spellinfo[i].frame > 0) {
int spellnum = spellinfo[i].spellnum;
// water
- if(spellnum == 0 && forcepause == 0) {
+ if (spellnum == 0 && forcepause == 0) {
float fr = (32 - spellinfo[i].frame);
ll[0][0] = -2;
@@ -6471,11 +6438,11 @@ void game_updspells()
ll[3][0] = 4;
ll[3][1] = -2;
- for(int f = 0; f <= 3; f++) {
- if(fr > f * 4 && fr < f * 4 + 16) {
+ for (int f = 0; f <= 3; f++) {
+ if (fr > f * 4 && fr < f * 4 + 16) {
float alf = 255;
- if(fr < f * 4 + 8) {
+ if (fr < f * 4 + 8) {
int fi = (int)((fr - f * 4) * 3) % 4;
rcSrc.x = 32 + fi * 16;
rcSrc.y = 80;
@@ -6491,11 +6458,11 @@ void game_updspells()
alf = 255 * ((fr - f * 4) / 8);
}
- if(fr >= f * 4 + 8) {
+ if (fr >= f * 4 + 8) {
int fi = 0; // ??
- if(f == 0 || f == 2) fi = 0;
- if(f == 1 || f == 3) fi = 1;
+ if (f == 0 || f == 2) fi = 0;
+ if (f == 1 || f == 3) fi = 1;
rcSrc.x = 32 + fi * 16;
rcSrc.y = 80;
rcSrc.w = 16;
@@ -6517,23 +6484,23 @@ void game_updspells()
alf = 255;
}
- if(xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
+ if (xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
SDL_SetAlpha(spellimg, SDL_SRCALPHA, alf);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
- if(spellinfo[i].damagewho == 0) {
- for(int e = 1; e <= lastnpc; e++) {
+ if (spellinfo[i].damagewho == 0) {
+ for (int e = 1; e <= lastnpc; e++) {
xdif = (xloc + 16) - (npcinfo[e].x + 12);
ydif = (yloc + 16) - (npcinfo[e].y + 12);
- if((abs(xdif) < 16 && abs(ydif) < 16)) {
+ if ((abs(xdif) < 16 && abs(ydif) < 16)) {
float damage = (float)player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
- if(npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
+ if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
game_damagenpc(e, damage, 1);
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndice], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -6543,12 +6510,12 @@ void game_updspells()
}
// check for post damage
- if(nposts > 0) {
- for(int e = 0; e <= nposts - 1; e++) {
+ if (nposts > 0) {
+ for (int e = 0; e <= nposts - 1; e++) {
xdif = (xloc + 16) - (postinfo[e][0] + 8);
ydif = (yloc + 16) - (postinfo[e][1] + 8);
- if((abs(xdif) < 16 && abs(ydif) < 16)) {
+ if ((abs(xdif) < 16 && abs(ydif) < 16)) {
objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
@@ -6561,7 +6528,7 @@ void game_updspells()
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndice], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -6574,10 +6541,10 @@ void game_updspells()
}
// metal
- if(spellnum == 1 && forcepause == 0) {
+ if (spellnum == 1 && forcepause == 0) {
float xdif, ydif;
int npc;
- int fr = (int)((32 - spellinfo[i].frame)*4) % 3;
+ int fr = (int)((32 - spellinfo[i].frame) * 4) % 3;
rcSrc.x = fr * 48;
rcSrc.y = 0;
@@ -6586,8 +6553,8 @@ void game_updspells()
float c1 = (32 - spellinfo[i].frame) / 16;
- float halfx = (spellinfo[i].homex-12) + ((spellinfo[i].enemyx-12) - (spellinfo[i].homex-12)) / 2;
- float halfy = (spellinfo[i].homey-12) + ((spellinfo[i].enemyy-12) - (spellinfo[i].homey-12)) / 2;
+ float halfx = (spellinfo[i].homex - 12) + ((spellinfo[i].enemyx - 12) - (spellinfo[i].homex - 12)) / 2;
+ float halfy = (spellinfo[i].homey - 12) + ((spellinfo[i].enemyy - 12) - (spellinfo[i].homey - 12)) / 2;
float wdth = (halfx - spellinfo[i].homex) * 1.2;
float hight = (halfy - spellinfo[i].homey) * 1.2;
@@ -6601,19 +6568,19 @@ void game_updspells()
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
- if(spellinfo[i].frame < 0) spellinfo[i].frame = 0;
+ if (spellinfo[i].frame < 0) spellinfo[i].frame = 0;
- if(spellinfo[i].damagewho == 0) {
- for(int e = 1; e <= lastnpc; e++) {
+ if (spellinfo[i].damagewho == 0) {
+ for (int e = 1; e <= lastnpc; e++) {
xdif = (xloc + 24) - (npcinfo[e].x + 12);
ydif = (yloc + 24) - (npcinfo[e].y + 12);
- if((abs(xdif) < 24 && abs(ydif) < 24)) {
+ if ((abs(xdif) < 24 && abs(ydif) < 24)) {
float damage = (float)player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
- if(npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
+ if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
game_damagenpc(e, damage, 1);
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndmetalhit], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -6622,10 +6589,10 @@ void game_updspells()
}
}
- if(spellinfo[i].damagewho == 1) {
+ if (spellinfo[i].damagewho == 1) {
// --------- boss 1 specific
- if(spellinfo[i].frame == 0 && npcinfo[spellinfo[i].npc].spriteset == 3) {
+ if (spellinfo[i].frame == 0 && npcinfo[spellinfo[i].npc].spriteset == 3) {
npc = spellinfo[i].npc;
npcinfo[npc].attackframe = 0;
npcinfo[npc].attacking = 0;
@@ -6636,7 +6603,7 @@ void game_updspells()
// ---------------
// --------- blackknight specific
- if(spellinfo[i].frame == 0 && npcinfo[spellinfo[i].npc].spriteset == 4) {
+ if (spellinfo[i].frame == 0 && npcinfo[spellinfo[i].npc].spriteset == 4) {
npc = spellinfo[i].npc;
npcinfo[npc].attackframe = 0;
npcinfo[npc].attacking = 0;
@@ -6649,15 +6616,15 @@ void game_updspells()
xdif = (xloc + 24) - (player.px + 12);
ydif = (yloc + 24) - (player.py + 12);
- if((abs(xdif) < 24 && abs(ydif) < 24) && player.pause < ticks) {
+ if ((abs(xdif) < 24 && abs(ydif) < 24) && player.pause < ticks) {
npx = player.px;
npy = player.py;
float damage = (float)npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
- if(player.hp > 0) {
+ if (player.hp > 0) {
game_damageplayer(damage);
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndmetalhit], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -6667,12 +6634,12 @@ void game_updspells()
// check for(int post damage
- if(nposts > 0) {
- for(int e = 0; e <= nposts - 1; e++) {
+ if (nposts > 0) {
+ for (int e = 0; e <= nposts - 1; e++) {
xdif = (xloc + 24) - (postinfo[e][0] + 8);
ydif = (yloc + 24) - (postinfo[e][1] + 8);
- if((abs(xdif) < 24 && abs(ydif) < 24)) {
+ if ((abs(xdif) < 24 && abs(ydif) < 24)) {
objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
@@ -6685,7 +6652,7 @@ void game_updspells()
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndmetalhit], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -6695,48 +6662,48 @@ void game_updspells()
}
// earth
- if(spellnum == 2 && forcepause == 0) {
+ if (spellnum == 2 && forcepause == 0) {
float hght = 240 - spellinfo[i].enemyy;
- for(int f = 8; f >= 0; f--) {
+ for (int f = 8; f >= 0; f--) {
float fr = (32 - spellinfo[i].frame);
- if(fr > f && fr < f + 16) {
+ if (fr > f && fr < f + 16) {
rcSrc.x = 32 * spellinfo[i].rockimg[f];
rcSrc.y = 48;
rcSrc.w = 32;
rcSrc.h = 32;
int scatter = 0;
- if(fr < 8 + f) {
+ if (fr < 8 + f) {
xloc = spellinfo[i].enemyx - 4;
yloc = spellinfo[i].enemyy * (1 - cos(3.14159 / 2 * (fr - f) / 8)); // ^ 2;
yloc *= yloc;
} else {
scatter = 1;
- xloc = spellinfo[i].enemyx - 4 - spellinfo[i].rockdeflect[f] * sin(3.14159 / 2* ((fr - f) - 8) / 8);
+ xloc = spellinfo[i].enemyx - 4 - spellinfo[i].rockdeflect[f] * sin(3.14159 / 2 * ((fr - f) - 8) / 8);
yloc = spellinfo[i].enemyy + hght * (1 - cos(3.14159 / 2 * ((fr - f) - 8) / 8));
}
rcDest.x = xloc;
rcDest.y = yloc;
- if(xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
+ if (xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
- if(scatter == 1) {
- if(spellinfo[i].damagewho == 0) {
- for(int e = 1; e <= lastnpc; e++) {
+ if (scatter == 1) {
+ if (spellinfo[i].damagewho == 0) {
+ for (int e = 1; e <= lastnpc; e++) {
xdif = (xloc + 16) - (npcinfo[e].x + 12);
ydif = (yloc + 16) - (npcinfo[e].y + 12);
- if((abs(xdif) < 16 && abs(ydif) < 16)) {
+ if ((abs(xdif) < 16 && abs(ydif) < 16)) {
float damage = (float)player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
- if(npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
+ if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
game_damagenpc(e, damage, 1);
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndrocks], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -6747,12 +6714,12 @@ void game_updspells()
// check for(int post damage
- if(nposts > 0) {
- for(int e = 0; e <= nposts - 1; e++) {
+ if (nposts > 0) {
+ for (int e = 0; e <= nposts - 1; e++) {
xdif = (xloc + 16) - (postinfo[e][0] + 8);
ydif = (yloc + 16) - (postinfo[e][1] + 8);
- if((abs(xdif) < 16 && abs(ydif) < 16)) {
+ if ((abs(xdif) < 16 && abs(ydif) < 16)) {
objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
@@ -6765,7 +6732,7 @@ void game_updspells()
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndrocks], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -6778,11 +6745,11 @@ void game_updspells()
}
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
- if(spellinfo[i].frame < 0) spellinfo[i].frame = 0;
+ if (spellinfo[i].frame < 0) spellinfo[i].frame = 0;
}
// crystal
- if(spellnum == 5) {
+ if (spellnum == 5) {
float fra = (32 - spellinfo[i].frame);
int fr = (int)((spellinfo[i].frame) * 2) % 8;
@@ -6796,15 +6763,15 @@ void game_updspells()
rcDest.y = player.py + 16 - 48;
int f = 160;
- if(fra < 8) f = 192 * fra / 8;
- if(fra > 24) f = 192 * (1 - (fra - 24) / 8);
+ if (fra < 8) f = 192 * fra / 8;
+ if (fra > 24) f = 192 * (1 - (fra - 24) / 8);
SDL_SetAlpha(spellimg, SDL_SRCALPHA, f);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
spellinfo[i].frame = spellinfo[i].frame - 0.3 * fpsr;
- if(spellinfo[i].frame < 0) {
+ if (spellinfo[i].frame < 0) {
spellinfo[i].frame = 0;
forcepause = 0;
@@ -6814,35 +6781,35 @@ void game_updspells()
int lx = (int)npx / 16;
int ly = (int)npy / 16;
- for(int f = 0; f < 5; f++) { // !! f < 5
+ for (int f = 0; f < 5; f++) { // !! f < 5
foundel[f] = 0;
}
- for(int xo = -2; xo <= 2; xo++) {
- for(int yo = -2; yo <= 2; yo++) {
+ for (int xo = -2; xo <= 2; xo++) {
+ for (int yo = -2; yo <= 2; yo++) {
int sx = lx + xo;
int sy = ly + yo;
- if(sx > -1 && sx < 20 && sy > -1 && sy < 15) {
- for(int l = 0; l <= 2; l++) {
+ if (sx > -1 && sx < 20 && sy > -1 && sy < 15) {
+ for (int l = 0; l <= 2; l++) {
int curtile = tileinfo[l][sx][sy][0];
int curtilel = tileinfo[l][sx][sy][1];
- if(curtile > 0) {
+ if (curtile > 0) {
curtile = curtile - 1;
int curtilex = curtile % 20;
int curtiley = (curtile - curtilex) / 20;
int element = elementmap[curtiley][curtilex];
- if(element > -1 && curtilel == 0) foundel[element + 1] = 1;
+ if (element > -1 && curtilel == 0) foundel[element + 1] = 1;
}
}
int o = objmap[sx][sy];
- if(o > -1) {
- if(objectinfo[o][4] == 1) foundel[2] = 1;
- if(o == 1 || o == 2) {
+ if (o > -1) {
+ if (objectinfo[o][4] == 1) foundel[2] = 1;
+ if (o == 1 || o == 2) {
foundel[2] = 1;
foundel[4] = 1;
}
@@ -6854,14 +6821,14 @@ void game_updspells()
char line[256];
strcpy(line, "Found... nothing...");
- for(int f = 0; f < 5; f++) {
- if(foundel[f] == 1 && player.foundspell[f] == 0) {
+ for (int f = 0; f < 5; f++) {
+ if (foundel[f] == 1 && player.foundspell[f] == 0) {
player.foundspell[f] = 1;
player.spellcharge[f] = 0;
- if(f == 1) strcpy(line, "Found... Water Essence");
- if(f == 2) strcpy(line, "Found... Metal Essence");
- if(f == 3) strcpy(line, "Found... Earth Essence");
- if(f == 4) strcpy(line, "Found... Fire Essence");
+ if (f == 1) strcpy(line, "Found... Water Essence");
+ if (f == 2) strcpy(line, "Found... Metal Essence");
+ if (f == 3) strcpy(line, "Found... Earth Essence");
+ if (f == 4) strcpy(line, "Found... Fire Essence");
break;
}
}
@@ -6871,9 +6838,9 @@ void game_updspells()
}
// room fireballs
- if(spellnum == 6 && forcepause == 0) {
+ if (spellnum == 6 && forcepause == 0) {
- if(spellinfo[i].frame > 16) {
+ if (spellinfo[i].frame > 16) {
float fr = (32 - spellinfo[i].frame);
SDL_SetAlpha(spellimg, SDL_SRCALPHA, 192 * sin(3.14159 * fr / 4));
@@ -6883,7 +6850,7 @@ void game_updspells()
rcSrc.w = 16;
rcSrc.h = 16;
- for(int ff = 0; ff <= spellinfo[i].nfballs - 1; ff++) {
+ for (int ff = 0; ff <= spellinfo[i].nfballs - 1; ff++) {
xloc = spellinfo[i].fireballs[ff][0] + (int)(RND() * 3) - 1;
yloc = spellinfo[i].fireballs[ff][1] + (int)(RND() * 3) - 1;
@@ -6903,7 +6870,7 @@ void game_updspells()
rcSrc.w = 16;
rcSrc.h = 16;
- for(int ff = 0; ff <= spellinfo[i].nfballs - 1; ff++) {
+ for (int ff = 0; ff <= spellinfo[i].nfballs - 1; ff++) {
float ax = spellinfo[i].fireballs[ff][0];
float ay = spellinfo[i].fireballs[ff][1];
float bx = player.px + 4;
@@ -6916,7 +6883,7 @@ void game_updspells()
spellinfo[i].fireballs[ff][2] += tx * 1.2 * fpsr;
spellinfo[i].fireballs[ff][3] += ty * 1.2 * fpsr;
- if(spellinfo[i].ballon[ff] == 1) {
+ if (spellinfo[i].ballon[ff] == 1) {
spellinfo[i].fireballs[ff][0] = ax + spellinfo[i].fireballs[ff][2] * 0.2 * fpsr;
spellinfo[i].fireballs[ff][1] = ay + spellinfo[i].fireballs[ff][3] * 0.2 * fpsr;
@@ -6929,32 +6896,32 @@ void game_updspells()
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
}
- if(xloc < -1 || yloc < -1 || xloc > 304 || yloc > 224) spellinfo[i].ballon[ff] = 0;
+ if (xloc < -1 || yloc < -1 || xloc > 304 || yloc > 224) spellinfo[i].ballon[ff] = 0;
}
SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
}
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
- if(spellinfo[i].frame < 0) spellinfo[i].frame = 0;
+ if (spellinfo[i].frame < 0) spellinfo[i].frame = 0;
- if(spellinfo[i].damagewho == 1) {
- for(int ff = 0; ff <= spellinfo[i].nfballs - 1; ff++) {
- if(spellinfo[i].ballon[ff] == 1) {
+ if (spellinfo[i].damagewho == 1) {
+ for (int ff = 0; ff <= spellinfo[i].nfballs - 1; ff++) {
+ if (spellinfo[i].ballon[ff] == 1) {
xloc = spellinfo[i].fireballs[ff][0] + (int)(RND() * 3) - 1;
yloc = spellinfo[i].fireballs[ff][1] + (int)(RND() * 3) - 1;
xdif = (xloc + 8) - (player.px + 12);
ydif = (yloc + 8) - (player.py + 12);
- if((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks) {
+ if ((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks) {
float damage = npcinfo[spellinfo[i].npc].spelldamage * (1 + RND() * 0.5) / 3;
- if(player.hp > 0) game_damageplayer(damage);
+ if (player.hp > 0) game_damageplayer(damage);
- if(menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndfire], 0);
- Mix_Volume(snd, config.effectsvol);
+ if (menabled == 1 && config.effects == 1) {
+ int snd = Mix_PlayChannel(-1, sfx[sndfire], 0);
+ Mix_Volume(snd, config.effectsvol);
}
}
}
@@ -6963,7 +6930,7 @@ void game_updspells()
}
// lightning bomb
- if(spellnum == 8) {
+ if (spellnum == 8) {
cl1 = SDL_MapRGB(videobuffer->format, 0, 32, 204);
cl2 = SDL_MapRGB(videobuffer->format, 142, 173, 191);
@@ -6975,44 +6942,44 @@ void game_updspells()
int apx = px + (int)(RND() * 5 - 2);
int apy = py + (int)(RND() * 5 - 2);
- for(int f = 0; f <= 0; f++) { // ??
+ for (int f = 0; f <= 0; f++) { // ??
int y = apy;
int orn = 0;
- for(int x = apx; x <= 319; x++) {
+ for (int x = apx; x <= 319; x++) {
int rn = (int)(RND() * 3);
- if(orn == 0) y = y - 1;
- if(orn == 2) y = y + 1;
+ if (orn == 0) y = y - 1;
+ if (orn == 2) y = y + 1;
- sys_line(videobuffer,x, y - 1, x, y + 2, cl1);
- sys_line(videobuffer,x, y, x, y + 1, cl3);
+ sys_line(videobuffer, x, y - 1, x, y + 2, cl1);
+ sys_line(videobuffer, x, y, x, y + 1, cl3);
- if(rn == 0) sys_line(videobuffer, x, y + 1, x, y + 1, cl2);
- if(rn == 2) sys_line(videobuffer, x, y, x, y, cl2);
+ if (rn == 0) sys_line(videobuffer, x, y + 1, x, y + 1, cl2);
+ if (rn == 2) sys_line(videobuffer, x, y, x, y, cl2);
orn = rn;
- if(spellinfo[i].damagewho == 0) {
- for(int e = 1; e <= lastnpc; e++) {
+ if (spellinfo[i].damagewho == 0) {
+ for (int e = 1; e <= lastnpc; e++) {
xdif = (x + 16) - (npcinfo[e].x + 12);
ydif = (y + 16) - (npcinfo[e].y + 12);
- if((abs(xdif) < 8 && abs(ydif) < 8)) {
+ if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = 30 * (1 + RND() * 0.5);
- if(npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) game_damagenpc(e, damage, 1);
+ if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) game_damagenpc(e, damage, 1);
}
}
}
-
+
// check for post damage
- if(nposts > 0) {
- for(int e = 0; e <= nposts - 1; e++) {
+ if (nposts > 0) {
+ for (int e = 0; e <= nposts - 1; e++) {
xdif = (xloc + 16) - (postinfo[e][0] + 8);
ydif = (yloc + 16) - (postinfo[e][1] + 8);
- if((abs(xdif) < 16 && abs(ydif) < 16)) {
+ if ((abs(xdif) < 16 && abs(ydif) < 16)) {
objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
@@ -7031,41 +6998,41 @@ void game_updspells()
y = apy;
orn = 0;
- for(int x = apx; x >= 0; x--) {
+ for (int x = apx; x >= 0; x--) {
int rn = (int)(RND() * 3);
- if(orn == 0) y = y - 1;
- if(orn == 2) y = y + 1;
+ if (orn == 0) y = y - 1;
+ if (orn == 2) y = y + 1;
- sys_line(videobuffer,x, y - 1, x, y + 2, cl1);
- sys_line(videobuffer,x, y, x, y + 1, cl3);
+ sys_line(videobuffer, x, y - 1, x, y + 2, cl1);
+ sys_line(videobuffer, x, y, x, y + 1, cl3);
- if(rn == 0) sys_line(videobuffer, x, y + 1, x, y + 1, cl2);
- if(rn == 2) sys_line(videobuffer, x, y, x, y, cl2);
+ if (rn == 0) sys_line(videobuffer, x, y + 1, x, y + 1, cl2);
+ if (rn == 2) sys_line(videobuffer, x, y, x, y, cl2);
orn = rn;
- if(spellinfo[i].damagewho == 0) {
- for(int e = 1; e <= lastnpc; e++) {
+ if (spellinfo[i].damagewho == 0) {
+ for (int e = 1; e <= lastnpc; e++) {
xdif = (x + 16) - (npcinfo[e].x + 12);
ydif = (y + 16) - (npcinfo[e].y + 12);
- if((abs(xdif) < 8 && abs(ydif) < 8)) {
+ if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = 30 * (1 + RND() * 0.5);
- if(npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) game_damagenpc(e, damage, 1);
+ if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) game_damagenpc(e, damage, 1);
}
}
}
// check for post damage
- if(nposts > 0) {
- for(int e = 0; e <= nposts - 1; e++) {
+ if (nposts > 0) {
+ for (int e = 0; e <= nposts - 1; e++) {
xdif = (xloc + 16) - (postinfo[e][0] + 8);
ydif = (yloc + 16) - (postinfo[e][1] + 8);
- if((abs(xdif) < 16 && abs(ydif) < 16)) {
+ if ((abs(xdif) < 16 && abs(ydif) < 16)) {
objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
@@ -7084,40 +7051,40 @@ void game_updspells()
int x = apx;
orn = 0;
- for(int y = apy; y <= 239; y++) {
+ for (int y = apy; y <= 239; y++) {
int rn = (int)(RND() * 3);
- if(orn == 0) x = x - 1;
- if(orn == 2) x = x + 1;
+ if (orn == 0) x = x - 1;
+ if (orn == 2) x = x + 1;
- sys_line(videobuffer,x - 1, y, x + 2, y, cl1);
- sys_line(videobuffer,x, y, x + 1, y, cl3);
+ sys_line(videobuffer, x - 1, y, x + 2, y, cl1);
+ sys_line(videobuffer, x, y, x + 1, y, cl3);
- if(rn == 0) sys_line(videobuffer, x + 1, y, x + 1, y, cl2);
- if(rn == 2) sys_line(videobuffer, x, y, x, y, cl2);
+ if (rn == 0) sys_line(videobuffer, x + 1, y, x + 1, y, cl2);
+ if (rn == 2) sys_line(videobuffer, x, y, x, y, cl2);
orn = rn;
- if(spellinfo[i].damagewho == 0) {
- for(int e = 1; e <= lastnpc; e++) {
+ if (spellinfo[i].damagewho == 0) {
+ for (int e = 1; e <= lastnpc; e++) {
xdif = (x + 16) - (npcinfo[e].x + 12);
ydif = (y + 16) - (npcinfo[e].y + 12);
- if((abs(xdif) < 8 && abs(ydif) < 8)) {
+ if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = 30 * (1 + RND() * 0.5);
- if(npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) game_damagenpc(e, damage, 1);
+ if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) game_damagenpc(e, damage, 1);
}
}
}
// check for post damage
- if(nposts > 0) {
- for(int e = 0; e <= nposts - 1; e++) {
+ if (nposts > 0) {
+ for (int e = 0; e <= nposts - 1; e++) {
xdif = (xloc + 16) - (postinfo[e][0] + 8);
ydif = (yloc + 16) - (postinfo[e][1] + 8);
- if((abs(xdif) < 16 && abs(ydif) < 16)) {
+ if ((abs(xdif) < 16 && abs(ydif) < 16)) {
objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
@@ -7136,40 +7103,40 @@ void game_updspells()
x = apx;
orn = 0;
- for(int y = apy; y >= 0; y--) {
+ for (int y = apy; y >= 0; y--) {
int rn = (int)(RND() * 3);
- if(orn == 0) x = x - 1;
- if(orn == 2) x = x + 1;
+ if (orn == 0) x = x - 1;
+ if (orn == 2) x = x + 1;
- sys_line(videobuffer,x - 1, y, x + 2, y, cl1);
- sys_line(videobuffer,x, y, x + 1, y, cl3);
+ sys_line(videobuffer, x - 1, y, x + 2, y, cl1);
+ sys_line(videobuffer, x, y, x + 1, y, cl3);
- if(rn == 0) sys_line(videobuffer, x + 1, y, x + 1, y, cl2);
- if(rn == 2) sys_line(videobuffer, x, y, x, y, cl2);
+ if (rn == 0) sys_line(videobuffer, x + 1, y, x + 1, y, cl2);
+ if (rn == 2) sys_line(videobuffer, x, y, x, y, cl2);
orn = rn;
- if(spellinfo[i].damagewho == 0) {
- for(int e = 1; e <= lastnpc; e++) {
+ if (spellinfo[i].damagewho == 0) {
+ for (int e = 1; e <= lastnpc; e++) {
xdif = (x + 16) - (npcinfo[e].x + 12);
ydif = (y + 16) - (npcinfo[e].y + 12);
- if((abs(xdif) < 8 && abs(ydif) < 8)) {
+ if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = 30 * (1 + RND() * 0.5);
- if(npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) game_damagenpc(e, damage, 1);
+ if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) game_damagenpc(e, damage, 1);
}
}
}
// check for post damage
- if(nposts > 0) {
- for(int e = 0; e <= nposts - 1; e++) {
+ if (nposts > 0) {
+ for (int e = 0; e <= nposts - 1; e++) {
xdif = (xloc + 16) - (postinfo[e][0] + 8);
ydif = (yloc + 16) - (postinfo[e][1] + 8);
- if((abs(xdif) < 16 && abs(ydif) < 16)) {
+ if ((abs(xdif) < 16 && abs(ydif) < 16)) {
objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
@@ -7188,14 +7155,14 @@ void game_updspells()
}
spellinfo[i].frame -= 0.5 * fpsr;
- if(spellinfo[i].frame < 0) {
+ if (spellinfo[i].frame < 0) {
spellinfo[i].frame = 0;
forcepause = 0;
}
}
// wizard 1 lightning
- if(spellnum == 9) {
+ if (spellnum == 9) {
cl1 = SDL_MapRGB(videobuffer->format, 0, 32, 204);
cl2 = SDL_MapRGB(videobuffer->format, 142, 173, 191);
@@ -7209,43 +7176,43 @@ void game_updspells()
int x = apx;
int orn = 0;
- for(int y = 0; y <= apy; y++) {
- if(y < 240) {
+ for (int y = 0; y <= apy; y++) {
+ if (y < 240) {
float xdif, ydif;
int rn = (int)(RND() * 3);
- if(orn == 0) x = x - 1;
- if(orn == 2) x = x + 1;
+ if (orn == 0) x = x - 1;
+ if (orn == 2) x = x + 1;
- sys_line(videobuffer,x - 1, y, x + 2, y, cl1);
- sys_line(videobuffer,x, y, x + 1, y, cl3);
+ sys_line(videobuffer, x - 1, y, x + 2, y, cl1);
+ sys_line(videobuffer, x, y, x + 1, y, cl3);
- if(rn == 0) sys_line(videobuffer, x + 1, y, x + 1, y, cl2);
- if(rn == 2) sys_line(videobuffer, x, y, x, y, cl2);
+ if (rn == 0) sys_line(videobuffer, x + 1, y, x + 1, y, cl2);
+ if (rn == 2) sys_line(videobuffer, x, y, x, y, cl2);
orn = rn;
- if(spellinfo[i].damagewho == 1) {
+ if (spellinfo[i].damagewho == 1) {
xdif = (x + 8) - (player.px + 12);
ydif = (y + 8) - (player.py + 12);
- if((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks) {
+ if ((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks) {
float damage = ((float)player.hp * 0.75) * (RND() * 0.5 + 0.5);
- if(damage < 5) damage = 5;
+ if (damage < 5) damage = 5;
- if(npcinfo[spellinfo[i].npc].spriteset == 12) {
- if(damage < 50) damage = 40 + (int)(RND() * 40);
+ if (npcinfo[spellinfo[i].npc].spriteset == 12) {
+ if (damage < 50) damage = 40 + (int)(RND() * 40);
}
- if(player.hp > 0) game_damageplayer(damage);
+ if (player.hp > 0) game_damageplayer(damage);
}
}
}
}
spellinfo[i].frame -= 0.5 * fpsr;
- if(spellinfo[i].frame < 0) {
+ if (spellinfo[i].frame < 0) {
spellinfo[i].frame = 0;
npcinfo[spellinfo[i].npc].attacking = 0;
@@ -7258,19 +7225,18 @@ void game_updspells()
-void game_updspellsunder()
-{
+void game_updspellsunder() {
unsigned int dq, *temp;
- if(forcepause == 1) return;
+ if (forcepause == 1) return;
- for(int i = 0; i < MAXSPELL; i++) {
- if(spellinfo[i].frame > 0) {
+ for (int i = 0; i < MAXSPELL; i++) {
+ if (spellinfo[i].frame > 0) {
int spellnum = spellinfo[i].spellnum;
// water
- if(spellnum == 0) {
+ if (spellnum == 0) {
int fra = (32 - spellinfo[i].frame);
int fr = (int)((32 - spellinfo[i].frame) * 2) % 4;
@@ -7283,26 +7249,26 @@ void game_updspellsunder()
rcDest.y = spellinfo[i].enemyy - 8;
int f = 160;
- if(fra < 8) f = 160 * fra / 8;
- if(fra > 24) f = 160 * (1 - (fra - 24) / 8);
+ if (fra < 8) f = 160 * fra / 8;
+ if (fra > 24) f = 160 * (1 - (fra - 24) / 8);
SDL_SetAlpha(spellimg, SDL_SRCALPHA, f);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
- if(spellinfo[i].frame < 0) spellinfo[i].frame = 0;
+ if (spellinfo[i].frame < 0) spellinfo[i].frame = 0;
- for(int f = 1; f <= lastnpc; f++) {
+ for (int f = 1; f <= lastnpc; f++) {
int xdif = spellinfo[i].enemyx - npcinfo[f].x;
int ydif = spellinfo[i].enemyy - npcinfo[f].y;
float dist = sqrt(xdif * xdif + ydif * ydif);
- if(dist > 20) dist = 20;
+ if (dist > 20) dist = 20;
- if(dist > 5) {
+ if (dist > 5) {
float ratio = (1 - dist / 25);
float newx = npcinfo[f].x + ratio * xdif / 3 * fpsr;
@@ -7315,7 +7281,7 @@ void game_updspellsunder()
// SDL_UnLockSurface clipbg
- if(dq == 0) {
+ if (dq == 0) {
npcinfo[f].x = newx;
npcinfo[f].y = newy;
// npcinfo[f].castpause = ticks + 200;
@@ -7328,7 +7294,7 @@ void game_updspellsunder()
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if(dq == 0) xpass = 1;
+ if (dq == 0) xpass = 1;
sx = (npcinfo[f].x / 2 + 6);
@@ -7336,15 +7302,15 @@ void game_updspellsunder()
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if(dq == 0) ypass = 1;
+ if (dq == 0) ypass = 1;
- if(ypass == 1) {
+ if (ypass == 1) {
newx = npcinfo[f].x;
- } else if(xpass == 1) {
+ } else if (xpass == 1) {
newy = npcinfo[f].y;
}
- if(xpass == 1 || ypass == 1) {
+ if (xpass == 1 || ypass == 1) {
npcinfo[f].x = newx;
npcinfo[f].y = newy;
// npcinfo[f].castpause = ticks + 200;
@@ -7355,21 +7321,21 @@ void game_updspellsunder()
}
// fire
- if(spellnum == 3) {
+ if (spellnum == 3) {
float fr = (32 - spellinfo[i].frame);
- fr = fr*fr * (1 - cos(3.14159 / 4 + 3.14159 / 4 * fr / 32));
+ fr = fr * fr * (1 - cos(3.14159 / 4 + 3.14159 / 4 * fr / 32));
- if(fr > 32) fr = 32;
+ if (fr > 32) fr = 32;
float s = 8;
- if(spellinfo[i].frame < 8) s = spellinfo[i].frame;
+ if (spellinfo[i].frame < 8) s = spellinfo[i].frame;
int fra = (int)fr;
- for(int f = 0; f <= 4; f++) {
- for(int x = 0; x <= fra; x += 2) {
- if(spellinfo[i].legalive[f] >= x) {
+ for (int f = 0; f <= 4; f++) {
+ for (int x = 0; x <= fra; x += 2) {
+ if (spellinfo[i].legalive[f] >= x) {
SDL_SetAlpha(spellimg, SDL_SRCALPHA, 192 * sin(3.14159 * x / 32) * s / 8);
float an = 360 / 5 * f + x / 32 * 180;
@@ -7384,7 +7350,7 @@ void game_updspellsunder()
rcDest.x = (int)xloc;
rcDest.y = (int)yloc;
- if(xloc > -1 && xloc < 304 && yloc > -1 && yloc < 224) {
+ if (xloc > -1 && xloc < 304 && yloc > -1 && yloc < 224) {
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
int sx = (xloc / 2 + 4);
@@ -7392,21 +7358,21 @@ void game_updspellsunder()
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if(dq > 1000 && x > 4) spellinfo[i].legalive[f] = x;
+ if (dq > 1000 && x > 4) spellinfo[i].legalive[f] = x;
- if(spellinfo[i].damagewho == 0) {
- for(int e = 1; e <= lastnpc; e++) {
+ if (spellinfo[i].damagewho == 0) {
+ for (int e = 1; e <= lastnpc; e++) {
float xdif = (xloc + 8) - (npcinfo[e].x + 12);
float ydif = (yloc + 8) - (npcinfo[e].y + 12);
- if((abs(xdif) < 8 && abs(ydif) < 8)) {
+ if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = (float)player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
- if(npcinfo[e].spriteset == 5) damage = -damage;
- if(npcinfo[e].spriteset == 11) damage = -damage;
- if(npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
+ if (npcinfo[e].spriteset == 5) damage = -damage;
+ if (npcinfo[e].spriteset == 11) damage = -damage;
+ if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
game_damagenpc(e, damage, 1);
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndfire], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -7415,17 +7381,17 @@ void game_updspellsunder()
}
}
- if(spellinfo[i].damagewho == 1) {
+ if (spellinfo[i].damagewho == 1) {
float xdif = (xloc + 8) - (player.px + 12);
float ydif = (yloc + 8) - (player.py + 12);
- if((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks) {
+ if ((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks) {
float damage = (float)npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
- if(player.hp > 0) {
+ if (player.hp > 0) {
game_damageplayer(damage);
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndfire], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -7434,12 +7400,12 @@ void game_updspellsunder()
}
// check for post damage
- if(nposts > 0) {
- for(int e = 0; e <= nposts - 1; e++) {
+ if (nposts > 0) {
+ for (int e = 0; e <= nposts - 1; e++) {
float xdif = (xloc + 8) - (postinfo[e][0] + 8);
float ydif = (yloc + 8) - (postinfo[e][1] + 8);
- if((abs(xdif) < 8 && abs(ydif) < 8)) {
+ if ((abs(xdif) < 8 && abs(ydif) < 8)) {
objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
@@ -7450,7 +7416,7 @@ void game_updspellsunder()
SDL_FillRect(clipbg2, &rcSrc, 0);
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndfire], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -7467,28 +7433,28 @@ void game_updspellsunder()
SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
- if(spellinfo[i].frame < 0) spellinfo[i].frame = 0;
+ if (spellinfo[i].frame < 0) spellinfo[i].frame = 0;
}
// sprite 6 spitfire
- if(spellnum == 7) {
+ if (spellnum == 7) {
float xspan = spellinfo[i].enemyx - spellinfo[i].homex;
float yspan = spellinfo[i].enemyy - spellinfo[i].homey;
float fr = (32 - spellinfo[i].frame);
- for(int f = 0; f <= 7; f++) {
+ for (int f = 0; f <= 7; f++) {
int alpha = 0;
float xx = 0;
- if(fr > f * 2 && fr < f * 2 + 16) xx = fr - f * 2;
- if(xx < 8) alpha = 255 * xx / 8;
- if(xx > 8) alpha = 255 * (1 - (xx - 8) / 8);
+ if (fr > f * 2 && fr < f * 2 + 16) xx = fr - f * 2;
+ if (xx < 8) alpha = 255 * xx / 8;
+ if (xx > 8) alpha = 255 * (1 - (xx - 8) / 8);
float yy = 16 * sin(3.141592 / 2 * xx / 16) - 8;
- if(alpha < 0) alpha = 0;
- if(alpha > 255) alpha = 255;
+ if (alpha < 0) alpha = 0;
+ if (alpha > 255) alpha = 255;
SDL_SetAlpha(spellimg, SDL_SRCALPHA, alpha);
@@ -7503,19 +7469,19 @@ void game_updspellsunder()
rcDest.x = xloc;
rcDest.y = yloc;
- if(xloc > -16 && xloc < 320 && yloc > -16 && yloc < 240) {
+ if (xloc > -16 && xloc < 320 && yloc > -16 && yloc < 240) {
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
- if(spellinfo[i].damagewho == 1) {
+ if (spellinfo[i].damagewho == 1) {
float xdif = (xloc + 8) - (player.px + 12);
float ydif = (yloc + 8) - (player.py + 12);
- if((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks && alpha > 64) {
+ if ((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks && alpha > 64) {
float damage = (float)npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
- if(player.hp > 0) {
+ if (player.hp > 0) {
game_damageplayer(damage);
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndfire], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -7530,9 +7496,9 @@ void game_updspellsunder()
SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
spellinfo[i].frame = spellinfo[i].frame - 0.5 * fpsr;
- if(spellinfo[i].frame < 0) spellinfo[i].frame = 0;
+ if (spellinfo[i].frame < 0) spellinfo[i].frame = 0;
- if(spellinfo[i].frame == 0) {
+ if (spellinfo[i].frame == 0) {
npcinfo[spellinfo[i].npc].attacking = 0;
npcinfo[spellinfo[i].npc].attacknext = ticks + npcinfo[spellinfo[i].npc].attackdelay;
}
@@ -7541,12 +7507,11 @@ void game_updspellsunder()
}
}
-void sys_initpaths()
-{
+void sys_initpaths() {
#ifdef __unix__
char line[256];
char *home = getenv("HOME");
- if(!home) return;
+ if (!home) return;
sprintf(line, "%s/.griffon", home);
mkdir(line, 0777);
@@ -7559,14 +7524,13 @@ void sys_initpaths()
#endif
}
-void sys_initialize()
-{
+void sys_initialize() {
int result;
sys_initpaths();
// init char *floatstri[MAXFLOAT]
- for(int i = 0; i < MAXFLOAT; i++)
+ for (int i = 0; i < MAXFLOAT; i++)
floatstri[i] = malloc(64); // 64 bytes each string (should be enough)
// set default values
@@ -7590,7 +7554,7 @@ void sys_initialize()
fullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
result = SDL_Init(SDL_INIT_EVERYTHING);
- if(result) {
+ if (result) {
printf("Failed to init SDL\n");
exit(1);
}
@@ -7598,7 +7562,7 @@ void sys_initialize()
atexit(SDL_Quit);
video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen); // SDL_FULLSCREEN
- if(!video) {
+ if (!video) {
printf("Failed to init Video\n");
exit(1);
}
@@ -7615,7 +7579,7 @@ void sys_initialize()
clipbg = SDL_CreateRGBSurface(SDL_SWSURFACE, 320, 240, config.scr_bpp, video->format->Rmask, video->format->Gmask, video->format->Bmask, video->format->Amask);
clipbg2 = SDL_DisplayFormat(video);
- for(int i = 0; i <= 3; i++) {
+ for (int i = 0; i <= 3; i++) {
char name[128];
sprintf(name, "art/map%i.bmp", i + 1);
@@ -7657,7 +7621,7 @@ void sys_initialize()
fpsr = 1;
nextticks = ticks + 1000;
- for(int i = 0; i <= 15; i++) {
+ for (int i = 0; i <= 15; i++) {
playerattackofs[0][i][0] = 0; // -1// -(i + 1)
playerattackofs[0][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2 - 1;
@@ -7674,8 +7638,7 @@ void sys_initialize()
sys_setupAudio();
}
-void sys_line(SDL_Surface *buffer, int x1, int y1, int x2, int y2, int col)
-{
+void sys_line(SDL_Surface *buffer, int x1, int y1, int x2, int y2, int col) {
unsigned int *temp;
SDL_LockSurface(buffer);
@@ -7683,15 +7646,15 @@ void sys_line(SDL_Surface *buffer, int x1, int y1, int x2, int y2, int col)
int xdif = x2 - x1;
int ydif = y2 - y1;
- if(xdif == 0) {
- for(int y = y1; y <= y2; y++) {
+ if (xdif == 0) {
+ for (int y = y1; y <= y2; y++) {
temp = buffer->pixels + y * buffer->pitch + x1 * buffer->format->BytesPerPixel;
*temp = col;
}
}
- if(ydif == 0) {
- for(int x = x1; x <= x2; x++) {
+ if (ydif == 0) {
+ for (int x = x1; x <= x2; x++) {
temp = buffer->pixels + y1 * buffer->pitch + x * buffer->format->BytesPerPixel;
*temp = col;
}
@@ -7700,8 +7663,7 @@ void sys_line(SDL_Surface *buffer, int x1, int y1, int x2, int y2, int col)
SDL_UnlockSurface(buffer);
}
-void sys_LoadAnims()
-{
+void sys_LoadAnims() {
spellimg = IMG_Load("art/spells.bmp");
SDL_SetColorKey(spellimg, SDL_SRCCOLORKEY, SDL_MapRGB(spellimg->format, 255, 0, 255));
@@ -7849,13 +7811,12 @@ void sys_LoadAnims()
SDL_SetColorKey(anims[12], SDL_SRCCOLORKEY, SDL_MapRGB(anims[12]->format, 255, 0, 255));
}
-void sys_LoadItemImgs()
-{
+void sys_LoadItemImgs() {
SDL_Surface *temp;
temp = IMG_Load("art/icons.bmp");
- for(int i = 0; i <= 20; i++) {
+ for (int i = 0; i <= 20; i++) {
itemimg[i] = SDL_CreateRGBSurface(SDL_SWSURFACE, 16, 16, config.scr_bpp, video->format->Rmask, video->format->Gmask, video->format->Bmask, video->format->Amask);
SDL_SetColorKey(itemimg[i], SDL_SRCCOLORKEY, SDL_MapRGB(itemimg[i]->format, 255, 0, 255));
@@ -7870,14 +7831,13 @@ void sys_LoadItemImgs()
SDL_FreeSurface(temp);
}
-void sys_LoadFont()
-{
+void sys_LoadFont() {
SDL_Surface *font;
font = IMG_Load("art/font.bmp");
- for(int i = 32; i <= 255; i++)
- for(int f = 0; f <= 4; f++) {
+ for (int i = 32; i <= 255; i++)
+ for (int f = 0; f <= 4; f++) {
int i2 = i - 32;
fontchr[i2][f] = SDL_CreateRGBSurface(SDL_SWSURFACE, 8, 8, config.scr_bpp, video->format->Rmask, video->format->Gmask, video->format->Bmask, video->format->Amask);
@@ -7900,29 +7860,27 @@ void sys_LoadFont()
SDL_FreeSurface(font);
}
-void sys_LoadTiles()
-{
+void sys_LoadTiles() {
tiles[0] = IMG_Load("art/tx.bmp");
tiles[1] = IMG_Load("art/tx1.bmp");
tiles[2] = IMG_Load("art/tx2.bmp");
tiles[3] = IMG_Load("art/tx3.bmp");
- for(int i = 0; i <= 3; i++)
+ for (int i = 0; i <= 3; i++)
SDL_SetColorKey(tiles[i], SDL_SRCCOLORKEY, SDL_MapRGB(tiles[i]->format, 255, 0, 255));
windowimg = IMG_Load("art/window.bmp");
SDL_SetColorKey(windowimg, SDL_SRCCOLORKEY, SDL_MapRGB(windowimg->format, 255, 0, 255));
}
-void sys_LoadTriggers()
-{
+void sys_LoadTriggers() {
FILE *fp;
char line[512];
fp = fopen("data/triggers.dat", "r");
- for(int i = 0; i <= 9999; i++)
- for(int a = 0; a <= 8; a++) {
+ for (int i = 0; i <= 9999; i++)
+ for (int a = 0; a <= 8; a++) {
fgets(line, sizeof(line), fp);
sscanf(line, "%i", &triggers[i][a]);
}
@@ -7930,23 +7888,22 @@ void sys_LoadTriggers()
fclose(fp);
}
-void sys_LoadObjectDB()
-{
+void sys_LoadObjectDB() {
FILE *fp;
char line[512];
fp = fopen("objectdb.dat", "r");
- for(int a = 0; a <= 32; a++) {
- for(int b = 0; b <= 5; b++) {
+ for (int a = 0; a <= 32; a++) {
+ for (int b = 0; b <= 5; b++) {
fgets(line, sizeof(line), fp);
sscanf(line, "%i", &objectinfo[a][b]);
}
- for(int b = 0; b <= 8; b++) {
- for(int c = 0; c <= 2; c++) {
- for(int d = 0; d <= 2; d++) {
- for(int e = 0; e <= 1; e++) {
+ for (int b = 0; b <= 8; b++) {
+ for (int c = 0; c <= 2; c++) {
+ for (int d = 0; d <= 2; d++) {
+ for (int e = 0; e <= 1; e++) {
fgets(line, sizeof(line), fp);
sscanf(line, "%i", &objecttile[a][b][c][d][e]);
}
@@ -7958,11 +7915,10 @@ void sys_LoadObjectDB()
fclose(fp);
}
-void sys_print(SDL_Surface *buffer, char *stri, int xloc, int yloc, int col)
-{
+void sys_print(SDL_Surface *buffer, char *stri, int xloc, int yloc, int col) {
int l = strlen(stri);
- for(int i = 0; i < l; i++) {
+ for (int i = 0; i < l; i++) {
rcDest.x = xloc + i * 8;
rcDest.y = yloc;
@@ -7970,8 +7926,7 @@ void sys_print(SDL_Surface *buffer, char *stri, int xloc, int yloc, int col)
}
}
-void sys_progress(int w, int wm)
-{
+void sys_progress(int w, int wm) {
long ccc;
ccc = SDL_MapRGB(videobuffer->format, 0, 255, 0);
@@ -7983,13 +7938,12 @@ void sys_progress(int w, int wm)
SDL_PumpEvents();
}
-void sys_setupAudio()
-{
+void sys_setupAudio() {
SDL_Surface *loadimg;
menabled = 1;
- if((Mix_Init(MIX_INIT_OGG) & MIX_INIT_OGG) != MIX_INIT_OGG) {
+ if ((Mix_Init(MIX_INIT_OGG) & MIX_INIT_OGG) != MIX_INIT_OGG) {
printf("Failed to init OGG support\n");
exit(1);
}
@@ -8024,7 +7978,7 @@ void sys_setupAudio()
rcDest.y = 116 + 12 + 12;
rcDest.h = 8;
- if(menabled == 1) {
+ if (menabled == 1) {
mboss = Mix_LoadWAV("music/boss.ogg");
sys_progress(1, 21);
mgardens = Mix_LoadWAV("music/gardens.ogg");
@@ -8072,8 +8026,7 @@ void sys_setupAudio()
}
}
-void sys_update()
-{
+void sys_update() {
unsigned int *temp, bgc;
int pa, sx, sy;
float opx, opy, spd;
@@ -8088,7 +8041,7 @@ void sys_update()
fpsr = (float)tickspassed / 24.0;
fp++;
- if(ticks > nextticks) {
+ if (ticks > nextticks) {
nextticks = ticks + 1000;
fps = fp;
fp = 0;
@@ -8097,9 +8050,9 @@ void sys_update()
SDL_LockSurface(clipbg);
- if(attacking == 1) {
+ if (attacking == 1) {
player.attackframe += player.attackspd * fpsr;
- if(player.attackframe >= 16) {
+ if (player.attackframe >= 16) {
attacking = 0;
player.attackframe = 0;
player.walkframe = 0;
@@ -8107,8 +8060,8 @@ void sys_update()
pa = (int)(player.attackframe);
- for(int i = 0; i <= pa; i++) {
- if(playerattackofs[player.walkdir][i][2] == 0) {
+ for (int i = 0; i <= pa; i++) {
+ if (playerattackofs[player.walkdir][i][2] == 0) {
playerattackofs[player.walkdir][i][2] = 1;
opx = player.px;
@@ -8121,7 +8074,7 @@ void sys_update()
sy = (int)(player.py / 2 + 10);
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
bgc = *temp;
- if(bgc > 0) {
+ if (bgc > 0) {
player.px = opx;
player.py = opy;
}
@@ -8134,37 +8087,37 @@ void sys_update()
game_checkhit();
}
- for(int i = 0; i < MAXFLOAT; i++) {
- if(floattext[i][0] > 0) {
+ for (int i = 0; i < MAXFLOAT; i++) {
+ if (floattext[i][0] > 0) {
spd = 0.5 * fpsr;
floattext[i][0] = floattext[i][0] - spd;
floattext[i][2] = floattext[i][2] - spd;
- if(floattext[i][0] < 0) floattext[i][0] = 0;
+ if (floattext[i][0] < 0) floattext[i][0] = 0;
}
- if(floaticon[i][0] > 0) {
+ if (floaticon[i][0] > 0) {
spd = 0.5 * fpsr;
floaticon[i][0] = floaticon[i][0] - spd;
floaticon[i][2] = floaticon[i][2] - spd;
- if(floaticon[i][0] < 0) floaticon[i][0] = 0;
+ if (floaticon[i][0] < 0) floaticon[i][0] = 0;
}
}
- if(player.level == player.maxlevel) player.exp = 0;
+ if (player.level == player.maxlevel) player.exp = 0;
- if(player.exp >= player.nextlevel) {
+ if (player.exp >= player.nextlevel) {
player.level = player.level + 1;
game_addFloatText("LEVEL UP!", player.px + 16 - 36, player.py + 16, 3);
player.exp = player.exp - player.nextlevel;
player.nextlevel = player.nextlevel * 3 / 2; // 1.5
player.maxhp = player.maxhp + player.level * 3;
- if(player.maxhp > 999) player.maxhp = 999;
+ if (player.maxhp > 999) player.maxhp = 999;
player.hp = player.maxhp;
player.sworddamage = player.level * 14 / 10;
player.spelldamage = player.level * 13 / 10;
- if(menabled == 1 && config.effects == 1) {
+ if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -8182,43 +8135,43 @@ void sys_update()
SDL_FillRect(clipbg, &rc, 1000);
- if(forcepause == 0) {
- for(int i = 0; i < 5; i++) {
- if(player.foundspell[i] == 1) player.spellcharge[i] += 1 * player.level * 0.01 * fpsr;
- if(player.spellcharge[i] > 100) player.spellcharge[i] = 100;
+ if (forcepause == 0) {
+ for (int i = 0; i < 5; i++) {
+ if (player.foundspell[i] == 1) player.spellcharge[i] += 1 * player.level * 0.01 * fpsr;
+ if (player.spellcharge[i] > 100) player.spellcharge[i] = 100;
}
- if(player.foundspell[0]) {
+ if (player.foundspell[0]) {
player.spellstrength += 3 * player.level * .01 * fpsr;
}
player.attackstrength += (30 + 3 * (float)player.level) / 50 * fpsr;
}
- if(player.attackstrength > 100) player.attackstrength = 100;
+ if (player.attackstrength > 100) player.attackstrength = 100;
- if(player.spellstrength > 100) player.spellstrength = 100;
+ if (player.spellstrength > 100) player.spellstrength = 100;
itemyloc += 0.75 * fpsr;
- while(itemyloc >= 16) itemyloc -= 16;
+ while (itemyloc >= 16) itemyloc -= 16;
- if(player.hp <= 0) game_theend();
+ if (player.hp <= 0) game_theend();
- if(roomlock == 1) {
+ if (roomlock == 1) {
roomlock = 0;
- for(int i = 1; i <= lastnpc; i++)
- if(npcinfo[i].hp > 0) roomlock = 1;
+ for (int i = 1; i <= lastnpc; i++)
+ if (npcinfo[i].hp > 0) roomlock = 1;
}
clouddeg += 0.1 * fpsr;
- while(clouddeg >= 360) clouddeg = clouddeg - 360;
+ while (clouddeg >= 360) clouddeg = clouddeg - 360;
player.hpflash = player.hpflash + 0.1 * fpsr;
- if(player.hpflash >=2) {
+ if (player.hpflash >= 2) {
player.hpflash = 0;
player.hpflashb = player.hpflashb + 1;
- if(player.hpflashb == 2) player.hpflashb = 0;
- if(menabled == 1 && config.effects == 1 && player.hpflashb == 0 && player.hp < player.maxhp / 4) {
+ if (player.hpflashb == 2) player.hpflashb = 0;
+ if (menabled == 1 && config.effects == 1 && player.hpflashb == 0 && player.hp < player.maxhp / 4) {
int snd = Mix_PlayChannel(-1, sfx[sndbeep], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -8226,9 +8179,9 @@ void sys_update()
// cloudson = 0
- if(itemselon == 1) player.itemselshade = player.itemselshade + 2 * fpsr;
- if(player.itemselshade > 24) player.itemselshade = 24;
+ if (itemselon == 1) player.itemselshade = player.itemselshade + 2 * fpsr;
+ if (player.itemselshade > 24) player.itemselshade = 24;
- for(int i = 0; i <= 4; i++)
- if(player.inventory[i] > 9) player.inventory[i] = 9;
+ for (int i = 0; i <= 4; i++)
+ if (player.inventory[i] > 9) player.inventory[i] = 9;
}
diff --git a/engines/griffon/engine.h b/engines/griffon/engine.h
index aec0e6e..1b50db2 100644
--- a/engines/griffon/engine.h
+++ b/engines/griffon/engine.h
@@ -18,182 +18,182 @@
#ifndef _GRIFFON_H_
#define _GRIFFON_H_
-#define MAXNPC 32
-#define MAXFLOAT 32
-#define MAXSPELL 32
+#define MAXNPC 32
+#define MAXFLOAT 32
+#define MAXSPELL 32
// spells
-#define ice 0
-#define steel 1
-#define wood 2
-#define rock 3
-#define fire 4
+#define ice 0
+#define steel 1
+#define wood 2
+#define rock 3
+#define fire 4
// inventory items
-#define INV_FLASK 0
-#define INV_DOUBLEFLASK 1
-#define INV_SHOCK 2
-#define INV_NORMALKEY 3
-#define INV_MASTERKEY 4
-
-#define sndbite 0
-#define sndcrystal 1
-#define snddoor 2
-#define sndenemyhit 3
-#define sndice 4
-#define sndlever 5
-#define sndlightning 6
-#define sndmetalhit 7
-#define sndpowerup 8
-#define sndrocks 9
-#define sndswordhit 10
-#define sndthrow 11
-#define sndchest 12
-#define sndfire 13
-#define sndbeep 14
+#define INV_FLASK 0
+#define INV_DOUBLEFLASK 1
+#define INV_SHOCK 2
+#define INV_NORMALKEY 3
+#define INV_MASTERKEY 4
+
+#define sndbite 0
+#define sndcrystal 1
+#define snddoor 2
+#define sndenemyhit 3
+#define sndice 4
+#define sndlever 5
+#define sndlightning 6
+#define sndmetalhit 7
+#define sndpowerup 8
+#define sndrocks 9
+#define sndswordhit 10
+#define sndthrow 11
+#define sndchest 12
+#define sndfire 13
+#define sndbeep 14
typedef struct {
- float px;
- float py;
- float opx;
- float opy;
- int walkdir;
- float walkframe;
- float walkspd;
- float attackframe;
- float attackspd;
-
- int hp;
- int maxhp;
- float hpflash;
- int hpflashb;
- int level;
- int maxlevel;
- int sword;
- int shield;
- int armour;
- int foundspell[5];
- float spellcharge[5];
- int inventory[5];
- float attackstrength;
- float spellstrength;
- int spelldamage;
- int sworddamage;
-
- int exp;
- int nextlevel;
-
- int pause;
-
- float itemselshade;
- int ysort;
+ float px;
+ float py;
+ float opx;
+ float opy;
+ int walkdir;
+ float walkframe;
+ float walkspd;
+ float attackframe;
+ float attackspd;
+
+ int hp;
+ int maxhp;
+ float hpflash;
+ int hpflashb;
+ int level;
+ int maxlevel;
+ int sword;
+ int shield;
+ int armour;
+ int foundspell[5];
+ float spellcharge[5];
+ int inventory[5];
+ float attackstrength;
+ float spellstrength;
+ int spelldamage;
+ int sworddamage;
+
+ int exp;
+ int nextlevel;
+
+ int pause;
+
+ float itemselshade;
+ int ysort;
} PLAYERTYPE;
typedef struct {
- float x;
- float y;
- int parentID;
- int isbase;
- int sprite;
- int bonelength; // the 'bone' that connects the body sections
+ float x;
+ float y;
+ int parentID;
+ int isbase;
+ int sprite;
+ int bonelength; // the 'bone' that connects the body sections
} BODYSECTIONTYPE;
typedef struct {
- float x;
- float y;
- int spriteset;
- int x1; // patrol area
- int y1;
- int x2;
- int y2;
- int attitude;
- int hp;
-
- int maxhp;
- int item1;
- int item2;
- int item3;
- int script;
- float frame;
- float frame2; // end boss specific
- int cframe;
- int onmap; // is this npc set to be genned in the mapfile
-
- int ticks;
- int pause;
- int shake;
-
- int movementmode;
- int walkdir;
- float walkspd;
- int movingdir;
- int moving;
-
- int attacking;
- float attackframe;
- int cattackframe;
- float attackspd;
- int attackdelay;
- int attacknext;
- int attackattempt;
-
- int spelldamage;
- int attackdamage;
+ float x;
+ float y;
+ int spriteset;
+ int x1; // patrol area
+ int y1;
+ int x2;
+ int y2;
+ int attitude;
+ int hp;
+
+ int maxhp;
+ int item1;
+ int item2;
+ int item3;
+ int script;
+ float frame;
+ float frame2; // end boss specific
+ int cframe;
+ int onmap; // is this npc set to be genned in the mapfile
+
+ int ticks;
+ int pause;
+ int shake;
+
+ int movementmode;
+ int walkdir;
+ float walkspd;
+ int movingdir;
+ int moving;
+
+ int attacking;
+ float attackframe;
+ int cattackframe;
+ float attackspd;
+ int attackdelay;
+ int attacknext;
+ int attackattempt;
+
+ int spelldamage;
+ int attackdamage;
// one wing and firehydra specific
BODYSECTIONTYPE bodysection[31];
- float swayangle;
- float swayspd;
- float headtargetx[4];
- float headtargety[4];
- int castpause;
+ float swayangle;
+ float swayspd;
+ float headtargetx[4];
+ float headtargety[4];
+ int castpause;
// firehydra specific
- int attacknext2[4];
- int attacking2[4];
- int attackframe2[4];
+ int attacknext2[4];
+ int attacking2[4];
+ int attackframe2[4];
// dragon2 specific
- float floating;
+ float floating;
} NPCTYPE;
typedef struct {
- int spellnum;
- float homex;
- float homey;
- float enemyx;
- float enemyy;
+ int spellnum;
+ float homex;
+ float homey;
+ float enemyx;
+ float enemyy;
- float frame;
+ float frame;
- int damagewho; // 0 = npc, 1 = player
+ int damagewho; // 0 = npc, 1 = player
// for earthslide
- float rocky[9];
- int rockimg[9];
- int rockdeflect[9];
+ float rocky[9];
+ int rockimg[9];
+ int rockdeflect[9];
- float strength;
+ float strength;
// fire
- int legalive[5];
+ int legalive[5];
// spell 6 specific
- float fireballs[7][4]; // x,y,targetx, targety
- int nfballs;
- int ballon[7];
+ float fireballs[7][4]; // x,y,targetx, targety
+ int nfballs;
+ int ballon[7];
- int npc;
+ int npc;
} SPELLTYPE;
typedef struct {
- int x; // xyloc on spriteimageset
- int y;
- int xofs; // the actual place to paste the sprite in reference to the bodypart loc on screen
- int yofs;
- int w; // w/h of the sprite in the imageset
- int h;
+ int x; // xyloc on spriteimageset
+ int y;
+ int xofs; // the actual place to paste the sprite in reference to the bodypart loc on screen
+ int yofs;
+ int w; // w/h of the sprite in the imageset
+ int h;
} ANIMSET2TYPE;
extern PLAYERTYPE player;
diff --git a/engines/griffon/state.cpp b/engines/griffon/state.cpp
index a68132e..6406ab8 100644
--- a/engines/griffon/state.cpp
+++ b/engines/griffon/state.cpp
@@ -28,36 +28,35 @@
char player_sav[256] = "data/player%i.sav";
-#define PRINT(A,B) \
-do { \
- char line[256]; \
- sprintf(line, A "\n", B); \
- fputs(line, fp); \
-} while(0)
-
-#define INPUT(A, B) \
-do { \
- char line[256]; \
- fgets(line, sizeof(line), fp); \
- sscanf(line, A, B); \
-} while(0)
+#define PRINT(A,B) \
+ do { \
+ char line[256]; \
+ sprintf(line, A "\n", B); \
+ fputs(line, fp); \
+ } while(0)
+
+#define INPUT(A, B) \
+ do { \
+ char line[256]; \
+ fgets(line, sizeof(line), fp); \
+ sscanf(line, A, B); \
+ } while(0)
// externs (to be removed later)
extern PLAYERTYPE playera;
extern int asecstart;
-int state_load(int slotnum)
-{
+int state_load(int slotnum) {
FILE *fp;
char line[256];
sprintf(line, player_sav, slotnum);
fp = fopen(line, "r");
- if(fp) {
+ if (fp) {
INPUT("%i", &player.level);
- if(player.level > 0) {
+ if (player.level > 0) {
INPUT("%i", &secstart);
INPUT("%s", line);
@@ -78,11 +77,11 @@ int state_load(int slotnum)
INPUT("%i", &player.sword);
INPUT("%i", &player.shield);
INPUT("%i", &player.armour);
- for(int i = 0; i < 5; i++) {
+ for (int i = 0; i < 5; i++) {
INPUT("%i", &player.foundspell[i]);
INPUT("%f", &player.spellcharge[i]);
}
- for(int a = 0; a < 5; a++) {
+ for (int a = 0; a < 5; a++) {
INPUT("%i", &player.inventory[a]);
}
INPUT("%f", &player.attackstrength);
@@ -90,22 +89,22 @@ int state_load(int slotnum)
INPUT("%i", &player.sworddamage);
INPUT("%i", &player.exp);
INPUT("%i", &player.nextlevel);
- for(int a = 0; a <= 99; a++) {
- for(int b = 0; b <= 9; b++) {
+ for (int a = 0; a <= 99; a++) {
+ for (int b = 0; b <= 9; b++) {
INPUT("%i", &scriptflag[a][b]);
}
}
INPUT("%i", &curmap);
- for(int a = 0; a <= 999; a++) {
- for(int b = 0; b <= 20; b++) {
- for(int c = 0; c <= 14; c++) {
+ for (int a = 0; a <= 999; a++) {
+ for (int b = 0; b <= 20; b++) {
+ for (int c = 0; c <= 14; c++) {
INPUT("%i", &objmapf[a][b][c]);
}
}
}
- for(int a = 0; a <= 200; a++) {
+ for (int a = 0; a <= 200; a++) {
INPUT("%i", &roomlocks[a]);
}
@@ -123,8 +122,7 @@ int state_load(int slotnum)
}
/* fill PLAYERTYPE playera; */
-int state_load_player(int slotnum)
-{
+int state_load_player(int slotnum) {
FILE *fp;
char line[256];
@@ -133,10 +131,10 @@ int state_load_player(int slotnum)
playera.level = 0;
fp = fopen(line, "r");
- if(fp) {
+ if (fp) {
INPUT("%i", &playera.level);
- if(playera.level > 0) {
+ if (playera.level > 0) {
INPUT("%i", &asecstart);
INPUT("%s", line);
@@ -157,11 +155,11 @@ int state_load_player(int slotnum)
INPUT("%i", &playera.sword);
INPUT("%i", &playera.shield);
INPUT("%i", &playera.armour);
- for(int i = 0; i < 5; i++) {
+ for (int i = 0; i < 5; i++) {
INPUT("%i", &playera.foundspell[i]);
INPUT("%f", &playera.spellcharge[i]);
}
- for(int a = 0; a < 5; a++) {
+ for (int a = 0; a < 5; a++) {
INPUT("%i", &playera.inventory[a]);
}
INPUT("%f", &playera.attackstrength);
@@ -181,18 +179,17 @@ int state_load_player(int slotnum)
return 0; // fail
}
-int state_save(int slotnum)
-{
+int state_save(int slotnum) {
FILE *fp;
char line[256];
sprintf(line, player_sav, slotnum);
fp = fopen(line, "w");
- if(fp) {
+ if (fp) {
PRINT("%i", player.level);
- if(player.level > 0) {
+ if (player.level > 0) {
PRINT("%i", (secstart + secsingame));
PRINT("%s", "a");
@@ -213,11 +210,11 @@ int state_save(int slotnum)
PRINT("%i", player.sword);
PRINT("%i", player.shield);
PRINT("%i", player.armour);
- for(int i = 0; i < 5; i++) {
+ for (int i = 0; i < 5; i++) {
PRINT("%i", player.foundspell[i]);
PRINT("%f", player.spellcharge[i]);
}
- for(int a = 0; a < 5; a++) {
+ for (int a = 0; a < 5; a++) {
PRINT("%i", player.inventory[a]);
}
PRINT("%f", player.attackstrength);
@@ -225,22 +222,22 @@ int state_save(int slotnum)
PRINT("%i", player.sworddamage);
PRINT("%i", player.exp);
PRINT("%i", player.nextlevel);
- for(int a = 0; a <= 99; a++) {
- for(int b = 0; b <= 9; b++) {
+ for (int a = 0; a <= 99; a++) {
+ for (int b = 0; b <= 9; b++) {
PRINT("%i", scriptflag[a][b]);
}
}
PRINT("%i", curmap);
- for(int a = 0; a <= 999; a++) {
- for(int b = 0; b <= 20; b++) {
- for(int c = 0; c <= 14; c++) {
+ for (int a = 0; a <= 999; a++) {
+ for (int b = 0; b <= 20; b++) {
+ for (int c = 0; c <= 14; c++) {
PRINT("%i", objmapf[a][b][c]);
}
}
}
- for(int a = 0; a <= 200; a++) {
+ for (int a = 0; a <= 200; a++) {
PRINT("%i", roomlocks[a]);
}
Commit: f73cd4e57a2c17137aec378f8769a8bca010f3dc
https://github.com/scummvm/scummvm/commit/f73cd4e57a2c17137aec378f8769a8bca010f3dc
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Added proper copyright headers
Changed paths:
engines/griffon/config.cpp
engines/griffon/config.h
engines/griffon/engine.cpp
engines/griffon/engine.h
engines/griffon/state.cpp
engines/griffon/state.h
diff --git a/engines/griffon/config.cpp b/engines/griffon/config.cpp
index d430380..8a53b4b 100644
--- a/engines/griffon/config.cpp
+++ b/engines/griffon/config.cpp
@@ -1,8 +1,13 @@
-/*
- * 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.
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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
@@ -11,7 +16,21 @@
*
* 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
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Originally written by Syn9 in FreeBASIC with SDL
+ * http://syn9.thehideoutgames.com/index_backup.php
+ *
+ * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
+ * http://github.com/dmitrysmagin/griffon_legend
+ *
+ *
+ * Programming/Graphics: Daniel "Syn9" Kennedy
+ * Music/Sound effects: David Turner
+ *
+ * Beta testing and gameplay design help:
+ * Deleter, Cha0s, Aether Fox, and Kiz
*
*/
diff --git a/engines/griffon/config.h b/engines/griffon/config.h
index f0af9b9..3ff469f 100644
--- a/engines/griffon/config.h
+++ b/engines/griffon/config.h
@@ -1,8 +1,13 @@
-/*
- * 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.
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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
@@ -11,7 +16,21 @@
*
* 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
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Originally written by Syn9 in FreeBASIC with SDL
+ * http://syn9.thehideoutgames.com/index_backup.php
+ *
+ * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
+ * http://github.com/dmitrysmagin/griffon_legend
+ *
+ *
+ * Programming/Graphics: Daniel "Syn9" Kennedy
+ * Music/Sound effects: David Turner
+ *
+ * Beta testing and gameplay design help:
+ * Deleter, Cha0s, Aether Fox, and Kiz
*
*/
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 228b5d1..cc913cb 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -1,8 +1,13 @@
-/*
- * 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.
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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
@@ -11,7 +16,21 @@
*
* 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
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Originally written by Syn9 in FreeBASIC with SDL
+ * http://syn9.thehideoutgames.com/index_backup.php
+ *
+ * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
+ * http://github.com/dmitrysmagin/griffon_legend
+ *
+ *
+ * Programming/Graphics: Daniel "Syn9" Kennedy
+ * Music/Sound effects: David Turner
+ *
+ * Beta testing and gameplay design help:
+ * Deleter, Cha0s, Aether Fox, and Kiz
*
*/
diff --git a/engines/griffon/engine.h b/engines/griffon/engine.h
index 1b50db2..e76e088 100644
--- a/engines/griffon/engine.h
+++ b/engines/griffon/engine.h
@@ -1,8 +1,13 @@
-/*
- * 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.
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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
@@ -11,7 +16,21 @@
*
* 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
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Originally written by Syn9 in FreeBASIC with SDL
+ * http://syn9.thehideoutgames.com/index_backup.php
+ *
+ * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
+ * http://github.com/dmitrysmagin/griffon_legend
+ *
+ *
+ * Programming/Graphics: Daniel "Syn9" Kennedy
+ * Music/Sound effects: David Turner
+ *
+ * Beta testing and gameplay design help:
+ * Deleter, Cha0s, Aether Fox, and Kiz
*
*/
diff --git a/engines/griffon/state.cpp b/engines/griffon/state.cpp
index 6406ab8..372a454 100644
--- a/engines/griffon/state.cpp
+++ b/engines/griffon/state.cpp
@@ -1,8 +1,13 @@
-/*
- * 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.
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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
@@ -11,7 +16,21 @@
*
* 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
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Originally written by Syn9 in FreeBASIC with SDL
+ * http://syn9.thehideoutgames.com/index_backup.php
+ *
+ * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
+ * http://github.com/dmitrysmagin/griffon_legend
+ *
+ *
+ * Programming/Graphics: Daniel "Syn9" Kennedy
+ * Music/Sound effects: David Turner
+ *
+ * Beta testing and gameplay design help:
+ * Deleter, Cha0s, Aether Fox, and Kiz
*
*/
diff --git a/engines/griffon/state.h b/engines/griffon/state.h
index d7f93aa..88ff083 100644
--- a/engines/griffon/state.h
+++ b/engines/griffon/state.h
@@ -1,8 +1,13 @@
-/*
- * 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.
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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
@@ -11,7 +16,21 @@
*
* 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
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Originally written by Syn9 in FreeBASIC with SDL
+ * http://syn9.thehideoutgames.com/index_backup.php
+ *
+ * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
+ * http://github.com/dmitrysmagin/griffon_legend
+ *
+ *
+ * Programming/Graphics: Daniel "Syn9" Kennedy
+ * Music/Sound effects: David Turner
+ *
+ * Beta testing and gameplay design help:
+ * Deleter, Cha0s, Aether Fox, and Kiz
*
*/
Commit: c8769b384601c0e6d14b43f36887cbf8d2bd595a
https://github.com/scummvm/scummvm/commit/c8769b384601c0e6d14b43f36887cbf8d2bd595a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Added namespaces and include guards
Changed paths:
engines/griffon/config.cpp
engines/griffon/config.h
engines/griffon/engine.cpp
engines/griffon/engine.h
engines/griffon/state.cpp
engines/griffon/state.h
diff --git a/engines/griffon/config.cpp b/engines/griffon/config.cpp
index 8a53b4b..aa57429 100644
--- a/engines/griffon/config.cpp
+++ b/engines/griffon/config.cpp
@@ -34,15 +34,10 @@
*
*/
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include <sys/stat.h>
-#include <SDL/SDL.h>
+#include "griffon/config.h"
-#include "config.h"
+namespace Griffon {
CONFIG config = {
320, 240, 16, 0, 0, 0, 1, 127, 1, 127
@@ -138,3 +133,5 @@ void config_save(CONFIG *config) {
fclose(fp);
}
}
+
+} // end of namespace Griffon
diff --git a/engines/griffon/config.h b/engines/griffon/config.h
index 3ff469f..7765918 100644
--- a/engines/griffon/config.h
+++ b/engines/griffon/config.h
@@ -34,8 +34,10 @@
*
*/
-#ifndef _CONFIG_H_
-#define _CONFIG_H_
+#ifndef GRIFFON_CONFIG_H
+#define GRIFFON_CONFIG_H
+
+namespace Griffon {
typedef struct {
int scr_width;
@@ -56,4 +58,6 @@ extern char config_ini[];
void config_load(CONFIG *config);
void config_save(CONFIG *config);
-#endif // _CONFIG_H_
+} // end of namespace Griffon
+
+#endif
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index cc913cb..188fb34 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -34,20 +34,11 @@
*
*/
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include <sys/stat.h>
+#include "griffon/griffon.h"
+#include "griffon/config.h"
+#include "griffon/state.h"
-#include <SDL/SDL.h>
-#include <SDL/SDL_image.h>
-#include <SDL/SDL_mixer.h>
-#include <SDL/SDL_rotozoom.h>
-
-#include "griffon.h"
-#include "config.h"
-#include "state.h"
+namespace Griffon {
// memo
/*
@@ -8204,3 +8195,5 @@ void sys_update() {
for (int i = 0; i <= 4; i++)
if (player.inventory[i] > 9) player.inventory[i] = 9;
}
+
+} // end of namespace Griffon
diff --git a/engines/griffon/engine.h b/engines/griffon/engine.h
index e76e088..1599866 100644
--- a/engines/griffon/engine.h
+++ b/engines/griffon/engine.h
@@ -34,8 +34,10 @@
*
*/
-#ifndef _GRIFFON_H_
-#define _GRIFFON_H_
+#ifndef GRIFFON_ENGINE_H
+#define GRIFFON_ENGINE_H
+
+namespace Griffon {
#define MAXNPC 32
#define MAXFLOAT 32
@@ -270,4 +272,6 @@ void sys_LoadObjectDB();
void sys_setupAudio();
void sys_update();
-#endif // _GRIFFON_H_
+} // end of namespace Griffon
+
+#endif
diff --git a/engines/griffon/state.cpp b/engines/griffon/state.cpp
index 372a454..a1ec297 100644
--- a/engines/griffon/state.cpp
+++ b/engines/griffon/state.cpp
@@ -1,272 +1,268 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- *
- * Originally written by Syn9 in FreeBASIC with SDL
- * http://syn9.thehideoutgames.com/index_backup.php
- *
- * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
- * http://github.com/dmitrysmagin/griffon_legend
- *
- *
- * Programming/Graphics: Daniel "Syn9" Kennedy
- * Music/Sound effects: David Turner
- *
- * Beta testing and gameplay design help:
- * Deleter, Cha0s, Aether Fox, and Kiz
- *
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include <sys/stat.h>
-
-#include <SDL/SDL.h>
-
-#include "griffon.h"
-#include "state.h"
-
-char player_sav[256] = "data/player%i.sav";
-
-#define PRINT(A,B) \
- do { \
- char line[256]; \
- sprintf(line, A "\n", B); \
- fputs(line, fp); \
- } while(0)
-
-#define INPUT(A, B) \
- do { \
- char line[256]; \
- fgets(line, sizeof(line), fp); \
- sscanf(line, A, B); \
- } while(0)
-
-// externs (to be removed later)
-extern PLAYERTYPE playera;
-extern int asecstart;
-
-int state_load(int slotnum) {
- FILE *fp;
- char line[256];
-
- sprintf(line, player_sav, slotnum);
-
- fp = fopen(line, "r");
- if (fp) {
- INPUT("%i", &player.level);
-
- if (player.level > 0) {
- INPUT("%i", &secstart);
- INPUT("%s", line);
-
- INPUT("%f", &player.px);
- INPUT("%f", &player.py);
- INPUT("%f", &player.opx);
- INPUT("%f", &player.opy);
- INPUT("%i", &player.walkdir);
- INPUT("%f", &player.walkframe);
- INPUT("%f", &player.walkspd);
- INPUT("%f", &player.attackframe);
- INPUT("%f", &player.attackspd);
- INPUT("%i", &player.hp);
- INPUT("%i", &player.maxhp);
- INPUT("%f", &player.hpflash);
- INPUT("%i", &player.level);
- INPUT("%i", &player.maxlevel);
- INPUT("%i", &player.sword);
- INPUT("%i", &player.shield);
- INPUT("%i", &player.armour);
- for (int i = 0; i < 5; i++) {
- INPUT("%i", &player.foundspell[i]);
- INPUT("%f", &player.spellcharge[i]);
- }
- for (int a = 0; a < 5; a++) {
- INPUT("%i", &player.inventory[a]);
- }
- INPUT("%f", &player.attackstrength);
- INPUT("%i", &player.spelldamage);
- INPUT("%i", &player.sworddamage);
- INPUT("%i", &player.exp);
- INPUT("%i", &player.nextlevel);
- for (int a = 0; a <= 99; a++) {
- for (int b = 0; b <= 9; b++) {
- INPUT("%i", &scriptflag[a][b]);
- }
- }
- INPUT("%i", &curmap);
-
- for (int a = 0; a <= 999; a++) {
- for (int b = 0; b <= 20; b++) {
- for (int c = 0; c <= 14; c++) {
- INPUT("%i", &objmapf[a][b][c]);
- }
- }
- }
-
- for (int a = 0; a <= 200; a++) {
- INPUT("%i", &roomlocks[a]);
- }
-
- INPUT("%f", &player.spellstrength);
-
- fclose(fp);
-
- return 1; // success
- }
-
- fclose(fp);
- }
-
- return 0; // fail
-}
-
-/* fill PLAYERTYPE playera; */
-int state_load_player(int slotnum) {
- FILE *fp;
- char line[256];
-
- sprintf(line, player_sav, slotnum);
-
- playera.level = 0;
-
- fp = fopen(line, "r");
- if (fp) {
- INPUT("%i", &playera.level);
-
- if (playera.level > 0) {
- INPUT("%i", &asecstart);
- INPUT("%s", line);
-
- INPUT("%f", &playera.px);
- INPUT("%f", &playera.py);
- INPUT("%f", &playera.opx);
- INPUT("%f", &playera.opy);
- INPUT("%i", &playera.walkdir);
- INPUT("%f", &playera.walkframe);
- INPUT("%f", &playera.walkspd);
- INPUT("%f", &playera.attackframe);
- INPUT("%f", &playera.attackspd);
- INPUT("%i", &playera.hp);
- INPUT("%i", &playera.maxhp);
- INPUT("%f", &playera.hpflash);
- INPUT("%i", &playera.level);
- INPUT("%i", &playera.maxlevel);
- INPUT("%i", &playera.sword);
- INPUT("%i", &playera.shield);
- INPUT("%i", &playera.armour);
- for (int i = 0; i < 5; i++) {
- INPUT("%i", &playera.foundspell[i]);
- INPUT("%f", &playera.spellcharge[i]);
- }
- for (int a = 0; a < 5; a++) {
- INPUT("%i", &playera.inventory[a]);
- }
- INPUT("%f", &playera.attackstrength);
- INPUT("%i", &playera.spelldamage);
- INPUT("%i", &playera.sworddamage);
- INPUT("%i", &playera.exp);
- INPUT("%i", &playera.nextlevel);
-
- fclose(fp);
-
- return 1; // success
- }
-
- fclose(fp);
- }
-
- return 0; // fail
-}
-
-int state_save(int slotnum) {
- FILE *fp;
- char line[256];
-
- sprintf(line, player_sav, slotnum);
-
- fp = fopen(line, "w");
- if (fp) {
- PRINT("%i", player.level);
-
- if (player.level > 0) {
- PRINT("%i", (secstart + secsingame));
- PRINT("%s", "a");
-
- PRINT("%f", player.px);
- PRINT("%f", player.py);
- PRINT("%f", player.opx);
- PRINT("%f", player.opy);
- PRINT("%i", player.walkdir);
- PRINT("%f", player.walkframe);
- PRINT("%f", player.walkspd);
- PRINT("%f", player.attackframe);
- PRINT("%f", player.attackspd);
- PRINT("%i", player.hp);
- PRINT("%i", player.maxhp);
- PRINT("%f", player.hpflash);
- PRINT("%i", player.level);
- PRINT("%i", player.maxlevel);
- PRINT("%i", player.sword);
- PRINT("%i", player.shield);
- PRINT("%i", player.armour);
- for (int i = 0; i < 5; i++) {
- PRINT("%i", player.foundspell[i]);
- PRINT("%f", player.spellcharge[i]);
- }
- for (int a = 0; a < 5; a++) {
- PRINT("%i", player.inventory[a]);
- }
- PRINT("%f", player.attackstrength);
- PRINT("%i", player.spelldamage);
- PRINT("%i", player.sworddamage);
- PRINT("%i", player.exp);
- PRINT("%i", player.nextlevel);
- for (int a = 0; a <= 99; a++) {
- for (int b = 0; b <= 9; b++) {
- PRINT("%i", scriptflag[a][b]);
- }
- }
- PRINT("%i", curmap);
-
- for (int a = 0; a <= 999; a++) {
- for (int b = 0; b <= 20; b++) {
- for (int c = 0; c <= 14; c++) {
- PRINT("%i", objmapf[a][b][c]);
- }
- }
- }
-
- for (int a = 0; a <= 200; a++) {
- PRINT("%i", roomlocks[a]);
- }
-
- PRINT("%f", player.spellstrength);
- }
-
- fclose(fp);
-
- return 1; // success
- }
-
- return 0; // fail
-}
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Originally written by Syn9 in FreeBASIC with SDL
+ * http://syn9.thehideoutgames.com/index_backup.php
+ *
+ * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
+ * http://github.com/dmitrysmagin/griffon_legend
+ *
+ *
+ * Programming/Graphics: Daniel "Syn9" Kennedy
+ * Music/Sound effects: David Turner
+ *
+ * Beta testing and gameplay design help:
+ * Deleter, Cha0s, Aether Fox, and Kiz
+ *
+ */
+
+#include "griffon/griffon.h"
+#include "griffon/state.h"
+
+namespace Griffon {
+
+char player_sav[256] = "data/player%i.sav";
+
+#define PRINT(A,B) \
+ do { \
+ char line[256]; \
+ sprintf(line, A "\n", B); \
+ fputs(line, fp); \
+ } while(0)
+
+#define INPUT(A, B) \
+ do { \
+ char line[256]; \
+ fgets(line, sizeof(line), fp); \
+ sscanf(line, A, B); \
+ } while(0)
+
+// externs (to be removed later)
+extern PLAYERTYPE playera;
+extern int asecstart;
+
+int state_load(int slotnum) {
+ FILE *fp;
+ char line[256];
+
+ sprintf(line, player_sav, slotnum);
+
+ fp = fopen(line, "r");
+ if (fp) {
+ INPUT("%i", &player.level);
+
+ if (player.level > 0) {
+ INPUT("%i", &secstart);
+ INPUT("%s", line);
+
+ INPUT("%f", &player.px);
+ INPUT("%f", &player.py);
+ INPUT("%f", &player.opx);
+ INPUT("%f", &player.opy);
+ INPUT("%i", &player.walkdir);
+ INPUT("%f", &player.walkframe);
+ INPUT("%f", &player.walkspd);
+ INPUT("%f", &player.attackframe);
+ INPUT("%f", &player.attackspd);
+ INPUT("%i", &player.hp);
+ INPUT("%i", &player.maxhp);
+ INPUT("%f", &player.hpflash);
+ INPUT("%i", &player.level);
+ INPUT("%i", &player.maxlevel);
+ INPUT("%i", &player.sword);
+ INPUT("%i", &player.shield);
+ INPUT("%i", &player.armour);
+ for (int i = 0; i < 5; i++) {
+ INPUT("%i", &player.foundspell[i]);
+ INPUT("%f", &player.spellcharge[i]);
+ }
+ for (int a = 0; a < 5; a++) {
+ INPUT("%i", &player.inventory[a]);
+ }
+ INPUT("%f", &player.attackstrength);
+ INPUT("%i", &player.spelldamage);
+ INPUT("%i", &player.sworddamage);
+ INPUT("%i", &player.exp);
+ INPUT("%i", &player.nextlevel);
+ for (int a = 0; a <= 99; a++) {
+ for (int b = 0; b <= 9; b++) {
+ INPUT("%i", &scriptflag[a][b]);
+ }
+ }
+ INPUT("%i", &curmap);
+
+ for (int a = 0; a <= 999; a++) {
+ for (int b = 0; b <= 20; b++) {
+ for (int c = 0; c <= 14; c++) {
+ INPUT("%i", &objmapf[a][b][c]);
+ }
+ }
+ }
+
+ for (int a = 0; a <= 200; a++) {
+ INPUT("%i", &roomlocks[a]);
+ }
+
+ INPUT("%f", &player.spellstrength);
+
+ fclose(fp);
+
+ return 1; // success
+ }
+
+ fclose(fp);
+ }
+
+ return 0; // fail
+}
+
+/* fill PLAYERTYPE playera; */
+int state_load_player(int slotnum) {
+ FILE *fp;
+ char line[256];
+
+ sprintf(line, player_sav, slotnum);
+
+ playera.level = 0;
+
+ fp = fopen(line, "r");
+ if (fp) {
+ INPUT("%i", &playera.level);
+
+ if (playera.level > 0) {
+ INPUT("%i", &asecstart);
+ INPUT("%s", line);
+
+ INPUT("%f", &playera.px);
+ INPUT("%f", &playera.py);
+ INPUT("%f", &playera.opx);
+ INPUT("%f", &playera.opy);
+ INPUT("%i", &playera.walkdir);
+ INPUT("%f", &playera.walkframe);
+ INPUT("%f", &playera.walkspd);
+ INPUT("%f", &playera.attackframe);
+ INPUT("%f", &playera.attackspd);
+ INPUT("%i", &playera.hp);
+ INPUT("%i", &playera.maxhp);
+ INPUT("%f", &playera.hpflash);
+ INPUT("%i", &playera.level);
+ INPUT("%i", &playera.maxlevel);
+ INPUT("%i", &playera.sword);
+ INPUT("%i", &playera.shield);
+ INPUT("%i", &playera.armour);
+ for (int i = 0; i < 5; i++) {
+ INPUT("%i", &playera.foundspell[i]);
+ INPUT("%f", &playera.spellcharge[i]);
+ }
+ for (int a = 0; a < 5; a++) {
+ INPUT("%i", &playera.inventory[a]);
+ }
+ INPUT("%f", &playera.attackstrength);
+ INPUT("%i", &playera.spelldamage);
+ INPUT("%i", &playera.sworddamage);
+ INPUT("%i", &playera.exp);
+ INPUT("%i", &playera.nextlevel);
+
+ fclose(fp);
+
+ return 1; // success
+ }
+
+ fclose(fp);
+ }
+
+ return 0; // fail
+}
+
+int state_save(int slotnum) {
+ FILE *fp;
+ char line[256];
+
+ sprintf(line, player_sav, slotnum);
+
+ fp = fopen(line, "w");
+ if (fp) {
+ PRINT("%i", player.level);
+
+ if (player.level > 0) {
+ PRINT("%i", (secstart + secsingame));
+ PRINT("%s", "a");
+
+ PRINT("%f", player.px);
+ PRINT("%f", player.py);
+ PRINT("%f", player.opx);
+ PRINT("%f", player.opy);
+ PRINT("%i", player.walkdir);
+ PRINT("%f", player.walkframe);
+ PRINT("%f", player.walkspd);
+ PRINT("%f", player.attackframe);
+ PRINT("%f", player.attackspd);
+ PRINT("%i", player.hp);
+ PRINT("%i", player.maxhp);
+ PRINT("%f", player.hpflash);
+ PRINT("%i", player.level);
+ PRINT("%i", player.maxlevel);
+ PRINT("%i", player.sword);
+ PRINT("%i", player.shield);
+ PRINT("%i", player.armour);
+ for (int i = 0; i < 5; i++) {
+ PRINT("%i", player.foundspell[i]);
+ PRINT("%f", player.spellcharge[i]);
+ }
+ for (int a = 0; a < 5; a++) {
+ PRINT("%i", player.inventory[a]);
+ }
+ PRINT("%f", player.attackstrength);
+ PRINT("%i", player.spelldamage);
+ PRINT("%i", player.sworddamage);
+ PRINT("%i", player.exp);
+ PRINT("%i", player.nextlevel);
+ for (int a = 0; a <= 99; a++) {
+ for (int b = 0; b <= 9; b++) {
+ PRINT("%i", scriptflag[a][b]);
+ }
+ }
+ PRINT("%i", curmap);
+
+ for (int a = 0; a <= 999; a++) {
+ for (int b = 0; b <= 20; b++) {
+ for (int c = 0; c <= 14; c++) {
+ PRINT("%i", objmapf[a][b][c]);
+ }
+ }
+ }
+
+ for (int a = 0; a <= 200; a++) {
+ PRINT("%i", roomlocks[a]);
+ }
+
+ PRINT("%f", player.spellstrength);
+ }
+
+ fclose(fp);
+
+ return 1; // success
+ }
+
+ return 0; // fail
+}
+
+} // end of namespace Griffon
diff --git a/engines/griffon/state.h b/engines/griffon/state.h
index 88ff083..c479f9d 100644
--- a/engines/griffon/state.h
+++ b/engines/griffon/state.h
@@ -34,8 +34,10 @@
*
*/
-#ifndef _STATE_H_
-#define _STATE_H_
+#ifndef GRIFFON_STATE_H
+#define GRIFFON_STATE_H
+
+namespace Griffon {
extern char player_sav[];
@@ -43,4 +45,6 @@ int state_load(int slotnum);
int state_load_player(int slotnum);
int state_save(int slotnum);
-#endif // _STATE_H_
+} // end of namespace Griffon
+
+#endif
Commit: 1a38a0e8ec1e0849eef2a2456c5d7023d22a1c9f
https://github.com/scummvm/scummvm/commit/1a38a0e8ec1e0849eef2a2456c5d7023d22a1c9f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
JANITORIAL: Fix line endings
Changed paths:
engines/griffon/state.h
diff --git a/engines/griffon/state.h b/engines/griffon/state.h
index c479f9d..ac8ccb1 100644
--- a/engines/griffon/state.h
+++ b/engines/griffon/state.h
@@ -1,50 +1,50 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- *
- * Originally written by Syn9 in FreeBASIC with SDL
- * http://syn9.thehideoutgames.com/index_backup.php
- *
- * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
- * http://github.com/dmitrysmagin/griffon_legend
- *
- *
- * Programming/Graphics: Daniel "Syn9" Kennedy
- * Music/Sound effects: David Turner
- *
- * Beta testing and gameplay design help:
- * Deleter, Cha0s, Aether Fox, and Kiz
- *
- */
-
-#ifndef GRIFFON_STATE_H
-#define GRIFFON_STATE_H
-
-namespace Griffon {
-
-extern char player_sav[];
-
-int state_load(int slotnum);
-int state_load_player(int slotnum);
-int state_save(int slotnum);
-
-} // end of namespace Griffon
-
-#endif
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Originally written by Syn9 in FreeBASIC with SDL
+ * http://syn9.thehideoutgames.com/index_backup.php
+ *
+ * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
+ * http://github.com/dmitrysmagin/griffon_legend
+ *
+ *
+ * Programming/Graphics: Daniel "Syn9" Kennedy
+ * Music/Sound effects: David Turner
+ *
+ * Beta testing and gameplay design help:
+ * Deleter, Cha0s, Aether Fox, and Kiz
+ *
+ */
+
+#ifndef GRIFFON_STATE_H
+#define GRIFFON_STATE_H
+
+namespace Griffon {
+
+extern char player_sav[];
+
+int state_load(int slotnum);
+int state_load_player(int slotnum);
+int state_save(int slotnum);
+
+} // end of namespace Griffon
+
+#endif
Commit: 4cf00359c9956d7ce1b402f5dc9b9289ad8ffc8a
https://github.com/scummvm/scummvm/commit/4cf00359c9956d7ce1b402f5dc9b9289ad8ffc8a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Removed unneeded config file handling
Changed paths:
engines/griffon/engine.cpp
engines/griffon/engine.h
engines/griffon/griffon.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 188fb34..170dbed 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -143,7 +143,7 @@ float clouddeg = 0;
int cloudson;
// spell info
-SPELLTYPE spellinfo[MAXSPELL];
+SPELLTYPE spellinfo[kMaxSpell];
// player info
int movingup, movingdown, movingleft, movingright;
@@ -167,9 +167,9 @@ SDL_Surface *animsa[100];
float playerattackofs[4][16][3];
// [dir] [frame] [x,y ofs, completed(0/1)]
-float floattext[MAXFLOAT][4]; // [id] [framesleft, x, y, col]
-char *floatstri[MAXFLOAT];
-float floaticon[MAXFLOAT][4]; // [id] [framesleft, x, y, ico]
+float floattext[kMaxFloat][4]; // [id] [framesleft, x, y, col]
+char *floatstri[kMaxFloat];
+float floaticon[kMaxFloat][4]; // [id] [framesleft, x, y, ico]
// special for animset2
ANIMSET2TYPE animset2[7], animset9[7];
@@ -194,7 +194,7 @@ int triggers[10000][9];
int triggerloc[320][240], ntriggers;
// npc info
-NPCTYPE npcinfo[MAXNPC];
+NPCTYPE npcinfo[kMaxNPC];
int lastnpc;
// music info
@@ -214,8 +214,7 @@ int ysort[2401], lasty, firsty;
int pmenu;
-#undef main
-int main() {
+int griffon_main() {
sys_initialize();
game_showlogos();
game_main();
@@ -422,7 +421,7 @@ static float RND() {
}
void game_addFloatIcon(int ico, float xloc, float yloc) {
- for (int i = 0; i < MAXFLOAT; i++) {
+ for (int i = 0; i < kMaxFloat; i++) {
if (floaticon[i][0] == 0) {
floaticon[i][0] = 32;
floaticon[i][1] = xloc;
@@ -434,7 +433,7 @@ void game_addFloatIcon(int ico, float xloc, float yloc) {
}
void game_addFloatText(char *stri, float xloc, float yloc, int col) {
- for (int i = 0; i < MAXFLOAT; i++) {
+ for (int i = 0; i < kMaxFloat; i++) {
if (floattext[i][0] == 0) {
floattext[i][0] = 32;
floattext[i][1] = xloc;
@@ -814,7 +813,7 @@ void game_attack() {
void game_castspell(int spellnum, float homex, float homey, float enemyx, float enemyy, int damagewho) {
// spellnum 7 = sprite 6 spitfire
- for (int i = 0; i < MAXSPELL; i++) {
+ for (int i = 0; i < kMaxSpell; i++) {
if (spellinfo[i].frame == 0) {
spellinfo[i].homex = homex;
spellinfo[i].homey = homey;
@@ -2123,7 +2122,7 @@ void game_drawhud() {
game_fillrect(videobuffer2, 0, 0, 320, 240, 0);
- for (int i = 0; i < MAXFLOAT; i++) {
+ for (int i = 0; i < kMaxFloat; i++) {
if (floattext[i][0] > 0) {
int fc = (int)floattext[i][3];
int c = fc, c2 = 3;
@@ -3662,7 +3661,7 @@ void game_loadmap(int mapnum) {
if ((mapnum == 53 || mapnum == 57 || mapnum == 61 || mapnum == 65 || mapnum == 62) && scriptflag[60][0] > 0) mapnum = mapnum + 100;
if ((mapnum == 161 || mapnum == 162) && scriptflag[60][0] == 2) mapnum = mapnum + 100;
- for (int i = 0; i < MAXSPELL; i++)
+ for (int i = 0; i < kMaxSpell; i++)
spellinfo[i].frame = 0;
roomlock = 0;
@@ -3853,7 +3852,7 @@ void game_loadmap(int mapnum) {
lastobj = 0;
lastnpc = 0;
- for (int i = 0; i < MAXNPC; i++)
+ for (int i = 0; i < kMaxNPC; i++)
npcinfo[i].onmap = 0;
for (int x = 0; x <= 19; x++) {
@@ -3925,7 +3924,7 @@ void game_loadmap(int mapnum) {
printf("Reading %s\n", name);
fp = fopen(name, "r");
- for (int i = 0; i < MAXNPC; i++) {
+ for (int i = 0; i < kMaxNPC; i++) {
INPUT("%i", &npcinfo[i].spriteset);
INPUT("%i", &npcinfo[i].x1);
INPUT("%i", &npcinfo[i].y1);
@@ -4649,7 +4648,7 @@ void game_processtrigger(int trignum) {
}
}
- for (int i = 0; i < MAXFLOAT; i++) {
+ for (int i = 0; i < kMaxFloat; i++) {
floattext[i][0] = 0;
floaticon[i][0] = 0;
}
@@ -5084,7 +5083,7 @@ void game_swash() {
}
void game_theend() {
- for (int i = 0; i < MAXFLOAT; i++) {
+ for (int i = 0; i < kMaxFloat; i++) {
floattext[i][0] = 0;
floaticon[i][0] = 0;
}
@@ -6431,7 +6430,7 @@ void game_updspells() {
float xloc = 0, yloc = 0, xst, yst, xdif, ydif;
- for (int i = 0; i < MAXSPELL; i++) {
+ for (int i = 0; i < kMaxSpell; i++) {
if (spellinfo[i].frame > 0) {
int spellnum = spellinfo[i].spellnum;
@@ -7241,7 +7240,7 @@ void game_updspellsunder() {
if (forcepause == 1) return;
- for (int i = 0; i < MAXSPELL; i++) {
+ for (int i = 0; i < kMaxSpell; i++) {
if (spellinfo[i].frame > 0) {
int spellnum = spellinfo[i].spellnum;
@@ -7517,69 +7516,13 @@ void game_updspellsunder() {
}
}
-void sys_initpaths() {
-#ifdef __unix__
- char line[256];
- char *home = getenv("HOME");
- if (!home) return;
-
- sprintf(line, "%s/.griffon", home);
- mkdir(line, 0777);
-
- strcpy(config_ini, line);
- strcat(config_ini, "/config.ini");
-
- strcpy(player_sav, line);
- strcat(player_sav, "/player%i.sav");
-#endif
-}
-
void sys_initialize() {
int result;
- sys_initpaths();
-
- // init char *floatstri[MAXFLOAT]
- for (int i = 0; i < MAXFLOAT; i++)
+ // init char *floatstri[kMaxFloat]
+ for (int i = 0; i < kMaxFloat; i++)
floatstri[i] = malloc(64); // 64 bytes each string (should be enough)
- // set default values
- config.scr_width = 320;
- config.scr_height = 240;
- config.scr_bpp = 32;
- config.hwaccel = 0;
- config.hwsurface = SDL_SWSURFACE;
- config.fullscreen = 0;
- config.music = 1;
- config.effects = 1;
- config.musicvol = 127;
- config.effectsvol = 127;
-
- config_load(&config);
-
- printf("SCR_WIDTH: %i\n", config.scr_width);
- printf("SCR_HEIGHT: %i\n", config.scr_height);
- printf("SCR_BITS: %i\n", config.scr_bpp);
-
- fullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
-
- result = SDL_Init(SDL_INIT_EVERYTHING);
- if (result) {
- printf("Failed to init SDL\n");
- exit(1);
- }
-
- atexit(SDL_Quit);
-
- video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen); // SDL_FULLSCREEN
- if (!video) {
- printf("Failed to init Video\n");
- exit(1);
- }
-
-
- SDL_WM_SetCaption("The Griffon Legend", NULL);
-
SDL_ShowCursor(SDL_DISABLE);
videobuffer = SDL_CreateRGBSurface(config.hwsurface, 320, 240, config.scr_bpp, video->format->Rmask, video->format->Gmask, video->format->Bmask, video->format->Amask);
@@ -8097,7 +8040,7 @@ void sys_update() {
game_checkhit();
}
- for (int i = 0; i < MAXFLOAT; i++) {
+ for (int i = 0; i < kMaxFloat; i++) {
if (floattext[i][0] > 0) {
spd = 0.5 * fpsr;
floattext[i][0] = floattext[i][0] - spd;
diff --git a/engines/griffon/engine.h b/engines/griffon/engine.h
index 1599866..23ef832 100644
--- a/engines/griffon/engine.h
+++ b/engines/griffon/engine.h
@@ -37,11 +37,13 @@
#ifndef GRIFFON_ENGINE_H
#define GRIFFON_ENGINE_H
+#include "graphics/transparent_surface.h"
+
namespace Griffon {
-#define MAXNPC 32
-#define MAXFLOAT 32
-#define MAXSPELL 32
+#define kMaxNPC 32
+#define kMaxFloat 32
+#define kMaxSpell 32
// spells
#define ice 0
@@ -224,6 +226,8 @@ extern int objmapf[1000][21][15];
extern int roomlocks[201];
extern int secsingame, secstart;
+void griffon_main();
+
void game_addFloatIcon(int ico, float xloc, float yloc);
void game_addFloatText(char *stri, float xloc, float yloc, int col);
void game_attack();
@@ -260,13 +264,13 @@ void game_updspells();
void game_updspellsunder();
void sys_initialize();
-void sys_line(SDL_Surface *buffer, int x1, int y1, int x2, int y2, int col);
+void sys_line(Graphics::TransparentSurface *buffer, int x1, int y1, int x2, int y2, int col);
void sys_LoadAnims();
void sys_LoadFont();
void sys_LoadItemImgs();
void sys_LoadTiles();
void sys_LoadTriggers();
-void sys_print(SDL_Surface *buffer, char *stri, int xloc, int yloc, int col);
+void sys_print(Graphics::TransparentSurface *buffer, char *stri, int xloc, int yloc, int col);
void sys_progress(int w, int wm);
void sys_LoadObjectDB();
void sys_setupAudio();
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index f787ac8..ba60fdb 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -26,10 +26,12 @@
#include "common/error.h"
#include "common/file.h"
#include "common/fs.h"
+#include "graphics/pixelformat.h"
#include "engines/util.h"
#include "griffon/griffon.h"
+#include "griffon/engine.h"
namespace Griffon {
@@ -45,7 +47,9 @@ GriffonEngine::~GriffonEngine() {
}
Common::Error GriffonEngine::run() {
- initGraphics(320, 200);
+ initGraphics(320, 240, new Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
+
+ griffon_main();
return Common::kNoError;
}
Commit: dcab06be6581ee087747f9e5f7cdfab5617e228f
https://github.com/scummvm/scummvm/commit/dcab06be6581ee087747f9e5f7cdfab5617e228f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Split single line if() statements
Changed paths:
engines/griffon/engine.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 170dbed..65faf28 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -459,12 +459,15 @@ void game_attack() {
if (ly > 0) {
int o2 = 0; // ??
int o = objmap[lx][ly - 1];
- if (ly > 1 && curmap == 58) o2 = objmap[lx][ly - 2];
- if (ly > 1 && curmap == 54) o2 = objmap[lx][ly - 2];
+ if (ly > 1 && curmap == 58)
+ o2 = objmap[lx][ly - 2];
+ if (ly > 1 && curmap == 54)
+ o2 = objmap[lx][ly - 2];
// cst
if ((objectinfo[o][4] == 1 && (o == 0 || o > 4)) || (objectinfo[o2][4] == 0 && o2 == 10)) {
- if (o2 == 10) o = 10;
+ if (o2 == 10)
+ o = 10;
int oscript = objectinfo[o][5];
if (oscript == 0 && player.inventory[INV_FLASK] < 9) {
@@ -478,7 +481,8 @@ void game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1)
+ objmap[lx][ly - 1] = 3;
game_eventtext("Found Flask!");
itemticks = ticks + 215;
@@ -503,16 +507,20 @@ void game_attack() {
itemticks = ticks + 215;
- if (curmap == 34) scriptflag[2][0] = 2;
- if (curmap == 62) scriptflag[8][0] = 2;
- if (curmap == 81) scriptflag[13][0] = 2;
+ if (curmap == 34)
+ scriptflag[2][0] = 2;
+ if (curmap == 62)
+ scriptflag[8][0] = 2;
+ if (curmap == 81)
+ scriptflag[13][0] = 2;
if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
- if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1)
+ objmap[lx][ly - 1] = 3;
game_eventtext("Found the Temple Key!");
return;
}
@@ -528,7 +536,8 @@ void game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1)
+ objmap[lx][ly - 1] = 3;
game_eventtext("Found the Infinite Crystal!");
itemticks = ticks + 215;
@@ -547,7 +556,8 @@ void game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1)
+ objmap[lx][ly - 1] = 3;
game_eventtext("Found the Obsidian Shield!");
objmapf[4][1][2] = 1;
@@ -566,7 +576,8 @@ void game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1)
+ objmap[lx][ly - 1] = 3;
game_eventtext("Found the Fidelis Sword!");
return;
}
@@ -588,7 +599,8 @@ void game_attack() {
objmapf[curmap][lx][ly - 1] = 1;
- if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1)
+ objmap[lx][ly - 1] = 3;
game_eventtext("Found Key");
game_addFloatIcon(16, lx * 16, (ly - 1) * 16);
@@ -613,7 +625,8 @@ void game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1)
+ objmap[lx][ly - 1] = 3;
game_eventtext("Found Mega Flask!");
itemticks = ticks + 215;
@@ -642,7 +655,8 @@ void game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1)
+ objmap[lx][ly - 1] = 3;
game_eventtext("Found Mega Flask!");
itemticks = ticks + 215;
@@ -671,7 +685,8 @@ void game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1)
+ objmap[lx][ly - 1] = 3;
game_eventtext("Found Lightning Bomb!");
itemticks = ticks + 215;
@@ -699,7 +714,8 @@ void game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1)
+ objmap[lx][ly - 1] = 3;
game_eventtext("Found the Fidelis Mail!");
itemticks = ticks + 215;
@@ -754,7 +770,8 @@ void game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1)
+ objmap[lx][ly - 1] = 3;
game_eventtext("Found the Blood Sword!");
objmapf[4][1][2] = 1;
return;
@@ -770,7 +787,8 @@ void game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1)
+ objmap[lx][ly - 1] = 3;
game_eventtext("Found the Entropy Shield!");
objmapf[4][1][2] = 1;
return;
@@ -786,7 +804,8 @@ void game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (objectinfo[o][4] == 1) objmap[lx][ly - 1] = 3;
+ if (objectinfo[o][4] == 1)
+ objmap[lx][ly - 1] = 3;
game_eventtext("Found the Rubyscale Armour!");
objmapf[4][1][2] = 1;
return;
@@ -907,19 +926,25 @@ void game_checkhit() {
float ydif = player.py - npy;
float ps = player.sword;
- if (ps > 1) ps = ps * 0.75;
+ if (ps > 1)
+ ps = ps * 0.75;
damage = (float)player.sworddamage * (1.0 + RND() * 1.0) * player.attackstrength / 100.0 * ps;
- if (player.attackstrength == 100) damage = damage * 1.5;
+ if (player.attackstrength == 100)
+ damage = damage * 1.5;
int hit = 0;
if (player.walkdir == 0) {
- if (abs(xdif) <= 8 && ydif >= 0 && ydif < 8) hit = 1;
+ if (abs(xdif) <= 8 && ydif >= 0 && ydif < 8)
+ hit = 1;
} else if (player.walkdir == 1) {
- if (abs(xdif) <= 8 && ydif <= 0 && ydif > -8) hit = 1;
+ if (abs(xdif) <= 8 && ydif <= 0 && ydif > -8)
+ hit = 1;
} else if (player.walkdir == 2) {
- if (abs(ydif) <= 8 && xdif >= -8 && xdif < 8) hit = 1;
+ if (abs(ydif) <= 8 && xdif >= -8 && xdif < 8)
+ hit = 1;
} else if (player.walkdir == 3) {
- if (abs(ydif) <= 8 && xdif <= 8 && xdif > -8) hit = 1;
+ if (abs(ydif) <= 8 && xdif <= 8 && xdif > -8)
+ hit = 1;
}
if (hit == 1) {
@@ -966,7 +991,8 @@ void game_checkinputs() {
if (event.type == SDL_KEYDOWN) {
switch (event.key.keysym.sym) {
case SDLK_ESCAPE:
- if (itemticks < ticks) game_title(1);
+ if (itemticks < ticks)
+ game_title(1);
break;
case SDLK_RETURN:
if (keys[SDLK_LALT] || keys[SDLK_RALT]) {
@@ -993,7 +1019,8 @@ void game_checkinputs() {
int heal = 50;
int maxh = player.maxhp - player.hp;
- if (heal > maxh) heal = maxh;
+ if (heal > maxh)
+ heal = maxh;
player.hp = player.hp + heal;
@@ -1018,7 +1045,8 @@ void game_checkinputs() {
int heal = 200;
int maxh = player.maxhp - player.hp;
- if (heal > maxh) heal = maxh;
+ if (heal > maxh)
+ heal = maxh;
player.hp = player.hp + heal;
@@ -1161,10 +1189,14 @@ __exit_do:
movingdown = 0;
movingleft = 0;
movingright = 0;
- if (keys[SDLK_UP]) movingup = 1;
- if (keys[SDLK_DOWN]) movingdown = 1;
- if (keys[SDLK_LEFT]) movingleft = 1;
- if (keys[SDLK_RIGHT]) movingright = 1;
+ if (keys[SDLK_UP])
+ movingup = 1;
+ if (keys[SDLK_DOWN])
+ movingdown = 1;
+ if (keys[SDLK_LEFT])
+ movingleft = 1;
+ if (keys[SDLK_RIGHT])
+ movingright = 1;
} else {
movingup = 0;
movingdown = 0;
@@ -1177,10 +1209,14 @@ __exit_do:
int origin = curenemy;
do {
curenemy = curenemy - 1;
- if (curenemy < 1) curenemy = lastnpc + nposts;
- if (curenemy == origin) break;
- if (curenemy <= lastnpc && npcinfo[curenemy].hp > 0) break;
- if (curenemy > lastnpc) break;
+ if (curenemy < 1)
+ curenemy = lastnpc + nposts;
+ if (curenemy == origin)
+ break;
+ if (curenemy <= lastnpc && npcinfo[curenemy].hp > 0)
+ break;
+ if (curenemy > lastnpc)
+ break;
} while (1);
itemticks = ticks + ntickdelay;
}
@@ -1188,31 +1224,41 @@ __exit_do:
int origin = curenemy;
do {
curenemy = curenemy + 1;
- if (curenemy > lastnpc + nposts) curenemy = 1;
- if (curenemy == origin) break;
- if (curenemy <= lastnpc && npcinfo[curenemy].hp > 0) break;
- if (curenemy > lastnpc) break;
+ if (curenemy > lastnpc + nposts)
+ curenemy = 1;
+ if (curenemy == origin)
+ break;
+ if (curenemy <= lastnpc && npcinfo[curenemy].hp > 0)
+ break;
+ if (curenemy > lastnpc)
+ break;
} while (1);
itemticks = ticks + ntickdelay;
}
- if (curenemy > lastnpc + nposts) curenemy = 1;
- if (curenemy < 1) curenemy = lastnpc + nposts;
+ if (curenemy > lastnpc + nposts)
+ curenemy = 1;
+ if (curenemy < 1)
+ curenemy = lastnpc + nposts;
}
} else {
if (itemticks < ticks) {
if (keys[SDLK_UP]) {
curitem = curitem - 1;
itemticks = ticks + ntickdelay;
- if (curitem == 4) curitem = 9;
- if (curitem == -1) curitem = 4;
+ if (curitem == 4)
+ curitem = 9;
+ if (curitem == -1)
+ curitem = 4;
}
if (keys[SDLK_DOWN]) {
curitem = curitem + 1;
itemticks = ticks + ntickdelay;
- if (curitem == 5) curitem = 0;
- if (curitem == 10) curitem = 5;
+ if (curitem == 5)
+ curitem = 0;
+ if (curitem == 10)
+ curitem = 5;
}
if (keys[SDLK_LEFT]) {
curitem = curitem - 5;
@@ -1223,8 +1269,10 @@ __exit_do:
itemticks = ticks + ntickdelay;
}
- if (curitem > 9) curitem = curitem - 10;
- if (curitem < 0) curitem = curitem + 10;
+ if (curitem > 9)
+ curitem = curitem - 10;
+ if (curitem < 0)
+ curitem = curitem + 10;
}
}
}
@@ -1241,7 +1289,8 @@ void game_checktrigger() {
canusekey = 0;
- if (triggerloc[lx][ly] > -1) game_processtrigger(triggerloc[lx][ly]);
+ if (triggerloc[lx][ly] > -1)
+ game_processtrigger(triggerloc[lx][ly]);
}
#ifdef OPENDINGUX
@@ -1335,8 +1384,10 @@ void game_configmenu() {
if (i == 15 || i == 17) {
int vol = (i == 15 ? config.musicvol : config.effectsvol) * 9 / 255;
- if (vol < 0) vol = 0;
- if (vol > 9) vol = 9;
+ if (vol < 0)
+ vol = 0;
+ if (vol > 9)
+ vol = 9;
strcpy(line, "[----------]");
line[vol + 1] = 'X';
@@ -1344,32 +1395,51 @@ void game_configmenu() {
}
int cl = 3;
- if (i == 0 && config.scr_width == 320) cl = 0;
- if (i == 1 && config.scr_width == 640) cl = 0;
- if (i == 2 && config.scr_bpp == 16) cl = 0;
- if (i == 3 && config.scr_bpp == 24) cl = 0;
- if (i == 4 && config.scr_bpp == 32) cl = 0;
- if (i == 6 && config.fullscreen != 0) cl = 0;
- if (i == 7 && config.fullscreen == 0) cl = 0;
- if (i == 9 && config.music == 1) cl = 0;
- if (i == 10 && config.music == 0) cl = 0;
- if (i == 12 && config.effects == 1) cl = 0;
- if (i == 13 && config.effects == 0) cl = 0;
-
- if (i > 18) cl = 0;
+ if (i == 0 && config.scr_width == 320)
+ cl = 0;
+ if (i == 1 && config.scr_width == 640)
+ cl = 0;
+ if (i == 2 && config.scr_bpp == 16)
+ cl = 0;
+ if (i == 3 && config.scr_bpp == 24)
+ cl = 0;
+ if (i == 4 && config.scr_bpp == 32)
+ cl = 0;
+ if (i == 6 && config.fullscreen != 0)
+ cl = 0;
+ if (i == 7 && config.fullscreen == 0)
+ cl = 0;
+ if (i == 9 && config.music == 1)
+ cl = 0;
+ if (i == 10 && config.music == 0)
+ cl = 0;
+ if (i == 12 && config.effects == 1)
+ cl = 0;
+ if (i == 13 && config.effects == 0)
+ cl = 0;
+
+ if (i > 18)
+ cl = 0;
sys_print(videobuffer, vr[i], 156 - 8 * strlen(vr[i]), sy + i * 8, 0);
sys_print(videobuffer, vl[i], 164, sy + i * 8, cl);
}
curselt = cursel;
- if (cursel > 4) curselt = curselt + 1;
- if (cursel > 6) curselt = curselt + 1;
- if (cursel > 8) curselt = curselt + 1;
- if (cursel > 10) curselt = curselt + 1;
- if (cursel > 11) curselt = curselt + 1;
- if (cursel > 12) curselt = curselt + 1;
- if (cursel > 13) curselt = curselt + 1;
+ if (cursel > 4)
+ curselt = curselt + 1;
+ if (cursel > 6)
+ curselt = curselt + 1;
+ if (cursel > 8)
+ curselt = curselt + 1;
+ if (cursel > 10)
+ curselt = curselt + 1;
+ if (cursel > 11)
+ curselt = curselt + 1;
+ if (cursel > 12)
+ curselt = curselt + 1;
+ if (cursel > 13)
+ curselt = curselt + 1;
rc.x = 148 + 3 * cos(3.14159 * 2 * itemyloc / 16.0);
rc.y = sy + 8 * curselt - 4;
@@ -1379,8 +1449,10 @@ void game_configmenu() {
float yy = 255.0;
if (ticks < ticks1 + 1000) {
yy = 255.0 * ((float)(ticks - ticks1) / 1000.0);
- if (yy < 0.0) yy = 0.0;
- if (yy > 255.0) yy = 255.0;
+ if (yy < 0.0)
+ yy = 0.0;
+ if (yy > 255.0)
+ yy = 255.0;
}
SDL_SetAlpha(videobuffer, SDL_SRCALPHA, (int)yy);
@@ -1404,7 +1476,8 @@ void game_configmenu() {
}
itemyloc += 0.75 * fpsr;
- while (itemyloc >= 16) itemyloc -= 16;
+ while (itemyloc >= 16)
+ itemyloc -= 16;
if (keypause < ticks) {
SDL_PollEvent(&event);
@@ -1413,18 +1486,21 @@ void game_configmenu() {
if (event.type == SDL_KEYDOWN) {
keypause = ticks + tickwait;
- if (keys[SDLK_ESCAPE] || keys[SDLK_LALT]) break;
+ if (keys[SDLK_ESCAPE] || keys[SDLK_LALT])
+ break;
if (keys[SDLK_LEFT]) {
if (cursel == 11) {
config.musicvol = config.musicvol - 25;
- if (config.musicvol < 0) config.musicvol = 0;
+ if (config.musicvol < 0)
+ config.musicvol = 0;
Mix_Volume(musicchannel, config.musicvol);
Mix_Volume(menuchannel, config.musicvol);
} else if (cursel == 12) {
config.effectsvol = config.effectsvol - 25;
- if (config.effectsvol < 0) config.effectsvol = 0;
+ if (config.effectsvol < 0)
+ config.effectsvol = 0;
Mix_Volume(-1, config.effectsvol);
Mix_Volume(musicchannel, config.musicvol);
@@ -1439,13 +1515,15 @@ void game_configmenu() {
if (keys[SDLK_RIGHT]) {
if (cursel == 11) {
config.musicvol = config.musicvol + 25;
- if (config.musicvol > 255) config.musicvol = 255;
+ if (config.musicvol > 255)
+ config.musicvol = 255;
Mix_Volume(musicchannel, config.musicvol);
Mix_Volume(menuchannel, config.musicvol);
} else if (cursel == 12) {
config.effectsvol = config.effectsvol + 25;
- if (config.effectsvol > 255) config.effectsvol = 255;
+ if (config.effectsvol > 255)
+ config.effectsvol = 255;
Mix_Volume(-1, config.effectsvol);
Mix_Volume(musicchannel, config.musicvol);
@@ -1460,11 +1538,13 @@ void game_configmenu() {
if (keys[SDLK_UP]) {
cursel--;
- if (cursel < MINCURSEL) cursel = 14;
+ if (cursel < MINCURSEL)
+ cursel = 14;
}
if (keys[SDLK_DOWN]) {
cursel++;
- if (cursel > 14) cursel = MINCURSEL;
+ if (cursel > 14)
+ cursel = MINCURSEL;
}
if (keys[SDLK_LCTRL] || keys[SDLK_RETURN]) {
@@ -1498,8 +1578,10 @@ void game_configmenu() {
fullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
int b = 16;
- if (cursel == 3) b = 24;
- if (cursel == 4) b = 32;
+ if (cursel == 3)
+ b = 24;
+ if (cursel == 4)
+ b = 32;
video = SDL_SetVideoMode(config.scr_width, config.scr_height, b, fullscreen);
if (video == 0) {
video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
@@ -1572,7 +1654,8 @@ void game_configmenu() {
}
clouddeg += 0.01 * fpsr;
- while (clouddeg >= 360) clouddeg = clouddeg - 360;
+ while (clouddeg >= 360)
+ clouddeg = clouddeg - 360;
SDL_Delay(10);
} while (1);
@@ -1596,7 +1679,8 @@ void game_damagenpc(int npcnum, int damage, int spell) {
} else {
ratio = 0;
heal = 0;
- if (damage < 0) heal = 1;
+ if (damage < 0)
+ heal = 1;
damage = abs(damage);
if (heal == 0) {
@@ -1606,13 +1690,15 @@ void game_damagenpc(int npcnum, int damage, int spell) {
}
npcinfo[npcnum].hp -= damage;
- if (npcinfo[npcnum].hp < 0) npcinfo[npcnum].hp = 0;
+ if (npcinfo[npcnum].hp < 0)
+ npcinfo[npcnum].hp = 0;
sprintf(line, "-%i", damage);
fcol = 1;
} else {
npcinfo[npcnum].hp += damage;
- if (npcinfo[npcnum].hp > npcinfo[npcnum].maxhp) npcinfo[npcnum].hp = npcinfo[npcnum].maxhp;
+ if (npcinfo[npcnum].hp > npcinfo[npcnum].maxhp)
+ npcinfo[npcnum].hp = npcinfo[npcnum].maxhp;
sprintf(line, "+%i", damage);
fcol = 5;
@@ -1620,12 +1706,14 @@ void game_damagenpc(int npcnum, int damage, int spell) {
npcinfo[npcnum].pause = ticks + 900;
- if (spell == 0) player.attackstrength = ratio;
+ if (spell == 0)
+ player.attackstrength = ratio;
}
game_addFloatText(line, npcinfo[npcnum].x + 12 - 4 * strlen(line), npcinfo[npcnum].y + 16, fcol);
- if (npcinfo[npcnum].spriteset == 12) game_castspell(9, npcinfo[npcnum].x, npcinfo[npcnum].y, player.px, player.py, npcnum);
+ if (npcinfo[npcnum].spriteset == 12)
+ game_castspell(9, npcinfo[npcnum].x, npcinfo[npcnum].y, player.px, player.py, npcnum);
// if enemy is killed
if (npcinfo[npcnum].hp == 0) {
@@ -1640,7 +1728,8 @@ void game_damagenpc(int npcnum, int damage, int spell) {
lx = (int)npx / 16;
ly = (int)npy / 16;
- if (objmap[lx][ly] == -1) objmap[lx][ly] = 4;
+ if (objmap[lx][ly] == -1)
+ objmap[lx][ly] = 4;
}
}
@@ -1653,7 +1742,8 @@ void game_damagenpc(int npcnum, int damage, int spell) {
lx = (int)npx / 16;
ly = (int)npy / 16;
- if (objmap[lx][ly] == -1) objmap[lx][ly] = 12;
+ if (objmap[lx][ly] == -1)
+ objmap[lx][ly] = 12;
}
}
@@ -1666,7 +1756,8 @@ void game_damagenpc(int npcnum, int damage, int spell) {
lx = (int)npx / 16;
ly = (int)npy / 16;
- if (objmap[lx][ly] == -1) objmap[lx][ly] = 13;
+ if (objmap[lx][ly] == -1)
+ objmap[lx][ly] = 13;
}
}
@@ -1677,7 +1768,8 @@ void game_damagenpc(int npcnum, int damage, int spell) {
alive = 0;
for (int i = 1; i <= lastnpc; i++) {
- if (npcinfo[i].hp > 0) alive = 1;
+ if (npcinfo[i].hp > 0)
+ alive = 1;
}
if (alive == 0) {
@@ -1694,7 +1786,8 @@ void game_damagenpc(int npcnum, int damage, int spell) {
lx = (int)npx / 16;
ly = (int)npy / 16;
- if (lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy)
+ player.py = player.py + 16;
SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
scriptflag[2][0] = 1;
}
@@ -1707,7 +1800,8 @@ void game_damagenpc(int npcnum, int damage, int spell) {
alive = 0;
for (int i = 1; i <= lastnpc; i++) {
- if (npcinfo[i].hp > 0) alive = 1;
+ if (npcinfo[i].hp > 0)
+ alive = 1;
}
if (alive == 0) {
@@ -1724,7 +1818,8 @@ void game_damagenpc(int npcnum, int damage, int spell) {
lx = (int)npx / 16;
ly = (int)npy / 16;
- if (lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy)
+ player.py = player.py + 16;
scriptflag[3][0] = 1;
SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
@@ -1763,7 +1858,8 @@ void game_damagenpc(int npcnum, int damage, int spell) {
alive = 0;
for (int i = 1; i <= lastnpc; i++) {
- if (npcinfo[i].hp > 0) alive = 1;
+ if (npcinfo[i].hp > 0)
+ alive = 1;
}
if (alive == 0) {
@@ -1780,7 +1876,8 @@ void game_damagenpc(int npcnum, int damage, int spell) {
lx = (int)npx / 16;
ly = (int)npy / 16;
- if (lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy)
+ player.py = player.py + 16;
scriptflag[5][0] = 1;
SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
@@ -1794,7 +1891,8 @@ void game_damagenpc(int npcnum, int damage, int spell) {
alive = 0;
for (int i = 1; i <= lastnpc; i++) {
- if (npcinfo[i].hp > 0) alive = 1;
+ if (npcinfo[i].hp > 0)
+ alive = 1;
}
if (alive == 0) {
@@ -1811,7 +1909,8 @@ void game_damagenpc(int npcnum, int damage, int spell) {
lx = (int)npx / 16;
ly = (int)npy / 16;
- if (lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy)
+ player.py = player.py + 16;
SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
scriptflag[8][0] = 1;
}
@@ -1825,7 +1924,8 @@ void game_damagenpc(int npcnum, int damage, int spell) {
alive = 0;
for (int i = 1; i <= lastnpc; i++) {
- if (npcinfo[i].hp > 0) alive = 1;
+ if (npcinfo[i].hp > 0)
+ alive = 1;
}
if (alive == 0) {
@@ -1842,7 +1942,8 @@ void game_damagenpc(int npcnum, int damage, int spell) {
lx = (int)npx / 16;
ly = (int)npy / 16;
- if (lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy)
+ player.py = player.py + 16;
scriptflag[s][0] = 1;
SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
@@ -1856,7 +1957,8 @@ void game_damagenpc(int npcnum, int damage, int spell) {
alive = 0;
for (int i = 1; i <= lastnpc; i++) {
- if (npcinfo[i].hp > 0) alive = 1;
+ if (npcinfo[i].hp > 0)
+ alive = 1;
}
if (alive == 0) {
@@ -1873,7 +1975,8 @@ void game_damagenpc(int npcnum, int damage, int spell) {
lx = (int)npx / 16;
ly = (int)npy / 16;
- if (lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy)
+ player.py = player.py + 16;
}
}
@@ -1884,7 +1987,8 @@ void game_damagenpc(int npcnum, int damage, int spell) {
alive = 0;
for (int i = 1; i <= lastnpc; i++) {
- if (npcinfo[i].hp > 0) alive = 1;
+ if (npcinfo[i].hp > 0)
+ alive = 1;
}
if (alive == 0) {
@@ -1901,7 +2005,8 @@ void game_damagenpc(int npcnum, int damage, int spell) {
lx = (int)npx / 16;
ly = (int)npy / 16;
- if (lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy)
+ player.py = player.py + 16;
scriptflag[12][0] = 1;
SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
@@ -1914,7 +2019,8 @@ void game_damagenpc(int npcnum, int damage, int spell) {
alive = 0;
for (int i = 1; i <= lastnpc; i++) {
- if (npcinfo[i].hp > 0) alive = 1;
+ if (npcinfo[i].hp > 0)
+ alive = 1;
}
if (alive == 0) {
@@ -1931,7 +2037,8 @@ void game_damagenpc(int npcnum, int damage, int spell) {
lx = (int)npx / 16;
ly = (int)npy / 16;
- if (lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy)
+ player.py = player.py + 16;
SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
scriptflag[13][0] = 1;
}
@@ -1941,7 +2048,8 @@ void game_damagenpc(int npcnum, int damage, int spell) {
if (npcinfo[npcnum].script == 15 && scriptflag[15][0] == 0) {
alive = 0;
for (int i = 1; i <= lastnpc; i++) {
- if (npcinfo[i].hp > 0) alive = 1;
+ if (npcinfo[i].hp > 0)
+ alive = 1;
}
if (alive == 0) {
@@ -1961,7 +2069,8 @@ void game_damagenpc(int npcnum, int damage, int spell) {
lx = (int)npx / 16;
ly = (int)npy / 16;
- if (lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy)
+ player.py = player.py + 16;
SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
scriptflag[15][0] = 1;
@@ -1981,7 +2090,8 @@ void game_damagenpc(int npcnum, int damage, int spell) {
lx = (int)npx / 16;
ly = (int)npy / 16;
- if (lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy)
+ player.py = player.py + 16;
SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
scriptflag[16][0] = 1;
@@ -2002,13 +2112,15 @@ void game_damagenpc(int npcnum, int damage, int spell) {
lx = (int)npx / 16;
ly = (int)npy / 16;
- if (lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy)
+ player.py = player.py + 16;
SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
scriptflag[17][0] = 1;
}
}
- if (npcinfo[npcnum].script == 14) game_endofgame();
+ if (npcinfo[npcnum].script == 14)
+ game_endofgame();
}
}
@@ -2016,10 +2128,12 @@ void game_damageplayer(int damage) {
char line[256];
player.hp -= damage;
- if (player.hp < 0) player.hp = 0;
+ if (player.hp < 0)
+ player.hp = 0;
sprintf(line, "-%i", damage);
- if (damage == 0) strcpy(line, "miss!");
+ if (damage == 0)
+ strcpy(line, "miss!");
game_addFloatText(line, player.px + 12 - 4 * strlen(line), player.py + 16, 4);
@@ -2048,8 +2162,10 @@ void game_drawanims(int Layer) {
int curtilex = c % 20;
int curtiley = (c - curtilex) / 20;
- if (curmap == 58 && scriptflag[60][0] > 0) curtilex = 1;
- if (curmap == 54 && scriptflag[60][0] > 1) curtilex = 1;
+ if (curmap == 58 && scriptflag[60][0] > 0)
+ curtilex = 1;
+ if (curmap == 54 && scriptflag[60][0] > 1)
+ curtilex = 1;
rcSrc.x = curtilex * 16;
rcSrc.y = curtiley * 16;
rcSrc.w = 16;
@@ -2090,11 +2206,13 @@ void game_drawanims(int Layer) {
for (int ff = 0; ff <= 5; ff++) {
int ffa = 20 * 5 - 1 + ff * 20;
int ffb = 20 * 5 + 4 + ff * 20;
- if (curtile > ffa && curtile < ffb) pass = 0;
+ if (curtile > ffa && curtile < ffb)
+ pass = 0;
}
}
- if (pass == 1) SDL_BlitSurface(tiles[curtilel], &rcSrc, videobuffer, &rcDest);
+ if (pass == 1)
+ SDL_BlitSurface(tiles[curtilel], &rcSrc, videobuffer, &rcDest);
}
}
}
@@ -2127,10 +2245,13 @@ void game_drawhud() {
int fc = (int)floattext[i][3];
int c = fc, c2 = 3;
- if (fc == 4) c = 1;
- else if (fc == 5) c = 0;
+ if (fc == 4)
+ c = 1;
+ else if (fc == 5)
+ c = 0;
- if (fc == 1 || fc == 3) c2 = 2;
+ if (fc == 1 || fc == 3)
+ c2 = 2;
if (fc != 0) {
sys_print(videobuffer, floatstri[i], (int)(floattext[i][1]) + 0, (int)(floattext[i][2]) - 1, c2);
@@ -2150,7 +2271,8 @@ void game_drawhud() {
rcDest.x = ix;
rcDest.y = iy;
- if (ico != 99) SDL_BlitSurface(itemimg[ico], NULL, videobuffer, &rcDest);
+ if (ico != 99)
+ SDL_BlitSurface(itemimg[ico], NULL, videobuffer, &rcDest);
if (ico == 99) {
SDL_SetAlpha(spellimg, SDL_SRCALPHA, (int)(RND() * 96) + 96);
@@ -2220,9 +2342,12 @@ void game_drawhud() {
rcDest.y = 46 + 77;
int amap = 0;
- if (curmap > 46) amap = 2;
- if (curmap > 67) amap = 3;
- if (curmap > 5 && curmap < 42) amap = 1;
+ if (curmap > 46)
+ amap = 2;
+ if (curmap > 67)
+ amap = 3;
+ if (curmap > 5 && curmap < 42)
+ amap = 1;
SDL_BlitSurface(mapimg[amap], NULL, videobuffer, &rcDest);
ccc = SDL_MapRGB(videobuffer->format, 128 + 127 * sin(3.141592 * 2 * itemyloc / 16), 0, 0);
@@ -2244,7 +2369,8 @@ void game_drawhud() {
sys_print(videobuffer, line, sx, sy, player.hp <= player.maxhp * 0.25 ? (int)player.hpflash : 0);
sprintf(line, "Level : %i", player.level);
- if (player.level == player.maxlevel) strcpy(line, "Level : MAX");
+ if (player.level == player.maxlevel)
+ strcpy(line, "Level : MAX");
sys_print(videobuffer, line, sx, sy + 8, 0);
// experience
@@ -2280,17 +2406,20 @@ void game_drawhud() {
rcSrc.y = 91;
int ss = (player.sword - 1) * 3;
- if (player.sword == 3) ss = 18;
+ if (player.sword == 3)
+ ss = 18;
SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
rcSrc.x = rcSrc.x + 16;
ss = (player.shield - 1) * 3 + 1;
- if (player.shield == 3) ss = 19;
+ if (player.shield == 3)
+ ss = 19;
SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
rcSrc.x = rcSrc.x + 16;
ss = (player.armour - 1) * 3 + 2;
- if (player.armour == 3) ss = 20;
+ if (player.armour == 3)
+ ss = 20;
SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
for (int i = 0; i <= 4; i++) {
@@ -2298,11 +2427,16 @@ void game_drawhud() {
sy = 70 + i * 24;
rcSrc.x = sx;
rcSrc.y = sy;
- if (i == 0) SDL_BlitSurface(itemimg[6], NULL, videobuffer, &rcSrc);
- if (i == 1) SDL_BlitSurface(itemimg[12], NULL, videobuffer, &rcSrc);
- if (i == 2) SDL_BlitSurface(itemimg[17], NULL, videobuffer, &rcSrc);
- if (i == 3) SDL_BlitSurface(itemimg[16], NULL, videobuffer, &rcSrc);
- if (i == 4) SDL_BlitSurface(itemimg[14], NULL, videobuffer, &rcSrc);
+ if (i == 0)
+ SDL_BlitSurface(itemimg[6], NULL, videobuffer, &rcSrc);
+ if (i == 1)
+ SDL_BlitSurface(itemimg[12], NULL, videobuffer, &rcSrc);
+ if (i == 2)
+ SDL_BlitSurface(itemimg[17], NULL, videobuffer, &rcSrc);
+ if (i == 3)
+ SDL_BlitSurface(itemimg[16], NULL, videobuffer, &rcSrc);
+ if (i == 4)
+ SDL_BlitSurface(itemimg[14], NULL, videobuffer, &rcSrc);
sprintf(line, "x%i", player.inventory[i]);
sys_print(videobuffer, line, sx + 17, sy + 7, 0);
Commit: e848f22b710b18dd0daa7801d7c0b7365680c233
https://github.com/scummvm/scummvm/commit/e848f22b710b18dd0daa7801d7c0b7365680c233
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Using TransparentSurface
Changed paths:
engines/griffon/engine.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 65faf28..8ae89ad 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -90,12 +90,12 @@ namespace Griffon {
*/
// system
-SDL_Surface *video, *videobuffer, *videobuffer2, *videobuffer3;
-SDL_Surface *titleimg, *titleimg2, *inventoryimg;
-SDL_Surface *logosimg, *theendimg;
+Graphics::TransparentSurface *video, *videobuffer, *videobuffer2, *videobuffer3;
+Graphics::TransparentSurface *titleimg, *titleimg2, *inventoryimg;
+Graphics::TransparentSurface *logosimg, *theendimg;
SDL_Event event;
-SDL_Surface *mapbg, *clipbg, *clipbg2;
+Graphics::TransparentSurface *mapbg, *clipbg, *clipbg2;
unsigned int clipsurround[4][4];
int fullscreen;
@@ -104,9 +104,9 @@ float animspd;
int rampdata[40][24];
int curmap;
-SDL_Surface *fontchr[224][5]; // 256 - 32
-SDL_Surface *itemimg[21], *windowimg;
-SDL_Surface *spellimg;
+Graphics::TransparentSurface *fontchr[224][5]; // 256 - 32
+Graphics::TransparentSurface *itemimg[21], *windowimg;
+Graphics::TransparentSurface *spellimg;
int itemselon, curitem, itemticks;
float itemyloc;
@@ -120,7 +120,7 @@ float fp, fps, fpsr;
int secsingame, secstart;
extern char *story[48];
-SDL_Surface *mapimg[4];
+Graphics::TransparentSurface *mapimg[4];
extern int invmap[4][7][13];
extern char *story2[27];
@@ -130,7 +130,7 @@ SDL_Rect rcSrc, rcDest;
int dontdrawover; // used in map24 so that the candles dont draw over the boss, default set to 0
// saveload info
-SDL_Surface *saveloadimg;
+Graphics::TransparentSurface *saveloadimg;
// post info
@@ -138,7 +138,7 @@ float postinfo[21][3];
int nposts;
// cloud info
-SDL_Surface *cloudimg;
+Graphics::TransparentSurface *cloudimg;
float clouddeg = 0;
int cloudson;
@@ -153,16 +153,16 @@ PLAYERTYPE playera;
int asecstart;
// tile info
-SDL_Surface *tiles[4];
+Graphics::TransparentSurface *tiles[4];
int tileinfo[3][40][24][3]; // maplayer, x, y, tiledata (tile, tilelayer)
extern int elementmap[15][20];
// animation info
-SDL_Surface *anims[100];
+Graphics::TransparentSurface *anims[100];
// id number 0&1 = players
-SDL_Surface *animsa[100];
+Graphics::TransparentSurface *animsa[100];
// attack anims
float playerattackofs[4][16][3];
// [dir] [frame] [x,y ofs, completed(0/1)]
@@ -1304,7 +1304,7 @@ void game_checktrigger() {
#endif
void game_configmenu() {
- SDL_Surface *configwindow;
+ Graphics::TransparentSurface *configwindow;
SDL_Rect rc;
int cursel, curselt, ofullscreen;
int tickwait, keypause, ticks1;
Commit: 2320c515a9be1b69bebc478ff8b2c2ea899e14b8
https://github.com/scummvm/scummvm/commit/2320c515a9be1b69bebc478ff8b2c2ea899e14b8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Formatted more oneliners
Changed paths:
engines/griffon/engine.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 8ae89ad..5be6ed2 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -852,7 +852,8 @@ void game_castspell(int spellnum, float homex, float homey, float enemyx, float
spellinfo[i].frame = 32;
if (damagewho == 0) {
spellinfo[i].strength = player.spellstrength / 100;
- if (player.spellstrength == 100) spellinfo[i].strength = 1.5;
+ if (player.spellstrength == 100)
+ spellinfo[i].strength = 1.5;
}
// set earthslide vars
@@ -986,7 +987,8 @@ void game_checkinputs() {
}
}
- if (attacking == 1 || (forcepause == 1 && itemselon == 0)) return;
+ if (attacking == 1 || (forcepause == 1 && itemselon == 0))
+ return;
if (event.type == SDL_KEYDOWN) {
switch (event.key.keysym.sym) {
@@ -1010,7 +1012,8 @@ void game_checkinputs() {
break;
case SDLK_LCTRL:
- if (itemselon == 0 && itemticks < ticks) game_attack();
+ if (itemselon == 0 && itemticks < ticks)
+ game_attack();
if (itemselon == 1 && itemticks < ticks) {
if (curitem == 0 && player.inventory[INV_FLASK] > 0) {
@@ -1637,7 +1640,8 @@ void game_configmenu() {
}
}
- if (cursel == 10 && config.effects == 1) config.effects = 0;
+ if (cursel == 10 && config.effects == 1)
+ config.effects = 0;
if (cursel == 13) {
config_save(&config);
@@ -2499,8 +2503,10 @@ void game_drawnpcs(int mode) {
int fst = firsty;
int lst = lasty;
- if (mode == 0) lst = player.ysort;
- if (mode == 1) fst = player.ysort;
+ if (mode == 0)
+ lst = player.ysort;
+ if (mode == 1)
+ fst = player.ysort;
for (int yy = fst; yy <= lst; yy++) {
@@ -2579,7 +2585,8 @@ void game_drawnpcs(int mode) {
for (int f = 0; f <= 7; f++) {
int yp = 0;
- if (f == 0 && (curmap == 53 || curmap == 57 || curmap == 61 || curmap == 65 || curmap == 56 || curmap > 66) && scriptflag[60][0] > 0) yp = 16;
+ if (f == 0 && (curmap == 53 || curmap == 57 || curmap == 61 || curmap == 65 || curmap == 56 || curmap > 66) && scriptflag[60][0] > 0)
+ yp = 16;
int s = npcinfo[i].bodysection[f].sprite;
rcSrc.x = animset9[s].x;
rcSrc.y = animset9[s].y + yp;
@@ -2664,7 +2671,8 @@ void game_drawnpcs(int mode) {
rcDest.y = npcinfo[i].bodysection[10 * ff].y - 8;
int x = 192 + ((int)(itemyloc + ff * 5) % 3) * 64;
- if (x > 255) x = 255;
+ if (x > 255)
+ x = 255;
SDL_SetAlpha(spellimg, SDL_SRCALPHA, x);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
@@ -2679,7 +2687,8 @@ void game_drawnpcs(int mode) {
rcDest.y = npcinfo[i].bodysection[ff * 10 + f].y - 8 + (int)(RND() * 3) - 1;
x = 192 + f % 3 * 64;
- if (x > 255) x = 255;
+ if (x > 255)
+ x = 255;
SDL_SetAlpha(spellimg, SDL_SRCALPHA, x);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
@@ -2791,7 +2800,8 @@ void game_drawnpcs(int mode) {
if (npcinfo[i].spriteset == 10) {
if (npcinfo[i].attacking == 0) {
npcinfo[i].floating = npcinfo[i].floating + 0.25 * fpsr;
- while (npcinfo[i].floating >= 16) npcinfo[i].floating = npcinfo[i].floating - 16;
+ while (npcinfo[i].floating >= 16)
+ npcinfo[i].floating = npcinfo[i].floating - 16;
float frame = npcinfo[i].frame;
int cframe = npcinfo[i].cframe;
@@ -2801,8 +2811,10 @@ void game_drawnpcs(int mode) {
frame = frame - 16;
cframe = (int)(frame);
- if (cframe > 16) cframe = 16 - 1;
- if (cframe < 0) cframe = 0;
+ if (cframe > 16)
+ cframe = 16 - 1;
+ if (cframe < 0)
+ cframe = 0;
npcinfo[i].frame = frame;
npcinfo[i].cframe = cframe;
@@ -2828,7 +2840,8 @@ void game_drawnpcs(int mode) {
SDL_BlitSurface(anims[sprite], &rcSrc, videobuffer, &rcDest);
} else {
npcinfo[i].floating = npcinfo[i].floating + 0.25 * fpsr;
- while (npcinfo[i].floating >= 16) npcinfo[i].floating = npcinfo[i].floating - 16;
+ while (npcinfo[i].floating >= 16)
+ npcinfo[i].floating = npcinfo[i].floating - 16;
int cframe = npcinfo[i].cattackframe;
@@ -2850,7 +2863,8 @@ void game_drawnpcs(int mode) {
if (npcinfo[i].spriteset == 11) {
npcinfo[i].floating = npcinfo[i].floating + .3 * fpsr;
- while (npcinfo[i].floating >= 16) npcinfo[i].floating = npcinfo[i].floating - 16;
+ while (npcinfo[i].floating >= 16)
+ npcinfo[i].floating = npcinfo[i].floating - 16;
float frame = npcinfo[i].frame2;
@@ -2886,7 +2900,8 @@ void game_drawnpcs(int mode) {
rcSrc.h = 16;
float fr3 = frame - 3 + i2;
- if (fr3 < 0) fr3 = fr3 + 16;
+ if (fr3 < 0)
+ fr3 = fr3 + 16;
rcDest.x = (float)(sx + 36 + ii * 8 - ii * cos(3.14159 * 2 * (fr3 - ii) / 16) * 2);
rcDest.y = (float)(sy + 16 + ii * sin(3.14159 * 2 * (fr3 - ii) / 16) * 3 - ii); // * 4
@@ -2977,7 +2992,8 @@ void game_drawnpcs(int mode) {
// bat kitty
if (npcinfo[i].spriteset == 12) {
npcinfo[i].floating = npcinfo[i].floating + 1 * fpsr;
- while (npcinfo[i].floating >= 16) npcinfo[i].floating = npcinfo[i].floating - 16;
+ while (npcinfo[i].floating >= 16)
+ npcinfo[i].floating = npcinfo[i].floating - 16;
float frame = npcinfo[i].frame;
int cframe = npcinfo[i].cframe;
@@ -2987,8 +3003,10 @@ void game_drawnpcs(int mode) {
frame = frame - 16;
cframe = (int)(frame);
- if (cframe > 16) cframe = 16 - 1;
- if (cframe < 0) cframe = 0;
+ if (cframe > 16)
+ cframe = 16 - 1;
+ if (cframe < 0)
+ cframe = 0;
npcinfo[i].frame = frame;
npcinfo[i].cframe = cframe;
@@ -3026,8 +3044,10 @@ void game_drawnpcs(int mode) {
int ww = 14 * npcinfo[i].hp / npcinfo[i].maxhp;
- if (ww > 14) ww = 14;
- if (ww < 1) ww = 1;
+ if (ww > 14)
+ ww = 14;
+ if (ww < 1)
+ ww = 1;
rcDest.w = ww;
rcDest.h = 2;
@@ -3037,8 +3057,10 @@ void game_drawnpcs(int mode) {
int pass = 1;
- if (npcinfo[i].spriteset == 3) pass = 0;
- if (pass == 1) game_drawover(npx, npy);
+ if (npcinfo[i].spriteset == 3)
+ pass = 0;
+ if (pass == 1)
+ game_drawover(npx, npy);
}
}
@@ -3086,11 +3108,13 @@ void game_drawover(int modx, int mody) {
for (int ff = 0; ff <= 5; ff++) {
int ffa = 20 * 5 - 1 + ff * 20;
int ffb = 20 * 5 + 4 + ff * 20;
- if (curtile > ffa && curtile < ffb) pass = 0;
+ if (curtile > ffa && curtile < ffb)
+ pass = 0;
}
}
- if (pass == 1) SDL_BlitSurface(tiles[curtilel], &rcSrc, videobuffer, &rcDest);
+ if (pass == 1)
+ SDL_BlitSurface(tiles[curtilel], &rcSrc, videobuffer, &rcDest);
}
}
}
@@ -3101,7 +3125,8 @@ void game_drawplayer() {
long ccc;
int f = 0;
- if (player.armour == 3) f = 13;
+ if (player.armour == 3)
+ f = 13;
if (attacking == 0) {
rcSrc.x = (int)(player.walkframe / 4) * 24;
@@ -3133,7 +3158,8 @@ void game_drawplayer() {
ccc = SDL_MapRGB(videobuffer->format, 224, 224, 64);
int pass = 0;
- if (player.hp <= player.maxhp * 0.25) pass = 1;
+ if (player.hp <= player.maxhp * 0.25)
+ pass = 1;
if (pass == 1) {
ccc = SDL_MapRGB(videobuffer->format, 255, 255, 255);
@@ -3141,7 +3167,8 @@ void game_drawplayer() {
}
int sss = 6;
- if (player.foundspell[0]) sss = 8;
+ if (player.foundspell[0])
+ sss = 8;
int npx = player.px;
int npy = player.py;
rcDest.x = npx + 4;
@@ -3156,8 +3183,10 @@ void game_drawplayer() {
int ww = 14 * player.hp / player.maxhp;
- if (ww > 14) ww = 14;
- if (ww < 1) ww = 1;
+ if (ww > 14)
+ ww = 14;
+ if (ww < 1)
+ ww = 1;
rcDest.w = ww;
rcDest.h = 2;
@@ -3165,13 +3194,16 @@ void game_drawplayer() {
SDL_FillRect(videobuffer, &rcDest, ccc);
ccc = SDL_MapRGB(videobuffer->format, 0, 224, 64);
- if (player.attackstrength == 100) ccc = SDL_MapRGB(videobuffer->format, 255, 128, 32);
+ if (player.attackstrength == 100)
+ ccc = SDL_MapRGB(videobuffer->format, 255, 128, 32);
ww = 14 * player.attackstrength / 100;
- if (ww > 14) ww = 14;
+ if (ww > 14)
+ ww = 14;
int ww2 = 14 * player.spellstrength / 100;
- if (ww2 > 14) ww2 = 14;
+ if (ww2 > 14)
+ ww2 = 14;
rcDest.w = ww;
rcDest.h = 2;
@@ -3180,7 +3212,8 @@ void game_drawplayer() {
SDL_FillRect(videobuffer, &rcDest, ccc);
ccc = SDL_MapRGB(videobuffer->format, 128, 0, 224);
- if (player.spellstrength == 100) ccc = SDL_MapRGB(videobuffer->format, 224, 0, 0);
+ if (player.spellstrength == 100)
+ ccc = SDL_MapRGB(videobuffer->format, 224, 0, 0);
rcDest.w = ww2;
rcDest.h = 2;
@@ -3199,13 +3232,15 @@ void game_drawview() {
game_drawanims(0);
// ------dontdrawover = special case to make boss work right in room 24
- if (dontdrawover == 1) game_drawanims(1);
+ if (dontdrawover == 1)
+ game_drawanims(1);
game_drawnpcs(0);
game_drawplayer();
game_drawnpcs(1);
- if (dontdrawover == 0) game_drawanims(1);
+ if (dontdrawover == 0)
+ game_drawanims(1);
game_drawover((int)player.px, (int)player.py);
@@ -3251,17 +3286,21 @@ void game_endofgame() {
do {
ld = ld + 4 * fpsr;
- if (ld > config.musicvol) ld = config.musicvol;
+ if (ld > config.musicvol)
+ ld = config.musicvol;
if (menabled == 1 && ldstop == 0) {
Mix_Volume(musicchannel, (int)ld);
- if ((int)ld == config.musicvol) ldstop = 1;
+ if ((int)ld == config.musicvol)
+ ldstop = 1;
}
ya = 0;
if (ticks < ticks1 + 1500) {
ya = (255 * (ticks - ticks1)) / 1500;
- if (ya < 0) ya = 0;
- if (ya > 255) ya = 255;
+ if (ya < 0)
+ ya = 0;
+ if (ya > 255)
+ ya = 255;
} else {
break;
}
@@ -3316,14 +3355,17 @@ void game_endofgame() {
sys_print(videobuffer, story2[i], x, yy, 4);
}
- if (yy < 10 && i == 25) break;
+ if (yy < 10 && i == 25)
+ break;
}
int ya = 255;
if (ticks < ticks1 + 1000) {
ya = 255 * (ticks - ticks1) / 1000;
- if (ya < 0) ya = 0;
- if (ya > 255) ya = 255;
+ if (ya < 0)
+ ya = 0;
+ if (ya > 255)
+ ya = 255;
}
SDL_SetAlpha(videobuffer, SDL_SRCALPHA, ya);
@@ -3347,17 +3389,22 @@ void game_endofgame() {
}
float add = 0.5 * fpsr;
- if (add > 1) add = 1;
+ if (add > 1)
+ add = 1;
xofs = xofs + add;
- if (xofs >= 320) xofs = xofs - 320;
+ if (xofs >= 320)
+ xofs = xofs - 320;
SDL_PollEvent(&event);
keys = SDL_GetKeyState(NULL);
- if (event.type == SDL_KEYDOWN) spd = 1;
- if (event.type == SDL_KEYUP) spd = 0.2;
+ if (event.type == SDL_KEYDOWN)
+ spd = 1;
+ if (event.type == SDL_KEYUP)
+ spd = 0.2;
- if (keys[SDLK_ESCAPE] || keys[SDLK_LALT]) break;
+ if (keys[SDLK_ESCAPE] || keys[SDLK_LALT])
+ break;
} while (1);
@@ -3369,8 +3416,10 @@ void game_endofgame() {
do {
if (ticks < ticks1 + 1500) {
int y = 255 * (ticks - ticks1) / 1500;
- if (y < 0) y = 0;
- if (y > 255) y = 255;
+ if (y < 0)
+ y = 0;
+ if (y > 255)
+ y = 255;
else
break;
}
@@ -3412,8 +3461,10 @@ void game_endofgame() {
y = 255;
if (ticks < ticks1 + 1000) {
y = 255 * (ticks - ticks1) / 1000;
- if (y < 0) y = 0;
- if (y > 255) y = 255;
+ if (y < 0)
+ y = 0;
+ if (y > 255)
+ y = 255;
}
SDL_SetAlpha(videobuffer, SDL_SRCALPHA, y);
@@ -3439,7 +3490,8 @@ void game_endofgame() {
SDL_PollEvent(&event);
keys = SDL_GetKeyState(NULL);
- if (event.type == SDL_KEYDOWN && keywait < ticks) break;
+ if (event.type == SDL_KEYDOWN && keywait < ticks)
+ break;
} while (1);
@@ -3469,18 +3521,22 @@ void game_eventtext(char *stri) {
SDL_PollEvent(&event);
keys = SDL_GetKeyState(NULL);
- if (event.type == SDL_KEYDOWN && pauseticks < ticks) break;
+ if (event.type == SDL_KEYDOWN && pauseticks < ticks)
+ break;
SDL_BlitSurface(videobuffer2, NULL, videobuffer, NULL);
fr = 192;
- if (pauseticks > ticks) fr = 192 * (ticks - bticks) / 500;
- if (fr > 192) fr = 192;
+ if (pauseticks > ticks)
+ fr = 192 * (ticks - bticks) / 500;
+ if (fr > 192)
+ fr = 192;
SDL_SetAlpha(windowimg, SDL_SRCALPHA, fr);
SDL_BlitSurface(windowimg, NULL, videobuffer, NULL);
- if (pauseticks < ticks) sys_print(videobuffer, stri, x, 15, 0);
+ if (pauseticks < ticks)
+ sys_print(videobuffer, stri, x, 15, 0);
SDL_SetAlpha(windowimg, SDL_SRCALPHA, 255);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
@@ -3534,14 +3590,20 @@ void game_handlewalking() {
int ly = (int)npy / 16;
int ramp = rampdata[lx][ly];
- if (ramp == 1 && movingup) spd = spd * 2;
- if (ramp == 1 && movingdown) spd = spd * 2;
+ if (ramp == 1 && movingup)
+ spd = spd * 2;
+ if (ramp == 1 && movingdown)
+ spd = spd * 2;
- if (ramp == 2 && movingleft) movingup = 1;
- if (ramp == 2 && movingright) movingdown = 1;
+ if (ramp == 2 && movingleft)
+ movingup = 1;
+ if (ramp == 2 && movingright)
+ movingdown = 1;
- if (ramp == 3 && movingright) movingup = 1;
- if (ramp == 3 && movingleft) movingdown = 1;
+ if (ramp == 3 && movingright)
+ movingup = 1;
+ if (ramp == 3 && movingleft)
+ movingdown = 1;
for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++) {
@@ -3556,10 +3618,14 @@ void game_handlewalking() {
}
}
- if (movingup) player.walkdir = 0;
- if (movingdown) player.walkdir = 1;
- if (movingleft) player.walkdir = 2;
- if (movingright) player.walkdir = 3;
+ if (movingup)
+ player.walkdir = 0;
+ if (movingdown)
+ player.walkdir = 1;
+ if (movingleft)
+ player.walkdir = 2;
+ if (movingright)
+ player.walkdir = 3;
if (movingup && clipsurround[1][0] == 0) {
py = py - spd;
@@ -3626,10 +3692,14 @@ void game_handlewalking() {
}
}
- if (px < -8) px = -8;
- if (px > xmax) px = xmax;
- if (py < -8) py = -8;
- if (py > ymax) py = ymax;
+ if (px < -8)
+ px = -8;
+ if (px > xmax)
+ px = xmax;
+ if (py < -8)
+ py = -8;
+ if (py > ymax)
+ py = ymax;
int pass = 1;
@@ -3657,13 +3727,17 @@ void game_handlewalking() {
int ydif = player.py - npy;
if (player.walkdir == 0) {
- if (abs(xdif) <= 8 && ydif > 0 && ydif < 8) npcinfo[i].y = npcinfo[i].y - spd;
+ if (abs(xdif) <= 8 && ydif > 0 && ydif < 8)
+ npcinfo[i].y = npcinfo[i].y - spd;
} else if (player.walkdir == 1) {
- if (abs(xdif) <= 8 && ydif < 0 && ydif > -8) npcinfo[i].y = npcinfo[i].y + spd;
+ if (abs(xdif) <= 8 && ydif < 0 && ydif > -8)
+ npcinfo[i].y = npcinfo[i].y + spd;
} else if (player.walkdir == 2) {
- if (abs(ydif) <= 8 && xdif > 0 && xdif < 8) npcinfo[i].x = npcinfo[i].x - spd;
+ if (abs(ydif) <= 8 && xdif > 0 && xdif < 8)
+ npcinfo[i].x = npcinfo[i].x - spd;
} else if (player.walkdir == 3) {
- if (abs(ydif) <= 8 && xdif < 0 && xdif > -8) npcinfo[i].x = npcinfo[i].x + spd;
+ if (abs(ydif) <= 8 && xdif < 0 && xdif > -8)
+ npcinfo[i].x = npcinfo[i].x + spd;
}
npx = npcinfo[i].x;
@@ -3687,8 +3761,10 @@ void game_handlewalking() {
player.px = px;
player.py = py;
- if (player.px != player.opx || player.py != player.opy) player.walkframe = player.walkframe + animspd * fpsr;
- if (player.walkframe >= 16) player.walkframe = player.walkframe - 16;
+ if (player.px != player.opx || player.py != player.opy)
+ player.walkframe = player.walkframe + animspd * fpsr;
+ if (player.walkframe >= 16)
+ player.walkframe = player.walkframe - 16;
// walking over items to pickup :::
int o = objmap[lx][ly];
@@ -3730,7 +3806,8 @@ void game_handlewalking() {
game_addFloatIcon(17, lx * 16, ly * 16);
objmapf[curmap][lx][ly] = 1;
- if (curmap == 41) scriptflag[9][1] = 1;
+ if (curmap == 41)
+ scriptflag[9][1] = 1;
if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
@@ -3777,23 +3854,36 @@ void game_loadmap(int mapnum) {
forcepause = 0;
cloudson = 0;
- if (mapnum < 6) cloudson = 1;
- if (mapnum > 41) cloudson = 1;
- if (mapnum > 47) cloudson = 0;
- if (mapnum == 52) cloudson = 1;
- if (mapnum == 60) cloudson = 1;
- if (mapnum == 50) cloudson = 1;
- if (mapnum == 54) cloudson = 1;
- if (mapnum == 58) cloudson = 1;
- if (mapnum == 62) cloudson = 1;
- if (mapnum == 83) cloudson = 1;
+ if (mapnum < 6)
+ cloudson = 1;
+ if (mapnum > 41)
+ cloudson = 1;
+ if (mapnum > 47)
+ cloudson = 0;
+ if (mapnum == 52)
+ cloudson = 1;
+ if (mapnum == 60)
+ cloudson = 1;
+ if (mapnum == 50)
+ cloudson = 1;
+ if (mapnum == 54)
+ cloudson = 1;
+ if (mapnum == 58)
+ cloudson = 1;
+ if (mapnum == 62)
+ cloudson = 1;
+ if (mapnum == 83)
+ cloudson = 1;
// -----------special case
dontdrawover = 0;
- if (mapnum == 24) dontdrawover = 1;
+ if (mapnum == 24)
+ dontdrawover = 1;
- if ((mapnum == 53 || mapnum == 57 || mapnum == 61 || mapnum == 65 || mapnum == 62) && scriptflag[60][0] > 0) mapnum = mapnum + 100;
- if ((mapnum == 161 || mapnum == 162) && scriptflag[60][0] == 2) mapnum = mapnum + 100;
+ if ((mapnum == 53 || mapnum == 57 || mapnum == 61 || mapnum == 65 || mapnum == 62) && scriptflag[60][0] > 0)
+ mapnum = mapnum + 100;
+ if ((mapnum == 161 || mapnum == 162) && scriptflag[60][0] == 2)
+ mapnum = mapnum + 100;
for (int i = 0; i < kMaxSpell; i++)
spellinfo[i].frame = 0;
@@ -3926,7 +4016,8 @@ void game_loadmap(int mapnum) {
int clip = 0;
int npc = 0;
- if (scriptflag[4][0] == 1 && x == 9 && y == 7) d = 99;
+ if (scriptflag[4][0] == 1 && x == 9 && y == 7)
+ d = 99;
if (d > 0) {
clip = d % 2;
@@ -3934,11 +4025,14 @@ void game_loadmap(int mapnum) {
npc = d % 2;
d = (d - npc) / 2;
- if (d == 99 && x == 9 && y == 7) clip = 1;
+ if (d == 99 && x == 9 && y == 7)
+ clip = 1;
if (clip) {
- if (d != 99) d = tempmap[6 * 40 + x][y];
- if (d == 99) d = 1;
+ if (d != 99)
+ d = tempmap[6 * 40 + x][y];
+ if (d == 99)
+ d = 1;
int x1 = x * 8;
int y1 = y * 8;
@@ -4014,7 +4108,8 @@ void game_loadmap(int mapnum) {
objmap[x][y] = o;
if (objectinfo[o][0] > 1) {
- if (o > lastobj) lastobj = o;
+ if (o > lastobj)
+ lastobj = o;
}
int x1 = x * 8;
@@ -4025,14 +4120,17 @@ void game_loadmap(int mapnum) {
rcDest.w = 8;
rcDest.h = 8;
- if (objectinfo[o][4] == 1) SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
- if (objectinfo[o][4] == 3) SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ if (objectinfo[o][4] == 1)
+ SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ if (objectinfo[o][4] == 3)
+ SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
}
if (npc == 1) {
int o = tempmap[4 * 40 + x][y];
- if (o > lastnpc) lastnpc = o;
+ if (o > lastnpc)
+ lastnpc = o;
npcinfo[o].x = x * 16 - 4;
npcinfo[o].y = y * 16 - 5;
@@ -4044,14 +4142,21 @@ void game_loadmap(int mapnum) {
}
- if (curmap == 62 && scriptflag[8][0] > 0) lastnpc = 0;
- if (curmap == 73 && scriptflag[12][0] > 0) lastnpc = 0;
- if (curmap == 81 && scriptflag[13][0] > 0) lastnpc = 0;
+ if (curmap == 62 && scriptflag[8][0] > 0)
+ lastnpc = 0;
+ if (curmap == 73 && scriptflag[12][0] > 0)
+ lastnpc = 0;
+ if (curmap == 81 && scriptflag[13][0] > 0)
+ lastnpc = 0;
- if (curmap == 73 && scriptflag[12][0] == 0) roomlock = 1;
- if (curmap == 81 && scriptflag[13][0] == 0) roomlock = 1;
- if (curmap == 83 && scriptflag[15][0] == 0) roomlock = 1;
- if (curmap == 82) roomlock = 1;
+ if (curmap == 73 && scriptflag[12][0] == 0)
+ roomlock = 1;
+ if (curmap == 81 && scriptflag[13][0] == 0)
+ roomlock = 1;
+ if (curmap == 83 && scriptflag[15][0] == 0)
+ roomlock = 1;
+ if (curmap == 82)
+ roomlock = 1;
// read *.npc file
sprintf(name, "mapdb/%04i.npc", mapnum);
@@ -4081,7 +4186,8 @@ void game_loadmap(int mapnum) {
npcinfo[i].walkspd = 1;
- if (RND() * 5 == 0) npcinfo[i].hp = 0;
+ if (RND() * 5 == 0)
+ npcinfo[i].hp = 0;
}
// onewing
@@ -4142,7 +4248,8 @@ void game_loadmap(int mapnum) {
npcinfo[i].walkspd = 1;
- if (RND() * 5 == 0) npcinfo[i].hp = 0;
+ if (RND() * 5 == 0)
+ npcinfo[i].hp = 0;
}
// priest1
@@ -4155,7 +4262,8 @@ void game_loadmap(int mapnum) {
npcinfo[i].walkspd = 1;
- if (RND() * 8 == 0) npcinfo[i].hp = 0;
+ if (RND() * 8 == 0)
+ npcinfo[i].hp = 0;
}
// yellow fire dragon
@@ -4168,7 +4276,8 @@ void game_loadmap(int mapnum) {
npcinfo[i].walkspd = 1;
- if (RND() * 5 == 0) npcinfo[i].hp = 0;
+ if (RND() * 5 == 0)
+ npcinfo[i].hp = 0;
}
// twowing
@@ -4224,7 +4333,8 @@ void game_loadmap(int mapnum) {
npcinfo[i].floating = RND() * 16;
}
- if (npcinfo[i].onmap == 0) npcinfo[i].hp = 0;
+ if (npcinfo[i].onmap == 0)
+ npcinfo[i].hp = 0;
npcinfo[i].maxhp = npcinfo[i].hp;
@@ -4335,7 +4445,8 @@ void game_loadmap(int mapnum) {
lx = (int)npx / 16;
ly = (int)npy / 16;
- if (lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy)
+ player.py = player.py + 16;
SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
@@ -4358,7 +4469,8 @@ void game_loadmap(int mapnum) {
lx = (int)npx / 16;
ly = (int)npy / 16;
- if (lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy)
+ player.py = player.py + 16;
SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
@@ -4381,7 +4493,8 @@ void game_loadmap(int mapnum) {
lx = (int)npx / 16;
ly = (int)npy / 16;
- if (lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy)
+ player.py = player.py + 16;
SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
@@ -4404,7 +4517,8 @@ void game_loadmap(int mapnum) {
lx = (int)npx / 16;
ly = (int)npy / 16;
- if (lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy)
+ player.py = player.py + 16;
SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
@@ -4427,7 +4541,8 @@ void game_loadmap(int mapnum) {
lx = (int)npx / 16;
ly = (int)npy / 16;
- if (lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy)
+ player.py = player.py + 16;
SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
@@ -4450,7 +4565,8 @@ void game_loadmap(int mapnum) {
lx = (int)npx / 16;
ly = (int)npy / 16;
- if (lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy)
+ player.py = player.py + 16;
SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
@@ -4474,7 +4590,8 @@ void game_loadmap(int mapnum) {
lx = (int)npx / 16;
ly = (int)npy / 16;
- if (lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy)
+ player.py = player.py + 16;
SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
@@ -4496,7 +4613,8 @@ void game_loadmap(int mapnum) {
lx = (int)npx / 16;
ly = (int)npy / 16;
- if (lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy)
+ player.py = player.py + 16;
SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
@@ -4518,7 +4636,8 @@ void game_loadmap(int mapnum) {
lx = (int)npx / 16;
ly = (int)npy / 16;
- if (lx == cx && ly == cy) player.py = player.py + 16;
+ if (lx == cx && ly == cy)
+ player.py = player.py + 16;
SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
}
@@ -4562,10 +4681,12 @@ void game_newgame() {
SDL_Rect rc;
ld += 4 * fpsr;
- if ((int)ld > config.musicvol) ld = config.musicvol;
+ if ((int)ld > config.musicvol)
+ ld = config.musicvol;
if (menabled == 1 && ldstop == 0) {
Mix_Volume(musicchannel, (int)ld);
- if ((int)ld == config.musicvol) ldstop = 1;
+ if ((int)ld == config.musicvol)
+ ldstop = 1;
}
rc.x = -xofs;
@@ -4592,7 +4713,8 @@ void game_newgame() {
sys_print(videobuffer, story[i], x, yy, 4);
}
- if (yy < 10 && i == 47) goto __exit_do;
+ if (yy < 10 && i == 47)
+ goto __exit_do;
}
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
@@ -4612,15 +4734,19 @@ void game_newgame() {
}
add = 0.5 * fpsr;
- if (add > 1) add = 1;
+ if (add > 1)
+ add = 1;
xofs += add;
- if (xofs >= 320) xofs = xofs - 320;
+ if (xofs >= 320)
+ xofs = xofs - 320;
SDL_PollEvent(&event);
keys = SDL_GetKeyState(NULL);
- if (event.type == SDL_KEYDOWN) cnt = 6;
- if (keys[SDLK_ESCAPE] || keys[SDLK_LALT]) goto __exit_do;
+ if (event.type == SDL_KEYDOWN)
+ cnt = 6;
+ if (keys[SDLK_ESCAPE] || keys[SDLK_LALT])
+ goto __exit_do;
SDL_Delay(10);
} while (1);
@@ -4715,7 +4841,8 @@ void game_playgame() {
game_checktrigger();
game_checkinputs();
- if (forcepause == 0) game_handlewalking();
+ if (forcepause == 0)
+ game_handlewalking();
game_updatey();
game_drawview();
@@ -4731,7 +4858,8 @@ void game_processtrigger(int trignum) {
trigtype = triggers[trignum][0];
- if (roomlock == 1) return;
+ if (roomlock == 1)
+ return;
// map jump------------------------------
if (trigtype == 0) {
tx = triggers[trignum][1];
@@ -4740,7 +4868,8 @@ void game_processtrigger(int trignum) {
tjumpstyle = triggers[trignum][4];
if (roomlocks[tmap] > 0) {
- if (saidlocked == 0) game_eventtext("Locked");
+ if (saidlocked == 0)
+ game_eventtext("Locked");
saidlocked = 1;
canusekey = 1;
locktype = roomlocks[tmap];
@@ -4749,7 +4878,8 @@ void game_processtrigger(int trignum) {
}
if (tmap == 1) {
- if (saidjammed == 0) game_eventtext("Door Jammed!");
+ if (saidjammed == 0)
+ game_eventtext("Door Jammed!");
saidjammed = 1;
return;
}
@@ -4767,8 +4897,10 @@ void game_processtrigger(int trignum) {
player.py += (ty - tsy) * 16;
// HACKFIX
- if (player.px < 0) player.px = 0;
- if (player.py < 0) player.py = 0;
+ if (player.px < 0)
+ player.px = 0;
+ if (player.py < 0)
+ player.py = 0;
if (tmap > 0) {
if (menabled == 1 && config.effects == 1) {
@@ -4822,7 +4954,6 @@ void game_saveloadnew() {
SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 64);
-
rcDest.x = 256;
rcDest.y = 192;
rcDest.w = 320;
@@ -4853,7 +4984,8 @@ void game_saveloadnew() {
return;
}
// NEW GAME
- if (currow == 0 && curcol == 0) game_newgame();
+ if (currow == 0 && curcol == 0)
+ game_newgame();
// LOAD GAME
if (currow == 0 && curcol == 1) {
@@ -4907,7 +5039,8 @@ void game_saveloadnew() {
switch (event.key.keysym.sym) {
case SDLK_ESCAPE:
case SDLK_LALT:
- if (lowerlock == 0) return;
+ if (lowerlock == 0)
+ return;
lowerlock = 0;
currow = 0;
tickpause = ticks + 125;
@@ -4915,7 +5048,8 @@ void game_saveloadnew() {
case SDLK_DOWN:
if (lowerlock == 1) {
currow = currow + 1;
- if (currow == 5) currow = 1;
+ if (currow == 5)
+ currow = 1;
tickpause = ticks + 125;
}
break;
@@ -4923,7 +5057,8 @@ void game_saveloadnew() {
case SDLK_UP:
if (lowerlock == 1) {
currow = currow - 1;
- if (currow == 0) currow = 4;
+ if (currow == 0)
+ currow = 4;
tickpause = ticks + 125;
}
break;
@@ -4931,7 +5066,8 @@ void game_saveloadnew() {
case SDLK_LEFT:
if (lowerlock == 0) {
curcol = curcol - 1;
- if (curcol == -1) curcol = 3;
+ if (curcol == -1)
+ curcol = 3;
tickpause = ticks + 125;
}
break;
@@ -4939,7 +5075,8 @@ void game_saveloadnew() {
case SDLK_RIGHT:
if (lowerlock == 0) {
curcol = curcol + 1;
- if (curcol == 4) curcol = 0;
+ if (curcol == 4)
+ curcol = 0;
tickpause = ticks + 125;
}
break;
@@ -4991,17 +5128,20 @@ void game_saveloadnew() {
rcSrc.y = sy + 1;
ss = (playera.sword - 1) * 3;
- if (playera.sword == 3) ss = 18;
+ if (playera.sword == 3)
+ ss = 18;
SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
rcSrc.x = rcSrc.x + 16;
ss = (playera.shield - 1) * 3 + 1;
- if (playera.shield == 3) ss = 19;
+ if (playera.shield == 3)
+ ss = 19;
SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
rcSrc.x = rcSrc.x + 16;
ss = (playera.armour - 1) * 3 + 2;
- if (playera.armour == 3) ss = 20;
+ if (playera.armour == 3)
+ ss = 20;
SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
nx = rcSrc.x + 13 + 3 * 8;
@@ -5010,7 +5150,8 @@ void game_saveloadnew() {
if (playera.foundspell[0] == 1) {
for (int i = 0; i < 5; i++) {
rcSrc.x = rcSrc.x + 17;
- if (playera.foundspell[i] == 1) SDL_BlitSurface(itemimg[7 + i], NULL, videobuffer, &rcSrc);
+ if (playera.foundspell[i] == 1)
+ SDL_BlitSurface(itemimg[7 + i], NULL, videobuffer, &rcSrc);
}
}
} else {
@@ -5023,10 +5164,14 @@ void game_saveloadnew() {
if (currow == 0) {
rcDest.y = 18;
- if (curcol == 0) rcDest.x = 10;
- if (curcol == 1) rcDest.x = 108;
- if (curcol == 2) rcDest.x = 170;
- if (curcol == 3) rcDest.x = 230;
+ if (curcol == 0)
+ rcDest.x = 10;
+ if (curcol == 1)
+ rcDest.x = 108;
+ if (curcol == 2)
+ rcDest.x = 170;
+ if (curcol == 3)
+ rcDest.x = 230;
rcDest.x = (float)(rcDest.x + 2 + 2 * sin(3.14159 * 2 * itemyloc / 16));
}
@@ -5040,8 +5185,10 @@ void game_saveloadnew() {
if (lowerlock == 1) {
rcDest.y = 18;
- if (curcol == 1) rcDest.x = 108;
- if (curcol == 2) rcDest.x = 170;
+ if (curcol == 1)
+ rcDest.x = 108;
+ if (curcol == 2)
+ rcDest.x = 170;
rcDest.x = rcDest.x; // + 2 + 2 * sin(-3.14159 * 2 * itemyloc / 16)
SDL_BlitSurface(itemimg[15], NULL, videobuffer, &rcDest);
@@ -5050,8 +5197,10 @@ void game_saveloadnew() {
yy = 255;
if (ticks < ticks1 + 1000) {
yy = 255 * (ticks - ticks1) / 1000;
- if (yy < 0) yy = 0;
- if (yy > 255) yy = 255;
+ if (yy < 0)
+ yy = 0;
+ if (yy > 255)
+ yy = 255;
}
SDL_SetAlpha(videobuffer, SDL_SRCALPHA, (int)yy);
@@ -5075,10 +5224,12 @@ void game_saveloadnew() {
}
clouddeg += 0.01 * fpsr;
- while (clouddeg >= 360) clouddeg -= 360;
+ while (clouddeg >= 360)
+ clouddeg -= 360;
itemyloc += 0.6 * fpsr;
- while (itemyloc >= 16) itemyloc -= 16;
+ while (itemyloc >= 16)
+ itemyloc -= 16;
SDL_Delay(10);
} while (1);
@@ -5099,14 +5250,18 @@ void game_showlogos() {
y = 255.0;
if (ticks < ticks1 + 1000) {
y = 255.0 * ((float)(ticks - ticks1) / 1000.0);
- if (y < 0.0) y = 0.0;
- if (y > 255.0) y = 255.0;
+ if (y < 0.0)
+ y = 0.0;
+ if (y > 255.0)
+ y = 255.0;
}
if (ticks > ticks1 + 3000) {
y = 255.0 - 255.0 * ((float)(ticks - ticks1 - 3000.0) / 1000.0);
- if (y < 0.0) y = 0.0;
- if (y > 255.0) y = 255.0;
+ if (y < 0.0)
+ y = 0.0;
+ if (y > 255.0)
+ y = 255.0;
}
SDL_FillRect(videobuffer, NULL, 0);
@@ -5134,7 +5289,8 @@ void game_showlogos() {
}
SDL_Delay(10);
- if (ticks > ticks1 + 4000) break;
+ if (ticks > ticks1 + 4000)
+ break;
} while (1);
}
@@ -5168,9 +5324,11 @@ void game_swash() {
}
clouddeg += 0.01 * fpsr;
- while (clouddeg >= 360) clouddeg = clouddeg - 360;
+ while (clouddeg >= 360)
+ clouddeg = clouddeg - 360;
- if (y > 10) break;
+ if (y > 10)
+ break;
} while (1);
y = 0;
@@ -5207,9 +5365,11 @@ void game_swash() {
}
clouddeg += 0.01 * fpsr;
- while (clouddeg >= 360) clouddeg = clouddeg - 360;
+ while (clouddeg >= 360)
+ clouddeg = clouddeg - 360;
- if (y > 10) break;
+ if (y > 10)
+ break;
} while (1);
@@ -5288,10 +5448,12 @@ void game_title(int mode) {
SDL_Rect rc;
ld += 4.0 * fpsr;
- if (ld > config.musicvol) ld = config.musicvol;
+ if (ld > config.musicvol)
+ ld = config.musicvol;
if (menabled == 1 && ldstop == 0) {
Mix_Volume(menuchannel, (int)ld);
- if ((int)ld == config.musicvol) ldstop = 1;
+ if ((int)ld == config.musicvol)
+ ldstop = 1;
}
rc.x = -xofs;
@@ -5316,8 +5478,10 @@ void game_title(int mode) {
sys_print(videobuffer, "options", x, y + 16, 4);
sys_print(videobuffer, "quit game", x, y + 32, 4);
- if (mode == 1) sys_print(videobuffer, "return", x, y + 48, 4);
- else sys_print(videobuffer, "(c) 2005 by Daniel 'Syn9' Kennedy", 28, 224, 4);
+ if (mode == 1)
+ sys_print(videobuffer, "return", x, y + 48, 4);
+ else
+ sys_print(videobuffer, "(c) 2005 by Daniel 'Syn9' Kennedy", 28, 224, 4);
rc.x = (float)(x - 16 - 4 * cos(3.14159 * 2 * itemyloc / 16));
rc.y = (float)(y - 4 + 16 * cursel);
@@ -5327,8 +5491,10 @@ void game_title(int mode) {
float yf = 255.0;
if (ticks < ticks1 + 1000) {
yf = 255.0 * ((float)(ticks - ticks1) / 1000.0);
- if (y < 0.0) yf = 0.0;
- if (y > 255.0) yf = 255.0;
+ if (y < 0.0)
+ yf = 0.0;
+ if (y > 255.0)
+ yf = 255.0;
}
SDL_SetAlpha(videobuffer, SDL_SRCALPHA, (int)yf);
@@ -5349,10 +5515,12 @@ void game_title(int mode) {
}
float add = 0.5 * fpsr;
- if (add > 1) add = 1;
+ if (add > 1)
+ add = 1;
xofs = xofs + add;
- if (xofs >= 320.0) xofs -= 320.0;
+ if (xofs >= 320.0)
+ xofs -= 320.0;
itemyloc += 0.75 * fpsr;
@@ -5367,13 +5535,16 @@ void game_title(int mode) {
if (event.type == SDL_KEYDOWN) {
keypause = ticks + 150;
- if ((keys[SDLK_ESCAPE] || keys[SDLK_LALT]) && mode == 1) break;
+ if ((keys[SDLK_ESCAPE] || keys[SDLK_LALT]) && mode == 1)
+ break;
else if (keys[SDLK_UP]) {
cursel--;
- if (cursel < 0) cursel = (mode == 1 ? 3 : 2);
+ if (cursel < 0)
+ cursel = (mode == 1 ? 3 : 2);
} else if (keys[SDLK_DOWN]) {
cursel++;
- if (cursel >= (mode == 1 ? 4 : 3)) cursel = 0;
+ if (cursel >= (mode == 1 ? 4 : 3))
+ cursel = 0;
} else if (keys[SDLK_LCTRL] || keys[SDLK_RETURN]) {
if (cursel == 0) {
game_saveloadnew();
@@ -5387,7 +5558,9 @@ void game_title(int mode) {
ticks1 = ticks;
} else if (cursel == 2) {
exit(1);
- } else if (cursel == 3) break;
+ } else if (cursel == 3) {
+ break;
+ }
}
}
}
@@ -5420,8 +5593,10 @@ void game_updanims() {
frame = frame - nframes;
cframe = (int)frame; // truncate fractional part
- if (cframe > nframes) cframe = nframes - 1;
- if (cframe < 0) cframe = 0;
+ if (cframe > nframes)
+ cframe = nframes - 1;
+ if (cframe < 0)
+ cframe = 0;
objectframe[i][0] = frame;
objectframe[i][1] = cframe;
@@ -5436,7 +5611,8 @@ void game_updatey() {
ysort[i] = -1;
ff = (int)(player.py * 10);
- if (ff < 0) ff = 0; // HACKFIX or ysort[yy] may go out of bounds
+ if (ff < 0) // HACKFIX or ysort[yy] may go out of bounds
+ ff = 0;
player.ysort = ff;
ysort[ff] = 0;
@@ -5447,13 +5623,16 @@ void game_updatey() {
yy = (int)(npcinfo[i].y * 10);
do {
- if (ysort[yy] == -1 || yy == 2400) break;
+ if (ysort[yy] == -1 || yy == 2400)
+ break;
yy = yy + 1;
} while (1);
ysort[yy] = i;
- if (yy < firsty) firsty = yy;
- if (yy > lasty) lasty = yy;
+ if (yy < firsty)
+ firsty = yy;
+ if (yy > lasty)
+ lasty = yy;
}
}
@@ -5465,10 +5644,13 @@ void game_updmusic() {
// if(curmap > 5 && curmap < 42) iplaysound = macademy;
// if(curmap > 47) iplaysound = mgardens;
iplaysound = mgardens;
- if (roomlock == 1) iplaysound = mboss;
+ if (roomlock == 1)
+ iplaysound = mboss;
- if (iplaysound == mboss && pboss) iplaysound = NULL;
- if (iplaysound == mgardens && pgardens) iplaysound = NULL;
+ if (iplaysound == mboss && pboss)
+ iplaysound = NULL;
+ if (iplaysound == mgardens && pgardens)
+ iplaysound = NULL;
if (iplaysound != NULL) {
Mix_HaltChannel(musicchannel);
@@ -5479,22 +5661,29 @@ void game_updmusic() {
pacademy = 0;
pcitadel = 0;
- if (iplaysound == mboss) pboss = 1;
- if (iplaysound == mgardens) pgardens = 1;
+ if (iplaysound == mboss)
+ pboss = 1;
+ if (iplaysound == mgardens)
+ pgardens = 1;
musicchannel = Mix_PlayChannel(-1, iplaysound, -1);
Mix_Volume(musicchannel, config.musicvol);
} else {
if (!Mix_Playing(musicchannel)) {
loopseta = loopseta + 1;
- if (loopseta == 4) loopseta = 0;
+ if (loopseta == 4)
+ loopseta = 0;
if (pgardens == 1) {
Mix_HaltChannel(musicchannel);
- if (pgardens == 1 && loopseta == 0) musicchannel = Mix_PlayChannel(-1, mgardens, 0);
- if (pgardens == 1 && loopseta == 1) musicchannel = Mix_PlayChannel(-1, mgardens2, 0);
- if (pgardens == 1 && loopseta == 2) musicchannel = Mix_PlayChannel(-1, mgardens3, 0);
- if (pgardens == 1 && loopseta == 3) musicchannel = Mix_PlayChannel(-1, mgardens4, 0);
+ if (pgardens == 1 && loopseta == 0)
+ musicchannel = Mix_PlayChannel(-1, mgardens, 0);
+ if (pgardens == 1 && loopseta == 1)
+ musicchannel = Mix_PlayChannel(-1, mgardens2, 0);
+ if (pgardens == 1 && loopseta == 2)
+ musicchannel = Mix_PlayChannel(-1, mgardens3, 0);
+ if (pgardens == 1 && loopseta == 3)
+ musicchannel = Mix_PlayChannel(-1, mgardens4, 0);
}
Mix_Volume(musicchannel, config.musicvol);
@@ -5516,8 +5705,10 @@ void game_updnpcs() {
if (npcinfo[i].hp > 0) {
// is npc walking
pass = 0;
- if (npcinfo[i].attacking == 0) pass = 1;
- if (npcinfo[i].spriteset == 5) pass = 1;
+ if (npcinfo[i].attacking == 0)
+ pass = 1;
+ if (npcinfo[i].spriteset == 5)
+ pass = 1;
if (pass == 1) {
int moveup = 0;
int movedown = 0;
@@ -5532,7 +5723,8 @@ void game_updnpcs() {
wspd = npcinfo[i].walkspd / 4;
- if (npcinfo[i].spriteset == 10) wspd = wspd * 2;
+ if (npcinfo[i].spriteset == 10)
+ wspd = wspd * 2;
int wdir = npcinfo[i].walkdir;
int mode = npcinfo[i].movementmode;
@@ -5540,15 +5732,20 @@ void game_updnpcs() {
xdif = player.px - npx;
ydif = player.py - npy;
- if (abs(xdif) < 4 * 16 && abs(ydif) < 4 * 16 && mode < 3) mode = 0;
- if (npcinfo[i].hp < npcinfo[i].maxhp * 0.25) mode = 3;
+ if (abs(xdif) < 4 * 16 && abs(ydif) < 4 * 16 && mode < 3)
+ mode = 0;
+ if (npcinfo[i].hp < npcinfo[i].maxhp * 0.25)
+ mode = 3;
- if (npcinfo[i].pause > ticks) mode = -1;
- if (npcinfo[i].spriteset == 2 && npcinfo[i].castpause > ticks) mode = -1;
+ if (npcinfo[i].pause > ticks)
+ mode = -1;
+ if (npcinfo[i].spriteset == 2 && npcinfo[i].castpause > ticks)
+ mode = -1;
if (mode == 3) {
mode = 1;
- if (abs(xdif) < 4 * 16 && abs(ydif) < 4 * 16) mode = 3;
+ if (abs(xdif) < 4 * 16 && abs(ydif) < 4 * 16)
+ mode = 3;
}
checkpass = 0;
@@ -5564,17 +5761,25 @@ void game_updnpcs() {
ydif = player.py - npy;
if (abs(xdif) > abs(ydif)) {
- if (xdif < 4) wdir = 2;
- if (xdif > -4) wdir = 3;
+ if (xdif < 4)
+ wdir = 2;
+ if (xdif > -4)
+ wdir = 3;
} else {
- if (ydif < 4) wdir = 0;
- if (ydif > -4) wdir = 1;
+ if (ydif < 4)
+ wdir = 0;
+ if (ydif > -4)
+ wdir = 1;
}
- if (xdif < 4) moveleft = 1;
- if (xdif > -4) moveright = 1;
- if (ydif < 4) moveup = 1;
- if (ydif > -4) movedown = 1;
+ if (xdif < 4)
+ moveleft = 1;
+ if (xdif > -4)
+ moveright = 1;
+ if (ydif < 4)
+ moveup = 1;
+ if (ydif > -4)
+ movedown = 1;
}
// *******************
@@ -5583,7 +5788,8 @@ void game_updnpcs() {
int movingdir = npcinfo[i].movingdir;
- if (npcinfo[i].ticks > ticks + 100000) npcinfo[i].ticks = ticks;
+ if (npcinfo[i].ticks > ticks + 100000)
+ npcinfo[i].ticks = ticks;
if (npcinfo[i].ticks < ticks) {
npcinfo[i].ticks = ticks + 2000;
@@ -5633,17 +5839,25 @@ void game_updnpcs() {
ydif = player.py - npy;
if (abs(xdif) > abs(ydif)) {
- if (xdif < 4) wdir = 3;
- if (xdif > -4) wdir = 2;
+ if (xdif < 4)
+ wdir = 3;
+ if (xdif > -4)
+ wdir = 2;
} else {
- if (ydif < 4) wdir = 1;
- if (ydif > -4) wdir = 0;
+ if (ydif < 4)
+ wdir = 1;
+ if (ydif > -4)
+ wdir = 0;
}
- if (xdif < 4) moveright = 1;
- if (xdif > -4) moveleft = 1;
- if (ydif < 4) movedown = 1;
- if (ydif > -4) moveup = 1;
+ if (xdif < 4)
+ moveright = 1;
+ if (xdif > -4)
+ moveleft = 1;
+ if (ydif < 4)
+ movedown = 1;
+ if (ydif > -4)
+ moveup = 1;
}
// *******************
@@ -5656,10 +5870,12 @@ void game_updnpcs() {
float xp = (npx / 2 + 6);
float yp = (npy / 2 + 10);
- if (npcinfo[i].spriteset == 10) wspd = wspd * 2;
+ if (npcinfo[i].spriteset == 10)
+ wspd = wspd * 2;
float ii = wspd * fpsr;
- if (ii < 1) ii = 1;
+ if (ii < 1)
+ ii = 1;
SDL_LockSurface(clipbg);
@@ -5668,15 +5884,18 @@ void game_updnpcs() {
sy = yp - ii;
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if (npcinfo[i].spriteset == 11) dq = 0;
+ if (npcinfo[i].spriteset == 11)
+ dq = 0;
- if (dq == 0) movinup = 1;
+ if (dq == 0)
+ movinup = 1;
if (dq > 0) {
sx = xp - ii;
sy = yp - ii;
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if (npcinfo[i].spriteset == 11) dq = 0;
+ if (npcinfo[i].spriteset == 11)
+ dq = 0;
if (dq == 0) {
movinup = 1;
movinleft = 1;
@@ -5687,7 +5906,8 @@ void game_updnpcs() {
sy = yp - ii;
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if (npcinfo[i].spriteset == 11) dq = 0;
+ if (npcinfo[i].spriteset == 11)
+ dq = 0;
if (dq == 0) {
movinup = 1;
movinright = 1;
@@ -5700,14 +5920,17 @@ void game_updnpcs() {
sy = yp + ii;
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if (npcinfo[i].spriteset == 11) dq = 0;
- if (dq == 0) movindown = 1;
+ if (npcinfo[i].spriteset == 11)
+ dq = 0;
+ if (dq == 0)
+ movindown = 1;
if (dq > 0) {
sx = xp - ii;
sy = yp + ii;
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if (npcinfo[i].spriteset == 11) dq = 0;
+ if (npcinfo[i].spriteset == 11)
+ dq = 0;
if (dq == 0) {
movindown = 1;
movinleft = 1;
@@ -5718,7 +5941,8 @@ void game_updnpcs() {
sy = yp + ii;
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if (npcinfo[i].spriteset == 11) dq = 0;
+ if (npcinfo[i].spriteset == 11)
+ dq = 0;
if (dq == 0) {
movindown = 1;
movinright = 1;
@@ -5731,14 +5955,17 @@ void game_updnpcs() {
sy = yp;
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if (npcinfo[i].spriteset == 11) dq = 0;
- if (dq == 0) movinleft = 1;
+ if (npcinfo[i].spriteset == 11)
+ dq = 0;
+ if (dq == 0)
+ movinleft = 1;
if (dq > 0) {
sx = xp - ii;
sy = yp - ii;
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if (npcinfo[i].spriteset == 11) dq = 0;
+ if (npcinfo[i].spriteset == 11)
+ dq = 0;
if (dq == 0) {
movinleft = 1;
movinup = 1;
@@ -5749,7 +5976,8 @@ void game_updnpcs() {
sy = yp + ii;
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if (npcinfo[i].spriteset == 11) dq = 0;
+ if (npcinfo[i].spriteset == 11)
+ dq = 0;
if (dq == 0) {
movinleft = 1;
movindown = 1;
@@ -5762,14 +5990,17 @@ void game_updnpcs() {
sy = yp;
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if (npcinfo[i].spriteset == 11) dq = 0;
- if (dq == 0) movinright = 1;
+ if (npcinfo[i].spriteset == 11)
+ dq = 0;
+ if (dq == 0)
+ movinright = 1;
if (dq > 0) {
sx = xp + ii;
sy = yp - ii;
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if (npcinfo[i].spriteset == 11) dq = 0;
+ if (npcinfo[i].spriteset == 11)
+ dq = 0;
if (dq == 0) {
movinright = 1;
movinup = 1;
@@ -5780,7 +6011,8 @@ void game_updnpcs() {
sy = yp + ii;
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if (npcinfo[i].spriteset == 11) dq = 0;
+ if (npcinfo[i].spriteset == 11)
+ dq = 0;
if (dq == 0) {
movinright = 1;
movindown = 1;
@@ -5788,14 +6020,19 @@ void game_updnpcs() {
}
}
- if (movinup) npy = npy - wspd * fpsr;
- if (movindown) npy = npy + wspd * fpsr;
- if (movinleft) npx = npx - wspd * fpsr;
- if (movinright) npx = npx + wspd * fpsr;
+ if (movinup)
+ npy = npy - wspd * fpsr;
+ if (movindown)
+ npy = npy + wspd * fpsr;
+ if (movinleft)
+ npx = npx - wspd * fpsr;
+ if (movinright)
+ npx = npx + wspd * fpsr;
if (checkpass == 1) {
pass = 0;
- if (npx >= npcinfo[i].x1 * 16 - 8 && npx <= npcinfo[i].x2 * 16 + 8 && npy >= npcinfo[i].y1 * 16 - 8 && npy <= npcinfo[i].y2 * 16 + 8) pass = 1;
+ if (npx >= npcinfo[i].x1 * 16 - 8 && npx <= npcinfo[i].x2 * 16 + 8 && npy >= npcinfo[i].y1 * 16 - 8 && npy <= npcinfo[i].y2 * 16 + 8)
+ pass = 1;
if (pass == 0) {
npx = onpx;
npy = onpy;
@@ -5805,7 +6042,8 @@ void game_updnpcs() {
float aspd = wspd;
- if (npcinfo[i].spriteset == 10) aspd = wspd / 2;
+ if (npcinfo[i].spriteset == 10)
+ aspd = wspd / 2;
xp = (npx / 2 + 6);
yp = (npy / 2 + 10);
@@ -5823,13 +6061,16 @@ void game_updnpcs() {
int lx = (int)anpx / 16;
int ly = (int)anpy / 16;
- if (triggerloc[lx][ly] > -1) bgc = 1;
- if (npcinfo[i].spriteset == 11) bgc = 0;
+ if (triggerloc[lx][ly] > -1)
+ bgc = 1;
+ if (npcinfo[i].spriteset == 11)
+ bgc = 0;
int rst = 0;
if (npcinfo[i].spriteset == 11) {
- if (npx < 40 || npx > 280 || npy < 36 || npy > 204) rst = 1;
+ if (npx < 40 || npx > 280 || npy < 36 || npy > 204)
+ rst = 1;
}
if (bgc > 0 || rst == 1) {
@@ -5843,7 +6084,8 @@ void game_updnpcs() {
npcinfo[i].walkdir = wdir;
npcinfo[i].moving = 0;
- if (npx != onpx || npy != onpy) npcinfo[i].moving = 1;
+ if (npx != onpx || npy != onpy)
+ npcinfo[i].moving = 1;
if (npcinfo[i].moving == 1) {
float frame = npcinfo[i].frame;
@@ -5854,8 +6096,10 @@ void game_updnpcs() {
frame = frame - 16;
cframe = (int)(frame);
- if (cframe > 16) cframe = 16 - 1;
- if (cframe < 0) cframe = 0;
+ if (cframe > 16)
+ cframe = 16 - 1;
+ if (cframe < 0)
+ cframe = 0;
npcinfo[i].frame = frame;
npcinfo[i].cframe = cframe;
@@ -5924,7 +6168,8 @@ void game_updnpcs() {
// sway code
npcinfo[i].swayangle = npcinfo[i].swayangle + npcinfo[i].swayspd * fpsr;
- if (npcinfo[i].swayangle >= 360) npcinfo[i].swayangle = npcinfo[i].swayangle - 360;
+ if (npcinfo[i].swayangle >= 360)
+ npcinfo[i].swayangle = npcinfo[i].swayangle - 360;
npcinfo[i].headtargetx[0] = npcinfo[i].x + (24 - npcinfo[i].swayspd / 2) * sin(3.14159 / 180 * npcinfo[i].swayangle) + 12;
npcinfo[i].headtargety[0] = npcinfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * npcinfo[i].swayangle);
@@ -5987,7 +6232,8 @@ void game_updnpcs() {
// sway code
npcinfo[i].swayangle = npcinfo[i].swayangle + npcinfo[i].swayspd * fpsr;
- if (npcinfo[i].swayangle >= 360) npcinfo[i].swayangle = npcinfo[i].swayangle - 360;
+ if (npcinfo[i].swayangle >= 360)
+ npcinfo[i].swayangle = npcinfo[i].swayangle - 360;
for (int ff = 0; ff <= 2; ff++) {
if (npcinfo[i].hp > 10 * ff * 20) {
@@ -6059,8 +6305,10 @@ void game_updnpcs() {
ydif = player.py - npy;
pass = 0;
- if (abs(xdif) < 48 && abs(ydif) < 6) pass = 1;
- if (abs(ydif) < 48 && abs(xdif) < 6) pass = 2;
+ if (abs(xdif) < 48 && abs(ydif) < 6)
+ pass = 1;
+ if (abs(ydif) < 48 && abs(xdif) < 6)
+ pass = 2;
if (pass > 0) {
npcinfo[i].attackattempt = ticks + 100;
@@ -6122,8 +6370,10 @@ void game_updnpcs() {
ydif = player.py - npy;
pass = 0;
- if (abs(xdif) < 56 && abs(ydif) < 6) pass = 1;
- if (abs(ydif) < 56 && abs(xdif) < 6) pass = 2;
+ if (abs(xdif) < 56 && abs(ydif) < 6)
+ pass = 1;
+ if (abs(ydif) < 56 && abs(xdif) < 6)
+ pass = 2;
if (pass > 0) {
npcinfo[i].attackattempt = ticks + 100;
@@ -6196,7 +6446,8 @@ void game_updnpcs() {
// sway code
npcinfo[i].swayangle = npcinfo[i].swayangle + npcinfo[i].swayspd * fpsr;
- if (npcinfo[i].swayangle >= 360) npcinfo[i].swayangle = npcinfo[i].swayangle - 360;
+ if (npcinfo[i].swayangle >= 360)
+ npcinfo[i].swayangle = npcinfo[i].swayangle - 360;
npcinfo[i].headtargetx[0] = npcinfo[i].x + (24 - npcinfo[i].swayspd / 2) * sin(3.14159 / 180 * npcinfo[i].swayangle) + 12;
npcinfo[i].headtargety[0] = npcinfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * npcinfo[i].swayangle);
@@ -6301,15 +6552,20 @@ void game_updnpcs() {
rcSrc.w = 3;
rcSrc.h = 3;
- if (npcinfo[i].pause < ticks) SDL_FillRect(clipbg, &rcSrc, i);
+ if (npcinfo[i].pause < ticks)
+ SDL_FillRect(clipbg, &rcSrc, i);
pass = 0;
- if (npcinfo[i].attacking == 1) pass = 1;
+ if (npcinfo[i].attacking == 1)
+ pass = 1;
if (npcinfo[i].spriteset == 5) {
- if (npcinfo[i].attacking2[0] == 1) pass = 1;
- if (npcinfo[i].attacking2[1] == 1) pass = 1;
- if (npcinfo[i].attacking2[2] == 1) pass = 1;
+ if (npcinfo[i].attacking2[0] == 1)
+ pass = 1;
+ if (npcinfo[i].attacking2[1] == 1)
+ pass = 1;
+ if (npcinfo[i].attacking2[2] == 1)
+ pass = 1;
}
if (pass == 1) {
@@ -6339,7 +6595,8 @@ void game_updnpcs() {
damage = (float)npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
- if (player.hp > 0) game_damageplayer(damage);
+ if (player.hp > 0)
+ game_damageplayer(damage);
}
}
@@ -6387,7 +6644,8 @@ void game_updnpcs() {
// npcinfo[i].attackframe = 0
// npcinfo[i].attacking = 0
damage = (float)npcinfo[i].attackdamage * (1.0 + (RND() * 0.5));
- if (player.hp > 0) game_damageplayer(damage);
+ if (player.hp > 0)
+ game_damageplayer(damage);
}
}
@@ -6438,7 +6696,8 @@ void game_updnpcs() {
// npcinfo[i].attackframe2(ff) = 0
// npcinfo[i].attacking2(ff) = 0
damage = (float)npcinfo[i].attackdamage * (1.0 + RND() * 0.5);
- if (player.hp > 0) game_damageplayer(damage);
+ if (player.hp > 0)
+ game_damageplayer(damage);
}
}
}
@@ -6490,7 +6749,8 @@ void game_updnpcs() {
// npcinfo[i].attackframe = 0
// npcinfo[i].attacking = 0
damage = (float)npcinfo[i].attackdamage * (1.0 + RND() * 0.5);
- if (player.hp > 0) game_damageplayer(damage);
+ if (player.hp > 0)
+ game_damageplayer(damage);
}
}
@@ -6519,7 +6779,8 @@ void game_updnpcs() {
// npcinfo[i].attackframe = 0
// npcinfo[i].attacking = 0
damage = (float)npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
- if (player.hp > 0) game_damageplayer(damage);
+ if (player.hp > 0)
+ game_damageplayer(damage);
}
}
@@ -6547,7 +6808,8 @@ void game_updnpcs() {
// npcinfo[i].attackframe = 0
// npcinfo[i].attacking = 0
damage = (float)npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
- if (player.hp > 0) game_damageplayer(damage);
+ if (player.hp > 0)
+ game_damageplayer(damage);
}
}
}
@@ -6604,8 +6866,10 @@ void game_updspells() {
if (fr >= f * 4 + 8) {
int fi = 0; // ??
- if (f == 0 || f == 2) fi = 0;
- if (f == 1 || f == 3) fi = 1;
+ if (f == 0 || f == 2)
+ fi = 0;
+ if (f == 1 || f == 3)
+ fi = 1;
rcSrc.x = 32 + fi * 16;
rcSrc.y = 80;
rcSrc.w = 16;
@@ -6711,7 +6975,8 @@ void game_updspells() {
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
- if (spellinfo[i].frame < 0) spellinfo[i].frame = 0;
+ if (spellinfo[i].frame < 0)
+ spellinfo[i].frame = 0;
if (spellinfo[i].damagewho == 0) {
for (int e = 1; e <= lastnpc; e++) {
@@ -6888,7 +7153,8 @@ void game_updspells() {
}
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
- if (spellinfo[i].frame < 0) spellinfo[i].frame = 0;
+ if (spellinfo[i].frame < 0)
+ spellinfo[i].frame = 0;
}
// crystal
@@ -6906,8 +7172,10 @@ void game_updspells() {
rcDest.y = player.py + 16 - 48;
int f = 160;
- if (fra < 8) f = 192 * fra / 8;
- if (fra > 24) f = 192 * (1 - (fra - 24) / 8);
+ if (fra < 8)
+ f = 192 * fra / 8;
+ if (fra > 24)
+ f = 192 * (1 - (fra - 24) / 8);
SDL_SetAlpha(spellimg, SDL_SRCALPHA, f);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
@@ -6945,13 +7213,15 @@ void game_updspells() {
int curtiley = (curtile - curtilex) / 20;
int element = elementmap[curtiley][curtilex];
- if (element > -1 && curtilel == 0) foundel[element + 1] = 1;
+ if (element > -1 && curtilel == 0)
+ foundel[element + 1] = 1;
}
}
int o = objmap[sx][sy];
if (o > -1) {
- if (objectinfo[o][4] == 1) foundel[2] = 1;
+ if (objectinfo[o][4] == 1)
+ foundel[2] = 1;
if (o == 1 || o == 2) {
foundel[2] = 1;
foundel[4] = 1;
@@ -6968,10 +7238,14 @@ void game_updspells() {
if (foundel[f] == 1 && player.foundspell[f] == 0) {
player.foundspell[f] = 1;
player.spellcharge[f] = 0;
- if (f == 1) strcpy(line, "Found... Water Essence");
- if (f == 2) strcpy(line, "Found... Metal Essence");
- if (f == 3) strcpy(line, "Found... Earth Essence");
- if (f == 4) strcpy(line, "Found... Fire Essence");
+ if (f == 1)
+ strcpy(line, "Found... Water Essence");
+ if (f == 2)
+ strcpy(line, "Found... Metal Essence");
+ if (f == 3)
+ strcpy(line, "Found... Earth Essence");
+ if (f == 4)
+ strcpy(line, "Found... Fire Essence");
break;
}
}
@@ -7039,14 +7313,16 @@ void game_updspells() {
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
}
- if (xloc < -1 || yloc < -1 || xloc > 304 || yloc > 224) spellinfo[i].ballon[ff] = 0;
+ if (xloc < -1 || yloc < -1 || xloc > 304 || yloc > 224)
+ spellinfo[i].ballon[ff] = 0;
}
SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
}
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
- if (spellinfo[i].frame < 0) spellinfo[i].frame = 0;
+ if (spellinfo[i].frame < 0)
+ spellinfo[i].frame = 0;
if (spellinfo[i].damagewho == 1) {
for (int ff = 0; ff <= spellinfo[i].nfballs - 1; ff++) {
@@ -7060,7 +7336,8 @@ void game_updspells() {
if ((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks) {
float damage = npcinfo[spellinfo[i].npc].spelldamage * (1 + RND() * 0.5) / 3;
- if (player.hp > 0) game_damageplayer(damage);
+ if (player.hp > 0)
+ game_damageplayer(damage);
if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndfire], 0);
@@ -7091,14 +7368,18 @@ void game_updspells() {
for (int x = apx; x <= 319; x++) {
int rn = (int)(RND() * 3);
- if (orn == 0) y = y - 1;
- if (orn == 2) y = y + 1;
+ if (orn == 0)
+ y = y - 1;
+ if (orn == 2)
+ y = y + 1;
sys_line(videobuffer, x, y - 1, x, y + 2, cl1);
sys_line(videobuffer, x, y, x, y + 1, cl3);
- if (rn == 0) sys_line(videobuffer, x, y + 1, x, y + 1, cl2);
- if (rn == 2) sys_line(videobuffer, x, y, x, y, cl2);
+ if (rn == 0)
+ sys_line(videobuffer, x, y + 1, x, y + 1, cl2);
+ if (rn == 2)
+ sys_line(videobuffer, x, y, x, y, cl2);
orn = rn;
@@ -7111,7 +7392,8 @@ void game_updspells() {
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = 30 * (1 + RND() * 0.5);
- if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) game_damagenpc(e, damage, 1);
+ if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks)
+ game_damagenpc(e, damage, 1);
}
}
}
@@ -7144,14 +7426,18 @@ void game_updspells() {
for (int x = apx; x >= 0; x--) {
int rn = (int)(RND() * 3);
- if (orn == 0) y = y - 1;
- if (orn == 2) y = y + 1;
+ if (orn == 0)
+ y = y - 1;
+ if (orn == 2)
+ y = y + 1;
sys_line(videobuffer, x, y - 1, x, y + 2, cl1);
sys_line(videobuffer, x, y, x, y + 1, cl3);
- if (rn == 0) sys_line(videobuffer, x, y + 1, x, y + 1, cl2);
- if (rn == 2) sys_line(videobuffer, x, y, x, y, cl2);
+ if (rn == 0)
+ sys_line(videobuffer, x, y + 1, x, y + 1, cl2);
+ if (rn == 2)
+ sys_line(videobuffer, x, y, x, y, cl2);
orn = rn;
@@ -7164,7 +7450,8 @@ void game_updspells() {
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = 30 * (1 + RND() * 0.5);
- if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) game_damagenpc(e, damage, 1);
+ if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks)
+ game_damagenpc(e, damage, 1);
}
}
}
@@ -7197,14 +7484,18 @@ void game_updspells() {
for (int y = apy; y <= 239; y++) {
int rn = (int)(RND() * 3);
- if (orn == 0) x = x - 1;
- if (orn == 2) x = x + 1;
+ if (orn == 0)
+ x = x - 1;
+ if (orn == 2)
+ x = x + 1;
sys_line(videobuffer, x - 1, y, x + 2, y, cl1);
sys_line(videobuffer, x, y, x + 1, y, cl3);
- if (rn == 0) sys_line(videobuffer, x + 1, y, x + 1, y, cl2);
- if (rn == 2) sys_line(videobuffer, x, y, x, y, cl2);
+ if (rn == 0)
+ sys_line(videobuffer, x + 1, y, x + 1, y, cl2);
+ if (rn == 2)
+ sys_line(videobuffer, x, y, x, y, cl2);
orn = rn;
@@ -7216,7 +7507,8 @@ void game_updspells() {
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = 30 * (1 + RND() * 0.5);
- if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) game_damagenpc(e, damage, 1);
+ if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks)
+ game_damagenpc(e, damage, 1);
}
}
}
@@ -7249,14 +7541,18 @@ void game_updspells() {
for (int y = apy; y >= 0; y--) {
int rn = (int)(RND() * 3);
- if (orn == 0) x = x - 1;
- if (orn == 2) x = x + 1;
+ if (orn == 0)
+ x = x - 1;
+ if (orn == 2)
+ x = x + 1;
sys_line(videobuffer, x - 1, y, x + 2, y, cl1);
sys_line(videobuffer, x, y, x + 1, y, cl3);
- if (rn == 0) sys_line(videobuffer, x + 1, y, x + 1, y, cl2);
- if (rn == 2) sys_line(videobuffer, x, y, x, y, cl2);
+ if (rn == 0)
+ sys_line(videobuffer, x + 1, y, x + 1, y, cl2);
+ if (rn == 2)
+ sys_line(videobuffer, x, y, x, y, cl2);
orn = rn;
@@ -7268,7 +7564,8 @@ void game_updspells() {
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = 30 * (1 + RND() * 0.5);
- if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) game_damagenpc(e, damage, 1);
+ if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks)
+ game_damagenpc(e, damage, 1);
}
}
}
@@ -7324,14 +7621,18 @@ void game_updspells() {
float xdif, ydif;
int rn = (int)(RND() * 3);
- if (orn == 0) x = x - 1;
- if (orn == 2) x = x + 1;
+ if (orn == 0)
+ x = x - 1;
+ if (orn == 2)
+ x = x + 1;
sys_line(videobuffer, x - 1, y, x + 2, y, cl1);
sys_line(videobuffer, x, y, x + 1, y, cl3);
- if (rn == 0) sys_line(videobuffer, x + 1, y, x + 1, y, cl2);
- if (rn == 2) sys_line(videobuffer, x, y, x, y, cl2);
+ if (rn == 0)
+ sys_line(videobuffer, x + 1, y, x + 1, y, cl2);
+ if (rn == 2)
+ sys_line(videobuffer, x, y, x, y, cl2);
orn = rn;
@@ -7342,13 +7643,16 @@ void game_updspells() {
if ((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks) {
float damage = ((float)player.hp * 0.75) * (RND() * 0.5 + 0.5);
- if (damage < 5) damage = 5;
+ if (damage < 5)
+ damage = 5;
if (npcinfo[spellinfo[i].npc].spriteset == 12) {
- if (damage < 50) damage = 40 + (int)(RND() * 40);
+ if (damage < 50)
+ damage = 40 + (int)(RND() * 40);
}
- if (player.hp > 0) game_damageplayer(damage);
+ if (player.hp > 0)
+ game_damageplayer(damage);
}
}
}
@@ -7372,7 +7676,8 @@ void game_updspellsunder() {
unsigned int dq, *temp;
- if (forcepause == 1) return;
+ if (forcepause == 1)
+ return;
for (int i = 0; i < kMaxSpell; i++) {
if (spellinfo[i].frame > 0) {
@@ -7392,15 +7697,18 @@ void game_updspellsunder() {
rcDest.y = spellinfo[i].enemyy - 8;
int f = 160;
- if (fra < 8) f = 160 * fra / 8;
- if (fra > 24) f = 160 * (1 - (fra - 24) / 8);
+ if (fra < 8)
+ f = 160 * fra / 8;
+ if (fra > 24)
+ f = 160 * (1 - (fra - 24) / 8);
SDL_SetAlpha(spellimg, SDL_SRCALPHA, f);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
- if (spellinfo[i].frame < 0) spellinfo[i].frame = 0;
+ if (spellinfo[i].frame < 0)
+ spellinfo[i].frame = 0;
for (int f = 1; f <= lastnpc; f++) {
@@ -7409,7 +7717,8 @@ void game_updspellsunder() {
float dist = sqrt(xdif * xdif + ydif * ydif);
- if (dist > 20) dist = 20;
+ if (dist > 20)
+ dist = 20;
if (dist > 5) {
float ratio = (1 - dist / 25);
@@ -7437,7 +7746,8 @@ void game_updspellsunder() {
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if (dq == 0) xpass = 1;
+ if (dq == 0)
+ xpass = 1;
sx = (npcinfo[f].x / 2 + 6);
@@ -7445,7 +7755,8 @@ void game_updspellsunder() {
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if (dq == 0) ypass = 1;
+ if (dq == 0)
+ ypass = 1;
if (ypass == 1) {
newx = npcinfo[f].x;
@@ -7469,10 +7780,12 @@ void game_updspellsunder() {
fr = fr * fr * (1 - cos(3.14159 / 4 + 3.14159 / 4 * fr / 32));
- if (fr > 32) fr = 32;
+ if (fr > 32)
+ fr = 32;
float s = 8;
- if (spellinfo[i].frame < 8) s = spellinfo[i].frame;
+ if (spellinfo[i].frame < 8)
+ s = spellinfo[i].frame;
int fra = (int)fr;
@@ -7501,7 +7814,8 @@ void game_updspellsunder() {
temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
dq = *temp;
- if (dq > 1000 && x > 4) spellinfo[i].legalive[f] = x;
+ if (dq > 1000 && x > 4)
+ spellinfo[i].legalive[f] = x;
if (spellinfo[i].damagewho == 0) {
for (int e = 1; e <= lastnpc; e++) {
@@ -7511,8 +7825,10 @@ void game_updspellsunder() {
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = (float)player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
- if (npcinfo[e].spriteset == 5) damage = -damage;
- if (npcinfo[e].spriteset == 11) damage = -damage;
+ if (npcinfo[e].spriteset == 5)
+ damage = -damage;
+ if (npcinfo[e].spriteset == 11)
+ damage = -damage;
if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
game_damagenpc(e, damage, 1);
if (menabled == 1 && config.effects == 1) {
@@ -7576,7 +7892,8 @@ void game_updspellsunder() {
SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
- if (spellinfo[i].frame < 0) spellinfo[i].frame = 0;
+ if (spellinfo[i].frame < 0)
+ spellinfo[i].frame = 0;
}
@@ -7591,13 +7908,18 @@ void game_updspellsunder() {
for (int f = 0; f <= 7; f++) {
int alpha = 0;
float xx = 0;
- if (fr > f * 2 && fr < f * 2 + 16) xx = fr - f * 2;
- if (xx < 8) alpha = 255 * xx / 8;
- if (xx > 8) alpha = 255 * (1 - (xx - 8) / 8);
+ if (fr > f * 2 && fr < f * 2 + 16)
+ xx = fr - f * 2;
+ if (xx < 8)
+ alpha = 255 * xx / 8;
+ if (xx > 8)
+ alpha = 255 * (1 - (xx - 8) / 8);
float yy = 16 * sin(3.141592 / 2 * xx / 16) - 8;
- if (alpha < 0) alpha = 0;
- if (alpha > 255) alpha = 255;
+ if (alpha < 0)
+ alpha = 0;
+ if (alpha > 255)
+ alpha = 255;
SDL_SetAlpha(spellimg, SDL_SRCALPHA, alpha);
@@ -7639,7 +7961,8 @@ void game_updspellsunder() {
SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
spellinfo[i].frame = spellinfo[i].frame - 0.5 * fpsr;
- if (spellinfo[i].frame < 0) spellinfo[i].frame = 0;
+ if (spellinfo[i].frame < 0)
+ spellinfo[i].frame = 0;
if (spellinfo[i].frame == 0) {
npcinfo[spellinfo[i].npc].attacking = 0;
@@ -8179,18 +8502,21 @@ void sys_update() {
spd = 0.5 * fpsr;
floattext[i][0] = floattext[i][0] - spd;
floattext[i][2] = floattext[i][2] - spd;
- if (floattext[i][0] < 0) floattext[i][0] = 0;
+ if (floattext[i][0] < 0)
+ floattext[i][0] = 0;
}
if (floaticon[i][0] > 0) {
spd = 0.5 * fpsr;
floaticon[i][0] = floaticon[i][0] - spd;
floaticon[i][2] = floaticon[i][2] - spd;
- if (floaticon[i][0] < 0) floaticon[i][0] = 0;
+ if (floaticon[i][0] < 0)
+ floaticon[i][0] = 0;
}
}
- if (player.level == player.maxlevel) player.exp = 0;
+ if (player.level == player.maxlevel)
+ player.exp = 0;
if (player.exp >= player.nextlevel) {
player.level = player.level + 1;
@@ -8198,7 +8524,8 @@ void sys_update() {
player.exp = player.exp - player.nextlevel;
player.nextlevel = player.nextlevel * 3 / 2; // 1.5
player.maxhp = player.maxhp + player.level * 3;
- if (player.maxhp > 999) player.maxhp = 999;
+ if (player.maxhp > 999)
+ player.maxhp = 999;
player.hp = player.maxhp;
player.sworddamage = player.level * 14 / 10;
@@ -8224,8 +8551,10 @@ void sys_update() {
if (forcepause == 0) {
for (int i = 0; i < 5; i++) {
- if (player.foundspell[i] == 1) player.spellcharge[i] += 1 * player.level * 0.01 * fpsr;
- if (player.spellcharge[i] > 100) player.spellcharge[i] = 100;
+ if (player.foundspell[i] == 1)
+ player.spellcharge[i] += 1 * player.level * 0.01 * fpsr;
+ if (player.spellcharge[i] > 100)
+ player.spellcharge[i] = 100;
}
if (player.foundspell[0]) {
@@ -8235,29 +8564,36 @@ void sys_update() {
player.attackstrength += (30 + 3 * (float)player.level) / 50 * fpsr;
}
- if (player.attackstrength > 100) player.attackstrength = 100;
+ if (player.attackstrength > 100)
+ player.attackstrength = 100;
- if (player.spellstrength > 100) player.spellstrength = 100;
+ if (player.spellstrength > 100)
+ player.spellstrength = 100;
itemyloc += 0.75 * fpsr;
- while (itemyloc >= 16) itemyloc -= 16;
+ while (itemyloc >= 16)
+ itemyloc -= 16;
- if (player.hp <= 0) game_theend();
+ if (player.hp <= 0)
+ game_theend();
if (roomlock == 1) {
roomlock = 0;
for (int i = 1; i <= lastnpc; i++)
- if (npcinfo[i].hp > 0) roomlock = 1;
+ if (npcinfo[i].hp > 0)
+ roomlock = 1;
}
clouddeg += 0.1 * fpsr;
- while (clouddeg >= 360) clouddeg = clouddeg - 360;
+ while (clouddeg >= 360)
+ clouddeg = clouddeg - 360;
player.hpflash = player.hpflash + 0.1 * fpsr;
if (player.hpflash >= 2) {
player.hpflash = 0;
player.hpflashb = player.hpflashb + 1;
- if (player.hpflashb == 2) player.hpflashb = 0;
+ if (player.hpflashb == 2)
+ player.hpflashb = 0;
if (menabled == 1 && config.effects == 1 && player.hpflashb == 0 && player.hp < player.maxhp / 4) {
int snd = Mix_PlayChannel(-1, sfx[sndbeep], 0);
Mix_Volume(snd, config.effectsvol);
@@ -8266,11 +8602,14 @@ void sys_update() {
// cloudson = 0
- if (itemselon == 1) player.itemselshade = player.itemselshade + 2 * fpsr;
- if (player.itemselshade > 24) player.itemselshade = 24;
+ if (itemselon == 1)
+ player.itemselshade = player.itemselshade + 2 * fpsr;
+ if (player.itemselshade > 24)
+ player.itemselshade = 24;
for (int i = 0; i <= 4; i++)
- if (player.inventory[i] > 9) player.inventory[i] = 9;
+ if (player.inventory[i] > 9)
+ player.inventory[i] = 9;
}
} // end of namespace Griffon
Commit: 1e2d89b7cb344647b68a3279e5147acb2cd8c701
https://github.com/scummvm/scummvm/commit/1e2d89b7cb344647b68a3279e5147acb2cd8c701
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Further work on compilation fixes
Changed paths:
engines/griffon/engine.cpp
engines/griffon/module.mk
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 5be6ed2..03864b0 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -35,9 +35,13 @@
*/
#include "griffon/griffon.h"
+#include "griffon/engine.h"
#include "griffon/config.h"
#include "griffon/state.h"
+#include "common/events.h"
+#include "graphics/transparent_surface.h"
+
namespace Griffon {
// memo
@@ -93,13 +97,13 @@ namespace Griffon {
Graphics::TransparentSurface *video, *videobuffer, *videobuffer2, *videobuffer3;
Graphics::TransparentSurface *titleimg, *titleimg2, *inventoryimg;
Graphics::TransparentSurface *logosimg, *theendimg;
-SDL_Event event;
+Common::Event event;
Graphics::TransparentSurface *mapbg, *clipbg, *clipbg2;
unsigned int clipsurround[4][4];
int fullscreen;
-Uint8 *keys;
+uint8 *keys;
float animspd;
int rampdata[40][24];
@@ -119,12 +123,12 @@ int ticks, tickspassed, nextticks;
float fp, fps, fpsr;
int secsingame, secstart;
-extern char *story[48];
+extern const char *story[48];
Graphics::TransparentSurface *mapimg[4];
extern int invmap[4][7][13];
-extern char *story2[27];
+extern const char *story2[27];
-SDL_Rect rcSrc, rcDest;
+Common::Rect rcSrc, rcDest;
// -----------special case
int dontdrawover; // used in map24 so that the candles dont draw over the boss, default set to 0
@@ -241,7 +245,7 @@ int elementmap[15][20] = {
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
};
-char *story[48] = {
+const char *story[48] = {
"The Griffon Legend",
"http://syn9.thehideoutgames.com/",
"",
@@ -292,7 +296,7 @@ char *story[48] = {
"with that honor as well."
};
-char *story2[27] = {
+const char *story2[27] = {
"After the fall of Margrave Gradius,",
"All the dragons, struck with panic,",
"evacuated the city immediately.",
@@ -390,9 +394,9 @@ int invmap[4][7][13] = {
#define SDL_BLITVIDEO(X, Y, C, F) sdl_blitscale((X), (Y), (C), NULL)
#endif
-void sdl_blitscale(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) {
+void sdl_blitscale(Graphics::TransparentSurface *src, Common::Rect *srcrect, Graphics::TransparentSurface *dst, Common::Rect *dstrect) {
if (src->w != dst->w) {
- SDL_Surface *scale2x = NULL;
+ Graphics::TransparentSurface *scale2x = NULL;
scale2x = zoomSurface(src, 2, 2, 0);
SDL_BlitSurface(scale2x, NULL, dst, NULL);
@@ -403,15 +407,8 @@ void sdl_blitscale(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Re
}
-void game_fillrect(SDL_Surface *surface, int x, int y, int w, int h, int color) {
- SDL_Rect src;
-
- src.x = x;
- src.y = y;
- src.w = w;
- src.h = h;
-
- SDL_FillRect(surface, &src, color);
+void game_fillrect(Graphics::TransparentSurface *surface, int x, int y, int w, int h, int color) {
+ surface->fillRect(Common::Rect(x, y, x + w, y + h), color);
}
// copypaste from hRnd_CRT()
@@ -1308,7 +1305,7 @@ void game_checktrigger() {
void game_configmenu() {
Graphics::TransparentSurface *configwindow;
- SDL_Rect rc;
+ Common::Rect rc;
int cursel, curselt, ofullscreen;
int tickwait, keypause, ticks1;
@@ -3223,7 +3220,7 @@ void game_drawplayer() {
}
void game_drawview() {
- SDL_Rect rc;
+ Common::Rect rc;
SDL_BlitSurface(mapbg, NULL, videobuffer, NULL);
@@ -3335,7 +3332,7 @@ void game_endofgame() {
float y = 140;
do {
- SDL_Rect rc;
+ Common::Rect rc;
rc.x = -xofs;
rc.y = 0;
@@ -3835,7 +3832,7 @@ void game_handlewalking() {
void game_loadmap(int mapnum) {
unsigned int ccc;
- SDL_Rect trect;
+ Common::Rect trect;
FILE *fp;
char name[256];
int tempmap[320][200];
@@ -4678,7 +4675,7 @@ void game_newgame() {
int ldstop = 0;
do {
- SDL_Rect rc;
+ Common::Rect rc;
ld += 4 * fpsr;
if ((int)ld > config.musicvol)
@@ -5445,7 +5442,7 @@ void game_title(int mode) {
float ld = 0;
do {
- SDL_Rect rc;
+ Common::Rect rc;
ld += 4.0 * fpsr;
if (ld > config.musicvol)
@@ -8048,7 +8045,7 @@ void sys_initialize() {
sys_setupAudio();
}
-void sys_line(SDL_Surface *buffer, int x1, int y1, int x2, int y2, int col) {
+void sys_line(Graphics::TransparentSurface *buffer, int x1, int y1, int x2, int y2, int col) {
unsigned int *temp;
SDL_LockSurface(buffer);
@@ -8222,7 +8219,7 @@ void sys_LoadAnims() {
}
void sys_LoadItemImgs() {
- SDL_Surface *temp;
+ Graphics::TransparentSurface *temp;
temp = IMG_Load("art/icons.bmp");
@@ -8242,7 +8239,7 @@ void sys_LoadItemImgs() {
}
void sys_LoadFont() {
- SDL_Surface *font;
+ Graphics::TransparentSurface *font;
font = IMG_Load("art/font.bmp");
@@ -8325,7 +8322,7 @@ void sys_LoadObjectDB() {
fclose(fp);
}
-void sys_print(SDL_Surface *buffer, char *stri, int xloc, int yloc, int col) {
+void sys_print(Graphics::TransparentSurface *buffer, char *stri, int xloc, int yloc, int col) {
int l = strlen(stri);
for (int i = 0; i < l; i++) {
@@ -8349,7 +8346,7 @@ void sys_progress(int w, int wm) {
}
void sys_setupAudio() {
- SDL_Surface *loadimg;
+ Graphics::TransparentSurface *loadimg;
menabled = 1;
@@ -8540,7 +8537,7 @@ void sys_update() {
SDL_UnlockSurface(clipbg);
SDL_BlitSurface(clipbg2, NULL, clipbg, NULL);
- SDL_Rect rc;
+ Common::Rect rc;
rc.x = player.px - 2;
rc.y = player.py - 2;
diff --git a/engines/griffon/module.mk b/engines/griffon/module.mk
index 5b24baf..d4208a2 100644
--- a/engines/griffon/module.mk
+++ b/engines/griffon/module.mk
@@ -1,6 +1,7 @@
MODULE := engines/griffon
MODULE_OBJS := \
+ engine.o \
griffon.o \
detection.o
Commit: 7ef71a98c28e7c58299eb51f9c4d953099b5ac5c
https://github.com/scummvm/scummvm/commit/7ef71a98c28e7c58299eb51f9c4d953099b5ac5c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Get rid of engine.h
Changed paths:
R engines/griffon/engine.h
engines/griffon/config.h
engines/griffon/engine.cpp
engines/griffon/griffon.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/config.h b/engines/griffon/config.h
index 7765918..78a7b1b 100644
--- a/engines/griffon/config.h
+++ b/engines/griffon/config.h
@@ -39,7 +39,7 @@
namespace Griffon {
-typedef struct {
+struct CONFIG {
int scr_width;
int scr_height;
int scr_bpp;
@@ -50,7 +50,7 @@ typedef struct {
int musicvol;
int effects;
int effectsvol;
-} CONFIG;
+};
extern CONFIG config;
extern char config_ini[];
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 03864b0..07e1424 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -35,7 +35,6 @@
*/
#include "griffon/griffon.h"
-#include "griffon/engine.h"
#include "griffon/config.h"
#include "griffon/state.h"
@@ -93,6 +92,11 @@ namespace Griffon {
*/
+// stubs
+typedef int Mix_Chunk;
+void Mix_Volume(int channel, int volume) {}
+int Mix_PlayChannel(int par1, Mix_Chunk *chunk, int par3);
+
// system
Graphics::TransparentSurface *video, *videobuffer, *videobuffer2, *videobuffer3;
Graphics::TransparentSurface *titleimg, *titleimg2, *inventoryimg;
@@ -218,12 +222,10 @@ int ysort[2401], lasty, firsty;
int pmenu;
-int griffon_main() {
+void GriffonEngine::griffon_main() {
sys_initialize();
game_showlogos();
game_main();
-
- return 0;
}
// element tile locations
@@ -395,16 +397,7 @@ int invmap[4][7][13] = {
#endif
void sdl_blitscale(Graphics::TransparentSurface *src, Common::Rect *srcrect, Graphics::TransparentSurface *dst, Common::Rect *dstrect) {
- if (src->w != dst->w) {
- Graphics::TransparentSurface *scale2x = NULL;
-
- scale2x = zoomSurface(src, 2, 2, 0);
- SDL_BlitSurface(scale2x, NULL, dst, NULL);
- SDL_FreeSurface(scale2x);
- } else {
- SDL_BlitSurface(src, NULL, dst, NULL);
- }
-
+ SDL_BlitSurface(src, NULL, dst, NULL);
}
void game_fillrect(Graphics::TransparentSurface *surface, int x, int y, int w, int h, int color) {
@@ -417,7 +410,7 @@ static float RND() {
return (float)rand() * (1.0 / ((float)RAND_MAX + 1.0));
}
-void game_addFloatIcon(int ico, float xloc, float yloc) {
+void GriffonEngine::game_addFloatIcon(int ico, float xloc, float yloc) {
for (int i = 0; i < kMaxFloat; i++) {
if (floaticon[i][0] == 0) {
floaticon[i][0] = 32;
@@ -429,7 +422,7 @@ void game_addFloatIcon(int ico, float xloc, float yloc) {
}
}
-void game_addFloatText(char *stri, float xloc, float yloc, int col) {
+void GriffonEngine::game_addFloatText(char *stri, float xloc, float yloc, int col) {
for (int i = 0; i < kMaxFloat; i++) {
if (floattext[i][0] == 0) {
floattext[i][0] = 32;
@@ -442,7 +435,7 @@ void game_addFloatText(char *stri, float xloc, float yloc, int col) {
}
}
-void game_attack() {
+void GriffonEngine::game_attack() {
float npx, npy;
npx = player.px + 12;
@@ -826,7 +819,7 @@ void game_attack() {
}
}
-void game_castspell(int spellnum, float homex, float homey, float enemyx, float enemyy, int damagewho) {
+void GriffonEngine::game_castspell(int spellnum, float homex, float homey, float enemyx, float enemyy, int damagewho) {
// spellnum 7 = sprite 6 spitfire
for (int i = 0; i < kMaxSpell; i++) {
@@ -910,7 +903,7 @@ void game_castspell(int spellnum, float homex, float homey, float enemyx, float
}
}
-void game_checkhit() {
+void GriffonEngine::game_checkhit() {
float npx, npy;
float damage;
@@ -958,7 +951,7 @@ void game_checkhit() {
}
}
-void game_checkinputs() {
+void GriffonEngine::game_checkinputs() {
int ntickdelay;
ntickdelay = 175;
@@ -1303,7 +1296,7 @@ void game_checktrigger() {
#define SY (38 + (240 - 38) / 2 - 88)
#endif
-void game_configmenu() {
+void GriffonEngine::game_configmenu() {
Graphics::TransparentSurface *configwindow;
Common::Rect rc;
int cursel, curselt, ofullscreen;
@@ -1667,7 +1660,7 @@ void game_configmenu() {
SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 64);
}
-void game_damagenpc(int npcnum, int damage, int spell) {
+void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
float npx, npy;
int lx, ly, cx, cy, alive;
char line[256];
@@ -2125,7 +2118,7 @@ void game_damagenpc(int npcnum, int damage, int spell) {
}
}
-void game_damageplayer(int damage) {
+void GriffonEngine::game_damageplayer(int damage) {
char line[256];
player.hp -= damage;
@@ -2141,7 +2134,7 @@ void game_damageplayer(int damage) {
player.pause = ticks + 1000;
}
-void game_drawanims(int Layer) {
+void GriffonEngine::game_drawanims(int Layer) {
for (int sx = 0; sx <= 19; sx++) {
for (int sy = 0; sy <= 14; sy++) {
int o = objmap[sx][sy];
@@ -2232,7 +2225,7 @@ int hud_recalc(int a, int b, int c) {
#define RGB(R, G, B) (SDL_MapRGB(videobuffer->format, (R), (G), (B)))
-void game_drawhud() {
+void GriffonEngine::game_drawhud() {
char line[128];
//sprintf(line, "fps: %i, map: %i, exp: %i/%i", (int)fps, curmap, player.exp, player.nextlevel);
//sys_print(videobuffer, line, 0, 0, 0);
@@ -2492,7 +2485,7 @@ void game_drawhud() {
}
}
-void game_drawnpcs(int mode) {
+void GriffonEngine::game_drawnpcs(int mode) {
unsigned int ccc;
ccc = SDL_MapRGB(videobuffer->format, 255, 128, 32);
@@ -3064,7 +3057,7 @@ void game_drawnpcs(int mode) {
}
}
-void game_drawover(int modx, int mody) {
+void GriffonEngine::game_drawover(int modx, int mody) {
int npx = modx + 12;
int npy = mody + 20;
@@ -3118,7 +3111,7 @@ void game_drawover(int modx, int mody) {
}
}
-void game_drawplayer() {
+void GriffonEngine::game_drawplayer() {
long ccc;
int f = 0;
@@ -3219,7 +3212,7 @@ void game_drawplayer() {
SDL_FillRect(videobuffer, &rcDest, ccc);
}
-void game_drawview() {
+void GriffonEngine::game_drawview() {
Common::Rect rc;
SDL_BlitSurface(mapbg, NULL, videobuffer, NULL);
@@ -3257,7 +3250,7 @@ void game_drawview() {
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
}
-void game_endofgame() {
+void GriffonEngine::game_endofgame() {
float xofs = 0;
int ticks1;
@@ -3499,7 +3492,7 @@ void game_endofgame() {
}
-void game_eventtext(char *stri) {
+void GriffonEngine::game_eventtext(const char *stri) {
int x, fr, pauseticks, bticks;
SDL_FillRect(videobuffer2, NULL, 0);
@@ -3563,7 +3556,7 @@ void game_eventtext(char *stri) {
}
-void game_handlewalking() {
+void GriffonEngine::game_handlewalking() {
unsigned int *temp/*, c*/, bgc;
float spd, /*ppx, ppy,*/ px, py, opx, opy;
float nx, ny, npx, npy;
@@ -3830,7 +3823,7 @@ void game_handlewalking() {
}
}
-void game_loadmap(int mapnum) {
+void GriffonEngine::game_loadmap(int mapnum) {
unsigned int ccc;
Common::Rect trect;
FILE *fp;
@@ -4642,12 +4635,12 @@ void game_loadmap(int mapnum) {
SDL_BlitSurface(clipbg, NULL, clipbg2, NULL);
}
-void game_main() {
+void GriffonEngine::game_main() {
game_title(0);
game_saveloadnew();
}
-void game_newgame() {
+void GriffonEngine::game_newgame() {
float xofs = 0;
float ld = 0, add;
int ticks, cnt = 0;
@@ -4821,7 +4814,7 @@ __exit_do:
game_playgame();
}
-void game_playgame() {
+void GriffonEngine::game_playgame() {
game_swash();
if (pmenu == 1 && menabled == 1) {
@@ -4850,7 +4843,7 @@ void game_playgame() {
} while (1);
}
-void game_processtrigger(int trignum) {
+void GriffonEngine::game_processtrigger(int trignum) {
int trigtype, tx, ty, tmap, tjumpstyle, tsx, tsy;
trigtype = triggers[trignum][0];
@@ -4917,7 +4910,7 @@ void game_processtrigger(int trignum) {
}
}
-void game_saveloadnew() {
+void GriffonEngine::game_saveloadnew() {
float y;
int yy;
int currow, curcol, lowerlock;
@@ -5234,7 +5227,7 @@ void game_saveloadnew() {
SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 64);
}
-void game_showlogos() {
+void GriffonEngine::game_showlogos() {
float y;
int ticks1;
@@ -5292,7 +5285,7 @@ void game_showlogos() {
}
-void game_swash() {
+void GriffonEngine::game_swash() {
float y;
y = 0;
@@ -5373,7 +5366,7 @@ void game_swash() {
SDL_SetAlpha(videobuffer, SDL_SRCALPHA, 255);
}
-void game_theend() {
+void GriffonEngine::game_theend() {
for (int i = 0; i < kMaxFloat; i++) {
floattext[i][0] = 0;
floaticon[i][0] = 0;
@@ -5404,7 +5397,7 @@ void game_theend() {
game_title(0);
}
-void game_title(int mode) {
+void GriffonEngine::game_title(int mode) {
float xofs = 0;
int ticks, ticks1, keypause;
int cursel, ldstop;
@@ -5576,7 +5569,7 @@ void game_title(int mode) {
}
}
-void game_updanims() {
+void GriffonEngine::game_updanims() {
for (int i = 0; i <= lastobj; i++) {
int nframes = objectinfo[i][0];
int oanimspd = objectinfo[i][3];
@@ -5601,7 +5594,7 @@ void game_updanims() {
}
}
-void game_updatey() {
+void GriffonEngine::game_updatey() {
int yy, ff;
for (int i = 0; i <= 2400; i++)
@@ -5633,7 +5626,7 @@ void game_updatey() {
}
}
-void game_updmusic() {
+void GriffonEngine::game_updmusic() {
Mix_Chunk *iplaysound = NULL;
if (menabled == 1 && config.music == 1) {
@@ -5689,7 +5682,7 @@ void game_updmusic() {
}
}
-void game_updnpcs() {
+void GriffonEngine::game_updnpcs() {
float npx, npy, onpx, onpy;
unsigned int *temp, dq, bgc;
float nnxa = 0, nnya = 0, nnxb = 0, nnyb = 0;
@@ -6815,7 +6808,7 @@ void game_updnpcs() {
}
}
-void game_updspells() {
+void GriffonEngine::game_updspells() {
int foundel[5];
float npx, npy;
long cl1, cl2, cl3;
@@ -7669,7 +7662,7 @@ void game_updspells() {
-void game_updspellsunder() {
+void GriffonEngine::game_updspellsunder() {
unsigned int dq, *temp;
@@ -7970,7 +7963,7 @@ void game_updspellsunder() {
}
}
-void sys_initialize() {
+void GriffonEngine::sys_initialize() {
int result;
// init char *floatstri[kMaxFloat]
@@ -8045,7 +8038,7 @@ void sys_initialize() {
sys_setupAudio();
}
-void sys_line(Graphics::TransparentSurface *buffer, int x1, int y1, int x2, int y2, int col) {
+void GriffonEngine::sys_line(Graphics::TransparentSurface *buffer, int x1, int y1, int x2, int y2, int col) {
unsigned int *temp;
SDL_LockSurface(buffer);
@@ -8070,7 +8063,7 @@ void sys_line(Graphics::TransparentSurface *buffer, int x1, int y1, int x2, int
SDL_UnlockSurface(buffer);
}
-void sys_LoadAnims() {
+void GriffonEngine::sys_LoadAnims() {
spellimg = IMG_Load("art/spells.bmp");
SDL_SetColorKey(spellimg, SDL_SRCCOLORKEY, SDL_MapRGB(spellimg->format, 255, 0, 255));
@@ -8218,7 +8211,7 @@ void sys_LoadAnims() {
SDL_SetColorKey(anims[12], SDL_SRCCOLORKEY, SDL_MapRGB(anims[12]->format, 255, 0, 255));
}
-void sys_LoadItemImgs() {
+void GriffonEngine::sys_LoadItemImgs() {
Graphics::TransparentSurface *temp;
temp = IMG_Load("art/icons.bmp");
@@ -8238,7 +8231,7 @@ void sys_LoadItemImgs() {
SDL_FreeSurface(temp);
}
-void sys_LoadFont() {
+void GriffonEngine::sys_LoadFont() {
Graphics::TransparentSurface *font;
font = IMG_Load("art/font.bmp");
@@ -8267,7 +8260,7 @@ void sys_LoadFont() {
SDL_FreeSurface(font);
}
-void sys_LoadTiles() {
+void GriffonEngine::sys_LoadTiles() {
tiles[0] = IMG_Load("art/tx.bmp");
tiles[1] = IMG_Load("art/tx1.bmp");
tiles[2] = IMG_Load("art/tx2.bmp");
@@ -8280,7 +8273,7 @@ void sys_LoadTiles() {
SDL_SetColorKey(windowimg, SDL_SRCCOLORKEY, SDL_MapRGB(windowimg->format, 255, 0, 255));
}
-void sys_LoadTriggers() {
+void GriffonEngine::sys_LoadTriggers() {
FILE *fp;
char line[512];
@@ -8295,7 +8288,7 @@ void sys_LoadTriggers() {
fclose(fp);
}
-void sys_LoadObjectDB() {
+void GriffonEngine::sys_LoadObjectDB() {
FILE *fp;
char line[512];
@@ -8322,7 +8315,7 @@ void sys_LoadObjectDB() {
fclose(fp);
}
-void sys_print(Graphics::TransparentSurface *buffer, char *stri, int xloc, int yloc, int col) {
+void GriffonEngine::sys_print(Graphics::TransparentSurface *buffer, char *stri, int xloc, int yloc, int col) {
int l = strlen(stri);
for (int i = 0; i < l; i++) {
@@ -8333,7 +8326,7 @@ void sys_print(Graphics::TransparentSurface *buffer, char *stri, int xloc, int y
}
}
-void sys_progress(int w, int wm) {
+void GriffonEngine::sys_progress(int w, int wm) {
long ccc;
ccc = SDL_MapRGB(videobuffer->format, 0, 255, 0);
@@ -8345,7 +8338,7 @@ void sys_progress(int w, int wm) {
SDL_PumpEvents();
}
-void sys_setupAudio() {
+void GriffonEngine::sys_setupAudio() {
Graphics::TransparentSurface *loadimg;
menabled = 1;
diff --git a/engines/griffon/engine.h b/engines/griffon/engine.h
deleted file mode 100644
index 23ef832..0000000
--- a/engines/griffon/engine.h
+++ /dev/null
@@ -1,281 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- *
- * Originally written by Syn9 in FreeBASIC with SDL
- * http://syn9.thehideoutgames.com/index_backup.php
- *
- * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
- * http://github.com/dmitrysmagin/griffon_legend
- *
- *
- * Programming/Graphics: Daniel "Syn9" Kennedy
- * Music/Sound effects: David Turner
- *
- * Beta testing and gameplay design help:
- * Deleter, Cha0s, Aether Fox, and Kiz
- *
- */
-
-#ifndef GRIFFON_ENGINE_H
-#define GRIFFON_ENGINE_H
-
-#include "graphics/transparent_surface.h"
-
-namespace Griffon {
-
-#define kMaxNPC 32
-#define kMaxFloat 32
-#define kMaxSpell 32
-
-// spells
-#define ice 0
-#define steel 1
-#define wood 2
-#define rock 3
-#define fire 4
-
-// inventory items
-#define INV_FLASK 0
-#define INV_DOUBLEFLASK 1
-#define INV_SHOCK 2
-#define INV_NORMALKEY 3
-#define INV_MASTERKEY 4
-
-#define sndbite 0
-#define sndcrystal 1
-#define snddoor 2
-#define sndenemyhit 3
-#define sndice 4
-#define sndlever 5
-#define sndlightning 6
-#define sndmetalhit 7
-#define sndpowerup 8
-#define sndrocks 9
-#define sndswordhit 10
-#define sndthrow 11
-#define sndchest 12
-#define sndfire 13
-#define sndbeep 14
-
-typedef struct {
- float px;
- float py;
- float opx;
- float opy;
- int walkdir;
- float walkframe;
- float walkspd;
- float attackframe;
- float attackspd;
-
- int hp;
- int maxhp;
- float hpflash;
- int hpflashb;
- int level;
- int maxlevel;
- int sword;
- int shield;
- int armour;
- int foundspell[5];
- float spellcharge[5];
- int inventory[5];
- float attackstrength;
- float spellstrength;
- int spelldamage;
- int sworddamage;
-
- int exp;
- int nextlevel;
-
- int pause;
-
- float itemselshade;
- int ysort;
-} PLAYERTYPE;
-
-typedef struct {
- float x;
- float y;
- int parentID;
- int isbase;
- int sprite;
- int bonelength; // the 'bone' that connects the body sections
-} BODYSECTIONTYPE;
-
-typedef struct {
- float x;
- float y;
- int spriteset;
- int x1; // patrol area
- int y1;
- int x2;
- int y2;
- int attitude;
- int hp;
-
- int maxhp;
- int item1;
- int item2;
- int item3;
- int script;
- float frame;
- float frame2; // end boss specific
- int cframe;
- int onmap; // is this npc set to be genned in the mapfile
-
- int ticks;
- int pause;
- int shake;
-
- int movementmode;
- int walkdir;
- float walkspd;
- int movingdir;
- int moving;
-
- int attacking;
- float attackframe;
- int cattackframe;
- float attackspd;
- int attackdelay;
- int attacknext;
- int attackattempt;
-
- int spelldamage;
- int attackdamage;
-
-
- // one wing and firehydra specific
- BODYSECTIONTYPE bodysection[31];
- float swayangle;
- float swayspd;
- float headtargetx[4];
- float headtargety[4];
- int castpause;
-
- // firehydra specific
- int attacknext2[4];
- int attacking2[4];
- int attackframe2[4];
-
- // dragon2 specific
- float floating;
-} NPCTYPE;
-
-typedef struct {
- int spellnum;
- float homex;
- float homey;
- float enemyx;
- float enemyy;
-
- float frame;
-
- int damagewho; // 0 = npc, 1 = player
-
- // for earthslide
- float rocky[9];
- int rockimg[9];
- int rockdeflect[9];
-
- float strength;
-
- // fire
- int legalive[5];
-
- // spell 6 specific
- float fireballs[7][4]; // x,y,targetx, targety
- int nfballs;
- int ballon[7];
-
- int npc;
-} SPELLTYPE;
-
-typedef struct {
- int x; // xyloc on spriteimageset
- int y;
- int xofs; // the actual place to paste the sprite in reference to the bodypart loc on screen
- int yofs;
- int w; // w/h of the sprite in the imageset
- int h;
-} ANIMSET2TYPE;
-
-extern PLAYERTYPE player;
-extern int curmap;
-extern int scriptflag[100][10];
-extern int objmapf[1000][21][15];
-extern int roomlocks[201];
-extern int secsingame, secstart;
-
-void griffon_main();
-
-void game_addFloatIcon(int ico, float xloc, float yloc);
-void game_addFloatText(char *stri, float xloc, float yloc, int col);
-void game_attack();
-void game_castspell(int spellnum, float homex, float homey, float enemyx, float enemyy, int damagewho);
-void game_checkhit();
-void game_checkinputs();
-void game_configmenu();
-void game_damagenpc(int npcnum, int damage, int spell);
-void game_damageplayer(int damage);
-void game_drawanims(int Layer);
-void game_drawhud();
-void game_drawnpcs(int mode);
-void game_drawover(int modx, int mody);
-void game_drawplayer();
-void game_drawview();
-void game_endofgame();
-void game_eventtext(char *stri);
-void game_handlewalking();
-void game_loadmap(int mapnum);
-void game_main();
-void game_newgame();
-void game_playgame();
-void game_processtrigger(int trignum);
-void game_saveloadnew();
-void game_showlogos();
-void game_swash();
-void game_theend();
-void game_title(int mode);
-void game_updanims();
-void game_updatey();
-void game_updmusic();
-void game_updnpcs();
-void game_updspells();
-void game_updspellsunder();
-
-void sys_initialize();
-void sys_line(Graphics::TransparentSurface *buffer, int x1, int y1, int x2, int y2, int col);
-void sys_LoadAnims();
-void sys_LoadFont();
-void sys_LoadItemImgs();
-void sys_LoadTiles();
-void sys_LoadTriggers();
-void sys_print(Graphics::TransparentSurface *buffer, char *stri, int xloc, int yloc, int col);
-void sys_progress(int w, int wm);
-void sys_LoadObjectDB();
-void sys_setupAudio();
-void sys_update();
-
-} // end of namespace Griffon
-
-#endif
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index ba60fdb..e31c7a3 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -31,7 +31,6 @@
#include "engines/util.h"
#include "griffon/griffon.h"
-#include "griffon/engine.h"
namespace Griffon {
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index dc250fd..3704d32 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -18,6 +18,19 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
+ * Originally written by Syn9 in FreeBASIC with SDL
+ * http://syn9.thehideoutgames.com/index_backup.php
+ *
+ * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
+ * http://github.com/dmitrysmagin/griffon_legend
+ *
+ *
+ * Programming/Graphics: Daniel "Syn9" Kennedy
+ * Music/Sound effects: David Turner
+ *
+ * Beta testing and gameplay design help:
+ * Deleter, Cha0s, Aether Fox, and Kiz
+ *
*/
#ifndef GRIFFON_H
@@ -29,6 +42,192 @@
namespace Griffon {
+#define kMaxNPC 32
+#define kMaxFloat 32
+#define kMaxSpell 32
+
+// spells
+#define ice 0
+#define steel 1
+#define wood 2
+#define rock 3
+#define fire 4
+
+// inventory items
+#define INV_FLASK 0
+#define INV_DOUBLEFLASK 1
+#define INV_SHOCK 2
+#define INV_NORMALKEY 3
+#define INV_MASTERKEY 4
+
+#define sndbite 0
+#define sndcrystal 1
+#define snddoor 2
+#define sndenemyhit 3
+#define sndice 4
+#define sndlever 5
+#define sndlightning 6
+#define sndmetalhit 7
+#define sndpowerup 8
+#define sndrocks 9
+#define sndswordhit 10
+#define sndthrow 11
+#define sndchest 12
+#define sndfire 13
+#define sndbeep 14
+
+struct PLAYERTYPE {
+ float px;
+ float py;
+ float opx;
+ float opy;
+ int walkdir;
+ float walkframe;
+ float walkspd;
+ float attackframe;
+ float attackspd;
+
+ int hp;
+ int maxhp;
+ float hpflash;
+ int hpflashb;
+ int level;
+ int maxlevel;
+ int sword;
+ int shield;
+ int armour;
+ int foundspell[5];
+ float spellcharge[5];
+ int inventory[5];
+ float attackstrength;
+ float spellstrength;
+ int spelldamage;
+ int sworddamage;
+
+ int exp;
+ int nextlevel;
+
+ int pause;
+
+ float itemselshade;
+ int ysort;
+};
+
+struct BODYSECTIONTYPE {
+ float x;
+ float y;
+ int parentID;
+ int isbase;
+ int sprite;
+ int bonelength; // the 'bone' that connects the body sections
+};
+
+struct NPCTYPE {
+ float x;
+ float y;
+ int spriteset;
+ int x1; // patrol area
+ int y1;
+ int x2;
+ int y2;
+ int attitude;
+ int hp;
+
+ int maxhp;
+ int item1;
+ int item2;
+ int item3;
+ int script;
+ float frame;
+ float frame2; // end boss specific
+ int cframe;
+ int onmap; // is this npc set to be genned in the mapfile
+
+ int ticks;
+ int pause;
+ int shake;
+
+ int movementmode;
+ int walkdir;
+ float walkspd;
+ int movingdir;
+ int moving;
+
+ int attacking;
+ float attackframe;
+ int cattackframe;
+ float attackspd;
+ int attackdelay;
+ int attacknext;
+ int attackattempt;
+
+ int spelldamage;
+ int attackdamage;
+
+
+ // one wing and firehydra specific
+ BODYSECTIONTYPE bodysection[31];
+ float swayangle;
+ float swayspd;
+ float headtargetx[4];
+ float headtargety[4];
+ int castpause;
+
+ // firehydra specific
+ int attacknext2[4];
+ int attacking2[4];
+ int attackframe2[4];
+
+ // dragon2 specific
+ float floating;
+};
+
+struct SPELLTYPE {
+ int spellnum;
+ float homex;
+ float homey;
+ float enemyx;
+ float enemyy;
+
+ float frame;
+
+ int damagewho; // 0 = npc, 1 = player
+
+ // for earthslide
+ float rocky[9];
+ int rockimg[9];
+ int rockdeflect[9];
+
+ float strength;
+
+ // fire
+ int legalive[5];
+
+ // spell 6 specific
+ float fireballs[7][4]; // x,y,targetx, targety
+ int nfballs;
+ int ballon[7];
+
+ int npc;
+};
+
+struct ANIMSET2TYPE {
+ int x; // xyloc on spriteimageset
+ int y;
+ int xofs; // the actual place to paste the sprite in reference to the bodypart loc on screen
+ int yofs;
+ int w; // w/h of the sprite in the imageset
+ int h;
+};
+
+extern PLAYERTYPE player;
+extern int curmap;
+extern int scriptflag[100][10];
+extern int objmapf[1000][21][15];
+extern int roomlocks[201];
+extern int secsingame, secstart;
+
+
class GriffonEngine : public Engine {
public:
GriffonEngine(OSystem *syst);
@@ -38,6 +237,57 @@ public:
private:
Common::RandomSource *_rnd;
+
+private:
+ void griffon_main();
+
+ void game_addFloatIcon(int ico, float xloc, float yloc);
+ void game_addFloatText(char *stri, float xloc, float yloc, int col);
+ void game_attack();
+ void game_castspell(int spellnum, float homex, float homey, float enemyx, float enemyy, int damagewho);
+ void game_checkhit();
+ void game_checkinputs();
+ void game_configmenu();
+ void game_damagenpc(int npcnum, int damage, int spell);
+ void game_damageplayer(int damage);
+ void game_drawanims(int Layer);
+ void game_drawhud();
+ void game_drawnpcs(int mode);
+ void game_drawover(int modx, int mody);
+ void game_drawplayer();
+ void game_drawview();
+ void game_endofgame();
+ void game_eventtext(const char *stri);
+ void game_handlewalking();
+ void game_loadmap(int mapnum);
+ void game_main();
+ void game_newgame();
+ void game_playgame();
+ void game_processtrigger(int trignum);
+ void game_saveloadnew();
+ void game_showlogos();
+ void game_swash();
+ void game_theend();
+ void game_title(int mode);
+ void game_updanims();
+ void game_updatey();
+ void game_updmusic();
+ void game_updnpcs();
+ void game_updspells();
+ void game_updspellsunder();
+
+ void sys_initialize();
+ void sys_line(Graphics::TransparentSurface *buffer, int x1, int y1, int x2, int y2, int col);
+ void sys_LoadAnims();
+ void sys_LoadFont();
+ void sys_LoadItemImgs();
+ void sys_LoadTiles();
+ void sys_LoadTriggers();
+ void sys_LoadObjectDB();
+ void sys_print(Graphics::TransparentSurface *buffer, char *stri, int xloc, int yloc, int col);
+ void sys_progress(int w, int wm);
+ void sys_setupAudio();
+ void sys_update();
};
}
Commit: 848539905df3d190a9512a1023b48d52aa36f75a
https://github.com/scummvm/scummvm/commit/848539905df3d190a9512a1023b48d52aa36f75a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Ported keyboard input
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 07e1424..3a776d9 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -39,7 +39,7 @@
#include "griffon/state.h"
#include "common/events.h"
-#include "graphics/transparent_surface.h"
+#include "common/system.h"
namespace Griffon {
@@ -107,7 +107,6 @@ Graphics::TransparentSurface *mapbg, *clipbg, *clipbg2;
unsigned int clipsurround[4][4];
int fullscreen;
-uint8 *keys;
float animspd;
int rampdata[40][24];
@@ -405,9 +404,9 @@ void game_fillrect(Graphics::TransparentSurface *surface, int x, int y, int w, i
}
// copypaste from hRnd_CRT()
-static float RND() {
+float GriffonEngine::RND() {
/* return between 0 and 1 (but never 1) */
- return (float)rand() * (1.0 / ((float)RAND_MAX + 1.0));
+ return (float)_rnd->getRandomNumber(32767) * (1.0 / 32768.0f);
}
void GriffonEngine::game_addFloatIcon(int ico, float xloc, float yloc) {
@@ -956,8 +955,7 @@ void GriffonEngine::game_checkinputs() {
ntickdelay = 175;
- SDL_PollEvent(&event);
- keys = SDL_GetKeyState(NULL);
+ g_system->getEventManager()->pollEvent(event);
nposts = 0;
@@ -980,28 +978,12 @@ void GriffonEngine::game_checkinputs() {
if (attacking == 1 || (forcepause == 1 && itemselon == 0))
return;
- if (event.type == SDL_KEYDOWN) {
- switch (event.key.keysym.sym) {
- case SDLK_ESCAPE:
+ if (event.type == Common::EVENT_KEYDOWN) {
+ if (event.kbd.keycode == Common::KEYCODE_ESCAPE) {
if (itemticks < ticks)
game_title(1);
break;
- case SDLK_RETURN:
- if (keys[SDLK_LALT] || keys[SDLK_RALT]) {
- if (fullscreen & SDL_FULLSCREEN) {
- fullscreen = config.hwaccel | config.hwsurface;
- } else {
- fullscreen = SDL_FULLSCREEN | config.hwaccel | config.hwsurface;
- }
-
- config.fullscreen = fullscreen & SDL_FULLSCREEN;
-
- video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
- SDL_UpdateRect(video, 0, 0, config.scr_width, config.scr_height);
- }
- break;
-
- case SDLK_LCTRL:
+ } else if (event.kbd.hasFlags(Common::KBD_CTRL)) {
if (itemselon == 0 && itemticks < ticks)
game_attack();
@@ -1154,9 +1136,7 @@ __exit_do:
}
}
- break;
-
- case SDLK_LALT:
+ } else if (event.kbd.hasFlags(Common::KBD_ALT)) {
if (itemticks < ticks) {
selenemyon = 0;
if (itemselon == 1) {
@@ -1170,10 +1150,6 @@ __exit_do:
player.itemselshade = 0;
}
}
- break;
-
- default:
- ;
}
}
@@ -1182,13 +1158,13 @@ __exit_do:
movingdown = 0;
movingleft = 0;
movingright = 0;
- if (keys[SDLK_UP])
+ if (event.kbd.keycode == Common::KEYCODE_UP)
movingup = 1;
- if (keys[SDLK_DOWN])
+ if (event.kbd.keycode == Common::KEYCODE_DOWN)
movingdown = 1;
- if (keys[SDLK_LEFT])
+ if (event.kbd.keycode == Common::KEYCODE_LEFT)
movingleft = 1;
- if (keys[SDLK_RIGHT])
+ if (event.kbd.keycode == Common::KEYCODE_RIGHT)
movingright = 1;
} else {
movingup = 0;
@@ -1198,7 +1174,7 @@ __exit_do:
if (selenemyon == 1) {
if (itemticks < ticks) {
- if (keys[SDLK_LEFT]) {
+ if (event.kbd.keycode == Common::KEYCODE_LEFT) {
int origin = curenemy;
do {
curenemy = curenemy - 1;
@@ -1213,7 +1189,7 @@ __exit_do:
} while (1);
itemticks = ticks + ntickdelay;
}
- if (keys[SDLK_RIGHT]) {
+ if (event.kbd.keycode == Common::KEYCODE_RIGHT) {
int origin = curenemy;
do {
curenemy = curenemy + 1;
@@ -1237,7 +1213,7 @@ __exit_do:
}
} else {
if (itemticks < ticks) {
- if (keys[SDLK_UP]) {
+ if (event.kbd.keycode == Common::KEYCODE_UP) {
curitem = curitem - 1;
itemticks = ticks + ntickdelay;
if (curitem == 4)
@@ -1245,7 +1221,7 @@ __exit_do:
if (curitem == -1)
curitem = 4;
}
- if (keys[SDLK_DOWN]) {
+ if (event.kbd.keycode == Common::KEYCODE_DOWN) {
curitem = curitem + 1;
itemticks = ticks + ntickdelay;
if (curitem == 5)
@@ -1253,11 +1229,11 @@ __exit_do:
if (curitem == 10)
curitem = 5;
}
- if (keys[SDLK_LEFT]) {
+ if (event.kbd.keycode == Common::KEYCODE_LEFT) {
curitem = curitem - 5;
itemticks = ticks + ntickdelay;
}
- if (keys[SDLK_RIGHT]) {
+ if (event.kbd.keycode == Common::KEYCODE_RIGHT) {
curitem = curitem + 5;
itemticks = ticks + ntickdelay;
}
@@ -1473,16 +1449,15 @@ void GriffonEngine::game_configmenu() {
itemyloc -= 16;
if (keypause < ticks) {
- SDL_PollEvent(&event);
- keys = SDL_GetKeyState(NULL);
+ g_system->getEventManager()->pollEvent(event);
- if (event.type == SDL_KEYDOWN) {
+ if (event.type == Common::EVENT_KEYDOWN) {
keypause = ticks + tickwait;
- if (keys[SDLK_ESCAPE] || keys[SDLK_LALT])
+ if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
break;
- if (keys[SDLK_LEFT]) {
+ if (event.kbd.keycode == Common::KEYCODE_LEFT) {
if (cursel == 11) {
config.musicvol = config.musicvol - 25;
if (config.musicvol < 0)
@@ -1505,7 +1480,7 @@ void GriffonEngine::game_configmenu() {
}
}
}
- if (keys[SDLK_RIGHT]) {
+ if (event.kbd.keycode == Common::KEYCODE_RIGHT) {
if (cursel == 11) {
config.musicvol = config.musicvol + 25;
if (config.musicvol > 255)
@@ -1529,18 +1504,18 @@ void GriffonEngine::game_configmenu() {
}
}
- if (keys[SDLK_UP]) {
+ if (event.kbd.keycode == Common::KEYCODE_UP) {
cursel--;
if (cursel < MINCURSEL)
cursel = 14;
}
- if (keys[SDLK_DOWN]) {
+ if (event.kbd.keycode == Common::KEYCODE_DOWN) {
cursel++;
if (cursel > 14)
cursel = MINCURSEL;
}
- if (keys[SDLK_LCTRL] || keys[SDLK_RETURN]) {
+ if (event.kbd.keycode == Common::KEYCODE_RETURN) {
if (cursel == 0) {
fullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
@@ -1640,7 +1615,7 @@ void GriffonEngine::game_configmenu() {
if (cursel == 14) {
// reset keys to avoid returning
- keys[SDLK_SPACE] = keys[SDLK_RETURN] = 0;
+ // keys[SDLK_SPACE] = keys[SDLK_RETURN] = 0; // FIXME
break;
}
}
@@ -3385,15 +3360,14 @@ void GriffonEngine::game_endofgame() {
if (xofs >= 320)
xofs = xofs - 320;
- SDL_PollEvent(&event);
- keys = SDL_GetKeyState(NULL);
+ g_system->getEventManager()->pollEvent(event);
- if (event.type == SDL_KEYDOWN)
+ if (event.type == Common::EVENT_KEYDOWN)
spd = 1;
- if (event.type == SDL_KEYUP)
+ if (event.type == Common::EVENT_KEYUP)
spd = 0.2;
- if (keys[SDLK_ESCAPE] || keys[SDLK_LALT])
+ if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
break;
} while (1);
@@ -3477,10 +3451,9 @@ void GriffonEngine::game_endofgame() {
fp = 0;
}
- SDL_PollEvent(&event);
- keys = SDL_GetKeyState(NULL);
+ g_system->getEventManager()->pollEvent(event);
- if (event.type == SDL_KEYDOWN && keywait < ticks)
+ if (event.type == Common::EVENT_KEYDOWN && keywait < ticks)
break;
} while (1);
@@ -3508,10 +3481,9 @@ void GriffonEngine::game_eventtext(const char *stri) {
SDL_BlitSurface(videobuffer, NULL, videobuffer2, NULL);
do {
- SDL_PollEvent(&event);
- keys = SDL_GetKeyState(NULL);
+ g_system->getEventManager()->pollEvent(event);
- if (event.type == SDL_KEYDOWN && pauseticks < ticks)
+ if (event.type == Common::EVENT_KEYDOWN && pauseticks < ticks)
break;
SDL_BlitSurface(videobuffer2, NULL, videobuffer, NULL);
@@ -4730,12 +4702,11 @@ void GriffonEngine::game_newgame() {
if (xofs >= 320)
xofs = xofs - 320;
- SDL_PollEvent(&event);
- keys = SDL_GetKeyState(NULL);
+ g_system->getEventManager()->pollEvent(event);
- if (event.type == SDL_KEYDOWN)
+ if (event.type == Common::EVENT_KEYDOWN)
cnt = 6;
- if (keys[SDLK_ESCAPE] || keys[SDLK_LALT])
+ if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
goto __exit_do;
SDL_Delay(10);
@@ -4955,14 +4926,13 @@ void GriffonEngine::game_saveloadnew() {
SDL_BlitSurface(saveloadimg, NULL, videobuffer, NULL);
- SDL_PollEvent(&event);
- keys = SDL_GetKeyState(NULL);
+ g_system->getEventManager()->pollEvent(event);
if (tickpause < ticks) {
- if (event.type == SDL_KEYDOWN) {
+ if (event.type == Common::EVENT_KEYDOWN) {
itemticks = ticks + 220;
- if (keys[SDLK_LCTRL] || keys[SDLK_RETURN]) {
+ if (event.kbd.keycode == Common::KEYCODE_RETURN) {
// QUIT - non existent :)
if (currow == 0 && curcol == 4) {
exit(1);
@@ -4970,7 +4940,7 @@ void GriffonEngine::game_saveloadnew() {
// RETURN
if (currow == 0 && curcol == 3) {
// reset keys to avoid returning
- keys[SDLK_RETURN] = keys[SDLK_SPACE] = 0;
+ // keys[SDLK_RETURN] = keys[SDLK_SPACE] = 0; // FIXME
return;
}
// NEW GAME
@@ -5026,16 +4996,15 @@ void GriffonEngine::game_saveloadnew() {
tickpause = ticks + 125;
}
- switch (event.key.keysym.sym) {
- case SDLK_ESCAPE:
- case SDLK_LALT:
+ switch (event.kbd.keycode) {
+ case Common::KEYCODE_ESCAPE:
if (lowerlock == 0)
return;
lowerlock = 0;
currow = 0;
tickpause = ticks + 125;
break;
- case SDLK_DOWN:
+ case Common::KEYCODE_DOWN:
if (lowerlock == 1) {
currow = currow + 1;
if (currow == 5)
@@ -5044,7 +5013,7 @@ void GriffonEngine::game_saveloadnew() {
}
break;
- case SDLK_UP:
+ case Common::KEYCODE_UP:
if (lowerlock == 1) {
currow = currow - 1;
if (currow == 0)
@@ -5053,7 +5022,7 @@ void GriffonEngine::game_saveloadnew() {
}
break;
- case SDLK_LEFT:
+ case Common::KEYCODE_LEFT:
if (lowerlock == 0) {
curcol = curcol - 1;
if (curcol == -1)
@@ -5062,7 +5031,7 @@ void GriffonEngine::game_saveloadnew() {
}
break;
- case SDLK_RIGHT:
+ case Common::KEYCODE_RIGHT:
if (lowerlock == 0) {
curcol = curcol + 1;
if (curcol == 4)
@@ -5517,25 +5486,23 @@ void GriffonEngine::game_title(int mode) {
while (itemyloc >= 16)
itemyloc = itemyloc - 16;
- SDL_PollEvent(&event);
+ g_system->getEventManager()->pollEvent(event);
if (keypause < ticks) {
- keys = SDL_GetKeyState(NULL);
-
- if (event.type == SDL_KEYDOWN) {
+ if (event.type == Common::EVENT_KEYDOWN) {
keypause = ticks + 150;
- if ((keys[SDLK_ESCAPE] || keys[SDLK_LALT]) && mode == 1)
+ if (event.kbd.keycode == Common::KEYCODE_ESCAPE && mode == 1)
break;
- else if (keys[SDLK_UP]) {
+ else if (event.kbd.keycode == Common::KEYCODE_UP]) {
cursel--;
if (cursel < 0)
cursel = (mode == 1 ? 3 : 2);
- } else if (keys[SDLK_DOWN]) {
+ } else if (event.kbd.keycode == Common::KEYCODE_DOWN]) {
cursel++;
if (cursel >= (mode == 1 ? 4 : 3))
cursel = 0;
- } else if (keys[SDLK_LCTRL] || keys[SDLK_RETURN]) {
+ } else if (event.kbd.keycode == Common::KEYCODE_RETURN]) {
if (cursel == 0) {
game_saveloadnew();
ticks = SDL_GetTicks();
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 3704d32..c200fbf 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -40,6 +40,8 @@
#include "common/random.h"
#include "engines/engine.h"
+#include "graphics/transparent_surface.h"
+
namespace Griffon {
#define kMaxNPC 32
@@ -241,6 +243,8 @@ private:
private:
void griffon_main();
+ float RND();
+
void game_addFloatIcon(int ico, float xloc, float yloc);
void game_addFloatText(char *stri, float xloc, float yloc, int col);
void game_attack();
Commit: 56ffd0b3cab33b70552838feb1db558e316909a1
https://github.com/scummvm/scummvm/commit/56ffd0b3cab33b70552838feb1db558e316909a1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Ported Rectangle code
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 3a776d9..4daaf79 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -396,7 +396,7 @@ int invmap[4][7][13] = {
#endif
void sdl_blitscale(Graphics::TransparentSurface *src, Common::Rect *srcrect, Graphics::TransparentSurface *dst, Common::Rect *dstrect) {
- SDL_BlitSurface(src, NULL, dst, NULL);
+ src->blit(dst);
}
void game_fillrect(Graphics::TransparentSurface *surface, int x, int y, int w, int h, int color) {
@@ -982,7 +982,6 @@ void GriffonEngine::game_checkinputs() {
if (event.kbd.keycode == Common::KEYCODE_ESCAPE) {
if (itemticks < ticks)
game_title(1);
- break;
} else if (event.kbd.hasFlags(Common::KBD_CTRL)) {
if (itemselon == 0 && itemticks < ticks)
game_attack();
@@ -1294,19 +1293,19 @@ void GriffonEngine::game_configmenu() {
do {
SDL_FillRect(videobuffer, NULL, 0);
- rcDest.x = 256 + 256 * cos(3.141592 / 180 * clouddeg * 40);
- rcDest.y = 192 + 192 * sin(3.141592 / 180 * clouddeg * 40);
- rcDest.w = 320;
- rcDest.h = 240;
+ rcDest.left = 256 + 256 * cos(3.141592 / 180 * clouddeg * 40);
+ rcDest.top = 192 + 192 * sin(3.141592 / 180 * clouddeg * 40);
+ rcDest.setWidth(320);
+ rcDest.setHeight(240);
SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 128);
SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 64);
- rcDest.x = 256;
- rcDest.y = 192;
- rcDest.w = 320;
- rcDest.h = 240;
+ rcDest.left = 256;
+ rcDest.top = 192;
+ rcDest.setWidth(320);
+ rcDest.setHeight(240);
SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 128);
SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
@@ -1317,7 +1316,7 @@ void GriffonEngine::game_configmenu() {
int sy = SY;
for (int i = 0; i <= 21; i++) {
- static char *vr[22] = {
+ static const char *vr[22] = {
#ifdef OPENDINGUX
"", "",
"", "", "", "",
@@ -1332,7 +1331,7 @@ void GriffonEngine::game_configmenu() {
"Music Volume:", "",
"Effects Volume:", "", "", "", ""
};
- static char *vl[22] = {
+ static const char *vl[22] = {
#ifdef OPENDINGUX
"", "",
"", "", "", "",
@@ -1410,8 +1409,8 @@ void GriffonEngine::game_configmenu() {
if (cursel > 13)
curselt = curselt + 1;
- rc.x = 148 + 3 * cos(3.14159 * 2 * itemyloc / 16.0);
- rc.y = sy + 8 * curselt - 4;
+ rc.left = 148 + 3 * cos(3.14159 * 2 * itemyloc / 16.0);
+ rc.top = sy + 8 * curselt - 4;
SDL_BlitSurface(itemimg[15], NULL, videobuffer, &rc);
@@ -1744,10 +1743,10 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (alive == 0) {
objmap[cx][cy] = 5;
- rcDest.x = cx * 8;
- rcDest.y = cy * 8;
- rcDest.w = 8;
- rcDest.h = 8;
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
npx = player.px + 12;
npy = player.py + 20;
@@ -1776,10 +1775,10 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (alive == 0) {
objmap[cx][cy] = 6;
- rcDest.x = cx * 8;
- rcDest.y = cy * 8;
- rcDest.w = 8;
- rcDest.h = 8;
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
npx = player.px + 12;
npy = player.py + 20;
@@ -1807,15 +1806,15 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
tileinfo[l][9][7][0] = curtile + 1;
tileinfo[l][9][7][1] = 0;
- rcSrc.x = curtilex * 16;
- rcSrc.y = curtiley * 16;
- rcSrc.w = 16;
- rcSrc.h = 16;
+ rcSrc.left = curtilex * 16;
+ rcSrc.top = curtiley * 16;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
- rcDest.x = 9 * 16;
- rcDest.y = 7 * 16;
- rcDest.w = 16;
- rcDest.h = 16;
+ rcDest.left = 9 * 16;
+ rcDest.top = 7 * 16;
+ rcDest.setWidth(16);
+ rcDest.setHeight(16);
SDL_BlitSurface(tiles[curtilel], &rcSrc, mapbg, &rcDest);
}
@@ -1834,10 +1833,10 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (alive == 0) {
objmap[cx][cy] = 9;
- rcDest.x = cx * 8;
- rcDest.y = cy * 8;
- rcDest.w = 8;
- rcDest.h = 8;
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
npx = player.px + 12;
npy = player.py + 20;
@@ -1867,10 +1866,10 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (alive == 0) {
objmap[cx][cy] = 5;
- rcDest.x = cx * 8;
- rcDest.y = cy * 8;
- rcDest.w = 8;
- rcDest.h = 8;
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
npx = player.px + 12;
npy = player.py + 20;
@@ -1900,10 +1899,10 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (alive == 0) {
objmap[cx][cy] = 11;
- rcDest.x = cx * 8;
- rcDest.y = cy * 8;
- rcDest.w = 8;
- rcDest.h = 8;
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
npx = player.px + 12;
npy = player.py + 20;
@@ -1933,10 +1932,10 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (alive == 0) {
objmap[cx][cy] = 13;
- rcDest.x = cx * 8;
- rcDest.y = cy * 8;
- rcDest.w = 8;
- rcDest.h = 8;
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
npx = player.px + 12;
npy = player.py + 20;
@@ -1963,10 +1962,10 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (alive == 0) {
objmap[cx][cy] = 16;
- rcDest.x = cx * 8;
- rcDest.y = cy * 8;
- rcDest.w = 8;
- rcDest.h = 8;
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
npx = player.px + 12;
npy = player.py + 20;
@@ -1995,10 +1994,10 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (alive == 0) {
objmap[cx][cy] = 5;
- rcDest.x = cx * 8;
- rcDest.y = cy * 8;
- rcDest.w = 8;
- rcDest.h = 8;
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
npx = player.px + 12;
npy = player.py + 20;
@@ -2027,10 +2026,10 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
objmap[cx][cy] = 18;
- rcDest.x = cx * 8;
- rcDest.y = cy * 8;
- rcDest.w = 8;
- rcDest.h = 8;
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
npx = player.px + 12;
npy = player.py + 20;
@@ -2048,10 +2047,10 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
objmap[cx][cy] = 19;
- rcDest.x = cx * 8;
- rcDest.y = cy * 8;
- rcDest.w = 8;
- rcDest.h = 8;
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
npx = player.px + 12;
npy = player.py + 20;
@@ -2070,10 +2069,10 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
objmap[cx][cy] = 20;
- rcDest.x = cx * 8;
- rcDest.y = cy * 8;
- rcDest.w = 8;
- rcDest.h = 8;
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
npx = player.px + 12;
npy = player.py + 20;
@@ -2135,15 +2134,15 @@ void GriffonEngine::game_drawanims(int Layer) {
curtilex = 1;
if (curmap == 54 && scriptflag[60][0] > 1)
curtilex = 1;
- rcSrc.x = curtilex * 16;
- rcSrc.y = curtiley * 16;
- rcSrc.w = 16;
- rcSrc.h = 16;
+ rcSrc.left = curtilex * 16;
+ rcSrc.top = curtiley * 16;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
- rcDest.x = x1;
- rcDest.y = y1;
- rcDest.w = 16;
- rcDest.h = 16;
+ rcDest.left = x1;
+ rcDest.top = y1;
+ rcDest.setWidth(16);
+ rcDest.setHeight(16);
SDL_BlitSurface(tiles[curtilel], &rcSrc, videobuffer, &rcDest);
}
@@ -2160,15 +2159,15 @@ void GriffonEngine::game_drawanims(int Layer) {
int curtilex = c % 20;
int curtiley = (c - curtilex) / 20;
- rcSrc.x = curtilex * 16;
- rcSrc.y = curtiley * 16;
- rcSrc.w = 16;
- rcSrc.h = 16;
+ rcSrc.left = curtilex * 16;
+ rcSrc.top = curtiley * 16;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
- rcDest.x = (sx + x) * 16;
- rcDest.y = (sy + y) * 16;
- rcDest.w = 16;
- rcDest.h = 16;
+ rcDest.left = (sx + x) * 16;
+ rcDest.top = (sy + y) * 16;
+ rcDest.setWidth(16);
+ rcDest.setHeight(16);
int pass = 1;
if (curtilel == 1) {
@@ -2237,21 +2236,21 @@ void GriffonEngine::game_drawhud() {
int ix = floaticon[i][1];
int iy = floaticon[i][2];
- rcDest.x = ix;
- rcDest.y = iy;
+ rcDest.left = ix;
+ rcDest.top = iy;
if (ico != 99)
SDL_BlitSurface(itemimg[ico], NULL, videobuffer, &rcDest);
if (ico == 99) {
SDL_SetAlpha(spellimg, SDL_SRCALPHA, (int)(RND() * 96) + 96);
- rcSrc.x = 16 * (int)(RND() * 2);
- rcSrc.y = 80;
- rcSrc.w = 16;
- rcSrc.h = 16;
+ rcSrc.left = 16 * (int)(RND() * 2);
+ rcSrc.top = 80;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
- rcDest.x = ix;
- rcDest.y = iy;
+ rcDest.left = ix;
+ rcDest.top = iy;
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
@@ -2265,19 +2264,19 @@ void GriffonEngine::game_drawhud() {
int nx = 19 * 8 + 13;
- rcSrc.x = nx - 17 + 48;
- rcSrc.y = sy;
+ rcSrc.left = nx - 17 + 48;
+ rcSrc.top = sy;
// spells in game
if (player.foundspell[0] == 1) {
for (int i = 0; i < 5; i++) {
- rcSrc.x = rcSrc.x + 17;
+ rcSrc.left = rcSrc.left + 17;
if (player.foundspell[i] == 1) {
SDL_BlitSurface(itemimg[7 + i], NULL, videobuffer, &rcSrc);
- game_fillrect(videobuffer, rcSrc.x, sy + 16, 16, 4, RGB(0, 32, 32));
- game_fillrect(videobuffer, rcSrc.x + 1, sy + 17,
+ game_fillrect(videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32));
+ game_fillrect(videobuffer, rcSrc.left + 1, sy + 17,
hud_recalc(player.spellcharge[i], 14, 100), 2,
player.spellcharge[i] == 100 ? RGB(255, 128, 32) : RGB(0, 224, 64));
}
@@ -2287,17 +2286,17 @@ void GriffonEngine::game_drawhud() {
}
if (selenemyon == 0) {
- rcDest.x = 0;
- rcDest.y = 0;
- rcDest.w = 320;
- rcDest.h = 240;
+ rcDest.left = 0;
+ rcDest.top = 0;
+ rcDest.right = 320;
+ rcDest.bottom = 240;
SDL_SetAlpha(videobuffer2, SDL_SRCALPHA, (int)(player.itemselshade * 4));
SDL_FillRect(videobuffer2, &rcDest, 0);
SDL_BlitSurface(videobuffer2, NULL, videobuffer, NULL);
int sy = 202;
- rcSrc.x = 46;
- rcSrc.y = 46;
+ rcSrc.left = 46;
+ rcSrc.top = 46;
SDL_SetAlpha(inventoryimg, SDL_SRCALPHA, 160); // 128
SDL_BlitSurface(inventoryimg, NULL, videobuffer, &rcSrc);
@@ -2307,8 +2306,8 @@ void GriffonEngine::game_drawhud() {
sy = 55;
// draw map 9,77
- rcDest.x = 46 + 9;
- rcDest.y = 46 + 77;
+ rcDest.left = 46 + 9;
+ rcDest.top = 46 + 77;
int amap = 0;
if (curmap > 46)
@@ -2371,21 +2370,21 @@ void GriffonEngine::game_drawhud() {
sys_print(videobuffer, "Use", 193, 55, 0);
sys_print(videobuffer, "Cast", 236, 55, 0);
- rcSrc.x = 128;
- rcSrc.y = 91;
+ rcSrc.left = 128;
+ rcSrc.top = 91;
int ss = (player.sword - 1) * 3;
if (player.sword == 3)
ss = 18;
SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
- rcSrc.x = rcSrc.x + 16;
+ rcSrc.left = rcSrc.left + 16;
ss = (player.shield - 1) * 3 + 1;
if (player.shield == 3)
ss = 19;
SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
- rcSrc.x = rcSrc.x + 16;
+ rcSrc.left = rcSrc.left + 16;
ss = (player.armour - 1) * 3 + 2;
if (player.armour == 3)
ss = 20;
@@ -2414,15 +2413,15 @@ void GriffonEngine::game_drawhud() {
// spells in menu
if (player.foundspell[0] == 1) {
for (int i = 0; i < 5; i++) {
- rcSrc.x = 243;
- rcSrc.y = 67 + i * 24;
- sy = rcSrc.y;
+ rcSrc.left = 243;
+ rcSrc.top = 67 + i * 24;
+ sy = rcSrc.top;
if (player.foundspell[i] == 1) {
SDL_BlitSurface(itemimg[7 + i], NULL, videobuffer, &rcSrc);
- game_fillrect(videobuffer, rcSrc.x, sy + 16, 16, 4, RGB(0, 32, 32));
- game_fillrect(videobuffer, rcSrc.x + 1, sy + 17,
+ game_fillrect(videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32));
+ game_fillrect(videobuffer, rcSrc.left + 1, sy + 17,
hud_recalc(player.spellcharge[i], 14, 100), 2,
player.spellcharge[i] == 100 ? RGB(255, 128, 32) : RGB(0, 224, 64));
}
@@ -2493,35 +2492,35 @@ void GriffonEngine::game_drawnpcs(int mode) {
int cframe = npcinfo[i].cframe;
- rcSrc.x = (int)(cframe / 4) * 24;
- rcSrc.y = wdir * 24;
- rcSrc.w = 24;
- rcSrc.h = 24;
+ rcSrc.left = (int)(cframe / 4) * 24;
+ rcSrc.top = wdir * 24;
+ rcSrc.setWidth(24);
+ rcSrc.setHeight(24);
- rcDest.x = npx;
- rcDest.y = npy;
- rcDest.w = 24;
- rcDest.h = 24;
+ rcDest.left = npx;
+ rcDest.top = npy;
+ rcDest.setWidth(24);
+ rcDest.setHeight(24);
if (npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
npcinfo[i].shake = ticks + 50;
- rcDest.x = rcDest.x + (int)(RND() * 3) - 1;
- rcDest.y = rcDest.y + (int)(RND() * 3) - 1;
+ rcDest.left += (int)(RND() * 3) - 1;
+ rcDest.top += (int)(RND() * 3) - 1;
}
SDL_BlitSurface(anims[sprite], &rcSrc, videobuffer, &rcDest);
} else {
int cframe = npcinfo[i].cattackframe;
- rcSrc.x = (int)(cframe / 4) * 24;
- rcSrc.y = wdir * 24;
- rcSrc.w = 24;
- rcSrc.h = 24;
+ rcSrc.left = (int)(cframe / 4) * 24;
+ rcSrc.top = wdir * 24;
+ rcSrc.setWidth(24);
+ rcSrc.setHeight(24);
- rcDest.x = npx;
- rcDest.y = npy;
- rcDest.w = 24;
- rcDest.h = 24;
+ rcDest.left = npx;
+ rcDest.top = npy;
+ rcDest.setWidth(24);
+ rcDest.setHeight(24);
SDL_BlitSurface(animsa[sprite], &rcSrc, videobuffer, &rcDest);
}
@@ -2532,13 +2531,13 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (npcinfo[i].spriteset == 2) {
for (int f = 0; f <= 7; f++) {
int s = npcinfo[i].bodysection[f].sprite;
- rcSrc.x = animset2[s].x;
- rcSrc.y = animset2[s].y;
- rcSrc.w = animset2[s].w;
- rcSrc.h = animset2[s].h;
+ rcSrc.left = animset2[s].x;
+ rcSrc.top = animset2[s].y;
+ rcSrc.setWidth(animset2[s].w);
+ rcSrc.setHeight(animset2[s].h);
- rcDest.x = npcinfo[i].bodysection[f].x - animset2[s].xofs;
- rcDest.y = npcinfo[i].bodysection[f].y - animset2[s].yofs + 2;
+ rcDest.left = npcinfo[i].bodysection[f].x - animset2[s].xofs;
+ rcDest.top = npcinfo[i].bodysection[f].y - animset2[s].yofs + 2;
SDL_BlitSurface(anims[2], &rcSrc, videobuffer, &rcDest);
}
@@ -2553,13 +2552,13 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (f == 0 && (curmap == 53 || curmap == 57 || curmap == 61 || curmap == 65 || curmap == 56 || curmap > 66) && scriptflag[60][0] > 0)
yp = 16;
int s = npcinfo[i].bodysection[f].sprite;
- rcSrc.x = animset9[s].x;
- rcSrc.y = animset9[s].y + yp;
- rcSrc.w = animset9[s].w;
- rcSrc.h = animset9[s].h;
+ rcSrc.left = animset9[s].x;
+ rcSrc.top = animset9[s].y + yp;
+ rcSrc.setWidth(animset9[s].w);
+ rcSrc.setHeight(animset9[s].h);
- rcDest.x = npcinfo[i].bodysection[f].x - animset9[s].xofs;
- rcDest.y = npcinfo[i].bodysection[f].y - animset9[s].yofs + 2;
+ rcDest.left = npcinfo[i].bodysection[f].x - animset9[s].xofs;
+ rcDest.top = npcinfo[i].bodysection[f].y - animset9[s].yofs + 2;
SDL_BlitSurface(anims[9], &rcSrc, videobuffer, &rcDest);
}
@@ -2572,23 +2571,23 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (npcinfo[i].attacking == 0) {
int cframe = npcinfo[i].cframe;
- rcSrc.x = (int)(cframe / 4) * 24;
- rcSrc.y = 0;
- rcSrc.w = 24;
- rcSrc.h = 48;
+ rcSrc.left = (int)(cframe / 4) * 24;
+ rcSrc.top = 0;
+ rcSrc.setWidth(24);
+ rcSrc.setHeight(48);
- rcDest.x = npx - 2;
- rcDest.y = npy - 24;
+ rcDest.left = npx - 2;
+ rcDest.top = npy - 24;
SDL_BlitSurface(anims[3], &rcSrc, videobuffer, &rcDest);
} else {
- rcSrc.x = 4 * 24;
- rcSrc.y = 0;
- rcSrc.w = 24;
- rcSrc.h = 48;
+ rcSrc.left = 4 * 24;
+ rcSrc.top = 0;
+ rcSrc.setWidth(24);
+ rcSrc.setHeight(48);
- rcDest.x = npx - 2;
- rcDest.y = npy - 24;
+ rcDest.left = npx - 2;
+ rcDest.top = npy - 24;
SDL_BlitSurface(anims[3], &rcSrc, videobuffer, &rcDest);
}
@@ -2600,23 +2599,23 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (npcinfo[i].attacking == 0) {
int cframe = npcinfo[i].cframe;
- rcSrc.x = (int)(cframe / 4) * 24;
- rcSrc.y = 0;
- rcSrc.w = 24;
- rcSrc.h = 48;
+ rcSrc.left = (int)(cframe / 4) * 24;
+ rcSrc.top = 0;
+ rcSrc.setWidth(24);
+ rcSrc.setHeight(48);
- rcDest.x = npx - 2;
- rcDest.y = npy - 24;
+ rcDest.left = npx - 2;
+ rcDest.top = npy - 24;
SDL_BlitSurface(anims[4], &rcSrc, videobuffer, &rcDest);
} else {
- rcSrc.x = 4 * 24;
- rcSrc.y = 0;
- rcSrc.w = 24;
- rcSrc.h = 48;
+ rcSrc.left = 4 * 24;
+ rcSrc.top = 0;
+ rcSrc.setWidth(24);
+ rcSrc.setHeight(48);
- rcDest.x = npx - 2;
- rcDest.y = npy - 24;
+ rcDest.left = npx - 2;
+ rcDest.top = npy - 24;
SDL_BlitSurface(anims[4], &rcSrc, videobuffer, &rcDest);
}
@@ -2627,13 +2626,13 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (npcinfo[i].spriteset == 5) {
for (int ff = 0; ff <= 2; ff++) {
if (npcinfo[i].hp > 10 * ff * 20) {
- rcSrc.x = 16 * (int)(RND() * 2);
- rcSrc.y = 80;
- rcSrc.w = 16;
- rcSrc.h = 16;
+ rcSrc.left = 16 * (int)(RND() * 2);
+ rcSrc.top = 80;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
- rcDest.x = npcinfo[i].bodysection[10 * ff].x - 8;
- rcDest.y = npcinfo[i].bodysection[10 * ff].y - 8;
+ rcDest.left = npcinfo[i].bodysection[10 * ff].x - 8;
+ rcDest.top = npcinfo[i].bodysection[10 * ff].y - 8;
int x = 192 + ((int)(itemyloc + ff * 5) % 3) * 64;
if (x > 255)
@@ -2643,13 +2642,13 @@ void GriffonEngine::game_drawnpcs(int mode) {
SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
for (int f = 1; f <= 8; f++) {
- rcSrc.x = 16 * (int)(RND() * 2);
- rcSrc.y = 80;
- rcSrc.w = 16;
- rcSrc.h = 16;
+ rcSrc.left = 16 * (int)(RND() * 2);
+ rcSrc.top = 80;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
- rcDest.x = npcinfo[i].bodysection[ff * 10 + f].x - 8 + (int)(RND() * 3) - 1;
- rcDest.y = npcinfo[i].bodysection[ff * 10 + f].y - 8 + (int)(RND() * 3) - 1;
+ rcDest.left = npcinfo[i].bodysection[ff * 10 + f].x - 8 + (int)(RND() * 3) - 1;
+ rcDest.top = npcinfo[i].bodysection[ff * 10 + f].y - 8 + (int)(RND() * 3) - 1;
x = 192 + f % 3 * 64;
if (x > 255)
@@ -2659,13 +2658,13 @@ void GriffonEngine::game_drawnpcs(int mode) {
SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
}
- rcSrc.x = 0;
- rcSrc.y = 0;
- rcSrc.w = 42;
- rcSrc.h = 36;
+ rcSrc.left = 0;
+ rcSrc.top = 0;
+ rcSrc.setWidth(42);
+ rcSrc.setHeight(36);
- rcDest.x = npcinfo[i].bodysection[10 * ff + 9].x - 21;
- rcDest.y = npcinfo[i].bodysection[10 * ff + 9].y - 21;
+ rcDest.left = npcinfo[i].bodysection[10 * ff + 9].x - 21;
+ rcDest.top = npcinfo[i].bodysection[10 * ff + 9].y - 21;
SDL_SetAlpha(spellimg, SDL_SRCALPHA, 192);
SDL_BlitSurface(anims[5], &rcSrc, videobuffer, &rcDest);
@@ -2681,20 +2680,20 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (npcinfo[i].spriteset == 6) {
int cframe = npcinfo[i].cframe;
- rcSrc.x = (int)(cframe / 4) * 24;
- rcSrc.y = wdir * 24;
- rcSrc.w = 24;
- rcSrc.h = 24;
+ rcSrc.left = (int)(cframe / 4) * 24;
+ rcSrc.top = wdir * 24;
+ rcSrc.setWidth(24);
+ rcSrc.setHeight(24);
- rcDest.x = npx;
- rcDest.y = npy;
- rcDest.w = 24;
- rcDest.h = 24;
+ rcDest.left = npx;
+ rcDest.top = npy;
+ rcDest.setWidth(24);
+ rcDest.setHeight(24);
if (npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
npcinfo[i].shake = ticks + 50;
- rcDest.x = rcDest.x + (int)(RND() * 3) - 1;
- rcDest.y = rcDest.y + (int)(RND() * 3) - 1;
+ rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
+ rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
SDL_BlitSurface(anims[sprite], &rcSrc, videobuffer, &rcDest);
@@ -2705,20 +2704,20 @@ void GriffonEngine::game_drawnpcs(int mode) {
// if(npcinfo[i].attacking == 0) {
int cframe = npcinfo[i].cframe;
- rcSrc.x = (int)(cframe / 4) * 24;
- rcSrc.y = wdir * 24;
- rcSrc.w = 24;
- rcSrc.h = 24;
+ rcSrc.left = (int)(cframe / 4) * 24;
+ rcSrc.top = wdir * 24;
+ rcSrc.setWidth(24);
+ rcSrc.setHeight(24);
- rcDest.x = npx;
- rcDest.y = npy;
- rcDest.w = 24;
- rcDest.h = 24;
+ rcDest.left = npx;
+ rcDest.top = npy;
+ rcDest.setWidth(24);
+ rcDest.setHeight(24);
if (npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
npcinfo[i].shake = ticks + 50;
- rcDest.x = rcDest.x + (int)(RND() * 3) - 1;
- rcDest.y = rcDest.y + (int)(RND() * 3) - 1;
+ rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
+ rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
SDL_BlitSurface(anims[sprite], &rcSrc, videobuffer, &rcDest);
// } else {
@@ -2726,13 +2725,13 @@ void GriffonEngine::game_drawnpcs(int mode) {
//rcSrc.x = (int)(cframe / 4) * 24;
//rcSrc.y = wdir * 24;
- //rcSrc.w = 24;
- //rcSrc.h = 24;
+ //rcSrc.setWidth(24);
+ //rcSrc.setHeight(24);
//rcDest.x = npx;
//rcDest.y = npy;
- //rcDest.w = 24;
- //rcDest.h = 24;
+ //rcDest.setWidth(24);
+ //rcDest.setHeight(24);
// SDL_BlitSurface(animsa(sprite), &rcSrc, videobuffer, &rcDest);
// }
}
@@ -2742,20 +2741,20 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (npcinfo[i].spriteset == 8) {
int cframe = npcinfo[i].cframe;
- rcSrc.x = (int)(cframe / 4) * 24;
- rcSrc.y = wdir * 24;
- rcSrc.w = 24;
- rcSrc.h = 24;
+ rcSrc.left = (int)(cframe / 4) * 24;
+ rcSrc.top = wdir * 24;
+ rcSrc.setWidth(24);
+ rcSrc.setHeight(24);
- rcDest.x = npx;
- rcDest.y = npy;
- rcDest.w = 24;
- rcDest.h = 24;
+ rcDest.left = npx;
+ rcDest.top = npy;
+ rcDest.setWidth(24);
+ rcDest.setHeight(24);
if (npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
npcinfo[i].shake = ticks + 50;
- rcDest.x = rcDest.x + (int)(RND() * 3) - 1;
- rcDest.y = rcDest.y + (int)(RND() * 3) - 1;
+ rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
+ rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
SDL_BlitSurface(anims[sprite], &rcSrc, videobuffer, &rcDest);
}
@@ -2786,20 +2785,20 @@ void GriffonEngine::game_drawnpcs(int mode) {
cframe = npcinfo[i].cframe;
- rcSrc.x = 74 * wdir;
- rcSrc.y = (int)(cframe / 4) * 48;
- rcSrc.w = 74;
- rcSrc.h = 48;
+ rcSrc.left = 74 * wdir;
+ rcSrc.top = (int)(cframe / 4) * 48;
+ rcSrc.setWidth(74);
+ rcSrc.setHeight(48);
- rcDest.x = npx + 12 - 37;
- rcDest.y = (float)(npy + 12 - 32 - 3 * sin(3.141592 * 2 * npcinfo[i].floating / 16));
- rcDest.w = 24;
- rcDest.h = 24;
+ rcDest.left = npx + 12 - 37;
+ rcDest.top = (float)(npy + 12 - 32 - 3 * sin(3.141592 * 2 * npcinfo[i].floating / 16));
+ rcDest.setWidth(24);
+ rcDest.setHeight(24);
if (npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
npcinfo[i].shake = ticks + 50;
- rcDest.x = rcDest.x + (int)(RND() * 3) - 1;
- rcDest.y = rcDest.y + (int)(RND() * 3) - 1;
+ rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
+ rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
SDL_BlitSurface(anims[sprite], &rcSrc, videobuffer, &rcDest);
@@ -2810,15 +2809,15 @@ void GriffonEngine::game_drawnpcs(int mode) {
int cframe = npcinfo[i].cattackframe;
- rcSrc.x = 74 * wdir;
- rcSrc.y = (int)(cframe / 4) * 48;
- rcSrc.w = 74;
- rcSrc.h = 48;
+ rcSrc.left = 74 * wdir;
+ rcSrc.top = (int)(cframe / 4) * 48;
+ rcSrc.setWidth(74);
+ rcSrc.setHeight(48);
- rcDest.x = npx + 12 - 37;
- rcDest.y = (float)(npy + 12 - 32 - 3 * sin(3.141592 * 2 * npcinfo[i].floating / 16));
- rcDest.w = 24;
- rcDest.h = 24;
+ rcDest.left = npx + 12 - 37;
+ rcDest.top = (float)(npy + 12 - 32 - 3 * sin(3.141592 * 2 * npcinfo[i].floating / 16));
+ rcDest.setWidth(24);
+ rcDest.setHeight(24);
SDL_BlitSurface(animsa[sprite], &rcSrc, videobuffer, &rcDest);
}
@@ -2846,37 +2845,37 @@ void GriffonEngine::game_drawnpcs(int mode) {
for (int fr = 0; fr <= 3; fr++) {
SDL_SetAlpha(spellimg, SDL_SRCALPHA, 128 + (int)(RND() * 96));
- rcSrc.x = 16 * (int)(RND() * 2);
- rcSrc.y = 80;
- rcSrc.w = 16;
- rcSrc.h = 16;
+ rcSrc.left = 16 * (int)(RND() * 2);
+ rcSrc.top = 80;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
- rcDest.x = sx + 32 + (int)(RND() * 3) - 1;
- rcDest.y = sy - (int)(RND() * 6);
+ rcDest.left = sx + 32 + (int)(RND() * 3) - 1;
+ rcDest.top = sy - (int)(RND() * 6);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
}
for (int ii = 0; ii <= 8; ii++) {
for (int i2 = 0; i2 <= 3; i2++) {
- rcSrc.x = 16 * (int)(RND() * 2);
- rcSrc.y = 80;
- rcSrc.w = 16;
- rcSrc.h = 16;
+ rcSrc.left = 16 * (int)(RND() * 2);
+ rcSrc.top = 80;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
float fr3 = frame - 3 + i2;
if (fr3 < 0)
fr3 = fr3 + 16;
- rcDest.x = (float)(sx + 36 + ii * 8 - ii * cos(3.14159 * 2 * (fr3 - ii) / 16) * 2);
- rcDest.y = (float)(sy + 16 + ii * sin(3.14159 * 2 * (fr3 - ii) / 16) * 3 - ii); // * 4
+ rcDest.left = (float)(sx + 36 + ii * 8 - ii * cos(3.14159 * 2 * (fr3 - ii) / 16) * 2);
+ rcDest.top = (float)(sy + 16 + ii * sin(3.14159 * 2 * (fr3 - ii) / 16) * 3 - ii); // * 4
SDL_SetAlpha(spellimg, SDL_SRCALPHA, i2 / 3 * 224);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
- int xloc = rcDest.x;
- int yloc = rcDest.y;
+ int xloc = rcDest.left;
+ int yloc = rcDest.top;
int xdif = (xloc + 8) - (player.px + 12);
int ydif = (yloc + 8) - (player.py + 12);
@@ -2894,15 +2893,15 @@ void GriffonEngine::game_drawnpcs(int mode) {
}
- rcDest.x = (float)(sx + 36 - ii * 8 + ii * cos(3.14159 * 2 * (fr3 - ii) / 16) * 2);
- rcDest.y = (float)(sy + 16 + ii * sin(3.14159 * 2 * (fr3 - ii) / 16) * 3 - ii); // * 4
+ rcDest.left = (float)(sx + 36 - ii * 8 + ii * cos(3.14159 * 2 * (fr3 - ii) / 16) * 2);
+ rcDest.top = (float)(sy + 16 + ii * sin(3.14159 * 2 * (fr3 - ii) / 16) * 3 - ii); // * 4
SDL_SetAlpha(spellimg, SDL_SRCALPHA, i2 / 3 * 224);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
- xloc = rcDest.x;
- yloc = rcDest.y;
+ xloc = rcDest.left;
+ yloc = rcDest.top;
xdif = (xloc + 8) - (player.px + 12);
ydif = (yloc + 8) - (player.py + 12);
@@ -2924,31 +2923,31 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (npcinfo[i].attacking == 0) {
int cframe = (int)(frame);
- rcSrc.x = 0;
- rcSrc.y = 72 * (int)(cframe / 4);
- rcSrc.w = 80;
- rcSrc.h = 72;
+ rcSrc.left = 0;
+ rcSrc.top = 72 * (int)(cframe / 4);
+ rcSrc.setWidth(80);
+ rcSrc.setHeight(72);
- rcDest.x = sx;
- rcDest.y = sy;
+ rcDest.left = sx;
+ rcDest.top = sy;
if (npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
npcinfo[i].shake = ticks + 50;
- rcDest.x = rcDest.x + (int)(RND() * 3) - 1;
- rcDest.y = rcDest.y + (int)(RND() * 3) - 1;
+ rcDest.left = rcDest.top + (int)(RND() * 3) - 1;
+ rcDest.left = rcDest.top + (int)(RND() * 3) - 1;
}
SDL_BlitSurface(anims[sprite], &rcSrc, videobuffer, &rcDest);
} else {
int cframe = (int)(npcinfo[i].cattackframe);
- rcSrc.x = 0;
- rcSrc.y = 72 * (int)(cframe / 4);
- rcSrc.w = 80;
- rcSrc.h = 72;
+ rcSrc.left = 0;
+ rcSrc.top = 72 * (int)(cframe / 4);
+ rcSrc.setWidth(80);
+ rcSrc.setHeight(72);
- rcDest.x = sx;
- rcDest.y = sy;
+ rcDest.left = sx;
+ rcDest.top = sy;
SDL_BlitSurface(animsa[sprite], &rcSrc, videobuffer, &rcDest);
}
@@ -2978,34 +2977,34 @@ void GriffonEngine::game_drawnpcs(int mode) {
cframe = npcinfo[i].cframe;
- rcSrc.x = 0;
- rcSrc.y = 0;
- rcSrc.w = 99;
- rcSrc.h = 80;
+ rcSrc.left = 0;
+ rcSrc.top = 0;
+ rcSrc.setWidth(99);
+ rcSrc.setHeight(80);
- rcDest.x = npx + 12 - 50;
- rcDest.y = (float)(npy + 12 - 64 + 2 * sin(3.141592 * 2 * npcinfo[i].floating / 16));
- rcDest.w = 99;
- rcDest.h = 80;
+ rcDest.left = npx + 12 - 50;
+ rcDest.top = (float)(npy + 12 - 64 + 2 * sin(3.141592 * 2 * npcinfo[i].floating / 16));
+ rcDest.setWidth(99);
+ rcDest.setHeight(80);
if (npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
npcinfo[i].shake = ticks + 50;
- rcDest.x = rcDest.x + (int)(RND() * 3) - 1;
- rcDest.y = rcDest.y + (int)(RND() * 3) - 1;
+ rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
+ rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
SDL_BlitSurface(anims[sprite], &rcSrc, videobuffer, &rcDest);
}
- rcDest.x = npx + 4;
- rcDest.y = npy + 22;
- rcDest.w = 16;
- rcDest.h = 4;
+ rcDest.left = npx + 4;
+ rcDest.top = npy + 22;
+ rcDest.setWidth(16);
+ rcDest.setHeight(4);
SDL_FillRect(videobuffer, &rcDest, 0);
- rcDest.x = npx + 5;
- rcDest.y = npy + 23;
+ rcDest.left = npx + 5;
+ rcDest.top = npy + 23;
int ww = 14 * npcinfo[i].hp / npcinfo[i].maxhp;
@@ -3014,8 +3013,8 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (ww < 1)
ww = 1;
- rcDest.w = ww;
- rcDest.h = 2;
+ rcDest.setWidth(ww);
+ rcDest.setHeight(2);
SDL_FillRect(videobuffer, &rcDest, ccc);
@@ -3058,15 +3057,15 @@ void GriffonEngine::game_drawover(int modx, int mody) {
int curtilex = curtile % 20;
int curtiley = (curtile - curtilex) / 20;
- rcSrc.x = curtilex * 16;
- rcSrc.y = curtiley * 16;
- rcSrc.w = 16;
- rcSrc.h = 16;
+ rcSrc.left = curtilex * 16;
+ rcSrc.top = curtiley * 16;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
- rcDest.x = sx2;
- rcDest.y = sy2;
- rcDest.w = 16;
- rcDest.h = 16;
+ rcDest.left = sx2;
+ rcDest.top = sy2;
+ rcDest.setWidth(16);
+ rcDest.setHeight(16);
int pass = 1;
if (curtilel == 1) {
@@ -3094,27 +3093,27 @@ void GriffonEngine::game_drawplayer() {
f = 13;
if (attacking == 0) {
- rcSrc.x = (int)(player.walkframe / 4) * 24;
- rcSrc.y = player.walkdir * 24;
- rcSrc.w = 24;
- rcSrc.h = 24;
+ rcSrc.left = (int)(player.walkframe / 4) * 24;
+ rcSrc.top = player.walkdir * 24;
+ rcSrc.setWidth(24);
+ rcSrc.setHeight(24);
- rcDest.x = (int)(player.px);
- rcDest.y = (int)(player.py);
- rcDest.w = 24;
- rcDest.h = 24;
+ rcDest.left = (int)(player.px);
+ rcDest.top = (int)(player.py);
+ rcDest.setWidth(24);
+ rcDest.setHeight(24);
SDL_BlitSurface(anims[f], &rcSrc, videobuffer, &rcDest);
} else {
- rcSrc.x = (int)(player.attackframe / 4) * 24;
- rcSrc.y = player.walkdir * 24;
- rcSrc.w = 24;
- rcSrc.h = 24;
+ rcSrc.left = (int)(player.attackframe / 4) * 24;
+ rcSrc.top = player.walkdir * 24;
+ rcSrc.setWidth(24);
+ rcSrc.setHeight(24);
- rcDest.x = (int)(player.px);
- rcDest.y = (int)(player.py);
- rcDest.w = 24;
- rcDest.h = 24;
+ rcDest.left = (int)(player.px);
+ rcDest.top = (int)(player.py);
+ rcDest.setWidth(24);
+ rcDest.setHeight(24);
SDL_BlitSurface(animsa[f], &rcSrc, videobuffer, &rcDest);
@@ -3136,10 +3135,10 @@ void GriffonEngine::game_drawplayer() {
sss = 8;
int npx = player.px;
int npy = player.py;
- rcDest.x = npx + 4;
- rcDest.y = npy + 22;
- rcDest.w = 16;
- rcDest.h = sss;
+ rcDest.left = npx + 4;
+ rcDest.top = npy + 22;
+ rcDest.setWidth(16);
+ rcDest.setHeight(sss);
SDL_FillRect(videobuffer, &rcDest, 0);
@@ -3153,8 +3152,8 @@ void GriffonEngine::game_drawplayer() {
if (ww < 1)
ww = 1;
- rcDest.w = ww;
- rcDest.h = 2;
+ rcDest.setWidth(ww);
+ rcDest.setHeight(2);
SDL_FillRect(videobuffer, &rcDest, ccc);
@@ -3170,9 +3169,9 @@ void GriffonEngine::game_drawplayer() {
if (ww2 > 14)
ww2 = 14;
- rcDest.w = ww;
- rcDest.h = 2;
- rcDest.y = rcDest.y + 2;
+ rcDest.top = rcDest.top + 2;
+ rcDest.setWidth(ww);
+ rcDest.setHeight(2);
SDL_FillRect(videobuffer, &rcDest, ccc);
@@ -3180,9 +3179,9 @@ void GriffonEngine::game_drawplayer() {
if (player.spellstrength == 100)
ccc = SDL_MapRGB(videobuffer->format, 224, 0, 0);
- rcDest.w = ww2;
- rcDest.h = 2;
- rcDest.y = rcDest.y + 2;
+ rcDest.top = rcDest.top + 2;
+ rcDest.setWidth(ww2);
+ rcDest.setHeight(2);
SDL_FillRect(videobuffer, &rcDest, ccc);
}
@@ -3212,10 +3211,10 @@ void GriffonEngine::game_drawview() {
game_updspells();
if (cloudson == 1) {
- rc.x = (float)(256 + 256 * cos(3.141592 / 180 * clouddeg));
- rc.y = (float)(192 + 192 * sin(3.141592 / 180 * clouddeg));
- rc.w = 320;
- rc.h = 240;
+ rc.left = (float)(256 + 256 * cos(3.141592 / 180 * clouddeg));
+ rc.top = (float)(192 + 192 * sin(3.141592 / 180 * clouddeg));
+ rc.setWidth(320);
+ rc.setHeight(240);
SDL_BlitSurface(cloudimg, &rc, videobuffer, NULL);
}
@@ -3302,13 +3301,13 @@ void GriffonEngine::game_endofgame() {
do {
Common::Rect rc;
- rc.x = -xofs;
- rc.y = 0;
+ rc.left = -xofs;
+ rc.top = 0;
SDL_BlitSurface(titleimg, NULL, videobuffer, &rc);
- rc.x = -xofs + 320;
- rc.y = 0;
+ rc.left = -xofs + 320;
+ rc.top = 0;
SDL_BlitSurface(titleimg, NULL, videobuffer, &rc);
@@ -3797,7 +3796,7 @@ void GriffonEngine::game_handlewalking() {
void GriffonEngine::game_loadmap(int mapnum) {
unsigned int ccc;
- Common::Rect trect;
+ Common::Rect trect(320, 240);
FILE *fp;
char name[256];
int tempmap[320][200];
@@ -3806,10 +3805,6 @@ void GriffonEngine::game_loadmap(int mapnum) {
curmap = mapnum;
- trect.x = 0;
- trect.y = 0;
- trect.w = 320;
- trect.h = 240;
SDL_FillRect(mapbg, &trect, 0);
SDL_FillRect(clipbg, &trect, ccc);
SDL_FillRect(clipbg2, &trect, ccc);
@@ -3926,15 +3921,15 @@ void GriffonEngine::game_loadmap(int mapnum) {
tileinfo[l][x][y][0] = curtile + 1;
tileinfo[l][x][y][1] = curtilelayer;
- rcSrc.x = curtilex * 16;
- rcSrc.y = curtiley * 16;
- rcSrc.w = 16;
- rcSrc.h = 16;
+ rcSrc.left = curtilex * 16;
+ rcSrc.top = curtiley * 16;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
- rcDest.x = x * 16;
- rcDest.y = y * 16;
- rcDest.w = 16;
- rcDest.h = 16;
+ rcDest.left = x * 16;
+ rcDest.top = y * 16;
+ rcDest.setWidth(16);
+ rcDest.setHeight(16);
if (l == 2 && curtilel == 1) {
for (int ff = 0; ff <= 5; ff++) {
@@ -3957,10 +3952,10 @@ void GriffonEngine::game_loadmap(int mapnum) {
SDL_BlitSurface(tiles[curtilel], &rcSrc, mapbg, &rcDest);
SDL_SetAlpha(tiles[curtilel], SDL_SRCALPHA, 255);
- rcDest.x = x * 8;
- rcDest.y = y * 8;
- rcDest.w = 8;
- rcDest.h = 8;
+ rcDest.left = x * 8;
+ rcDest.top = y * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
SDL_FillRect(clipbg, &rcDest, 0);
}
@@ -4014,10 +4009,10 @@ void GriffonEngine::game_loadmap(int mapnum) {
sys_line(clipbg, x1, y1, x1, y1 + 7, ccc);
sys_line(clipbg, x1 + 1, y1, x1 + 1, y1 + 7, ccc);
} else if (d == 5) {
- rcDest.x = x1;
- rcDest.y = y1;
- rcDest.w = 8;
- rcDest.h = 8;
+ rcDest.left = x1;
+ rcDest.top = y1;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
} else if (d == 6) {
sys_line(clipbg, x1 + 7, y1, x1 + 7, y1 + 7, ccc);
@@ -4077,10 +4072,10 @@ void GriffonEngine::game_loadmap(int mapnum) {
int x1 = x * 8;
int y1 = y * 8;
- rcDest.x = x1;
- rcDest.y = y1;
- rcDest.w = 8;
- rcDest.h = 8;
+ rcDest.left = x1;
+ rcDest.top = y1;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
if (objectinfo[o][4] == 1)
SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
@@ -4396,10 +4391,10 @@ void GriffonEngine::game_loadmap(int mapnum) {
objmap[cx][cy] = 5;
- rcDest.x = cx * 8;
- rcDest.y = cy * 8;
- rcDest.w = 8;
- rcDest.h = 8;
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
npx = player.px + 12;
npy = player.py + 20;
@@ -4420,10 +4415,10 @@ void GriffonEngine::game_loadmap(int mapnum) {
objmap[cx][cy] = 6;
- rcDest.x = cx * 8;
- rcDest.y = cy * 8;
- rcDest.w = 8;
- rcDest.h = 8;
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
npx = player.px + 12;
npy = player.py + 20;
@@ -4444,10 +4439,10 @@ void GriffonEngine::game_loadmap(int mapnum) {
objmap[cx][cy] = 5;
- rcDest.x = cx * 8;
- rcDest.y = cy * 8;
- rcDest.w = 8;
- rcDest.h = 8;
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
npx = player.px + 12;
npy = player.py + 20;
@@ -4468,10 +4463,10 @@ void GriffonEngine::game_loadmap(int mapnum) {
objmap[cx][cy] = 9;
- rcDest.x = cx * 8;
- rcDest.y = cy * 8;
- rcDest.w = 8;
- rcDest.h = 8;
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
npx = player.px + 12;
npy = player.py + 20;
@@ -4492,10 +4487,10 @@ void GriffonEngine::game_loadmap(int mapnum) {
objmap[cx][cy] = 16;
- rcDest.x = cx * 8;
- rcDest.y = cy * 8;
- rcDest.w = 8;
- rcDest.h = 8;
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
npx = player.px + 12;
npy = player.py + 20;
@@ -4516,10 +4511,10 @@ void GriffonEngine::game_loadmap(int mapnum) {
objmap[cx][cy] = 5;
- rcDest.x = cx * 8;
- rcDest.y = cy * 8;
- rcDest.w = 8;
- rcDest.h = 8;
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
npx = player.px + 12;
npy = player.py + 20;
@@ -4541,10 +4536,10 @@ void GriffonEngine::game_loadmap(int mapnum) {
objmap[cx][cy] = 18;
- rcDest.x = cx * 8;
- rcDest.y = cy * 8;
- rcDest.w = 8;
- rcDest.h = 8;
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
npx = player.px + 12;
npy = player.py + 20;
@@ -4564,10 +4559,10 @@ void GriffonEngine::game_loadmap(int mapnum) {
objmap[cx][cy] = 19;
- rcDest.x = cx * 8;
- rcDest.y = cy * 8;
- rcDest.w = 8;
- rcDest.h = 8;
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
npx = player.px + 12;
npy = player.py + 20;
@@ -4587,10 +4582,10 @@ void GriffonEngine::game_loadmap(int mapnum) {
objmap[cx][cy] = 20;
- rcDest.x = cx * 8;
- rcDest.y = cy * 8;
- rcDest.w = 8;
- rcDest.h = 8;
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
npx = player.px + 12;
npy = player.py + 20;
@@ -4651,13 +4646,13 @@ void GriffonEngine::game_newgame() {
ldstop = 1;
}
- rc.x = -xofs;
- rc.y = 0;
+ rc.left = -xofs;
+ rc.top = 0;
SDL_BlitSurface(titleimg, NULL, videobuffer, &rc);
- rc.x = -xofs + 320;
- rc.y = 0;
+ rc.left = -xofs + 320;
+ rc.top = 0;
SDL_BlitSurface(titleimg, NULL, videobuffer, &rc);
@@ -4906,19 +4901,19 @@ void GriffonEngine::game_saveloadnew() {
y = y + 1 * fpsr;
- rcDest.x = 256 + 256 * cos(3.141592 / 180 * clouddeg * 40);
- rcDest.y = 192 + 192 * sin(3.141592 / 180 * clouddeg * 40);
- rcDest.w = 320;
- rcDest.h = 240;
+ rcDest.left = 256 + 256 * cos(3.141592 / 180 * clouddeg * 40);
+ rcDest.top = 192 + 192 * sin(3.141592 / 180 * clouddeg * 40);
+ rcDest.setWidth(320);
+ rcDest.setHeight(240);
SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 128);
SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 64);
- rcDest.x = 256;
- rcDest.y = 192;
- rcDest.w = 320;
- rcDest.h = 240;
+ rcDest.left = 256;
+ rcDest.top = 192;
+ rcDest.setWidth(320);
+ rcDest.setHeight(240);
SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 128);
SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
@@ -5083,32 +5078,32 @@ void GriffonEngine::game_saveloadnew() {
sys_print(videobuffer, line, sx, sy + 11, 0);
- rcSrc.x = sx + 15 * 8 + 24;
- rcSrc.y = sy + 1;
+ rcSrc.left = sx + 15 * 8 + 24;
+ rcSrc.top = sy + 1;
ss = (playera.sword - 1) * 3;
if (playera.sword == 3)
ss = 18;
SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
- rcSrc.x = rcSrc.x + 16;
+ rcSrc.left = rcSrc.left + 16;
ss = (playera.shield - 1) * 3 + 1;
if (playera.shield == 3)
ss = 19;
SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
- rcSrc.x = rcSrc.x + 16;
+ rcSrc.left = rcSrc.left + 16;
ss = (playera.armour - 1) * 3 + 2;
if (playera.armour == 3)
ss = 20;
SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
- nx = rcSrc.x + 13 + 3 * 8;
- rcSrc.x = nx - 17;
+ nx = rcSrc.left + 13 + 3 * 8;
+ rcSrc.left = nx - 17;
if (playera.foundspell[0] == 1) {
for (int i = 0; i < 5; i++) {
- rcSrc.x = rcSrc.x + 17;
+ rcSrc.left = rcSrc.left + 17;
if (playera.foundspell[i] == 1)
SDL_BlitSurface(itemimg[7 + i], NULL, videobuffer, &rcSrc);
}
@@ -5124,31 +5119,31 @@ void GriffonEngine::game_saveloadnew() {
if (currow == 0) {
rcDest.y = 18;
if (curcol == 0)
- rcDest.x = 10;
+ rcDest.left = 10;
if (curcol == 1)
- rcDest.x = 108;
+ rcDest.left = 108;
if (curcol == 2)
- rcDest.x = 170;
+ rcDest.left = 170;
if (curcol == 3)
- rcDest.x = 230;
- rcDest.x = (float)(rcDest.x + 2 + 2 * sin(3.14159 * 2 * itemyloc / 16));
+ rcDest.left = 230;
+ rcDest.left = (float)(rcDest.x + 2 + 2 * sin(3.14159 * 2 * itemyloc / 16));
}
if (currow > 0) {
- rcDest.x = (float)(0 + 2 * sin(3.14159 * 2 * itemyloc / 16));
- rcDest.y = (float)(53 + (currow - 1) * 48);
+ rcDest.left = (float)(0 + 2 * sin(3.14159 * 2 * itemyloc / 16));
+ rcDest.top = (float)(53 + (currow - 1) * 48);
}
SDL_BlitSurface(itemimg[15], NULL, videobuffer, &rcDest);
if (lowerlock == 1) {
- rcDest.y = 18;
+ rcDest.top = 18;
if (curcol == 1)
- rcDest.x = 108;
+ rcDest.left = 108;
if (curcol == 2)
- rcDest.x = 170;
- rcDest.x = rcDest.x; // + 2 + 2 * sin(-3.14159 * 2 * itemyloc / 16)
+ rcDest.left = 170;
+ rcDest.left = rcDest.left; // + 2 + 2 * sin(-3.14159 * 2 * itemyloc / 16)
SDL_BlitSurface(itemimg[15], NULL, videobuffer, &rcDest);
}
@@ -5298,10 +5293,10 @@ void GriffonEngine::game_swash() {
SDL_BlitSurface(mapbg, NULL, videobuffer, NULL);
if (cloudson == 1) {
- rcDest.x = (float)(256 + 256 * cos(3.141592 / 180 * clouddeg));
- rcDest.y = (float)(192 + 192 * sin(3.141592 / 180 * clouddeg));
- rcDest.w = 320;
- rcDest.h = 240;
+ rcDest.left = (float)(256 + 256 * cos(3.141592 / 180 * clouddeg));
+ rcDest.top = (float)(192 + 192 * sin(3.141592 / 180 * clouddeg));
+ rcDest.setWidth(320);
+ rcDest.setHeight(240);
SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
}
@@ -5372,10 +5367,10 @@ void GriffonEngine::game_title(int mode) {
int cursel, ldstop;
int x, y;
- rcSrc.x = 0;
- rcSrc.y = 0;
- rcSrc.w = 320;
- rcSrc.h = 240;
+ rcSrc.left = 0;
+ rcSrc.top = 0;
+ rcSrc.setWidth(320);
+ rcSrc.setHeight(240);
SDL_FillRect(videobuffer2, &rcSrc, 0);
SDL_FillRect(videobuffer3, &rcSrc, 0);
@@ -5415,18 +5410,18 @@ void GriffonEngine::game_title(int mode) {
ldstop = 1;
}
- rc.x = -xofs;
- rc.y = 0;
+ rc.left = -xofs;
+ rc.top = 0;
SDL_BlitSurface(titleimg, NULL, videobuffer, &rc);
- rc.x = -xofs + 320.0;
- rc.y = 0;
+ rc.left = -xofs + 320.0;
+ rc.top = 0;
SDL_BlitSurface(titleimg, NULL, videobuffer, &rc);
- rc.x = 0;
- rc.y = 0;
+ rc.left = 0;
+ rc.top = 0;
SDL_BlitSurface(titleimg2, NULL, videobuffer, &rc);
@@ -5442,8 +5437,8 @@ void GriffonEngine::game_title(int mode) {
else
sys_print(videobuffer, "(c) 2005 by Daniel 'Syn9' Kennedy", 28, 224, 4);
- rc.x = (float)(x - 16 - 4 * cos(3.14159 * 2 * itemyloc / 16));
- rc.y = (float)(y - 4 + 16 * cursel);
+ rc.left = (float)(x - 16 - 4 * cos(3.14159 * 2 * itemyloc / 16));
+ rc.top = (float)(y - 4 + 16 * cursel);
SDL_BlitSurface(itemimg[15], NULL, videobuffer, &rc);
@@ -6504,10 +6499,10 @@ void GriffonEngine::game_updnpcs() {
int xp = (npx / 2 + 6);
int yp = (npy / 2 + 10);
- rcSrc.x = xp - 1;
- rcSrc.y = yp - 1;
- rcSrc.w = 3;
- rcSrc.h = 3;
+ rcSrc.left = xp - 1;
+ rcSrc.top = yp - 1;
+ rcSrc.setWidth(3);
+ rcSrc.setHeight(3);
if (npcinfo[i].pause < ticks)
SDL_FillRect(clipbg, &rcSrc, i);
@@ -6806,16 +6801,16 @@ void GriffonEngine::game_updspells() {
if (fr < f * 4 + 8) {
int fi = (int)((fr - f * 4) * 3) % 4;
- rcSrc.x = 32 + fi * 16;
- rcSrc.y = 80;
- rcSrc.w = 16;
- rcSrc.h = 16;
+ rcSrc.left = 32 + fi * 16;
+ rcSrc.top = 80;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
xloc = spellinfo[i].enemyx + 12 + ll[f][0] * 16;
yloc = spellinfo[i].enemyy + 16 + ll[f][1] * 16;
- rcDest.x = xloc;
- rcDest.y = yloc;
+ rcDest.left = xloc;
+ rcDest.top = yloc;
alf = 255 * ((fr - f * 4) / 8);
}
@@ -6827,10 +6822,10 @@ void GriffonEngine::game_updspells() {
fi = 0;
if (f == 1 || f == 3)
fi = 1;
- rcSrc.x = 32 + fi * 16;
- rcSrc.y = 80;
- rcSrc.w = 16;
- rcSrc.h = 16;
+ rcSrc.left = 32 + fi * 16;
+ rcSrc.top = 80;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
xst = spellinfo[i].enemyx + 12 + ll[f][0] * 16;
yst = spellinfo[i].enemyy + 16 + ll[f][1] * 16;
@@ -6842,8 +6837,8 @@ void GriffonEngine::game_updspells() {
xloc = xst + xi * fl * fl;
yloc = yst + yi * fl * fl;
- rcDest.x = xloc;
- rcDest.y = yloc;
+ rcDest.left = xloc;
+ rcDest.top = yloc;
alf = 255;
}
@@ -6883,10 +6878,10 @@ void GriffonEngine::game_updspells() {
objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
- rcSrc.x = postinfo[e][0] / 2;
- rcSrc.y = postinfo[e][1] / 2;
- rcSrc.w = 8;
- rcSrc.h = 8;
+ rcSrc.left = postinfo[e][0] / 2;
+ rcSrc.top = postinfo[e][1] / 2;
+ rcSrc.setWidth(8);
+ rcSrc.setHeight(8);
SDL_FillRect(clipbg2, &rcSrc, 0);
@@ -6910,10 +6905,10 @@ void GriffonEngine::game_updspells() {
int npc;
int fr = (int)((32 - spellinfo[i].frame) * 4) % 3;
- rcSrc.x = fr * 48;
- rcSrc.y = 0;
- rcSrc.w = 48;
- rcSrc.h = 48;
+ rcSrc.left = fr * 48;
+ rcSrc.top = 0;
+ rcSrc.setWidth(48);
+ rcSrc.setHeight(48);
float c1 = (32 - spellinfo[i].frame) / 16;
@@ -6926,8 +6921,8 @@ void GriffonEngine::game_updspells() {
xloc = halfx + wdth * cos(3.14159 + 3.14159 * 2 * c1);
yloc = halfy + hight * sin(3.14159 + 3.14159 * 2 * c1);
- rcDest.x = xloc;
- rcDest.y = yloc;
+ rcDest.left = xloc;
+ rcDest.top = yloc;
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
@@ -7008,10 +7003,10 @@ void GriffonEngine::game_updspells() {
objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
- rcSrc.x = postinfo[e][0] / 2;
- rcSrc.y = postinfo[e][1] / 2;
- rcSrc.w = 8;
- rcSrc.h = 8;
+ rcSrc.left = postinfo[e][0] / 2;
+ rcSrc.top = postinfo[e][1] / 2;
+ rcSrc.setWidth(8);
+ rcSrc.setHeight(8);
SDL_FillRect(clipbg2, &rcSrc, 0);
@@ -7035,10 +7030,10 @@ void GriffonEngine::game_updspells() {
float fr = (32 - spellinfo[i].frame);
if (fr > f && fr < f + 16) {
- rcSrc.x = 32 * spellinfo[i].rockimg[f];
- rcSrc.y = 48;
- rcSrc.w = 32;
- rcSrc.h = 32;
+ rcSrc.left = 32 * spellinfo[i].rockimg[f];
+ rcSrc.top = 48;
+ rcSrc.setWidth(32);
+ rcSrc.setHeight(32);
int scatter = 0;
if (fr < 8 + f) {
@@ -7051,8 +7046,8 @@ void GriffonEngine::game_updspells() {
yloc = spellinfo[i].enemyy + hght * (1 - cos(3.14159 / 2 * ((fr - f) - 8) / 8));
}
- rcDest.x = xloc;
- rcDest.y = yloc;
+ rcDest.left = xloc;
+ rcDest.top = yloc;
if (xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
@@ -7088,10 +7083,10 @@ void GriffonEngine::game_updspells() {
objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
- rcSrc.x = postinfo[e][0] / 2;
- rcSrc.y = postinfo[e][1] / 2;
- rcSrc.w = 8;
- rcSrc.h = 8;
+ rcSrc.left = postinfo[e][0] / 2;
+ rcSrc.top = postinfo[e][1] / 2;
+ rcSrc.setWidth(8);
+ rcSrc.setHeight(8);
SDL_FillRect(clipbg2, &rcSrc, 0);
@@ -7120,13 +7115,13 @@ void GriffonEngine::game_updspells() {
float fra = (32 - spellinfo[i].frame);
int fr = (int)((spellinfo[i].frame) * 2) % 8;
- rcSrc.x = fr * 32;
- rcSrc.y = 96 + 48;
- rcSrc.w = 32;
- rcSrc.h = 64;
+ rcSrc.left = fr * 32;
+ rcSrc.top = 96 + 48;
+ rcSrc.setWidth(32);
+ rcSrc.setHeight(64);
- rcDest.x = player.px - 4;
- rcDest.y = player.py + 16 - 48;
+ rcDest.left = player.px - 4;
+ rcDest.top = player.py + 16 - 48;
int f = 160;
if (fra < 8)
@@ -7219,10 +7214,10 @@ void GriffonEngine::game_updspells() {
SDL_SetAlpha(spellimg, SDL_SRCALPHA, 192 * sin(3.14159 * fr / 4));
- rcSrc.x = 16 * (int)(RND() * 2);
- rcSrc.y = 80;
- rcSrc.w = 16;
- rcSrc.h = 16;
+ rcSrc.left = 16 * (int)(RND() * 2);
+ rcSrc.top = 80;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
for (int ff = 0; ff <= spellinfo[i].nfballs - 1; ff++) {
@@ -7239,10 +7234,10 @@ void GriffonEngine::game_updspells() {
} else {
SDL_SetAlpha(spellimg, SDL_SRCALPHA, 192);
- rcSrc.x = 16 * (int)(RND() * 2);
- rcSrc.y = 80;
- rcSrc.w = 16;
- rcSrc.h = 16;
+ rcSrc.left = 16 * (int)(RND() * 2);
+ rcSrc.top = 80;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
for (int ff = 0; ff <= spellinfo[i].nfballs - 1; ff++) {
float ax = spellinfo[i].fireballs[ff][0];
@@ -7365,10 +7360,10 @@ void GriffonEngine::game_updspells() {
objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
- rcSrc.x = postinfo[e][0] / 2;
- rcSrc.y = postinfo[e][1] / 2;
- rcSrc.w = 8;
- rcSrc.h = 8;
+ rcSrc.left = postinfo[e][0] / 2;
+ rcSrc.top = postinfo[e][1] / 2;
+ rcSrc.setWidth(8);
+ rcSrc.setHeight(8);
SDL_FillRect(clipbg2, &rcSrc, 0);
@@ -7423,10 +7418,10 @@ void GriffonEngine::game_updspells() {
objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
- rcSrc.x = postinfo[e][0] / 2;
- rcSrc.y = postinfo[e][1] / 2;
- rcSrc.w = 8;
- rcSrc.h = 8;
+ rcSrc.left = postinfo[e][0] / 2;
+ rcSrc.top = postinfo[e][1] / 2;
+ rcSrc.setWidth(8);
+ rcSrc.setHeight(8);
SDL_FillRect(clipbg2, &rcSrc, 0);
@@ -7480,10 +7475,10 @@ void GriffonEngine::game_updspells() {
objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
- rcSrc.x = postinfo[e][0] / 2;
- rcSrc.y = postinfo[e][1] / 2;
- rcSrc.w = 8;
- rcSrc.h = 8;
+ rcSrc.left = postinfo[e][0] / 2;
+ rcSrc.top = postinfo[e][1] / 2;
+ rcSrc.setWidth(8);
+ rcSrc.setHeight(8);
SDL_FillRect(clipbg2, &rcSrc, 0);
@@ -7537,10 +7532,10 @@ void GriffonEngine::game_updspells() {
objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
- rcSrc.x = postinfo[e][0] / 2;
- rcSrc.y = postinfo[e][1] / 2;
- rcSrc.w = 8;
- rcSrc.h = 8;
+ rcSrc.left = postinfo[e][0] / 2;
+ rcSrc.top = postinfo[e][1] / 2;
+ rcSrc.setWidth(8);
+ rcSrc.setHeight(8);
SDL_FillRect(clipbg2, &rcSrc, 0);
@@ -7645,10 +7640,10 @@ void GriffonEngine::game_updspellsunder() {
int fra = (32 - spellinfo[i].frame);
int fr = (int)((32 - spellinfo[i].frame) * 2) % 4;
- rcSrc.x = fr * 48;
- rcSrc.y = 96;
- rcSrc.w = 48;
- rcSrc.h = 48;
+ rcSrc.left = fr * 48;
+ rcSrc.top = 96;
+ rcSrc.setWidth(48);
+ rcSrc.setHeight(48);
rcDest.x = spellinfo[i].enemyx - 12;
rcDest.y = spellinfo[i].enemyy - 8;
@@ -7753,15 +7748,15 @@ void GriffonEngine::game_updspellsunder() {
float an = 360 / 5 * f + x / 32 * 180;
- rcSrc.x = 16 * (int)(RND() * 2);
- rcSrc.y = 80;
- rcSrc.w = 16;
- rcSrc.h = 16;
+ rcSrc.left = 16 * (int)(RND() * 2);
+ rcSrc.top = 80;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
float xloc = (float)(spellinfo[i].enemyx + 4 + x * 2 * cos(3.14159 / 180 * an) + (int)(RND() * 3) - 1);
float yloc = (float)(spellinfo[i].enemyy + 4 + x * 2 * sin(3.14159 / 180 * an) + (int)(RND() * 3) - 1);
- rcDest.x = (int)xloc;
- rcDest.y = (int)yloc;
+ rcDest.left = (int)xloc;
+ rcDest.top = (int)yloc;
if (xloc > -1 && xloc < 304 && yloc > -1 && yloc < 224) {
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
@@ -7825,10 +7820,10 @@ void GriffonEngine::game_updspellsunder() {
objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
- rcSrc.x = postinfo[e][0] / 2;
- rcSrc.y = postinfo[e][1] / 2;
- rcSrc.w = 8;
- rcSrc.h = 8;
+ rcSrc.left = postinfo[e][0] / 2;
+ rcSrc.top = postinfo[e][1] / 2;
+ rcSrc.setWidth(8);
+ rcSrc.setHeight(8);
SDL_FillRect(clipbg2, &rcSrc, 0);
@@ -7880,16 +7875,16 @@ void GriffonEngine::game_updspellsunder() {
SDL_SetAlpha(spellimg, SDL_SRCALPHA, alpha);
- rcSrc.x = 16 * (int)(RND() * 2);
- rcSrc.y = 80;
- rcSrc.w = 16;
- rcSrc.h = 16;
+ rcSrc.left = 16 * (int)(RND() * 2);
+ rcSrc.top = 80;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
float xloc = spellinfo[i].homex + xspan / 7 * f;
float yloc = spellinfo[i].homey + yspan / 7 * f - yy;
- rcDest.x = xloc;
- rcDest.y = yloc;
+ rcDest.left = xloc;
+ rcDest.top = yloc;
if (xloc > -16 && xloc < 320 && yloc > -16 && yloc < 240) {
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
@@ -8187,10 +8182,10 @@ void GriffonEngine::sys_LoadItemImgs() {
itemimg[i] = SDL_CreateRGBSurface(SDL_SWSURFACE, 16, 16, config.scr_bpp, video->format->Rmask, video->format->Gmask, video->format->Bmask, video->format->Amask);
SDL_SetColorKey(itemimg[i], SDL_SRCCOLORKEY, SDL_MapRGB(itemimg[i]->format, 255, 0, 255));
- rcSrc.x = i * 16;
- rcSrc.y = 0;
- rcSrc.w = 16;
- rcSrc.h = 16;
+ rcSrc.left = i * 16;
+ rcSrc.top = 0;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
SDL_BlitSurface(temp, &rcSrc, itemimg[i], NULL);
}
@@ -8214,10 +8209,10 @@ void GriffonEngine::sys_LoadFont() {
int row = (i2 - col) / 40;
- rcSrc.x = col * 8;
- rcSrc.y = row * 8 + f * 48;
- rcSrc.w = 8;
- rcSrc.h = 8;
+ rcSrc.left = col * 8;
+ rcSrc.top = row * 8 + f * 48;
+ rcSrc.setWidth(8);
+ rcSrc.setHeight(8);
rcDest.x = 0;
rcDest.y = 0;
@@ -8282,12 +8277,12 @@ void GriffonEngine::sys_LoadObjectDB() {
fclose(fp);
}
-void GriffonEngine::sys_print(Graphics::TransparentSurface *buffer, char *stri, int xloc, int yloc, int col) {
+void GriffonEngine::sys_print(Graphics::TransparentSurface *buffer, const char *stri, int xloc, int yloc, int col) {
int l = strlen(stri);
for (int i = 0; i < l; i++) {
- rcDest.x = xloc + i * 8;
- rcDest.y = yloc;
+ rcDest.left = xloc + i * 8;
+ rcDest.top = yloc;
SDL_BlitSurface(fontchr[stri[i] - 32][col], NULL, buffer, &rcDest);
}
@@ -8298,7 +8293,7 @@ void GriffonEngine::sys_progress(int w, int wm) {
ccc = SDL_MapRGB(videobuffer->format, 0, 255, 0);
- rcDest.w = w * 74 / wm;
+ rcDest.setWidth(w * 74 / wm);
SDL_FillRect(videobuffer, &rcDest, ccc);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
SDL_Flip(video);
@@ -8326,13 +8321,13 @@ void GriffonEngine::sys_setupAudio() {
loadimg = IMG_Load("art/load.bmp");
SDL_SetColorKey(loadimg, SDL_SRCCOLORKEY, SDL_MapRGB(loadimg->format, 255, 0, 255));
- rcSrc.x = 0;
- rcSrc.y = 0;
- rcSrc.w = 88;
- rcSrc.h = 32;
+ rcSrc.left = 0;
+ rcSrc.top = 0;
+ rcSrc.setWidth(88);
+ rcSrc.setHeight(32);
- rcDest.x = 160 - 44;
- rcDest.y = 116 + 12;
+ rcDest.left = 160 - 44;
+ rcDest.top = 116 + 12;
SDL_SetAlpha(loadimg, 0 | SDL_SRCALPHA, 160); // 128
SDL_BlitSurface(loadimg, &rcSrc, videobuffer, &rcDest);
@@ -8341,9 +8336,9 @@ void GriffonEngine::sys_setupAudio() {
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
SDL_Flip(video);
- rcDest.x = 160 - 44 + 7;
- rcDest.y = 116 + 12 + 12;
- rcDest.h = 8;
+ rcDest.left = 160 - 44 + 7;
+ rcDest.top = 116 + 12 + 12;
+ rcDest.setHeight(8);
if (menabled == 1) {
mboss = Mix_LoadWAV("music/boss.ogg");
@@ -8499,10 +8494,10 @@ void sys_update() {
Common::Rect rc;
- rc.x = player.px - 2;
- rc.y = player.py - 2;
- rc.w = 5;
- rc.h = 5;
+ rc.left = player.px - 2;
+ rc.top = player.py - 2;
+ rc.setWidth(5);
+ rc.setHeight(5);
SDL_FillRect(clipbg, &rc, 1000);
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index c200fbf..1a18d7d 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -288,7 +288,7 @@ private:
void sys_LoadTiles();
void sys_LoadTriggers();
void sys_LoadObjectDB();
- void sys_print(Graphics::TransparentSurface *buffer, char *stri, int xloc, int yloc, int col);
+ void sys_print(Graphics::TransparentSurface *buffer, const char *stri, int xloc, int yloc, int col);
void sys_progress(int w, int wm);
void sys_setupAudio();
void sys_update();
Commit: 561d7dbbbba3e5f52df0c1e31b527781b7bfa540
https://github.com/scummvm/scummvm/commit/561d7dbbbba3e5f52df0c1e31b527781b7bfa540
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: More compilation fixes. The code compiles now
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 4daaf79..0c7ea9e 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -39,8 +39,11 @@
#include "griffon/state.h"
#include "common/events.h"
+#include "common/file.h"
#include "common/system.h"
+#include "image/bmp.h"
+
namespace Griffon {
// memo
@@ -95,12 +98,27 @@ namespace Griffon {
// stubs
typedef int Mix_Chunk;
void Mix_Volume(int channel, int volume) {}
-int Mix_PlayChannel(int par1, Mix_Chunk *chunk, int par3);
+int Mix_PlayChannel(int par1, Mix_Chunk *chunk, int par3) { return 0; }
+void Mix_Pause(int channel) {}
+void Mix_HaltChannel(int channel) {}
+void Mix_Resume(int channel) {}
+void SDL_SetAlpha(Graphics::Surface *src, int flag, int alpha) {}
+void SDL_Flip(Graphics::TransparentSurface *src) {}
+void SDL_BlitSurface(Graphics::TransparentSurface *src, Common::Rect *srcRect, Graphics::TransparentSurface *dst, Common::Rect *dstRect) {}
+void SDL_BlitSurface(Graphics::Surface *src, Common::Rect *srcRect, Graphics::TransparentSurface *dst, Common::Rect *dstRect) {}
+void SDL_BlitSurface(Graphics::Surface *src, Common::Rect *srcRect, Graphics::Surface *dst, Common::Rect *dstRect) {}
+void SDL_FillRect(Graphics::TransparentSurface *surface, Common::Rect *rect, uint32 color) {}
+int SDL_MapRGB(Graphics::PixelFormat format, int r, int g, int b) { return 0; }
+void SDL_SetColorKey(Graphics::Surface *src, int mode, uint32 color);
+
+Mix_Chunk *Mix_LoadWAV(const char *name) { return NULL; }
+bool Mix_Playing(int channel) { return true; }
+
// system
Graphics::TransparentSurface *video, *videobuffer, *videobuffer2, *videobuffer3;
-Graphics::TransparentSurface *titleimg, *titleimg2, *inventoryimg;
-Graphics::TransparentSurface *logosimg, *theendimg;
+Graphics::Surface *titleimg, *titleimg2, *inventoryimg;
+Graphics::Surface *logosimg, *theendimg;
Common::Event event;
Graphics::TransparentSurface *mapbg, *clipbg, *clipbg2;
@@ -111,9 +129,9 @@ float animspd;
int rampdata[40][24];
int curmap;
-Graphics::TransparentSurface *fontchr[224][5]; // 256 - 32
-Graphics::TransparentSurface *itemimg[21], *windowimg;
-Graphics::TransparentSurface *spellimg;
+Graphics::Surface *fontchr[224][5]; // 256 - 32
+Graphics::Surface *itemimg[21], *windowimg;
+Graphics::Surface *spellimg;
int itemselon, curitem, itemticks;
float itemyloc;
@@ -127,7 +145,7 @@ float fp, fps, fpsr;
int secsingame, secstart;
extern const char *story[48];
-Graphics::TransparentSurface *mapimg[4];
+Graphics::Surface *mapimg[4];
extern int invmap[4][7][13];
extern const char *story2[27];
@@ -137,7 +155,7 @@ Common::Rect rcSrc, rcDest;
int dontdrawover; // used in map24 so that the candles dont draw over the boss, default set to 0
// saveload info
-Graphics::TransparentSurface *saveloadimg;
+Graphics::Surface *saveloadimg;
// post info
@@ -145,7 +163,7 @@ float postinfo[21][3];
int nposts;
// cloud info
-Graphics::TransparentSurface *cloudimg;
+Graphics::Surface *cloudimg;
float clouddeg = 0;
int cloudson;
@@ -160,16 +178,16 @@ PLAYERTYPE playera;
int asecstart;
// tile info
-Graphics::TransparentSurface *tiles[4];
+Graphics::Surface *tiles[4];
int tileinfo[3][40][24][3]; // maplayer, x, y, tiledata (tile, tilelayer)
extern int elementmap[15][20];
// animation info
-Graphics::TransparentSurface *anims[100];
+Graphics::Surface *anims[100];
// id number 0&1 = players
-Graphics::TransparentSurface *animsa[100];
+Graphics::Surface *animsa[100];
// attack anims
float playerattackofs[4][16][3];
// [dir] [frame] [x,y ofs, completed(0/1)]
@@ -373,36 +391,42 @@ int invmap[4][7][13] = {
};
// HELPER MACRO ---------------------------------------------------------------
-#define PRINT(A,B) \
- do { \
- char line[256]; \
- sprintf(line, A "\n", B); \
- fputs(line, fp); \
- } while(0)
-
-#define INPUT(A, B) \
- do { \
- char line[256]; \
- fgets(line, sizeof(line), fp); \
- sscanf(line, A, B); \
+#define INPUT(A, B) \
+ do { \
+ Common::String line; \
+ fp.readLine(); \
+ sscanf(line.c_str(), A, B); \
} while(0)
// CODE GOES HERE -------------------------------------------------------------
-#ifdef OPENDINGUX
-#define SDL_BLITVIDEO(X, Y, C, F) SDL_BlitSurface((X), (Y), (C), (F))
-#else
#define SDL_BLITVIDEO(X, Y, C, F) sdl_blitscale((X), (Y), (C), NULL)
-#endif
void sdl_blitscale(Graphics::TransparentSurface *src, Common::Rect *srcrect, Graphics::TransparentSurface *dst, Common::Rect *dstrect) {
- src->blit(dst);
+ src->blit(*dst);
}
void game_fillrect(Graphics::TransparentSurface *surface, int x, int y, int w, int h, int color) {
surface->fillRect(Common::Rect(x, y, x + w, y + h), color);
}
+Graphics::Surface *IMG_Load(const char *name) {
+ Common::File fp;
+
+ fp.open(name);
+ if (!fp.isOpen()) {
+ error("Cannot open file %s", name);
+ }
+
+ Image::BitmapDecoder bitmapDecoder;
+ bitmapDecoder.loadStream(fp);
+ fp.close();
+
+ Graphics::Surface *res = bitmapDecoder.getSurface()->convertTo(g_system->getScreenFormat());
+
+ return res;
+}
+
// copypaste from hRnd_CRT()
float GriffonEngine::RND() {
/* return between 0 and 1 (but never 1) */
@@ -421,7 +445,7 @@ void GriffonEngine::game_addFloatIcon(int ico, float xloc, float yloc) {
}
}
-void GriffonEngine::game_addFloatText(char *stri, float xloc, float yloc, int col) {
+void GriffonEngine::game_addFloatText(const char *stri, float xloc, float yloc, int col) {
for (int i = 0; i < kMaxFloat; i++) {
if (floattext[i][0] == 0) {
floattext[i][0] = 32;
@@ -1246,7 +1270,7 @@ __exit_do:
}
}
-void game_checktrigger() {
+void GriffonEngine::game_checktrigger() {
int npx, npy, lx, ly;
npx = player.px + 12;
@@ -1272,22 +1296,20 @@ void game_checktrigger() {
#endif
void GriffonEngine::game_configmenu() {
- Graphics::TransparentSurface *configwindow;
+ Graphics::Surface *configwindow;
Common::Rect rc;
int cursel, curselt, ofullscreen;
int tickwait, keypause, ticks1;
cursel = MINCURSEL;
- ticks = SDL_GetTicks();
+ ticks = g_system->getMillis();
tickwait = 100;
keypause = ticks + tickwait;
- configwindow = SDL_DisplayFormat(videobuffer);
-
configwindow = IMG_Load("art/configwindow.bmp");
- SDL_SetColorKey(configwindow, SDL_SRCCOLORKEY, SDL_MapRGB(configwindow->format, 255, 0, 255));
- SDL_SetAlpha(configwindow, SDL_SRCALPHA, 160);
+ SDL_SetColorKey(configwindow, 0, SDL_MapRGB(configwindow->format, 255, 0, 255));
+ SDL_SetAlpha(configwindow, 0, 160);
ticks1 = ticks;
do {
@@ -1298,18 +1320,18 @@ void GriffonEngine::game_configmenu() {
rcDest.setWidth(320);
rcDest.setHeight(240);
- SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 128);
+ SDL_SetAlpha(cloudimg, 0, 128);
SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
- SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 64);
+ SDL_SetAlpha(cloudimg, 0, 64);
rcDest.left = 256;
rcDest.top = 192;
rcDest.setWidth(320);
rcDest.setHeight(240);
- SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 128);
+ SDL_SetAlpha(cloudimg, 0, 128);
SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
- SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 64);
+ SDL_SetAlpha(cloudimg, 0, 64);
SDL_BlitSurface(configwindow, NULL, videobuffer, NULL);
@@ -1423,15 +1445,15 @@ void GriffonEngine::game_configmenu() {
yy = 255.0;
}
- SDL_SetAlpha(videobuffer, SDL_SRCALPHA, (int)yy);
+ SDL_SetAlpha(videobuffer, 0, (int)yy);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
- SDL_SetAlpha(videobuffer, SDL_SRCALPHA, 255);
+ SDL_SetAlpha(videobuffer, 0, 255);
SDL_Flip(video);
- SDL_PumpEvents();
+ g_system->getEventManager()->pollEvent(event);
tickspassed = ticks;
- ticks = SDL_GetTicks();
+ ticks = g_system->getMillis();
tickspassed = ticks - tickspassed;
fpsr = (float)tickspassed / 24;
@@ -1515,6 +1537,7 @@ void GriffonEngine::game_configmenu() {
}
if (event.kbd.keycode == Common::KEYCODE_RETURN) {
+#if 0
if (cursel == 0) {
fullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
@@ -1611,6 +1634,7 @@ void GriffonEngine::game_configmenu() {
config_save(&config);
break;
}
+#endif
if (cursel == 14) {
// reset keys to avoid returning
@@ -1625,13 +1649,13 @@ void GriffonEngine::game_configmenu() {
while (clouddeg >= 360)
clouddeg = clouddeg - 360;
- SDL_Delay(10);
+ g_system->delayMillis(10);
} while (1);
- SDL_FreeSurface(configwindow);
+ configwindow->free();
itemticks = ticks + 210;
- SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 64);
+ SDL_SetAlpha(cloudimg, 0, 64);
}
void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
@@ -2242,7 +2266,7 @@ void GriffonEngine::game_drawhud() {
if (ico != 99)
SDL_BlitSurface(itemimg[ico], NULL, videobuffer, &rcDest);
if (ico == 99) {
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, (int)(RND() * 96) + 96);
+ SDL_SetAlpha(spellimg, 0, (int)(RND() * 96) + 96);
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -2254,7 +2278,7 @@ void GriffonEngine::game_drawhud() {
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
+ SDL_SetAlpha(spellimg, 0, 255);
}
}
}
@@ -2290,7 +2314,7 @@ void GriffonEngine::game_drawhud() {
rcDest.top = 0;
rcDest.right = 320;
rcDest.bottom = 240;
- SDL_SetAlpha(videobuffer2, SDL_SRCALPHA, (int)(player.itemselshade * 4));
+ SDL_SetAlpha(videobuffer2, 0, (int)(player.itemselshade * 4));
SDL_FillRect(videobuffer2, &rcDest, 0);
SDL_BlitSurface(videobuffer2, NULL, videobuffer, NULL);
@@ -2298,9 +2322,9 @@ void GriffonEngine::game_drawhud() {
rcSrc.left = 46;
rcSrc.top = 46;
- SDL_SetAlpha(inventoryimg, SDL_SRCALPHA, 160); // 128
+ SDL_SetAlpha(inventoryimg, 0, 160); // 128
SDL_BlitSurface(inventoryimg, NULL, videobuffer, &rcSrc);
- SDL_SetAlpha(inventoryimg, SDL_SRCALPHA, 255);
+ SDL_SetAlpha(inventoryimg, 0, 255);
int sx = 54;
sy = 55;
@@ -2393,8 +2417,8 @@ void GriffonEngine::game_drawhud() {
for (int i = 0; i <= 4; i++) {
sx = 188;
sy = 70 + i * 24;
- rcSrc.x = sx;
- rcSrc.y = sy;
+ rcSrc.left = sx;
+ rcSrc.top = sy;
if (i == 0)
SDL_BlitSurface(itemimg[6], NULL, videobuffer, &rcSrc);
if (i == 1)
@@ -2431,14 +2455,14 @@ void GriffonEngine::game_drawhud() {
if (itemselon == 1) {
for (int i = 0; i <= 4; i++) {
if (curitem == 5 + i) {
- rcDest.x = (float)(243 - 12 + 3 * sin(3.141592 * 2 * itemyloc / 16));
- rcDest.y = 67 + 24 * i;
+ rcDest.left = (float)(243 - 12 + 3 * sin(3.141592 * 2 * itemyloc / 16));
+ rcDest.top = 67 + 24 * i;
SDL_BlitSurface(itemimg[15], NULL, videobuffer, &rcDest);
}
if (curitem == i) {
- rcDest.x = (float)(189 - 12 + 3 * sin(3.141592 * 2 * itemyloc / 16));
- rcDest.y = 70 + 24 * i;
+ rcDest.left = (float)(189 - 12 + 3 * sin(3.141592 * 2 * itemyloc / 16));
+ rcDest.top = 70 + 24 * i;
SDL_BlitSurface(itemimg[15], NULL, videobuffer, &rcDest);
}
}
@@ -2448,11 +2472,11 @@ void GriffonEngine::game_drawhud() {
if (selenemyon == 1) {
if (curenemy > lastnpc) {
int pst = curenemy - lastnpc - 1;
- rcDest.x = postinfo[pst][0];
- rcDest.y = (float)(postinfo[pst][1] - 4 - sin(3.141592 / 8 * itemyloc));
+ rcDest.left = postinfo[pst][0];
+ rcDest.top = (float)(postinfo[pst][1] - 4 - sin(3.141592 / 8 * itemyloc));
} else {
- rcDest.x = npcinfo[curenemy].x + 4;
- rcDest.y = (float)(npcinfo[curenemy].y + 4 - 16 - sin(3.141592 / 8 * itemyloc));
+ rcDest.left = npcinfo[curenemy].x + 4;
+ rcDest.top = (float)(npcinfo[curenemy].y + 4 - 16 - sin(3.141592 / 8 * itemyloc));
}
SDL_BlitSurface(itemimg[13], NULL, videobuffer, &rcDest);
@@ -2637,9 +2661,9 @@ void GriffonEngine::game_drawnpcs(int mode) {
int x = 192 + ((int)(itemyloc + ff * 5) % 3) * 64;
if (x > 255)
x = 255;
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, x);
+ SDL_SetAlpha(spellimg, 0, x);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
+ SDL_SetAlpha(spellimg, 0, 255);
for (int f = 1; f <= 8; f++) {
rcSrc.left = 16 * (int)(RND() * 2);
@@ -2653,9 +2677,9 @@ void GriffonEngine::game_drawnpcs(int mode) {
x = 192 + f % 3 * 64;
if (x > 255)
x = 255;
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, x);
+ SDL_SetAlpha(spellimg, 0, x);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
+ SDL_SetAlpha(spellimg, 0, 255);
}
rcSrc.left = 0;
@@ -2666,9 +2690,9 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = npcinfo[i].bodysection[10 * ff + 9].x - 21;
rcDest.top = npcinfo[i].bodysection[10 * ff + 9].y - 21;
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, 192);
+ SDL_SetAlpha(spellimg, 0, 192);
SDL_BlitSurface(anims[5], &rcSrc, videobuffer, &rcDest);
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
+ SDL_SetAlpha(spellimg, 0, 255);
}
@@ -2723,13 +2747,13 @@ void GriffonEngine::game_drawnpcs(int mode) {
// } else {
//cframe = npcinfo[i].cattackframe;
- //rcSrc.x = (int)(cframe / 4) * 24;
- //rcSrc.y = wdir * 24;
+ //rcSrc.left = (int)(cframe / 4) * 24;
+ //rcSrc.top = wdir * 24;
//rcSrc.setWidth(24);
//rcSrc.setHeight(24);
- //rcDest.x = npx;
- //rcDest.y = npy;
+ //rcDest.left = npx;
+ //rcDest.top = npy;
//rcDest.setWidth(24);
//rcDest.setHeight(24);
// SDL_BlitSurface(animsa(sprite), &rcSrc, videobuffer, &rcDest);
@@ -2843,7 +2867,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
int sy = (float)(npy + 12 - 50 - 3 * sin(3.141592 * 2 * npcinfo[i].floating / 16));
for (int fr = 0; fr <= 3; fr++) {
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, 128 + (int)(RND() * 96));
+ SDL_SetAlpha(spellimg, 0, 128 + (int)(RND() * 96));
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -2870,7 +2894,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = (float)(sx + 36 + ii * 8 - ii * cos(3.14159 * 2 * (fr3 - ii) / 16) * 2);
rcDest.top = (float)(sy + 16 + ii * sin(3.14159 * 2 * (fr3 - ii) / 16) * 3 - ii); // * 4
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, i2 / 3 * 224);
+ SDL_SetAlpha(spellimg, 0, i2 / 3 * 224);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
@@ -2896,7 +2920,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = (float)(sx + 36 - ii * 8 + ii * cos(3.14159 * 2 * (fr3 - ii) / 16) * 2);
rcDest.top = (float)(sy + 16 + ii * sin(3.14159 * 2 * (fr3 - ii) / 16) * 3 - ii); // * 4
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, i2 / 3 * 224);
+ SDL_SetAlpha(spellimg, 0, i2 / 3 * 224);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
@@ -2919,7 +2943,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
}
}
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
+ SDL_SetAlpha(spellimg, 0, 255);
if (npcinfo[i].attacking == 0) {
int cframe = (int)(frame);
@@ -3142,8 +3166,8 @@ void GriffonEngine::game_drawplayer() {
SDL_FillRect(videobuffer, &rcDest, 0);
- rcDest.x = npx + 5;
- rcDest.y = npy + 23;
+ rcDest.left = npx + 5;
+ rcDest.top = npy + 23;
int ww = 14 * player.hp / player.maxhp;
@@ -3228,7 +3252,7 @@ void GriffonEngine::game_endofgame() {
float xofs = 0;
int ticks1;
- ticks = SDL_GetTicks();
+ ticks = g_system->getMillis();
float spd = 0.2;
@@ -3271,17 +3295,18 @@ void GriffonEngine::game_endofgame() {
SDL_FillRect(videobuffer, NULL, 0);
- SDL_SetAlpha(videobuffer, SDL_SRCALPHA, ya);
+ SDL_SetAlpha(videobuffer, 0, ya);
SDL_BlitSurface(videobuffer2, NULL, videobuffer3, NULL);
SDL_BlitSurface(videobuffer, NULL, videobuffer3, NULL);
SDL_BlitSurface(videobuffer3, NULL, video, NULL);
- SDL_SetAlpha(videobuffer, SDL_SRCALPHA, 255);
+ SDL_SetAlpha(videobuffer, 0, 255);
SDL_Flip(video);
- SDL_PumpEvents();
+ g_system->getEventManager()->pollEvent(event);
+ g_system->delayMillis(10);
tickspassed = ticks;
- ticks = SDL_GetTicks();
+ ticks = g_system->getMillis();
tickspassed = ticks - tickspassed;
fpsr = (float)tickspassed / 24;
@@ -3332,15 +3357,16 @@ void GriffonEngine::game_endofgame() {
ya = 255;
}
- SDL_SetAlpha(videobuffer, SDL_SRCALPHA, ya);
+ SDL_SetAlpha(videobuffer, 0, ya);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
- SDL_SetAlpha(videobuffer, SDL_SRCALPHA, 255);
+ SDL_SetAlpha(videobuffer, 0, 255);
SDL_Flip(video);
- SDL_PumpEvents();
+ g_system->getEventManager()->pollEvent(event);
+ g_system->delayMillis(10);
tickspassed = ticks;
- ticks = SDL_GetTicks();
+ ticks = g_system->getMillis();
tickspassed = ticks - tickspassed;
fpsr = (float)tickspassed / 24;
@@ -3359,8 +3385,6 @@ void GriffonEngine::game_endofgame() {
if (xofs >= 320)
xofs = xofs - 320;
- g_system->getEventManager()->pollEvent(event);
-
if (event.type == Common::EVENT_KEYDOWN)
spd = 1;
if (event.type == Common::EVENT_KEYUP)
@@ -3389,17 +3413,18 @@ void GriffonEngine::game_endofgame() {
SDL_FillRect(videobuffer, NULL, 0);
- SDL_SetAlpha(videobuffer, SDL_SRCALPHA, y);
+ SDL_SetAlpha(videobuffer, 0, y);
SDL_BlitSurface(videobuffer2, NULL, videobuffer3, NULL);
SDL_BlitSurface(videobuffer, NULL, videobuffer3, NULL);
SDL_BlitSurface(videobuffer3, NULL, video, NULL);
- SDL_SetAlpha(videobuffer, SDL_SRCALPHA, 255);
+ SDL_SetAlpha(videobuffer, 0, 255);
SDL_Flip(video);
- SDL_PumpEvents();
+ g_system->getEventManager()->pollEvent(event);
+ g_system->delayMillis(10);
tickspassed = ticks;
- ticks = SDL_GetTicks();
+ ticks = g_system->getMillis();
tickspassed = ticks - tickspassed;
fpsr = (float)tickspassed / 24;
@@ -3430,15 +3455,16 @@ void GriffonEngine::game_endofgame() {
y = 255;
}
- SDL_SetAlpha(videobuffer, SDL_SRCALPHA, y);
+ SDL_SetAlpha(videobuffer, 0, y);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
- SDL_SetAlpha(videobuffer, SDL_SRCALPHA, 255);
+ SDL_SetAlpha(videobuffer, 0, 255);
SDL_Flip(video);
- SDL_PumpEvents();
+ g_system->getEventManager()->pollEvent(event);
+ g_system->delayMillis(10);
tickspassed = ticks;
- ticks = SDL_GetTicks();
+ ticks = g_system->getMillis();
tickspassed = ticks - tickspassed;
fpsr = (float)tickspassed / 24;
@@ -3472,7 +3498,7 @@ void GriffonEngine::game_eventtext(const char *stri) {
x = 160 - 4 * strlen(stri);
- ticks = SDL_GetTicks();
+ ticks = g_system->getMillis();
pauseticks = ticks + 500;
bticks = ticks;
@@ -3493,20 +3519,21 @@ void GriffonEngine::game_eventtext(const char *stri) {
if (fr > 192)
fr = 192;
- SDL_SetAlpha(windowimg, SDL_SRCALPHA, fr);
+ SDL_SetAlpha(windowimg, 0, fr);
SDL_BlitSurface(windowimg, NULL, videobuffer, NULL);
if (pauseticks < ticks)
sys_print(videobuffer, stri, x, 15, 0);
- SDL_SetAlpha(windowimg, SDL_SRCALPHA, 255);
+ SDL_SetAlpha(windowimg, 0, 255);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
SDL_Flip(video);
- SDL_PumpEvents();
+ g_system->getEventManager()->pollEvent(event);
+ g_system->delayMillis(10);
tickspassed = ticks;
- ticks = SDL_GetTicks();
+ ticks = g_system->getMillis();
tickspassed = ticks - tickspassed;
fpsr = (float)tickspassed / 24.0;
@@ -3518,7 +3545,7 @@ void GriffonEngine::game_eventtext(const char *stri) {
fp = 0;
}
- SDL_Delay(10);
+ g_system->delayMillis(10);
} while (1);
SDL_BlitSurface(videobuffer3, NULL, videobuffer, NULL);
@@ -3573,7 +3600,7 @@ void GriffonEngine::game_handlewalking() {
clipsurround[x + 1][y + 1] = 0;
if (sx > -1 && sx < 320 && sy > -1 && sy < 192) {
- temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ temp = (uint32 *)clipbg->getBasePtr(sx, sy);
clipsurround[x + 1][y + 1] = *temp;
}
}
@@ -3666,7 +3693,7 @@ void GriffonEngine::game_handlewalking() {
int sx = (px / 2 + 6);
int sy = (py / 2 + 10);
- temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ temp = (uint32 *)clipbg->getBasePtr(sx, sy);
bgc = *temp;
if (bgc > 0 && bgc != 1000) {
px = opx;
@@ -3706,7 +3733,7 @@ void GriffonEngine::game_handlewalking() {
sx = (int)(npx / 2 + 6);
sy = (int)(npy / 2 + 10);
- temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ temp = (uint32 *)clipbg->getBasePtr(sx, sy);
bgc = *temp;
if (bgc > 0) {
@@ -3797,7 +3824,6 @@ void GriffonEngine::game_handlewalking() {
void GriffonEngine::game_loadmap(int mapnum) {
unsigned int ccc;
Common::Rect trect(320, 240);
- FILE *fp;
char name[256];
int tempmap[320][200];
@@ -3849,13 +3875,15 @@ void GriffonEngine::game_loadmap(int mapnum) {
// read *.map file
sprintf(name, "mapdb/%04i.map", mapnum);
- printf("Reading %s\n", name);
- fp = fopen(name, "r");
+ debug(1, "Reading %s", name);
+
+ Common::File fp;
+ fp.open(name);
for (int x = 0; x <= 319; x++)
for (int y = 0; y <= 199; y++) {
INPUT("%i", &tempmap[x][y]);
}
- fclose(fp);
+ fp.close();
for (int x = 0; x <= 319; x++)
for (int y = 0; y <= 239; y++) {
@@ -3864,8 +3892,8 @@ void GriffonEngine::game_loadmap(int mapnum) {
// read *.trg file
sprintf(name, "mapdb/%04i.trg", mapnum);
- printf("Reading %s\n", name);
- fp = fopen(name, "r");
+ debug(1, "Reading %s", name);
+ fp.open(name);
INPUT("%i", &ntriggers);
@@ -3878,7 +3906,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
triggerloc[mapx][mapy] = trig;
}
- fclose(fp);
+ fp.close();
for (int y = 0; y <= 23; y++)
@@ -3936,7 +3964,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
ffa = 20 * 5 - 1 + ff * 20;
ffb = 20 * 5 + 4 + ff * 20;
if (curtile > ffa && curtile < ffb) {
- SDL_SetAlpha(tiles[curtilel], SDL_SRCALPHA, 128);
+ SDL_SetAlpha(tiles[curtilel], 0, 128);
}
}
}
@@ -3944,13 +3972,13 @@ void GriffonEngine::game_loadmap(int mapnum) {
for (int ff = 0; ff <= 4; ff++) {
ffa = 20 * (5 + ff) + 3;
if (curtile == ffa) {
- SDL_SetAlpha(tiles[curtilel], SDL_SRCALPHA, 192);
+ SDL_SetAlpha(tiles[curtilel], 0, 192);
}
}
}
SDL_BlitSurface(tiles[curtilel], &rcSrc, mapbg, &rcDest);
- SDL_SetAlpha(tiles[curtilel], SDL_SRCALPHA, 255);
+ SDL_SetAlpha(tiles[curtilel], 0, 255);
rcDest.left = x * 8;
rcDest.top = y * 8;
@@ -4117,8 +4145,8 @@ void GriffonEngine::game_loadmap(int mapnum) {
// read *.npc file
sprintf(name, "mapdb/%04i.npc", mapnum);
- printf("Reading %s\n", name);
- fp = fopen(name, "r");
+ debug(1, "Reading %s", name);
+ fp.open(name);
for (int i = 0; i < kMaxNPC; i++) {
INPUT("%i", &npcinfo[i].spriteset);
@@ -4379,7 +4407,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
npcinfo[i].pause = ticks;
}
- fclose(fp);
+ fp.close();
int cx, cy, npx, npy, lx, ly;
@@ -4615,7 +4643,7 @@ void GriffonEngine::game_newgame() {
SDL_FillRect(videobuffer2, NULL, 0);
SDL_FillRect(videobuffer3, NULL, 0);
- ticks = SDL_GetTicks();
+ ticks = g_system->getMillis();
SDL_BlitSurface(videobuffer, NULL, videobuffer3, NULL);
SDL_BlitSurface(videobuffer, NULL, videobuffer2, NULL);
@@ -4678,7 +4706,7 @@ void GriffonEngine::game_newgame() {
SDL_Flip(video);
tickspassed = ticks;
- ticks = SDL_GetTicks();
+ ticks = g_system->getMillis();
tickspassed = ticks - tickspassed;
fpsr = (float)tickspassed / 24.0;
@@ -4704,7 +4732,7 @@ void GriffonEngine::game_newgame() {
if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
goto __exit_do;
- SDL_Delay(10);
+ g_system->delayMillis(10);
} while (1);
__exit_do:
@@ -4884,15 +4912,15 @@ void GriffonEngine::game_saveloadnew() {
clouddeg = 0;
- SDL_SetAlpha(videobuffer, SDL_SRCALPHA, 255);
- SDL_SetAlpha(saveloadimg, SDL_SRCALPHA, 192);
+ SDL_SetAlpha(videobuffer, 0, 255);
+ SDL_SetAlpha(saveloadimg, 0, 192);
currow = 0;
curcol = 0;
lowerlock = 0;
- ticks = SDL_GetTicks();
+ ticks = g_system->getMillis();
ticks1 = ticks;
tickpause = ticks + 150;
@@ -4906,18 +4934,18 @@ void GriffonEngine::game_saveloadnew() {
rcDest.setWidth(320);
rcDest.setHeight(240);
- SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 128);
+ SDL_SetAlpha(cloudimg, 0, 128);
SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
- SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 64);
+ SDL_SetAlpha(cloudimg, 0, 64);
rcDest.left = 256;
rcDest.top = 192;
rcDest.setWidth(320);
rcDest.setHeight(240);
- SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 128);
+ SDL_SetAlpha(cloudimg, 0, 128);
SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
- SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 64);
+ SDL_SetAlpha(cloudimg, 0, 64);
SDL_BlitSurface(saveloadimg, NULL, videobuffer, NULL);
@@ -4930,7 +4958,7 @@ void GriffonEngine::game_saveloadnew() {
if (event.kbd.keycode == Common::KEYCODE_RETURN) {
// QUIT - non existent :)
if (currow == 0 && curcol == 4) {
- exit(1);
+ //exit(1); // FIXME
}
// RETURN
if (currow == 0 && curcol == 3) {
@@ -5117,7 +5145,7 @@ void GriffonEngine::game_saveloadnew() {
if (currow == 0) {
- rcDest.y = 18;
+ rcDest.top = 18;
if (curcol == 0)
rcDest.left = 10;
if (curcol == 1)
@@ -5126,7 +5154,7 @@ void GriffonEngine::game_saveloadnew() {
rcDest.left = 170;
if (curcol == 3)
rcDest.left = 230;
- rcDest.left = (float)(rcDest.x + 2 + 2 * sin(3.14159 * 2 * itemyloc / 16));
+ rcDest.left = (float)(rcDest.left + 2 + 2 * sin(3.14159 * 2 * itemyloc / 16));
}
if (currow > 0) {
@@ -5157,15 +5185,15 @@ void GriffonEngine::game_saveloadnew() {
yy = 255;
}
- SDL_SetAlpha(videobuffer, SDL_SRCALPHA, (int)yy);
+ SDL_SetAlpha(videobuffer, 0, (int)yy);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
- SDL_SetAlpha(videobuffer, SDL_SRCALPHA, 255);
+ SDL_SetAlpha(videobuffer, 0, 255);
SDL_Flip(video);
- SDL_PumpEvents();
+ g_system->getEventManager()->pollEvent(event);
tickspassed = ticks;
- ticks = SDL_GetTicks();
+ ticks = g_system->getMillis();
tickspassed = ticks - tickspassed;
fpsr = (float)tickspassed / 24;
@@ -5185,17 +5213,17 @@ void GriffonEngine::game_saveloadnew() {
while (itemyloc >= 16)
itemyloc -= 16;
- SDL_Delay(10);
+ g_system->delayMillis(10);
} while (1);
- SDL_SetAlpha(cloudimg, SDL_SRCALPHA, 64);
+ SDL_SetAlpha(cloudimg, 0, 64);
}
void GriffonEngine::game_showlogos() {
float y;
int ticks1;
- ticks = SDL_GetTicks();
+ ticks = g_system->getMillis();
ticks1 = ticks;
y = 0.0;
@@ -5220,17 +5248,17 @@ void GriffonEngine::game_showlogos() {
SDL_FillRect(videobuffer, NULL, 0);
- SDL_SetAlpha(logosimg, SDL_SRCALPHA, (int)y);
+ SDL_SetAlpha(logosimg, 0, (int)y);
SDL_BlitSurface(logosimg, NULL, videobuffer, NULL);
- SDL_SetAlpha(logosimg, SDL_SRCALPHA, 255);
+ SDL_SetAlpha(logosimg, 0, 255);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
SDL_Flip(video);
- SDL_PumpEvents();
+ g_system->getEventManager()->pollEvent(event);
tickspassed = ticks;
- ticks = SDL_GetTicks();
+ ticks = g_system->getMillis();
tickspassed = ticks - tickspassed;
fpsr = (float)tickspassed / 24;
@@ -5242,7 +5270,7 @@ void GriffonEngine::game_showlogos() {
fp = 0;
}
- SDL_Delay(10);
+ g_system->delayMillis(10);
if (ticks > ticks1 + 4000)
break;
} while (1);
@@ -5257,15 +5285,16 @@ void GriffonEngine::game_swash() {
do {
y = y + 1 * fpsr;
- SDL_SetAlpha(videobuffer, SDL_SRCALPHA, (int)y);
+ SDL_SetAlpha(videobuffer, 0, (int)y);
SDL_FillRect(videobuffer, NULL, 0);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
SDL_Flip(video);
- SDL_PumpEvents();
+ g_system->getEventManager()->pollEvent(event);
+ g_system->delayMillis(10);
tickspassed = ticks;
- ticks = SDL_GetTicks();
+ ticks = g_system->getMillis();
tickspassed = ticks - tickspassed;
fpsr = (float)tickspassed / 24.0;
@@ -5289,7 +5318,7 @@ void GriffonEngine::game_swash() {
do {
y = y + 1 * fpsr;
- SDL_SetAlpha(videobuffer, SDL_SRCALPHA, (int)(y * 25));
+ SDL_SetAlpha(videobuffer, 0, (int)(y * 25));
SDL_BlitSurface(mapbg, NULL, videobuffer, NULL);
if (cloudson == 1) {
@@ -5303,10 +5332,11 @@ void GriffonEngine::game_swash() {
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
SDL_Flip(video);
- SDL_PumpEvents();
+ g_system->getEventManager()->pollEvent(event);
+ g_system->delayMillis(10);
tickspassed = ticks;
- ticks = SDL_GetTicks();
+ ticks = g_system->getMillis();
tickspassed = ticks - tickspassed;
fpsr = (float)tickspassed / 24.0;
@@ -5327,7 +5357,7 @@ void GriffonEngine::game_swash() {
} while (1);
- SDL_SetAlpha(videobuffer, SDL_SRCALPHA, 255);
+ SDL_SetAlpha(videobuffer, 0, 255);
}
void GriffonEngine::game_theend() {
@@ -5337,15 +5367,16 @@ void GriffonEngine::game_theend() {
}
for (float y = 0; y < 100; y += fpsr) {
- SDL_SetAlpha(videobuffer, SDL_SRCALPHA, (int)y);
+ SDL_SetAlpha(videobuffer, 0, (int)y);
SDL_FillRect(videobuffer, NULL, 0);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
SDL_Flip(video);
- SDL_PumpEvents();
+ g_system->getEventManager()->pollEvent(event);
+ g_system->delayMillis(10);
tickspassed = ticks;
- ticks = SDL_GetTicks();
+ ticks = g_system->getMillis();
tickspassed = ticks - tickspassed;
fpsr = (float)tickspassed / 24.0;
@@ -5375,7 +5406,7 @@ void GriffonEngine::game_title(int mode) {
SDL_FillRect(videobuffer2, &rcSrc, 0);
SDL_FillRect(videobuffer3, &rcSrc, 0);
- ticks = SDL_GetTicks();
+ ticks = g_system->getMillis();
SDL_BlitSurface(videobuffer, NULL, videobuffer3, NULL);
SDL_BlitSurface(videobuffer, NULL, videobuffer2, NULL);
@@ -5451,12 +5482,12 @@ void GriffonEngine::game_title(int mode) {
yf = 255.0;
}
- SDL_SetAlpha(videobuffer, SDL_SRCALPHA, (int)yf);
+ SDL_SetAlpha(videobuffer, 0, (int)yf);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
- SDL_SetAlpha(videobuffer, SDL_SRCALPHA, 255);
+ SDL_SetAlpha(videobuffer, 0, 255);
tickspassed = ticks;
- ticks = SDL_GetTicks();
+ ticks = g_system->getMillis();
tickspassed = ticks - tickspassed;
fpsr = (float)tickspassed / 24.0;
@@ -5489,27 +5520,27 @@ void GriffonEngine::game_title(int mode) {
if (event.kbd.keycode == Common::KEYCODE_ESCAPE && mode == 1)
break;
- else if (event.kbd.keycode == Common::KEYCODE_UP]) {
+ else if (event.kbd.keycode == Common::KEYCODE_UP) {
cursel--;
if (cursel < 0)
cursel = (mode == 1 ? 3 : 2);
- } else if (event.kbd.keycode == Common::KEYCODE_DOWN]) {
+ } else if (event.kbd.keycode == Common::KEYCODE_DOWN) {
cursel++;
if (cursel >= (mode == 1 ? 4 : 3))
cursel = 0;
- } else if (event.kbd.keycode == Common::KEYCODE_RETURN]) {
+ } else if (event.kbd.keycode == Common::KEYCODE_RETURN) {
if (cursel == 0) {
game_saveloadnew();
- ticks = SDL_GetTicks();
+ ticks = g_system->getMillis();
keypause = ticks + 150;
ticks1 = ticks;
} else if (cursel == 1) {
game_configmenu();
- ticks = SDL_GetTicks();
+ ticks = g_system->getMillis();
keypause = ticks + 150;
ticks1 = ticks;
} else if (cursel == 2) {
- exit(1);
+ //exit(1); // FIXME
} else if (cursel == 3) {
break;
}
@@ -5518,7 +5549,7 @@ void GriffonEngine::game_title(int mode) {
}
SDL_Flip(video);
- SDL_Delay(10);
+ g_system->delayMillis(10);
} while (1);
itemticks = ticks + 210;
@@ -5646,7 +5677,7 @@ void GriffonEngine::game_updmusic() {
void GriffonEngine::game_updnpcs() {
float npx, npy, onpx, onpy;
- unsigned int *temp, dq, bgc;
+ uint32 *temp, dq, bgc;
float nnxa = 0, nnya = 0, nnxb = 0, nnyb = 0;
int pass = 0, checkpass;
float wspd, xdif, ydif;
@@ -5829,12 +5860,10 @@ void GriffonEngine::game_updnpcs() {
if (ii < 1)
ii = 1;
- SDL_LockSurface(clipbg);
-
if (moveup) {
sx = xp;
sy = yp - ii;
- temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ temp = (uint32 *)clipbg->getBasePtr(sx, sy);
dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
@@ -5844,7 +5873,7 @@ void GriffonEngine::game_updnpcs() {
if (dq > 0) {
sx = xp - ii;
sy = yp - ii;
- temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ temp = (uint32 *)clipbg->getBasePtr(sx, sy);
dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
@@ -5856,7 +5885,7 @@ void GriffonEngine::game_updnpcs() {
if (dq > 0) {
sx = xp + ii;
sy = yp - ii;
- temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ temp = (uint32 *)clipbg->getBasePtr(sx, sy);
dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
@@ -5870,7 +5899,7 @@ void GriffonEngine::game_updnpcs() {
if (movedown) {
sx = xp;
sy = yp + ii;
- temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ temp = (uint32 *)clipbg->getBasePtr(sx, sy);
dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
@@ -5879,7 +5908,7 @@ void GriffonEngine::game_updnpcs() {
if (dq > 0) {
sx = xp - ii;
sy = yp + ii;
- temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ temp = (uint32 *)clipbg->getBasePtr(sx, sy);
dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
@@ -5891,7 +5920,7 @@ void GriffonEngine::game_updnpcs() {
if (dq > 0) {
sx = xp + ii;
sy = yp + ii;
- temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ temp = (uint32 *)clipbg->getBasePtr(sx, sy);
dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
@@ -5905,7 +5934,7 @@ void GriffonEngine::game_updnpcs() {
if (moveleft) {
sx = xp - ii;
sy = yp;
- temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ temp = (uint32 *)clipbg->getBasePtr(sx, sy);
dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
@@ -5914,7 +5943,7 @@ void GriffonEngine::game_updnpcs() {
if (dq > 0) {
sx = xp - ii;
sy = yp - ii;
- temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ temp = (uint32 *)clipbg->getBasePtr(sx, sy);
dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
@@ -5926,7 +5955,7 @@ void GriffonEngine::game_updnpcs() {
if (dq > 0) {
sx = xp - ii;
sy = yp + ii;
- temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ temp = (uint32 *)clipbg->getBasePtr(sx, sy);
dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
@@ -5940,7 +5969,7 @@ void GriffonEngine::game_updnpcs() {
if (moveright) {
sx = xp + ii;
sy = yp;
- temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ temp = (uint32 *)clipbg->getBasePtr(sx, sy);
dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
@@ -5949,7 +5978,7 @@ void GriffonEngine::game_updnpcs() {
if (dq > 0) {
sx = xp + ii;
sy = yp - ii;
- temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ temp = (uint32 *)clipbg->getBasePtr(sx, sy);
dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
@@ -5961,7 +5990,7 @@ void GriffonEngine::game_updnpcs() {
if (dq > 0) {
sx = xp + ii;
sy = yp + ii;
- temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ temp = (uint32 *)clipbg->getBasePtr(sx, sy);
dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
@@ -6002,11 +6031,9 @@ void GriffonEngine::game_updnpcs() {
sx = xp;
sy = yp;
- temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ temp = (uint32 *)clipbg->getBasePtr(sx, sy);
bgc = *temp;
- SDL_UnlockSurface(clipbg);
-
float anpx = npx + 12;
float anpy = npy + 20;
@@ -6844,9 +6871,9 @@ void GriffonEngine::game_updspells() {
}
if (xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, alf);
+ SDL_SetAlpha(spellimg, 0, alf);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
+ SDL_SetAlpha(spellimg, 0, 255);
if (spellinfo[i].damagewho == 0) {
for (int e = 1; e <= lastnpc; e++) {
@@ -7129,9 +7156,9 @@ void GriffonEngine::game_updspells() {
if (fra > 24)
f = 192 * (1 - (fra - 24) / 8);
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, f);
+ SDL_SetAlpha(spellimg, 0, f);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
+ SDL_SetAlpha(spellimg, 0, 255);
spellinfo[i].frame = spellinfo[i].frame - 0.3 * fpsr;
if (spellinfo[i].frame < 0) {
@@ -7212,7 +7239,7 @@ void GriffonEngine::game_updspells() {
if (spellinfo[i].frame > 16) {
float fr = (32 - spellinfo[i].frame);
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, 192 * sin(3.14159 * fr / 4));
+ SDL_SetAlpha(spellimg, 0, 192 * sin(3.14159 * fr / 4));
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -7224,15 +7251,15 @@ void GriffonEngine::game_updspells() {
xloc = spellinfo[i].fireballs[ff][0] + (int)(RND() * 3) - 1;
yloc = spellinfo[i].fireballs[ff][1] + (int)(RND() * 3) - 1;
- rcDest.x = xloc;
- rcDest.y = yloc;
+ rcDest.left = xloc;
+ rcDest.top = yloc;
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
}
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
+ SDL_SetAlpha(spellimg, 0, 255);
} else {
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, 192);
+ SDL_SetAlpha(spellimg, 0, 192);
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -7259,8 +7286,8 @@ void GriffonEngine::game_updspells() {
xloc = spellinfo[i].fireballs[ff][0] + (int)(RND() * 3) - 1;
yloc = spellinfo[i].fireballs[ff][1] + (int)(RND() * 3) - 1;
- rcDest.x = xloc;
- rcDest.y = yloc;
+ rcDest.left = xloc;
+ rcDest.top = yloc;
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
}
@@ -7269,7 +7296,7 @@ void GriffonEngine::game_updspells() {
spellinfo[i].ballon[ff] = 0;
}
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
+ SDL_SetAlpha(spellimg, 0, 255);
}
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
@@ -7645,8 +7672,8 @@ void GriffonEngine::game_updspellsunder() {
rcSrc.setWidth(48);
rcSrc.setHeight(48);
- rcDest.x = spellinfo[i].enemyx - 12;
- rcDest.y = spellinfo[i].enemyy - 8;
+ rcDest.left = spellinfo[i].enemyx - 12;
+ rcDest.top = spellinfo[i].enemyy - 8;
int f = 160;
if (fra < 8)
@@ -7654,9 +7681,9 @@ void GriffonEngine::game_updspellsunder() {
if (fra > 24)
f = 160 * (1 - (fra - 24) / 8);
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, f);
+ SDL_SetAlpha(spellimg, 0, f);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
+ SDL_SetAlpha(spellimg, 0, 255);
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
if (spellinfo[i].frame < 0)
@@ -7680,11 +7707,9 @@ void GriffonEngine::game_updspellsunder() {
int sx = (newx / 2 + 6);
int sy = (newy / 2 + 10);
- temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ temp = (uint32 *)clipbg->getBasePtr(sx, sy);
dq = *temp;
- // SDL_UnLockSurface clipbg
-
if (dq == 0) {
npcinfo[f].x = newx;
npcinfo[f].y = newy;
@@ -7695,7 +7720,7 @@ void GriffonEngine::game_updspellsunder() {
sx = (newx / 2 + 6);
sy = (npcinfo[f].y / 2 + 10);
- temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ temp = (uint32 *)clipbg->getBasePtr(sx, sy);
dq = *temp;
if (dq == 0)
@@ -7704,7 +7729,7 @@ void GriffonEngine::game_updspellsunder() {
sx = (npcinfo[f].x / 2 + 6);
sy = (newy / 2 + 10);
- temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ temp = (uint32 *)clipbg->getBasePtr(sx, sy);
dq = *temp;
if (dq == 0)
@@ -7744,7 +7769,7 @@ void GriffonEngine::game_updspellsunder() {
for (int f = 0; f <= 4; f++) {
for (int x = 0; x <= fra; x += 2) {
if (spellinfo[i].legalive[f] >= x) {
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, 192 * sin(3.14159 * x / 32) * s / 8);
+ SDL_SetAlpha(spellimg, 0, 192 * sin(3.14159 * x / 32) * s / 8);
float an = 360 / 5 * f + x / 32 * 180;
@@ -7763,7 +7788,7 @@ void GriffonEngine::game_updspellsunder() {
int sx = (xloc / 2 + 4);
int sy = (yloc / 2 + 8);
- temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ temp = (uint32 *)clipbg->getBasePtr(sx, sy);
dq = *temp;
if (dq > 1000 && x > 4)
@@ -7841,7 +7866,7 @@ void GriffonEngine::game_updspellsunder() {
}
}
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
+ SDL_SetAlpha(spellimg, 0, 255);
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
if (spellinfo[i].frame < 0)
@@ -7873,7 +7898,7 @@ void GriffonEngine::game_updspellsunder() {
if (alpha > 255)
alpha = 255;
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, alpha);
+ SDL_SetAlpha(spellimg, 0, alpha);
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -7911,7 +7936,7 @@ void GriffonEngine::game_updspellsunder() {
}
- SDL_SetAlpha(spellimg, SDL_SRCALPHA, 255);
+ SDL_SetAlpha(spellimg, 0, 255);
spellinfo[i].frame = spellinfo[i].frame - 0.5 * fpsr;
if (spellinfo[i].frame < 0)
spellinfo[i].frame = 0;
@@ -7930,45 +7955,46 @@ void GriffonEngine::sys_initialize() {
// init char *floatstri[kMaxFloat]
for (int i = 0; i < kMaxFloat; i++)
- floatstri[i] = malloc(64); // 64 bytes each string (should be enough)
-
- SDL_ShowCursor(SDL_DISABLE);
-
- videobuffer = SDL_CreateRGBSurface(config.hwsurface, 320, 240, config.scr_bpp, video->format->Rmask, video->format->Gmask, video->format->Bmask, video->format->Amask);
- videobuffer2 = SDL_CreateRGBSurface(config.hwsurface, 320, 240, config.scr_bpp, video->format->Rmask, video->format->Gmask, video->format->Bmask, video->format->Amask);
- videobuffer3 = SDL_CreateRGBSurface(config.hwsurface, 320, 240, config.scr_bpp, video->format->Rmask, video->format->Gmask, video->format->Bmask, video->format->Amask);
- mapbg = SDL_CreateRGBSurface(config.hwsurface, 320, 240, config.scr_bpp, video->format->Rmask, video->format->Gmask, video->format->Bmask, video->format->Amask);
- clipbg = SDL_CreateRGBSurface(SDL_SWSURFACE, 320, 240, config.scr_bpp, video->format->Rmask, video->format->Gmask, video->format->Bmask, video->format->Amask);
- clipbg2 = SDL_DisplayFormat(video);
+ floatstri[i] = (char *)malloc(64); // 64 bytes each string (should be enough)
+
+ videobuffer = new Graphics::TransparentSurface;
+ videobuffer->create(320, 240, g_system->getScreenFormat());
+ videobuffer2 = new Graphics::TransparentSurface;
+ videobuffer2->create(320, 240, g_system->getScreenFormat());
+ videobuffer3 = new Graphics::TransparentSurface;
+ videobuffer3->create(320, 240, g_system->getScreenFormat());
+ mapbg = new Graphics::TransparentSurface;
+ mapbg->create(320, 240, g_system->getScreenFormat());
+ clipbg = new Graphics::TransparentSurface;
+ clipbg->create(320, 240, g_system->getScreenFormat());
+ clipbg2 = new Graphics::TransparentSurface;
+ clipbg2->create(320, 240, g_system->getScreenFormat());
for (int i = 0; i <= 3; i++) {
char name[128];
sprintf(name, "art/map%i.bmp", i + 1);
- mapimg[i] = SDL_DisplayFormat(video);
mapimg[i] = IMG_Load(name);
- SDL_SetColorKey(mapimg[i], SDL_SRCCOLORKEY, SDL_MapRGB(mapimg[i]->format, 255, 0, 255));
+ SDL_SetColorKey(mapimg[i], 0, SDL_MapRGB(mapimg[i]->format, 255, 0, 255));
}
cloudimg = IMG_Load("art/clouds.bmp");
- SDL_SetColorKey(cloudimg, SDL_SRCCOLORKEY, SDL_MapRGB(cloudimg->format, 255, 0, 255));
- SDL_SetAlpha(cloudimg, 0 | SDL_SRCALPHA, 96);
+ SDL_SetColorKey(cloudimg, 0, SDL_MapRGB(cloudimg->format, 255, 0, 255));
+ SDL_SetAlpha(cloudimg, 0 | 0, 96);
saveloadimg = IMG_Load("art/saveloadnew.bmp");
- SDL_SetColorKey(saveloadimg, SDL_SRCCOLORKEY, SDL_MapRGB(saveloadimg->format, 255, 0, 255));
- SDL_SetAlpha(saveloadimg, 0 | SDL_SRCALPHA, 160);
+ SDL_SetColorKey(saveloadimg, 0, SDL_MapRGB(saveloadimg->format, 255, 0, 255));
+ SDL_SetAlpha(saveloadimg, 0 | 0, 160);
titleimg = IMG_Load("art/titleb.bmp");
titleimg2 = IMG_Load("art/titlea.bmp");
- SDL_SetColorKey(titleimg2, SDL_SRCCOLORKEY, SDL_MapRGB(titleimg2->format, 255, 0, 255));
- //SDL_SetAlpha(titleimg2, 0 | SDL_SRCALPHA, 204);
+ SDL_SetColorKey(titleimg2, 0, SDL_MapRGB(titleimg2->format, 255, 0, 255));
+ //SDL_SetAlpha(titleimg2, 0 | 0, 204);
inventoryimg = IMG_Load("art/inventory.bmp");
- SDL_SetColorKey(inventoryimg, SDL_SRCCOLORKEY, SDL_MapRGB(inventoryimg->format, 255, 0, 255));
+ SDL_SetColorKey(inventoryimg, 0, SDL_MapRGB(inventoryimg->format, 255, 0, 255));
- logosimg = SDL_DisplayFormat(video);
- theendimg = SDL_DisplayFormat(video);
logosimg = IMG_Load("art/logos.bmp");
theendimg = IMG_Load("art/theend.bmp");
@@ -8001,54 +8027,50 @@ void GriffonEngine::sys_initialize() {
}
void GriffonEngine::sys_line(Graphics::TransparentSurface *buffer, int x1, int y1, int x2, int y2, int col) {
- unsigned int *temp;
-
- SDL_LockSurface(buffer);
+ uint32 *temp;
int xdif = x2 - x1;
int ydif = y2 - y1;
if (xdif == 0) {
for (int y = y1; y <= y2; y++) {
- temp = buffer->pixels + y * buffer->pitch + x1 * buffer->format->BytesPerPixel;
+ temp = (uint32 *)buffer->getBasePtr(x1, y);
*temp = col;
}
}
if (ydif == 0) {
for (int x = x1; x <= x2; x++) {
- temp = buffer->pixels + y1 * buffer->pitch + x * buffer->format->BytesPerPixel;
+ temp = (uint32 *)buffer->getBasePtr(x, y1);
*temp = col;
}
}
-
- SDL_UnlockSurface(buffer);
}
void GriffonEngine::sys_LoadAnims() {
spellimg = IMG_Load("art/spells.bmp");
- SDL_SetColorKey(spellimg, SDL_SRCCOLORKEY, SDL_MapRGB(spellimg->format, 255, 0, 255));
+ SDL_SetColorKey(spellimg, 0, SDL_MapRGB(spellimg->format, 255, 0, 255));
anims[0] = IMG_Load("art/anims0.bmp");
- SDL_SetColorKey(anims[0], SDL_SRCCOLORKEY, SDL_MapRGB(anims[0]->format, 255, 0, 255));
+ SDL_SetColorKey(anims[0], 0, SDL_MapRGB(anims[0]->format, 255, 0, 255));
animsa[0] = IMG_Load("art/anims0a.bmp");
- SDL_SetColorKey(animsa[0], SDL_SRCCOLORKEY, SDL_MapRGB(animsa[0]->format, 255, 0, 255));
+ SDL_SetColorKey(animsa[0], 0, SDL_MapRGB(animsa[0]->format, 255, 0, 255));
anims[13] = IMG_Load("art/anims0x.bmp");
- SDL_SetColorKey(anims[13], SDL_SRCCOLORKEY, SDL_MapRGB(anims[13]->format, 255, 0, 255));
+ SDL_SetColorKey(anims[13], 0, SDL_MapRGB(anims[13]->format, 255, 0, 255));
animsa[13] = IMG_Load("art/anims0xa.bmp");
- SDL_SetColorKey(animsa[13], SDL_SRCCOLORKEY, SDL_MapRGB(animsa[13]->format, 255, 0, 255));
+ SDL_SetColorKey(animsa[13], 0, SDL_MapRGB(animsa[13]->format, 255, 0, 255));
anims[1] = IMG_Load("art/anims1.bmp");
- SDL_SetColorKey(anims[1], SDL_SRCCOLORKEY, SDL_MapRGB(anims[1]->format, 255, 0, 255));
+ SDL_SetColorKey(anims[1], 0, SDL_MapRGB(anims[1]->format, 255, 0, 255));
animsa[1] = IMG_Load("art/anims1a.bmp");
- SDL_SetColorKey(animsa[1], SDL_SRCCOLORKEY, SDL_MapRGB(animsa[1]->format, 255, 0, 255));
+ SDL_SetColorKey(animsa[1], 0, SDL_MapRGB(animsa[1]->format, 255, 0, 255));
anims[2] = IMG_Load("art/anims2.bmp");
- SDL_SetColorKey(anims[2], SDL_SRCCOLORKEY, SDL_MapRGB(anims[2]->format, 255, 0, 255));
+ SDL_SetColorKey(anims[2], 0, SDL_MapRGB(anims[2]->format, 255, 0, 255));
// huge
animset2[0].xofs = 8;
@@ -8094,7 +8116,7 @@ void GriffonEngine::sys_LoadAnims() {
animset2[5].h = 36;
anims[9] = IMG_Load("art/anims9.bmp");
- SDL_SetColorKey(anims[9], SDL_SRCCOLORKEY, SDL_MapRGB(anims[9]->format, 255, 0, 255));
+ SDL_SetColorKey(anims[9], 0, SDL_MapRGB(anims[9]->format, 255, 0, 255));
// huge
animset9[0].xofs = 8;
@@ -8140,47 +8162,48 @@ void GriffonEngine::sys_LoadAnims() {
animset9[5].h = 36;
anims[3] = IMG_Load("art/anims3.bmp");
- SDL_SetColorKey(anims[3], SDL_SRCCOLORKEY, SDL_MapRGB(anims[3]->format, 255, 0, 255));
+ SDL_SetColorKey(anims[3], 0, SDL_MapRGB(anims[3]->format, 255, 0, 255));
anims[4] = IMG_Load("art/anims4.bmp");
- SDL_SetColorKey(anims[4], SDL_SRCCOLORKEY, SDL_MapRGB(anims[4]->format, 255, 0, 255));
+ SDL_SetColorKey(anims[4], 0, SDL_MapRGB(anims[4]->format, 255, 0, 255));
anims[5] = IMG_Load("art/anims5.bmp");
- SDL_SetColorKey(anims[5], SDL_SRCCOLORKEY, SDL_MapRGB(anims[5]->format, 255, 0, 255));
+ SDL_SetColorKey(anims[5], 0, SDL_MapRGB(anims[5]->format, 255, 0, 255));
anims[6] = IMG_Load("art/anims6.bmp");
- SDL_SetColorKey(anims[6], SDL_SRCCOLORKEY, SDL_MapRGB(anims[6]->format, 255, 0, 255));
+ SDL_SetColorKey(anims[6], 0, SDL_MapRGB(anims[6]->format, 255, 0, 255));
anims[7] = IMG_Load("art/anims7.bmp");
- SDL_SetColorKey(anims[7], SDL_SRCCOLORKEY, SDL_MapRGB(anims[7]->format, 255, 0, 255));
+ SDL_SetColorKey(anims[7], 0, SDL_MapRGB(anims[7]->format, 255, 0, 255));
anims[8] = IMG_Load("art/anims8.bmp");
- SDL_SetColorKey(anims[8], SDL_SRCCOLORKEY, SDL_MapRGB(anims[8]->format, 255, 0, 255));
+ SDL_SetColorKey(anims[8], 0, SDL_MapRGB(anims[8]->format, 255, 0, 255));
anims[10] = IMG_Load("art/anims10.bmp");
- SDL_SetColorKey(anims[10], SDL_SRCCOLORKEY, SDL_MapRGB(anims[10]->format, 255, 0, 255));
+ SDL_SetColorKey(anims[10], 0, SDL_MapRGB(anims[10]->format, 255, 0, 255));
animsa[10] = IMG_Load("art/anims10a.bmp");
- SDL_SetColorKey(animsa[10], SDL_SRCCOLORKEY, SDL_MapRGB(animsa[10]->format, 255, 0, 255));
+ SDL_SetColorKey(animsa[10], 0, SDL_MapRGB(animsa[10]->format, 255, 0, 255));
anims[11] = IMG_Load("art/anims11.bmp");
- SDL_SetColorKey(anims[11], SDL_SRCCOLORKEY, SDL_MapRGB(anims[11]->format, 255, 0, 255));
+ SDL_SetColorKey(anims[11], 0, SDL_MapRGB(anims[11]->format, 255, 0, 255));
animsa[11] = IMG_Load("art/anims11a.bmp");
- SDL_SetColorKey(animsa[11], SDL_SRCCOLORKEY, SDL_MapRGB(animsa[11]->format, 255, 0, 255));
+ SDL_SetColorKey(animsa[11], 0, SDL_MapRGB(animsa[11]->format, 255, 0, 255));
anims[12] = IMG_Load("art/anims12.bmp");
- SDL_SetColorKey(anims[12], SDL_SRCCOLORKEY, SDL_MapRGB(anims[12]->format, 255, 0, 255));
+ SDL_SetColorKey(anims[12], 0, SDL_MapRGB(anims[12]->format, 255, 0, 255));
}
void GriffonEngine::sys_LoadItemImgs() {
- Graphics::TransparentSurface *temp;
+ Graphics::Surface *temp;
temp = IMG_Load("art/icons.bmp");
for (int i = 0; i <= 20; i++) {
- itemimg[i] = SDL_CreateRGBSurface(SDL_SWSURFACE, 16, 16, config.scr_bpp, video->format->Rmask, video->format->Gmask, video->format->Bmask, video->format->Amask);
- SDL_SetColorKey(itemimg[i], SDL_SRCCOLORKEY, SDL_MapRGB(itemimg[i]->format, 255, 0, 255));
+ itemimg[i] = new Graphics::Surface;
+ itemimg[i]->create(16, 16, g_system->getScreenFormat());
+ SDL_SetColorKey(itemimg[i], 0, SDL_MapRGB(itemimg[i]->format, 255, 0, 255));
rcSrc.left = i * 16;
rcSrc.top = 0;
@@ -8190,11 +8213,11 @@ void GriffonEngine::sys_LoadItemImgs() {
SDL_BlitSurface(temp, &rcSrc, itemimg[i], NULL);
}
- SDL_FreeSurface(temp);
+ temp->free();
}
void GriffonEngine::sys_LoadFont() {
- Graphics::TransparentSurface *font;
+ Graphics::Surface *font;
font = IMG_Load("art/font.bmp");
@@ -8202,8 +8225,9 @@ void GriffonEngine::sys_LoadFont() {
for (int f = 0; f <= 4; f++) {
int i2 = i - 32;
- fontchr[i2][f] = SDL_CreateRGBSurface(SDL_SWSURFACE, 8, 8, config.scr_bpp, video->format->Rmask, video->format->Gmask, video->format->Bmask, video->format->Amask);
- SDL_SetColorKey(fontchr[i2][f], SDL_SRCCOLORKEY, SDL_MapRGB(fontchr[i2][f]->format, 255, 0, 255));
+ fontchr[i2][f] = new Graphics::Surface;
+ fontchr[i2][f]->create(8, 8, g_system->getScreenFormat());
+ SDL_SetColorKey(fontchr[i2][f], 0, SDL_MapRGB(fontchr[i2][f]->format, 255, 0, 255));
int col = i2 % 40;
@@ -8214,12 +8238,12 @@ void GriffonEngine::sys_LoadFont() {
rcSrc.setWidth(8);
rcSrc.setHeight(8);
- rcDest.x = 0;
- rcDest.y = 0;
+ rcDest.left = 0;
+ rcDest.top = 0;
SDL_BlitSurface(font, &rcSrc, fontchr[i2][f], &rcDest);
}
- SDL_FreeSurface(font);
+ font->free();
}
void GriffonEngine::sys_LoadTiles() {
@@ -8229,52 +8253,47 @@ void GriffonEngine::sys_LoadTiles() {
tiles[3] = IMG_Load("art/tx3.bmp");
for (int i = 0; i <= 3; i++)
- SDL_SetColorKey(tiles[i], SDL_SRCCOLORKEY, SDL_MapRGB(tiles[i]->format, 255, 0, 255));
+ SDL_SetColorKey(tiles[i], 0, SDL_MapRGB(tiles[i]->format, 255, 0, 255));
windowimg = IMG_Load("art/window.bmp");
- SDL_SetColorKey(windowimg, SDL_SRCCOLORKEY, SDL_MapRGB(windowimg->format, 255, 0, 255));
+ SDL_SetColorKey(windowimg, 0, SDL_MapRGB(windowimg->format, 255, 0, 255));
}
void GriffonEngine::sys_LoadTriggers() {
- FILE *fp;
- char line[512];
+ Common::File fp;
- fp = fopen("data/triggers.dat", "r");
+ fp.open("data/triggers.dat");
for (int i = 0; i <= 9999; i++)
for (int a = 0; a <= 8; a++) {
- fgets(line, sizeof(line), fp);
- sscanf(line, "%i", &triggers[i][a]);
+ INPUT("%i", &triggers[i][a]);
}
- fclose(fp);
+ fp.close();
}
void GriffonEngine::sys_LoadObjectDB() {
- FILE *fp;
- char line[512];
+ Common::File fp;
- fp = fopen("objectdb.dat", "r");
+ fp.open("objectdb.dat");
for (int a = 0; a <= 32; a++) {
for (int b = 0; b <= 5; b++) {
- fgets(line, sizeof(line), fp);
- sscanf(line, "%i", &objectinfo[a][b]);
+ INPUT("%i", &objectinfo[a][b]);
}
for (int b = 0; b <= 8; b++) {
for (int c = 0; c <= 2; c++) {
for (int d = 0; d <= 2; d++) {
for (int e = 0; e <= 1; e++) {
- fgets(line, sizeof(line), fp);
- sscanf(line, "%i", &objecttile[a][b][c][d][e]);
+ INPUT("%i", &objecttile[a][b][c][d][e]);
}
}
}
}
}
- fclose(fp);
+ fp.close();
}
void GriffonEngine::sys_print(Graphics::TransparentSurface *buffer, const char *stri, int xloc, int yloc, int col) {
@@ -8297,29 +8316,25 @@ void GriffonEngine::sys_progress(int w, int wm) {
SDL_FillRect(videobuffer, &rcDest, ccc);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
SDL_Flip(video);
- SDL_PumpEvents();
+ g_system->getEventManager()->pollEvent(event);
}
void GriffonEngine::sys_setupAudio() {
- Graphics::TransparentSurface *loadimg;
+ Graphics::Surface *loadimg;
menabled = 1;
- if ((Mix_Init(MIX_INIT_OGG) & MIX_INIT_OGG) != MIX_INIT_OGG) {
- printf("Failed to init OGG support\n");
- exit(1);
- }
-
- Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 1024);
+ // FIXME
+ //Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 1024);
- atexit(Mix_Quit);
- atexit(Mix_CloseAudio);
+ //atexit(Mix_Quit);
+ //atexit(Mix_CloseAudio);
- char *stri = "Loading...";
+ const char *stri = "Loading...";
sys_print(videobuffer, stri, 160 - 4 * strlen(stri), 116, 0);
loadimg = IMG_Load("art/load.bmp");
- SDL_SetColorKey(loadimg, SDL_SRCCOLORKEY, SDL_MapRGB(loadimg->format, 255, 0, 255));
+ SDL_SetColorKey(loadimg, 0, SDL_MapRGB(loadimg->format, 255, 0, 255));
rcSrc.left = 0;
rcSrc.top = 0;
@@ -8329,9 +8344,9 @@ void GriffonEngine::sys_setupAudio() {
rcDest.left = 160 - 44;
rcDest.top = 116 + 12;
- SDL_SetAlpha(loadimg, 0 | SDL_SRCALPHA, 160); // 128
+ SDL_SetAlpha(loadimg, 0 | 0, 160); // 128
SDL_BlitSurface(loadimg, &rcSrc, videobuffer, &rcDest);
- SDL_SetAlpha(loadimg, 0 | SDL_SRCALPHA, 255);
+ SDL_SetAlpha(loadimg, 0 | 0, 255);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
SDL_Flip(video);
@@ -8388,16 +8403,16 @@ void GriffonEngine::sys_setupAudio() {
}
}
-void sys_update() {
- unsigned int *temp, bgc;
+void GriffonEngine::sys_update() {
+ uint32 *temp, bgc;
int pa, sx, sy;
float opx, opy, spd;
SDL_Flip(video);
- SDL_PumpEvents();
+ g_system->getEventManager()->pollEvent(event);
tickspassed = ticks;
- ticks = SDL_GetTicks();
+ ticks = g_system->getMillis();
tickspassed = ticks - tickspassed;
fpsr = (float)tickspassed / 24.0;
@@ -8410,8 +8425,6 @@ void sys_update() {
secsingame = secsingame + 1;
}
- SDL_LockSurface(clipbg);
-
if (attacking == 1) {
player.attackframe += player.attackspd * fpsr;
if (player.attackframe >= 16) {
@@ -8434,7 +8447,7 @@ void sys_update() {
sx = (int)(player.px / 2 + 6);
sy = (int)(player.py / 2 + 10);
- temp = clipbg->pixels + sy * clipbg->pitch + sx * clipbg->format->BytesPerPixel;
+ temp = (uint32 *)clipbg->getBasePtr(sx, sy);
bgc = *temp;
if (bgc > 0) {
player.px = opx;
@@ -8489,7 +8502,6 @@ void sys_update() {
}
}
- SDL_UnlockSurface(clipbg);
SDL_BlitSurface(clipbg2, NULL, clipbg, NULL);
Common::Rect rc;
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 1a18d7d..a81951e 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -246,11 +246,12 @@ private:
float RND();
void game_addFloatIcon(int ico, float xloc, float yloc);
- void game_addFloatText(char *stri, float xloc, float yloc, int col);
+ void game_addFloatText(const char *stri, float xloc, float yloc, int col);
void game_attack();
void game_castspell(int spellnum, float homex, float homey, float enemyx, float enemyy, int damagewho);
void game_checkhit();
void game_checkinputs();
+ void game_checktrigger();
void game_configmenu();
void game_damagenpc(int npcnum, int damage, int spell);
void game_damageplayer(int damage);
Commit: d3de41aa5dc10f5e88a1827c080fe0c4ae7d77c9
https://github.com/scummvm/scummvm/commit/d3de41aa5dc10f5e88a1827c080fe0c4ae7d77c9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix some warnings
Changed paths:
engines/griffon/engine.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 0c7ea9e..0b35809 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -394,7 +394,7 @@ int invmap[4][7][13] = {
#define INPUT(A, B) \
do { \
Common::String line; \
- fp.readLine(); \
+ file.readLine(); \
sscanf(line.c_str(), A, B); \
} while(0)
@@ -411,16 +411,16 @@ void game_fillrect(Graphics::TransparentSurface *surface, int x, int y, int w, i
}
Graphics::Surface *IMG_Load(const char *name) {
- Common::File fp;
+ Common::File file;
- fp.open(name);
- if (!fp.isOpen()) {
+ file.open(name);
+ if (!file.isOpen()) {
error("Cannot open file %s", name);
}
Image::BitmapDecoder bitmapDecoder;
- bitmapDecoder.loadStream(fp);
- fp.close();
+ bitmapDecoder.loadStream(file);
+ file.close();
Graphics::Surface *res = bitmapDecoder.getSurface()->convertTo(g_system->getScreenFormat());
@@ -1298,7 +1298,7 @@ void GriffonEngine::game_checktrigger() {
void GriffonEngine::game_configmenu() {
Graphics::Surface *configwindow;
Common::Rect rc;
- int cursel, curselt, ofullscreen;
+ int cursel, curselt;
int tickwait, keypause, ticks1;
cursel = MINCURSEL;
@@ -3348,7 +3348,7 @@ void GriffonEngine::game_endofgame() {
break;
}
- int ya = 255;
+ ya = 255;
if (ticks < ticks1 + 1000) {
ya = 255 * (ticks - ticks1) / 1000;
if (ya < 0)
@@ -3396,24 +3396,24 @@ void GriffonEngine::game_endofgame() {
ticks1 = ticks;
- y = 0;
+ int y1 = 0;
SDL_BlitSurface(videobuffer, NULL, videobuffer2, NULL);
do {
if (ticks < ticks1 + 1500) {
- int y = 255 * (ticks - ticks1) / 1500;
- if (y < 0)
- y = 0;
- if (y > 255)
- y = 255;
+ y1 = 255 * (ticks - ticks1) / 1500;
+ if (y1 < 0)
+ y1 = 0;
+ if (y1 > 255)
+ y1 = 255;
else
break;
}
SDL_FillRect(videobuffer, NULL, 0);
- SDL_SetAlpha(videobuffer, 0, y);
+ SDL_SetAlpha(videobuffer, 0, y1);
SDL_BlitSurface(videobuffer2, NULL, videobuffer3, NULL);
SDL_BlitSurface(videobuffer, NULL, videobuffer3, NULL);
SDL_BlitSurface(videobuffer3, NULL, video, NULL);
@@ -3441,21 +3441,21 @@ void GriffonEngine::game_endofgame() {
int keywait = 2000 + ticks;
ticks1 = ticks;
- y = 0;
+ y1 = 0;
do {
SDL_BlitSurface(theendimg, NULL, videobuffer, NULL);
- y = 255;
+ y1 = 255;
if (ticks < ticks1 + 1000) {
- y = 255 * (ticks - ticks1) / 1000;
- if (y < 0)
- y = 0;
- if (y > 255)
- y = 255;
+ y1 = 255 * (ticks - ticks1) / 1000;
+ if (y1 < 0)
+ y1 = 0;
+ if (y1 > 255)
+ y1 = 255;
}
- SDL_SetAlpha(videobuffer, 0, y);
+ SDL_SetAlpha(videobuffer, 0, y1);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
SDL_SetAlpha(videobuffer, 0, 255);
@@ -3877,13 +3877,13 @@ void GriffonEngine::game_loadmap(int mapnum) {
sprintf(name, "mapdb/%04i.map", mapnum);
debug(1, "Reading %s", name);
- Common::File fp;
- fp.open(name);
+ Common::File file;
+ file.open(name);
for (int x = 0; x <= 319; x++)
for (int y = 0; y <= 199; y++) {
INPUT("%i", &tempmap[x][y]);
}
- fp.close();
+ file.close();
for (int x = 0; x <= 319; x++)
for (int y = 0; y <= 239; y++) {
@@ -3893,7 +3893,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
// read *.trg file
sprintf(name, "mapdb/%04i.trg", mapnum);
debug(1, "Reading %s", name);
- fp.open(name);
+ file.open(name);
INPUT("%i", &ntriggers);
@@ -3906,7 +3906,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
triggerloc[mapx][mapy] = trig;
}
- fp.close();
+ file.close();
for (int y = 0; y <= 23; y++)
@@ -4146,7 +4146,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
// read *.npc file
sprintf(name, "mapdb/%04i.npc", mapnum);
debug(1, "Reading %s", name);
- fp.open(name);
+ file.open(name);
for (int i = 0; i < kMaxNPC; i++) {
INPUT("%i", &npcinfo[i].spriteset);
@@ -4407,7 +4407,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
npcinfo[i].pause = ticks;
}
- fp.close();
+ file.close();
int cx, cy, npx, npy, lx, ly;
@@ -4905,7 +4905,7 @@ void GriffonEngine::game_processtrigger(int trignum) {
}
void GriffonEngine::game_saveloadnew() {
- float y;
+ float y = 0.0;
int yy;
int currow, curcol, lowerlock;
int ticks, ticks1, tickpause;
@@ -6928,7 +6928,6 @@ void GriffonEngine::game_updspells() {
// metal
if (spellnum == 1 && forcepause == 0) {
- float xdif, ydif;
int npc;
int fr = (int)((32 - spellinfo[i].frame) * 4) % 3;
@@ -7171,8 +7170,8 @@ void GriffonEngine::game_updspells() {
int lx = (int)npx / 16;
int ly = (int)npy / 16;
- for (int f = 0; f < 5; f++) { // !! f < 5
- foundel[f] = 0;
+ for (int f1 = 0; f1 < 5; f1++) { // !! f < 5
+ foundel[f1] = 0;
}
for (int xo = -2; xo <= 2; xo++) {
@@ -7213,17 +7212,17 @@ void GriffonEngine::game_updspells() {
char line[256];
strcpy(line, "Found... nothing...");
- for (int f = 0; f < 5; f++) {
- if (foundel[f] == 1 && player.foundspell[f] == 0) {
- player.foundspell[f] = 1;
- player.spellcharge[f] = 0;
- if (f == 1)
+ for (int f1 = 0; f1 < 5; f1++) {
+ if (foundel[f1] == 1 && player.foundspell[f1] == 0) {
+ player.foundspell[f1] = 1;
+ player.spellcharge[f1] = 0;
+ if (f1 == 1)
strcpy(line, "Found... Water Essence");
- if (f == 2)
+ if (f1 == 2)
strcpy(line, "Found... Metal Essence");
- if (f == 3)
+ if (f1 == 3)
strcpy(line, "Found... Earth Essence");
- if (f == 4)
+ if (f1 == 4)
strcpy(line, "Found... Fire Essence");
break;
}
@@ -7460,7 +7459,7 @@ void GriffonEngine::game_updspells() {
int x = apx;
orn = 0;
- for (int y = apy; y <= 239; y++) {
+ for (y = apy; y <= 239; y++) {
int rn = (int)(RND() * 3);
if (orn == 0)
@@ -7517,7 +7516,7 @@ void GriffonEngine::game_updspells() {
x = apx;
orn = 0;
- for (int y = apy; y >= 0; y--) {
+ for (y = apy; y >= 0; y--) {
int rn = (int)(RND() * 3);
if (orn == 0)
@@ -7597,7 +7596,6 @@ void GriffonEngine::game_updspells() {
int orn = 0;
for (int y = 0; y <= apy; y++) {
if (y < 240) {
- float xdif, ydif;
int rn = (int)(RND() * 3);
if (orn == 0)
@@ -7690,7 +7688,7 @@ void GriffonEngine::game_updspellsunder() {
spellinfo[i].frame = 0;
- for (int f = 1; f <= lastnpc; f++) {
+ for (f = 1; f <= lastnpc; f++) {
int xdif = spellinfo[i].enemyx - npcinfo[f].x;
int ydif = spellinfo[i].enemyy - npcinfo[f].y;
@@ -7951,8 +7949,6 @@ void GriffonEngine::game_updspellsunder() {
}
void GriffonEngine::sys_initialize() {
- int result;
-
// init char *floatstri[kMaxFloat]
for (int i = 0; i < kMaxFloat; i++)
floatstri[i] = (char *)malloc(64); // 64 bytes each string (should be enough)
@@ -8260,22 +8256,22 @@ void GriffonEngine::sys_LoadTiles() {
}
void GriffonEngine::sys_LoadTriggers() {
- Common::File fp;
+ Common::File file;
- fp.open("data/triggers.dat");
+ file.open("data/triggers.dat");
for (int i = 0; i <= 9999; i++)
for (int a = 0; a <= 8; a++) {
INPUT("%i", &triggers[i][a]);
}
- fp.close();
+ file.close();
}
void GriffonEngine::sys_LoadObjectDB() {
- Common::File fp;
+ Common::File file;
- fp.open("objectdb.dat");
+ file.open("objectdb.dat");
for (int a = 0; a <= 32; a++) {
for (int b = 0; b <= 5; b++) {
@@ -8293,7 +8289,7 @@ void GriffonEngine::sys_LoadObjectDB() {
}
}
- fp.close();
+ file.close();
}
void GriffonEngine::sys_print(Graphics::TransparentSurface *buffer, const char *stri, int xloc, int yloc, int col) {
Commit: c890f95cf69e87cbe69516277216d6a0d662d4a1
https://github.com/scummvm/scummvm/commit/c890f95cf69e87cbe69516277216d6a0d662d4a1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: More compilation fixes
Changed paths:
engines/griffon/config.cpp
engines/griffon/detection.cpp
engines/griffon/engine.cpp
engines/griffon/module.mk
engines/griffon/state.cpp
diff --git a/engines/griffon/config.cpp b/engines/griffon/config.cpp
index aa57429..cda0554 100644
--- a/engines/griffon/config.cpp
+++ b/engines/griffon/config.cpp
@@ -60,6 +60,7 @@ char config_ini[64] = "config.ini";
} while(0)
void config_load(CONFIG *config) {
+#if 0
char line[128];
char arg[128];
FILE *fp;
@@ -109,9 +110,11 @@ void config_load(CONFIG *config) {
fclose(fp);
}
+#endif
}
void config_save(CONFIG *config) {
+#if 0
FILE *fp = fopen(config_ini, "w");
if (fp) {
@@ -132,6 +135,7 @@ void config_save(CONFIG *config) {
PRINT("%i", config->effectsvol);
fclose(fp);
}
+#endif
}
} // end of namespace Griffon
diff --git a/engines/griffon/detection.cpp b/engines/griffon/detection.cpp
index 099c855..b67241c 100644
--- a/engines/griffon/detection.cpp
+++ b/engines/griffon/detection.cpp
@@ -38,7 +38,7 @@ static const ADGameDescription gameDescriptions[] = {
AD_ENTRY1s("objectdb.dat", "ec5371da28f01ccf88980b32d9de2232", 27754),
Common::EN_ANY,
Common::kPlatformWindows,
- ADGF_UNSTABLE,
+ ADGF_UNSTABLE | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
@@ -69,7 +69,10 @@ bool GriffonMetaEngine::hasFeature(MetaEngineFeature f) const {
}
bool GriffonMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
- return false;
+ if (desc)
+ *engine = new Griffon::GriffonEngine(syst);
+
+ return desc != nullptr;
}
#if PLUGIN_ENABLED_DYNAMIC(GRIFFON)
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 0b35809..a9336bb 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -109,7 +109,7 @@ void SDL_BlitSurface(Graphics::Surface *src, Common::Rect *srcRect, Graphics::Tr
void SDL_BlitSurface(Graphics::Surface *src, Common::Rect *srcRect, Graphics::Surface *dst, Common::Rect *dstRect) {}
void SDL_FillRect(Graphics::TransparentSurface *surface, Common::Rect *rect, uint32 color) {}
int SDL_MapRGB(Graphics::PixelFormat format, int r, int g, int b) { return 0; }
-void SDL_SetColorKey(Graphics::Surface *src, int mode, uint32 color);
+void SDL_SetColorKey(Graphics::Surface *src, int mode, uint32 color) {}
Mix_Chunk *Mix_LoadWAV(const char *name) { return NULL; }
bool Mix_Playing(int channel) { return true; }
diff --git a/engines/griffon/module.mk b/engines/griffon/module.mk
index d4208a2..2dbacb5 100644
--- a/engines/griffon/module.mk
+++ b/engines/griffon/module.mk
@@ -1,9 +1,11 @@
MODULE := engines/griffon
MODULE_OBJS := \
+ config.o \
engine.o \
griffon.o \
- detection.o
+ detection.o \
+ state.o
MODULE_DIRS += \
engines/griffon
diff --git a/engines/griffon/state.cpp b/engines/griffon/state.cpp
index a1ec297..3aa97d6 100644
--- a/engines/griffon/state.cpp
+++ b/engines/griffon/state.cpp
@@ -60,6 +60,7 @@ extern PLAYERTYPE playera;
extern int asecstart;
int state_load(int slotnum) {
+#if 0
FILE *fp;
char line[256];
@@ -131,11 +132,13 @@ int state_load(int slotnum) {
fclose(fp);
}
+#endif
return 0; // fail
}
/* fill PLAYERTYPE playera; */
int state_load_player(int slotnum) {
+#if 0
FILE *fp;
char line[256];
@@ -188,11 +191,13 @@ int state_load_player(int slotnum) {
fclose(fp);
}
+#endif
return 0; // fail
}
int state_save(int slotnum) {
+#if 0
FILE *fp;
char line[256];
@@ -262,6 +267,7 @@ int state_save(int slotnum) {
return 1; // success
}
+#endif
return 0; // fail
}
Commit: 5a74f562272a9eefc797b66afad0f8bce04927af
https://github.com/scummvm/scummvm/commit/5a74f562272a9eefc797b66afad0f8bce04927af
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: First graphics output
Changed paths:
engines/griffon/engine.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index a9336bb..6659a7c 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -103,11 +103,95 @@ void Mix_Pause(int channel) {}
void Mix_HaltChannel(int channel) {}
void Mix_Resume(int channel) {}
void SDL_SetAlpha(Graphics::Surface *src, int flag, int alpha) {}
-void SDL_Flip(Graphics::TransparentSurface *src) {}
-void SDL_BlitSurface(Graphics::TransparentSurface *src, Common::Rect *srcRect, Graphics::TransparentSurface *dst, Common::Rect *dstRect) {}
-void SDL_BlitSurface(Graphics::Surface *src, Common::Rect *srcRect, Graphics::TransparentSurface *dst, Common::Rect *dstRect) {}
-void SDL_BlitSurface(Graphics::Surface *src, Common::Rect *srcRect, Graphics::Surface *dst, Common::Rect *dstRect) {}
-void SDL_FillRect(Graphics::TransparentSurface *surface, Common::Rect *rect, uint32 color) {}
+void SDL_Flip(Graphics::TransparentSurface *src) { g_system->copyRectToScreen(src->getPixels(), src->pitch, 0, 0, src->w, src->h); g_system->updateScreen(); }
+void SDL_BlitSurface(Graphics::TransparentSurface *src, Common::Rect *srcRect, Graphics::TransparentSurface *dst, Common::Rect *dstRect) {
+ assert(dst);
+ assert(src);
+ if (dstRect) {
+ if (dstRect->left >= 320 || dstRect->top >= 240)
+ return;
+
+ dstRect->debugPrint(1, "dst:");
+ }
+ debug(1, "dstsurf: %d x %d srcsurf: %d x %d", dst->w, dst->h, src->w, src->h);
+ if (srcRect)
+ srcRect->debugPrint(1, "src:");
+ src->blit(*dst, dstRect ? dstRect->left : 0, dstRect ? dstRect->top : 0, Graphics::FLIP_NONE, srcRect);
+}
+void SDL_BlitSurface(Graphics::Surface *src, Common::Rect *srcRect, Graphics::TransparentSurface *dst, Common::Rect *dstRect) {
+ assert(dst);
+ assert(src);
+
+ if (dstRect) {
+ if (dstRect->left >= 320 || dstRect->top >= 240)
+ return;
+ dstRect->debugPrint(1, "dst:");
+ }
+ debug(1, "dstsurf: %d x %d srcsurf: %d x %d", dst->w, dst->h, src->w, src->h);
+ if (srcRect)
+ srcRect->debugPrint(1, "src:");
+
+ int x = dstRect ? dstRect->left : 0;
+ int y = dstRect ? dstRect->top : 0;
+
+ if (srcRect) {
+ dst->copyRectToSurface(*src, x, y, *srcRect);
+ } else {
+ int w = src->w;
+ int h = src->h;
+
+ if (x + w > dst->w) {
+ w = dst->w - x;
+ }
+
+ if (y + h > dst->h) {
+ h = dst->h - y;
+ }
+
+ dst->copyRectToSurface(src->getPixels(), src->pitch, x, y, w, h);
+ }
+}
+void SDL_BlitSurface(Graphics::Surface *src, Common::Rect *srcRect, Graphics::Surface *dst, Common::Rect *dstRect) {
+ assert(dst);
+ assert(src);
+
+ if (dstRect) {
+ if (dstRect->left >= 320 || dstRect->top >= 240)
+ return;
+
+ dstRect->debugPrint(1, "dst:");
+ }
+ debug(1, "dstsurf: %d x %d srcsurf: %d x %d", dst->w, dst->h, src->w, src->h);
+ if (srcRect)
+ srcRect->debugPrint(1, "src:");
+
+ int x = dstRect ? dstRect->left : 0;
+ int y = dstRect ? dstRect->top : 0;
+
+ if (srcRect) {
+ dst->copyRectToSurface(*src, x, y, *srcRect);
+ } else {
+ int w = src->w;
+ int h = src->h;
+
+ if (x + w > dst->w) {
+ w = dst->w - x;
+ }
+
+ if (y + h > dst->h) {
+ h = dst->h - y;
+ }
+
+ dst->copyRectToSurface(src->getPixels(), src->pitch, x, y, w, h);
+ }
+}
+void SDL_FillRect(Graphics::TransparentSurface *surface, Common::Rect *rect, uint32 color) {
+ if (rect)
+ surface->fillRect(*rect, color);
+ else
+ surface->fillRect(Common::Rect(0, 0, surface->w, surface->h), color);
+}
+
int SDL_MapRGB(Graphics::PixelFormat format, int r, int g, int b) { return 0; }
void SDL_SetColorKey(Graphics::Surface *src, int mode, uint32 color) {}
@@ -418,6 +502,8 @@ Graphics::Surface *IMG_Load(const char *name) {
error("Cannot open file %s", name);
}
+ debug(1, "Loading: %s", name);
+
Image::BitmapDecoder bitmapDecoder;
bitmapDecoder.loadStream(file);
file.close();
@@ -1003,6 +1089,8 @@ void GriffonEngine::game_checkinputs() {
return;
if (event.type == Common::EVENT_KEYDOWN) {
+ warning("HERE3");
+
if (event.kbd.keycode == Common::KEYCODE_ESCAPE) {
if (itemticks < ticks)
game_title(1);
@@ -1473,6 +1561,8 @@ void GriffonEngine::game_configmenu() {
g_system->getEventManager()->pollEvent(event);
if (event.type == Common::EVENT_KEYDOWN) {
+ warning("HERE4");
+
keypause = ticks + tickwait;
if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
@@ -4952,6 +5042,7 @@ void GriffonEngine::game_saveloadnew() {
g_system->getEventManager()->pollEvent(event);
if (tickpause < ticks) {
+ warning("HERE");
if (event.type == Common::EVENT_KEYDOWN) {
itemticks = ticks + 220;
@@ -5246,15 +5337,13 @@ void GriffonEngine::game_showlogos() {
y = 255.0;
}
- SDL_FillRect(videobuffer, NULL, 0);
-
+ videobuffer->fillRect(Common::Rect(0, 0, 320, 240), 0);
SDL_SetAlpha(logosimg, 0, (int)y);
- SDL_BlitSurface(logosimg, NULL, videobuffer, NULL);
- SDL_SetAlpha(logosimg, 0, 255);
+ videobuffer->copyRectToSurface(*logosimg, 0, 0, Common::Rect(0, 0, 320, 240));
- SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
+ g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ g_system->updateScreen();
- SDL_Flip(video);
g_system->getEventManager()->pollEvent(event);
tickspassed = ticks;
@@ -5516,6 +5605,7 @@ void GriffonEngine::game_title(int mode) {
if (keypause < ticks) {
if (event.type == Common::EVENT_KEYDOWN) {
+ warning("HERE2");
keypause = ticks + 150;
if (event.kbd.keycode == Common::KEYCODE_ESCAPE && mode == 1)
@@ -7953,6 +8043,8 @@ void GriffonEngine::sys_initialize() {
for (int i = 0; i < kMaxFloat; i++)
floatstri[i] = (char *)malloc(64); // 64 bytes each string (should be enough)
+ video = new Graphics::TransparentSurface;
+ video->create(320, 240, g_system->getScreenFormat());
videobuffer = new Graphics::TransparentSurface;
videobuffer->create(320, 240, g_system->getScreenFormat());
videobuffer2 = new Graphics::TransparentSurface;
Commit: 17e1cb80c854575e720011a7882c182273687b3e
https://github.com/scummvm/scummvm/commit/17e1cb80c854575e720011a7882c182273687b3e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Got main menu displayed
Changed paths:
engines/griffon/engine.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 6659a7c..f20019a 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -102,7 +102,7 @@ int Mix_PlayChannel(int par1, Mix_Chunk *chunk, int par3) { return 0; }
void Mix_Pause(int channel) {}
void Mix_HaltChannel(int channel) {}
void Mix_Resume(int channel) {}
-void SDL_SetAlpha(Graphics::Surface *src, int flag, int alpha) {}
+void SDL_SetAlpha(Graphics::TransparentSurface *src, int flag, int alpha) {}
void SDL_Flip(Graphics::TransparentSurface *src) { g_system->copyRectToScreen(src->getPixels(), src->pitch, 0, 0, src->w, src->h); g_system->updateScreen(); }
void SDL_BlitSurface(Graphics::TransparentSurface *src, Common::Rect *srcRect, Graphics::TransparentSurface *dst, Common::Rect *dstRect) {
assert(dst);
@@ -110,81 +110,10 @@ void SDL_BlitSurface(Graphics::TransparentSurface *src, Common::Rect *srcRect, G
if (dstRect) {
if (dstRect->left >= 320 || dstRect->top >= 240)
return;
-
- dstRect->debugPrint(1, "dst:");
}
- debug(1, "dstsurf: %d x %d srcsurf: %d x %d", dst->w, dst->h, src->w, src->h);
- if (srcRect)
- srcRect->debugPrint(1, "src:");
src->blit(*dst, dstRect ? dstRect->left : 0, dstRect ? dstRect->top : 0, Graphics::FLIP_NONE, srcRect);
}
-void SDL_BlitSurface(Graphics::Surface *src, Common::Rect *srcRect, Graphics::TransparentSurface *dst, Common::Rect *dstRect) {
- assert(dst);
- assert(src);
-
- if (dstRect) {
- if (dstRect->left >= 320 || dstRect->top >= 240)
- return;
- dstRect->debugPrint(1, "dst:");
- }
- debug(1, "dstsurf: %d x %d srcsurf: %d x %d", dst->w, dst->h, src->w, src->h);
- if (srcRect)
- srcRect->debugPrint(1, "src:");
-
- int x = dstRect ? dstRect->left : 0;
- int y = dstRect ? dstRect->top : 0;
-
- if (srcRect) {
- dst->copyRectToSurface(*src, x, y, *srcRect);
- } else {
- int w = src->w;
- int h = src->h;
-
- if (x + w > dst->w) {
- w = dst->w - x;
- }
-
- if (y + h > dst->h) {
- h = dst->h - y;
- }
-
- dst->copyRectToSurface(src->getPixels(), src->pitch, x, y, w, h);
- }
-}
-void SDL_BlitSurface(Graphics::Surface *src, Common::Rect *srcRect, Graphics::Surface *dst, Common::Rect *dstRect) {
- assert(dst);
- assert(src);
-
- if (dstRect) {
- if (dstRect->left >= 320 || dstRect->top >= 240)
- return;
-
- dstRect->debugPrint(1, "dst:");
- }
- debug(1, "dstsurf: %d x %d srcsurf: %d x %d", dst->w, dst->h, src->w, src->h);
- if (srcRect)
- srcRect->debugPrint(1, "src:");
-
- int x = dstRect ? dstRect->left : 0;
- int y = dstRect ? dstRect->top : 0;
- if (srcRect) {
- dst->copyRectToSurface(*src, x, y, *srcRect);
- } else {
- int w = src->w;
- int h = src->h;
-
- if (x + w > dst->w) {
- w = dst->w - x;
- }
-
- if (y + h > dst->h) {
- h = dst->h - y;
- }
-
- dst->copyRectToSurface(src->getPixels(), src->pitch, x, y, w, h);
- }
-}
void SDL_FillRect(Graphics::TransparentSurface *surface, Common::Rect *rect, uint32 color) {
if (rect)
surface->fillRect(*rect, color);
@@ -193,7 +122,7 @@ void SDL_FillRect(Graphics::TransparentSurface *surface, Common::Rect *rect, uin
}
int SDL_MapRGB(Graphics::PixelFormat format, int r, int g, int b) { return 0; }
-void SDL_SetColorKey(Graphics::Surface *src, int mode, uint32 color) {}
+void SDL_SetColorKey(Graphics::TransparentSurface *src, int mode, uint32 color) {}
Mix_Chunk *Mix_LoadWAV(const char *name) { return NULL; }
bool Mix_Playing(int channel) { return true; }
@@ -201,8 +130,8 @@ bool Mix_Playing(int channel) { return true; }
// system
Graphics::TransparentSurface *video, *videobuffer, *videobuffer2, *videobuffer3;
-Graphics::Surface *titleimg, *titleimg2, *inventoryimg;
-Graphics::Surface *logosimg, *theendimg;
+Graphics::TransparentSurface *titleimg, *titleimg2, *inventoryimg;
+Graphics::TransparentSurface *logosimg, *theendimg;
Common::Event event;
Graphics::TransparentSurface *mapbg, *clipbg, *clipbg2;
@@ -213,9 +142,9 @@ float animspd;
int rampdata[40][24];
int curmap;
-Graphics::Surface *fontchr[224][5]; // 256 - 32
-Graphics::Surface *itemimg[21], *windowimg;
-Graphics::Surface *spellimg;
+Graphics::TransparentSurface *fontchr[224][5]; // 256 - 32
+Graphics::TransparentSurface *itemimg[21], *windowimg;
+Graphics::TransparentSurface *spellimg;
int itemselon, curitem, itemticks;
float itemyloc;
@@ -229,7 +158,7 @@ float fp, fps, fpsr;
int secsingame, secstart;
extern const char *story[48];
-Graphics::Surface *mapimg[4];
+Graphics::TransparentSurface *mapimg[4];
extern int invmap[4][7][13];
extern const char *story2[27];
@@ -239,7 +168,7 @@ Common::Rect rcSrc, rcDest;
int dontdrawover; // used in map24 so that the candles dont draw over the boss, default set to 0
// saveload info
-Graphics::Surface *saveloadimg;
+Graphics::TransparentSurface *saveloadimg;
// post info
@@ -247,7 +176,7 @@ float postinfo[21][3];
int nposts;
// cloud info
-Graphics::Surface *cloudimg;
+Graphics::TransparentSurface *cloudimg;
float clouddeg = 0;
int cloudson;
@@ -262,16 +191,16 @@ PLAYERTYPE playera;
int asecstart;
// tile info
-Graphics::Surface *tiles[4];
+Graphics::TransparentSurface *tiles[4];
int tileinfo[3][40][24][3]; // maplayer, x, y, tiledata (tile, tilelayer)
extern int elementmap[15][20];
// animation info
-Graphics::Surface *anims[100];
+Graphics::TransparentSurface *anims[100];
// id number 0&1 = players
-Graphics::Surface *animsa[100];
+Graphics::TransparentSurface *animsa[100];
// attack anims
float playerattackofs[4][16][3];
// [dir] [frame] [x,y ofs, completed(0/1)]
@@ -494,7 +423,7 @@ void game_fillrect(Graphics::TransparentSurface *surface, int x, int y, int w, i
surface->fillRect(Common::Rect(x, y, x + w, y + h), color);
}
-Graphics::Surface *IMG_Load(const char *name) {
+Graphics::TransparentSurface *IMG_Load(const char *name) {
Common::File file;
file.open(name);
@@ -508,9 +437,7 @@ Graphics::Surface *IMG_Load(const char *name) {
bitmapDecoder.loadStream(file);
file.close();
- Graphics::Surface *res = bitmapDecoder.getSurface()->convertTo(g_system->getScreenFormat());
-
- return res;
+ return new Graphics::TransparentSurface(*bitmapDecoder.getSurface()->convertTo(g_system->getScreenFormat()));
}
// copypaste from hRnd_CRT()
@@ -1384,7 +1311,7 @@ void GriffonEngine::game_checktrigger() {
#endif
void GriffonEngine::game_configmenu() {
- Graphics::Surface *configwindow;
+ Graphics::TransparentSurface *configwindow;
Common::Rect rc;
int cursel, curselt;
int tickwait, keypause, ticks1;
@@ -8284,12 +8211,12 @@ void GriffonEngine::sys_LoadAnims() {
}
void GriffonEngine::sys_LoadItemImgs() {
- Graphics::Surface *temp;
+ Graphics::TransparentSurface *temp;
temp = IMG_Load("art/icons.bmp");
for (int i = 0; i <= 20; i++) {
- itemimg[i] = new Graphics::Surface;
+ itemimg[i] = new Graphics::TransparentSurface;
itemimg[i]->create(16, 16, g_system->getScreenFormat());
SDL_SetColorKey(itemimg[i], 0, SDL_MapRGB(itemimg[i]->format, 255, 0, 255));
@@ -8305,7 +8232,7 @@ void GriffonEngine::sys_LoadItemImgs() {
}
void GriffonEngine::sys_LoadFont() {
- Graphics::Surface *font;
+ Graphics::TransparentSurface *font;
font = IMG_Load("art/font.bmp");
@@ -8313,7 +8240,7 @@ void GriffonEngine::sys_LoadFont() {
for (int f = 0; f <= 4; f++) {
int i2 = i - 32;
- fontchr[i2][f] = new Graphics::Surface;
+ fontchr[i2][f] = new Graphics::TransparentSurface;
fontchr[i2][f]->create(8, 8, g_system->getScreenFormat());
SDL_SetColorKey(fontchr[i2][f], 0, SDL_MapRGB(fontchr[i2][f]->format, 255, 0, 255));
@@ -8408,7 +8335,7 @@ void GriffonEngine::sys_progress(int w, int wm) {
}
void GriffonEngine::sys_setupAudio() {
- Graphics::Surface *loadimg;
+ Graphics::TransparentSurface *loadimg;
menabled = 1;
Commit: 84f02e2f73c5272bdecee890128a95456285104f
https://github.com/scummvm/scummvm/commit/84f02e2f73c5272bdecee890128a95456285104f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Implement engine quitting
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index f20019a..86291f8 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -255,6 +255,10 @@ int pmenu;
void GriffonEngine::griffon_main() {
sys_initialize();
game_showlogos();
+
+ if (_shouldQuit)
+ return;
+
game_main();
}
@@ -1015,9 +1019,12 @@ void GriffonEngine::game_checkinputs() {
if (attacking == 1 || (forcepause == 1 && itemselon == 0))
return;
- if (event.type == Common::EVENT_KEYDOWN) {
- warning("HERE3");
+ if (event.type == Common::EVENT_QUIT) {
+ _shouldQuit = true;
+ return;
+ }
+ if (event.type == Common::EVENT_KEYDOWN) {
if (event.kbd.keycode == Common::KEYCODE_ESCAPE) {
if (itemticks < ticks)
game_title(1);
@@ -1487,9 +1494,10 @@ void GriffonEngine::game_configmenu() {
if (keypause < ticks) {
g_system->getEventManager()->pollEvent(event);
- if (event.type == Common::EVENT_KEYDOWN) {
- warning("HERE4");
+ if (event.type == Common::EVENT_QUIT)
+ _shouldQuit = true;
+ if (event.type == Common::EVENT_KEYDOWN) {
keypause = ticks + tickwait;
if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
@@ -1667,7 +1675,7 @@ void GriffonEngine::game_configmenu() {
clouddeg = clouddeg - 360;
g_system->delayMillis(10);
- } while (1);
+ } while (!_shouldQuit);
configwindow->free();
itemticks = ticks + 210;
@@ -4649,6 +4657,10 @@ void GriffonEngine::game_loadmap(int mapnum) {
void GriffonEngine::game_main() {
game_title(0);
+
+ if (_shouldQuit)
+ return;
+
game_saveloadnew();
}
@@ -4749,10 +4761,16 @@ void GriffonEngine::game_newgame() {
if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
goto __exit_do;
+ if (event.type == Common::EVENT_QUIT)
+ _shouldQuit = true;
+
g_system->delayMillis(10);
- } while (1);
+ } while (!_shouldQuit);
__exit_do:
+ if (_shouldQuit)
+ return;
+
player.px = 0;
player.py = 0;
player.opx = 0;
@@ -4851,7 +4869,7 @@ void GriffonEngine::game_playgame() {
game_updmusic();
sys_update();
- } while (1);
+ } while (!_shouldQuit);
}
void GriffonEngine::game_processtrigger(int trignum) {
@@ -4968,15 +4986,20 @@ void GriffonEngine::game_saveloadnew() {
g_system->getEventManager()->pollEvent(event);
+ if (event.type == Common::EVENT_QUIT) {
+ _shouldQuit = true;
+ return;
+ }
+
if (tickpause < ticks) {
- warning("HERE");
if (event.type == Common::EVENT_KEYDOWN) {
itemticks = ticks + 220;
if (event.kbd.keycode == Common::KEYCODE_RETURN) {
// QUIT - non existent :)
if (currow == 0 && curcol == 4) {
- //exit(1); // FIXME
+ _shouldQuit = true;
+ return;
}
// RETURN
if (currow == 0 && curcol == 3) {
@@ -5232,7 +5255,7 @@ void GriffonEngine::game_saveloadnew() {
itemyloc -= 16;
g_system->delayMillis(10);
- } while (1);
+ } while (!_shouldQuit);
SDL_SetAlpha(cloudimg, 0, 64);
}
@@ -5273,6 +5296,9 @@ void GriffonEngine::game_showlogos() {
g_system->getEventManager()->pollEvent(event);
+ if (event.type == Common::EVENT_QUIT)
+ _shouldQuit = true;
+
tickspassed = ticks;
ticks = g_system->getMillis();
@@ -5289,7 +5315,7 @@ void GriffonEngine::game_showlogos() {
g_system->delayMillis(10);
if (ticks > ticks1 + 4000)
break;
- } while (1);
+ } while (!_shouldQuit);
}
@@ -5530,9 +5556,11 @@ void GriffonEngine::game_title(int mode) {
g_system->getEventManager()->pollEvent(event);
+ if (event.type == Common::EVENT_QUIT)
+ _shouldQuit = true;
+
if (keypause < ticks) {
if (event.type == Common::EVENT_KEYDOWN) {
- warning("HERE2");
keypause = ticks + 150;
if (event.kbd.keycode == Common::KEYCODE_ESCAPE && mode == 1)
@@ -5557,7 +5585,7 @@ void GriffonEngine::game_title(int mode) {
keypause = ticks + 150;
ticks1 = ticks;
} else if (cursel == 2) {
- //exit(1); // FIXME
+ _shouldQuit = true;
} else if (cursel == 3) {
break;
}
@@ -5567,7 +5595,7 @@ void GriffonEngine::game_title(int mode) {
SDL_Flip(video);
g_system->delayMillis(10);
- } while (1);
+ } while (!_shouldQuit);
itemticks = ticks + 210;
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index e31c7a3..17cb048 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -39,6 +39,8 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
SearchMan.addSubDirectoryMatching(gameDataDir, "sound");
_rnd = new Common::RandomSource("griffon");
+
+ _shouldQuit = false;
}
GriffonEngine::~GriffonEngine() {
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index a81951e..7da3414 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -239,6 +239,7 @@ public:
private:
Common::RandomSource *_rnd;
+ bool _shouldQuit;
private:
void griffon_main();
Commit: 7ade9001c5587e1fce1e2737f06cb279bcef88d8
https://github.com/scummvm/scummvm/commit/7ade9001c5587e1fce1e2737f06cb279bcef88d8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Handle color key
Changed paths:
engines/griffon/engine.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 86291f8..67313ed 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -122,7 +122,6 @@ void SDL_FillRect(Graphics::TransparentSurface *surface, Common::Rect *rect, uin
}
int SDL_MapRGB(Graphics::PixelFormat format, int r, int g, int b) { return 0; }
-void SDL_SetColorKey(Graphics::TransparentSurface *src, int mode, uint32 color) {}
Mix_Chunk *Mix_LoadWAV(const char *name) { return NULL; }
bool Mix_Playing(int channel) { return true; }
@@ -427,7 +426,7 @@ void game_fillrect(Graphics::TransparentSurface *surface, int x, int y, int w, i
surface->fillRect(Common::Rect(x, y, x + w, y + h), color);
}
-Graphics::TransparentSurface *IMG_Load(const char *name) {
+Graphics::TransparentSurface *IMG_Load(const char *name, bool colorkey = false) {
Common::File file;
file.open(name);
@@ -441,7 +440,12 @@ Graphics::TransparentSurface *IMG_Load(const char *name) {
bitmapDecoder.loadStream(file);
file.close();
- return new Graphics::TransparentSurface(*bitmapDecoder.getSurface()->convertTo(g_system->getScreenFormat()));
+ Graphics::TransparentSurface *surface = new Graphics::TransparentSurface(*bitmapDecoder.getSurface()->convertTo(g_system->getScreenFormat()));
+
+ if (colorkey)
+ surface->applyColorKey(255, 0, 255);
+
+ return surface;
}
// copypaste from hRnd_CRT()
@@ -1329,8 +1333,7 @@ void GriffonEngine::game_configmenu() {
tickwait = 100;
keypause = ticks + tickwait;
- configwindow = IMG_Load("art/configwindow.bmp");
- SDL_SetColorKey(configwindow, 0, SDL_MapRGB(configwindow->format, 255, 0, 255));
+ configwindow = IMG_Load("art/configwindow.bmp", true);
SDL_SetAlpha(configwindow, 0, 160);
ticks1 = ticks;
@@ -5288,8 +5291,7 @@ void GriffonEngine::game_showlogos() {
}
videobuffer->fillRect(Common::Rect(0, 0, 320, 240), 0);
- SDL_SetAlpha(logosimg, 0, (int)y);
- videobuffer->copyRectToSurface(*logosimg, 0, 0, Common::Rect(0, 0, 320, 240));
+ logosimg->blit(*videobuffer, 0, 0, Graphics::FLIP_NONE, nullptr, TS_ARGB((int)y, (int)y, (int)y, (int)y));
g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
g_system->updateScreen();
@@ -8017,26 +8019,21 @@ void GriffonEngine::sys_initialize() {
char name[128];
sprintf(name, "art/map%i.bmp", i + 1);
- mapimg[i] = IMG_Load(name);
- SDL_SetColorKey(mapimg[i], 0, SDL_MapRGB(mapimg[i]->format, 255, 0, 255));
+ mapimg[i] = IMG_Load(name, true);
}
- cloudimg = IMG_Load("art/clouds.bmp");
- SDL_SetColorKey(cloudimg, 0, SDL_MapRGB(cloudimg->format, 255, 0, 255));
+ cloudimg = IMG_Load("art/clouds.bmp", true);
SDL_SetAlpha(cloudimg, 0 | 0, 96);
- saveloadimg = IMG_Load("art/saveloadnew.bmp");
- SDL_SetColorKey(saveloadimg, 0, SDL_MapRGB(saveloadimg->format, 255, 0, 255));
+ saveloadimg = IMG_Load("art/saveloadnew.bmp", true);
SDL_SetAlpha(saveloadimg, 0 | 0, 160);
titleimg = IMG_Load("art/titleb.bmp");
- titleimg2 = IMG_Load("art/titlea.bmp");
- SDL_SetColorKey(titleimg2, 0, SDL_MapRGB(titleimg2->format, 255, 0, 255));
+ titleimg2 = IMG_Load("art/titlea.bmp", true);
//SDL_SetAlpha(titleimg2, 0 | 0, 204);
- inventoryimg = IMG_Load("art/inventory.bmp");
- SDL_SetColorKey(inventoryimg, 0, SDL_MapRGB(inventoryimg->format, 255, 0, 255));
+ inventoryimg = IMG_Load("art/inventory.bmp", true);
logosimg = IMG_Load("art/logos.bmp");
theendimg = IMG_Load("art/theend.bmp");
@@ -8091,29 +8088,14 @@ void GriffonEngine::sys_line(Graphics::TransparentSurface *buffer, int x1, int y
}
void GriffonEngine::sys_LoadAnims() {
- spellimg = IMG_Load("art/spells.bmp");
- SDL_SetColorKey(spellimg, 0, SDL_MapRGB(spellimg->format, 255, 0, 255));
-
- anims[0] = IMG_Load("art/anims0.bmp");
- SDL_SetColorKey(anims[0], 0, SDL_MapRGB(anims[0]->format, 255, 0, 255));
-
- animsa[0] = IMG_Load("art/anims0a.bmp");
- SDL_SetColorKey(animsa[0], 0, SDL_MapRGB(animsa[0]->format, 255, 0, 255));
-
- anims[13] = IMG_Load("art/anims0x.bmp");
- SDL_SetColorKey(anims[13], 0, SDL_MapRGB(anims[13]->format, 255, 0, 255));
-
- animsa[13] = IMG_Load("art/anims0xa.bmp");
- SDL_SetColorKey(animsa[13], 0, SDL_MapRGB(animsa[13]->format, 255, 0, 255));
-
- anims[1] = IMG_Load("art/anims1.bmp");
- SDL_SetColorKey(anims[1], 0, SDL_MapRGB(anims[1]->format, 255, 0, 255));
-
- animsa[1] = IMG_Load("art/anims1a.bmp");
- SDL_SetColorKey(animsa[1], 0, SDL_MapRGB(animsa[1]->format, 255, 0, 255));
-
- anims[2] = IMG_Load("art/anims2.bmp");
- SDL_SetColorKey(anims[2], 0, SDL_MapRGB(anims[2]->format, 255, 0, 255));
+ spellimg = IMG_Load("art/spells.bmp", true);
+ anims[0] = IMG_Load("art/anims0.bmp", true);
+ animsa[0] = IMG_Load("art/anims0a.bmp", true);
+ anims[13] = IMG_Load("art/anims0x.bmp", true);
+ animsa[13] = IMG_Load("art/anims0xa.bmp", true);
+ anims[1] = IMG_Load("art/anims1.bmp", true);
+ animsa[1] = IMG_Load("art/anims1a.bmp", true);
+ anims[2] = IMG_Load("art/anims2.bmp", true);
// huge
animset2[0].xofs = 8;
@@ -8158,8 +8140,7 @@ void GriffonEngine::sys_LoadAnims() {
animset2[5].w = 42;
animset2[5].h = 36;
- anims[9] = IMG_Load("art/anims9.bmp");
- SDL_SetColorKey(anims[9], 0, SDL_MapRGB(anims[9]->format, 255, 0, 255));
+ anims[9] = IMG_Load("art/anims9.bmp", true);
// huge
animset9[0].xofs = 8;
@@ -8204,49 +8185,27 @@ void GriffonEngine::sys_LoadAnims() {
animset9[5].w = 42;
animset9[5].h = 36;
- anims[3] = IMG_Load("art/anims3.bmp");
- SDL_SetColorKey(anims[3], 0, SDL_MapRGB(anims[3]->format, 255, 0, 255));
-
- anims[4] = IMG_Load("art/anims4.bmp");
- SDL_SetColorKey(anims[4], 0, SDL_MapRGB(anims[4]->format, 255, 0, 255));
-
- anims[5] = IMG_Load("art/anims5.bmp");
- SDL_SetColorKey(anims[5], 0, SDL_MapRGB(anims[5]->format, 255, 0, 255));
-
- anims[6] = IMG_Load("art/anims6.bmp");
- SDL_SetColorKey(anims[6], 0, SDL_MapRGB(anims[6]->format, 255, 0, 255));
-
- anims[7] = IMG_Load("art/anims7.bmp");
- SDL_SetColorKey(anims[7], 0, SDL_MapRGB(anims[7]->format, 255, 0, 255));
-
- anims[8] = IMG_Load("art/anims8.bmp");
- SDL_SetColorKey(anims[8], 0, SDL_MapRGB(anims[8]->format, 255, 0, 255));
-
- anims[10] = IMG_Load("art/anims10.bmp");
- SDL_SetColorKey(anims[10], 0, SDL_MapRGB(anims[10]->format, 255, 0, 255));
-
- animsa[10] = IMG_Load("art/anims10a.bmp");
- SDL_SetColorKey(animsa[10], 0, SDL_MapRGB(animsa[10]->format, 255, 0, 255));
-
- anims[11] = IMG_Load("art/anims11.bmp");
- SDL_SetColorKey(anims[11], 0, SDL_MapRGB(anims[11]->format, 255, 0, 255));
-
- animsa[11] = IMG_Load("art/anims11a.bmp");
- SDL_SetColorKey(animsa[11], 0, SDL_MapRGB(animsa[11]->format, 255, 0, 255));
-
- anims[12] = IMG_Load("art/anims12.bmp");
- SDL_SetColorKey(anims[12], 0, SDL_MapRGB(anims[12]->format, 255, 0, 255));
+ anims[3] = IMG_Load("art/anims3.bmp", true);
+ anims[4] = IMG_Load("art/anims4.bmp", true);
+ anims[5] = IMG_Load("art/anims5.bmp", true);
+ anims[6] = IMG_Load("art/anims6.bmp", true);
+ anims[7] = IMG_Load("art/anims7.bmp", true);
+ anims[8] = IMG_Load("art/anims8.bmp", true);
+ anims[10] = IMG_Load("art/anims10.bmp", true);
+ animsa[10] = IMG_Load("art/anims10a.bmp", true);
+ anims[11] = IMG_Load("art/anims11.bmp", true);
+ animsa[11] = IMG_Load("art/anims11a.bmp", true);
+ anims[12] = IMG_Load("art/anims12.bmp", true);
}
void GriffonEngine::sys_LoadItemImgs() {
Graphics::TransparentSurface *temp;
- temp = IMG_Load("art/icons.bmp");
+ temp = IMG_Load("art/icons.bmp", true);
for (int i = 0; i <= 20; i++) {
itemimg[i] = new Graphics::TransparentSurface;
itemimg[i]->create(16, 16, g_system->getScreenFormat());
- SDL_SetColorKey(itemimg[i], 0, SDL_MapRGB(itemimg[i]->format, 255, 0, 255));
rcSrc.left = i * 16;
rcSrc.top = 0;
@@ -8262,7 +8221,7 @@ void GriffonEngine::sys_LoadItemImgs() {
void GriffonEngine::sys_LoadFont() {
Graphics::TransparentSurface *font;
- font = IMG_Load("art/font.bmp");
+ font = IMG_Load("art/font.bmp", true);
for (int i = 32; i <= 255; i++)
for (int f = 0; f <= 4; f++) {
@@ -8270,7 +8229,6 @@ void GriffonEngine::sys_LoadFont() {
fontchr[i2][f] = new Graphics::TransparentSurface;
fontchr[i2][f]->create(8, 8, g_system->getScreenFormat());
- SDL_SetColorKey(fontchr[i2][f], 0, SDL_MapRGB(fontchr[i2][f]->format, 255, 0, 255));
int col = i2 % 40;
@@ -8290,16 +8248,12 @@ void GriffonEngine::sys_LoadFont() {
}
void GriffonEngine::sys_LoadTiles() {
- tiles[0] = IMG_Load("art/tx.bmp");
- tiles[1] = IMG_Load("art/tx1.bmp");
- tiles[2] = IMG_Load("art/tx2.bmp");
- tiles[3] = IMG_Load("art/tx3.bmp");
-
- for (int i = 0; i <= 3; i++)
- SDL_SetColorKey(tiles[i], 0, SDL_MapRGB(tiles[i]->format, 255, 0, 255));
+ tiles[0] = IMG_Load("art/tx.bmp", true);
+ tiles[1] = IMG_Load("art/tx1.bmp", true);
+ tiles[2] = IMG_Load("art/tx2.bmp", true);
+ tiles[3] = IMG_Load("art/tx3.bmp", true);
- windowimg = IMG_Load("art/window.bmp");
- SDL_SetColorKey(windowimg, 0, SDL_MapRGB(windowimg->format, 255, 0, 255));
+ windowimg = IMG_Load("art/window.bmp", true);
}
void GriffonEngine::sys_LoadTriggers() {
@@ -8376,8 +8330,7 @@ void GriffonEngine::sys_setupAudio() {
const char *stri = "Loading...";
sys_print(videobuffer, stri, 160 - 4 * strlen(stri), 116, 0);
- loadimg = IMG_Load("art/load.bmp");
- SDL_SetColorKey(loadimg, 0, SDL_MapRGB(loadimg->format, 255, 0, 255));
+ loadimg = IMG_Load("art/load.bmp", true);
rcSrc.left = 0;
rcSrc.top = 0;
Commit: c450854165a9c26d6ab982b09e23ac6d53496599
https://github.com/scummvm/scummvm/commit/c450854165a9c26d6ab982b09e23ac6d53496599
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRAPHICS: Added setAlpha() method to TransparentSurface
Changed paths:
graphics/transparent_surface.cpp
graphics/transparent_surface.h
diff --git a/graphics/transparent_surface.cpp b/graphics/transparent_surface.cpp
index b4d73d1..a24f719 100644
--- a/graphics/transparent_surface.cpp
+++ b/graphics/transparent_surface.cpp
@@ -716,6 +716,23 @@ void TransparentSurface::applyColorKey(uint8 rKey, uint8 gKey, uint8 bKey, bool
}
}
+/**
+ * Sets alpha channel for all pixels to specified value
+ * @param alpha value of the alpha channel to set
+ */
+void TransparentSurface::setAlpha(uint8 alpha) {
+ assert(format.bytesPerPixel == 4);
+ for (int i = 0; i < h; i++) {
+ for (int j = 0; j < w; j++) {
+ uint32 pix = ((uint32 *)pixels)[i * w + j];
+ uint8 r, g, b, a;
+ format.colorToARGB(pix, a, r, g, b);
+ a = alpha;
+ ((uint32 *)pixels)[i * w + j] = format.ARGBToColor(a, r, g, b);
+ }
+ }
+}
+
AlphaType TransparentSurface::getAlphaMode() const {
return _alphaMode;
}
diff --git a/graphics/transparent_surface.h b/graphics/transparent_surface.h
index 22fe045..0738c90 100644
--- a/graphics/transparent_surface.h
+++ b/graphics/transparent_surface.h
@@ -137,6 +137,7 @@ struct TransparentSurface : public Graphics::Surface {
TSpriteBlendMode blend = BLEND_NORMAL);
void applyColorKey(uint8 r, uint8 g, uint8 b, bool overwriteAlpha = false);
+ void setAlpha(uint8 alpha);
/**
* @brief Scale function; this returns a transformed version of this surface after rotation and
Commit: 8259a8aa333bb226339aa0defb2db59e7412de2d
https://github.com/scummvm/scummvm/commit/8259a8aa333bb226339aa0defb2db59e7412de2d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Handle transparency
Changed paths:
engines/griffon/engine.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 67313ed..d279f04 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -102,7 +102,7 @@ int Mix_PlayChannel(int par1, Mix_Chunk *chunk, int par3) { return 0; }
void Mix_Pause(int channel) {}
void Mix_HaltChannel(int channel) {}
void Mix_Resume(int channel) {}
-void SDL_SetAlpha(Graphics::TransparentSurface *src, int flag, int alpha) {}
+void SDL_SetAlpha(Graphics::TransparentSurface *src, int flag, int alpha) { src->setAlpha(alpha); }
void SDL_Flip(Graphics::TransparentSurface *src) { g_system->copyRectToScreen(src->getPixels(), src->pitch, 0, 0, src->w, src->h); g_system->updateScreen(); }
void SDL_BlitSurface(Graphics::TransparentSurface *src, Common::Rect *srcRect, Graphics::TransparentSurface *dst, Common::Rect *dstRect) {
assert(dst);
@@ -1334,7 +1334,7 @@ void GriffonEngine::game_configmenu() {
keypause = ticks + tickwait;
configwindow = IMG_Load("art/configwindow.bmp", true);
- SDL_SetAlpha(configwindow, 0, 160);
+ configwindow->setAlpha(160);
ticks1 = ticks;
do {
@@ -1345,18 +1345,18 @@ void GriffonEngine::game_configmenu() {
rcDest.setWidth(320);
rcDest.setHeight(240);
- SDL_SetAlpha(cloudimg, 0, 128);
+ cloudimg->setAlpha(128);
SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
- SDL_SetAlpha(cloudimg, 0, 64);
+ cloudimg->setAlpha(64);
rcDest.left = 256;
rcDest.top = 192;
rcDest.setWidth(320);
rcDest.setHeight(240);
- SDL_SetAlpha(cloudimg, 0, 128);
+ cloudimg->setAlpha(128);
SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
- SDL_SetAlpha(cloudimg, 0, 64);
+ cloudimg->setAlpha(64);
SDL_BlitSurface(configwindow, NULL, videobuffer, NULL);
@@ -1470,9 +1470,9 @@ void GriffonEngine::game_configmenu() {
yy = 255.0;
}
- SDL_SetAlpha(videobuffer, 0, (int)yy);
+ videobuffer->setAlpha((int)yy);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
- SDL_SetAlpha(videobuffer, 0, 255);
+ videobuffer->setAlpha(255);
SDL_Flip(video);
g_system->getEventManager()->pollEvent(event);
@@ -1683,7 +1683,7 @@ void GriffonEngine::game_configmenu() {
configwindow->free();
itemticks = ticks + 210;
- SDL_SetAlpha(cloudimg, 0, 64);
+ cloudimg->setAlpha(64);
}
void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
@@ -2294,7 +2294,7 @@ void GriffonEngine::game_drawhud() {
if (ico != 99)
SDL_BlitSurface(itemimg[ico], NULL, videobuffer, &rcDest);
if (ico == 99) {
- SDL_SetAlpha(spellimg, 0, (int)(RND() * 96) + 96);
+ spellimg->setAlpha((int)(RND() * 96) + 96);
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -2306,7 +2306,7 @@ void GriffonEngine::game_drawhud() {
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
- SDL_SetAlpha(spellimg, 0, 255);
+ spellimg->setAlpha(255);
}
}
}
@@ -2342,17 +2342,17 @@ void GriffonEngine::game_drawhud() {
rcDest.top = 0;
rcDest.right = 320;
rcDest.bottom = 240;
- SDL_SetAlpha(videobuffer2, 0, (int)(player.itemselshade * 4));
SDL_FillRect(videobuffer2, &rcDest, 0);
+ videobuffer2->setAlpha((int)(player.itemselshade * 4)); // FIXME
SDL_BlitSurface(videobuffer2, NULL, videobuffer, NULL);
int sy = 202;
rcSrc.left = 46;
rcSrc.top = 46;
- SDL_SetAlpha(inventoryimg, 0, 160); // 128
+ inventoryimg->setAlpha(160); // 128
SDL_BlitSurface(inventoryimg, NULL, videobuffer, &rcSrc);
- SDL_SetAlpha(inventoryimg, 0, 255);
+ inventoryimg->setAlpha(255);
int sx = 54;
sy = 55;
@@ -2689,9 +2689,9 @@ void GriffonEngine::game_drawnpcs(int mode) {
int x = 192 + ((int)(itemyloc + ff * 5) % 3) * 64;
if (x > 255)
x = 255;
- SDL_SetAlpha(spellimg, 0, x);
+ spellimg->setAlpha(x);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
- SDL_SetAlpha(spellimg, 0, 255);
+ spellimg->setAlpha(255);
for (int f = 1; f <= 8; f++) {
rcSrc.left = 16 * (int)(RND() * 2);
@@ -2705,9 +2705,9 @@ void GriffonEngine::game_drawnpcs(int mode) {
x = 192 + f % 3 * 64;
if (x > 255)
x = 255;
- SDL_SetAlpha(spellimg, 0, x);
+ spellimg->setAlpha(x);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
- SDL_SetAlpha(spellimg, 0, 255);
+ spellimg->setAlpha(255);
}
rcSrc.left = 0;
@@ -2718,10 +2718,9 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = npcinfo[i].bodysection[10 * ff + 9].x - 21;
rcDest.top = npcinfo[i].bodysection[10 * ff + 9].y - 21;
- SDL_SetAlpha(spellimg, 0, 192);
+ spellimg->setAlpha(192);
SDL_BlitSurface(anims[5], &rcSrc, videobuffer, &rcDest);
- SDL_SetAlpha(spellimg, 0, 255);
-
+ spellimg->setAlpha(255);
}
}
@@ -2895,7 +2894,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
int sy = (float)(npy + 12 - 50 - 3 * sin(3.141592 * 2 * npcinfo[i].floating / 16));
for (int fr = 0; fr <= 3; fr++) {
- SDL_SetAlpha(spellimg, 0, 128 + (int)(RND() * 96));
+ spellimg->setAlpha(128 + (int)(RND() * 96));
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -2922,7 +2921,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = (float)(sx + 36 + ii * 8 - ii * cos(3.14159 * 2 * (fr3 - ii) / 16) * 2);
rcDest.top = (float)(sy + 16 + ii * sin(3.14159 * 2 * (fr3 - ii) / 16) * 3 - ii); // * 4
- SDL_SetAlpha(spellimg, 0, i2 / 3 * 224);
+ spellimg->setAlpha(i2 / 3 * 224);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
@@ -2948,7 +2947,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = (float)(sx + 36 - ii * 8 + ii * cos(3.14159 * 2 * (fr3 - ii) / 16) * 2);
rcDest.top = (float)(sy + 16 + ii * sin(3.14159 * 2 * (fr3 - ii) / 16) * 3 - ii); // * 4
- SDL_SetAlpha(spellimg, 0, i2 / 3 * 224);
+ spellimg->setAlpha(i2 / 3 * 224);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
@@ -2971,7 +2970,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
}
}
- SDL_SetAlpha(spellimg, 0, 255);
+ spellimg->setAlpha(255);
if (npcinfo[i].attacking == 0) {
int cframe = (int)(frame);
@@ -3323,11 +3322,11 @@ void GriffonEngine::game_endofgame() {
SDL_FillRect(videobuffer, NULL, 0);
- SDL_SetAlpha(videobuffer, 0, ya);
+ videobuffer->setAlpha(ya);
SDL_BlitSurface(videobuffer2, NULL, videobuffer3, NULL);
SDL_BlitSurface(videobuffer, NULL, videobuffer3, NULL);
SDL_BlitSurface(videobuffer3, NULL, video, NULL);
- SDL_SetAlpha(videobuffer, 0, 255);
+ videobuffer->setAlpha(255);
SDL_Flip(video);
g_system->getEventManager()->pollEvent(event);
@@ -3385,9 +3384,9 @@ void GriffonEngine::game_endofgame() {
ya = 255;
}
- SDL_SetAlpha(videobuffer, 0, ya);
+ videobuffer->setAlpha(ya);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
- SDL_SetAlpha(videobuffer, 0, 255);
+ videobuffer->setAlpha(255);
SDL_Flip(video);
g_system->getEventManager()->pollEvent(event);
@@ -3441,11 +3440,11 @@ void GriffonEngine::game_endofgame() {
SDL_FillRect(videobuffer, NULL, 0);
- SDL_SetAlpha(videobuffer, 0, y1);
+ videobuffer->setAlpha(y1);
SDL_BlitSurface(videobuffer2, NULL, videobuffer3, NULL);
SDL_BlitSurface(videobuffer, NULL, videobuffer3, NULL);
SDL_BlitSurface(videobuffer3, NULL, video, NULL);
- SDL_SetAlpha(videobuffer, 0, 255);
+ videobuffer->setAlpha(255);
SDL_Flip(video);
g_system->getEventManager()->pollEvent(event);
@@ -3483,9 +3482,9 @@ void GriffonEngine::game_endofgame() {
y1 = 255;
}
- SDL_SetAlpha(videobuffer, 0, y1);
+ videobuffer->setAlpha(y1);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
- SDL_SetAlpha(videobuffer, 0, 255);
+ videobuffer->setAlpha(255);
SDL_Flip(video);
g_system->getEventManager()->pollEvent(event);
@@ -3547,13 +3546,13 @@ void GriffonEngine::game_eventtext(const char *stri) {
if (fr > 192)
fr = 192;
- SDL_SetAlpha(windowimg, 0, fr);
+ windowimg->setAlpha(fr);
SDL_BlitSurface(windowimg, NULL, videobuffer, NULL);
if (pauseticks < ticks)
sys_print(videobuffer, stri, x, 15, 0);
- SDL_SetAlpha(windowimg, 0, 255);
+ windowimg->setAlpha(255);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
SDL_Flip(video);
@@ -3992,7 +3991,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
ffa = 20 * 5 - 1 + ff * 20;
ffb = 20 * 5 + 4 + ff * 20;
if (curtile > ffa && curtile < ffb) {
- SDL_SetAlpha(tiles[curtilel], 0, 128);
+ tiles[curtilel]->setAlpha(128);
}
}
}
@@ -4000,13 +3999,13 @@ void GriffonEngine::game_loadmap(int mapnum) {
for (int ff = 0; ff <= 4; ff++) {
ffa = 20 * (5 + ff) + 3;
if (curtile == ffa) {
- SDL_SetAlpha(tiles[curtilel], 0, 192);
+ tiles[curtilel]->setAlpha(192);
}
}
}
SDL_BlitSurface(tiles[curtilel], &rcSrc, mapbg, &rcDest);
- SDL_SetAlpha(tiles[curtilel], 0, 255);
+ tiles[curtilel]->setAlpha(255);
rcDest.left = x * 8;
rcDest.top = y * 8;
@@ -4950,8 +4949,8 @@ void GriffonEngine::game_saveloadnew() {
clouddeg = 0;
- SDL_SetAlpha(videobuffer, 0, 255);
- SDL_SetAlpha(saveloadimg, 0, 192);
+ videobuffer->setAlpha(255);
+ saveloadimg->setAlpha(192);
currow = 0;
curcol = 0;
@@ -4972,18 +4971,18 @@ void GriffonEngine::game_saveloadnew() {
rcDest.setWidth(320);
rcDest.setHeight(240);
- SDL_SetAlpha(cloudimg, 0, 128);
+ cloudimg->setAlpha(128);
SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
- SDL_SetAlpha(cloudimg, 0, 64);
+ cloudimg->setAlpha(64);
rcDest.left = 256;
rcDest.top = 192;
rcDest.setWidth(320);
rcDest.setHeight(240);
- SDL_SetAlpha(cloudimg, 0, 128);
+ cloudimg->setAlpha(128);
SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
- SDL_SetAlpha(cloudimg, 0, 64);
+ cloudimg->setAlpha(64);
SDL_BlitSurface(saveloadimg, NULL, videobuffer, NULL);
@@ -5229,9 +5228,9 @@ void GriffonEngine::game_saveloadnew() {
yy = 255;
}
- SDL_SetAlpha(videobuffer, 0, (int)yy);
+ videobuffer->setAlpha((int)yy);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
- SDL_SetAlpha(videobuffer, 0, 255);
+ videobuffer->setAlpha(255);
SDL_Flip(video);
g_system->getEventManager()->pollEvent(event);
@@ -5260,7 +5259,7 @@ void GriffonEngine::game_saveloadnew() {
g_system->delayMillis(10);
} while (!_shouldQuit);
- SDL_SetAlpha(cloudimg, 0, 64);
+ cloudimg->setAlpha(64);
}
void GriffonEngine::game_showlogos() {
@@ -5329,7 +5328,7 @@ void GriffonEngine::game_swash() {
do {
y = y + 1 * fpsr;
- SDL_SetAlpha(videobuffer, 0, (int)y);
+ videobuffer->setAlpha((int)y);
SDL_FillRect(videobuffer, NULL, 0);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
@@ -5362,7 +5361,7 @@ void GriffonEngine::game_swash() {
do {
y = y + 1 * fpsr;
- SDL_SetAlpha(videobuffer, 0, (int)(y * 25));
+ videobuffer->setAlpha((int)(y * 25));
SDL_BlitSurface(mapbg, NULL, videobuffer, NULL);
if (cloudson == 1) {
@@ -5401,7 +5400,7 @@ void GriffonEngine::game_swash() {
} while (1);
- SDL_SetAlpha(videobuffer, 0, 255);
+ videobuffer->setAlpha(255);
}
void GriffonEngine::game_theend() {
@@ -5411,7 +5410,7 @@ void GriffonEngine::game_theend() {
}
for (float y = 0; y < 100; y += fpsr) {
- SDL_SetAlpha(videobuffer, 0, (int)y);
+ videobuffer->setAlpha((int)y);
SDL_FillRect(videobuffer, NULL, 0);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
@@ -5526,9 +5525,9 @@ void GriffonEngine::game_title(int mode) {
yf = 255.0;
}
- SDL_SetAlpha(videobuffer, 0, (int)yf);
+ videobuffer->setAlpha((int)yf);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
- SDL_SetAlpha(videobuffer, 0, 255);
+ videobuffer->setAlpha(255);
tickspassed = ticks;
ticks = g_system->getMillis();
@@ -6918,9 +6917,9 @@ void GriffonEngine::game_updspells() {
}
if (xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
- SDL_SetAlpha(spellimg, 0, alf);
+ spellimg->setAlpha(alf);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
- SDL_SetAlpha(spellimg, 0, 255);
+ spellimg->setAlpha(255);
if (spellinfo[i].damagewho == 0) {
for (int e = 1; e <= lastnpc; e++) {
@@ -7202,9 +7201,9 @@ void GriffonEngine::game_updspells() {
if (fra > 24)
f = 192 * (1 - (fra - 24) / 8);
- SDL_SetAlpha(spellimg, 0, f);
+ spellimg->setAlpha(f);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
- SDL_SetAlpha(spellimg, 0, 255);
+ spellimg->setAlpha(255);
spellinfo[i].frame = spellinfo[i].frame - 0.3 * fpsr;
if (spellinfo[i].frame < 0) {
@@ -7285,7 +7284,7 @@ void GriffonEngine::game_updspells() {
if (spellinfo[i].frame > 16) {
float fr = (32 - spellinfo[i].frame);
- SDL_SetAlpha(spellimg, 0, 192 * sin(3.14159 * fr / 4));
+ spellimg->setAlpha(192 * sin(3.14159 * fr / 4));
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -7303,9 +7302,9 @@ void GriffonEngine::game_updspells() {
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
}
- SDL_SetAlpha(spellimg, 0, 255);
+ spellimg->setAlpha(255);
} else {
- SDL_SetAlpha(spellimg, 0, 192);
+ spellimg->setAlpha(192);
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -7342,7 +7341,7 @@ void GriffonEngine::game_updspells() {
spellinfo[i].ballon[ff] = 0;
}
- SDL_SetAlpha(spellimg, 0, 255);
+ spellimg->setAlpha(255);
}
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
@@ -7726,9 +7725,9 @@ void GriffonEngine::game_updspellsunder() {
if (fra > 24)
f = 160 * (1 - (fra - 24) / 8);
- SDL_SetAlpha(spellimg, 0, f);
+ spellimg->setAlpha(f);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
- SDL_SetAlpha(spellimg, 0, 255);
+ spellimg->setAlpha(255);
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
if (spellinfo[i].frame < 0)
@@ -7814,7 +7813,7 @@ void GriffonEngine::game_updspellsunder() {
for (int f = 0; f <= 4; f++) {
for (int x = 0; x <= fra; x += 2) {
if (spellinfo[i].legalive[f] >= x) {
- SDL_SetAlpha(spellimg, 0, 192 * sin(3.14159 * x / 32) * s / 8);
+ spellimg->setAlpha(192 * sin(3.14159 * x / 32) * s / 8);
float an = 360 / 5 * f + x / 32 * 180;
@@ -7911,7 +7910,7 @@ void GriffonEngine::game_updspellsunder() {
}
}
- SDL_SetAlpha(spellimg, 0, 255);
+ spellimg->setAlpha(255);
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
if (spellinfo[i].frame < 0)
@@ -7943,7 +7942,7 @@ void GriffonEngine::game_updspellsunder() {
if (alpha > 255)
alpha = 255;
- SDL_SetAlpha(spellimg, 0, alpha);
+ spellimg->setAlpha(alpha);
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -7981,7 +7980,7 @@ void GriffonEngine::game_updspellsunder() {
}
- SDL_SetAlpha(spellimg, 0, 255);
+ spellimg->setAlpha(255);
spellinfo[i].frame = spellinfo[i].frame - 0.5 * fpsr;
if (spellinfo[i].frame < 0)
spellinfo[i].frame = 0;
Commit: b45cadb0654ce47dea0d24046110820b9ce8ae99
https://github.com/scummvm/scummvm/commit/b45cadb0654ce47dea0d24046110820b9ce8ae99
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRAPHICS: Enhanced setAlpha method
Changed paths:
graphics/transparent_surface.cpp
graphics/transparent_surface.h
diff --git a/graphics/transparent_surface.cpp b/graphics/transparent_surface.cpp
index a24f719..eb8d3fe 100644
--- a/graphics/transparent_surface.cpp
+++ b/graphics/transparent_surface.cpp
@@ -719,15 +719,17 @@ void TransparentSurface::applyColorKey(uint8 rKey, uint8 gKey, uint8 bKey, bool
/**
* Sets alpha channel for all pixels to specified value
* @param alpha value of the alpha channel to set
+ * @param skipTransparent if set to true, then do not touch pixels with alpha=0
*/
-void TransparentSurface::setAlpha(uint8 alpha) {
+void TransparentSurface::setAlpha(uint8 alpha, bool skipTransparent) {
assert(format.bytesPerPixel == 4);
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
uint32 pix = ((uint32 *)pixels)[i * w + j];
uint8 r, g, b, a;
format.colorToARGB(pix, a, r, g, b);
- a = alpha;
+ if (!skipTransparent || a)
+ a = alpha;
((uint32 *)pixels)[i * w + j] = format.ARGBToColor(a, r, g, b);
}
}
diff --git a/graphics/transparent_surface.h b/graphics/transparent_surface.h
index 0738c90..8f44936 100644
--- a/graphics/transparent_surface.h
+++ b/graphics/transparent_surface.h
@@ -137,7 +137,7 @@ struct TransparentSurface : public Graphics::Surface {
TSpriteBlendMode blend = BLEND_NORMAL);
void applyColorKey(uint8 r, uint8 g, uint8 b, bool overwriteAlpha = false);
- void setAlpha(uint8 alpha);
+ void setAlpha(uint8 alpha, bool skipTransparent = false);
/**
* @brief Scale function; this returns a transformed version of this surface after rotation and
Commit: 8f399b95b3b29358262a832a53d6a18957996582
https://github.com/scummvm/scummvm/commit/8f399b95b3b29358262a832a53d6a18957996582
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Properly process transparency together with keycolor
Changed paths:
engines/griffon/engine.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index d279f04..5d09cd8 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -102,7 +102,6 @@ int Mix_PlayChannel(int par1, Mix_Chunk *chunk, int par3) { return 0; }
void Mix_Pause(int channel) {}
void Mix_HaltChannel(int channel) {}
void Mix_Resume(int channel) {}
-void SDL_SetAlpha(Graphics::TransparentSurface *src, int flag, int alpha) { src->setAlpha(alpha); }
void SDL_Flip(Graphics::TransparentSurface *src) { g_system->copyRectToScreen(src->getPixels(), src->pitch, 0, 0, src->w, src->h); g_system->updateScreen(); }
void SDL_BlitSurface(Graphics::TransparentSurface *src, Common::Rect *srcRect, Graphics::TransparentSurface *dst, Common::Rect *dstRect) {
assert(dst);
@@ -121,7 +120,7 @@ void SDL_FillRect(Graphics::TransparentSurface *surface, Common::Rect *rect, uin
surface->fillRect(Common::Rect(0, 0, surface->w, surface->h), color);
}
-int SDL_MapRGB(Graphics::PixelFormat format, int r, int g, int b) { return 0; }
+int SDL_MapRGB(Graphics::PixelFormat format, int r, int g, int b) { return format.RGBToColor(r, g, b); }
Mix_Chunk *Mix_LoadWAV(const char *name) { return NULL; }
bool Mix_Playing(int channel) { return true; }
@@ -410,7 +409,7 @@ int invmap[4][7][13] = {
#define INPUT(A, B) \
do { \
Common::String line; \
- file.readLine(); \
+ line = file.readLine(); \
sscanf(line.c_str(), A, B); \
} while(0)
@@ -1334,7 +1333,7 @@ void GriffonEngine::game_configmenu() {
keypause = ticks + tickwait;
configwindow = IMG_Load("art/configwindow.bmp", true);
- configwindow->setAlpha(160);
+ configwindow->setAlpha(160, true);
ticks1 = ticks;
do {
@@ -1345,18 +1344,18 @@ void GriffonEngine::game_configmenu() {
rcDest.setWidth(320);
rcDest.setHeight(240);
- cloudimg->setAlpha(128);
+ cloudimg->setAlpha(128, true);
SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
- cloudimg->setAlpha(64);
+ cloudimg->setAlpha(64, true);
rcDest.left = 256;
rcDest.top = 192;
rcDest.setWidth(320);
rcDest.setHeight(240);
- cloudimg->setAlpha(128);
+ cloudimg->setAlpha(128, true);
SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
- cloudimg->setAlpha(64);
+ cloudimg->setAlpha(64, true);
SDL_BlitSurface(configwindow, NULL, videobuffer, NULL);
@@ -1683,7 +1682,7 @@ void GriffonEngine::game_configmenu() {
configwindow->free();
itemticks = ticks + 210;
- cloudimg->setAlpha(64);
+ cloudimg->setAlpha(64, true);
}
void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
@@ -2294,7 +2293,7 @@ void GriffonEngine::game_drawhud() {
if (ico != 99)
SDL_BlitSurface(itemimg[ico], NULL, videobuffer, &rcDest);
if (ico == 99) {
- spellimg->setAlpha((int)(RND() * 96) + 96);
+ spellimg->setAlpha((int)(RND() * 96) + 96, true);
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -2306,7 +2305,7 @@ void GriffonEngine::game_drawhud() {
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
- spellimg->setAlpha(255);
+ spellimg->setAlpha(255, true);
}
}
}
@@ -2350,9 +2349,9 @@ void GriffonEngine::game_drawhud() {
rcSrc.left = 46;
rcSrc.top = 46;
- inventoryimg->setAlpha(160); // 128
+ inventoryimg->setAlpha(160, true); // 128
SDL_BlitSurface(inventoryimg, NULL, videobuffer, &rcSrc);
- inventoryimg->setAlpha(255);
+ inventoryimg->setAlpha(255, true);
int sx = 54;
sy = 55;
@@ -2689,9 +2688,9 @@ void GriffonEngine::game_drawnpcs(int mode) {
int x = 192 + ((int)(itemyloc + ff * 5) % 3) * 64;
if (x > 255)
x = 255;
- spellimg->setAlpha(x);
+ spellimg->setAlpha(x, true);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
- spellimg->setAlpha(255);
+ spellimg->setAlpha(255, true);
for (int f = 1; f <= 8; f++) {
rcSrc.left = 16 * (int)(RND() * 2);
@@ -2705,9 +2704,9 @@ void GriffonEngine::game_drawnpcs(int mode) {
x = 192 + f % 3 * 64;
if (x > 255)
x = 255;
- spellimg->setAlpha(x);
+ spellimg->setAlpha(x, true);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
- spellimg->setAlpha(255);
+ spellimg->setAlpha(255, true);
}
rcSrc.left = 0;
@@ -2718,9 +2717,9 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = npcinfo[i].bodysection[10 * ff + 9].x - 21;
rcDest.top = npcinfo[i].bodysection[10 * ff + 9].y - 21;
- spellimg->setAlpha(192);
+ spellimg->setAlpha(192, true);
SDL_BlitSurface(anims[5], &rcSrc, videobuffer, &rcDest);
- spellimg->setAlpha(255);
+ spellimg->setAlpha(255, true);
}
}
@@ -2894,7 +2893,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
int sy = (float)(npy + 12 - 50 - 3 * sin(3.141592 * 2 * npcinfo[i].floating / 16));
for (int fr = 0; fr <= 3; fr++) {
- spellimg->setAlpha(128 + (int)(RND() * 96));
+ spellimg->setAlpha(128 + (int)(RND() * 96), true);
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -2921,7 +2920,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = (float)(sx + 36 + ii * 8 - ii * cos(3.14159 * 2 * (fr3 - ii) / 16) * 2);
rcDest.top = (float)(sy + 16 + ii * sin(3.14159 * 2 * (fr3 - ii) / 16) * 3 - ii); // * 4
- spellimg->setAlpha(i2 / 3 * 224);
+ spellimg->setAlpha(i2 / 3 * 224, true);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
@@ -2947,7 +2946,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = (float)(sx + 36 - ii * 8 + ii * cos(3.14159 * 2 * (fr3 - ii) / 16) * 2);
rcDest.top = (float)(sy + 16 + ii * sin(3.14159 * 2 * (fr3 - ii) / 16) * 3 - ii); // * 4
- spellimg->setAlpha(i2 / 3 * 224);
+ spellimg->setAlpha(i2 / 3 * 224, true);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
@@ -2970,7 +2969,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
}
}
- spellimg->setAlpha(255);
+ spellimg->setAlpha(255, true);
if (npcinfo[i].attacking == 0) {
int cframe = (int)(frame);
@@ -3546,13 +3545,13 @@ void GriffonEngine::game_eventtext(const char *stri) {
if (fr > 192)
fr = 192;
- windowimg->setAlpha(fr);
+ windowimg->setAlpha(fr, true);
SDL_BlitSurface(windowimg, NULL, videobuffer, NULL);
if (pauseticks < ticks)
sys_print(videobuffer, stri, x, 15, 0);
- windowimg->setAlpha(255);
+ windowimg->setAlpha(255, true);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
SDL_Flip(video);
@@ -3991,7 +3990,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
ffa = 20 * 5 - 1 + ff * 20;
ffb = 20 * 5 + 4 + ff * 20;
if (curtile > ffa && curtile < ffb) {
- tiles[curtilel]->setAlpha(128);
+ tiles[curtilel]->setAlpha(128, true);
}
}
}
@@ -3999,13 +3998,13 @@ void GriffonEngine::game_loadmap(int mapnum) {
for (int ff = 0; ff <= 4; ff++) {
ffa = 20 * (5 + ff) + 3;
if (curtile == ffa) {
- tiles[curtilel]->setAlpha(192);
+ tiles[curtilel]->setAlpha(192, true);
}
}
}
SDL_BlitSurface(tiles[curtilel], &rcSrc, mapbg, &rcDest);
- tiles[curtilel]->setAlpha(255);
+ tiles[curtilel]->setAlpha(255, true);
rcDest.left = x * 8;
rcDest.top = y * 8;
@@ -4950,7 +4949,7 @@ void GriffonEngine::game_saveloadnew() {
clouddeg = 0;
videobuffer->setAlpha(255);
- saveloadimg->setAlpha(192);
+ saveloadimg->setAlpha(192, true);
currow = 0;
curcol = 0;
@@ -4971,18 +4970,18 @@ void GriffonEngine::game_saveloadnew() {
rcDest.setWidth(320);
rcDest.setHeight(240);
- cloudimg->setAlpha(128);
+ cloudimg->setAlpha(128, true);
SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
- cloudimg->setAlpha(64);
+ cloudimg->setAlpha(64, true);
rcDest.left = 256;
rcDest.top = 192;
rcDest.setWidth(320);
rcDest.setHeight(240);
- cloudimg->setAlpha(128);
+ cloudimg->setAlpha(128, true);
SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
- cloudimg->setAlpha(64);
+ cloudimg->setAlpha(64, true);
SDL_BlitSurface(saveloadimg, NULL, videobuffer, NULL);
@@ -5259,7 +5258,7 @@ void GriffonEngine::game_saveloadnew() {
g_system->delayMillis(10);
} while (!_shouldQuit);
- cloudimg->setAlpha(64);
+ cloudimg->setAlpha(64, true);
}
void GriffonEngine::game_showlogos() {
@@ -6917,9 +6916,9 @@ void GriffonEngine::game_updspells() {
}
if (xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
- spellimg->setAlpha(alf);
+ spellimg->setAlpha(alf, true);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
- spellimg->setAlpha(255);
+ spellimg->setAlpha(255, true);
if (spellinfo[i].damagewho == 0) {
for (int e = 1; e <= lastnpc; e++) {
@@ -7201,9 +7200,9 @@ void GriffonEngine::game_updspells() {
if (fra > 24)
f = 192 * (1 - (fra - 24) / 8);
- spellimg->setAlpha(f);
+ spellimg->setAlpha(f, true);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
- spellimg->setAlpha(255);
+ spellimg->setAlpha(255, true);
spellinfo[i].frame = spellinfo[i].frame - 0.3 * fpsr;
if (spellinfo[i].frame < 0) {
@@ -7284,7 +7283,7 @@ void GriffonEngine::game_updspells() {
if (spellinfo[i].frame > 16) {
float fr = (32 - spellinfo[i].frame);
- spellimg->setAlpha(192 * sin(3.14159 * fr / 4));
+ spellimg->setAlpha(192 * sin(3.14159 * fr / 4), true);
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -7302,9 +7301,9 @@ void GriffonEngine::game_updspells() {
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
}
- spellimg->setAlpha(255);
+ spellimg->setAlpha(255, true);
} else {
- spellimg->setAlpha(192);
+ spellimg->setAlpha(192, true);
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -7341,7 +7340,7 @@ void GriffonEngine::game_updspells() {
spellinfo[i].ballon[ff] = 0;
}
- spellimg->setAlpha(255);
+ spellimg->setAlpha(255, true);
}
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
@@ -7725,9 +7724,9 @@ void GriffonEngine::game_updspellsunder() {
if (fra > 24)
f = 160 * (1 - (fra - 24) / 8);
- spellimg->setAlpha(f);
+ spellimg->setAlpha(f, true);
SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
- spellimg->setAlpha(255);
+ spellimg->setAlpha(255, true);
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
if (spellinfo[i].frame < 0)
@@ -7813,7 +7812,7 @@ void GriffonEngine::game_updspellsunder() {
for (int f = 0; f <= 4; f++) {
for (int x = 0; x <= fra; x += 2) {
if (spellinfo[i].legalive[f] >= x) {
- spellimg->setAlpha(192 * sin(3.14159 * x / 32) * s / 8);
+ spellimg->setAlpha(192 * sin(3.14159 * x / 32) * s / 8, true);
float an = 360 / 5 * f + x / 32 * 180;
@@ -7910,7 +7909,7 @@ void GriffonEngine::game_updspellsunder() {
}
}
- spellimg->setAlpha(255);
+ spellimg->setAlpha(255, true);
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
if (spellinfo[i].frame < 0)
@@ -7942,7 +7941,7 @@ void GriffonEngine::game_updspellsunder() {
if (alpha > 255)
alpha = 255;
- spellimg->setAlpha(alpha);
+ spellimg->setAlpha(alpha, true);
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -7980,7 +7979,7 @@ void GriffonEngine::game_updspellsunder() {
}
- spellimg->setAlpha(255);
+ spellimg->setAlpha(255, true);
spellinfo[i].frame = spellinfo[i].frame - 0.5 * fpsr;
if (spellinfo[i].frame < 0)
spellinfo[i].frame = 0;
@@ -8022,15 +8021,15 @@ void GriffonEngine::sys_initialize() {
}
cloudimg = IMG_Load("art/clouds.bmp", true);
- SDL_SetAlpha(cloudimg, 0 | 0, 96);
+ cloudimg->setAlpha(96, true);
saveloadimg = IMG_Load("art/saveloadnew.bmp", true);
- SDL_SetAlpha(saveloadimg, 0 | 0, 160);
+ saveloadimg->setAlpha(160, true);
titleimg = IMG_Load("art/titleb.bmp");
titleimg2 = IMG_Load("art/titlea.bmp", true);
- //SDL_SetAlpha(titleimg2, 0 | 0, 204);
+ //titleimg2->setAlpha(204, true);
inventoryimg = IMG_Load("art/inventory.bmp", true);
@@ -8339,9 +8338,9 @@ void GriffonEngine::sys_setupAudio() {
rcDest.left = 160 - 44;
rcDest.top = 116 + 12;
- SDL_SetAlpha(loadimg, 0 | 0, 160); // 128
+ loadimg->setAlpha(160, true); // 128
SDL_BlitSurface(loadimg, &rcSrc, videobuffer, &rcDest);
- SDL_SetAlpha(loadimg, 0 | 0, 255);
+ loadimg->setAlpha(255, true);
SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
SDL_Flip(video);
Commit: 2364c6b45723351bb1a7af82a9a8eea219a442da
https://github.com/scummvm/scummvm/commit/2364c6b45723351bb1a7af82a9a8eea219a442da
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Simplify code
Changed paths:
engines/griffon/engine.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 5d09cd8..5193e83 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -4067,7 +4067,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
rcDest.top = y1;
rcDest.setWidth(8);
rcDest.setHeight(8);
- SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ SDL_FillRect(clipbg, &rcDest, ccc);
} else if (d == 6) {
sys_line(clipbg, x1 + 7, y1, x1 + 7, y1 + 7, ccc);
sys_line(clipbg, x1 + 6, y1, x1 + 6, y1 + 7, ccc);
@@ -4132,9 +4132,9 @@ void GriffonEngine::game_loadmap(int mapnum) {
rcDest.setHeight(8);
if (objectinfo[o][4] == 1)
- SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ SDL_FillRect(clipbg, &rcDest, ccc);
if (objectinfo[o][4] == 3)
- SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ SDL_FillRect(clipbg, &rcDest, ccc);
}
}
if (npc == 1) {
@@ -4459,7 +4459,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ SDL_FillRect(clipbg, &rcDest, ccc);
}
// academy crystal
@@ -4483,7 +4483,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ SDL_FillRect(clipbg, &rcDest, ccc);
}
// gardens master key
@@ -4507,7 +4507,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ SDL_FillRect(clipbg, &rcDest, ccc);
}
// gardens fidelis sword
@@ -4531,7 +4531,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ SDL_FillRect(clipbg, &rcDest, ccc);
}
// citadel armour
@@ -4555,7 +4555,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ SDL_FillRect(clipbg, &rcDest, ccc);
}
// citadel master key
@@ -4579,7 +4579,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ SDL_FillRect(clipbg, &rcDest, ccc);
}
@@ -4604,7 +4604,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ SDL_FillRect(clipbg, &rcDest, ccc);
}
if (curmap == 83 && scriptflag[16][0] == 1 && player.shield < 3) {
@@ -4627,7 +4627,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ SDL_FillRect(clipbg, &rcDest, ccc);
}
if (curmap == 83 && scriptflag[17][0] == 1 && player.armour < 3) {
@@ -4650,7 +4650,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ SDL_FillRect(clipbg, &rcDest, ccc);
}
SDL_BlitSurface(clipbg, NULL, clipbg2, NULL);
Commit: 70f61cda0b37bb2ccfb38e1246a6c33897494ac9
https://github.com/scummvm/scummvm/commit/70f61cda0b37bb2ccfb38e1246a6c33897494ac9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix collision detection
Changed paths:
engines/griffon/engine.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 5193e83..9f4b68d 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -4653,7 +4653,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
SDL_FillRect(clipbg, &rcDest, ccc);
}
- SDL_BlitSurface(clipbg, NULL, clipbg2, NULL);
+ clipbg2->copyRectToSurface(clipbg->getPixels(), clipbg->pitch, 0, 0, clipbg->w, clipbg->h);
}
void GriffonEngine::game_main() {
@@ -8496,7 +8496,7 @@ void GriffonEngine::sys_update() {
}
}
- SDL_BlitSurface(clipbg2, NULL, clipbg, NULL);
+ clipbg->copyRectToSurface(clipbg2->getPixels(), clipbg2->pitch, 0, 0, clipbg2->w, clipbg2->h);
Common::Rect rc;
Commit: 091789fb983c6c9271cab344ba2fed87001f0397
https://github.com/scummvm/scummvm/commit/091789fb983c6c9271cab344ba2fed87001f0397
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Replaced some SDL calls
Changed paths:
engines/griffon/engine.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 9f4b68d..5a6dbe2 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -102,7 +102,7 @@ int Mix_PlayChannel(int par1, Mix_Chunk *chunk, int par3) { return 0; }
void Mix_Pause(int channel) {}
void Mix_HaltChannel(int channel) {}
void Mix_Resume(int channel) {}
-void SDL_Flip(Graphics::TransparentSurface *src) { g_system->copyRectToScreen(src->getPixels(), src->pitch, 0, 0, src->w, src->h); g_system->updateScreen(); }
+
void SDL_BlitSurface(Graphics::TransparentSurface *src, Common::Rect *srcRect, Graphics::TransparentSurface *dst, Common::Rect *dstRect) {
assert(dst);
assert(src);
@@ -120,8 +120,6 @@ void SDL_FillRect(Graphics::TransparentSurface *surface, Common::Rect *rect, uin
surface->fillRect(Common::Rect(0, 0, surface->w, surface->h), color);
}
-int SDL_MapRGB(Graphics::PixelFormat format, int r, int g, int b) { return format.RGBToColor(r, g, b); }
-
Mix_Chunk *Mix_LoadWAV(const char *name) { return NULL; }
bool Mix_Playing(int channel) { return true; }
@@ -1470,10 +1468,9 @@ void GriffonEngine::game_configmenu() {
}
videobuffer->setAlpha((int)yy);
- SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
- videobuffer->setAlpha(255);
+ g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ g_system->updateScreen();
- SDL_Flip(video);
g_system->getEventManager()->pollEvent(event);
tickspassed = ticks;
@@ -1807,7 +1804,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ SDL_FillRect(clipbg2, &rcDest, clipbg->format.RGBToColor(255, 255, 255));
scriptflag[2][0] = 1;
}
}
@@ -1840,7 +1837,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
scriptflag[3][0] = 1;
- SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ SDL_FillRect(clipbg2, &rcDest, clipbg->format.RGBToColor(255, 255, 255));
}
}
@@ -1898,7 +1895,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
scriptflag[5][0] = 1;
- SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ SDL_FillRect(clipbg2, &rcDest, clipbg->format.RGBToColor(255, 255, 255));
}
}
@@ -1930,7 +1927,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ SDL_FillRect(clipbg2, &rcDest, clipbg->format.RGBToColor(255, 255, 255));
scriptflag[8][0] = 1;
}
}
@@ -1964,7 +1961,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
scriptflag[s][0] = 1;
- SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ SDL_FillRect(clipbg2, &rcDest, clipbg->format.RGBToColor(255, 255, 255));
}
}
}
@@ -2027,7 +2024,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
scriptflag[12][0] = 1;
- SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ SDL_FillRect(clipbg2, &rcDest, clipbg->format.RGBToColor(255, 255, 255));
}
}
@@ -2058,7 +2055,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ SDL_FillRect(clipbg2, &rcDest, clipbg->format.RGBToColor(255, 255, 255));
scriptflag[13][0] = 1;
}
}
@@ -2090,7 +2087,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ SDL_FillRect(clipbg2, &rcDest, clipbg->format.RGBToColor(255, 255, 255));
scriptflag[15][0] = 1;
cx = 9;
@@ -2111,7 +2108,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ SDL_FillRect(clipbg2, &rcDest, clipbg->format.RGBToColor(255, 255, 255));
scriptflag[16][0] = 1;
@@ -2133,7 +2130,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg2, &rcDest, SDL_MapRGB(clipbg->format, 255, 255, 255));
+ SDL_FillRect(clipbg2, &rcDest, clipbg->format.RGBToColor(255, 255, 255));
scriptflag[17][0] = 1;
}
}
@@ -2248,7 +2245,7 @@ int hud_recalc(int a, int b, int c) {
return result > b ? b : result;
}
-#define RGB(R, G, B) (SDL_MapRGB(videobuffer->format, (R), (G), (B)))
+#define RGB(R, G, B) (videobuffer->format.RGBToColor((R), (G), (B)))
void GriffonEngine::game_drawhud() {
char line[128];
@@ -2369,7 +2366,7 @@ void GriffonEngine::game_drawhud() {
amap = 1;
SDL_BlitSurface(mapimg[amap], NULL, videobuffer, &rcDest);
- ccc = SDL_MapRGB(videobuffer->format, 128 + 127 * sin(3.141592 * 2 * itemyloc / 16), 0, 0);
+ ccc = videobuffer->format.RGBToColor(128 + 127 * sin(3.141592 * 2 * itemyloc / 16), 0, 0);
for (int b = 0; b <= 6; b++) {
for (int a = 0; a <= 12; a++) {
@@ -2513,7 +2510,7 @@ void GriffonEngine::game_drawhud() {
void GriffonEngine::game_drawnpcs(int mode) {
unsigned int ccc;
- ccc = SDL_MapRGB(videobuffer->format, 255, 128, 32);
+ ccc = videobuffer->format.RGBToColor(255, 128, 32);
int fst = firsty;
int lst = lasty;
@@ -3169,15 +3166,15 @@ void GriffonEngine::game_drawplayer() {
}
- ccc = SDL_MapRGB(videobuffer->format, 224, 224, 64);
+ ccc = videobuffer->format.RGBToColor(224, 224, 64);
int pass = 0;
if (player.hp <= player.maxhp * 0.25)
pass = 1;
if (pass == 1) {
- ccc = SDL_MapRGB(videobuffer->format, 255, 255, 255);
- if ((int)(player.hpflash) == 1) ccc = SDL_MapRGB(videobuffer->format, 255, 0, 0);
+ ccc = videobuffer->format.RGBToColor(255, 255, 255);
+ if ((int)(player.hpflash) == 1) ccc = videobuffer->format.RGBToColor(255, 0, 0);
}
int sss = 6;
@@ -3207,9 +3204,9 @@ void GriffonEngine::game_drawplayer() {
SDL_FillRect(videobuffer, &rcDest, ccc);
- ccc = SDL_MapRGB(videobuffer->format, 0, 224, 64);
+ ccc = videobuffer->format.RGBToColor(0, 224, 64);
if (player.attackstrength == 100)
- ccc = SDL_MapRGB(videobuffer->format, 255, 128, 32);
+ ccc = videobuffer->format.RGBToColor(255, 128, 32);
ww = 14 * player.attackstrength / 100;
if (ww > 14)
@@ -3225,9 +3222,9 @@ void GriffonEngine::game_drawplayer() {
SDL_FillRect(videobuffer, &rcDest, ccc);
- ccc = SDL_MapRGB(videobuffer->format, 128, 0, 224);
+ ccc = videobuffer->format.RGBToColor(128, 0, 224);
if (player.spellstrength == 100)
- ccc = SDL_MapRGB(videobuffer->format, 224, 0, 0);
+ ccc = videobuffer->format.RGBToColor(224, 0, 0);
rcDest.top = rcDest.top + 2;
rcDest.setWidth(ww2);
@@ -3324,10 +3321,10 @@ void GriffonEngine::game_endofgame() {
videobuffer->setAlpha(ya);
SDL_BlitSurface(videobuffer2, NULL, videobuffer3, NULL);
SDL_BlitSurface(videobuffer, NULL, videobuffer3, NULL);
- SDL_BlitSurface(videobuffer3, NULL, video, NULL);
- videobuffer->setAlpha(255);
- SDL_Flip(video);
+ g_system->copyRectToScreen(videobuffer3->getPixels(), videobuffer3->pitch, 0, 0, videobuffer3->w, videobuffer3->h);
+ g_system->updateScreen();
+
g_system->getEventManager()->pollEvent(event);
g_system->delayMillis(10);
@@ -3384,10 +3381,9 @@ void GriffonEngine::game_endofgame() {
}
videobuffer->setAlpha(ya);
- SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
- videobuffer->setAlpha(255);
+ g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ g_system->updateScreen();
- SDL_Flip(video);
g_system->getEventManager()->pollEvent(event);
g_system->delayMillis(10);
@@ -3442,10 +3438,10 @@ void GriffonEngine::game_endofgame() {
videobuffer->setAlpha(y1);
SDL_BlitSurface(videobuffer2, NULL, videobuffer3, NULL);
SDL_BlitSurface(videobuffer, NULL, videobuffer3, NULL);
- SDL_BlitSurface(videobuffer3, NULL, video, NULL);
- videobuffer->setAlpha(255);
- SDL_Flip(video);
+ g_system->copyRectToScreen(videobuffer3->getPixels(), videobuffer3->pitch, 0, 0, videobuffer3->w, videobuffer3->h);
+ g_system->updateScreen();
+
g_system->getEventManager()->pollEvent(event);
g_system->delayMillis(10);
@@ -3482,10 +3478,9 @@ void GriffonEngine::game_endofgame() {
}
videobuffer->setAlpha(y1);
- SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
- videobuffer->setAlpha(255);
+ g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ g_system->updateScreen();
- SDL_Flip(video);
g_system->getEventManager()->pollEvent(event);
g_system->delayMillis(10);
@@ -3551,10 +3546,9 @@ void GriffonEngine::game_eventtext(const char *stri) {
if (pauseticks < ticks)
sys_print(videobuffer, stri, x, 15, 0);
- windowimg->setAlpha(255, true);
- SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
+ g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ g_system->updateScreen();
- SDL_Flip(video);
g_system->getEventManager()->pollEvent(event);
g_system->delayMillis(10);
@@ -3853,7 +3847,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
char name[256];
int tempmap[320][200];
- ccc = SDL_MapRGB(clipbg->format, 255, 255, 255);
+ ccc = clipbg->format.RGBToColor(255, 255, 255);
curmap = mapnum;
@@ -4732,8 +4726,8 @@ void GriffonEngine::game_newgame() {
goto __exit_do;
}
- SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
- SDL_Flip(video);
+ g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ g_system->updateScreen();
tickspassed = ticks;
ticks = g_system->getMillis();
@@ -5228,10 +5222,9 @@ void GriffonEngine::game_saveloadnew() {
}
videobuffer->setAlpha((int)yy);
- SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
- videobuffer->setAlpha(255);
+ g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ g_system->updateScreen();
- SDL_Flip(video);
g_system->getEventManager()->pollEvent(event);
tickspassed = ticks;
@@ -5329,9 +5322,10 @@ void GriffonEngine::game_swash() {
videobuffer->setAlpha((int)y);
SDL_FillRect(videobuffer, NULL, 0);
- SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
- SDL_Flip(video);
+ g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ g_system->updateScreen();
+
g_system->getEventManager()->pollEvent(event);
g_system->delayMillis(10);
@@ -5372,8 +5366,9 @@ void GriffonEngine::game_swash() {
SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
}
- SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
- SDL_Flip(video);
+ g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ g_system->updateScreen();
+
g_system->getEventManager()->pollEvent(event);
g_system->delayMillis(10);
@@ -5411,9 +5406,9 @@ void GriffonEngine::game_theend() {
for (float y = 0; y < 100; y += fpsr) {
videobuffer->setAlpha((int)y);
SDL_FillRect(videobuffer, NULL, 0);
- SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
+ g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ g_system->updateScreen();
- SDL_Flip(video);
g_system->getEventManager()->pollEvent(event);
g_system->delayMillis(10);
@@ -5525,8 +5520,8 @@ void GriffonEngine::game_title(int mode) {
}
videobuffer->setAlpha((int)yf);
- SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
- videobuffer->setAlpha(255);
+ g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ g_system->updateScreen();
tickspassed = ticks;
ticks = g_system->getMillis();
@@ -5593,7 +5588,6 @@ void GriffonEngine::game_title(int mode) {
}
}
- SDL_Flip(video);
g_system->delayMillis(10);
} while (!_shouldQuit);
@@ -7375,9 +7369,9 @@ void GriffonEngine::game_updspells() {
// lightning bomb
if (spellnum == 8) {
- cl1 = SDL_MapRGB(videobuffer->format, 0, 32, 204);
- cl2 = SDL_MapRGB(videobuffer->format, 142, 173, 191);
- cl3 = SDL_MapRGB(videobuffer->format, 240, 240, 240);
+ cl1 = videobuffer->format.RGBToColor(0, 32, 204);
+ cl2 = videobuffer->format.RGBToColor(142, 173, 191);
+ cl3 = videobuffer->format.RGBToColor(240, 240, 240);
float px = player.px + 12;
float py = player.py + 12;
@@ -7627,9 +7621,9 @@ void GriffonEngine::game_updspells() {
// wizard 1 lightning
if (spellnum == 9) {
- cl1 = SDL_MapRGB(videobuffer->format, 0, 32, 204);
- cl2 = SDL_MapRGB(videobuffer->format, 142, 173, 191);
- cl3 = SDL_MapRGB(videobuffer->format, 240, 240, 240);
+ cl1 = videobuffer->format.RGBToColor(0, 32, 204);
+ cl2 = videobuffer->format.RGBToColor(142, 173, 191);
+ cl3 = videobuffer->format.RGBToColor(240, 240, 240);
int px = spellinfo[i].enemyx + 12;
int py = spellinfo[i].enemyy + 24;
@@ -8305,12 +8299,14 @@ void GriffonEngine::sys_print(Graphics::TransparentSurface *buffer, const char *
void GriffonEngine::sys_progress(int w, int wm) {
long ccc;
- ccc = SDL_MapRGB(videobuffer->format, 0, 255, 0);
+ ccc = videobuffer->format.RGBToColor(0, 255, 0);
rcDest.setWidth(w * 74 / wm);
SDL_FillRect(videobuffer, &rcDest, ccc);
- SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
- SDL_Flip(video);
+
+ g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ g_system->updateScreen();
+
g_system->getEventManager()->pollEvent(event);
}
@@ -8340,10 +8336,9 @@ void GriffonEngine::sys_setupAudio() {
loadimg->setAlpha(160, true); // 128
SDL_BlitSurface(loadimg, &rcSrc, videobuffer, &rcDest);
- loadimg->setAlpha(255, true);
- SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
- SDL_Flip(video);
+ g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ g_system->updateScreen();
rcDest.left = 160 - 44 + 7;
rcDest.top = 116 + 12 + 12;
@@ -8402,7 +8397,8 @@ void GriffonEngine::sys_update() {
int pa, sx, sy;
float opx, opy, spd;
- SDL_Flip(video);
+ g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ g_system->updateScreen();
g_system->getEventManager()->pollEvent(event);
tickspassed = ticks;
Commit: 1b102b3aa8fb7887db72b3b47f8d2aa13a6f04b1
https://github.com/scummvm/scummvm/commit/1b102b3aa8fb7887db72b3b47f8d2aa13a6f04b1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Replaced rest of the SDL calls
Changed paths:
engines/griffon/engine.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 5a6dbe2..d339ace 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -102,24 +102,6 @@ int Mix_PlayChannel(int par1, Mix_Chunk *chunk, int par3) { return 0; }
void Mix_Pause(int channel) {}
void Mix_HaltChannel(int channel) {}
void Mix_Resume(int channel) {}
-
-void SDL_BlitSurface(Graphics::TransparentSurface *src, Common::Rect *srcRect, Graphics::TransparentSurface *dst, Common::Rect *dstRect) {
- assert(dst);
- assert(src);
- if (dstRect) {
- if (dstRect->left >= 320 || dstRect->top >= 240)
- return;
- }
- src->blit(*dst, dstRect ? dstRect->left : 0, dstRect ? dstRect->top : 0, Graphics::FLIP_NONE, srcRect);
-}
-
-void SDL_FillRect(Graphics::TransparentSurface *surface, Common::Rect *rect, uint32 color) {
- if (rect)
- surface->fillRect(*rect, color);
- else
- surface->fillRect(Common::Rect(0, 0, surface->w, surface->h), color);
-}
-
Mix_Chunk *Mix_LoadWAV(const char *name) { return NULL; }
bool Mix_Playing(int channel) { return true; }
@@ -413,12 +395,6 @@ int invmap[4][7][13] = {
// CODE GOES HERE -------------------------------------------------------------
-#define SDL_BLITVIDEO(X, Y, C, F) sdl_blitscale((X), (Y), (C), NULL)
-
-void sdl_blitscale(Graphics::TransparentSurface *src, Common::Rect *srcrect, Graphics::TransparentSurface *dst, Common::Rect *dstrect) {
- src->blit(*dst);
-}
-
void game_fillrect(Graphics::TransparentSurface *surface, int x, int y, int w, int h, int color) {
surface->fillRect(Common::Rect(x, y, x + w, y + h), color);
}
@@ -1335,7 +1311,7 @@ void GriffonEngine::game_configmenu() {
ticks1 = ticks;
do {
- SDL_FillRect(videobuffer, NULL, 0);
+ videobuffer->fillRect(Common::Rect(0, 0, videobuffer->w, videobuffer->h), 0);
rcDest.left = 256 + 256 * cos(3.141592 / 180 * clouddeg * 40);
rcDest.top = 192 + 192 * sin(3.141592 / 180 * clouddeg * 40);
@@ -1343,7 +1319,7 @@ void GriffonEngine::game_configmenu() {
rcDest.setHeight(240);
cloudimg->setAlpha(128, true);
- SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
+ cloudimg->blit(*videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
cloudimg->setAlpha(64, true);
rcDest.left = 256;
@@ -1352,10 +1328,10 @@ void GriffonEngine::game_configmenu() {
rcDest.setHeight(240);
cloudimg->setAlpha(128, true);
- SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
+ cloudimg->blit(*videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
cloudimg->setAlpha(64, true);
- SDL_BlitSurface(configwindow, NULL, videobuffer, NULL);
+ configwindow->blit(*videobuffer);
int sy = SY;
@@ -1456,7 +1432,7 @@ void GriffonEngine::game_configmenu() {
rc.left = 148 + 3 * cos(3.14159 * 2 * itemyloc / 16.0);
rc.top = sy + 8 * curselt - 4;
- SDL_BlitSurface(itemimg[15], NULL, videobuffer, &rc);
+ itemimg[15]->blit(*videobuffer, rc.left, rc.top);
float yy = 255.0;
if (ticks < ticks1 + 1000) {
@@ -1804,7 +1780,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg2, &rcDest, clipbg->format.RGBToColor(255, 255, 255));
+ clipbg2->fillRect(rcDest, clipbg->format.RGBToColor(255, 255, 255));
scriptflag[2][0] = 1;
}
}
@@ -1837,7 +1813,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
scriptflag[3][0] = 1;
- SDL_FillRect(clipbg2, &rcDest, clipbg->format.RGBToColor(255, 255, 255));
+ clipbg2->fillRect(rcDest, clipbg->format.RGBToColor(255, 255, 255));
}
}
@@ -1864,7 +1840,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
rcDest.setWidth(16);
rcDest.setHeight(16);
- SDL_BlitSurface(tiles[curtilel], &rcSrc, mapbg, &rcDest);
+ tiles[curtilel]->blit(*mapbg, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
// firehydra sword chest
@@ -1895,7 +1871,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
scriptflag[5][0] = 1;
- SDL_FillRect(clipbg2, &rcDest, clipbg->format.RGBToColor(255, 255, 255));
+ clipbg2->fillRect(rcDest, clipbg->format.RGBToColor(255, 255, 255));
}
}
@@ -1927,7 +1903,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg2, &rcDest, clipbg->format.RGBToColor(255, 255, 255));
+ clipbg2->fillRect(rcDest, clipbg->format.RGBToColor(255, 255, 255));
scriptflag[8][0] = 1;
}
}
@@ -1961,7 +1937,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
scriptflag[s][0] = 1;
- SDL_FillRect(clipbg2, &rcDest, clipbg->format.RGBToColor(255, 255, 255));
+ clipbg2->fillRect(rcDest, clipbg->format.RGBToColor(255, 255, 255));
}
}
}
@@ -2024,7 +2000,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
scriptflag[12][0] = 1;
- SDL_FillRect(clipbg2, &rcDest, clipbg->format.RGBToColor(255, 255, 255));
+ clipbg2->fillRect(rcDest, clipbg->format.RGBToColor(255, 255, 255));
}
}
@@ -2055,7 +2031,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg2, &rcDest, clipbg->format.RGBToColor(255, 255, 255));
+ clipbg2->fillRect(rcDest, clipbg->format.RGBToColor(255, 255, 255));
scriptflag[13][0] = 1;
}
}
@@ -2087,7 +2063,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg2, &rcDest, clipbg->format.RGBToColor(255, 255, 255));
+ clipbg2->fillRect(rcDest, clipbg->format.RGBToColor(255, 255, 255));
scriptflag[15][0] = 1;
cx = 9;
@@ -2108,7 +2084,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg2, &rcDest, clipbg->format.RGBToColor(255, 255, 255));
+ clipbg2->fillRect(rcDest, clipbg->format.RGBToColor(255, 255, 255));
scriptflag[16][0] = 1;
@@ -2130,7 +2106,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg2, &rcDest, clipbg->format.RGBToColor(255, 255, 255));
+ clipbg2->fillRect(rcDest, clipbg->format.RGBToColor(255, 255, 255));
scriptflag[17][0] = 1;
}
}
@@ -2192,7 +2168,7 @@ void GriffonEngine::game_drawanims(int Layer) {
rcDest.setWidth(16);
rcDest.setHeight(16);
- SDL_BlitSurface(tiles[curtilel], &rcSrc, videobuffer, &rcDest);
+ tiles[curtilel]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
if (Layer == 1) {
@@ -2228,7 +2204,7 @@ void GriffonEngine::game_drawanims(int Layer) {
}
if (pass == 1)
- SDL_BlitSurface(tiles[curtilel], &rcSrc, videobuffer, &rcDest);
+ tiles[curtilel]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
}
@@ -2288,7 +2264,7 @@ void GriffonEngine::game_drawhud() {
rcDest.top = iy;
if (ico != 99)
- SDL_BlitSurface(itemimg[ico], NULL, videobuffer, &rcDest);
+ itemimg[ico]->blit(*videobuffer, rcDest.left, rcDest.top);
if (ico == 99) {
spellimg->setAlpha((int)(RND() * 96) + 96, true);
@@ -2300,7 +2276,7 @@ void GriffonEngine::game_drawhud() {
rcDest.left = ix;
rcDest.top = iy;
- SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+ spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
spellimg->setAlpha(255, true);
}
@@ -2321,7 +2297,7 @@ void GriffonEngine::game_drawhud() {
rcSrc.left = rcSrc.left + 17;
if (player.foundspell[i] == 1) {
- SDL_BlitSurface(itemimg[7 + i], NULL, videobuffer, &rcSrc);
+ itemimg[7 + i]->blit(*videobuffer, rcSrc.left, rcSrc.top);
game_fillrect(videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32));
game_fillrect(videobuffer, rcSrc.left + 1, sy + 17,
@@ -2338,16 +2314,16 @@ void GriffonEngine::game_drawhud() {
rcDest.top = 0;
rcDest.right = 320;
rcDest.bottom = 240;
- SDL_FillRect(videobuffer2, &rcDest, 0);
+ videobuffer2->fillRect(rcDest, 0);
videobuffer2->setAlpha((int)(player.itemselshade * 4)); // FIXME
- SDL_BlitSurface(videobuffer2, NULL, videobuffer, NULL);
+ videobuffer2->blit(*videobuffer);
int sy = 202;
rcSrc.left = 46;
rcSrc.top = 46;
inventoryimg->setAlpha(160, true); // 128
- SDL_BlitSurface(inventoryimg, NULL, videobuffer, &rcSrc);
+ inventoryimg->blit(*videobuffer, rcSrc.left, rcSrc.top);
inventoryimg->setAlpha(255, true);
int sx = 54;
@@ -2364,7 +2340,7 @@ void GriffonEngine::game_drawhud() {
amap = 3;
if (curmap > 5 && curmap < 42)
amap = 1;
- SDL_BlitSurface(mapimg[amap], NULL, videobuffer, &rcDest);
+ mapimg[amap]->blit(*videobuffer, rcDest.left, rcDest.top);
ccc = videobuffer->format.RGBToColor(128 + 127 * sin(3.141592 * 2 * itemyloc / 16), 0, 0);
@@ -2424,19 +2400,19 @@ void GriffonEngine::game_drawhud() {
int ss = (player.sword - 1) * 3;
if (player.sword == 3)
ss = 18;
- SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
+ itemimg[ss]->blit(*videobuffer, rcSrc.left, rcSrc.top);
rcSrc.left = rcSrc.left + 16;
ss = (player.shield - 1) * 3 + 1;
if (player.shield == 3)
ss = 19;
- SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
+ itemimg[ss]->blit(*videobuffer, rcSrc.left, rcSrc.top);
rcSrc.left = rcSrc.left + 16;
ss = (player.armour - 1) * 3 + 2;
if (player.armour == 3)
ss = 20;
- SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
+ itemimg[ss]->blit(*videobuffer, rcSrc.left, rcSrc.top);
for (int i = 0; i <= 4; i++) {
sx = 188;
@@ -2444,15 +2420,15 @@ void GriffonEngine::game_drawhud() {
rcSrc.left = sx;
rcSrc.top = sy;
if (i == 0)
- SDL_BlitSurface(itemimg[6], NULL, videobuffer, &rcSrc);
+ itemimg[6]->blit(*videobuffer, rcSrc.left, rcSrc.top);
if (i == 1)
- SDL_BlitSurface(itemimg[12], NULL, videobuffer, &rcSrc);
+ itemimg[12]->blit(*videobuffer, rcSrc.left, rcSrc.top);
if (i == 2)
- SDL_BlitSurface(itemimg[17], NULL, videobuffer, &rcSrc);
+ itemimg[17]->blit(*videobuffer, rcSrc.left, rcSrc.top);
if (i == 3)
- SDL_BlitSurface(itemimg[16], NULL, videobuffer, &rcSrc);
+ itemimg[16]->blit(*videobuffer, rcSrc.left, rcSrc.top);
if (i == 4)
- SDL_BlitSurface(itemimg[14], NULL, videobuffer, &rcSrc);
+ itemimg[14]->blit(*videobuffer, rcSrc.left, rcSrc.top);
sprintf(line, "x%i", player.inventory[i]);
sys_print(videobuffer, line, sx + 17, sy + 7, 0);
@@ -2466,7 +2442,7 @@ void GriffonEngine::game_drawhud() {
sy = rcSrc.top;
if (player.foundspell[i] == 1) {
- SDL_BlitSurface(itemimg[7 + i], NULL, videobuffer, &rcSrc);
+ itemimg[7 + i]->blit(*videobuffer, rcSrc.left, rcSrc.top);
game_fillrect(videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32));
game_fillrect(videobuffer, rcSrc.left + 1, sy + 17,
@@ -2481,13 +2457,13 @@ void GriffonEngine::game_drawhud() {
if (curitem == 5 + i) {
rcDest.left = (float)(243 - 12 + 3 * sin(3.141592 * 2 * itemyloc / 16));
rcDest.top = 67 + 24 * i;
- SDL_BlitSurface(itemimg[15], NULL, videobuffer, &rcDest);
+ itemimg[15]->blit(*videobuffer, rcDest.left, rcDest.top);
}
if (curitem == i) {
rcDest.left = (float)(189 - 12 + 3 * sin(3.141592 * 2 * itemyloc / 16));
rcDest.top = 70 + 24 * i;
- SDL_BlitSurface(itemimg[15], NULL, videobuffer, &rcDest);
+ itemimg[15]->blit(*videobuffer, rcDest.left, rcDest.top);
}
}
}
@@ -2503,7 +2479,7 @@ void GriffonEngine::game_drawhud() {
rcDest.top = (float)(npcinfo[curenemy].y + 4 - 16 - sin(3.141592 / 8 * itemyloc));
}
- SDL_BlitSurface(itemimg[13], NULL, videobuffer, &rcDest);
+ itemimg[13]->blit(*videobuffer, rcDest.left, rcDest.top);
}
}
@@ -2556,7 +2532,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.top += (int)(RND() * 3) - 1;
}
- SDL_BlitSurface(anims[sprite], &rcSrc, videobuffer, &rcDest);
+ anims[sprite]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
int cframe = npcinfo[i].cattackframe;
@@ -2570,7 +2546,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.setWidth(24);
rcDest.setHeight(24);
- SDL_BlitSurface(animsa[sprite], &rcSrc, videobuffer, &rcDest);
+ animsa[sprite]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -2587,7 +2563,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = npcinfo[i].bodysection[f].x - animset2[s].xofs;
rcDest.top = npcinfo[i].bodysection[f].y - animset2[s].yofs + 2;
- SDL_BlitSurface(anims[2], &rcSrc, videobuffer, &rcDest);
+ anims[2]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -2608,7 +2584,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = npcinfo[i].bodysection[f].x - animset9[s].xofs;
rcDest.top = npcinfo[i].bodysection[f].y - animset9[s].yofs + 2;
- SDL_BlitSurface(anims[9], &rcSrc, videobuffer, &rcDest);
+ anims[9]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -2627,7 +2603,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = npx - 2;
rcDest.top = npy - 24;
- SDL_BlitSurface(anims[3], &rcSrc, videobuffer, &rcDest);
+ anims[3]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
rcSrc.left = 4 * 24;
rcSrc.top = 0;
@@ -2637,7 +2613,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = npx - 2;
rcDest.top = npy - 24;
- SDL_BlitSurface(anims[3], &rcSrc, videobuffer, &rcDest);
+ anims[3]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -2655,7 +2631,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = npx - 2;
rcDest.top = npy - 24;
- SDL_BlitSurface(anims[4], &rcSrc, videobuffer, &rcDest);
+ anims[4]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
rcSrc.left = 4 * 24;
rcSrc.top = 0;
@@ -2665,7 +2641,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = npx - 2;
rcDest.top = npy - 24;
- SDL_BlitSurface(anims[4], &rcSrc, videobuffer, &rcDest);
+ anims[4]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -2686,7 +2662,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (x > 255)
x = 255;
spellimg->setAlpha(x, true);
- SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+ spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
spellimg->setAlpha(255, true);
for (int f = 1; f <= 8; f++) {
@@ -2702,7 +2678,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (x > 255)
x = 255;
spellimg->setAlpha(x, true);
- SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+ spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
spellimg->setAlpha(255, true);
}
@@ -2715,7 +2691,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.top = npcinfo[i].bodysection[10 * ff + 9].y - 21;
spellimg->setAlpha(192, true);
- SDL_BlitSurface(anims[5], &rcSrc, videobuffer, &rcDest);
+ anims[5]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
spellimg->setAlpha(255, true);
}
@@ -2743,7 +2719,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
- SDL_BlitSurface(anims[sprite], &rcSrc, videobuffer, &rcDest);
+ anims[sprite]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
// wizard
@@ -2766,7 +2742,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
- SDL_BlitSurface(anims[sprite], &rcSrc, videobuffer, &rcDest);
+ anims[sprite]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
// } else {
//cframe = npcinfo[i].cattackframe;
@@ -2779,7 +2755,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
//rcDest.top = npy;
//rcDest.setWidth(24);
//rcDest.setHeight(24);
- // SDL_BlitSurface(animsa(sprite), &rcSrc, videobuffer, &rcDest);
+ // animsa(sprite)->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
// }
}
@@ -2803,7 +2779,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
- SDL_BlitSurface(anims[sprite], &rcSrc, videobuffer, &rcDest);
+ anims[sprite]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
@@ -2848,7 +2824,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
- SDL_BlitSurface(anims[sprite], &rcSrc, videobuffer, &rcDest);
+ anims[sprite]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
npcinfo[i].floating = npcinfo[i].floating + 0.25 * fpsr;
while (npcinfo[i].floating >= 16)
@@ -2866,7 +2842,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.setWidth(24);
rcDest.setHeight(24);
- SDL_BlitSurface(animsa[sprite], &rcSrc, videobuffer, &rcDest);
+ animsa[sprite]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -2900,7 +2876,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = sx + 32 + (int)(RND() * 3) - 1;
rcDest.top = sy - (int)(RND() * 6);
- SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+ spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
for (int ii = 0; ii <= 8; ii++) {
@@ -2919,7 +2895,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
spellimg->setAlpha(i2 / 3 * 224, true);
- SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+ spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
int xloc = rcDest.left;
int yloc = rcDest.top;
@@ -2945,7 +2921,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
spellimg->setAlpha(i2 / 3 * 224, true);
- SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+ spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
xloc = rcDest.left;
yloc = rcDest.top;
@@ -2984,7 +2960,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = rcDest.top + (int)(RND() * 3) - 1;
}
- SDL_BlitSurface(anims[sprite], &rcSrc, videobuffer, &rcDest);
+ anims[sprite]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
int cframe = (int)(npcinfo[i].cattackframe);
@@ -2996,7 +2972,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = sx;
rcDest.top = sy;
- SDL_BlitSurface(animsa[sprite], &rcSrc, videobuffer, &rcDest);
+ animsa[sprite]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -3040,7 +3016,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
- SDL_BlitSurface(anims[sprite], &rcSrc, videobuffer, &rcDest);
+ anims[sprite]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
rcDest.left = npx + 4;
@@ -3048,7 +3024,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.setWidth(16);
rcDest.setHeight(4);
- SDL_FillRect(videobuffer, &rcDest, 0);
+ videobuffer->fillRect(rcDest, 0);
rcDest.left = npx + 5;
rcDest.top = npy + 23;
@@ -3064,7 +3040,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.setHeight(2);
- SDL_FillRect(videobuffer, &rcDest, ccc);
+ videobuffer->fillRect(rcDest, ccc);
int pass = 1;
@@ -3125,7 +3101,7 @@ void GriffonEngine::game_drawover(int modx, int mody) {
}
if (pass == 1)
- SDL_BlitSurface(tiles[curtilel], &rcSrc, videobuffer, &rcDest);
+ tiles[curtilel]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
}
@@ -3150,7 +3126,7 @@ void GriffonEngine::game_drawplayer() {
rcDest.setWidth(24);
rcDest.setHeight(24);
- SDL_BlitSurface(anims[f], &rcSrc, videobuffer, &rcDest);
+ anims[f]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
rcSrc.left = (int)(player.attackframe / 4) * 24;
rcSrc.top = player.walkdir * 24;
@@ -3162,7 +3138,7 @@ void GriffonEngine::game_drawplayer() {
rcDest.setWidth(24);
rcDest.setHeight(24);
- SDL_BlitSurface(animsa[f], &rcSrc, videobuffer, &rcDest);
+ animsa[f]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
@@ -3187,7 +3163,7 @@ void GriffonEngine::game_drawplayer() {
rcDest.setWidth(16);
rcDest.setHeight(sss);
- SDL_FillRect(videobuffer, &rcDest, 0);
+ videobuffer->fillRect(rcDest, 0);
rcDest.left = npx + 5;
rcDest.top = npy + 23;
@@ -3202,7 +3178,7 @@ void GriffonEngine::game_drawplayer() {
rcDest.setWidth(ww);
rcDest.setHeight(2);
- SDL_FillRect(videobuffer, &rcDest, ccc);
+ videobuffer->fillRect(rcDest, ccc);
ccc = videobuffer->format.RGBToColor(0, 224, 64);
if (player.attackstrength == 100)
@@ -3220,7 +3196,7 @@ void GriffonEngine::game_drawplayer() {
rcDest.setWidth(ww);
rcDest.setHeight(2);
- SDL_FillRect(videobuffer, &rcDest, ccc);
+ videobuffer->fillRect(rcDest, ccc);
ccc = videobuffer->format.RGBToColor(128, 0, 224);
if (player.spellstrength == 100)
@@ -3230,13 +3206,13 @@ void GriffonEngine::game_drawplayer() {
rcDest.setWidth(ww2);
rcDest.setHeight(2);
- SDL_FillRect(videobuffer, &rcDest, ccc);
+ videobuffer->fillRect(rcDest, ccc);
}
void GriffonEngine::game_drawview() {
Common::Rect rc;
- SDL_BlitSurface(mapbg, NULL, videobuffer, NULL);
+ mapbg->blit(*videobuffer);
game_updspellsunder();
@@ -3263,12 +3239,12 @@ void GriffonEngine::game_drawview() {
rc.setWidth(320);
rc.setHeight(240);
- SDL_BlitSurface(cloudimg, &rc, videobuffer, NULL);
+ cloudimg->blit(*videobuffer, 0, 0, Graphics::FLIP_NONE, &rc);
}
game_drawhud();
- SDL_BLITVIDEO(videobuffer, NULL, video, NULL);
+ g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
}
void GriffonEngine::game_endofgame() {
@@ -3288,9 +3264,9 @@ void GriffonEngine::game_endofgame() {
ticks1 = ticks;
int ya = 0;
- SDL_FillRect(videobuffer2, NULL, 0);
- SDL_FillRect(videobuffer3, NULL, 0);
- SDL_BlitSurface(videobuffer, NULL, videobuffer2, NULL);
+ videobuffer2->fillRect(Common::Rect(0, 0, videobuffer2->w, videobuffer2->h), 0);
+ videobuffer3->fillRect(Common::Rect(0, 0, videobuffer3->w, videobuffer3->h), 0);
+ videobuffer->blit(*videobuffer2);
float ld = 0;
int ldstop = 0;
@@ -3316,11 +3292,11 @@ void GriffonEngine::game_endofgame() {
break;
}
- SDL_FillRect(videobuffer, NULL, 0);
+ videobuffer->fillRect(Common::Rect(0, 0, videobuffer->w, videobuffer->h), 0);
videobuffer->setAlpha(ya);
- SDL_BlitSurface(videobuffer2, NULL, videobuffer3, NULL);
- SDL_BlitSurface(videobuffer, NULL, videobuffer3, NULL);
+ videobuffer2->blit(*videobuffer3);
+ videobuffer->blit(*videobuffer3);
g_system->copyRectToScreen(videobuffer3->getPixels(), videobuffer3->pitch, 0, 0, videobuffer3->w, videobuffer3->h);
g_system->updateScreen();
@@ -3352,12 +3328,12 @@ void GriffonEngine::game_endofgame() {
rc.left = -xofs;
rc.top = 0;
- SDL_BlitSurface(titleimg, NULL, videobuffer, &rc);
+ titleimg->blit(*videobuffer, rc.left, rc.top);
rc.left = -xofs + 320;
rc.top = 0;
- SDL_BlitSurface(titleimg, NULL, videobuffer, &rc);
+ titleimg->blit(*videobuffer, rc.left, rc.top);
y = y - spd * fpsr;
for (int i = 0; i <= 26; i++) {
@@ -3420,7 +3396,7 @@ void GriffonEngine::game_endofgame() {
ticks1 = ticks;
int y1 = 0;
- SDL_BlitSurface(videobuffer, NULL, videobuffer2, NULL);
+ videobuffer->blit(*videobuffer2);
do {
if (ticks < ticks1 + 1500) {
@@ -3433,11 +3409,11 @@ void GriffonEngine::game_endofgame() {
break;
}
- SDL_FillRect(videobuffer, NULL, 0);
+ videobuffer->fillRect(Common::Rect(0, 0, videobuffer->w, videobuffer->h), 0);
videobuffer->setAlpha(y1);
- SDL_BlitSurface(videobuffer2, NULL, videobuffer3, NULL);
- SDL_BlitSurface(videobuffer, NULL, videobuffer3, NULL);
+ videobuffer2->blit(*videobuffer3);
+ videobuffer->blit(*videobuffer3);
g_system->copyRectToScreen(videobuffer3->getPixels(), videobuffer3->pitch, 0, 0, videobuffer3->w, videobuffer3->h);
g_system->updateScreen();
@@ -3466,7 +3442,7 @@ void GriffonEngine::game_endofgame() {
y1 = 0;
do {
- SDL_BlitSurface(theendimg, NULL, videobuffer, NULL);
+ theendimg->blit(*videobuffer);
y1 = 255;
if (ticks < ticks1 + 1000) {
@@ -3504,8 +3480,8 @@ void GriffonEngine::game_endofgame() {
} while (1);
- SDL_FillRect(videobuffer2, NULL, 0);
- SDL_FillRect(videobuffer3, NULL, 0);
+ videobuffer2->fillRect(Common::Rect(0, 0, videobuffer2->w, videobuffer2->h), 0);
+ videobuffer3->fillRect(Common::Rect(0, 0, videobuffer3->w, videobuffer3->h), 0);
game_theend();
@@ -3514,8 +3490,8 @@ void GriffonEngine::game_endofgame() {
void GriffonEngine::game_eventtext(const char *stri) {
int x, fr, pauseticks, bticks;
- SDL_FillRect(videobuffer2, NULL, 0);
- SDL_FillRect(videobuffer3, NULL, 0);
+ videobuffer2->fillRect(Common::Rect(0, 0, videobuffer2->w, videobuffer2->h), 0);
+ videobuffer3->fillRect(Common::Rect(0, 0, videobuffer3->w, videobuffer3->h), 0);
x = 160 - 4 * strlen(stri);
@@ -3523,15 +3499,15 @@ void GriffonEngine::game_eventtext(const char *stri) {
pauseticks = ticks + 500;
bticks = ticks;
- SDL_BlitSurface(videobuffer, NULL, videobuffer3, NULL);
- SDL_BlitSurface(videobuffer, NULL, videobuffer2, NULL);
+ videobuffer->blit(*videobuffer3);
+ videobuffer->blit(*videobuffer2);
do {
g_system->getEventManager()->pollEvent(event);
if (event.type == Common::EVENT_KEYDOWN && pauseticks < ticks)
break;
- SDL_BlitSurface(videobuffer2, NULL, videobuffer, NULL);
+ videobuffer2->blit(*videobuffer);
fr = 192;
@@ -3542,7 +3518,7 @@ void GriffonEngine::game_eventtext(const char *stri) {
windowimg->setAlpha(fr, true);
- SDL_BlitSurface(windowimg, NULL, videobuffer, NULL);
+ windowimg->blit(*videobuffer);
if (pauseticks < ticks)
sys_print(videobuffer, stri, x, 15, 0);
@@ -3568,7 +3544,7 @@ void GriffonEngine::game_eventtext(const char *stri) {
g_system->delayMillis(10);
} while (1);
- SDL_BlitSurface(videobuffer3, NULL, videobuffer, NULL);
+ videobuffer3->blit(*videobuffer);
itemticks = ticks + 210;
}
@@ -3851,9 +3827,9 @@ void GriffonEngine::game_loadmap(int mapnum) {
curmap = mapnum;
- SDL_FillRect(mapbg, &trect, 0);
- SDL_FillRect(clipbg, &trect, ccc);
- SDL_FillRect(clipbg2, &trect, ccc);
+ mapbg->fillRect(trect, 0);
+ clipbg->fillRect(trect, ccc);
+ clipbg2->fillRect(trect, ccc);
forcepause = 0;
cloudson = 0;
@@ -3997,7 +3973,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
}
}
- SDL_BlitSurface(tiles[curtilel], &rcSrc, mapbg, &rcDest);
+ tiles[curtilel]->blit(*mapbg, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
tiles[curtilel]->setAlpha(255, true);
rcDest.left = x * 8;
@@ -4005,7 +3981,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- SDL_FillRect(clipbg, &rcDest, 0);
+ clipbg->fillRect(rcDest, 0);
}
}
@@ -4061,7 +4037,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
rcDest.top = y1;
rcDest.setWidth(8);
rcDest.setHeight(8);
- SDL_FillRect(clipbg, &rcDest, ccc);
+ clipbg->fillRect(rcDest, ccc);
} else if (d == 6) {
sys_line(clipbg, x1 + 7, y1, x1 + 7, y1 + 7, ccc);
sys_line(clipbg, x1 + 6, y1, x1 + 6, y1 + 7, ccc);
@@ -4126,9 +4102,9 @@ void GriffonEngine::game_loadmap(int mapnum) {
rcDest.setHeight(8);
if (objectinfo[o][4] == 1)
- SDL_FillRect(clipbg, &rcDest, ccc);
+ clipbg->fillRect(rcDest, ccc);
if (objectinfo[o][4] == 3)
- SDL_FillRect(clipbg, &rcDest, ccc);
+ clipbg->fillRect(rcDest, ccc);
}
}
if (npc == 1) {
@@ -4453,7 +4429,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, ccc);
+ clipbg->fillRect(rcDest, ccc);
}
// academy crystal
@@ -4477,7 +4453,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, ccc);
+ clipbg->fillRect(rcDest, ccc);
}
// gardens master key
@@ -4501,7 +4477,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, ccc);
+ clipbg->fillRect(rcDest, ccc);
}
// gardens fidelis sword
@@ -4525,7 +4501,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, ccc);
+ clipbg->fillRect(rcDest, ccc);
}
// citadel armour
@@ -4549,7 +4525,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, ccc);
+ clipbg->fillRect(rcDest, ccc);
}
// citadel master key
@@ -4573,7 +4549,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, ccc);
+ clipbg->fillRect(rcDest, ccc);
}
@@ -4598,7 +4574,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, ccc);
+ clipbg->fillRect(rcDest, ccc);
}
if (curmap == 83 && scriptflag[16][0] == 1 && player.shield < 3) {
@@ -4621,7 +4597,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, ccc);
+ clipbg->fillRect(rcDest, ccc);
}
if (curmap == 83 && scriptflag[17][0] == 1 && player.armour < 3) {
@@ -4644,7 +4620,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- SDL_FillRect(clipbg, &rcDest, ccc);
+ clipbg->fillRect(rcDest, ccc);
}
clipbg2->copyRectToSurface(clipbg->getPixels(), clipbg->pitch, 0, 0, clipbg->w, clipbg->h);
@@ -4664,13 +4640,13 @@ void GriffonEngine::game_newgame() {
float ld = 0, add;
int ticks, cnt = 0;
- SDL_FillRect(videobuffer2, NULL, 0);
- SDL_FillRect(videobuffer3, NULL, 0);
+ videobuffer2->fillRect(Common::Rect(0, 0, videobuffer2->w, videobuffer2->h), 0);
+ videobuffer3->fillRect(Common::Rect(0, 0, videobuffer3->w, videobuffer3->h), 0);
ticks = g_system->getMillis();
- SDL_BlitSurface(videobuffer, NULL, videobuffer3, NULL);
- SDL_BlitSurface(videobuffer, NULL, videobuffer2, NULL);
+ videobuffer->blit(*videobuffer3);
+ videobuffer->blit(*videobuffer2);
fpsr = 0.0;
int y = 140;
@@ -4701,12 +4677,12 @@ void GriffonEngine::game_newgame() {
rc.left = -xofs;
rc.top = 0;
- SDL_BlitSurface(titleimg, NULL, videobuffer, &rc);
+ titleimg->blit(*videobuffer, rc.left, rc.top);
rc.left = -xofs + 320;
rc.top = 0;
- SDL_BlitSurface(titleimg, NULL, videobuffer, &rc);
+ titleimg->blit(*videobuffer, rc.left, rc.top);
if (++cnt >= 6) {
cnt = 0;
@@ -4955,7 +4931,7 @@ void GriffonEngine::game_saveloadnew() {
tickpause = ticks + 150;
do {
- SDL_FillRect(videobuffer, NULL, 0);
+ videobuffer->fillRect(Common::Rect(0, 0, videobuffer->w, videobuffer->h), 0);
y = y + 1 * fpsr;
@@ -4965,7 +4941,7 @@ void GriffonEngine::game_saveloadnew() {
rcDest.setHeight(240);
cloudimg->setAlpha(128, true);
- SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
+ cloudimg->blit(*videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
cloudimg->setAlpha(64, true);
rcDest.left = 256;
@@ -4974,10 +4950,10 @@ void GriffonEngine::game_saveloadnew() {
rcDest.setHeight(240);
cloudimg->setAlpha(128, true);
- SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
+ cloudimg->blit(*videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
cloudimg->setAlpha(64, true);
- SDL_BlitSurface(saveloadimg, NULL, videobuffer, NULL);
+ saveloadimg->blit(*videobuffer);
g_system->getEventManager()->pollEvent(event);
@@ -5148,19 +5124,19 @@ void GriffonEngine::game_saveloadnew() {
ss = (playera.sword - 1) * 3;
if (playera.sword == 3)
ss = 18;
- SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
+ itemimg[ss]->blit(*videobuffer, rcSrc.left, rcSrc.top);
rcSrc.left = rcSrc.left + 16;
ss = (playera.shield - 1) * 3 + 1;
if (playera.shield == 3)
ss = 19;
- SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
+ itemimg[ss]->blit(*videobuffer, rcSrc.left, rcSrc.top);
rcSrc.left = rcSrc.left + 16;
ss = (playera.armour - 1) * 3 + 2;
if (playera.armour == 3)
ss = 20;
- SDL_BlitSurface(itemimg[ss], NULL, videobuffer, &rcSrc);
+ itemimg[ss]->blit(*videobuffer, rcSrc.left, rcSrc.top);
nx = rcSrc.left + 13 + 3 * 8;
rcSrc.left = nx - 17;
@@ -5169,7 +5145,7 @@ void GriffonEngine::game_saveloadnew() {
for (int i = 0; i < 5; i++) {
rcSrc.left = rcSrc.left + 17;
if (playera.foundspell[i] == 1)
- SDL_BlitSurface(itemimg[7 + i], NULL, videobuffer, &rcSrc);
+ itemimg[7 + i]->blit(*videobuffer, rcSrc.left, rcSrc.top);
}
}
} else {
@@ -5198,7 +5174,7 @@ void GriffonEngine::game_saveloadnew() {
rcDest.top = (float)(53 + (currow - 1) * 48);
}
- SDL_BlitSurface(itemimg[15], NULL, videobuffer, &rcDest);
+ itemimg[15]->blit(*videobuffer, rcDest.left, rcDest.top);
if (lowerlock == 1) {
@@ -5209,7 +5185,7 @@ void GriffonEngine::game_saveloadnew() {
rcDest.left = 170;
rcDest.left = rcDest.left; // + 2 + 2 * sin(-3.14159 * 2 * itemyloc / 16)
- SDL_BlitSurface(itemimg[15], NULL, videobuffer, &rcDest);
+ itemimg[15]->blit(*videobuffer, rcDest.left, rcDest.top);
}
yy = 255;
@@ -5321,7 +5297,7 @@ void GriffonEngine::game_swash() {
y = y + 1 * fpsr;
videobuffer->setAlpha((int)y);
- SDL_FillRect(videobuffer, NULL, 0);
+ videobuffer->fillRect(Common::Rect(0, 0, videobuffer->w, videobuffer->h), 0);
g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
g_system->updateScreen();
@@ -5355,7 +5331,7 @@ void GriffonEngine::game_swash() {
y = y + 1 * fpsr;
videobuffer->setAlpha((int)(y * 25));
- SDL_BlitSurface(mapbg, NULL, videobuffer, NULL);
+ mapbg->blit(*videobuffer);
if (cloudson == 1) {
rcDest.left = (float)(256 + 256 * cos(3.141592 / 180 * clouddeg));
@@ -5363,7 +5339,7 @@ void GriffonEngine::game_swash() {
rcDest.setWidth(320);
rcDest.setHeight(240);
- SDL_BlitSurface(cloudimg, &rcDest, videobuffer, NULL);
+ cloudimg->blit(*videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
}
g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
@@ -5405,7 +5381,7 @@ void GriffonEngine::game_theend() {
for (float y = 0; y < 100; y += fpsr) {
videobuffer->setAlpha((int)y);
- SDL_FillRect(videobuffer, NULL, 0);
+ videobuffer->fillRect(Common::Rect(0, 0, videobuffer->w, videobuffer->h), 0);
g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
g_system->updateScreen();
@@ -5440,13 +5416,13 @@ void GriffonEngine::game_title(int mode) {
rcSrc.setWidth(320);
rcSrc.setHeight(240);
- SDL_FillRect(videobuffer2, &rcSrc, 0);
- SDL_FillRect(videobuffer3, &rcSrc, 0);
+ videobuffer2->fillRect(rcSrc, 0);
+ videobuffer3->fillRect(rcSrc, 0);
ticks = g_system->getMillis();
- SDL_BlitSurface(videobuffer, NULL, videobuffer3, NULL);
- SDL_BlitSurface(videobuffer, NULL, videobuffer2, NULL);
+ videobuffer->blit(*videobuffer3);
+ videobuffer->blit(*videobuffer2);
cursel = 0;
@@ -5481,17 +5457,17 @@ void GriffonEngine::game_title(int mode) {
rc.left = -xofs;
rc.top = 0;
- SDL_BlitSurface(titleimg, NULL, videobuffer, &rc);
+ titleimg->blit(*videobuffer, rc.left, rc.top);
rc.left = -xofs + 320.0;
rc.top = 0;
- SDL_BlitSurface(titleimg, NULL, videobuffer, &rc);
+ titleimg->blit(*videobuffer, rc.left, rc.top);
rc.left = 0;
rc.top = 0;
- SDL_BlitSurface(titleimg2, NULL, videobuffer, &rc);
+ titleimg2->blit(*videobuffer, rc.left, rc.top);
y = 172;
x = 160 - 14 * 4;
@@ -5508,7 +5484,7 @@ void GriffonEngine::game_title(int mode) {
rc.left = (float)(x - 16 - 4 * cos(3.14159 * 2 * itemyloc / 16));
rc.top = (float)(y - 4 + 16 * cursel);
- SDL_BlitSurface(itemimg[15], NULL, videobuffer, &rc);
+ itemimg[15]->blit(*videobuffer, rc.left, rc.top);
float yf = 255.0;
if (ticks < ticks1 + 1000) {
@@ -6571,7 +6547,7 @@ void GriffonEngine::game_updnpcs() {
rcSrc.setHeight(3);
if (npcinfo[i].pause < ticks)
- SDL_FillRect(clipbg, &rcSrc, i);
+ clipbg->fillRect(rcSrc, i);
pass = 0;
@@ -6911,7 +6887,7 @@ void GriffonEngine::game_updspells() {
if (xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
spellimg->setAlpha(alf, true);
- SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+ spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
spellimg->setAlpha(255, true);
if (spellinfo[i].damagewho == 0) {
@@ -6949,7 +6925,7 @@ void GriffonEngine::game_updspells() {
rcSrc.setWidth(8);
rcSrc.setHeight(8);
- SDL_FillRect(clipbg2, &rcSrc, 0);
+ clipbg2->fillRect(rcSrc, 0);
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
@@ -6989,7 +6965,7 @@ void GriffonEngine::game_updspells() {
rcDest.left = xloc;
rcDest.top = yloc;
- SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+ spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
if (spellinfo[i].frame < 0)
@@ -7073,7 +7049,7 @@ void GriffonEngine::game_updspells() {
rcSrc.setWidth(8);
rcSrc.setHeight(8);
- SDL_FillRect(clipbg2, &rcSrc, 0);
+ clipbg2->fillRect(rcSrc, 0);
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
@@ -7115,7 +7091,7 @@ void GriffonEngine::game_updspells() {
rcDest.top = yloc;
if (xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
- SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+ spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
if (scatter == 1) {
if (spellinfo[i].damagewho == 0) {
@@ -7153,7 +7129,7 @@ void GriffonEngine::game_updspells() {
rcSrc.setWidth(8);
rcSrc.setHeight(8);
- SDL_FillRect(clipbg2, &rcSrc, 0);
+ clipbg2->fillRect(rcSrc, 0);
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
@@ -7195,7 +7171,7 @@ void GriffonEngine::game_updspells() {
f = 192 * (1 - (fra - 24) / 8);
spellimg->setAlpha(f, true);
- SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+ spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
spellimg->setAlpha(255, true);
spellinfo[i].frame = spellinfo[i].frame - 0.3 * fpsr;
@@ -7292,7 +7268,7 @@ void GriffonEngine::game_updspells() {
rcDest.left = xloc;
rcDest.top = yloc;
- SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+ spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
spellimg->setAlpha(255, true);
@@ -7327,7 +7303,7 @@ void GriffonEngine::game_updspells() {
rcDest.left = xloc;
rcDest.top = yloc;
- SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+ spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
if (xloc < -1 || yloc < -1 || xloc > 304 || yloc > 224)
@@ -7430,7 +7406,7 @@ void GriffonEngine::game_updspells() {
rcSrc.setWidth(8);
rcSrc.setHeight(8);
- SDL_FillRect(clipbg2, &rcSrc, 0);
+ clipbg2->fillRect(rcSrc, 0);
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
}
@@ -7488,7 +7464,7 @@ void GriffonEngine::game_updspells() {
rcSrc.setWidth(8);
rcSrc.setHeight(8);
- SDL_FillRect(clipbg2, &rcSrc, 0);
+ clipbg2->fillRect(rcSrc, 0);
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
}
@@ -7545,7 +7521,7 @@ void GriffonEngine::game_updspells() {
rcSrc.setWidth(8);
rcSrc.setHeight(8);
- SDL_FillRect(clipbg2, &rcSrc, 0);
+ clipbg2->fillRect(rcSrc, 0);
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
}
@@ -7602,7 +7578,7 @@ void GriffonEngine::game_updspells() {
rcSrc.setWidth(8);
rcSrc.setHeight(8);
- SDL_FillRect(clipbg2, &rcSrc, 0);
+ clipbg2->fillRect(rcSrc, 0);
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
}
@@ -7719,7 +7695,7 @@ void GriffonEngine::game_updspellsunder() {
f = 160 * (1 - (fra - 24) / 8);
spellimg->setAlpha(f, true);
- SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+ spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
spellimg->setAlpha(255, true);
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
@@ -7821,7 +7797,7 @@ void GriffonEngine::game_updspellsunder() {
rcDest.top = (int)yloc;
if (xloc > -1 && xloc < 304 && yloc > -1 && yloc < 224) {
- SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+ spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
int sx = (xloc / 2 + 4);
int sy = (yloc / 2 + 8);
@@ -7887,7 +7863,7 @@ void GriffonEngine::game_updspellsunder() {
rcSrc.setWidth(8);
rcSrc.setHeight(8);
- SDL_FillRect(clipbg2, &rcSrc, 0);
+ clipbg2->fillRect(rcSrc, 0);
if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndfire], 0);
@@ -7949,7 +7925,7 @@ void GriffonEngine::game_updspellsunder() {
rcDest.top = yloc;
if (xloc > -16 && xloc < 320 && yloc > -16 && yloc < 240) {
- SDL_BlitSurface(spellimg, &rcSrc, videobuffer, &rcDest);
+ spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
if (spellinfo[i].damagewho == 1) {
float xdif = (xloc + 8) - (player.px + 12);
@@ -8204,7 +8180,7 @@ void GriffonEngine::sys_LoadItemImgs() {
rcSrc.setWidth(16);
rcSrc.setHeight(16);
- SDL_BlitSurface(temp, &rcSrc, itemimg[i], NULL);
+ temp->blit(*itemimg[i], 0, 0, Graphics::FLIP_NONE, &rcSrc);
}
temp->free();
@@ -8233,7 +8209,7 @@ void GriffonEngine::sys_LoadFont() {
rcDest.left = 0;
rcDest.top = 0;
- SDL_BlitSurface(font, &rcSrc, fontchr[i2][f], &rcDest);
+ font->blit(*fontchr[i2][f], rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
font->free();
@@ -8292,7 +8268,7 @@ void GriffonEngine::sys_print(Graphics::TransparentSurface *buffer, const char *
rcDest.left = xloc + i * 8;
rcDest.top = yloc;
- SDL_BlitSurface(fontchr[stri[i] - 32][col], NULL, buffer, &rcDest);
+ fontchr[stri[i] - 32][col]->blit(*buffer, rcDest.left, rcDest.top);
}
}
@@ -8302,7 +8278,7 @@ void GriffonEngine::sys_progress(int w, int wm) {
ccc = videobuffer->format.RGBToColor(0, 255, 0);
rcDest.setWidth(w * 74 / wm);
- SDL_FillRect(videobuffer, &rcDest, ccc);
+ videobuffer->fillRect(rcDest, ccc);
g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
g_system->updateScreen();
@@ -8335,7 +8311,7 @@ void GriffonEngine::sys_setupAudio() {
rcDest.top = 116 + 12;
loadimg->setAlpha(160, true); // 128
- SDL_BlitSurface(loadimg, &rcSrc, videobuffer, &rcDest);
+ loadimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
g_system->updateScreen();
@@ -8397,7 +8373,6 @@ void GriffonEngine::sys_update() {
int pa, sx, sy;
float opx, opy, spd;
- g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(event);
@@ -8501,7 +8476,7 @@ void GriffonEngine::sys_update() {
rc.setWidth(5);
rc.setHeight(5);
- SDL_FillRect(clipbg, &rc, 1000);
+ clipbg->fillRect(rc, 1000);
if (forcepause == 0) {
for (int i = 0; i < 5; i++) {
Commit: 4531c5b110aa35db05492042342006381314c338
https://github.com/scummvm/scummvm/commit/4531c5b110aa35db05492042342006381314c338
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Removed rendering artifacts
Changed paths:
engines/griffon/engine.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index d339ace..c85bc70 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -1331,7 +1331,7 @@ void GriffonEngine::game_configmenu() {
cloudimg->blit(*videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
cloudimg->setAlpha(64, true);
- configwindow->blit(*videobuffer);
+ videobuffer->copyRectToSurface(configwindow->getPixels(), configwindow->pitch, 0, 0, configwindow->w, configwindow->h);
int sy = SY;
@@ -3212,7 +3212,7 @@ void GriffonEngine::game_drawplayer() {
void GriffonEngine::game_drawview() {
Common::Rect rc;
- mapbg->blit(*videobuffer);
+ videobuffer->copyRectToSurface(mapbg->getPixels(), mapbg->pitch, 0, 0, mapbg->w, mapbg->h);
game_updspellsunder();
@@ -3266,7 +3266,7 @@ void GriffonEngine::game_endofgame() {
videobuffer2->fillRect(Common::Rect(0, 0, videobuffer2->w, videobuffer2->h), 0);
videobuffer3->fillRect(Common::Rect(0, 0, videobuffer3->w, videobuffer3->h), 0);
- videobuffer->blit(*videobuffer2);
+ videobuffer2->copyRectToSurface(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
float ld = 0;
int ldstop = 0;
@@ -3295,8 +3295,8 @@ void GriffonEngine::game_endofgame() {
videobuffer->fillRect(Common::Rect(0, 0, videobuffer->w, videobuffer->h), 0);
videobuffer->setAlpha(ya);
- videobuffer2->blit(*videobuffer3);
- videobuffer->blit(*videobuffer3);
+ videobuffer3->copyRectToSurface(videobuffer2->getPixels(), videobuffer2->pitch, 0, 0, videobuffer2->w, videobuffer2->h);
+ videobuffer3->copyRectToSurface(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
g_system->copyRectToScreen(videobuffer3->getPixels(), videobuffer3->pitch, 0, 0, videobuffer3->w, videobuffer3->h);
g_system->updateScreen();
@@ -3396,7 +3396,7 @@ void GriffonEngine::game_endofgame() {
ticks1 = ticks;
int y1 = 0;
- videobuffer->blit(*videobuffer2);
+ videobuffer2->copyRectToSurface(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
do {
if (ticks < ticks1 + 1500) {
@@ -3442,7 +3442,7 @@ void GriffonEngine::game_endofgame() {
y1 = 0;
do {
- theendimg->blit(*videobuffer);
+ videobuffer->copyRectToSurface(theendimg->getPixels(), theendimg->pitch, 0, 0, theendimg->w, theendimg->h);
y1 = 255;
if (ticks < ticks1 + 1000) {
Commit: bdff046e06806dfbe6e1d4f8fbbf94896ff1df0a
https://github.com/scummvm/scummvm/commit/bdff046e06806dfbe6e1d4f8fbbf94896ff1df0a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Move save/load functions to saveload.cpp
Changed paths:
A engines/griffon/saveload.cpp
R engines/griffon/state.cpp
R engines/griffon/state.h
engines/griffon/engine.cpp
engines/griffon/griffon.h
engines/griffon/module.mk
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index c85bc70..cc1fe2b 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -36,7 +36,6 @@
#include "griffon/griffon.h"
#include "griffon/config.h"
-#include "griffon/state.h"
#include "common/events.h"
#include "common/file.h"
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 7da3414..9b811e8 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -294,6 +294,10 @@ private:
void sys_progress(int w, int wm);
void sys_setupAudio();
void sys_update();
+
+ int state_load(int slotnum);
+ int state_load_player(int slotnum);
+ int state_save(int slotnum);
};
}
diff --git a/engines/griffon/module.mk b/engines/griffon/module.mk
index 2dbacb5..7df4e2e 100644
--- a/engines/griffon/module.mk
+++ b/engines/griffon/module.mk
@@ -5,7 +5,7 @@ MODULE_OBJS := \
engine.o \
griffon.o \
detection.o \
- state.o
+ saveload.o
MODULE_DIRS += \
engines/griffon
diff --git a/engines/griffon/saveload.cpp b/engines/griffon/saveload.cpp
new file mode 100644
index 0000000..11c15cd
--- /dev/null
+++ b/engines/griffon/saveload.cpp
@@ -0,0 +1,273 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Originally written by Syn9 in FreeBASIC with SDL
+ * http://syn9.thehideoutgames.com/index_backup.php
+ *
+ * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
+ * http://github.com/dmitrysmagin/griffon_legend
+ *
+ *
+ * Programming/Graphics: Daniel "Syn9" Kennedy
+ * Music/Sound effects: David Turner
+ *
+ * Beta testing and gameplay design help:
+ * Deleter, Cha0s, Aether Fox, and Kiz
+ *
+ */
+
+#include "griffon/griffon.h"
+
+namespace Griffon {
+
+char player_sav[256] = "data/player%i.sav";
+
+#define PRINT(A,B) \
+ do { \
+ char line[256]; \
+ sprintf(line, A "\n", B); \
+ fputs(line, fp); \
+ } while(0)
+
+#define INPUT(A, B) \
+ do { \
+ char line[256]; \
+ fgets(line, sizeof(line), fp); \
+ sscanf(line, A, B); \
+ } while(0)
+
+// externs (to be removed later)
+extern PLAYERTYPE playera;
+extern int asecstart;
+
+int GriffonEngine::state_load(int slotnum) {
+#if 0
+ FILE *fp;
+ char line[256];
+
+ sprintf(line, player_sav, slotnum);
+
+ fp = fopen(line, "r");
+ if (fp) {
+ INPUT("%i", &player.level);
+
+ if (player.level > 0) {
+ INPUT("%i", &secstart);
+ INPUT("%s", line);
+
+ INPUT("%f", &player.px);
+ INPUT("%f", &player.py);
+ INPUT("%f", &player.opx);
+ INPUT("%f", &player.opy);
+ INPUT("%i", &player.walkdir);
+ INPUT("%f", &player.walkframe);
+ INPUT("%f", &player.walkspd);
+ INPUT("%f", &player.attackframe);
+ INPUT("%f", &player.attackspd);
+ INPUT("%i", &player.hp);
+ INPUT("%i", &player.maxhp);
+ INPUT("%f", &player.hpflash);
+ INPUT("%i", &player.level);
+ INPUT("%i", &player.maxlevel);
+ INPUT("%i", &player.sword);
+ INPUT("%i", &player.shield);
+ INPUT("%i", &player.armour);
+ for (int i = 0; i < 5; i++) {
+ INPUT("%i", &player.foundspell[i]);
+ INPUT("%f", &player.spellcharge[i]);
+ }
+ for (int a = 0; a < 5; a++) {
+ INPUT("%i", &player.inventory[a]);
+ }
+ INPUT("%f", &player.attackstrength);
+ INPUT("%i", &player.spelldamage);
+ INPUT("%i", &player.sworddamage);
+ INPUT("%i", &player.exp);
+ INPUT("%i", &player.nextlevel);
+ for (int a = 0; a <= 99; a++) {
+ for (int b = 0; b <= 9; b++) {
+ INPUT("%i", &scriptflag[a][b]);
+ }
+ }
+ INPUT("%i", &curmap);
+
+ for (int a = 0; a <= 999; a++) {
+ for (int b = 0; b <= 20; b++) {
+ for (int c = 0; c <= 14; c++) {
+ INPUT("%i", &objmapf[a][b][c]);
+ }
+ }
+ }
+
+ for (int a = 0; a <= 200; a++) {
+ INPUT("%i", &roomlocks[a]);
+ }
+
+ INPUT("%f", &player.spellstrength);
+
+ fclose(fp);
+
+ return 1; // success
+ }
+
+ fclose(fp);
+ }
+
+#endif
+ return 0; // fail
+}
+
+/* fill PLAYERTYPE playera; */
+int GriffonEngine::state_load_player(int slotnum) {
+#if 0
+ FILE *fp;
+ char line[256];
+
+ sprintf(line, player_sav, slotnum);
+
+ playera.level = 0;
+
+ fp = fopen(line, "r");
+ if (fp) {
+ INPUT("%i", &playera.level);
+
+ if (playera.level > 0) {
+ INPUT("%i", &asecstart);
+ INPUT("%s", line);
+
+ INPUT("%f", &playera.px);
+ INPUT("%f", &playera.py);
+ INPUT("%f", &playera.opx);
+ INPUT("%f", &playera.opy);
+ INPUT("%i", &playera.walkdir);
+ INPUT("%f", &playera.walkframe);
+ INPUT("%f", &playera.walkspd);
+ INPUT("%f", &playera.attackframe);
+ INPUT("%f", &playera.attackspd);
+ INPUT("%i", &playera.hp);
+ INPUT("%i", &playera.maxhp);
+ INPUT("%f", &playera.hpflash);
+ INPUT("%i", &playera.level);
+ INPUT("%i", &playera.maxlevel);
+ INPUT("%i", &playera.sword);
+ INPUT("%i", &playera.shield);
+ INPUT("%i", &playera.armour);
+ for (int i = 0; i < 5; i++) {
+ INPUT("%i", &playera.foundspell[i]);
+ INPUT("%f", &playera.spellcharge[i]);
+ }
+ for (int a = 0; a < 5; a++) {
+ INPUT("%i", &playera.inventory[a]);
+ }
+ INPUT("%f", &playera.attackstrength);
+ INPUT("%i", &playera.spelldamage);
+ INPUT("%i", &playera.sworddamage);
+ INPUT("%i", &playera.exp);
+ INPUT("%i", &playera.nextlevel);
+
+ fclose(fp);
+
+ return 1; // success
+ }
+
+ fclose(fp);
+ }
+#endif
+
+ return 0; // fail
+}
+
+int GriffonEngine::state_save(int slotnum) {
+#if 0
+ FILE *fp;
+ char line[256];
+
+ sprintf(line, player_sav, slotnum);
+
+ fp = fopen(line, "w");
+ if (fp) {
+ PRINT("%i", player.level);
+
+ if (player.level > 0) {
+ PRINT("%i", (secstart + secsingame));
+ PRINT("%s", "a");
+
+ PRINT("%f", player.px);
+ PRINT("%f", player.py);
+ PRINT("%f", player.opx);
+ PRINT("%f", player.opy);
+ PRINT("%i", player.walkdir);
+ PRINT("%f", player.walkframe);
+ PRINT("%f", player.walkspd);
+ PRINT("%f", player.attackframe);
+ PRINT("%f", player.attackspd);
+ PRINT("%i", player.hp);
+ PRINT("%i", player.maxhp);
+ PRINT("%f", player.hpflash);
+ PRINT("%i", player.level);
+ PRINT("%i", player.maxlevel);
+ PRINT("%i", player.sword);
+ PRINT("%i", player.shield);
+ PRINT("%i", player.armour);
+ for (int i = 0; i < 5; i++) {
+ PRINT("%i", player.foundspell[i]);
+ PRINT("%f", player.spellcharge[i]);
+ }
+ for (int a = 0; a < 5; a++) {
+ PRINT("%i", player.inventory[a]);
+ }
+ PRINT("%f", player.attackstrength);
+ PRINT("%i", player.spelldamage);
+ PRINT("%i", player.sworddamage);
+ PRINT("%i", player.exp);
+ PRINT("%i", player.nextlevel);
+ for (int a = 0; a <= 99; a++) {
+ for (int b = 0; b <= 9; b++) {
+ PRINT("%i", scriptflag[a][b]);
+ }
+ }
+ PRINT("%i", curmap);
+
+ for (int a = 0; a <= 999; a++) {
+ for (int b = 0; b <= 20; b++) {
+ for (int c = 0; c <= 14; c++) {
+ PRINT("%i", objmapf[a][b][c]);
+ }
+ }
+ }
+
+ for (int a = 0; a <= 200; a++) {
+ PRINT("%i", roomlocks[a]);
+ }
+
+ PRINT("%f", player.spellstrength);
+ }
+
+ fclose(fp);
+
+ return 1; // success
+ }
+
+#endif
+ return 0; // fail
+}
+
+} // end of namespace Griffon
diff --git a/engines/griffon/state.cpp b/engines/griffon/state.cpp
deleted file mode 100644
index 3aa97d6..0000000
--- a/engines/griffon/state.cpp
+++ /dev/null
@@ -1,274 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- *
- * Originally written by Syn9 in FreeBASIC with SDL
- * http://syn9.thehideoutgames.com/index_backup.php
- *
- * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
- * http://github.com/dmitrysmagin/griffon_legend
- *
- *
- * Programming/Graphics: Daniel "Syn9" Kennedy
- * Music/Sound effects: David Turner
- *
- * Beta testing and gameplay design help:
- * Deleter, Cha0s, Aether Fox, and Kiz
- *
- */
-
-#include "griffon/griffon.h"
-#include "griffon/state.h"
-
-namespace Griffon {
-
-char player_sav[256] = "data/player%i.sav";
-
-#define PRINT(A,B) \
- do { \
- char line[256]; \
- sprintf(line, A "\n", B); \
- fputs(line, fp); \
- } while(0)
-
-#define INPUT(A, B) \
- do { \
- char line[256]; \
- fgets(line, sizeof(line), fp); \
- sscanf(line, A, B); \
- } while(0)
-
-// externs (to be removed later)
-extern PLAYERTYPE playera;
-extern int asecstart;
-
-int state_load(int slotnum) {
-#if 0
- FILE *fp;
- char line[256];
-
- sprintf(line, player_sav, slotnum);
-
- fp = fopen(line, "r");
- if (fp) {
- INPUT("%i", &player.level);
-
- if (player.level > 0) {
- INPUT("%i", &secstart);
- INPUT("%s", line);
-
- INPUT("%f", &player.px);
- INPUT("%f", &player.py);
- INPUT("%f", &player.opx);
- INPUT("%f", &player.opy);
- INPUT("%i", &player.walkdir);
- INPUT("%f", &player.walkframe);
- INPUT("%f", &player.walkspd);
- INPUT("%f", &player.attackframe);
- INPUT("%f", &player.attackspd);
- INPUT("%i", &player.hp);
- INPUT("%i", &player.maxhp);
- INPUT("%f", &player.hpflash);
- INPUT("%i", &player.level);
- INPUT("%i", &player.maxlevel);
- INPUT("%i", &player.sword);
- INPUT("%i", &player.shield);
- INPUT("%i", &player.armour);
- for (int i = 0; i < 5; i++) {
- INPUT("%i", &player.foundspell[i]);
- INPUT("%f", &player.spellcharge[i]);
- }
- for (int a = 0; a < 5; a++) {
- INPUT("%i", &player.inventory[a]);
- }
- INPUT("%f", &player.attackstrength);
- INPUT("%i", &player.spelldamage);
- INPUT("%i", &player.sworddamage);
- INPUT("%i", &player.exp);
- INPUT("%i", &player.nextlevel);
- for (int a = 0; a <= 99; a++) {
- for (int b = 0; b <= 9; b++) {
- INPUT("%i", &scriptflag[a][b]);
- }
- }
- INPUT("%i", &curmap);
-
- for (int a = 0; a <= 999; a++) {
- for (int b = 0; b <= 20; b++) {
- for (int c = 0; c <= 14; c++) {
- INPUT("%i", &objmapf[a][b][c]);
- }
- }
- }
-
- for (int a = 0; a <= 200; a++) {
- INPUT("%i", &roomlocks[a]);
- }
-
- INPUT("%f", &player.spellstrength);
-
- fclose(fp);
-
- return 1; // success
- }
-
- fclose(fp);
- }
-
-#endif
- return 0; // fail
-}
-
-/* fill PLAYERTYPE playera; */
-int state_load_player(int slotnum) {
-#if 0
- FILE *fp;
- char line[256];
-
- sprintf(line, player_sav, slotnum);
-
- playera.level = 0;
-
- fp = fopen(line, "r");
- if (fp) {
- INPUT("%i", &playera.level);
-
- if (playera.level > 0) {
- INPUT("%i", &asecstart);
- INPUT("%s", line);
-
- INPUT("%f", &playera.px);
- INPUT("%f", &playera.py);
- INPUT("%f", &playera.opx);
- INPUT("%f", &playera.opy);
- INPUT("%i", &playera.walkdir);
- INPUT("%f", &playera.walkframe);
- INPUT("%f", &playera.walkspd);
- INPUT("%f", &playera.attackframe);
- INPUT("%f", &playera.attackspd);
- INPUT("%i", &playera.hp);
- INPUT("%i", &playera.maxhp);
- INPUT("%f", &playera.hpflash);
- INPUT("%i", &playera.level);
- INPUT("%i", &playera.maxlevel);
- INPUT("%i", &playera.sword);
- INPUT("%i", &playera.shield);
- INPUT("%i", &playera.armour);
- for (int i = 0; i < 5; i++) {
- INPUT("%i", &playera.foundspell[i]);
- INPUT("%f", &playera.spellcharge[i]);
- }
- for (int a = 0; a < 5; a++) {
- INPUT("%i", &playera.inventory[a]);
- }
- INPUT("%f", &playera.attackstrength);
- INPUT("%i", &playera.spelldamage);
- INPUT("%i", &playera.sworddamage);
- INPUT("%i", &playera.exp);
- INPUT("%i", &playera.nextlevel);
-
- fclose(fp);
-
- return 1; // success
- }
-
- fclose(fp);
- }
-#endif
-
- return 0; // fail
-}
-
-int state_save(int slotnum) {
-#if 0
- FILE *fp;
- char line[256];
-
- sprintf(line, player_sav, slotnum);
-
- fp = fopen(line, "w");
- if (fp) {
- PRINT("%i", player.level);
-
- if (player.level > 0) {
- PRINT("%i", (secstart + secsingame));
- PRINT("%s", "a");
-
- PRINT("%f", player.px);
- PRINT("%f", player.py);
- PRINT("%f", player.opx);
- PRINT("%f", player.opy);
- PRINT("%i", player.walkdir);
- PRINT("%f", player.walkframe);
- PRINT("%f", player.walkspd);
- PRINT("%f", player.attackframe);
- PRINT("%f", player.attackspd);
- PRINT("%i", player.hp);
- PRINT("%i", player.maxhp);
- PRINT("%f", player.hpflash);
- PRINT("%i", player.level);
- PRINT("%i", player.maxlevel);
- PRINT("%i", player.sword);
- PRINT("%i", player.shield);
- PRINT("%i", player.armour);
- for (int i = 0; i < 5; i++) {
- PRINT("%i", player.foundspell[i]);
- PRINT("%f", player.spellcharge[i]);
- }
- for (int a = 0; a < 5; a++) {
- PRINT("%i", player.inventory[a]);
- }
- PRINT("%f", player.attackstrength);
- PRINT("%i", player.spelldamage);
- PRINT("%i", player.sworddamage);
- PRINT("%i", player.exp);
- PRINT("%i", player.nextlevel);
- for (int a = 0; a <= 99; a++) {
- for (int b = 0; b <= 9; b++) {
- PRINT("%i", scriptflag[a][b]);
- }
- }
- PRINT("%i", curmap);
-
- for (int a = 0; a <= 999; a++) {
- for (int b = 0; b <= 20; b++) {
- for (int c = 0; c <= 14; c++) {
- PRINT("%i", objmapf[a][b][c]);
- }
- }
- }
-
- for (int a = 0; a <= 200; a++) {
- PRINT("%i", roomlocks[a]);
- }
-
- PRINT("%f", player.spellstrength);
- }
-
- fclose(fp);
-
- return 1; // success
- }
-
-#endif
- return 0; // fail
-}
-
-} // end of namespace Griffon
diff --git a/engines/griffon/state.h b/engines/griffon/state.h
deleted file mode 100644
index ac8ccb1..0000000
--- a/engines/griffon/state.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- *
- * Originally written by Syn9 in FreeBASIC with SDL
- * http://syn9.thehideoutgames.com/index_backup.php
- *
- * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
- * http://github.com/dmitrysmagin/griffon_legend
- *
- *
- * Programming/Graphics: Daniel "Syn9" Kennedy
- * Music/Sound effects: David Turner
- *
- * Beta testing and gameplay design help:
- * Deleter, Cha0s, Aether Fox, and Kiz
- *
- */
-
-#ifndef GRIFFON_STATE_H
-#define GRIFFON_STATE_H
-
-namespace Griffon {
-
-extern char player_sav[];
-
-int state_load(int slotnum);
-int state_load_player(int slotnum);
-int state_save(int slotnum);
-
-} // end of namespace Griffon
-
-#endif
Commit: 62066b530fca62ab7a8c3f646e6b5e1a7399e90c
https://github.com/scummvm/scummvm/commit/62066b530fca62ab7a8c3f646e6b5e1a7399e90c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Implement save/load
Changed paths:
engines/griffon/griffon.h
engines/griffon/saveload.cpp
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 9b811e8..9e4b499 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -295,6 +295,7 @@ private:
void sys_setupAudio();
void sys_update();
+ Common::String makeSaveGameName(int slot);
int state_load(int slotnum);
int state_load_player(int slotnum);
int state_save(int slotnum);
diff --git a/engines/griffon/saveload.cpp b/engines/griffon/saveload.cpp
index 11c15cd..54f3413 100644
--- a/engines/griffon/saveload.cpp
+++ b/engines/griffon/saveload.cpp
@@ -36,238 +36,227 @@
#include "griffon/griffon.h"
+#include "common/savefile.h"
+
namespace Griffon {
char player_sav[256] = "data/player%i.sav";
-#define PRINT(A,B) \
- do { \
- char line[256]; \
- sprintf(line, A "\n", B); \
- fputs(line, fp); \
+#define PRINT(A,B) \
+ do { \
+ char line[256]; \
+ sprintf(line, A "\n", B); \
+ file->write(line, strlen(line)); \
} while(0)
-#define INPUT(A, B) \
- do { \
- char line[256]; \
- fgets(line, sizeof(line), fp); \
- sscanf(line, A, B); \
+#define INPUT(A, B) \
+ do { \
+ Common::String line; \
+ line = file->readLine(); \
+ sscanf(line.c_str(), A, B); \
} while(0)
// externs (to be removed later)
extern PLAYERTYPE playera;
extern int asecstart;
-int GriffonEngine::state_load(int slotnum) {
-#if 0
- FILE *fp;
- char line[256];
-
- sprintf(line, player_sav, slotnum);
+Common::String GriffonEngine::makeSaveGameName(int slot) {
+ return (_targetName + Common::String::format(".%02d", slot));
+}
- fp = fopen(line, "r");
- if (fp) {
+int GriffonEngine::state_load(int slotnum) {
+ Common::String filename = makeSaveGameName(slotnum);
+ Common::InSaveFile *file;
+ if (!(file = _saveFileMan->openForLoading(filename)))
+ return 0;
+
+ INPUT("%i", &player.level);
+
+ if (player.level > 0) {
+ char temp[256];
+
+ INPUT("%i", &secstart);
+ INPUT("%s", temp);
+
+ INPUT("%f", &player.px);
+ INPUT("%f", &player.py);
+ INPUT("%f", &player.opx);
+ INPUT("%f", &player.opy);
+ INPUT("%i", &player.walkdir);
+ INPUT("%f", &player.walkframe);
+ INPUT("%f", &player.walkspd);
+ INPUT("%f", &player.attackframe);
+ INPUT("%f", &player.attackspd);
+ INPUT("%i", &player.hp);
+ INPUT("%i", &player.maxhp);
+ INPUT("%f", &player.hpflash);
INPUT("%i", &player.level);
-
- if (player.level > 0) {
- INPUT("%i", &secstart);
- INPUT("%s", line);
-
- INPUT("%f", &player.px);
- INPUT("%f", &player.py);
- INPUT("%f", &player.opx);
- INPUT("%f", &player.opy);
- INPUT("%i", &player.walkdir);
- INPUT("%f", &player.walkframe);
- INPUT("%f", &player.walkspd);
- INPUT("%f", &player.attackframe);
- INPUT("%f", &player.attackspd);
- INPUT("%i", &player.hp);
- INPUT("%i", &player.maxhp);
- INPUT("%f", &player.hpflash);
- INPUT("%i", &player.level);
- INPUT("%i", &player.maxlevel);
- INPUT("%i", &player.sword);
- INPUT("%i", &player.shield);
- INPUT("%i", &player.armour);
- for (int i = 0; i < 5; i++) {
- INPUT("%i", &player.foundspell[i]);
- INPUT("%f", &player.spellcharge[i]);
- }
- for (int a = 0; a < 5; a++) {
- INPUT("%i", &player.inventory[a]);
- }
- INPUT("%f", &player.attackstrength);
- INPUT("%i", &player.spelldamage);
- INPUT("%i", &player.sworddamage);
- INPUT("%i", &player.exp);
- INPUT("%i", &player.nextlevel);
- for (int a = 0; a <= 99; a++) {
- for (int b = 0; b <= 9; b++) {
- INPUT("%i", &scriptflag[a][b]);
- }
+ INPUT("%i", &player.maxlevel);
+ INPUT("%i", &player.sword);
+ INPUT("%i", &player.shield);
+ INPUT("%i", &player.armour);
+ for (int i = 0; i < 5; i++) {
+ INPUT("%i", &player.foundspell[i]);
+ INPUT("%f", &player.spellcharge[i]);
+ }
+ for (int a = 0; a < 5; a++) {
+ INPUT("%i", &player.inventory[a]);
+ }
+ INPUT("%f", &player.attackstrength);
+ INPUT("%i", &player.spelldamage);
+ INPUT("%i", &player.sworddamage);
+ INPUT("%i", &player.exp);
+ INPUT("%i", &player.nextlevel);
+ for (int a = 0; a <= 99; a++) {
+ for (int b = 0; b <= 9; b++) {
+ INPUT("%i", &scriptflag[a][b]);
}
- INPUT("%i", &curmap);
+ }
+ INPUT("%i", &curmap);
- for (int a = 0; a <= 999; a++) {
- for (int b = 0; b <= 20; b++) {
- for (int c = 0; c <= 14; c++) {
- INPUT("%i", &objmapf[a][b][c]);
- }
+ for (int a = 0; a <= 999; a++) {
+ for (int b = 0; b <= 20; b++) {
+ for (int c = 0; c <= 14; c++) {
+ INPUT("%i", &objmapf[a][b][c]);
}
}
+ }
- for (int a = 0; a <= 200; a++) {
- INPUT("%i", &roomlocks[a]);
- }
-
- INPUT("%f", &player.spellstrength);
-
- fclose(fp);
-
- return 1; // success
+ for (int a = 0; a <= 200; a++) {
+ INPUT("%i", &roomlocks[a]);
}
- fclose(fp);
+ INPUT("%f", &player.spellstrength);
+
+ return 1; // success
}
-#endif
- return 0; // fail
+ return 0; // faliure
}
/* fill PLAYERTYPE playera; */
int GriffonEngine::state_load_player(int slotnum) {
-#if 0
- FILE *fp;
- char line[256];
-
- sprintf(line, player_sav, slotnum);
+ Common::String filename = makeSaveGameName(slotnum);
+ Common::InSaveFile *file;
playera.level = 0;
- fp = fopen(line, "r");
- if (fp) {
+ if (!(file = _saveFileMan->openForLoading(filename)))
+ return 0;
+
+ INPUT("%i", &playera.level);
+
+ if (playera.level > 0) {
+ char temp[256];
+
+ INPUT("%i", &asecstart);
+ INPUT("%s", temp);
+
+ INPUT("%f", &playera.px);
+ INPUT("%f", &playera.py);
+ INPUT("%f", &playera.opx);
+ INPUT("%f", &playera.opy);
+ INPUT("%i", &playera.walkdir);
+ INPUT("%f", &playera.walkframe);
+ INPUT("%f", &playera.walkspd);
+ INPUT("%f", &playera.attackframe);
+ INPUT("%f", &playera.attackspd);
+ INPUT("%i", &playera.hp);
+ INPUT("%i", &playera.maxhp);
+ INPUT("%f", &playera.hpflash);
INPUT("%i", &playera.level);
-
- if (playera.level > 0) {
- INPUT("%i", &asecstart);
- INPUT("%s", line);
-
- INPUT("%f", &playera.px);
- INPUT("%f", &playera.py);
- INPUT("%f", &playera.opx);
- INPUT("%f", &playera.opy);
- INPUT("%i", &playera.walkdir);
- INPUT("%f", &playera.walkframe);
- INPUT("%f", &playera.walkspd);
- INPUT("%f", &playera.attackframe);
- INPUT("%f", &playera.attackspd);
- INPUT("%i", &playera.hp);
- INPUT("%i", &playera.maxhp);
- INPUT("%f", &playera.hpflash);
- INPUT("%i", &playera.level);
- INPUT("%i", &playera.maxlevel);
- INPUT("%i", &playera.sword);
- INPUT("%i", &playera.shield);
- INPUT("%i", &playera.armour);
- for (int i = 0; i < 5; i++) {
- INPUT("%i", &playera.foundspell[i]);
- INPUT("%f", &playera.spellcharge[i]);
- }
- for (int a = 0; a < 5; a++) {
- INPUT("%i", &playera.inventory[a]);
- }
- INPUT("%f", &playera.attackstrength);
- INPUT("%i", &playera.spelldamage);
- INPUT("%i", &playera.sworddamage);
- INPUT("%i", &playera.exp);
- INPUT("%i", &playera.nextlevel);
-
- fclose(fp);
-
- return 1; // success
+ INPUT("%i", &playera.maxlevel);
+ INPUT("%i", &playera.sword);
+ INPUT("%i", &playera.shield);
+ INPUT("%i", &playera.armour);
+ for (int i = 0; i < 5; i++) {
+ INPUT("%i", &playera.foundspell[i]);
+ INPUT("%f", &playera.spellcharge[i]);
+ }
+ for (int a = 0; a < 5; a++) {
+ INPUT("%i", &playera.inventory[a]);
}
+ INPUT("%f", &playera.attackstrength);
+ INPUT("%i", &playera.spelldamage);
+ INPUT("%i", &playera.sworddamage);
+ INPUT("%i", &playera.exp);
+ INPUT("%i", &playera.nextlevel);
- fclose(fp);
+ return 1; // success
}
-#endif
return 0; // fail
}
int GriffonEngine::state_save(int slotnum) {
-#if 0
- FILE *fp;
- char line[256];
+ Common::String filename = makeSaveGameName(slotnum);
+ Common::OutSaveFile *file;
- sprintf(line, player_sav, slotnum);
+ if (!(file = _saveFileMan->openForSaving(filename))) {
+ warning("Cannot open %s for saving", filename.c_str());
+ return 0;
+ }
- fp = fopen(line, "w");
- if (fp) {
+ PRINT("%i", player.level);
+
+ if (player.level > 0) {
+ PRINT("%i", (secstart + secsingame));
+ PRINT("%s", "a");
+
+ PRINT("%f", player.px);
+ PRINT("%f", player.py);
+ PRINT("%f", player.opx);
+ PRINT("%f", player.opy);
+ PRINT("%i", player.walkdir);
+ PRINT("%f", player.walkframe);
+ PRINT("%f", player.walkspd);
+ PRINT("%f", player.attackframe);
+ PRINT("%f", player.attackspd);
+ PRINT("%i", player.hp);
+ PRINT("%i", player.maxhp);
+ PRINT("%f", player.hpflash);
PRINT("%i", player.level);
-
- if (player.level > 0) {
- PRINT("%i", (secstart + secsingame));
- PRINT("%s", "a");
-
- PRINT("%f", player.px);
- PRINT("%f", player.py);
- PRINT("%f", player.opx);
- PRINT("%f", player.opy);
- PRINT("%i", player.walkdir);
- PRINT("%f", player.walkframe);
- PRINT("%f", player.walkspd);
- PRINT("%f", player.attackframe);
- PRINT("%f", player.attackspd);
- PRINT("%i", player.hp);
- PRINT("%i", player.maxhp);
- PRINT("%f", player.hpflash);
- PRINT("%i", player.level);
- PRINT("%i", player.maxlevel);
- PRINT("%i", player.sword);
- PRINT("%i", player.shield);
- PRINT("%i", player.armour);
- for (int i = 0; i < 5; i++) {
- PRINT("%i", player.foundspell[i]);
- PRINT("%f", player.spellcharge[i]);
- }
- for (int a = 0; a < 5; a++) {
- PRINT("%i", player.inventory[a]);
- }
- PRINT("%f", player.attackstrength);
- PRINT("%i", player.spelldamage);
- PRINT("%i", player.sworddamage);
- PRINT("%i", player.exp);
- PRINT("%i", player.nextlevel);
- for (int a = 0; a <= 99; a++) {
- for (int b = 0; b <= 9; b++) {
- PRINT("%i", scriptflag[a][b]);
- }
+ PRINT("%i", player.maxlevel);
+ PRINT("%i", player.sword);
+ PRINT("%i", player.shield);
+ PRINT("%i", player.armour);
+ for (int i = 0; i < 5; i++) {
+ PRINT("%i", player.foundspell[i]);
+ PRINT("%f", player.spellcharge[i]);
+ }
+ for (int a = 0; a < 5; a++) {
+ PRINT("%i", player.inventory[a]);
+ }
+ PRINT("%f", player.attackstrength);
+ PRINT("%i", player.spelldamage);
+ PRINT("%i", player.sworddamage);
+ PRINT("%i", player.exp);
+ PRINT("%i", player.nextlevel);
+ for (int a = 0; a <= 99; a++) {
+ for (int b = 0; b <= 9; b++) {
+ PRINT("%i", scriptflag[a][b]);
}
- PRINT("%i", curmap);
+ }
+ PRINT("%i", curmap);
- for (int a = 0; a <= 999; a++) {
- for (int b = 0; b <= 20; b++) {
- for (int c = 0; c <= 14; c++) {
- PRINT("%i", objmapf[a][b][c]);
- }
+ for (int a = 0; a <= 999; a++) {
+ for (int b = 0; b <= 20; b++) {
+ for (int c = 0; c <= 14; c++) {
+ PRINT("%i", objmapf[a][b][c]);
}
}
-
- for (int a = 0; a <= 200; a++) {
- PRINT("%i", roomlocks[a]);
- }
-
- PRINT("%f", player.spellstrength);
}
- fclose(fp);
+ for (int a = 0; a <= 200; a++) {
+ PRINT("%i", roomlocks[a]);
+ }
- return 1; // success
+ PRINT("%f", player.spellstrength);
}
-#endif
- return 0; // fail
+ file->finalize();
+
+ return 1; // success
}
} // end of namespace Griffon
Commit: 5c4016b4820cced49c3d56e4ef2c626acc511ec2
https://github.com/scummvm/scummvm/commit/5c4016b4820cced49c3d56e4ef2c626acc511ec2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Implemented cheat mode via debug console
Changed paths:
A engines/griffon/console.cpp
A engines/griffon/console.h
engines/griffon/engine.cpp
engines/griffon/griffon.cpp
engines/griffon/griffon.h
engines/griffon/module.mk
diff --git a/engines/griffon/console.cpp b/engines/griffon/console.cpp
new file mode 100644
index 0000000..e055bc2
--- /dev/null
+++ b/engines/griffon/console.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "gui/debugger.h"
+
+#include "griffon/console.h"
+
+namespace Griffon {
+
+Console::Console() {
+ _godMode = false;
+ registerCmd("godmode", WRAP_METHOD(Console, Cmd_godMode));
+}
+
+bool Console::Cmd_godMode(int argc, const char** argv) {
+ if (argc != 1) {
+ debugPrintf("Usage: %s\n", argv[0]);
+ debugPrintf("Enables/Disables invincibility and megadamage\n");
+ return true;
+ }
+
+ _godMode ^= true;
+ debugPrintf("God mode is now %s\n", _godMode ? "Enabled" : "Disabled");
+ return true;
+}
+
+} // End of namespace Plumbers
diff --git a/engines/griffon/console.h b/engines/griffon/console.h
new file mode 100644
index 0000000..4709b7e
--- /dev/null
+++ b/engines/griffon/console.h
@@ -0,0 +1,41 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*
+*/
+
+#ifndef GRIFFON_CONSOLE_H
+#define GRIFFON_CONSOLE_H
+
+#include "gui/debugger.h"
+
+namespace Griffon {
+
+class Console : public GUI::Debugger {
+public:
+ bool _godMode;
+
+ explicit Console();
+ virtual ~Console(void) {}
+
+ bool Cmd_godMode(int argc, const char** argv);
+};
+}
+
+#endif
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index cc1fe2b..3f32486 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -36,6 +36,7 @@
#include "griffon/griffon.h"
#include "griffon/config.h"
+#include "griffon/console.h"
#include "common/events.h"
#include "common/file.h"
@@ -936,6 +937,10 @@ void GriffonEngine::game_checkhit() {
if (ps > 1)
ps = ps * 0.75;
damage = (float)player.sworddamage * (1.0 + RND() * 1.0) * player.attackstrength / 100.0 * ps;
+
+ if (_console->_godMode)
+ damage = 1000;
+
if (player.attackstrength == 100)
damage = damage * 1.5;
@@ -1004,6 +1009,9 @@ void GriffonEngine::game_checkinputs() {
if (event.kbd.keycode == Common::KEYCODE_ESCAPE) {
if (itemticks < ticks)
game_title(1);
+ } else if (event.kbd.keycode == Common::KEYCODE_d && event.kbd.hasFlags(Common::KBD_CTRL)) {
+ _console->attach();
+ event.type = Common::EVENT_INVALID;
} else if (event.kbd.hasFlags(Common::KBD_CTRL)) {
if (itemselon == 0 && itemticks < ticks)
game_attack();
@@ -2118,7 +2126,9 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
void GriffonEngine::game_damageplayer(int damage) {
char line[256];
- player.hp -= damage;
+ if (!_console->_godMode)
+ player.hp -= damage;
+
if (player.hp < 0)
player.hp = 0;
@@ -3822,6 +3832,8 @@ void GriffonEngine::game_loadmap(int mapnum) {
char name[256];
int tempmap[320][200];
+ debug(2, "Loaded map %d", mapnum);
+
ccc = clipbg->format.RGBToColor(255, 255, 255);
curmap = mapnum;
@@ -4838,6 +4850,8 @@ void GriffonEngine::game_playgame() {
game_updmusic();
+ _console->onFrame();
+
sys_update();
} while (!_shouldQuit);
}
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index 17cb048..f1ba852 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -31,6 +31,7 @@
#include "engines/util.h"
#include "griffon/griffon.h"
+#include "griffon/console.h"
namespace Griffon {
@@ -40,6 +41,8 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
_rnd = new Common::RandomSource("griffon");
+ _console = nullptr;
+
_shouldQuit = false;
}
@@ -50,6 +53,8 @@ GriffonEngine::~GriffonEngine() {
Common::Error GriffonEngine::run() {
initGraphics(320, 240, new Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
+ _console = new Console();
+
griffon_main();
return Common::kNoError;
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 9e4b499..d8e323b 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -44,6 +44,8 @@
namespace Griffon {
+class Console;
+
#define kMaxNPC 32
#define kMaxFloat 32
#define kMaxSpell 32
@@ -241,6 +243,8 @@ private:
Common::RandomSource *_rnd;
bool _shouldQuit;
+ Console *_console;
+
private:
void griffon_main();
diff --git a/engines/griffon/module.mk b/engines/griffon/module.mk
index 7df4e2e..de09712 100644
--- a/engines/griffon/module.mk
+++ b/engines/griffon/module.mk
@@ -2,6 +2,7 @@ MODULE := engines/griffon
MODULE_OBJS := \
config.o \
+ console.o \
engine.o \
griffon.o \
detection.o \
Commit: d82854b0c9be3ab97bb59e0e39b66c379a5f5459
https://github.com/scummvm/scummvm/commit/d82854b0c9be3ab97bb59e0e39b66c379a5f5459
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Move all global variables to class
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 3f32486..2f994c2 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -38,7 +38,6 @@
#include "griffon/config.h"
#include "griffon/console.h"
-#include "common/events.h"
#include "common/file.h"
#include "common/system.h"
@@ -96,7 +95,6 @@ namespace Griffon {
*/
// stubs
-typedef int Mix_Chunk;
void Mix_Volume(int channel, int volume) {}
int Mix_PlayChannel(int par1, Mix_Chunk *chunk, int par3) { return 0; }
void Mix_Pause(int channel) {}
@@ -106,130 +104,6 @@ Mix_Chunk *Mix_LoadWAV(const char *name) { return NULL; }
bool Mix_Playing(int channel) { return true; }
-// system
-Graphics::TransparentSurface *video, *videobuffer, *videobuffer2, *videobuffer3;
-Graphics::TransparentSurface *titleimg, *titleimg2, *inventoryimg;
-Graphics::TransparentSurface *logosimg, *theendimg;
-Common::Event event;
-
-Graphics::TransparentSurface *mapbg, *clipbg, *clipbg2;
-unsigned int clipsurround[4][4];
-int fullscreen;
-
-float animspd;
-int rampdata[40][24];
-
-int curmap;
-Graphics::TransparentSurface *fontchr[224][5]; // 256 - 32
-Graphics::TransparentSurface *itemimg[21], *windowimg;
-Graphics::TransparentSurface *spellimg;
-
-int itemselon, curitem, itemticks;
-float itemyloc;
-int selenemyon, curenemy, forcepause;
-int roomlock; // set to disable any room jumps while in the room
-int scriptflag[100][10], saveslot; // script, flag
-
-// timer related - move to local later
-int ticks, tickspassed, nextticks;
-float fp, fps, fpsr;
-int secsingame, secstart;
-
-extern const char *story[48];
-Graphics::TransparentSurface *mapimg[4];
-extern int invmap[4][7][13];
-extern const char *story2[27];
-
-Common::Rect rcSrc, rcDest;
-
-// -----------special case
-int dontdrawover; // used in map24 so that the candles dont draw over the boss, default set to 0
-
-// saveload info
-Graphics::TransparentSurface *saveloadimg;
-
-
-// post info
-float postinfo[21][3];
-int nposts;
-
-// cloud info
-Graphics::TransparentSurface *cloudimg;
-float clouddeg = 0;
-int cloudson;
-
-// spell info
-SPELLTYPE spellinfo[kMaxSpell];
-
-// player info
-int movingup, movingdown, movingleft, movingright;
-PLAYERTYPE player;
-int attacking;
-PLAYERTYPE playera;
-int asecstart;
-
-// tile info
-Graphics::TransparentSurface *tiles[4];
-int tileinfo[3][40][24][3]; // maplayer, x, y, tiledata (tile, tilelayer)
-
-extern int elementmap[15][20];
-
-
-// animation info
-Graphics::TransparentSurface *anims[100];
-// id number 0&1 = players
-Graphics::TransparentSurface *animsa[100];
-// attack anims
-float playerattackofs[4][16][3];
-// [dir] [frame] [x,y ofs, completed(0/1)]
-
-float floattext[kMaxFloat][4]; // [id] [framesleft, x, y, col]
-char *floatstri[kMaxFloat];
-float floaticon[kMaxFloat][4]; // [id] [framesleft, x, y, ico]
-
-// special for animset2
-ANIMSET2TYPE animset2[7], animset9[7];
-
-// object info
-float objectframe[256][2];
-int lastobj;
-// frame!, curframe
-int objectinfo[33][6];
-// nframes,xtiles,ytiles,speed,type,script, update?
-int objecttile[33][9][3][3][2];
-// [objnum] [frame] [x] [y] [tile/layer]
-int objmap[21][15];
-
-int objmapf[1000][21][15];
-// [mapnum] x, y set to 1 to make this objmap spot stay at -1
-
-// trigger info
-int triggers[10000][9];
-// [map#][index], [var]
-// map#,x,y
-int triggerloc[320][240], ntriggers;
-
-// npc info
-NPCTYPE npcinfo[kMaxNPC];
-int lastnpc;
-
-// music info
-Mix_Chunk *mgardens, *mgardens2, *mgardens3, *mgardens4, *mboss, *mmenu, *mendofgame;
-int menabled = 1, musicchannel = -1, menuchannel = -1;
-int pgardens, pboss, ptown, pacademy, pcitadel;
-int loopseta = 0;
-
-Mix_Chunk *sfx[21];
-
-// room locks
-int roomlocks[201], saidlocked, canusekey, locktype, roomtounlock, saidjammed;
-// set to 1 for normal key, set to 2 for master, set to 0 if unlocked
-
-// ysort
-int ysort[2401], lasty, firsty;
-
-int pmenu;
-
void GriffonEngine::griffon_main() {
sys_initialize();
game_showlogos();
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index f1ba852..7562936 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -44,6 +44,14 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
_console = nullptr;
_shouldQuit = false;
+
+ menabled = 1;
+ musicchannel = -1;
+ menuchannel = -1;
+
+ loopseta = 0;
+
+ clouddeg = 0.0f;
}
GriffonEngine::~GriffonEngine() {
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index d8e323b..4707a0c 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -37,6 +37,7 @@
#define GRIFFON_H
#include "common/scummsys.h"
+#include "common/events.h"
#include "common/random.h"
#include "engines/engine.h"
@@ -224,13 +225,7 @@ struct ANIMSET2TYPE {
int h;
};
-extern PLAYERTYPE player;
-extern int curmap;
-extern int scriptflag[100][10];
-extern int objmapf[1000][21][15];
-extern int roomlocks[201];
-extern int secsingame, secstart;
-
+typedef int Mix_Chunk;
class GriffonEngine : public Engine {
public:
@@ -303,6 +298,126 @@ private:
int state_load(int slotnum);
int state_load_player(int slotnum);
int state_save(int slotnum);
+
+private:
+ Graphics::TransparentSurface *video, *videobuffer, *videobuffer2, *videobuffer3;
+
+ // system
+ Graphics::TransparentSurface *titleimg, *titleimg2, *inventoryimg;
+ Graphics::TransparentSurface *logosimg, *theendimg;
+ Common::Event event;
+
+ Graphics::TransparentSurface *mapbg, *clipbg, *clipbg2;
+ unsigned int clipsurround[4][4];
+ int fullscreen;
+
+ float animspd;
+ int rampdata[40][24];
+
+ int curmap;
+ Graphics::TransparentSurface *fontchr[224][5]; // 256 - 32
+ Graphics::TransparentSurface *itemimg[21], *windowimg;
+ Graphics::TransparentSurface *spellimg;
+
+ int itemselon, curitem, itemticks;
+ float itemyloc;
+ int selenemyon, curenemy, forcepause;
+ int roomlock; // set to disable any room jumps while in the room
+ int scriptflag[100][10], saveslot; // script, flag
+
+ // timer related - move to local later
+ int ticks, tickspassed, nextticks;
+ float fp, fps, fpsr;
+ int secsingame, secstart;
+
+ Graphics::TransparentSurface *mapimg[4];
+
+ Common::Rect rcSrc, rcDest;
+
+ // -----------special case
+ int dontdrawover; // used in map24 so that the candles dont draw over the boss, default set to 0
+
+ // saveload info
+ Graphics::TransparentSurface *saveloadimg;
+
+
+ // post info
+ float postinfo[21][3];
+ int nposts;
+
+ // cloud info
+ Graphics::TransparentSurface *cloudimg;
+ float clouddeg;
+ int cloudson;
+
+ // spell info
+ SPELLTYPE spellinfo[kMaxSpell];
+
+ // player info
+ int movingup, movingdown, movingleft, movingright;
+ PLAYERTYPE player;
+ int attacking;
+ PLAYERTYPE playera;
+ int asecstart;
+
+ // tile info
+ Graphics::TransparentSurface *tiles[4];
+ int tileinfo[3][40][24][3]; // maplayer, x, y, tiledata (tile, tilelayer)
+
+ // animation info
+ Graphics::TransparentSurface *anims[100];
+ // id number 0&1 = players
+ Graphics::TransparentSurface *animsa[100];
+ // attack anims
+ float playerattackofs[4][16][3];
+ // [dir] [frame] [x,y ofs, completed(0/1)]
+
+ float floattext[kMaxFloat][4]; // [id] [framesleft, x, y, col]
+ char *floatstri[kMaxFloat];
+ float floaticon[kMaxFloat][4]; // [id] [framesleft, x, y, ico]
+
+ // special for animset2
+ ANIMSET2TYPE animset2[7], animset9[7];
+
+ // object info
+ float objectframe[256][2];
+ int lastobj;
+ // frame!, curframe
+ int objectinfo[33][6];
+ // nframes,xtiles,ytiles,speed,type,script, update?
+ int objecttile[33][9][3][3][2];
+ // [objnum] [frame] [x] [y] [tile/layer]
+ int objmap[21][15];
+
+ int objmapf[1000][21][15];
+ // [mapnum] x, y set to 1 to make this objmap spot stay at -1
+
+ // trigger info
+ int triggers[10000][9];
+ // [map#][index], [var]
+ // map#,x,y
+ int triggerloc[320][240], ntriggers;
+
+ // npc info
+ NPCTYPE npcinfo[kMaxNPC];
+ int lastnpc;
+
+ // music info
+ Mix_Chunk *mgardens, *mgardens2, *mgardens3, *mgardens4, *mboss, *mmenu, *mendofgame;
+ int menabled, musicchannel, menuchannel;
+ int pgardens, pboss, ptown, pacademy, pcitadel;
+ int loopseta;
+
+ Mix_Chunk *sfx[21];
+
+ // room locks
+ int roomlocks[201], saidlocked, canusekey, locktype, roomtounlock, saidjammed;
+ // set to 1 for normal key, set to 2 for master, set to 0 if unlocked
+
+ // ysort
+ int ysort[2401], lasty, firsty;
+
+ int pmenu;
};
}
Commit: 6bc45a55f5c3db23aaead0fdee63763794a9039e
https://github.com/scummvm/scummvm/commit/6bc45a55f5c3db23aaead0fdee63763794a9039e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Renamed several class member vars
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 2f994c2..7449c2c 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -1192,7 +1192,7 @@ void GriffonEngine::game_configmenu() {
ticks1 = ticks;
do {
- videobuffer->fillRect(Common::Rect(0, 0, videobuffer->w, videobuffer->h), 0);
+ _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
rcDest.left = 256 + 256 * cos(3.141592 / 180 * clouddeg * 40);
rcDest.top = 192 + 192 * sin(3.141592 / 180 * clouddeg * 40);
@@ -1200,7 +1200,7 @@ void GriffonEngine::game_configmenu() {
rcDest.setHeight(240);
cloudimg->setAlpha(128, true);
- cloudimg->blit(*videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
+ cloudimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
cloudimg->setAlpha(64, true);
rcDest.left = 256;
@@ -1209,10 +1209,10 @@ void GriffonEngine::game_configmenu() {
rcDest.setHeight(240);
cloudimg->setAlpha(128, true);
- cloudimg->blit(*videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
+ cloudimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
cloudimg->setAlpha(64, true);
- videobuffer->copyRectToSurface(configwindow->getPixels(), configwindow->pitch, 0, 0, configwindow->w, configwindow->h);
+ _videobuffer->copyRectToSurface(configwindow->getPixels(), configwindow->pitch, 0, 0, configwindow->w, configwindow->h);
int sy = SY;
@@ -1290,8 +1290,8 @@ void GriffonEngine::game_configmenu() {
if (i > 18)
cl = 0;
- sys_print(videobuffer, vr[i], 156 - 8 * strlen(vr[i]), sy + i * 8, 0);
- sys_print(videobuffer, vl[i], 164, sy + i * 8, cl);
+ sys_print(_videobuffer, vr[i], 156 - 8 * strlen(vr[i]), sy + i * 8, 0);
+ sys_print(_videobuffer, vl[i], 164, sy + i * 8, cl);
}
curselt = cursel;
@@ -1313,7 +1313,7 @@ void GriffonEngine::game_configmenu() {
rc.left = 148 + 3 * cos(3.14159 * 2 * itemyloc / 16.0);
rc.top = sy + 8 * curselt - 4;
- itemimg[15]->blit(*videobuffer, rc.left, rc.top);
+ itemimg[15]->blit(*_videobuffer, rc.left, rc.top);
float yy = 255.0;
if (ticks < ticks1 + 1000) {
@@ -1324,8 +1324,8 @@ void GriffonEngine::game_configmenu() {
yy = 255.0;
}
- videobuffer->setAlpha((int)yy);
- g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ _videobuffer->setAlpha((int)yy);
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(event);
@@ -1422,28 +1422,28 @@ void GriffonEngine::game_configmenu() {
if (cursel == 0) {
fullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
- video = SDL_SetVideoMode(320, 240, config.scr_bpp, fullscreen);
- if (video == 0) {
- video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
+ _video = SDL_SetVideoMode(320, 240, config.scr_bpp, fullscreen);
+ if (_video == 0) {
+ _video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
} else {
config.scr_width = 320;
config.scr_height = 240;
}
- SDL_UpdateRect(video, 0, 0, config.scr_width, config.scr_height);
+ SDL_UpdateRect(_video, 0, 0, config.scr_width, config.scr_height);
}
if (cursel == 1) {
fullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
- video = SDL_SetVideoMode(640, 480, config.scr_bpp, fullscreen);
- if (video == 0) {
- video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
+ _video = SDL_SetVideoMode(640, 480, config.scr_bpp, fullscreen);
+ if (_video == 0) {
+ _video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
} else {
config.scr_width = 640;
config.scr_height = 480;
}
- SDL_UpdateRect(video, 0, 0, config.scr_width, config.scr_height);
+ SDL_UpdateRect(_video, 0, 0, config.scr_width, config.scr_height);
}
if (cursel == 2 || cursel == 3 || cursel == 4) {
fullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
@@ -1453,40 +1453,40 @@ void GriffonEngine::game_configmenu() {
b = 24;
if (cursel == 4)
b = 32;
- video = SDL_SetVideoMode(config.scr_width, config.scr_height, b, fullscreen);
- if (video == 0) {
- video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
+ _video = SDL_SetVideoMode(config.scr_width, config.scr_height, b, fullscreen);
+ if (_video == 0) {
+ _video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
} else {
config.scr_bpp = b;
}
- SDL_UpdateRect(video, 0, 0, config.scr_width, config.scr_height);
+ SDL_UpdateRect(_video, 0, 0, config.scr_width, config.scr_height);
}
if (cursel == 5) {
ofullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
fullscreen = SDL_FULLSCREEN | config.hwaccel | config.hwsurface;
- video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
- if (video == 0) {
- video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, ofullscreen);
+ _video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
+ if (_video == 0) {
+ _video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, ofullscreen);
} else {
config.fullscreen = SDL_FULLSCREEN;
}
- SDL_UpdateRect(video, 0, 0, config.scr_width, config.scr_height);
+ SDL_UpdateRect(_video, 0, 0, config.scr_width, config.scr_height);
}
if (cursel == 6) {
ofullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
fullscreen = 0 | config.hwaccel | config.hwsurface;
- video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
- if (video == 0) {
- video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, ofullscreen);
+ _video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
+ if (_video == 0) {
+ _video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, ofullscreen);
} else {
config.fullscreen = 0;
}
- SDL_UpdateRect(video, 0, 0, config.scr_width, config.scr_height);
+ SDL_UpdateRect(_video, 0, 0, config.scr_width, config.scr_height);
}
if (cursel == 7 && config.music == 0) {
config.music = 1;
@@ -2051,7 +2051,7 @@ void GriffonEngine::game_drawanims(int Layer) {
rcDest.setWidth(16);
rcDest.setHeight(16);
- tiles[curtilel]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ tiles[curtilel]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
if (Layer == 1) {
@@ -2087,7 +2087,7 @@ void GriffonEngine::game_drawanims(int Layer) {
}
if (pass == 1)
- tiles[curtilel]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ tiles[curtilel]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
}
@@ -2104,16 +2104,16 @@ int hud_recalc(int a, int b, int c) {
return result > b ? b : result;
}
-#define RGB(R, G, B) (videobuffer->format.RGBToColor((R), (G), (B)))
+#define RGB(R, G, B) (_videobuffer->format.RGBToColor((R), (G), (B)))
void GriffonEngine::game_drawhud() {
char line[128];
//sprintf(line, "fps: %i, map: %i, exp: %i/%i", (int)fps, curmap, player.exp, player.nextlevel);
- //sys_print(videobuffer, line, 0, 0, 0);
+ //sys_print(_videobuffer, line, 0, 0, 0);
long ccc;
- game_fillrect(videobuffer2, 0, 0, 320, 240, 0);
+ game_fillrect(_videobuffer2, 0, 0, 320, 240, 0);
for (int i = 0; i < kMaxFloat; i++) {
if (floattext[i][0] > 0) {
@@ -2129,13 +2129,13 @@ void GriffonEngine::game_drawhud() {
c2 = 2;
if (fc != 0) {
- sys_print(videobuffer, floatstri[i], (int)(floattext[i][1]) + 0, (int)(floattext[i][2]) - 1, c2);
- sys_print(videobuffer, floatstri[i], (int)(floattext[i][1]) + 0, (int)(floattext[i][2]) + 1, c2);
- sys_print(videobuffer, floatstri[i], (int)(floattext[i][1]) - 1, (int)(floattext[i][2]) + 0, c2);
- sys_print(videobuffer, floatstri[i], (int)(floattext[i][1]) + 1, (int)(floattext[i][2]) + 0, c2);
+ sys_print(_videobuffer, floatstri[i], (int)(floattext[i][1]) + 0, (int)(floattext[i][2]) - 1, c2);
+ sys_print(_videobuffer, floatstri[i], (int)(floattext[i][1]) + 0, (int)(floattext[i][2]) + 1, c2);
+ sys_print(_videobuffer, floatstri[i], (int)(floattext[i][1]) - 1, (int)(floattext[i][2]) + 0, c2);
+ sys_print(_videobuffer, floatstri[i], (int)(floattext[i][1]) + 1, (int)(floattext[i][2]) + 0, c2);
}
- sys_print(videobuffer, floatstri[i], (int)(floattext[i][1]), (int)(floattext[i][2]), c);
+ sys_print(_videobuffer, floatstri[i], (int)(floattext[i][1]), (int)(floattext[i][2]), c);
}
if (floaticon[i][0] > 0) {
@@ -2147,7 +2147,7 @@ void GriffonEngine::game_drawhud() {
rcDest.top = iy;
if (ico != 99)
- itemimg[ico]->blit(*videobuffer, rcDest.left, rcDest.top);
+ itemimg[ico]->blit(*_videobuffer, rcDest.left, rcDest.top);
if (ico == 99) {
spellimg->setAlpha((int)(RND() * 96) + 96, true);
@@ -2159,7 +2159,7 @@ void GriffonEngine::game_drawhud() {
rcDest.left = ix;
rcDest.top = iy;
- spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
spellimg->setAlpha(255, true);
}
@@ -2180,10 +2180,10 @@ void GriffonEngine::game_drawhud() {
rcSrc.left = rcSrc.left + 17;
if (player.foundspell[i] == 1) {
- itemimg[7 + i]->blit(*videobuffer, rcSrc.left, rcSrc.top);
+ itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
- game_fillrect(videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32));
- game_fillrect(videobuffer, rcSrc.left + 1, sy + 17,
+ game_fillrect(_videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32));
+ game_fillrect(_videobuffer, rcSrc.left + 1, sy + 17,
hud_recalc(player.spellcharge[i], 14, 100), 2,
player.spellcharge[i] == 100 ? RGB(255, 128, 32) : RGB(0, 224, 64));
}
@@ -2197,17 +2197,17 @@ void GriffonEngine::game_drawhud() {
rcDest.top = 0;
rcDest.right = 320;
rcDest.bottom = 240;
- videobuffer2->fillRect(rcDest, 0);
- videobuffer2->setAlpha((int)(player.itemselshade * 4)); // FIXME
- videobuffer2->blit(*videobuffer);
+ _videobuffer2->fillRect(rcDest, 0);
+ _videobuffer2->setAlpha((int)(player.itemselshade * 4)); // FIXME
+ _videobuffer2->blit(*_videobuffer);
int sy = 202;
rcSrc.left = 46;
rcSrc.top = 46;
- inventoryimg->setAlpha(160, true); // 128
- inventoryimg->blit(*videobuffer, rcSrc.left, rcSrc.top);
- inventoryimg->setAlpha(255, true);
+ _inventoryimg->setAlpha(160, true); // 128
+ _inventoryimg->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _inventoryimg->setAlpha(255, true);
int sx = 54;
sy = 55;
@@ -2223,44 +2223,44 @@ void GriffonEngine::game_drawhud() {
amap = 3;
if (curmap > 5 && curmap < 42)
amap = 1;
- mapimg[amap]->blit(*videobuffer, rcDest.left, rcDest.top);
+ mapimg[amap]->blit(*_videobuffer, rcDest.left, rcDest.top);
- ccc = videobuffer->format.RGBToColor(128 + 127 * sin(3.141592 * 2 * itemyloc / 16), 0, 0);
+ ccc = _videobuffer->format.RGBToColor(128 + 127 * sin(3.141592 * 2 * itemyloc / 16), 0, 0);
for (int b = 0; b <= 6; b++) {
for (int a = 0; a <= 12; a++) {
if (invmap[amap][b][a] == curmap) {
- game_fillrect(videobuffer, 46 + 9 + a * 9 + 2, 46 + 77 + b * 9 + 1, 6, 6, ccc);
+ game_fillrect(_videobuffer, 46 + 9 + a * 9 + 2, 46 + 77 + b * 9 + 1, 6, 6, ccc);
}
}
}
if (amap == 1) {
- sys_print(videobuffer, "L1", 46 + 9, 46 + 77, 0);
- sys_print(videobuffer, "L2", 46 + 9 + 7 * 9, 46 + 77, 0);
+ sys_print(_videobuffer, "L1", 46 + 9, 46 + 77, 0);
+ sys_print(_videobuffer, "L2", 46 + 9 + 7 * 9, 46 + 77, 0);
}
sprintf(line, "Health: %i/%i", player.hp, player.maxhp);
- sys_print(videobuffer, line, sx, sy, player.hp <= player.maxhp * 0.25 ? (int)player.hpflash : 0);
+ sys_print(_videobuffer, line, sx, sy, player.hp <= player.maxhp * 0.25 ? (int)player.hpflash : 0);
sprintf(line, "Level : %i", player.level);
if (player.level == player.maxlevel)
strcpy(line, "Level : MAX");
- sys_print(videobuffer, line, sx, sy + 8, 0);
+ sys_print(_videobuffer, line, sx, sy + 8, 0);
// experience
- game_fillrect(videobuffer, sx + 64, sy + 16, 16, 4, RGB(0, 32, 32));
- game_fillrect(videobuffer, sx + 65, sy + 17,
+ game_fillrect(_videobuffer, sx + 64, sy + 16, 16, 4, RGB(0, 32, 32));
+ game_fillrect(_videobuffer, sx + 65, sy + 17,
hud_recalc(player.exp, 14, player.nextlevel), 2, RGB(0, 224, 64));
// attack strength
- game_fillrect(videobuffer, sx + 1, sy + 16, 56, 6, RGB(0, 32, 32));
- game_fillrect(videobuffer, sx + 1, sy + 17,
+ game_fillrect(_videobuffer, sx + 1, sy + 16, 56, 6, RGB(0, 32, 32));
+ game_fillrect(_videobuffer, sx + 1, sy + 17,
hud_recalc(player.attackstrength, 54, 100), 2,
player.attackstrength == 100 ? RGB(255, 128, 32) : RGB(0, 64, 224));
// spell strength
- game_fillrect(videobuffer, sx + 1, sy + 19,
+ game_fillrect(_videobuffer, sx + 1, sy + 19,
hud_recalc(player.spellstrength, 54, 100), 2,
player.spellstrength == 100 ? RGB(224, 0, 0) : RGB(128, 0, 224));
@@ -2272,10 +2272,10 @@ void GriffonEngine::game_drawhud() {
int s = (ase - m * 60);
sprintf(line, "%02i:%02i:%02i", h, m, s);
- sys_print(videobuffer, line, 46 + 38 - strlen(line) * 4, 46 + 49, 0);
+ sys_print(_videobuffer, line, 46 + 38 - strlen(line) * 4, 46 + 49, 0);
- sys_print(videobuffer, "Use", 193, 55, 0);
- sys_print(videobuffer, "Cast", 236, 55, 0);
+ sys_print(_videobuffer, "Use", 193, 55, 0);
+ sys_print(_videobuffer, "Cast", 236, 55, 0);
rcSrc.left = 128;
rcSrc.top = 91;
@@ -2283,19 +2283,19 @@ void GriffonEngine::game_drawhud() {
int ss = (player.sword - 1) * 3;
if (player.sword == 3)
ss = 18;
- itemimg[ss]->blit(*videobuffer, rcSrc.left, rcSrc.top);
+ itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
rcSrc.left = rcSrc.left + 16;
ss = (player.shield - 1) * 3 + 1;
if (player.shield == 3)
ss = 19;
- itemimg[ss]->blit(*videobuffer, rcSrc.left, rcSrc.top);
+ itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
rcSrc.left = rcSrc.left + 16;
ss = (player.armour - 1) * 3 + 2;
if (player.armour == 3)
ss = 20;
- itemimg[ss]->blit(*videobuffer, rcSrc.left, rcSrc.top);
+ itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
for (int i = 0; i <= 4; i++) {
sx = 188;
@@ -2303,18 +2303,18 @@ void GriffonEngine::game_drawhud() {
rcSrc.left = sx;
rcSrc.top = sy;
if (i == 0)
- itemimg[6]->blit(*videobuffer, rcSrc.left, rcSrc.top);
+ itemimg[6]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
if (i == 1)
- itemimg[12]->blit(*videobuffer, rcSrc.left, rcSrc.top);
+ itemimg[12]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
if (i == 2)
- itemimg[17]->blit(*videobuffer, rcSrc.left, rcSrc.top);
+ itemimg[17]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
if (i == 3)
- itemimg[16]->blit(*videobuffer, rcSrc.left, rcSrc.top);
+ itemimg[16]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
if (i == 4)
- itemimg[14]->blit(*videobuffer, rcSrc.left, rcSrc.top);
+ itemimg[14]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
sprintf(line, "x%i", player.inventory[i]);
- sys_print(videobuffer, line, sx + 17, sy + 7, 0);
+ sys_print(_videobuffer, line, sx + 17, sy + 7, 0);
}
// spells in menu
@@ -2325,10 +2325,10 @@ void GriffonEngine::game_drawhud() {
sy = rcSrc.top;
if (player.foundspell[i] == 1) {
- itemimg[7 + i]->blit(*videobuffer, rcSrc.left, rcSrc.top);
+ itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
- game_fillrect(videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32));
- game_fillrect(videobuffer, rcSrc.left + 1, sy + 17,
+ game_fillrect(_videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32));
+ game_fillrect(_videobuffer, rcSrc.left + 1, sy + 17,
hud_recalc(player.spellcharge[i], 14, 100), 2,
player.spellcharge[i] == 100 ? RGB(255, 128, 32) : RGB(0, 224, 64));
}
@@ -2340,13 +2340,13 @@ void GriffonEngine::game_drawhud() {
if (curitem == 5 + i) {
rcDest.left = (float)(243 - 12 + 3 * sin(3.141592 * 2 * itemyloc / 16));
rcDest.top = 67 + 24 * i;
- itemimg[15]->blit(*videobuffer, rcDest.left, rcDest.top);
+ itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
}
if (curitem == i) {
rcDest.left = (float)(189 - 12 + 3 * sin(3.141592 * 2 * itemyloc / 16));
rcDest.top = 70 + 24 * i;
- itemimg[15]->blit(*videobuffer, rcDest.left, rcDest.top);
+ itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
}
}
}
@@ -2362,14 +2362,14 @@ void GriffonEngine::game_drawhud() {
rcDest.top = (float)(npcinfo[curenemy].y + 4 - 16 - sin(3.141592 / 8 * itemyloc));
}
- itemimg[13]->blit(*videobuffer, rcDest.left, rcDest.top);
+ itemimg[13]->blit(*_videobuffer, rcDest.left, rcDest.top);
}
}
void GriffonEngine::game_drawnpcs(int mode) {
unsigned int ccc;
- ccc = videobuffer->format.RGBToColor(255, 128, 32);
+ ccc = _videobuffer->format.RGBToColor(255, 128, 32);
int fst = firsty;
int lst = lasty;
@@ -2415,7 +2415,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.top += (int)(RND() * 3) - 1;
}
- anims[sprite]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
int cframe = npcinfo[i].cattackframe;
@@ -2429,7 +2429,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.setWidth(24);
rcDest.setHeight(24);
- animsa[sprite]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ animsa[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -2446,7 +2446,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = npcinfo[i].bodysection[f].x - animset2[s].xofs;
rcDest.top = npcinfo[i].bodysection[f].y - animset2[s].yofs + 2;
- anims[2]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ anims[2]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -2467,7 +2467,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = npcinfo[i].bodysection[f].x - animset9[s].xofs;
rcDest.top = npcinfo[i].bodysection[f].y - animset9[s].yofs + 2;
- anims[9]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ anims[9]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -2486,7 +2486,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = npx - 2;
rcDest.top = npy - 24;
- anims[3]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ anims[3]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
rcSrc.left = 4 * 24;
rcSrc.top = 0;
@@ -2496,7 +2496,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = npx - 2;
rcDest.top = npy - 24;
- anims[3]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ anims[3]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -2514,7 +2514,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = npx - 2;
rcDest.top = npy - 24;
- anims[4]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ anims[4]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
rcSrc.left = 4 * 24;
rcSrc.top = 0;
@@ -2524,7 +2524,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = npx - 2;
rcDest.top = npy - 24;
- anims[4]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ anims[4]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -2545,7 +2545,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (x > 255)
x = 255;
spellimg->setAlpha(x, true);
- spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
spellimg->setAlpha(255, true);
for (int f = 1; f <= 8; f++) {
@@ -2561,7 +2561,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (x > 255)
x = 255;
spellimg->setAlpha(x, true);
- spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
spellimg->setAlpha(255, true);
}
@@ -2574,7 +2574,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.top = npcinfo[i].bodysection[10 * ff + 9].y - 21;
spellimg->setAlpha(192, true);
- anims[5]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ anims[5]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
spellimg->setAlpha(255, true);
}
@@ -2602,7 +2602,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
- anims[sprite]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
// wizard
@@ -2625,7 +2625,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
- anims[sprite]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
// } else {
//cframe = npcinfo[i].cattackframe;
@@ -2638,7 +2638,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
//rcDest.top = npy;
//rcDest.setWidth(24);
//rcDest.setHeight(24);
- // animsa(sprite)->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ // animsa(sprite)->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
// }
}
@@ -2662,7 +2662,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
- anims[sprite]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
@@ -2707,7 +2707,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
- anims[sprite]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
npcinfo[i].floating = npcinfo[i].floating + 0.25 * fpsr;
while (npcinfo[i].floating >= 16)
@@ -2725,7 +2725,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.setWidth(24);
rcDest.setHeight(24);
- animsa[sprite]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ animsa[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -2759,7 +2759,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = sx + 32 + (int)(RND() * 3) - 1;
rcDest.top = sy - (int)(RND() * 6);
- spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
for (int ii = 0; ii <= 8; ii++) {
@@ -2778,7 +2778,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
spellimg->setAlpha(i2 / 3 * 224, true);
- spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
int xloc = rcDest.left;
int yloc = rcDest.top;
@@ -2804,7 +2804,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
spellimg->setAlpha(i2 / 3 * 224, true);
- spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
xloc = rcDest.left;
yloc = rcDest.top;
@@ -2843,7 +2843,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = rcDest.top + (int)(RND() * 3) - 1;
}
- anims[sprite]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
int cframe = (int)(npcinfo[i].cattackframe);
@@ -2855,7 +2855,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = sx;
rcDest.top = sy;
- animsa[sprite]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ animsa[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -2899,7 +2899,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
- anims[sprite]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
rcDest.left = npx + 4;
@@ -2907,7 +2907,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.setWidth(16);
rcDest.setHeight(4);
- videobuffer->fillRect(rcDest, 0);
+ _videobuffer->fillRect(rcDest, 0);
rcDest.left = npx + 5;
rcDest.top = npy + 23;
@@ -2923,7 +2923,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.setHeight(2);
- videobuffer->fillRect(rcDest, ccc);
+ _videobuffer->fillRect(rcDest, ccc);
int pass = 1;
@@ -2984,7 +2984,7 @@ void GriffonEngine::game_drawover(int modx, int mody) {
}
if (pass == 1)
- tiles[curtilel]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ tiles[curtilel]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
}
@@ -3009,7 +3009,7 @@ void GriffonEngine::game_drawplayer() {
rcDest.setWidth(24);
rcDest.setHeight(24);
- anims[f]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ anims[f]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
rcSrc.left = (int)(player.attackframe / 4) * 24;
rcSrc.top = player.walkdir * 24;
@@ -3021,19 +3021,19 @@ void GriffonEngine::game_drawplayer() {
rcDest.setWidth(24);
rcDest.setHeight(24);
- animsa[f]->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ animsa[f]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
- ccc = videobuffer->format.RGBToColor(224, 224, 64);
+ ccc = _videobuffer->format.RGBToColor(224, 224, 64);
int pass = 0;
if (player.hp <= player.maxhp * 0.25)
pass = 1;
if (pass == 1) {
- ccc = videobuffer->format.RGBToColor(255, 255, 255);
- if ((int)(player.hpflash) == 1) ccc = videobuffer->format.RGBToColor(255, 0, 0);
+ ccc = _videobuffer->format.RGBToColor(255, 255, 255);
+ if ((int)(player.hpflash) == 1) ccc = _videobuffer->format.RGBToColor(255, 0, 0);
}
int sss = 6;
@@ -3046,7 +3046,7 @@ void GriffonEngine::game_drawplayer() {
rcDest.setWidth(16);
rcDest.setHeight(sss);
- videobuffer->fillRect(rcDest, 0);
+ _videobuffer->fillRect(rcDest, 0);
rcDest.left = npx + 5;
rcDest.top = npy + 23;
@@ -3061,11 +3061,11 @@ void GriffonEngine::game_drawplayer() {
rcDest.setWidth(ww);
rcDest.setHeight(2);
- videobuffer->fillRect(rcDest, ccc);
+ _videobuffer->fillRect(rcDest, ccc);
- ccc = videobuffer->format.RGBToColor(0, 224, 64);
+ ccc = _videobuffer->format.RGBToColor(0, 224, 64);
if (player.attackstrength == 100)
- ccc = videobuffer->format.RGBToColor(255, 128, 32);
+ ccc = _videobuffer->format.RGBToColor(255, 128, 32);
ww = 14 * player.attackstrength / 100;
if (ww > 14)
@@ -3079,23 +3079,23 @@ void GriffonEngine::game_drawplayer() {
rcDest.setWidth(ww);
rcDest.setHeight(2);
- videobuffer->fillRect(rcDest, ccc);
+ _videobuffer->fillRect(rcDest, ccc);
- ccc = videobuffer->format.RGBToColor(128, 0, 224);
+ ccc = _videobuffer->format.RGBToColor(128, 0, 224);
if (player.spellstrength == 100)
- ccc = videobuffer->format.RGBToColor(224, 0, 0);
+ ccc = _videobuffer->format.RGBToColor(224, 0, 0);
rcDest.top = rcDest.top + 2;
rcDest.setWidth(ww2);
rcDest.setHeight(2);
- videobuffer->fillRect(rcDest, ccc);
+ _videobuffer->fillRect(rcDest, ccc);
}
void GriffonEngine::game_drawview() {
Common::Rect rc;
- videobuffer->copyRectToSurface(mapbg->getPixels(), mapbg->pitch, 0, 0, mapbg->w, mapbg->h);
+ _videobuffer->copyRectToSurface(mapbg->getPixels(), mapbg->pitch, 0, 0, mapbg->w, mapbg->h);
game_updspellsunder();
@@ -3122,12 +3122,12 @@ void GriffonEngine::game_drawview() {
rc.setWidth(320);
rc.setHeight(240);
- cloudimg->blit(*videobuffer, 0, 0, Graphics::FLIP_NONE, &rc);
+ cloudimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, &rc);
}
game_drawhud();
- g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
}
void GriffonEngine::game_endofgame() {
@@ -3147,9 +3147,9 @@ void GriffonEngine::game_endofgame() {
ticks1 = ticks;
int ya = 0;
- videobuffer2->fillRect(Common::Rect(0, 0, videobuffer2->w, videobuffer2->h), 0);
- videobuffer3->fillRect(Common::Rect(0, 0, videobuffer3->w, videobuffer3->h), 0);
- videobuffer2->copyRectToSurface(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ _videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
+ _videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
+ _videobuffer2->copyRectToSurface(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
float ld = 0;
int ldstop = 0;
@@ -3175,13 +3175,13 @@ void GriffonEngine::game_endofgame() {
break;
}
- videobuffer->fillRect(Common::Rect(0, 0, videobuffer->w, videobuffer->h), 0);
+ _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
- videobuffer->setAlpha(ya);
- videobuffer3->copyRectToSurface(videobuffer2->getPixels(), videobuffer2->pitch, 0, 0, videobuffer2->w, videobuffer2->h);
- videobuffer3->copyRectToSurface(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ _videobuffer->setAlpha(ya);
+ _videobuffer3->copyRectToSurface(_videobuffer2->getPixels(), _videobuffer2->pitch, 0, 0, _videobuffer2->w, _videobuffer2->h);
+ _videobuffer3->copyRectToSurface(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
- g_system->copyRectToScreen(videobuffer3->getPixels(), videobuffer3->pitch, 0, 0, videobuffer3->w, videobuffer3->h);
+ g_system->copyRectToScreen(_videobuffer3->getPixels(), _videobuffer3->pitch, 0, 0, _videobuffer3->w, _videobuffer3->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(event);
@@ -3211,19 +3211,19 @@ void GriffonEngine::game_endofgame() {
rc.left = -xofs;
rc.top = 0;
- titleimg->blit(*videobuffer, rc.left, rc.top);
+ _titleimg->blit(*_videobuffer, rc.left, rc.top);
rc.left = -xofs + 320;
rc.top = 0;
- titleimg->blit(*videobuffer, rc.left, rc.top);
+ _titleimg->blit(*_videobuffer, rc.left, rc.top);
y = y - spd * fpsr;
for (int i = 0; i <= 26; i++) {
int yy = y + i * 10;
if (yy > -8 && yy < 240) {
int x = 160 - strlen(story2[i]) * 4;
- sys_print(videobuffer, story2[i], x, yy, 4);
+ sys_print(_videobuffer, story2[i], x, yy, 4);
}
if (yy < 10 && i == 25)
@@ -3239,8 +3239,8 @@ void GriffonEngine::game_endofgame() {
ya = 255;
}
- videobuffer->setAlpha(ya);
- g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ _videobuffer->setAlpha(ya);
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(event);
@@ -3279,7 +3279,7 @@ void GriffonEngine::game_endofgame() {
ticks1 = ticks;
int y1 = 0;
- videobuffer2->copyRectToSurface(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ _videobuffer2->copyRectToSurface(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
do {
if (ticks < ticks1 + 1500) {
@@ -3292,13 +3292,13 @@ void GriffonEngine::game_endofgame() {
break;
}
- videobuffer->fillRect(Common::Rect(0, 0, videobuffer->w, videobuffer->h), 0);
+ _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
- videobuffer->setAlpha(y1);
- videobuffer2->blit(*videobuffer3);
- videobuffer->blit(*videobuffer3);
+ _videobuffer->setAlpha(y1);
+ _videobuffer2->blit(*_videobuffer3);
+ _videobuffer->blit(*_videobuffer3);
- g_system->copyRectToScreen(videobuffer3->getPixels(), videobuffer3->pitch, 0, 0, videobuffer3->w, videobuffer3->h);
+ g_system->copyRectToScreen(_videobuffer3->getPixels(), _videobuffer3->pitch, 0, 0, _videobuffer3->w, _videobuffer3->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(event);
@@ -3325,7 +3325,7 @@ void GriffonEngine::game_endofgame() {
y1 = 0;
do {
- videobuffer->copyRectToSurface(theendimg->getPixels(), theendimg->pitch, 0, 0, theendimg->w, theendimg->h);
+ _videobuffer->copyRectToSurface(_theendimg->getPixels(), _theendimg->pitch, 0, 0, _theendimg->w, _theendimg->h);
y1 = 255;
if (ticks < ticks1 + 1000) {
@@ -3336,8 +3336,8 @@ void GriffonEngine::game_endofgame() {
y1 = 255;
}
- videobuffer->setAlpha(y1);
- g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ _videobuffer->setAlpha(y1);
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(event);
@@ -3363,8 +3363,8 @@ void GriffonEngine::game_endofgame() {
} while (1);
- videobuffer2->fillRect(Common::Rect(0, 0, videobuffer2->w, videobuffer2->h), 0);
- videobuffer3->fillRect(Common::Rect(0, 0, videobuffer3->w, videobuffer3->h), 0);
+ _videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
+ _videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
game_theend();
@@ -3373,8 +3373,8 @@ void GriffonEngine::game_endofgame() {
void GriffonEngine::game_eventtext(const char *stri) {
int x, fr, pauseticks, bticks;
- videobuffer2->fillRect(Common::Rect(0, 0, videobuffer2->w, videobuffer2->h), 0);
- videobuffer3->fillRect(Common::Rect(0, 0, videobuffer3->w, videobuffer3->h), 0);
+ _videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
+ _videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
x = 160 - 4 * strlen(stri);
@@ -3382,15 +3382,15 @@ void GriffonEngine::game_eventtext(const char *stri) {
pauseticks = ticks + 500;
bticks = ticks;
- videobuffer->blit(*videobuffer3);
- videobuffer->blit(*videobuffer2);
+ _videobuffer->blit(*_videobuffer3);
+ _videobuffer->blit(*_videobuffer2);
do {
g_system->getEventManager()->pollEvent(event);
if (event.type == Common::EVENT_KEYDOWN && pauseticks < ticks)
break;
- videobuffer2->blit(*videobuffer);
+ _videobuffer2->blit(*_videobuffer);
fr = 192;
@@ -3401,11 +3401,11 @@ void GriffonEngine::game_eventtext(const char *stri) {
windowimg->setAlpha(fr, true);
- windowimg->blit(*videobuffer);
+ windowimg->blit(*_videobuffer);
if (pauseticks < ticks)
- sys_print(videobuffer, stri, x, 15, 0);
+ sys_print(_videobuffer, stri, x, 15, 0);
- g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(event);
@@ -3427,7 +3427,7 @@ void GriffonEngine::game_eventtext(const char *stri) {
g_system->delayMillis(10);
} while (1);
- videobuffer3->blit(*videobuffer);
+ _videobuffer3->blit(*_videobuffer);
itemticks = ticks + 210;
}
@@ -4525,13 +4525,13 @@ void GriffonEngine::game_newgame() {
float ld = 0, add;
int ticks, cnt = 0;
- videobuffer2->fillRect(Common::Rect(0, 0, videobuffer2->w, videobuffer2->h), 0);
- videobuffer3->fillRect(Common::Rect(0, 0, videobuffer3->w, videobuffer3->h), 0);
+ _videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
+ _videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
ticks = g_system->getMillis();
- videobuffer->blit(*videobuffer3);
- videobuffer->blit(*videobuffer2);
+ _videobuffer->blit(*_videobuffer3);
+ _videobuffer->blit(*_videobuffer2);
fpsr = 0.0;
int y = 140;
@@ -4562,12 +4562,12 @@ void GriffonEngine::game_newgame() {
rc.left = -xofs;
rc.top = 0;
- titleimg->blit(*videobuffer, rc.left, rc.top);
+ _titleimg->blit(*_videobuffer, rc.left, rc.top);
rc.left = -xofs + 320;
rc.top = 0;
- titleimg->blit(*videobuffer, rc.left, rc.top);
+ _titleimg->blit(*_videobuffer, rc.left, rc.top);
if (++cnt >= 6) {
cnt = 0;
@@ -4580,14 +4580,14 @@ void GriffonEngine::game_newgame() {
yy = y + i * 10;
if (yy > -8 && yy < 240) {
x = 160 - strlen(story[i]) * 4;
- sys_print(videobuffer, story[i], x, yy, 4);
+ sys_print(_videobuffer, story[i], x, yy, 4);
}
if (yy < 10 && i == 47)
goto __exit_do;
}
- g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
tickspassed = ticks;
@@ -4805,7 +4805,7 @@ void GriffonEngine::game_saveloadnew() {
clouddeg = 0;
- videobuffer->setAlpha(255);
+ _videobuffer->setAlpha(255);
saveloadimg->setAlpha(192, true);
currow = 0;
@@ -4818,7 +4818,7 @@ void GriffonEngine::game_saveloadnew() {
tickpause = ticks + 150;
do {
- videobuffer->fillRect(Common::Rect(0, 0, videobuffer->w, videobuffer->h), 0);
+ _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
y = y + 1 * fpsr;
@@ -4828,7 +4828,7 @@ void GriffonEngine::game_saveloadnew() {
rcDest.setHeight(240);
cloudimg->setAlpha(128, true);
- cloudimg->blit(*videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
+ cloudimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
cloudimg->setAlpha(64, true);
rcDest.left = 256;
@@ -4837,10 +4837,10 @@ void GriffonEngine::game_saveloadnew() {
rcDest.setHeight(240);
cloudimg->setAlpha(128, true);
- cloudimg->blit(*videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
+ cloudimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
cloudimg->setAlpha(64, true);
- saveloadimg->blit(*videobuffer);
+ saveloadimg->blit(*_videobuffer);
g_system->getEventManager()->pollEvent(event);
@@ -4989,21 +4989,21 @@ void GriffonEngine::game_saveloadnew() {
int s = (ase - m * 60);
sprintf(line, "Game Time: %02i:%02i:%02i", h, m, s);
- sys_print(videobuffer, line, 160 - strlen(line) * 4, sy, 0);
+ sys_print(_videobuffer, line, 160 - strlen(line) * 4, sy, 0);
sx = 12;
sy = sy + 11;
cc = 0;
sprintf(line, "Health: %i/%i", playera.hp, playera.maxhp);
- sys_print(videobuffer, line, sx, sy, cc);
+ sys_print(_videobuffer, line, sx, sy, cc);
if (playera.level == 22)
strcpy(line, "Level: MAX");
else
sprintf(line, "Level: %i", playera.level);
- sys_print(videobuffer, line, sx, sy + 11, 0);
+ sys_print(_videobuffer, line, sx, sy + 11, 0);
rcSrc.left = sx + 15 * 8 + 24;
rcSrc.top = sy + 1;
@@ -5011,19 +5011,19 @@ void GriffonEngine::game_saveloadnew() {
ss = (playera.sword - 1) * 3;
if (playera.sword == 3)
ss = 18;
- itemimg[ss]->blit(*videobuffer, rcSrc.left, rcSrc.top);
+ itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
rcSrc.left = rcSrc.left + 16;
ss = (playera.shield - 1) * 3 + 1;
if (playera.shield == 3)
ss = 19;
- itemimg[ss]->blit(*videobuffer, rcSrc.left, rcSrc.top);
+ itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
rcSrc.left = rcSrc.left + 16;
ss = (playera.armour - 1) * 3 + 2;
if (playera.armour == 3)
ss = 20;
- itemimg[ss]->blit(*videobuffer, rcSrc.left, rcSrc.top);
+ itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
nx = rcSrc.left + 13 + 3 * 8;
rcSrc.left = nx - 17;
@@ -5032,12 +5032,12 @@ void GriffonEngine::game_saveloadnew() {
for (int i = 0; i < 5; i++) {
rcSrc.left = rcSrc.left + 17;
if (playera.foundspell[i] == 1)
- itemimg[7 + i]->blit(*videobuffer, rcSrc.left, rcSrc.top);
+ itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
}
}
} else {
int sy = 57 + ff * 48;
- sys_print(videobuffer, "Empty", 160 - 5 * 4, sy, 0);
+ sys_print(_videobuffer, "Empty", 160 - 5 * 4, sy, 0);
}
}
// ------------------------------------------
@@ -5061,7 +5061,7 @@ void GriffonEngine::game_saveloadnew() {
rcDest.top = (float)(53 + (currow - 1) * 48);
}
- itemimg[15]->blit(*videobuffer, rcDest.left, rcDest.top);
+ itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
if (lowerlock == 1) {
@@ -5072,7 +5072,7 @@ void GriffonEngine::game_saveloadnew() {
rcDest.left = 170;
rcDest.left = rcDest.left; // + 2 + 2 * sin(-3.14159 * 2 * itemyloc / 16)
- itemimg[15]->blit(*videobuffer, rcDest.left, rcDest.top);
+ itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
}
yy = 255;
@@ -5084,8 +5084,8 @@ void GriffonEngine::game_saveloadnew() {
yy = 255;
}
- videobuffer->setAlpha((int)yy);
- g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ _videobuffer->setAlpha((int)yy);
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(event);
@@ -5144,10 +5144,10 @@ void GriffonEngine::game_showlogos() {
y = 255.0;
}
- videobuffer->fillRect(Common::Rect(0, 0, 320, 240), 0);
- logosimg->blit(*videobuffer, 0, 0, Graphics::FLIP_NONE, nullptr, TS_ARGB((int)y, (int)y, (int)y, (int)y));
+ _videobuffer->fillRect(Common::Rect(0, 0, 320, 240), 0);
+ _logosimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, nullptr, TS_ARGB((int)y, (int)y, (int)y, (int)y));
- g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(event);
@@ -5183,10 +5183,10 @@ void GriffonEngine::game_swash() {
do {
y = y + 1 * fpsr;
- videobuffer->setAlpha((int)y);
- videobuffer->fillRect(Common::Rect(0, 0, videobuffer->w, videobuffer->h), 0);
+ _videobuffer->setAlpha((int)y);
+ _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
- g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(event);
@@ -5217,8 +5217,8 @@ void GriffonEngine::game_swash() {
do {
y = y + 1 * fpsr;
- videobuffer->setAlpha((int)(y * 25));
- mapbg->blit(*videobuffer);
+ _videobuffer->setAlpha((int)(y * 25));
+ mapbg->blit(*_videobuffer);
if (cloudson == 1) {
rcDest.left = (float)(256 + 256 * cos(3.141592 / 180 * clouddeg));
@@ -5226,10 +5226,10 @@ void GriffonEngine::game_swash() {
rcDest.setWidth(320);
rcDest.setHeight(240);
- cloudimg->blit(*videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
+ cloudimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
}
- g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(event);
@@ -5257,7 +5257,7 @@ void GriffonEngine::game_swash() {
} while (1);
- videobuffer->setAlpha(255);
+ _videobuffer->setAlpha(255);
}
void GriffonEngine::game_theend() {
@@ -5267,9 +5267,9 @@ void GriffonEngine::game_theend() {
}
for (float y = 0; y < 100; y += fpsr) {
- videobuffer->setAlpha((int)y);
- videobuffer->fillRect(Common::Rect(0, 0, videobuffer->w, videobuffer->h), 0);
- g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ _videobuffer->setAlpha((int)y);
+ _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(event);
@@ -5303,13 +5303,13 @@ void GriffonEngine::game_title(int mode) {
rcSrc.setWidth(320);
rcSrc.setHeight(240);
- videobuffer2->fillRect(rcSrc, 0);
- videobuffer3->fillRect(rcSrc, 0);
+ _videobuffer2->fillRect(rcSrc, 0);
+ _videobuffer3->fillRect(rcSrc, 0);
ticks = g_system->getMillis();
- videobuffer->blit(*videobuffer3);
- videobuffer->blit(*videobuffer2);
+ _videobuffer->blit(*_videobuffer3);
+ _videobuffer->blit(*_videobuffer2);
cursel = 0;
@@ -5344,34 +5344,34 @@ void GriffonEngine::game_title(int mode) {
rc.left = -xofs;
rc.top = 0;
- titleimg->blit(*videobuffer, rc.left, rc.top);
+ _titleimg->blit(*_videobuffer, rc.left, rc.top);
rc.left = -xofs + 320.0;
rc.top = 0;
- titleimg->blit(*videobuffer, rc.left, rc.top);
+ _titleimg->blit(*_videobuffer, rc.left, rc.top);
rc.left = 0;
rc.top = 0;
- titleimg2->blit(*videobuffer, rc.left, rc.top);
+ _titleimg2->blit(*_videobuffer, rc.left, rc.top);
y = 172;
x = 160 - 14 * 4;
- sys_print(videobuffer, "new game/save/load", x, y, 4);
- sys_print(videobuffer, "options", x, y + 16, 4);
- sys_print(videobuffer, "quit game", x, y + 32, 4);
+ sys_print(_videobuffer, "new game/save/load", x, y, 4);
+ sys_print(_videobuffer, "options", x, y + 16, 4);
+ sys_print(_videobuffer, "quit game", x, y + 32, 4);
if (mode == 1)
- sys_print(videobuffer, "return", x, y + 48, 4);
+ sys_print(_videobuffer, "return", x, y + 48, 4);
else
- sys_print(videobuffer, "(c) 2005 by Daniel 'Syn9' Kennedy", 28, 224, 4);
+ sys_print(_videobuffer, "(c) 2005 by Daniel 'Syn9' Kennedy", 28, 224, 4);
rc.left = (float)(x - 16 - 4 * cos(3.14159 * 2 * itemyloc / 16));
rc.top = (float)(y - 4 + 16 * cursel);
- itemimg[15]->blit(*videobuffer, rc.left, rc.top);
+ itemimg[15]->blit(*_videobuffer, rc.left, rc.top);
float yf = 255.0;
if (ticks < ticks1 + 1000) {
@@ -5382,8 +5382,8 @@ void GriffonEngine::game_title(int mode) {
yf = 255.0;
}
- videobuffer->setAlpha((int)yf);
- g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ _videobuffer->setAlpha((int)yf);
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
tickspassed = ticks;
@@ -6774,7 +6774,7 @@ void GriffonEngine::game_updspells() {
if (xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
spellimg->setAlpha(alf, true);
- spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
spellimg->setAlpha(255, true);
if (spellinfo[i].damagewho == 0) {
@@ -6852,7 +6852,7 @@ void GriffonEngine::game_updspells() {
rcDest.left = xloc;
rcDest.top = yloc;
- spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
if (spellinfo[i].frame < 0)
@@ -6978,7 +6978,7 @@ void GriffonEngine::game_updspells() {
rcDest.top = yloc;
if (xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
- spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
if (scatter == 1) {
if (spellinfo[i].damagewho == 0) {
@@ -7058,7 +7058,7 @@ void GriffonEngine::game_updspells() {
f = 192 * (1 - (fra - 24) / 8);
spellimg->setAlpha(f, true);
- spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
spellimg->setAlpha(255, true);
spellinfo[i].frame = spellinfo[i].frame - 0.3 * fpsr;
@@ -7155,7 +7155,7 @@ void GriffonEngine::game_updspells() {
rcDest.left = xloc;
rcDest.top = yloc;
- spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
spellimg->setAlpha(255, true);
@@ -7190,7 +7190,7 @@ void GriffonEngine::game_updspells() {
rcDest.left = xloc;
rcDest.top = yloc;
- spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
if (xloc < -1 || yloc < -1 || xloc > 304 || yloc > 224)
@@ -7232,9 +7232,9 @@ void GriffonEngine::game_updspells() {
// lightning bomb
if (spellnum == 8) {
- cl1 = videobuffer->format.RGBToColor(0, 32, 204);
- cl2 = videobuffer->format.RGBToColor(142, 173, 191);
- cl3 = videobuffer->format.RGBToColor(240, 240, 240);
+ cl1 = _videobuffer->format.RGBToColor(0, 32, 204);
+ cl2 = _videobuffer->format.RGBToColor(142, 173, 191);
+ cl3 = _videobuffer->format.RGBToColor(240, 240, 240);
float px = player.px + 12;
float py = player.py + 12;
@@ -7253,13 +7253,13 @@ void GriffonEngine::game_updspells() {
if (orn == 2)
y = y + 1;
- sys_line(videobuffer, x, y - 1, x, y + 2, cl1);
- sys_line(videobuffer, x, y, x, y + 1, cl3);
+ sys_line(_videobuffer, x, y - 1, x, y + 2, cl1);
+ sys_line(_videobuffer, x, y, x, y + 1, cl3);
if (rn == 0)
- sys_line(videobuffer, x, y + 1, x, y + 1, cl2);
+ sys_line(_videobuffer, x, y + 1, x, y + 1, cl2);
if (rn == 2)
- sys_line(videobuffer, x, y, x, y, cl2);
+ sys_line(_videobuffer, x, y, x, y, cl2);
orn = rn;
@@ -7311,13 +7311,13 @@ void GriffonEngine::game_updspells() {
if (orn == 2)
y = y + 1;
- sys_line(videobuffer, x, y - 1, x, y + 2, cl1);
- sys_line(videobuffer, x, y, x, y + 1, cl3);
+ sys_line(_videobuffer, x, y - 1, x, y + 2, cl1);
+ sys_line(_videobuffer, x, y, x, y + 1, cl3);
if (rn == 0)
- sys_line(videobuffer, x, y + 1, x, y + 1, cl2);
+ sys_line(_videobuffer, x, y + 1, x, y + 1, cl2);
if (rn == 2)
- sys_line(videobuffer, x, y, x, y, cl2);
+ sys_line(_videobuffer, x, y, x, y, cl2);
orn = rn;
@@ -7369,13 +7369,13 @@ void GriffonEngine::game_updspells() {
if (orn == 2)
x = x + 1;
- sys_line(videobuffer, x - 1, y, x + 2, y, cl1);
- sys_line(videobuffer, x, y, x + 1, y, cl3);
+ sys_line(_videobuffer, x - 1, y, x + 2, y, cl1);
+ sys_line(_videobuffer, x, y, x + 1, y, cl3);
if (rn == 0)
- sys_line(videobuffer, x + 1, y, x + 1, y, cl2);
+ sys_line(_videobuffer, x + 1, y, x + 1, y, cl2);
if (rn == 2)
- sys_line(videobuffer, x, y, x, y, cl2);
+ sys_line(_videobuffer, x, y, x, y, cl2);
orn = rn;
@@ -7426,13 +7426,13 @@ void GriffonEngine::game_updspells() {
if (orn == 2)
x = x + 1;
- sys_line(videobuffer, x - 1, y, x + 2, y, cl1);
- sys_line(videobuffer, x, y, x + 1, y, cl3);
+ sys_line(_videobuffer, x - 1, y, x + 2, y, cl1);
+ sys_line(_videobuffer, x, y, x + 1, y, cl3);
if (rn == 0)
- sys_line(videobuffer, x + 1, y, x + 1, y, cl2);
+ sys_line(_videobuffer, x + 1, y, x + 1, y, cl2);
if (rn == 2)
- sys_line(videobuffer, x, y, x, y, cl2);
+ sys_line(_videobuffer, x, y, x, y, cl2);
orn = rn;
@@ -7484,9 +7484,9 @@ void GriffonEngine::game_updspells() {
// wizard 1 lightning
if (spellnum == 9) {
- cl1 = videobuffer->format.RGBToColor(0, 32, 204);
- cl2 = videobuffer->format.RGBToColor(142, 173, 191);
- cl3 = videobuffer->format.RGBToColor(240, 240, 240);
+ cl1 = _videobuffer->format.RGBToColor(0, 32, 204);
+ cl2 = _videobuffer->format.RGBToColor(142, 173, 191);
+ cl3 = _videobuffer->format.RGBToColor(240, 240, 240);
int px = spellinfo[i].enemyx + 12;
int py = spellinfo[i].enemyy + 24;
@@ -7505,13 +7505,13 @@ void GriffonEngine::game_updspells() {
if (orn == 2)
x = x + 1;
- sys_line(videobuffer, x - 1, y, x + 2, y, cl1);
- sys_line(videobuffer, x, y, x + 1, y, cl3);
+ sys_line(_videobuffer, x - 1, y, x + 2, y, cl1);
+ sys_line(_videobuffer, x, y, x + 1, y, cl3);
if (rn == 0)
- sys_line(videobuffer, x + 1, y, x + 1, y, cl2);
+ sys_line(_videobuffer, x + 1, y, x + 1, y, cl2);
if (rn == 2)
- sys_line(videobuffer, x, y, x, y, cl2);
+ sys_line(_videobuffer, x, y, x, y, cl2);
orn = rn;
@@ -7582,7 +7582,7 @@ void GriffonEngine::game_updspellsunder() {
f = 160 * (1 - (fra - 24) / 8);
spellimg->setAlpha(f, true);
- spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
spellimg->setAlpha(255, true);
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
@@ -7684,7 +7684,7 @@ void GriffonEngine::game_updspellsunder() {
rcDest.top = (int)yloc;
if (xloc > -1 && xloc < 304 && yloc > -1 && yloc < 224) {
- spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
int sx = (xloc / 2 + 4);
int sy = (yloc / 2 + 8);
@@ -7812,7 +7812,7 @@ void GriffonEngine::game_updspellsunder() {
rcDest.top = yloc;
if (xloc > -16 && xloc < 320 && yloc > -16 && yloc < 240) {
- spellimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
if (spellinfo[i].damagewho == 1) {
float xdif = (xloc + 8) - (player.px + 12);
@@ -7855,14 +7855,14 @@ void GriffonEngine::sys_initialize() {
for (int i = 0; i < kMaxFloat; i++)
floatstri[i] = (char *)malloc(64); // 64 bytes each string (should be enough)
- video = new Graphics::TransparentSurface;
- video->create(320, 240, g_system->getScreenFormat());
- videobuffer = new Graphics::TransparentSurface;
- videobuffer->create(320, 240, g_system->getScreenFormat());
- videobuffer2 = new Graphics::TransparentSurface;
- videobuffer2->create(320, 240, g_system->getScreenFormat());
- videobuffer3 = new Graphics::TransparentSurface;
- videobuffer3->create(320, 240, g_system->getScreenFormat());
+ _video = new Graphics::TransparentSurface;
+ _video->create(320, 240, g_system->getScreenFormat());
+ _videobuffer = new Graphics::TransparentSurface;
+ _videobuffer->create(320, 240, g_system->getScreenFormat());
+ _videobuffer2 = new Graphics::TransparentSurface;
+ _videobuffer2->create(320, 240, g_system->getScreenFormat());
+ _videobuffer3 = new Graphics::TransparentSurface;
+ _videobuffer3->create(320, 240, g_system->getScreenFormat());
mapbg = new Graphics::TransparentSurface;
mapbg->create(320, 240, g_system->getScreenFormat());
clipbg = new Graphics::TransparentSurface;
@@ -7884,14 +7884,14 @@ void GriffonEngine::sys_initialize() {
saveloadimg = IMG_Load("art/saveloadnew.bmp", true);
saveloadimg->setAlpha(160, true);
- titleimg = IMG_Load("art/titleb.bmp");
- titleimg2 = IMG_Load("art/titlea.bmp", true);
- //titleimg2->setAlpha(204, true);
+ _titleimg = IMG_Load("art/titleb.bmp");
+ _titleimg2 = IMG_Load("art/titlea.bmp", true);
+ //_titleimg2->setAlpha(204, true);
- inventoryimg = IMG_Load("art/inventory.bmp", true);
+ _inventoryimg = IMG_Load("art/inventory.bmp", true);
- logosimg = IMG_Load("art/logos.bmp");
- theendimg = IMG_Load("art/theend.bmp");
+ _logosimg = IMG_Load("art/logos.bmp");
+ _theendimg = IMG_Load("art/theend.bmp");
sys_LoadTiles();
@@ -8162,12 +8162,12 @@ void GriffonEngine::sys_print(Graphics::TransparentSurface *buffer, const char *
void GriffonEngine::sys_progress(int w, int wm) {
long ccc;
- ccc = videobuffer->format.RGBToColor(0, 255, 0);
+ ccc = _videobuffer->format.RGBToColor(0, 255, 0);
rcDest.setWidth(w * 74 / wm);
- videobuffer->fillRect(rcDest, ccc);
+ _videobuffer->fillRect(rcDest, ccc);
- g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(event);
@@ -8185,7 +8185,7 @@ void GriffonEngine::sys_setupAudio() {
//atexit(Mix_CloseAudio);
const char *stri = "Loading...";
- sys_print(videobuffer, stri, 160 - 4 * strlen(stri), 116, 0);
+ sys_print(_videobuffer, stri, 160 - 4 * strlen(stri), 116, 0);
loadimg = IMG_Load("art/load.bmp", true);
@@ -8198,9 +8198,9 @@ void GriffonEngine::sys_setupAudio() {
rcDest.top = 116 + 12;
loadimg->setAlpha(160, true); // 128
- loadimg->blit(*videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ loadimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- g_system->copyRectToScreen(videobuffer->getPixels(), videobuffer->pitch, 0, 0, videobuffer->w, videobuffer->h);
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
rcDest.left = 160 - 44 + 7;
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 4707a0c..7c1ec28 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -300,11 +300,11 @@ private:
int state_save(int slotnum);
private:
- Graphics::TransparentSurface *video, *videobuffer, *videobuffer2, *videobuffer3;
+ Graphics::TransparentSurface *_video, *_videobuffer, *_videobuffer2, *_videobuffer3;
// system
- Graphics::TransparentSurface *titleimg, *titleimg2, *inventoryimg;
- Graphics::TransparentSurface *logosimg, *theendimg;
+ Graphics::TransparentSurface *_titleimg, *_titleimg2, *_inventoryimg;
+ Graphics::TransparentSurface *_logosimg, *_theendimg;
Common::Event event;
Graphics::TransparentSurface *mapbg, *clipbg, *clipbg2;
Commit: f07567c4b315ab3dd80cab6f9bcdf48b1b73561f
https://github.com/scummvm/scummvm/commit/f07567c4b315ab3dd80cab6f9bcdf48b1b73561f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix warnings
Changed paths:
engines/griffon/engine.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 7449c2c..49410d9 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -4523,7 +4523,7 @@ void GriffonEngine::game_main() {
void GriffonEngine::game_newgame() {
float xofs = 0;
float ld = 0, add;
- int ticks, cnt = 0;
+ int cnt = 0;
_videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
_videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
@@ -4801,7 +4801,7 @@ void GriffonEngine::game_saveloadnew() {
float y = 0.0;
int yy;
int currow, curcol, lowerlock;
- int ticks, ticks1, tickpause;
+ int ticks1, tickpause;
clouddeg = 0;
@@ -5294,7 +5294,7 @@ void GriffonEngine::game_theend() {
void GriffonEngine::game_title(int mode) {
float xofs = 0;
- int ticks, ticks1, keypause;
+ int ticks1, keypause;
int cursel, ldstop;
int x, y;
Commit: 5f8b6851e0871527afdd4fd9e8b9b8cf6d0e08c5
https://github.com/scummvm/scummvm/commit/5f8b6851e0871527afdd4fd9e8b9b8cf6d0e08c5
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: const'ness
Changed paths:
engines/griffon/engine.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 49410d9..0bd147c 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -115,7 +115,7 @@ void GriffonEngine::griffon_main() {
}
// element tile locations
-int elementmap[15][20] = {
+const int elementmap[15][20] = {
{ 2, 2, 2, 2, -1, -1, -1, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1 },
{ 2, -1, -1, -1, -1, -1, -1, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1 },
{ 2, -1, 2, 2, -1, -1, -1, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1 },
@@ -215,7 +215,7 @@ const char *story2[27] = {
};
// map in inventory menu
-int invmap[4][7][13] = {
+const int invmap[4][7][13] = {
// map 0
{
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
Commit: 20270594f73d12ff8ce942d5cc01b0205d5c15b4
https://github.com/scummvm/scummvm/commit/20270594f73d12ff8ce942d5cc01b0205d5c15b4
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix some warning in MSVC9 by enforcing the use of float numbers.
Also, add a couple of comments
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 0bd147c..226658e 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -298,7 +298,7 @@ Graphics::TransparentSurface *IMG_Load(const char *name, bool colorkey = false)
// copypaste from hRnd_CRT()
float GriffonEngine::RND() {
/* return between 0 and 1 (but never 1) */
- return (float)_rnd->getRandomNumber(32767) * (1.0 / 32768.0f);
+ return (float)_rnd->getRandomNumber(32767) * (1.0f / 32768.0f);
}
void GriffonEngine::game_addFloatIcon(int ico, float xloc, float yloc) {
@@ -730,11 +730,11 @@ void GriffonEngine::game_castspell(int spellnum, float homex, float homey, float
spellinfo[i].damagewho = dw;
spellinfo[i].npc = npc;
- spellinfo[i].frame = 32;
+ spellinfo[i].frame = 32.0f;
if (damagewho == 0) {
spellinfo[i].strength = player.spellstrength / 100;
if (player.spellstrength == 100)
- spellinfo[i].strength = 1.5;
+ spellinfo[i].strength = 1.5f;
}
// set earthslide vars
@@ -3136,7 +3136,7 @@ void GriffonEngine::game_endofgame() {
ticks = g_system->getMillis();
- float spd = 0.2;
+ float spd = 0.2f;
if (menabled == 1 && config.music == 1) {
Mix_HaltChannel(-1);
@@ -3267,9 +3267,9 @@ void GriffonEngine::game_endofgame() {
xofs = xofs - 320;
if (event.type == Common::EVENT_KEYDOWN)
- spd = 1;
+ spd = 1.0f;
if (event.type == Common::EVENT_KEYUP)
- spd = 0.2;
+ spd = 0.2f;
if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
break;
@@ -4065,7 +4065,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
npcinfo[i].attackdamage = 24;
npcinfo[i].spelldamage = 30;
- npcinfo[i].walkspd = 1.4;
+ npcinfo[i].walkspd = 1.4f;
npcinfo[i].castpause = ticks;
}
@@ -4077,7 +4077,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
npcinfo[i].attackdamage = 0;
npcinfo[i].spelldamage = 30;
- npcinfo[i].walkspd = 1.2;
+ npcinfo[i].walkspd = 1.2f;
}
// black knights
@@ -4099,7 +4099,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
npcinfo[i].attackdamage = 50;
npcinfo[i].spelldamage = 30;
- npcinfo[i].walkspd = 1.3;
+ npcinfo[i].walkspd = 1.3f;
npcinfo[i].swayangle = 0;
}
@@ -4667,10 +4667,10 @@ __exit_do:
roomlocks[73] = 1;
roomlocks[82] = 2;
- player.walkspd = 1.1;
- animspd = 0.5;
+ player.walkspd = 1.1f;
+ animspd = 0.5f;
attacking = 0;
- player.attackspd = 1.5;
+ player.attackspd = 1.5f;
player.sword = 1;
player.level = 1;
@@ -4895,10 +4895,10 @@ void GriffonEngine::game_saveloadnew() {
if (lowerlock == 1 && curcol == 2 && tickpause < ticks) {
if (state_load(currow - 1)) {
- player.walkspd = 1.1;
- animspd = .5;
+ player.walkspd = 1.1f;
+ animspd = 0.5f;
attacking = 0;
- player.attackspd = 1.5;
+ player.attackspd = 1.5f;
pgardens = 0;
ptown = 0;
@@ -7594,7 +7594,7 @@ void GriffonEngine::game_updspellsunder() {
int xdif = spellinfo[i].enemyx - npcinfo[f].x;
int ydif = spellinfo[i].enemyy - npcinfo[f].y;
- float dist = sqrt(xdif * xdif + ydif * ydif);
+ float dist = sqrt((float)(xdif * xdif + ydif * ydif));
if (dist > 20)
dist = 20;
@@ -7901,7 +7901,7 @@ void GriffonEngine::sys_initialize() {
sys_LoadFont();
sys_LoadItemImgs();
- fpsr = 1;
+ fpsr = 1.0f;
nextticks = ticks + 1000;
for (int i = 0; i <= 15; i++) {
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 7c1ec28..c533380 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -86,7 +86,7 @@ struct PLAYERTYPE {
float py;
float opx;
float opy;
- int walkdir;
+ int walkdir;
float walkframe;
float walkspd;
float attackframe;
@@ -94,7 +94,7 @@ struct PLAYERTYPE {
int hp;
int maxhp;
- float hpflash;
+ float hpflash;
int hpflashb;
int level;
int maxlevel;
@@ -102,10 +102,10 @@ struct PLAYERTYPE {
int shield;
int armour;
int foundspell[5];
- float spellcharge[5];
+ float spellcharge[5];
int inventory[5];
- float attackstrength;
- float spellstrength;
+ float attackstrength;
+ float spellstrength;
int spelldamage;
int sworddamage;
@@ -114,7 +114,7 @@ struct PLAYERTYPE {
int pause;
- float itemselshade;
+ float itemselshade;
int ysort;
};
@@ -199,7 +199,7 @@ struct SPELLTYPE {
int damagewho; // 0 = npc, 1 = player
// for earthslide
- float rocky[9];
+ float rocky[9]; // CHECKME: Looks unused
int rockimg[9];
int rockdeflect[9];
@@ -311,7 +311,7 @@ private:
unsigned int clipsurround[4][4];
int fullscreen;
- float animspd;
+ float animspd; // CHECKME: it seems to always be 0.5
int rampdata[40][24];
int curmap;
@@ -327,7 +327,7 @@ private:
// timer related - move to local later
int ticks, tickspassed, nextticks;
- float fp, fps, fpsr;
+ float fp, fps, fpsr; // CHECKME: fp and fps seems to be integers
int secsingame, secstart;
Graphics::TransparentSurface *mapimg[4];
@@ -335,7 +335,7 @@ private:
Common::Rect rcSrc, rcDest;
// -----------special case
- int dontdrawover; // used in map24 so that the candles dont draw over the boss, default set to 0
+ int dontdrawover; // used in map24 so that the candles don't draw over the boss, default set to 0
// saveload info
Graphics::TransparentSurface *saveloadimg;
Commit: 8fb85f40dd6a5d7089ada6caf46b01babaf1e86c
https://github.com/scummvm/scummvm/commit/8fb85f40dd6a5d7089ada6caf46b01babaf1e86c
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Avoid direct equality on floats, some janitorial work
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 226658e..592c77f 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -303,7 +303,7 @@ float GriffonEngine::RND() {
void GriffonEngine::game_addFloatIcon(int ico, float xloc, float yloc) {
for (int i = 0; i < kMaxFloat; i++) {
- if (floaticon[i][0] == 0) {
+ if (ABS(floaticon[i][0]) < kEpsilon) {
floaticon[i][0] = 32;
floaticon[i][1] = xloc;
floaticon[i][2] = yloc;
@@ -315,7 +315,7 @@ void GriffonEngine::game_addFloatIcon(int ico, float xloc, float yloc) {
void GriffonEngine::game_addFloatText(const char *stri, float xloc, float yloc, int col) {
for (int i = 0; i < kMaxFloat; i++) {
- if (floattext[i][0] == 0) {
+ if (ABS(floattext[i][0]) < kEpsilon) {
floattext[i][0] = 32;
floattext[i][1] = xloc;
floattext[i][2] = yloc;
@@ -327,10 +327,8 @@ void GriffonEngine::game_addFloatText(const char *stri, float xloc, float yloc,
}
void GriffonEngine::game_attack() {
- float npx, npy;
-
- npx = player.px + 12;
- npy = player.py + 20;
+ float npx = player.px + 12;
+ float npy = player.py + 20;
int lx = (int)npx / 16;
int ly = (int)npy / 16;
@@ -714,7 +712,7 @@ void GriffonEngine::game_castspell(int spellnum, float homex, float homey, float
// spellnum 7 = sprite 6 spitfire
for (int i = 0; i < kMaxSpell; i++) {
- if (spellinfo[i].frame == 0) {
+ if (ABS(spellinfo[i].frame) < kEpsilon) {
spellinfo[i].homex = homex;
spellinfo[i].homey = homey;
spellinfo[i].enemyx = enemyx;
@@ -733,7 +731,7 @@ void GriffonEngine::game_castspell(int spellnum, float homex, float homey, float
spellinfo[i].frame = 32.0f;
if (damagewho == 0) {
spellinfo[i].strength = player.spellstrength / 100;
- if (player.spellstrength == 100)
+ if (ABS(player.spellstrength - 100) < kEpsilon)
spellinfo[i].strength = 1.5f;
}
@@ -815,25 +813,25 @@ void GriffonEngine::game_checkhit() {
if (_console->_godMode)
damage = 1000;
- if (player.attackstrength == 100)
- damage = damage * 1.5;
+ if (ABS(player.attackstrength - 100) < kEpsilon)
+ damage *= 1.5;
- int hit = 0;
+ bool hit = false;
if (player.walkdir == 0) {
if (abs(xdif) <= 8 && ydif >= 0 && ydif < 8)
- hit = 1;
+ hit = true;
} else if (player.walkdir == 1) {
if (abs(xdif) <= 8 && ydif <= 0 && ydif > -8)
- hit = 1;
+ hit = true;
} else if (player.walkdir == 2) {
if (abs(ydif) <= 8 && xdif >= -8 && xdif < 8)
- hit = 1;
+ hit = true;
} else if (player.walkdir == 3) {
if (abs(ydif) <= 8 && xdif <= 8 && xdif > -8)
- hit = 1;
+ hit = true;
}
- if (hit == 1) {
+ if (hit) {
if (menabled == 1 && config.effects == 1) {
int snd = Mix_PlayChannel(-1, sfx[sndswordhit], 0);
Mix_Volume(snd, config.effectsvol);
@@ -847,9 +845,7 @@ void GriffonEngine::game_checkhit() {
}
void GriffonEngine::game_checkinputs() {
- int ntickdelay;
-
- ntickdelay = 175;
+ int ntickdelay = 175;
g_system->getEventManager()->pollEvent(event);
@@ -1012,7 +1008,7 @@ void GriffonEngine::game_checkinputs() {
}
if (curitem > 5 && selenemyon == 0 && itemselon == 1) {
- if (player.spellcharge[curitem - 5] == 100) {
+ if (ABS(player.spellcharge[curitem - 5] - 100) < kEpsilon) {
itemticks = ticks + ntickdelay;
selenemyon = 1;
@@ -1151,13 +1147,11 @@ __exit_do:
}
void GriffonEngine::game_checktrigger() {
- int npx, npy, lx, ly;
+ int npx = player.px + 12;
+ int npy = player.py + 20;
- npx = player.px + 12;
- npy = player.py + 20;
-
- lx = (int)npx / 16;
- ly = (int)npy / 16;
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
canusekey = 0;
@@ -1178,19 +1172,18 @@ void GriffonEngine::game_checktrigger() {
void GriffonEngine::game_configmenu() {
Graphics::TransparentSurface *configwindow;
Common::Rect rc;
- int cursel, curselt;
- int tickwait, keypause, ticks1;
+ int curselt;
- cursel = MINCURSEL;
+ int cursel = MINCURSEL;
ticks = g_system->getMillis();
- tickwait = 100;
- keypause = ticks + tickwait;
+ int tickwait = 100;
+ int keypause = ticks + tickwait;
configwindow = IMG_Load("art/configwindow.bmp", true);
configwindow->setAlpha(160, true);
- ticks1 = ticks;
+ int ticks1 = ticks;
do {
_videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
@@ -2185,7 +2178,7 @@ void GriffonEngine::game_drawhud() {
game_fillrect(_videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32));
game_fillrect(_videobuffer, rcSrc.left + 1, sy + 17,
hud_recalc(player.spellcharge[i], 14, 100), 2,
- player.spellcharge[i] == 100 ? RGB(255, 128, 32) : RGB(0, 224, 64));
+ ABS(player.spellcharge[i] - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 224, 64));
}
}
}
@@ -2257,12 +2250,12 @@ void GriffonEngine::game_drawhud() {
game_fillrect(_videobuffer, sx + 1, sy + 16, 56, 6, RGB(0, 32, 32));
game_fillrect(_videobuffer, sx + 1, sy + 17,
hud_recalc(player.attackstrength, 54, 100), 2,
- player.attackstrength == 100 ? RGB(255, 128, 32) : RGB(0, 64, 224));
+ ABS(player.attackstrength - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 64, 224));
// spell strength
game_fillrect(_videobuffer, sx + 1, sy + 19,
hud_recalc(player.spellstrength, 54, 100), 2,
- player.spellstrength == 100 ? RGB(224, 0, 0) : RGB(128, 0, 224));
+ ABS(player.spellstrength - 100) < kEpsilon ? RGB(224, 0, 0) : RGB(128, 0, 224));
// time
int ase = secstart + secsingame;
@@ -2330,7 +2323,7 @@ void GriffonEngine::game_drawhud() {
game_fillrect(_videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32));
game_fillrect(_videobuffer, rcSrc.left + 1, sy + 17,
hud_recalc(player.spellcharge[i], 14, 100), 2,
- player.spellcharge[i] == 100 ? RGB(255, 128, 32) : RGB(0, 224, 64));
+ ABS(player.spellcharge[i] - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 224, 64));
}
}
}
@@ -2367,10 +2360,7 @@ void GriffonEngine::game_drawhud() {
}
void GriffonEngine::game_drawnpcs(int mode) {
- unsigned int ccc;
-
- ccc = _videobuffer->format.RGBToColor(255, 128, 32);
-
+ unsigned int ccc = _videobuffer->format.RGBToColor(255, 128, 32);
int fst = firsty;
int lst = lasty;
@@ -2992,8 +2982,6 @@ void GriffonEngine::game_drawover(int modx, int mody) {
}
void GriffonEngine::game_drawplayer() {
- long ccc;
-
int f = 0;
if (player.armour == 3)
f = 13;
@@ -3025,7 +3013,7 @@ void GriffonEngine::game_drawplayer() {
}
- ccc = _videobuffer->format.RGBToColor(224, 224, 64);
+ long ccc = _videobuffer->format.RGBToColor(224, 224, 64);
int pass = 0;
if (player.hp <= player.maxhp * 0.25)
@@ -3033,7 +3021,8 @@ void GriffonEngine::game_drawplayer() {
if (pass == 1) {
ccc = _videobuffer->format.RGBToColor(255, 255, 255);
- if ((int)(player.hpflash) == 1) ccc = _videobuffer->format.RGBToColor(255, 0, 0);
+ if ((int)(player.hpflash) == 1)
+ ccc = _videobuffer->format.RGBToColor(255, 0, 0);
}
int sss = 6;
@@ -3064,7 +3053,7 @@ void GriffonEngine::game_drawplayer() {
_videobuffer->fillRect(rcDest, ccc);
ccc = _videobuffer->format.RGBToColor(0, 224, 64);
- if (player.attackstrength == 100)
+ if (ABS(player.attackstrength - 100) < kEpsilon)
ccc = _videobuffer->format.RGBToColor(255, 128, 32);
ww = 14 * player.attackstrength / 100;
@@ -3082,7 +3071,7 @@ void GriffonEngine::game_drawplayer() {
_videobuffer->fillRect(rcDest, ccc);
ccc = _videobuffer->format.RGBToColor(128, 0, 224);
- if (player.spellstrength == 100)
+ if (ABS(player.spellstrength - 100) < kEpsilon)
ccc = _videobuffer->format.RGBToColor(224, 0, 0);
rcDest.top = rcDest.top + 2;
@@ -3093,8 +3082,6 @@ void GriffonEngine::game_drawplayer() {
}
void GriffonEngine::game_drawview() {
- Common::Rect rc;
-
_videobuffer->copyRectToSurface(mapbg->getPixels(), mapbg->pitch, 0, 0, mapbg->w, mapbg->h);
game_updspellsunder();
@@ -3117,6 +3104,7 @@ void GriffonEngine::game_drawview() {
game_updspells();
if (cloudson == 1) {
+ Common::Rect rc;
rc.left = (float)(256 + 256 * cos(3.141592 / 180 * clouddeg));
rc.top = (float)(192 + 192 * sin(3.141592 / 180 * clouddeg));
rc.setWidth(320);
@@ -3132,8 +3120,6 @@ void GriffonEngine::game_drawview() {
void GriffonEngine::game_endofgame() {
float xofs = 0;
- int ticks1;
-
ticks = g_system->getMillis();
float spd = 0.2f;
@@ -3144,7 +3130,7 @@ void GriffonEngine::game_endofgame() {
Mix_Volume(musicchannel, 0);
}
- ticks1 = ticks;
+ int ticks1 = ticks;
int ya = 0;
_videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
@@ -3371,16 +3357,16 @@ void GriffonEngine::game_endofgame() {
}
void GriffonEngine::game_eventtext(const char *stri) {
- int x, fr, pauseticks, bticks;
+ int fr;
_videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
_videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
- x = 160 - 4 * strlen(stri);
+ int x = 160 - 4 * strlen(stri);
ticks = g_system->getMillis();
- pauseticks = ticks + 500;
- bticks = ticks;
+ int pauseticks = ticks + 500;
+ int bticks = ticks;
_videobuffer->blit(*_videobuffer3);
_videobuffer->blit(*_videobuffer2);
@@ -6880,7 +6866,7 @@ void GriffonEngine::game_updspells() {
if (spellinfo[i].damagewho == 1) {
// --------- boss 1 specific
- if (spellinfo[i].frame == 0 && npcinfo[spellinfo[i].npc].spriteset == 3) {
+ if (ABS(spellinfo[i].frame) < 0 && npcinfo[spellinfo[i].npc].spriteset == 3) {
npc = spellinfo[i].npc;
npcinfo[npc].attackframe = 0;
npcinfo[npc].attacking = 0;
@@ -6891,7 +6877,7 @@ void GriffonEngine::game_updspells() {
// ---------------
// --------- blackknight specific
- if (spellinfo[i].frame == 0 && npcinfo[spellinfo[i].npc].spriteset == 4) {
+ if (ABS(spellinfo[i].frame) < 0 && npcinfo[spellinfo[i].npc].spriteset == 4) {
npc = spellinfo[i].npc;
npcinfo[npc].attackframe = 0;
npcinfo[npc].attacking = 0;
@@ -7841,7 +7827,7 @@ void GriffonEngine::game_updspellsunder() {
if (spellinfo[i].frame < 0)
spellinfo[i].frame = 0;
- if (spellinfo[i].frame == 0) {
+ if (ABS(spellinfo[i].frame) < 0) {
npcinfo[spellinfo[i].npc].attacking = 0;
npcinfo[spellinfo[i].npc].attacknext = ticks + npcinfo[spellinfo[i].npc].attackdelay;
}
@@ -8288,7 +8274,7 @@ void GriffonEngine::sys_update() {
pa = (int)(player.attackframe);
for (int i = 0; i <= pa; i++) {
- if (playerattackofs[player.walkdir][i][2] == 0) {
+ if (ABS(playerattackofs[player.walkdir][i][2]) < kEpsilon) {
playerattackofs[player.walkdir][i][2] = 1;
opx = player.px;
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index c533380..06269f7 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -81,6 +81,8 @@ class Console;
#define sndfire 13
#define sndbeep 14
+#define kEpsilon 0.001
+
struct PLAYERTYPE {
float px;
float py;
@@ -410,6 +412,7 @@ private:
Mix_Chunk *sfx[21];
+ // TODO: Check those variables, at least canusekey is a boolean, and the case is wrong in all the names
// room locks
int roomlocks[201], saidlocked, canusekey, locktype, roomtounlock, saidjammed;
// set to 1 for normal key, set to 2 for master, set to 0 if unlocked
Commit: a69ed08ec9302bace802a6728df0189dd38b56d4
https://github.com/scummvm/scummvm/commit/a69ed08ec9302bace802a6728df0189dd38b56d4
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Reduce the scope of variables, change some variables to boolean
Changed paths:
engines/griffon/engine.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 592c77f..4ac4649 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -793,14 +793,11 @@ void GriffonEngine::game_castspell(int spellnum, float homex, float homey, float
}
void GriffonEngine::game_checkhit() {
- float npx, npy;
- float damage;
-
if (attacking == 1) {
for (int i = 1; i <= lastnpc; i++) {
if (npcinfo[i].hp > 0 && npcinfo[i].pause < ticks && (int)(RND() * 2) == 0) {
- npx = npcinfo[i].x;
- npy = npcinfo[i].y;
+ float npx = npcinfo[i].x;
+ float npy = npcinfo[i].y;
float xdif = player.px - npx;
float ydif = player.py - npy;
@@ -808,7 +805,7 @@ void GriffonEngine::game_checkhit() {
float ps = player.sword;
if (ps > 1)
ps = ps * 0.75;
- damage = (float)player.sworddamage * (1.0 + RND() * 1.0) * player.attackstrength / 100.0 * ps;
+ float damage = (float)player.sworddamage * (1.0 + RND() * 1.0) * player.attackstrength / 100.0 * ps;
if (_console->_godMode)
damage = 1000;
@@ -1170,17 +1167,13 @@ void GriffonEngine::game_checktrigger() {
#endif
void GriffonEngine::game_configmenu() {
- Graphics::TransparentSurface *configwindow;
- Common::Rect rc;
- int curselt;
-
int cursel = MINCURSEL;
ticks = g_system->getMillis();
int tickwait = 100;
int keypause = ticks + tickwait;
- configwindow = IMG_Load("art/configwindow.bmp", true);
+ Graphics::TransparentSurface *configwindow = IMG_Load("art/configwindow.bmp", true);
configwindow->setAlpha(160, true);
int ticks1 = ticks;
@@ -1287,22 +1280,23 @@ void GriffonEngine::game_configmenu() {
sys_print(_videobuffer, vl[i], 164, sy + i * 8, cl);
}
- curselt = cursel;
+ int curselt = cursel;
if (cursel > 4)
- curselt = curselt + 1;
+ curselt += 1;
if (cursel > 6)
- curselt = curselt + 1;
+ curselt += 1;
if (cursel > 8)
- curselt = curselt + 1;
+ curselt += 1;
if (cursel > 10)
- curselt = curselt + 1;
+ curselt += 1;
if (cursel > 11)
- curselt = curselt + 1;
+ curselt += 1;
if (cursel > 12)
- curselt = curselt + 1;
+ curselt += 1;
if (cursel > 13)
- curselt = curselt + 1;
+ curselt += 1;
+ Common::Rect rc;
rc.left = 148 + 3 * cos(3.14159 * 2 * itemyloc / 16.0);
rc.top = sy + 8 * curselt - 4;
@@ -1533,18 +1527,15 @@ void GriffonEngine::game_configmenu() {
}
void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
- float npx, npy;
- int lx, ly, cx, cy, alive;
char line[256];
- int ratio;
- int fcol, heal, ff;
+ int fcol;
if (damage == 0) {
strcpy(line, "miss!");
fcol = 2;
} else {
- ratio = 0;
- heal = 0;
+ int ratio = 0;
+ int heal = 0;
if (damage < 0)
heal = 1;
damage = abs(damage);
@@ -1586,13 +1577,13 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
player.exp = player.exp + npcinfo[npcnum].maxhp;
if (npcinfo[npcnum].spriteset == 1 || npcinfo[npcnum].spriteset == 7 || npcinfo[npcnum].spriteset == 6) {
- ff = (int)(RND() * player.level * 3);
+ int ff = (int)(RND() * player.level * 3);
if (ff == 0) {
- npx = npcinfo[npcnum].x + 12;
- npy = npcinfo[npcnum].y + 20;
+ float npx = npcinfo[npcnum].x + 12;
+ float npy = npcinfo[npcnum].y + 20;
- lx = (int)npx / 16;
- ly = (int)npy / 16;
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
if (objmap[lx][ly] == -1)
objmap[lx][ly] = 4;
@@ -1600,13 +1591,13 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
}
if (npcinfo[npcnum].spriteset == 2 || npcinfo[npcnum].spriteset == 9 || npcinfo[npcnum].spriteset == 4 || npcinfo[npcnum].spriteset == 5) {
- ff = (int)(RND() * player.level);
+ int ff = (int)(RND() * player.level);
if (ff == 0) {
- npx = npcinfo[npcnum].x + 12;
- npy = npcinfo[npcnum].y + 20;
+ float npx = npcinfo[npcnum].x + 12;
+ float npy = npcinfo[npcnum].y + 20;
- lx = (int)npx / 16;
- ly = (int)npy / 16;
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
if (objmap[lx][ly] == -1)
objmap[lx][ly] = 12;
@@ -1614,13 +1605,13 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
}
if (npcinfo[npcnum].spriteset == 9 || npcinfo[npcnum].spriteset == 10 || npcinfo[npcnum].spriteset == 5) {
- ff = (int)(RND() * player.level * 2);
+ int ff = (int)(RND() * player.level * 2);
if (ff == 0) {
- npx = npcinfo[npcnum].x + 12;
- npy = npcinfo[npcnum].y + 20;
+ float npx = npcinfo[npcnum].x + 12;
+ float npy = npcinfo[npcnum].y + 20;
- lx = (int)npx / 16;
- ly = (int)npy / 16;
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
if (objmap[lx][ly] == -1)
objmap[lx][ly] = 13;
@@ -1629,16 +1620,16 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
// academy master key chest script
if (npcinfo[npcnum].script == 2) {
- cx = 9;
- cy = 7;
-
- alive = 0;
+ bool alive = false;
for (int i = 1; i <= lastnpc; i++) {
if (npcinfo[i].hp > 0)
- alive = 1;
+ alive = true;
}
- if (alive == 0) {
+ if (!alive) {
+ int cx = 9;
+ int cy = 7;
+
objmap[cx][cy] = 5;
rcDest.left = cx * 8;
@@ -1646,11 +1637,11 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- npx = player.px + 12;
- npy = player.py + 20;
+ float npx = player.px + 12;
+ float npy = player.py + 20;
- lx = (int)npx / 16;
- ly = (int)npy / 16;
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
if (lx == cx && ly == cy)
player.py = player.py + 16;
@@ -1661,16 +1652,16 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
// academy crystal chest script
if (npcinfo[npcnum].script == 3) {
- cx = 9;
- cy = 7;
-
- alive = 0;
+ bool alive = false;
for (int i = 1; i <= lastnpc; i++) {
if (npcinfo[i].hp > 0)
- alive = 1;
+ alive = true;
}
- if (alive == 0) {
+ if (!alive) {
+ int cx = 9;
+ int cy = 7;
+
objmap[cx][cy] = 6;
rcDest.left = cx * 8;
@@ -1678,11 +1669,11 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- npx = player.px + 12;
- npy = player.py + 20;
+ float npx = player.px + 12;
+ float npy = player.py + 20;
- lx = (int)npx / 16;
- ly = (int)npy / 16;
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
if (lx == cx && ly == cy)
player.py = player.py + 16;
@@ -1719,16 +1710,16 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
// firehydra sword chest
if (npcinfo[npcnum].script == 5) {
- cx = 9;
- cy = 6;
-
- alive = 0;
+ bool alive = false;
for (int i = 1; i <= lastnpc; i++) {
if (npcinfo[i].hp > 0)
- alive = 1;
+ alive = true;
}
- if (alive == 0) {
+ if (!alive) {
+ int cx = 9;
+ int cy = 6;
+
objmap[cx][cy] = 9;
rcDest.left = cx * 8;
@@ -1736,11 +1727,11 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- npx = player.px + 12;
- npy = player.py + 20;
+ float npx = player.px + 12;
+ float npy = player.py + 20;
- lx = (int)npx / 16;
- ly = (int)npy / 16;
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
if (lx == cx && ly == cy)
player.py = player.py + 16;
@@ -1752,16 +1743,16 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
// gardens master key script
if (npcinfo[npcnum].script == 8 && scriptflag[6][0] == 0) {
- cx = 13;
- cy = 7;
-
- alive = 0;
+ bool alive = false;
for (int i = 1; i <= lastnpc; i++) {
if (npcinfo[i].hp > 0)
- alive = 1;
+ alive = true;
}
- if (alive == 0) {
+ if (!alive) {
+ int cx = 13;
+ int cy = 7;
+
objmap[cx][cy] = 5;
rcDest.left = cx * 8;
@@ -1769,11 +1760,11 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- npx = player.px + 12;
- npy = player.py + 20;
+ float npx = player.px + 12;
+ float npy = player.py + 20;
- lx = (int)npx / 16;
- ly = (int)npy / 16;
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
if (lx == cx && ly == cy)
player.py = player.py + 16;
@@ -1785,16 +1776,16 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
// regular key chest 1
for (int s = 20; s <= 23; s++) {
if (npcinfo[npcnum].script == s && scriptflag[s][0] < 2) {
- cx = 9;
- cy = 7;
-
- alive = 0;
+ bool alive = false;
for (int i = 1; i <= lastnpc; i++) {
if (npcinfo[i].hp > 0)
- alive = 1;
+ alive = true;
}
- if (alive == 0) {
+ if (!alive) {
+ int cx = 9;
+ int cy = 7;
+
objmap[cx][cy] = 11;
rcDest.left = cx * 8;
@@ -1802,11 +1793,11 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- npx = player.px + 12;
- npy = player.py + 20;
+ float npx = player.px + 12;
+ float npy = player.py + 20;
- lx = (int)npx / 16;
- ly = (int)npy / 16;
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
if (lx == cx && ly == cy)
player.py = player.py + 16;
@@ -1818,16 +1809,16 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
// pickup lightning bomb
if (npcinfo[npcnum].script == 9 && (curmap == 41 && scriptflag[9][1] == 0)) {
- cx = 9;
- cy = 7;
-
- alive = 0;
+ bool alive = false;
for (int i = 1; i <= lastnpc; i++) {
if (npcinfo[i].hp > 0)
- alive = 1;
+ alive = true;
}
- if (alive == 0) {
+ if (!alive) {
+ int cx = 9;
+ int cy = 7;
+
objmap[cx][cy] = 13;
rcDest.left = cx * 8;
@@ -1835,11 +1826,11 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- npx = player.px + 12;
- npy = player.py + 20;
+ float npx = player.px + 12;
+ float npy = player.py + 20;
- lx = (int)npx / 16;
- ly = (int)npy / 16;
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
if (lx == cx && ly == cy)
player.py = player.py + 16;
@@ -1848,16 +1839,16 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
// citadel armour chest
if (npcinfo[npcnum].script == 12) {
- cx = 8;
- cy = 7;
-
- alive = 0;
+ bool alive = false;
for (int i = 1; i <= lastnpc; i++) {
if (npcinfo[i].hp > 0)
- alive = 1;
+ alive = true;
}
- if (alive == 0) {
+ if (!alive) {
+ int cx = 8;
+ int cy = 7;
+
objmap[cx][cy] = 16;
rcDest.left = cx * 8;
@@ -1865,11 +1856,11 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- npx = player.px + 12;
- npy = player.py + 20;
+ float npx = player.px + 12;
+ float npy = player.py + 20;
- lx = (int)npx / 16;
- ly = (int)npy / 16;
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
if (lx == cx && ly == cy)
player.py = player.py + 16;
@@ -1880,16 +1871,16 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
// citadel master key script
if (npcinfo[npcnum].script == 13 && scriptflag[13][0] == 0) {
- cx = 11;
- cy = 10;
-
- alive = 0;
+ bool alive = false;
for (int i = 1; i <= lastnpc; i++) {
if (npcinfo[i].hp > 0)
- alive = 1;
+ alive = true;
}
- if (alive == 0) {
+ if (!alive) {
+ int cx = 11;
+ int cy = 10;
+
objmap[cx][cy] = 5;
rcDest.left = cx * 8;
@@ -1897,11 +1888,11 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- npx = player.px + 12;
- npy = player.py + 20;
+ float npx = player.px + 12;
+ float npy = player.py + 20;
- lx = (int)npx / 16;
- ly = (int)npy / 16;
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
if (lx == cx && ly == cy)
player.py = player.py + 16;
@@ -1912,15 +1903,15 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
// max ups
if (npcinfo[npcnum].script == 15 && scriptflag[15][0] == 0) {
- alive = 0;
+ bool alive = false;
for (int i = 1; i <= lastnpc; i++) {
if (npcinfo[i].hp > 0)
- alive = 1;
+ alive = true;
}
- if (alive == 0) {
- cx = 6;
- cy = 8;
+ if (!alive) {
+ int cx = 6;
+ int cy = 8;
objmap[cx][cy] = 18;
@@ -1929,11 +1920,11 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- npx = player.px + 12;
- npy = player.py + 20;
+ float npx = player.px + 12;
+ float npy = player.py + 20;
- lx = (int)npx / 16;
- ly = (int)npy / 16;
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
if (lx == cx && ly == cy)
player.py = player.py + 16;
@@ -2100,12 +2091,9 @@ int hud_recalc(int a, int b, int c) {
#define RGB(R, G, B) (_videobuffer->format.RGBToColor((R), (G), (B)))
void GriffonEngine::game_drawhud() {
- char line[128];
//sprintf(line, "fps: %i, map: %i, exp: %i/%i", (int)fps, curmap, player.exp, player.nextlevel);
//sys_print(_videobuffer, line, 0, 0, 0);
- long ccc;
-
game_fillrect(_videobuffer2, 0, 0, 320, 240, 0);
for (int i = 0; i < kMaxFloat; i++) {
@@ -2218,7 +2206,7 @@ void GriffonEngine::game_drawhud() {
amap = 1;
mapimg[amap]->blit(*_videobuffer, rcDest.left, rcDest.top);
- ccc = _videobuffer->format.RGBToColor(128 + 127 * sin(3.141592 * 2 * itemyloc / 16), 0, 0);
+ long ccc = _videobuffer->format.RGBToColor(128 + 127 * sin(3.141592 * 2 * itemyloc / 16), 0, 0);
for (int b = 0; b <= 6; b++) {
for (int a = 0; a <= 12; a++) {
@@ -2233,6 +2221,7 @@ void GriffonEngine::game_drawhud() {
sys_print(_videobuffer, "L2", 46 + 9 + 7 * 9, 46 + 77, 0);
}
+ char line[128];
sprintf(line, "Health: %i/%i", player.hp, player.maxhp);
sys_print(_videobuffer, line, sx, sy, player.hp <= player.maxhp * 0.25 ? (int)player.hpflash : 0);
@@ -3357,8 +3346,6 @@ void GriffonEngine::game_endofgame() {
}
void GriffonEngine::game_eventtext(const char *stri) {
- int fr;
-
_videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
_videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
@@ -3378,7 +3365,7 @@ void GriffonEngine::game_eventtext(const char *stri) {
break;
_videobuffer2->blit(*_videobuffer);
- fr = 192;
+ int fr = 192;
if (pauseticks > ticks)
fr = 192 * (ticks - bticks) / 500;
@@ -3796,22 +3783,18 @@ void GriffonEngine::game_loadmap(int mapnum) {
for (int y = 0; y <= 23; y++) {
for (int x = 0; x <= 39; x++) {
for (int l = 0; l <= 2; l++) {
- int lx, ly, curtile, curtilelayer;
- int curtilel, curtilex, curtiley;
- int ffa, ffb;
-
- ly = y;
- lx = x + l * 40;
+ int ly = y;
+ int lx = x + l * 40;
// tile
- curtile = tempmap[lx][ly];
- curtilelayer = tempmap[lx][ly + 40];
+ int curtile = tempmap[lx][ly];
+ int curtilelayer = tempmap[lx][ly + 40];
if (curtile > 0) {
curtile = curtile - 1;
- curtilel = curtilelayer;
- curtilex = curtile % 20;
- curtiley = (curtile - curtilex) / 20;
+ int curtilel = curtilelayer;
+ int curtilex = curtile % 20;
+ int curtiley = (curtile - curtilex) / 20;
tileinfo[l][x][y][0] = curtile + 1;
tileinfo[l][x][y][1] = curtilelayer;
@@ -3828,8 +3811,8 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (l == 2 && curtilel == 1) {
for (int ff = 0; ff <= 5; ff++) {
- ffa = 20 * 5 - 1 + ff * 20;
- ffb = 20 * 5 + 4 + ff * 20;
+ int ffa = 20 * 5 - 1 + ff * 20;
+ int ffb = 20 * 5 + 4 + ff * 20;
if (curtile > ffa && curtile < ffb) {
tiles[curtilel]->setAlpha(128, true);
}
@@ -3837,7 +3820,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
}
if (l == 1 && curtilel == 2) {
for (int ff = 0; ff <= 4; ff++) {
- ffa = 20 * (5 + ff) + 3;
+ int ffa = 20 * (5 + ff) + 3;
if (curtile == ffa) {
tiles[curtilel]->setAlpha(192, true);
}
@@ -3862,19 +3845,15 @@ void GriffonEngine::game_loadmap(int mapnum) {
for (int x = 0; x <= 39; x++) {
for (int y = 0; y <= 23; y++) {
-
int d = tempmap[3 * 40 + x][y];
- int clip = 0;
- int npc = 0;
-
if (scriptflag[4][0] == 1 && x == 9 && y == 7)
d = 99;
if (d > 0) {
- clip = d % 2;
+ int clip = d % 2;
d = (d - clip) / 2;
- npc = d % 2;
+ int npc = d % 2;
d = (d - npc) / 2;
if (d == 99 && x == 9 && y == 7)
@@ -3939,11 +3918,10 @@ void GriffonEngine::game_loadmap(int mapnum) {
for (int y = 0; y <= 19; y++) {
int d = tempmap[3 * 40 + x][y];
- int clip = 0;
int npc = 0;
int obj = 0;
if (d > 0) {
- clip = d % 2;
+ int clip = d % 2;
d = (d - clip) / 2;
npc = d % 2;
d = (d - npc) / 2;
@@ -4717,18 +4695,16 @@ void GriffonEngine::game_playgame() {
}
void GriffonEngine::game_processtrigger(int trignum) {
- int trigtype, tx, ty, tmap, tjumpstyle, tsx, tsy;
-
- trigtype = triggers[trignum][0];
+ int trigtype = triggers[trignum][0];
if (roomlock == 1)
return;
// map jump------------------------------
if (trigtype == 0) {
- tx = triggers[trignum][1];
- ty = triggers[trignum][2];
- tmap = triggers[trignum][3];
- tjumpstyle = triggers[trignum][4];
+ int tx = triggers[trignum][1];
+ int ty = triggers[trignum][2];
+ int tmap = triggers[trignum][3];
+ int tjumpstyle = triggers[trignum][4];
if (roomlocks[tmap] > 0) {
if (saidlocked == 0)
@@ -4753,8 +4729,8 @@ void GriffonEngine::game_processtrigger(int trignum) {
// loc-sxy+oldmaploc
if (tjumpstyle == 0) {
- tsx = triggers[trignum][5];
- tsy = triggers[trignum][6];
+ int tsx = triggers[trignum][5];
+ int tsy = triggers[trignum][6];
player.px += (tx - tsx) * 16;
player.py += (ty - tsy) * 16;
@@ -4785,23 +4761,19 @@ void GriffonEngine::game_processtrigger(int trignum) {
void GriffonEngine::game_saveloadnew() {
float y = 0.0;
- int yy;
- int currow, curcol, lowerlock;
- int ticks1, tickpause;
clouddeg = 0;
_videobuffer->setAlpha(255);
saveloadimg->setAlpha(192, true);
- currow = 0;
- curcol = 0;
-
- lowerlock = 0;
+ int currow = 0;
+ int curcol = 0;
+ int lowerlock = 0;
ticks = g_system->getMillis();
- ticks1 = ticks;
- tickpause = ticks + 150;
+ int ticks1 = ticks;
+ int tickpause = ticks + 150;
do {
_videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
@@ -5056,12 +5028,14 @@ void GriffonEngine::game_saveloadnew() {
rcDest.left = 108;
if (curcol == 2)
rcDest.left = 170;
- rcDest.left = rcDest.left; // + 2 + 2 * sin(-3.14159 * 2 * itemyloc / 16)
+
+ // CHECKME: Useless code? or temporary commented?
+ // rcDest.left = rcDest.left; // + 2 + 2 * sin(-3.14159 * 2 * itemyloc / 16)
itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
}
- yy = 255;
+ int yy = 255;
if (ticks < ticks1 + 1000) {
yy = 255 * (ticks - ticks1) / 1000;
if (yy < 0)
@@ -5280,9 +5254,6 @@ void GriffonEngine::game_theend() {
void GriffonEngine::game_title(int mode) {
float xofs = 0;
- int ticks1, keypause;
- int cursel, ldstop;
- int x, y;
rcSrc.left = 0;
rcSrc.top = 0;
@@ -5297,11 +5268,9 @@ void GriffonEngine::game_title(int mode) {
_videobuffer->blit(*_videobuffer3);
_videobuffer->blit(*_videobuffer2);
- cursel = 0;
-
- keypause = ticks + 220;
-
- ticks1 = ticks;
+ int cursel = 0;
+ int keypause = ticks + 220;
+ int ticks1 = ticks;
if (menabled == 1 && config.music == 1) {
Mix_Volume(musicchannel, 0);
@@ -5312,7 +5281,7 @@ void GriffonEngine::game_title(int mode) {
pmenu = 1;
}
- ldstop = 0;
+ int ldstop = 0;
float ld = 0;
do {
@@ -5342,8 +5311,8 @@ void GriffonEngine::game_title(int mode) {
_titleimg2->blit(*_videobuffer, rc.left, rc.top);
- y = 172;
- x = 160 - 14 * 4;
+ int y = 172;
+ int x = 160 - 14 * 4;
sys_print(_videobuffer, "new game/save/load", x, y, 4);
sys_print(_videobuffer, "options", x, y + 16, 4);
@@ -5476,12 +5445,10 @@ void GriffonEngine::game_updanims() {
}
void GriffonEngine::game_updatey() {
- int yy, ff;
-
for (int i = 0; i <= 2400; i++)
ysort[i] = -1;
- ff = (int)(player.py * 10);
+ int ff = (int)(player.py * 10);
if (ff < 0) // HACKFIX or ysort[yy] may go out of bounds
ff = 0;
player.ysort = ff;
@@ -5491,7 +5458,7 @@ void GriffonEngine::game_updatey() {
lasty = 0;
for (int i = 1; i <= lastnpc; i++) {
- yy = (int)(npcinfo[i].y * 10);
+ int yy = (int)(npcinfo[i].y * 10);
do {
if (ysort[yy] == -1 || yy == 2400)
@@ -5564,18 +5531,10 @@ void GriffonEngine::game_updmusic() {
}
void GriffonEngine::game_updnpcs() {
- float npx, npy, onpx, onpy;
- uint32 *temp, dq, bgc;
- float nnxa = 0, nnya = 0, nnxb = 0, nnyb = 0;
- int pass = 0, checkpass;
- float wspd, xdif, ydif;
- int sx, sy;
- int dospell = 0;
-
for (int i = 1; i <= lastnpc; i++) {
if (npcinfo[i].hp > 0) {
// is npc walking
- pass = 0;
+ int pass = 0;
if (npcinfo[i].attacking == 0)
pass = 1;
if (npcinfo[i].spriteset == 5)
@@ -5586,13 +5545,13 @@ void GriffonEngine::game_updnpcs() {
int moveleft = 0;
int moveright = 0;
- npx = npcinfo[i].x;
- npy = npcinfo[i].y;
+ float npx = npcinfo[i].x;
+ float npy = npcinfo[i].y;
- onpx = npx;
- onpy = npy;
+ float onpx = npx;
+ float onpy = npy;
- wspd = npcinfo[i].walkspd / 4;
+ float wspd = npcinfo[i].walkspd / 4;
if (npcinfo[i].spriteset == 10)
wspd = wspd * 2;
@@ -5600,8 +5559,8 @@ void GriffonEngine::game_updnpcs() {
int mode = npcinfo[i].movementmode;
- xdif = player.px - npx;
- ydif = player.py - npy;
+ float xdif = player.px - npx;
+ float ydif = player.py - npy;
if (abs(xdif) < 4 * 16 && abs(ydif) < 4 * 16 && mode < 3)
mode = 0;
@@ -5619,7 +5578,7 @@ void GriffonEngine::game_updnpcs() {
mode = 3;
}
- checkpass = 0;
+ bool checkpass = false;
// npc AI CODE
// --------------
@@ -5698,7 +5657,7 @@ void GriffonEngine::game_updnpcs() {
moveleft = 1;
}
- checkpass = 1;
+ checkpass = true;
}
// *******************
@@ -5749,10 +5708,10 @@ void GriffonEngine::game_updnpcs() {
ii = 1;
if (moveup) {
- sx = xp;
- sy = yp - ii;
- temp = (uint32 *)clipbg->getBasePtr(sx, sy);
- dq = *temp;
+ int sx = xp;
+ int sy = yp - ii;
+ uint32 *temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ uint32 dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
@@ -5785,10 +5744,10 @@ void GriffonEngine::game_updnpcs() {
}
if (movedown) {
- sx = xp;
- sy = yp + ii;
- temp = (uint32 *)clipbg->getBasePtr(sx, sy);
- dq = *temp;
+ int sx = xp;
+ int sy = yp + ii;
+ uint32 *temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ uint32 dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
if (dq == 0)
@@ -5820,10 +5779,10 @@ void GriffonEngine::game_updnpcs() {
}
if (moveleft) {
- sx = xp - ii;
- sy = yp;
- temp = (uint32 *)clipbg->getBasePtr(sx, sy);
- dq = *temp;
+ int sx = xp - ii;
+ int sy = yp;
+ uint32 *temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ uint32 dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
if (dq == 0)
@@ -5855,10 +5814,10 @@ void GriffonEngine::game_updnpcs() {
}
if (moveright) {
- sx = xp + ii;
- sy = yp;
- temp = (uint32 *)clipbg->getBasePtr(sx, sy);
- dq = *temp;
+ int sx = xp + ii;
+ int sy = yp;
+ uint32 *temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ uint32 dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
if (dq == 0)
@@ -5898,7 +5857,7 @@ void GriffonEngine::game_updnpcs() {
if (movinright)
npx = npx + wspd * fpsr;
- if (checkpass == 1) {
+ if (checkpass) {
pass = 0;
if (npx >= npcinfo[i].x1 * 16 - 8 && npx <= npcinfo[i].x2 * 16 + 8 && npy >= npcinfo[i].y1 * 16 - 8 && npy <= npcinfo[i].y2 * 16 + 8)
pass = 1;
@@ -5917,10 +5876,10 @@ void GriffonEngine::game_updnpcs() {
xp = (npx / 2 + 6);
yp = (npy / 2 + 10);
- sx = xp;
- sy = yp;
- temp = (uint32 *)clipbg->getBasePtr(sx, sy);
- bgc = *temp;
+ int sx = xp;
+ int sy = yp;
+ uint32 *temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ uint32 bgc = *temp;
float anpx = npx + 12;
float anpy = npy + 20;
@@ -5996,6 +5955,8 @@ void GriffonEngine::game_updnpcs() {
}
}
+ bool dospell = false;
+
// onewing specific
if (npcinfo[i].spriteset == 2) {
if (npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
@@ -6024,12 +5985,12 @@ void GriffonEngine::game_updnpcs() {
}
- dospell = 0;
+ dospell = false;
if (npcinfo[i].attacking == 0 && npcinfo[i].castpause < ticks) {
npcinfo[i].swayspd = npcinfo[i].swayspd + npcinfo[i].swayspd / 200 * fpsr;
if (npcinfo[i].swayspd > 15) {
- dospell = 1;
+ dospell = true;
npcinfo[i].swayspd = 1;
}
@@ -6042,7 +6003,7 @@ void GriffonEngine::game_updnpcs() {
npcinfo[i].headtargety[0] = npcinfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * npcinfo[i].swayangle);
}
- if (dospell == 1) {
+ if (dospell) {
npcinfo[i].pause = ticks + 3000;
npcinfo[i].attacknext = ticks + 4500;
npcinfo[i].castpause = ticks + 4500;
@@ -6182,6 +6143,7 @@ void GriffonEngine::game_updnpcs() {
if ((int)(RND() * 2) == 0) {
npcinfo[i].attacking = 1;
npcinfo[i].attackframe = 0;
+ float nnxa = 0, nnya = 0, nnxb = 0, nnyb = 0;
if (pass == 1 && xdif < 0) {
nnxa = npx - 8;
@@ -6248,6 +6210,7 @@ void GriffonEngine::game_updnpcs() {
npcinfo[i].attacking = 1;
npcinfo[i].attackframe = 0;
+ float nnxa = 0, nnya = 0, nnxb = 0, nnyb = 0;
if (pass == 1 && xdif < 0) {
nnxa = npx - 8;
nnya = npy + 4;
@@ -6320,7 +6283,7 @@ void GriffonEngine::game_updnpcs() {
npcinfo[i].headtargety[0] = npcinfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * npcinfo[i].swayangle);
}
- if (dospell == 1) {
+ if (dospell) {
npcinfo[i].pause = ticks + 3000;
npcinfo[i].attacknext = ticks + 5000;
npcinfo[i].castpause = ticks + 3000;
@@ -6405,11 +6368,8 @@ void GriffonEngine::game_updnpcs() {
}
- int dist;
- float damage;
-
- npx = npcinfo[i].x;
- npy = npcinfo[i].y;
+ float npx = npcinfo[i].x;
+ float npy = npcinfo[i].y;
int xp = (npx / 2 + 6);
int yp = (npy / 2 + 10);
@@ -6436,6 +6396,8 @@ void GriffonEngine::game_updnpcs() {
}
if (pass == 1) {
+ int dist;
+ float damage;
// spriteset1 specific
if (npcinfo[i].spriteset == 1) {
npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * fpsr;
@@ -6450,8 +6412,8 @@ void GriffonEngine::game_updnpcs() {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
- xdif = player.px - npx;
- ydif = player.py - npy;
+ float xdif = player.px - npx;
+ float ydif = player.py - npy;
dist = 10;
@@ -6469,8 +6431,8 @@ void GriffonEngine::game_updnpcs() {
if (npcinfo[i].spriteset == 2) {
// targethead code
- xdif = npcinfo[i].bodysection[7].x - npcinfo[i].headtargetx[0];
- ydif = npcinfo[i].bodysection[7].y - npcinfo[i].headtargety[0];
+ float xdif = npcinfo[i].bodysection[7].x - npcinfo[i].headtargetx[0];
+ float ydif = npcinfo[i].bodysection[7].y - npcinfo[i].headtargety[0];
npcinfo[i].bodysection[7].x = npcinfo[i].bodysection[7].x - xdif * 0.4 * fpsr;
npcinfo[i].bodysection[7].y = npcinfo[i].bodysection[7].y - ydif * 0.4 * fpsr;
@@ -6521,8 +6483,8 @@ void GriffonEngine::game_updnpcs() {
if (npcinfo[i].spriteset == 5) {
for (int ff = 0; ff <= 2; ff++) {
if (npcinfo[i].attacking2[ff] == 1) {
- xdif = npcinfo[i].bodysection[10 * ff + 9].x - npcinfo[i].headtargetx[ff];
- ydif = npcinfo[i].bodysection[10 * ff + 9].y - npcinfo[i].headtargety[ff];
+ float xdif = npcinfo[i].bodysection[10 * ff + 9].x - npcinfo[i].headtargetx[ff];
+ float ydif = npcinfo[i].bodysection[10 * ff + 9].y - npcinfo[i].headtargety[ff];
npcinfo[i].bodysection[10 * ff + 9].x = npcinfo[i].bodysection[10 * ff + 9].x - xdif * .2 * fpsr;
npcinfo[i].bodysection[10 * ff + 9].y = npcinfo[i].bodysection[10 * ff + 9].y - ydif * .2 * fpsr;
@@ -6574,8 +6536,8 @@ void GriffonEngine::game_updnpcs() {
// twowing specific
if (npcinfo[i].spriteset == 9) {
// targethead code
- xdif = npcinfo[i].bodysection[7].x - npcinfo[i].headtargetx[0];
- ydif = npcinfo[i].bodysection[7].y - npcinfo[i].headtargety[0];
+ float xdif = npcinfo[i].bodysection[7].x - npcinfo[i].headtargetx[0];
+ float ydif = npcinfo[i].bodysection[7].y - npcinfo[i].headtargety[0];
npcinfo[i].bodysection[7].x = npcinfo[i].bodysection[7].x - xdif * 0.4 * fpsr;
npcinfo[i].bodysection[7].y = npcinfo[i].bodysection[7].y - ydif * 0.4 * fpsr;
@@ -6636,8 +6598,8 @@ void GriffonEngine::game_updnpcs() {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
- xdif = player.px - npx;
- ydif = player.py - npy;
+ float xdif = player.px - npx;
+ float ydif = player.py - npy;
dist = 16 + npcinfo[i].attackframe;
@@ -6665,8 +6627,8 @@ void GriffonEngine::game_updnpcs() {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
- xdif = player.px - npx;
- ydif = player.py - npy;
+ float xdif = player.px - npx;
+ float ydif = player.py - npy;
dist = 36;
@@ -6816,7 +6778,6 @@ void GriffonEngine::game_updspells() {
// metal
if (spellnum == 1 && forcepause == 0) {
- int npc;
int fr = (int)((32 - spellinfo[i].frame) * 4) % 3;
rcSrc.left = fr * 48;
@@ -6864,10 +6825,9 @@ void GriffonEngine::game_updspells() {
}
if (spellinfo[i].damagewho == 1) {
-
// --------- boss 1 specific
if (ABS(spellinfo[i].frame) < 0 && npcinfo[spellinfo[i].npc].spriteset == 3) {
- npc = spellinfo[i].npc;
+ int npc = spellinfo[i].npc;
npcinfo[npc].attackframe = 0;
npcinfo[npc].attacking = 0;
@@ -6878,7 +6838,7 @@ void GriffonEngine::game_updspells() {
// --------- blackknight specific
if (ABS(spellinfo[i].frame) < 0 && npcinfo[spellinfo[i].npc].spriteset == 4) {
- npc = spellinfo[i].npc;
+ int npc = spellinfo[i].npc;
npcinfo[npc].attackframe = 0;
npcinfo[npc].attacking = 0;
@@ -7538,9 +7498,6 @@ void GriffonEngine::game_updspells() {
void GriffonEngine::game_updspellsunder() {
-
- unsigned int dq, *temp;
-
if (forcepause == 1)
return;
@@ -7593,8 +7550,9 @@ void GriffonEngine::game_updspellsunder() {
int sx = (newx / 2 + 6);
int sy = (newy / 2 + 10);
- temp = (uint32 *)clipbg->getBasePtr(sx, sy);
- dq = *temp;
+
+ unsigned int *temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ unsigned int dq = *temp;
if (dq == 0) {
npcinfo[f].x = newx;
@@ -7674,8 +7632,9 @@ void GriffonEngine::game_updspellsunder() {
int sx = (xloc / 2 + 4);
int sy = (yloc / 2 + 8);
- temp = (uint32 *)clipbg->getBasePtr(sx, sy);
- dq = *temp;
+
+ unsigned int *temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ unsigned int dq = *temp;
if (dq > 1000 && x > 4)
spellinfo[i].legalive[f] = x;
@@ -7908,21 +7867,19 @@ void GriffonEngine::sys_initialize() {
}
void GriffonEngine::sys_line(Graphics::TransparentSurface *buffer, int x1, int y1, int x2, int y2, int col) {
- uint32 *temp;
-
int xdif = x2 - x1;
int ydif = y2 - y1;
if (xdif == 0) {
for (int y = y1; y <= y2; y++) {
- temp = (uint32 *)buffer->getBasePtr(x1, y);
+ uint32 *temp = (uint32 *)buffer->getBasePtr(x1, y);
*temp = col;
}
}
if (ydif == 0) {
for (int x = x1; x <= x2; x++) {
- temp = (uint32 *)buffer->getBasePtr(x, y1);
+ uint32 *temp = (uint32 *)buffer->getBasePtr(x, y1);
*temp = col;
}
}
@@ -8040,9 +7997,7 @@ void GriffonEngine::sys_LoadAnims() {
}
void GriffonEngine::sys_LoadItemImgs() {
- Graphics::TransparentSurface *temp;
-
- temp = IMG_Load("art/icons.bmp", true);
+ Graphics::TransparentSurface *temp = IMG_Load("art/icons.bmp", true);
for (int i = 0; i <= 20; i++) {
itemimg[i] = new Graphics::TransparentSurface;
@@ -8060,9 +8015,7 @@ void GriffonEngine::sys_LoadItemImgs() {
}
void GriffonEngine::sys_LoadFont() {
- Graphics::TransparentSurface *font;
-
- font = IMG_Load("art/font.bmp", true);
+ Graphics::TransparentSurface *font = IMG_Load("art/font.bmp", true);
for (int i = 32; i <= 255; i++)
for (int f = 0; f <= 4; f++) {
@@ -8099,13 +8052,13 @@ void GriffonEngine::sys_LoadTiles() {
void GriffonEngine::sys_LoadTriggers() {
Common::File file;
-
file.open("data/triggers.dat");
- for (int i = 0; i <= 9999; i++)
+ for (int i = 0; i <= 9999; i++) {
for (int a = 0; a <= 8; a++) {
INPUT("%i", &triggers[i][a]);
}
+ }
file.close();
}
@@ -8146,9 +8099,7 @@ void GriffonEngine::sys_print(Graphics::TransparentSurface *buffer, const char *
}
void GriffonEngine::sys_progress(int w, int wm) {
- long ccc;
-
- ccc = _videobuffer->format.RGBToColor(0, 255, 0);
+ long ccc = _videobuffer->format.RGBToColor(0, 255, 0);
rcDest.setWidth(w * 74 / wm);
_videobuffer->fillRect(rcDest, ccc);
@@ -8160,8 +8111,6 @@ void GriffonEngine::sys_progress(int w, int wm) {
}
void GriffonEngine::sys_setupAudio() {
- Graphics::TransparentSurface *loadimg;
-
menabled = 1;
// FIXME
@@ -8173,7 +8122,7 @@ void GriffonEngine::sys_setupAudio() {
const char *stri = "Loading...";
sys_print(_videobuffer, stri, 160 - 4 * strlen(stri), 116, 0);
- loadimg = IMG_Load("art/load.bmp", true);
+ Graphics::TransparentSurface *loadimg = IMG_Load("art/load.bmp", true);
rcSrc.left = 0;
rcSrc.top = 0;
@@ -8242,10 +8191,6 @@ void GriffonEngine::sys_setupAudio() {
}
void GriffonEngine::sys_update() {
- uint32 *temp, bgc;
- int pa, sx, sy;
- float opx, opy, spd;
-
g_system->updateScreen();
g_system->getEventManager()->pollEvent(event);
@@ -8271,22 +8216,22 @@ void GriffonEngine::sys_update() {
player.walkframe = 0;
}
- pa = (int)(player.attackframe);
+ int pa = (int)(player.attackframe);
for (int i = 0; i <= pa; i++) {
if (ABS(playerattackofs[player.walkdir][i][2]) < kEpsilon) {
playerattackofs[player.walkdir][i][2] = 1;
- opx = player.px;
- opy = player.py;
+ float opx = player.px;
+ float opy = player.py;
player.px = player.px + playerattackofs[player.walkdir][i][0];
player.py = player.py + playerattackofs[player.walkdir][i][1];
- sx = (int)(player.px / 2 + 6);
- sy = (int)(player.py / 2 + 10);
- temp = (uint32 *)clipbg->getBasePtr(sx, sy);
- bgc = *temp;
+ int sx = (int)(player.px / 2 + 6);
+ int sy = (int)(player.py / 2 + 10);
+ uint32 *temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ uint32 bgc = *temp;
if (bgc > 0) {
player.px = opx;
player.py = opy;
@@ -8302,7 +8247,7 @@ void GriffonEngine::sys_update() {
for (int i = 0; i < kMaxFloat; i++) {
if (floattext[i][0] > 0) {
- spd = 0.5 * fpsr;
+ float spd = 0.5 * fpsr;
floattext[i][0] = floattext[i][0] - spd;
floattext[i][2] = floattext[i][2] - spd;
if (floattext[i][0] < 0)
@@ -8310,7 +8255,7 @@ void GriffonEngine::sys_update() {
}
if (floaticon[i][0] > 0) {
- spd = 0.5 * fpsr;
+ float spd = 0.5 * fpsr;
floaticon[i][0] = floaticon[i][0] - spd;
floaticon[i][2] = floaticon[i][2] - spd;
if (floaticon[i][0] < 0)
Commit: b444a9ffc4ee9209c76f1d1bda481c9c7308f257
https://github.com/scummvm/scummvm/commit/b444a9ffc4ee9209c76f1d1bda481c9c7308f257
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Preload sound files, simplify sound API
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 4ac4649..de70152 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -34,6 +34,8 @@
*
*/
+#include "audio/decoders/vorbis.h"
+
#include "griffon/griffon.h"
#include "griffon/config.h"
#include "griffon/console.h"
@@ -96,13 +98,28 @@ namespace Griffon {
// stubs
void Mix_Volume(int channel, int volume) {}
-int Mix_PlayChannel(int par1, Mix_Chunk *chunk, int par3) { return 0; }
+int Mix_PlayChannel(Audio::SeekableAudioStream *chunk, int par3) { return 0; }
void Mix_Pause(int channel) {}
void Mix_HaltChannel(int channel) {}
void Mix_Resume(int channel) {}
-Mix_Chunk *Mix_LoadWAV(const char *name) { return NULL; }
bool Mix_Playing(int channel) { return true; }
+Audio::SeekableAudioStream *Mix_LoadWAV(const char *name) {
+ Common::File file;
+ Audio::SeekableAudioStream *audioStream = NULL;
+
+ file.open(name);
+ if (!file.isOpen()) {
+ error("Cannot open file %s", name);
+ }
+
+#ifdef USE_VORBIS
+ audioStream = Audio::makeVorbisStream(&file, DisposeAfterUse::YES);
+#endif // USE_VORBIS
+
+ return audioStream;
+}
+
void GriffonEngine::griffon_main() {
sys_initialize();
@@ -356,7 +373,7 @@ void GriffonEngine::game_attack() {
objmapf[curmap][lx][ly - 1] = 1;
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -370,7 +387,7 @@ void GriffonEngine::game_attack() {
if (oscript == 0 && player.inventory[INV_FLASK] == 9) {
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndchest], 0);
+ int snd = Mix_PlayChannel(sfx[sndchest], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -394,7 +411,7 @@ void GriffonEngine::game_attack() {
scriptflag[13][0] = 2;
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -411,7 +428,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(7, lx * 16, (ly - 1) * 16);
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -431,7 +448,7 @@ void GriffonEngine::game_attack() {
itemticks = ticks + 215;
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -451,7 +468,7 @@ void GriffonEngine::game_attack() {
itemticks = ticks + 215;
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -472,7 +489,7 @@ void GriffonEngine::game_attack() {
}
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -485,7 +502,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(16, lx * 16, (ly - 1) * 16);
} else {
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndchest], 0);
+ int snd = Mix_PlayChannel(sfx[sndchest], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -500,7 +517,7 @@ void GriffonEngine::game_attack() {
objmapf[curmap][lx][ly - 1] = 1;
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -514,7 +531,7 @@ void GriffonEngine::game_attack() {
if (oscript == 7 && player.inventory[INV_DOUBLEFLASK] == 9) {
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndchest], 0);
+ int snd = Mix_PlayChannel(sfx[sndchest], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -530,7 +547,7 @@ void GriffonEngine::game_attack() {
objmapf[curmap][lx][ly - 1] = 1;
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -544,7 +561,7 @@ void GriffonEngine::game_attack() {
if (oscript == 10 && player.inventory[INV_DOUBLEFLASK] == 9) {
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndchest], 0);
+ int snd = Mix_PlayChannel(sfx[sndchest], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -560,7 +577,7 @@ void GriffonEngine::game_attack() {
objmapf[curmap][lx][ly - 1] = 1;
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -574,7 +591,7 @@ void GriffonEngine::game_attack() {
if (oscript == 11 && player.inventory[INV_SHOCK] == 9) {
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndchest], 0);
+ int snd = Mix_PlayChannel(sfx[sndchest], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -589,7 +606,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(5, lx * 16, (ly - 1) * 16);
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -606,13 +623,13 @@ void GriffonEngine::game_attack() {
scriptflag[60][0] = 1;
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndlever], 0);
+ int snd = Mix_PlayChannel(sfx[sndlever], 0);
Mix_Volume(snd, config.effectsvol);
}
} else if (curmap == 58 && scriptflag[60][0] > 0) {
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[snddoor], 0);
+ int snd = Mix_PlayChannel(sfx[snddoor], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -621,14 +638,14 @@ void GriffonEngine::game_attack() {
if (curmap == 54 && scriptflag[60][0] == 1) {
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndlever], 0);
+ int snd = Mix_PlayChannel(sfx[sndlever], 0);
Mix_Volume(snd, config.effectsvol);
}
scriptflag[60][0] = 2;
} else if (curmap == 54 && scriptflag[60][0] > 1) {
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[snddoor], 0);
+ int snd = Mix_PlayChannel(sfx[snddoor], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -645,7 +662,7 @@ void GriffonEngine::game_attack() {
itemticks = ticks + 215;
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -662,7 +679,7 @@ void GriffonEngine::game_attack() {
itemticks = ticks + 215;
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -679,7 +696,7 @@ void GriffonEngine::game_attack() {
itemticks = ticks + 215;
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -776,13 +793,13 @@ void GriffonEngine::game_castspell(int spellnum, float homex, float homey, float
if (menabled == 1 && config.effects == 1) {
if (spellnum == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndthrow], 0);
+ int snd = Mix_PlayChannel(sfx[sndthrow], 0);
Mix_Volume(snd, config.effectsvol);
} else if (spellnum == 5) {
- int snd = Mix_PlayChannel(-1, sfx[sndcrystal], 0);
+ int snd = Mix_PlayChannel(sfx[sndcrystal], 0);
Mix_Volume(snd, config.effectsvol);
} else if (spellnum == 8 || spellnum == 9) {
- int snd = Mix_PlayChannel(-1, sfx[sndlightning], 0);
+ int snd = Mix_PlayChannel(sfx[sndlightning], 0);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -830,7 +847,7 @@ void GriffonEngine::game_checkhit() {
if (hit) {
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndswordhit], 0);
+ int snd = Mix_PlayChannel(sfx[sndswordhit], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -902,7 +919,7 @@ void GriffonEngine::game_checkinputs() {
player.inventory[INV_FLASK]--;
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -928,7 +945,7 @@ void GriffonEngine::game_checkinputs() {
player.inventory[INV_DOUBLEFLASK]--;
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -1364,7 +1381,7 @@ void GriffonEngine::game_configmenu() {
Mix_Volume(menuchannel, config.musicvol);
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[snddoor], 0);
+ int snd = Mix_PlayChannel(sfx[snddoor], 0);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -1387,7 +1404,7 @@ void GriffonEngine::game_configmenu() {
Mix_Volume(menuchannel, config.musicvol);
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[snddoor], 0);
+ int snd = Mix_PlayChannel(sfx[snddoor], 0);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -1478,7 +1495,7 @@ void GriffonEngine::game_configmenu() {
if (cursel == 7 && config.music == 0) {
config.music = 1;
if (menabled == 1) {
- menuchannel = Mix_PlayChannel(-1, mmenu, -1);
+ menuchannel = Mix_PlayChannel(mmenu, -1);
Mix_Volume(menuchannel, config.musicvol);
}
}
@@ -1490,7 +1507,7 @@ void GriffonEngine::game_configmenu() {
if (cursel == 9 && config.effects == 0) {
config.effects = 1;
if (menabled == 1) {
- int snd = Mix_PlayChannel(-1, sfx[snddoor], 0);
+ int snd = Mix_PlayChannel(sfx[snddoor], 0);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -2770,7 +2787,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (player.hp > 0) {
game_damageplayer(damage);
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndfire], 0);
+ int snd = Mix_PlayChannel(sfx[sndfire], 0);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -2796,7 +2813,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (player.hp > 0) {
game_damageplayer(damage);
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndfire], 0);
+ int snd = Mix_PlayChannel(sfx[sndfire], 0);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -3115,7 +3132,7 @@ void GriffonEngine::game_endofgame() {
if (menabled == 1 && config.music == 1) {
Mix_HaltChannel(-1);
- musicchannel = Mix_PlayChannel(-1, mendofgame, -1);
+ musicchannel = Mix_PlayChannel(mendofgame, -1);
Mix_Volume(musicchannel, 0);
}
@@ -3620,7 +3637,7 @@ void GriffonEngine::game_handlewalking() {
objmapf[curmap][lx][ly] = 1;
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -3634,7 +3651,7 @@ void GriffonEngine::game_handlewalking() {
objmapf[curmap][lx][ly] = 1;
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -3650,7 +3667,7 @@ void GriffonEngine::game_handlewalking() {
scriptflag[9][1] = 1;
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -3665,7 +3682,7 @@ void GriffonEngine::game_handlewalking() {
objmapf[curmap][lx][ly] = 1;
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -4502,7 +4519,7 @@ void GriffonEngine::game_newgame() {
if (menabled == 1 && config.music == 1) {
Mix_HaltChannel(-1);
- musicchannel = Mix_PlayChannel(-1, mendofgame, -1);
+ musicchannel = Mix_PlayChannel(mendofgame, -1);
Mix_Volume(musicchannel, 0);
}
@@ -4743,7 +4760,7 @@ void GriffonEngine::game_processtrigger(int trignum) {
if (tmap > 0) {
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[snddoor], 0);
+ int snd = Mix_PlayChannel(sfx[snddoor], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -5276,7 +5293,7 @@ void GriffonEngine::game_title(int mode) {
Mix_Volume(musicchannel, 0);
Mix_Pause(musicchannel);
- menuchannel = Mix_PlayChannel(-1, mmenu, -1);
+ menuchannel = Mix_PlayChannel(mmenu, -1);
Mix_Volume(menuchannel, config.musicvol);
pmenu = 1;
}
@@ -5475,7 +5492,7 @@ void GriffonEngine::game_updatey() {
}
void GriffonEngine::game_updmusic() {
- Mix_Chunk *iplaysound = NULL;
+ Audio::SeekableAudioStream *iplaysound = NULL;
if (menabled == 1 && config.music == 1) {
@@ -5504,7 +5521,7 @@ void GriffonEngine::game_updmusic() {
if (iplaysound == mgardens)
pgardens = 1;
- musicchannel = Mix_PlayChannel(-1, iplaysound, -1);
+ musicchannel = Mix_PlayChannel(iplaysound, -1);
Mix_Volume(musicchannel, config.musicvol);
} else {
if (!Mix_Playing(musicchannel)) {
@@ -5515,13 +5532,13 @@ void GriffonEngine::game_updmusic() {
if (pgardens == 1) {
Mix_HaltChannel(musicchannel);
if (pgardens == 1 && loopseta == 0)
- musicchannel = Mix_PlayChannel(-1, mgardens, 0);
+ musicchannel = Mix_PlayChannel(mgardens, 0);
if (pgardens == 1 && loopseta == 1)
- musicchannel = Mix_PlayChannel(-1, mgardens2, 0);
+ musicchannel = Mix_PlayChannel(mgardens2, 0);
if (pgardens == 1 && loopseta == 2)
- musicchannel = Mix_PlayChannel(-1, mgardens3, 0);
+ musicchannel = Mix_PlayChannel(mgardens3, 0);
if (pgardens == 1 && loopseta == 3)
- musicchannel = Mix_PlayChannel(-1, mgardens4, 0);
+ musicchannel = Mix_PlayChannel(mgardens4, 0);
}
Mix_Volume(musicchannel, config.musicvol);
@@ -5944,7 +5961,7 @@ void GriffonEngine::game_updnpcs() {
npcinfo[i].attackattempt = ticks + 100;
if ((int)(RND() * 2) == 0) {
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndenemyhit], 0);
+ int snd = Mix_PlayChannel(sfx[sndenemyhit], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -5971,7 +5988,7 @@ void GriffonEngine::game_updnpcs() {
if ((dist) < 24) {
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndbite], 0);
+ int snd = Mix_PlayChannel(sfx[sndbite], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -6077,7 +6094,7 @@ void GriffonEngine::game_updnpcs() {
if ((dist) < 36) {
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndbite], 0);
+ int snd = Mix_PlayChannel(sfx[sndbite], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -6257,7 +6274,7 @@ void GriffonEngine::game_updnpcs() {
if ((dist) < 24) {
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndbite], 0);
+ int snd = Mix_PlayChannel(sfx[sndbite], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -6331,7 +6348,7 @@ void GriffonEngine::game_updnpcs() {
npcinfo[i].attackattempt = ticks + 100;
if ((int)(RND() * 2) == 0) {
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndenemyhit], 0);
+ int snd = Mix_PlayChannel(sfx[sndenemyhit], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -6356,7 +6373,7 @@ void GriffonEngine::game_updnpcs() {
npcinfo[i].attackattempt = ticks + 100;
if ((int)(RND() * 2) == 0) {
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndice], 0);
+ int snd = Mix_PlayChannel(sfx[sndice], 0);
Mix_Volume(snd, config.effectsvol);
}
npcinfo[i].attacking = 1;
@@ -6737,7 +6754,7 @@ void GriffonEngine::game_updspells() {
if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
game_damagenpc(e, damage, 1);
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndice], 0);
+ int snd = Mix_PlayChannel(sfx[sndice], 0);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -6765,7 +6782,7 @@ void GriffonEngine::game_updspells() {
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndice], 0);
+ int snd = Mix_PlayChannel(sfx[sndice], 0);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -6816,7 +6833,7 @@ void GriffonEngine::game_updspells() {
if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
game_damagenpc(e, damage, 1);
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndmetalhit], 0);
+ int snd = Mix_PlayChannel(sfx[sndmetalhit], 0);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -6859,7 +6876,7 @@ void GriffonEngine::game_updspells() {
if (player.hp > 0) {
game_damageplayer(damage);
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndmetalhit], 0);
+ int snd = Mix_PlayChannel(sfx[sndmetalhit], 0);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -6887,7 +6904,7 @@ void GriffonEngine::game_updspells() {
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndmetalhit], 0);
+ int snd = Mix_PlayChannel(sfx[sndmetalhit], 0);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -6938,7 +6955,7 @@ void GriffonEngine::game_updspells() {
if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
game_damagenpc(e, damage, 1);
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndrocks], 0);
+ int snd = Mix_PlayChannel(sfx[sndrocks], 0);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -6967,7 +6984,7 @@ void GriffonEngine::game_updspells() {
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndrocks], 0);
+ int snd = Mix_PlayChannel(sfx[sndrocks], 0);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -7166,7 +7183,7 @@ void GriffonEngine::game_updspells() {
game_damageplayer(damage);
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndfire], 0);
+ int snd = Mix_PlayChannel(sfx[sndfire], 0);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -7654,7 +7671,7 @@ void GriffonEngine::game_updspellsunder() {
if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
game_damagenpc(e, damage, 1);
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndfire], 0);
+ int snd = Mix_PlayChannel(sfx[sndfire], 0);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -7673,7 +7690,7 @@ void GriffonEngine::game_updspellsunder() {
game_damageplayer(damage);
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndfire], 0);
+ int snd = Mix_PlayChannel(sfx[sndfire], 0);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -7698,7 +7715,7 @@ void GriffonEngine::game_updspellsunder() {
clipbg2->fillRect(rcSrc, 0);
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndfire], 0);
+ int snd = Mix_PlayChannel(sfx[sndfire], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -7769,7 +7786,7 @@ void GriffonEngine::game_updspellsunder() {
if (player.hp > 0) {
game_damageplayer(damage);
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndfire], 0);
+ int snd = Mix_PlayChannel(sfx[sndfire], 0);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -8280,7 +8297,7 @@ void GriffonEngine::sys_update() {
player.spelldamage = player.level * 13 / 10;
if (menabled == 1 && config.effects == 1) {
- int snd = Mix_PlayChannel(-1, sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -8342,7 +8359,7 @@ void GriffonEngine::sys_update() {
if (player.hpflashb == 2)
player.hpflashb = 0;
if (menabled == 1 && config.effects == 1 && player.hpflashb == 0 && player.hp < player.maxhp / 4) {
- int snd = Mix_PlayChannel(-1, sfx[sndbeep], 0);
+ int snd = Mix_PlayChannel(sfx[sndbeep], 0);
Mix_Volume(snd, config.effectsvol);
}
}
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 06269f7..91c3365 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -41,6 +41,8 @@
#include "common/random.h"
#include "engines/engine.h"
+#include "audio/audiostream.h"
+
#include "graphics/transparent_surface.h"
namespace Griffon {
@@ -227,8 +229,6 @@ struct ANIMSET2TYPE {
int h;
};
-typedef int Mix_Chunk;
-
class GriffonEngine : public Engine {
public:
GriffonEngine(OSystem *syst);
@@ -405,12 +405,12 @@ private:
int lastnpc;
// music info
- Mix_Chunk *mgardens, *mgardens2, *mgardens3, *mgardens4, *mboss, *mmenu, *mendofgame;
+ Audio::SeekableAudioStream *mgardens, *mgardens2, *mgardens3, *mgardens4, *mboss, *mmenu, *mendofgame;
int menabled, musicchannel, menuchannel;
int pgardens, pboss, ptown, pacademy, pcitadel;
int loopseta;
- Mix_Chunk *sfx[21];
+ Audio::SeekableAudioStream *sfx[21];
// TODO: Check those variables, at least canusekey is a boolean, and the case is wrong in all the names
// room locks
Commit: 022b6316ddb06c94ea2fce2f3301cb8bd8f332bb
https://github.com/scummvm/scummvm/commit/022b6316ddb06c94ea2fce2f3301cb8bd8f332bb
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Unstubbed more sound functionality
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index de70152..3085fdc 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -97,12 +97,44 @@ namespace Griffon {
*/
// stubs
-void Mix_Volume(int channel, int volume) {}
-int Mix_PlayChannel(Audio::SeekableAudioStream *chunk, int par3) { return 0; }
-void Mix_Pause(int channel) {}
-void Mix_HaltChannel(int channel) {}
-void Mix_Resume(int channel) {}
-bool Mix_Playing(int channel) { return true; }
+void GriffonEngine::Mix_Volume(int channel, int volume) {}
+
+int GriffonEngine::Mix_getHandle() {
+ for (uint i = 0; i < SOUND_HANDLES; i++) {
+ if (!_mixer->isSoundHandleActive(_handles[i])) {
+ return i;
+ }
+ }
+
+ error("Mix_getHandle(): Too many sound handles");
+
+ return -1;
+}
+
+int GriffonEngine::Mix_PlayChannel(Audio::SeekableAudioStream *chunk, int par3) {
+ int ch = Mix_getHandle();
+
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, &_handles[ch], chunk, -1, Audio::Mixer::kMaxChannelVolume,
+ 0, DisposeAfterUse::NO, false, false);
+
+ return ch;
+}
+
+void GriffonEngine::Mix_Pause(int channel) {
+ _mixer->pauseHandle(_handles[channel], true);
+}
+
+void GriffonEngine::Mix_HaltChannel(int channel) {
+ _mixer->stopHandle(_handles[channel]);
+}
+
+void GriffonEngine::Mix_Resume(int channel) {
+ _mixer->pauseHandle(_handles[channel], false);
+}
+
+bool GriffonEngine::Mix_Playing(int channel) {
+ return _mixer->isSoundHandleActive(_handles[channel]);
+}
Audio::SeekableAudioStream *Mix_LoadWAV(const char *name) {
Common::File file;
@@ -5045,7 +5077,7 @@ void GriffonEngine::game_saveloadnew() {
rcDest.left = 108;
if (curcol == 2)
rcDest.left = 170;
-
+
// CHECKME: Useless code? or temporary commented?
// rcDest.left = rcDest.left; // + 2 + 2 * sin(-3.14159 * 2 * itemyloc / 16)
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index 7562936..6bc3497 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -26,6 +26,7 @@
#include "common/error.h"
#include "common/file.h"
#include "common/fs.h"
+#include "common/system.h"
#include "graphics/pixelformat.h"
#include "engines/util.h"
@@ -42,6 +43,7 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
_rnd = new Common::RandomSource("griffon");
_console = nullptr;
+ _mixer = nullptr;
_shouldQuit = false;
@@ -61,6 +63,8 @@ GriffonEngine::~GriffonEngine() {
Common::Error GriffonEngine::run() {
initGraphics(320, 240, new Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
+ _mixer = g_system->getMixer();
+
_console = new Console();
griffon_main();
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 91c3365..7fd531e 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -42,6 +42,7 @@
#include "engines/engine.h"
#include "audio/audiostream.h"
+#include "audio/mixer.h"
#include "graphics/transparent_surface.h"
@@ -49,6 +50,8 @@ namespace Griffon {
class Console;
+#define SOUND_HANDLES 16
+
#define kMaxNPC 32
#define kMaxFloat 32
#define kMaxSpell 32
@@ -301,6 +304,14 @@ private:
int state_load_player(int slotnum);
int state_save(int slotnum);
+ void Mix_Volume(int channel, int volume);
+ int Mix_getHandle();
+ int Mix_PlayChannel(Audio::SeekableAudioStream *chunk, int par3);
+ void Mix_Pause(int channel);
+ void Mix_HaltChannel(int channel);
+ void Mix_Resume(int channel);
+ bool Mix_Playing(int channel);
+
private:
Graphics::TransparentSurface *_video, *_videobuffer, *_videobuffer2, *_videobuffer3;
@@ -411,6 +422,8 @@ private:
int loopseta;
Audio::SeekableAudioStream *sfx[21];
+ Audio::SoundHandle _handles[SOUND_HANDLES];
+ Audio::Mixer *_mixer;
// TODO: Check those variables, at least canusekey is a boolean, and the case is wrong in all the names
// room locks
Commit: c3eb075efef324e98f4d6e7588d5ae3499c01ed6
https://github.com/scummvm/scummvm/commit/c3eb075efef324e98f4d6e7588d5ae3499c01ed6
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Change some integer by booleans
Changed paths:
engines/griffon/config.cpp
engines/griffon/config.h
engines/griffon/engine.cpp
engines/griffon/griffon.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/config.cpp b/engines/griffon/config.cpp
index cda0554..83e1e85 100644
--- a/engines/griffon/config.cpp
+++ b/engines/griffon/config.cpp
@@ -40,7 +40,7 @@
namespace Griffon {
CONFIG config = {
- 320, 240, 16, 0, 0, 0, 1, 127, 1, 127
+ 320, 240, 16, false, 0, 0, true, 127, true, 127
};
char config_ini[64] = "config.ini";
@@ -63,9 +63,8 @@ void config_load(CONFIG *config) {
#if 0
char line[128];
char arg[128];
- FILE *fp;
- fp = fopen(config_ini, "r");
+ FILE *fp = fopen(config_ini, "r");
if (fp) {
while (fgets(line, sizeof(line), fp) != NULL) {
sscanf(line, "%s", arg); // eliminate eol and eof by this
@@ -80,25 +79,25 @@ void config_load(CONFIG *config) {
fgets(line, sizeof(line), fp);
sscanf(line, "%i", &config->scr_bpp);
} else if (strcmp(arg, "HWACCEL:YES") == 0) {
- config->hwaccel = SDL_HWACCEL;
+ config->hwaccel = true;
} else if (strcmp(arg, "HWACCEL:NO") == 0) {
- config->hwaccel = 0;
+ config->hwaccel = false;
} else if (strcmp(arg, "HWSURFACE:YES") == 0) {
- config->hwsurface = SDL_HWSURFACE;
+ config->hwsurface = true;
} else if (strcmp(arg, "HWSURFACE:NO") == 0) {
- config->hwsurface = 0;
+ config->hwsurface = false;
} else if (strcmp(arg, "FULLSCREEN:YES") == 0) {
- config->fullscreen = SDL_FULLSCREEN;
+ config->fullscreen = true;
} else if (strcmp(arg, "FULLSCREEN:NO") == 0) {
- config->fullscreen = 0;
+ config->fullscreen = false;
} else if (strcmp(arg, "MUSIC:YES") == 0) {
- config->music = 1;
+ config->music = true;
} else if (strcmp(arg, "MUSIC:NO") == 0) {
- config->music = 0;
+ config->music = false;
} else if (strcmp(arg, "SNDEFFECTS:YES") == 0) {
- config->effects = 1;
+ config->effects = true;
} else if (strcmp(arg, "SNDEFFECTS:NO") == 0) {
- config->effects = 0;
+ config->effects = false;
} else if (strcmp(arg, "opmusicvol:") == 0) {
fgets(line, sizeof(line), fp);
sscanf(line, "%i", &config->musicvol);
diff --git a/engines/griffon/config.h b/engines/griffon/config.h
index 78a7b1b..0b6ec89 100644
--- a/engines/griffon/config.h
+++ b/engines/griffon/config.h
@@ -43,12 +43,12 @@ struct CONFIG {
int scr_width;
int scr_height;
int scr_bpp;
- int fullscreen;
+ bool fullscreen;
int hwaccel;
int hwsurface;
- int music;
+ bool music;
int musicvol;
- int effects;
+ bool effects;
int effectsvol;
};
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 3085fdc..191c309 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -404,7 +404,7 @@ void GriffonEngine::game_attack() {
objmapf[curmap][lx][ly - 1] = 1;
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -418,7 +418,7 @@ void GriffonEngine::game_attack() {
}
if (oscript == 0 && player.inventory[INV_FLASK] == 9) {
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndchest], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -442,7 +442,7 @@ void GriffonEngine::game_attack() {
if (curmap == 81)
scriptflag[13][0] = 2;
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -459,7 +459,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(7, lx * 16, (ly - 1) * 16);
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -479,7 +479,7 @@ void GriffonEngine::game_attack() {
itemticks = ticks + 215;
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -499,7 +499,7 @@ void GriffonEngine::game_attack() {
itemticks = ticks + 215;
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -520,7 +520,7 @@ void GriffonEngine::game_attack() {
}
}
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -533,7 +533,7 @@ void GriffonEngine::game_attack() {
game_eventtext("Found Key");
game_addFloatIcon(16, lx * 16, (ly - 1) * 16);
} else {
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndchest], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -548,7 +548,7 @@ void GriffonEngine::game_attack() {
objmapf[curmap][lx][ly - 1] = 1;
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -562,7 +562,7 @@ void GriffonEngine::game_attack() {
}
if (oscript == 7 && player.inventory[INV_DOUBLEFLASK] == 9) {
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndchest], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -578,7 +578,7 @@ void GriffonEngine::game_attack() {
objmapf[curmap][lx][ly - 1] = 1;
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -592,7 +592,7 @@ void GriffonEngine::game_attack() {
}
if (oscript == 10 && player.inventory[INV_DOUBLEFLASK] == 9) {
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndchest], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -608,7 +608,7 @@ void GriffonEngine::game_attack() {
objmapf[curmap][lx][ly - 1] = 1;
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -622,7 +622,7 @@ void GriffonEngine::game_attack() {
}
if (oscript == 11 && player.inventory[INV_SHOCK] == 9) {
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndchest], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -637,7 +637,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(5, lx * 16, (ly - 1) * 16);
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -654,13 +654,13 @@ void GriffonEngine::game_attack() {
if (curmap == 58 && scriptflag[60][0] == 0) {
scriptflag[60][0] = 1;
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndlever], 0);
Mix_Volume(snd, config.effectsvol);
}
} else if (curmap == 58 && scriptflag[60][0] > 0) {
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[snddoor], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -669,14 +669,14 @@ void GriffonEngine::game_attack() {
}
if (curmap == 54 && scriptflag[60][0] == 1) {
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndlever], 0);
Mix_Volume(snd, config.effectsvol);
}
scriptflag[60][0] = 2;
} else if (curmap == 54 && scriptflag[60][0] > 1) {
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[snddoor], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -693,7 +693,7 @@ void GriffonEngine::game_attack() {
itemticks = ticks + 215;
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -710,7 +710,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(19, lx * 16, (ly - 1) * 16);
itemticks = ticks + 215;
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -727,7 +727,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(20, lx * 16, (ly - 1) * 16);
itemticks = ticks + 215;
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -743,7 +743,7 @@ void GriffonEngine::game_attack() {
}
}
- attacking = 1;
+ attacking = true;
player.attackframe = 0;
movingup = 0;
movingdown = 0;
@@ -823,7 +823,7 @@ void GriffonEngine::game_castspell(int spellnum, float homex, float homey, float
spellinfo[i].nfballs = nballs;
}
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
if (spellnum == 1) {
int snd = Mix_PlayChannel(sfx[sndthrow], 0);
Mix_Volume(snd, config.effectsvol);
@@ -842,7 +842,7 @@ void GriffonEngine::game_castspell(int spellnum, float homex, float homey, float
}
void GriffonEngine::game_checkhit() {
- if (attacking == 1) {
+ if (attacking) {
for (int i = 1; i <= lastnpc; i++) {
if (npcinfo[i].hp > 0 && npcinfo[i].pause < ticks && (int)(RND() * 2) == 0) {
float npx = npcinfo[i].x;
@@ -878,7 +878,7 @@ void GriffonEngine::game_checkhit() {
}
if (hit) {
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndswordhit], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -913,7 +913,7 @@ void GriffonEngine::game_checkinputs() {
}
}
- if (attacking == 1 || (forcepause == 1 && itemselon == 0))
+ if (attacking || (forcepause && itemselon == 0))
return;
if (event.type == Common::EVENT_QUIT) {
@@ -950,13 +950,13 @@ void GriffonEngine::game_checkinputs() {
player.inventory[INV_FLASK]--;
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
itemselon = 0;
- forcepause = 0;
+ forcepause = false;
}
if (curitem == 1 && player.inventory[INV_DOUBLEFLASK] > 0) {
@@ -976,20 +976,19 @@ void GriffonEngine::game_checkinputs() {
player.inventory[INV_DOUBLEFLASK]--;
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
itemselon = 0;
- forcepause = 0;
-
+ forcepause = false;
}
if (curitem == 2 && player.inventory[INV_SHOCK] > 0) {
game_castspell(8, player.px, player.py, npcinfo[curenemy].x, npcinfo[curenemy].y, 0);
- forcepause = 1;
+ forcepause = true;
player.inventory[INV_SHOCK]--;
@@ -1028,7 +1027,7 @@ void GriffonEngine::game_checkinputs() {
player.spellcharge[0] = 0;
- forcepause = 1;
+ forcepause = true;
itemticks = ticks + ntickdelay;
selenemyon = 0;
@@ -1050,7 +1049,7 @@ void GriffonEngine::game_checkinputs() {
itemticks = ticks + ntickdelay;
selenemyon = 0;
itemselon = 0;
- forcepause = 0;
+ forcepause = false;
}
if (curitem > 5 && selenemyon == 0 && itemselon == 1) {
@@ -1087,11 +1086,11 @@ __exit_do:
if (itemselon == 1) {
itemselon = 0;
itemticks = ticks + 220;
- forcepause = 0;
+ forcepause = false;
} else {
itemselon = 1;
itemticks = ticks + 220;
- forcepause = 1;
+ forcepause = true;
player.itemselshade = 0;
}
}
@@ -1309,17 +1308,17 @@ void GriffonEngine::game_configmenu() {
cl = 0;
if (i == 4 && config.scr_bpp == 32)
cl = 0;
- if (i == 6 && config.fullscreen != 0)
+ if (i == 6 && config.fullscreen)
cl = 0;
- if (i == 7 && config.fullscreen == 0)
+ if (i == 7 && !config.fullscreen)
cl = 0;
- if (i == 9 && config.music == 1)
+ if (i == 9 && config.music)
cl = 0;
- if (i == 10 && config.music == 0)
+ if (i == 10 && !config.music)
cl = 0;
- if (i == 12 && config.effects == 1)
+ if (i == 12 && config.effects)
cl = 0;
- if (i == 13 && config.effects == 0)
+ if (i == 13 && !config.effects)
cl = 0;
if (i > 18)
@@ -1412,7 +1411,7 @@ void GriffonEngine::game_configmenu() {
Mix_Volume(musicchannel, config.musicvol);
Mix_Volume(menuchannel, config.musicvol);
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[snddoor], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -1435,7 +1434,7 @@ void GriffonEngine::game_configmenu() {
Mix_Volume(musicchannel, config.musicvol);
Mix_Volume(menuchannel, config.musicvol);
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[snddoor], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -1544,7 +1543,7 @@ void GriffonEngine::game_configmenu() {
}
}
- if (cursel == 10 && config.effects == 1)
+ if (cursel == 10 && config.effects)
config.effects = 0;
if (cursel == 13) {
@@ -2818,7 +2817,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (player.hp > 0) {
game_damageplayer(damage);
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndfire], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -2844,7 +2843,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (player.hp > 0) {
game_damageplayer(damage);
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndfire], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -3024,7 +3023,7 @@ void GriffonEngine::game_drawplayer() {
if (player.armour == 3)
f = 13;
- if (attacking == 0) {
+ if (!attacking) {
rcSrc.left = (int)(player.walkframe / 4) * 24;
rcSrc.top = player.walkdir * 24;
rcSrc.setWidth(24);
@@ -3162,7 +3161,7 @@ void GriffonEngine::game_endofgame() {
float spd = 0.2f;
- if (menabled == 1 && config.music == 1) {
+ if (menabled && config.music) {
Mix_HaltChannel(-1);
musicchannel = Mix_PlayChannel(mendofgame, -1);
Mix_Volume(musicchannel, 0);
@@ -3182,7 +3181,7 @@ void GriffonEngine::game_endofgame() {
ld = ld + 4 * fpsr;
if (ld > config.musicvol)
ld = config.musicvol;
- if (menabled == 1 && ldstop == 0) {
+ if (menabled && ldstop == 0) {
Mix_Volume(musicchannel, (int)ld);
if ((int)ld == config.musicvol)
ldstop = 1;
@@ -3668,7 +3667,7 @@ void GriffonEngine::game_handlewalking() {
objmapf[curmap][lx][ly] = 1;
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -3682,7 +3681,7 @@ void GriffonEngine::game_handlewalking() {
objmapf[curmap][lx][ly] = 1;
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -3698,7 +3697,7 @@ void GriffonEngine::game_handlewalking() {
if (curmap == 41)
scriptflag[9][1] = 1;
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -3713,7 +3712,7 @@ void GriffonEngine::game_handlewalking() {
objmapf[curmap][lx][ly] = 1;
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -3738,7 +3737,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
clipbg->fillRect(trect, ccc);
clipbg2->fillRect(trect, ccc);
- forcepause = 0;
+ forcepause = false;
cloudson = 0;
if (mapnum < 6)
cloudson = 1;
@@ -4549,7 +4548,7 @@ void GriffonEngine::game_newgame() {
fpsr = 0.0;
int y = 140;
- if (menabled == 1 && config.music == 1) {
+ if (menabled && config.music) {
Mix_HaltChannel(-1);
musicchannel = Mix_PlayChannel(mendofgame, -1);
Mix_Volume(musicchannel, 0);
@@ -4566,7 +4565,7 @@ void GriffonEngine::game_newgame() {
ld += 4 * fpsr;
if ((int)ld > config.musicvol)
ld = config.musicvol;
- if (menabled == 1 && ldstop == 0) {
+ if (menabled && ldstop == 0) {
Mix_Volume(musicchannel, (int)ld);
if ((int)ld == config.musicvol)
ldstop = 1;
@@ -4682,7 +4681,7 @@ __exit_do:
player.walkspd = 1.1f;
animspd = 0.5f;
- attacking = 0;
+ attacking = false;
player.attackspd = 1.5f;
player.sword = 1;
@@ -4715,13 +4714,13 @@ __exit_do:
void GriffonEngine::game_playgame() {
game_swash();
- if (pmenu == 1 && menabled == 1) {
+ if (pmenu == 1 && menabled) {
Mix_HaltChannel(menuchannel);
pmenu = 0;
}
do {
- if (forcepause == 0) {
+ if (!forcepause) {
game_updanims();
game_updnpcs();
}
@@ -4729,7 +4728,7 @@ void GriffonEngine::game_playgame() {
game_checktrigger();
game_checkinputs();
- if (forcepause == 0)
+ if (!forcepause)
game_handlewalking();
game_updatey();
@@ -4791,7 +4790,7 @@ void GriffonEngine::game_processtrigger(int trignum) {
player.py = 0;
if (tmap > 0) {
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[snddoor], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -4904,7 +4903,7 @@ void GriffonEngine::game_saveloadnew() {
if (state_load(currow - 1)) {
player.walkspd = 1.1f;
animspd = 0.5f;
- attacking = 0;
+ attacking = false;
player.attackspd = 1.5f;
pgardens = 0;
@@ -5321,7 +5320,7 @@ void GriffonEngine::game_title(int mode) {
int keypause = ticks + 220;
int ticks1 = ticks;
- if (menabled == 1 && config.music == 1) {
+ if (menabled && config.music) {
Mix_Volume(musicchannel, 0);
Mix_Pause(musicchannel);
@@ -5339,7 +5338,7 @@ void GriffonEngine::game_title(int mode) {
ld += 4.0 * fpsr;
if (ld > config.musicvol)
ld = config.musicvol;
- if (menabled == 1 && ldstop == 0) {
+ if (menabled && ldstop == 0) {
Mix_Volume(menuchannel, (int)ld);
if ((int)ld == config.musicvol)
ldstop = 1;
@@ -5460,7 +5459,7 @@ void GriffonEngine::game_title(int mode) {
itemticks = ticks + 210;
- if (menabled == 1 && config.music == 1) {
+ if (menabled && config.music) {
Mix_HaltChannel(menuchannel);
Mix_Resume(musicchannel);
Mix_Volume(musicchannel, config.musicvol);
@@ -5526,7 +5525,7 @@ void GriffonEngine::game_updatey() {
void GriffonEngine::game_updmusic() {
Audio::SeekableAudioStream *iplaysound = NULL;
- if (menabled == 1 && config.music == 1) {
+ if (menabled && config.music) {
// if(curmap > 5 && curmap < 42) iplaysound = macademy;
// if(curmap > 47) iplaysound = mgardens;
@@ -5992,7 +5991,7 @@ void GriffonEngine::game_updnpcs() {
if (abs(xdif) < 20 && abs(ydif) < 20) {
npcinfo[i].attackattempt = ticks + 100;
if ((int)(RND() * 2) == 0) {
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndenemyhit], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -6019,7 +6018,7 @@ void GriffonEngine::game_updnpcs() {
float dist = sqrt(xdif * xdif + ydif * ydif);
if ((dist) < 24) {
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndbite], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -6125,7 +6124,7 @@ void GriffonEngine::game_updnpcs() {
float dist = sqrt(xdif * xdif + ydif * ydif);
if ((dist) < 36) {
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndbite], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -6305,7 +6304,7 @@ void GriffonEngine::game_updnpcs() {
float dist = sqrt(xdif * xdif + ydif * ydif);
if ((dist) < 24) {
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndbite], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -6379,7 +6378,7 @@ void GriffonEngine::game_updnpcs() {
if (abs(xdif) < 32 && abs(ydif) < 32) {
npcinfo[i].attackattempt = ticks + 100;
if ((int)(RND() * 2) == 0) {
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndenemyhit], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -6404,7 +6403,7 @@ void GriffonEngine::game_updnpcs() {
if (abs(xdif) < 38 && abs(ydif) < 38) {
npcinfo[i].attackattempt = ticks + 100;
if ((int)(RND() * 2) == 0) {
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndice], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -6709,7 +6708,7 @@ void GriffonEngine::game_updspells() {
int spellnum = spellinfo[i].spellnum;
// water
- if (spellnum == 0 && forcepause == 0) {
+ if (spellnum == 0 && !forcepause) {
float fr = (32 - spellinfo[i].frame);
ll[0][0] = -2;
@@ -6785,7 +6784,7 @@ void GriffonEngine::game_updspells() {
if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
game_damagenpc(e, damage, 1);
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndice], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -6813,7 +6812,7 @@ void GriffonEngine::game_updspells() {
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndice], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -6826,7 +6825,7 @@ void GriffonEngine::game_updspells() {
}
// metal
- if (spellnum == 1 && forcepause == 0) {
+ if (spellnum == 1 && !forcepause) {
int fr = (int)((32 - spellinfo[i].frame) * 4) % 3;
rcSrc.left = fr * 48;
@@ -6864,7 +6863,7 @@ void GriffonEngine::game_updspells() {
if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
game_damagenpc(e, damage, 1);
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndmetalhit], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -6907,7 +6906,7 @@ void GriffonEngine::game_updspells() {
if (player.hp > 0) {
game_damageplayer(damage);
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndmetalhit], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -6935,7 +6934,7 @@ void GriffonEngine::game_updspells() {
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndmetalhit], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -6945,7 +6944,7 @@ void GriffonEngine::game_updspells() {
}
// earth
- if (spellnum == 2 && forcepause == 0) {
+ if (spellnum == 2 && !forcepause) {
float hght = 240 - spellinfo[i].enemyy;
for (int f = 8; f >= 0; f--) {
@@ -6986,7 +6985,7 @@ void GriffonEngine::game_updspells() {
if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
game_damagenpc(e, damage, 1);
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndrocks], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -7015,7 +7014,7 @@ void GriffonEngine::game_updspells() {
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndrocks], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -7059,7 +7058,7 @@ void GriffonEngine::game_updspells() {
spellinfo[i].frame = spellinfo[i].frame - 0.3 * fpsr;
if (spellinfo[i].frame < 0) {
spellinfo[i].frame = 0;
- forcepause = 0;
+ forcepause = false;
npx = player.px + 12;
npy = player.py + 20;
@@ -7130,7 +7129,7 @@ void GriffonEngine::game_updspells() {
}
// room fireballs
- if (spellnum == 6 && forcepause == 0) {
+ if (spellnum == 6 && !forcepause) {
if (spellinfo[i].frame > 16) {
float fr = (32 - spellinfo[i].frame);
@@ -7214,7 +7213,7 @@ void GriffonEngine::game_updspells() {
if (player.hp > 0)
game_damageplayer(damage);
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndfire], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -7472,7 +7471,7 @@ void GriffonEngine::game_updspells() {
spellinfo[i].frame -= 0.5 * fpsr;
if (spellinfo[i].frame < 0) {
spellinfo[i].frame = 0;
- forcepause = 0;
+ forcepause = false;
}
}
@@ -7547,7 +7546,7 @@ void GriffonEngine::game_updspells() {
void GriffonEngine::game_updspellsunder() {
- if (forcepause == 1)
+ if (forcepause)
return;
for (int i = 0; i < kMaxSpell; i++) {
@@ -7702,7 +7701,7 @@ void GriffonEngine::game_updspellsunder() {
damage = -damage;
if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
game_damagenpc(e, damage, 1);
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndfire], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -7721,7 +7720,7 @@ void GriffonEngine::game_updspellsunder() {
if (player.hp > 0) {
game_damageplayer(damage);
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndfire], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -7746,7 +7745,7 @@ void GriffonEngine::game_updspellsunder() {
clipbg2->fillRect(rcSrc, 0);
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndfire], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -7817,7 +7816,7 @@ void GriffonEngine::game_updspellsunder() {
if (player.hp > 0) {
game_damageplayer(damage);
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndfire], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -8160,7 +8159,7 @@ void GriffonEngine::sys_progress(int w, int wm) {
}
void GriffonEngine::sys_setupAudio() {
- menabled = 1;
+ menabled = true;
// FIXME
//Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 1024);
@@ -8191,7 +8190,7 @@ void GriffonEngine::sys_setupAudio() {
rcDest.top = 116 + 12 + 12;
rcDest.setHeight(8);
- if (menabled == 1) {
+ if (menabled) {
mboss = Mix_LoadWAV("music/boss.ogg");
sys_progress(1, 21);
mgardens = Mix_LoadWAV("music/gardens.ogg");
@@ -8257,10 +8256,10 @@ void GriffonEngine::sys_update() {
secsingame = secsingame + 1;
}
- if (attacking == 1) {
+ if (attacking) {
player.attackframe += player.attackspd * fpsr;
if (player.attackframe >= 16) {
- attacking = 0;
+ attacking = false;
player.attackframe = 0;
player.walkframe = 0;
}
@@ -8328,7 +8327,7 @@ void GriffonEngine::sys_update() {
player.sworddamage = player.level * 14 / 10;
player.spelldamage = player.level * 13 / 10;
- if (menabled == 1 && config.effects == 1) {
+ if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
Mix_Volume(snd, config.effectsvol);
}
@@ -8345,7 +8344,7 @@ void GriffonEngine::sys_update() {
clipbg->fillRect(rc, 1000);
- if (forcepause == 0) {
+ if (!forcepause) {
for (int i = 0; i < 5; i++) {
if (player.foundspell[i] == 1)
player.spellcharge[i] += 1 * player.level * 0.01 * fpsr;
@@ -8390,7 +8389,7 @@ void GriffonEngine::sys_update() {
player.hpflashb = player.hpflashb + 1;
if (player.hpflashb == 2)
player.hpflashb = 0;
- if (menabled == 1 && config.effects == 1 && player.hpflashb == 0 && player.hp < player.maxhp / 4) {
+ if (menabled && config.effects && player.hpflashb == 0 && player.hp < player.maxhp / 4) {
int snd = Mix_PlayChannel(sfx[sndbeep], 0);
Mix_Volume(snd, config.effectsvol);
}
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index 6bc3497..7ffc923 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -47,7 +47,7 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
_shouldQuit = false;
- menabled = 1;
+ menabled = true;
musicchannel = -1;
menuchannel = -1;
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 7fd531e..59255c9 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -334,7 +334,8 @@ private:
int itemselon, curitem, itemticks;
float itemyloc;
- int selenemyon, curenemy, forcepause;
+ int selenemyon, curenemy;
+ bool forcepause;
int roomlock; // set to disable any room jumps while in the room
int scriptflag[100][10], saveslot; // script, flag
@@ -369,7 +370,7 @@ private:
// player info
int movingup, movingdown, movingleft, movingright;
PLAYERTYPE player;
- int attacking;
+ bool attacking;
PLAYERTYPE playera;
int asecstart;
@@ -417,7 +418,8 @@ private:
// music info
Audio::SeekableAudioStream *mgardens, *mgardens2, *mgardens3, *mgardens4, *mboss, *mmenu, *mendofgame;
- int menabled, musicchannel, menuchannel;
+ bool menabled; // CHECKME: Always true?
+ int musicchannel, menuchannel;
int pgardens, pboss, ptown, pacademy, pcitadel;
int loopseta;
Commit: b790f823747414e5a2a9b6c0603ae46d8c4fba51
https://github.com/scummvm/scummvm/commit/b790f823747414e5a2a9b6c0603ae46d8c4fba51
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Preload sounds into memory
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 191c309..4d97703 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -34,7 +34,9 @@
*
*/
+#include "audio/audiostream.h"
#include "audio/decoders/vorbis.h"
+#include "common/memstream.h"
#include "griffon/griffon.h"
#include "griffon/config.h"
@@ -111,11 +113,15 @@ int GriffonEngine::Mix_getHandle() {
return -1;
}
-int GriffonEngine::Mix_PlayChannel(Audio::SeekableAudioStream *chunk, int par3) {
+int GriffonEngine::Mix_PlayChannel(DataChunk *chunk, int par3) {
int ch = Mix_getHandle();
- _mixer->playStream(Audio::Mixer::kSFXSoundType, &_handles[ch], chunk, -1, Audio::Mixer::kMaxChannelVolume,
- 0, DisposeAfterUse::NO, false, false);
+#ifdef USE_VORBIS
+ Audio::SeekableAudioStream *audioStream = Audio::makeVorbisStream(new Common::MemoryReadStream(chunk->data, chunk->size), DisposeAfterUse::YES);
+
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, &_handles[ch], audioStream, -1, Audio::Mixer::kMaxChannelVolume,
+ 0, DisposeAfterUse::YES, false, false);
+#endif // USE_VORBIS
return ch;
}
@@ -136,20 +142,21 @@ bool GriffonEngine::Mix_Playing(int channel) {
return _mixer->isSoundHandleActive(_handles[channel]);
}
-Audio::SeekableAudioStream *Mix_LoadWAV(const char *name) {
+DataChunk *Mix_LoadWAV(const char *name) {
Common::File file;
- Audio::SeekableAudioStream *audioStream = NULL;
+ DataChunk *res = new DataChunk;
file.open(name);
if (!file.isOpen()) {
error("Cannot open file %s", name);
}
-#ifdef USE_VORBIS
- audioStream = Audio::makeVorbisStream(&file, DisposeAfterUse::YES);
-#endif // USE_VORBIS
+ res->size = file.size();
+ res->data = (byte *)malloc(res->size);
+
+ file.read(res->data, res->size);
- return audioStream;
+ return res;
}
@@ -5523,7 +5530,7 @@ void GriffonEngine::game_updatey() {
}
void GriffonEngine::game_updmusic() {
- Audio::SeekableAudioStream *iplaysound = NULL;
+ DataChunk *iplaysound = NULL;
if (menabled && config.music) {
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 59255c9..6961d3a 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -41,7 +41,6 @@
#include "common/random.h"
#include "engines/engine.h"
-#include "audio/audiostream.h"
#include "audio/mixer.h"
#include "graphics/transparent_surface.h"
@@ -232,6 +231,11 @@ struct ANIMSET2TYPE {
int h;
};
+struct DataChunk {
+ byte *data;
+ int size;
+};
+
class GriffonEngine : public Engine {
public:
GriffonEngine(OSystem *syst);
@@ -306,7 +310,7 @@ private:
void Mix_Volume(int channel, int volume);
int Mix_getHandle();
- int Mix_PlayChannel(Audio::SeekableAudioStream *chunk, int par3);
+ int Mix_PlayChannel(DataChunk *chunk, int par3);
void Mix_Pause(int channel);
void Mix_HaltChannel(int channel);
void Mix_Resume(int channel);
@@ -417,13 +421,13 @@ private:
int lastnpc;
// music info
- Audio::SeekableAudioStream *mgardens, *mgardens2, *mgardens3, *mgardens4, *mboss, *mmenu, *mendofgame;
+ DataChunk *mgardens, *mgardens2, *mgardens3, *mgardens4, *mboss, *mmenu, *mendofgame;
bool menabled; // CHECKME: Always true?
int musicchannel, menuchannel;
int pgardens, pboss, ptown, pacademy, pcitadel;
int loopseta;
- Audio::SeekableAudioStream *sfx[21];
+ DataChunk *sfx[21];
Audio::SoundHandle _handles[SOUND_HANDLES];
Audio::Mixer *_mixer;
Commit: 85e0ffff3247c74d10eaba6c6a721b9cfed26b67
https://github.com/scummvm/scummvm/commit/85e0ffff3247c74d10eaba6c6a721b9cfed26b67
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Implement sound looping
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 4d97703..0b55b54 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -113,14 +113,20 @@ int GriffonEngine::Mix_getHandle() {
return -1;
}
-int GriffonEngine::Mix_PlayChannel(DataChunk *chunk, int par3) {
+int GriffonEngine::Mix_PlayChannel(DataChunk *chunk, bool looped) {
int ch = Mix_getHandle();
#ifdef USE_VORBIS
Audio::SeekableAudioStream *audioStream = Audio::makeVorbisStream(new Common::MemoryReadStream(chunk->data, chunk->size), DisposeAfterUse::YES);
- _mixer->playStream(Audio::Mixer::kSFXSoundType, &_handles[ch], audioStream, -1, Audio::Mixer::kMaxChannelVolume,
- 0, DisposeAfterUse::YES, false, false);
+
+ if (looped) {
+ Audio::AudioStream *loopingStream = new Audio::LoopingAudioStream(audioStream, 0, DisposeAfterUse::YES);
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, &_handles[ch], loopingStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::YES, false, false);
+
+ } else {
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, &_handles[ch], audioStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::YES, false, false);
+ }
#endif // USE_VORBIS
return ch;
@@ -412,7 +418,7 @@ void GriffonEngine::game_attack() {
objmapf[curmap][lx][ly - 1] = 1;
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -426,7 +432,7 @@ void GriffonEngine::game_attack() {
if (oscript == 0 && player.inventory[INV_FLASK] == 9) {
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndchest], 0);
+ int snd = Mix_PlayChannel(sfx[sndchest]);
Mix_Volume(snd, config.effectsvol);
}
@@ -450,7 +456,7 @@ void GriffonEngine::game_attack() {
scriptflag[13][0] = 2;
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -467,7 +473,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(7, lx * 16, (ly - 1) * 16);
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -487,7 +493,7 @@ void GriffonEngine::game_attack() {
itemticks = ticks + 215;
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -507,7 +513,7 @@ void GriffonEngine::game_attack() {
itemticks = ticks + 215;
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -528,7 +534,7 @@ void GriffonEngine::game_attack() {
}
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -541,7 +547,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(16, lx * 16, (ly - 1) * 16);
} else {
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndchest], 0);
+ int snd = Mix_PlayChannel(sfx[sndchest]);
Mix_Volume(snd, config.effectsvol);
}
@@ -556,7 +562,7 @@ void GriffonEngine::game_attack() {
objmapf[curmap][lx][ly - 1] = 1;
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -570,7 +576,7 @@ void GriffonEngine::game_attack() {
if (oscript == 7 && player.inventory[INV_DOUBLEFLASK] == 9) {
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndchest], 0);
+ int snd = Mix_PlayChannel(sfx[sndchest]);
Mix_Volume(snd, config.effectsvol);
}
@@ -586,7 +592,7 @@ void GriffonEngine::game_attack() {
objmapf[curmap][lx][ly - 1] = 1;
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -600,7 +606,7 @@ void GriffonEngine::game_attack() {
if (oscript == 10 && player.inventory[INV_DOUBLEFLASK] == 9) {
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndchest], 0);
+ int snd = Mix_PlayChannel(sfx[sndchest]);
Mix_Volume(snd, config.effectsvol);
}
@@ -616,7 +622,7 @@ void GriffonEngine::game_attack() {
objmapf[curmap][lx][ly - 1] = 1;
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -630,7 +636,7 @@ void GriffonEngine::game_attack() {
if (oscript == 11 && player.inventory[INV_SHOCK] == 9) {
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndchest], 0);
+ int snd = Mix_PlayChannel(sfx[sndchest]);
Mix_Volume(snd, config.effectsvol);
}
@@ -645,7 +651,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(5, lx * 16, (ly - 1) * 16);
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -662,13 +668,13 @@ void GriffonEngine::game_attack() {
scriptflag[60][0] = 1;
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndlever], 0);
+ int snd = Mix_PlayChannel(sfx[sndlever]);
Mix_Volume(snd, config.effectsvol);
}
} else if (curmap == 58 && scriptflag[60][0] > 0) {
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[snddoor], 0);
+ int snd = Mix_PlayChannel(sfx[snddoor]);
Mix_Volume(snd, config.effectsvol);
}
@@ -677,14 +683,14 @@ void GriffonEngine::game_attack() {
if (curmap == 54 && scriptflag[60][0] == 1) {
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndlever], 0);
+ int snd = Mix_PlayChannel(sfx[sndlever]);
Mix_Volume(snd, config.effectsvol);
}
scriptflag[60][0] = 2;
} else if (curmap == 54 && scriptflag[60][0] > 1) {
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[snddoor], 0);
+ int snd = Mix_PlayChannel(sfx[snddoor]);
Mix_Volume(snd, config.effectsvol);
}
@@ -701,7 +707,7 @@ void GriffonEngine::game_attack() {
itemticks = ticks + 215;
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -718,7 +724,7 @@ void GriffonEngine::game_attack() {
itemticks = ticks + 215;
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -735,7 +741,7 @@ void GriffonEngine::game_attack() {
itemticks = ticks + 215;
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -832,13 +838,13 @@ void GriffonEngine::game_castspell(int spellnum, float homex, float homey, float
if (menabled && config.effects) {
if (spellnum == 1) {
- int snd = Mix_PlayChannel(sfx[sndthrow], 0);
+ int snd = Mix_PlayChannel(sfx[sndthrow]);
Mix_Volume(snd, config.effectsvol);
} else if (spellnum == 5) {
- int snd = Mix_PlayChannel(sfx[sndcrystal], 0);
+ int snd = Mix_PlayChannel(sfx[sndcrystal]);
Mix_Volume(snd, config.effectsvol);
} else if (spellnum == 8 || spellnum == 9) {
- int snd = Mix_PlayChannel(sfx[sndlightning], 0);
+ int snd = Mix_PlayChannel(sfx[sndlightning]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -886,7 +892,7 @@ void GriffonEngine::game_checkhit() {
if (hit) {
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndswordhit], 0);
+ int snd = Mix_PlayChannel(sfx[sndswordhit]);
Mix_Volume(snd, config.effectsvol);
}
@@ -958,7 +964,7 @@ void GriffonEngine::game_checkinputs() {
player.inventory[INV_FLASK]--;
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -984,7 +990,7 @@ void GriffonEngine::game_checkinputs() {
player.inventory[INV_DOUBLEFLASK]--;
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -1419,7 +1425,7 @@ void GriffonEngine::game_configmenu() {
Mix_Volume(menuchannel, config.musicvol);
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[snddoor], 0);
+ int snd = Mix_PlayChannel(sfx[snddoor]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -1442,7 +1448,7 @@ void GriffonEngine::game_configmenu() {
Mix_Volume(menuchannel, config.musicvol);
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[snddoor], 0);
+ int snd = Mix_PlayChannel(sfx[snddoor]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -1533,7 +1539,7 @@ void GriffonEngine::game_configmenu() {
if (cursel == 7 && config.music == 0) {
config.music = 1;
if (menabled == 1) {
- menuchannel = Mix_PlayChannel(mmenu, -1);
+ menuchannel = Mix_PlayChannel(mmenu, true);
Mix_Volume(menuchannel, config.musicvol);
}
}
@@ -1545,7 +1551,7 @@ void GriffonEngine::game_configmenu() {
if (cursel == 9 && config.effects == 0) {
config.effects = 1;
if (menabled == 1) {
- int snd = Mix_PlayChannel(sfx[snddoor], 0);
+ int snd = Mix_PlayChannel(sfx[snddoor]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -2825,7 +2831,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (player.hp > 0) {
game_damageplayer(damage);
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndfire], 0);
+ int snd = Mix_PlayChannel(sfx[sndfire]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -2851,7 +2857,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (player.hp > 0) {
game_damageplayer(damage);
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndfire], 0);
+ int snd = Mix_PlayChannel(sfx[sndfire]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -3170,7 +3176,7 @@ void GriffonEngine::game_endofgame() {
if (menabled && config.music) {
Mix_HaltChannel(-1);
- musicchannel = Mix_PlayChannel(mendofgame, -1);
+ musicchannel = Mix_PlayChannel(mendofgame, true);
Mix_Volume(musicchannel, 0);
}
@@ -3675,7 +3681,7 @@ void GriffonEngine::game_handlewalking() {
objmapf[curmap][lx][ly] = 1;
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -3689,7 +3695,7 @@ void GriffonEngine::game_handlewalking() {
objmapf[curmap][lx][ly] = 1;
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -3705,7 +3711,7 @@ void GriffonEngine::game_handlewalking() {
scriptflag[9][1] = 1;
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -3720,7 +3726,7 @@ void GriffonEngine::game_handlewalking() {
objmapf[curmap][lx][ly] = 1;
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -4557,7 +4563,7 @@ void GriffonEngine::game_newgame() {
if (menabled && config.music) {
Mix_HaltChannel(-1);
- musicchannel = Mix_PlayChannel(mendofgame, -1);
+ musicchannel = Mix_PlayChannel(mendofgame, true);
Mix_Volume(musicchannel, 0);
}
@@ -4798,7 +4804,7 @@ void GriffonEngine::game_processtrigger(int trignum) {
if (tmap > 0) {
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[snddoor], 0);
+ int snd = Mix_PlayChannel(sfx[snddoor]);
Mix_Volume(snd, config.effectsvol);
}
@@ -5331,7 +5337,7 @@ void GriffonEngine::game_title(int mode) {
Mix_Volume(musicchannel, 0);
Mix_Pause(musicchannel);
- menuchannel = Mix_PlayChannel(mmenu, -1);
+ menuchannel = Mix_PlayChannel(mmenu, true);
Mix_Volume(menuchannel, config.musicvol);
pmenu = 1;
}
@@ -5559,7 +5565,7 @@ void GriffonEngine::game_updmusic() {
if (iplaysound == mgardens)
pgardens = 1;
- musicchannel = Mix_PlayChannel(iplaysound, -1);
+ musicchannel = Mix_PlayChannel(iplaysound, true);
Mix_Volume(musicchannel, config.musicvol);
} else {
if (!Mix_Playing(musicchannel)) {
@@ -5570,13 +5576,13 @@ void GriffonEngine::game_updmusic() {
if (pgardens == 1) {
Mix_HaltChannel(musicchannel);
if (pgardens == 1 && loopseta == 0)
- musicchannel = Mix_PlayChannel(mgardens, 0);
+ musicchannel = Mix_PlayChannel(mgardens);
if (pgardens == 1 && loopseta == 1)
- musicchannel = Mix_PlayChannel(mgardens2, 0);
+ musicchannel = Mix_PlayChannel(mgardens2);
if (pgardens == 1 && loopseta == 2)
- musicchannel = Mix_PlayChannel(mgardens3, 0);
+ musicchannel = Mix_PlayChannel(mgardens3);
if (pgardens == 1 && loopseta == 3)
- musicchannel = Mix_PlayChannel(mgardens4, 0);
+ musicchannel = Mix_PlayChannel(mgardens4);
}
Mix_Volume(musicchannel, config.musicvol);
@@ -5999,7 +6005,7 @@ void GriffonEngine::game_updnpcs() {
npcinfo[i].attackattempt = ticks + 100;
if ((int)(RND() * 2) == 0) {
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndenemyhit], 0);
+ int snd = Mix_PlayChannel(sfx[sndenemyhit]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6026,7 +6032,7 @@ void GriffonEngine::game_updnpcs() {
if ((dist) < 24) {
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndbite], 0);
+ int snd = Mix_PlayChannel(sfx[sndbite]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6132,7 +6138,7 @@ void GriffonEngine::game_updnpcs() {
if ((dist) < 36) {
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndbite], 0);
+ int snd = Mix_PlayChannel(sfx[sndbite]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6312,7 +6318,7 @@ void GriffonEngine::game_updnpcs() {
if ((dist) < 24) {
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndbite], 0);
+ int snd = Mix_PlayChannel(sfx[sndbite]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6386,7 +6392,7 @@ void GriffonEngine::game_updnpcs() {
npcinfo[i].attackattempt = ticks + 100;
if ((int)(RND() * 2) == 0) {
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndenemyhit], 0);
+ int snd = Mix_PlayChannel(sfx[sndenemyhit]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6411,7 +6417,7 @@ void GriffonEngine::game_updnpcs() {
npcinfo[i].attackattempt = ticks + 100;
if ((int)(RND() * 2) == 0) {
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndice], 0);
+ int snd = Mix_PlayChannel(sfx[sndice]);
Mix_Volume(snd, config.effectsvol);
}
npcinfo[i].attacking = 1;
@@ -6792,7 +6798,7 @@ void GriffonEngine::game_updspells() {
if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
game_damagenpc(e, damage, 1);
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndice], 0);
+ int snd = Mix_PlayChannel(sfx[sndice]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -6820,7 +6826,7 @@ void GriffonEngine::game_updspells() {
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndice], 0);
+ int snd = Mix_PlayChannel(sfx[sndice]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -6871,7 +6877,7 @@ void GriffonEngine::game_updspells() {
if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
game_damagenpc(e, damage, 1);
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndmetalhit], 0);
+ int snd = Mix_PlayChannel(sfx[sndmetalhit]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -6914,7 +6920,7 @@ void GriffonEngine::game_updspells() {
if (player.hp > 0) {
game_damageplayer(damage);
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndmetalhit], 0);
+ int snd = Mix_PlayChannel(sfx[sndmetalhit]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -6942,7 +6948,7 @@ void GriffonEngine::game_updspells() {
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndmetalhit], 0);
+ int snd = Mix_PlayChannel(sfx[sndmetalhit]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -6993,7 +6999,7 @@ void GriffonEngine::game_updspells() {
if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
game_damagenpc(e, damage, 1);
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndrocks], 0);
+ int snd = Mix_PlayChannel(sfx[sndrocks]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -7022,7 +7028,7 @@ void GriffonEngine::game_updspells() {
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndrocks], 0);
+ int snd = Mix_PlayChannel(sfx[sndrocks]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -7221,7 +7227,7 @@ void GriffonEngine::game_updspells() {
game_damageplayer(damage);
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndfire], 0);
+ int snd = Mix_PlayChannel(sfx[sndfire]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -7709,7 +7715,7 @@ void GriffonEngine::game_updspellsunder() {
if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
game_damagenpc(e, damage, 1);
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndfire], 0);
+ int snd = Mix_PlayChannel(sfx[sndfire]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -7728,7 +7734,7 @@ void GriffonEngine::game_updspellsunder() {
game_damageplayer(damage);
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndfire], 0);
+ int snd = Mix_PlayChannel(sfx[sndfire]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -7753,7 +7759,7 @@ void GriffonEngine::game_updspellsunder() {
clipbg2->fillRect(rcSrc, 0);
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndfire], 0);
+ int snd = Mix_PlayChannel(sfx[sndfire]);
Mix_Volume(snd, config.effectsvol);
}
@@ -7824,7 +7830,7 @@ void GriffonEngine::game_updspellsunder() {
if (player.hp > 0) {
game_damageplayer(damage);
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndfire], 0);
+ int snd = Mix_PlayChannel(sfx[sndfire]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -8335,7 +8341,7 @@ void GriffonEngine::sys_update() {
player.spelldamage = player.level * 13 / 10;
if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup], 0);
+ int snd = Mix_PlayChannel(sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -8397,7 +8403,7 @@ void GriffonEngine::sys_update() {
if (player.hpflashb == 2)
player.hpflashb = 0;
if (menabled && config.effects && player.hpflashb == 0 && player.hp < player.maxhp / 4) {
- int snd = Mix_PlayChannel(sfx[sndbeep], 0);
+ int snd = Mix_PlayChannel(sfx[sndbeep]);
Mix_Volume(snd, config.effectsvol);
}
}
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 6961d3a..35f9450 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -310,7 +310,7 @@ private:
void Mix_Volume(int channel, int volume);
int Mix_getHandle();
- int Mix_PlayChannel(DataChunk *chunk, int par3);
+ int Mix_PlayChannel(DataChunk *chunk, bool looped = false);
void Mix_Pause(int channel);
void Mix_HaltChannel(int channel);
void Mix_Resume(int channel);
Commit: e541ae9dc599589771144963dfb759cbd1d8a80c
https://github.com/scummvm/scummvm/commit/e541ae9dc599589771144963dfb759cbd1d8a80c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Rename class variables
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 0b55b54..0df92bd 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -1539,7 +1539,7 @@ void GriffonEngine::game_configmenu() {
if (cursel == 7 && config.music == 0) {
config.music = 1;
if (menabled == 1) {
- menuchannel = Mix_PlayChannel(mmenu, true);
+ menuchannel = Mix_PlayChannel(_mmenu, true);
Mix_Volume(menuchannel, config.musicvol);
}
}
@@ -1706,7 +1706,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- clipbg2->fillRect(rcDest, clipbg->format.RGBToColor(255, 255, 255));
+ _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
scriptflag[2][0] = 1;
}
}
@@ -1739,7 +1739,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
scriptflag[3][0] = 1;
- clipbg2->fillRect(rcDest, clipbg->format.RGBToColor(255, 255, 255));
+ _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
}
}
@@ -1766,7 +1766,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
rcDest.setWidth(16);
rcDest.setHeight(16);
- tiles[curtilel]->blit(*mapbg, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ tiles[curtilel]->blit(*_mapbg, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
// firehydra sword chest
@@ -1797,7 +1797,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
scriptflag[5][0] = 1;
- clipbg2->fillRect(rcDest, clipbg->format.RGBToColor(255, 255, 255));
+ _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
}
}
@@ -1829,7 +1829,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- clipbg2->fillRect(rcDest, clipbg->format.RGBToColor(255, 255, 255));
+ _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
scriptflag[8][0] = 1;
}
}
@@ -1863,7 +1863,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
scriptflag[s][0] = 1;
- clipbg2->fillRect(rcDest, clipbg->format.RGBToColor(255, 255, 255));
+ _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
}
}
}
@@ -1926,7 +1926,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
scriptflag[12][0] = 1;
- clipbg2->fillRect(rcDest, clipbg->format.RGBToColor(255, 255, 255));
+ _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
}
}
@@ -1957,7 +1957,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- clipbg2->fillRect(rcDest, clipbg->format.RGBToColor(255, 255, 255));
+ _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
scriptflag[13][0] = 1;
}
}
@@ -1989,7 +1989,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- clipbg2->fillRect(rcDest, clipbg->format.RGBToColor(255, 255, 255));
+ _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
scriptflag[15][0] = 1;
cx = 9;
@@ -2010,7 +2010,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- clipbg2->fillRect(rcDest, clipbg->format.RGBToColor(255, 255, 255));
+ _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
scriptflag[16][0] = 1;
@@ -2032,7 +2032,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- clipbg2->fillRect(rcDest, clipbg->format.RGBToColor(255, 255, 255));
+ _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
scriptflag[17][0] = 1;
}
}
@@ -3132,7 +3132,7 @@ void GriffonEngine::game_drawplayer() {
}
void GriffonEngine::game_drawview() {
- _videobuffer->copyRectToSurface(mapbg->getPixels(), mapbg->pitch, 0, 0, mapbg->w, mapbg->h);
+ _videobuffer->copyRectToSurface(_mapbg->getPixels(), _mapbg->pitch, 0, 0, _mapbg->w, _mapbg->h);
game_updspellsunder();
@@ -3176,7 +3176,7 @@ void GriffonEngine::game_endofgame() {
if (menabled && config.music) {
Mix_HaltChannel(-1);
- musicchannel = Mix_PlayChannel(mendofgame, true);
+ musicchannel = Mix_PlayChannel(_mendofgame, true);
Mix_Volume(musicchannel, 0);
}
@@ -3511,10 +3511,10 @@ void GriffonEngine::game_handlewalking() {
int sx = nx + x;
int sy = ny + y;
- clipsurround[x + 1][y + 1] = 0;
+ _clipsurround[x + 1][y + 1] = 0;
if (sx > -1 && sx < 320 && sy > -1 && sy < 192) {
- temp = (uint32 *)clipbg->getBasePtr(sx, sy);
- clipsurround[x + 1][y + 1] = *temp;
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ _clipsurround[x + 1][y + 1] = *temp;
}
}
}
@@ -3528,66 +3528,66 @@ void GriffonEngine::game_handlewalking() {
if (movingright)
player.walkdir = 3;
- if (movingup && clipsurround[1][0] == 0) {
+ if (movingup && _clipsurround[1][0] == 0) {
py = py - spd;
player.walkdir = 0;
- } else if (movingup && clipsurround[1][0] > 0) {
+ } else if (movingup && _clipsurround[1][0] > 0) {
// move upleft
- if (movingright == 0 && clipsurround[0][0] == 0) {
+ if (movingright == 0 && _clipsurround[0][0] == 0) {
py = py - spd;
px = px - spd;
}
// move upright
- if (movingleft == 0 && clipsurround[2][0] == 0) {
+ if (movingleft == 0 && _clipsurround[2][0] == 0) {
py = py - spd;
px = px + spd;
}
}
- if (movingdown && clipsurround[1][2] == 0) {
+ if (movingdown && _clipsurround[1][2] == 0) {
py = py + spd;
player.walkdir = 1;
- } else if (movingdown && clipsurround[1][2] > 0) {
+ } else if (movingdown && _clipsurround[1][2] > 0) {
// move downleft
- if (movingright == 0 && clipsurround[0][2] == 0) {
+ if (movingright == 0 && _clipsurround[0][2] == 0) {
py = py + spd;
px = px - spd;
}
// move downright
- if (movingleft == 0 && clipsurround[2][2] == 0) {
+ if (movingleft == 0 && _clipsurround[2][2] == 0) {
py = py + spd;
px = px + spd;
}
}
- if (movingleft && clipsurround[0][1] == 0) {
+ if (movingleft && _clipsurround[0][1] == 0) {
px = px - spd;
player.walkdir = 2;
- } else if (movingleft && clipsurround[0][1] > 0) {
+ } else if (movingleft && _clipsurround[0][1] > 0) {
// move leftup
- if (movingdown == 0 && clipsurround[0][0] == 0) {
+ if (movingdown == 0 && _clipsurround[0][0] == 0) {
py = py - spd;
px = px - spd;
}
// move leftdown
- if (movingup == 0 && clipsurround[0][2] == 0) {
+ if (movingup == 0 && _clipsurround[0][2] == 0) {
py = py + spd;
px = px - spd;
}
}
- if (movingright && clipsurround[2][1] == 0) {
+ if (movingright && _clipsurround[2][1] == 0) {
px = px + spd;
player.walkdir = 3;
- } else if (movingright && clipsurround[2][1] > 0) {
+ } else if (movingright && _clipsurround[2][1] > 0) {
// move rightup
- if (movingdown == 0 && clipsurround[2][0] == 0) {
+ if (movingdown == 0 && _clipsurround[2][0] == 0) {
px = px + spd;
py = py - spd;
}
// move rightdown
- if (movingup == 0 && clipsurround[2][2] == 0) {
+ if (movingup == 0 && _clipsurround[2][2] == 0) {
py = py + spd;
px = px + spd;
}
@@ -3606,7 +3606,7 @@ void GriffonEngine::game_handlewalking() {
int sx = (px / 2 + 6);
int sy = (py / 2 + 10);
- temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
bgc = *temp;
if (bgc > 0 && bgc != 1000) {
px = opx;
@@ -3646,7 +3646,7 @@ void GriffonEngine::game_handlewalking() {
sx = (int)(npx / 2 + 6);
sy = (int)(npy / 2 + 10);
- temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
bgc = *temp;
if (bgc > 0) {
@@ -3742,13 +3742,13 @@ void GriffonEngine::game_loadmap(int mapnum) {
debug(2, "Loaded map %d", mapnum);
- ccc = clipbg->format.RGBToColor(255, 255, 255);
+ ccc = _clipbg->format.RGBToColor(255, 255, 255);
curmap = mapnum;
- mapbg->fillRect(trect, 0);
- clipbg->fillRect(trect, ccc);
- clipbg2->fillRect(trect, ccc);
+ _mapbg->fillRect(trect, 0);
+ _clipbg->fillRect(trect, ccc);
+ _clipbg2->fillRect(trect, ccc);
forcepause = false;
cloudson = 0;
@@ -3888,7 +3888,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
}
}
- tiles[curtilel]->blit(*mapbg, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ tiles[curtilel]->blit(*_mapbg, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
tiles[curtilel]->setAlpha(255, true);
rcDest.left = x * 8;
@@ -3896,7 +3896,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- clipbg->fillRect(rcDest, 0);
+ _clipbg->fillRect(rcDest, 0);
}
}
@@ -3931,37 +3931,37 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (d == 1) {
for (int i = 0; i <= 7; i++) {
- sys_line(clipbg, x1, y1 + i, x1 + 7 - i, y1 + i, ccc);
+ sys_line(_clipbg, x1, y1 + i, x1 + 7 - i, y1 + i, ccc);
}
} else if (d == 2) {
- sys_line(clipbg, x1, y1, x1 + 7, y1, ccc);
- sys_line(clipbg, x1, y1 + 1, x1 + 7, y1 + 1, ccc);
+ sys_line(_clipbg, x1, y1, x1 + 7, y1, ccc);
+ sys_line(_clipbg, x1, y1 + 1, x1 + 7, y1 + 1, ccc);
} else if (d == 3) {
for (int i = 0; i <= 7; i++) {
- sys_line(clipbg, x1 + i, y1 + i, x1 + 7, y1 + i, ccc);
+ sys_line(_clipbg, x1 + i, y1 + i, x1 + 7, y1 + i, ccc);
}
} else if (d == 4) {
- sys_line(clipbg, x1, y1, x1, y1 + 7, ccc);
- sys_line(clipbg, x1 + 1, y1, x1 + 1, y1 + 7, ccc);
+ sys_line(_clipbg, x1, y1, x1, y1 + 7, ccc);
+ sys_line(_clipbg, x1 + 1, y1, x1 + 1, y1 + 7, ccc);
} else if (d == 5) {
rcDest.left = x1;
rcDest.top = y1;
rcDest.setWidth(8);
rcDest.setHeight(8);
- clipbg->fillRect(rcDest, ccc);
+ _clipbg->fillRect(rcDest, ccc);
} else if (d == 6) {
- sys_line(clipbg, x1 + 7, y1, x1 + 7, y1 + 7, ccc);
- sys_line(clipbg, x1 + 6, y1, x1 + 6, y1 + 7, ccc);
+ sys_line(_clipbg, x1 + 7, y1, x1 + 7, y1 + 7, ccc);
+ sys_line(_clipbg, x1 + 6, y1, x1 + 6, y1 + 7, ccc);
} else if (d == 7) {
for (int i = 0; i <= 7; i++) {
- sys_line(clipbg, x1, y1 + i, x1 + i, y1 + i, ccc);
+ sys_line(_clipbg, x1, y1 + i, x1 + i, y1 + i, ccc);
}
} else if (d == 8) {
- sys_line(clipbg, x1, y1 + 7, x1 + 7, y1 + 7, ccc);
- sys_line(clipbg, x1, y1 + 7, x1 + 6, y1 + 6, ccc);
+ sys_line(_clipbg, x1, y1 + 7, x1 + 7, y1 + 7, ccc);
+ sys_line(_clipbg, x1, y1 + 7, x1 + 6, y1 + 6, ccc);
} else if (d == 9) {
for (int i = 0; i <= 7; i++) {
- sys_line(clipbg, x1 + 7 - i, y1 + i, x1 + 7, y1 + i, ccc);
+ sys_line(_clipbg, x1 + 7 - i, y1 + i, x1 + 7, y1 + i, ccc);
}
}
}
@@ -4012,9 +4012,9 @@ void GriffonEngine::game_loadmap(int mapnum) {
rcDest.setHeight(8);
if (objectinfo[o][4] == 1)
- clipbg->fillRect(rcDest, ccc);
+ _clipbg->fillRect(rcDest, ccc);
if (objectinfo[o][4] == 3)
- clipbg->fillRect(rcDest, ccc);
+ _clipbg->fillRect(rcDest, ccc);
}
}
if (npc == 1) {
@@ -4339,7 +4339,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- clipbg->fillRect(rcDest, ccc);
+ _clipbg->fillRect(rcDest, ccc);
}
// academy crystal
@@ -4363,7 +4363,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- clipbg->fillRect(rcDest, ccc);
+ _clipbg->fillRect(rcDest, ccc);
}
// gardens master key
@@ -4387,7 +4387,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- clipbg->fillRect(rcDest, ccc);
+ _clipbg->fillRect(rcDest, ccc);
}
// gardens fidelis sword
@@ -4411,7 +4411,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- clipbg->fillRect(rcDest, ccc);
+ _clipbg->fillRect(rcDest, ccc);
}
// citadel armour
@@ -4435,7 +4435,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- clipbg->fillRect(rcDest, ccc);
+ _clipbg->fillRect(rcDest, ccc);
}
// citadel master key
@@ -4459,7 +4459,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- clipbg->fillRect(rcDest, ccc);
+ _clipbg->fillRect(rcDest, ccc);
}
@@ -4484,7 +4484,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- clipbg->fillRect(rcDest, ccc);
+ _clipbg->fillRect(rcDest, ccc);
}
if (curmap == 83 && scriptflag[16][0] == 1 && player.shield < 3) {
@@ -4507,7 +4507,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- clipbg->fillRect(rcDest, ccc);
+ _clipbg->fillRect(rcDest, ccc);
}
if (curmap == 83 && scriptflag[17][0] == 1 && player.armour < 3) {
@@ -4530,10 +4530,10 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (lx == cx && ly == cy)
player.py = player.py + 16;
- clipbg->fillRect(rcDest, ccc);
+ _clipbg->fillRect(rcDest, ccc);
}
- clipbg2->copyRectToSurface(clipbg->getPixels(), clipbg->pitch, 0, 0, clipbg->w, clipbg->h);
+ _clipbg2->copyRectToSurface(_clipbg->getPixels(), _clipbg->pitch, 0, 0, _clipbg->w, _clipbg->h);
}
void GriffonEngine::game_main() {
@@ -4563,7 +4563,7 @@ void GriffonEngine::game_newgame() {
if (menabled && config.music) {
Mix_HaltChannel(-1);
- musicchannel = Mix_PlayChannel(mendofgame, true);
+ musicchannel = Mix_PlayChannel(_mendofgame, true);
Mix_Volume(musicchannel, 0);
}
@@ -5239,7 +5239,7 @@ void GriffonEngine::game_swash() {
y = y + 1 * fpsr;
_videobuffer->setAlpha((int)(y * 25));
- mapbg->blit(*_videobuffer);
+ _mapbg->blit(*_videobuffer);
if (cloudson == 1) {
rcDest.left = (float)(256 + 256 * cos(3.141592 / 180 * clouddeg));
@@ -5337,7 +5337,7 @@ void GriffonEngine::game_title(int mode) {
Mix_Volume(musicchannel, 0);
Mix_Pause(musicchannel);
- menuchannel = Mix_PlayChannel(mmenu, true);
+ menuchannel = Mix_PlayChannel(_mmenu, true);
Mix_Volume(menuchannel, config.musicvol);
pmenu = 1;
}
@@ -5541,14 +5541,14 @@ void GriffonEngine::game_updmusic() {
if (menabled && config.music) {
// if(curmap > 5 && curmap < 42) iplaysound = macademy;
- // if(curmap > 47) iplaysound = mgardens;
- iplaysound = mgardens;
+ // if(curmap > 47) iplaysound = _mgardens;
+ iplaysound = _mgardens;
if (roomlock == 1)
- iplaysound = mboss;
+ iplaysound = _mboss;
- if (iplaysound == mboss && pboss)
+ if (iplaysound == _mboss && pboss)
iplaysound = NULL;
- if (iplaysound == mgardens && pgardens)
+ if (iplaysound == _mgardens && pgardens)
iplaysound = NULL;
if (iplaysound != NULL) {
@@ -5560,9 +5560,9 @@ void GriffonEngine::game_updmusic() {
pacademy = 0;
pcitadel = 0;
- if (iplaysound == mboss)
+ if (iplaysound == _mboss)
pboss = 1;
- if (iplaysound == mgardens)
+ if (iplaysound == _mgardens)
pgardens = 1;
musicchannel = Mix_PlayChannel(iplaysound, true);
@@ -5576,13 +5576,13 @@ void GriffonEngine::game_updmusic() {
if (pgardens == 1) {
Mix_HaltChannel(musicchannel);
if (pgardens == 1 && loopseta == 0)
- musicchannel = Mix_PlayChannel(mgardens);
+ musicchannel = Mix_PlayChannel(_mgardens);
if (pgardens == 1 && loopseta == 1)
- musicchannel = Mix_PlayChannel(mgardens2);
+ musicchannel = Mix_PlayChannel(_mgardens2);
if (pgardens == 1 && loopseta == 2)
- musicchannel = Mix_PlayChannel(mgardens3);
+ musicchannel = Mix_PlayChannel(_mgardens3);
if (pgardens == 1 && loopseta == 3)
- musicchannel = Mix_PlayChannel(mgardens4);
+ musicchannel = Mix_PlayChannel(_mgardens4);
}
Mix_Volume(musicchannel, config.musicvol);
@@ -5771,7 +5771,7 @@ void GriffonEngine::game_updnpcs() {
if (moveup) {
int sx = xp;
int sy = yp - ii;
- uint32 *temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
uint32 dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
@@ -5781,7 +5781,7 @@ void GriffonEngine::game_updnpcs() {
if (dq > 0) {
sx = xp - ii;
sy = yp - ii;
- temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
@@ -5793,7 +5793,7 @@ void GriffonEngine::game_updnpcs() {
if (dq > 0) {
sx = xp + ii;
sy = yp - ii;
- temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
@@ -5807,7 +5807,7 @@ void GriffonEngine::game_updnpcs() {
if (movedown) {
int sx = xp;
int sy = yp + ii;
- uint32 *temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
uint32 dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
@@ -5816,7 +5816,7 @@ void GriffonEngine::game_updnpcs() {
if (dq > 0) {
sx = xp - ii;
sy = yp + ii;
- temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
@@ -5828,7 +5828,7 @@ void GriffonEngine::game_updnpcs() {
if (dq > 0) {
sx = xp + ii;
sy = yp + ii;
- temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
@@ -5842,7 +5842,7 @@ void GriffonEngine::game_updnpcs() {
if (moveleft) {
int sx = xp - ii;
int sy = yp;
- uint32 *temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
uint32 dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
@@ -5851,7 +5851,7 @@ void GriffonEngine::game_updnpcs() {
if (dq > 0) {
sx = xp - ii;
sy = yp - ii;
- temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
@@ -5863,7 +5863,7 @@ void GriffonEngine::game_updnpcs() {
if (dq > 0) {
sx = xp - ii;
sy = yp + ii;
- temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
@@ -5877,7 +5877,7 @@ void GriffonEngine::game_updnpcs() {
if (moveright) {
int sx = xp + ii;
int sy = yp;
- uint32 *temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
uint32 dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
@@ -5886,7 +5886,7 @@ void GriffonEngine::game_updnpcs() {
if (dq > 0) {
sx = xp + ii;
sy = yp - ii;
- temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
@@ -5898,7 +5898,7 @@ void GriffonEngine::game_updnpcs() {
if (dq > 0) {
sx = xp + ii;
sy = yp + ii;
- temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
if (npcinfo[i].spriteset == 11)
dq = 0;
@@ -5939,7 +5939,7 @@ void GriffonEngine::game_updnpcs() {
int sx = xp;
int sy = yp;
- uint32 *temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
uint32 bgc = *temp;
float anpx = npx + 12;
@@ -6441,7 +6441,7 @@ void GriffonEngine::game_updnpcs() {
rcSrc.setHeight(3);
if (npcinfo[i].pause < ticks)
- clipbg->fillRect(rcSrc, i);
+ _clipbg->fillRect(rcSrc, i);
pass = 0;
@@ -6821,7 +6821,7 @@ void GriffonEngine::game_updspells() {
rcSrc.setWidth(8);
rcSrc.setHeight(8);
- clipbg2->fillRect(rcSrc, 0);
+ _clipbg2->fillRect(rcSrc, 0);
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
@@ -6943,7 +6943,7 @@ void GriffonEngine::game_updspells() {
rcSrc.setWidth(8);
rcSrc.setHeight(8);
- clipbg2->fillRect(rcSrc, 0);
+ _clipbg2->fillRect(rcSrc, 0);
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
@@ -7023,7 +7023,7 @@ void GriffonEngine::game_updspells() {
rcSrc.setWidth(8);
rcSrc.setHeight(8);
- clipbg2->fillRect(rcSrc, 0);
+ _clipbg2->fillRect(rcSrc, 0);
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
@@ -7300,7 +7300,7 @@ void GriffonEngine::game_updspells() {
rcSrc.setWidth(8);
rcSrc.setHeight(8);
- clipbg2->fillRect(rcSrc, 0);
+ _clipbg2->fillRect(rcSrc, 0);
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
}
@@ -7358,7 +7358,7 @@ void GriffonEngine::game_updspells() {
rcSrc.setWidth(8);
rcSrc.setHeight(8);
- clipbg2->fillRect(rcSrc, 0);
+ _clipbg2->fillRect(rcSrc, 0);
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
}
@@ -7415,7 +7415,7 @@ void GriffonEngine::game_updspells() {
rcSrc.setWidth(8);
rcSrc.setHeight(8);
- clipbg2->fillRect(rcSrc, 0);
+ _clipbg2->fillRect(rcSrc, 0);
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
}
@@ -7472,7 +7472,7 @@ void GriffonEngine::game_updspells() {
rcSrc.setWidth(8);
rcSrc.setHeight(8);
- clipbg2->fillRect(rcSrc, 0);
+ _clipbg2->fillRect(rcSrc, 0);
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
}
@@ -7612,7 +7612,7 @@ void GriffonEngine::game_updspellsunder() {
int sx = (newx / 2 + 6);
int sy = (newy / 2 + 10);
- unsigned int *temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ unsigned int *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
unsigned int dq = *temp;
if (dq == 0) {
@@ -7625,7 +7625,7 @@ void GriffonEngine::game_updspellsunder() {
sx = (newx / 2 + 6);
sy = (npcinfo[f].y / 2 + 10);
- temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
if (dq == 0)
@@ -7634,7 +7634,7 @@ void GriffonEngine::game_updspellsunder() {
sx = (npcinfo[f].x / 2 + 6);
sy = (newy / 2 + 10);
- temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
if (dq == 0)
@@ -7694,7 +7694,7 @@ void GriffonEngine::game_updspellsunder() {
int sx = (xloc / 2 + 4);
int sy = (yloc / 2 + 8);
- unsigned int *temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ unsigned int *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
unsigned int dq = *temp;
if (dq > 1000 && x > 4)
@@ -7756,7 +7756,7 @@ void GriffonEngine::game_updspellsunder() {
rcSrc.setWidth(8);
rcSrc.setHeight(8);
- clipbg2->fillRect(rcSrc, 0);
+ _clipbg2->fillRect(rcSrc, 0);
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndfire]);
@@ -7869,12 +7869,12 @@ void GriffonEngine::sys_initialize() {
_videobuffer2->create(320, 240, g_system->getScreenFormat());
_videobuffer3 = new Graphics::TransparentSurface;
_videobuffer3->create(320, 240, g_system->getScreenFormat());
- mapbg = new Graphics::TransparentSurface;
- mapbg->create(320, 240, g_system->getScreenFormat());
- clipbg = new Graphics::TransparentSurface;
- clipbg->create(320, 240, g_system->getScreenFormat());
- clipbg2 = new Graphics::TransparentSurface;
- clipbg2->create(320, 240, g_system->getScreenFormat());
+ _mapbg = new Graphics::TransparentSurface;
+ _mapbg->create(320, 240, g_system->getScreenFormat());
+ _clipbg = new Graphics::TransparentSurface;
+ _clipbg->create(320, 240, g_system->getScreenFormat());
+ _clipbg2 = new Graphics::TransparentSurface;
+ _clipbg2->create(320, 240, g_system->getScreenFormat());
for (int i = 0; i <= 3; i++) {
char name[128];
@@ -8204,19 +8204,19 @@ void GriffonEngine::sys_setupAudio() {
rcDest.setHeight(8);
if (menabled) {
- mboss = Mix_LoadWAV("music/boss.ogg");
+ _mboss = Mix_LoadWAV("music/boss.ogg");
sys_progress(1, 21);
- mgardens = Mix_LoadWAV("music/gardens.ogg");
+ _mgardens = Mix_LoadWAV("music/gardens.ogg");
sys_progress(2, 21);
- mgardens2 = Mix_LoadWAV("music/gardens2.ogg");
+ _mgardens2 = Mix_LoadWAV("music/gardens2.ogg");
sys_progress(3, 21);
- mgardens3 = Mix_LoadWAV("music/gardens3.ogg");
+ _mgardens3 = Mix_LoadWAV("music/gardens3.ogg");
sys_progress(4, 21);
- mgardens4 = Mix_LoadWAV("music/gardens4.ogg");
+ _mgardens4 = Mix_LoadWAV("music/gardens4.ogg");
sys_progress(5, 21);
- mendofgame = Mix_LoadWAV("music/endofgame.ogg");
+ _mendofgame = Mix_LoadWAV("music/endofgame.ogg");
sys_progress(6, 21);
- mmenu = Mix_LoadWAV("music/menu.ogg");
+ _mmenu = Mix_LoadWAV("music/menu.ogg");
sys_progress(7, 21);
sfx[0] = Mix_LoadWAV("sfx/bite.ogg");
@@ -8291,7 +8291,7 @@ void GriffonEngine::sys_update() {
int sx = (int)(player.px / 2 + 6);
int sy = (int)(player.py / 2 + 10);
- uint32 *temp = (uint32 *)clipbg->getBasePtr(sx, sy);
+ uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
uint32 bgc = *temp;
if (bgc > 0) {
player.px = opx;
@@ -8346,7 +8346,7 @@ void GriffonEngine::sys_update() {
}
}
- clipbg->copyRectToSurface(clipbg2->getPixels(), clipbg2->pitch, 0, 0, clipbg2->w, clipbg2->h);
+ _clipbg->copyRectToSurface(_clipbg2->getPixels(), _clipbg2->pitch, 0, 0, _clipbg2->w, _clipbg2->h);
Common::Rect rc;
@@ -8355,7 +8355,7 @@ void GriffonEngine::sys_update() {
rc.setWidth(5);
rc.setHeight(5);
- clipbg->fillRect(rc, 1000);
+ _clipbg->fillRect(rc, 1000);
if (!forcepause) {
for (int i = 0; i < 5; i++) {
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 35f9450..fff83cf 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -324,8 +324,8 @@ private:
Graphics::TransparentSurface *_logosimg, *_theendimg;
Common::Event event;
- Graphics::TransparentSurface *mapbg, *clipbg, *clipbg2;
- unsigned int clipsurround[4][4];
+ Graphics::TransparentSurface *_mapbg, *_clipbg, *_clipbg2;
+ unsigned int _clipsurround[4][4];
int fullscreen;
float animspd; // CHECKME: it seems to always be 0.5
@@ -421,7 +421,7 @@ private:
int lastnpc;
// music info
- DataChunk *mgardens, *mgardens2, *mgardens3, *mgardens4, *mboss, *mmenu, *mendofgame;
+ DataChunk *_mgardens, *_mgardens2, *_mgardens3, *_mgardens4, *_mboss, *_mmenu, *_mendofgame;
bool menabled; // CHECKME: Always true?
int musicchannel, menuchannel;
int pgardens, pboss, ptown, pacademy, pcitadel;
Commit: 6ebcdaeed4dcda6dcdbebf539eaea68c17667ac8
https://github.com/scummvm/scummvm/commit/6ebcdaeed4dcda6dcdbebf539eaea68c17667ac8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Rename more class variables
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.h
engines/griffon/saveload.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 0df92bd..035f81e 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -389,20 +389,20 @@ void GriffonEngine::game_addFloatText(const char *stri, float xloc, float yloc,
}
void GriffonEngine::game_attack() {
- float npx = player.px + 12;
- float npy = player.py + 20;
+ float npx = _player.px + 12;
+ float npy = _player.py + 20;
int lx = (int)npx / 16;
int ly = (int)npy / 16;
// if facing up
- if (player.walkdir == 0) {
+ if (_player.walkdir == 0) {
if (ly > 0) {
int o2 = 0; // ??
int o = objmap[lx][ly - 1];
- if (ly > 1 && curmap == 58)
+ if (ly > 1 && _curmap == 58)
o2 = objmap[lx][ly - 2];
- if (ly > 1 && curmap == 54)
+ if (ly > 1 && _curmap == 54)
o2 = objmap[lx][ly - 2];
// cst
@@ -411,11 +411,11 @@ void GriffonEngine::game_attack() {
o = 10;
int oscript = objectinfo[o][5];
- if (oscript == 0 && player.inventory[INV_FLASK] < 9) {
- player.inventory[INV_FLASK]++;
+ if (oscript == 0 && _player.inventory[INV_FLASK] < 9) {
+ _player.inventory[INV_FLASK]++;
game_addFloatIcon(6, lx * 16, (ly - 1) * 16);
- objmapf[curmap][lx][ly - 1] = 1;
+ objmapf[_curmap][lx][ly - 1] = 1;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
@@ -430,7 +430,7 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 0 && player.inventory[INV_FLASK] == 9) {
+ if (oscript == 0 && _player.inventory[INV_FLASK] == 9) {
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndchest]);
Mix_Volume(snd, config.effectsvol);
@@ -442,17 +442,17 @@ void GriffonEngine::game_attack() {
}
if (oscript == 2) {
- player.inventory[INV_MASTERKEY]++;
+ _player.inventory[INV_MASTERKEY]++;
game_addFloatIcon(14, lx * 16, (ly - 1) * 16);
itemticks = ticks + 215;
- if (curmap == 34)
+ if (_curmap == 34)
scriptflag[2][0] = 2;
- if (curmap == 62)
+ if (_curmap == 62)
scriptflag[8][0] = 2;
- if (curmap == 81)
+ if (_curmap == 81)
scriptflag[13][0] = 2;
if (menabled && config.effects) {
@@ -467,8 +467,8 @@ void GriffonEngine::game_attack() {
}
if (oscript == 3) {
- player.foundspell[0] = 1;
- player.spellcharge[0] = 0;
+ _player.foundspell[0] = 1;
+ _player.spellcharge[0] = 0;
game_addFloatIcon(7, lx * 16, (ly - 1) * 16);
@@ -485,8 +485,8 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 4 && player.shield == 1) {
- player.shield = 2;
+ if (oscript == 4 && _player.shield == 1) {
+ _player.shield = 2;
game_addFloatIcon(4, lx * 16, (ly - 1) * 16);
@@ -505,8 +505,8 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 5 && player.sword == 1) {
- player.sword = 2;
+ if (oscript == 5 && _player.sword == 1) {
+ _player.sword = 2;
game_addFloatIcon(3, lx * 16, (ly - 1) * 16);
@@ -524,8 +524,8 @@ void GriffonEngine::game_attack() {
}
if (oscript == 6) {
- if (player.inventory[INV_NORMALKEY] < 9) {
- player.inventory[INV_NORMALKEY]++;
+ if (_player.inventory[INV_NORMALKEY] < 9) {
+ _player.inventory[INV_NORMALKEY]++;
for (int s = 20; s <= 23; s++) {
if (scriptflag[s][0] == 1) {
@@ -538,7 +538,7 @@ void GriffonEngine::game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- objmapf[curmap][lx][ly - 1] = 1;
+ objmapf[_curmap][lx][ly - 1] = 1;
if (objectinfo[o][4] == 1)
objmap[lx][ly - 1] = 3;
@@ -555,11 +555,11 @@ void GriffonEngine::game_attack() {
}
}
- if (oscript == 7 && player.inventory[INV_DOUBLEFLASK] < 9) {
- player.inventory[INV_DOUBLEFLASK]++;
+ if (oscript == 7 && _player.inventory[INV_DOUBLEFLASK] < 9) {
+ _player.inventory[INV_DOUBLEFLASK]++;
game_addFloatIcon(12, lx * 16, (ly - 1) * 16);
- objmapf[curmap][lx][ly - 1] = 1;
+ objmapf[_curmap][lx][ly - 1] = 1;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
@@ -574,7 +574,7 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 7 && player.inventory[INV_DOUBLEFLASK] == 9) {
+ if (oscript == 7 && _player.inventory[INV_DOUBLEFLASK] == 9) {
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndchest]);
Mix_Volume(snd, config.effectsvol);
@@ -585,11 +585,11 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 10 && player.inventory[INV_DOUBLEFLASK] < 9) {
- player.inventory[INV_DOUBLEFLASK]++;
+ if (oscript == 10 && _player.inventory[INV_DOUBLEFLASK] < 9) {
+ _player.inventory[INV_DOUBLEFLASK]++;
game_addFloatIcon(12, lx * 16, (ly - 1) * 16);
- objmapf[curmap][lx][ly - 1] = 1;
+ objmapf[_curmap][lx][ly - 1] = 1;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
@@ -604,7 +604,7 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 10 && player.inventory[INV_DOUBLEFLASK] == 9) {
+ if (oscript == 10 && _player.inventory[INV_DOUBLEFLASK] == 9) {
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndchest]);
Mix_Volume(snd, config.effectsvol);
@@ -615,11 +615,11 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 11 && player.inventory[INV_SHOCK] < 9) {
- player.inventory[INV_SHOCK]++;
+ if (oscript == 11 && _player.inventory[INV_SHOCK] < 9) {
+ _player.inventory[INV_SHOCK]++;
game_addFloatIcon(17, lx * 16, (ly - 1) * 16);
- objmapf[curmap][lx][ly - 1] = 1;
+ objmapf[_curmap][lx][ly - 1] = 1;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
@@ -634,7 +634,7 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 11 && player.inventory[INV_SHOCK] == 9) {
+ if (oscript == 11 && _player.inventory[INV_SHOCK] == 9) {
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndchest]);
Mix_Volume(snd, config.effectsvol);
@@ -645,8 +645,8 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 12 && player.armour == 1) {
- player.armour = 2;
+ if (oscript == 12 && _player.armour == 1) {
+ _player.armour = 2;
game_addFloatIcon(5, lx * 16, (ly - 1) * 16);
@@ -664,7 +664,7 @@ void GriffonEngine::game_attack() {
}
if (oscript == 60) {
- if (curmap == 58 && scriptflag[60][0] == 0) {
+ if (_curmap == 58 && scriptflag[60][0] == 0) {
scriptflag[60][0] = 1;
if (menabled && config.effects) {
@@ -672,7 +672,7 @@ void GriffonEngine::game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- } else if (curmap == 58 && scriptflag[60][0] > 0) {
+ } else if (_curmap == 58 && scriptflag[60][0] > 0) {
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[snddoor]);
Mix_Volume(snd, config.effectsvol);
@@ -681,14 +681,14 @@ void GriffonEngine::game_attack() {
game_eventtext("It's stuck!");
}
- if (curmap == 54 && scriptflag[60][0] == 1) {
+ if (_curmap == 54 && scriptflag[60][0] == 1) {
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndlever]);
Mix_Volume(snd, config.effectsvol);
}
scriptflag[60][0] = 2;
- } else if (curmap == 54 && scriptflag[60][0] > 1) {
+ } else if (_curmap == 54 && scriptflag[60][0] > 1) {
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[snddoor]);
Mix_Volume(snd, config.effectsvol);
@@ -699,8 +699,8 @@ void GriffonEngine::game_attack() {
}
- if (oscript == 15 && player.sword < 3) {
- player.sword = 3;
+ if (oscript == 15 && _player.sword < 3) {
+ _player.sword = 3;
game_addFloatIcon(18, lx * 16, (ly - 1) * 16);
@@ -718,8 +718,8 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 16 && player.shield < 3) {
- player.shield = 3;
+ if (oscript == 16 && _player.shield < 3) {
+ _player.shield = 3;
game_addFloatIcon(19, lx * 16, (ly - 1) * 16);
itemticks = ticks + 215;
@@ -735,8 +735,8 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 17 && player.armour < 3) {
- player.armour = 3;
+ if (oscript == 17 && _player.armour < 3) {
+ _player.armour = 3;
game_addFloatIcon(20, lx * 16, (ly - 1) * 16);
itemticks = ticks + 215;
@@ -757,7 +757,7 @@ void GriffonEngine::game_attack() {
}
attacking = true;
- player.attackframe = 0;
+ _player.attackframe = 0;
movingup = 0;
movingdown = 0;
movingleft = 0;
@@ -765,7 +765,7 @@ void GriffonEngine::game_attack() {
for (int i = 0; i <= 15; i++) {
for (int a = 0; a <= 3; a++) {
- playerattackofs[a][i][2] = 0;
+ _playerattackofs[a][i][2] = 0;
}
}
}
@@ -792,8 +792,8 @@ void GriffonEngine::game_castspell(int spellnum, float homex, float homey, float
spellinfo[i].frame = 32.0f;
if (damagewho == 0) {
- spellinfo[i].strength = player.spellstrength / 100;
- if (ABS(player.spellstrength - 100) < kEpsilon)
+ spellinfo[i].strength = _player.spellstrength / 100;
+ if (ABS(_player.spellstrength - 100) < kEpsilon)
spellinfo[i].strength = 1.5f;
}
@@ -861,31 +861,31 @@ void GriffonEngine::game_checkhit() {
float npx = npcinfo[i].x;
float npy = npcinfo[i].y;
- float xdif = player.px - npx;
- float ydif = player.py - npy;
+ float xdif = _player.px - npx;
+ float ydif = _player.py - npy;
- float ps = player.sword;
+ float ps = _player.sword;
if (ps > 1)
ps = ps * 0.75;
- float damage = (float)player.sworddamage * (1.0 + RND() * 1.0) * player.attackstrength / 100.0 * ps;
+ float damage = (float)_player.sworddamage * (1.0 + RND() * 1.0) * _player.attackstrength / 100.0 * ps;
if (_console->_godMode)
damage = 1000;
- if (ABS(player.attackstrength - 100) < kEpsilon)
+ if (ABS(_player.attackstrength - 100) < kEpsilon)
damage *= 1.5;
bool hit = false;
- if (player.walkdir == 0) {
+ if (_player.walkdir == 0) {
if (abs(xdif) <= 8 && ydif >= 0 && ydif < 8)
hit = true;
- } else if (player.walkdir == 1) {
+ } else if (_player.walkdir == 1) {
if (abs(xdif) <= 8 && ydif <= 0 && ydif > -8)
hit = true;
- } else if (player.walkdir == 2) {
+ } else if (_player.walkdir == 2) {
if (abs(ydif) <= 8 && xdif >= -8 && xdif < 8)
hit = true;
- } else if (player.walkdir == 3) {
+ } else if (_player.walkdir == 3) {
if (abs(ydif) <= 8 && xdif <= 8 && xdif > -8)
hit = true;
}
@@ -906,7 +906,7 @@ void GriffonEngine::game_checkhit() {
void GriffonEngine::game_checkinputs() {
int ntickdelay = 175;
- g_system->getEventManager()->pollEvent(event);
+ g_system->getEventManager()->pollEvent(_event);
nposts = 0;
@@ -929,39 +929,39 @@ void GriffonEngine::game_checkinputs() {
if (attacking || (forcepause && itemselon == 0))
return;
- if (event.type == Common::EVENT_QUIT) {
+ if (_event.type == Common::EVENT_QUIT) {
_shouldQuit = true;
return;
}
- if (event.type == Common::EVENT_KEYDOWN) {
- if (event.kbd.keycode == Common::KEYCODE_ESCAPE) {
+ if (_event.type == Common::EVENT_KEYDOWN) {
+ if (_event.kbd.keycode == Common::KEYCODE_ESCAPE) {
if (itemticks < ticks)
game_title(1);
- } else if (event.kbd.keycode == Common::KEYCODE_d && event.kbd.hasFlags(Common::KBD_CTRL)) {
+ } else if (_event.kbd.keycode == Common::KEYCODE_d && _event.kbd.hasFlags(Common::KBD_CTRL)) {
_console->attach();
- event.type = Common::EVENT_INVALID;
- } else if (event.kbd.hasFlags(Common::KBD_CTRL)) {
+ _event.type = Common::EVENT_INVALID;
+ } else if (_event.kbd.hasFlags(Common::KBD_CTRL)) {
if (itemselon == 0 && itemticks < ticks)
game_attack();
if (itemselon == 1 && itemticks < ticks) {
- if (curitem == 0 && player.inventory[INV_FLASK] > 0) {
+ if (curitem == 0 && _player.inventory[INV_FLASK] > 0) {
itemticks = ticks + ntickdelay;
int heal = 50;
- int maxh = player.maxhp - player.hp;
+ int maxh = _player.maxhp - _player.hp;
if (heal > maxh)
heal = maxh;
- player.hp = player.hp + heal;
+ _player.hp = _player.hp + heal;
char text[256];
sprintf(text, "+%i", heal);
- game_addFloatText(text, player.px + 16 - 4 * strlen(text), player.py + 16, 5);
+ game_addFloatText(text, _player.px + 16 - 4 * strlen(text), _player.py + 16, 5);
- player.inventory[INV_FLASK]--;
+ _player.inventory[INV_FLASK]--;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
@@ -972,22 +972,22 @@ void GriffonEngine::game_checkinputs() {
forcepause = false;
}
- if (curitem == 1 && player.inventory[INV_DOUBLEFLASK] > 0) {
+ if (curitem == 1 && _player.inventory[INV_DOUBLEFLASK] > 0) {
itemticks = ticks + ntickdelay;
int heal = 200;
- int maxh = player.maxhp - player.hp;
+ int maxh = _player.maxhp - _player.hp;
if (heal > maxh)
heal = maxh;
- player.hp = player.hp + heal;
+ _player.hp = _player.hp + heal;
char text[256];
sprintf(text, "+%i", heal);
- game_addFloatText(text, player.px + 16 - 4 * strlen(text), player.py + 16, 5);
+ game_addFloatText(text, _player.px + 16 - 4 * strlen(text), _player.py + 16, 5);
- player.inventory[INV_DOUBLEFLASK]--;
+ _player.inventory[INV_DOUBLEFLASK]--;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
@@ -998,12 +998,12 @@ void GriffonEngine::game_checkinputs() {
forcepause = false;
}
- if (curitem == 2 && player.inventory[INV_SHOCK] > 0) {
- game_castspell(8, player.px, player.py, npcinfo[curenemy].x, npcinfo[curenemy].y, 0);
+ if (curitem == 2 && _player.inventory[INV_SHOCK] > 0) {
+ game_castspell(8, _player.px, _player.py, npcinfo[curenemy].x, npcinfo[curenemy].y, 0);
forcepause = true;
- player.inventory[INV_SHOCK]--;
+ _player.inventory[INV_SHOCK]--;
itemticks = ticks + ntickdelay;
selenemyon = 0;
@@ -1011,11 +1011,11 @@ void GriffonEngine::game_checkinputs() {
}
- if (curitem == 3 && player.inventory[INV_NORMALKEY] > 0 && canusekey == 1 && locktype == 1) {
+ if (curitem == 3 && _player.inventory[INV_NORMALKEY] > 0 && canusekey == 1 && locktype == 1) {
roomlocks[roomtounlock] = 0;
game_eventtext("UnLocked!");
- player.inventory[INV_NORMALKEY]--;
+ _player.inventory[INV_NORMALKEY]--;
itemticks = ticks + ntickdelay;
selenemyon = 0;
@@ -1023,11 +1023,11 @@ void GriffonEngine::game_checkinputs() {
return;
}
- if (curitem == 4 && player.inventory[INV_MASTERKEY] > 0 && canusekey == 1 && locktype == 2) {
+ if (curitem == 4 && _player.inventory[INV_MASTERKEY] > 0 && canusekey == 1 && locktype == 2) {
roomlocks[roomtounlock] = 0;
game_eventtext("UnLocked!");
- player.inventory[INV_MASTERKEY]--;
+ _player.inventory[INV_MASTERKEY]--;
itemticks = ticks + ntickdelay;
selenemyon = 0;
@@ -1035,10 +1035,10 @@ void GriffonEngine::game_checkinputs() {
return;
}
- if (curitem == 5 && player.spellcharge[0] == 100) {
- game_castspell(5, player.px, player.py, npcinfo[curenemy].x, npcinfo[curenemy].y, 0);
+ if (curitem == 5 && _player.spellcharge[0] == 100) {
+ game_castspell(5, _player.px, _player.py, npcinfo[curenemy].x, npcinfo[curenemy].y, 0);
- player.spellcharge[0] = 0;
+ _player.spellcharge[0] = 0;
forcepause = true;
@@ -1049,15 +1049,15 @@ void GriffonEngine::game_checkinputs() {
if (curitem > 5 && selenemyon == 1) {
if (curenemy <= lastnpc) {
- game_castspell(curitem - 6, player.px, player.py, npcinfo[curenemy].x, npcinfo[curenemy].y, 0);
+ game_castspell(curitem - 6, _player.px, _player.py, npcinfo[curenemy].x, npcinfo[curenemy].y, 0);
} else {
int pst = curenemy - lastnpc - 1;
- game_castspell(curitem - 6, player.px, player.py, postinfo[pst][0], postinfo[pst][1], 0);
+ game_castspell(curitem - 6, _player.px, _player.py, postinfo[pst][0], postinfo[pst][1], 0);
}
- player.spellcharge[curitem - 5] = 0;
+ _player.spellcharge[curitem - 5] = 0;
- player.spellstrength = 0;
+ _player.spellstrength = 0;
itemticks = ticks + ntickdelay;
selenemyon = 0;
@@ -1066,7 +1066,7 @@ void GriffonEngine::game_checkinputs() {
}
if (curitem > 5 && selenemyon == 0 && itemselon == 1) {
- if (ABS(player.spellcharge[curitem - 5] - 100) < kEpsilon) {
+ if (ABS(_player.spellcharge[curitem - 5] - 100) < kEpsilon) {
itemticks = ticks + ntickdelay;
selenemyon = 1;
@@ -1093,7 +1093,7 @@ __exit_do:
}
}
- } else if (event.kbd.hasFlags(Common::KBD_ALT)) {
+ } else if (_event.kbd.hasFlags(Common::KBD_ALT)) {
if (itemticks < ticks) {
selenemyon = 0;
if (itemselon == 1) {
@@ -1104,7 +1104,7 @@ __exit_do:
itemselon = 1;
itemticks = ticks + 220;
forcepause = true;
- player.itemselshade = 0;
+ _player.itemselshade = 0;
}
}
}
@@ -1115,13 +1115,13 @@ __exit_do:
movingdown = 0;
movingleft = 0;
movingright = 0;
- if (event.kbd.keycode == Common::KEYCODE_UP)
+ if (_event.kbd.keycode == Common::KEYCODE_UP)
movingup = 1;
- if (event.kbd.keycode == Common::KEYCODE_DOWN)
+ if (_event.kbd.keycode == Common::KEYCODE_DOWN)
movingdown = 1;
- if (event.kbd.keycode == Common::KEYCODE_LEFT)
+ if (_event.kbd.keycode == Common::KEYCODE_LEFT)
movingleft = 1;
- if (event.kbd.keycode == Common::KEYCODE_RIGHT)
+ if (_event.kbd.keycode == Common::KEYCODE_RIGHT)
movingright = 1;
} else {
movingup = 0;
@@ -1131,7 +1131,7 @@ __exit_do:
if (selenemyon == 1) {
if (itemticks < ticks) {
- if (event.kbd.keycode == Common::KEYCODE_LEFT) {
+ if (_event.kbd.keycode == Common::KEYCODE_LEFT) {
int origin = curenemy;
do {
curenemy = curenemy - 1;
@@ -1146,7 +1146,7 @@ __exit_do:
} while (1);
itemticks = ticks + ntickdelay;
}
- if (event.kbd.keycode == Common::KEYCODE_RIGHT) {
+ if (_event.kbd.keycode == Common::KEYCODE_RIGHT) {
int origin = curenemy;
do {
curenemy = curenemy + 1;
@@ -1170,7 +1170,7 @@ __exit_do:
}
} else {
if (itemticks < ticks) {
- if (event.kbd.keycode == Common::KEYCODE_UP) {
+ if (_event.kbd.keycode == Common::KEYCODE_UP) {
curitem = curitem - 1;
itemticks = ticks + ntickdelay;
if (curitem == 4)
@@ -1178,7 +1178,7 @@ __exit_do:
if (curitem == -1)
curitem = 4;
}
- if (event.kbd.keycode == Common::KEYCODE_DOWN) {
+ if (_event.kbd.keycode == Common::KEYCODE_DOWN) {
curitem = curitem + 1;
itemticks = ticks + ntickdelay;
if (curitem == 5)
@@ -1186,11 +1186,11 @@ __exit_do:
if (curitem == 10)
curitem = 5;
}
- if (event.kbd.keycode == Common::KEYCODE_LEFT) {
+ if (_event.kbd.keycode == Common::KEYCODE_LEFT) {
curitem = curitem - 5;
itemticks = ticks + ntickdelay;
}
- if (event.kbd.keycode == Common::KEYCODE_RIGHT) {
+ if (_event.kbd.keycode == Common::KEYCODE_RIGHT) {
curitem = curitem + 5;
itemticks = ticks + ntickdelay;
}
@@ -1205,8 +1205,8 @@ __exit_do:
}
void GriffonEngine::game_checktrigger() {
- int npx = player.px + 12;
- int npy = player.py + 20;
+ int npx = _player.px + 12;
+ int npy = _player.py + 20;
int lx = (int)npx / 16;
int ly = (int)npy / 16;
@@ -1361,7 +1361,7 @@ void GriffonEngine::game_configmenu() {
rc.left = 148 + 3 * cos(3.14159 * 2 * itemyloc / 16.0);
rc.top = sy + 8 * curselt - 4;
- itemimg[15]->blit(*_videobuffer, rc.left, rc.top);
+ _itemimg[15]->blit(*_videobuffer, rc.left, rc.top);
float yy = 255.0;
if (ticks < ticks1 + 1000) {
@@ -1376,7 +1376,7 @@ void GriffonEngine::game_configmenu() {
g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
- g_system->getEventManager()->pollEvent(event);
+ g_system->getEventManager()->pollEvent(_event);
tickspassed = ticks;
ticks = g_system->getMillis();
@@ -1396,18 +1396,18 @@ void GriffonEngine::game_configmenu() {
itemyloc -= 16;
if (keypause < ticks) {
- g_system->getEventManager()->pollEvent(event);
+ g_system->getEventManager()->pollEvent(_event);
- if (event.type == Common::EVENT_QUIT)
+ if (_event.type == Common::EVENT_QUIT)
_shouldQuit = true;
- if (event.type == Common::EVENT_KEYDOWN) {
+ if (_event.type == Common::EVENT_KEYDOWN) {
keypause = ticks + tickwait;
- if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
+ if (_event.kbd.keycode == Common::KEYCODE_ESCAPE)
break;
- if (event.kbd.keycode == Common::KEYCODE_LEFT) {
+ if (_event.kbd.keycode == Common::KEYCODE_LEFT) {
if (cursel == 11) {
config.musicvol = config.musicvol - 25;
if (config.musicvol < 0)
@@ -1430,7 +1430,7 @@ void GriffonEngine::game_configmenu() {
}
}
}
- if (event.kbd.keycode == Common::KEYCODE_RIGHT) {
+ if (_event.kbd.keycode == Common::KEYCODE_RIGHT) {
if (cursel == 11) {
config.musicvol = config.musicvol + 25;
if (config.musicvol > 255)
@@ -1454,18 +1454,18 @@ void GriffonEngine::game_configmenu() {
}
}
- if (event.kbd.keycode == Common::KEYCODE_UP) {
+ if (_event.kbd.keycode == Common::KEYCODE_UP) {
cursel--;
if (cursel < MINCURSEL)
cursel = 14;
}
- if (event.kbd.keycode == Common::KEYCODE_DOWN) {
+ if (_event.kbd.keycode == Common::KEYCODE_DOWN) {
cursel++;
if (cursel > 14)
cursel = MINCURSEL;
}
- if (event.kbd.keycode == Common::KEYCODE_RETURN) {
+ if (_event.kbd.keycode == Common::KEYCODE_RETURN) {
#if 0
if (cursel == 0) {
fullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
@@ -1625,20 +1625,20 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
npcinfo[npcnum].pause = ticks + 900;
if (spell == 0)
- player.attackstrength = ratio;
+ _player.attackstrength = ratio;
}
game_addFloatText(line, npcinfo[npcnum].x + 12 - 4 * strlen(line), npcinfo[npcnum].y + 16, fcol);
if (npcinfo[npcnum].spriteset == 12)
- game_castspell(9, npcinfo[npcnum].x, npcinfo[npcnum].y, player.px, player.py, npcnum);
+ game_castspell(9, npcinfo[npcnum].x, npcinfo[npcnum].y, _player.px, _player.py, npcnum);
// if enemy is killed
if (npcinfo[npcnum].hp == 0) {
- player.exp = player.exp + npcinfo[npcnum].maxhp;
+ _player.exp = _player.exp + npcinfo[npcnum].maxhp;
if (npcinfo[npcnum].spriteset == 1 || npcinfo[npcnum].spriteset == 7 || npcinfo[npcnum].spriteset == 6) {
- int ff = (int)(RND() * player.level * 3);
+ int ff = (int)(RND() * _player.level * 3);
if (ff == 0) {
float npx = npcinfo[npcnum].x + 12;
float npy = npcinfo[npcnum].y + 20;
@@ -1652,7 +1652,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
}
if (npcinfo[npcnum].spriteset == 2 || npcinfo[npcnum].spriteset == 9 || npcinfo[npcnum].spriteset == 4 || npcinfo[npcnum].spriteset == 5) {
- int ff = (int)(RND() * player.level);
+ int ff = (int)(RND() * _player.level);
if (ff == 0) {
float npx = npcinfo[npcnum].x + 12;
float npy = npcinfo[npcnum].y + 20;
@@ -1666,7 +1666,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
}
if (npcinfo[npcnum].spriteset == 9 || npcinfo[npcnum].spriteset == 10 || npcinfo[npcnum].spriteset == 5) {
- int ff = (int)(RND() * player.level * 2);
+ int ff = (int)(RND() * _player.level * 2);
if (ff == 0) {
float npx = npcinfo[npcnum].x + 12;
float npy = npcinfo[npcnum].y + 20;
@@ -1698,14 +1698,14 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- float npx = player.px + 12;
- float npy = player.py + 20;
+ float npx = _player.px + 12;
+ float npy = _player.py + 20;
int lx = (int)npx / 16;
int ly = (int)npy / 16;
if (lx == cx && ly == cy)
- player.py = player.py + 16;
+ _player.py = _player.py + 16;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
scriptflag[2][0] = 1;
}
@@ -1730,14 +1730,14 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- float npx = player.px + 12;
- float npy = player.py + 20;
+ float npx = _player.px + 12;
+ float npy = _player.py + 20;
int lx = (int)npx / 16;
int ly = (int)npy / 16;
if (lx == cx && ly == cy)
- player.py = player.py + 16;
+ _player.py = _player.py + 16;
scriptflag[3][0] = 1;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
}
@@ -1788,14 +1788,14 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- float npx = player.px + 12;
- float npy = player.py + 20;
+ float npx = _player.px + 12;
+ float npy = _player.py + 20;
int lx = (int)npx / 16;
int ly = (int)npy / 16;
if (lx == cx && ly == cy)
- player.py = player.py + 16;
+ _player.py = _player.py + 16;
scriptflag[5][0] = 1;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
}
@@ -1821,14 +1821,14 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- float npx = player.px + 12;
- float npy = player.py + 20;
+ float npx = _player.px + 12;
+ float npy = _player.py + 20;
int lx = (int)npx / 16;
int ly = (int)npy / 16;
if (lx == cx && ly == cy)
- player.py = player.py + 16;
+ _player.py = _player.py + 16;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
scriptflag[8][0] = 1;
}
@@ -1854,14 +1854,14 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- float npx = player.px + 12;
- float npy = player.py + 20;
+ float npx = _player.px + 12;
+ float npy = _player.py + 20;
int lx = (int)npx / 16;
int ly = (int)npy / 16;
if (lx == cx && ly == cy)
- player.py = player.py + 16;
+ _player.py = _player.py + 16;
scriptflag[s][0] = 1;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
}
@@ -1869,7 +1869,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
}
// pickup lightning bomb
- if (npcinfo[npcnum].script == 9 && (curmap == 41 && scriptflag[9][1] == 0)) {
+ if (npcinfo[npcnum].script == 9 && (_curmap == 41 && scriptflag[9][1] == 0)) {
bool alive = false;
for (int i = 1; i <= lastnpc; i++) {
if (npcinfo[i].hp > 0)
@@ -1887,14 +1887,14 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- float npx = player.px + 12;
- float npy = player.py + 20;
+ float npx = _player.px + 12;
+ float npy = _player.py + 20;
int lx = (int)npx / 16;
int ly = (int)npy / 16;
if (lx == cx && ly == cy)
- player.py = player.py + 16;
+ _player.py = _player.py + 16;
}
}
@@ -1917,14 +1917,14 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- float npx = player.px + 12;
- float npy = player.py + 20;
+ float npx = _player.px + 12;
+ float npy = _player.py + 20;
int lx = (int)npx / 16;
int ly = (int)npy / 16;
if (lx == cx && ly == cy)
- player.py = player.py + 16;
+ _player.py = _player.py + 16;
scriptflag[12][0] = 1;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
}
@@ -1949,14 +1949,14 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- float npx = player.px + 12;
- float npy = player.py + 20;
+ float npx = _player.px + 12;
+ float npy = _player.py + 20;
int lx = (int)npx / 16;
int ly = (int)npy / 16;
if (lx == cx && ly == cy)
- player.py = player.py + 16;
+ _player.py = _player.py + 16;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
scriptflag[13][0] = 1;
}
@@ -1981,14 +1981,14 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- float npx = player.px + 12;
- float npy = player.py + 20;
+ float npx = _player.px + 12;
+ float npy = _player.py + 20;
int lx = (int)npx / 16;
int ly = (int)npy / 16;
if (lx == cx && ly == cy)
- player.py = player.py + 16;
+ _player.py = _player.py + 16;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
scriptflag[15][0] = 1;
@@ -2002,14 +2002,14 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- npx = player.px + 12;
- npy = player.py + 20;
+ npx = _player.px + 12;
+ npy = _player.py + 20;
lx = (int)npx / 16;
ly = (int)npy / 16;
if (lx == cx && ly == cy)
- player.py = player.py + 16;
+ _player.py = _player.py + 16;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
scriptflag[16][0] = 1;
@@ -2024,14 +2024,14 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- npx = player.px + 12;
- npy = player.py + 20;
+ npx = _player.px + 12;
+ npy = _player.py + 20;
lx = (int)npx / 16;
ly = (int)npy / 16;
if (lx == cx && ly == cy)
- player.py = player.py + 16;
+ _player.py = _player.py + 16;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
scriptflag[17][0] = 1;
}
@@ -2046,18 +2046,18 @@ void GriffonEngine::game_damageplayer(int damage) {
char line[256];
if (!_console->_godMode)
- player.hp -= damage;
+ _player.hp -= damage;
- if (player.hp < 0)
- player.hp = 0;
+ if (_player.hp < 0)
+ _player.hp = 0;
sprintf(line, "-%i", damage);
if (damage == 0)
strcpy(line, "miss!");
- game_addFloatText(line, player.px + 12 - 4 * strlen(line), player.py + 16, 4);
+ game_addFloatText(line, _player.px + 12 - 4 * strlen(line), _player.py + 16, 4);
- player.pause = ticks + 1000;
+ _player.pause = ticks + 1000;
}
void GriffonEngine::game_drawanims(int Layer) {
@@ -2082,9 +2082,9 @@ void GriffonEngine::game_drawanims(int Layer) {
int curtilex = c % 20;
int curtiley = (c - curtilex) / 20;
- if (curmap == 58 && scriptflag[60][0] > 0)
+ if (_curmap == 58 && scriptflag[60][0] > 0)
curtilex = 1;
- if (curmap == 54 && scriptflag[60][0] > 1)
+ if (_curmap == 54 && scriptflag[60][0] > 1)
curtilex = 1;
rcSrc.left = curtilex * 16;
rcSrc.top = curtiley * 16;
@@ -2152,7 +2152,7 @@ int hud_recalc(int a, int b, int c) {
#define RGB(R, G, B) (_videobuffer->format.RGBToColor((R), (G), (B)))
void GriffonEngine::game_drawhud() {
- //sprintf(line, "fps: %i, map: %i, exp: %i/%i", (int)fps, curmap, player.exp, player.nextlevel);
+ //sprintf(line, "fps: %i, map: %i, exp: %i/%i", (int)fps, _curmap, _player.exp, _player.nextlevel);
//sys_print(_videobuffer, line, 0, 0, 0);
game_fillrect(_videobuffer2, 0, 0, 320, 240, 0);
@@ -2189,9 +2189,9 @@ void GriffonEngine::game_drawhud() {
rcDest.top = iy;
if (ico != 99)
- itemimg[ico]->blit(*_videobuffer, rcDest.left, rcDest.top);
+ _itemimg[ico]->blit(*_videobuffer, rcDest.left, rcDest.top);
if (ico == 99) {
- spellimg->setAlpha((int)(RND() * 96) + 96, true);
+ _spellimg->setAlpha((int)(RND() * 96) + 96, true);
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -2201,9 +2201,9 @@ void GriffonEngine::game_drawhud() {
rcDest.left = ix;
rcDest.top = iy;
- spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- spellimg->setAlpha(255, true);
+ _spellimg->setAlpha(255, true);
}
}
}
@@ -2217,17 +2217,17 @@ void GriffonEngine::game_drawhud() {
rcSrc.top = sy;
// spells in game
- if (player.foundspell[0] == 1) {
+ if (_player.foundspell[0] == 1) {
for (int i = 0; i < 5; i++) {
rcSrc.left = rcSrc.left + 17;
- if (player.foundspell[i] == 1) {
- itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ if (_player.foundspell[i] == 1) {
+ _itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
game_fillrect(_videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32));
game_fillrect(_videobuffer, rcSrc.left + 1, sy + 17,
- hud_recalc(player.spellcharge[i], 14, 100), 2,
- ABS(player.spellcharge[i] - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 224, 64));
+ hud_recalc(_player.spellcharge[i], 14, 100), 2,
+ ABS(_player.spellcharge[i] - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 224, 64));
}
}
}
@@ -2240,7 +2240,7 @@ void GriffonEngine::game_drawhud() {
rcDest.right = 320;
rcDest.bottom = 240;
_videobuffer2->fillRect(rcDest, 0);
- _videobuffer2->setAlpha((int)(player.itemselshade * 4)); // FIXME
+ _videobuffer2->setAlpha((int)(_player.itemselshade * 4)); // FIXME
_videobuffer2->blit(*_videobuffer);
int sy = 202;
@@ -2259,11 +2259,11 @@ void GriffonEngine::game_drawhud() {
rcDest.top = 46 + 77;
int amap = 0;
- if (curmap > 46)
+ if (_curmap > 46)
amap = 2;
- if (curmap > 67)
+ if (_curmap > 67)
amap = 3;
- if (curmap > 5 && curmap < 42)
+ if (_curmap > 5 && _curmap < 42)
amap = 1;
mapimg[amap]->blit(*_videobuffer, rcDest.left, rcDest.top);
@@ -2271,7 +2271,7 @@ void GriffonEngine::game_drawhud() {
for (int b = 0; b <= 6; b++) {
for (int a = 0; a <= 12; a++) {
- if (invmap[amap][b][a] == curmap) {
+ if (invmap[amap][b][a] == _curmap) {
game_fillrect(_videobuffer, 46 + 9 + a * 9 + 2, 46 + 77 + b * 9 + 1, 6, 6, ccc);
}
}
@@ -2283,29 +2283,29 @@ void GriffonEngine::game_drawhud() {
}
char line[128];
- sprintf(line, "Health: %i/%i", player.hp, player.maxhp);
- sys_print(_videobuffer, line, sx, sy, player.hp <= player.maxhp * 0.25 ? (int)player.hpflash : 0);
+ sprintf(line, "Health: %i/%i", _player.hp, _player.maxhp);
+ sys_print(_videobuffer, line, sx, sy, _player.hp <= _player.maxhp * 0.25 ? (int)_player.hpflash : 0);
- sprintf(line, "Level : %i", player.level);
- if (player.level == player.maxlevel)
+ sprintf(line, "Level : %i", _player.level);
+ if (_player.level == _player.maxlevel)
strcpy(line, "Level : MAX");
sys_print(_videobuffer, line, sx, sy + 8, 0);
// experience
game_fillrect(_videobuffer, sx + 64, sy + 16, 16, 4, RGB(0, 32, 32));
game_fillrect(_videobuffer, sx + 65, sy + 17,
- hud_recalc(player.exp, 14, player.nextlevel), 2, RGB(0, 224, 64));
+ hud_recalc(_player.exp, 14, _player.nextlevel), 2, RGB(0, 224, 64));
// attack strength
game_fillrect(_videobuffer, sx + 1, sy + 16, 56, 6, RGB(0, 32, 32));
game_fillrect(_videobuffer, sx + 1, sy + 17,
- hud_recalc(player.attackstrength, 54, 100), 2,
- ABS(player.attackstrength - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 64, 224));
+ hud_recalc(_player.attackstrength, 54, 100), 2,
+ ABS(_player.attackstrength - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 64, 224));
// spell strength
game_fillrect(_videobuffer, sx + 1, sy + 19,
- hud_recalc(player.spellstrength, 54, 100), 2,
- ABS(player.spellstrength - 100) < kEpsilon ? RGB(224, 0, 0) : RGB(128, 0, 224));
+ hud_recalc(_player.spellstrength, 54, 100), 2,
+ ABS(_player.spellstrength - 100) < kEpsilon ? RGB(224, 0, 0) : RGB(128, 0, 224));
// time
int ase = secstart + secsingame;
@@ -2323,22 +2323,22 @@ void GriffonEngine::game_drawhud() {
rcSrc.left = 128;
rcSrc.top = 91;
- int ss = (player.sword - 1) * 3;
- if (player.sword == 3)
+ int ss = (_player.sword - 1) * 3;
+ if (_player.sword == 3)
ss = 18;
- itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
rcSrc.left = rcSrc.left + 16;
- ss = (player.shield - 1) * 3 + 1;
- if (player.shield == 3)
+ ss = (_player.shield - 1) * 3 + 1;
+ if (_player.shield == 3)
ss = 19;
- itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
rcSrc.left = rcSrc.left + 16;
- ss = (player.armour - 1) * 3 + 2;
- if (player.armour == 3)
+ ss = (_player.armour - 1) * 3 + 2;
+ if (_player.armour == 3)
ss = 20;
- itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
for (int i = 0; i <= 4; i++) {
sx = 188;
@@ -2346,34 +2346,34 @@ void GriffonEngine::game_drawhud() {
rcSrc.left = sx;
rcSrc.top = sy;
if (i == 0)
- itemimg[6]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _itemimg[6]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
if (i == 1)
- itemimg[12]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _itemimg[12]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
if (i == 2)
- itemimg[17]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _itemimg[17]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
if (i == 3)
- itemimg[16]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _itemimg[16]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
if (i == 4)
- itemimg[14]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _itemimg[14]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
- sprintf(line, "x%i", player.inventory[i]);
+ sprintf(line, "x%i", _player.inventory[i]);
sys_print(_videobuffer, line, sx + 17, sy + 7, 0);
}
// spells in menu
- if (player.foundspell[0] == 1) {
+ if (_player.foundspell[0] == 1) {
for (int i = 0; i < 5; i++) {
rcSrc.left = 243;
rcSrc.top = 67 + i * 24;
sy = rcSrc.top;
- if (player.foundspell[i] == 1) {
- itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ if (_player.foundspell[i] == 1) {
+ _itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
game_fillrect(_videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32));
game_fillrect(_videobuffer, rcSrc.left + 1, sy + 17,
- hud_recalc(player.spellcharge[i], 14, 100), 2,
- ABS(player.spellcharge[i] - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 224, 64));
+ hud_recalc(_player.spellcharge[i], 14, 100), 2,
+ ABS(_player.spellcharge[i] - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 224, 64));
}
}
}
@@ -2383,13 +2383,13 @@ void GriffonEngine::game_drawhud() {
if (curitem == 5 + i) {
rcDest.left = (float)(243 - 12 + 3 * sin(3.141592 * 2 * itemyloc / 16));
rcDest.top = 67 + 24 * i;
- itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
+ _itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
}
if (curitem == i) {
rcDest.left = (float)(189 - 12 + 3 * sin(3.141592 * 2 * itemyloc / 16));
rcDest.top = 70 + 24 * i;
- itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
+ _itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
}
}
}
@@ -2405,7 +2405,7 @@ void GriffonEngine::game_drawhud() {
rcDest.top = (float)(npcinfo[curenemy].y + 4 - 16 - sin(3.141592 / 8 * itemyloc));
}
- itemimg[13]->blit(*_videobuffer, rcDest.left, rcDest.top);
+ _itemimg[13]->blit(*_videobuffer, rcDest.left, rcDest.top);
}
}
@@ -2415,9 +2415,9 @@ void GriffonEngine::game_drawnpcs(int mode) {
int lst = lasty;
if (mode == 0)
- lst = player.ysort;
+ lst = _player.ysort;
if (mode == 1)
- fst = player.ysort;
+ fst = _player.ysort;
for (int yy = fst; yy <= lst; yy++) {
@@ -2496,7 +2496,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
for (int f = 0; f <= 7; f++) {
int yp = 0;
- if (f == 0 && (curmap == 53 || curmap == 57 || curmap == 61 || curmap == 65 || curmap == 56 || curmap > 66) && scriptflag[60][0] > 0)
+ if (f == 0 && (_curmap == 53 || _curmap == 57 || _curmap == 61 || _curmap == 65 || _curmap == 56 || _curmap > 66) && scriptflag[60][0] > 0)
yp = 16;
int s = npcinfo[i].bodysection[f].sprite;
rcSrc.left = animset9[s].x;
@@ -2584,9 +2584,9 @@ void GriffonEngine::game_drawnpcs(int mode) {
int x = 192 + ((int)(itemyloc + ff * 5) % 3) * 64;
if (x > 255)
x = 255;
- spellimg->setAlpha(x, true);
- spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- spellimg->setAlpha(255, true);
+ _spellimg->setAlpha(x, true);
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellimg->setAlpha(255, true);
for (int f = 1; f <= 8; f++) {
rcSrc.left = 16 * (int)(RND() * 2);
@@ -2600,9 +2600,9 @@ void GriffonEngine::game_drawnpcs(int mode) {
x = 192 + f % 3 * 64;
if (x > 255)
x = 255;
- spellimg->setAlpha(x, true);
- spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- spellimg->setAlpha(255, true);
+ _spellimg->setAlpha(x, true);
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellimg->setAlpha(255, true);
}
rcSrc.left = 0;
@@ -2613,9 +2613,9 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = npcinfo[i].bodysection[10 * ff + 9].x - 21;
rcDest.top = npcinfo[i].bodysection[10 * ff + 9].y - 21;
- spellimg->setAlpha(192, true);
+ _spellimg->setAlpha(192, true);
anims[5]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- spellimg->setAlpha(255, true);
+ _spellimg->setAlpha(255, true);
}
}
@@ -2789,7 +2789,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
int sy = (float)(npy + 12 - 50 - 3 * sin(3.141592 * 2 * npcinfo[i].floating / 16));
for (int fr = 0; fr <= 3; fr++) {
- spellimg->setAlpha(128 + (int)(RND() * 96), true);
+ _spellimg->setAlpha(128 + (int)(RND() * 96), true);
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -2799,7 +2799,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = sx + 32 + (int)(RND() * 3) - 1;
rcDest.top = sy - (int)(RND() * 6);
- spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
for (int ii = 0; ii <= 8; ii++) {
@@ -2816,19 +2816,19 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = (float)(sx + 36 + ii * 8 - ii * cos(3.14159 * 2 * (fr3 - ii) / 16) * 2);
rcDest.top = (float)(sy + 16 + ii * sin(3.14159 * 2 * (fr3 - ii) / 16) * 3 - ii); // * 4
- spellimg->setAlpha(i2 / 3 * 224, true);
+ _spellimg->setAlpha(i2 / 3 * 224, true);
- spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
int xloc = rcDest.left;
int yloc = rcDest.top;
- int xdif = (xloc + 8) - (player.px + 12);
- int ydif = (yloc + 8) - (player.py + 12);
+ int xdif = (xloc + 8) - (_player.px + 12);
+ int ydif = (yloc + 8) - (_player.py + 12);
- if ((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks) {
+ if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < ticks) {
float damage = (float)npcinfo[i].spelldamage * (1.0 + RND() * 0.5);
- if (player.hp > 0) {
+ if (_player.hp > 0) {
game_damageplayer(damage);
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndfire]);
@@ -2842,19 +2842,19 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = (float)(sx + 36 - ii * 8 + ii * cos(3.14159 * 2 * (fr3 - ii) / 16) * 2);
rcDest.top = (float)(sy + 16 + ii * sin(3.14159 * 2 * (fr3 - ii) / 16) * 3 - ii); // * 4
- spellimg->setAlpha(i2 / 3 * 224, true);
+ _spellimg->setAlpha(i2 / 3 * 224, true);
- spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
xloc = rcDest.left;
yloc = rcDest.top;
- xdif = (xloc + 8) - (player.px + 12);
- ydif = (yloc + 8) - (player.py + 12);
+ xdif = (xloc + 8) - (_player.px + 12);
+ ydif = (yloc + 8) - (_player.py + 12);
- if ((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks) {
+ if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < ticks) {
float damage = (float)npcinfo[i].spelldamage * (1.0 + RND() * 0.5);
- if (player.hp > 0) {
+ if (_player.hp > 0) {
game_damageplayer(damage);
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndfire]);
@@ -2865,7 +2865,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
}
}
- spellimg->setAlpha(255, true);
+ _spellimg->setAlpha(255, true);
if (npcinfo[i].attacking == 0) {
int cframe = (int)(frame);
@@ -3033,29 +3033,29 @@ void GriffonEngine::game_drawover(int modx, int mody) {
void GriffonEngine::game_drawplayer() {
int f = 0;
- if (player.armour == 3)
+ if (_player.armour == 3)
f = 13;
if (!attacking) {
- rcSrc.left = (int)(player.walkframe / 4) * 24;
- rcSrc.top = player.walkdir * 24;
+ rcSrc.left = (int)(_player.walkframe / 4) * 24;
+ rcSrc.top = _player.walkdir * 24;
rcSrc.setWidth(24);
rcSrc.setHeight(24);
- rcDest.left = (int)(player.px);
- rcDest.top = (int)(player.py);
+ rcDest.left = (int)(_player.px);
+ rcDest.top = (int)(_player.py);
rcDest.setWidth(24);
rcDest.setHeight(24);
anims[f]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
- rcSrc.left = (int)(player.attackframe / 4) * 24;
- rcSrc.top = player.walkdir * 24;
+ rcSrc.left = (int)(_player.attackframe / 4) * 24;
+ rcSrc.top = _player.walkdir * 24;
rcSrc.setWidth(24);
rcSrc.setHeight(24);
- rcDest.left = (int)(player.px);
- rcDest.top = (int)(player.py);
+ rcDest.left = (int)(_player.px);
+ rcDest.top = (int)(_player.py);
rcDest.setWidth(24);
rcDest.setHeight(24);
@@ -3066,20 +3066,20 @@ void GriffonEngine::game_drawplayer() {
long ccc = _videobuffer->format.RGBToColor(224, 224, 64);
int pass = 0;
- if (player.hp <= player.maxhp * 0.25)
+ if (_player.hp <= _player.maxhp * 0.25)
pass = 1;
if (pass == 1) {
ccc = _videobuffer->format.RGBToColor(255, 255, 255);
- if ((int)(player.hpflash) == 1)
+ if ((int)(_player.hpflash) == 1)
ccc = _videobuffer->format.RGBToColor(255, 0, 0);
}
int sss = 6;
- if (player.foundspell[0])
+ if (_player.foundspell[0])
sss = 8;
- int npx = player.px;
- int npy = player.py;
+ int npx = _player.px;
+ int npy = _player.py;
rcDest.left = npx + 4;
rcDest.top = npy + 22;
rcDest.setWidth(16);
@@ -3091,7 +3091,7 @@ void GriffonEngine::game_drawplayer() {
rcDest.top = npy + 23;
- int ww = 14 * player.hp / player.maxhp;
+ int ww = 14 * _player.hp / _player.maxhp;
if (ww > 14)
ww = 14;
if (ww < 1)
@@ -3103,14 +3103,14 @@ void GriffonEngine::game_drawplayer() {
_videobuffer->fillRect(rcDest, ccc);
ccc = _videobuffer->format.RGBToColor(0, 224, 64);
- if (ABS(player.attackstrength - 100) < kEpsilon)
+ if (ABS(_player.attackstrength - 100) < kEpsilon)
ccc = _videobuffer->format.RGBToColor(255, 128, 32);
- ww = 14 * player.attackstrength / 100;
+ ww = 14 * _player.attackstrength / 100;
if (ww > 14)
ww = 14;
- int ww2 = 14 * player.spellstrength / 100;
+ int ww2 = 14 * _player.spellstrength / 100;
if (ww2 > 14)
ww2 = 14;
@@ -3121,7 +3121,7 @@ void GriffonEngine::game_drawplayer() {
_videobuffer->fillRect(rcDest, ccc);
ccc = _videobuffer->format.RGBToColor(128, 0, 224);
- if (ABS(player.spellstrength - 100) < kEpsilon)
+ if (ABS(_player.spellstrength - 100) < kEpsilon)
ccc = _videobuffer->format.RGBToColor(224, 0, 0);
rcDest.top = rcDest.top + 2;
@@ -3149,7 +3149,7 @@ void GriffonEngine::game_drawview() {
if (dontdrawover == 0)
game_drawanims(1);
- game_drawover((int)player.px, (int)player.py);
+ game_drawover((int)_player.px, (int)_player.py);
game_updspells();
@@ -3220,7 +3220,7 @@ void GriffonEngine::game_endofgame() {
g_system->copyRectToScreen(_videobuffer3->getPixels(), _videobuffer3->pitch, 0, 0, _videobuffer3->w, _videobuffer3->h);
g_system->updateScreen();
- g_system->getEventManager()->pollEvent(event);
+ g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
tickspassed = ticks;
@@ -3279,7 +3279,7 @@ void GriffonEngine::game_endofgame() {
g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
- g_system->getEventManager()->pollEvent(event);
+ g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
tickspassed = ticks;
@@ -3302,12 +3302,12 @@ void GriffonEngine::game_endofgame() {
if (xofs >= 320)
xofs = xofs - 320;
- if (event.type == Common::EVENT_KEYDOWN)
+ if (_event.type == Common::EVENT_KEYDOWN)
spd = 1.0f;
- if (event.type == Common::EVENT_KEYUP)
+ if (_event.type == Common::EVENT_KEYUP)
spd = 0.2f;
- if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
+ if (_event.kbd.keycode == Common::KEYCODE_ESCAPE)
break;
} while (1);
@@ -3337,7 +3337,7 @@ void GriffonEngine::game_endofgame() {
g_system->copyRectToScreen(_videobuffer3->getPixels(), _videobuffer3->pitch, 0, 0, _videobuffer3->w, _videobuffer3->h);
g_system->updateScreen();
- g_system->getEventManager()->pollEvent(event);
+ g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
tickspassed = ticks;
@@ -3376,7 +3376,7 @@ void GriffonEngine::game_endofgame() {
g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
- g_system->getEventManager()->pollEvent(event);
+ g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
tickspassed = ticks;
@@ -3392,9 +3392,9 @@ void GriffonEngine::game_endofgame() {
fp = 0;
}
- g_system->getEventManager()->pollEvent(event);
+ g_system->getEventManager()->pollEvent(_event);
- if (event.type == Common::EVENT_KEYDOWN && keywait < ticks)
+ if (_event.type == Common::EVENT_KEYDOWN && keywait < ticks)
break;
} while (1);
@@ -3420,9 +3420,9 @@ void GriffonEngine::game_eventtext(const char *stri) {
_videobuffer->blit(*_videobuffer2);
do {
- g_system->getEventManager()->pollEvent(event);
+ g_system->getEventManager()->pollEvent(_event);
- if (event.type == Common::EVENT_KEYDOWN && pauseticks < ticks)
+ if (_event.type == Common::EVENT_KEYDOWN && pauseticks < ticks)
break;
_videobuffer2->blit(*_videobuffer);
@@ -3433,16 +3433,16 @@ void GriffonEngine::game_eventtext(const char *stri) {
if (fr > 192)
fr = 192;
- windowimg->setAlpha(fr, true);
+ _windowimg->setAlpha(fr, true);
- windowimg->blit(*_videobuffer);
+ _windowimg->blit(*_videobuffer);
if (pauseticks < ticks)
sys_print(_videobuffer, stri, x, 15, 0);
g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
- g_system->getEventManager()->pollEvent(event);
+ g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
tickspassed = ticks;
@@ -3475,12 +3475,12 @@ void GriffonEngine::game_handlewalking() {
int xmax = 20 * 16 - 25;
int ymax = 15 * 16 - 25;
- px = player.px;
- py = player.py;
+ px = _player.px;
+ py = _player.py;
opx = px;
opy = py;
- spd = player.walkspd * fpsr;
+ spd = _player.walkspd * fpsr;
nx = (px / 2 + 6);
ny = (py / 2 + 10);
@@ -3490,7 +3490,7 @@ void GriffonEngine::game_handlewalking() {
int lx = (int)npx / 16;
int ly = (int)npy / 16;
- int ramp = rampdata[lx][ly];
+ int ramp = _rampdata[lx][ly];
if (ramp == 1 && movingup)
spd = spd * 2;
if (ramp == 1 && movingdown)
@@ -3520,17 +3520,17 @@ void GriffonEngine::game_handlewalking() {
}
if (movingup)
- player.walkdir = 0;
+ _player.walkdir = 0;
if (movingdown)
- player.walkdir = 1;
+ _player.walkdir = 1;
if (movingleft)
- player.walkdir = 2;
+ _player.walkdir = 2;
if (movingright)
- player.walkdir = 3;
+ _player.walkdir = 3;
if (movingup && _clipsurround[1][0] == 0) {
py = py - spd;
- player.walkdir = 0;
+ _player.walkdir = 0;
} else if (movingup && _clipsurround[1][0] > 0) {
// move upleft
if (movingright == 0 && _clipsurround[0][0] == 0) {
@@ -3546,7 +3546,7 @@ void GriffonEngine::game_handlewalking() {
}
if (movingdown && _clipsurround[1][2] == 0) {
py = py + spd;
- player.walkdir = 1;
+ _player.walkdir = 1;
} else if (movingdown && _clipsurround[1][2] > 0) {
// move downleft
if (movingright == 0 && _clipsurround[0][2] == 0) {
@@ -3562,7 +3562,7 @@ void GriffonEngine::game_handlewalking() {
}
if (movingleft && _clipsurround[0][1] == 0) {
px = px - spd;
- player.walkdir = 2;
+ _player.walkdir = 2;
} else if (movingleft && _clipsurround[0][1] > 0) {
// move leftup
if (movingdown == 0 && _clipsurround[0][0] == 0) {
@@ -3578,7 +3578,7 @@ void GriffonEngine::game_handlewalking() {
}
if (movingright && _clipsurround[2][1] == 0) {
px = px + spd;
- player.walkdir = 3;
+ _player.walkdir = 3;
} else if (movingright && _clipsurround[2][1] > 0) {
// move rightup
if (movingdown == 0 && _clipsurround[2][0] == 0) {
@@ -3624,19 +3624,19 @@ void GriffonEngine::game_handlewalking() {
opx = npx;
opy = npy;
- int xdif = player.px - npx;
- int ydif = player.py - npy;
+ int xdif = _player.px - npx;
+ int ydif = _player.py - npy;
- if (player.walkdir == 0) {
+ if (_player.walkdir == 0) {
if (abs(xdif) <= 8 && ydif > 0 && ydif < 8)
npcinfo[i].y = npcinfo[i].y - spd;
- } else if (player.walkdir == 1) {
+ } else if (_player.walkdir == 1) {
if (abs(xdif) <= 8 && ydif < 0 && ydif > -8)
npcinfo[i].y = npcinfo[i].y + spd;
- } else if (player.walkdir == 2) {
+ } else if (_player.walkdir == 2) {
if (abs(ydif) <= 8 && xdif > 0 && xdif < 8)
npcinfo[i].x = npcinfo[i].x - spd;
- } else if (player.walkdir == 3) {
+ } else if (_player.walkdir == 3) {
if (abs(ydif) <= 8 && xdif < 0 && xdif > -8)
npcinfo[i].x = npcinfo[i].x + spd;
}
@@ -3657,28 +3657,28 @@ void GriffonEngine::game_handlewalking() {
}
}
- player.opx = player.px;
- player.opy = player.py;
- player.px = px;
- player.py = py;
+ _player.opx = _player.px;
+ _player.opy = _player.py;
+ _player.px = px;
+ _player.py = py;
- if (player.px != player.opx || player.py != player.opy)
- player.walkframe = player.walkframe + animspd * fpsr;
- if (player.walkframe >= 16)
- player.walkframe = player.walkframe - 16;
+ if (_player.px != _player.opx || _player.py != _player.opy)
+ _player.walkframe = _player.walkframe + _animspd * fpsr;
+ if (_player.walkframe >= 16)
+ _player.walkframe = _player.walkframe - 16;
// walking over items to pickup :::
int o = objmap[lx][ly];
if (o > -1) {
// fsk
- if (objectinfo[o][4] == 2 && player.inventory[INV_FLASK] < 9) {
+ if (objectinfo[o][4] == 2 && _player.inventory[INV_FLASK] < 9) {
objmap[lx][ly] = -1;
- player.inventory[INV_FLASK]++;
+ _player.inventory[INV_FLASK]++;
game_addFloatIcon(6, lx * 16, ly * 16);
- objmapf[curmap][lx][ly] = 1;
+ objmapf[_curmap][lx][ly] = 1;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
@@ -3686,13 +3686,13 @@ void GriffonEngine::game_handlewalking() {
}
}
- if (objectinfo[o][5] == 7 && player.inventory[INV_DOUBLEFLASK] < 9) {
+ if (objectinfo[o][5] == 7 && _player.inventory[INV_DOUBLEFLASK] < 9) {
objmap[lx][ly] = -1;
- player.inventory[INV_DOUBLEFLASK]++;
+ _player.inventory[INV_DOUBLEFLASK]++;
game_addFloatIcon(12, lx * 16, ly * 16);
- objmapf[curmap][lx][ly] = 1;
+ objmapf[_curmap][lx][ly] = 1;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
@@ -3700,14 +3700,14 @@ void GriffonEngine::game_handlewalking() {
}
}
- if (objectinfo[o][5] == 9 && player.inventory[INV_SHOCK] < 9 && (curmap == 41 && scriptflag[9][1] == 0)) {
+ if (objectinfo[o][5] == 9 && _player.inventory[INV_SHOCK] < 9 && (_curmap == 41 && scriptflag[9][1] == 0)) {
objmap[lx][ly] = -1;
- player.inventory[INV_SHOCK]++;
+ _player.inventory[INV_SHOCK]++;
game_addFloatIcon(17, lx * 16, ly * 16);
- objmapf[curmap][lx][ly] = 1;
- if (curmap == 41)
+ objmapf[_curmap][lx][ly] = 1;
+ if (_curmap == 41)
scriptflag[9][1] = 1;
if (menabled && config.effects) {
@@ -3717,13 +3717,13 @@ void GriffonEngine::game_handlewalking() {
}
- if (objectinfo[o][5] == 9 && player.inventory[INV_SHOCK] < 9) {
+ if (objectinfo[o][5] == 9 && _player.inventory[INV_SHOCK] < 9) {
objmap[lx][ly] = -1;
- player.inventory[INV_SHOCK]++;
+ _player.inventory[INV_SHOCK]++;
game_addFloatIcon(17, lx * 16, ly * 16);
- objmapf[curmap][lx][ly] = 1;
+ objmapf[_curmap][lx][ly] = 1;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
@@ -3744,7 +3744,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
ccc = _clipbg->format.RGBToColor(255, 255, 255);
- curmap = mapnum;
+ _curmap = mapnum;
_mapbg->fillRect(trect, 0);
_clipbg->fillRect(trect, ccc);
@@ -3826,7 +3826,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
for (int y = 0; y <= 23; y++)
for (int x = 0; x <= 39; x++)
- rampdata[x][y] = tempmap[3 * 40 + x][y + 40];
+ _rampdata[x][y] = tempmap[3 * 40 + x][y + 40];
for (int y = 0; y <= 23; y++)
@@ -3835,7 +3835,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
for (int a = 0; a <= 2; a++)
tileinfo[l][x][y][a] = 0;
- if (scriptflag[4][0] == 1 && curmap == 4) {
+ if (scriptflag[4][0] == 1 && _curmap == 4) {
triggerloc[9][7] = 5004;
tempmap[9][7] = 41;
tempmap[9][7 + 40] = 0;
@@ -3995,7 +3995,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
int o = tempmap[5 * 40 + x][y];
- if (objmapf[curmap][x][y] == 0) {
+ if (objmapf[_curmap][x][y] == 0) {
objmap[x][y] = o;
if (objectinfo[o][0] > 1) {
@@ -4033,20 +4033,20 @@ void GriffonEngine::game_loadmap(int mapnum) {
}
- if (curmap == 62 && scriptflag[8][0] > 0)
+ if (_curmap == 62 && scriptflag[8][0] > 0)
lastnpc = 0;
- if (curmap == 73 && scriptflag[12][0] > 0)
+ if (_curmap == 73 && scriptflag[12][0] > 0)
lastnpc = 0;
- if (curmap == 81 && scriptflag[13][0] > 0)
+ if (_curmap == 81 && scriptflag[13][0] > 0)
lastnpc = 0;
- if (curmap == 73 && scriptflag[12][0] == 0)
+ if (_curmap == 73 && scriptflag[12][0] == 0)
roomlock = 1;
- if (curmap == 81 && scriptflag[13][0] == 0)
+ if (_curmap == 81 && scriptflag[13][0] == 0)
roomlock = 1;
- if (curmap == 83 && scriptflag[15][0] == 0)
+ if (_curmap == 83 && scriptflag[15][0] == 0)
roomlock = 1;
- if (curmap == 82)
+ if (_curmap == 82)
roomlock = 1;
// read *.npc file
@@ -4319,7 +4319,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
int cx, cy, npx, npy, lx, ly;
// academy master key
- if (curmap == 34 && scriptflag[2][0] == 1) {
+ if (_curmap == 34 && scriptflag[2][0] == 1) {
cx = 9;
cy = 7;
@@ -4330,20 +4330,20 @@ void GriffonEngine::game_loadmap(int mapnum) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- npx = player.px + 12;
- npy = player.py + 20;
+ npx = _player.px + 12;
+ npy = _player.py + 20;
lx = (int)npx / 16;
ly = (int)npy / 16;
if (lx == cx && ly == cy)
- player.py = player.py + 16;
+ _player.py = _player.py + 16;
_clipbg->fillRect(rcDest, ccc);
}
// academy crystal
- if (curmap == 24 && player.foundspell[0] == 0 && scriptflag[3][0] == 1) {
+ if (_curmap == 24 && _player.foundspell[0] == 0 && scriptflag[3][0] == 1) {
cx = 9;
cy = 7;
@@ -4354,20 +4354,20 @@ void GriffonEngine::game_loadmap(int mapnum) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- npx = player.px + 12;
- npy = player.py + 20;
+ npx = _player.px + 12;
+ npy = _player.py + 20;
lx = (int)npx / 16;
ly = (int)npy / 16;
if (lx == cx && ly == cy)
- player.py = player.py + 16;
+ _player.py = _player.py + 16;
_clipbg->fillRect(rcDest, ccc);
}
// gardens master key
- if (curmap == 62 && scriptflag[8][0] == 1) {
+ if (_curmap == 62 && scriptflag[8][0] == 1) {
cx = 13;
cy = 7;
@@ -4378,20 +4378,20 @@ void GriffonEngine::game_loadmap(int mapnum) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- npx = player.px + 12;
- npy = player.py + 20;
+ npx = _player.px + 12;
+ npy = _player.py + 20;
lx = (int)npx / 16;
ly = (int)npy / 16;
if (lx == cx && ly == cy)
- player.py = player.py + 16;
+ _player.py = _player.py + 16;
_clipbg->fillRect(rcDest, ccc);
}
// gardens fidelis sword
- if (curmap == 66 && scriptflag[5][0] == 1 && player.sword == 1) {
+ if (_curmap == 66 && scriptflag[5][0] == 1 && _player.sword == 1) {
cx = 9;
cy = 6;
@@ -4402,20 +4402,20 @@ void GriffonEngine::game_loadmap(int mapnum) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- npx = player.px + 12;
- npy = player.py + 20;
+ npx = _player.px + 12;
+ npy = _player.py + 20;
lx = (int)npx / 16;
ly = (int)npy / 16;
if (lx == cx && ly == cy)
- player.py = player.py + 16;
+ _player.py = _player.py + 16;
_clipbg->fillRect(rcDest, ccc);
}
// citadel armour
- if (curmap == 73 && scriptflag[12][0] == 1 && player.armour == 1) {
+ if (_curmap == 73 && scriptflag[12][0] == 1 && _player.armour == 1) {
cx = 8;
cy = 7;
@@ -4426,20 +4426,20 @@ void GriffonEngine::game_loadmap(int mapnum) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- npx = player.px + 12;
- npy = player.py + 20;
+ npx = _player.px + 12;
+ npy = _player.py + 20;
lx = (int)npx / 16;
ly = (int)npy / 16;
if (lx == cx && ly == cy)
- player.py = player.py + 16;
+ _player.py = _player.py + 16;
_clipbg->fillRect(rcDest, ccc);
}
// citadel master key
- if (curmap == 81 && scriptflag[13][0] == 1) {
+ if (_curmap == 81 && scriptflag[13][0] == 1) {
cx = 11;
cy = 10;
@@ -4450,21 +4450,21 @@ void GriffonEngine::game_loadmap(int mapnum) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- npx = player.px + 12;
- npy = player.py + 20;
+ npx = _player.px + 12;
+ npy = _player.py + 20;
lx = (int)npx / 16;
ly = (int)npy / 16;
if (lx == cx && ly == cy)
- player.py = player.py + 16;
+ _player.py = _player.py + 16;
_clipbg->fillRect(rcDest, ccc);
}
// max ups
- if (curmap == 83 && scriptflag[15][0] == 1 && player.sword < 3) {
+ if (_curmap == 83 && scriptflag[15][0] == 1 && _player.sword < 3) {
cx = 6;
cy = 8;
@@ -4475,19 +4475,19 @@ void GriffonEngine::game_loadmap(int mapnum) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- npx = player.px + 12;
- npy = player.py + 20;
+ npx = _player.px + 12;
+ npy = _player.py + 20;
lx = (int)npx / 16;
ly = (int)npy / 16;
if (lx == cx && ly == cy)
- player.py = player.py + 16;
+ _player.py = _player.py + 16;
_clipbg->fillRect(rcDest, ccc);
}
- if (curmap == 83 && scriptflag[16][0] == 1 && player.shield < 3) {
+ if (_curmap == 83 && scriptflag[16][0] == 1 && _player.shield < 3) {
cx = 9;
cy = 8;
@@ -4498,19 +4498,19 @@ void GriffonEngine::game_loadmap(int mapnum) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- npx = player.px + 12;
- npy = player.py + 20;
+ npx = _player.px + 12;
+ npy = _player.py + 20;
lx = (int)npx / 16;
ly = (int)npy / 16;
if (lx == cx && ly == cy)
- player.py = player.py + 16;
+ _player.py = _player.py + 16;
_clipbg->fillRect(rcDest, ccc);
}
- if (curmap == 83 && scriptflag[17][0] == 1 && player.armour < 3) {
+ if (_curmap == 83 && scriptflag[17][0] == 1 && _player.armour < 3) {
cx = 12;
cy = 8;
@@ -4521,14 +4521,14 @@ void GriffonEngine::game_loadmap(int mapnum) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- npx = player.px + 12;
- npy = player.py + 20;
+ npx = _player.px + 12;
+ npy = _player.py + 20;
lx = (int)npx / 16;
ly = (int)npy / 16;
if (lx == cx && ly == cy)
- player.py = player.py + 16;
+ _player.py = _player.py + 16;
_clipbg->fillRect(rcDest, ccc);
}
@@ -4635,14 +4635,14 @@ void GriffonEngine::game_newgame() {
if (xofs >= 320)
xofs = xofs - 320;
- g_system->getEventManager()->pollEvent(event);
+ g_system->getEventManager()->pollEvent(_event);
- if (event.type == Common::EVENT_KEYDOWN)
+ if (_event.type == Common::EVENT_KEYDOWN)
cnt = 6;
- if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
+ if (_event.kbd.keycode == Common::KEYCODE_ESCAPE)
goto __exit_do;
- if (event.type == Common::EVENT_QUIT)
+ if (_event.type == Common::EVENT_QUIT)
_shouldQuit = true;
g_system->delayMillis(10);
@@ -4652,33 +4652,33 @@ __exit_do:
if (_shouldQuit)
return;
- player.px = 0;
- player.py = 0;
- player.opx = 0;
- player.opy = 0;
- player.walkdir = 0;
- player.walkframe = 0;
- player.walkspd = 0;
- player.attackframe = 0;
- player.attackspd = 0;
- player.hp = 0;
- player.maxhp = 0;
- player.hpflash = 0;
- player.level = 0;
- player.maxlevel = 0;
- player.sword = 0;
- player.shield = 0;
- player.armour = 0;
+ _player.px = 0;
+ _player.py = 0;
+ _player.opx = 0;
+ _player.opy = 0;
+ _player.walkdir = 0;
+ _player.walkframe = 0;
+ _player.walkspd = 0;
+ _player.attackframe = 0;
+ _player.attackspd = 0;
+ _player.hp = 0;
+ _player.maxhp = 0;
+ _player.hpflash = 0;
+ _player.level = 0;
+ _player.maxlevel = 0;
+ _player.sword = 0;
+ _player.shield = 0;
+ _player.armour = 0;
for (int i = 0; i < 5; i++) {
- player.foundspell[i] = 0;
- player.spellcharge[i] = 0;
- player.inventory[i] = 0;
+ _player.foundspell[i] = 0;
+ _player.spellcharge[i] = 0;
+ _player.inventory[i] = 0;
}
- player.attackstrength = 0;
- player.spelldamage = 0;
- player.sworddamage = 0;
- player.exp = 0;
- player.nextlevel = 0;
+ _player.attackstrength = 0;
+ _player.spelldamage = 0;
+ _player.sworddamage = 0;
+ _player.exp = 0;
+ _player.nextlevel = 0;
memset(scriptflag, 0, sizeof(scriptflag));
memset(objmapf, 0, sizeof(objmapf));
@@ -4692,26 +4692,26 @@ __exit_do:
roomlocks[73] = 1;
roomlocks[82] = 2;
- player.walkspd = 1.1f;
- animspd = 0.5f;
+ _player.walkspd = 1.1f;
+ _animspd = 0.5f;
attacking = false;
- player.attackspd = 1.5f;
+ _player.attackspd = 1.5f;
- player.sword = 1;
- player.level = 1;
- player.maxlevel = 22;
- player.nextlevel = 50;
- player.shield = 1;
- player.armour = 1;
- player.hp = 14;
- player.maxhp = player.hp;
+ _player.sword = 1;
+ _player.level = 1;
+ _player.maxlevel = 22;
+ _player.nextlevel = 50;
+ _player.shield = 1;
+ _player.armour = 1;
+ _player.hp = 14;
+ _player.maxhp = _player.hp;
- player.sworddamage = player.level * 2;
- player.spelldamage = player.level * 3 / 2;
+ _player.sworddamage = _player.level * 2;
+ _player.spelldamage = _player.level * 3 / 2;
- player.px = 15 * 16 - 4;
- player.py = 6 * 16 - 4;
- player.walkdir = 1;
+ _player.px = 15 * 16 - 4;
+ _player.py = 6 * 16 - 4;
+ _player.walkdir = 1;
pgardens = 0;
ptown = 0;
@@ -4793,14 +4793,14 @@ void GriffonEngine::game_processtrigger(int trignum) {
int tsx = triggers[trignum][5];
int tsy = triggers[trignum][6];
- player.px += (tx - tsx) * 16;
- player.py += (ty - tsy) * 16;
+ _player.px += (tx - tsx) * 16;
+ _player.py += (ty - tsy) * 16;
// HACKFIX
- if (player.px < 0)
- player.px = 0;
- if (player.py < 0)
- player.py = 0;
+ if (_player.px < 0)
+ _player.px = 0;
+ if (_player.py < 0)
+ _player.py = 0;
if (tmap > 0) {
if (menabled && config.effects) {
@@ -4861,18 +4861,18 @@ void GriffonEngine::game_saveloadnew() {
saveloadimg->blit(*_videobuffer);
- g_system->getEventManager()->pollEvent(event);
+ g_system->getEventManager()->pollEvent(_event);
- if (event.type == Common::EVENT_QUIT) {
+ if (_event.type == Common::EVENT_QUIT) {
_shouldQuit = true;
return;
}
if (tickpause < ticks) {
- if (event.type == Common::EVENT_KEYDOWN) {
+ if (_event.type == Common::EVENT_KEYDOWN) {
itemticks = ticks + 220;
- if (event.kbd.keycode == Common::KEYCODE_RETURN) {
+ if (_event.kbd.keycode == Common::KEYCODE_RETURN) {
// QUIT - non existent :)
if (currow == 0 && curcol == 4) {
_shouldQuit = true;
@@ -4914,10 +4914,10 @@ void GriffonEngine::game_saveloadnew() {
if (lowerlock == 1 && curcol == 2 && tickpause < ticks) {
if (state_load(currow - 1)) {
- player.walkspd = 1.1f;
- animspd = 0.5f;
+ _player.walkspd = 1.1f;
+ _animspd = 0.5f;
attacking = false;
- player.attackspd = 1.5f;
+ _player.attackspd = 1.5f;
pgardens = 0;
ptown = 0;
@@ -4929,7 +4929,7 @@ void GriffonEngine::game_saveloadnew() {
secsingame = 0;
saveslot = currow - 1;
- game_loadmap(curmap);
+ game_loadmap(_curmap);
game_playgame();
}
}
@@ -4937,7 +4937,7 @@ void GriffonEngine::game_saveloadnew() {
tickpause = ticks + 125;
}
- switch (event.kbd.keycode) {
+ switch (_event.kbd.keycode) {
case Common::KEYCODE_ESCAPE:
if (lowerlock == 0)
return;
@@ -4993,7 +4993,7 @@ void GriffonEngine::game_saveloadnew() {
for (int ff = 0; ff <= 3; ff++) {
state_load_player(ff);
- if (playera.level > 0) {
+ if (_playera.level > 0) {
char line[256];
int sx, sy, cc, ss, nx;
@@ -5014,44 +5014,44 @@ void GriffonEngine::game_saveloadnew() {
sy = sy + 11;
cc = 0;
- sprintf(line, "Health: %i/%i", playera.hp, playera.maxhp);
+ sprintf(line, "Health: %i/%i", _playera.hp, _playera.maxhp);
sys_print(_videobuffer, line, sx, sy, cc);
- if (playera.level == 22)
+ if (_playera.level == 22)
strcpy(line, "Level: MAX");
else
- sprintf(line, "Level: %i", playera.level);
+ sprintf(line, "Level: %i", _playera.level);
sys_print(_videobuffer, line, sx, sy + 11, 0);
rcSrc.left = sx + 15 * 8 + 24;
rcSrc.top = sy + 1;
- ss = (playera.sword - 1) * 3;
- if (playera.sword == 3)
+ ss = (_playera.sword - 1) * 3;
+ if (_playera.sword == 3)
ss = 18;
- itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
rcSrc.left = rcSrc.left + 16;
- ss = (playera.shield - 1) * 3 + 1;
- if (playera.shield == 3)
+ ss = (_playera.shield - 1) * 3 + 1;
+ if (_playera.shield == 3)
ss = 19;
- itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
rcSrc.left = rcSrc.left + 16;
- ss = (playera.armour - 1) * 3 + 2;
- if (playera.armour == 3)
+ ss = (_playera.armour - 1) * 3 + 2;
+ if (_playera.armour == 3)
ss = 20;
- itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
nx = rcSrc.left + 13 + 3 * 8;
rcSrc.left = nx - 17;
- if (playera.foundspell[0] == 1) {
+ if (_playera.foundspell[0] == 1) {
for (int i = 0; i < 5; i++) {
rcSrc.left = rcSrc.left + 17;
- if (playera.foundspell[i] == 1)
- itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ if (_playera.foundspell[i] == 1)
+ _itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
}
}
} else {
@@ -5080,7 +5080,7 @@ void GriffonEngine::game_saveloadnew() {
rcDest.top = (float)(53 + (currow - 1) * 48);
}
- itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
+ _itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
if (lowerlock == 1) {
@@ -5093,7 +5093,7 @@ void GriffonEngine::game_saveloadnew() {
// CHECKME: Useless code? or temporary commented?
// rcDest.left = rcDest.left; // + 2 + 2 * sin(-3.14159 * 2 * itemyloc / 16)
- itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
+ _itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
}
int yy = 255;
@@ -5109,7 +5109,7 @@ void GriffonEngine::game_saveloadnew() {
g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
- g_system->getEventManager()->pollEvent(event);
+ g_system->getEventManager()->pollEvent(_event);
tickspassed = ticks;
ticks = g_system->getMillis();
@@ -5171,9 +5171,9 @@ void GriffonEngine::game_showlogos() {
g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
- g_system->getEventManager()->pollEvent(event);
+ g_system->getEventManager()->pollEvent(_event);
- if (event.type == Common::EVENT_QUIT)
+ if (_event.type == Common::EVENT_QUIT)
_shouldQuit = true;
tickspassed = ticks;
@@ -5210,7 +5210,7 @@ void GriffonEngine::game_swash() {
g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
- g_system->getEventManager()->pollEvent(event);
+ g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
tickspassed = ticks;
@@ -5253,7 +5253,7 @@ void GriffonEngine::game_swash() {
g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
- g_system->getEventManager()->pollEvent(event);
+ g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
tickspassed = ticks;
@@ -5293,7 +5293,7 @@ void GriffonEngine::game_theend() {
g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
- g_system->getEventManager()->pollEvent(event);
+ g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
tickspassed = ticks;
@@ -5387,7 +5387,7 @@ void GriffonEngine::game_title(int mode) {
rc.left = (float)(x - 16 - 4 * cos(3.14159 * 2 * itemyloc / 16));
rc.top = (float)(y - 4 + 16 * cursel);
- itemimg[15]->blit(*_videobuffer, rc.left, rc.top);
+ _itemimg[15]->blit(*_videobuffer, rc.left, rc.top);
float yf = 255.0;
if (ticks < ticks1 + 1000) {
@@ -5428,26 +5428,26 @@ void GriffonEngine::game_title(int mode) {
while (itemyloc >= 16)
itemyloc = itemyloc - 16;
- g_system->getEventManager()->pollEvent(event);
+ g_system->getEventManager()->pollEvent(_event);
- if (event.type == Common::EVENT_QUIT)
+ if (_event.type == Common::EVENT_QUIT)
_shouldQuit = true;
if (keypause < ticks) {
- if (event.type == Common::EVENT_KEYDOWN) {
+ if (_event.type == Common::EVENT_KEYDOWN) {
keypause = ticks + 150;
- if (event.kbd.keycode == Common::KEYCODE_ESCAPE && mode == 1)
+ if (_event.kbd.keycode == Common::KEYCODE_ESCAPE && mode == 1)
break;
- else if (event.kbd.keycode == Common::KEYCODE_UP) {
+ else if (_event.kbd.keycode == Common::KEYCODE_UP) {
cursel--;
if (cursel < 0)
cursel = (mode == 1 ? 3 : 2);
- } else if (event.kbd.keycode == Common::KEYCODE_DOWN) {
+ } else if (_event.kbd.keycode == Common::KEYCODE_DOWN) {
cursel++;
if (cursel >= (mode == 1 ? 4 : 3))
cursel = 0;
- } else if (event.kbd.keycode == Common::KEYCODE_RETURN) {
+ } else if (_event.kbd.keycode == Common::KEYCODE_RETURN) {
if (cursel == 0) {
game_saveloadnew();
ticks = g_system->getMillis();
@@ -5483,13 +5483,13 @@ void GriffonEngine::game_title(int mode) {
void GriffonEngine::game_updanims() {
for (int i = 0; i <= lastobj; i++) {
int nframes = objectinfo[i][0];
- int oanimspd = objectinfo[i][3];
+ int o_animspd = objectinfo[i][3];
float frame = objectframe[i][0];
int cframe = objectframe[i][1];
// objectinfo[i][6] = 0; // ?? out of bounds
if (nframes > 1) {
- frame = frame + oanimspd / 50 * fpsr;
+ frame = frame + o_animspd / 50 * fpsr;
while (frame >= nframes)
frame = frame - nframes;
@@ -5509,10 +5509,10 @@ void GriffonEngine::game_updatey() {
for (int i = 0; i <= 2400; i++)
ysort[i] = -1;
- int ff = (int)(player.py * 10);
+ int ff = (int)(_player.py * 10);
if (ff < 0) // HACKFIX or ysort[yy] may go out of bounds
ff = 0;
- player.ysort = ff;
+ _player.ysort = ff;
ysort[ff] = 0;
firsty = 2400;
@@ -5540,8 +5540,8 @@ void GriffonEngine::game_updmusic() {
if (menabled && config.music) {
- // if(curmap > 5 && curmap < 42) iplaysound = macademy;
- // if(curmap > 47) iplaysound = _mgardens;
+ // if(_curmap > 5 && _curmap < 42) iplaysound = macademy;
+ // if(_curmap > 47) iplaysound = _mgardens;
iplaysound = _mgardens;
if (roomlock == 1)
iplaysound = _mboss;
@@ -5620,8 +5620,8 @@ void GriffonEngine::game_updnpcs() {
int mode = npcinfo[i].movementmode;
- float xdif = player.px - npx;
- float ydif = player.py - npy;
+ float xdif = _player.px - npx;
+ float ydif = _player.py - npy;
if (abs(xdif) < 4 * 16 && abs(ydif) < 4 * 16 && mode < 3)
mode = 0;
@@ -5648,8 +5648,8 @@ void GriffonEngine::game_updnpcs() {
if (mode == 0) {
wspd = npcinfo[i].walkspd / 2;
- xdif = player.px - npx;
- ydif = player.py - npy;
+ xdif = _player.px - npx;
+ ydif = _player.py - npy;
if (abs(xdif) > abs(ydif)) {
if (xdif < 4)
@@ -5726,8 +5726,8 @@ void GriffonEngine::game_updnpcs() {
if (mode == 3) {
wspd = npcinfo[i].walkspd / 2;
- xdif = player.px - npx;
- ydif = player.py - npy;
+ xdif = _player.px - npx;
+ ydif = _player.py - npy;
if (abs(xdif) > abs(ydif)) {
if (xdif < 4)
@@ -5998,8 +5998,8 @@ void GriffonEngine::game_updnpcs() {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
- xdif = player.px - npx;
- ydif = player.py - npy;
+ xdif = _player.px - npx;
+ ydif = _player.py - npy;
if (abs(xdif) < 20 && abs(ydif) < 20) {
npcinfo[i].attackattempt = ticks + 100;
@@ -6024,8 +6024,8 @@ void GriffonEngine::game_updnpcs() {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
- xdif = player.px - npx;
- ydif = player.py - npy;
+ xdif = _player.px - npx;
+ ydif = _player.py - npy;
if (abs(xdif) < 24 && abs(ydif) < 24) {
float dist = sqrt(xdif * xdif + ydif * ydif);
@@ -6039,8 +6039,8 @@ void GriffonEngine::game_updnpcs() {
npcinfo[i].attacking = 1;
npcinfo[i].attackframe = 0;
- npcinfo[i].headtargetx[0] = player.px + 12;
- npcinfo[i].headtargety[0] = player.py - 4;
+ npcinfo[i].headtargetx[0] = _player.px + 12;
+ npcinfo[i].headtargety[0] = _player.py - 4;
}
}
@@ -6105,11 +6105,11 @@ void GriffonEngine::game_updnpcs() {
npcinfo[i].attacking = 1;
npcinfo[i].attackframe = 0;
- game_castspell(1, npcinfo[i].x, npcinfo[i].y, player.px, player.py, i);
+ game_castspell(1, npcinfo[i].x, npcinfo[i].y, _player.px, _player.py, i);
}
if (npcinfo[i].castpause < ticks) {
- game_castspell(6, npcinfo[i].x, npcinfo[i].y, player.px, player.py, i);
+ game_castspell(6, npcinfo[i].x, npcinfo[i].y, _player.px, _player.py, i);
npcinfo[i].castpause = ticks + 12000;
}
}
@@ -6130,8 +6130,8 @@ void GriffonEngine::game_updnpcs() {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
- xdif = player.px - npx;
- ydif = player.py - npy;
+ xdif = _player.px - npx;
+ ydif = _player.py - npy;
if (abs(xdif) < 48 && abs(ydif) < 48) {
float dist = sqrt(xdif * xdif + ydif * ydif);
@@ -6146,8 +6146,8 @@ void GriffonEngine::game_updnpcs() {
npcinfo[i].attacking2[ff] = 1;
npcinfo[i].attackframe2[ff] = 0;
- npcinfo[i].headtargetx[ff] = player.px + 12;
- npcinfo[i].headtargety[ff] = player.py - 4;
+ npcinfo[i].headtargetx[ff] = _player.px + 12;
+ npcinfo[i].headtargety[ff] = _player.py - 4;
npcinfo[i].swayangle = 0;
}
@@ -6190,8 +6190,8 @@ void GriffonEngine::game_updnpcs() {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
- xdif = player.px - npx;
- ydif = player.py - npy;
+ xdif = _player.px - npx;
+ ydif = _player.py - npy;
pass = 0;
if (abs(xdif) < 48 && abs(ydif) < 6)
@@ -6240,11 +6240,11 @@ void GriffonEngine::game_updnpcs() {
npcinfo[i].attacking = 1;
npcinfo[i].attackframe = 0;
- game_castspell(9, npcinfo[i].x, npcinfo[i].y, player.px, player.py, i);
+ game_castspell(9, npcinfo[i].x, npcinfo[i].y, _player.px, _player.py, i);
}
if (npcinfo[i].castpause < ticks) {
- // game_castspell 6, npcinfo[i].x, npcinfo[i].y, player.px, player.py, i
+ // game_castspell 6, npcinfo[i].x, npcinfo[i].y, _player.px, _player.py, i
// npcinfo[i].castpause = ticks + 12000
}
@@ -6256,8 +6256,8 @@ void GriffonEngine::game_updnpcs() {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
- xdif = player.px - npx;
- ydif = player.py - npy;
+ xdif = _player.px - npx;
+ ydif = _player.py - npy;
pass = 0;
if (abs(xdif) < 56 && abs(ydif) < 6)
@@ -6310,8 +6310,8 @@ void GriffonEngine::game_updnpcs() {
npx = npcinfo[i].bodysection[7].x;
npy = npcinfo[i].bodysection[7].y;
- xdif = player.px - npx;
- ydif = player.py - npy;
+ xdif = _player.px - npx;
+ ydif = _player.py - npy;
if (abs(xdif) < 24 && abs(ydif) < 24) {
float dist = sqrt(xdif * xdif + ydif * ydif);
@@ -6325,8 +6325,8 @@ void GriffonEngine::game_updnpcs() {
npcinfo[i].attacking = 1;
npcinfo[i].attackframe = 0;
- npcinfo[i].headtargetx[0] = player.px + 12;
- npcinfo[i].headtargety[0] = player.py - 4;
+ npcinfo[i].headtargetx[0] = _player.px + 12;
+ npcinfo[i].headtargety[0] = _player.py - 4;
}
}
@@ -6385,8 +6385,8 @@ void GriffonEngine::game_updnpcs() {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
- xdif = player.px - npx;
- ydif = player.py - npy;
+ xdif = _player.px - npx;
+ ydif = _player.py - npy;
if (abs(xdif) < 32 && abs(ydif) < 32) {
npcinfo[i].attackattempt = ticks + 100;
@@ -6410,8 +6410,8 @@ void GriffonEngine::game_updnpcs() {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
- xdif = player.px - npx;
- ydif = player.py - npy;
+ xdif = _player.px - npx;
+ ydif = _player.py - npy;
if (abs(xdif) < 38 && abs(ydif) < 38) {
npcinfo[i].attackattempt = ticks + 100;
@@ -6473,19 +6473,19 @@ void GriffonEngine::game_updnpcs() {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
- float xdif = player.px - npx;
- float ydif = player.py - npy;
+ float xdif = _player.px - npx;
+ float ydif = _player.py - npy;
dist = 10;
- if (abs(xdif) < dist && abs(ydif) < dist && player.pause < ticks) {
+ if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < ticks) {
npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
// npcinfo[i].attackframe = 0;
// npcinfo[i].attacking = 0;
damage = (float)npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
- if (player.hp > 0)
+ if (_player.hp > 0)
game_damageplayer(damage);
}
}
@@ -6524,17 +6524,17 @@ void GriffonEngine::game_updnpcs() {
npx = npcinfo[i].bodysection[7].x;
npy = (npcinfo[i].bodysection[7].y + 16);
- xdif = (player.px + 12) - npx;
- ydif = (player.py + 12) - npy;
+ xdif = (_player.px + 12) - npx;
+ ydif = (_player.py + 12) - npy;
dist = 8;
- if (abs(xdif) < dist && abs(ydif) < dist && player.pause < ticks) {
+ if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < ticks) {
npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
// npcinfo[i].attackframe = 0
// npcinfo[i].attacking = 0
damage = (float)npcinfo[i].attackdamage * (1.0 + (RND() * 0.5));
- if (player.hp > 0)
+ if (_player.hp > 0)
game_damageplayer(damage);
}
}
@@ -6576,17 +6576,17 @@ void GriffonEngine::game_updnpcs() {
npx = npcinfo[i].bodysection[10 * ff + 9].x;
npy = (npcinfo[i].bodysection[10 * ff + 9].y + 16);
- xdif = (player.px + 12) - npx;
- ydif = (player.py + 12) - npy;
+ xdif = (_player.px + 12) - npx;
+ ydif = (_player.py + 12) - npy;
dist = 8;
- if (abs(xdif) < dist && abs(ydif) < dist && player.pause < ticks) {
+ if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < ticks) {
npcinfo[i].attacknext2[ff] = ticks + npcinfo[i].attackdelay;
// npcinfo[i].attackframe2(ff) = 0
// npcinfo[i].attacking2(ff) = 0
damage = (float)npcinfo[i].attackdamage * (1.0 + RND() * 0.5);
- if (player.hp > 0)
+ if (_player.hp > 0)
game_damageplayer(damage);
}
}
@@ -6629,17 +6629,17 @@ void GriffonEngine::game_updnpcs() {
npx = npcinfo[i].bodysection[7].x;
npy = (npcinfo[i].bodysection[7].y + 16);
- xdif = (player.px + 12) - npx;
- ydif = (player.py + 12) - npy;
+ xdif = (_player.px + 12) - npx;
+ ydif = (_player.py + 12) - npy;
dist = 8;
- if (abs(xdif) < dist && abs(ydif) < dist && player.pause < ticks) {
+ if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < ticks) {
npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
// npcinfo[i].attackframe = 0
// npcinfo[i].attacking = 0
damage = (float)npcinfo[i].attackdamage * (1.0 + RND() * 0.5);
- if (player.hp > 0)
+ if (_player.hp > 0)
game_damageplayer(damage);
}
}
@@ -6659,17 +6659,17 @@ void GriffonEngine::game_updnpcs() {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
- float xdif = player.px - npx;
- float ydif = player.py - npy;
+ float xdif = _player.px - npx;
+ float ydif = _player.py - npy;
dist = 16 + npcinfo[i].attackframe;
- if (abs(xdif) < dist && abs(ydif) < dist && player.pause < ticks) {
+ if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < ticks) {
npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
// npcinfo[i].attackframe = 0
// npcinfo[i].attacking = 0
damage = (float)npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
- if (player.hp > 0)
+ if (_player.hp > 0)
game_damageplayer(damage);
}
}
@@ -6688,17 +6688,17 @@ void GriffonEngine::game_updnpcs() {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
- float xdif = player.px - npx;
- float ydif = player.py - npy;
+ float xdif = _player.px - npx;
+ float ydif = _player.py - npy;
dist = 36;
- if (abs(xdif) < dist && abs(ydif) < dist && player.pause < ticks) {
+ if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < ticks) {
npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
// npcinfo[i].attackframe = 0
// npcinfo[i].attacking = 0
damage = (float)npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
- if (player.hp > 0)
+ if (_player.hp > 0)
game_damageplayer(damage);
}
}
@@ -6782,9 +6782,9 @@ void GriffonEngine::game_updspells() {
}
if (xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
- spellimg->setAlpha(alf, true);
- spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- spellimg->setAlpha(255, true);
+ _spellimg->setAlpha(alf, true);
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellimg->setAlpha(255, true);
if (spellinfo[i].damagewho == 0) {
for (int e = 1; e <= lastnpc; e++) {
@@ -6793,7 +6793,7 @@ void GriffonEngine::game_updspells() {
ydif = (yloc + 16) - (npcinfo[e].y + 12);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- float damage = (float)player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
+ float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
game_damagenpc(e, damage, 1);
@@ -6813,7 +6813,7 @@ void GriffonEngine::game_updspells() {
ydif = (yloc + 16) - (postinfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
rcSrc.left = postinfo[e][0] / 2;
@@ -6860,7 +6860,7 @@ void GriffonEngine::game_updspells() {
rcDest.left = xloc;
rcDest.top = yloc;
- spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
if (spellinfo[i].frame < 0)
@@ -6872,7 +6872,7 @@ void GriffonEngine::game_updspells() {
ydif = (yloc + 24) - (npcinfo[e].y + 12);
if ((abs(xdif) < 24 && abs(ydif) < 24)) {
- float damage = (float)player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
+ float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
game_damagenpc(e, damage, 1);
@@ -6908,16 +6908,16 @@ void GriffonEngine::game_updspells() {
}
// ---------------
- xdif = (xloc + 24) - (player.px + 12);
- ydif = (yloc + 24) - (player.py + 12);
+ xdif = (xloc + 24) - (_player.px + 12);
+ ydif = (yloc + 24) - (_player.py + 12);
- if ((abs(xdif) < 24 && abs(ydif) < 24) && player.pause < ticks) {
- npx = player.px;
- npy = player.py;
+ if ((abs(xdif) < 24 && abs(ydif) < 24) && _player.pause < ticks) {
+ npx = _player.px;
+ npy = _player.py;
float damage = (float)npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
- if (player.hp > 0) {
+ if (_player.hp > 0) {
game_damageplayer(damage);
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndmetalhit]);
@@ -6935,7 +6935,7 @@ void GriffonEngine::game_updspells() {
ydif = (yloc + 24) - (postinfo[e][1] + 8);
if ((abs(xdif) < 24 && abs(ydif) < 24)) {
- objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
rcSrc.left = postinfo[e][0] / 2;
@@ -6985,7 +6985,7 @@ void GriffonEngine::game_updspells() {
rcDest.top = yloc;
if (xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
- spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
if (scatter == 1) {
if (spellinfo[i].damagewho == 0) {
@@ -6994,7 +6994,7 @@ void GriffonEngine::game_updspells() {
ydif = (yloc + 16) - (npcinfo[e].y + 12);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- float damage = (float)player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
+ float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
game_damagenpc(e, damage, 1);
@@ -7015,7 +7015,7 @@ void GriffonEngine::game_updspells() {
ydif = (yloc + 16) - (postinfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
rcSrc.left = postinfo[e][0] / 2;
@@ -7055,8 +7055,8 @@ void GriffonEngine::game_updspells() {
rcSrc.setWidth(32);
rcSrc.setHeight(64);
- rcDest.left = player.px - 4;
- rcDest.top = player.py + 16 - 48;
+ rcDest.left = _player.px - 4;
+ rcDest.top = _player.py + 16 - 48;
int f = 160;
if (fra < 8)
@@ -7064,17 +7064,17 @@ void GriffonEngine::game_updspells() {
if (fra > 24)
f = 192 * (1 - (fra - 24) / 8);
- spellimg->setAlpha(f, true);
- spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- spellimg->setAlpha(255, true);
+ _spellimg->setAlpha(f, true);
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellimg->setAlpha(255, true);
spellinfo[i].frame = spellinfo[i].frame - 0.3 * fpsr;
if (spellinfo[i].frame < 0) {
spellinfo[i].frame = 0;
forcepause = false;
- npx = player.px + 12;
- npy = player.py + 20;
+ npx = _player.px + 12;
+ npy = _player.py + 20;
int lx = (int)npx / 16;
int ly = (int)npy / 16;
@@ -7122,9 +7122,9 @@ void GriffonEngine::game_updspells() {
strcpy(line, "Found... nothing...");
for (int f1 = 0; f1 < 5; f1++) {
- if (foundel[f1] == 1 && player.foundspell[f1] == 0) {
- player.foundspell[f1] = 1;
- player.spellcharge[f1] = 0;
+ if (foundel[f1] == 1 && _player.foundspell[f1] == 0) {
+ _player.foundspell[f1] = 1;
+ _player.spellcharge[f1] = 0;
if (f1 == 1)
strcpy(line, "Found... Water Essence");
if (f1 == 2)
@@ -7147,7 +7147,7 @@ void GriffonEngine::game_updspells() {
if (spellinfo[i].frame > 16) {
float fr = (32 - spellinfo[i].frame);
- spellimg->setAlpha(192 * sin(3.14159 * fr / 4), true);
+ _spellimg->setAlpha(192 * sin(3.14159 * fr / 4), true);
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -7162,12 +7162,12 @@ void GriffonEngine::game_updspells() {
rcDest.left = xloc;
rcDest.top = yloc;
- spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
- spellimg->setAlpha(255, true);
+ _spellimg->setAlpha(255, true);
} else {
- spellimg->setAlpha(192, true);
+ _spellimg->setAlpha(192, true);
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -7177,8 +7177,8 @@ void GriffonEngine::game_updspells() {
for (int ff = 0; ff <= spellinfo[i].nfballs - 1; ff++) {
float ax = spellinfo[i].fireballs[ff][0];
float ay = spellinfo[i].fireballs[ff][1];
- float bx = player.px + 4;
- float by = player.py + 4;
+ float bx = _player.px + 4;
+ float by = _player.py + 4;
float d = sqrt((bx - ax) * (bx - ax) + (by - ay) * (by - ay));
float tx = (bx - ax) / d;
@@ -7197,14 +7197,14 @@ void GriffonEngine::game_updspells() {
rcDest.left = xloc;
rcDest.top = yloc;
- spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
if (xloc < -1 || yloc < -1 || xloc > 304 || yloc > 224)
spellinfo[i].ballon[ff] = 0;
}
- spellimg->setAlpha(255, true);
+ _spellimg->setAlpha(255, true);
}
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
@@ -7217,13 +7217,13 @@ void GriffonEngine::game_updspells() {
xloc = spellinfo[i].fireballs[ff][0] + (int)(RND() * 3) - 1;
yloc = spellinfo[i].fireballs[ff][1] + (int)(RND() * 3) - 1;
- xdif = (xloc + 8) - (player.px + 12);
- ydif = (yloc + 8) - (player.py + 12);
+ xdif = (xloc + 8) - (_player.px + 12);
+ ydif = (yloc + 8) - (_player.py + 12);
- if ((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks) {
+ if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < ticks) {
float damage = npcinfo[spellinfo[i].npc].spelldamage * (1 + RND() * 0.5) / 3;
- if (player.hp > 0)
+ if (_player.hp > 0)
game_damageplayer(damage);
if (menabled && config.effects) {
@@ -7243,8 +7243,8 @@ void GriffonEngine::game_updspells() {
cl2 = _videobuffer->format.RGBToColor(142, 173, 191);
cl3 = _videobuffer->format.RGBToColor(240, 240, 240);
- float px = player.px + 12;
- float py = player.py + 12;
+ float px = _player.px + 12;
+ float py = _player.py + 12;
int apx = px + (int)(RND() * 5 - 2);
int apy = py + (int)(RND() * 5 - 2);
@@ -7292,7 +7292,7 @@ void GriffonEngine::game_updspells() {
ydif = (yloc + 16) - (postinfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
rcSrc.left = postinfo[e][0] / 2;
@@ -7350,7 +7350,7 @@ void GriffonEngine::game_updspells() {
ydif = (yloc + 16) - (postinfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
rcSrc.left = postinfo[e][0] / 2;
@@ -7407,7 +7407,7 @@ void GriffonEngine::game_updspells() {
ydif = (yloc + 16) - (postinfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
rcSrc.left = postinfo[e][0] / 2;
@@ -7464,7 +7464,7 @@ void GriffonEngine::game_updspells() {
ydif = (yloc + 16) - (postinfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
rcSrc.left = postinfo[e][0] / 2;
@@ -7524,11 +7524,11 @@ void GriffonEngine::game_updspells() {
if (spellinfo[i].damagewho == 1) {
- xdif = (x + 8) - (player.px + 12);
- ydif = (y + 8) - (player.py + 12);
+ xdif = (x + 8) - (_player.px + 12);
+ ydif = (y + 8) - (_player.py + 12);
- if ((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks) {
- float damage = ((float)player.hp * 0.75) * (RND() * 0.5 + 0.5);
+ if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < ticks) {
+ float damage = ((float)_player.hp * 0.75) * (RND() * 0.5 + 0.5);
if (damage < 5)
damage = 5;
@@ -7537,7 +7537,7 @@ void GriffonEngine::game_updspells() {
damage = 40 + (int)(RND() * 40);
}
- if (player.hp > 0)
+ if (_player.hp > 0)
game_damageplayer(damage);
}
}
@@ -7585,9 +7585,9 @@ void GriffonEngine::game_updspellsunder() {
if (fra > 24)
f = 160 * (1 - (fra - 24) / 8);
- spellimg->setAlpha(f, true);
- spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- spellimg->setAlpha(255, true);
+ _spellimg->setAlpha(f, true);
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellimg->setAlpha(255, true);
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
if (spellinfo[i].frame < 0)
@@ -7674,7 +7674,7 @@ void GriffonEngine::game_updspellsunder() {
for (int f = 0; f <= 4; f++) {
for (int x = 0; x <= fra; x += 2) {
if (spellinfo[i].legalive[f] >= x) {
- spellimg->setAlpha(192 * sin(3.14159 * x / 32) * s / 8, true);
+ _spellimg->setAlpha(192 * sin(3.14159 * x / 32) * s / 8, true);
float an = 360 / 5 * f + x / 32 * 180;
@@ -7689,7 +7689,7 @@ void GriffonEngine::game_updspellsunder() {
rcDest.top = (int)yloc;
if (xloc > -1 && xloc < 304 && yloc > -1 && yloc < 224) {
- spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
int sx = (xloc / 2 + 4);
int sy = (yloc / 2 + 8);
@@ -7706,7 +7706,7 @@ void GriffonEngine::game_updspellsunder() {
float ydif = (yloc + 8) - (npcinfo[e].y + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
- float damage = (float)player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
+ float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
if (npcinfo[e].spriteset == 5)
damage = -damage;
@@ -7724,13 +7724,13 @@ void GriffonEngine::game_updspellsunder() {
}
if (spellinfo[i].damagewho == 1) {
- float xdif = (xloc + 8) - (player.px + 12);
- float ydif = (yloc + 8) - (player.py + 12);
+ float xdif = (xloc + 8) - (_player.px + 12);
+ float ydif = (yloc + 8) - (_player.py + 12);
- if ((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks) {
+ if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < ticks) {
float damage = (float)npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
- if (player.hp > 0) {
+ if (_player.hp > 0) {
game_damageplayer(damage);
if (menabled && config.effects) {
@@ -7748,7 +7748,7 @@ void GriffonEngine::game_updspellsunder() {
float ydif = (yloc + 8) - (postinfo[e][1] + 8);
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
- objmapf[curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
rcSrc.left = postinfo[e][0] / 2;
@@ -7772,7 +7772,7 @@ void GriffonEngine::game_updspellsunder() {
}
}
- spellimg->setAlpha(255, true);
+ _spellimg->setAlpha(255, true);
spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
if (spellinfo[i].frame < 0)
@@ -7804,7 +7804,7 @@ void GriffonEngine::game_updspellsunder() {
if (alpha > 255)
alpha = 255;
- spellimg->setAlpha(alpha, true);
+ _spellimg->setAlpha(alpha, true);
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -7818,16 +7818,16 @@ void GriffonEngine::game_updspellsunder() {
rcDest.top = yloc;
if (xloc > -16 && xloc < 320 && yloc > -16 && yloc < 240) {
- spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
if (spellinfo[i].damagewho == 1) {
- float xdif = (xloc + 8) - (player.px + 12);
- float ydif = (yloc + 8) - (player.py + 12);
+ float xdif = (xloc + 8) - (_player.px + 12);
+ float ydif = (yloc + 8) - (_player.py + 12);
- if ((abs(xdif) < 8 && abs(ydif) < 8) && player.pause < ticks && alpha > 64) {
+ if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < ticks && alpha > 64) {
float damage = (float)npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
- if (player.hp > 0) {
+ if (_player.hp > 0) {
game_damageplayer(damage);
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndfire]);
@@ -7842,7 +7842,7 @@ void GriffonEngine::game_updspellsunder() {
}
- spellimg->setAlpha(255, true);
+ _spellimg->setAlpha(255, true);
spellinfo[i].frame = spellinfo[i].frame - 0.5 * fpsr;
if (spellinfo[i].frame < 0)
spellinfo[i].frame = 0;
@@ -7911,17 +7911,17 @@ void GriffonEngine::sys_initialize() {
nextticks = ticks + 1000;
for (int i = 0; i <= 15; i++) {
- playerattackofs[0][i][0] = 0; // -1// -(i + 1)
- playerattackofs[0][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2 - 1;
+ _playerattackofs[0][i][0] = 0; // -1// -(i + 1)
+ _playerattackofs[0][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2 - 1;
- playerattackofs[1][i][0] = 0; // i + 1
- playerattackofs[1][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2 + 1;
+ _playerattackofs[1][i][0] = 0; // i + 1
+ _playerattackofs[1][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2 + 1;
- playerattackofs[2][i][0] = -1; // -(i + 1)
- playerattackofs[2][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2;
+ _playerattackofs[2][i][0] = -1; // -(i + 1)
+ _playerattackofs[2][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2;
- playerattackofs[3][i][0] = 1; // i + 1
- playerattackofs[3][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2;
+ _playerattackofs[3][i][0] = 1; // i + 1
+ _playerattackofs[3][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2;
}
sys_setupAudio();
@@ -7947,7 +7947,7 @@ void GriffonEngine::sys_line(Graphics::TransparentSurface *buffer, int x1, int y
}
void GriffonEngine::sys_LoadAnims() {
- spellimg = IMG_Load("art/spells.bmp", true);
+ _spellimg = IMG_Load("art/spells.bmp", true);
anims[0] = IMG_Load("art/anims0.bmp", true);
animsa[0] = IMG_Load("art/anims0a.bmp", true);
anims[13] = IMG_Load("art/anims0x.bmp", true);
@@ -8061,15 +8061,15 @@ void GriffonEngine::sys_LoadItemImgs() {
Graphics::TransparentSurface *temp = IMG_Load("art/icons.bmp", true);
for (int i = 0; i <= 20; i++) {
- itemimg[i] = new Graphics::TransparentSurface;
- itemimg[i]->create(16, 16, g_system->getScreenFormat());
+ _itemimg[i] = new Graphics::TransparentSurface;
+ _itemimg[i]->create(16, 16, g_system->getScreenFormat());
rcSrc.left = i * 16;
rcSrc.top = 0;
rcSrc.setWidth(16);
rcSrc.setHeight(16);
- temp->blit(*itemimg[i], 0, 0, Graphics::FLIP_NONE, &rcSrc);
+ temp->blit(*_itemimg[i], 0, 0, Graphics::FLIP_NONE, &rcSrc);
}
temp->free();
@@ -8082,8 +8082,8 @@ void GriffonEngine::sys_LoadFont() {
for (int f = 0; f <= 4; f++) {
int i2 = i - 32;
- fontchr[i2][f] = new Graphics::TransparentSurface;
- fontchr[i2][f]->create(8, 8, g_system->getScreenFormat());
+ _fontchr[i2][f] = new Graphics::TransparentSurface;
+ _fontchr[i2][f]->create(8, 8, g_system->getScreenFormat());
int col = i2 % 40;
@@ -8096,7 +8096,7 @@ void GriffonEngine::sys_LoadFont() {
rcDest.left = 0;
rcDest.top = 0;
- font->blit(*fontchr[i2][f], rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ font->blit(*_fontchr[i2][f], rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
font->free();
@@ -8108,7 +8108,7 @@ void GriffonEngine::sys_LoadTiles() {
tiles[2] = IMG_Load("art/tx2.bmp", true);
tiles[3] = IMG_Load("art/tx3.bmp", true);
- windowimg = IMG_Load("art/window.bmp", true);
+ _windowimg = IMG_Load("art/window.bmp", true);
}
void GriffonEngine::sys_LoadTriggers() {
@@ -8155,7 +8155,7 @@ void GriffonEngine::sys_print(Graphics::TransparentSurface *buffer, const char *
rcDest.left = xloc + i * 8;
rcDest.top = yloc;
- fontchr[stri[i] - 32][col]->blit(*buffer, rcDest.left, rcDest.top);
+ _fontchr[stri[i] - 32][col]->blit(*buffer, rcDest.left, rcDest.top);
}
}
@@ -8168,7 +8168,7 @@ void GriffonEngine::sys_progress(int w, int wm) {
g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
- g_system->getEventManager()->pollEvent(event);
+ g_system->getEventManager()->pollEvent(_event);
}
void GriffonEngine::sys_setupAudio() {
@@ -8253,7 +8253,7 @@ void GriffonEngine::sys_setupAudio() {
void GriffonEngine::sys_update() {
g_system->updateScreen();
- g_system->getEventManager()->pollEvent(event);
+ g_system->getEventManager()->pollEvent(_event);
tickspassed = ticks;
ticks = g_system->getMillis();
@@ -8270,38 +8270,38 @@ void GriffonEngine::sys_update() {
}
if (attacking) {
- player.attackframe += player.attackspd * fpsr;
- if (player.attackframe >= 16) {
+ _player.attackframe += _player.attackspd * fpsr;
+ if (_player.attackframe >= 16) {
attacking = false;
- player.attackframe = 0;
- player.walkframe = 0;
+ _player.attackframe = 0;
+ _player.walkframe = 0;
}
- int pa = (int)(player.attackframe);
+ int pa = (int)(_player.attackframe);
for (int i = 0; i <= pa; i++) {
- if (ABS(playerattackofs[player.walkdir][i][2]) < kEpsilon) {
- playerattackofs[player.walkdir][i][2] = 1;
+ if (ABS(_playerattackofs[_player.walkdir][i][2]) < kEpsilon) {
+ _playerattackofs[_player.walkdir][i][2] = 1;
- float opx = player.px;
- float opy = player.py;
+ float opx = _player.px;
+ float opy = _player.py;
- player.px = player.px + playerattackofs[player.walkdir][i][0];
- player.py = player.py + playerattackofs[player.walkdir][i][1];
+ _player.px = _player.px + _playerattackofs[_player.walkdir][i][0];
+ _player.py = _player.py + _playerattackofs[_player.walkdir][i][1];
- int sx = (int)(player.px / 2 + 6);
- int sy = (int)(player.py / 2 + 10);
+ int sx = (int)(_player.px / 2 + 6);
+ int sy = (int)(_player.py / 2 + 10);
uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
uint32 bgc = *temp;
if (bgc > 0) {
- player.px = opx;
- player.py = opy;
+ _player.px = opx;
+ _player.py = opy;
}
}
}
- player.opx = player.px;
- player.opy = player.py;
+ _player.opx = _player.px;
+ _player.opy = _player.py;
game_checkhit();
}
@@ -8324,21 +8324,21 @@ void GriffonEngine::sys_update() {
}
}
- if (player.level == player.maxlevel)
- player.exp = 0;
+ if (_player.level == _player.maxlevel)
+ _player.exp = 0;
- if (player.exp >= player.nextlevel) {
- player.level = player.level + 1;
- game_addFloatText("LEVEL UP!", player.px + 16 - 36, player.py + 16, 3);
- player.exp = player.exp - player.nextlevel;
- player.nextlevel = player.nextlevel * 3 / 2; // 1.5
- player.maxhp = player.maxhp + player.level * 3;
- if (player.maxhp > 999)
- player.maxhp = 999;
- player.hp = player.maxhp;
+ if (_player.exp >= _player.nextlevel) {
+ _player.level = _player.level + 1;
+ game_addFloatText("LEVEL UP!", _player.px + 16 - 36, _player.py + 16, 3);
+ _player.exp = _player.exp - _player.nextlevel;
+ _player.nextlevel = _player.nextlevel * 3 / 2; // 1.5
+ _player.maxhp = _player.maxhp + _player.level * 3;
+ if (_player.maxhp > 999)
+ _player.maxhp = 999;
+ _player.hp = _player.maxhp;
- player.sworddamage = player.level * 14 / 10;
- player.spelldamage = player.level * 13 / 10;
+ _player.sworddamage = _player.level * 14 / 10;
+ _player.spelldamage = _player.level * 13 / 10;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
@@ -8350,8 +8350,8 @@ void GriffonEngine::sys_update() {
Common::Rect rc;
- rc.left = player.px - 2;
- rc.top = player.py - 2;
+ rc.left = _player.px - 2;
+ rc.top = _player.py - 2;
rc.setWidth(5);
rc.setHeight(5);
@@ -8359,30 +8359,30 @@ void GriffonEngine::sys_update() {
if (!forcepause) {
for (int i = 0; i < 5; i++) {
- if (player.foundspell[i] == 1)
- player.spellcharge[i] += 1 * player.level * 0.01 * fpsr;
- if (player.spellcharge[i] > 100)
- player.spellcharge[i] = 100;
+ if (_player.foundspell[i] == 1)
+ _player.spellcharge[i] += 1 * _player.level * 0.01 * fpsr;
+ if (_player.spellcharge[i] > 100)
+ _player.spellcharge[i] = 100;
}
- if (player.foundspell[0]) {
- player.spellstrength += 3 * player.level * .01 * fpsr;
+ if (_player.foundspell[0]) {
+ _player.spellstrength += 3 * _player.level * .01 * fpsr;
}
- player.attackstrength += (30 + 3 * (float)player.level) / 50 * fpsr;
+ _player.attackstrength += (30 + 3 * (float)_player.level) / 50 * fpsr;
}
- if (player.attackstrength > 100)
- player.attackstrength = 100;
+ if (_player.attackstrength > 100)
+ _player.attackstrength = 100;
- if (player.spellstrength > 100)
- player.spellstrength = 100;
+ if (_player.spellstrength > 100)
+ _player.spellstrength = 100;
itemyloc += 0.75 * fpsr;
while (itemyloc >= 16)
itemyloc -= 16;
- if (player.hp <= 0)
+ if (_player.hp <= 0)
game_theend();
if (roomlock == 1) {
@@ -8396,13 +8396,13 @@ void GriffonEngine::sys_update() {
while (clouddeg >= 360)
clouddeg = clouddeg - 360;
- player.hpflash = player.hpflash + 0.1 * fpsr;
- if (player.hpflash >= 2) {
- player.hpflash = 0;
- player.hpflashb = player.hpflashb + 1;
- if (player.hpflashb == 2)
- player.hpflashb = 0;
- if (menabled && config.effects && player.hpflashb == 0 && player.hp < player.maxhp / 4) {
+ _player.hpflash = _player.hpflash + 0.1 * fpsr;
+ if (_player.hpflash >= 2) {
+ _player.hpflash = 0;
+ _player.hpflashb = _player.hpflashb + 1;
+ if (_player.hpflashb == 2)
+ _player.hpflashb = 0;
+ if (menabled && config.effects && _player.hpflashb == 0 && _player.hp < _player.maxhp / 4) {
int snd = Mix_PlayChannel(sfx[sndbeep]);
Mix_Volume(snd, config.effectsvol);
}
@@ -8411,13 +8411,13 @@ void GriffonEngine::sys_update() {
// cloudson = 0
if (itemselon == 1)
- player.itemselshade = player.itemselshade + 2 * fpsr;
- if (player.itemselshade > 24)
- player.itemselshade = 24;
+ _player.itemselshade = _player.itemselshade + 2 * fpsr;
+ if (_player.itemselshade > 24)
+ _player.itemselshade = 24;
for (int i = 0; i <= 4; i++)
- if (player.inventory[i] > 9)
- player.inventory[i] = 9;
+ if (_player.inventory[i] > 9)
+ _player.inventory[i] = 9;
}
} // end of namespace Griffon
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index fff83cf..7a6f9a6 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -56,11 +56,11 @@ class Console;
#define kMaxSpell 32
// spells
-#define ice 0
-#define steel 1
-#define wood 2
-#define rock 3
-#define fire 4
+#define kSpellIce 0
+#define kSpellSteel 1
+#define kSpellWood 2
+#define kSpellRock 3
+#define kSpellFire 4
// inventory items
#define INV_FLASK 0
@@ -322,19 +322,19 @@ private:
// system
Graphics::TransparentSurface *_titleimg, *_titleimg2, *_inventoryimg;
Graphics::TransparentSurface *_logosimg, *_theendimg;
- Common::Event event;
+ Common::Event _event;
Graphics::TransparentSurface *_mapbg, *_clipbg, *_clipbg2;
unsigned int _clipsurround[4][4];
int fullscreen;
- float animspd; // CHECKME: it seems to always be 0.5
- int rampdata[40][24];
+ float _animspd; // CHECKME: it seems to always be 0.5
+ int _rampdata[40][24];
- int curmap;
- Graphics::TransparentSurface *fontchr[224][5]; // 256 - 32
- Graphics::TransparentSurface *itemimg[21], *windowimg;
- Graphics::TransparentSurface *spellimg;
+ int _curmap;
+ Graphics::TransparentSurface *_fontchr[224][5]; // 256 - 32
+ Graphics::TransparentSurface *_itemimg[21], *_windowimg;
+ Graphics::TransparentSurface *_spellimg;
int itemselon, curitem, itemticks;
float itemyloc;
@@ -373,9 +373,9 @@ private:
// player info
int movingup, movingdown, movingleft, movingright;
- PLAYERTYPE player;
+ PLAYERTYPE _player;
bool attacking;
- PLAYERTYPE playera;
+ PLAYERTYPE _playera;
int asecstart;
// tile info
@@ -387,7 +387,7 @@ private:
// id number 0&1 = players
Graphics::TransparentSurface *animsa[100];
// attack anims
- float playerattackofs[4][16][3];
+ float _playerattackofs[4][16][3];
// [dir] [frame] [x,y ofs, completed(0/1)]
float floattext[kMaxFloat][4]; // [id] [framesleft, x, y, col]
diff --git a/engines/griffon/saveload.cpp b/engines/griffon/saveload.cpp
index 54f3413..55e2d75 100644
--- a/engines/griffon/saveload.cpp
+++ b/engines/griffon/saveload.cpp
@@ -40,8 +40,6 @@
namespace Griffon {
-char player_sav[256] = "data/player%i.sav";
-
#define PRINT(A,B) \
do { \
char line[256]; \
@@ -56,10 +54,6 @@ char player_sav[256] = "data/player%i.sav";
sscanf(line.c_str(), A, B); \
} while(0)
-// externs (to be removed later)
-extern PLAYERTYPE playera;
-extern int asecstart;
-
Common::String GriffonEngine::makeSaveGameName(int slot) {
return (_targetName + Common::String::format(".%02d", slot));
}
@@ -70,49 +64,49 @@ int GriffonEngine::state_load(int slotnum) {
if (!(file = _saveFileMan->openForLoading(filename)))
return 0;
- INPUT("%i", &player.level);
+ INPUT("%i", &_player.level);
- if (player.level > 0) {
+ if (_player.level > 0) {
char temp[256];
INPUT("%i", &secstart);
INPUT("%s", temp);
- INPUT("%f", &player.px);
- INPUT("%f", &player.py);
- INPUT("%f", &player.opx);
- INPUT("%f", &player.opy);
- INPUT("%i", &player.walkdir);
- INPUT("%f", &player.walkframe);
- INPUT("%f", &player.walkspd);
- INPUT("%f", &player.attackframe);
- INPUT("%f", &player.attackspd);
- INPUT("%i", &player.hp);
- INPUT("%i", &player.maxhp);
- INPUT("%f", &player.hpflash);
- INPUT("%i", &player.level);
- INPUT("%i", &player.maxlevel);
- INPUT("%i", &player.sword);
- INPUT("%i", &player.shield);
- INPUT("%i", &player.armour);
+ INPUT("%f", &_player.px);
+ INPUT("%f", &_player.py);
+ INPUT("%f", &_player.opx);
+ INPUT("%f", &_player.opy);
+ INPUT("%i", &_player.walkdir);
+ INPUT("%f", &_player.walkframe);
+ INPUT("%f", &_player.walkspd);
+ INPUT("%f", &_player.attackframe);
+ INPUT("%f", &_player.attackspd);
+ INPUT("%i", &_player.hp);
+ INPUT("%i", &_player.maxhp);
+ INPUT("%f", &_player.hpflash);
+ INPUT("%i", &_player.level);
+ INPUT("%i", &_player.maxlevel);
+ INPUT("%i", &_player.sword);
+ INPUT("%i", &_player.shield);
+ INPUT("%i", &_player.armour);
for (int i = 0; i < 5; i++) {
- INPUT("%i", &player.foundspell[i]);
- INPUT("%f", &player.spellcharge[i]);
+ INPUT("%i", &_player.foundspell[i]);
+ INPUT("%f", &_player.spellcharge[i]);
}
for (int a = 0; a < 5; a++) {
- INPUT("%i", &player.inventory[a]);
+ INPUT("%i", &_player.inventory[a]);
}
- INPUT("%f", &player.attackstrength);
- INPUT("%i", &player.spelldamage);
- INPUT("%i", &player.sworddamage);
- INPUT("%i", &player.exp);
- INPUT("%i", &player.nextlevel);
+ INPUT("%f", &_player.attackstrength);
+ INPUT("%i", &_player.spelldamage);
+ INPUT("%i", &_player.sworddamage);
+ INPUT("%i", &_player.exp);
+ INPUT("%i", &_player.nextlevel);
for (int a = 0; a <= 99; a++) {
for (int b = 0; b <= 9; b++) {
INPUT("%i", &scriptflag[a][b]);
}
}
- INPUT("%i", &curmap);
+ INPUT("%i", &_curmap);
for (int a = 0; a <= 999; a++) {
for (int b = 0; b <= 20; b++) {
@@ -126,7 +120,7 @@ int GriffonEngine::state_load(int slotnum) {
INPUT("%i", &roomlocks[a]);
}
- INPUT("%f", &player.spellstrength);
+ INPUT("%f", &_player.spellstrength);
return 1; // success
}
@@ -134,53 +128,53 @@ int GriffonEngine::state_load(int slotnum) {
return 0; // faliure
}
-/* fill PLAYERTYPE playera; */
+/* fill PLAYERTYPE _playera; */
int GriffonEngine::state_load_player(int slotnum) {
Common::String filename = makeSaveGameName(slotnum);
Common::InSaveFile *file;
- playera.level = 0;
+ _playera.level = 0;
if (!(file = _saveFileMan->openForLoading(filename)))
return 0;
- INPUT("%i", &playera.level);
+ INPUT("%i", &_playera.level);
- if (playera.level > 0) {
+ if (_playera.level > 0) {
char temp[256];
INPUT("%i", &asecstart);
INPUT("%s", temp);
- INPUT("%f", &playera.px);
- INPUT("%f", &playera.py);
- INPUT("%f", &playera.opx);
- INPUT("%f", &playera.opy);
- INPUT("%i", &playera.walkdir);
- INPUT("%f", &playera.walkframe);
- INPUT("%f", &playera.walkspd);
- INPUT("%f", &playera.attackframe);
- INPUT("%f", &playera.attackspd);
- INPUT("%i", &playera.hp);
- INPUT("%i", &playera.maxhp);
- INPUT("%f", &playera.hpflash);
- INPUT("%i", &playera.level);
- INPUT("%i", &playera.maxlevel);
- INPUT("%i", &playera.sword);
- INPUT("%i", &playera.shield);
- INPUT("%i", &playera.armour);
+ INPUT("%f", &_playera.px);
+ INPUT("%f", &_playera.py);
+ INPUT("%f", &_playera.opx);
+ INPUT("%f", &_playera.opy);
+ INPUT("%i", &_playera.walkdir);
+ INPUT("%f", &_playera.walkframe);
+ INPUT("%f", &_playera.walkspd);
+ INPUT("%f", &_playera.attackframe);
+ INPUT("%f", &_playera.attackspd);
+ INPUT("%i", &_playera.hp);
+ INPUT("%i", &_playera.maxhp);
+ INPUT("%f", &_playera.hpflash);
+ INPUT("%i", &_playera.level);
+ INPUT("%i", &_playera.maxlevel);
+ INPUT("%i", &_playera.sword);
+ INPUT("%i", &_playera.shield);
+ INPUT("%i", &_playera.armour);
for (int i = 0; i < 5; i++) {
- INPUT("%i", &playera.foundspell[i]);
- INPUT("%f", &playera.spellcharge[i]);
+ INPUT("%i", &_playera.foundspell[i]);
+ INPUT("%f", &_playera.spellcharge[i]);
}
for (int a = 0; a < 5; a++) {
- INPUT("%i", &playera.inventory[a]);
+ INPUT("%i", &_playera.inventory[a]);
}
- INPUT("%f", &playera.attackstrength);
- INPUT("%i", &playera.spelldamage);
- INPUT("%i", &playera.sworddamage);
- INPUT("%i", &playera.exp);
- INPUT("%i", &playera.nextlevel);
+ INPUT("%f", &_playera.attackstrength);
+ INPUT("%i", &_playera.spelldamage);
+ INPUT("%i", &_playera.sworddamage);
+ INPUT("%i", &_playera.exp);
+ INPUT("%i", &_playera.nextlevel);
return 1; // success
}
@@ -197,47 +191,47 @@ int GriffonEngine::state_save(int slotnum) {
return 0;
}
- PRINT("%i", player.level);
+ PRINT("%i", _player.level);
- if (player.level > 0) {
+ if (_player.level > 0) {
PRINT("%i", (secstart + secsingame));
PRINT("%s", "a");
- PRINT("%f", player.px);
- PRINT("%f", player.py);
- PRINT("%f", player.opx);
- PRINT("%f", player.opy);
- PRINT("%i", player.walkdir);
- PRINT("%f", player.walkframe);
- PRINT("%f", player.walkspd);
- PRINT("%f", player.attackframe);
- PRINT("%f", player.attackspd);
- PRINT("%i", player.hp);
- PRINT("%i", player.maxhp);
- PRINT("%f", player.hpflash);
- PRINT("%i", player.level);
- PRINT("%i", player.maxlevel);
- PRINT("%i", player.sword);
- PRINT("%i", player.shield);
- PRINT("%i", player.armour);
+ PRINT("%f", _player.px);
+ PRINT("%f", _player.py);
+ PRINT("%f", _player.opx);
+ PRINT("%f", _player.opy);
+ PRINT("%i", _player.walkdir);
+ PRINT("%f", _player.walkframe);
+ PRINT("%f", _player.walkspd);
+ PRINT("%f", _player.attackframe);
+ PRINT("%f", _player.attackspd);
+ PRINT("%i", _player.hp);
+ PRINT("%i", _player.maxhp);
+ PRINT("%f", _player.hpflash);
+ PRINT("%i", _player.level);
+ PRINT("%i", _player.maxlevel);
+ PRINT("%i", _player.sword);
+ PRINT("%i", _player.shield);
+ PRINT("%i", _player.armour);
for (int i = 0; i < 5; i++) {
- PRINT("%i", player.foundspell[i]);
- PRINT("%f", player.spellcharge[i]);
+ PRINT("%i", _player.foundspell[i]);
+ PRINT("%f", _player.spellcharge[i]);
}
for (int a = 0; a < 5; a++) {
- PRINT("%i", player.inventory[a]);
+ PRINT("%i", _player.inventory[a]);
}
- PRINT("%f", player.attackstrength);
- PRINT("%i", player.spelldamage);
- PRINT("%i", player.sworddamage);
- PRINT("%i", player.exp);
- PRINT("%i", player.nextlevel);
+ PRINT("%f", _player.attackstrength);
+ PRINT("%i", _player.spelldamage);
+ PRINT("%i", _player.sworddamage);
+ PRINT("%i", _player.exp);
+ PRINT("%i", _player.nextlevel);
for (int a = 0; a <= 99; a++) {
for (int b = 0; b <= 9; b++) {
PRINT("%i", scriptflag[a][b]);
}
}
- PRINT("%i", curmap);
+ PRINT("%i", _curmap);
for (int a = 0; a <= 999; a++) {
for (int b = 0; b <= 20; b++) {
@@ -251,7 +245,7 @@ int GriffonEngine::state_save(int slotnum) {
PRINT("%i", roomlocks[a]);
}
- PRINT("%f", player.spellstrength);
+ PRINT("%f", _player.spellstrength);
}
file->finalize();
Commit: bcbadaee948b026f45175774247eb60cfea051a3
https://github.com/scummvm/scummvm/commit/bcbadaee948b026f45175774247eb60cfea051a3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Variable renaming
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.h
engines/griffon/saveload.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 035f81e..a2e205d 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -426,7 +426,7 @@ void GriffonEngine::game_attack() {
objmap[lx][ly - 1] = 3;
game_eventtext("Found Flask!");
- itemticks = ticks + 215;
+ _itemticks = ticks + 215;
return;
}
@@ -437,7 +437,7 @@ void GriffonEngine::game_attack() {
}
game_eventtext("Cannot Carry any more Flasks!");
- itemticks = ticks + 215;
+ _itemticks = ticks + 215;
return;
}
@@ -446,14 +446,14 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(14, lx * 16, (ly - 1) * 16);
- itemticks = ticks + 215;
+ _itemticks = ticks + 215;
if (_curmap == 34)
- scriptflag[2][0] = 2;
+ _scriptflag[2][0] = 2;
if (_curmap == 62)
- scriptflag[8][0] = 2;
+ _scriptflag[8][0] = 2;
if (_curmap == 81)
- scriptflag[13][0] = 2;
+ _scriptflag[13][0] = 2;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
@@ -481,7 +481,7 @@ void GriffonEngine::game_attack() {
objmap[lx][ly - 1] = 3;
game_eventtext("Found the Infinite Crystal!");
- itemticks = ticks + 215;
+ _itemticks = ticks + 215;
return;
}
@@ -490,7 +490,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(4, lx * 16, (ly - 1) * 16);
- itemticks = ticks + 215;
+ _itemticks = ticks + 215;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
@@ -510,7 +510,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(3, lx * 16, (ly - 1) * 16);
- itemticks = ticks + 215;
+ _itemticks = ticks + 215;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
@@ -528,8 +528,8 @@ void GriffonEngine::game_attack() {
_player.inventory[INV_NORMALKEY]++;
for (int s = 20; s <= 23; s++) {
- if (scriptflag[s][0] == 1) {
- scriptflag[s][0] = 2;
+ if (_scriptflag[s][0] == 1) {
+ _scriptflag[s][0] = 2;
}
}
@@ -570,7 +570,7 @@ void GriffonEngine::game_attack() {
objmap[lx][ly - 1] = 3;
game_eventtext("Found Mega Flask!");
- itemticks = ticks + 215;
+ _itemticks = ticks + 215;
return;
}
@@ -581,7 +581,7 @@ void GriffonEngine::game_attack() {
}
game_eventtext("Cannot Carry any more Mega Flasks!");
- itemticks = ticks + 215;
+ _itemticks = ticks + 215;
return;
}
@@ -600,7 +600,7 @@ void GriffonEngine::game_attack() {
objmap[lx][ly - 1] = 3;
game_eventtext("Found Mega Flask!");
- itemticks = ticks + 215;
+ _itemticks = ticks + 215;
return;
}
@@ -611,7 +611,7 @@ void GriffonEngine::game_attack() {
}
game_eventtext("Cannot Carry any more Mega Flasks!");
- itemticks = ticks + 215;
+ _itemticks = ticks + 215;
return;
}
@@ -630,7 +630,7 @@ void GriffonEngine::game_attack() {
objmap[lx][ly - 1] = 3;
game_eventtext("Found Lightning Bomb!");
- itemticks = ticks + 215;
+ _itemticks = ticks + 215;
return;
}
@@ -641,7 +641,7 @@ void GriffonEngine::game_attack() {
}
game_eventtext("Cannot Carry any more Lightning Bombs!");
- itemticks = ticks + 215;
+ _itemticks = ticks + 215;
return;
}
@@ -659,20 +659,20 @@ void GriffonEngine::game_attack() {
objmap[lx][ly - 1] = 3;
game_eventtext("Found the Fidelis Mail!");
- itemticks = ticks + 215;
+ _itemticks = ticks + 215;
return;
}
if (oscript == 60) {
- if (_curmap == 58 && scriptflag[60][0] == 0) {
- scriptflag[60][0] = 1;
+ if (_curmap == 58 && _scriptflag[60][0] == 0) {
+ _scriptflag[60][0] = 1;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndlever]);
Mix_Volume(snd, config.effectsvol);
}
- } else if (_curmap == 58 && scriptflag[60][0] > 0) {
+ } else if (_curmap == 58 && _scriptflag[60][0] > 0) {
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[snddoor]);
Mix_Volume(snd, config.effectsvol);
@@ -681,14 +681,14 @@ void GriffonEngine::game_attack() {
game_eventtext("It's stuck!");
}
- if (_curmap == 54 && scriptflag[60][0] == 1) {
+ if (_curmap == 54 && _scriptflag[60][0] == 1) {
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndlever]);
Mix_Volume(snd, config.effectsvol);
}
- scriptflag[60][0] = 2;
- } else if (_curmap == 54 && scriptflag[60][0] > 1) {
+ _scriptflag[60][0] = 2;
+ } else if (_curmap == 54 && _scriptflag[60][0] > 1) {
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[snddoor]);
Mix_Volume(snd, config.effectsvol);
@@ -704,7 +704,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(18, lx * 16, (ly - 1) * 16);
- itemticks = ticks + 215;
+ _itemticks = ticks + 215;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
@@ -721,7 +721,7 @@ void GriffonEngine::game_attack() {
if (oscript == 16 && _player.shield < 3) {
_player.shield = 3;
game_addFloatIcon(19, lx * 16, (ly - 1) * 16);
- itemticks = ticks + 215;
+ _itemticks = ticks + 215;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
@@ -738,7 +738,7 @@ void GriffonEngine::game_attack() {
if (oscript == 17 && _player.armour < 3) {
_player.armour = 3;
game_addFloatIcon(20, lx * 16, (ly - 1) * 16);
- itemticks = ticks + 215;
+ _itemticks = ticks + 215;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
@@ -926,7 +926,7 @@ void GriffonEngine::game_checkinputs() {
}
}
- if (attacking || (forcepause && itemselon == 0))
+ if (attacking || (_forcepause && _itemselon == 0))
return;
if (_event.type == Common::EVENT_QUIT) {
@@ -936,18 +936,18 @@ void GriffonEngine::game_checkinputs() {
if (_event.type == Common::EVENT_KEYDOWN) {
if (_event.kbd.keycode == Common::KEYCODE_ESCAPE) {
- if (itemticks < ticks)
+ if (_itemticks < ticks)
game_title(1);
} else if (_event.kbd.keycode == Common::KEYCODE_d && _event.kbd.hasFlags(Common::KBD_CTRL)) {
_console->attach();
_event.type = Common::EVENT_INVALID;
} else if (_event.kbd.hasFlags(Common::KBD_CTRL)) {
- if (itemselon == 0 && itemticks < ticks)
+ if (_itemselon == 0 && _itemticks < ticks)
game_attack();
- if (itemselon == 1 && itemticks < ticks) {
- if (curitem == 0 && _player.inventory[INV_FLASK] > 0) {
- itemticks = ticks + ntickdelay;
+ if (_itemselon == 1 && _itemticks < ticks) {
+ if (_curitem == 0 && _player.inventory[INV_FLASK] > 0) {
+ _itemticks = ticks + ntickdelay;
int heal = 50;
int maxh = _player.maxhp - _player.hp;
@@ -968,12 +968,12 @@ void GriffonEngine::game_checkinputs() {
Mix_Volume(snd, config.effectsvol);
}
- itemselon = 0;
- forcepause = false;
+ _itemselon = 0;
+ _forcepause = false;
}
- if (curitem == 1 && _player.inventory[INV_DOUBLEFLASK] > 0) {
- itemticks = ticks + ntickdelay;
+ if (_curitem == 1 && _player.inventory[INV_DOUBLEFLASK] > 0) {
+ _itemticks = ticks + ntickdelay;
int heal = 200;
int maxh = _player.maxhp - _player.hp;
@@ -994,123 +994,123 @@ void GriffonEngine::game_checkinputs() {
Mix_Volume(snd, config.effectsvol);
}
- itemselon = 0;
- forcepause = false;
+ _itemselon = 0;
+ _forcepause = false;
}
- if (curitem == 2 && _player.inventory[INV_SHOCK] > 0) {
- game_castspell(8, _player.px, _player.py, npcinfo[curenemy].x, npcinfo[curenemy].y, 0);
+ if (_curitem == 2 && _player.inventory[INV_SHOCK] > 0) {
+ game_castspell(8, _player.px, _player.py, npcinfo[_curenemy].x, npcinfo[_curenemy].y, 0);
- forcepause = true;
+ _forcepause = true;
_player.inventory[INV_SHOCK]--;
- itemticks = ticks + ntickdelay;
- selenemyon = 0;
- itemselon = 0;
+ _itemticks = ticks + ntickdelay;
+ _selenemyon = 0;
+ _itemselon = 0;
}
- if (curitem == 3 && _player.inventory[INV_NORMALKEY] > 0 && canusekey == 1 && locktype == 1) {
- roomlocks[roomtounlock] = 0;
+ if (_curitem == 3 && _player.inventory[INV_NORMALKEY] > 0 && canusekey == 1 && locktype == 1) {
+ _roomlocks[roomtounlock] = 0;
game_eventtext("UnLocked!");
_player.inventory[INV_NORMALKEY]--;
- itemticks = ticks + ntickdelay;
- selenemyon = 0;
- itemselon = 0;
+ _itemticks = ticks + ntickdelay;
+ _selenemyon = 0;
+ _itemselon = 0;
return;
}
- if (curitem == 4 && _player.inventory[INV_MASTERKEY] > 0 && canusekey == 1 && locktype == 2) {
- roomlocks[roomtounlock] = 0;
+ if (_curitem == 4 && _player.inventory[INV_MASTERKEY] > 0 && canusekey == 1 && locktype == 2) {
+ _roomlocks[roomtounlock] = 0;
game_eventtext("UnLocked!");
_player.inventory[INV_MASTERKEY]--;
- itemticks = ticks + ntickdelay;
- selenemyon = 0;
- itemselon = 0;
+ _itemticks = ticks + ntickdelay;
+ _selenemyon = 0;
+ _itemselon = 0;
return;
}
- if (curitem == 5 && _player.spellcharge[0] == 100) {
- game_castspell(5, _player.px, _player.py, npcinfo[curenemy].x, npcinfo[curenemy].y, 0);
+ if (_curitem == 5 && _player.spellcharge[0] == 100) {
+ game_castspell(5, _player.px, _player.py, npcinfo[_curenemy].x, npcinfo[_curenemy].y, 0);
_player.spellcharge[0] = 0;
- forcepause = true;
+ _forcepause = true;
- itemticks = ticks + ntickdelay;
- selenemyon = 0;
- itemselon = 0;
+ _itemticks = ticks + ntickdelay;
+ _selenemyon = 0;
+ _itemselon = 0;
}
- if (curitem > 5 && selenemyon == 1) {
- if (curenemy <= lastnpc) {
- game_castspell(curitem - 6, _player.px, _player.py, npcinfo[curenemy].x, npcinfo[curenemy].y, 0);
+ if (_curitem > 5 && _selenemyon == 1) {
+ if (_curenemy <= lastnpc) {
+ game_castspell(_curitem - 6, _player.px, _player.py, npcinfo[_curenemy].x, npcinfo[_curenemy].y, 0);
} else {
- int pst = curenemy - lastnpc - 1;
- game_castspell(curitem - 6, _player.px, _player.py, postinfo[pst][0], postinfo[pst][1], 0);
+ int pst = _curenemy - lastnpc - 1;
+ game_castspell(_curitem - 6, _player.px, _player.py, postinfo[pst][0], postinfo[pst][1], 0);
}
- _player.spellcharge[curitem - 5] = 0;
+ _player.spellcharge[_curitem - 5] = 0;
_player.spellstrength = 0;
- itemticks = ticks + ntickdelay;
- selenemyon = 0;
- itemselon = 0;
- forcepause = false;
+ _itemticks = ticks + ntickdelay;
+ _selenemyon = 0;
+ _itemselon = 0;
+ _forcepause = false;
}
- if (curitem > 5 && selenemyon == 0 && itemselon == 1) {
- if (ABS(_player.spellcharge[curitem - 5] - 100) < kEpsilon) {
- itemticks = ticks + ntickdelay;
+ if (_curitem > 5 && _selenemyon == 0 && _itemselon == 1) {
+ if (ABS(_player.spellcharge[_curitem - 5] - 100) < kEpsilon) {
+ _itemticks = ticks + ntickdelay;
- selenemyon = 1;
+ _selenemyon = 1;
int i = 0;
do {
if (npcinfo[i].hp > 0) {
- curenemy = i;
+ _curenemy = i;
goto __exit_do;
}
i = i + 1;
if (i == lastnpc + 1) {
- selenemyon = 0;
+ _selenemyon = 0;
goto __exit_do;
}
} while (1);
__exit_do:
- if (nposts > 0 && selenemyon == 0) {
- selenemyon = 1;
- curenemy = lastnpc + 1;
+ if (nposts > 0 && _selenemyon == 0) {
+ _selenemyon = 1;
+ _curenemy = lastnpc + 1;
}
}
}
}
} else if (_event.kbd.hasFlags(Common::KBD_ALT)) {
- if (itemticks < ticks) {
- selenemyon = 0;
- if (itemselon == 1) {
- itemselon = 0;
- itemticks = ticks + 220;
- forcepause = false;
+ if (_itemticks < ticks) {
+ _selenemyon = 0;
+ if (_itemselon == 1) {
+ _itemselon = 0;
+ _itemticks = ticks + 220;
+ _forcepause = false;
} else {
- itemselon = 1;
- itemticks = ticks + 220;
- forcepause = true;
+ _itemselon = 1;
+ _itemticks = ticks + 220;
+ _forcepause = true;
_player.itemselshade = 0;
}
}
}
}
- if (itemselon == 0) {
+ if (_itemselon == 0) {
movingup = 0;
movingdown = 0;
movingleft = 0;
@@ -1129,76 +1129,76 @@ __exit_do:
movingleft = 0;
movingright = 0;
- if (selenemyon == 1) {
- if (itemticks < ticks) {
+ if (_selenemyon == 1) {
+ if (_itemticks < ticks) {
if (_event.kbd.keycode == Common::KEYCODE_LEFT) {
- int origin = curenemy;
+ int origin = _curenemy;
do {
- curenemy = curenemy - 1;
- if (curenemy < 1)
- curenemy = lastnpc + nposts;
- if (curenemy == origin)
+ _curenemy = _curenemy - 1;
+ if (_curenemy < 1)
+ _curenemy = lastnpc + nposts;
+ if (_curenemy == origin)
break;
- if (curenemy <= lastnpc && npcinfo[curenemy].hp > 0)
+ if (_curenemy <= lastnpc && npcinfo[_curenemy].hp > 0)
break;
- if (curenemy > lastnpc)
+ if (_curenemy > lastnpc)
break;
} while (1);
- itemticks = ticks + ntickdelay;
+ _itemticks = ticks + ntickdelay;
}
if (_event.kbd.keycode == Common::KEYCODE_RIGHT) {
- int origin = curenemy;
+ int origin = _curenemy;
do {
- curenemy = curenemy + 1;
- if (curenemy > lastnpc + nposts)
- curenemy = 1;
- if (curenemy == origin)
+ _curenemy = _curenemy + 1;
+ if (_curenemy > lastnpc + nposts)
+ _curenemy = 1;
+ if (_curenemy == origin)
break;
- if (curenemy <= lastnpc && npcinfo[curenemy].hp > 0)
+ if (_curenemy <= lastnpc && npcinfo[_curenemy].hp > 0)
break;
- if (curenemy > lastnpc)
+ if (_curenemy > lastnpc)
break;
} while (1);
- itemticks = ticks + ntickdelay;
+ _itemticks = ticks + ntickdelay;
}
- if (curenemy > lastnpc + nposts)
- curenemy = 1;
- if (curenemy < 1)
- curenemy = lastnpc + nposts;
+ if (_curenemy > lastnpc + nposts)
+ _curenemy = 1;
+ if (_curenemy < 1)
+ _curenemy = lastnpc + nposts;
}
} else {
- if (itemticks < ticks) {
+ if (_itemticks < ticks) {
if (_event.kbd.keycode == Common::KEYCODE_UP) {
- curitem = curitem - 1;
- itemticks = ticks + ntickdelay;
- if (curitem == 4)
- curitem = 9;
- if (curitem == -1)
- curitem = 4;
+ _curitem = _curitem - 1;
+ _itemticks = ticks + ntickdelay;
+ if (_curitem == 4)
+ _curitem = 9;
+ if (_curitem == -1)
+ _curitem = 4;
}
if (_event.kbd.keycode == Common::KEYCODE_DOWN) {
- curitem = curitem + 1;
- itemticks = ticks + ntickdelay;
- if (curitem == 5)
- curitem = 0;
- if (curitem == 10)
- curitem = 5;
+ _curitem = _curitem + 1;
+ _itemticks = ticks + ntickdelay;
+ if (_curitem == 5)
+ _curitem = 0;
+ if (_curitem == 10)
+ _curitem = 5;
}
if (_event.kbd.keycode == Common::KEYCODE_LEFT) {
- curitem = curitem - 5;
- itemticks = ticks + ntickdelay;
+ _curitem = _curitem - 5;
+ _itemticks = ticks + ntickdelay;
}
if (_event.kbd.keycode == Common::KEYCODE_RIGHT) {
- curitem = curitem + 5;
- itemticks = ticks + ntickdelay;
+ _curitem = _curitem + 5;
+ _itemticks = ticks + ntickdelay;
}
- if (curitem > 9)
- curitem = curitem - 10;
- if (curitem < 0)
- curitem = curitem + 10;
+ if (_curitem > 9)
+ _curitem = _curitem - 10;
+ if (_curitem < 0)
+ _curitem = _curitem + 10;
}
}
}
@@ -1358,7 +1358,7 @@ void GriffonEngine::game_configmenu() {
curselt += 1;
Common::Rect rc;
- rc.left = 148 + 3 * cos(3.14159 * 2 * itemyloc / 16.0);
+ rc.left = 148 + 3 * cos(3.14159 * 2 * _itemyloc / 16.0);
rc.top = sy + 8 * curselt - 4;
_itemimg[15]->blit(*_videobuffer, rc.left, rc.top);
@@ -1378,22 +1378,22 @@ void GriffonEngine::game_configmenu() {
g_system->getEventManager()->pollEvent(_event);
- tickspassed = ticks;
+ _tickspassed = ticks;
ticks = g_system->getMillis();
- tickspassed = ticks - tickspassed;
- fpsr = (float)tickspassed / 24;
+ _tickspassed = ticks - _tickspassed;
+ fpsr = (float)_tickspassed / 24;
fp++;
- if (ticks > nextticks) {
- nextticks = ticks + 1000;
+ if (ticks > _nextticks) {
+ _nextticks = ticks + 1000;
fps = fp;
fp = 0;
}
- itemyloc += 0.75 * fpsr;
- while (itemyloc >= 16)
- itemyloc -= 16;
+ _itemyloc += 0.75 * fpsr;
+ while (_itemyloc >= 16)
+ _itemyloc -= 16;
if (keypause < ticks) {
g_system->getEventManager()->pollEvent(_event);
@@ -1582,7 +1582,7 @@ void GriffonEngine::game_configmenu() {
} while (!_shouldQuit);
configwindow->free();
- itemticks = ticks + 210;
+ _itemticks = ticks + 210;
cloudimg->setAlpha(64, true);
}
@@ -1707,7 +1707,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- scriptflag[2][0] = 1;
+ _scriptflag[2][0] = 1;
}
}
@@ -1738,13 +1738,13 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
- scriptflag[3][0] = 1;
+ _scriptflag[3][0] = 1;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
}
}
// tower shield chest script
- if (npcinfo[npcnum].script == 4 && scriptflag[4][0] == 0) {
+ if (npcinfo[npcnum].script == 4 && _scriptflag[4][0] == 0) {
triggerloc[9][7] = 5004;
int curtile = 40;
@@ -1796,14 +1796,14 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
- scriptflag[5][0] = 1;
+ _scriptflag[5][0] = 1;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
}
}
// gardens master key script
- if (npcinfo[npcnum].script == 8 && scriptflag[6][0] == 0) {
+ if (npcinfo[npcnum].script == 8 && _scriptflag[6][0] == 0) {
bool alive = false;
for (int i = 1; i <= lastnpc; i++) {
if (npcinfo[i].hp > 0)
@@ -1830,13 +1830,13 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- scriptflag[8][0] = 1;
+ _scriptflag[8][0] = 1;
}
}
// regular key chest 1
for (int s = 20; s <= 23; s++) {
- if (npcinfo[npcnum].script == s && scriptflag[s][0] < 2) {
+ if (npcinfo[npcnum].script == s && _scriptflag[s][0] < 2) {
bool alive = false;
for (int i = 1; i <= lastnpc; i++) {
if (npcinfo[i].hp > 0)
@@ -1862,14 +1862,14 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
- scriptflag[s][0] = 1;
+ _scriptflag[s][0] = 1;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
}
}
}
// pickup lightning bomb
- if (npcinfo[npcnum].script == 9 && (_curmap == 41 && scriptflag[9][1] == 0)) {
+ if (npcinfo[npcnum].script == 9 && (_curmap == 41 && _scriptflag[9][1] == 0)) {
bool alive = false;
for (int i = 1; i <= lastnpc; i++) {
if (npcinfo[i].hp > 0)
@@ -1925,13 +1925,13 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
- scriptflag[12][0] = 1;
+ _scriptflag[12][0] = 1;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
}
}
// citadel master key script
- if (npcinfo[npcnum].script == 13 && scriptflag[13][0] == 0) {
+ if (npcinfo[npcnum].script == 13 && _scriptflag[13][0] == 0) {
bool alive = false;
for (int i = 1; i <= lastnpc; i++) {
if (npcinfo[i].hp > 0)
@@ -1958,12 +1958,12 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- scriptflag[13][0] = 1;
+ _scriptflag[13][0] = 1;
}
}
// max ups
- if (npcinfo[npcnum].script == 15 && scriptflag[15][0] == 0) {
+ if (npcinfo[npcnum].script == 15 && _scriptflag[15][0] == 0) {
bool alive = false;
for (int i = 1; i <= lastnpc; i++) {
if (npcinfo[i].hp > 0)
@@ -1990,7 +1990,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- scriptflag[15][0] = 1;
+ _scriptflag[15][0] = 1;
cx = 9;
cy = 8;
@@ -2012,7 +2012,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
_player.py = _player.py + 16;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- scriptflag[16][0] = 1;
+ _scriptflag[16][0] = 1;
cx = 12;
cy = 8;
@@ -2033,7 +2033,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- scriptflag[17][0] = 1;
+ _scriptflag[17][0] = 1;
}
}
@@ -2082,9 +2082,9 @@ void GriffonEngine::game_drawanims(int Layer) {
int curtilex = c % 20;
int curtiley = (c - curtilex) / 20;
- if (_curmap == 58 && scriptflag[60][0] > 0)
+ if (_curmap == 58 && _scriptflag[60][0] > 0)
curtilex = 1;
- if (_curmap == 54 && scriptflag[60][0] > 1)
+ if (_curmap == 54 && _scriptflag[60][0] > 1)
curtilex = 1;
rcSrc.left = curtilex * 16;
rcSrc.top = curtiley * 16;
@@ -2208,7 +2208,7 @@ void GriffonEngine::game_drawhud() {
}
}
- if (itemselon == 0) {
+ if (_itemselon == 0) {
int sy = 211;
@@ -2234,7 +2234,7 @@ void GriffonEngine::game_drawhud() {
return;
}
- if (selenemyon == 0) {
+ if (_selenemyon == 0) {
rcDest.left = 0;
rcDest.top = 0;
rcDest.right = 320;
@@ -2267,7 +2267,7 @@ void GriffonEngine::game_drawhud() {
amap = 1;
mapimg[amap]->blit(*_videobuffer, rcDest.left, rcDest.top);
- long ccc = _videobuffer->format.RGBToColor(128 + 127 * sin(3.141592 * 2 * itemyloc / 16), 0, 0);
+ long ccc = _videobuffer->format.RGBToColor(128 + 127 * sin(3.141592 * 2 * _itemyloc / 16), 0, 0);
for (int b = 0; b <= 6; b++) {
for (int a = 0; a <= 12; a++) {
@@ -2378,16 +2378,16 @@ void GriffonEngine::game_drawhud() {
}
}
- if (itemselon == 1) {
+ if (_itemselon == 1) {
for (int i = 0; i <= 4; i++) {
- if (curitem == 5 + i) {
- rcDest.left = (float)(243 - 12 + 3 * sin(3.141592 * 2 * itemyloc / 16));
+ if (_curitem == 5 + i) {
+ rcDest.left = (float)(243 - 12 + 3 * sin(3.141592 * 2 * _itemyloc / 16));
rcDest.top = 67 + 24 * i;
_itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
}
- if (curitem == i) {
- rcDest.left = (float)(189 - 12 + 3 * sin(3.141592 * 2 * itemyloc / 16));
+ if (_curitem == i) {
+ rcDest.left = (float)(189 - 12 + 3 * sin(3.141592 * 2 * _itemyloc / 16));
rcDest.top = 70 + 24 * i;
_itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
}
@@ -2395,14 +2395,14 @@ void GriffonEngine::game_drawhud() {
}
}
- if (selenemyon == 1) {
- if (curenemy > lastnpc) {
- int pst = curenemy - lastnpc - 1;
+ if (_selenemyon == 1) {
+ if (_curenemy > lastnpc) {
+ int pst = _curenemy - lastnpc - 1;
rcDest.left = postinfo[pst][0];
- rcDest.top = (float)(postinfo[pst][1] - 4 - sin(3.141592 / 8 * itemyloc));
+ rcDest.top = (float)(postinfo[pst][1] - 4 - sin(3.141592 / 8 * _itemyloc));
} else {
- rcDest.left = npcinfo[curenemy].x + 4;
- rcDest.top = (float)(npcinfo[curenemy].y + 4 - 16 - sin(3.141592 / 8 * itemyloc));
+ rcDest.left = npcinfo[_curenemy].x + 4;
+ rcDest.top = (float)(npcinfo[_curenemy].y + 4 - 16 - sin(3.141592 / 8 * _itemyloc));
}
_itemimg[13]->blit(*_videobuffer, rcDest.left, rcDest.top);
@@ -2496,7 +2496,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
for (int f = 0; f <= 7; f++) {
int yp = 0;
- if (f == 0 && (_curmap == 53 || _curmap == 57 || _curmap == 61 || _curmap == 65 || _curmap == 56 || _curmap > 66) && scriptflag[60][0] > 0)
+ if (f == 0 && (_curmap == 53 || _curmap == 57 || _curmap == 61 || _curmap == 65 || _curmap == 56 || _curmap > 66) && _scriptflag[60][0] > 0)
yp = 16;
int s = npcinfo[i].bodysection[f].sprite;
rcSrc.left = animset9[s].x;
@@ -2581,7 +2581,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = npcinfo[i].bodysection[10 * ff].x - 8;
rcDest.top = npcinfo[i].bodysection[10 * ff].y - 8;
- int x = 192 + ((int)(itemyloc + ff * 5) % 3) * 64;
+ int x = 192 + ((int)(_itemyloc + ff * 5) % 3) * 64;
if (x > 255)
x = 255;
_spellimg->setAlpha(x, true);
@@ -3223,15 +3223,15 @@ void GriffonEngine::game_endofgame() {
g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
- tickspassed = ticks;
+ _tickspassed = ticks;
ticks = g_system->getMillis();
- tickspassed = ticks - tickspassed;
- fpsr = (float)tickspassed / 24;
+ _tickspassed = ticks - _tickspassed;
+ fpsr = (float)_tickspassed / 24;
fp++;
- if (ticks > nextticks) {
- nextticks = ticks + 1000;
+ if (ticks > _nextticks) {
+ _nextticks = ticks + 1000;
fps = fp;
fp = 0;
}
@@ -3282,15 +3282,15 @@ void GriffonEngine::game_endofgame() {
g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
- tickspassed = ticks;
+ _tickspassed = ticks;
ticks = g_system->getMillis();
- tickspassed = ticks - tickspassed;
- fpsr = (float)tickspassed / 24;
+ _tickspassed = ticks - _tickspassed;
+ fpsr = (float)_tickspassed / 24;
fp++;
- if (ticks > nextticks) {
- nextticks = ticks + 1000;
+ if (ticks > _nextticks) {
+ _nextticks = ticks + 1000;
fps = fp;
fp = 0;
}
@@ -3340,15 +3340,15 @@ void GriffonEngine::game_endofgame() {
g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
- tickspassed = ticks;
+ _tickspassed = ticks;
ticks = g_system->getMillis();
- tickspassed = ticks - tickspassed;
- fpsr = (float)tickspassed / 24;
+ _tickspassed = ticks - _tickspassed;
+ fpsr = (float)_tickspassed / 24;
fp++;
- if (ticks > nextticks) {
- nextticks = ticks + 1000;
+ if (ticks > _nextticks) {
+ _nextticks = ticks + 1000;
fps = fp;
fp = 0;
}
@@ -3379,15 +3379,15 @@ void GriffonEngine::game_endofgame() {
g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
- tickspassed = ticks;
+ _tickspassed = ticks;
ticks = g_system->getMillis();
- tickspassed = ticks - tickspassed;
- fpsr = (float)tickspassed / 24;
+ _tickspassed = ticks - _tickspassed;
+ fpsr = (float)_tickspassed / 24;
fp++;
- if (ticks > nextticks) {
- nextticks = ticks + 1000;
+ if (ticks > _nextticks) {
+ _nextticks = ticks + 1000;
fps = fp;
fp = 0;
}
@@ -3445,15 +3445,15 @@ void GriffonEngine::game_eventtext(const char *stri) {
g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
- tickspassed = ticks;
+ _tickspassed = ticks;
ticks = g_system->getMillis();
- tickspassed = ticks - tickspassed;
- fpsr = (float)tickspassed / 24.0;
+ _tickspassed = ticks - _tickspassed;
+ fpsr = (float)_tickspassed / 24.0;
fp++;
- if (ticks > nextticks) {
- nextticks = ticks + 1000;
+ if (ticks > _nextticks) {
+ _nextticks = ticks + 1000;
fps = fp;
fp = 0;
}
@@ -3463,7 +3463,7 @@ void GriffonEngine::game_eventtext(const char *stri) {
_videobuffer3->blit(*_videobuffer);
- itemticks = ticks + 210;
+ _itemticks = ticks + 210;
}
@@ -3700,7 +3700,7 @@ void GriffonEngine::game_handlewalking() {
}
}
- if (objectinfo[o][5] == 9 && _player.inventory[INV_SHOCK] < 9 && (_curmap == 41 && scriptflag[9][1] == 0)) {
+ if (objectinfo[o][5] == 9 && _player.inventory[INV_SHOCK] < 9 && (_curmap == 41 && _scriptflag[9][1] == 0)) {
objmap[lx][ly] = -1;
_player.inventory[INV_SHOCK]++;
@@ -3708,7 +3708,7 @@ void GriffonEngine::game_handlewalking() {
objmapf[_curmap][lx][ly] = 1;
if (_curmap == 41)
- scriptflag[9][1] = 1;
+ _scriptflag[9][1] = 1;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
@@ -3750,7 +3750,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
_clipbg->fillRect(trect, ccc);
_clipbg2->fillRect(trect, ccc);
- forcepause = false;
+ _forcepause = false;
cloudson = 0;
if (mapnum < 6)
cloudson = 1;
@@ -3778,15 +3778,15 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (mapnum == 24)
dontdrawover = 1;
- if ((mapnum == 53 || mapnum == 57 || mapnum == 61 || mapnum == 65 || mapnum == 62) && scriptflag[60][0] > 0)
+ if ((mapnum == 53 || mapnum == 57 || mapnum == 61 || mapnum == 65 || mapnum == 62) && _scriptflag[60][0] > 0)
mapnum = mapnum + 100;
- if ((mapnum == 161 || mapnum == 162) && scriptflag[60][0] == 2)
+ if ((mapnum == 161 || mapnum == 162) && _scriptflag[60][0] == 2)
mapnum = mapnum + 100;
for (int i = 0; i < kMaxSpell; i++)
spellinfo[i].frame = 0;
- roomlock = 0;
+ _roomlock = 0;
// read *.map file
sprintf(name, "mapdb/%04i.map", mapnum);
@@ -3835,7 +3835,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
for (int a = 0; a <= 2; a++)
tileinfo[l][x][y][a] = 0;
- if (scriptflag[4][0] == 1 && _curmap == 4) {
+ if (_scriptflag[4][0] == 1 && _curmap == 4) {
triggerloc[9][7] = 5004;
tempmap[9][7] = 41;
tempmap[9][7 + 40] = 0;
@@ -3908,7 +3908,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
for (int y = 0; y <= 23; y++) {
int d = tempmap[3 * 40 + x][y];
- if (scriptflag[4][0] == 1 && x == 9 && y == 7)
+ if (_scriptflag[4][0] == 1 && x == 9 && y == 7)
d = 99;
if (d > 0) {
@@ -4033,21 +4033,21 @@ void GriffonEngine::game_loadmap(int mapnum) {
}
- if (_curmap == 62 && scriptflag[8][0] > 0)
+ if (_curmap == 62 && _scriptflag[8][0] > 0)
lastnpc = 0;
- if (_curmap == 73 && scriptflag[12][0] > 0)
+ if (_curmap == 73 && _scriptflag[12][0] > 0)
lastnpc = 0;
- if (_curmap == 81 && scriptflag[13][0] > 0)
+ if (_curmap == 81 && _scriptflag[13][0] > 0)
lastnpc = 0;
- if (_curmap == 73 && scriptflag[12][0] == 0)
- roomlock = 1;
- if (_curmap == 81 && scriptflag[13][0] == 0)
- roomlock = 1;
- if (_curmap == 83 && scriptflag[15][0] == 0)
- roomlock = 1;
+ if (_curmap == 73 && _scriptflag[12][0] == 0)
+ _roomlock = 1;
+ if (_curmap == 81 && _scriptflag[13][0] == 0)
+ _roomlock = 1;
+ if (_curmap == 83 && _scriptflag[15][0] == 0)
+ _roomlock = 1;
if (_curmap == 82)
- roomlock = 1;
+ _roomlock = 1;
// read *.npc file
sprintf(name, "mapdb/%04i.npc", mapnum);
@@ -4279,33 +4279,33 @@ void GriffonEngine::game_loadmap(int mapnum) {
}
if (npcinfo[i].script == 2) {
- roomlock = 1;
- if (scriptflag[2][0] > 0) {
- roomlock = 0;
+ _roomlock = 1;
+ if (_scriptflag[2][0] > 0) {
+ _roomlock = 0;
npcinfo[i].hp = 0;
}
}
if (npcinfo[i].script == 3) {
- roomlock = 1;
- if (scriptflag[3][0] > 0) {
- roomlock = 0;
+ _roomlock = 1;
+ if (_scriptflag[3][0] > 0) {
+ _roomlock = 0;
npcinfo[i].hp = 0;
}
}
if (npcinfo[i].script == 5) {
- roomlock = 1;
- if (scriptflag[5][0] > 0) {
- roomlock = 0;
+ _roomlock = 1;
+ if (_scriptflag[5][0] > 0) {
+ _roomlock = 0;
npcinfo[i].hp = 0;
}
}
if (npcinfo[i].script == 15) {
- roomlock = 1;
- if (scriptflag[15][0] > 0) {
- roomlock = 0;
+ _roomlock = 1;
+ if (_scriptflag[15][0] > 0) {
+ _roomlock = 0;
npcinfo[i].hp = 0;
}
}
@@ -4319,7 +4319,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
int cx, cy, npx, npy, lx, ly;
// academy master key
- if (_curmap == 34 && scriptflag[2][0] == 1) {
+ if (_curmap == 34 && _scriptflag[2][0] == 1) {
cx = 9;
cy = 7;
@@ -4343,7 +4343,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
}
// academy crystal
- if (_curmap == 24 && _player.foundspell[0] == 0 && scriptflag[3][0] == 1) {
+ if (_curmap == 24 && _player.foundspell[0] == 0 && _scriptflag[3][0] == 1) {
cx = 9;
cy = 7;
@@ -4367,7 +4367,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
}
// gardens master key
- if (_curmap == 62 && scriptflag[8][0] == 1) {
+ if (_curmap == 62 && _scriptflag[8][0] == 1) {
cx = 13;
cy = 7;
@@ -4391,7 +4391,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
}
// gardens fidelis sword
- if (_curmap == 66 && scriptflag[5][0] == 1 && _player.sword == 1) {
+ if (_curmap == 66 && _scriptflag[5][0] == 1 && _player.sword == 1) {
cx = 9;
cy = 6;
@@ -4415,7 +4415,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
}
// citadel armour
- if (_curmap == 73 && scriptflag[12][0] == 1 && _player.armour == 1) {
+ if (_curmap == 73 && _scriptflag[12][0] == 1 && _player.armour == 1) {
cx = 8;
cy = 7;
@@ -4439,7 +4439,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
}
// citadel master key
- if (_curmap == 81 && scriptflag[13][0] == 1) {
+ if (_curmap == 81 && _scriptflag[13][0] == 1) {
cx = 11;
cy = 10;
@@ -4464,7 +4464,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
// max ups
- if (_curmap == 83 && scriptflag[15][0] == 1 && _player.sword < 3) {
+ if (_curmap == 83 && _scriptflag[15][0] == 1 && _player.sword < 3) {
cx = 6;
cy = 8;
@@ -4487,7 +4487,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
_clipbg->fillRect(rcDest, ccc);
}
- if (_curmap == 83 && scriptflag[16][0] == 1 && _player.shield < 3) {
+ if (_curmap == 83 && _scriptflag[16][0] == 1 && _player.shield < 3) {
cx = 9;
cy = 8;
@@ -4510,7 +4510,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
_clipbg->fillRect(rcDest, ccc);
}
- if (_curmap == 83 && scriptflag[17][0] == 1 && _player.armour < 3) {
+ if (_curmap == 83 && _scriptflag[17][0] == 1 && _player.armour < 3) {
cx = 12;
cy = 8;
@@ -4615,15 +4615,15 @@ void GriffonEngine::game_newgame() {
g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
- tickspassed = ticks;
+ _tickspassed = ticks;
ticks = g_system->getMillis();
- tickspassed = ticks - tickspassed;
- fpsr = (float)tickspassed / 24.0;
+ _tickspassed = ticks - _tickspassed;
+ fpsr = (float)_tickspassed / 24.0;
fp++;
- if (ticks > nextticks) {
- nextticks = ticks + 1000;
+ if (ticks > _nextticks) {
+ _nextticks = ticks + 1000;
fps = fp;
fp = 0;
}
@@ -4680,17 +4680,17 @@ __exit_do:
_player.exp = 0;
_player.nextlevel = 0;
- memset(scriptflag, 0, sizeof(scriptflag));
+ memset(_scriptflag, 0, sizeof(_scriptflag));
memset(objmapf, 0, sizeof(objmapf));
- memset(roomlocks, 0, sizeof(roomlocks));
+ memset(_roomlocks, 0, sizeof(_roomlocks));
- roomlocks[66] = 2;
- roomlocks[24] = 2;
- roomlocks[17] = 1;
- roomlocks[34] = 1;
- roomlocks[50] = 1;
- roomlocks[73] = 1;
- roomlocks[82] = 2;
+ _roomlocks[66] = 2;
+ _roomlocks[24] = 2;
+ _roomlocks[17] = 1;
+ _roomlocks[34] = 1;
+ _roomlocks[50] = 1;
+ _roomlocks[73] = 1;
+ _roomlocks[82] = 2;
_player.walkspd = 1.1f;
_animspd = 0.5f;
@@ -4733,7 +4733,7 @@ void GriffonEngine::game_playgame() {
}
do {
- if (!forcepause) {
+ if (!_forcepause) {
game_updanims();
game_updnpcs();
}
@@ -4741,7 +4741,7 @@ void GriffonEngine::game_playgame() {
game_checktrigger();
game_checkinputs();
- if (!forcepause)
+ if (!_forcepause)
game_handlewalking();
game_updatey();
@@ -4758,7 +4758,7 @@ void GriffonEngine::game_playgame() {
void GriffonEngine::game_processtrigger(int trignum) {
int trigtype = triggers[trignum][0];
- if (roomlock == 1)
+ if (_roomlock == 1)
return;
// map jump------------------------------
if (trigtype == 0) {
@@ -4767,12 +4767,12 @@ void GriffonEngine::game_processtrigger(int trignum) {
int tmap = triggers[trignum][3];
int tjumpstyle = triggers[trignum][4];
- if (roomlocks[tmap] > 0) {
+ if (_roomlocks[tmap] > 0) {
if (saidlocked == 0)
game_eventtext("Locked");
saidlocked = 1;
canusekey = 1;
- locktype = roomlocks[tmap];
+ locktype = _roomlocks[tmap];
roomtounlock = tmap;
return;
}
@@ -4870,7 +4870,7 @@ void GriffonEngine::game_saveloadnew() {
if (tickpause < ticks) {
if (_event.type == Common::EVENT_KEYDOWN) {
- itemticks = ticks + 220;
+ _itemticks = ticks + 220;
if (_event.kbd.keycode == Common::KEYCODE_RETURN) {
// QUIT - non existent :)
@@ -4891,7 +4891,7 @@ void GriffonEngine::game_saveloadnew() {
// LOAD GAME
if (currow == 0 && curcol == 1) {
lowerlock = 1;
- currow = 1 + saveslot;
+ currow = 1 + _saveslot;
tickpause = ticks + 125;
}
// SAVE GAME
@@ -4907,7 +4907,7 @@ void GriffonEngine::game_saveloadnew() {
secstart = secstart + secsingame;
secsingame = 0;
lowerlock = 0;
- saveslot = currow - 1;
+ _saveslot = currow - 1;
currow = 0;
}
}
@@ -4928,7 +4928,7 @@ void GriffonEngine::game_saveloadnew() {
Mix_HaltChannel(-1);
secsingame = 0;
- saveslot = currow - 1;
+ _saveslot = currow - 1;
game_loadmap(_curmap);
game_playgame();
}
@@ -5072,11 +5072,11 @@ void GriffonEngine::game_saveloadnew() {
rcDest.left = 170;
if (curcol == 3)
rcDest.left = 230;
- rcDest.left = (float)(rcDest.left + 2 + 2 * sin(3.14159 * 2 * itemyloc / 16));
+ rcDest.left = (float)(rcDest.left + 2 + 2 * sin(3.14159 * 2 * _itemyloc / 16));
}
if (currow > 0) {
- rcDest.left = (float)(0 + 2 * sin(3.14159 * 2 * itemyloc / 16));
+ rcDest.left = (float)(0 + 2 * sin(3.14159 * 2 * _itemyloc / 16));
rcDest.top = (float)(53 + (currow - 1) * 48);
}
@@ -5091,7 +5091,7 @@ void GriffonEngine::game_saveloadnew() {
rcDest.left = 170;
// CHECKME: Useless code? or temporary commented?
- // rcDest.left = rcDest.left; // + 2 + 2 * sin(-3.14159 * 2 * itemyloc / 16)
+ // rcDest.left = rcDest.left; // + 2 + 2 * sin(-3.14159 * 2 * _itemyloc / 16)
_itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
}
@@ -5111,15 +5111,15 @@ void GriffonEngine::game_saveloadnew() {
g_system->getEventManager()->pollEvent(_event);
- tickspassed = ticks;
+ _tickspassed = ticks;
ticks = g_system->getMillis();
- tickspassed = ticks - tickspassed;
- fpsr = (float)tickspassed / 24;
+ _tickspassed = ticks - _tickspassed;
+ fpsr = (float)_tickspassed / 24;
fp++;
- if (ticks > nextticks) {
- nextticks = ticks + 1000;
+ if (ticks > _nextticks) {
+ _nextticks = ticks + 1000;
fps = fp;
fp = 0;
}
@@ -5128,9 +5128,9 @@ void GriffonEngine::game_saveloadnew() {
while (clouddeg >= 360)
clouddeg -= 360;
- itemyloc += 0.6 * fpsr;
- while (itemyloc >= 16)
- itemyloc -= 16;
+ _itemyloc += 0.6 * fpsr;
+ while (_itemyloc >= 16)
+ _itemyloc -= 16;
g_system->delayMillis(10);
} while (!_shouldQuit);
@@ -5176,15 +5176,15 @@ void GriffonEngine::game_showlogos() {
if (_event.type == Common::EVENT_QUIT)
_shouldQuit = true;
- tickspassed = ticks;
+ _tickspassed = ticks;
ticks = g_system->getMillis();
- tickspassed = ticks - tickspassed;
- fpsr = (float)tickspassed / 24;
+ _tickspassed = ticks - _tickspassed;
+ fpsr = (float)_tickspassed / 24;
fp++;
- if (ticks > nextticks) {
- nextticks = ticks + 1000;
+ if (ticks > _nextticks) {
+ _nextticks = ticks + 1000;
fps = fp;
fp = 0;
}
@@ -5213,15 +5213,15 @@ void GriffonEngine::game_swash() {
g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
- tickspassed = ticks;
+ _tickspassed = ticks;
ticks = g_system->getMillis();
- tickspassed = ticks - tickspassed;
- fpsr = (float)tickspassed / 24.0;
+ _tickspassed = ticks - _tickspassed;
+ fpsr = (float)_tickspassed / 24.0;
fp++;
- if (ticks > nextticks) {
- nextticks = ticks + 1000;
+ if (ticks > _nextticks) {
+ _nextticks = ticks + 1000;
fps = fp;
fp = 0;
}
@@ -5256,15 +5256,15 @@ void GriffonEngine::game_swash() {
g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
- tickspassed = ticks;
+ _tickspassed = ticks;
ticks = g_system->getMillis();
- tickspassed = ticks - tickspassed;
- fpsr = (float)tickspassed / 24.0;
+ _tickspassed = ticks - _tickspassed;
+ fpsr = (float)_tickspassed / 24.0;
fp++;
- if (ticks > nextticks) {
- nextticks = ticks + 1000;
+ if (ticks > _nextticks) {
+ _nextticks = ticks + 1000;
fps = fp;
fp = 0;
}
@@ -5296,15 +5296,15 @@ void GriffonEngine::game_theend() {
g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
- tickspassed = ticks;
+ _tickspassed = ticks;
ticks = g_system->getMillis();
- tickspassed = ticks - tickspassed;
- fpsr = (float)tickspassed / 24.0;
+ _tickspassed = ticks - _tickspassed;
+ fpsr = (float)_tickspassed / 24.0;
fp++;
- if (ticks > nextticks) {
- nextticks = ticks + 1000;
+ if (ticks > _nextticks) {
+ _nextticks = ticks + 1000;
fps = fp;
fp = 0;
}
@@ -5384,7 +5384,7 @@ void GriffonEngine::game_title(int mode) {
else
sys_print(_videobuffer, "(c) 2005 by Daniel 'Syn9' Kennedy", 28, 224, 4);
- rc.left = (float)(x - 16 - 4 * cos(3.14159 * 2 * itemyloc / 16));
+ rc.left = (float)(x - 16 - 4 * cos(3.14159 * 2 * _itemyloc / 16));
rc.top = (float)(y - 4 + 16 * cursel);
_itemimg[15]->blit(*_videobuffer, rc.left, rc.top);
@@ -5402,15 +5402,15 @@ void GriffonEngine::game_title(int mode) {
g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
- tickspassed = ticks;
+ _tickspassed = ticks;
ticks = g_system->getMillis();
- tickspassed = ticks - tickspassed;
- fpsr = (float)tickspassed / 24.0;
+ _tickspassed = ticks - _tickspassed;
+ fpsr = (float)_tickspassed / 24.0;
fp++;
- if (ticks > nextticks) {
- nextticks = ticks + 1000;
+ if (ticks > _nextticks) {
+ _nextticks = ticks + 1000;
fps = fp;
fp = 0;
}
@@ -5423,10 +5423,10 @@ void GriffonEngine::game_title(int mode) {
if (xofs >= 320.0)
xofs -= 320.0;
- itemyloc += 0.75 * fpsr;
+ _itemyloc += 0.75 * fpsr;
- while (itemyloc >= 16)
- itemyloc = itemyloc - 16;
+ while (_itemyloc >= 16)
+ _itemyloc = _itemyloc - 16;
g_system->getEventManager()->pollEvent(_event);
@@ -5470,7 +5470,7 @@ void GriffonEngine::game_title(int mode) {
g_system->delayMillis(10);
} while (!_shouldQuit);
- itemticks = ticks + 210;
+ _itemticks = ticks + 210;
if (menabled && config.music) {
Mix_HaltChannel(menuchannel);
@@ -5543,7 +5543,7 @@ void GriffonEngine::game_updmusic() {
// if(_curmap > 5 && _curmap < 42) iplaysound = macademy;
// if(_curmap > 47) iplaysound = _mgardens;
iplaysound = _mgardens;
- if (roomlock == 1)
+ if (_roomlock == 1)
iplaysound = _mboss;
if (iplaysound == _mboss && pboss)
@@ -6167,8 +6167,8 @@ void GriffonEngine::game_updnpcs() {
npcinfo[i].bodysection[10 * ff + 9].x = npcinfo[i].bodysection[10 * ff + 9].x - xdif * 0.4 * fpsr;
npcinfo[i].bodysection[10 * ff + 9].y = npcinfo[i].bodysection[10 * ff + 9].y - ydif * 0.4 * fpsr;
- npcinfo[i].bodysection[10 * ff].x = npcinfo[i].x + 12 + 8 * cos(3.141592 * 2 * (itemyloc / 16 + ff * 120 / 360));
- npcinfo[i].bodysection[10 * ff].y = npcinfo[i].y + 12 + 8 * sin(3.141592 * 2 * (itemyloc / 16 + ff * 120 / 360));
+ npcinfo[i].bodysection[10 * ff].x = npcinfo[i].x + 12 + 8 * cos(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
+ npcinfo[i].bodysection[10 * ff].y = npcinfo[i].y + 12 + 8 * sin(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
for (int f = 8; f >= 1; f--) {
xdif = npcinfo[i].bodysection[ff * 10 + f + 1].x - npcinfo[i].bodysection[ff * 10 + f - 1].x;
@@ -6550,8 +6550,8 @@ void GriffonEngine::game_updnpcs() {
npcinfo[i].bodysection[10 * ff + 9].x = npcinfo[i].bodysection[10 * ff + 9].x - xdif * .2 * fpsr;
npcinfo[i].bodysection[10 * ff + 9].y = npcinfo[i].bodysection[10 * ff + 9].y - ydif * .2 * fpsr;
- npcinfo[i].bodysection[10 * ff].x = npcinfo[i].x + 12 + 8 * cos(3.141592 * 2 * (itemyloc / 16 + ff * 120 / 360));
- npcinfo[i].bodysection[10 * ff].y = npcinfo[i].y + 12 + 8 * sin(3.141592 * 2 * (itemyloc / 16 + ff * 120 / 360));
+ npcinfo[i].bodysection[10 * ff].x = npcinfo[i].x + 12 + 8 * cos(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
+ npcinfo[i].bodysection[10 * ff].y = npcinfo[i].y + 12 + 8 * sin(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
for (int f = 8; f >= 1; f--) {
xdif = npcinfo[i].bodysection[ff * 10 + f + 1].x - npcinfo[i].bodysection[ff * 10 + f - 1].x;
@@ -6721,7 +6721,7 @@ void GriffonEngine::game_updspells() {
int spellnum = spellinfo[i].spellnum;
// water
- if (spellnum == 0 && !forcepause) {
+ if (spellnum == 0 && !_forcepause) {
float fr = (32 - spellinfo[i].frame);
ll[0][0] = -2;
@@ -6838,7 +6838,7 @@ void GriffonEngine::game_updspells() {
}
// metal
- if (spellnum == 1 && !forcepause) {
+ if (spellnum == 1 && !_forcepause) {
int fr = (int)((32 - spellinfo[i].frame) * 4) % 3;
rcSrc.left = fr * 48;
@@ -6957,7 +6957,7 @@ void GriffonEngine::game_updspells() {
}
// earth
- if (spellnum == 2 && !forcepause) {
+ if (spellnum == 2 && !_forcepause) {
float hght = 240 - spellinfo[i].enemyy;
for (int f = 8; f >= 0; f--) {
@@ -7071,7 +7071,7 @@ void GriffonEngine::game_updspells() {
spellinfo[i].frame = spellinfo[i].frame - 0.3 * fpsr;
if (spellinfo[i].frame < 0) {
spellinfo[i].frame = 0;
- forcepause = false;
+ _forcepause = false;
npx = _player.px + 12;
npy = _player.py + 20;
@@ -7142,7 +7142,7 @@ void GriffonEngine::game_updspells() {
}
// room fireballs
- if (spellnum == 6 && !forcepause) {
+ if (spellnum == 6 && !_forcepause) {
if (spellinfo[i].frame > 16) {
float fr = (32 - spellinfo[i].frame);
@@ -7484,7 +7484,7 @@ void GriffonEngine::game_updspells() {
spellinfo[i].frame -= 0.5 * fpsr;
if (spellinfo[i].frame < 0) {
spellinfo[i].frame = 0;
- forcepause = false;
+ _forcepause = false;
}
}
@@ -7559,7 +7559,7 @@ void GriffonEngine::game_updspells() {
void GriffonEngine::game_updspellsunder() {
- if (forcepause)
+ if (_forcepause)
return;
for (int i = 0; i < kMaxSpell; i++) {
@@ -7908,7 +7908,7 @@ void GriffonEngine::sys_initialize() {
sys_LoadItemImgs();
fpsr = 1.0f;
- nextticks = ticks + 1000;
+ _nextticks = ticks + 1000;
for (int i = 0; i <= 15; i++) {
_playerattackofs[0][i][0] = 0; // -1// -(i + 1)
@@ -8255,15 +8255,15 @@ void GriffonEngine::sys_update() {
g_system->updateScreen();
g_system->getEventManager()->pollEvent(_event);
- tickspassed = ticks;
+ _tickspassed = ticks;
ticks = g_system->getMillis();
- tickspassed = ticks - tickspassed;
- fpsr = (float)tickspassed / 24.0;
+ _tickspassed = ticks - _tickspassed;
+ fpsr = (float)_tickspassed / 24.0;
fp++;
- if (ticks > nextticks) {
- nextticks = ticks + 1000;
+ if (ticks > _nextticks) {
+ _nextticks = ticks + 1000;
fps = fp;
fp = 0;
secsingame = secsingame + 1;
@@ -8357,7 +8357,7 @@ void GriffonEngine::sys_update() {
_clipbg->fillRect(rc, 1000);
- if (!forcepause) {
+ if (!_forcepause) {
for (int i = 0; i < 5; i++) {
if (_player.foundspell[i] == 1)
_player.spellcharge[i] += 1 * _player.level * 0.01 * fpsr;
@@ -8378,18 +8378,18 @@ void GriffonEngine::sys_update() {
if (_player.spellstrength > 100)
_player.spellstrength = 100;
- itemyloc += 0.75 * fpsr;
- while (itemyloc >= 16)
- itemyloc -= 16;
+ _itemyloc += 0.75 * fpsr;
+ while (_itemyloc >= 16)
+ _itemyloc -= 16;
if (_player.hp <= 0)
game_theend();
- if (roomlock == 1) {
- roomlock = 0;
+ if (_roomlock == 1) {
+ _roomlock = 0;
for (int i = 1; i <= lastnpc; i++)
if (npcinfo[i].hp > 0)
- roomlock = 1;
+ _roomlock = 1;
}
clouddeg += 0.1 * fpsr;
@@ -8410,7 +8410,7 @@ void GriffonEngine::sys_update() {
// cloudson = 0
- if (itemselon == 1)
+ if (_itemselon == 1)
_player.itemselshade = _player.itemselshade + 2 * fpsr;
if (_player.itemselshade > 24)
_player.itemselshade = 24;
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 7a6f9a6..9511ec7 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -336,15 +336,15 @@ private:
Graphics::TransparentSurface *_itemimg[21], *_windowimg;
Graphics::TransparentSurface *_spellimg;
- int itemselon, curitem, itemticks;
- float itemyloc;
- int selenemyon, curenemy;
- bool forcepause;
- int roomlock; // set to disable any room jumps while in the room
- int scriptflag[100][10], saveslot; // script, flag
+ int _itemselon, _curitem, _itemticks;
+ float _itemyloc;
+ int _selenemyon, _curenemy;
+ bool _forcepause;
+ int _roomlock; // set to disable any room jumps while in the room
+ int _scriptflag[100][10], _saveslot; // script, flag
// timer related - move to local later
- int ticks, tickspassed, nextticks;
+ int ticks, _tickspassed, _nextticks;
float fp, fps, fpsr; // CHECKME: fp and fps seems to be integers
int secsingame, secstart;
@@ -433,7 +433,7 @@ private:
// TODO: Check those variables, at least canusekey is a boolean, and the case is wrong in all the names
// room locks
- int roomlocks[201], saidlocked, canusekey, locktype, roomtounlock, saidjammed;
+ int _roomlocks[201], saidlocked, canusekey, locktype, roomtounlock, saidjammed;
// set to 1 for normal key, set to 2 for master, set to 0 if unlocked
// ysort
diff --git a/engines/griffon/saveload.cpp b/engines/griffon/saveload.cpp
index 55e2d75..29632e3 100644
--- a/engines/griffon/saveload.cpp
+++ b/engines/griffon/saveload.cpp
@@ -103,7 +103,7 @@ int GriffonEngine::state_load(int slotnum) {
INPUT("%i", &_player.nextlevel);
for (int a = 0; a <= 99; a++) {
for (int b = 0; b <= 9; b++) {
- INPUT("%i", &scriptflag[a][b]);
+ INPUT("%i", &_scriptflag[a][b]);
}
}
INPUT("%i", &_curmap);
@@ -117,7 +117,7 @@ int GriffonEngine::state_load(int slotnum) {
}
for (int a = 0; a <= 200; a++) {
- INPUT("%i", &roomlocks[a]);
+ INPUT("%i", &_roomlocks[a]);
}
INPUT("%f", &_player.spellstrength);
@@ -228,7 +228,7 @@ int GriffonEngine::state_save(int slotnum) {
PRINT("%i", _player.nextlevel);
for (int a = 0; a <= 99; a++) {
for (int b = 0; b <= 9; b++) {
- PRINT("%i", scriptflag[a][b]);
+ PRINT("%i", _scriptflag[a][b]);
}
}
PRINT("%i", _curmap);
@@ -242,7 +242,7 @@ int GriffonEngine::state_save(int slotnum) {
}
for (int a = 0; a <= 200; a++) {
- PRINT("%i", roomlocks[a]);
+ PRINT("%i", _roomlocks[a]);
}
PRINT("%f", _player.spellstrength);
Commit: f4ef04dc0a4cbf8414a696af98fb0da09a4f829a
https://github.com/scummvm/scummvm/commit/f4ef04dc0a4cbf8414a696af98fb0da09a4f829a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Variable renaming
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index a2e205d..78590fe 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -426,7 +426,7 @@ void GriffonEngine::game_attack() {
objmap[lx][ly - 1] = 3;
game_eventtext("Found Flask!");
- _itemticks = ticks + 215;
+ _itemticks = _ticks + 215;
return;
}
@@ -437,7 +437,7 @@ void GriffonEngine::game_attack() {
}
game_eventtext("Cannot Carry any more Flasks!");
- _itemticks = ticks + 215;
+ _itemticks = _ticks + 215;
return;
}
@@ -446,7 +446,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(14, lx * 16, (ly - 1) * 16);
- _itemticks = ticks + 215;
+ _itemticks = _ticks + 215;
if (_curmap == 34)
_scriptflag[2][0] = 2;
@@ -481,7 +481,7 @@ void GriffonEngine::game_attack() {
objmap[lx][ly - 1] = 3;
game_eventtext("Found the Infinite Crystal!");
- _itemticks = ticks + 215;
+ _itemticks = _ticks + 215;
return;
}
@@ -490,7 +490,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(4, lx * 16, (ly - 1) * 16);
- _itemticks = ticks + 215;
+ _itemticks = _ticks + 215;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
@@ -510,7 +510,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(3, lx * 16, (ly - 1) * 16);
- _itemticks = ticks + 215;
+ _itemticks = _ticks + 215;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
@@ -570,7 +570,7 @@ void GriffonEngine::game_attack() {
objmap[lx][ly - 1] = 3;
game_eventtext("Found Mega Flask!");
- _itemticks = ticks + 215;
+ _itemticks = _ticks + 215;
return;
}
@@ -581,7 +581,7 @@ void GriffonEngine::game_attack() {
}
game_eventtext("Cannot Carry any more Mega Flasks!");
- _itemticks = ticks + 215;
+ _itemticks = _ticks + 215;
return;
}
@@ -600,7 +600,7 @@ void GriffonEngine::game_attack() {
objmap[lx][ly - 1] = 3;
game_eventtext("Found Mega Flask!");
- _itemticks = ticks + 215;
+ _itemticks = _ticks + 215;
return;
}
@@ -611,7 +611,7 @@ void GriffonEngine::game_attack() {
}
game_eventtext("Cannot Carry any more Mega Flasks!");
- _itemticks = ticks + 215;
+ _itemticks = _ticks + 215;
return;
}
@@ -630,7 +630,7 @@ void GriffonEngine::game_attack() {
objmap[lx][ly - 1] = 3;
game_eventtext("Found Lightning Bomb!");
- _itemticks = ticks + 215;
+ _itemticks = _ticks + 215;
return;
}
@@ -641,7 +641,7 @@ void GriffonEngine::game_attack() {
}
game_eventtext("Cannot Carry any more Lightning Bombs!");
- _itemticks = ticks + 215;
+ _itemticks = _ticks + 215;
return;
}
@@ -659,7 +659,7 @@ void GriffonEngine::game_attack() {
objmap[lx][ly - 1] = 3;
game_eventtext("Found the Fidelis Mail!");
- _itemticks = ticks + 215;
+ _itemticks = _ticks + 215;
return;
}
@@ -704,7 +704,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(18, lx * 16, (ly - 1) * 16);
- _itemticks = ticks + 215;
+ _itemticks = _ticks + 215;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
@@ -721,7 +721,7 @@ void GriffonEngine::game_attack() {
if (oscript == 16 && _player.shield < 3) {
_player.shield = 3;
game_addFloatIcon(19, lx * 16, (ly - 1) * 16);
- _itemticks = ticks + 215;
+ _itemticks = _ticks + 215;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
@@ -738,7 +738,7 @@ void GriffonEngine::game_attack() {
if (oscript == 17 && _player.armour < 3) {
_player.armour = 3;
game_addFloatIcon(20, lx * 16, (ly - 1) * 16);
- _itemticks = ticks + 215;
+ _itemticks = _ticks + 215;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
@@ -857,7 +857,7 @@ void GriffonEngine::game_castspell(int spellnum, float homex, float homey, float
void GriffonEngine::game_checkhit() {
if (attacking) {
for (int i = 1; i <= lastnpc; i++) {
- if (npcinfo[i].hp > 0 && npcinfo[i].pause < ticks && (int)(RND() * 2) == 0) {
+ if (npcinfo[i].hp > 0 && npcinfo[i].pause < _ticks && (int)(RND() * 2) == 0) {
float npx = npcinfo[i].x;
float npy = npcinfo[i].y;
@@ -936,18 +936,18 @@ void GriffonEngine::game_checkinputs() {
if (_event.type == Common::EVENT_KEYDOWN) {
if (_event.kbd.keycode == Common::KEYCODE_ESCAPE) {
- if (_itemticks < ticks)
+ if (_itemticks < _ticks)
game_title(1);
} else if (_event.kbd.keycode == Common::KEYCODE_d && _event.kbd.hasFlags(Common::KBD_CTRL)) {
_console->attach();
_event.type = Common::EVENT_INVALID;
} else if (_event.kbd.hasFlags(Common::KBD_CTRL)) {
- if (_itemselon == 0 && _itemticks < ticks)
+ if (_itemselon == 0 && _itemticks < _ticks)
game_attack();
- if (_itemselon == 1 && _itemticks < ticks) {
+ if (_itemselon == 1 && _itemticks < _ticks) {
if (_curitem == 0 && _player.inventory[INV_FLASK] > 0) {
- _itemticks = ticks + ntickdelay;
+ _itemticks = _ticks + ntickdelay;
int heal = 50;
int maxh = _player.maxhp - _player.hp;
@@ -973,7 +973,7 @@ void GriffonEngine::game_checkinputs() {
}
if (_curitem == 1 && _player.inventory[INV_DOUBLEFLASK] > 0) {
- _itemticks = ticks + ntickdelay;
+ _itemticks = _ticks + ntickdelay;
int heal = 200;
int maxh = _player.maxhp - _player.hp;
@@ -1005,7 +1005,7 @@ void GriffonEngine::game_checkinputs() {
_player.inventory[INV_SHOCK]--;
- _itemticks = ticks + ntickdelay;
+ _itemticks = _ticks + ntickdelay;
_selenemyon = 0;
_itemselon = 0;
@@ -1017,7 +1017,7 @@ void GriffonEngine::game_checkinputs() {
_player.inventory[INV_NORMALKEY]--;
- _itemticks = ticks + ntickdelay;
+ _itemticks = _ticks + ntickdelay;
_selenemyon = 0;
_itemselon = 0;
return;
@@ -1029,7 +1029,7 @@ void GriffonEngine::game_checkinputs() {
_player.inventory[INV_MASTERKEY]--;
- _itemticks = ticks + ntickdelay;
+ _itemticks = _ticks + ntickdelay;
_selenemyon = 0;
_itemselon = 0;
return;
@@ -1042,7 +1042,7 @@ void GriffonEngine::game_checkinputs() {
_forcepause = true;
- _itemticks = ticks + ntickdelay;
+ _itemticks = _ticks + ntickdelay;
_selenemyon = 0;
_itemselon = 0;
}
@@ -1059,7 +1059,7 @@ void GriffonEngine::game_checkinputs() {
_player.spellstrength = 0;
- _itemticks = ticks + ntickdelay;
+ _itemticks = _ticks + ntickdelay;
_selenemyon = 0;
_itemselon = 0;
_forcepause = false;
@@ -1067,7 +1067,7 @@ void GriffonEngine::game_checkinputs() {
if (_curitem > 5 && _selenemyon == 0 && _itemselon == 1) {
if (ABS(_player.spellcharge[_curitem - 5] - 100) < kEpsilon) {
- _itemticks = ticks + ntickdelay;
+ _itemticks = _ticks + ntickdelay;
_selenemyon = 1;
@@ -1094,15 +1094,15 @@ __exit_do:
}
}
} else if (_event.kbd.hasFlags(Common::KBD_ALT)) {
- if (_itemticks < ticks) {
+ if (_itemticks < _ticks) {
_selenemyon = 0;
if (_itemselon == 1) {
_itemselon = 0;
- _itemticks = ticks + 220;
+ _itemticks = _ticks + 220;
_forcepause = false;
} else {
_itemselon = 1;
- _itemticks = ticks + 220;
+ _itemticks = _ticks + 220;
_forcepause = true;
_player.itemselshade = 0;
}
@@ -1130,7 +1130,7 @@ __exit_do:
movingright = 0;
if (_selenemyon == 1) {
- if (_itemticks < ticks) {
+ if (_itemticks < _ticks) {
if (_event.kbd.keycode == Common::KEYCODE_LEFT) {
int origin = _curenemy;
do {
@@ -1144,7 +1144,7 @@ __exit_do:
if (_curenemy > lastnpc)
break;
} while (1);
- _itemticks = ticks + ntickdelay;
+ _itemticks = _ticks + ntickdelay;
}
if (_event.kbd.keycode == Common::KEYCODE_RIGHT) {
int origin = _curenemy;
@@ -1159,7 +1159,7 @@ __exit_do:
if (_curenemy > lastnpc)
break;
} while (1);
- _itemticks = ticks + ntickdelay;
+ _itemticks = _ticks + ntickdelay;
}
@@ -1169,10 +1169,10 @@ __exit_do:
_curenemy = lastnpc + nposts;
}
} else {
- if (_itemticks < ticks) {
+ if (_itemticks < _ticks) {
if (_event.kbd.keycode == Common::KEYCODE_UP) {
_curitem = _curitem - 1;
- _itemticks = ticks + ntickdelay;
+ _itemticks = _ticks + ntickdelay;
if (_curitem == 4)
_curitem = 9;
if (_curitem == -1)
@@ -1180,7 +1180,7 @@ __exit_do:
}
if (_event.kbd.keycode == Common::KEYCODE_DOWN) {
_curitem = _curitem + 1;
- _itemticks = ticks + ntickdelay;
+ _itemticks = _ticks + ntickdelay;
if (_curitem == 5)
_curitem = 0;
if (_curitem == 10)
@@ -1188,11 +1188,11 @@ __exit_do:
}
if (_event.kbd.keycode == Common::KEYCODE_LEFT) {
_curitem = _curitem - 5;
- _itemticks = ticks + ntickdelay;
+ _itemticks = _ticks + ntickdelay;
}
if (_event.kbd.keycode == Common::KEYCODE_RIGHT) {
_curitem = _curitem + 5;
- _itemticks = ticks + ntickdelay;
+ _itemticks = _ticks + ntickdelay;
}
if (_curitem > 9)
@@ -1230,14 +1230,14 @@ void GriffonEngine::game_checktrigger() {
void GriffonEngine::game_configmenu() {
int cursel = MINCURSEL;
- ticks = g_system->getMillis();
+ _ticks = g_system->getMillis();
int tickwait = 100;
- int keypause = ticks + tickwait;
+ int keypause = _ticks + tickwait;
Graphics::TransparentSurface *configwindow = IMG_Load("art/configwindow.bmp", true);
configwindow->setAlpha(160, true);
- int ticks1 = ticks;
+ int _ticks1 = _ticks;
do {
_videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
@@ -1364,8 +1364,8 @@ void GriffonEngine::game_configmenu() {
_itemimg[15]->blit(*_videobuffer, rc.left, rc.top);
float yy = 255.0;
- if (ticks < ticks1 + 1000) {
- yy = 255.0 * ((float)(ticks - ticks1) / 1000.0);
+ if (_ticks < _ticks1 + 1000) {
+ yy = 255.0 * ((float)(_ticks - _ticks1) / 1000.0);
if (yy < 0.0)
yy = 0.0;
if (yy > 255.0)
@@ -1378,31 +1378,31 @@ void GriffonEngine::game_configmenu() {
g_system->getEventManager()->pollEvent(_event);
- _tickspassed = ticks;
- ticks = g_system->getMillis();
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
- _tickspassed = ticks - _tickspassed;
- fpsr = (float)_tickspassed / 24;
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24;
- fp++;
- if (ticks > _nextticks) {
- _nextticks = ticks + 1000;
- fps = fp;
- fp = 0;
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
}
- _itemyloc += 0.75 * fpsr;
+ _itemyloc += 0.75 * _fpsr;
while (_itemyloc >= 16)
_itemyloc -= 16;
- if (keypause < ticks) {
+ if (keypause < _ticks) {
g_system->getEventManager()->pollEvent(_event);
if (_event.type == Common::EVENT_QUIT)
_shouldQuit = true;
if (_event.type == Common::EVENT_KEYDOWN) {
- keypause = ticks + tickwait;
+ keypause = _ticks + tickwait;
if (_event.kbd.keycode == Common::KEYCODE_ESCAPE)
break;
@@ -1574,7 +1574,7 @@ void GriffonEngine::game_configmenu() {
}
}
- clouddeg += 0.01 * fpsr;
+ clouddeg += 0.01 * _fpsr;
while (clouddeg >= 360)
clouddeg = clouddeg - 360;
@@ -1582,7 +1582,7 @@ void GriffonEngine::game_configmenu() {
} while (!_shouldQuit);
configwindow->free();
- _itemticks = ticks + 210;
+ _itemticks = _ticks + 210;
cloudimg->setAlpha(64, true);
}
@@ -1622,7 +1622,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
fcol = 5;
}
- npcinfo[npcnum].pause = ticks + 900;
+ npcinfo[npcnum].pause = _ticks + 900;
if (spell == 0)
_player.attackstrength = ratio;
@@ -2057,7 +2057,7 @@ void GriffonEngine::game_damageplayer(int damage) {
game_addFloatText(line, _player.px + 12 - 4 * strlen(line), _player.py + 16, 4);
- _player.pause = ticks + 1000;
+ _player.pause = _ticks + 1000;
}
void GriffonEngine::game_drawanims(int Layer) {
@@ -2152,7 +2152,7 @@ int hud_recalc(int a, int b, int c) {
#define RGB(R, G, B) (_videobuffer->format.RGBToColor((R), (G), (B)))
void GriffonEngine::game_drawhud() {
- //sprintf(line, "fps: %i, map: %i, exp: %i/%i", (int)fps, _curmap, _player.exp, _player.nextlevel);
+ //sprintf(line, "_fps: %i, map: %i, exp: %i/%i", (int)_fps, _curmap, _player.exp, _player.nextlevel);
//sys_print(_videobuffer, line, 0, 0, 0);
game_fillrect(_videobuffer2, 0, 0, 320, 240, 0);
@@ -2449,8 +2449,8 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.setWidth(24);
rcDest.setHeight(24);
- if (npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
- npcinfo[i].shake = ticks + 50;
+ if (npcinfo[i].pause > _ticks && npcinfo[i].shake < _ticks) {
+ npcinfo[i].shake = _ticks + 50;
rcDest.left += (int)(RND() * 3) - 1;
rcDest.top += (int)(RND() * 3) - 1;
}
@@ -2636,8 +2636,8 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.setWidth(24);
rcDest.setHeight(24);
- if (npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
- npcinfo[i].shake = ticks + 50;
+ if (npcinfo[i].pause > _ticks && npcinfo[i].shake < _ticks) {
+ npcinfo[i].shake = _ticks + 50;
rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
@@ -2660,8 +2660,8 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.setWidth(24);
rcDest.setHeight(24);
- if (npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
- npcinfo[i].shake = ticks + 50;
+ if (npcinfo[i].pause > _ticks && npcinfo[i].shake < _ticks) {
+ npcinfo[i].shake = _ticks + 50;
rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
@@ -2697,8 +2697,8 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.setWidth(24);
rcDest.setHeight(24);
- if (npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
- npcinfo[i].shake = ticks + 50;
+ if (npcinfo[i].pause > _ticks && npcinfo[i].shake < _ticks) {
+ npcinfo[i].shake = _ticks + 50;
rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
@@ -2709,14 +2709,14 @@ void GriffonEngine::game_drawnpcs(int mode) {
// dragon2
if (npcinfo[i].spriteset == 10) {
if (npcinfo[i].attacking == 0) {
- npcinfo[i].floating = npcinfo[i].floating + 0.25 * fpsr;
+ npcinfo[i].floating = npcinfo[i].floating + 0.25 * _fpsr;
while (npcinfo[i].floating >= 16)
npcinfo[i].floating = npcinfo[i].floating - 16;
float frame = npcinfo[i].frame;
int cframe = npcinfo[i].cframe;
- frame = frame + 0.5 * fpsr;
+ frame = frame + 0.5 * _fpsr;
while (frame >= 16)
frame = frame - 16;
@@ -2741,15 +2741,15 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.setWidth(24);
rcDest.setHeight(24);
- if (npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
- npcinfo[i].shake = ticks + 50;
+ if (npcinfo[i].pause > _ticks && npcinfo[i].shake < _ticks) {
+ npcinfo[i].shake = _ticks + 50;
rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
- npcinfo[i].floating = npcinfo[i].floating + 0.25 * fpsr;
+ npcinfo[i].floating = npcinfo[i].floating + 0.25 * _fpsr;
while (npcinfo[i].floating >= 16)
npcinfo[i].floating = npcinfo[i].floating - 16;
@@ -2772,14 +2772,14 @@ void GriffonEngine::game_drawnpcs(int mode) {
// end boss
if (npcinfo[i].spriteset == 11) {
- npcinfo[i].floating = npcinfo[i].floating + .3 * fpsr;
+ npcinfo[i].floating = npcinfo[i].floating + .3 * _fpsr;
while (npcinfo[i].floating >= 16)
npcinfo[i].floating = npcinfo[i].floating - 16;
float frame = npcinfo[i].frame2;
- frame = frame + 0.5 * fpsr;
+ frame = frame + 0.5 * _fpsr;
while (frame >= 16)
frame = frame - 16;
@@ -2825,7 +2825,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
int xdif = (xloc + 8) - (_player.px + 12);
int ydif = (yloc + 8) - (_player.py + 12);
- if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < ticks) {
+ if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
float damage = (float)npcinfo[i].spelldamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
@@ -2851,7 +2851,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
xdif = (xloc + 8) - (_player.px + 12);
ydif = (yloc + 8) - (_player.py + 12);
- if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < ticks) {
+ if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
float damage = (float)npcinfo[i].spelldamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
@@ -2877,8 +2877,8 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = sx;
rcDest.top = sy;
- if (npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
- npcinfo[i].shake = ticks + 50;
+ if (npcinfo[i].pause > _ticks && npcinfo[i].shake < _ticks) {
+ npcinfo[i].shake = _ticks + 50;
rcDest.left = rcDest.top + (int)(RND() * 3) - 1;
rcDest.left = rcDest.top + (int)(RND() * 3) - 1;
}
@@ -2901,14 +2901,14 @@ void GriffonEngine::game_drawnpcs(int mode) {
// bat kitty
if (npcinfo[i].spriteset == 12) {
- npcinfo[i].floating = npcinfo[i].floating + 1 * fpsr;
+ npcinfo[i].floating = npcinfo[i].floating + 1 * _fpsr;
while (npcinfo[i].floating >= 16)
npcinfo[i].floating = npcinfo[i].floating - 16;
float frame = npcinfo[i].frame;
int cframe = npcinfo[i].cframe;
- frame = frame + 0.5 * fpsr;
+ frame = frame + 0.5 * _fpsr;
while (frame >= 16)
frame = frame - 16;
@@ -2933,8 +2933,8 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.setWidth(99);
rcDest.setHeight(80);
- if (npcinfo[i].pause > ticks && npcinfo[i].shake < ticks) {
- npcinfo[i].shake = ticks + 50;
+ if (npcinfo[i].pause > _ticks && npcinfo[i].shake < _ticks) {
+ npcinfo[i].shake = _ticks + 50;
rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
@@ -3170,7 +3170,7 @@ void GriffonEngine::game_drawview() {
void GriffonEngine::game_endofgame() {
float xofs = 0;
- ticks = g_system->getMillis();
+ _ticks = g_system->getMillis();
float spd = 0.2f;
@@ -3180,7 +3180,7 @@ void GriffonEngine::game_endofgame() {
Mix_Volume(musicchannel, 0);
}
- int ticks1 = ticks;
+ int _ticks1 = _ticks;
int ya = 0;
_videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
@@ -3191,7 +3191,7 @@ void GriffonEngine::game_endofgame() {
int ldstop = 0;
do {
- ld = ld + 4 * fpsr;
+ ld = ld + 4 * _fpsr;
if (ld > config.musicvol)
ld = config.musicvol;
if (menabled && ldstop == 0) {
@@ -3201,8 +3201,8 @@ void GriffonEngine::game_endofgame() {
}
ya = 0;
- if (ticks < ticks1 + 1500) {
- ya = (255 * (ticks - ticks1)) / 1500;
+ if (_ticks < _ticks1 + 1500) {
+ ya = (255 * (_ticks - _ticks1)) / 1500;
if (ya < 0)
ya = 0;
if (ya > 255)
@@ -3223,21 +3223,21 @@ void GriffonEngine::game_endofgame() {
g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
- _tickspassed = ticks;
- ticks = g_system->getMillis();
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
- _tickspassed = ticks - _tickspassed;
- fpsr = (float)_tickspassed / 24;
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24;
- fp++;
- if (ticks > _nextticks) {
- _nextticks = ticks + 1000;
- fps = fp;
- fp = 0;
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
}
} while (1);
- ticks1 = ticks;
+ _ticks1 = _ticks;
ya = 0;
float y = 140;
@@ -3254,7 +3254,7 @@ void GriffonEngine::game_endofgame() {
_titleimg->blit(*_videobuffer, rc.left, rc.top);
- y = y - spd * fpsr;
+ y = y - spd * _fpsr;
for (int i = 0; i <= 26; i++) {
int yy = y + i * 10;
if (yy > -8 && yy < 240) {
@@ -3267,8 +3267,8 @@ void GriffonEngine::game_endofgame() {
}
ya = 255;
- if (ticks < ticks1 + 1000) {
- ya = 255 * (ticks - ticks1) / 1000;
+ if (_ticks < _ticks1 + 1000) {
+ ya = 255 * (_ticks - _ticks1) / 1000;
if (ya < 0)
ya = 0;
if (ya > 255)
@@ -3282,20 +3282,20 @@ void GriffonEngine::game_endofgame() {
g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
- _tickspassed = ticks;
- ticks = g_system->getMillis();
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
- _tickspassed = ticks - _tickspassed;
- fpsr = (float)_tickspassed / 24;
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24;
- fp++;
- if (ticks > _nextticks) {
- _nextticks = ticks + 1000;
- fps = fp;
- fp = 0;
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
}
- float add = 0.5 * fpsr;
+ float add = 0.5 * _fpsr;
if (add > 1)
add = 1;
xofs = xofs + add;
@@ -3312,14 +3312,14 @@ void GriffonEngine::game_endofgame() {
} while (1);
- ticks1 = ticks;
+ _ticks1 = _ticks;
int y1 = 0;
_videobuffer2->copyRectToSurface(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
do {
- if (ticks < ticks1 + 1500) {
- y1 = 255 * (ticks - ticks1) / 1500;
+ if (_ticks < _ticks1 + 1500) {
+ y1 = 255 * (_ticks - _ticks1) / 1500;
if (y1 < 0)
y1 = 0;
if (y1 > 255)
@@ -3340,32 +3340,32 @@ void GriffonEngine::game_endofgame() {
g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
- _tickspassed = ticks;
- ticks = g_system->getMillis();
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
- _tickspassed = ticks - _tickspassed;
- fpsr = (float)_tickspassed / 24;
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24;
- fp++;
- if (ticks > _nextticks) {
- _nextticks = ticks + 1000;
- fps = fp;
- fp = 0;
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
}
} while (1);
- int keywait = 2000 + ticks;
+ int keywait = 2000 + _ticks;
- ticks1 = ticks;
+ _ticks1 = _ticks;
y1 = 0;
do {
_videobuffer->copyRectToSurface(_theendimg->getPixels(), _theendimg->pitch, 0, 0, _theendimg->w, _theendimg->h);
y1 = 255;
- if (ticks < ticks1 + 1000) {
- y1 = 255 * (ticks - ticks1) / 1000;
+ if (_ticks < _ticks1 + 1000) {
+ y1 = 255 * (_ticks - _ticks1) / 1000;
if (y1 < 0)
y1 = 0;
if (y1 > 255)
@@ -3379,22 +3379,22 @@ void GriffonEngine::game_endofgame() {
g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
- _tickspassed = ticks;
- ticks = g_system->getMillis();
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
- _tickspassed = ticks - _tickspassed;
- fpsr = (float)_tickspassed / 24;
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24;
- fp++;
- if (ticks > _nextticks) {
- _nextticks = ticks + 1000;
- fps = fp;
- fp = 0;
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
}
g_system->getEventManager()->pollEvent(_event);
- if (_event.type == Common::EVENT_KEYDOWN && keywait < ticks)
+ if (_event.type == Common::EVENT_KEYDOWN && keywait < _ticks)
break;
} while (1);
@@ -3412,9 +3412,9 @@ void GriffonEngine::game_eventtext(const char *stri) {
int x = 160 - 4 * strlen(stri);
- ticks = g_system->getMillis();
- int pauseticks = ticks + 500;
- int bticks = ticks;
+ _ticks = g_system->getMillis();
+ int pause_ticks = _ticks + 500;
+ int b_ticks = _ticks;
_videobuffer->blit(*_videobuffer3);
_videobuffer->blit(*_videobuffer2);
@@ -3422,21 +3422,21 @@ void GriffonEngine::game_eventtext(const char *stri) {
do {
g_system->getEventManager()->pollEvent(_event);
- if (_event.type == Common::EVENT_KEYDOWN && pauseticks < ticks)
+ if (_event.type == Common::EVENT_KEYDOWN && pause_ticks < _ticks)
break;
_videobuffer2->blit(*_videobuffer);
int fr = 192;
- if (pauseticks > ticks)
- fr = 192 * (ticks - bticks) / 500;
+ if (pause_ticks > _ticks)
+ fr = 192 * (_ticks - b_ticks) / 500;
if (fr > 192)
fr = 192;
_windowimg->setAlpha(fr, true);
_windowimg->blit(*_videobuffer);
- if (pauseticks < ticks)
+ if (pause_ticks < _ticks)
sys_print(_videobuffer, stri, x, 15, 0);
g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
@@ -3445,17 +3445,17 @@ void GriffonEngine::game_eventtext(const char *stri) {
g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
- _tickspassed = ticks;
- ticks = g_system->getMillis();
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
- _tickspassed = ticks - _tickspassed;
- fpsr = (float)_tickspassed / 24.0;
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24.0;
- fp++;
- if (ticks > _nextticks) {
- _nextticks = ticks + 1000;
- fps = fp;
- fp = 0;
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
}
g_system->delayMillis(10);
@@ -3463,7 +3463,7 @@ void GriffonEngine::game_eventtext(const char *stri) {
_videobuffer3->blit(*_videobuffer);
- _itemticks = ticks + 210;
+ _itemticks = _ticks + 210;
}
@@ -3480,7 +3480,7 @@ void GriffonEngine::game_handlewalking() {
opx = px;
opy = py;
- spd = _player.walkspd * fpsr;
+ spd = _player.walkspd * _fpsr;
nx = (px / 2 + 6);
ny = (py / 2 + 10);
@@ -3663,7 +3663,7 @@ void GriffonEngine::game_handlewalking() {
_player.py = py;
if (_player.px != _player.opx || _player.py != _player.opy)
- _player.walkframe = _player.walkframe + _animspd * fpsr;
+ _player.walkframe = _player.walkframe + _animspd * _fpsr;
if (_player.walkframe >= 16)
_player.walkframe = _player.walkframe - 16;
@@ -4091,7 +4091,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
npcinfo[i].spelldamage = 30;
npcinfo[i].walkspd = 1.4f;
- npcinfo[i].castpause = ticks;
+ npcinfo[i].castpause = _ticks;
}
// boss1
@@ -4233,7 +4233,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
npcinfo[i].attackframe = 0;
npcinfo[i].cattackframe = 0;
npcinfo[i].attackspd = 1.5;
- npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay * (1 + RND() * 2);
+ npcinfo[i].attacknext = _ticks + npcinfo[i].attackdelay * (1 + RND() * 2);
if (npcinfo[i].spriteset == 2 || npcinfo[i].spriteset == 9) {
npcinfo[i].bodysection[0].sprite = 0;
@@ -4310,7 +4310,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
}
}
- npcinfo[i].pause = ticks;
+ npcinfo[i].pause = _ticks;
}
file.close();
@@ -4553,12 +4553,12 @@ void GriffonEngine::game_newgame() {
_videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
_videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
- ticks = g_system->getMillis();
+ _ticks = g_system->getMillis();
_videobuffer->blit(*_videobuffer3);
_videobuffer->blit(*_videobuffer2);
- fpsr = 0.0;
+ _fpsr = 0.0;
int y = 140;
if (menabled && config.music) {
@@ -4575,7 +4575,7 @@ void GriffonEngine::game_newgame() {
do {
Common::Rect rc;
- ld += 4 * fpsr;
+ ld += 4 * _fpsr;
if ((int)ld > config.musicvol)
ld = config.musicvol;
if (menabled && ldstop == 0) {
@@ -4615,20 +4615,20 @@ void GriffonEngine::game_newgame() {
g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
- _tickspassed = ticks;
- ticks = g_system->getMillis();
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
- _tickspassed = ticks - _tickspassed;
- fpsr = (float)_tickspassed / 24.0;
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24.0;
- fp++;
- if (ticks > _nextticks) {
- _nextticks = ticks + 1000;
- fps = fp;
- fp = 0;
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
}
- add = 0.5 * fpsr;
+ add = 0.5 * _fpsr;
if (add > 1)
add = 1;
xofs += add;
@@ -4832,14 +4832,14 @@ void GriffonEngine::game_saveloadnew() {
int curcol = 0;
int lowerlock = 0;
- ticks = g_system->getMillis();
- int ticks1 = ticks;
- int tickpause = ticks + 150;
+ _ticks = g_system->getMillis();
+ int _ticks1 = _ticks;
+ int tickpause = _ticks + 150;
do {
_videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
- y = y + 1 * fpsr;
+ y = y + 1 * _fpsr;
rcDest.left = 256 + 256 * cos(3.141592 / 180 * clouddeg * 40);
rcDest.top = 192 + 192 * sin(3.141592 / 180 * clouddeg * 40);
@@ -4868,9 +4868,9 @@ void GriffonEngine::game_saveloadnew() {
return;
}
- if (tickpause < ticks) {
+ if (tickpause < _ticks) {
if (_event.type == Common::EVENT_KEYDOWN) {
- _itemticks = ticks + 220;
+ _itemticks = _ticks + 220;
if (_event.kbd.keycode == Common::KEYCODE_RETURN) {
// QUIT - non existent :)
@@ -4892,17 +4892,17 @@ void GriffonEngine::game_saveloadnew() {
if (currow == 0 && curcol == 1) {
lowerlock = 1;
currow = 1 + _saveslot;
- tickpause = ticks + 125;
+ tickpause = _ticks + 125;
}
// SAVE GAME
if (currow == 0 && curcol == 2) {
lowerlock = 1;
currow = 1;
- tickpause = ticks + 125;
+ tickpause = _ticks + 125;
}
- if (lowerlock == 1 && curcol == 1 && tickpause < ticks) {
+ if (lowerlock == 1 && curcol == 1 && tickpause < _ticks) {
if (state_save(currow - 1)) {
secstart = secstart + secsingame;
secsingame = 0;
@@ -4912,7 +4912,7 @@ void GriffonEngine::game_saveloadnew() {
}
}
- if (lowerlock == 1 && curcol == 2 && tickpause < ticks) {
+ if (lowerlock == 1 && curcol == 2 && tickpause < _ticks) {
if (state_load(currow - 1)) {
_player.walkspd = 1.1f;
_animspd = 0.5f;
@@ -4934,7 +4934,7 @@ void GriffonEngine::game_saveloadnew() {
}
}
- tickpause = ticks + 125;
+ tickpause = _ticks + 125;
}
switch (_event.kbd.keycode) {
@@ -4943,14 +4943,14 @@ void GriffonEngine::game_saveloadnew() {
return;
lowerlock = 0;
currow = 0;
- tickpause = ticks + 125;
+ tickpause = _ticks + 125;
break;
case Common::KEYCODE_DOWN:
if (lowerlock == 1) {
currow = currow + 1;
if (currow == 5)
currow = 1;
- tickpause = ticks + 125;
+ tickpause = _ticks + 125;
}
break;
@@ -4959,7 +4959,7 @@ void GriffonEngine::game_saveloadnew() {
currow = currow - 1;
if (currow == 0)
currow = 4;
- tickpause = ticks + 125;
+ tickpause = _ticks + 125;
}
break;
@@ -4968,7 +4968,7 @@ void GriffonEngine::game_saveloadnew() {
curcol = curcol - 1;
if (curcol == -1)
curcol = 3;
- tickpause = ticks + 125;
+ tickpause = _ticks + 125;
}
break;
@@ -4977,7 +4977,7 @@ void GriffonEngine::game_saveloadnew() {
curcol = curcol + 1;
if (curcol == 4)
curcol = 0;
- tickpause = ticks + 125;
+ tickpause = _ticks + 125;
}
break;
default:
@@ -5097,8 +5097,8 @@ void GriffonEngine::game_saveloadnew() {
}
int yy = 255;
- if (ticks < ticks1 + 1000) {
- yy = 255 * (ticks - ticks1) / 1000;
+ if (_ticks < _ticks1 + 1000) {
+ yy = 255 * (_ticks - _ticks1) / 1000;
if (yy < 0)
yy = 0;
if (yy > 255)
@@ -5111,24 +5111,24 @@ void GriffonEngine::game_saveloadnew() {
g_system->getEventManager()->pollEvent(_event);
- _tickspassed = ticks;
- ticks = g_system->getMillis();
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
- _tickspassed = ticks - _tickspassed;
- fpsr = (float)_tickspassed / 24;
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24;
- fp++;
- if (ticks > _nextticks) {
- _nextticks = ticks + 1000;
- fps = fp;
- fp = 0;
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
}
- clouddeg += 0.01 * fpsr;
+ clouddeg += 0.01 * _fpsr;
while (clouddeg >= 360)
clouddeg -= 360;
- _itemyloc += 0.6 * fpsr;
+ _itemyloc += 0.6 * _fpsr;
while (_itemyloc >= 16)
_itemyloc -= 16;
@@ -5140,25 +5140,25 @@ void GriffonEngine::game_saveloadnew() {
void GriffonEngine::game_showlogos() {
float y;
- int ticks1;
+ int _ticks1;
- ticks = g_system->getMillis();
- ticks1 = ticks;
+ _ticks = g_system->getMillis();
+ _ticks1 = _ticks;
y = 0.0;
do {
y = 255.0;
- if (ticks < ticks1 + 1000) {
- y = 255.0 * ((float)(ticks - ticks1) / 1000.0);
+ if (_ticks < _ticks1 + 1000) {
+ y = 255.0 * ((float)(_ticks - _ticks1) / 1000.0);
if (y < 0.0)
y = 0.0;
if (y > 255.0)
y = 255.0;
}
- if (ticks > ticks1 + 3000) {
- y = 255.0 - 255.0 * ((float)(ticks - ticks1 - 3000.0) / 1000.0);
+ if (_ticks > _ticks1 + 3000) {
+ y = 255.0 - 255.0 * ((float)(_ticks - _ticks1 - 3000.0) / 1000.0);
if (y < 0.0)
y = 0.0;
if (y > 255.0)
@@ -5176,21 +5176,21 @@ void GriffonEngine::game_showlogos() {
if (_event.type == Common::EVENT_QUIT)
_shouldQuit = true;
- _tickspassed = ticks;
- ticks = g_system->getMillis();
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
- _tickspassed = ticks - _tickspassed;
- fpsr = (float)_tickspassed / 24;
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24;
- fp++;
- if (ticks > _nextticks) {
- _nextticks = ticks + 1000;
- fps = fp;
- fp = 0;
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
}
g_system->delayMillis(10);
- if (ticks > ticks1 + 4000)
+ if (_ticks > _ticks1 + 4000)
break;
} while (!_shouldQuit);
}
@@ -5202,7 +5202,7 @@ void GriffonEngine::game_swash() {
y = 0;
do {
- y = y + 1 * fpsr;
+ y = y + 1 * _fpsr;
_videobuffer->setAlpha((int)y);
_videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
@@ -5213,20 +5213,20 @@ void GriffonEngine::game_swash() {
g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
- _tickspassed = ticks;
- ticks = g_system->getMillis();
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
- _tickspassed = ticks - _tickspassed;
- fpsr = (float)_tickspassed / 24.0;
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24.0;
- fp++;
- if (ticks > _nextticks) {
- _nextticks = ticks + 1000;
- fps = fp;
- fp = 0;
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
}
- clouddeg += 0.01 * fpsr;
+ clouddeg += 0.01 * _fpsr;
while (clouddeg >= 360)
clouddeg = clouddeg - 360;
@@ -5236,7 +5236,7 @@ void GriffonEngine::game_swash() {
y = 0;
do {
- y = y + 1 * fpsr;
+ y = y + 1 * _fpsr;
_videobuffer->setAlpha((int)(y * 25));
_mapbg->blit(*_videobuffer);
@@ -5256,20 +5256,20 @@ void GriffonEngine::game_swash() {
g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
- _tickspassed = ticks;
- ticks = g_system->getMillis();
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
- _tickspassed = ticks - _tickspassed;
- fpsr = (float)_tickspassed / 24.0;
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24.0;
- fp++;
- if (ticks > _nextticks) {
- _nextticks = ticks + 1000;
- fps = fp;
- fp = 0;
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
}
- clouddeg += 0.01 * fpsr;
+ clouddeg += 0.01 * _fpsr;
while (clouddeg >= 360)
clouddeg = clouddeg - 360;
@@ -5287,7 +5287,7 @@ void GriffonEngine::game_theend() {
floaticon[i][0] = 0;
}
- for (float y = 0; y < 100; y += fpsr) {
+ for (float y = 0; y < 100; y += _fpsr) {
_videobuffer->setAlpha((int)y);
_videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
@@ -5296,17 +5296,17 @@ void GriffonEngine::game_theend() {
g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
- _tickspassed = ticks;
- ticks = g_system->getMillis();
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
- _tickspassed = ticks - _tickspassed;
- fpsr = (float)_tickspassed / 24.0;
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24.0;
- fp++;
- if (ticks > _nextticks) {
- _nextticks = ticks + 1000;
- fps = fp;
- fp = 0;
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
}
}
@@ -5324,14 +5324,14 @@ void GriffonEngine::game_title(int mode) {
_videobuffer2->fillRect(rcSrc, 0);
_videobuffer3->fillRect(rcSrc, 0);
- ticks = g_system->getMillis();
+ _ticks = g_system->getMillis();
_videobuffer->blit(*_videobuffer3);
_videobuffer->blit(*_videobuffer2);
int cursel = 0;
- int keypause = ticks + 220;
- int ticks1 = ticks;
+ int keypause = _ticks + 220;
+ int _ticks1 = _ticks;
if (menabled && config.music) {
Mix_Volume(musicchannel, 0);
@@ -5348,7 +5348,7 @@ void GriffonEngine::game_title(int mode) {
do {
Common::Rect rc;
- ld += 4.0 * fpsr;
+ ld += 4.0 * _fpsr;
if (ld > config.musicvol)
ld = config.musicvol;
if (menabled && ldstop == 0) {
@@ -5390,8 +5390,8 @@ void GriffonEngine::game_title(int mode) {
_itemimg[15]->blit(*_videobuffer, rc.left, rc.top);
float yf = 255.0;
- if (ticks < ticks1 + 1000) {
- yf = 255.0 * ((float)(ticks - ticks1) / 1000.0);
+ if (_ticks < _ticks1 + 1000) {
+ yf = 255.0 * ((float)(_ticks - _ticks1) / 1000.0);
if (y < 0.0)
yf = 0.0;
if (y > 255.0)
@@ -5402,20 +5402,20 @@ void GriffonEngine::game_title(int mode) {
g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
- _tickspassed = ticks;
- ticks = g_system->getMillis();
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
- _tickspassed = ticks - _tickspassed;
- fpsr = (float)_tickspassed / 24.0;
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24.0;
- fp++;
- if (ticks > _nextticks) {
- _nextticks = ticks + 1000;
- fps = fp;
- fp = 0;
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
}
- float add = 0.5 * fpsr;
+ float add = 0.5 * _fpsr;
if (add > 1)
add = 1;
@@ -5423,7 +5423,7 @@ void GriffonEngine::game_title(int mode) {
if (xofs >= 320.0)
xofs -= 320.0;
- _itemyloc += 0.75 * fpsr;
+ _itemyloc += 0.75 * _fpsr;
while (_itemyloc >= 16)
_itemyloc = _itemyloc - 16;
@@ -5433,9 +5433,9 @@ void GriffonEngine::game_title(int mode) {
if (_event.type == Common::EVENT_QUIT)
_shouldQuit = true;
- if (keypause < ticks) {
+ if (keypause < _ticks) {
if (_event.type == Common::EVENT_KEYDOWN) {
- keypause = ticks + 150;
+ keypause = _ticks + 150;
if (_event.kbd.keycode == Common::KEYCODE_ESCAPE && mode == 1)
break;
@@ -5450,14 +5450,14 @@ void GriffonEngine::game_title(int mode) {
} else if (_event.kbd.keycode == Common::KEYCODE_RETURN) {
if (cursel == 0) {
game_saveloadnew();
- ticks = g_system->getMillis();
- keypause = ticks + 150;
- ticks1 = ticks;
+ _ticks = g_system->getMillis();
+ keypause = _ticks + 150;
+ _ticks1 = _ticks;
} else if (cursel == 1) {
game_configmenu();
- ticks = g_system->getMillis();
- keypause = ticks + 150;
- ticks1 = ticks;
+ _ticks = g_system->getMillis();
+ keypause = _ticks + 150;
+ _ticks1 = _ticks;
} else if (cursel == 2) {
_shouldQuit = true;
} else if (cursel == 3) {
@@ -5470,7 +5470,7 @@ void GriffonEngine::game_title(int mode) {
g_system->delayMillis(10);
} while (!_shouldQuit);
- _itemticks = ticks + 210;
+ _itemticks = _ticks + 210;
if (menabled && config.music) {
Mix_HaltChannel(menuchannel);
@@ -5489,7 +5489,7 @@ void GriffonEngine::game_updanims() {
// objectinfo[i][6] = 0; // ?? out of bounds
if (nframes > 1) {
- frame = frame + o_animspd / 50 * fpsr;
+ frame = frame + o_animspd / 50 * _fpsr;
while (frame >= nframes)
frame = frame - nframes;
@@ -5628,9 +5628,9 @@ void GriffonEngine::game_updnpcs() {
if (npcinfo[i].hp < npcinfo[i].maxhp * 0.25)
mode = 3;
- if (npcinfo[i].pause > ticks)
+ if (npcinfo[i].pause > _ticks)
mode = -1;
- if (npcinfo[i].spriteset == 2 && npcinfo[i].castpause > ticks)
+ if (npcinfo[i].spriteset == 2 && npcinfo[i].castpause > _ticks)
mode = -1;
if (mode == 3) {
@@ -5679,11 +5679,11 @@ void GriffonEngine::game_updnpcs() {
int movingdir = npcinfo[i].movingdir;
- if (npcinfo[i].ticks > ticks + 100000)
- npcinfo[i].ticks = ticks;
+ if (npcinfo[i].ticks > _ticks + 100000)
+ npcinfo[i].ticks = _ticks;
- if (npcinfo[i].ticks < ticks) {
- npcinfo[i].ticks = ticks + 2000;
+ if (npcinfo[i].ticks < _ticks) {
+ npcinfo[i].ticks = _ticks + 2000;
movingdir = (int)(RND() * 8);
npcinfo[i].movingdir = movingdir;
}
@@ -5764,7 +5764,7 @@ void GriffonEngine::game_updnpcs() {
if (npcinfo[i].spriteset == 10)
wspd = wspd * 2;
- float ii = wspd * fpsr;
+ float ii = wspd * _fpsr;
if (ii < 1)
ii = 1;
@@ -5910,13 +5910,13 @@ void GriffonEngine::game_updnpcs() {
}
if (movinup)
- npy = npy - wspd * fpsr;
+ npy = npy - wspd * _fpsr;
if (movindown)
- npy = npy + wspd * fpsr;
+ npy = npy + wspd * _fpsr;
if (movinleft)
- npx = npx - wspd * fpsr;
+ npx = npx - wspd * _fpsr;
if (movinright)
- npx = npx + wspd * fpsr;
+ npx = npx + wspd * _fpsr;
if (checkpass) {
pass = 0;
@@ -5925,7 +5925,7 @@ void GriffonEngine::game_updnpcs() {
if (pass == 0) {
npx = onpx;
npy = onpy;
- npcinfo[i].ticks = ticks;
+ npcinfo[i].ticks = _ticks;
}
}
@@ -5978,7 +5978,7 @@ void GriffonEngine::game_updnpcs() {
float frame = npcinfo[i].frame;
int cframe = npcinfo[i].cframe;
- frame = frame + aspd * fpsr;
+ frame = frame + aspd * _fpsr;
while (frame >= 16)
frame = frame - 16;
@@ -5993,8 +5993,8 @@ void GriffonEngine::game_updnpcs() {
}
// spriteset1 specific
- if (npcinfo[i].spriteset == 1 && npcinfo[i].attackattempt < ticks) {
- if (npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ if (npcinfo[i].spriteset == 1 && npcinfo[i].attackattempt < _ticks) {
+ if (npcinfo[i].attacknext < _ticks && npcinfo[i].pause < _ticks && npcinfo[i].attacking == 0) {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
@@ -6002,7 +6002,7 @@ void GriffonEngine::game_updnpcs() {
ydif = _player.py - npy;
if (abs(xdif) < 20 && abs(ydif) < 20) {
- npcinfo[i].attackattempt = ticks + 100;
+ npcinfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndenemyhit]);
@@ -6020,7 +6020,7 @@ void GriffonEngine::game_updnpcs() {
// onewing specific
if (npcinfo[i].spriteset == 2) {
- if (npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ if (npcinfo[i].attacknext < _ticks && npcinfo[i].pause < _ticks && npcinfo[i].attacking == 0) {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
@@ -6048,15 +6048,15 @@ void GriffonEngine::game_updnpcs() {
dospell = false;
- if (npcinfo[i].attacking == 0 && npcinfo[i].castpause < ticks) {
- npcinfo[i].swayspd = npcinfo[i].swayspd + npcinfo[i].swayspd / 200 * fpsr;
+ if (npcinfo[i].attacking == 0 && npcinfo[i].castpause < _ticks) {
+ npcinfo[i].swayspd = npcinfo[i].swayspd + npcinfo[i].swayspd / 200 * _fpsr;
if (npcinfo[i].swayspd > 15) {
dospell = true;
npcinfo[i].swayspd = 1;
}
// sway code
- npcinfo[i].swayangle = npcinfo[i].swayangle + npcinfo[i].swayspd * fpsr;
+ npcinfo[i].swayangle = npcinfo[i].swayangle + npcinfo[i].swayspd * _fpsr;
if (npcinfo[i].swayangle >= 360)
npcinfo[i].swayangle = npcinfo[i].swayangle - 360;
@@ -6065,9 +6065,9 @@ void GriffonEngine::game_updnpcs() {
}
if (dospell) {
- npcinfo[i].pause = ticks + 3000;
- npcinfo[i].attacknext = ticks + 4500;
- npcinfo[i].castpause = ticks + 4500;
+ npcinfo[i].pause = _ticks + 3000;
+ npcinfo[i].attacknext = _ticks + 4500;
+ npcinfo[i].castpause = _ticks + 4500;
game_castspell(3, npcinfo[i].x, npcinfo[i].y, npcinfo[i].x, npcinfo[i].y, i);
@@ -6080,8 +6080,8 @@ void GriffonEngine::game_updnpcs() {
ydif = npcinfo[i].bodysection[7].y - npcinfo[i].headtargety[0];
- npcinfo[i].bodysection[7].x = npcinfo[i].bodysection[7].x - xdif * 0.4 * fpsr;
- npcinfo[i].bodysection[7].y = npcinfo[i].bodysection[7].y - ydif * 0.4 * fpsr;
+ npcinfo[i].bodysection[7].x = npcinfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
+ npcinfo[i].bodysection[7].y = npcinfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
npcinfo[i].bodysection[0].x = npcinfo[i].x + 12;
@@ -6101,16 +6101,16 @@ void GriffonEngine::game_updnpcs() {
// boss1 specific and blackknight
if (npcinfo[i].spriteset == 3 || npcinfo[i].spriteset == 4) {
- if (npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ if (npcinfo[i].attacknext < _ticks && npcinfo[i].pause < _ticks && npcinfo[i].attacking == 0) {
npcinfo[i].attacking = 1;
npcinfo[i].attackframe = 0;
game_castspell(1, npcinfo[i].x, npcinfo[i].y, _player.px, _player.py, i);
}
- if (npcinfo[i].castpause < ticks) {
+ if (npcinfo[i].castpause < _ticks) {
game_castspell(6, npcinfo[i].x, npcinfo[i].y, _player.px, _player.py, i);
- npcinfo[i].castpause = ticks + 12000;
+ npcinfo[i].castpause = _ticks + 12000;
}
}
@@ -6120,13 +6120,13 @@ void GriffonEngine::game_updnpcs() {
npcinfo[i].swayspd = 4;
// sway code
- npcinfo[i].swayangle = npcinfo[i].swayangle + npcinfo[i].swayspd * fpsr;
+ npcinfo[i].swayangle = npcinfo[i].swayangle + npcinfo[i].swayspd * _fpsr;
if (npcinfo[i].swayangle >= 360)
npcinfo[i].swayangle = npcinfo[i].swayangle - 360;
for (int ff = 0; ff <= 2; ff++) {
if (npcinfo[i].hp > 10 * ff * 20) {
- if (npcinfo[i].pause < ticks && npcinfo[i].attacking2[ff] == 0 && npcinfo[i].attacknext2[ff] < ticks) {
+ if (npcinfo[i].pause < _ticks && npcinfo[i].attacking2[ff] == 0 && npcinfo[i].attacknext2[ff] < _ticks) {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
@@ -6164,8 +6164,8 @@ void GriffonEngine::game_updnpcs() {
xdif = npcinfo[i].bodysection[10 * ff + 9].x - npcinfo[i].headtargetx[ff];
ydif = npcinfo[i].bodysection[10 * ff + 9].y - npcinfo[i].headtargety[ff];
- npcinfo[i].bodysection[10 * ff + 9].x = npcinfo[i].bodysection[10 * ff + 9].x - xdif * 0.4 * fpsr;
- npcinfo[i].bodysection[10 * ff + 9].y = npcinfo[i].bodysection[10 * ff + 9].y - ydif * 0.4 * fpsr;
+ npcinfo[i].bodysection[10 * ff + 9].x = npcinfo[i].bodysection[10 * ff + 9].x - xdif * 0.4 * _fpsr;
+ npcinfo[i].bodysection[10 * ff + 9].y = npcinfo[i].bodysection[10 * ff + 9].y - ydif * 0.4 * _fpsr;
npcinfo[i].bodysection[10 * ff].x = npcinfo[i].x + 12 + 8 * cos(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
npcinfo[i].bodysection[10 * ff].y = npcinfo[i].y + 12 + 8 * sin(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
@@ -6185,8 +6185,8 @@ void GriffonEngine::game_updnpcs() {
}
// spriteset6 specific
- if (npcinfo[i].spriteset == 6 && npcinfo[i].attackattempt < ticks) {
- if (npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ if (npcinfo[i].spriteset == 6 && npcinfo[i].attackattempt < _ticks) {
+ if (npcinfo[i].attacknext < _ticks && npcinfo[i].pause < _ticks && npcinfo[i].attacking == 0) {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
@@ -6200,7 +6200,7 @@ void GriffonEngine::game_updnpcs() {
pass = 2;
if (pass > 0) {
- npcinfo[i].attackattempt = ticks + 100;
+ npcinfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
npcinfo[i].attacking = 1;
npcinfo[i].attackframe = 0;
@@ -6236,23 +6236,23 @@ void GriffonEngine::game_updnpcs() {
// wizard1 specific
if (npcinfo[i].spriteset == 7) {
- if (npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ if (npcinfo[i].attacknext < _ticks && npcinfo[i].pause < _ticks && npcinfo[i].attacking == 0) {
npcinfo[i].attacking = 1;
npcinfo[i].attackframe = 0;
game_castspell(9, npcinfo[i].x, npcinfo[i].y, _player.px, _player.py, i);
}
- if (npcinfo[i].castpause < ticks) {
+ if (npcinfo[i].castpause < _ticks) {
// game_castspell 6, npcinfo[i].x, npcinfo[i].y, _player.px, _player.py, i
- // npcinfo[i].castpause = ticks + 12000
+ // npcinfo[i].castpause = _ticks + 12000
}
}
// spriteset6 specific
- if (npcinfo[i].spriteset == 8 && npcinfo[i].attackattempt < ticks) {
- if (npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ if (npcinfo[i].spriteset == 8 && npcinfo[i].attackattempt < _ticks) {
+ if (npcinfo[i].attacknext < _ticks && npcinfo[i].pause < _ticks && npcinfo[i].attacking == 0) {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
@@ -6266,7 +6266,7 @@ void GriffonEngine::game_updnpcs() {
pass = 2;
if (pass > 0) {
- npcinfo[i].attackattempt = ticks + 100;
+ npcinfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
npcinfo[i].attacking = 1;
npcinfo[i].attackframe = 0;
@@ -6306,7 +6306,7 @@ void GriffonEngine::game_updnpcs() {
// twowing specific
if (npcinfo[i].spriteset == 9) {
- if (npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ if (npcinfo[i].attacknext < _ticks && npcinfo[i].pause < _ticks && npcinfo[i].attacking == 0) {
npx = npcinfo[i].bodysection[7].x;
npy = npcinfo[i].bodysection[7].y;
@@ -6332,11 +6332,11 @@ void GriffonEngine::game_updnpcs() {
}
- if (npcinfo[i].attacking == 0 && npcinfo[i].castpause < ticks) {
+ if (npcinfo[i].attacking == 0 && npcinfo[i].castpause < _ticks) {
npcinfo[i].swayspd = 4;
// sway code
- npcinfo[i].swayangle = npcinfo[i].swayangle + npcinfo[i].swayspd * fpsr;
+ npcinfo[i].swayangle = npcinfo[i].swayangle + npcinfo[i].swayspd * _fpsr;
if (npcinfo[i].swayangle >= 360)
npcinfo[i].swayangle = npcinfo[i].swayangle - 360;
@@ -6345,9 +6345,9 @@ void GriffonEngine::game_updnpcs() {
}
if (dospell) {
- npcinfo[i].pause = ticks + 3000;
- npcinfo[i].attacknext = ticks + 5000;
- npcinfo[i].castpause = ticks + 3000;
+ npcinfo[i].pause = _ticks + 3000;
+ npcinfo[i].attacknext = _ticks + 5000;
+ npcinfo[i].castpause = _ticks + 3000;
game_castspell(3, npcinfo[i].x, npcinfo[i].y, npcinfo[i].x, npcinfo[i].y, i);
@@ -6360,8 +6360,8 @@ void GriffonEngine::game_updnpcs() {
ydif = npcinfo[i].bodysection[7].y - npcinfo[i].headtargety[0];
- npcinfo[i].bodysection[7].x = npcinfo[i].bodysection[7].x - xdif * 0.4 * fpsr;
- npcinfo[i].bodysection[7].y = npcinfo[i].bodysection[7].y - ydif * 0.4 * fpsr;
+ npcinfo[i].bodysection[7].x = npcinfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
+ npcinfo[i].bodysection[7].y = npcinfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
npcinfo[i].bodysection[0].x = npcinfo[i].x + 12;
npcinfo[i].bodysection[0].y = npcinfo[i].y + 12;
@@ -6380,8 +6380,8 @@ void GriffonEngine::game_updnpcs() {
}
// dragon2 specific
- if (npcinfo[i].spriteset == 10 && npcinfo[i].attackattempt < ticks) {
- if (npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ if (npcinfo[i].spriteset == 10 && npcinfo[i].attackattempt < _ticks) {
+ if (npcinfo[i].attacknext < _ticks && npcinfo[i].pause < _ticks && npcinfo[i].attacking == 0) {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
@@ -6389,7 +6389,7 @@ void GriffonEngine::game_updnpcs() {
ydif = _player.py - npy;
if (abs(xdif) < 32 && abs(ydif) < 32) {
- npcinfo[i].attackattempt = ticks + 100;
+ npcinfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndenemyhit]);
@@ -6405,8 +6405,8 @@ void GriffonEngine::game_updnpcs() {
// endboss specific
- if (npcinfo[i].spriteset == 11 && npcinfo[i].attackattempt < ticks) {
- if (npcinfo[i].attacknext < ticks && npcinfo[i].pause < ticks && npcinfo[i].attacking == 0) {
+ if (npcinfo[i].spriteset == 11 && npcinfo[i].attackattempt < _ticks) {
+ if (npcinfo[i].attacknext < _ticks && npcinfo[i].pause < _ticks && npcinfo[i].attacking == 0) {
npx = npcinfo[i].x;
npy = npcinfo[i].y;
@@ -6414,7 +6414,7 @@ void GriffonEngine::game_updnpcs() {
ydif = _player.py - npy;
if (abs(xdif) < 38 && abs(ydif) < 38) {
- npcinfo[i].attackattempt = ticks + 100;
+ npcinfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndice]);
@@ -6440,7 +6440,7 @@ void GriffonEngine::game_updnpcs() {
rcSrc.setWidth(3);
rcSrc.setHeight(3);
- if (npcinfo[i].pause < ticks)
+ if (npcinfo[i].pause < _ticks)
_clipbg->fillRect(rcSrc, i);
@@ -6461,11 +6461,11 @@ void GriffonEngine::game_updnpcs() {
float damage;
// spriteset1 specific
if (npcinfo[i].spriteset == 1) {
- npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * fpsr;
+ npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * _fpsr;
if (npcinfo[i].attackframe >= 16) {
npcinfo[i].attackframe = 0;
npcinfo[i].attacking = 0;
- npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
+ npcinfo[i].attacknext = _ticks + npcinfo[i].attackdelay;
}
npcinfo[i].cattackframe = (int)(npcinfo[i].attackframe);
@@ -6478,8 +6478,8 @@ void GriffonEngine::game_updnpcs() {
dist = 10;
- if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < ticks) {
- npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
+ if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
+ npcinfo[i].attacknext = _ticks + npcinfo[i].attackdelay;
// npcinfo[i].attackframe = 0;
// npcinfo[i].attacking = 0;
@@ -6495,8 +6495,8 @@ void GriffonEngine::game_updnpcs() {
float xdif = npcinfo[i].bodysection[7].x - npcinfo[i].headtargetx[0];
float ydif = npcinfo[i].bodysection[7].y - npcinfo[i].headtargety[0];
- npcinfo[i].bodysection[7].x = npcinfo[i].bodysection[7].x - xdif * 0.4 * fpsr;
- npcinfo[i].bodysection[7].y = npcinfo[i].bodysection[7].y - ydif * 0.4 * fpsr;
+ npcinfo[i].bodysection[7].x = npcinfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
+ npcinfo[i].bodysection[7].y = npcinfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
npcinfo[i].bodysection[0].x = npcinfo[i].x + 12;
npcinfo[i].bodysection[0].y = npcinfo[i].y + 12;
@@ -6512,11 +6512,11 @@ void GriffonEngine::game_updnpcs() {
npcinfo[i].bodysection[f].y = npcinfo[i].bodysection[f].y - (npcinfo[i].bodysection[f].y - ty);
}
- npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * fpsr;
+ npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * _fpsr;
if (npcinfo[i].attackframe >= 16) {
npcinfo[i].attackframe = 0;
npcinfo[i].attacking = 0;
- npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
+ npcinfo[i].attacknext = _ticks + npcinfo[i].attackdelay;
}
npcinfo[i].cattackframe = (int)(npcinfo[i].attackframe);
@@ -6529,8 +6529,8 @@ void GriffonEngine::game_updnpcs() {
dist = 8;
- if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < ticks) {
- npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
+ if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
+ npcinfo[i].attacknext = _ticks + npcinfo[i].attackdelay;
// npcinfo[i].attackframe = 0
// npcinfo[i].attacking = 0
damage = (float)npcinfo[i].attackdamage * (1.0 + (RND() * 0.5));
@@ -6547,8 +6547,8 @@ void GriffonEngine::game_updnpcs() {
float xdif = npcinfo[i].bodysection[10 * ff + 9].x - npcinfo[i].headtargetx[ff];
float ydif = npcinfo[i].bodysection[10 * ff + 9].y - npcinfo[i].headtargety[ff];
- npcinfo[i].bodysection[10 * ff + 9].x = npcinfo[i].bodysection[10 * ff + 9].x - xdif * .2 * fpsr;
- npcinfo[i].bodysection[10 * ff + 9].y = npcinfo[i].bodysection[10 * ff + 9].y - ydif * .2 * fpsr;
+ npcinfo[i].bodysection[10 * ff + 9].x = npcinfo[i].bodysection[10 * ff + 9].x - xdif * .2 * _fpsr;
+ npcinfo[i].bodysection[10 * ff + 9].y = npcinfo[i].bodysection[10 * ff + 9].y - ydif * .2 * _fpsr;
npcinfo[i].bodysection[10 * ff].x = npcinfo[i].x + 12 + 8 * cos(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
npcinfo[i].bodysection[10 * ff].y = npcinfo[i].y + 12 + 8 * sin(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
@@ -6564,11 +6564,11 @@ void GriffonEngine::game_updnpcs() {
npcinfo[i].bodysection[ff * 10 + f].y = npcinfo[i].bodysection[ff * 10 + f].y - (npcinfo[i].bodysection[ff * 10 + f].y - ty) / 3;
}
- npcinfo[i].attackframe2[ff] = npcinfo[i].attackframe2[ff] + npcinfo[i].attackspd * fpsr;
+ npcinfo[i].attackframe2[ff] = npcinfo[i].attackframe2[ff] + npcinfo[i].attackspd * _fpsr;
if (npcinfo[i].attackframe2[ff] >= 16) {
npcinfo[i].attackframe2[ff] = 0;
npcinfo[i].attacking2[ff] = 0;
- npcinfo[i].attacknext2[ff] = ticks + npcinfo[i].attackdelay;
+ npcinfo[i].attacknext2[ff] = _ticks + npcinfo[i].attackdelay;
}
npcinfo[i].cattackframe = (int)(npcinfo[i].attackframe);
@@ -6581,8 +6581,8 @@ void GriffonEngine::game_updnpcs() {
dist = 8;
- if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < ticks) {
- npcinfo[i].attacknext2[ff] = ticks + npcinfo[i].attackdelay;
+ if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
+ npcinfo[i].attacknext2[ff] = _ticks + npcinfo[i].attackdelay;
// npcinfo[i].attackframe2(ff) = 0
// npcinfo[i].attacking2(ff) = 0
damage = (float)npcinfo[i].attackdamage * (1.0 + RND() * 0.5);
@@ -6600,8 +6600,8 @@ void GriffonEngine::game_updnpcs() {
float xdif = npcinfo[i].bodysection[7].x - npcinfo[i].headtargetx[0];
float ydif = npcinfo[i].bodysection[7].y - npcinfo[i].headtargety[0];
- npcinfo[i].bodysection[7].x = npcinfo[i].bodysection[7].x - xdif * 0.4 * fpsr;
- npcinfo[i].bodysection[7].y = npcinfo[i].bodysection[7].y - ydif * 0.4 * fpsr;
+ npcinfo[i].bodysection[7].x = npcinfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
+ npcinfo[i].bodysection[7].y = npcinfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
npcinfo[i].bodysection[0].x = npcinfo[i].x + 12;
npcinfo[i].bodysection[0].y = npcinfo[i].y + 12;
@@ -6617,11 +6617,11 @@ void GriffonEngine::game_updnpcs() {
npcinfo[i].bodysection[f].y = npcinfo[i].bodysection[f].y - (npcinfo[i].bodysection[f].y - ty);
}
- npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * fpsr;
+ npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * _fpsr;
if (npcinfo[i].attackframe >= 16) {
npcinfo[i].attackframe = 0;
npcinfo[i].attacking = 0;
- npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
+ npcinfo[i].attacknext = _ticks + npcinfo[i].attackdelay;
}
npcinfo[i].cattackframe = (int)(npcinfo[i].attackframe);
@@ -6634,8 +6634,8 @@ void GriffonEngine::game_updnpcs() {
dist = 8;
- if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < ticks) {
- npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
+ if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
+ npcinfo[i].attacknext = _ticks + npcinfo[i].attackdelay;
// npcinfo[i].attackframe = 0
// npcinfo[i].attacking = 0
damage = (float)npcinfo[i].attackdamage * (1.0 + RND() * 0.5);
@@ -6647,11 +6647,11 @@ void GriffonEngine::game_updnpcs() {
// dragon 2 specific
if (npcinfo[i].spriteset == 10) {
- npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * fpsr;
+ npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * _fpsr;
if (npcinfo[i].attackframe >= 16) {
npcinfo[i].attackframe = 0;
npcinfo[i].attacking = 0;
- npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
+ npcinfo[i].attacknext = _ticks + npcinfo[i].attackdelay;
}
npcinfo[i].cattackframe = (int)(npcinfo[i].attackframe);
@@ -6664,8 +6664,8 @@ void GriffonEngine::game_updnpcs() {
dist = 16 + npcinfo[i].attackframe;
- if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < ticks) {
- npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
+ if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
+ npcinfo[i].attacknext = _ticks + npcinfo[i].attackdelay;
// npcinfo[i].attackframe = 0
// npcinfo[i].attacking = 0
damage = (float)npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
@@ -6676,11 +6676,11 @@ void GriffonEngine::game_updnpcs() {
// endboss specific
if (npcinfo[i].spriteset == 11) {
- npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * fpsr;
+ npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * _fpsr;
if (npcinfo[i].attackframe >= 16) {
npcinfo[i].attackframe = 0;
npcinfo[i].attacking = 0;
- npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
+ npcinfo[i].attacknext = _ticks + npcinfo[i].attackdelay;
}
npcinfo[i].cattackframe = (int)(npcinfo[i].attackframe);
@@ -6693,8 +6693,8 @@ void GriffonEngine::game_updnpcs() {
dist = 36;
- if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < ticks) {
- npcinfo[i].attacknext = ticks + npcinfo[i].attackdelay;
+ if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
+ npcinfo[i].attacknext = _ticks + npcinfo[i].attackdelay;
// npcinfo[i].attackframe = 0
// npcinfo[i].attacking = 0
damage = (float)npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
@@ -6795,7 +6795,7 @@ void GriffonEngine::game_updspells() {
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
- if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
+ if (npcinfo[e].hp > 0 && npcinfo[e].pause < _ticks) {
game_damagenpc(e, damage, 1);
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndice]);
@@ -6862,7 +6862,7 @@ void GriffonEngine::game_updspells() {
_spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
+ spellinfo[i].frame = spellinfo[i].frame - 0.2 * _fpsr;
if (spellinfo[i].frame < 0)
spellinfo[i].frame = 0;
@@ -6874,7 +6874,7 @@ void GriffonEngine::game_updspells() {
if ((abs(xdif) < 24 && abs(ydif) < 24)) {
float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
- if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
+ if (npcinfo[e].hp > 0 && npcinfo[e].pause < _ticks) {
game_damagenpc(e, damage, 1);
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndmetalhit]);
@@ -6892,8 +6892,8 @@ void GriffonEngine::game_updspells() {
npcinfo[npc].attackframe = 0;
npcinfo[npc].attacking = 0;
- npcinfo[npc].pause = ticks + 1000;
- npcinfo[npc].attacknext = ticks + 4000;
+ npcinfo[npc].pause = _ticks + 1000;
+ npcinfo[npc].attacknext = _ticks + 4000;
}
// ---------------
@@ -6903,15 +6903,15 @@ void GriffonEngine::game_updspells() {
npcinfo[npc].attackframe = 0;
npcinfo[npc].attacking = 0;
- npcinfo[npc].pause = ticks + 1000;
- npcinfo[npc].attacknext = ticks + 3500;
+ npcinfo[npc].pause = _ticks + 1000;
+ npcinfo[npc].attacknext = _ticks + 3500;
}
// ---------------
xdif = (xloc + 24) - (_player.px + 12);
ydif = (yloc + 24) - (_player.py + 12);
- if ((abs(xdif) < 24 && abs(ydif) < 24) && _player.pause < ticks) {
+ if ((abs(xdif) < 24 && abs(ydif) < 24) && _player.pause < _ticks) {
npx = _player.px;
npy = _player.py;
@@ -6996,7 +6996,7 @@ void GriffonEngine::game_updspells() {
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
- if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
+ if (npcinfo[e].hp > 0 && npcinfo[e].pause < _ticks) {
game_damagenpc(e, damage, 1);
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndrocks]);
@@ -7039,7 +7039,7 @@ void GriffonEngine::game_updspells() {
}
}
- spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
+ spellinfo[i].frame = spellinfo[i].frame - 0.2 * _fpsr;
if (spellinfo[i].frame < 0)
spellinfo[i].frame = 0;
}
@@ -7068,7 +7068,7 @@ void GriffonEngine::game_updspells() {
_spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
_spellimg->setAlpha(255, true);
- spellinfo[i].frame = spellinfo[i].frame - 0.3 * fpsr;
+ spellinfo[i].frame = spellinfo[i].frame - 0.3 * _fpsr;
if (spellinfo[i].frame < 0) {
spellinfo[i].frame = 0;
_forcepause = false;
@@ -7184,12 +7184,12 @@ void GriffonEngine::game_updspells() {
float tx = (bx - ax) / d;
float ty = (by - ay) / d;
- spellinfo[i].fireballs[ff][2] += tx * 1.2 * fpsr;
- spellinfo[i].fireballs[ff][3] += ty * 1.2 * fpsr;
+ spellinfo[i].fireballs[ff][2] += tx * 1.2 * _fpsr;
+ spellinfo[i].fireballs[ff][3] += ty * 1.2 * _fpsr;
if (spellinfo[i].ballon[ff] == 1) {
- spellinfo[i].fireballs[ff][0] = ax + spellinfo[i].fireballs[ff][2] * 0.2 * fpsr;
- spellinfo[i].fireballs[ff][1] = ay + spellinfo[i].fireballs[ff][3] * 0.2 * fpsr;
+ spellinfo[i].fireballs[ff][0] = ax + spellinfo[i].fireballs[ff][2] * 0.2 * _fpsr;
+ spellinfo[i].fireballs[ff][1] = ay + spellinfo[i].fireballs[ff][3] * 0.2 * _fpsr;
xloc = spellinfo[i].fireballs[ff][0] + (int)(RND() * 3) - 1;
yloc = spellinfo[i].fireballs[ff][1] + (int)(RND() * 3) - 1;
@@ -7207,7 +7207,7 @@ void GriffonEngine::game_updspells() {
_spellimg->setAlpha(255, true);
}
- spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
+ spellinfo[i].frame = spellinfo[i].frame - 0.2 * _fpsr;
if (spellinfo[i].frame < 0)
spellinfo[i].frame = 0;
@@ -7220,7 +7220,7 @@ void GriffonEngine::game_updspells() {
xdif = (xloc + 8) - (_player.px + 12);
ydif = (yloc + 8) - (_player.py + 12);
- if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < ticks) {
+ if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
float damage = npcinfo[spellinfo[i].npc].spelldamage * (1 + RND() * 0.5) / 3;
if (_player.hp > 0)
@@ -7279,7 +7279,7 @@ void GriffonEngine::game_updspells() {
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = 30 * (1 + RND() * 0.5);
- if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks)
+ if (npcinfo[e].hp > 0 && npcinfo[e].pause < _ticks)
game_damagenpc(e, damage, 1);
}
}
@@ -7337,7 +7337,7 @@ void GriffonEngine::game_updspells() {
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = 30 * (1 + RND() * 0.5);
- if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks)
+ if (npcinfo[e].hp > 0 && npcinfo[e].pause < _ticks)
game_damagenpc(e, damage, 1);
}
}
@@ -7394,7 +7394,7 @@ void GriffonEngine::game_updspells() {
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = 30 * (1 + RND() * 0.5);
- if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks)
+ if (npcinfo[e].hp > 0 && npcinfo[e].pause < _ticks)
game_damagenpc(e, damage, 1);
}
}
@@ -7451,7 +7451,7 @@ void GriffonEngine::game_updspells() {
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = 30 * (1 + RND() * 0.5);
- if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks)
+ if (npcinfo[e].hp > 0 && npcinfo[e].pause < _ticks)
game_damagenpc(e, damage, 1);
}
}
@@ -7481,7 +7481,7 @@ void GriffonEngine::game_updspells() {
}
}
- spellinfo[i].frame -= 0.5 * fpsr;
+ spellinfo[i].frame -= 0.5 * _fpsr;
if (spellinfo[i].frame < 0) {
spellinfo[i].frame = 0;
_forcepause = false;
@@ -7527,7 +7527,7 @@ void GriffonEngine::game_updspells() {
xdif = (x + 8) - (_player.px + 12);
ydif = (y + 8) - (_player.py + 12);
- if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < ticks) {
+ if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
float damage = ((float)_player.hp * 0.75) * (RND() * 0.5 + 0.5);
if (damage < 5)
damage = 5;
@@ -7544,12 +7544,12 @@ void GriffonEngine::game_updspells() {
}
}
- spellinfo[i].frame -= 0.5 * fpsr;
+ spellinfo[i].frame -= 0.5 * _fpsr;
if (spellinfo[i].frame < 0) {
spellinfo[i].frame = 0;
npcinfo[spellinfo[i].npc].attacking = 0;
- npcinfo[spellinfo[i].npc].attacknext = ticks + npcinfo[spellinfo[i].npc].attackdelay;
+ npcinfo[spellinfo[i].npc].attacknext = _ticks + npcinfo[spellinfo[i].npc].attackdelay;
}
}
}
@@ -7589,7 +7589,7 @@ void GriffonEngine::game_updspellsunder() {
_spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
_spellimg->setAlpha(255, true);
- spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
+ spellinfo[i].frame = spellinfo[i].frame - 0.2 * _fpsr;
if (spellinfo[i].frame < 0)
spellinfo[i].frame = 0;
@@ -7606,8 +7606,8 @@ void GriffonEngine::game_updspellsunder() {
if (dist > 5) {
float ratio = (1 - dist / 25);
- float newx = npcinfo[f].x + ratio * xdif / 3 * fpsr;
- float newy = npcinfo[f].y + ratio * ydif / 3 * fpsr;
+ float newx = npcinfo[f].x + ratio * xdif / 3 * _fpsr;
+ float newy = npcinfo[f].y + ratio * ydif / 3 * _fpsr;
int sx = (newx / 2 + 6);
int sy = (newy / 2 + 10);
@@ -7618,7 +7618,7 @@ void GriffonEngine::game_updspellsunder() {
if (dq == 0) {
npcinfo[f].x = newx;
npcinfo[f].y = newy;
- // npcinfo[f].castpause = ticks + 200;
+ // npcinfo[f].castpause = _ticks + 200;
} else {
int xpass = 0;
int ypass = 0;
@@ -7649,7 +7649,7 @@ void GriffonEngine::game_updspellsunder() {
if (xpass == 1 || ypass == 1) {
npcinfo[f].x = newx;
npcinfo[f].y = newy;
- // npcinfo[f].castpause = ticks + 200;
+ // npcinfo[f].castpause = _ticks + 200;
}
}
}
@@ -7712,7 +7712,7 @@ void GriffonEngine::game_updspellsunder() {
damage = -damage;
if (npcinfo[e].spriteset == 11)
damage = -damage;
- if (npcinfo[e].hp > 0 && npcinfo[e].pause < ticks) {
+ if (npcinfo[e].hp > 0 && npcinfo[e].pause < _ticks) {
game_damagenpc(e, damage, 1);
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndfire]);
@@ -7727,7 +7727,7 @@ void GriffonEngine::game_updspellsunder() {
float xdif = (xloc + 8) - (_player.px + 12);
float ydif = (yloc + 8) - (_player.py + 12);
- if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < ticks) {
+ if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
float damage = (float)npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
@@ -7774,7 +7774,7 @@ void GriffonEngine::game_updspellsunder() {
_spellimg->setAlpha(255, true);
- spellinfo[i].frame = spellinfo[i].frame - 0.2 * fpsr;
+ spellinfo[i].frame = spellinfo[i].frame - 0.2 * _fpsr;
if (spellinfo[i].frame < 0)
spellinfo[i].frame = 0;
@@ -7824,7 +7824,7 @@ void GriffonEngine::game_updspellsunder() {
float xdif = (xloc + 8) - (_player.px + 12);
float ydif = (yloc + 8) - (_player.py + 12);
- if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < ticks && alpha > 64) {
+ if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks && alpha > 64) {
float damage = (float)npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
@@ -7843,13 +7843,13 @@ void GriffonEngine::game_updspellsunder() {
}
_spellimg->setAlpha(255, true);
- spellinfo[i].frame = spellinfo[i].frame - 0.5 * fpsr;
+ spellinfo[i].frame = spellinfo[i].frame - 0.5 * _fpsr;
if (spellinfo[i].frame < 0)
spellinfo[i].frame = 0;
if (ABS(spellinfo[i].frame) < 0) {
npcinfo[spellinfo[i].npc].attacking = 0;
- npcinfo[spellinfo[i].npc].attacknext = ticks + npcinfo[spellinfo[i].npc].attackdelay;
+ npcinfo[spellinfo[i].npc].attacknext = _ticks + npcinfo[spellinfo[i].npc].attackdelay;
}
}
}
@@ -7907,8 +7907,8 @@ void GriffonEngine::sys_initialize() {
sys_LoadFont();
sys_LoadItemImgs();
- fpsr = 1.0f;
- _nextticks = ticks + 1000;
+ _fpsr = 1.0f;
+ _nextticks = _ticks + 1000;
for (int i = 0; i <= 15; i++) {
_playerattackofs[0][i][0] = 0; // -1// -(i + 1)
@@ -8255,22 +8255,22 @@ void GriffonEngine::sys_update() {
g_system->updateScreen();
g_system->getEventManager()->pollEvent(_event);
- _tickspassed = ticks;
- ticks = g_system->getMillis();
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
- _tickspassed = ticks - _tickspassed;
- fpsr = (float)_tickspassed / 24.0;
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24.0;
- fp++;
- if (ticks > _nextticks) {
- _nextticks = ticks + 1000;
- fps = fp;
- fp = 0;
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
secsingame = secsingame + 1;
}
if (attacking) {
- _player.attackframe += _player.attackspd * fpsr;
+ _player.attackframe += _player.attackspd * _fpsr;
if (_player.attackframe >= 16) {
attacking = false;
_player.attackframe = 0;
@@ -8308,7 +8308,7 @@ void GriffonEngine::sys_update() {
for (int i = 0; i < kMaxFloat; i++) {
if (floattext[i][0] > 0) {
- float spd = 0.5 * fpsr;
+ float spd = 0.5 * _fpsr;
floattext[i][0] = floattext[i][0] - spd;
floattext[i][2] = floattext[i][2] - spd;
if (floattext[i][0] < 0)
@@ -8316,7 +8316,7 @@ void GriffonEngine::sys_update() {
}
if (floaticon[i][0] > 0) {
- float spd = 0.5 * fpsr;
+ float spd = 0.5 * _fpsr;
floaticon[i][0] = floaticon[i][0] - spd;
floaticon[i][2] = floaticon[i][2] - spd;
if (floaticon[i][0] < 0)
@@ -8360,16 +8360,16 @@ void GriffonEngine::sys_update() {
if (!_forcepause) {
for (int i = 0; i < 5; i++) {
if (_player.foundspell[i] == 1)
- _player.spellcharge[i] += 1 * _player.level * 0.01 * fpsr;
+ _player.spellcharge[i] += 1 * _player.level * 0.01 * _fpsr;
if (_player.spellcharge[i] > 100)
_player.spellcharge[i] = 100;
}
if (_player.foundspell[0]) {
- _player.spellstrength += 3 * _player.level * .01 * fpsr;
+ _player.spellstrength += 3 * _player.level * .01 * _fpsr;
}
- _player.attackstrength += (30 + 3 * (float)_player.level) / 50 * fpsr;
+ _player.attackstrength += (30 + 3 * (float)_player.level) / 50 * _fpsr;
}
if (_player.attackstrength > 100)
@@ -8378,7 +8378,7 @@ void GriffonEngine::sys_update() {
if (_player.spellstrength > 100)
_player.spellstrength = 100;
- _itemyloc += 0.75 * fpsr;
+ _itemyloc += 0.75 * _fpsr;
while (_itemyloc >= 16)
_itemyloc -= 16;
@@ -8392,11 +8392,11 @@ void GriffonEngine::sys_update() {
_roomlock = 1;
}
- clouddeg += 0.1 * fpsr;
+ clouddeg += 0.1 * _fpsr;
while (clouddeg >= 360)
clouddeg = clouddeg - 360;
- _player.hpflash = _player.hpflash + 0.1 * fpsr;
+ _player.hpflash = _player.hpflash + 0.1 * _fpsr;
if (_player.hpflash >= 2) {
_player.hpflash = 0;
_player.hpflashb = _player.hpflashb + 1;
@@ -8411,7 +8411,7 @@ void GriffonEngine::sys_update() {
// cloudson = 0
if (_itemselon == 1)
- _player.itemselshade = _player.itemselshade + 2 * fpsr;
+ _player.itemselshade = _player.itemselshade + 2 * _fpsr;
if (_player.itemselshade > 24)
_player.itemselshade = 24;
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 9511ec7..53b4cec 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -344,8 +344,8 @@ private:
int _scriptflag[100][10], _saveslot; // script, flag
// timer related - move to local later
- int ticks, _tickspassed, _nextticks;
- float fp, fps, fpsr; // CHECKME: fp and fps seems to be integers
+ int _ticks, _tickspassed, _nextticks;
+ float _fp, _fps, _fpsr; // CHECKME: _fp and _fps seems to be integers
int secsingame, secstart;
Graphics::TransparentSurface *mapimg[4];
Commit: 3796916033e1aa09b60a64e8b2a364e5394e9ea4
https://github.com/scummvm/scummvm/commit/3796916033e1aa09b60a64e8b2a364e5394e9ea4
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Variable renaming
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.h
engines/griffon/saveload.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 78590fe..e4f3594 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -365,11 +365,11 @@ float GriffonEngine::RND() {
void GriffonEngine::game_addFloatIcon(int ico, float xloc, float yloc) {
for (int i = 0; i < kMaxFloat; i++) {
- if (ABS(floaticon[i][0]) < kEpsilon) {
- floaticon[i][0] = 32;
- floaticon[i][1] = xloc;
- floaticon[i][2] = yloc;
- floaticon[i][3] = ico;
+ if (ABS(_floaticon[i][0]) < kEpsilon) {
+ _floaticon[i][0] = 32;
+ _floaticon[i][1] = xloc;
+ _floaticon[i][2] = yloc;
+ _floaticon[i][3] = ico;
return;
}
}
@@ -377,12 +377,12 @@ void GriffonEngine::game_addFloatIcon(int ico, float xloc, float yloc) {
void GriffonEngine::game_addFloatText(const char *stri, float xloc, float yloc, int col) {
for (int i = 0; i < kMaxFloat; i++) {
- if (ABS(floattext[i][0]) < kEpsilon) {
- floattext[i][0] = 32;
- floattext[i][1] = xloc;
- floattext[i][2] = yloc;
- floattext[i][3] = col;
- strcpy(floatstri[i], stri);
+ if (ABS(_floattext[i][0]) < kEpsilon) {
+ _floattext[i][0] = 32;
+ _floattext[i][1] = xloc;
+ _floattext[i][2] = yloc;
+ _floattext[i][3] = col;
+ strcpy(_floatstri[i], stri);
return;
}
}
@@ -1753,8 +1753,8 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
int curtiley = (curtile - curtilex) / 20;
int l = 0; // ?? not defined in original code
- tileinfo[l][9][7][0] = curtile + 1;
- tileinfo[l][9][7][1] = 0;
+ _tileinfo[l][9][7][0] = curtile + 1;
+ _tileinfo[l][9][7][1] = 0;
rcSrc.left = curtilex * 16;
rcSrc.top = curtiley * 16;
@@ -1766,7 +1766,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
rcDest.setWidth(16);
rcDest.setHeight(16);
- tiles[curtilel]->blit(*_mapbg, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _tiles[curtilel]->blit(*_mapbg, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
// firehydra sword chest
@@ -2096,14 +2096,14 @@ void GriffonEngine::game_drawanims(int Layer) {
rcDest.setWidth(16);
rcDest.setHeight(16);
- tiles[curtilel]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _tiles[curtilel]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
if (Layer == 1) {
for (int l = 1; l <= 2; l++) {
- int c = tileinfo[l][sx + x][sy + y][0];
+ int c = _tileinfo[l][sx + x][sy + y][0];
if (c > 0) {
- int cl = tileinfo[l][sx + x][sy + y][1];
+ int cl = _tileinfo[l][sx + x][sy + y][1];
c = c - 1;
int curtile = c;
@@ -2132,7 +2132,7 @@ void GriffonEngine::game_drawanims(int Layer) {
}
if (pass == 1)
- tiles[curtilel]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _tiles[curtilel]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
}
@@ -2158,8 +2158,8 @@ void GriffonEngine::game_drawhud() {
game_fillrect(_videobuffer2, 0, 0, 320, 240, 0);
for (int i = 0; i < kMaxFloat; i++) {
- if (floattext[i][0] > 0) {
- int fc = (int)floattext[i][3];
+ if (_floattext[i][0] > 0) {
+ int fc = (int)_floattext[i][3];
int c = fc, c2 = 3;
if (fc == 4)
@@ -2171,19 +2171,19 @@ void GriffonEngine::game_drawhud() {
c2 = 2;
if (fc != 0) {
- sys_print(_videobuffer, floatstri[i], (int)(floattext[i][1]) + 0, (int)(floattext[i][2]) - 1, c2);
- sys_print(_videobuffer, floatstri[i], (int)(floattext[i][1]) + 0, (int)(floattext[i][2]) + 1, c2);
- sys_print(_videobuffer, floatstri[i], (int)(floattext[i][1]) - 1, (int)(floattext[i][2]) + 0, c2);
- sys_print(_videobuffer, floatstri[i], (int)(floattext[i][1]) + 1, (int)(floattext[i][2]) + 0, c2);
+ sys_print(_videobuffer, _floatstri[i], (int)(_floattext[i][1]) + 0, (int)(_floattext[i][2]) - 1, c2);
+ sys_print(_videobuffer, _floatstri[i], (int)(_floattext[i][1]) + 0, (int)(_floattext[i][2]) + 1, c2);
+ sys_print(_videobuffer, _floatstri[i], (int)(_floattext[i][1]) - 1, (int)(_floattext[i][2]) + 0, c2);
+ sys_print(_videobuffer, _floatstri[i], (int)(_floattext[i][1]) + 1, (int)(_floattext[i][2]) + 0, c2);
}
- sys_print(_videobuffer, floatstri[i], (int)(floattext[i][1]), (int)(floattext[i][2]), c);
+ sys_print(_videobuffer, _floatstri[i], (int)(_floattext[i][1]), (int)(_floattext[i][2]), c);
}
- if (floaticon[i][0] > 0) {
- int ico = floaticon[i][3];
- int ix = floaticon[i][1];
- int iy = floaticon[i][2];
+ if (_floaticon[i][0] > 0) {
+ int ico = _floaticon[i][3];
+ int ix = _floaticon[i][1];
+ int iy = _floaticon[i][2];
rcDest.left = ix;
rcDest.top = iy;
@@ -2308,7 +2308,7 @@ void GriffonEngine::game_drawhud() {
ABS(_player.spellstrength - 100) < kEpsilon ? RGB(224, 0, 0) : RGB(128, 0, 224));
// time
- int ase = secstart + secsingame;
+ int ase = _secstart + _secsingame;
int h = ((ase - (ase % 3600)) / 3600);
ase = (ase - h * 3600);
int m = ((ase - (ase % 60)) / 60);
@@ -2455,7 +2455,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.top += (int)(RND() * 3) - 1;
}
- anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
int cframe = npcinfo[i].cattackframe;
@@ -2469,7 +2469,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.setWidth(24);
rcDest.setHeight(24);
- animsa[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _animsa[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -2478,15 +2478,15 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (npcinfo[i].spriteset == 2) {
for (int f = 0; f <= 7; f++) {
int s = npcinfo[i].bodysection[f].sprite;
- rcSrc.left = animset2[s].x;
- rcSrc.top = animset2[s].y;
- rcSrc.setWidth(animset2[s].w);
- rcSrc.setHeight(animset2[s].h);
+ rcSrc.left = _animset2[s].x;
+ rcSrc.top = _animset2[s].y;
+ rcSrc.setWidth(_animset2[s].w);
+ rcSrc.setHeight(_animset2[s].h);
- rcDest.left = npcinfo[i].bodysection[f].x - animset2[s].xofs;
- rcDest.top = npcinfo[i].bodysection[f].y - animset2[s].yofs + 2;
+ rcDest.left = npcinfo[i].bodysection[f].x - _animset2[s].xofs;
+ rcDest.top = npcinfo[i].bodysection[f].y - _animset2[s].yofs + 2;
- anims[2]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[2]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -2499,15 +2499,15 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (f == 0 && (_curmap == 53 || _curmap == 57 || _curmap == 61 || _curmap == 65 || _curmap == 56 || _curmap > 66) && _scriptflag[60][0] > 0)
yp = 16;
int s = npcinfo[i].bodysection[f].sprite;
- rcSrc.left = animset9[s].x;
- rcSrc.top = animset9[s].y + yp;
- rcSrc.setWidth(animset9[s].w);
- rcSrc.setHeight(animset9[s].h);
+ rcSrc.left = _animset9[s].x;
+ rcSrc.top = _animset9[s].y + yp;
+ rcSrc.setWidth(_animset9[s].w);
+ rcSrc.setHeight(_animset9[s].h);
- rcDest.left = npcinfo[i].bodysection[f].x - animset9[s].xofs;
- rcDest.top = npcinfo[i].bodysection[f].y - animset9[s].yofs + 2;
+ rcDest.left = npcinfo[i].bodysection[f].x - _animset9[s].xofs;
+ rcDest.top = npcinfo[i].bodysection[f].y - _animset9[s].yofs + 2;
- anims[9]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[9]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -2526,7 +2526,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = npx - 2;
rcDest.top = npy - 24;
- anims[3]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[3]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
rcSrc.left = 4 * 24;
rcSrc.top = 0;
@@ -2536,7 +2536,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = npx - 2;
rcDest.top = npy - 24;
- anims[3]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[3]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -2554,7 +2554,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = npx - 2;
rcDest.top = npy - 24;
- anims[4]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[4]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
rcSrc.left = 4 * 24;
rcSrc.top = 0;
@@ -2564,7 +2564,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = npx - 2;
rcDest.top = npy - 24;
- anims[4]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[4]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -2614,7 +2614,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.top = npcinfo[i].bodysection[10 * ff + 9].y - 21;
_spellimg->setAlpha(192, true);
- anims[5]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[5]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
_spellimg->setAlpha(255, true);
}
@@ -2642,7 +2642,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
- anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
// wizard
@@ -2665,7 +2665,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
- anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
// } else {
//cframe = npcinfo[i].cattackframe;
@@ -2678,7 +2678,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
//rcDest.top = npy;
//rcDest.setWidth(24);
//rcDest.setHeight(24);
- // animsa(sprite)->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ // _animsa(sprite)->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
// }
}
@@ -2702,7 +2702,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
- anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
@@ -2747,7 +2747,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
- anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
npcinfo[i].floating = npcinfo[i].floating + 0.25 * _fpsr;
while (npcinfo[i].floating >= 16)
@@ -2765,7 +2765,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.setWidth(24);
rcDest.setHeight(24);
- animsa[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _animsa[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -2883,7 +2883,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = rcDest.top + (int)(RND() * 3) - 1;
}
- anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
int cframe = (int)(npcinfo[i].cattackframe);
@@ -2895,7 +2895,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = sx;
rcDest.top = sy;
- animsa[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _animsa[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -2939,7 +2939,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
- anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
rcDest.left = npx + 4;
@@ -2995,8 +2995,8 @@ void GriffonEngine::game_drawover(int modx, int mody) {
if (sx > -1 && sx < 40 && sy > -1 && sy < 24) {
- int curtile = tileinfo[2][sx][sy][0];
- int curtilel = tileinfo[2][sx][sy][1];
+ int curtile = _tileinfo[2][sx][sy][0];
+ int curtilel = _tileinfo[2][sx][sy][1];
if (curtile > 0) {
curtile = curtile - 1;
@@ -3024,7 +3024,7 @@ void GriffonEngine::game_drawover(int modx, int mody) {
}
if (pass == 1)
- tiles[curtilel]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _tiles[curtilel]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
}
@@ -3047,7 +3047,7 @@ void GriffonEngine::game_drawplayer() {
rcDest.setWidth(24);
rcDest.setHeight(24);
- anims[f]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[f]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
rcSrc.left = (int)(_player.attackframe / 4) * 24;
rcSrc.top = _player.walkdir * 24;
@@ -3059,7 +3059,7 @@ void GriffonEngine::game_drawplayer() {
rcDest.setWidth(24);
rcDest.setHeight(24);
- animsa[f]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _animsa[f]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
@@ -3833,7 +3833,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
for (int x = 0; x <= 39; x++)
for (int l = 0; l <= 2; l++)
for (int a = 0; a <= 2; a++)
- tileinfo[l][x][y][a] = 0;
+ _tileinfo[l][x][y][a] = 0;
if (_scriptflag[4][0] == 1 && _curmap == 4) {
triggerloc[9][7] = 5004;
@@ -3857,8 +3857,8 @@ void GriffonEngine::game_loadmap(int mapnum) {
int curtilex = curtile % 20;
int curtiley = (curtile - curtilex) / 20;
- tileinfo[l][x][y][0] = curtile + 1;
- tileinfo[l][x][y][1] = curtilelayer;
+ _tileinfo[l][x][y][0] = curtile + 1;
+ _tileinfo[l][x][y][1] = curtilelayer;
rcSrc.left = curtilex * 16;
rcSrc.top = curtiley * 16;
@@ -3875,7 +3875,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
int ffa = 20 * 5 - 1 + ff * 20;
int ffb = 20 * 5 + 4 + ff * 20;
if (curtile > ffa && curtile < ffb) {
- tiles[curtilel]->setAlpha(128, true);
+ _tiles[curtilel]->setAlpha(128, true);
}
}
}
@@ -3883,13 +3883,13 @@ void GriffonEngine::game_loadmap(int mapnum) {
for (int ff = 0; ff <= 4; ff++) {
int ffa = 20 * (5 + ff) + 3;
if (curtile == ffa) {
- tiles[curtilel]->setAlpha(192, true);
+ _tiles[curtilel]->setAlpha(192, true);
}
}
}
- tiles[curtilel]->blit(*_mapbg, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- tiles[curtilel]->setAlpha(255, true);
+ _tiles[curtilel]->blit(*_mapbg, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _tiles[curtilel]->setAlpha(255, true);
rcDest.left = x * 8;
rcDest.top = y * 8;
@@ -4567,8 +4567,8 @@ void GriffonEngine::game_newgame() {
Mix_Volume(musicchannel, 0);
}
- secsingame = 0;
- secstart = 0;
+ _secsingame = 0;
+ _secstart = 0;
int ldstop = 0;
@@ -4815,8 +4815,8 @@ void GriffonEngine::game_processtrigger(int trignum) {
}
for (int i = 0; i < kMaxFloat; i++) {
- floattext[i][0] = 0;
- floaticon[i][0] = 0;
+ _floattext[i][0] = 0;
+ _floaticon[i][0] = 0;
}
}
@@ -4904,8 +4904,8 @@ void GriffonEngine::game_saveloadnew() {
if (lowerlock == 1 && curcol == 1 && tickpause < _ticks) {
if (state_save(currow - 1)) {
- secstart = secstart + secsingame;
- secsingame = 0;
+ _secstart = _secstart + _secsingame;
+ _secsingame = 0;
lowerlock = 0;
_saveslot = currow - 1;
currow = 0;
@@ -4927,7 +4927,7 @@ void GriffonEngine::game_saveloadnew() {
Mix_HaltChannel(-1);
- secsingame = 0;
+ _secsingame = 0;
_saveslot = currow - 1;
game_loadmap(_curmap);
game_playgame();
@@ -5001,7 +5001,7 @@ void GriffonEngine::game_saveloadnew() {
sy = 57 + ff * 48;
// time
- int ase = asecstart;
+ int ase = _asecstart;
int h = ((ase - (ase % 3600)) / 3600);
ase = (ase - h * 3600);
int m = ((ase - (ase % 60)) / 60);
@@ -5283,8 +5283,8 @@ void GriffonEngine::game_swash() {
void GriffonEngine::game_theend() {
for (int i = 0; i < kMaxFloat; i++) {
- floattext[i][0] = 0;
- floaticon[i][0] = 0;
+ _floattext[i][0] = 0;
+ _floaticon[i][0] = 0;
}
for (float y = 0; y < 100; y += _fpsr) {
@@ -7091,8 +7091,8 @@ void GriffonEngine::game_updspells() {
if (sx > -1 && sx < 20 && sy > -1 && sy < 15) {
for (int l = 0; l <= 2; l++) {
- int curtile = tileinfo[l][sx][sy][0];
- int curtilel = tileinfo[l][sx][sy][1];
+ int curtile = _tileinfo[l][sx][sy][0];
+ int curtilel = _tileinfo[l][sx][sy][1];
if (curtile > 0) {
curtile = curtile - 1;
@@ -7857,9 +7857,9 @@ void GriffonEngine::game_updspellsunder() {
}
void GriffonEngine::sys_initialize() {
- // init char *floatstri[kMaxFloat]
+ // init char *_floatstri[kMaxFloat]
for (int i = 0; i < kMaxFloat; i++)
- floatstri[i] = (char *)malloc(64); // 64 bytes each string (should be enough)
+ _floatstri[i] = (char *)malloc(64); // 64 bytes each string (should be enough)
_video = new Graphics::TransparentSurface;
_video->create(320, 240, g_system->getScreenFormat());
@@ -7948,113 +7948,113 @@ void GriffonEngine::sys_line(Graphics::TransparentSurface *buffer, int x1, int y
void GriffonEngine::sys_LoadAnims() {
_spellimg = IMG_Load("art/spells.bmp", true);
- anims[0] = IMG_Load("art/anims0.bmp", true);
- animsa[0] = IMG_Load("art/anims0a.bmp", true);
- anims[13] = IMG_Load("art/anims0x.bmp", true);
- animsa[13] = IMG_Load("art/anims0xa.bmp", true);
- anims[1] = IMG_Load("art/anims1.bmp", true);
- animsa[1] = IMG_Load("art/anims1a.bmp", true);
- anims[2] = IMG_Load("art/anims2.bmp", true);
+ _anims[0] = IMG_Load("art/_anims0.bmp", true);
+ _animsa[0] = IMG_Load("art/_anims0a.bmp", true);
+ _anims[13] = IMG_Load("art/_anims0x.bmp", true);
+ _animsa[13] = IMG_Load("art/_anims0xa.bmp", true);
+ _anims[1] = IMG_Load("art/_anims1.bmp", true);
+ _animsa[1] = IMG_Load("art/_anims1a.bmp", true);
+ _anims[2] = IMG_Load("art/_anims2.bmp", true);
// huge
- animset2[0].xofs = 8;
- animset2[0].yofs = 7;
- animset2[0].x = 123;
- animset2[0].y = 0;
- animset2[0].w = 18;
- animset2[0].h = 16;
+ _animset2[0].xofs = 8;
+ _animset2[0].yofs = 7;
+ _animset2[0].x = 123;
+ _animset2[0].y = 0;
+ _animset2[0].w = 18;
+ _animset2[0].h = 16;
// big
- animset2[1].xofs = 7;
- animset2[1].yofs = 7;
- animset2[1].x = 107;
- animset2[1].y = 0;
- animset2[1].w = 16;
- animset2[1].h = 14;
+ _animset2[1].xofs = 7;
+ _animset2[1].yofs = 7;
+ _animset2[1].x = 107;
+ _animset2[1].y = 0;
+ _animset2[1].w = 16;
+ _animset2[1].h = 14;
// med
- animset2[2].xofs = 6;
- animset2[2].yofs = 6;
- animset2[2].x = 93;
- animset2[2].y = 0;
- animset2[2].w = 14;
- animset2[2].h = 13;
+ _animset2[2].xofs = 6;
+ _animset2[2].yofs = 6;
+ _animset2[2].x = 93;
+ _animset2[2].y = 0;
+ _animset2[2].w = 14;
+ _animset2[2].h = 13;
// small
- animset2[3].xofs = 4;
- animset2[3].yofs = 4;
- animset2[3].x = 83;
- animset2[3].y = 0;
- animset2[3].w = 10;
- animset2[3].h = 10;
+ _animset2[3].xofs = 4;
+ _animset2[3].yofs = 4;
+ _animset2[3].x = 83;
+ _animset2[3].y = 0;
+ _animset2[3].w = 10;
+ _animset2[3].h = 10;
// wing
- animset2[4].xofs = 4;
- animset2[4].yofs = 20;
- animset2[4].x = 42;
- animset2[4].y = 0;
- animset2[4].w = 41;
- animset2[4].h = 33;
+ _animset2[4].xofs = 4;
+ _animset2[4].yofs = 20;
+ _animset2[4].x = 42;
+ _animset2[4].y = 0;
+ _animset2[4].w = 41;
+ _animset2[4].h = 33;
// head
- animset2[5].xofs = 20;
- animset2[5].yofs = 18;
- animset2[5].x = 0;
- animset2[5].y = 0;
- animset2[5].w = 42;
- animset2[5].h = 36;
+ _animset2[5].xofs = 20;
+ _animset2[5].yofs = 18;
+ _animset2[5].x = 0;
+ _animset2[5].y = 0;
+ _animset2[5].w = 42;
+ _animset2[5].h = 36;
- anims[9] = IMG_Load("art/anims9.bmp", true);
+ _anims[9] = IMG_Load("art/_anims9.bmp", true);
// huge
- animset9[0].xofs = 8;
- animset9[0].yofs = 7;
- animset9[0].x = 154;
- animset9[0].y = 0;
- animset9[0].w = 18;
- animset9[0].h = 16;
+ _animset9[0].xofs = 8;
+ _animset9[0].yofs = 7;
+ _animset9[0].x = 154;
+ _animset9[0].y = 0;
+ _animset9[0].w = 18;
+ _animset9[0].h = 16;
// big
- animset9[1].xofs = 7;
- animset9[1].yofs = 7;
- animset9[1].x = 138;
- animset9[1].y = 0;
- animset9[1].w = 16;
- animset9[1].h = 14;
+ _animset9[1].xofs = 7;
+ _animset9[1].yofs = 7;
+ _animset9[1].x = 138;
+ _animset9[1].y = 0;
+ _animset9[1].w = 16;
+ _animset9[1].h = 14;
// med
- animset9[2].xofs = 6;
- animset9[2].yofs = 6;
- animset9[2].x = 93 + 31;
- animset9[2].y = 0;
- animset9[2].w = 14;
- animset9[2].h = 13;
+ _animset9[2].xofs = 6;
+ _animset9[2].yofs = 6;
+ _animset9[2].x = 93 + 31;
+ _animset9[2].y = 0;
+ _animset9[2].w = 14;
+ _animset9[2].h = 13;
// small
- animset9[3].xofs = 4;
- animset9[3].yofs = 4;
- animset9[3].x = 83 + 31;
- animset9[3].y = 0;
- animset9[3].w = 10;
- animset9[3].h = 10;
+ _animset9[3].xofs = 4;
+ _animset9[3].yofs = 4;
+ _animset9[3].x = 83 + 31;
+ _animset9[3].y = 0;
+ _animset9[3].w = 10;
+ _animset9[3].h = 10;
// wing
- animset9[4].xofs = 36;
- animset9[4].yofs = 20;
- animset9[4].x = 42;
- animset9[4].y = 0;
- animset9[4].w = 72;
- animset9[4].h = 33;
+ _animset9[4].xofs = 36;
+ _animset9[4].yofs = 20;
+ _animset9[4].x = 42;
+ _animset9[4].y = 0;
+ _animset9[4].w = 72;
+ _animset9[4].h = 33;
// head
- animset9[5].xofs = 20;
- animset9[5].yofs = 18;
- animset9[5].x = 0;
- animset9[5].y = 0;
- animset9[5].w = 42;
- animset9[5].h = 36;
-
- anims[3] = IMG_Load("art/anims3.bmp", true);
- anims[4] = IMG_Load("art/anims4.bmp", true);
- anims[5] = IMG_Load("art/anims5.bmp", true);
- anims[6] = IMG_Load("art/anims6.bmp", true);
- anims[7] = IMG_Load("art/anims7.bmp", true);
- anims[8] = IMG_Load("art/anims8.bmp", true);
- anims[10] = IMG_Load("art/anims10.bmp", true);
- animsa[10] = IMG_Load("art/anims10a.bmp", true);
- anims[11] = IMG_Load("art/anims11.bmp", true);
- animsa[11] = IMG_Load("art/anims11a.bmp", true);
- anims[12] = IMG_Load("art/anims12.bmp", true);
+ _animset9[5].xofs = 20;
+ _animset9[5].yofs = 18;
+ _animset9[5].x = 0;
+ _animset9[5].y = 0;
+ _animset9[5].w = 42;
+ _animset9[5].h = 36;
+
+ _anims[3] = IMG_Load("art/_anims3.bmp", true);
+ _anims[4] = IMG_Load("art/_anims4.bmp", true);
+ _anims[5] = IMG_Load("art/_anims5.bmp", true);
+ _anims[6] = IMG_Load("art/_anims6.bmp", true);
+ _anims[7] = IMG_Load("art/_anims7.bmp", true);
+ _anims[8] = IMG_Load("art/_anims8.bmp", true);
+ _anims[10] = IMG_Load("art/_anims10.bmp", true);
+ _animsa[10] = IMG_Load("art/_anims10a.bmp", true);
+ _anims[11] = IMG_Load("art/_anims11.bmp", true);
+ _animsa[11] = IMG_Load("art/_anims11a.bmp", true);
+ _anims[12] = IMG_Load("art/_anims12.bmp", true);
}
void GriffonEngine::sys_LoadItemImgs() {
@@ -8103,10 +8103,10 @@ void GriffonEngine::sys_LoadFont() {
}
void GriffonEngine::sys_LoadTiles() {
- tiles[0] = IMG_Load("art/tx.bmp", true);
- tiles[1] = IMG_Load("art/tx1.bmp", true);
- tiles[2] = IMG_Load("art/tx2.bmp", true);
- tiles[3] = IMG_Load("art/tx3.bmp", true);
+ _tiles[0] = IMG_Load("art/tx.bmp", true);
+ _tiles[1] = IMG_Load("art/tx1.bmp", true);
+ _tiles[2] = IMG_Load("art/tx2.bmp", true);
+ _tiles[3] = IMG_Load("art/tx3.bmp", true);
_windowimg = IMG_Load("art/window.bmp", true);
}
@@ -8266,7 +8266,7 @@ void GriffonEngine::sys_update() {
_nextticks = _ticks + 1000;
_fps = _fp;
_fp = 0;
- secsingame = secsingame + 1;
+ _secsingame = _secsingame + 1;
}
if (attacking) {
@@ -8307,20 +8307,20 @@ void GriffonEngine::sys_update() {
}
for (int i = 0; i < kMaxFloat; i++) {
- if (floattext[i][0] > 0) {
+ if (_floattext[i][0] > 0) {
float spd = 0.5 * _fpsr;
- floattext[i][0] = floattext[i][0] - spd;
- floattext[i][2] = floattext[i][2] - spd;
- if (floattext[i][0] < 0)
- floattext[i][0] = 0;
+ _floattext[i][0] = _floattext[i][0] - spd;
+ _floattext[i][2] = _floattext[i][2] - spd;
+ if (_floattext[i][0] < 0)
+ _floattext[i][0] = 0;
}
- if (floaticon[i][0] > 0) {
+ if (_floaticon[i][0] > 0) {
float spd = 0.5 * _fpsr;
- floaticon[i][0] = floaticon[i][0] - spd;
- floaticon[i][2] = floaticon[i][2] - spd;
- if (floaticon[i][0] < 0)
- floaticon[i][0] = 0;
+ _floaticon[i][0] = _floaticon[i][0] - spd;
+ _floaticon[i][2] = _floaticon[i][2] - spd;
+ if (_floaticon[i][0] < 0)
+ _floaticon[i][0] = 0;
}
}
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 53b4cec..0ae0e4a 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -346,7 +346,7 @@ private:
// timer related - move to local later
int _ticks, _tickspassed, _nextticks;
float _fp, _fps, _fpsr; // CHECKME: _fp and _fps seems to be integers
- int secsingame, secstart;
+ int _secsingame, _secstart;
Graphics::TransparentSurface *mapimg[4];
@@ -376,26 +376,26 @@ private:
PLAYERTYPE _player;
bool attacking;
PLAYERTYPE _playera;
- int asecstart;
+ int _asecstart;
// tile info
- Graphics::TransparentSurface *tiles[4];
- int tileinfo[3][40][24][3]; // maplayer, x, y, tiledata (tile, tilelayer)
+ Graphics::TransparentSurface *_tiles[4];
+ int _tileinfo[3][40][24][3]; // maplayer, x, y, tiledata (tile, tilelayer)
// animation info
- Graphics::TransparentSurface *anims[100];
+ Graphics::TransparentSurface *_anims[100];
// id number 0&1 = players
- Graphics::TransparentSurface *animsa[100];
+ Graphics::TransparentSurface *_animsa[100];
// attack anims
float _playerattackofs[4][16][3];
// [dir] [frame] [x,y ofs, completed(0/1)]
- float floattext[kMaxFloat][4]; // [id] [framesleft, x, y, col]
- char *floatstri[kMaxFloat];
- float floaticon[kMaxFloat][4]; // [id] [framesleft, x, y, ico]
+ float _floattext[kMaxFloat][4]; // [id] [framesleft, x, y, col]
+ char *_floatstri[kMaxFloat];
+ float _floaticon[kMaxFloat][4]; // [id] [framesleft, x, y, ico]
// special for animset2
- ANIMSET2TYPE animset2[7], animset9[7];
+ ANIMSET2TYPE _animset2[7], _animset9[7];
// object info
float objectframe[256][2];
diff --git a/engines/griffon/saveload.cpp b/engines/griffon/saveload.cpp
index 29632e3..f3cc6f5 100644
--- a/engines/griffon/saveload.cpp
+++ b/engines/griffon/saveload.cpp
@@ -69,7 +69,7 @@ int GriffonEngine::state_load(int slotnum) {
if (_player.level > 0) {
char temp[256];
- INPUT("%i", &secstart);
+ INPUT("%i", &_secstart);
INPUT("%s", temp);
INPUT("%f", &_player.px);
@@ -143,7 +143,7 @@ int GriffonEngine::state_load_player(int slotnum) {
if (_playera.level > 0) {
char temp[256];
- INPUT("%i", &asecstart);
+ INPUT("%i", &_asecstart);
INPUT("%s", temp);
INPUT("%f", &_playera.px);
@@ -194,7 +194,7 @@ int GriffonEngine::state_save(int slotnum) {
PRINT("%i", _player.level);
if (_player.level > 0) {
- PRINT("%i", (secstart + secsingame));
+ PRINT("%i", (_secstart + _secsingame));
PRINT("%s", "a");
PRINT("%f", _player.px);
Commit: 5fc1d7a6d881695dca14abac5ac4f00e4bc295e6
https://github.com/scummvm/scummvm/commit/5fc1d7a6d881695dca14abac5ac4f00e4bc295e6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Vraiable renames
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.h
engines/griffon/saveload.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index e4f3594..bc2c423 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -399,31 +399,31 @@ void GriffonEngine::game_attack() {
if (_player.walkdir == 0) {
if (ly > 0) {
int o2 = 0; // ??
- int o = objmap[lx][ly - 1];
+ int o = _objmap[lx][ly - 1];
if (ly > 1 && _curmap == 58)
- o2 = objmap[lx][ly - 2];
+ o2 = _objmap[lx][ly - 2];
if (ly > 1 && _curmap == 54)
- o2 = objmap[lx][ly - 2];
+ o2 = _objmap[lx][ly - 2];
// cst
- if ((objectinfo[o][4] == 1 && (o == 0 || o > 4)) || (objectinfo[o2][4] == 0 && o2 == 10)) {
+ if ((_objectinfo[o][4] == 1 && (o == 0 || o > 4)) || (_objectinfo[o2][4] == 0 && o2 == 10)) {
if (o2 == 10)
o = 10;
- int oscript = objectinfo[o][5];
+ int oscript = _objectinfo[o][5];
if (oscript == 0 && _player.inventory[INV_FLASK] < 9) {
_player.inventory[INV_FLASK]++;
game_addFloatIcon(6, lx * 16, (ly - 1) * 16);
- objmapf[_curmap][lx][ly - 1] = 1;
+ _objmapf[_curmap][lx][ly - 1] = 1;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
- if (objectinfo[o][4] == 1)
- objmap[lx][ly - 1] = 3;
+ if (_objectinfo[o][4] == 1)
+ _objmap[lx][ly - 1] = 3;
game_eventtext("Found Flask!");
_itemticks = _ticks + 215;
@@ -460,8 +460,8 @@ void GriffonEngine::game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (objectinfo[o][4] == 1)
- objmap[lx][ly - 1] = 3;
+ if (_objectinfo[o][4] == 1)
+ _objmap[lx][ly - 1] = 3;
game_eventtext("Found the Temple Key!");
return;
}
@@ -477,8 +477,8 @@ void GriffonEngine::game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (objectinfo[o][4] == 1)
- objmap[lx][ly - 1] = 3;
+ if (_objectinfo[o][4] == 1)
+ _objmap[lx][ly - 1] = 3;
game_eventtext("Found the Infinite Crystal!");
_itemticks = _ticks + 215;
@@ -497,11 +497,11 @@ void GriffonEngine::game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (objectinfo[o][4] == 1)
- objmap[lx][ly - 1] = 3;
+ if (_objectinfo[o][4] == 1)
+ _objmap[lx][ly - 1] = 3;
game_eventtext("Found the Obsidian Shield!");
- objmapf[4][1][2] = 1;
+ _objmapf[4][1][2] = 1;
return;
}
@@ -517,8 +517,8 @@ void GriffonEngine::game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (objectinfo[o][4] == 1)
- objmap[lx][ly - 1] = 3;
+ if (_objectinfo[o][4] == 1)
+ _objmap[lx][ly - 1] = 3;
game_eventtext("Found the Fidelis Sword!");
return;
}
@@ -538,10 +538,10 @@ void GriffonEngine::game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- objmapf[_curmap][lx][ly - 1] = 1;
+ _objmapf[_curmap][lx][ly - 1] = 1;
- if (objectinfo[o][4] == 1)
- objmap[lx][ly - 1] = 3;
+ if (_objectinfo[o][4] == 1)
+ _objmap[lx][ly - 1] = 3;
game_eventtext("Found Key");
game_addFloatIcon(16, lx * 16, (ly - 1) * 16);
@@ -559,15 +559,15 @@ void GriffonEngine::game_attack() {
_player.inventory[INV_DOUBLEFLASK]++;
game_addFloatIcon(12, lx * 16, (ly - 1) * 16);
- objmapf[_curmap][lx][ly - 1] = 1;
+ _objmapf[_curmap][lx][ly - 1] = 1;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
- if (objectinfo[o][4] == 1)
- objmap[lx][ly - 1] = 3;
+ if (_objectinfo[o][4] == 1)
+ _objmap[lx][ly - 1] = 3;
game_eventtext("Found Mega Flask!");
_itemticks = _ticks + 215;
@@ -589,15 +589,15 @@ void GriffonEngine::game_attack() {
_player.inventory[INV_DOUBLEFLASK]++;
game_addFloatIcon(12, lx * 16, (ly - 1) * 16);
- objmapf[_curmap][lx][ly - 1] = 1;
+ _objmapf[_curmap][lx][ly - 1] = 1;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
- if (objectinfo[o][4] == 1)
- objmap[lx][ly - 1] = 3;
+ if (_objectinfo[o][4] == 1)
+ _objmap[lx][ly - 1] = 3;
game_eventtext("Found Mega Flask!");
_itemticks = _ticks + 215;
@@ -619,15 +619,15 @@ void GriffonEngine::game_attack() {
_player.inventory[INV_SHOCK]++;
game_addFloatIcon(17, lx * 16, (ly - 1) * 16);
- objmapf[_curmap][lx][ly - 1] = 1;
+ _objmapf[_curmap][lx][ly - 1] = 1;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
- if (objectinfo[o][4] == 1)
- objmap[lx][ly - 1] = 3;
+ if (_objectinfo[o][4] == 1)
+ _objmap[lx][ly - 1] = 3;
game_eventtext("Found Lightning Bomb!");
_itemticks = _ticks + 215;
@@ -655,8 +655,8 @@ void GriffonEngine::game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (objectinfo[o][4] == 1)
- objmap[lx][ly - 1] = 3;
+ if (_objectinfo[o][4] == 1)
+ _objmap[lx][ly - 1] = 3;
game_eventtext("Found the Fidelis Mail!");
_itemticks = _ticks + 215;
@@ -711,10 +711,10 @@ void GriffonEngine::game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (objectinfo[o][4] == 1)
- objmap[lx][ly - 1] = 3;
+ if (_objectinfo[o][4] == 1)
+ _objmap[lx][ly - 1] = 3;
game_eventtext("Found the Blood Sword!");
- objmapf[4][1][2] = 1;
+ _objmapf[4][1][2] = 1;
return;
}
@@ -728,10 +728,10 @@ void GriffonEngine::game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (objectinfo[o][4] == 1)
- objmap[lx][ly - 1] = 3;
+ if (_objectinfo[o][4] == 1)
+ _objmap[lx][ly - 1] = 3;
game_eventtext("Found the Entropy Shield!");
- objmapf[4][1][2] = 1;
+ _objmapf[4][1][2] = 1;
return;
}
@@ -745,10 +745,10 @@ void GriffonEngine::game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (objectinfo[o][4] == 1)
- objmap[lx][ly - 1] = 3;
+ if (_objectinfo[o][4] == 1)
+ _objmap[lx][ly - 1] = 3;
game_eventtext("Found the Rubyscale Armour!");
- objmapf[4][1][2] = 1;
+ _objmapf[4][1][2] = 1;
return;
}
@@ -819,7 +819,7 @@ void GriffonEngine::game_castspell(int spellnum, float homex, float homey, float
int nballs = 0;
for (int x = 0; x <= 19; x++) {
for (int y = 0; y <= 14; y++) {
- if ((objmap[x][y] == 1 || objmap[x][y] == 2) && nballs < 5 && (int)(RND() * 4) == 0) {
+ if ((_objmap[x][y] == 1 || _objmap[x][y] == 2) && nballs < 5 && (int)(RND() * 4) == 0) {
int ax = x * 16;
int ay = y * 16;
@@ -857,9 +857,9 @@ void GriffonEngine::game_castspell(int spellnum, float homex, float homey, float
void GriffonEngine::game_checkhit() {
if (attacking) {
for (int i = 1; i <= lastnpc; i++) {
- if (npcinfo[i].hp > 0 && npcinfo[i].pause < _ticks && (int)(RND() * 2) == 0) {
- float npx = npcinfo[i].x;
- float npy = npcinfo[i].y;
+ if (_npcinfo[i].hp > 0 && _npcinfo[i].pause < _ticks && (int)(RND() * 2) == 0) {
+ float npx = _npcinfo[i].x;
+ float npy = _npcinfo[i].y;
float xdif = _player.px - npx;
float ydif = _player.py - npy;
@@ -917,8 +917,8 @@ void GriffonEngine::game_checkinputs() {
for (int x = 0; x <= 19; x++) {
for (int y = 0; y <= 14; y++) {
- int o = objmap[x][y];
- if (objectinfo[o][4] == 3) {
+ int o = _objmap[x][y];
+ if (_objectinfo[o][4] == 3) {
postinfo[nposts][0] = x * 16;
postinfo[nposts][1] = y * 16;
nposts = nposts + 1;
@@ -999,7 +999,7 @@ void GriffonEngine::game_checkinputs() {
}
if (_curitem == 2 && _player.inventory[INV_SHOCK] > 0) {
- game_castspell(8, _player.px, _player.py, npcinfo[_curenemy].x, npcinfo[_curenemy].y, 0);
+ game_castspell(8, _player.px, _player.py, _npcinfo[_curenemy].x, _npcinfo[_curenemy].y, 0);
_forcepause = true;
@@ -1036,7 +1036,7 @@ void GriffonEngine::game_checkinputs() {
}
if (_curitem == 5 && _player.spellcharge[0] == 100) {
- game_castspell(5, _player.px, _player.py, npcinfo[_curenemy].x, npcinfo[_curenemy].y, 0);
+ game_castspell(5, _player.px, _player.py, _npcinfo[_curenemy].x, _npcinfo[_curenemy].y, 0);
_player.spellcharge[0] = 0;
@@ -1049,7 +1049,7 @@ void GriffonEngine::game_checkinputs() {
if (_curitem > 5 && _selenemyon == 1) {
if (_curenemy <= lastnpc) {
- game_castspell(_curitem - 6, _player.px, _player.py, npcinfo[_curenemy].x, npcinfo[_curenemy].y, 0);
+ game_castspell(_curitem - 6, _player.px, _player.py, _npcinfo[_curenemy].x, _npcinfo[_curenemy].y, 0);
} else {
int pst = _curenemy - lastnpc - 1;
game_castspell(_curitem - 6, _player.px, _player.py, postinfo[pst][0], postinfo[pst][1], 0);
@@ -1073,7 +1073,7 @@ void GriffonEngine::game_checkinputs() {
int i = 0;
do {
- if (npcinfo[i].hp > 0) {
+ if (_npcinfo[i].hp > 0) {
_curenemy = i;
goto __exit_do;
}
@@ -1139,7 +1139,7 @@ __exit_do:
_curenemy = lastnpc + nposts;
if (_curenemy == origin)
break;
- if (_curenemy <= lastnpc && npcinfo[_curenemy].hp > 0)
+ if (_curenemy <= lastnpc && _npcinfo[_curenemy].hp > 0)
break;
if (_curenemy > lastnpc)
break;
@@ -1154,7 +1154,7 @@ __exit_do:
_curenemy = 1;
if (_curenemy == origin)
break;
- if (_curenemy <= lastnpc && npcinfo[_curenemy].hp > 0)
+ if (_curenemy <= lastnpc && _npcinfo[_curenemy].hp > 0)
break;
if (_curenemy > lastnpc)
break;
@@ -1213,8 +1213,8 @@ void GriffonEngine::game_checktrigger() {
canusekey = 0;
- if (triggerloc[lx][ly] > -1)
- game_processtrigger(triggerloc[lx][ly]);
+ if (_triggerloc[lx][ly] > -1)
+ game_processtrigger(_triggerloc[lx][ly]);
}
#ifdef OPENDINGUX
@@ -1602,88 +1602,88 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
damage = abs(damage);
if (heal == 0) {
- if (damage > npcinfo[npcnum].hp) {
- ratio = (damage - npcinfo[npcnum].hp) * 100 / damage;
- damage = npcinfo[npcnum].hp;
+ if (damage > _npcinfo[npcnum].hp) {
+ ratio = (damage - _npcinfo[npcnum].hp) * 100 / damage;
+ damage = _npcinfo[npcnum].hp;
}
- npcinfo[npcnum].hp -= damage;
- if (npcinfo[npcnum].hp < 0)
- npcinfo[npcnum].hp = 0;
+ _npcinfo[npcnum].hp -= damage;
+ if (_npcinfo[npcnum].hp < 0)
+ _npcinfo[npcnum].hp = 0;
sprintf(line, "-%i", damage);
fcol = 1;
} else {
- npcinfo[npcnum].hp += damage;
- if (npcinfo[npcnum].hp > npcinfo[npcnum].maxhp)
- npcinfo[npcnum].hp = npcinfo[npcnum].maxhp;
+ _npcinfo[npcnum].hp += damage;
+ if (_npcinfo[npcnum].hp > _npcinfo[npcnum].maxhp)
+ _npcinfo[npcnum].hp = _npcinfo[npcnum].maxhp;
sprintf(line, "+%i", damage);
fcol = 5;
}
- npcinfo[npcnum].pause = _ticks + 900;
+ _npcinfo[npcnum].pause = _ticks + 900;
if (spell == 0)
_player.attackstrength = ratio;
}
- game_addFloatText(line, npcinfo[npcnum].x + 12 - 4 * strlen(line), npcinfo[npcnum].y + 16, fcol);
+ game_addFloatText(line, _npcinfo[npcnum].x + 12 - 4 * strlen(line), _npcinfo[npcnum].y + 16, fcol);
- if (npcinfo[npcnum].spriteset == 12)
- game_castspell(9, npcinfo[npcnum].x, npcinfo[npcnum].y, _player.px, _player.py, npcnum);
+ if (_npcinfo[npcnum].spriteset == 12)
+ game_castspell(9, _npcinfo[npcnum].x, _npcinfo[npcnum].y, _player.px, _player.py, npcnum);
// if enemy is killed
- if (npcinfo[npcnum].hp == 0) {
- _player.exp = _player.exp + npcinfo[npcnum].maxhp;
+ if (_npcinfo[npcnum].hp == 0) {
+ _player.exp = _player.exp + _npcinfo[npcnum].maxhp;
- if (npcinfo[npcnum].spriteset == 1 || npcinfo[npcnum].spriteset == 7 || npcinfo[npcnum].spriteset == 6) {
+ if (_npcinfo[npcnum].spriteset == 1 || _npcinfo[npcnum].spriteset == 7 || _npcinfo[npcnum].spriteset == 6) {
int ff = (int)(RND() * _player.level * 3);
if (ff == 0) {
- float npx = npcinfo[npcnum].x + 12;
- float npy = npcinfo[npcnum].y + 20;
+ float npx = _npcinfo[npcnum].x + 12;
+ float npy = _npcinfo[npcnum].y + 20;
int lx = (int)npx / 16;
int ly = (int)npy / 16;
- if (objmap[lx][ly] == -1)
- objmap[lx][ly] = 4;
+ if (_objmap[lx][ly] == -1)
+ _objmap[lx][ly] = 4;
}
}
- if (npcinfo[npcnum].spriteset == 2 || npcinfo[npcnum].spriteset == 9 || npcinfo[npcnum].spriteset == 4 || npcinfo[npcnum].spriteset == 5) {
+ if (_npcinfo[npcnum].spriteset == 2 || _npcinfo[npcnum].spriteset == 9 || _npcinfo[npcnum].spriteset == 4 || _npcinfo[npcnum].spriteset == 5) {
int ff = (int)(RND() * _player.level);
if (ff == 0) {
- float npx = npcinfo[npcnum].x + 12;
- float npy = npcinfo[npcnum].y + 20;
+ float npx = _npcinfo[npcnum].x + 12;
+ float npy = _npcinfo[npcnum].y + 20;
int lx = (int)npx / 16;
int ly = (int)npy / 16;
- if (objmap[lx][ly] == -1)
- objmap[lx][ly] = 12;
+ if (_objmap[lx][ly] == -1)
+ _objmap[lx][ly] = 12;
}
}
- if (npcinfo[npcnum].spriteset == 9 || npcinfo[npcnum].spriteset == 10 || npcinfo[npcnum].spriteset == 5) {
+ if (_npcinfo[npcnum].spriteset == 9 || _npcinfo[npcnum].spriteset == 10 || _npcinfo[npcnum].spriteset == 5) {
int ff = (int)(RND() * _player.level * 2);
if (ff == 0) {
- float npx = npcinfo[npcnum].x + 12;
- float npy = npcinfo[npcnum].y + 20;
+ float npx = _npcinfo[npcnum].x + 12;
+ float npy = _npcinfo[npcnum].y + 20;
int lx = (int)npx / 16;
int ly = (int)npy / 16;
- if (objmap[lx][ly] == -1)
- objmap[lx][ly] = 13;
+ if (_objmap[lx][ly] == -1)
+ _objmap[lx][ly] = 13;
}
}
// academy master key chest script
- if (npcinfo[npcnum].script == 2) {
+ if (_npcinfo[npcnum].script == 2) {
bool alive = false;
for (int i = 1; i <= lastnpc; i++) {
- if (npcinfo[i].hp > 0)
+ if (_npcinfo[i].hp > 0)
alive = true;
}
@@ -1691,7 +1691,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
int cx = 9;
int cy = 7;
- objmap[cx][cy] = 5;
+ _objmap[cx][cy] = 5;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -1712,10 +1712,10 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
}
// academy crystal chest script
- if (npcinfo[npcnum].script == 3) {
+ if (_npcinfo[npcnum].script == 3) {
bool alive = false;
for (int i = 1; i <= lastnpc; i++) {
- if (npcinfo[i].hp > 0)
+ if (_npcinfo[i].hp > 0)
alive = true;
}
@@ -1723,7 +1723,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
int cx = 9;
int cy = 7;
- objmap[cx][cy] = 6;
+ _objmap[cx][cy] = 6;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -1744,8 +1744,8 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
}
// tower shield chest script
- if (npcinfo[npcnum].script == 4 && _scriptflag[4][0] == 0) {
- triggerloc[9][7] = 5004;
+ if (_npcinfo[npcnum].script == 4 && _scriptflag[4][0] == 0) {
+ _triggerloc[9][7] = 5004;
int curtile = 40;
int curtilel = 0;
@@ -1770,10 +1770,10 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
}
// firehydra sword chest
- if (npcinfo[npcnum].script == 5) {
+ if (_npcinfo[npcnum].script == 5) {
bool alive = false;
for (int i = 1; i <= lastnpc; i++) {
- if (npcinfo[i].hp > 0)
+ if (_npcinfo[i].hp > 0)
alive = true;
}
@@ -1781,7 +1781,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
int cx = 9;
int cy = 6;
- objmap[cx][cy] = 9;
+ _objmap[cx][cy] = 9;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -1803,10 +1803,10 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
}
// gardens master key script
- if (npcinfo[npcnum].script == 8 && _scriptflag[6][0] == 0) {
+ if (_npcinfo[npcnum].script == 8 && _scriptflag[6][0] == 0) {
bool alive = false;
for (int i = 1; i <= lastnpc; i++) {
- if (npcinfo[i].hp > 0)
+ if (_npcinfo[i].hp > 0)
alive = true;
}
@@ -1814,7 +1814,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
int cx = 13;
int cy = 7;
- objmap[cx][cy] = 5;
+ _objmap[cx][cy] = 5;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -1836,10 +1836,10 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
// regular key chest 1
for (int s = 20; s <= 23; s++) {
- if (npcinfo[npcnum].script == s && _scriptflag[s][0] < 2) {
+ if (_npcinfo[npcnum].script == s && _scriptflag[s][0] < 2) {
bool alive = false;
for (int i = 1; i <= lastnpc; i++) {
- if (npcinfo[i].hp > 0)
+ if (_npcinfo[i].hp > 0)
alive = true;
}
@@ -1847,7 +1847,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
int cx = 9;
int cy = 7;
- objmap[cx][cy] = 11;
+ _objmap[cx][cy] = 11;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -1869,10 +1869,10 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
}
// pickup lightning bomb
- if (npcinfo[npcnum].script == 9 && (_curmap == 41 && _scriptflag[9][1] == 0)) {
+ if (_npcinfo[npcnum].script == 9 && (_curmap == 41 && _scriptflag[9][1] == 0)) {
bool alive = false;
for (int i = 1; i <= lastnpc; i++) {
- if (npcinfo[i].hp > 0)
+ if (_npcinfo[i].hp > 0)
alive = true;
}
@@ -1880,7 +1880,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
int cx = 9;
int cy = 7;
- objmap[cx][cy] = 13;
+ _objmap[cx][cy] = 13;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -1899,10 +1899,10 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
}
// citadel armour chest
- if (npcinfo[npcnum].script == 12) {
+ if (_npcinfo[npcnum].script == 12) {
bool alive = false;
for (int i = 1; i <= lastnpc; i++) {
- if (npcinfo[i].hp > 0)
+ if (_npcinfo[i].hp > 0)
alive = true;
}
@@ -1910,7 +1910,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
int cx = 8;
int cy = 7;
- objmap[cx][cy] = 16;
+ _objmap[cx][cy] = 16;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -1931,10 +1931,10 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
}
// citadel master key script
- if (npcinfo[npcnum].script == 13 && _scriptflag[13][0] == 0) {
+ if (_npcinfo[npcnum].script == 13 && _scriptflag[13][0] == 0) {
bool alive = false;
for (int i = 1; i <= lastnpc; i++) {
- if (npcinfo[i].hp > 0)
+ if (_npcinfo[i].hp > 0)
alive = true;
}
@@ -1942,7 +1942,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
int cx = 11;
int cy = 10;
- objmap[cx][cy] = 5;
+ _objmap[cx][cy] = 5;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -1963,10 +1963,10 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
}
// max ups
- if (npcinfo[npcnum].script == 15 && _scriptflag[15][0] == 0) {
+ if (_npcinfo[npcnum].script == 15 && _scriptflag[15][0] == 0) {
bool alive = false;
for (int i = 1; i <= lastnpc; i++) {
- if (npcinfo[i].hp > 0)
+ if (_npcinfo[i].hp > 0)
alive = true;
}
@@ -1974,7 +1974,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
int cx = 6;
int cy = 8;
- objmap[cx][cy] = 18;
+ _objmap[cx][cy] = 18;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -1995,7 +1995,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
cx = 9;
cy = 8;
- objmap[cx][cy] = 19;
+ _objmap[cx][cy] = 19;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -2017,7 +2017,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
cx = 12;
cy = 8;
- objmap[cx][cy] = 20;
+ _objmap[cx][cy] = 20;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -2037,7 +2037,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
}
}
- if (npcinfo[npcnum].script == 14)
+ if (_npcinfo[npcnum].script == 14)
game_endofgame();
}
}
@@ -2063,20 +2063,20 @@ void GriffonEngine::game_damageplayer(int damage) {
void GriffonEngine::game_drawanims(int Layer) {
for (int sx = 0; sx <= 19; sx++) {
for (int sy = 0; sy <= 14; sy++) {
- int o = objmap[sx][sy];
+ int o = _objmap[sx][sy];
if (o > -1) {
- int xtiles = objectinfo[o][1];
- int ytiles = objectinfo[o][2];
- int cframe = objectframe[o][1];
+ int xtiles = _objectinfo[o][1];
+ int ytiles = _objectinfo[o][2];
+ int cframe = _objectframe[o][1];
for (int x = 0; x <= xtiles - 1; x++) {
for (int y = 0; y <= ytiles - 1; y++) {
int x1 = (sx + x) * 16;
int y1 = (sy + y) * 16;
- if (objecttile[o][cframe][x][y][1] == Layer) {
- int c = objecttile[o][cframe][x][y][0];
+ if (_objecttile[o][cframe][x][y][1] == Layer) {
+ int c = _objecttile[o][cframe][x][y][0];
c = c - 1;
int curtilel = 3;
int curtilex = c % 20;
@@ -2401,8 +2401,8 @@ void GriffonEngine::game_drawhud() {
rcDest.left = postinfo[pst][0];
rcDest.top = (float)(postinfo[pst][1] - 4 - sin(3.141592 / 8 * _itemyloc));
} else {
- rcDest.left = npcinfo[_curenemy].x + 4;
- rcDest.top = (float)(npcinfo[_curenemy].y + 4 - 16 - sin(3.141592 / 8 * _itemyloc));
+ rcDest.left = _npcinfo[_curenemy].x + 4;
+ rcDest.top = (float)(_npcinfo[_curenemy].y + 4 - 16 - sin(3.141592 / 8 * _itemyloc));
}
_itemimg[13]->blit(*_videobuffer, rcDest.left, rcDest.top);
@@ -2424,20 +2424,20 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (ysort[yy] > 0) {
int i = ysort[yy];
- if (npcinfo[i].hp > 0) {
- int npx = (int)(npcinfo[i].x);
- int npy = (int)(npcinfo[i].y);
+ if (_npcinfo[i].hp > 0) {
+ int npx = (int)(_npcinfo[i].x);
+ int npy = (int)(_npcinfo[i].y);
- int sprite = npcinfo[i].spriteset;
+ int sprite = _npcinfo[i].spriteset;
- int wdir = npcinfo[i].walkdir;
+ int wdir = _npcinfo[i].walkdir;
// spriteset1 specific
- if (npcinfo[i].spriteset == 1) {
+ if (_npcinfo[i].spriteset == 1) {
- if (npcinfo[i].attacking == 0) {
+ if (_npcinfo[i].attacking == 0) {
- int cframe = npcinfo[i].cframe;
+ int cframe = _npcinfo[i].cframe;
rcSrc.left = (int)(cframe / 4) * 24;
rcSrc.top = wdir * 24;
@@ -2449,15 +2449,15 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.setWidth(24);
rcDest.setHeight(24);
- if (npcinfo[i].pause > _ticks && npcinfo[i].shake < _ticks) {
- npcinfo[i].shake = _ticks + 50;
+ if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
+ _npcinfo[i].shake = _ticks + 50;
rcDest.left += (int)(RND() * 3) - 1;
rcDest.top += (int)(RND() * 3) - 1;
}
_anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
- int cframe = npcinfo[i].cattackframe;
+ int cframe = _npcinfo[i].cattackframe;
rcSrc.left = (int)(cframe / 4) * 24;
rcSrc.top = wdir * 24;
@@ -2475,16 +2475,16 @@ void GriffonEngine::game_drawnpcs(int mode) {
}
// onewing
- if (npcinfo[i].spriteset == 2) {
+ if (_npcinfo[i].spriteset == 2) {
for (int f = 0; f <= 7; f++) {
- int s = npcinfo[i].bodysection[f].sprite;
+ int s = _npcinfo[i].bodysection[f].sprite;
rcSrc.left = _animset2[s].x;
rcSrc.top = _animset2[s].y;
rcSrc.setWidth(_animset2[s].w);
rcSrc.setHeight(_animset2[s].h);
- rcDest.left = npcinfo[i].bodysection[f].x - _animset2[s].xofs;
- rcDest.top = npcinfo[i].bodysection[f].y - _animset2[s].yofs + 2;
+ rcDest.left = _npcinfo[i].bodysection[f].x - _animset2[s].xofs;
+ rcDest.top = _npcinfo[i].bodysection[f].y - _animset2[s].yofs + 2;
_anims[2]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
@@ -2492,20 +2492,20 @@ void GriffonEngine::game_drawnpcs(int mode) {
}
// twowing
- if (npcinfo[i].spriteset == 9) {
+ if (_npcinfo[i].spriteset == 9) {
for (int f = 0; f <= 7; f++) {
int yp = 0;
if (f == 0 && (_curmap == 53 || _curmap == 57 || _curmap == 61 || _curmap == 65 || _curmap == 56 || _curmap > 66) && _scriptflag[60][0] > 0)
yp = 16;
- int s = npcinfo[i].bodysection[f].sprite;
+ int s = _npcinfo[i].bodysection[f].sprite;
rcSrc.left = _animset9[s].x;
rcSrc.top = _animset9[s].y + yp;
rcSrc.setWidth(_animset9[s].w);
rcSrc.setHeight(_animset9[s].h);
- rcDest.left = npcinfo[i].bodysection[f].x - _animset9[s].xofs;
- rcDest.top = npcinfo[i].bodysection[f].y - _animset9[s].yofs + 2;
+ rcDest.left = _npcinfo[i].bodysection[f].x - _animset9[s].xofs;
+ rcDest.top = _npcinfo[i].bodysection[f].y - _animset9[s].yofs + 2;
_anims[9]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
@@ -2514,9 +2514,9 @@ void GriffonEngine::game_drawnpcs(int mode) {
// boss 1
- if (npcinfo[i].spriteset == 3) {
- if (npcinfo[i].attacking == 0) {
- int cframe = npcinfo[i].cframe;
+ if (_npcinfo[i].spriteset == 3) {
+ if (_npcinfo[i].attacking == 0) {
+ int cframe = _npcinfo[i].cframe;
rcSrc.left = (int)(cframe / 4) * 24;
rcSrc.top = 0;
@@ -2542,9 +2542,9 @@ void GriffonEngine::game_drawnpcs(int mode) {
}
// black knight
- if (npcinfo[i].spriteset == 4) {
- if (npcinfo[i].attacking == 0) {
- int cframe = npcinfo[i].cframe;
+ if (_npcinfo[i].spriteset == 4) {
+ if (_npcinfo[i].attacking == 0) {
+ int cframe = _npcinfo[i].cframe;
rcSrc.left = (int)(cframe / 4) * 24;
rcSrc.top = 0;
@@ -2570,16 +2570,16 @@ void GriffonEngine::game_drawnpcs(int mode) {
// firehydra
- if (npcinfo[i].spriteset == 5) {
+ if (_npcinfo[i].spriteset == 5) {
for (int ff = 0; ff <= 2; ff++) {
- if (npcinfo[i].hp > 10 * ff * 20) {
+ if (_npcinfo[i].hp > 10 * ff * 20) {
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
rcSrc.setWidth(16);
rcSrc.setHeight(16);
- rcDest.left = npcinfo[i].bodysection[10 * ff].x - 8;
- rcDest.top = npcinfo[i].bodysection[10 * ff].y - 8;
+ rcDest.left = _npcinfo[i].bodysection[10 * ff].x - 8;
+ rcDest.top = _npcinfo[i].bodysection[10 * ff].y - 8;
int x = 192 + ((int)(_itemyloc + ff * 5) % 3) * 64;
if (x > 255)
@@ -2594,8 +2594,8 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcSrc.setWidth(16);
rcSrc.setHeight(16);
- rcDest.left = npcinfo[i].bodysection[ff * 10 + f].x - 8 + (int)(RND() * 3) - 1;
- rcDest.top = npcinfo[i].bodysection[ff * 10 + f].y - 8 + (int)(RND() * 3) - 1;
+ rcDest.left = _npcinfo[i].bodysection[ff * 10 + f].x - 8 + (int)(RND() * 3) - 1;
+ rcDest.top = _npcinfo[i].bodysection[ff * 10 + f].y - 8 + (int)(RND() * 3) - 1;
x = 192 + f % 3 * 64;
if (x > 255)
@@ -2610,8 +2610,8 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcSrc.setWidth(42);
rcSrc.setHeight(36);
- rcDest.left = npcinfo[i].bodysection[10 * ff + 9].x - 21;
- rcDest.top = npcinfo[i].bodysection[10 * ff + 9].y - 21;
+ rcDest.left = _npcinfo[i].bodysection[10 * ff + 9].x - 21;
+ rcDest.top = _npcinfo[i].bodysection[10 * ff + 9].y - 21;
_spellimg->setAlpha(192, true);
_anims[5]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
@@ -2623,8 +2623,8 @@ void GriffonEngine::game_drawnpcs(int mode) {
}
// red dragon
- if (npcinfo[i].spriteset == 6) {
- int cframe = npcinfo[i].cframe;
+ if (_npcinfo[i].spriteset == 6) {
+ int cframe = _npcinfo[i].cframe;
rcSrc.left = (int)(cframe / 4) * 24;
rcSrc.top = wdir * 24;
@@ -2636,8 +2636,8 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.setWidth(24);
rcDest.setHeight(24);
- if (npcinfo[i].pause > _ticks && npcinfo[i].shake < _ticks) {
- npcinfo[i].shake = _ticks + 50;
+ if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
+ _npcinfo[i].shake = _ticks + 50;
rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
@@ -2646,9 +2646,9 @@ void GriffonEngine::game_drawnpcs(int mode) {
}
// wizard
- if (npcinfo[i].spriteset == 7) {
- // if(npcinfo[i].attacking == 0) {
- int cframe = npcinfo[i].cframe;
+ if (_npcinfo[i].spriteset == 7) {
+ // if(_npcinfo[i].attacking == 0) {
+ int cframe = _npcinfo[i].cframe;
rcSrc.left = (int)(cframe / 4) * 24;
rcSrc.top = wdir * 24;
@@ -2660,14 +2660,14 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.setWidth(24);
rcDest.setHeight(24);
- if (npcinfo[i].pause > _ticks && npcinfo[i].shake < _ticks) {
- npcinfo[i].shake = _ticks + 50;
+ if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
+ _npcinfo[i].shake = _ticks + 50;
rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
_anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
// } else {
- //cframe = npcinfo[i].cattackframe;
+ //cframe = _npcinfo[i].cattackframe;
//rcSrc.left = (int)(cframe / 4) * 24;
//rcSrc.top = wdir * 24;
@@ -2684,8 +2684,8 @@ void GriffonEngine::game_drawnpcs(int mode) {
// yellow dragon
- if (npcinfo[i].spriteset == 8) {
- int cframe = npcinfo[i].cframe;
+ if (_npcinfo[i].spriteset == 8) {
+ int cframe = _npcinfo[i].cframe;
rcSrc.left = (int)(cframe / 4) * 24;
rcSrc.top = wdir * 24;
@@ -2697,8 +2697,8 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.setWidth(24);
rcDest.setHeight(24);
- if (npcinfo[i].pause > _ticks && npcinfo[i].shake < _ticks) {
- npcinfo[i].shake = _ticks + 50;
+ if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
+ _npcinfo[i].shake = _ticks + 50;
rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
@@ -2707,14 +2707,14 @@ void GriffonEngine::game_drawnpcs(int mode) {
// dragon2
- if (npcinfo[i].spriteset == 10) {
- if (npcinfo[i].attacking == 0) {
- npcinfo[i].floating = npcinfo[i].floating + 0.25 * _fpsr;
- while (npcinfo[i].floating >= 16)
- npcinfo[i].floating = npcinfo[i].floating - 16;
+ if (_npcinfo[i].spriteset == 10) {
+ if (_npcinfo[i].attacking == 0) {
+ _npcinfo[i].floating = _npcinfo[i].floating + 0.25 * _fpsr;
+ while (_npcinfo[i].floating >= 16)
+ _npcinfo[i].floating = _npcinfo[i].floating - 16;
- float frame = npcinfo[i].frame;
- int cframe = npcinfo[i].cframe;
+ float frame = _npcinfo[i].frame;
+ int cframe = _npcinfo[i].cframe;
frame = frame + 0.5 * _fpsr;
while (frame >= 16)
@@ -2726,10 +2726,10 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (cframe < 0)
cframe = 0;
- npcinfo[i].frame = frame;
- npcinfo[i].cframe = cframe;
+ _npcinfo[i].frame = frame;
+ _npcinfo[i].cframe = cframe;
- cframe = npcinfo[i].cframe;
+ cframe = _npcinfo[i].cframe;
rcSrc.left = 74 * wdir;
rcSrc.top = (int)(cframe / 4) * 48;
@@ -2737,23 +2737,23 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcSrc.setHeight(48);
rcDest.left = npx + 12 - 37;
- rcDest.top = (float)(npy + 12 - 32 - 3 * sin(3.141592 * 2 * npcinfo[i].floating / 16));
+ rcDest.top = (float)(npy + 12 - 32 - 3 * sin(3.141592 * 2 * _npcinfo[i].floating / 16));
rcDest.setWidth(24);
rcDest.setHeight(24);
- if (npcinfo[i].pause > _ticks && npcinfo[i].shake < _ticks) {
- npcinfo[i].shake = _ticks + 50;
+ if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
+ _npcinfo[i].shake = _ticks + 50;
rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
_anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
- npcinfo[i].floating = npcinfo[i].floating + 0.25 * _fpsr;
- while (npcinfo[i].floating >= 16)
- npcinfo[i].floating = npcinfo[i].floating - 16;
+ _npcinfo[i].floating = _npcinfo[i].floating + 0.25 * _fpsr;
+ while (_npcinfo[i].floating >= 16)
+ _npcinfo[i].floating = _npcinfo[i].floating - 16;
- int cframe = npcinfo[i].cattackframe;
+ int cframe = _npcinfo[i].cattackframe;
rcSrc.left = 74 * wdir;
rcSrc.top = (int)(cframe / 4) * 48;
@@ -2761,7 +2761,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcSrc.setHeight(48);
rcDest.left = npx + 12 - 37;
- rcDest.top = (float)(npy + 12 - 32 - 3 * sin(3.141592 * 2 * npcinfo[i].floating / 16));
+ rcDest.top = (float)(npy + 12 - 32 - 3 * sin(3.141592 * 2 * _npcinfo[i].floating / 16));
rcDest.setWidth(24);
rcDest.setHeight(24);
@@ -2770,23 +2770,23 @@ void GriffonEngine::game_drawnpcs(int mode) {
}
// end boss
- if (npcinfo[i].spriteset == 11) {
+ if (_npcinfo[i].spriteset == 11) {
- npcinfo[i].floating = npcinfo[i].floating + .3 * _fpsr;
- while (npcinfo[i].floating >= 16)
- npcinfo[i].floating = npcinfo[i].floating - 16;
+ _npcinfo[i].floating = _npcinfo[i].floating + .3 * _fpsr;
+ while (_npcinfo[i].floating >= 16)
+ _npcinfo[i].floating = _npcinfo[i].floating - 16;
- float frame = npcinfo[i].frame2;
+ float frame = _npcinfo[i].frame2;
frame = frame + 0.5 * _fpsr;
while (frame >= 16)
frame = frame - 16;
- npcinfo[i].frame2 = frame;
+ _npcinfo[i].frame2 = frame;
int sx = npx + 12 - 40;
- int sy = (float)(npy + 12 - 50 - 3 * sin(3.141592 * 2 * npcinfo[i].floating / 16));
+ int sy = (float)(npy + 12 - 50 - 3 * sin(3.141592 * 2 * _npcinfo[i].floating / 16));
for (int fr = 0; fr <= 3; fr++) {
_spellimg->setAlpha(128 + (int)(RND() * 96), true);
@@ -2826,7 +2826,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
int ydif = (yloc + 8) - (_player.py + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
- float damage = (float)npcinfo[i].spelldamage * (1.0 + RND() * 0.5);
+ float damage = (float)_npcinfo[i].spelldamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
game_damageplayer(damage);
@@ -2852,7 +2852,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
ydif = (yloc + 8) - (_player.py + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
- float damage = (float)npcinfo[i].spelldamage * (1.0 + RND() * 0.5);
+ float damage = (float)_npcinfo[i].spelldamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
game_damageplayer(damage);
@@ -2867,7 +2867,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
_spellimg->setAlpha(255, true);
- if (npcinfo[i].attacking == 0) {
+ if (_npcinfo[i].attacking == 0) {
int cframe = (int)(frame);
rcSrc.left = 0;
rcSrc.top = 72 * (int)(cframe / 4);
@@ -2877,15 +2877,15 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.left = sx;
rcDest.top = sy;
- if (npcinfo[i].pause > _ticks && npcinfo[i].shake < _ticks) {
- npcinfo[i].shake = _ticks + 50;
+ if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
+ _npcinfo[i].shake = _ticks + 50;
rcDest.left = rcDest.top + (int)(RND() * 3) - 1;
rcDest.left = rcDest.top + (int)(RND() * 3) - 1;
}
_anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
- int cframe = (int)(npcinfo[i].cattackframe);
+ int cframe = (int)(_npcinfo[i].cattackframe);
rcSrc.left = 0;
rcSrc.top = 72 * (int)(cframe / 4);
@@ -2900,13 +2900,13 @@ void GriffonEngine::game_drawnpcs(int mode) {
}
// bat kitty
- if (npcinfo[i].spriteset == 12) {
- npcinfo[i].floating = npcinfo[i].floating + 1 * _fpsr;
- while (npcinfo[i].floating >= 16)
- npcinfo[i].floating = npcinfo[i].floating - 16;
+ if (_npcinfo[i].spriteset == 12) {
+ _npcinfo[i].floating = _npcinfo[i].floating + 1 * _fpsr;
+ while (_npcinfo[i].floating >= 16)
+ _npcinfo[i].floating = _npcinfo[i].floating - 16;
- float frame = npcinfo[i].frame;
- int cframe = npcinfo[i].cframe;
+ float frame = _npcinfo[i].frame;
+ int cframe = _npcinfo[i].cframe;
frame = frame + 0.5 * _fpsr;
while (frame >= 16)
@@ -2918,10 +2918,10 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (cframe < 0)
cframe = 0;
- npcinfo[i].frame = frame;
- npcinfo[i].cframe = cframe;
+ _npcinfo[i].frame = frame;
+ _npcinfo[i].cframe = cframe;
- cframe = npcinfo[i].cframe;
+ cframe = _npcinfo[i].cframe;
rcSrc.left = 0;
rcSrc.top = 0;
@@ -2929,12 +2929,12 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcSrc.setHeight(80);
rcDest.left = npx + 12 - 50;
- rcDest.top = (float)(npy + 12 - 64 + 2 * sin(3.141592 * 2 * npcinfo[i].floating / 16));
+ rcDest.top = (float)(npy + 12 - 64 + 2 * sin(3.141592 * 2 * _npcinfo[i].floating / 16));
rcDest.setWidth(99);
rcDest.setHeight(80);
- if (npcinfo[i].pause > _ticks && npcinfo[i].shake < _ticks) {
- npcinfo[i].shake = _ticks + 50;
+ if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
+ _npcinfo[i].shake = _ticks + 50;
rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
@@ -2953,7 +2953,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
rcDest.top = npy + 23;
- int ww = 14 * npcinfo[i].hp / npcinfo[i].maxhp;
+ int ww = 14 * _npcinfo[i].hp / _npcinfo[i].maxhp;
if (ww > 14)
ww = 14;
if (ww < 1)
@@ -2967,7 +2967,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
int pass = 1;
- if (npcinfo[i].spriteset == 3)
+ if (_npcinfo[i].spriteset == 3)
pass = 0;
if (pass == 1)
game_drawover(npx, npy);
@@ -3617,9 +3617,9 @@ void GriffonEngine::game_handlewalking() {
// push npc
if (pass == 1) {
for (int i = 1; i <= lastnpc; i++) {
- if (npcinfo[i].hp > 0) {
- npx = npcinfo[i].x;
- npy = npcinfo[i].y;
+ if (_npcinfo[i].hp > 0) {
+ npx = _npcinfo[i].x;
+ npy = _npcinfo[i].y;
opx = npx;
opy = npy;
@@ -3629,20 +3629,20 @@ void GriffonEngine::game_handlewalking() {
if (_player.walkdir == 0) {
if (abs(xdif) <= 8 && ydif > 0 && ydif < 8)
- npcinfo[i].y = npcinfo[i].y - spd;
+ _npcinfo[i].y = _npcinfo[i].y - spd;
} else if (_player.walkdir == 1) {
if (abs(xdif) <= 8 && ydif < 0 && ydif > -8)
- npcinfo[i].y = npcinfo[i].y + spd;
+ _npcinfo[i].y = _npcinfo[i].y + spd;
} else if (_player.walkdir == 2) {
if (abs(ydif) <= 8 && xdif > 0 && xdif < 8)
- npcinfo[i].x = npcinfo[i].x - spd;
+ _npcinfo[i].x = _npcinfo[i].x - spd;
} else if (_player.walkdir == 3) {
if (abs(ydif) <= 8 && xdif < 0 && xdif > -8)
- npcinfo[i].x = npcinfo[i].x + spd;
+ _npcinfo[i].x = _npcinfo[i].x + spd;
}
- npx = npcinfo[i].x;
- npy = npcinfo[i].y;
+ npx = _npcinfo[i].x;
+ npy = _npcinfo[i].y;
sx = (int)(npx / 2 + 6);
sy = (int)(npy / 2 + 10);
@@ -3650,8 +3650,8 @@ void GriffonEngine::game_handlewalking() {
bgc = *temp;
if (bgc > 0) {
- npcinfo[i].x = opx;
- npcinfo[i].y = opy;
+ _npcinfo[i].x = opx;
+ _npcinfo[i].y = opy;
}
}
}
@@ -3668,17 +3668,17 @@ void GriffonEngine::game_handlewalking() {
_player.walkframe = _player.walkframe - 16;
// walking over items to pickup :::
- int o = objmap[lx][ly];
+ int o = _objmap[lx][ly];
if (o > -1) {
// fsk
- if (objectinfo[o][4] == 2 && _player.inventory[INV_FLASK] < 9) {
- objmap[lx][ly] = -1;
+ if (_objectinfo[o][4] == 2 && _player.inventory[INV_FLASK] < 9) {
+ _objmap[lx][ly] = -1;
_player.inventory[INV_FLASK]++;
game_addFloatIcon(6, lx * 16, ly * 16);
- objmapf[_curmap][lx][ly] = 1;
+ _objmapf[_curmap][lx][ly] = 1;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
@@ -3686,13 +3686,13 @@ void GriffonEngine::game_handlewalking() {
}
}
- if (objectinfo[o][5] == 7 && _player.inventory[INV_DOUBLEFLASK] < 9) {
- objmap[lx][ly] = -1;
+ if (_objectinfo[o][5] == 7 && _player.inventory[INV_DOUBLEFLASK] < 9) {
+ _objmap[lx][ly] = -1;
_player.inventory[INV_DOUBLEFLASK]++;
game_addFloatIcon(12, lx * 16, ly * 16);
- objmapf[_curmap][lx][ly] = 1;
+ _objmapf[_curmap][lx][ly] = 1;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
@@ -3700,13 +3700,13 @@ void GriffonEngine::game_handlewalking() {
}
}
- if (objectinfo[o][5] == 9 && _player.inventory[INV_SHOCK] < 9 && (_curmap == 41 && _scriptflag[9][1] == 0)) {
- objmap[lx][ly] = -1;
+ if (_objectinfo[o][5] == 9 && _player.inventory[INV_SHOCK] < 9 && (_curmap == 41 && _scriptflag[9][1] == 0)) {
+ _objmap[lx][ly] = -1;
_player.inventory[INV_SHOCK]++;
game_addFloatIcon(17, lx * 16, ly * 16);
- objmapf[_curmap][lx][ly] = 1;
+ _objmapf[_curmap][lx][ly] = 1;
if (_curmap == 41)
_scriptflag[9][1] = 1;
@@ -3717,13 +3717,13 @@ void GriffonEngine::game_handlewalking() {
}
- if (objectinfo[o][5] == 9 && _player.inventory[INV_SHOCK] < 9) {
- objmap[lx][ly] = -1;
+ if (_objectinfo[o][5] == 9 && _player.inventory[INV_SHOCK] < 9) {
+ _objmap[lx][ly] = -1;
_player.inventory[INV_SHOCK]++;
game_addFloatIcon(17, lx * 16, ly * 16);
- objmapf[_curmap][lx][ly] = 1;
+ _objmapf[_curmap][lx][ly] = 1;
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndpowerup]);
@@ -3802,7 +3802,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
for (int x = 0; x <= 319; x++)
for (int y = 0; y <= 239; y++) {
- triggerloc[x][y] = -1;
+ _triggerloc[x][y] = -1;
}
// read *.trg file
@@ -3810,16 +3810,16 @@ void GriffonEngine::game_loadmap(int mapnum) {
debug(1, "Reading %s", name);
file.open(name);
- INPUT("%i", &ntriggers);
+ INPUT("%i", &_ntriggers);
- for (int i = 0; i < ntriggers; i++) {
+ for (int i = 0; i < _ntriggers; i++) {
int mapx, mapy, trig;
INPUT("%i", &mapx);
INPUT("%i", &mapy);
INPUT("%i", &trig);
- triggerloc[mapx][mapy] = trig;
+ _triggerloc[mapx][mapy] = trig;
}
file.close();
@@ -3836,7 +3836,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
_tileinfo[l][x][y][a] = 0;
if (_scriptflag[4][0] == 1 && _curmap == 4) {
- triggerloc[9][7] = 5004;
+ _triggerloc[9][7] = 5004;
tempmap[9][7] = 41;
tempmap[9][7 + 40] = 0;
}
@@ -3969,11 +3969,11 @@ void GriffonEngine::game_loadmap(int mapnum) {
}
}
- lastobj = 0;
+ _lastobj = 0;
lastnpc = 0;
for (int i = 0; i < kMaxNPC; i++)
- npcinfo[i].onmap = 0;
+ _npcinfo[i].onmap = 0;
for (int x = 0; x <= 19; x++) {
for (int y = 0; y <= 19; y++) {
@@ -3989,18 +3989,18 @@ void GriffonEngine::game_loadmap(int mapnum) {
obj = d % 2;
}
- objmap[x][y] = -1;
+ _objmap[x][y] = -1;
if (obj == 1) {
int o = tempmap[5 * 40 + x][y];
- if (objmapf[_curmap][x][y] == 0) {
- objmap[x][y] = o;
+ if (_objmapf[_curmap][x][y] == 0) {
+ _objmap[x][y] = o;
- if (objectinfo[o][0] > 1) {
- if (o > lastobj)
- lastobj = o;
+ if (_objectinfo[o][0] > 1) {
+ if (o > _lastobj)
+ _lastobj = o;
}
int x1 = x * 8;
@@ -4011,9 +4011,9 @@ void GriffonEngine::game_loadmap(int mapnum) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- if (objectinfo[o][4] == 1)
+ if (_objectinfo[o][4] == 1)
_clipbg->fillRect(rcDest, ccc);
- if (objectinfo[o][4] == 3)
+ if (_objectinfo[o][4] == 3)
_clipbg->fillRect(rcDest, ccc);
}
}
@@ -4023,11 +4023,11 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (o > lastnpc)
lastnpc = o;
- npcinfo[o].x = x * 16 - 4;
- npcinfo[o].y = y * 16 - 5;
+ _npcinfo[o].x = x * 16 - 4;
+ _npcinfo[o].y = y * 16 - 5;
- npcinfo[o].walkdir = 1;
- npcinfo[o].onmap = 1;
+ _npcinfo[o].walkdir = 1;
+ _npcinfo[o].onmap = 1;
}
}
}
@@ -4055,262 +4055,262 @@ void GriffonEngine::game_loadmap(int mapnum) {
file.open(name);
for (int i = 0; i < kMaxNPC; i++) {
- INPUT("%i", &npcinfo[i].spriteset);
- INPUT("%i", &npcinfo[i].x1);
- INPUT("%i", &npcinfo[i].y1);
- INPUT("%i", &npcinfo[i].x2);
- INPUT("%i", &npcinfo[i].y2);
- INPUT("%i", &npcinfo[i].movementmode);
- INPUT("%i", &npcinfo[i].hp);
- INPUT("%i", &npcinfo[i].item1);
- INPUT("%i", &npcinfo[i].item2);
- INPUT("%i", &npcinfo[i].item3);
- INPUT("%i", &npcinfo[i].script);
+ INPUT("%i", &_npcinfo[i].spriteset);
+ INPUT("%i", &_npcinfo[i].x1);
+ INPUT("%i", &_npcinfo[i].y1);
+ INPUT("%i", &_npcinfo[i].x2);
+ INPUT("%i", &_npcinfo[i].y2);
+ INPUT("%i", &_npcinfo[i].movementmode);
+ INPUT("%i", &_npcinfo[i].hp);
+ INPUT("%i", &_npcinfo[i].item1);
+ INPUT("%i", &_npcinfo[i].item2);
+ INPUT("%i", &_npcinfo[i].item3);
+ INPUT("%i", &_npcinfo[i].script);
// baby dragon
- if (npcinfo[i].spriteset == 1) {
- npcinfo[i].hp = 12;
- npcinfo[i].attackdelay = 2000;
+ if (_npcinfo[i].spriteset == 1) {
+ _npcinfo[i].hp = 12;
+ _npcinfo[i].attackdelay = 2000;
- npcinfo[i].attackdamage = 2;
- npcinfo[i].spelldamage = 0;
+ _npcinfo[i].attackdamage = 2;
+ _npcinfo[i].spelldamage = 0;
- npcinfo[i].walkspd = 1;
+ _npcinfo[i].walkspd = 1;
if (RND() * 5 == 0)
- npcinfo[i].hp = 0;
+ _npcinfo[i].hp = 0;
}
// onewing
- if (npcinfo[i].spriteset == 2) {
- npcinfo[i].hp = 200;
- npcinfo[i].attackdelay = 2000;
- npcinfo[i].swayspd = 1;
+ if (_npcinfo[i].spriteset == 2) {
+ _npcinfo[i].hp = 200;
+ _npcinfo[i].attackdelay = 2000;
+ _npcinfo[i].swayspd = 1;
- npcinfo[i].attackdamage = 24;
- npcinfo[i].spelldamage = 30;
+ _npcinfo[i].attackdamage = 24;
+ _npcinfo[i].spelldamage = 30;
- npcinfo[i].walkspd = 1.4f;
- npcinfo[i].castpause = _ticks;
+ _npcinfo[i].walkspd = 1.4f;
+ _npcinfo[i].castpause = _ticks;
}
// boss1
- if (npcinfo[i].spriteset == 3) {
- npcinfo[i].hp = 300;
- npcinfo[i].attackdelay = 2200;
+ if (_npcinfo[i].spriteset == 3) {
+ _npcinfo[i].hp = 300;
+ _npcinfo[i].attackdelay = 2200;
- npcinfo[i].attackdamage = 0;
- npcinfo[i].spelldamage = 30;
+ _npcinfo[i].attackdamage = 0;
+ _npcinfo[i].spelldamage = 30;
- npcinfo[i].walkspd = 1.2f;
+ _npcinfo[i].walkspd = 1.2f;
}
// black knights
- if (npcinfo[i].spriteset == 4) {
- npcinfo[i].hp = 200;
- npcinfo[i].attackdelay = 2800;
+ if (_npcinfo[i].spriteset == 4) {
+ _npcinfo[i].hp = 200;
+ _npcinfo[i].attackdelay = 2800;
- npcinfo[i].attackdamage = 0;
- npcinfo[i].spelldamage = 30;
+ _npcinfo[i].attackdamage = 0;
+ _npcinfo[i].spelldamage = 30;
- npcinfo[i].walkspd = 1;
+ _npcinfo[i].walkspd = 1;
}
// boss2 firehydra
- if (npcinfo[i].spriteset == 5) {
- npcinfo[i].hp = 600;
- npcinfo[i].attackdelay = 2200;
+ if (_npcinfo[i].spriteset == 5) {
+ _npcinfo[i].hp = 600;
+ _npcinfo[i].attackdelay = 2200;
- npcinfo[i].attackdamage = 50;
- npcinfo[i].spelldamage = 30;
+ _npcinfo[i].attackdamage = 50;
+ _npcinfo[i].spelldamage = 30;
- npcinfo[i].walkspd = 1.3f;
+ _npcinfo[i].walkspd = 1.3f;
- npcinfo[i].swayangle = 0;
+ _npcinfo[i].swayangle = 0;
}
// baby fire dragon
- if (npcinfo[i].spriteset == 6) {
- npcinfo[i].hp = 20;
- npcinfo[i].attackdelay = 1500;
+ if (_npcinfo[i].spriteset == 6) {
+ _npcinfo[i].hp = 20;
+ _npcinfo[i].attackdelay = 1500;
- npcinfo[i].attackdamage = 0;
- npcinfo[i].spelldamage = 12;
+ _npcinfo[i].attackdamage = 0;
+ _npcinfo[i].spelldamage = 12;
- npcinfo[i].walkspd = 1;
+ _npcinfo[i].walkspd = 1;
if (RND() * 5 == 0)
- npcinfo[i].hp = 0;
+ _npcinfo[i].hp = 0;
}
// priest1
- if (npcinfo[i].spriteset == 7) {
- npcinfo[i].hp = 40;
- npcinfo[i].attackdelay = 5000;
+ if (_npcinfo[i].spriteset == 7) {
+ _npcinfo[i].hp = 40;
+ _npcinfo[i].attackdelay = 5000;
- npcinfo[i].attackdamage = 0;
- npcinfo[i].spelldamage = 8;
+ _npcinfo[i].attackdamage = 0;
+ _npcinfo[i].spelldamage = 8;
- npcinfo[i].walkspd = 1;
+ _npcinfo[i].walkspd = 1;
if (RND() * 8 == 0)
- npcinfo[i].hp = 0;
+ _npcinfo[i].hp = 0;
}
// yellow fire dragon
- if (npcinfo[i].spriteset == 8) {
- npcinfo[i].hp = 100;
- npcinfo[i].attackdelay = 1500;
+ if (_npcinfo[i].spriteset == 8) {
+ _npcinfo[i].hp = 100;
+ _npcinfo[i].attackdelay = 1500;
- npcinfo[i].attackdamage = 0;
- npcinfo[i].spelldamage = 24;
+ _npcinfo[i].attackdamage = 0;
+ _npcinfo[i].spelldamage = 24;
- npcinfo[i].walkspd = 1;
+ _npcinfo[i].walkspd = 1;
if (RND() * 5 == 0)
- npcinfo[i].hp = 0;
+ _npcinfo[i].hp = 0;
}
// twowing
- if (npcinfo[i].spriteset == 9) {
- npcinfo[i].hp = 140;
- npcinfo[i].attackdelay = 2000;
- npcinfo[i].swayspd = 1;
+ if (_npcinfo[i].spriteset == 9) {
+ _npcinfo[i].hp = 140;
+ _npcinfo[i].attackdelay = 2000;
+ _npcinfo[i].swayspd = 1;
- npcinfo[i].attackdamage = 30;
- npcinfo[i].spelldamage = 0;
+ _npcinfo[i].attackdamage = 30;
+ _npcinfo[i].spelldamage = 0;
- npcinfo[i].walkspd = 1;
+ _npcinfo[i].walkspd = 1;
- npcinfo[i].castpause = 0;
+ _npcinfo[i].castpause = 0;
}
// dragon2
- if (npcinfo[i].spriteset == 10) {
- npcinfo[i].hp = 80;
- npcinfo[i].attackdelay = 1500;
+ if (_npcinfo[i].spriteset == 10) {
+ _npcinfo[i].hp = 80;
+ _npcinfo[i].attackdelay = 1500;
- npcinfo[i].attackdamage = 24;
- npcinfo[i].spelldamage = 0;
+ _npcinfo[i].attackdamage = 24;
+ _npcinfo[i].spelldamage = 0;
- npcinfo[i].walkspd = 1;
+ _npcinfo[i].walkspd = 1;
- npcinfo[i].floating = RND() * 16;
+ _npcinfo[i].floating = RND() * 16;
}
// end boss
- if (npcinfo[i].spriteset == 11) {
- npcinfo[i].hp = 1200;
- npcinfo[i].attackdelay = 2000;
+ if (_npcinfo[i].spriteset == 11) {
+ _npcinfo[i].hp = 1200;
+ _npcinfo[i].attackdelay = 2000;
- npcinfo[i].attackdamage = 100;
- npcinfo[i].spelldamage = 60;
+ _npcinfo[i].attackdamage = 100;
+ _npcinfo[i].spelldamage = 60;
- npcinfo[i].walkspd = 1;
+ _npcinfo[i].walkspd = 1;
- npcinfo[i].floating = RND() * 16;
+ _npcinfo[i].floating = RND() * 16;
}
// bat kitty
- if (npcinfo[i].spriteset == 12) {
- npcinfo[i].hp = 800;
- npcinfo[i].attackdelay = 2000;
+ if (_npcinfo[i].spriteset == 12) {
+ _npcinfo[i].hp = 800;
+ _npcinfo[i].attackdelay = 2000;
- npcinfo[i].attackdamage = 100;
- npcinfo[i].spelldamage = 50;
+ _npcinfo[i].attackdamage = 100;
+ _npcinfo[i].spelldamage = 50;
- npcinfo[i].walkspd = 1;
+ _npcinfo[i].walkspd = 1;
- npcinfo[i].floating = RND() * 16;
+ _npcinfo[i].floating = RND() * 16;
}
- if (npcinfo[i].onmap == 0)
- npcinfo[i].hp = 0;
+ if (_npcinfo[i].onmap == 0)
+ _npcinfo[i].hp = 0;
- npcinfo[i].maxhp = npcinfo[i].hp;
+ _npcinfo[i].maxhp = _npcinfo[i].hp;
- npcinfo[i].attacking = 0;
- npcinfo[i].attackframe = 0;
- npcinfo[i].cattackframe = 0;
- npcinfo[i].attackspd = 1.5;
- npcinfo[i].attacknext = _ticks + npcinfo[i].attackdelay * (1 + RND() * 2);
+ _npcinfo[i].attacking = 0;
+ _npcinfo[i].attackframe = 0;
+ _npcinfo[i].cattackframe = 0;
+ _npcinfo[i].attackspd = 1.5;
+ _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay * (1 + RND() * 2);
- if (npcinfo[i].spriteset == 2 || npcinfo[i].spriteset == 9) {
- npcinfo[i].bodysection[0].sprite = 0;
- npcinfo[i].bodysection[1].sprite = 1;
- npcinfo[i].bodysection[2].sprite = 2;
- npcinfo[i].bodysection[3].sprite = 3;
- npcinfo[i].bodysection[4].sprite = 4;
- npcinfo[i].bodysection[5].sprite = 3;
- npcinfo[i].bodysection[6].sprite = 3;
- npcinfo[i].bodysection[7].sprite = 5;
+ if (_npcinfo[i].spriteset == 2 || _npcinfo[i].spriteset == 9) {
+ _npcinfo[i].bodysection[0].sprite = 0;
+ _npcinfo[i].bodysection[1].sprite = 1;
+ _npcinfo[i].bodysection[2].sprite = 2;
+ _npcinfo[i].bodysection[3].sprite = 3;
+ _npcinfo[i].bodysection[4].sprite = 4;
+ _npcinfo[i].bodysection[5].sprite = 3;
+ _npcinfo[i].bodysection[6].sprite = 3;
+ _npcinfo[i].bodysection[7].sprite = 5;
- npcinfo[i].bodysection[0].bonelength = 8;
- npcinfo[i].bodysection[1].bonelength = 7;
- npcinfo[i].bodysection[2].bonelength = 6;
- npcinfo[i].bodysection[3].bonelength = 4;
- npcinfo[i].bodysection[4].bonelength = 4;
- npcinfo[i].bodysection[5].bonelength = 4;
- npcinfo[i].bodysection[6].bonelength = 4;
+ _npcinfo[i].bodysection[0].bonelength = 8;
+ _npcinfo[i].bodysection[1].bonelength = 7;
+ _npcinfo[i].bodysection[2].bonelength = 6;
+ _npcinfo[i].bodysection[3].bonelength = 4;
+ _npcinfo[i].bodysection[4].bonelength = 4;
+ _npcinfo[i].bodysection[5].bonelength = 4;
+ _npcinfo[i].bodysection[6].bonelength = 4;
for (int f = 0; f <= 7; f++) {
- npcinfo[i].bodysection[f].x = npcinfo[i].x + 12;
- npcinfo[i].bodysection[f].y = npcinfo[i].y + 14;
+ _npcinfo[i].bodysection[f].x = _npcinfo[i].x + 12;
+ _npcinfo[i].bodysection[f].y = _npcinfo[i].y + 14;
}
- npcinfo[i].headtargetx[0] = npcinfo[i].x + 12;
- npcinfo[i].headtargety[0] = npcinfo[i].y + 14;
+ _npcinfo[i].headtargetx[0] = _npcinfo[i].x + 12;
+ _npcinfo[i].headtargety[0] = _npcinfo[i].y + 14;
}
- if (npcinfo[i].spriteset == 5) {
+ if (_npcinfo[i].spriteset == 5) {
for (int f = 0; f <= 29; f++) {
- npcinfo[i].bodysection[f].x = npcinfo[i].x + 12;
- npcinfo[i].bodysection[f].y = npcinfo[i].y + 14;
+ _npcinfo[i].bodysection[f].x = _npcinfo[i].x + 12;
+ _npcinfo[i].bodysection[f].y = _npcinfo[i].y + 14;
}
for (int f = 0; f <= 2; f++) {
- npcinfo[i].headtargetx[f] = npcinfo[i].x + 12;
- npcinfo[i].headtargety[f] = npcinfo[i].y + 14;
+ _npcinfo[i].headtargetx[f] = _npcinfo[i].x + 12;
+ _npcinfo[i].headtargety[f] = _npcinfo[i].y + 14;
- npcinfo[i].attacking2[f] = 0;
- npcinfo[i].attackframe2[f] = 0;
+ _npcinfo[i].attacking2[f] = 0;
+ _npcinfo[i].attackframe2[f] = 0;
}
}
- if (npcinfo[i].script == 2) {
+ if (_npcinfo[i].script == 2) {
_roomlock = 1;
if (_scriptflag[2][0] > 0) {
_roomlock = 0;
- npcinfo[i].hp = 0;
+ _npcinfo[i].hp = 0;
}
}
- if (npcinfo[i].script == 3) {
+ if (_npcinfo[i].script == 3) {
_roomlock = 1;
if (_scriptflag[3][0] > 0) {
_roomlock = 0;
- npcinfo[i].hp = 0;
+ _npcinfo[i].hp = 0;
}
}
- if (npcinfo[i].script == 5) {
+ if (_npcinfo[i].script == 5) {
_roomlock = 1;
if (_scriptflag[5][0] > 0) {
_roomlock = 0;
- npcinfo[i].hp = 0;
+ _npcinfo[i].hp = 0;
}
}
- if (npcinfo[i].script == 15) {
+ if (_npcinfo[i].script == 15) {
_roomlock = 1;
if (_scriptflag[15][0] > 0) {
_roomlock = 0;
- npcinfo[i].hp = 0;
+ _npcinfo[i].hp = 0;
}
}
- npcinfo[i].pause = _ticks;
+ _npcinfo[i].pause = _ticks;
}
file.close();
@@ -4323,7 +4323,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
cx = 9;
cy = 7;
- objmap[cx][cy] = 5;
+ _objmap[cx][cy] = 5;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -4347,7 +4347,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
cx = 9;
cy = 7;
- objmap[cx][cy] = 6;
+ _objmap[cx][cy] = 6;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -4371,7 +4371,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
cx = 13;
cy = 7;
- objmap[cx][cy] = 5;
+ _objmap[cx][cy] = 5;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -4395,7 +4395,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
cx = 9;
cy = 6;
- objmap[cx][cy] = 9;
+ _objmap[cx][cy] = 9;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -4419,7 +4419,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
cx = 8;
cy = 7;
- objmap[cx][cy] = 16;
+ _objmap[cx][cy] = 16;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -4443,7 +4443,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
cx = 11;
cy = 10;
- objmap[cx][cy] = 5;
+ _objmap[cx][cy] = 5;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -4468,7 +4468,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
cx = 6;
cy = 8;
- objmap[cx][cy] = 18;
+ _objmap[cx][cy] = 18;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -4491,7 +4491,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
cx = 9;
cy = 8;
- objmap[cx][cy] = 19;
+ _objmap[cx][cy] = 19;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -4514,7 +4514,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
cx = 12;
cy = 8;
- objmap[cx][cy] = 20;
+ _objmap[cx][cy] = 20;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -4681,7 +4681,7 @@ __exit_do:
_player.nextlevel = 0;
memset(_scriptflag, 0, sizeof(_scriptflag));
- memset(objmapf, 0, sizeof(objmapf));
+ memset(_objmapf, 0, sizeof(_objmapf));
memset(_roomlocks, 0, sizeof(_roomlocks));
_roomlocks[66] = 2;
@@ -4756,16 +4756,16 @@ void GriffonEngine::game_playgame() {
}
void GriffonEngine::game_processtrigger(int trignum) {
- int trigtype = triggers[trignum][0];
+ int trigtype = _triggers[trignum][0];
if (_roomlock == 1)
return;
// map jump------------------------------
if (trigtype == 0) {
- int tx = triggers[trignum][1];
- int ty = triggers[trignum][2];
- int tmap = triggers[trignum][3];
- int tjumpstyle = triggers[trignum][4];
+ int tx = _triggers[trignum][1];
+ int ty = _triggers[trignum][2];
+ int tmap = _triggers[trignum][3];
+ int tjumpstyle = _triggers[trignum][4];
if (_roomlocks[tmap] > 0) {
if (saidlocked == 0)
@@ -4790,8 +4790,8 @@ void GriffonEngine::game_processtrigger(int trignum) {
// loc-sxy+oldmaploc
if (tjumpstyle == 0) {
- int tsx = triggers[trignum][5];
- int tsy = triggers[trignum][6];
+ int tsx = _triggers[trignum][5];
+ int tsy = _triggers[trignum][6];
_player.px += (tx - tsx) * 16;
_player.py += (ty - tsy) * 16;
@@ -5481,12 +5481,12 @@ void GriffonEngine::game_title(int mode) {
}
void GriffonEngine::game_updanims() {
- for (int i = 0; i <= lastobj; i++) {
- int nframes = objectinfo[i][0];
- int o_animspd = objectinfo[i][3];
- float frame = objectframe[i][0];
- int cframe = objectframe[i][1];
- // objectinfo[i][6] = 0; // ?? out of bounds
+ for (int i = 0; i <= _lastobj; i++) {
+ int nframes = _objectinfo[i][0];
+ int o_animspd = _objectinfo[i][3];
+ float frame = _objectframe[i][0];
+ int cframe = _objectframe[i][1];
+ // _objectinfo[i][6] = 0; // ?? out of bounds
if (nframes > 1) {
frame = frame + o_animspd / 50 * _fpsr;
@@ -5499,8 +5499,8 @@ void GriffonEngine::game_updanims() {
if (cframe < 0)
cframe = 0;
- objectframe[i][0] = frame;
- objectframe[i][1] = cframe;
+ _objectframe[i][0] = frame;
+ _objectframe[i][1] = cframe;
}
}
}
@@ -5519,7 +5519,7 @@ void GriffonEngine::game_updatey() {
lasty = 0;
for (int i = 1; i <= lastnpc; i++) {
- int yy = (int)(npcinfo[i].y * 10);
+ int yy = (int)(_npcinfo[i].y * 10);
do {
if (ysort[yy] == -1 || yy == 2400)
@@ -5593,12 +5593,12 @@ void GriffonEngine::game_updmusic() {
void GriffonEngine::game_updnpcs() {
for (int i = 1; i <= lastnpc; i++) {
- if (npcinfo[i].hp > 0) {
+ if (_npcinfo[i].hp > 0) {
// is npc walking
int pass = 0;
- if (npcinfo[i].attacking == 0)
+ if (_npcinfo[i].attacking == 0)
pass = 1;
- if (npcinfo[i].spriteset == 5)
+ if (_npcinfo[i].spriteset == 5)
pass = 1;
if (pass == 1) {
int moveup = 0;
@@ -5606,31 +5606,31 @@ void GriffonEngine::game_updnpcs() {
int moveleft = 0;
int moveright = 0;
- float npx = npcinfo[i].x;
- float npy = npcinfo[i].y;
+ float npx = _npcinfo[i].x;
+ float npy = _npcinfo[i].y;
float onpx = npx;
float onpy = npy;
- float wspd = npcinfo[i].walkspd / 4;
+ float wspd = _npcinfo[i].walkspd / 4;
- if (npcinfo[i].spriteset == 10)
+ if (_npcinfo[i].spriteset == 10)
wspd = wspd * 2;
- int wdir = npcinfo[i].walkdir;
+ int wdir = _npcinfo[i].walkdir;
- int mode = npcinfo[i].movementmode;
+ int mode = _npcinfo[i].movementmode;
float xdif = _player.px - npx;
float ydif = _player.py - npy;
if (abs(xdif) < 4 * 16 && abs(ydif) < 4 * 16 && mode < 3)
mode = 0;
- if (npcinfo[i].hp < npcinfo[i].maxhp * 0.25)
+ if (_npcinfo[i].hp < _npcinfo[i].maxhp * 0.25)
mode = 3;
- if (npcinfo[i].pause > _ticks)
+ if (_npcinfo[i].pause > _ticks)
mode = -1;
- if (npcinfo[i].spriteset == 2 && npcinfo[i].castpause > _ticks)
+ if (_npcinfo[i].spriteset == 2 && _npcinfo[i].castpause > _ticks)
mode = -1;
if (mode == 3) {
@@ -5646,7 +5646,7 @@ void GriffonEngine::game_updnpcs() {
// *** aggressive
if (mode == 0) {
- wspd = npcinfo[i].walkspd / 2;
+ wspd = _npcinfo[i].walkspd / 2;
xdif = _player.px - npx;
ydif = _player.py - npy;
@@ -5677,15 +5677,15 @@ void GriffonEngine::game_updnpcs() {
// *** defensive
if (mode == 1) {
- int movingdir = npcinfo[i].movingdir;
+ int movingdir = _npcinfo[i].movingdir;
- if (npcinfo[i].ticks > _ticks + 100000)
- npcinfo[i].ticks = _ticks;
+ if (_npcinfo[i].ticks > _ticks + 100000)
+ _npcinfo[i].ticks = _ticks;
- if (npcinfo[i].ticks < _ticks) {
- npcinfo[i].ticks = _ticks + 2000;
+ if (_npcinfo[i].ticks < _ticks) {
+ _npcinfo[i].ticks = _ticks + 2000;
movingdir = (int)(RND() * 8);
- npcinfo[i].movingdir = movingdir;
+ _npcinfo[i].movingdir = movingdir;
}
if (movingdir == 0) {
@@ -5724,7 +5724,7 @@ void GriffonEngine::game_updnpcs() {
// *** run away
if (mode == 3) {
- wspd = npcinfo[i].walkspd / 2;
+ wspd = _npcinfo[i].walkspd / 2;
xdif = _player.px - npx;
ydif = _player.py - npy;
@@ -5761,7 +5761,7 @@ void GriffonEngine::game_updnpcs() {
float xp = (npx / 2 + 6);
float yp = (npy / 2 + 10);
- if (npcinfo[i].spriteset == 10)
+ if (_npcinfo[i].spriteset == 10)
wspd = wspd * 2;
float ii = wspd * _fpsr;
@@ -5773,7 +5773,7 @@ void GriffonEngine::game_updnpcs() {
int sy = yp - ii;
uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
uint32 dq = *temp;
- if (npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == 11)
dq = 0;
if (dq == 0)
@@ -5783,7 +5783,7 @@ void GriffonEngine::game_updnpcs() {
sy = yp - ii;
temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
- if (npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == 11)
dq = 0;
if (dq == 0) {
movinup = 1;
@@ -5795,7 +5795,7 @@ void GriffonEngine::game_updnpcs() {
sy = yp - ii;
temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
- if (npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == 11)
dq = 0;
if (dq == 0) {
movinup = 1;
@@ -5809,7 +5809,7 @@ void GriffonEngine::game_updnpcs() {
int sy = yp + ii;
uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
uint32 dq = *temp;
- if (npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == 11)
dq = 0;
if (dq == 0)
movindown = 1;
@@ -5818,7 +5818,7 @@ void GriffonEngine::game_updnpcs() {
sy = yp + ii;
temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
- if (npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == 11)
dq = 0;
if (dq == 0) {
movindown = 1;
@@ -5830,7 +5830,7 @@ void GriffonEngine::game_updnpcs() {
sy = yp + ii;
temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
- if (npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == 11)
dq = 0;
if (dq == 0) {
movindown = 1;
@@ -5844,7 +5844,7 @@ void GriffonEngine::game_updnpcs() {
int sy = yp;
uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
uint32 dq = *temp;
- if (npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == 11)
dq = 0;
if (dq == 0)
movinleft = 1;
@@ -5853,7 +5853,7 @@ void GriffonEngine::game_updnpcs() {
sy = yp - ii;
temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
- if (npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == 11)
dq = 0;
if (dq == 0) {
movinleft = 1;
@@ -5865,7 +5865,7 @@ void GriffonEngine::game_updnpcs() {
sy = yp + ii;
temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
- if (npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == 11)
dq = 0;
if (dq == 0) {
movinleft = 1;
@@ -5879,7 +5879,7 @@ void GriffonEngine::game_updnpcs() {
int sy = yp;
uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
uint32 dq = *temp;
- if (npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == 11)
dq = 0;
if (dq == 0)
movinright = 1;
@@ -5888,7 +5888,7 @@ void GriffonEngine::game_updnpcs() {
sy = yp - ii;
temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
- if (npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == 11)
dq = 0;
if (dq == 0) {
movinright = 1;
@@ -5900,7 +5900,7 @@ void GriffonEngine::game_updnpcs() {
sy = yp + ii;
temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
- if (npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == 11)
dq = 0;
if (dq == 0) {
movinright = 1;
@@ -5920,18 +5920,18 @@ void GriffonEngine::game_updnpcs() {
if (checkpass) {
pass = 0;
- if (npx >= npcinfo[i].x1 * 16 - 8 && npx <= npcinfo[i].x2 * 16 + 8 && npy >= npcinfo[i].y1 * 16 - 8 && npy <= npcinfo[i].y2 * 16 + 8)
+ if (npx >= _npcinfo[i].x1 * 16 - 8 && npx <= _npcinfo[i].x2 * 16 + 8 && npy >= _npcinfo[i].y1 * 16 - 8 && npy <= _npcinfo[i].y2 * 16 + 8)
pass = 1;
if (pass == 0) {
npx = onpx;
npy = onpy;
- npcinfo[i].ticks = _ticks;
+ _npcinfo[i].ticks = _ticks;
}
}
float aspd = wspd;
- if (npcinfo[i].spriteset == 10)
+ if (_npcinfo[i].spriteset == 10)
aspd = wspd / 2;
xp = (npx / 2 + 6);
@@ -5948,14 +5948,14 @@ void GriffonEngine::game_updnpcs() {
int lx = (int)anpx / 16;
int ly = (int)anpy / 16;
- if (triggerloc[lx][ly] > -1)
+ if (_triggerloc[lx][ly] > -1)
bgc = 1;
- if (npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == 11)
bgc = 0;
int rst = 0;
- if (npcinfo[i].spriteset == 11) {
+ if (_npcinfo[i].spriteset == 11) {
if (npx < 40 || npx > 280 || npy < 36 || npy > 204)
rst = 1;
}
@@ -5965,18 +5965,18 @@ void GriffonEngine::game_updnpcs() {
npy = onpy;
}
- npcinfo[i].x = npx;
- npcinfo[i].y = npy;
+ _npcinfo[i].x = npx;
+ _npcinfo[i].y = npy;
- npcinfo[i].walkdir = wdir;
- npcinfo[i].moving = 0;
+ _npcinfo[i].walkdir = wdir;
+ _npcinfo[i].moving = 0;
if (npx != onpx || npy != onpy)
- npcinfo[i].moving = 1;
+ _npcinfo[i].moving = 1;
- if (npcinfo[i].moving == 1) {
- float frame = npcinfo[i].frame;
- int cframe = npcinfo[i].cframe;
+ if (_npcinfo[i].moving == 1) {
+ float frame = _npcinfo[i].frame;
+ int cframe = _npcinfo[i].cframe;
frame = frame + aspd * _fpsr;
while (frame >= 16)
@@ -5988,29 +5988,29 @@ void GriffonEngine::game_updnpcs() {
if (cframe < 0)
cframe = 0;
- npcinfo[i].frame = frame;
- npcinfo[i].cframe = cframe;
+ _npcinfo[i].frame = frame;
+ _npcinfo[i].cframe = cframe;
}
// spriteset1 specific
- if (npcinfo[i].spriteset == 1 && npcinfo[i].attackattempt < _ticks) {
- if (npcinfo[i].attacknext < _ticks && npcinfo[i].pause < _ticks && npcinfo[i].attacking == 0) {
- npx = npcinfo[i].x;
- npy = npcinfo[i].y;
+ if (_npcinfo[i].spriteset == 1 && _npcinfo[i].attackattempt < _ticks) {
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
+ npx = _npcinfo[i].x;
+ npy = _npcinfo[i].y;
xdif = _player.px - npx;
ydif = _player.py - npy;
if (abs(xdif) < 20 && abs(ydif) < 20) {
- npcinfo[i].attackattempt = _ticks + 100;
+ _npcinfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndenemyhit]);
Mix_Volume(snd, config.effectsvol);
}
- npcinfo[i].attacking = 1;
- npcinfo[i].attackframe = 0;
+ _npcinfo[i].attacking = 1;
+ _npcinfo[i].attackframe = 0;
}
}
}
@@ -6019,10 +6019,10 @@ void GriffonEngine::game_updnpcs() {
bool dospell = false;
// onewing specific
- if (npcinfo[i].spriteset == 2) {
- if (npcinfo[i].attacknext < _ticks && npcinfo[i].pause < _ticks && npcinfo[i].attacking == 0) {
- npx = npcinfo[i].x;
- npy = npcinfo[i].y;
+ if (_npcinfo[i].spriteset == 2) {
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
+ npx = _npcinfo[i].x;
+ npy = _npcinfo[i].y;
xdif = _player.px - npx;
ydif = _player.py - npy;
@@ -6036,11 +6036,11 @@ void GriffonEngine::game_updnpcs() {
Mix_Volume(snd, config.effectsvol);
}
- npcinfo[i].attacking = 1;
- npcinfo[i].attackframe = 0;
+ _npcinfo[i].attacking = 1;
+ _npcinfo[i].attackframe = 0;
- npcinfo[i].headtargetx[0] = _player.px + 12;
- npcinfo[i].headtargety[0] = _player.py - 4;
+ _npcinfo[i].headtargetx[0] = _player.px + 12;
+ _npcinfo[i].headtargety[0] = _player.py - 4;
}
}
@@ -6048,87 +6048,87 @@ void GriffonEngine::game_updnpcs() {
dospell = false;
- if (npcinfo[i].attacking == 0 && npcinfo[i].castpause < _ticks) {
- npcinfo[i].swayspd = npcinfo[i].swayspd + npcinfo[i].swayspd / 200 * _fpsr;
- if (npcinfo[i].swayspd > 15) {
+ if (_npcinfo[i].attacking == 0 && _npcinfo[i].castpause < _ticks) {
+ _npcinfo[i].swayspd = _npcinfo[i].swayspd + _npcinfo[i].swayspd / 200 * _fpsr;
+ if (_npcinfo[i].swayspd > 15) {
dospell = true;
- npcinfo[i].swayspd = 1;
+ _npcinfo[i].swayspd = 1;
}
// sway code
- npcinfo[i].swayangle = npcinfo[i].swayangle + npcinfo[i].swayspd * _fpsr;
- if (npcinfo[i].swayangle >= 360)
- npcinfo[i].swayangle = npcinfo[i].swayangle - 360;
+ _npcinfo[i].swayangle = _npcinfo[i].swayangle + _npcinfo[i].swayspd * _fpsr;
+ if (_npcinfo[i].swayangle >= 360)
+ _npcinfo[i].swayangle = _npcinfo[i].swayangle - 360;
- npcinfo[i].headtargetx[0] = npcinfo[i].x + (24 - npcinfo[i].swayspd / 2) * sin(3.14159 / 180 * npcinfo[i].swayangle) + 12;
- npcinfo[i].headtargety[0] = npcinfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * npcinfo[i].swayangle);
+ _npcinfo[i].headtargetx[0] = _npcinfo[i].x + (24 - _npcinfo[i].swayspd / 2) * sin(3.14159 / 180 * _npcinfo[i].swayangle) + 12;
+ _npcinfo[i].headtargety[0] = _npcinfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * _npcinfo[i].swayangle);
}
if (dospell) {
- npcinfo[i].pause = _ticks + 3000;
- npcinfo[i].attacknext = _ticks + 4500;
- npcinfo[i].castpause = _ticks + 4500;
+ _npcinfo[i].pause = _ticks + 3000;
+ _npcinfo[i].attacknext = _ticks + 4500;
+ _npcinfo[i].castpause = _ticks + 4500;
- game_castspell(3, npcinfo[i].x, npcinfo[i].y, npcinfo[i].x, npcinfo[i].y, i);
+ game_castspell(3, _npcinfo[i].x, _npcinfo[i].y, _npcinfo[i].x, _npcinfo[i].y, i);
- npcinfo[i].headtargetx[0] = npcinfo[i].x;
- npcinfo[i].headtargety[0] = npcinfo[i].y - 36 + 16;
+ _npcinfo[i].headtargetx[0] = _npcinfo[i].x;
+ _npcinfo[i].headtargety[0] = _npcinfo[i].y - 36 + 16;
}
// targethead code
- xdif = npcinfo[i].bodysection[7].x - npcinfo[i].headtargetx[0];
- ydif = npcinfo[i].bodysection[7].y - npcinfo[i].headtargety[0];
+ xdif = _npcinfo[i].bodysection[7].x - _npcinfo[i].headtargetx[0];
+ ydif = _npcinfo[i].bodysection[7].y - _npcinfo[i].headtargety[0];
- npcinfo[i].bodysection[7].x = npcinfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
- npcinfo[i].bodysection[7].y = npcinfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
+ _npcinfo[i].bodysection[7].x = _npcinfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
+ _npcinfo[i].bodysection[7].y = _npcinfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
- npcinfo[i].bodysection[0].x = npcinfo[i].x + 12;
- npcinfo[i].bodysection[0].y = npcinfo[i].y + 12;
+ _npcinfo[i].bodysection[0].x = _npcinfo[i].x + 12;
+ _npcinfo[i].bodysection[0].y = _npcinfo[i].y + 12;
for (int f = 6; f >= 1; f--) {
- xdif = npcinfo[i].bodysection[f + 1].x - npcinfo[i].bodysection[f - 1].x;
- ydif = npcinfo[i].bodysection[f + 1].y - npcinfo[i].bodysection[f - 1].y;
+ xdif = _npcinfo[i].bodysection[f + 1].x - _npcinfo[i].bodysection[f - 1].x;
+ ydif = _npcinfo[i].bodysection[f + 1].y - _npcinfo[i].bodysection[f - 1].y;
- float tx = npcinfo[i].bodysection[f - 1].x + xdif / 2;
- float ty = npcinfo[i].bodysection[f - 1].y + ydif / 2;
+ float tx = _npcinfo[i].bodysection[f - 1].x + xdif / 2;
+ float ty = _npcinfo[i].bodysection[f - 1].y + ydif / 2;
- npcinfo[i].bodysection[f].x = npcinfo[i].bodysection[f].x - (npcinfo[i].bodysection[f].x - tx) / 3;
- npcinfo[i].bodysection[f].y = npcinfo[i].bodysection[f].y - (npcinfo[i].bodysection[f].y - ty) / 3;
+ _npcinfo[i].bodysection[f].x = _npcinfo[i].bodysection[f].x - (_npcinfo[i].bodysection[f].x - tx) / 3;
+ _npcinfo[i].bodysection[f].y = _npcinfo[i].bodysection[f].y - (_npcinfo[i].bodysection[f].y - ty) / 3;
}
}
// boss1 specific and blackknight
- if (npcinfo[i].spriteset == 3 || npcinfo[i].spriteset == 4) {
- if (npcinfo[i].attacknext < _ticks && npcinfo[i].pause < _ticks && npcinfo[i].attacking == 0) {
- npcinfo[i].attacking = 1;
- npcinfo[i].attackframe = 0;
+ if (_npcinfo[i].spriteset == 3 || _npcinfo[i].spriteset == 4) {
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
+ _npcinfo[i].attacking = 1;
+ _npcinfo[i].attackframe = 0;
- game_castspell(1, npcinfo[i].x, npcinfo[i].y, _player.px, _player.py, i);
+ game_castspell(1, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i);
}
- if (npcinfo[i].castpause < _ticks) {
- game_castspell(6, npcinfo[i].x, npcinfo[i].y, _player.px, _player.py, i);
- npcinfo[i].castpause = _ticks + 12000;
+ if (_npcinfo[i].castpause < _ticks) {
+ game_castspell(6, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i);
+ _npcinfo[i].castpause = _ticks + 12000;
}
}
// firehydra specific
- if (npcinfo[i].spriteset == 5) {
- npcinfo[i].swayspd = 4;
+ if (_npcinfo[i].spriteset == 5) {
+ _npcinfo[i].swayspd = 4;
// sway code
- npcinfo[i].swayangle = npcinfo[i].swayangle + npcinfo[i].swayspd * _fpsr;
- if (npcinfo[i].swayangle >= 360)
- npcinfo[i].swayangle = npcinfo[i].swayangle - 360;
+ _npcinfo[i].swayangle = _npcinfo[i].swayangle + _npcinfo[i].swayspd * _fpsr;
+ if (_npcinfo[i].swayangle >= 360)
+ _npcinfo[i].swayangle = _npcinfo[i].swayangle - 360;
for (int ff = 0; ff <= 2; ff++) {
- if (npcinfo[i].hp > 10 * ff * 20) {
- if (npcinfo[i].pause < _ticks && npcinfo[i].attacking2[ff] == 0 && npcinfo[i].attacknext2[ff] < _ticks) {
- npx = npcinfo[i].x;
- npy = npcinfo[i].y;
+ if (_npcinfo[i].hp > 10 * ff * 20) {
+ if (_npcinfo[i].pause < _ticks && _npcinfo[i].attacking2[ff] == 0 && _npcinfo[i].attacknext2[ff] < _ticks) {
+ npx = _npcinfo[i].x;
+ npy = _npcinfo[i].y;
xdif = _player.px - npx;
ydif = _player.py - npy;
@@ -6142,53 +6142,53 @@ void GriffonEngine::game_updnpcs() {
Mix_Volume(snd, config.effectsvol);
}
- npcinfo[i].attacking = 1;
- npcinfo[i].attacking2[ff] = 1;
- npcinfo[i].attackframe2[ff] = 0;
+ _npcinfo[i].attacking = 1;
+ _npcinfo[i].attacking2[ff] = 1;
+ _npcinfo[i].attackframe2[ff] = 0;
- npcinfo[i].headtargetx[ff] = _player.px + 12;
- npcinfo[i].headtargety[ff] = _player.py - 4;
+ _npcinfo[i].headtargetx[ff] = _player.px + 12;
+ _npcinfo[i].headtargety[ff] = _player.py - 4;
- npcinfo[i].swayangle = 0;
+ _npcinfo[i].swayangle = 0;
}
}
}
- if (npcinfo[i].attacking2[ff] == 0) {
- npcinfo[i].headtargetx[ff] = npcinfo[i].x + 38 * sin(3.14159 / 180 * (npcinfo[i].swayangle + 120 * ff)) + 12;
- npcinfo[i].headtargety[ff] = npcinfo[i].y - 46 + 16 + 16 * sin(3.14159 * 2 / 180 * (npcinfo[i].swayangle + 120 * ff));
+ if (_npcinfo[i].attacking2[ff] == 0) {
+ _npcinfo[i].headtargetx[ff] = _npcinfo[i].x + 38 * sin(3.14159 / 180 * (_npcinfo[i].swayangle + 120 * ff)) + 12;
+ _npcinfo[i].headtargety[ff] = _npcinfo[i].y - 46 + 16 + 16 * sin(3.14159 * 2 / 180 * (_npcinfo[i].swayangle + 120 * ff));
}
// targethead code
- xdif = npcinfo[i].bodysection[10 * ff + 9].x - npcinfo[i].headtargetx[ff];
- ydif = npcinfo[i].bodysection[10 * ff + 9].y - npcinfo[i].headtargety[ff];
+ xdif = _npcinfo[i].bodysection[10 * ff + 9].x - _npcinfo[i].headtargetx[ff];
+ ydif = _npcinfo[i].bodysection[10 * ff + 9].y - _npcinfo[i].headtargety[ff];
- npcinfo[i].bodysection[10 * ff + 9].x = npcinfo[i].bodysection[10 * ff + 9].x - xdif * 0.4 * _fpsr;
- npcinfo[i].bodysection[10 * ff + 9].y = npcinfo[i].bodysection[10 * ff + 9].y - ydif * 0.4 * _fpsr;
+ _npcinfo[i].bodysection[10 * ff + 9].x = _npcinfo[i].bodysection[10 * ff + 9].x - xdif * 0.4 * _fpsr;
+ _npcinfo[i].bodysection[10 * ff + 9].y = _npcinfo[i].bodysection[10 * ff + 9].y - ydif * 0.4 * _fpsr;
- npcinfo[i].bodysection[10 * ff].x = npcinfo[i].x + 12 + 8 * cos(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
- npcinfo[i].bodysection[10 * ff].y = npcinfo[i].y + 12 + 8 * sin(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
+ _npcinfo[i].bodysection[10 * ff].x = _npcinfo[i].x + 12 + 8 * cos(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
+ _npcinfo[i].bodysection[10 * ff].y = _npcinfo[i].y + 12 + 8 * sin(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
for (int f = 8; f >= 1; f--) {
- xdif = npcinfo[i].bodysection[ff * 10 + f + 1].x - npcinfo[i].bodysection[ff * 10 + f - 1].x;
- ydif = npcinfo[i].bodysection[ff * 10 + f + 1].y - npcinfo[i].bodysection[ff * 10 + f - 1].y;
+ xdif = _npcinfo[i].bodysection[ff * 10 + f + 1].x - _npcinfo[i].bodysection[ff * 10 + f - 1].x;
+ ydif = _npcinfo[i].bodysection[ff * 10 + f + 1].y - _npcinfo[i].bodysection[ff * 10 + f - 1].y;
- float tx = npcinfo[i].bodysection[ff * 10 + f - 1].x + xdif / 2;
- float ty = npcinfo[i].bodysection[ff * 10 + f - 1].y + ydif / 2;
+ float tx = _npcinfo[i].bodysection[ff * 10 + f - 1].x + xdif / 2;
+ float ty = _npcinfo[i].bodysection[ff * 10 + f - 1].y + ydif / 2;
- npcinfo[i].bodysection[ff * 10 + f].x = npcinfo[i].bodysection[ff * 10 + f].x - (npcinfo[i].bodysection[ff * 10 + f].x - tx) / 3;
- npcinfo[i].bodysection[ff * 10 + f].y = npcinfo[i].bodysection[ff * 10 + f].y - (npcinfo[i].bodysection[ff * 10 + f].y - ty) / 3;
+ _npcinfo[i].bodysection[ff * 10 + f].x = _npcinfo[i].bodysection[ff * 10 + f].x - (_npcinfo[i].bodysection[ff * 10 + f].x - tx) / 3;
+ _npcinfo[i].bodysection[ff * 10 + f].y = _npcinfo[i].bodysection[ff * 10 + f].y - (_npcinfo[i].bodysection[ff * 10 + f].y - ty) / 3;
}
}
}
}
// spriteset6 specific
- if (npcinfo[i].spriteset == 6 && npcinfo[i].attackattempt < _ticks) {
- if (npcinfo[i].attacknext < _ticks && npcinfo[i].pause < _ticks && npcinfo[i].attacking == 0) {
- npx = npcinfo[i].x;
- npy = npcinfo[i].y;
+ if (_npcinfo[i].spriteset == 6 && _npcinfo[i].attackattempt < _ticks) {
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
+ npx = _npcinfo[i].x;
+ npy = _npcinfo[i].y;
xdif = _player.px - npx;
ydif = _player.py - npy;
@@ -6200,10 +6200,10 @@ void GriffonEngine::game_updnpcs() {
pass = 2;
if (pass > 0) {
- npcinfo[i].attackattempt = _ticks + 100;
+ _npcinfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
- npcinfo[i].attacking = 1;
- npcinfo[i].attackframe = 0;
+ _npcinfo[i].attacking = 1;
+ _npcinfo[i].attackframe = 0;
float nnxa = 0, nnya = 0, nnxb = 0, nnyb = 0;
if (pass == 1 && xdif < 0) {
@@ -6235,26 +6235,26 @@ void GriffonEngine::game_updnpcs() {
}
// wizard1 specific
- if (npcinfo[i].spriteset == 7) {
- if (npcinfo[i].attacknext < _ticks && npcinfo[i].pause < _ticks && npcinfo[i].attacking == 0) {
- npcinfo[i].attacking = 1;
- npcinfo[i].attackframe = 0;
+ if (_npcinfo[i].spriteset == 7) {
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
+ _npcinfo[i].attacking = 1;
+ _npcinfo[i].attackframe = 0;
- game_castspell(9, npcinfo[i].x, npcinfo[i].y, _player.px, _player.py, i);
+ game_castspell(9, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i);
}
- if (npcinfo[i].castpause < _ticks) {
- // game_castspell 6, npcinfo[i].x, npcinfo[i].y, _player.px, _player.py, i
- // npcinfo[i].castpause = _ticks + 12000
+ if (_npcinfo[i].castpause < _ticks) {
+ // game_castspell 6, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i
+ // _npcinfo[i].castpause = _ticks + 12000
}
}
// spriteset6 specific
- if (npcinfo[i].spriteset == 8 && npcinfo[i].attackattempt < _ticks) {
- if (npcinfo[i].attacknext < _ticks && npcinfo[i].pause < _ticks && npcinfo[i].attacking == 0) {
- npx = npcinfo[i].x;
- npy = npcinfo[i].y;
+ if (_npcinfo[i].spriteset == 8 && _npcinfo[i].attackattempt < _ticks) {
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
+ npx = _npcinfo[i].x;
+ npy = _npcinfo[i].y;
xdif = _player.px - npx;
ydif = _player.py - npy;
@@ -6266,10 +6266,10 @@ void GriffonEngine::game_updnpcs() {
pass = 2;
if (pass > 0) {
- npcinfo[i].attackattempt = _ticks + 100;
+ _npcinfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
- npcinfo[i].attacking = 1;
- npcinfo[i].attackframe = 0;
+ _npcinfo[i].attacking = 1;
+ _npcinfo[i].attackframe = 0;
float nnxa = 0, nnya = 0, nnxb = 0, nnyb = 0;
if (pass == 1 && xdif < 0) {
@@ -6277,25 +6277,25 @@ void GriffonEngine::game_updnpcs() {
nnya = npy + 4;
nnxb = npx - 56 - 8;
nnyb = npy + 4;
- npcinfo[i].walkdir = 2;
+ _npcinfo[i].walkdir = 2;
} else if (pass == 1 && xdif > 0) {
nnxa = npx + 16;
nnya = npy + 4;
nnxb = npx + 16 + 56;
nnyb = npy + 4;
- npcinfo[i].walkdir = 3;
+ _npcinfo[i].walkdir = 3;
} else if (pass == 2 && ydif < 0) {
nnya = npy;
nnxa = npx + 4;
nnyb = npy - 56;
nnxb = npx + 4;
- npcinfo[i].walkdir = 0;
+ _npcinfo[i].walkdir = 0;
} else if (pass == 2 && ydif > 0) {
nnya = npy + 20;
nnxa = npx + 4;
nnyb = npy + 20 + 56;
nnxb = npx + 4;
- npcinfo[i].walkdir = 1;
+ _npcinfo[i].walkdir = 1;
}
game_castspell(7, nnxa, nnya, nnxb, nnyb, i);
@@ -6305,10 +6305,10 @@ void GriffonEngine::game_updnpcs() {
}
// twowing specific
- if (npcinfo[i].spriteset == 9) {
- if (npcinfo[i].attacknext < _ticks && npcinfo[i].pause < _ticks && npcinfo[i].attacking == 0) {
- npx = npcinfo[i].bodysection[7].x;
- npy = npcinfo[i].bodysection[7].y;
+ if (_npcinfo[i].spriteset == 9) {
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
+ npx = _npcinfo[i].bodysection[7].x;
+ npy = _npcinfo[i].bodysection[7].y;
xdif = _player.px - npx;
ydif = _player.py - npy;
@@ -6322,82 +6322,82 @@ void GriffonEngine::game_updnpcs() {
Mix_Volume(snd, config.effectsvol);
}
- npcinfo[i].attacking = 1;
- npcinfo[i].attackframe = 0;
+ _npcinfo[i].attacking = 1;
+ _npcinfo[i].attackframe = 0;
- npcinfo[i].headtargetx[0] = _player.px + 12;
- npcinfo[i].headtargety[0] = _player.py - 4;
+ _npcinfo[i].headtargetx[0] = _player.px + 12;
+ _npcinfo[i].headtargety[0] = _player.py - 4;
}
}
}
- if (npcinfo[i].attacking == 0 && npcinfo[i].castpause < _ticks) {
- npcinfo[i].swayspd = 4;
+ if (_npcinfo[i].attacking == 0 && _npcinfo[i].castpause < _ticks) {
+ _npcinfo[i].swayspd = 4;
// sway code
- npcinfo[i].swayangle = npcinfo[i].swayangle + npcinfo[i].swayspd * _fpsr;
- if (npcinfo[i].swayangle >= 360)
- npcinfo[i].swayangle = npcinfo[i].swayangle - 360;
+ _npcinfo[i].swayangle = _npcinfo[i].swayangle + _npcinfo[i].swayspd * _fpsr;
+ if (_npcinfo[i].swayangle >= 360)
+ _npcinfo[i].swayangle = _npcinfo[i].swayangle - 360;
- npcinfo[i].headtargetx[0] = npcinfo[i].x + (24 - npcinfo[i].swayspd / 2) * sin(3.14159 / 180 * npcinfo[i].swayangle) + 12;
- npcinfo[i].headtargety[0] = npcinfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * npcinfo[i].swayangle);
+ _npcinfo[i].headtargetx[0] = _npcinfo[i].x + (24 - _npcinfo[i].swayspd / 2) * sin(3.14159 / 180 * _npcinfo[i].swayangle) + 12;
+ _npcinfo[i].headtargety[0] = _npcinfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * _npcinfo[i].swayangle);
}
if (dospell) {
- npcinfo[i].pause = _ticks + 3000;
- npcinfo[i].attacknext = _ticks + 5000;
- npcinfo[i].castpause = _ticks + 3000;
+ _npcinfo[i].pause = _ticks + 3000;
+ _npcinfo[i].attacknext = _ticks + 5000;
+ _npcinfo[i].castpause = _ticks + 3000;
- game_castspell(3, npcinfo[i].x, npcinfo[i].y, npcinfo[i].x, npcinfo[i].y, i);
+ game_castspell(3, _npcinfo[i].x, _npcinfo[i].y, _npcinfo[i].x, _npcinfo[i].y, i);
- npcinfo[i].headtargetx[0] = npcinfo[i].x;
- npcinfo[i].headtargety[0] = npcinfo[i].y - 36 + 16;
+ _npcinfo[i].headtargetx[0] = _npcinfo[i].x;
+ _npcinfo[i].headtargety[0] = _npcinfo[i].y - 36 + 16;
}
// targethead code
- xdif = npcinfo[i].bodysection[7].x - npcinfo[i].headtargetx[0];
- ydif = npcinfo[i].bodysection[7].y - npcinfo[i].headtargety[0];
+ xdif = _npcinfo[i].bodysection[7].x - _npcinfo[i].headtargetx[0];
+ ydif = _npcinfo[i].bodysection[7].y - _npcinfo[i].headtargety[0];
- npcinfo[i].bodysection[7].x = npcinfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
- npcinfo[i].bodysection[7].y = npcinfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
+ _npcinfo[i].bodysection[7].x = _npcinfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
+ _npcinfo[i].bodysection[7].y = _npcinfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
- npcinfo[i].bodysection[0].x = npcinfo[i].x + 12;
- npcinfo[i].bodysection[0].y = npcinfo[i].y + 12;
+ _npcinfo[i].bodysection[0].x = _npcinfo[i].x + 12;
+ _npcinfo[i].bodysection[0].y = _npcinfo[i].y + 12;
for (int f = 6; f >= 1; f--) {
- xdif = npcinfo[i].bodysection[f + 1].x - npcinfo[i].bodysection[f - 1].x;
- ydif = npcinfo[i].bodysection[f + 1].y - npcinfo[i].bodysection[f - 1].y;
+ xdif = _npcinfo[i].bodysection[f + 1].x - _npcinfo[i].bodysection[f - 1].x;
+ ydif = _npcinfo[i].bodysection[f + 1].y - _npcinfo[i].bodysection[f - 1].y;
- float tx = npcinfo[i].bodysection[f - 1].x + xdif / 2;
- float ty = npcinfo[i].bodysection[f - 1].y + ydif / 2;
+ float tx = _npcinfo[i].bodysection[f - 1].x + xdif / 2;
+ float ty = _npcinfo[i].bodysection[f - 1].y + ydif / 2;
- npcinfo[i].bodysection[f].x = npcinfo[i].bodysection[f].x - (npcinfo[i].bodysection[f].x - tx) / 3;
- npcinfo[i].bodysection[f].y = npcinfo[i].bodysection[f].y - (npcinfo[i].bodysection[f].y - ty) / 3;
+ _npcinfo[i].bodysection[f].x = _npcinfo[i].bodysection[f].x - (_npcinfo[i].bodysection[f].x - tx) / 3;
+ _npcinfo[i].bodysection[f].y = _npcinfo[i].bodysection[f].y - (_npcinfo[i].bodysection[f].y - ty) / 3;
}
}
// dragon2 specific
- if (npcinfo[i].spriteset == 10 && npcinfo[i].attackattempt < _ticks) {
- if (npcinfo[i].attacknext < _ticks && npcinfo[i].pause < _ticks && npcinfo[i].attacking == 0) {
- npx = npcinfo[i].x;
- npy = npcinfo[i].y;
+ if (_npcinfo[i].spriteset == 10 && _npcinfo[i].attackattempt < _ticks) {
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
+ npx = _npcinfo[i].x;
+ npy = _npcinfo[i].y;
xdif = _player.px - npx;
ydif = _player.py - npy;
if (abs(xdif) < 32 && abs(ydif) < 32) {
- npcinfo[i].attackattempt = _ticks + 100;
+ _npcinfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndenemyhit]);
Mix_Volume(snd, config.effectsvol);
}
- npcinfo[i].attacking = 1;
- npcinfo[i].attackframe = 0;
+ _npcinfo[i].attacking = 1;
+ _npcinfo[i].attackframe = 0;
}
}
}
@@ -6405,23 +6405,23 @@ void GriffonEngine::game_updnpcs() {
// endboss specific
- if (npcinfo[i].spriteset == 11 && npcinfo[i].attackattempt < _ticks) {
- if (npcinfo[i].attacknext < _ticks && npcinfo[i].pause < _ticks && npcinfo[i].attacking == 0) {
- npx = npcinfo[i].x;
- npy = npcinfo[i].y;
+ if (_npcinfo[i].spriteset == 11 && _npcinfo[i].attackattempt < _ticks) {
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
+ npx = _npcinfo[i].x;
+ npy = _npcinfo[i].y;
xdif = _player.px - npx;
ydif = _player.py - npy;
if (abs(xdif) < 38 && abs(ydif) < 38) {
- npcinfo[i].attackattempt = _ticks + 100;
+ _npcinfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndice]);
Mix_Volume(snd, config.effectsvol);
}
- npcinfo[i].attacking = 1;
- npcinfo[i].attackframe = 0;
+ _npcinfo[i].attacking = 1;
+ _npcinfo[i].attackframe = 0;
}
}
}
@@ -6429,8 +6429,8 @@ void GriffonEngine::game_updnpcs() {
}
- float npx = npcinfo[i].x;
- float npy = npcinfo[i].y;
+ float npx = _npcinfo[i].x;
+ float npy = _npcinfo[i].y;
int xp = (npx / 2 + 6);
int yp = (npy / 2 + 10);
@@ -6440,19 +6440,19 @@ void GriffonEngine::game_updnpcs() {
rcSrc.setWidth(3);
rcSrc.setHeight(3);
- if (npcinfo[i].pause < _ticks)
+ if (_npcinfo[i].pause < _ticks)
_clipbg->fillRect(rcSrc, i);
pass = 0;
- if (npcinfo[i].attacking == 1)
+ if (_npcinfo[i].attacking == 1)
pass = 1;
- if (npcinfo[i].spriteset == 5) {
- if (npcinfo[i].attacking2[0] == 1)
+ if (_npcinfo[i].spriteset == 5) {
+ if (_npcinfo[i].attacking2[0] == 1)
pass = 1;
- if (npcinfo[i].attacking2[1] == 1)
+ if (_npcinfo[i].attacking2[1] == 1)
pass = 1;
- if (npcinfo[i].attacking2[2] == 1)
+ if (_npcinfo[i].attacking2[2] == 1)
pass = 1;
}
@@ -6460,18 +6460,18 @@ void GriffonEngine::game_updnpcs() {
int dist;
float damage;
// spriteset1 specific
- if (npcinfo[i].spriteset == 1) {
- npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * _fpsr;
- if (npcinfo[i].attackframe >= 16) {
- npcinfo[i].attackframe = 0;
- npcinfo[i].attacking = 0;
- npcinfo[i].attacknext = _ticks + npcinfo[i].attackdelay;
+ if (_npcinfo[i].spriteset == 1) {
+ _npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
+ if (_npcinfo[i].attackframe >= 16) {
+ _npcinfo[i].attackframe = 0;
+ _npcinfo[i].attacking = 0;
+ _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
}
- npcinfo[i].cattackframe = (int)(npcinfo[i].attackframe);
+ _npcinfo[i].cattackframe = (int)(_npcinfo[i].attackframe);
- npx = npcinfo[i].x;
- npy = npcinfo[i].y;
+ npx = _npcinfo[i].x;
+ npy = _npcinfo[i].y;
float xdif = _player.px - npx;
float ydif = _player.py - npy;
@@ -6479,50 +6479,50 @@ void GriffonEngine::game_updnpcs() {
dist = 10;
if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
- npcinfo[i].attacknext = _ticks + npcinfo[i].attackdelay;
- // npcinfo[i].attackframe = 0;
- // npcinfo[i].attacking = 0;
+ _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
+ // _npcinfo[i].attackframe = 0;
+ // _npcinfo[i].attacking = 0;
- damage = (float)npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
+ damage = (float)_npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
if (_player.hp > 0)
game_damageplayer(damage);
}
}
- if (npcinfo[i].spriteset == 2) {
+ if (_npcinfo[i].spriteset == 2) {
// targethead code
- float xdif = npcinfo[i].bodysection[7].x - npcinfo[i].headtargetx[0];
- float ydif = npcinfo[i].bodysection[7].y - npcinfo[i].headtargety[0];
+ float xdif = _npcinfo[i].bodysection[7].x - _npcinfo[i].headtargetx[0];
+ float ydif = _npcinfo[i].bodysection[7].y - _npcinfo[i].headtargety[0];
- npcinfo[i].bodysection[7].x = npcinfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
- npcinfo[i].bodysection[7].y = npcinfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
+ _npcinfo[i].bodysection[7].x = _npcinfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
+ _npcinfo[i].bodysection[7].y = _npcinfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
- npcinfo[i].bodysection[0].x = npcinfo[i].x + 12;
- npcinfo[i].bodysection[0].y = npcinfo[i].y + 12;
+ _npcinfo[i].bodysection[0].x = _npcinfo[i].x + 12;
+ _npcinfo[i].bodysection[0].y = _npcinfo[i].y + 12;
for (int f = 6; f >= 1; f--) {
- xdif = npcinfo[i].bodysection[f + 1].x - npcinfo[i].bodysection[f - 1].x;
- ydif = npcinfo[i].bodysection[f + 1].y - npcinfo[i].bodysection[f - 1].y;
+ xdif = _npcinfo[i].bodysection[f + 1].x - _npcinfo[i].bodysection[f - 1].x;
+ ydif = _npcinfo[i].bodysection[f + 1].y - _npcinfo[i].bodysection[f - 1].y;
- float tx = npcinfo[i].bodysection[f - 1].x + xdif / 2;
- float ty = npcinfo[i].bodysection[f - 1].y + ydif / 2;
+ float tx = _npcinfo[i].bodysection[f - 1].x + xdif / 2;
+ float ty = _npcinfo[i].bodysection[f - 1].y + ydif / 2;
- npcinfo[i].bodysection[f].x = npcinfo[i].bodysection[f].x - (npcinfo[i].bodysection[f].x - tx);
- npcinfo[i].bodysection[f].y = npcinfo[i].bodysection[f].y - (npcinfo[i].bodysection[f].y - ty);
+ _npcinfo[i].bodysection[f].x = _npcinfo[i].bodysection[f].x - (_npcinfo[i].bodysection[f].x - tx);
+ _npcinfo[i].bodysection[f].y = _npcinfo[i].bodysection[f].y - (_npcinfo[i].bodysection[f].y - ty);
}
- npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * _fpsr;
- if (npcinfo[i].attackframe >= 16) {
- npcinfo[i].attackframe = 0;
- npcinfo[i].attacking = 0;
- npcinfo[i].attacknext = _ticks + npcinfo[i].attackdelay;
+ _npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
+ if (_npcinfo[i].attackframe >= 16) {
+ _npcinfo[i].attackframe = 0;
+ _npcinfo[i].attacking = 0;
+ _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
}
- npcinfo[i].cattackframe = (int)(npcinfo[i].attackframe);
+ _npcinfo[i].cattackframe = (int)(_npcinfo[i].attackframe);
- npx = npcinfo[i].bodysection[7].x;
- npy = (npcinfo[i].bodysection[7].y + 16);
+ npx = _npcinfo[i].bodysection[7].x;
+ npy = (_npcinfo[i].bodysection[7].y + 16);
xdif = (_player.px + 12) - npx;
ydif = (_player.py + 12) - npy;
@@ -6530,10 +6530,10 @@ void GriffonEngine::game_updnpcs() {
dist = 8;
if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
- npcinfo[i].attacknext = _ticks + npcinfo[i].attackdelay;
- // npcinfo[i].attackframe = 0
- // npcinfo[i].attacking = 0
- damage = (float)npcinfo[i].attackdamage * (1.0 + (RND() * 0.5));
+ _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
+ // _npcinfo[i].attackframe = 0
+ // _npcinfo[i].attacking = 0
+ damage = (float)_npcinfo[i].attackdamage * (1.0 + (RND() * 0.5));
if (_player.hp > 0)
game_damageplayer(damage);
}
@@ -6541,40 +6541,40 @@ void GriffonEngine::game_updnpcs() {
// firehydra
- if (npcinfo[i].spriteset == 5) {
+ if (_npcinfo[i].spriteset == 5) {
for (int ff = 0; ff <= 2; ff++) {
- if (npcinfo[i].attacking2[ff] == 1) {
- float xdif = npcinfo[i].bodysection[10 * ff + 9].x - npcinfo[i].headtargetx[ff];
- float ydif = npcinfo[i].bodysection[10 * ff + 9].y - npcinfo[i].headtargety[ff];
+ if (_npcinfo[i].attacking2[ff] == 1) {
+ float xdif = _npcinfo[i].bodysection[10 * ff + 9].x - _npcinfo[i].headtargetx[ff];
+ float ydif = _npcinfo[i].bodysection[10 * ff + 9].y - _npcinfo[i].headtargety[ff];
- npcinfo[i].bodysection[10 * ff + 9].x = npcinfo[i].bodysection[10 * ff + 9].x - xdif * .2 * _fpsr;
- npcinfo[i].bodysection[10 * ff + 9].y = npcinfo[i].bodysection[10 * ff + 9].y - ydif * .2 * _fpsr;
+ _npcinfo[i].bodysection[10 * ff + 9].x = _npcinfo[i].bodysection[10 * ff + 9].x - xdif * .2 * _fpsr;
+ _npcinfo[i].bodysection[10 * ff + 9].y = _npcinfo[i].bodysection[10 * ff + 9].y - ydif * .2 * _fpsr;
- npcinfo[i].bodysection[10 * ff].x = npcinfo[i].x + 12 + 8 * cos(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
- npcinfo[i].bodysection[10 * ff].y = npcinfo[i].y + 12 + 8 * sin(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
+ _npcinfo[i].bodysection[10 * ff].x = _npcinfo[i].x + 12 + 8 * cos(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
+ _npcinfo[i].bodysection[10 * ff].y = _npcinfo[i].y + 12 + 8 * sin(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
for (int f = 8; f >= 1; f--) {
- xdif = npcinfo[i].bodysection[ff * 10 + f + 1].x - npcinfo[i].bodysection[ff * 10 + f - 1].x;
- ydif = npcinfo[i].bodysection[ff * 10 + f + 1].y - npcinfo[i].bodysection[ff * 10 + f - 1].y;
+ xdif = _npcinfo[i].bodysection[ff * 10 + f + 1].x - _npcinfo[i].bodysection[ff * 10 + f - 1].x;
+ ydif = _npcinfo[i].bodysection[ff * 10 + f + 1].y - _npcinfo[i].bodysection[ff * 10 + f - 1].y;
- float tx = npcinfo[i].bodysection[ff * 10 + f - 1].x + xdif / 2;
- float ty = npcinfo[i].bodysection[ff * 10 + f - 1].y + ydif / 2;
+ float tx = _npcinfo[i].bodysection[ff * 10 + f - 1].x + xdif / 2;
+ float ty = _npcinfo[i].bodysection[ff * 10 + f - 1].y + ydif / 2;
- npcinfo[i].bodysection[ff * 10 + f].x = npcinfo[i].bodysection[ff * 10 + f].x - (npcinfo[i].bodysection[ff * 10 + f].x - tx) / 3;
- npcinfo[i].bodysection[ff * 10 + f].y = npcinfo[i].bodysection[ff * 10 + f].y - (npcinfo[i].bodysection[ff * 10 + f].y - ty) / 3;
+ _npcinfo[i].bodysection[ff * 10 + f].x = _npcinfo[i].bodysection[ff * 10 + f].x - (_npcinfo[i].bodysection[ff * 10 + f].x - tx) / 3;
+ _npcinfo[i].bodysection[ff * 10 + f].y = _npcinfo[i].bodysection[ff * 10 + f].y - (_npcinfo[i].bodysection[ff * 10 + f].y - ty) / 3;
}
- npcinfo[i].attackframe2[ff] = npcinfo[i].attackframe2[ff] + npcinfo[i].attackspd * _fpsr;
- if (npcinfo[i].attackframe2[ff] >= 16) {
- npcinfo[i].attackframe2[ff] = 0;
- npcinfo[i].attacking2[ff] = 0;
- npcinfo[i].attacknext2[ff] = _ticks + npcinfo[i].attackdelay;
+ _npcinfo[i].attackframe2[ff] = _npcinfo[i].attackframe2[ff] + _npcinfo[i].attackspd * _fpsr;
+ if (_npcinfo[i].attackframe2[ff] >= 16) {
+ _npcinfo[i].attackframe2[ff] = 0;
+ _npcinfo[i].attacking2[ff] = 0;
+ _npcinfo[i].attacknext2[ff] = _ticks + _npcinfo[i].attackdelay;
}
- npcinfo[i].cattackframe = (int)(npcinfo[i].attackframe);
+ _npcinfo[i].cattackframe = (int)(_npcinfo[i].attackframe);
- npx = npcinfo[i].bodysection[10 * ff + 9].x;
- npy = (npcinfo[i].bodysection[10 * ff + 9].y + 16);
+ npx = _npcinfo[i].bodysection[10 * ff + 9].x;
+ npy = (_npcinfo[i].bodysection[10 * ff + 9].y + 16);
xdif = (_player.px + 12) - npx;
ydif = (_player.py + 12) - npy;
@@ -6582,10 +6582,10 @@ void GriffonEngine::game_updnpcs() {
dist = 8;
if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
- npcinfo[i].attacknext2[ff] = _ticks + npcinfo[i].attackdelay;
- // npcinfo[i].attackframe2(ff) = 0
- // npcinfo[i].attacking2(ff) = 0
- damage = (float)npcinfo[i].attackdamage * (1.0 + RND() * 0.5);
+ _npcinfo[i].attacknext2[ff] = _ticks + _npcinfo[i].attackdelay;
+ // _npcinfo[i].attackframe2(ff) = 0
+ // _npcinfo[i].attacking2(ff) = 0
+ damage = (float)_npcinfo[i].attackdamage * (1.0 + RND() * 0.5);
if (_player.hp > 0)
game_damageplayer(damage);
}
@@ -6595,39 +6595,39 @@ void GriffonEngine::game_updnpcs() {
}
// twowing specific
- if (npcinfo[i].spriteset == 9) {
+ if (_npcinfo[i].spriteset == 9) {
// targethead code
- float xdif = npcinfo[i].bodysection[7].x - npcinfo[i].headtargetx[0];
- float ydif = npcinfo[i].bodysection[7].y - npcinfo[i].headtargety[0];
+ float xdif = _npcinfo[i].bodysection[7].x - _npcinfo[i].headtargetx[0];
+ float ydif = _npcinfo[i].bodysection[7].y - _npcinfo[i].headtargety[0];
- npcinfo[i].bodysection[7].x = npcinfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
- npcinfo[i].bodysection[7].y = npcinfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
+ _npcinfo[i].bodysection[7].x = _npcinfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
+ _npcinfo[i].bodysection[7].y = _npcinfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
- npcinfo[i].bodysection[0].x = npcinfo[i].x + 12;
- npcinfo[i].bodysection[0].y = npcinfo[i].y + 12;
+ _npcinfo[i].bodysection[0].x = _npcinfo[i].x + 12;
+ _npcinfo[i].bodysection[0].y = _npcinfo[i].y + 12;
for (int f = 6; f >= 1; f--) {
- xdif = npcinfo[i].bodysection[f + 1].x - npcinfo[i].bodysection[f - 1].x;
- ydif = npcinfo[i].bodysection[f + 1].y - npcinfo[i].bodysection[f - 1].y;
+ xdif = _npcinfo[i].bodysection[f + 1].x - _npcinfo[i].bodysection[f - 1].x;
+ ydif = _npcinfo[i].bodysection[f + 1].y - _npcinfo[i].bodysection[f - 1].y;
- float tx = npcinfo[i].bodysection[f - 1].x + xdif / 2;
- float ty = npcinfo[i].bodysection[f - 1].y + ydif / 2;
+ float tx = _npcinfo[i].bodysection[f - 1].x + xdif / 2;
+ float ty = _npcinfo[i].bodysection[f - 1].y + ydif / 2;
- npcinfo[i].bodysection[f].x = npcinfo[i].bodysection[f].x - (npcinfo[i].bodysection[f].x - tx);
- npcinfo[i].bodysection[f].y = npcinfo[i].bodysection[f].y - (npcinfo[i].bodysection[f].y - ty);
+ _npcinfo[i].bodysection[f].x = _npcinfo[i].bodysection[f].x - (_npcinfo[i].bodysection[f].x - tx);
+ _npcinfo[i].bodysection[f].y = _npcinfo[i].bodysection[f].y - (_npcinfo[i].bodysection[f].y - ty);
}
- npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * _fpsr;
- if (npcinfo[i].attackframe >= 16) {
- npcinfo[i].attackframe = 0;
- npcinfo[i].attacking = 0;
- npcinfo[i].attacknext = _ticks + npcinfo[i].attackdelay;
+ _npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
+ if (_npcinfo[i].attackframe >= 16) {
+ _npcinfo[i].attackframe = 0;
+ _npcinfo[i].attacking = 0;
+ _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
}
- npcinfo[i].cattackframe = (int)(npcinfo[i].attackframe);
+ _npcinfo[i].cattackframe = (int)(_npcinfo[i].attackframe);
- npx = npcinfo[i].bodysection[7].x;
- npy = (npcinfo[i].bodysection[7].y + 16);
+ npx = _npcinfo[i].bodysection[7].x;
+ npy = (_npcinfo[i].bodysection[7].y + 16);
xdif = (_player.px + 12) - npx;
ydif = (_player.py + 12) - npy;
@@ -6635,58 +6635,58 @@ void GriffonEngine::game_updnpcs() {
dist = 8;
if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
- npcinfo[i].attacknext = _ticks + npcinfo[i].attackdelay;
- // npcinfo[i].attackframe = 0
- // npcinfo[i].attacking = 0
- damage = (float)npcinfo[i].attackdamage * (1.0 + RND() * 0.5);
+ _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
+ // _npcinfo[i].attackframe = 0
+ // _npcinfo[i].attacking = 0
+ damage = (float)_npcinfo[i].attackdamage * (1.0 + RND() * 0.5);
if (_player.hp > 0)
game_damageplayer(damage);
}
}
// dragon 2 specific
- if (npcinfo[i].spriteset == 10) {
+ if (_npcinfo[i].spriteset == 10) {
- npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * _fpsr;
- if (npcinfo[i].attackframe >= 16) {
- npcinfo[i].attackframe = 0;
- npcinfo[i].attacking = 0;
- npcinfo[i].attacknext = _ticks + npcinfo[i].attackdelay;
+ _npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
+ if (_npcinfo[i].attackframe >= 16) {
+ _npcinfo[i].attackframe = 0;
+ _npcinfo[i].attacking = 0;
+ _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
}
- npcinfo[i].cattackframe = (int)(npcinfo[i].attackframe);
+ _npcinfo[i].cattackframe = (int)(_npcinfo[i].attackframe);
- npx = npcinfo[i].x;
- npy = npcinfo[i].y;
+ npx = _npcinfo[i].x;
+ npy = _npcinfo[i].y;
float xdif = _player.px - npx;
float ydif = _player.py - npy;
- dist = 16 + npcinfo[i].attackframe;
+ dist = 16 + _npcinfo[i].attackframe;
if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
- npcinfo[i].attacknext = _ticks + npcinfo[i].attackdelay;
- // npcinfo[i].attackframe = 0
- // npcinfo[i].attacking = 0
- damage = (float)npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
+ _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
+ // _npcinfo[i].attackframe = 0
+ // _npcinfo[i].attacking = 0
+ damage = (float)_npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
if (_player.hp > 0)
game_damageplayer(damage);
}
}
// endboss specific
- if (npcinfo[i].spriteset == 11) {
- npcinfo[i].attackframe = npcinfo[i].attackframe + npcinfo[i].attackspd * _fpsr;
- if (npcinfo[i].attackframe >= 16) {
- npcinfo[i].attackframe = 0;
- npcinfo[i].attacking = 0;
- npcinfo[i].attacknext = _ticks + npcinfo[i].attackdelay;
+ if (_npcinfo[i].spriteset == 11) {
+ _npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
+ if (_npcinfo[i].attackframe >= 16) {
+ _npcinfo[i].attackframe = 0;
+ _npcinfo[i].attacking = 0;
+ _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
}
- npcinfo[i].cattackframe = (int)(npcinfo[i].attackframe);
+ _npcinfo[i].cattackframe = (int)(_npcinfo[i].attackframe);
- npx = npcinfo[i].x;
- npy = npcinfo[i].y;
+ npx = _npcinfo[i].x;
+ npy = _npcinfo[i].y;
float xdif = _player.px - npx;
float ydif = _player.py - npy;
@@ -6694,10 +6694,10 @@ void GriffonEngine::game_updnpcs() {
dist = 36;
if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
- npcinfo[i].attacknext = _ticks + npcinfo[i].attackdelay;
- // npcinfo[i].attackframe = 0
- // npcinfo[i].attacking = 0
- damage = (float)npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
+ _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
+ // _npcinfo[i].attackframe = 0
+ // _npcinfo[i].attacking = 0
+ damage = (float)_npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
if (_player.hp > 0)
game_damageplayer(damage);
}
@@ -6789,13 +6789,13 @@ void GriffonEngine::game_updspells() {
if (spellinfo[i].damagewho == 0) {
for (int e = 1; e <= lastnpc; e++) {
- xdif = (xloc + 16) - (npcinfo[e].x + 12);
- ydif = (yloc + 16) - (npcinfo[e].y + 12);
+ xdif = (xloc + 16) - (_npcinfo[e].x + 12);
+ ydif = (yloc + 16) - (_npcinfo[e].y + 12);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
- if (npcinfo[e].hp > 0 && npcinfo[e].pause < _ticks) {
+ if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
game_damagenpc(e, damage, 1);
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndice]);
@@ -6813,8 +6813,8 @@ void GriffonEngine::game_updspells() {
ydif = (yloc + 16) - (postinfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+ _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ _objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
rcSrc.left = postinfo[e][0] / 2;
rcSrc.top = postinfo[e][1] / 2;
@@ -6868,13 +6868,13 @@ void GriffonEngine::game_updspells() {
if (spellinfo[i].damagewho == 0) {
for (int e = 1; e <= lastnpc; e++) {
- xdif = (xloc + 24) - (npcinfo[e].x + 12);
- ydif = (yloc + 24) - (npcinfo[e].y + 12);
+ xdif = (xloc + 24) - (_npcinfo[e].x + 12);
+ ydif = (yloc + 24) - (_npcinfo[e].y + 12);
if ((abs(xdif) < 24 && abs(ydif) < 24)) {
float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
- if (npcinfo[e].hp > 0 && npcinfo[e].pause < _ticks) {
+ if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
game_damagenpc(e, damage, 1);
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndmetalhit]);
@@ -6887,24 +6887,24 @@ void GriffonEngine::game_updspells() {
if (spellinfo[i].damagewho == 1) {
// --------- boss 1 specific
- if (ABS(spellinfo[i].frame) < 0 && npcinfo[spellinfo[i].npc].spriteset == 3) {
+ if (ABS(spellinfo[i].frame) < 0 && _npcinfo[spellinfo[i].npc].spriteset == 3) {
int npc = spellinfo[i].npc;
- npcinfo[npc].attackframe = 0;
- npcinfo[npc].attacking = 0;
+ _npcinfo[npc].attackframe = 0;
+ _npcinfo[npc].attacking = 0;
- npcinfo[npc].pause = _ticks + 1000;
- npcinfo[npc].attacknext = _ticks + 4000;
+ _npcinfo[npc].pause = _ticks + 1000;
+ _npcinfo[npc].attacknext = _ticks + 4000;
}
// ---------------
// --------- blackknight specific
- if (ABS(spellinfo[i].frame) < 0 && npcinfo[spellinfo[i].npc].spriteset == 4) {
+ if (ABS(spellinfo[i].frame) < 0 && _npcinfo[spellinfo[i].npc].spriteset == 4) {
int npc = spellinfo[i].npc;
- npcinfo[npc].attackframe = 0;
- npcinfo[npc].attacking = 0;
+ _npcinfo[npc].attackframe = 0;
+ _npcinfo[npc].attacking = 0;
- npcinfo[npc].pause = _ticks + 1000;
- npcinfo[npc].attacknext = _ticks + 3500;
+ _npcinfo[npc].pause = _ticks + 1000;
+ _npcinfo[npc].attacknext = _ticks + 3500;
}
// ---------------
@@ -6915,7 +6915,7 @@ void GriffonEngine::game_updspells() {
npx = _player.px;
npy = _player.py;
- float damage = (float)npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
+ float damage = (float)_npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
game_damageplayer(damage);
@@ -6935,8 +6935,8 @@ void GriffonEngine::game_updspells() {
ydif = (yloc + 24) - (postinfo[e][1] + 8);
if ((abs(xdif) < 24 && abs(ydif) < 24)) {
- objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+ _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ _objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
rcSrc.left = postinfo[e][0] / 2;
rcSrc.top = postinfo[e][1] / 2;
@@ -6990,13 +6990,13 @@ void GriffonEngine::game_updspells() {
if (scatter == 1) {
if (spellinfo[i].damagewho == 0) {
for (int e = 1; e <= lastnpc; e++) {
- xdif = (xloc + 16) - (npcinfo[e].x + 12);
- ydif = (yloc + 16) - (npcinfo[e].y + 12);
+ xdif = (xloc + 16) - (_npcinfo[e].x + 12);
+ ydif = (yloc + 16) - (_npcinfo[e].y + 12);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
- if (npcinfo[e].hp > 0 && npcinfo[e].pause < _ticks) {
+ if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
game_damagenpc(e, damage, 1);
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndrocks]);
@@ -7015,8 +7015,8 @@ void GriffonEngine::game_updspells() {
ydif = (yloc + 16) - (postinfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+ _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ _objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
rcSrc.left = postinfo[e][0] / 2;
rcSrc.top = postinfo[e][1] / 2;
@@ -7105,9 +7105,9 @@ void GriffonEngine::game_updspells() {
}
}
- int o = objmap[sx][sy];
+ int o = _objmap[sx][sy];
if (o > -1) {
- if (objectinfo[o][4] == 1)
+ if (_objectinfo[o][4] == 1)
foundel[2] = 1;
if (o == 1 || o == 2) {
foundel[2] = 1;
@@ -7221,7 +7221,7 @@ void GriffonEngine::game_updspells() {
ydif = (yloc + 8) - (_player.py + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
- float damage = npcinfo[spellinfo[i].npc].spelldamage * (1 + RND() * 0.5) / 3;
+ float damage = _npcinfo[spellinfo[i].npc].spelldamage * (1 + RND() * 0.5) / 3;
if (_player.hp > 0)
game_damageplayer(damage);
@@ -7273,13 +7273,13 @@ void GriffonEngine::game_updspells() {
if (spellinfo[i].damagewho == 0) {
for (int e = 1; e <= lastnpc; e++) {
- xdif = (x + 16) - (npcinfo[e].x + 12);
- ydif = (y + 16) - (npcinfo[e].y + 12);
+ xdif = (x + 16) - (_npcinfo[e].x + 12);
+ ydif = (y + 16) - (_npcinfo[e].y + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = 30 * (1 + RND() * 0.5);
- if (npcinfo[e].hp > 0 && npcinfo[e].pause < _ticks)
+ if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks)
game_damagenpc(e, damage, 1);
}
}
@@ -7292,8 +7292,8 @@ void GriffonEngine::game_updspells() {
ydif = (yloc + 16) - (postinfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+ _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ _objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
rcSrc.left = postinfo[e][0] / 2;
rcSrc.top = postinfo[e][1] / 2;
@@ -7331,13 +7331,13 @@ void GriffonEngine::game_updspells() {
if (spellinfo[i].damagewho == 0) {
for (int e = 1; e <= lastnpc; e++) {
- xdif = (x + 16) - (npcinfo[e].x + 12);
- ydif = (y + 16) - (npcinfo[e].y + 12);
+ xdif = (x + 16) - (_npcinfo[e].x + 12);
+ ydif = (y + 16) - (_npcinfo[e].y + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = 30 * (1 + RND() * 0.5);
- if (npcinfo[e].hp > 0 && npcinfo[e].pause < _ticks)
+ if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks)
game_damagenpc(e, damage, 1);
}
}
@@ -7350,8 +7350,8 @@ void GriffonEngine::game_updspells() {
ydif = (yloc + 16) - (postinfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+ _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ _objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
rcSrc.left = postinfo[e][0] / 2;
rcSrc.top = postinfo[e][1] / 2;
@@ -7388,13 +7388,13 @@ void GriffonEngine::game_updspells() {
if (spellinfo[i].damagewho == 0) {
for (int e = 1; e <= lastnpc; e++) {
- xdif = (x + 16) - (npcinfo[e].x + 12);
- ydif = (y + 16) - (npcinfo[e].y + 12);
+ xdif = (x + 16) - (_npcinfo[e].x + 12);
+ ydif = (y + 16) - (_npcinfo[e].y + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = 30 * (1 + RND() * 0.5);
- if (npcinfo[e].hp > 0 && npcinfo[e].pause < _ticks)
+ if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks)
game_damagenpc(e, damage, 1);
}
}
@@ -7407,8 +7407,8 @@ void GriffonEngine::game_updspells() {
ydif = (yloc + 16) - (postinfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+ _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ _objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
rcSrc.left = postinfo[e][0] / 2;
rcSrc.top = postinfo[e][1] / 2;
@@ -7445,13 +7445,13 @@ void GriffonEngine::game_updspells() {
if (spellinfo[i].damagewho == 0) {
for (int e = 1; e <= lastnpc; e++) {
- xdif = (x + 16) - (npcinfo[e].x + 12);
- ydif = (y + 16) - (npcinfo[e].y + 12);
+ xdif = (x + 16) - (_npcinfo[e].x + 12);
+ ydif = (y + 16) - (_npcinfo[e].y + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = 30 * (1 + RND() * 0.5);
- if (npcinfo[e].hp > 0 && npcinfo[e].pause < _ticks)
+ if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks)
game_damagenpc(e, damage, 1);
}
}
@@ -7464,8 +7464,8 @@ void GriffonEngine::game_updspells() {
ydif = (yloc + 16) - (postinfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+ _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ _objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
rcSrc.left = postinfo[e][0] / 2;
rcSrc.top = postinfo[e][1] / 2;
@@ -7532,7 +7532,7 @@ void GriffonEngine::game_updspells() {
if (damage < 5)
damage = 5;
- if (npcinfo[spellinfo[i].npc].spriteset == 12) {
+ if (_npcinfo[spellinfo[i].npc].spriteset == 12) {
if (damage < 50)
damage = 40 + (int)(RND() * 40);
}
@@ -7548,8 +7548,8 @@ void GriffonEngine::game_updspells() {
if (spellinfo[i].frame < 0) {
spellinfo[i].frame = 0;
- npcinfo[spellinfo[i].npc].attacking = 0;
- npcinfo[spellinfo[i].npc].attacknext = _ticks + npcinfo[spellinfo[i].npc].attackdelay;
+ _npcinfo[spellinfo[i].npc].attacking = 0;
+ _npcinfo[spellinfo[i].npc].attacknext = _ticks + _npcinfo[spellinfo[i].npc].attackdelay;
}
}
}
@@ -7595,8 +7595,8 @@ void GriffonEngine::game_updspellsunder() {
for (f = 1; f <= lastnpc; f++) {
- int xdif = spellinfo[i].enemyx - npcinfo[f].x;
- int ydif = spellinfo[i].enemyy - npcinfo[f].y;
+ int xdif = spellinfo[i].enemyx - _npcinfo[f].x;
+ int ydif = spellinfo[i].enemyy - _npcinfo[f].y;
float dist = sqrt((float)(xdif * xdif + ydif * ydif));
@@ -7606,8 +7606,8 @@ void GriffonEngine::game_updspellsunder() {
if (dist > 5) {
float ratio = (1 - dist / 25);
- float newx = npcinfo[f].x + ratio * xdif / 3 * _fpsr;
- float newy = npcinfo[f].y + ratio * ydif / 3 * _fpsr;
+ float newx = _npcinfo[f].x + ratio * xdif / 3 * _fpsr;
+ float newy = _npcinfo[f].y + ratio * ydif / 3 * _fpsr;
int sx = (newx / 2 + 6);
int sy = (newy / 2 + 10);
@@ -7616,15 +7616,15 @@ void GriffonEngine::game_updspellsunder() {
unsigned int dq = *temp;
if (dq == 0) {
- npcinfo[f].x = newx;
- npcinfo[f].y = newy;
- // npcinfo[f].castpause = _ticks + 200;
+ _npcinfo[f].x = newx;
+ _npcinfo[f].y = newy;
+ // _npcinfo[f].castpause = _ticks + 200;
} else {
int xpass = 0;
int ypass = 0;
sx = (newx / 2 + 6);
- sy = (npcinfo[f].y / 2 + 10);
+ sy = (_npcinfo[f].y / 2 + 10);
temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
@@ -7632,7 +7632,7 @@ void GriffonEngine::game_updspellsunder() {
xpass = 1;
- sx = (npcinfo[f].x / 2 + 6);
+ sx = (_npcinfo[f].x / 2 + 6);
sy = (newy / 2 + 10);
temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
@@ -7641,15 +7641,15 @@ void GriffonEngine::game_updspellsunder() {
ypass = 1;
if (ypass == 1) {
- newx = npcinfo[f].x;
+ newx = _npcinfo[f].x;
} else if (xpass == 1) {
- newy = npcinfo[f].y;
+ newy = _npcinfo[f].y;
}
if (xpass == 1 || ypass == 1) {
- npcinfo[f].x = newx;
- npcinfo[f].y = newy;
- // npcinfo[f].castpause = _ticks + 200;
+ _npcinfo[f].x = newx;
+ _npcinfo[f].y = newy;
+ // _npcinfo[f].castpause = _ticks + 200;
}
}
}
@@ -7702,17 +7702,17 @@ void GriffonEngine::game_updspellsunder() {
if (spellinfo[i].damagewho == 0) {
for (int e = 1; e <= lastnpc; e++) {
- float xdif = (xloc + 8) - (npcinfo[e].x + 12);
- float ydif = (yloc + 8) - (npcinfo[e].y + 12);
+ float xdif = (xloc + 8) - (_npcinfo[e].x + 12);
+ float ydif = (yloc + 8) - (_npcinfo[e].y + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
- if (npcinfo[e].spriteset == 5)
+ if (_npcinfo[e].spriteset == 5)
damage = -damage;
- if (npcinfo[e].spriteset == 11)
+ if (_npcinfo[e].spriteset == 11)
damage = -damage;
- if (npcinfo[e].hp > 0 && npcinfo[e].pause < _ticks) {
+ if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
game_damagenpc(e, damage, 1);
if (menabled && config.effects) {
int snd = Mix_PlayChannel(sfx[sndfire]);
@@ -7728,7 +7728,7 @@ void GriffonEngine::game_updspellsunder() {
float ydif = (yloc + 8) - (_player.py + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
- float damage = (float)npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
+ float damage = (float)_npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
game_damageplayer(damage);
@@ -7748,8 +7748,8 @@ void GriffonEngine::game_updspellsunder() {
float ydif = (yloc + 8) - (postinfo[e][1] + 8);
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
- objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+ _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ _objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
rcSrc.left = postinfo[e][0] / 2;
rcSrc.top = postinfo[e][1] / 2;
@@ -7825,7 +7825,7 @@ void GriffonEngine::game_updspellsunder() {
float ydif = (yloc + 8) - (_player.py + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks && alpha > 64) {
- float damage = (float)npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
+ float damage = (float)_npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
game_damageplayer(damage);
@@ -7848,8 +7848,8 @@ void GriffonEngine::game_updspellsunder() {
spellinfo[i].frame = 0;
if (ABS(spellinfo[i].frame) < 0) {
- npcinfo[spellinfo[i].npc].attacking = 0;
- npcinfo[spellinfo[i].npc].attacknext = _ticks + npcinfo[spellinfo[i].npc].attackdelay;
+ _npcinfo[spellinfo[i].npc].attacking = 0;
+ _npcinfo[spellinfo[i].npc].attacknext = _ticks + _npcinfo[spellinfo[i].npc].attackdelay;
}
}
}
@@ -8113,11 +8113,11 @@ void GriffonEngine::sys_LoadTiles() {
void GriffonEngine::sys_LoadTriggers() {
Common::File file;
- file.open("data/triggers.dat");
+ file.open("data/_triggers.dat");
for (int i = 0; i <= 9999; i++) {
for (int a = 0; a <= 8; a++) {
- INPUT("%i", &triggers[i][a]);
+ INPUT("%i", &_triggers[i][a]);
}
}
@@ -8131,14 +8131,14 @@ void GriffonEngine::sys_LoadObjectDB() {
for (int a = 0; a <= 32; a++) {
for (int b = 0; b <= 5; b++) {
- INPUT("%i", &objectinfo[a][b]);
+ INPUT("%i", &_objectinfo[a][b]);
}
for (int b = 0; b <= 8; b++) {
for (int c = 0; c <= 2; c++) {
for (int d = 0; d <= 2; d++) {
for (int e = 0; e <= 1; e++) {
- INPUT("%i", &objecttile[a][b][c][d][e]);
+ INPUT("%i", &_objecttile[a][b][c][d][e]);
}
}
}
@@ -8388,7 +8388,7 @@ void GriffonEngine::sys_update() {
if (_roomlock == 1) {
_roomlock = 0;
for (int i = 1; i <= lastnpc; i++)
- if (npcinfo[i].hp > 0)
+ if (_npcinfo[i].hp > 0)
_roomlock = 1;
}
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 0ae0e4a..fcb0fa4 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -398,26 +398,26 @@ private:
ANIMSET2TYPE _animset2[7], _animset9[7];
// object info
- float objectframe[256][2];
- int lastobj;
+ float _objectframe[256][2];
+ int _lastobj;
// frame!, curframe
- int objectinfo[33][6];
+ int _objectinfo[33][6];
// nframes,xtiles,ytiles,speed,type,script, update?
- int objecttile[33][9][3][3][2];
+ int _objecttile[33][9][3][3][2];
// [objnum] [frame] [x] [y] [tile/layer]
- int objmap[21][15];
+ int _objmap[21][15];
- int objmapf[1000][21][15];
+ int _objmapf[1000][21][15];
// [mapnum] x, y set to 1 to make this objmap spot stay at -1
// trigger info
- int triggers[10000][9];
+ int _triggers[10000][9];
// [map#][index], [var]
// map#,x,y
- int triggerloc[320][240], ntriggers;
+ int _triggerloc[320][240], _ntriggers;
// npc info
- NPCTYPE npcinfo[kMaxNPC];
+ NPCTYPE _npcinfo[kMaxNPC];
int lastnpc;
// music info
diff --git a/engines/griffon/saveload.cpp b/engines/griffon/saveload.cpp
index f3cc6f5..6295890 100644
--- a/engines/griffon/saveload.cpp
+++ b/engines/griffon/saveload.cpp
@@ -111,7 +111,7 @@ int GriffonEngine::state_load(int slotnum) {
for (int a = 0; a <= 999; a++) {
for (int b = 0; b <= 20; b++) {
for (int c = 0; c <= 14; c++) {
- INPUT("%i", &objmapf[a][b][c]);
+ INPUT("%i", &_objmapf[a][b][c]);
}
}
}
@@ -236,7 +236,7 @@ int GriffonEngine::state_save(int slotnum) {
for (int a = 0; a <= 999; a++) {
for (int b = 0; b <= 20; b++) {
for (int c = 0; c <= 14; c++) {
- PRINT("%i", objmapf[a][b][c]);
+ PRINT("%i", _objmapf[a][b][c]);
}
}
}
Commit: c1accc049e2803c9ef4c5202f2fd9401d5e59432
https://github.com/scummvm/scummvm/commit/c1accc049e2803c9ef4c5202f2fd9401d5e59432
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Variable renames
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index bc2c423..6ee6807 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -417,8 +417,8 @@ void GriffonEngine::game_attack() {
_objmapf[_curmap][lx][ly - 1] = 1;
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -431,8 +431,8 @@ void GriffonEngine::game_attack() {
}
if (oscript == 0 && _player.inventory[INV_FLASK] == 9) {
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndchest]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndchest]);
Mix_Volume(snd, config.effectsvol);
}
@@ -455,8 +455,8 @@ void GriffonEngine::game_attack() {
if (_curmap == 81)
_scriptflag[13][0] = 2;
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -472,8 +472,8 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(7, lx * 16, (ly - 1) * 16);
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -492,8 +492,8 @@ void GriffonEngine::game_attack() {
_itemticks = _ticks + 215;
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -512,8 +512,8 @@ void GriffonEngine::game_attack() {
_itemticks = _ticks + 215;
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -533,8 +533,8 @@ void GriffonEngine::game_attack() {
}
}
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -546,8 +546,8 @@ void GriffonEngine::game_attack() {
game_eventtext("Found Key");
game_addFloatIcon(16, lx * 16, (ly - 1) * 16);
} else {
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndchest]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndchest]);
Mix_Volume(snd, config.effectsvol);
}
@@ -561,8 +561,8 @@ void GriffonEngine::game_attack() {
_objmapf[_curmap][lx][ly - 1] = 1;
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -575,8 +575,8 @@ void GriffonEngine::game_attack() {
}
if (oscript == 7 && _player.inventory[INV_DOUBLEFLASK] == 9) {
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndchest]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndchest]);
Mix_Volume(snd, config.effectsvol);
}
@@ -591,8 +591,8 @@ void GriffonEngine::game_attack() {
_objmapf[_curmap][lx][ly - 1] = 1;
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -605,8 +605,8 @@ void GriffonEngine::game_attack() {
}
if (oscript == 10 && _player.inventory[INV_DOUBLEFLASK] == 9) {
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndchest]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndchest]);
Mix_Volume(snd, config.effectsvol);
}
@@ -621,8 +621,8 @@ void GriffonEngine::game_attack() {
_objmapf[_curmap][lx][ly - 1] = 1;
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -635,8 +635,8 @@ void GriffonEngine::game_attack() {
}
if (oscript == 11 && _player.inventory[INV_SHOCK] == 9) {
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndchest]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndchest]);
Mix_Volume(snd, config.effectsvol);
}
@@ -650,8 +650,8 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(5, lx * 16, (ly - 1) * 16);
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -667,14 +667,14 @@ void GriffonEngine::game_attack() {
if (_curmap == 58 && _scriptflag[60][0] == 0) {
_scriptflag[60][0] = 1;
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndlever]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndlever]);
Mix_Volume(snd, config.effectsvol);
}
} else if (_curmap == 58 && _scriptflag[60][0] > 0) {
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[snddoor]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[snddoor]);
Mix_Volume(snd, config.effectsvol);
}
@@ -682,15 +682,15 @@ void GriffonEngine::game_attack() {
}
if (_curmap == 54 && _scriptflag[60][0] == 1) {
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndlever]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndlever]);
Mix_Volume(snd, config.effectsvol);
}
_scriptflag[60][0] = 2;
} else if (_curmap == 54 && _scriptflag[60][0] > 1) {
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[snddoor]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[snddoor]);
Mix_Volume(snd, config.effectsvol);
}
@@ -706,8 +706,8 @@ void GriffonEngine::game_attack() {
_itemticks = _ticks + 215;
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -723,8 +723,8 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(19, lx * 16, (ly - 1) * 16);
_itemticks = _ticks + 215;
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -740,8 +740,8 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(20, lx * 16, (ly - 1) * 16);
_itemticks = _ticks + 215;
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -836,15 +836,15 @@ void GriffonEngine::game_castspell(int spellnum, float homex, float homey, float
spellinfo[i].nfballs = nballs;
}
- if (menabled && config.effects) {
+ if (_menabled && config.effects) {
if (spellnum == 1) {
- int snd = Mix_PlayChannel(sfx[sndthrow]);
+ int snd = Mix_PlayChannel(_sfx[sndthrow]);
Mix_Volume(snd, config.effectsvol);
} else if (spellnum == 5) {
- int snd = Mix_PlayChannel(sfx[sndcrystal]);
+ int snd = Mix_PlayChannel(_sfx[sndcrystal]);
Mix_Volume(snd, config.effectsvol);
} else if (spellnum == 8 || spellnum == 9) {
- int snd = Mix_PlayChannel(sfx[sndlightning]);
+ int snd = Mix_PlayChannel(_sfx[sndlightning]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -856,7 +856,7 @@ void GriffonEngine::game_castspell(int spellnum, float homex, float homey, float
void GriffonEngine::game_checkhit() {
if (attacking) {
- for (int i = 1; i <= lastnpc; i++) {
+ for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0 && _npcinfo[i].pause < _ticks && (int)(RND() * 2) == 0) {
float npx = _npcinfo[i].x;
float npy = _npcinfo[i].y;
@@ -891,8 +891,8 @@ void GriffonEngine::game_checkhit() {
}
if (hit) {
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndswordhit]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndswordhit]);
Mix_Volume(snd, config.effectsvol);
}
@@ -963,8 +963,8 @@ void GriffonEngine::game_checkinputs() {
_player.inventory[INV_FLASK]--;
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -989,8 +989,8 @@ void GriffonEngine::game_checkinputs() {
_player.inventory[INV_DOUBLEFLASK]--;
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -1011,8 +1011,8 @@ void GriffonEngine::game_checkinputs() {
}
- if (_curitem == 3 && _player.inventory[INV_NORMALKEY] > 0 && canusekey == 1 && locktype == 1) {
- _roomlocks[roomtounlock] = 0;
+ if (_curitem == 3 && _player.inventory[INV_NORMALKEY] > 0 && _canusekey == 1 && _locktype == 1) {
+ _roomlocks[_roomtounlock] = 0;
game_eventtext("UnLocked!");
_player.inventory[INV_NORMALKEY]--;
@@ -1023,8 +1023,8 @@ void GriffonEngine::game_checkinputs() {
return;
}
- if (_curitem == 4 && _player.inventory[INV_MASTERKEY] > 0 && canusekey == 1 && locktype == 2) {
- _roomlocks[roomtounlock] = 0;
+ if (_curitem == 4 && _player.inventory[INV_MASTERKEY] > 0 && _canusekey == 1 && _locktype == 2) {
+ _roomlocks[_roomtounlock] = 0;
game_eventtext("UnLocked!");
_player.inventory[INV_MASTERKEY]--;
@@ -1048,10 +1048,10 @@ void GriffonEngine::game_checkinputs() {
}
if (_curitem > 5 && _selenemyon == 1) {
- if (_curenemy <= lastnpc) {
+ if (_curenemy <= _lastnpc) {
game_castspell(_curitem - 6, _player.px, _player.py, _npcinfo[_curenemy].x, _npcinfo[_curenemy].y, 0);
} else {
- int pst = _curenemy - lastnpc - 1;
+ int pst = _curenemy - _lastnpc - 1;
game_castspell(_curitem - 6, _player.px, _player.py, postinfo[pst][0], postinfo[pst][1], 0);
}
@@ -1078,7 +1078,7 @@ void GriffonEngine::game_checkinputs() {
goto __exit_do;
}
i = i + 1;
- if (i == lastnpc + 1) {
+ if (i == _lastnpc + 1) {
_selenemyon = 0;
goto __exit_do;
}
@@ -1087,7 +1087,7 @@ __exit_do:
if (nposts > 0 && _selenemyon == 0) {
_selenemyon = 1;
- _curenemy = lastnpc + 1;
+ _curenemy = _lastnpc + 1;
}
}
@@ -1136,12 +1136,12 @@ __exit_do:
do {
_curenemy = _curenemy - 1;
if (_curenemy < 1)
- _curenemy = lastnpc + nposts;
+ _curenemy = _lastnpc + nposts;
if (_curenemy == origin)
break;
- if (_curenemy <= lastnpc && _npcinfo[_curenemy].hp > 0)
+ if (_curenemy <= _lastnpc && _npcinfo[_curenemy].hp > 0)
break;
- if (_curenemy > lastnpc)
+ if (_curenemy > _lastnpc)
break;
} while (1);
_itemticks = _ticks + ntickdelay;
@@ -1150,23 +1150,23 @@ __exit_do:
int origin = _curenemy;
do {
_curenemy = _curenemy + 1;
- if (_curenemy > lastnpc + nposts)
+ if (_curenemy > _lastnpc + nposts)
_curenemy = 1;
if (_curenemy == origin)
break;
- if (_curenemy <= lastnpc && _npcinfo[_curenemy].hp > 0)
+ if (_curenemy <= _lastnpc && _npcinfo[_curenemy].hp > 0)
break;
- if (_curenemy > lastnpc)
+ if (_curenemy > _lastnpc)
break;
} while (1);
_itemticks = _ticks + ntickdelay;
}
- if (_curenemy > lastnpc + nposts)
+ if (_curenemy > _lastnpc + nposts)
_curenemy = 1;
if (_curenemy < 1)
- _curenemy = lastnpc + nposts;
+ _curenemy = _lastnpc + nposts;
}
} else {
if (_itemticks < _ticks) {
@@ -1211,7 +1211,7 @@ void GriffonEngine::game_checktrigger() {
int lx = (int)npx / 16;
int ly = (int)npy / 16;
- canusekey = 0;
+ _canusekey = 0;
if (_triggerloc[lx][ly] > -1)
game_processtrigger(_triggerloc[lx][ly]);
@@ -1413,19 +1413,19 @@ void GriffonEngine::game_configmenu() {
if (config.musicvol < 0)
config.musicvol = 0;
- Mix_Volume(musicchannel, config.musicvol);
- Mix_Volume(menuchannel, config.musicvol);
+ Mix_Volume(_musicchannel, config.musicvol);
+ Mix_Volume(_menuchannel, config.musicvol);
} else if (cursel == 12) {
config.effectsvol = config.effectsvol - 25;
if (config.effectsvol < 0)
config.effectsvol = 0;
Mix_Volume(-1, config.effectsvol);
- Mix_Volume(musicchannel, config.musicvol);
- Mix_Volume(menuchannel, config.musicvol);
+ Mix_Volume(_musicchannel, config.musicvol);
+ Mix_Volume(_menuchannel, config.musicvol);
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[snddoor]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[snddoor]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -1436,19 +1436,19 @@ void GriffonEngine::game_configmenu() {
if (config.musicvol > 255)
config.musicvol = 255;
- Mix_Volume(musicchannel, config.musicvol);
- Mix_Volume(menuchannel, config.musicvol);
+ Mix_Volume(_musicchannel, config.musicvol);
+ Mix_Volume(_menuchannel, config.musicvol);
} else if (cursel == 12) {
config.effectsvol = config.effectsvol + 25;
if (config.effectsvol > 255)
config.effectsvol = 255;
Mix_Volume(-1, config.effectsvol);
- Mix_Volume(musicchannel, config.musicvol);
- Mix_Volume(menuchannel, config.musicvol);
+ Mix_Volume(_musicchannel, config.musicvol);
+ Mix_Volume(_menuchannel, config.musicvol);
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[snddoor]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[snddoor]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -1538,20 +1538,20 @@ void GriffonEngine::game_configmenu() {
}
if (cursel == 7 && config.music == 0) {
config.music = 1;
- if (menabled == 1) {
- menuchannel = Mix_PlayChannel(_mmenu, true);
- Mix_Volume(menuchannel, config.musicvol);
+ if (_menabled == 1) {
+ _menuchannel = Mix_PlayChannel(_mmenu, true);
+ Mix_Volume(_menuchannel, config.musicvol);
}
}
if (cursel == 8 && config.music == 1) {
config.music = 0;
- Mix_HaltChannel(musicchannel);
- Mix_HaltChannel(menuchannel);
+ Mix_HaltChannel(_musicchannel);
+ Mix_HaltChannel(_menuchannel);
}
if (cursel == 9 && config.effects == 0) {
config.effects = 1;
- if (menabled == 1) {
- int snd = Mix_PlayChannel(sfx[snddoor]);
+ if (_menabled == 1) {
+ int snd = Mix_PlayChannel(_sfx[snddoor]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -1682,7 +1682,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
// academy master key chest script
if (_npcinfo[npcnum].script == 2) {
bool alive = false;
- for (int i = 1; i <= lastnpc; i++) {
+ for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0)
alive = true;
}
@@ -1714,7 +1714,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
// academy crystal chest script
if (_npcinfo[npcnum].script == 3) {
bool alive = false;
- for (int i = 1; i <= lastnpc; i++) {
+ for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0)
alive = true;
}
@@ -1772,7 +1772,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
// firehydra sword chest
if (_npcinfo[npcnum].script == 5) {
bool alive = false;
- for (int i = 1; i <= lastnpc; i++) {
+ for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0)
alive = true;
}
@@ -1805,7 +1805,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
// gardens master key script
if (_npcinfo[npcnum].script == 8 && _scriptflag[6][0] == 0) {
bool alive = false;
- for (int i = 1; i <= lastnpc; i++) {
+ for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0)
alive = true;
}
@@ -1838,7 +1838,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
for (int s = 20; s <= 23; s++) {
if (_npcinfo[npcnum].script == s && _scriptflag[s][0] < 2) {
bool alive = false;
- for (int i = 1; i <= lastnpc; i++) {
+ for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0)
alive = true;
}
@@ -1871,7 +1871,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
// pickup lightning bomb
if (_npcinfo[npcnum].script == 9 && (_curmap == 41 && _scriptflag[9][1] == 0)) {
bool alive = false;
- for (int i = 1; i <= lastnpc; i++) {
+ for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0)
alive = true;
}
@@ -1901,7 +1901,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
// citadel armour chest
if (_npcinfo[npcnum].script == 12) {
bool alive = false;
- for (int i = 1; i <= lastnpc; i++) {
+ for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0)
alive = true;
}
@@ -1933,7 +1933,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
// citadel master key script
if (_npcinfo[npcnum].script == 13 && _scriptflag[13][0] == 0) {
bool alive = false;
- for (int i = 1; i <= lastnpc; i++) {
+ for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0)
alive = true;
}
@@ -1965,7 +1965,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
// max ups
if (_npcinfo[npcnum].script == 15 && _scriptflag[15][0] == 0) {
bool alive = false;
- for (int i = 1; i <= lastnpc; i++) {
+ for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0)
alive = true;
}
@@ -2396,8 +2396,8 @@ void GriffonEngine::game_drawhud() {
}
if (_selenemyon == 1) {
- if (_curenemy > lastnpc) {
- int pst = _curenemy - lastnpc - 1;
+ if (_curenemy > _lastnpc) {
+ int pst = _curenemy - _lastnpc - 1;
rcDest.left = postinfo[pst][0];
rcDest.top = (float)(postinfo[pst][1] - 4 - sin(3.141592 / 8 * _itemyloc));
} else {
@@ -2411,8 +2411,8 @@ void GriffonEngine::game_drawhud() {
void GriffonEngine::game_drawnpcs(int mode) {
unsigned int ccc = _videobuffer->format.RGBToColor(255, 128, 32);
- int fst = firsty;
- int lst = lasty;
+ int fst = _firsty;
+ int lst = _lasty;
if (mode == 0)
lst = _player.ysort;
@@ -2421,8 +2421,8 @@ void GriffonEngine::game_drawnpcs(int mode) {
for (int yy = fst; yy <= lst; yy++) {
- if (ysort[yy] > 0) {
- int i = ysort[yy];
+ if (_ysort[yy] > 0) {
+ int i = _ysort[yy];
if (_npcinfo[i].hp > 0) {
int npx = (int)(_npcinfo[i].x);
@@ -2830,8 +2830,8 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (_player.hp > 0) {
game_damageplayer(damage);
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndfire]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndfire]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -2856,8 +2856,8 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (_player.hp > 0) {
game_damageplayer(damage);
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndfire]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndfire]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -3174,10 +3174,10 @@ void GriffonEngine::game_endofgame() {
float spd = 0.2f;
- if (menabled && config.music) {
+ if (_menabled && config.music) {
Mix_HaltChannel(-1);
- musicchannel = Mix_PlayChannel(_mendofgame, true);
- Mix_Volume(musicchannel, 0);
+ _musicchannel = Mix_PlayChannel(_mendofgame, true);
+ Mix_Volume(_musicchannel, 0);
}
int _ticks1 = _ticks;
@@ -3194,8 +3194,8 @@ void GriffonEngine::game_endofgame() {
ld = ld + 4 * _fpsr;
if (ld > config.musicvol)
ld = config.musicvol;
- if (menabled && ldstop == 0) {
- Mix_Volume(musicchannel, (int)ld);
+ if (_menabled && ldstop == 0) {
+ Mix_Volume(_musicchannel, (int)ld);
if ((int)ld == config.musicvol)
ldstop = 1;
}
@@ -3616,7 +3616,7 @@ void GriffonEngine::game_handlewalking() {
// push npc
if (pass == 1) {
- for (int i = 1; i <= lastnpc; i++) {
+ for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0) {
npx = _npcinfo[i].x;
npy = _npcinfo[i].y;
@@ -3680,8 +3680,8 @@ void GriffonEngine::game_handlewalking() {
_objmapf[_curmap][lx][ly] = 1;
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -3694,8 +3694,8 @@ void GriffonEngine::game_handlewalking() {
_objmapf[_curmap][lx][ly] = 1;
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -3710,8 +3710,8 @@ void GriffonEngine::game_handlewalking() {
if (_curmap == 41)
_scriptflag[9][1] = 1;
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -3725,8 +3725,8 @@ void GriffonEngine::game_handlewalking() {
_objmapf[_curmap][lx][ly] = 1;
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
@@ -3970,7 +3970,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
}
_lastobj = 0;
- lastnpc = 0;
+ _lastnpc = 0;
for (int i = 0; i < kMaxNPC; i++)
_npcinfo[i].onmap = 0;
@@ -4020,8 +4020,8 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (npc == 1) {
int o = tempmap[4 * 40 + x][y];
- if (o > lastnpc)
- lastnpc = o;
+ if (o > _lastnpc)
+ _lastnpc = o;
_npcinfo[o].x = x * 16 - 4;
_npcinfo[o].y = y * 16 - 5;
@@ -4034,11 +4034,11 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (_curmap == 62 && _scriptflag[8][0] > 0)
- lastnpc = 0;
+ _lastnpc = 0;
if (_curmap == 73 && _scriptflag[12][0] > 0)
- lastnpc = 0;
+ _lastnpc = 0;
if (_curmap == 81 && _scriptflag[13][0] > 0)
- lastnpc = 0;
+ _lastnpc = 0;
if (_curmap == 73 && _scriptflag[12][0] == 0)
_roomlock = 1;
@@ -4561,10 +4561,10 @@ void GriffonEngine::game_newgame() {
_fpsr = 0.0;
int y = 140;
- if (menabled && config.music) {
+ if (_menabled && config.music) {
Mix_HaltChannel(-1);
- musicchannel = Mix_PlayChannel(_mendofgame, true);
- Mix_Volume(musicchannel, 0);
+ _musicchannel = Mix_PlayChannel(_mendofgame, true);
+ Mix_Volume(_musicchannel, 0);
}
_secsingame = 0;
@@ -4578,8 +4578,8 @@ void GriffonEngine::game_newgame() {
ld += 4 * _fpsr;
if ((int)ld > config.musicvol)
ld = config.musicvol;
- if (menabled && ldstop == 0) {
- Mix_Volume(musicchannel, (int)ld);
+ if (_menabled && ldstop == 0) {
+ Mix_Volume(_musicchannel, (int)ld);
if ((int)ld == config.musicvol)
ldstop = 1;
}
@@ -4713,11 +4713,11 @@ __exit_do:
_player.py = 6 * 16 - 4;
_player.walkdir = 1;
- pgardens = 0;
- ptown = 0;
- pboss = 0;
- pacademy = 0;
- pcitadel = 0;
+ _pgardens = 0;
+ _ptown = 0;
+ _pboss = 0;
+ _pacademy = 0;
+ _pcitadel = 0;
game_loadmap(2);
@@ -4727,9 +4727,9 @@ __exit_do:
void GriffonEngine::game_playgame() {
game_swash();
- if (pmenu == 1 && menabled) {
- Mix_HaltChannel(menuchannel);
- pmenu = 0;
+ if (_pmenu == 1 && _menabled) {
+ Mix_HaltChannel(_menuchannel);
+ _pmenu = 0;
}
do {
@@ -4768,24 +4768,24 @@ void GriffonEngine::game_processtrigger(int trignum) {
int tjumpstyle = _triggers[trignum][4];
if (_roomlocks[tmap] > 0) {
- if (saidlocked == 0)
+ if (_saidlocked == 0)
game_eventtext("Locked");
- saidlocked = 1;
- canusekey = 1;
- locktype = _roomlocks[tmap];
- roomtounlock = tmap;
+ _saidlocked = 1;
+ _canusekey = 1;
+ _locktype = _roomlocks[tmap];
+ _roomtounlock = tmap;
return;
}
if (tmap == 1) {
- if (saidjammed == 0)
+ if (_saidjammed == 0)
game_eventtext("Door Jammed!");
- saidjammed = 1;
+ _saidjammed = 1;
return;
}
- saidlocked = 0;
- saidjammed = 0;
+ _saidlocked = 0;
+ _saidjammed = 0;
// loc-sxy+oldmaploc
if (tjumpstyle == 0) {
@@ -4803,8 +4803,8 @@ void GriffonEngine::game_processtrigger(int trignum) {
_player.py = 0;
if (tmap > 0) {
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[snddoor]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[snddoor]);
Mix_Volume(snd, config.effectsvol);
}
@@ -4919,11 +4919,11 @@ void GriffonEngine::game_saveloadnew() {
attacking = false;
_player.attackspd = 1.5f;
- pgardens = 0;
- ptown = 0;
- pboss = 0;
- pacademy = 0;
- pcitadel = 0;
+ _pgardens = 0;
+ _ptown = 0;
+ _pboss = 0;
+ _pacademy = 0;
+ _pcitadel = 0;
Mix_HaltChannel(-1);
@@ -5333,13 +5333,13 @@ void GriffonEngine::game_title(int mode) {
int keypause = _ticks + 220;
int _ticks1 = _ticks;
- if (menabled && config.music) {
- Mix_Volume(musicchannel, 0);
- Mix_Pause(musicchannel);
+ if (_menabled && config.music) {
+ Mix_Volume(_musicchannel, 0);
+ Mix_Pause(_musicchannel);
- menuchannel = Mix_PlayChannel(_mmenu, true);
- Mix_Volume(menuchannel, config.musicvol);
- pmenu = 1;
+ _menuchannel = Mix_PlayChannel(_mmenu, true);
+ Mix_Volume(_menuchannel, config.musicvol);
+ _pmenu = 1;
}
int ldstop = 0;
@@ -5351,8 +5351,8 @@ void GriffonEngine::game_title(int mode) {
ld += 4.0 * _fpsr;
if (ld > config.musicvol)
ld = config.musicvol;
- if (menabled && ldstop == 0) {
- Mix_Volume(menuchannel, (int)ld);
+ if (_menabled && ldstop == 0) {
+ Mix_Volume(_menuchannel, (int)ld);
if ((int)ld == config.musicvol)
ldstop = 1;
}
@@ -5472,11 +5472,11 @@ void GriffonEngine::game_title(int mode) {
_itemticks = _ticks + 210;
- if (menabled && config.music) {
- Mix_HaltChannel(menuchannel);
- Mix_Resume(musicchannel);
- Mix_Volume(musicchannel, config.musicvol);
- pmenu = 0;
+ if (_menabled && config.music) {
+ Mix_HaltChannel(_menuchannel);
+ Mix_Resume(_musicchannel);
+ Mix_Volume(_musicchannel, config.musicvol);
+ _pmenu = 0;
}
}
@@ -5507,38 +5507,38 @@ void GriffonEngine::game_updanims() {
void GriffonEngine::game_updatey() {
for (int i = 0; i <= 2400; i++)
- ysort[i] = -1;
+ _ysort[i] = -1;
int ff = (int)(_player.py * 10);
- if (ff < 0) // HACKFIX or ysort[yy] may go out of bounds
+ if (ff < 0) // HACKFIX or _ysort[yy] may go out of bounds
ff = 0;
_player.ysort = ff;
- ysort[ff] = 0;
+ _ysort[ff] = 0;
- firsty = 2400;
- lasty = 0;
+ _firsty = 2400;
+ _lasty = 0;
- for (int i = 1; i <= lastnpc; i++) {
+ for (int i = 1; i <= _lastnpc; i++) {
int yy = (int)(_npcinfo[i].y * 10);
do {
- if (ysort[yy] == -1 || yy == 2400)
+ if (_ysort[yy] == -1 || yy == 2400)
break;
yy = yy + 1;
} while (1);
- ysort[yy] = i;
- if (yy < firsty)
- firsty = yy;
- if (yy > lasty)
- lasty = yy;
+ _ysort[yy] = i;
+ if (yy < _firsty)
+ _firsty = yy;
+ if (yy > _lasty)
+ _lasty = yy;
}
}
void GriffonEngine::game_updmusic() {
DataChunk *iplaysound = NULL;
- if (menabled && config.music) {
+ if (_menabled && config.music) {
// if(_curmap > 5 && _curmap < 42) iplaysound = macademy;
// if(_curmap > 47) iplaysound = _mgardens;
@@ -5546,53 +5546,53 @@ void GriffonEngine::game_updmusic() {
if (_roomlock == 1)
iplaysound = _mboss;
- if (iplaysound == _mboss && pboss)
+ if (iplaysound == _mboss && _pboss)
iplaysound = NULL;
- if (iplaysound == _mgardens && pgardens)
+ if (iplaysound == _mgardens && _pgardens)
iplaysound = NULL;
if (iplaysound != NULL) {
- Mix_HaltChannel(musicchannel);
+ Mix_HaltChannel(_musicchannel);
- pboss = 0;
- pgardens = 0;
- ptown = 0;
- pacademy = 0;
- pcitadel = 0;
+ _pboss = 0;
+ _pgardens = 0;
+ _ptown = 0;
+ _pacademy = 0;
+ _pcitadel = 0;
if (iplaysound == _mboss)
- pboss = 1;
+ _pboss = 1;
if (iplaysound == _mgardens)
- pgardens = 1;
+ _pgardens = 1;
- musicchannel = Mix_PlayChannel(iplaysound, true);
- Mix_Volume(musicchannel, config.musicvol);
+ _musicchannel = Mix_PlayChannel(iplaysound, true);
+ Mix_Volume(_musicchannel, config.musicvol);
} else {
- if (!Mix_Playing(musicchannel)) {
- loopseta = loopseta + 1;
- if (loopseta == 4)
- loopseta = 0;
-
- if (pgardens == 1) {
- Mix_HaltChannel(musicchannel);
- if (pgardens == 1 && loopseta == 0)
- musicchannel = Mix_PlayChannel(_mgardens);
- if (pgardens == 1 && loopseta == 1)
- musicchannel = Mix_PlayChannel(_mgardens2);
- if (pgardens == 1 && loopseta == 2)
- musicchannel = Mix_PlayChannel(_mgardens3);
- if (pgardens == 1 && loopseta == 3)
- musicchannel = Mix_PlayChannel(_mgardens4);
+ if (!Mix_Playing(_musicchannel)) {
+ _loopseta = _loopseta + 1;
+ if (_loopseta == 4)
+ _loopseta = 0;
+
+ if (_pgardens == 1) {
+ Mix_HaltChannel(_musicchannel);
+ if (_pgardens == 1 && _loopseta == 0)
+ _musicchannel = Mix_PlayChannel(_mgardens);
+ if (_pgardens == 1 && _loopseta == 1)
+ _musicchannel = Mix_PlayChannel(_mgardens2);
+ if (_pgardens == 1 && _loopseta == 2)
+ _musicchannel = Mix_PlayChannel(_mgardens3);
+ if (_pgardens == 1 && _loopseta == 3)
+ _musicchannel = Mix_PlayChannel(_mgardens4);
}
- Mix_Volume(musicchannel, config.musicvol);
+ Mix_Volume(_musicchannel, config.musicvol);
}
}
}
}
void GriffonEngine::game_updnpcs() {
- for (int i = 1; i <= lastnpc; i++) {
+ for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0) {
// is npc walking
int pass = 0;
@@ -6004,8 +6004,8 @@ void GriffonEngine::game_updnpcs() {
if (abs(xdif) < 20 && abs(ydif) < 20) {
_npcinfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndenemyhit]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndenemyhit]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6031,8 +6031,8 @@ void GriffonEngine::game_updnpcs() {
float dist = sqrt(xdif * xdif + ydif * ydif);
if ((dist) < 24) {
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndbite]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndbite]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6137,8 +6137,8 @@ void GriffonEngine::game_updnpcs() {
float dist = sqrt(xdif * xdif + ydif * ydif);
if ((dist) < 36) {
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndbite]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndbite]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6317,8 +6317,8 @@ void GriffonEngine::game_updnpcs() {
float dist = sqrt(xdif * xdif + ydif * ydif);
if ((dist) < 24) {
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndbite]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndbite]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6391,8 +6391,8 @@ void GriffonEngine::game_updnpcs() {
if (abs(xdif) < 32 && abs(ydif) < 32) {
_npcinfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndenemyhit]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndenemyhit]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6416,8 +6416,8 @@ void GriffonEngine::game_updnpcs() {
if (abs(xdif) < 38 && abs(ydif) < 38) {
_npcinfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndice]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndice]);
Mix_Volume(snd, config.effectsvol);
}
_npcinfo[i].attacking = 1;
@@ -6787,7 +6787,7 @@ void GriffonEngine::game_updspells() {
_spellimg->setAlpha(255, true);
if (spellinfo[i].damagewho == 0) {
- for (int e = 1; e <= lastnpc; e++) {
+ for (int e = 1; e <= _lastnpc; e++) {
xdif = (xloc + 16) - (_npcinfo[e].x + 12);
ydif = (yloc + 16) - (_npcinfo[e].y + 12);
@@ -6797,8 +6797,8 @@ void GriffonEngine::game_updspells() {
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
game_damagenpc(e, damage, 1);
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndice]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndice]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -6825,8 +6825,8 @@ void GriffonEngine::game_updspells() {
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndice]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndice]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -6867,7 +6867,7 @@ void GriffonEngine::game_updspells() {
spellinfo[i].frame = 0;
if (spellinfo[i].damagewho == 0) {
- for (int e = 1; e <= lastnpc; e++) {
+ for (int e = 1; e <= _lastnpc; e++) {
xdif = (xloc + 24) - (_npcinfo[e].x + 12);
ydif = (yloc + 24) - (_npcinfo[e].y + 12);
@@ -6876,8 +6876,8 @@ void GriffonEngine::game_updspells() {
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
game_damagenpc(e, damage, 1);
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndmetalhit]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndmetalhit]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -6919,8 +6919,8 @@ void GriffonEngine::game_updspells() {
if (_player.hp > 0) {
game_damageplayer(damage);
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndmetalhit]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndmetalhit]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -6947,8 +6947,8 @@ void GriffonEngine::game_updspells() {
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndmetalhit]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndmetalhit]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -6989,7 +6989,7 @@ void GriffonEngine::game_updspells() {
if (scatter == 1) {
if (spellinfo[i].damagewho == 0) {
- for (int e = 1; e <= lastnpc; e++) {
+ for (int e = 1; e <= _lastnpc; e++) {
xdif = (xloc + 16) - (_npcinfo[e].x + 12);
ydif = (yloc + 16) - (_npcinfo[e].y + 12);
@@ -6998,8 +6998,8 @@ void GriffonEngine::game_updspells() {
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
game_damagenpc(e, damage, 1);
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndrocks]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndrocks]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -7027,8 +7027,8 @@ void GriffonEngine::game_updspells() {
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndrocks]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndrocks]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -7226,8 +7226,8 @@ void GriffonEngine::game_updspells() {
if (_player.hp > 0)
game_damageplayer(damage);
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndfire]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndfire]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -7271,7 +7271,7 @@ void GriffonEngine::game_updspells() {
orn = rn;
if (spellinfo[i].damagewho == 0) {
- for (int e = 1; e <= lastnpc; e++) {
+ for (int e = 1; e <= _lastnpc; e++) {
xdif = (x + 16) - (_npcinfo[e].x + 12);
ydif = (y + 16) - (_npcinfo[e].y + 12);
@@ -7329,7 +7329,7 @@ void GriffonEngine::game_updspells() {
orn = rn;
if (spellinfo[i].damagewho == 0) {
- for (int e = 1; e <= lastnpc; e++) {
+ for (int e = 1; e <= _lastnpc; e++) {
xdif = (x + 16) - (_npcinfo[e].x + 12);
ydif = (y + 16) - (_npcinfo[e].y + 12);
@@ -7387,7 +7387,7 @@ void GriffonEngine::game_updspells() {
orn = rn;
if (spellinfo[i].damagewho == 0) {
- for (int e = 1; e <= lastnpc; e++) {
+ for (int e = 1; e <= _lastnpc; e++) {
xdif = (x + 16) - (_npcinfo[e].x + 12);
ydif = (y + 16) - (_npcinfo[e].y + 12);
@@ -7444,7 +7444,7 @@ void GriffonEngine::game_updspells() {
orn = rn;
if (spellinfo[i].damagewho == 0) {
- for (int e = 1; e <= lastnpc; e++) {
+ for (int e = 1; e <= _lastnpc; e++) {
xdif = (x + 16) - (_npcinfo[e].x + 12);
ydif = (y + 16) - (_npcinfo[e].y + 12);
@@ -7594,7 +7594,7 @@ void GriffonEngine::game_updspellsunder() {
spellinfo[i].frame = 0;
- for (f = 1; f <= lastnpc; f++) {
+ for (f = 1; f <= _lastnpc; f++) {
int xdif = spellinfo[i].enemyx - _npcinfo[f].x;
int ydif = spellinfo[i].enemyy - _npcinfo[f].y;
@@ -7701,7 +7701,7 @@ void GriffonEngine::game_updspellsunder() {
spellinfo[i].legalive[f] = x;
if (spellinfo[i].damagewho == 0) {
- for (int e = 1; e <= lastnpc; e++) {
+ for (int e = 1; e <= _lastnpc; e++) {
float xdif = (xloc + 8) - (_npcinfo[e].x + 12);
float ydif = (yloc + 8) - (_npcinfo[e].y + 12);
@@ -7714,8 +7714,8 @@ void GriffonEngine::game_updspellsunder() {
damage = -damage;
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
game_damagenpc(e, damage, 1);
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndfire]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndfire]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -7733,8 +7733,8 @@ void GriffonEngine::game_updspellsunder() {
if (_player.hp > 0) {
game_damageplayer(damage);
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndfire]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndfire]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -7758,8 +7758,8 @@ void GriffonEngine::game_updspellsunder() {
_clipbg2->fillRect(rcSrc, 0);
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndfire]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndfire]);
Mix_Volume(snd, config.effectsvol);
}
@@ -7829,8 +7829,8 @@ void GriffonEngine::game_updspellsunder() {
if (_player.hp > 0) {
game_damageplayer(damage);
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndfire]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndfire]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -8172,7 +8172,7 @@ void GriffonEngine::sys_progress(int w, int wm) {
}
void GriffonEngine::sys_setupAudio() {
- menabled = true;
+ _menabled = true;
// FIXME
//Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 1024);
@@ -8203,7 +8203,7 @@ void GriffonEngine::sys_setupAudio() {
rcDest.top = 116 + 12 + 12;
rcDest.setHeight(8);
- if (menabled) {
+ if (_menabled) {
_mboss = Mix_LoadWAV("music/boss.ogg");
sys_progress(1, 21);
_mgardens = Mix_LoadWAV("music/gardens.ogg");
@@ -8219,35 +8219,35 @@ void GriffonEngine::sys_setupAudio() {
_mmenu = Mix_LoadWAV("music/menu.ogg");
sys_progress(7, 21);
- sfx[0] = Mix_LoadWAV("sfx/bite.ogg");
+ _sfx[0] = Mix_LoadWAV("_sfx/bite.ogg");
sys_progress(8, 21);
- sfx[1] = Mix_LoadWAV("sfx/crystal.ogg");
+ _sfx[1] = Mix_LoadWAV("_sfx/crystal.ogg");
sys_progress(9, 21);
- sfx[2] = Mix_LoadWAV("sfx/door.ogg");
+ _sfx[2] = Mix_LoadWAV("_sfx/door.ogg");
sys_progress(10, 21);
- sfx[3] = Mix_LoadWAV("sfx/enemyhit.ogg");
+ _sfx[3] = Mix_LoadWAV("_sfx/enemyhit.ogg");
sys_progress(11, 21);
- sfx[4] = Mix_LoadWAV("sfx/ice.ogg");
+ _sfx[4] = Mix_LoadWAV("_sfx/ice.ogg");
sys_progress(12, 21);
- sfx[5] = Mix_LoadWAV("sfx/lever.ogg");
+ _sfx[5] = Mix_LoadWAV("_sfx/lever.ogg");
sys_progress(13, 21);
- sfx[6] = Mix_LoadWAV("sfx/lightning.ogg");
+ _sfx[6] = Mix_LoadWAV("_sfx/lightning.ogg");
sys_progress(14, 21);
- sfx[7] = Mix_LoadWAV("sfx/metalhit.ogg");
+ _sfx[7] = Mix_LoadWAV("_sfx/metalhit.ogg");
sys_progress(15, 21);
- sfx[8] = Mix_LoadWAV("sfx/powerup.ogg");
+ _sfx[8] = Mix_LoadWAV("_sfx/powerup.ogg");
sys_progress(16, 21);
- sfx[9] = Mix_LoadWAV("sfx/rocks.ogg");
+ _sfx[9] = Mix_LoadWAV("_sfx/rocks.ogg");
sys_progress(17, 21);
- sfx[10] = Mix_LoadWAV("sfx/swordhit.ogg");
+ _sfx[10] = Mix_LoadWAV("_sfx/swordhit.ogg");
sys_progress(18, 21);
- sfx[11] = Mix_LoadWAV("sfx/throw.ogg");
+ _sfx[11] = Mix_LoadWAV("_sfx/throw.ogg");
sys_progress(19, 21);
- sfx[12] = Mix_LoadWAV("sfx/chest.ogg");
+ _sfx[12] = Mix_LoadWAV("_sfx/chest.ogg");
sys_progress(20, 21);
- sfx[13] = Mix_LoadWAV("sfx/fire.ogg");
+ _sfx[13] = Mix_LoadWAV("_sfx/fire.ogg");
sys_progress(21, 21);
- sfx[14] = Mix_LoadWAV("sfx/beep.ogg");
+ _sfx[14] = Mix_LoadWAV("_sfx/beep.ogg");
}
}
@@ -8340,8 +8340,8 @@ void GriffonEngine::sys_update() {
_player.sworddamage = _player.level * 14 / 10;
_player.spelldamage = _player.level * 13 / 10;
- if (menabled && config.effects) {
- int snd = Mix_PlayChannel(sfx[sndpowerup]);
+ if (_menabled && config.effects) {
+ int snd = Mix_PlayChannel(_sfx[sndpowerup]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -8387,7 +8387,7 @@ void GriffonEngine::sys_update() {
if (_roomlock == 1) {
_roomlock = 0;
- for (int i = 1; i <= lastnpc; i++)
+ for (int i = 1; i <= _lastnpc; i++)
if (_npcinfo[i].hp > 0)
_roomlock = 1;
}
@@ -8402,8 +8402,8 @@ void GriffonEngine::sys_update() {
_player.hpflashb = _player.hpflashb + 1;
if (_player.hpflashb == 2)
_player.hpflashb = 0;
- if (menabled && config.effects && _player.hpflashb == 0 && _player.hp < _player.maxhp / 4) {
- int snd = Mix_PlayChannel(sfx[sndbeep]);
+ if (_menabled && config.effects && _player.hpflashb == 0 && _player.hp < _player.maxhp / 4) {
+ int snd = Mix_PlayChannel(_sfx[sndbeep]);
Mix_Volume(snd, config.effectsvol);
}
}
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index 7ffc923..59174bc 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -47,11 +47,11 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
_shouldQuit = false;
- menabled = true;
- musicchannel = -1;
- menuchannel = -1;
+ _menabled = true; // TODO. Sync with config
+ _musicchannel = -1;
+ _menuchannel = -1;
- loopseta = 0;
+ _loopseta = 0;
clouddeg = 0.0f;
}
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index fcb0fa4..66815d3 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -418,28 +418,28 @@ private:
// npc info
NPCTYPE _npcinfo[kMaxNPC];
- int lastnpc;
+ int _lastnpc;
// music info
DataChunk *_mgardens, *_mgardens2, *_mgardens3, *_mgardens4, *_mboss, *_mmenu, *_mendofgame;
- bool menabled; // CHECKME: Always true?
- int musicchannel, menuchannel;
- int pgardens, pboss, ptown, pacademy, pcitadel;
- int loopseta;
+ bool _menabled; // CHECKME: Always true?
+ int _musicchannel, _menuchannel;
+ int _pgardens, _pboss, _ptown, _pacademy, _pcitadel;
+ int _loopseta;
- DataChunk *sfx[21];
+ DataChunk *_sfx[21];
Audio::SoundHandle _handles[SOUND_HANDLES];
Audio::Mixer *_mixer;
- // TODO: Check those variables, at least canusekey is a boolean, and the case is wrong in all the names
+ // TODO: Check those variables, at least _canusekey is a boolean, and the case is wrong in all the names
// room locks
- int _roomlocks[201], saidlocked, canusekey, locktype, roomtounlock, saidjammed;
+ int _roomlocks[201], _saidlocked, _canusekey, _locktype, _roomtounlock, _saidjammed;
// set to 1 for normal key, set to 2 for master, set to 0 if unlocked
// ysort
- int ysort[2401], lasty, firsty;
+ int _ysort[2401], _lasty, _firsty;
- int pmenu;
+ int _pmenu;
};
}
Commit: f00fd96e54722b62fc6fe910fa41f4215e09a924
https://github.com/scummvm/scummvm/commit/f00fd96e54722b62fc6fe910fa41f4215e09a924
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Turned defines into enums
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 6ee6807..b5b65a6 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -102,7 +102,7 @@ namespace Griffon {
void GriffonEngine::Mix_Volume(int channel, int volume) {}
int GriffonEngine::Mix_getHandle() {
- for (uint i = 0; i < SOUND_HANDLES; i++) {
+ for (uint i = 0; i < kSoundHandles; i++) {
if (!_mixer->isSoundHandleActive(_handles[i])) {
return i;
}
@@ -411,14 +411,14 @@ void GriffonEngine::game_attack() {
o = 10;
int oscript = _objectinfo[o][5];
- if (oscript == 0 && _player.inventory[INV_FLASK] < 9) {
- _player.inventory[INV_FLASK]++;
+ if (oscript == 0 && _player.inventory[kInvFlask] < 9) {
+ _player.inventory[kInvFlask]++;
game_addFloatIcon(6, lx * 16, (ly - 1) * 16);
_objmapf[_curmap][lx][ly - 1] = 1;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndpowerup]);
+ int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -430,9 +430,9 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 0 && _player.inventory[INV_FLASK] == 9) {
+ if (oscript == 0 && _player.inventory[kInvFlask] == 9) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndchest]);
+ int snd = Mix_PlayChannel(_sfx[kSndChest]);
Mix_Volume(snd, config.effectsvol);
}
@@ -442,7 +442,7 @@ void GriffonEngine::game_attack() {
}
if (oscript == 2) {
- _player.inventory[INV_MASTERKEY]++;
+ _player.inventory[kInvMasterKey]++;
game_addFloatIcon(14, lx * 16, (ly - 1) * 16);
@@ -456,7 +456,7 @@ void GriffonEngine::game_attack() {
_scriptflag[13][0] = 2;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndpowerup]);
+ int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -473,7 +473,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(7, lx * 16, (ly - 1) * 16);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndpowerup]);
+ int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -493,7 +493,7 @@ void GriffonEngine::game_attack() {
_itemticks = _ticks + 215;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndpowerup]);
+ int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -513,7 +513,7 @@ void GriffonEngine::game_attack() {
_itemticks = _ticks + 215;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndpowerup]);
+ int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -524,8 +524,8 @@ void GriffonEngine::game_attack() {
}
if (oscript == 6) {
- if (_player.inventory[INV_NORMALKEY] < 9) {
- _player.inventory[INV_NORMALKEY]++;
+ if (_player.inventory[kInvNormalKey] < 9) {
+ _player.inventory[kInvNormalKey]++;
for (int s = 20; s <= 23; s++) {
if (_scriptflag[s][0] == 1) {
@@ -534,7 +534,7 @@ void GriffonEngine::game_attack() {
}
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndpowerup]);
+ int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -547,7 +547,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(16, lx * 16, (ly - 1) * 16);
} else {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndchest]);
+ int snd = Mix_PlayChannel(_sfx[kSndChest]);
Mix_Volume(snd, config.effectsvol);
}
@@ -555,14 +555,14 @@ void GriffonEngine::game_attack() {
}
}
- if (oscript == 7 && _player.inventory[INV_DOUBLEFLASK] < 9) {
- _player.inventory[INV_DOUBLEFLASK]++;
+ if (oscript == 7 && _player.inventory[kInvDoubleFlask] < 9) {
+ _player.inventory[kInvDoubleFlask]++;
game_addFloatIcon(12, lx * 16, (ly - 1) * 16);
_objmapf[_curmap][lx][ly - 1] = 1;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndpowerup]);
+ int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -574,9 +574,9 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 7 && _player.inventory[INV_DOUBLEFLASK] == 9) {
+ if (oscript == 7 && _player.inventory[kInvDoubleFlask] == 9) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndchest]);
+ int snd = Mix_PlayChannel(_sfx[kSndChest]);
Mix_Volume(snd, config.effectsvol);
}
@@ -585,14 +585,14 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 10 && _player.inventory[INV_DOUBLEFLASK] < 9) {
- _player.inventory[INV_DOUBLEFLASK]++;
+ if (oscript == 10 && _player.inventory[kInvDoubleFlask] < 9) {
+ _player.inventory[kInvDoubleFlask]++;
game_addFloatIcon(12, lx * 16, (ly - 1) * 16);
_objmapf[_curmap][lx][ly - 1] = 1;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndpowerup]);
+ int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -604,9 +604,9 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 10 && _player.inventory[INV_DOUBLEFLASK] == 9) {
+ if (oscript == 10 && _player.inventory[kInvDoubleFlask] == 9) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndchest]);
+ int snd = Mix_PlayChannel(_sfx[kSndChest]);
Mix_Volume(snd, config.effectsvol);
}
@@ -615,14 +615,14 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 11 && _player.inventory[INV_SHOCK] < 9) {
- _player.inventory[INV_SHOCK]++;
+ if (oscript == 11 && _player.inventory[kInvShock] < 9) {
+ _player.inventory[kInvShock]++;
game_addFloatIcon(17, lx * 16, (ly - 1) * 16);
_objmapf[_curmap][lx][ly - 1] = 1;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndpowerup]);
+ int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -634,9 +634,9 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 11 && _player.inventory[INV_SHOCK] == 9) {
+ if (oscript == 11 && _player.inventory[kInvShock] == 9) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndchest]);
+ int snd = Mix_PlayChannel(_sfx[kSndChest]);
Mix_Volume(snd, config.effectsvol);
}
@@ -651,7 +651,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(5, lx * 16, (ly - 1) * 16);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndpowerup]);
+ int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -668,13 +668,13 @@ void GriffonEngine::game_attack() {
_scriptflag[60][0] = 1;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndlever]);
+ int snd = Mix_PlayChannel(_sfx[kSndLever]);
Mix_Volume(snd, config.effectsvol);
}
} else if (_curmap == 58 && _scriptflag[60][0] > 0) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[snddoor]);
+ int snd = Mix_PlayChannel(_sfx[kSndDoor]);
Mix_Volume(snd, config.effectsvol);
}
@@ -683,14 +683,14 @@ void GriffonEngine::game_attack() {
if (_curmap == 54 && _scriptflag[60][0] == 1) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndlever]);
+ int snd = Mix_PlayChannel(_sfx[kSndLever]);
Mix_Volume(snd, config.effectsvol);
}
_scriptflag[60][0] = 2;
} else if (_curmap == 54 && _scriptflag[60][0] > 1) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[snddoor]);
+ int snd = Mix_PlayChannel(_sfx[kSndDoor]);
Mix_Volume(snd, config.effectsvol);
}
@@ -707,7 +707,7 @@ void GriffonEngine::game_attack() {
_itemticks = _ticks + 215;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndpowerup]);
+ int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -724,7 +724,7 @@ void GriffonEngine::game_attack() {
_itemticks = _ticks + 215;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndpowerup]);
+ int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -741,7 +741,7 @@ void GriffonEngine::game_attack() {
_itemticks = _ticks + 215;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndpowerup]);
+ int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -838,13 +838,13 @@ void GriffonEngine::game_castspell(int spellnum, float homex, float homey, float
if (_menabled && config.effects) {
if (spellnum == 1) {
- int snd = Mix_PlayChannel(_sfx[sndthrow]);
+ int snd = Mix_PlayChannel(_sfx[kSndThrow]);
Mix_Volume(snd, config.effectsvol);
} else if (spellnum == 5) {
- int snd = Mix_PlayChannel(_sfx[sndcrystal]);
+ int snd = Mix_PlayChannel(_sfx[kSndCrystal]);
Mix_Volume(snd, config.effectsvol);
} else if (spellnum == 8 || spellnum == 9) {
- int snd = Mix_PlayChannel(_sfx[sndlightning]);
+ int snd = Mix_PlayChannel(_sfx[kSndLightning]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -892,7 +892,7 @@ void GriffonEngine::game_checkhit() {
if (hit) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndswordhit]);
+ int snd = Mix_PlayChannel(_sfx[kSndSwordHit]);
Mix_Volume(snd, config.effectsvol);
}
@@ -946,7 +946,7 @@ void GriffonEngine::game_checkinputs() {
game_attack();
if (_itemselon == 1 && _itemticks < _ticks) {
- if (_curitem == 0 && _player.inventory[INV_FLASK] > 0) {
+ if (_curitem == 0 && _player.inventory[kInvFlask] > 0) {
_itemticks = _ticks + ntickdelay;
int heal = 50;
@@ -961,10 +961,10 @@ void GriffonEngine::game_checkinputs() {
sprintf(text, "+%i", heal);
game_addFloatText(text, _player.px + 16 - 4 * strlen(text), _player.py + 16, 5);
- _player.inventory[INV_FLASK]--;
+ _player.inventory[kInvFlask]--;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndpowerup]);
+ int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -972,7 +972,7 @@ void GriffonEngine::game_checkinputs() {
_forcepause = false;
}
- if (_curitem == 1 && _player.inventory[INV_DOUBLEFLASK] > 0) {
+ if (_curitem == 1 && _player.inventory[kInvDoubleFlask] > 0) {
_itemticks = _ticks + ntickdelay;
int heal = 200;
@@ -987,10 +987,10 @@ void GriffonEngine::game_checkinputs() {
sprintf(text, "+%i", heal);
game_addFloatText(text, _player.px + 16 - 4 * strlen(text), _player.py + 16, 5);
- _player.inventory[INV_DOUBLEFLASK]--;
+ _player.inventory[kInvDoubleFlask]--;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndpowerup]);
+ int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -998,12 +998,12 @@ void GriffonEngine::game_checkinputs() {
_forcepause = false;
}
- if (_curitem == 2 && _player.inventory[INV_SHOCK] > 0) {
+ if (_curitem == 2 && _player.inventory[kInvShock] > 0) {
game_castspell(8, _player.px, _player.py, _npcinfo[_curenemy].x, _npcinfo[_curenemy].y, 0);
_forcepause = true;
- _player.inventory[INV_SHOCK]--;
+ _player.inventory[kInvShock]--;
_itemticks = _ticks + ntickdelay;
_selenemyon = 0;
@@ -1011,11 +1011,11 @@ void GriffonEngine::game_checkinputs() {
}
- if (_curitem == 3 && _player.inventory[INV_NORMALKEY] > 0 && _canusekey == 1 && _locktype == 1) {
+ if (_curitem == 3 && _player.inventory[kInvNormalKey] > 0 && _canusekey == 1 && _locktype == 1) {
_roomlocks[_roomtounlock] = 0;
game_eventtext("UnLocked!");
- _player.inventory[INV_NORMALKEY]--;
+ _player.inventory[kInvNormalKey]--;
_itemticks = _ticks + ntickdelay;
_selenemyon = 0;
@@ -1023,11 +1023,11 @@ void GriffonEngine::game_checkinputs() {
return;
}
- if (_curitem == 4 && _player.inventory[INV_MASTERKEY] > 0 && _canusekey == 1 && _locktype == 2) {
+ if (_curitem == 4 && _player.inventory[kInvMasterKey] > 0 && _canusekey == 1 && _locktype == 2) {
_roomlocks[_roomtounlock] = 0;
game_eventtext("UnLocked!");
- _player.inventory[INV_MASTERKEY]--;
+ _player.inventory[kInvMasterKey]--;
_itemticks = _ticks + ntickdelay;
_selenemyon = 0;
@@ -1425,7 +1425,7 @@ void GriffonEngine::game_configmenu() {
Mix_Volume(_menuchannel, config.musicvol);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[snddoor]);
+ int snd = Mix_PlayChannel(_sfx[kSndDoor]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -1448,7 +1448,7 @@ void GriffonEngine::game_configmenu() {
Mix_Volume(_menuchannel, config.musicvol);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[snddoor]);
+ int snd = Mix_PlayChannel(_sfx[kSndDoor]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -1551,7 +1551,7 @@ void GriffonEngine::game_configmenu() {
if (cursel == 9 && config.effects == 0) {
config.effects = 1;
if (_menabled == 1) {
- int snd = Mix_PlayChannel(_sfx[snddoor]);
+ int snd = Mix_PlayChannel(_sfx[kSndDoor]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -2831,7 +2831,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (_player.hp > 0) {
game_damageplayer(damage);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndfire]);
+ int snd = Mix_PlayChannel(_sfx[kSndFire]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -2857,7 +2857,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (_player.hp > 0) {
game_damageplayer(damage);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndfire]);
+ int snd = Mix_PlayChannel(_sfx[kSndFire]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -3672,38 +3672,38 @@ void GriffonEngine::game_handlewalking() {
if (o > -1) {
// fsk
- if (_objectinfo[o][4] == 2 && _player.inventory[INV_FLASK] < 9) {
+ if (_objectinfo[o][4] == 2 && _player.inventory[kInvFlask] < 9) {
_objmap[lx][ly] = -1;
- _player.inventory[INV_FLASK]++;
+ _player.inventory[kInvFlask]++;
game_addFloatIcon(6, lx * 16, ly * 16);
_objmapf[_curmap][lx][ly] = 1;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndpowerup]);
+ int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
}
- if (_objectinfo[o][5] == 7 && _player.inventory[INV_DOUBLEFLASK] < 9) {
+ if (_objectinfo[o][5] == 7 && _player.inventory[kInvDoubleFlask] < 9) {
_objmap[lx][ly] = -1;
- _player.inventory[INV_DOUBLEFLASK]++;
+ _player.inventory[kInvDoubleFlask]++;
game_addFloatIcon(12, lx * 16, ly * 16);
_objmapf[_curmap][lx][ly] = 1;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndpowerup]);
+ int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
}
- if (_objectinfo[o][5] == 9 && _player.inventory[INV_SHOCK] < 9 && (_curmap == 41 && _scriptflag[9][1] == 0)) {
+ if (_objectinfo[o][5] == 9 && _player.inventory[kInvShock] < 9 && (_curmap == 41 && _scriptflag[9][1] == 0)) {
_objmap[lx][ly] = -1;
- _player.inventory[INV_SHOCK]++;
+ _player.inventory[kInvShock]++;
game_addFloatIcon(17, lx * 16, ly * 16);
_objmapf[_curmap][lx][ly] = 1;
@@ -3711,22 +3711,22 @@ void GriffonEngine::game_handlewalking() {
_scriptflag[9][1] = 1;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndpowerup]);
+ int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
}
- if (_objectinfo[o][5] == 9 && _player.inventory[INV_SHOCK] < 9) {
+ if (_objectinfo[o][5] == 9 && _player.inventory[kInvShock] < 9) {
_objmap[lx][ly] = -1;
- _player.inventory[INV_SHOCK]++;
+ _player.inventory[kInvShock]++;
game_addFloatIcon(17, lx * 16, ly * 16);
_objmapf[_curmap][lx][ly] = 1;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndpowerup]);
+ int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -4804,7 +4804,7 @@ void GriffonEngine::game_processtrigger(int trignum) {
if (tmap > 0) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[snddoor]);
+ int snd = Mix_PlayChannel(_sfx[kSndDoor]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6005,7 +6005,7 @@ void GriffonEngine::game_updnpcs() {
_npcinfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndenemyhit]);
+ int snd = Mix_PlayChannel(_sfx[kSndEnemyHit]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6032,7 +6032,7 @@ void GriffonEngine::game_updnpcs() {
if ((dist) < 24) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndbite]);
+ int snd = Mix_PlayChannel(_sfx[kSndBite]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6138,7 +6138,7 @@ void GriffonEngine::game_updnpcs() {
if ((dist) < 36) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndbite]);
+ int snd = Mix_PlayChannel(_sfx[kSndBite]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6318,7 +6318,7 @@ void GriffonEngine::game_updnpcs() {
if ((dist) < 24) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndbite]);
+ int snd = Mix_PlayChannel(_sfx[kSndBite]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6392,7 +6392,7 @@ void GriffonEngine::game_updnpcs() {
_npcinfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndenemyhit]);
+ int snd = Mix_PlayChannel(_sfx[kSndEnemyHit]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6417,7 +6417,7 @@ void GriffonEngine::game_updnpcs() {
_npcinfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndice]);
+ int snd = Mix_PlayChannel(_sfx[kSndIce]);
Mix_Volume(snd, config.effectsvol);
}
_npcinfo[i].attacking = 1;
@@ -6798,7 +6798,7 @@ void GriffonEngine::game_updspells() {
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
game_damagenpc(e, damage, 1);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndice]);
+ int snd = Mix_PlayChannel(_sfx[kSndIce]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -6826,7 +6826,7 @@ void GriffonEngine::game_updspells() {
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndice]);
+ int snd = Mix_PlayChannel(_sfx[kSndIce]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -6877,7 +6877,7 @@ void GriffonEngine::game_updspells() {
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
game_damagenpc(e, damage, 1);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndmetalhit]);
+ int snd = Mix_PlayChannel(_sfx[kSndMetalHit]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -6920,7 +6920,7 @@ void GriffonEngine::game_updspells() {
if (_player.hp > 0) {
game_damageplayer(damage);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndmetalhit]);
+ int snd = Mix_PlayChannel(_sfx[kSndMetalHit]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -6948,7 +6948,7 @@ void GriffonEngine::game_updspells() {
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndmetalhit]);
+ int snd = Mix_PlayChannel(_sfx[kSndMetalHit]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -6999,7 +6999,7 @@ void GriffonEngine::game_updspells() {
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
game_damagenpc(e, damage, 1);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndrocks]);
+ int snd = Mix_PlayChannel(_sfx[kSndRocks]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -7028,7 +7028,7 @@ void GriffonEngine::game_updspells() {
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndrocks]);
+ int snd = Mix_PlayChannel(_sfx[kSndRocks]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -7227,7 +7227,7 @@ void GriffonEngine::game_updspells() {
game_damageplayer(damage);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndfire]);
+ int snd = Mix_PlayChannel(_sfx[kSndFire]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -7715,7 +7715,7 @@ void GriffonEngine::game_updspellsunder() {
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
game_damagenpc(e, damage, 1);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndfire]);
+ int snd = Mix_PlayChannel(_sfx[kSndFire]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -7734,7 +7734,7 @@ void GriffonEngine::game_updspellsunder() {
game_damageplayer(damage);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndfire]);
+ int snd = Mix_PlayChannel(_sfx[kSndFire]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -7759,7 +7759,7 @@ void GriffonEngine::game_updspellsunder() {
_clipbg2->fillRect(rcSrc, 0);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndfire]);
+ int snd = Mix_PlayChannel(_sfx[kSndFire]);
Mix_Volume(snd, config.effectsvol);
}
@@ -7830,7 +7830,7 @@ void GriffonEngine::game_updspellsunder() {
if (_player.hp > 0) {
game_damageplayer(damage);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndfire]);
+ int snd = Mix_PlayChannel(_sfx[kSndFire]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -8341,7 +8341,7 @@ void GriffonEngine::sys_update() {
_player.spelldamage = _player.level * 13 / 10;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[sndpowerup]);
+ int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -8403,7 +8403,7 @@ void GriffonEngine::sys_update() {
if (_player.hpflashb == 2)
_player.hpflashb = 0;
if (_menabled && config.effects && _player.hpflashb == 0 && _player.hp < _player.maxhp / 4) {
- int snd = Mix_PlayChannel(_sfx[sndbeep]);
+ int snd = Mix_PlayChannel(_sfx[kSndBeep]);
Mix_Volume(snd, config.effectsvol);
}
}
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 66815d3..e07b912 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -49,41 +49,46 @@ namespace Griffon {
class Console;
-#define SOUND_HANDLES 16
-
+#define kSoundHandles 16
#define kMaxNPC 32
#define kMaxFloat 32
#define kMaxSpell 32
// spells
-#define kSpellIce 0
-#define kSpellSteel 1
-#define kSpellWood 2
-#define kSpellRock 3
-#define kSpellFire 4
+enum {
+ kSpellIce = 0,
+ kSpellSteel,
+ kSpellWood,
+ kSpellRock,
+ kSpellFire
+};
// inventory items
-#define INV_FLASK 0
-#define INV_DOUBLEFLASK 1
-#define INV_SHOCK 2
-#define INV_NORMALKEY 3
-#define INV_MASTERKEY 4
-
-#define sndbite 0
-#define sndcrystal 1
-#define snddoor 2
-#define sndenemyhit 3
-#define sndice 4
-#define sndlever 5
-#define sndlightning 6
-#define sndmetalhit 7
-#define sndpowerup 8
-#define sndrocks 9
-#define sndswordhit 10
-#define sndthrow 11
-#define sndchest 12
-#define sndfire 13
-#define sndbeep 14
+enum {
+ kInvFlask = 0,
+ kInvDoubleFlask,
+ kInvShock,
+ kInvNormalKey,
+ kInvMasterKey
+};
+
+enum {
+ kSndBite = 0,
+ kSndCrystal,
+ kSndDoor,
+ kSndEnemyHit,
+ kSndIce,
+ kSndLever,
+ kSndLightning,
+ kSndMetalHit,
+ kSndPowerUp,
+ kSndRocks,
+ kSndSwordHit,
+ kSndThrow,
+ kSndChest,
+ kSndFire,
+ kSndBeep
+};
#define kEpsilon 0.001
@@ -326,7 +331,6 @@ private:
Graphics::TransparentSurface *_mapbg, *_clipbg, *_clipbg2;
unsigned int _clipsurround[4][4];
- int fullscreen;
float _animspd; // CHECKME: it seems to always be 0.5
int _rampdata[40][24];
@@ -428,7 +432,7 @@ private:
int _loopseta;
DataChunk *_sfx[21];
- Audio::SoundHandle _handles[SOUND_HANDLES];
+ Audio::SoundHandle _handles[kSoundHandles];
Audio::Mixer *_mixer;
// TODO: Check those variables, at least _canusekey is a boolean, and the case is wrong in all the names
Commit: 0873e6ef4ed3cbd41214328978cd75b7209b57db
https://github.com/scummvm/scummvm/commit/0873e6ef4ed3cbd41214328978cd75b7209b57db
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Rename data types
Changed paths:
engines/griffon/griffon.h
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index e07b912..75a3eeb 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -92,7 +92,7 @@ enum {
#define kEpsilon 0.001
-struct PLAYERTYPE {
+struct Player {
float px;
float py;
float opx;
@@ -129,7 +129,7 @@ struct PLAYERTYPE {
int ysort;
};
-struct BODYSECTIONTYPE {
+struct BodySection {
float x;
float y;
int parentID;
@@ -138,7 +138,7 @@ struct BODYSECTIONTYPE {
int bonelength; // the 'bone' that connects the body sections
};
-struct NPCTYPE {
+struct NPC {
float x;
float y;
int spriteset;
@@ -182,7 +182,7 @@ struct NPCTYPE {
// one wing and firehydra specific
- BODYSECTIONTYPE bodysection[31];
+ BodySection bodysection[31];
float swayangle;
float swayspd;
float headtargetx[4];
@@ -198,7 +198,7 @@ struct NPCTYPE {
float floating;
};
-struct SPELLTYPE {
+struct Spell {
int spellnum;
float homex;
float homey;
@@ -227,7 +227,7 @@ struct SPELLTYPE {
int npc;
};
-struct ANIMSET2TYPE {
+struct AnimSet {
int x; // xyloc on spriteimageset
int y;
int xofs; // the actual place to paste the sprite in reference to the bodypart loc on screen
@@ -373,13 +373,13 @@ private:
int cloudson;
// spell info
- SPELLTYPE spellinfo[kMaxSpell];
+ Spell spellinfo[kMaxSpell];
// player info
int movingup, movingdown, movingleft, movingright;
- PLAYERTYPE _player;
+ Player _player;
bool attacking;
- PLAYERTYPE _playera;
+ Player _playera;
int _asecstart;
// tile info
@@ -399,7 +399,7 @@ private:
float _floaticon[kMaxFloat][4]; // [id] [framesleft, x, y, ico]
// special for animset2
- ANIMSET2TYPE _animset2[7], _animset9[7];
+ AnimSet _animset2[7], _animset9[7];
// object info
float _objectframe[256][2];
@@ -421,7 +421,7 @@ private:
int _triggerloc[320][240], _ntriggers;
// npc info
- NPCTYPE _npcinfo[kMaxNPC];
+ NPC _npcinfo[kMaxNPC];
int _lastnpc;
// music info
Commit: 1714d20a4fa04d9efba67d7705f48f70271279a0
https://github.com/scummvm/scummvm/commit/1714d20a4fa04d9efba67d7705f48f70271279a0
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Turn some more variables to boolean, rename some variables
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.h
engines/griffon/saveload.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index b5b65a6..5088a28 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -1011,8 +1011,8 @@ void GriffonEngine::game_checkinputs() {
}
- if (_curitem == 3 && _player.inventory[kInvNormalKey] > 0 && _canusekey == 1 && _locktype == 1) {
- _roomlocks[_roomtounlock] = 0;
+ if (_curitem == 3 && _player.inventory[kInvNormalKey] > 0 && _canUseKey && _lockType == 1) {
+ _roomLocks[_roomToUnlock] = 0;
game_eventtext("UnLocked!");
_player.inventory[kInvNormalKey]--;
@@ -1023,8 +1023,8 @@ void GriffonEngine::game_checkinputs() {
return;
}
- if (_curitem == 4 && _player.inventory[kInvMasterKey] > 0 && _canusekey == 1 && _locktype == 2) {
- _roomlocks[_roomtounlock] = 0;
+ if (_curitem == 4 && _player.inventory[kInvMasterKey] > 0 && _canUseKey && _lockType == 2) {
+ _roomLocks[_roomToUnlock] = 0;
game_eventtext("UnLocked!");
_player.inventory[kInvMasterKey]--;
@@ -1211,7 +1211,7 @@ void GriffonEngine::game_checktrigger() {
int lx = (int)npx / 16;
int ly = (int)npy / 16;
- _canusekey = 0;
+ _canUseKey = false;
if (_triggerloc[lx][ly] > -1)
game_processtrigger(_triggerloc[lx][ly]);
@@ -4682,15 +4682,15 @@ __exit_do:
memset(_scriptflag, 0, sizeof(_scriptflag));
memset(_objmapf, 0, sizeof(_objmapf));
- memset(_roomlocks, 0, sizeof(_roomlocks));
+ memset(_roomLocks, 0, sizeof(_roomLocks));
- _roomlocks[66] = 2;
- _roomlocks[24] = 2;
- _roomlocks[17] = 1;
- _roomlocks[34] = 1;
- _roomlocks[50] = 1;
- _roomlocks[73] = 1;
- _roomlocks[82] = 2;
+ _roomLocks[66] = 2;
+ _roomLocks[24] = 2;
+ _roomLocks[17] = 1;
+ _roomLocks[34] = 1;
+ _roomLocks[50] = 1;
+ _roomLocks[73] = 1;
+ _roomLocks[82] = 2;
_player.walkspd = 1.1f;
_animspd = 0.5f;
@@ -4713,11 +4713,11 @@ __exit_do:
_player.py = 6 * 16 - 4;
_player.walkdir = 1;
- _pgardens = 0;
- _ptown = 0;
- _pboss = 0;
- _pacademy = 0;
- _pcitadel = 0;
+ _pgardens = false;
+ _ptown = false;
+ _pboss = false;
+ _pacademy = false;
+ _pcitadel = false;
game_loadmap(2);
@@ -4727,9 +4727,9 @@ __exit_do:
void GriffonEngine::game_playgame() {
game_swash();
- if (_pmenu == 1 && _menabled) {
+ if (_pmenu && _menabled) {
Mix_HaltChannel(_menuchannel);
- _pmenu = 0;
+ _pmenu = false;
}
do {
@@ -4767,25 +4767,25 @@ void GriffonEngine::game_processtrigger(int trignum) {
int tmap = _triggers[trignum][3];
int tjumpstyle = _triggers[trignum][4];
- if (_roomlocks[tmap] > 0) {
- if (_saidlocked == 0)
+ if (_roomLocks[tmap] > 0) {
+ if (!_saidLocked)
game_eventtext("Locked");
- _saidlocked = 1;
- _canusekey = 1;
- _locktype = _roomlocks[tmap];
- _roomtounlock = tmap;
+ _saidLocked = true;
+ _canUseKey = true;
+ _lockType = _roomLocks[tmap];
+ _roomToUnlock = tmap;
return;
}
if (tmap == 1) {
- if (_saidjammed == 0)
+ if (!_saidJammed)
game_eventtext("Door Jammed!");
- _saidjammed = 1;
+ _saidJammed = true;
return;
}
- _saidlocked = 0;
- _saidjammed = 0;
+ _saidLocked = false;
+ _saidJammed = false;
// loc-sxy+oldmaploc
if (tjumpstyle == 0) {
@@ -4919,11 +4919,11 @@ void GriffonEngine::game_saveloadnew() {
attacking = false;
_player.attackspd = 1.5f;
- _pgardens = 0;
- _ptown = 0;
- _pboss = 0;
- _pacademy = 0;
- _pcitadel = 0;
+ _pgardens = false;
+ _ptown = false;
+ _pboss = false;
+ _pacademy = false;
+ _pcitadel = false;
Mix_HaltChannel(-1);
@@ -5339,10 +5339,10 @@ void GriffonEngine::game_title(int mode) {
_menuchannel = Mix_PlayChannel(_mmenu, true);
Mix_Volume(_menuchannel, config.musicvol);
- _pmenu = 1;
+ _pmenu = true;
}
- int ldstop = 0;
+ bool ldstop = false;
float ld = 0;
do {
@@ -5351,10 +5351,10 @@ void GriffonEngine::game_title(int mode) {
ld += 4.0 * _fpsr;
if (ld > config.musicvol)
ld = config.musicvol;
- if (_menabled && ldstop == 0) {
+ if (_menabled && !ldstop) {
Mix_Volume(_menuchannel, (int)ld);
if ((int)ld == config.musicvol)
- ldstop = 1;
+ ldstop = true;
}
rc.left = -xofs;
@@ -5476,7 +5476,7 @@ void GriffonEngine::game_title(int mode) {
Mix_HaltChannel(_menuchannel);
Mix_Resume(_musicchannel);
Mix_Volume(_musicchannel, config.musicvol);
- _pmenu = 0;
+ _pmenu = false;
}
}
@@ -5554,34 +5554,34 @@ void GriffonEngine::game_updmusic() {
if (iplaysound != NULL) {
Mix_HaltChannel(_musicchannel);
- _pboss = 0;
- _pgardens = 0;
- _ptown = 0;
- _pacademy = 0;
- _pcitadel = 0;
+ _pboss = false;
+ _pgardens = false;
+ _ptown = false;
+ _pacademy = false;
+ _pcitadel = false;
if (iplaysound == _mboss)
- _pboss = 1;
+ _pboss = true;
if (iplaysound == _mgardens)
- _pgardens = 1;
+ _pgardens = true;
_musicchannel = Mix_PlayChannel(iplaysound, true);
Mix_Volume(_musicchannel, config.musicvol);
} else {
if (!Mix_Playing(_musicchannel)) {
- _loopseta = _loopseta + 1;
+ _loopseta += 1;
if (_loopseta == 4)
_loopseta = 0;
- if (_pgardens == 1) {
+ if (_pgardens) {
Mix_HaltChannel(_musicchannel);
- if (_pgardens == 1 && _loopseta == 0)
+ if (_pgardens && _loopseta == 0)
_musicchannel = Mix_PlayChannel(_mgardens);
- if (_pgardens == 1 && _loopseta == 1)
+ if (_pgardens && _loopseta == 1)
_musicchannel = Mix_PlayChannel(_mgardens2);
- if (_pgardens == 1 && _loopseta == 2)
+ if (_pgardens && _loopseta == 2)
_musicchannel = Mix_PlayChannel(_mgardens3);
- if (_pgardens == 1 && _loopseta == 3)
+ if (_pgardens && _loopseta == 3)
_musicchannel = Mix_PlayChannel(_mgardens4);
}
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 75a3eeb..559236e 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -428,22 +428,28 @@ private:
DataChunk *_mgardens, *_mgardens2, *_mgardens3, *_mgardens4, *_mboss, *_mmenu, *_mendofgame;
bool _menabled; // CHECKME: Always true?
int _musicchannel, _menuchannel;
- int _pgardens, _pboss, _ptown, _pacademy, _pcitadel;
+ bool _ptown, _pacademy, _pcitadel; // CHECKME: They look unused.
+ bool _pboss;
+ bool _pgardens;
int _loopseta;
DataChunk *_sfx[21];
Audio::SoundHandle _handles[kSoundHandles];
Audio::Mixer *_mixer;
- // TODO: Check those variables, at least _canusekey is a boolean, and the case is wrong in all the names
- // room locks
- int _roomlocks[201], _saidlocked, _canusekey, _locktype, _roomtounlock, _saidjammed;
// set to 1 for normal key, set to 2 for master, set to 0 if unlocked
+ int _roomLocks[201], _lockType;
+ int _roomToUnlock;
+
+ bool _canUseKey;
+ bool _saidLocked;
+ bool _saidJammed;
+
// ysort
int _ysort[2401], _lasty, _firsty;
- int _pmenu;
+ bool _pmenu;
};
}
diff --git a/engines/griffon/saveload.cpp b/engines/griffon/saveload.cpp
index 6295890..2ff71d0 100644
--- a/engines/griffon/saveload.cpp
+++ b/engines/griffon/saveload.cpp
@@ -117,7 +117,7 @@ int GriffonEngine::state_load(int slotnum) {
}
for (int a = 0; a <= 200; a++) {
- INPUT("%i", &_roomlocks[a]);
+ INPUT("%i", &_roomLocks[a]);
}
INPUT("%f", &_player.spellstrength);
@@ -242,7 +242,7 @@ int GriffonEngine::state_save(int slotnum) {
}
for (int a = 0; a <= 200; a++) {
- PRINT("%i", _roomlocks[a]);
+ PRINT("%i", _roomLocks[a]);
}
PRINT("%f", _player.spellstrength);
Commit: abc99b86eaced1a5fc07b30e3382fad40c614217
https://github.com/scummvm/scummvm/commit/abc99b86eaced1a5fc07b30e3382fad40c614217
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Some more renaming and refactoring
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 5088a28..21477af 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -399,18 +399,18 @@ void GriffonEngine::game_attack() {
if (_player.walkdir == 0) {
if (ly > 0) {
int o2 = 0; // ??
- int o = _objmap[lx][ly - 1];
+ int o = _objectMap[lx][ly - 1];
if (ly > 1 && _curmap == 58)
- o2 = _objmap[lx][ly - 2];
+ o2 = _objectMap[lx][ly - 2];
if (ly > 1 && _curmap == 54)
- o2 = _objmap[lx][ly - 2];
+ o2 = _objectMap[lx][ly - 2];
// cst
- if ((_objectinfo[o][4] == 1 && (o == 0 || o > 4)) || (_objectinfo[o2][4] == 0 && o2 == 10)) {
+ if ((_objectInfo[o][4] == 1 && (o == 0 || o > 4)) || (_objectInfo[o2][4] == 0 && o2 == 10)) {
if (o2 == 10)
o = 10;
- int oscript = _objectinfo[o][5];
+ int oscript = _objectInfo[o][5];
if (oscript == 0 && _player.inventory[kInvFlask] < 9) {
_player.inventory[kInvFlask]++;
game_addFloatIcon(6, lx * 16, (ly - 1) * 16);
@@ -422,8 +422,8 @@ void GriffonEngine::game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (_objectinfo[o][4] == 1)
- _objmap[lx][ly - 1] = 3;
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
game_eventtext("Found Flask!");
_itemticks = _ticks + 215;
@@ -460,8 +460,8 @@ void GriffonEngine::game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (_objectinfo[o][4] == 1)
- _objmap[lx][ly - 1] = 3;
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
game_eventtext("Found the Temple Key!");
return;
}
@@ -477,8 +477,8 @@ void GriffonEngine::game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (_objectinfo[o][4] == 1)
- _objmap[lx][ly - 1] = 3;
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
game_eventtext("Found the Infinite Crystal!");
_itemticks = _ticks + 215;
@@ -497,8 +497,8 @@ void GriffonEngine::game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (_objectinfo[o][4] == 1)
- _objmap[lx][ly - 1] = 3;
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
game_eventtext("Found the Obsidian Shield!");
_objmapf[4][1][2] = 1;
@@ -517,8 +517,8 @@ void GriffonEngine::game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (_objectinfo[o][4] == 1)
- _objmap[lx][ly - 1] = 3;
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
game_eventtext("Found the Fidelis Sword!");
return;
}
@@ -540,8 +540,8 @@ void GriffonEngine::game_attack() {
_objmapf[_curmap][lx][ly - 1] = 1;
- if (_objectinfo[o][4] == 1)
- _objmap[lx][ly - 1] = 3;
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
game_eventtext("Found Key");
game_addFloatIcon(16, lx * 16, (ly - 1) * 16);
@@ -566,8 +566,8 @@ void GriffonEngine::game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (_objectinfo[o][4] == 1)
- _objmap[lx][ly - 1] = 3;
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
game_eventtext("Found Mega Flask!");
_itemticks = _ticks + 215;
@@ -596,8 +596,8 @@ void GriffonEngine::game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (_objectinfo[o][4] == 1)
- _objmap[lx][ly - 1] = 3;
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
game_eventtext("Found Mega Flask!");
_itemticks = _ticks + 215;
@@ -626,8 +626,8 @@ void GriffonEngine::game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (_objectinfo[o][4] == 1)
- _objmap[lx][ly - 1] = 3;
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
game_eventtext("Found Lightning Bomb!");
_itemticks = _ticks + 215;
@@ -655,8 +655,8 @@ void GriffonEngine::game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (_objectinfo[o][4] == 1)
- _objmap[lx][ly - 1] = 3;
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
game_eventtext("Found the Fidelis Mail!");
_itemticks = _ticks + 215;
@@ -711,8 +711,8 @@ void GriffonEngine::game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (_objectinfo[o][4] == 1)
- _objmap[lx][ly - 1] = 3;
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
game_eventtext("Found the Blood Sword!");
_objmapf[4][1][2] = 1;
return;
@@ -728,8 +728,8 @@ void GriffonEngine::game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (_objectinfo[o][4] == 1)
- _objmap[lx][ly - 1] = 3;
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
game_eventtext("Found the Entropy Shield!");
_objmapf[4][1][2] = 1;
return;
@@ -745,8 +745,8 @@ void GriffonEngine::game_attack() {
Mix_Volume(snd, config.effectsvol);
}
- if (_objectinfo[o][4] == 1)
- _objmap[lx][ly - 1] = 3;
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
game_eventtext("Found the Rubyscale Armour!");
_objmapf[4][1][2] = 1;
return;
@@ -758,10 +758,10 @@ void GriffonEngine::game_attack() {
attacking = true;
_player.attackframe = 0;
- movingup = 0;
- movingdown = 0;
- movingleft = 0;
- movingright = 0;
+ movingup = false;
+ movingdown = false;
+ movingleft = false;
+ movingright = false;
for (int i = 0; i <= 15; i++) {
for (int a = 0; a <= 3; a++) {
@@ -819,7 +819,7 @@ void GriffonEngine::game_castspell(int spellnum, float homex, float homey, float
int nballs = 0;
for (int x = 0; x <= 19; x++) {
for (int y = 0; y <= 14; y++) {
- if ((_objmap[x][y] == 1 || _objmap[x][y] == 2) && nballs < 5 && (int)(RND() * 4) == 0) {
+ if ((_objectMap[x][y] == 1 || _objectMap[x][y] == 2) && nballs < 5 && (int)(RND() * 4) == 0) {
int ax = x * 16;
int ay = y * 16;
@@ -917,8 +917,8 @@ void GriffonEngine::game_checkinputs() {
for (int x = 0; x <= 19; x++) {
for (int y = 0; y <= 14; y++) {
- int o = _objmap[x][y];
- if (_objectinfo[o][4] == 3) {
+ int o = _objectMap[x][y];
+ if (_objectInfo[o][4] == 3) {
postinfo[nposts][0] = x * 16;
postinfo[nposts][1] = y * 16;
nposts = nposts + 1;
@@ -1111,23 +1111,23 @@ __exit_do:
}
if (_itemselon == 0) {
- movingup = 0;
- movingdown = 0;
- movingleft = 0;
- movingright = 0;
+ movingup = false;
+ movingdown = false;
+ movingleft = false;
+ movingright = false;
if (_event.kbd.keycode == Common::KEYCODE_UP)
- movingup = 1;
+ movingup = true;
if (_event.kbd.keycode == Common::KEYCODE_DOWN)
- movingdown = 1;
+ movingdown = true;
if (_event.kbd.keycode == Common::KEYCODE_LEFT)
- movingleft = 1;
+ movingleft = true;
if (_event.kbd.keycode == Common::KEYCODE_RIGHT)
- movingright = 1;
+ movingright = true;
} else {
- movingup = 0;
- movingdown = 0;
- movingleft = 0;
- movingright = 0;
+ movingup = false;
+ movingdown = false;
+ movingleft = false;
+ movingright = false;
if (_selenemyon == 1) {
if (_itemticks < _ticks) {
@@ -1646,8 +1646,8 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
int lx = (int)npx / 16;
int ly = (int)npy / 16;
- if (_objmap[lx][ly] == -1)
- _objmap[lx][ly] = 4;
+ if (_objectMap[lx][ly] == -1)
+ _objectMap[lx][ly] = 4;
}
}
@@ -1660,8 +1660,8 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
int lx = (int)npx / 16;
int ly = (int)npy / 16;
- if (_objmap[lx][ly] == -1)
- _objmap[lx][ly] = 12;
+ if (_objectMap[lx][ly] == -1)
+ _objectMap[lx][ly] = 12;
}
}
@@ -1674,8 +1674,8 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
int lx = (int)npx / 16;
int ly = (int)npy / 16;
- if (_objmap[lx][ly] == -1)
- _objmap[lx][ly] = 13;
+ if (_objectMap[lx][ly] == -1)
+ _objectMap[lx][ly] = 13;
}
}
@@ -1691,7 +1691,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
int cx = 9;
int cy = 7;
- _objmap[cx][cy] = 5;
+ _objectMap[cx][cy] = 5;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -1723,7 +1723,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
int cx = 9;
int cy = 7;
- _objmap[cx][cy] = 6;
+ _objectMap[cx][cy] = 6;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -1781,7 +1781,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
int cx = 9;
int cy = 6;
- _objmap[cx][cy] = 9;
+ _objectMap[cx][cy] = 9;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -1814,7 +1814,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
int cx = 13;
int cy = 7;
- _objmap[cx][cy] = 5;
+ _objectMap[cx][cy] = 5;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -1847,7 +1847,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
int cx = 9;
int cy = 7;
- _objmap[cx][cy] = 11;
+ _objectMap[cx][cy] = 11;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -1880,7 +1880,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
int cx = 9;
int cy = 7;
- _objmap[cx][cy] = 13;
+ _objectMap[cx][cy] = 13;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -1910,7 +1910,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
int cx = 8;
int cy = 7;
- _objmap[cx][cy] = 16;
+ _objectMap[cx][cy] = 16;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -1942,7 +1942,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
int cx = 11;
int cy = 10;
- _objmap[cx][cy] = 5;
+ _objectMap[cx][cy] = 5;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -1974,7 +1974,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
int cx = 6;
int cy = 8;
- _objmap[cx][cy] = 18;
+ _objectMap[cx][cy] = 18;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -1995,7 +1995,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
cx = 9;
cy = 8;
- _objmap[cx][cy] = 19;
+ _objectMap[cx][cy] = 19;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -2017,7 +2017,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
cx = 12;
cy = 8;
- _objmap[cx][cy] = 20;
+ _objectMap[cx][cy] = 20;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -2063,20 +2063,20 @@ void GriffonEngine::game_damageplayer(int damage) {
void GriffonEngine::game_drawanims(int Layer) {
for (int sx = 0; sx <= 19; sx++) {
for (int sy = 0; sy <= 14; sy++) {
- int o = _objmap[sx][sy];
+ int o = _objectMap[sx][sy];
if (o > -1) {
- int xtiles = _objectinfo[o][1];
- int ytiles = _objectinfo[o][2];
- int cframe = _objectframe[o][1];
+ int xtiles = _objectInfo[o][1];
+ int ytiles = _objectInfo[o][2];
+ int cframe = _objectFrame[o][1];
for (int x = 0; x <= xtiles - 1; x++) {
for (int y = 0; y <= ytiles - 1; y++) {
int x1 = (sx + x) * 16;
int y1 = (sy + y) * 16;
- if (_objecttile[o][cframe][x][y][1] == Layer) {
- int c = _objecttile[o][cframe][x][y][0];
+ if (_objectTile[o][cframe][x][y][1] == Layer) {
+ int c = _objectTile[o][cframe][x][y][0];
c = c - 1;
int curtilel = 3;
int curtilex = c % 20;
@@ -3468,43 +3468,41 @@ void GriffonEngine::game_eventtext(const char *stri) {
void GriffonEngine::game_handlewalking() {
- unsigned int *temp/*, c*/, bgc;
- float spd, /*ppx, ppy,*/ px, py, opx, opy;
- float nx, ny, npx, npy;
-
int xmax = 20 * 16 - 25;
int ymax = 15 * 16 - 25;
- px = _player.px;
- py = _player.py;
- opx = px;
- opy = py;
+ float px = _player.px;
+ float py = _player.py;
+ float opx = px;
+ float opy = py;
- spd = _player.walkspd * _fpsr;
+ float spd = _player.walkspd * _fpsr;
- nx = (px / 2 + 6);
- ny = (py / 2 + 10);
+ float nx = (px / 2 + 6);
+ float ny = (py / 2 + 10);
- npx = px + 12;
- npy = py + 20;
+ float npx = px + 12;
+ float npy = py + 20;
int lx = (int)npx / 16;
int ly = (int)npy / 16;
int ramp = _rampdata[lx][ly];
if (ramp == 1 && movingup)
- spd = spd * 2;
+ spd *= 2;
if (ramp == 1 && movingdown)
- spd = spd * 2;
+ spd *= 2;
if (ramp == 2 && movingleft)
- movingup = 1;
+ movingup = true;
if (ramp == 2 && movingright)
- movingdown = 1;
+ movingdown = true;
if (ramp == 3 && movingright)
- movingup = 1;
+ movingup = true;
if (ramp == 3 && movingleft)
- movingdown = 1;
+ movingdown = true;
+
+ unsigned int *temp/*, c*/, bgc;
for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++) {
@@ -3529,67 +3527,67 @@ void GriffonEngine::game_handlewalking() {
_player.walkdir = 3;
if (movingup && _clipsurround[1][0] == 0) {
- py = py - spd;
+ py -= spd;
_player.walkdir = 0;
} else if (movingup && _clipsurround[1][0] > 0) {
// move upleft
- if (movingright == 0 && _clipsurround[0][0] == 0) {
- py = py - spd;
- px = px - spd;
+ if (!movingright && _clipsurround[0][0] == 0) {
+ py -= spd;
+ px -= spd;
}
// move upright
- if (movingleft == 0 && _clipsurround[2][0] == 0) {
- py = py - spd;
- px = px + spd;
+ if (!movingleft && _clipsurround[2][0] == 0) {
+ py -= spd;
+ px += spd;
}
}
if (movingdown && _clipsurround[1][2] == 0) {
- py = py + spd;
+ py += spd;
_player.walkdir = 1;
} else if (movingdown && _clipsurround[1][2] > 0) {
// move downleft
if (movingright == 0 && _clipsurround[0][2] == 0) {
- py = py + spd;
- px = px - spd;
+ py += spd;
+ px -= spd;
}
// move downright
if (movingleft == 0 && _clipsurround[2][2] == 0) {
- py = py + spd;
- px = px + spd;
+ py += spd;
+ px += spd;
}
}
if (movingleft && _clipsurround[0][1] == 0) {
- px = px - spd;
+ px -= spd;
_player.walkdir = 2;
} else if (movingleft && _clipsurround[0][1] > 0) {
// move leftup
- if (movingdown == 0 && _clipsurround[0][0] == 0) {
- py = py - spd;
- px = px - spd;
+ if (!movingdown && _clipsurround[0][0] == 0) {
+ py -= spd;
+ px -= spd;
}
// move leftdown
- if (movingup == 0 && _clipsurround[0][2] == 0) {
- py = py + spd;
- px = px - spd;
+ if (!movingup && _clipsurround[0][2] == 0) {
+ py += spd;
+ px -= spd;
}
}
if (movingright && _clipsurround[2][1] == 0) {
- px = px + spd;
+ px += spd;
_player.walkdir = 3;
} else if (movingright && _clipsurround[2][1] > 0) {
// move rightup
- if (movingdown == 0 && _clipsurround[2][0] == 0) {
- px = px + spd;
- py = py - spd;
+ if (!movingdown && _clipsurround[2][0] == 0) {
+ px += spd;
+ py -= spd;
}
// move rightdown
- if (movingup == 0 && _clipsurround[2][2] == 0) {
- py = py + spd;
- px = px + spd;
+ if (!movingup && _clipsurround[2][2] == 0) {
+ py += spd;
+ px += spd;
}
}
@@ -3629,16 +3627,16 @@ void GriffonEngine::game_handlewalking() {
if (_player.walkdir == 0) {
if (abs(xdif) <= 8 && ydif > 0 && ydif < 8)
- _npcinfo[i].y = _npcinfo[i].y - spd;
+ _npcinfo[i].y -= spd;
} else if (_player.walkdir == 1) {
if (abs(xdif) <= 8 && ydif < 0 && ydif > -8)
- _npcinfo[i].y = _npcinfo[i].y + spd;
+ _npcinfo[i].y += spd;
} else if (_player.walkdir == 2) {
if (abs(ydif) <= 8 && xdif > 0 && xdif < 8)
- _npcinfo[i].x = _npcinfo[i].x - spd;
+ _npcinfo[i].x -= spd;
} else if (_player.walkdir == 3) {
if (abs(ydif) <= 8 && xdif < 0 && xdif > -8)
- _npcinfo[i].x = _npcinfo[i].x + spd;
+ _npcinfo[i].x += spd;
}
npx = _npcinfo[i].x;
@@ -3663,17 +3661,17 @@ void GriffonEngine::game_handlewalking() {
_player.py = py;
if (_player.px != _player.opx || _player.py != _player.opy)
- _player.walkframe = _player.walkframe + _animspd * _fpsr;
+ _player.walkframe += _animspd * _fpsr;
if (_player.walkframe >= 16)
- _player.walkframe = _player.walkframe - 16;
+ _player.walkframe -= 16;
// walking over items to pickup :::
- int o = _objmap[lx][ly];
+ int o = _objectMap[lx][ly];
if (o > -1) {
// fsk
- if (_objectinfo[o][4] == 2 && _player.inventory[kInvFlask] < 9) {
- _objmap[lx][ly] = -1;
+ if (_objectInfo[o][4] == 2 && _player.inventory[kInvFlask] < 9) {
+ _objectMap[lx][ly] = -1;
_player.inventory[kInvFlask]++;
game_addFloatIcon(6, lx * 16, ly * 16);
@@ -3686,8 +3684,8 @@ void GriffonEngine::game_handlewalking() {
}
}
- if (_objectinfo[o][5] == 7 && _player.inventory[kInvDoubleFlask] < 9) {
- _objmap[lx][ly] = -1;
+ if (_objectInfo[o][5] == 7 && _player.inventory[kInvDoubleFlask] < 9) {
+ _objectMap[lx][ly] = -1;
_player.inventory[kInvDoubleFlask]++;
game_addFloatIcon(12, lx * 16, ly * 16);
@@ -3700,8 +3698,8 @@ void GriffonEngine::game_handlewalking() {
}
}
- if (_objectinfo[o][5] == 9 && _player.inventory[kInvShock] < 9 && (_curmap == 41 && _scriptflag[9][1] == 0)) {
- _objmap[lx][ly] = -1;
+ if (_objectInfo[o][5] == 9 && _player.inventory[kInvShock] < 9 && (_curmap == 41 && _scriptflag[9][1] == 0)) {
+ _objectMap[lx][ly] = -1;
_player.inventory[kInvShock]++;
game_addFloatIcon(17, lx * 16, ly * 16);
@@ -3717,8 +3715,8 @@ void GriffonEngine::game_handlewalking() {
}
- if (_objectinfo[o][5] == 9 && _player.inventory[kInvShock] < 9) {
- _objmap[lx][ly] = -1;
+ if (_objectInfo[o][5] == 9 && _player.inventory[kInvShock] < 9) {
+ _objectMap[lx][ly] = -1;
_player.inventory[kInvShock]++;
game_addFloatIcon(17, lx * 16, ly * 16);
@@ -3735,16 +3733,12 @@ void GriffonEngine::game_handlewalking() {
}
void GriffonEngine::game_loadmap(int mapnum) {
- unsigned int ccc;
- Common::Rect trect(320, 240);
- char name[256];
- int tempmap[320][200];
-
debug(2, "Loaded map %d", mapnum);
- ccc = _clipbg->format.RGBToColor(255, 255, 255);
+ unsigned int ccc = _clipbg->format.RGBToColor(255, 255, 255);
_curmap = mapnum;
+ Common::Rect trect(320, 240);
_mapbg->fillRect(trect, 0);
_clipbg->fillRect(trect, ccc);
@@ -3786,24 +3780,28 @@ void GriffonEngine::game_loadmap(int mapnum) {
for (int i = 0; i < kMaxSpell; i++)
spellinfo[i].frame = 0;
- _roomlock = 0;
+ _roomlock = false;
+ char name[256];
// read *.map file
sprintf(name, "mapdb/%04i.map", mapnum);
debug(1, "Reading %s", name);
Common::File file;
file.open(name);
- for (int x = 0; x <= 319; x++)
+ int tempmap[320][200];
+ for (int x = 0; x <= 319; x++) {
for (int y = 0; y <= 199; y++) {
INPUT("%i", &tempmap[x][y]);
}
+ }
file.close();
- for (int x = 0; x <= 319; x++)
+ for (int x = 0; x <= 319; x++) {
for (int y = 0; y <= 239; y++) {
_triggerloc[x][y] = -1;
}
+ }
// read *.trg file
sprintf(name, "mapdb/%04i.trg", mapnum);
@@ -3824,16 +3822,19 @@ void GriffonEngine::game_loadmap(int mapnum) {
file.close();
- for (int y = 0; y <= 23; y++)
+ for (int y = 0; y <= 23; y++) {
for (int x = 0; x <= 39; x++)
_rampdata[x][y] = tempmap[3 * 40 + x][y + 40];
+ }
-
- for (int y = 0; y <= 23; y++)
- for (int x = 0; x <= 39; x++)
- for (int l = 0; l <= 2; l++)
+ for (int y = 0; y <= 23; y++) {
+ for (int x = 0; x <= 39; x++) {
+ for (int l = 0; l <= 2; l++) {
for (int a = 0; a <= 2; a++)
_tileinfo[l][x][y][a] = 0;
+ }
+ }
+ }
if (_scriptflag[4][0] == 1 && _curmap == 4) {
_triggerloc[9][7] = 5004;
@@ -3898,12 +3899,10 @@ void GriffonEngine::game_loadmap(int mapnum) {
_clipbg->fillRect(rcDest, 0);
}
-
}
}
}
-
for (int x = 0; x <= 39; x++) {
for (int y = 0; y <= 23; y++) {
int d = tempmap[3 * 40 + x][y];
@@ -3969,7 +3968,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
}
}
- _lastobj = 0;
+ _lastObj = 0;
_lastnpc = 0;
for (int i = 0; i < kMaxNPC; i++)
@@ -3989,18 +3988,18 @@ void GriffonEngine::game_loadmap(int mapnum) {
obj = d % 2;
}
- _objmap[x][y] = -1;
+ _objectMap[x][y] = -1;
if (obj == 1) {
int o = tempmap[5 * 40 + x][y];
if (_objmapf[_curmap][x][y] == 0) {
- _objmap[x][y] = o;
+ _objectMap[x][y] = o;
- if (_objectinfo[o][0] > 1) {
- if (o > _lastobj)
- _lastobj = o;
+ if (_objectInfo[o][0] > 1) {
+ if (o > _lastObj)
+ _lastObj = o;
}
int x1 = x * 8;
@@ -4011,9 +4010,9 @@ void GriffonEngine::game_loadmap(int mapnum) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- if (_objectinfo[o][4] == 1)
+ if (_objectInfo[o][4] == 1)
_clipbg->fillRect(rcDest, ccc);
- if (_objectinfo[o][4] == 3)
+ if (_objectInfo[o][4] == 3)
_clipbg->fillRect(rcDest, ccc);
}
}
@@ -4041,13 +4040,13 @@ void GriffonEngine::game_loadmap(int mapnum) {
_lastnpc = 0;
if (_curmap == 73 && _scriptflag[12][0] == 0)
- _roomlock = 1;
+ _roomlock = true;
if (_curmap == 81 && _scriptflag[13][0] == 0)
- _roomlock = 1;
+ _roomlock = true;
if (_curmap == 83 && _scriptflag[15][0] == 0)
- _roomlock = 1;
+ _roomlock = true;
if (_curmap == 82)
- _roomlock = 1;
+ _roomlock = true;
// read *.npc file
sprintf(name, "mapdb/%04i.npc", mapnum);
@@ -4279,33 +4278,33 @@ void GriffonEngine::game_loadmap(int mapnum) {
}
if (_npcinfo[i].script == 2) {
- _roomlock = 1;
+ _roomlock = true;
if (_scriptflag[2][0] > 0) {
- _roomlock = 0;
+ _roomlock = false;
_npcinfo[i].hp = 0;
}
}
if (_npcinfo[i].script == 3) {
- _roomlock = 1;
+ _roomlock = true;
if (_scriptflag[3][0] > 0) {
- _roomlock = 0;
+ _roomlock = false;
_npcinfo[i].hp = 0;
}
}
if (_npcinfo[i].script == 5) {
- _roomlock = 1;
+ _roomlock = true;
if (_scriptflag[5][0] > 0) {
- _roomlock = 0;
+ _roomlock = false;
_npcinfo[i].hp = 0;
}
}
if (_npcinfo[i].script == 15) {
- _roomlock = 1;
+ _roomlock = true;
if (_scriptflag[15][0] > 0) {
- _roomlock = 0;
+ _roomlock = false;
_npcinfo[i].hp = 0;
}
}
@@ -4323,7 +4322,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
cx = 9;
cy = 7;
- _objmap[cx][cy] = 5;
+ _objectMap[cx][cy] = 5;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -4347,7 +4346,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
cx = 9;
cy = 7;
- _objmap[cx][cy] = 6;
+ _objectMap[cx][cy] = 6;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -4371,7 +4370,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
cx = 13;
cy = 7;
- _objmap[cx][cy] = 5;
+ _objectMap[cx][cy] = 5;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -4395,7 +4394,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
cx = 9;
cy = 6;
- _objmap[cx][cy] = 9;
+ _objectMap[cx][cy] = 9;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -4419,7 +4418,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
cx = 8;
cy = 7;
- _objmap[cx][cy] = 16;
+ _objectMap[cx][cy] = 16;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -4443,7 +4442,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
cx = 11;
cy = 10;
- _objmap[cx][cy] = 5;
+ _objectMap[cx][cy] = 5;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -4468,7 +4467,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
cx = 6;
cy = 8;
- _objmap[cx][cy] = 18;
+ _objectMap[cx][cy] = 18;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -4491,7 +4490,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
cx = 9;
cy = 8;
- _objmap[cx][cy] = 19;
+ _objectMap[cx][cy] = 19;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -4514,7 +4513,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
cx = 12;
cy = 8;
- _objmap[cx][cy] = 20;
+ _objectMap[cx][cy] = 20;
rcDest.left = cx * 8;
rcDest.top = cy * 8;
@@ -4758,8 +4757,9 @@ void GriffonEngine::game_playgame() {
void GriffonEngine::game_processtrigger(int trignum) {
int trigtype = _triggers[trignum][0];
- if (_roomlock == 1)
+ if (_roomlock)
return;
+
// map jump------------------------------
if (trigtype == 0) {
int tx = _triggers[trignum][1];
@@ -5481,11 +5481,11 @@ void GriffonEngine::game_title(int mode) {
}
void GriffonEngine::game_updanims() {
- for (int i = 0; i <= _lastobj; i++) {
- int nframes = _objectinfo[i][0];
- int o_animspd = _objectinfo[i][3];
- float frame = _objectframe[i][0];
- int cframe = _objectframe[i][1];
+ for (int i = 0; i <= _lastObj; i++) {
+ int nframes = _objectInfo[i][0];
+ int o_animspd = _objectInfo[i][3];
+ float frame = _objectFrame[i][0];
+ int cframe = _objectFrame[i][1];
// _objectinfo[i][6] = 0; // ?? out of bounds
if (nframes > 1) {
@@ -5499,8 +5499,8 @@ void GriffonEngine::game_updanims() {
if (cframe < 0)
cframe = 0;
- _objectframe[i][0] = frame;
- _objectframe[i][1] = cframe;
+ _objectFrame[i][0] = frame;
+ _objectFrame[i][1] = cframe;
}
}
}
@@ -5543,7 +5543,7 @@ void GriffonEngine::game_updmusic() {
// if(_curmap > 5 && _curmap < 42) iplaysound = macademy;
// if(_curmap > 47) iplaysound = _mgardens;
iplaysound = _mgardens;
- if (_roomlock == 1)
+ if (_roomlock)
iplaysound = _mboss;
if (iplaysound == _mboss && _pboss)
@@ -6814,7 +6814,7 @@ void GriffonEngine::game_updspells() {
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
_objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- _objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+ _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
rcSrc.left = postinfo[e][0] / 2;
rcSrc.top = postinfo[e][1] / 2;
@@ -6936,7 +6936,7 @@ void GriffonEngine::game_updspells() {
if ((abs(xdif) < 24 && abs(ydif) < 24)) {
_objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- _objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+ _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
rcSrc.left = postinfo[e][0] / 2;
rcSrc.top = postinfo[e][1] / 2;
@@ -7016,7 +7016,7 @@ void GriffonEngine::game_updspells() {
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
_objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- _objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+ _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
rcSrc.left = postinfo[e][0] / 2;
rcSrc.top = postinfo[e][1] / 2;
@@ -7105,9 +7105,9 @@ void GriffonEngine::game_updspells() {
}
}
- int o = _objmap[sx][sy];
+ int o = _objectMap[sx][sy];
if (o > -1) {
- if (_objectinfo[o][4] == 1)
+ if (_objectInfo[o][4] == 1)
foundel[2] = 1;
if (o == 1 || o == 2) {
foundel[2] = 1;
@@ -7293,7 +7293,7 @@ void GriffonEngine::game_updspells() {
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
_objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- _objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+ _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
rcSrc.left = postinfo[e][0] / 2;
rcSrc.top = postinfo[e][1] / 2;
@@ -7351,7 +7351,7 @@ void GriffonEngine::game_updspells() {
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
_objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- _objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+ _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
rcSrc.left = postinfo[e][0] / 2;
rcSrc.top = postinfo[e][1] / 2;
@@ -7408,7 +7408,7 @@ void GriffonEngine::game_updspells() {
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
_objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- _objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+ _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
rcSrc.left = postinfo[e][0] / 2;
rcSrc.top = postinfo[e][1] / 2;
@@ -7465,7 +7465,7 @@ void GriffonEngine::game_updspells() {
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
_objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- _objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+ _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
rcSrc.left = postinfo[e][0] / 2;
rcSrc.top = postinfo[e][1] / 2;
@@ -7749,7 +7749,7 @@ void GriffonEngine::game_updspellsunder() {
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
_objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- _objmap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+ _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
rcSrc.left = postinfo[e][0] / 2;
rcSrc.top = postinfo[e][1] / 2;
@@ -8131,14 +8131,14 @@ void GriffonEngine::sys_LoadObjectDB() {
for (int a = 0; a <= 32; a++) {
for (int b = 0; b <= 5; b++) {
- INPUT("%i", &_objectinfo[a][b]);
+ INPUT("%i", &_objectInfo[a][b]);
}
for (int b = 0; b <= 8; b++) {
for (int c = 0; c <= 2; c++) {
for (int d = 0; d <= 2; d++) {
for (int e = 0; e <= 1; e++) {
- INPUT("%i", &_objecttile[a][b][c][d][e]);
+ INPUT("%i", &_objectTile[a][b][c][d][e]);
}
}
}
@@ -8385,11 +8385,11 @@ void GriffonEngine::sys_update() {
if (_player.hp <= 0)
game_theend();
- if (_roomlock == 1) {
- _roomlock = 0;
+ if (_roomlock) {
+ _roomlock = false;
for (int i = 1; i <= _lastnpc; i++)
if (_npcinfo[i].hp > 0)
- _roomlock = 1;
+ _roomlock = true;
}
clouddeg += 0.1 * _fpsr;
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 559236e..f98964c 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -344,7 +344,7 @@ private:
float _itemyloc;
int _selenemyon, _curenemy;
bool _forcepause;
- int _roomlock; // set to disable any room jumps while in the room
+ bool _roomlock; // set to disable any room jumps while in the room
int _scriptflag[100][10], _saveslot; // script, flag
// timer related - move to local later
@@ -376,7 +376,7 @@ private:
Spell spellinfo[kMaxSpell];
// player info
- int movingup, movingdown, movingleft, movingright;
+ bool movingup, movingdown, movingleft, movingright;
Player _player;
bool attacking;
Player _playera;
@@ -402,14 +402,14 @@ private:
AnimSet _animset2[7], _animset9[7];
// object info
- float _objectframe[256][2];
- int _lastobj;
+ float _objectFrame[256][2];
+ int _lastObj;
// frame!, curframe
- int _objectinfo[33][6];
+ int _objectInfo[33][6];
// nframes,xtiles,ytiles,speed,type,script, update?
- int _objecttile[33][9][3][3][2];
+ int _objectTile[33][9][3][3][2];
// [objnum] [frame] [x] [y] [tile/layer]
- int _objmap[21][15];
+ int _objectMap[21][15];
int _objmapf[1000][21][15];
// [mapnum] x, y set to 1 to make this objmap spot stay at -1
Commit: 712cb5858bcbd4a33a6082b39cd56b2effbbbf51
https://github.com/scummvm/scummvm/commit/712cb5858bcbd4a33a6082b39cd56b2effbbbf51
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Use enum for game scripts
Changed paths:
engines/griffon/engine.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 21477af..c077ec0 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -49,28 +49,30 @@
namespace Griffon {
+// in game scripts
+enum {
+ kScriptMasterKey = 2, // find master key
+ kScriptFindCtystal = 3, // find crystal
+ kScriptFindShield = 4, // find shield - obj 8
+ kScriptFindSword = 5, // find sword - obj 9
+ kScriptKeyChest = 6, // regular key chest
+ kScriptBlueFlask = 7, // blue flask
+ kScriptGardenMasterKey = 8, // garden's master key
+ kScriptLightningBomb = 9, // lightning bomb
+ kScriptBlueFlaskChest = 10, // blue flask chest
+ kScriptLightningChest = 11, // lightning chest
+ kScriptArmourChest = 12, // armour chest
+ kScriptCitadelMasterKey = 13, // citadel master key
+ kScriptEndOfGame = 14, // end of game
+ kScriptGetSword3 = 15, // get sword3
+ kScriptShield3 = 16, // shield3
+ kScriptArmour3 = 17, // armour3
+ kScriptKeyChest1 = 20, // key chest 1
+ kScriptLever = 60 // lever
+};
+
// memo
/*
- in game scripts
- 2 - find master key
- 3 - find crystal
- 4 - find shield - obj 8
- 5 - find sword - obj 9
- 6 - regular key chest
- 7 - blue flask
- 8 - garden's master key
- 9 - lightning bomb
- 10 - blue flask chest
- 11 - lightning chest
- 12 - armour chest
- 13 - citadel master key
- 14 - end of game
- 15 - get sword3
- 16 - shield3
- 17 - armour3
- 20 key chest 1
- 60-lever
-
monsters
1 - baby dragon
2 - one wing
@@ -441,7 +443,7 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 2) {
+ if (oscript == kScriptMasterKey) {
_player.inventory[kInvMasterKey]++;
game_addFloatIcon(14, lx * 16, (ly - 1) * 16);
@@ -449,11 +451,11 @@ void GriffonEngine::game_attack() {
_itemticks = _ticks + 215;
if (_curmap == 34)
- _scriptflag[2][0] = 2;
+ _scriptflag[kScriptMasterKey][0] = 2;
if (_curmap == 62)
- _scriptflag[8][0] = 2;
+ _scriptflag[kScriptGardenMasterKey][0] = 2;
if (_curmap == 81)
- _scriptflag[13][0] = 2;
+ _scriptflag[kScriptCitadelMasterKey][0] = 2;
if (_menabled && config.effects) {
int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
@@ -466,7 +468,7 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 3) {
+ if (oscript == kScriptFindCtystal) {
_player.foundspell[0] = 1;
_player.spellcharge[0] = 0;
@@ -485,7 +487,7 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 4 && _player.shield == 1) {
+ if (oscript == kScriptFindShield && _player.shield == 1) {
_player.shield = 2;
game_addFloatIcon(4, lx * 16, (ly - 1) * 16);
@@ -505,7 +507,7 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 5 && _player.sword == 1) {
+ if (oscript == kScriptFindSword && _player.sword == 1) {
_player.sword = 2;
game_addFloatIcon(3, lx * 16, (ly - 1) * 16);
@@ -523,7 +525,7 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 6) {
+ if (oscript == kScriptKeyChest) {
if (_player.inventory[kInvNormalKey] < 9) {
_player.inventory[kInvNormalKey]++;
@@ -555,7 +557,7 @@ void GriffonEngine::game_attack() {
}
}
- if (oscript == 7 && _player.inventory[kInvDoubleFlask] < 9) {
+ if (oscript == kScriptBlueFlask && _player.inventory[kInvDoubleFlask] < 9) {
_player.inventory[kInvDoubleFlask]++;
game_addFloatIcon(12, lx * 16, (ly - 1) * 16);
@@ -574,7 +576,7 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 7 && _player.inventory[kInvDoubleFlask] == 9) {
+ if (oscript == kScriptBlueFlask && _player.inventory[kInvDoubleFlask] == 9) {
if (_menabled && config.effects) {
int snd = Mix_PlayChannel(_sfx[kSndChest]);
Mix_Volume(snd, config.effectsvol);
@@ -585,7 +587,7 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 10 && _player.inventory[kInvDoubleFlask] < 9) {
+ if (oscript == kScriptBlueFlaskChest && _player.inventory[kInvDoubleFlask] < 9) {
_player.inventory[kInvDoubleFlask]++;
game_addFloatIcon(12, lx * 16, (ly - 1) * 16);
@@ -604,7 +606,7 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 10 && _player.inventory[kInvDoubleFlask] == 9) {
+ if (oscript == kScriptBlueFlaskChest && _player.inventory[kInvDoubleFlask] == 9) {
if (_menabled && config.effects) {
int snd = Mix_PlayChannel(_sfx[kSndChest]);
Mix_Volume(snd, config.effectsvol);
@@ -615,7 +617,7 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 11 && _player.inventory[kInvShock] < 9) {
+ if (oscript == kScriptLightningChest && _player.inventory[kInvShock] < 9) {
_player.inventory[kInvShock]++;
game_addFloatIcon(17, lx * 16, (ly - 1) * 16);
@@ -634,7 +636,7 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 11 && _player.inventory[kInvShock] == 9) {
+ if (oscript == kScriptLightningChest && _player.inventory[kInvShock] == 9) {
if (_menabled && config.effects) {
int snd = Mix_PlayChannel(_sfx[kSndChest]);
Mix_Volume(snd, config.effectsvol);
@@ -645,7 +647,7 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 12 && _player.armour == 1) {
+ if (oscript == kScriptArmourChest && _player.armour == 1) {
_player.armour = 2;
game_addFloatIcon(5, lx * 16, (ly - 1) * 16);
@@ -663,16 +665,16 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 60) {
- if (_curmap == 58 && _scriptflag[60][0] == 0) {
- _scriptflag[60][0] = 1;
+ if (oscript == kScriptLever) {
+ if (_curmap == 58 && _scriptflag[kScriptLever][0] == 0) {
+ _scriptflag[kScriptLever][0] = 1;
if (_menabled && config.effects) {
int snd = Mix_PlayChannel(_sfx[kSndLever]);
Mix_Volume(snd, config.effectsvol);
}
- } else if (_curmap == 58 && _scriptflag[60][0] > 0) {
+ } else if (_curmap == 58 && _scriptflag[kScriptLever][0] > 0) {
if (_menabled && config.effects) {
int snd = Mix_PlayChannel(_sfx[kSndDoor]);
Mix_Volume(snd, config.effectsvol);
@@ -681,14 +683,14 @@ void GriffonEngine::game_attack() {
game_eventtext("It's stuck!");
}
- if (_curmap == 54 && _scriptflag[60][0] == 1) {
+ if (_curmap == 54 && _scriptflag[kScriptLever][0] == 1) {
if (_menabled && config.effects) {
int snd = Mix_PlayChannel(_sfx[kSndLever]);
Mix_Volume(snd, config.effectsvol);
}
- _scriptflag[60][0] = 2;
- } else if (_curmap == 54 && _scriptflag[60][0] > 1) {
+ _scriptflag[kScriptLever][0] = 2;
+ } else if (_curmap == 54 && _scriptflag[kScriptLever][0] > 1) {
if (_menabled && config.effects) {
int snd = Mix_PlayChannel(_sfx[kSndDoor]);
Mix_Volume(snd, config.effectsvol);
@@ -699,7 +701,7 @@ void GriffonEngine::game_attack() {
}
- if (oscript == 15 && _player.sword < 3) {
+ if (oscript == kScriptGetSword3 && _player.sword < 3) {
_player.sword = 3;
game_addFloatIcon(18, lx * 16, (ly - 1) * 16);
@@ -718,7 +720,7 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 16 && _player.shield < 3) {
+ if (oscript == kScriptShield3 && _player.shield < 3) {
_player.shield = 3;
game_addFloatIcon(19, lx * 16, (ly - 1) * 16);
_itemticks = _ticks + 215;
@@ -735,7 +737,7 @@ void GriffonEngine::game_attack() {
return;
}
- if (oscript == 17 && _player.armour < 3) {
+ if (oscript == kScriptArmour3 && _player.armour < 3) {
_player.armour = 3;
game_addFloatIcon(20, lx * 16, (ly - 1) * 16);
_itemticks = _ticks + 215;
@@ -1680,7 +1682,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
}
// academy master key chest script
- if (_npcinfo[npcnum].script == 2) {
+ if (_npcinfo[npcnum].script == kScriptMasterKey) {
bool alive = false;
for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0)
@@ -1707,12 +1709,12 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- _scriptflag[2][0] = 1;
+ _scriptflag[kScriptMasterKey][0] = 1;
}
}
// academy crystal chest script
- if (_npcinfo[npcnum].script == 3) {
+ if (_npcinfo[npcnum].script == kScriptFindCtystal) {
bool alive = false;
for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0)
@@ -1738,13 +1740,13 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
- _scriptflag[3][0] = 1;
+ _scriptflag[kScriptFindCtystal][0] = 1;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
}
}
// tower shield chest script
- if (_npcinfo[npcnum].script == 4 && _scriptflag[4][0] == 0) {
+ if (_npcinfo[npcnum].script == kScriptFindShield && _scriptflag[kScriptFindShield][0] == 0) {
_triggerloc[9][7] = 5004;
int curtile = 40;
@@ -1770,7 +1772,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
}
// firehydra sword chest
- if (_npcinfo[npcnum].script == 5) {
+ if (_npcinfo[npcnum].script == kScriptFindSword) {
bool alive = false;
for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0)
@@ -1796,14 +1798,14 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
- _scriptflag[5][0] = 1;
+ _scriptflag[kScriptFindSword][0] = 1;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
}
}
// gardens master key script
- if (_npcinfo[npcnum].script == 8 && _scriptflag[6][0] == 0) {
+ if (_npcinfo[npcnum].script == kScriptGardenMasterKey && _scriptflag[kScriptKeyChest][0] == 0) {
bool alive = false;
for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0)
@@ -1830,7 +1832,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- _scriptflag[8][0] = 1;
+ _scriptflag[kScriptGardenMasterKey][0] = 1;
}
}
@@ -1869,7 +1871,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
}
// pickup lightning bomb
- if (_npcinfo[npcnum].script == 9 && (_curmap == 41 && _scriptflag[9][1] == 0)) {
+ if (_npcinfo[npcnum].script == kScriptLightningBomb && (_curmap == 41 && _scriptflag[kScriptLightningBomb][1] == 0)) {
bool alive = false;
for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0)
@@ -1899,7 +1901,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
}
// citadel armour chest
- if (_npcinfo[npcnum].script == 12) {
+ if (_npcinfo[npcnum].script == kScriptArmourChest) {
bool alive = false;
for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0)
@@ -1925,13 +1927,13 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
- _scriptflag[12][0] = 1;
+ _scriptflag[kScriptArmourChest][0] = 1;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
}
}
// citadel master key script
- if (_npcinfo[npcnum].script == 13 && _scriptflag[13][0] == 0) {
+ if (_npcinfo[npcnum].script == kScriptCitadelMasterKey && _scriptflag[kScriptCitadelMasterKey][0] == 0) {
bool alive = false;
for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0)
@@ -1958,12 +1960,12 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- _scriptflag[13][0] = 1;
+ _scriptflag[kScriptCitadelMasterKey][0] = 1;
}
}
// max ups
- if (_npcinfo[npcnum].script == 15 && _scriptflag[15][0] == 0) {
+ if (_npcinfo[npcnum].script == kScriptGetSword3 && _scriptflag[kScriptGetSword3][0] == 0) {
bool alive = false;
for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0)
@@ -1990,7 +1992,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- _scriptflag[15][0] = 1;
+ _scriptflag[kScriptGetSword3][0] = 1;
cx = 9;
cy = 8;
@@ -2012,7 +2014,7 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
_player.py = _player.py + 16;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- _scriptflag[16][0] = 1;
+ _scriptflag[kScriptShield3][0] = 1;
cx = 12;
cy = 8;
@@ -2033,11 +2035,11 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- _scriptflag[17][0] = 1;
+ _scriptflag[kScriptArmour3][0] = 1;
}
}
- if (_npcinfo[npcnum].script == 14)
+ if (_npcinfo[npcnum].script == kScriptEndOfGame)
game_endofgame();
}
}
@@ -2082,9 +2084,9 @@ void GriffonEngine::game_drawanims(int Layer) {
int curtilex = c % 20;
int curtiley = (c - curtilex) / 20;
- if (_curmap == 58 && _scriptflag[60][0] > 0)
+ if (_curmap == 58 && _scriptflag[kScriptLever][0] > 0)
curtilex = 1;
- if (_curmap == 54 && _scriptflag[60][0] > 1)
+ if (_curmap == 54 && _scriptflag[kScriptLever][0] > 1)
curtilex = 1;
rcSrc.left = curtilex * 16;
rcSrc.top = curtiley * 16;
@@ -2496,7 +2498,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
for (int f = 0; f <= 7; f++) {
int yp = 0;
- if (f == 0 && (_curmap == 53 || _curmap == 57 || _curmap == 61 || _curmap == 65 || _curmap == 56 || _curmap > 66) && _scriptflag[60][0] > 0)
+ if (f == 0 && (_curmap == 53 || _curmap == 57 || _curmap == 61 || _curmap == 65 || _curmap == 56 || _curmap > 66) && _scriptflag[kScriptLever][0] > 0)
yp = 16;
int s = _npcinfo[i].bodysection[f].sprite;
rcSrc.left = _animset9[s].x;
@@ -3698,7 +3700,7 @@ void GriffonEngine::game_handlewalking() {
}
}
- if (_objectInfo[o][5] == 9 && _player.inventory[kInvShock] < 9 && (_curmap == 41 && _scriptflag[9][1] == 0)) {
+ if (_objectInfo[o][5] == 9 && _player.inventory[kInvShock] < 9 && (_curmap == 41 && _scriptflag[kScriptLightningBomb][1] == 0)) {
_objectMap[lx][ly] = -1;
_player.inventory[kInvShock]++;
@@ -3706,7 +3708,7 @@ void GriffonEngine::game_handlewalking() {
_objmapf[_curmap][lx][ly] = 1;
if (_curmap == 41)
- _scriptflag[9][1] = 1;
+ _scriptflag[kScriptLightningBomb][1] = 1;
if (_menabled && config.effects) {
int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
@@ -3772,9 +3774,9 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (mapnum == 24)
dontdrawover = 1;
- if ((mapnum == 53 || mapnum == 57 || mapnum == 61 || mapnum == 65 || mapnum == 62) && _scriptflag[60][0] > 0)
+ if ((mapnum == 53 || mapnum == 57 || mapnum == 61 || mapnum == 65 || mapnum == 62) && _scriptflag[kScriptLever][0] > 0)
mapnum = mapnum + 100;
- if ((mapnum == 161 || mapnum == 162) && _scriptflag[60][0] == 2)
+ if ((mapnum == 161 || mapnum == 162) && _scriptflag[kScriptLever][0] == 2)
mapnum = mapnum + 100;
for (int i = 0; i < kMaxSpell; i++)
@@ -3836,7 +3838,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
}
}
- if (_scriptflag[4][0] == 1 && _curmap == 4) {
+ if (_scriptflag[kScriptFindShield][0] == 1 && _curmap == 4) {
_triggerloc[9][7] = 5004;
tempmap[9][7] = 41;
tempmap[9][7 + 40] = 0;
@@ -3907,7 +3909,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
for (int y = 0; y <= 23; y++) {
int d = tempmap[3 * 40 + x][y];
- if (_scriptflag[4][0] == 1 && x == 9 && y == 7)
+ if (_scriptflag[kScriptFindShield][0] == 1 && x == 9 && y == 7)
d = 99;
if (d > 0) {
@@ -4032,18 +4034,18 @@ void GriffonEngine::game_loadmap(int mapnum) {
}
- if (_curmap == 62 && _scriptflag[8][0] > 0)
+ if (_curmap == 62 && _scriptflag[kScriptGardenMasterKey][0] > 0)
_lastnpc = 0;
- if (_curmap == 73 && _scriptflag[12][0] > 0)
+ if (_curmap == 73 && _scriptflag[kScriptArmourChest][0] > 0)
_lastnpc = 0;
- if (_curmap == 81 && _scriptflag[13][0] > 0)
+ if (_curmap == 81 && _scriptflag[kScriptCitadelMasterKey][0] > 0)
_lastnpc = 0;
- if (_curmap == 73 && _scriptflag[12][0] == 0)
+ if (_curmap == 73 && _scriptflag[kScriptArmourChest][0] == 0)
_roomlock = true;
- if (_curmap == 81 && _scriptflag[13][0] == 0)
+ if (_curmap == 81 && _scriptflag[kScriptCitadelMasterKey][0] == 0)
_roomlock = true;
- if (_curmap == 83 && _scriptflag[15][0] == 0)
+ if (_curmap == 83 && _scriptflag[kScriptGetSword3][0] == 0)
_roomlock = true;
if (_curmap == 82)
_roomlock = true;
@@ -4277,33 +4279,33 @@ void GriffonEngine::game_loadmap(int mapnum) {
}
}
- if (_npcinfo[i].script == 2) {
+ if (_npcinfo[i].script == kScriptMasterKey) {
_roomlock = true;
- if (_scriptflag[2][0] > 0) {
+ if (_scriptflag[kScriptMasterKey][0] > 0) {
_roomlock = false;
_npcinfo[i].hp = 0;
}
}
- if (_npcinfo[i].script == 3) {
+ if (_npcinfo[i].script == kScriptFindCtystal) {
_roomlock = true;
- if (_scriptflag[3][0] > 0) {
+ if (_scriptflag[kScriptFindCtystal][0] > 0) {
_roomlock = false;
_npcinfo[i].hp = 0;
}
}
- if (_npcinfo[i].script == 5) {
+ if (_npcinfo[i].script == kScriptFindSword) {
_roomlock = true;
- if (_scriptflag[5][0] > 0) {
+ if (_scriptflag[kScriptFindSword][0] > 0) {
_roomlock = false;
_npcinfo[i].hp = 0;
}
}
- if (_npcinfo[i].script == 15) {
+ if (_npcinfo[i].script == kScriptGetSword3) {
_roomlock = true;
- if (_scriptflag[15][0] > 0) {
+ if (_scriptflag[kScriptGetSword3][0] > 0) {
_roomlock = false;
_npcinfo[i].hp = 0;
}
@@ -4318,7 +4320,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
int cx, cy, npx, npy, lx, ly;
// academy master key
- if (_curmap == 34 && _scriptflag[2][0] == 1) {
+ if (_curmap == 34 && _scriptflag[kScriptMasterKey][0] == 1) {
cx = 9;
cy = 7;
@@ -4342,7 +4344,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
}
// academy crystal
- if (_curmap == 24 && _player.foundspell[0] == 0 && _scriptflag[3][0] == 1) {
+ if (_curmap == 24 && _player.foundspell[0] == 0 && _scriptflag[kScriptFindCtystal][0] == 1) {
cx = 9;
cy = 7;
@@ -4366,7 +4368,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
}
// gardens master key
- if (_curmap == 62 && _scriptflag[8][0] == 1) {
+ if (_curmap == 62 && _scriptflag[kScriptGardenMasterKey][0] == 1) {
cx = 13;
cy = 7;
@@ -4390,7 +4392,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
}
// gardens fidelis sword
- if (_curmap == 66 && _scriptflag[5][0] == 1 && _player.sword == 1) {
+ if (_curmap == 66 && _scriptflag[kScriptFindSword][0] == 1 && _player.sword == 1) {
cx = 9;
cy = 6;
@@ -4414,7 +4416,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
}
// citadel armour
- if (_curmap == 73 && _scriptflag[12][0] == 1 && _player.armour == 1) {
+ if (_curmap == 73 && _scriptflag[kScriptArmourChest][0] == 1 && _player.armour == 1) {
cx = 8;
cy = 7;
@@ -4438,7 +4440,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
}
// citadel master key
- if (_curmap == 81 && _scriptflag[13][0] == 1) {
+ if (_curmap == 81 && _scriptflag[kScriptCitadelMasterKey][0] == 1) {
cx = 11;
cy = 10;
@@ -4463,7 +4465,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
// max ups
- if (_curmap == 83 && _scriptflag[15][0] == 1 && _player.sword < 3) {
+ if (_curmap == 83 && _scriptflag[kScriptGetSword3][0] == 1 && _player.sword < 3) {
cx = 6;
cy = 8;
@@ -4486,7 +4488,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
_clipbg->fillRect(rcDest, ccc);
}
- if (_curmap == 83 && _scriptflag[16][0] == 1 && _player.shield < 3) {
+ if (_curmap == 83 && _scriptflag[kScriptShield3][0] == 1 && _player.shield < 3) {
cx = 9;
cy = 8;
@@ -4509,7 +4511,7 @@ void GriffonEngine::game_loadmap(int mapnum) {
_clipbg->fillRect(rcDest, ccc);
}
- if (_curmap == 83 && _scriptflag[17][0] == 1 && _player.armour < 3) {
+ if (_curmap == 83 && _scriptflag[kScriptArmour3][0] == 1 && _player.armour < 3) {
cx = 12;
cy = 8;
Commit: fbfc82acf5c966fecba84696d03baca0d6f55ddf
https://github.com/scummvm/scummvm/commit/fbfc82acf5c966fecba84696d03baca0d6f55ddf
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix regressions
Changed paths:
engines/griffon/engine.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index c077ec0..4069d6a 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -7950,13 +7950,13 @@ void GriffonEngine::sys_line(Graphics::TransparentSurface *buffer, int x1, int y
void GriffonEngine::sys_LoadAnims() {
_spellimg = IMG_Load("art/spells.bmp", true);
- _anims[0] = IMG_Load("art/_anims0.bmp", true);
- _animsa[0] = IMG_Load("art/_anims0a.bmp", true);
- _anims[13] = IMG_Load("art/_anims0x.bmp", true);
- _animsa[13] = IMG_Load("art/_anims0xa.bmp", true);
- _anims[1] = IMG_Load("art/_anims1.bmp", true);
- _animsa[1] = IMG_Load("art/_anims1a.bmp", true);
- _anims[2] = IMG_Load("art/_anims2.bmp", true);
+ _anims[0] = IMG_Load("art/anims0.bmp", true);
+ _animsa[0] = IMG_Load("art/anims0a.bmp", true);
+ _anims[13] = IMG_Load("art/anims0x.bmp", true);
+ _animsa[13] = IMG_Load("art/anims0xa.bmp", true);
+ _anims[1] = IMG_Load("art/anims1.bmp", true);
+ _animsa[1] = IMG_Load("art/anims1a.bmp", true);
+ _anims[2] = IMG_Load("art/anims2.bmp", true);
// huge
_animset2[0].xofs = 8;
@@ -8001,7 +8001,7 @@ void GriffonEngine::sys_LoadAnims() {
_animset2[5].w = 42;
_animset2[5].h = 36;
- _anims[9] = IMG_Load("art/_anims9.bmp", true);
+ _anims[9] = IMG_Load("art/anims9.bmp", true);
// huge
_animset9[0].xofs = 8;
@@ -8046,17 +8046,17 @@ void GriffonEngine::sys_LoadAnims() {
_animset9[5].w = 42;
_animset9[5].h = 36;
- _anims[3] = IMG_Load("art/_anims3.bmp", true);
- _anims[4] = IMG_Load("art/_anims4.bmp", true);
- _anims[5] = IMG_Load("art/_anims5.bmp", true);
- _anims[6] = IMG_Load("art/_anims6.bmp", true);
- _anims[7] = IMG_Load("art/_anims7.bmp", true);
- _anims[8] = IMG_Load("art/_anims8.bmp", true);
- _anims[10] = IMG_Load("art/_anims10.bmp", true);
- _animsa[10] = IMG_Load("art/_anims10a.bmp", true);
- _anims[11] = IMG_Load("art/_anims11.bmp", true);
- _animsa[11] = IMG_Load("art/_anims11a.bmp", true);
- _anims[12] = IMG_Load("art/_anims12.bmp", true);
+ _anims[3] = IMG_Load("art/anims3.bmp", true);
+ _anims[4] = IMG_Load("art/anims4.bmp", true);
+ _anims[5] = IMG_Load("art/anims5.bmp", true);
+ _anims[6] = IMG_Load("art/anims6.bmp", true);
+ _anims[7] = IMG_Load("art/anims7.bmp", true);
+ _anims[8] = IMG_Load("art/anims8.bmp", true);
+ _anims[10] = IMG_Load("art/anims10.bmp", true);
+ _animsa[10] = IMG_Load("art/anims10a.bmp", true);
+ _anims[11] = IMG_Load("art/anims11.bmp", true);
+ _animsa[11] = IMG_Load("art/anims11a.bmp", true);
+ _anims[12] = IMG_Load("art/anims12.bmp", true);
}
void GriffonEngine::sys_LoadItemImgs() {
@@ -8115,7 +8115,7 @@ void GriffonEngine::sys_LoadTiles() {
void GriffonEngine::sys_LoadTriggers() {
Common::File file;
- file.open("data/_triggers.dat");
+ file.open("data/triggers.dat");
for (int i = 0; i <= 9999; i++) {
for (int a = 0; a <= 8; a++) {
@@ -8221,35 +8221,35 @@ void GriffonEngine::sys_setupAudio() {
_mmenu = Mix_LoadWAV("music/menu.ogg");
sys_progress(7, 21);
- _sfx[0] = Mix_LoadWAV("_sfx/bite.ogg");
+ _sfx[0] = Mix_LoadWAV("sfx/bite.ogg");
sys_progress(8, 21);
- _sfx[1] = Mix_LoadWAV("_sfx/crystal.ogg");
+ _sfx[1] = Mix_LoadWAV("sfx/crystal.ogg");
sys_progress(9, 21);
- _sfx[2] = Mix_LoadWAV("_sfx/door.ogg");
+ _sfx[2] = Mix_LoadWAV("sfx/door.ogg");
sys_progress(10, 21);
- _sfx[3] = Mix_LoadWAV("_sfx/enemyhit.ogg");
+ _sfx[3] = Mix_LoadWAV("sfx/enemyhit.ogg");
sys_progress(11, 21);
- _sfx[4] = Mix_LoadWAV("_sfx/ice.ogg");
+ _sfx[4] = Mix_LoadWAV("sfx/ice.ogg");
sys_progress(12, 21);
- _sfx[5] = Mix_LoadWAV("_sfx/lever.ogg");
+ _sfx[5] = Mix_LoadWAV("sfx/lever.ogg");
sys_progress(13, 21);
- _sfx[6] = Mix_LoadWAV("_sfx/lightning.ogg");
+ _sfx[6] = Mix_LoadWAV("sfx/lightning.ogg");
sys_progress(14, 21);
- _sfx[7] = Mix_LoadWAV("_sfx/metalhit.ogg");
+ _sfx[7] = Mix_LoadWAV("sfx/metalhit.ogg");
sys_progress(15, 21);
- _sfx[8] = Mix_LoadWAV("_sfx/powerup.ogg");
+ _sfx[8] = Mix_LoadWAV("sfx/powerup.ogg");
sys_progress(16, 21);
- _sfx[9] = Mix_LoadWAV("_sfx/rocks.ogg");
+ _sfx[9] = Mix_LoadWAV("sfx/rocks.ogg");
sys_progress(17, 21);
- _sfx[10] = Mix_LoadWAV("_sfx/swordhit.ogg");
+ _sfx[10] = Mix_LoadWAV("sfx/swordhit.ogg");
sys_progress(18, 21);
- _sfx[11] = Mix_LoadWAV("_sfx/throw.ogg");
+ _sfx[11] = Mix_LoadWAV("sfx/throw.ogg");
sys_progress(19, 21);
- _sfx[12] = Mix_LoadWAV("_sfx/chest.ogg");
+ _sfx[12] = Mix_LoadWAV("sfx/chest.ogg");
sys_progress(20, 21);
- _sfx[13] = Mix_LoadWAV("_sfx/fire.ogg");
+ _sfx[13] = Mix_LoadWAV("sfx/fire.ogg");
sys_progress(21, 21);
- _sfx[14] = Mix_LoadWAV("_sfx/beep.ogg");
+ _sfx[14] = Mix_LoadWAV("sfx/beep.ogg");
}
}
Commit: afb67042c8319a8ecae067eb0e04b1ca1f0bb289
https://github.com/scummvm/scummvm/commit/afb67042c8319a8ecae067eb0e04b1ca1f0bb289
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Rename sound method
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 4069d6a..307ded7 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -115,7 +115,7 @@ int GriffonEngine::Mix_getHandle() {
return -1;
}
-int GriffonEngine::Mix_PlayChannel(DataChunk *chunk, bool looped) {
+int GriffonEngine::playSound(DataChunk *chunk, bool looped) {
int ch = Mix_getHandle();
#ifdef USE_VORBIS
@@ -420,7 +420,7 @@ void GriffonEngine::game_attack() {
_objmapf[_curmap][lx][ly - 1] = 1;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
+ int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -434,7 +434,7 @@ void GriffonEngine::game_attack() {
if (oscript == 0 && _player.inventory[kInvFlask] == 9) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndChest]);
+ int snd = playSound(_sfx[kSndChest]);
Mix_Volume(snd, config.effectsvol);
}
@@ -458,7 +458,7 @@ void GriffonEngine::game_attack() {
_scriptflag[kScriptCitadelMasterKey][0] = 2;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
+ int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -475,7 +475,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(7, lx * 16, (ly - 1) * 16);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
+ int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -495,7 +495,7 @@ void GriffonEngine::game_attack() {
_itemticks = _ticks + 215;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
+ int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -515,7 +515,7 @@ void GriffonEngine::game_attack() {
_itemticks = _ticks + 215;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
+ int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -536,7 +536,7 @@ void GriffonEngine::game_attack() {
}
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
+ int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -549,7 +549,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(16, lx * 16, (ly - 1) * 16);
} else {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndChest]);
+ int snd = playSound(_sfx[kSndChest]);
Mix_Volume(snd, config.effectsvol);
}
@@ -564,7 +564,7 @@ void GriffonEngine::game_attack() {
_objmapf[_curmap][lx][ly - 1] = 1;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
+ int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -578,7 +578,7 @@ void GriffonEngine::game_attack() {
if (oscript == kScriptBlueFlask && _player.inventory[kInvDoubleFlask] == 9) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndChest]);
+ int snd = playSound(_sfx[kSndChest]);
Mix_Volume(snd, config.effectsvol);
}
@@ -594,7 +594,7 @@ void GriffonEngine::game_attack() {
_objmapf[_curmap][lx][ly - 1] = 1;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
+ int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -608,7 +608,7 @@ void GriffonEngine::game_attack() {
if (oscript == kScriptBlueFlaskChest && _player.inventory[kInvDoubleFlask] == 9) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndChest]);
+ int snd = playSound(_sfx[kSndChest]);
Mix_Volume(snd, config.effectsvol);
}
@@ -624,7 +624,7 @@ void GriffonEngine::game_attack() {
_objmapf[_curmap][lx][ly - 1] = 1;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
+ int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -638,7 +638,7 @@ void GriffonEngine::game_attack() {
if (oscript == kScriptLightningChest && _player.inventory[kInvShock] == 9) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndChest]);
+ int snd = playSound(_sfx[kSndChest]);
Mix_Volume(snd, config.effectsvol);
}
@@ -653,7 +653,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(5, lx * 16, (ly - 1) * 16);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
+ int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -670,13 +670,13 @@ void GriffonEngine::game_attack() {
_scriptflag[kScriptLever][0] = 1;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndLever]);
+ int snd = playSound(_sfx[kSndLever]);
Mix_Volume(snd, config.effectsvol);
}
} else if (_curmap == 58 && _scriptflag[kScriptLever][0] > 0) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndDoor]);
+ int snd = playSound(_sfx[kSndDoor]);
Mix_Volume(snd, config.effectsvol);
}
@@ -685,14 +685,14 @@ void GriffonEngine::game_attack() {
if (_curmap == 54 && _scriptflag[kScriptLever][0] == 1) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndLever]);
+ int snd = playSound(_sfx[kSndLever]);
Mix_Volume(snd, config.effectsvol);
}
_scriptflag[kScriptLever][0] = 2;
} else if (_curmap == 54 && _scriptflag[kScriptLever][0] > 1) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndDoor]);
+ int snd = playSound(_sfx[kSndDoor]);
Mix_Volume(snd, config.effectsvol);
}
@@ -709,7 +709,7 @@ void GriffonEngine::game_attack() {
_itemticks = _ticks + 215;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
+ int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -726,7 +726,7 @@ void GriffonEngine::game_attack() {
_itemticks = _ticks + 215;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
+ int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -743,7 +743,7 @@ void GriffonEngine::game_attack() {
_itemticks = _ticks + 215;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
+ int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -840,13 +840,13 @@ void GriffonEngine::game_castspell(int spellnum, float homex, float homey, float
if (_menabled && config.effects) {
if (spellnum == 1) {
- int snd = Mix_PlayChannel(_sfx[kSndThrow]);
+ int snd = playSound(_sfx[kSndThrow]);
Mix_Volume(snd, config.effectsvol);
} else if (spellnum == 5) {
- int snd = Mix_PlayChannel(_sfx[kSndCrystal]);
+ int snd = playSound(_sfx[kSndCrystal]);
Mix_Volume(snd, config.effectsvol);
} else if (spellnum == 8 || spellnum == 9) {
- int snd = Mix_PlayChannel(_sfx[kSndLightning]);
+ int snd = playSound(_sfx[kSndLightning]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -894,7 +894,7 @@ void GriffonEngine::game_checkhit() {
if (hit) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndSwordHit]);
+ int snd = playSound(_sfx[kSndSwordHit]);
Mix_Volume(snd, config.effectsvol);
}
@@ -966,7 +966,7 @@ void GriffonEngine::game_checkinputs() {
_player.inventory[kInvFlask]--;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
+ int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -992,7 +992,7 @@ void GriffonEngine::game_checkinputs() {
_player.inventory[kInvDoubleFlask]--;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
+ int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -1427,7 +1427,7 @@ void GriffonEngine::game_configmenu() {
Mix_Volume(_menuchannel, config.musicvol);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndDoor]);
+ int snd = playSound(_sfx[kSndDoor]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -1450,7 +1450,7 @@ void GriffonEngine::game_configmenu() {
Mix_Volume(_menuchannel, config.musicvol);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndDoor]);
+ int snd = playSound(_sfx[kSndDoor]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -1541,7 +1541,7 @@ void GriffonEngine::game_configmenu() {
if (cursel == 7 && config.music == 0) {
config.music = 1;
if (_menabled == 1) {
- _menuchannel = Mix_PlayChannel(_mmenu, true);
+ _menuchannel = playSound(_mmenu, true);
Mix_Volume(_menuchannel, config.musicvol);
}
}
@@ -1553,7 +1553,7 @@ void GriffonEngine::game_configmenu() {
if (cursel == 9 && config.effects == 0) {
config.effects = 1;
if (_menabled == 1) {
- int snd = Mix_PlayChannel(_sfx[kSndDoor]);
+ int snd = playSound(_sfx[kSndDoor]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -2833,7 +2833,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (_player.hp > 0) {
game_damageplayer(damage);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndFire]);
+ int snd = playSound(_sfx[kSndFire]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -2859,7 +2859,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (_player.hp > 0) {
game_damageplayer(damage);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndFire]);
+ int snd = playSound(_sfx[kSndFire]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -3178,7 +3178,7 @@ void GriffonEngine::game_endofgame() {
if (_menabled && config.music) {
Mix_HaltChannel(-1);
- _musicchannel = Mix_PlayChannel(_mendofgame, true);
+ _musicchannel = playSound(_mendofgame, true);
Mix_Volume(_musicchannel, 0);
}
@@ -3681,7 +3681,7 @@ void GriffonEngine::game_handlewalking() {
_objmapf[_curmap][lx][ly] = 1;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
+ int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -3695,7 +3695,7 @@ void GriffonEngine::game_handlewalking() {
_objmapf[_curmap][lx][ly] = 1;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
+ int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -3711,7 +3711,7 @@ void GriffonEngine::game_handlewalking() {
_scriptflag[kScriptLightningBomb][1] = 1;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
+ int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -3726,7 +3726,7 @@ void GriffonEngine::game_handlewalking() {
_objmapf[_curmap][lx][ly] = 1;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
+ int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -4564,7 +4564,7 @@ void GriffonEngine::game_newgame() {
if (_menabled && config.music) {
Mix_HaltChannel(-1);
- _musicchannel = Mix_PlayChannel(_mendofgame, true);
+ _musicchannel = playSound(_mendofgame, true);
Mix_Volume(_musicchannel, 0);
}
@@ -4806,7 +4806,7 @@ void GriffonEngine::game_processtrigger(int trignum) {
if (tmap > 0) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndDoor]);
+ int snd = playSound(_sfx[kSndDoor]);
Mix_Volume(snd, config.effectsvol);
}
@@ -5339,7 +5339,7 @@ void GriffonEngine::game_title(int mode) {
Mix_Volume(_musicchannel, 0);
Mix_Pause(_musicchannel);
- _menuchannel = Mix_PlayChannel(_mmenu, true);
+ _menuchannel = playSound(_mmenu, true);
Mix_Volume(_menuchannel, config.musicvol);
_pmenu = true;
}
@@ -5567,7 +5567,7 @@ void GriffonEngine::game_updmusic() {
if (iplaysound == _mgardens)
_pgardens = true;
- _musicchannel = Mix_PlayChannel(iplaysound, true);
+ _musicchannel = playSound(iplaysound, true);
Mix_Volume(_musicchannel, config.musicvol);
} else {
if (!Mix_Playing(_musicchannel)) {
@@ -5578,13 +5578,13 @@ void GriffonEngine::game_updmusic() {
if (_pgardens) {
Mix_HaltChannel(_musicchannel);
if (_pgardens && _loopseta == 0)
- _musicchannel = Mix_PlayChannel(_mgardens);
+ _musicchannel = playSound(_mgardens);
if (_pgardens && _loopseta == 1)
- _musicchannel = Mix_PlayChannel(_mgardens2);
+ _musicchannel = playSound(_mgardens2);
if (_pgardens && _loopseta == 2)
- _musicchannel = Mix_PlayChannel(_mgardens3);
+ _musicchannel = playSound(_mgardens3);
if (_pgardens && _loopseta == 3)
- _musicchannel = Mix_PlayChannel(_mgardens4);
+ _musicchannel = playSound(_mgardens4);
}
Mix_Volume(_musicchannel, config.musicvol);
@@ -6007,7 +6007,7 @@ void GriffonEngine::game_updnpcs() {
_npcinfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndEnemyHit]);
+ int snd = playSound(_sfx[kSndEnemyHit]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6034,7 +6034,7 @@ void GriffonEngine::game_updnpcs() {
if ((dist) < 24) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndBite]);
+ int snd = playSound(_sfx[kSndBite]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6140,7 +6140,7 @@ void GriffonEngine::game_updnpcs() {
if ((dist) < 36) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndBite]);
+ int snd = playSound(_sfx[kSndBite]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6320,7 +6320,7 @@ void GriffonEngine::game_updnpcs() {
if ((dist) < 24) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndBite]);
+ int snd = playSound(_sfx[kSndBite]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6394,7 +6394,7 @@ void GriffonEngine::game_updnpcs() {
_npcinfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndEnemyHit]);
+ int snd = playSound(_sfx[kSndEnemyHit]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6419,7 +6419,7 @@ void GriffonEngine::game_updnpcs() {
_npcinfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndIce]);
+ int snd = playSound(_sfx[kSndIce]);
Mix_Volume(snd, config.effectsvol);
}
_npcinfo[i].attacking = 1;
@@ -6800,7 +6800,7 @@ void GriffonEngine::game_updspells() {
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
game_damagenpc(e, damage, 1);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndIce]);
+ int snd = playSound(_sfx[kSndIce]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -6828,7 +6828,7 @@ void GriffonEngine::game_updspells() {
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndIce]);
+ int snd = playSound(_sfx[kSndIce]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -6879,7 +6879,7 @@ void GriffonEngine::game_updspells() {
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
game_damagenpc(e, damage, 1);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndMetalHit]);
+ int snd = playSound(_sfx[kSndMetalHit]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -6922,7 +6922,7 @@ void GriffonEngine::game_updspells() {
if (_player.hp > 0) {
game_damageplayer(damage);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndMetalHit]);
+ int snd = playSound(_sfx[kSndMetalHit]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -6950,7 +6950,7 @@ void GriffonEngine::game_updspells() {
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndMetalHit]);
+ int snd = playSound(_sfx[kSndMetalHit]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -7001,7 +7001,7 @@ void GriffonEngine::game_updspells() {
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
game_damagenpc(e, damage, 1);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndRocks]);
+ int snd = playSound(_sfx[kSndRocks]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -7030,7 +7030,7 @@ void GriffonEngine::game_updspells() {
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndRocks]);
+ int snd = playSound(_sfx[kSndRocks]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -7229,7 +7229,7 @@ void GriffonEngine::game_updspells() {
game_damageplayer(damage);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndFire]);
+ int snd = playSound(_sfx[kSndFire]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -7717,7 +7717,7 @@ void GriffonEngine::game_updspellsunder() {
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
game_damagenpc(e, damage, 1);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndFire]);
+ int snd = playSound(_sfx[kSndFire]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -7736,7 +7736,7 @@ void GriffonEngine::game_updspellsunder() {
game_damageplayer(damage);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndFire]);
+ int snd = playSound(_sfx[kSndFire]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -7761,7 +7761,7 @@ void GriffonEngine::game_updspellsunder() {
_clipbg2->fillRect(rcSrc, 0);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndFire]);
+ int snd = playSound(_sfx[kSndFire]);
Mix_Volume(snd, config.effectsvol);
}
@@ -7832,7 +7832,7 @@ void GriffonEngine::game_updspellsunder() {
if (_player.hp > 0) {
game_damageplayer(damage);
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndFire]);
+ int snd = playSound(_sfx[kSndFire]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -8343,7 +8343,7 @@ void GriffonEngine::sys_update() {
_player.spelldamage = _player.level * 13 / 10;
if (_menabled && config.effects) {
- int snd = Mix_PlayChannel(_sfx[kSndPowerUp]);
+ int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
}
@@ -8405,7 +8405,7 @@ void GriffonEngine::sys_update() {
if (_player.hpflashb == 2)
_player.hpflashb = 0;
if (_menabled && config.effects && _player.hpflashb == 0 && _player.hp < _player.maxhp / 4) {
- int snd = Mix_PlayChannel(_sfx[kSndBeep]);
+ int snd = playSound(_sfx[kSndBeep]);
Mix_Volume(snd, config.effectsvol);
}
}
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index f98964c..4ddeec6 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -315,7 +315,7 @@ private:
void Mix_Volume(int channel, int volume);
int Mix_getHandle();
- int Mix_PlayChannel(DataChunk *chunk, bool looped = false);
+ int playSound(DataChunk *chunk, bool looped = false);
void Mix_Pause(int channel);
void Mix_HaltChannel(int channel);
void Mix_Resume(int channel);
Commit: 0648af2b8845c5840c0255c0631f0918bb524533
https://github.com/scummvm/scummvm/commit/0648af2b8845c5840c0255c0631f0918bb524533
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Remove useless code from game_configmenu, enable the part handlign Return key
Changed paths:
engines/griffon/engine.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 307ded7..75bfa23 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -1219,21 +1219,16 @@ void GriffonEngine::game_checktrigger() {
game_processtrigger(_triggerloc[lx][ly]);
}
-#ifdef OPENDINGUX
#define MINCURSEL 7
#define MAXCURSEL 14
#define SY 22
-#else
-#define MINCURSEL 0
-#define MAXCURSEL 14
-#define SY (38 + (240 - 38) / 2 - 88)
-#endif
void GriffonEngine::game_configmenu() {
int cursel = MINCURSEL;
+ int tickwait = 1000 / 60;
+
_ticks = g_system->getMillis();
- int tickwait = 100;
int keypause = _ticks + tickwait;
Graphics::TransparentSurface *configwindow = IMG_Load("art/configwindow.bmp", true);
@@ -1267,30 +1262,18 @@ void GriffonEngine::game_configmenu() {
for (int i = 0; i <= 21; i++) {
static const char *vr[22] = {
-#ifdef OPENDINGUX
"", "",
"", "", "", "",
"", "", "",
-#else
- "Resolution:", "",
- "Bit Depth:", "", "", "",
- "Start Fullscreen:", "", "",
-#endif
"Music:", "", "",
"Sound Effects:", "", "",
"Music Volume:", "",
"Effects Volume:", "", "", "", ""
};
static const char *vl[22] = {
-#ifdef OPENDINGUX
"", "",
"", "", "", "",
"", "", "",
-#else
- "320x240", "640x480",
- "16", "24", "32", "",
- "Yes", "No", "",
-#endif
"On", "Off", "",
"On", "Off", "",
"[----------]", "",
@@ -1313,41 +1296,23 @@ void GriffonEngine::game_configmenu() {
}
int cl = 3;
- if (i == 0 && config.scr_width == 320)
- cl = 0;
- if (i == 1 && config.scr_width == 640)
- cl = 0;
- if (i == 2 && config.scr_bpp == 16)
- cl = 0;
- if (i == 3 && config.scr_bpp == 24)
- cl = 0;
- if (i == 4 && config.scr_bpp == 32)
- cl = 0;
- if (i == 6 && config.fullscreen)
- cl = 0;
- if (i == 7 && !config.fullscreen)
- cl = 0;
+
if (i == 9 && config.music)
cl = 0;
- if (i == 10 && !config.music)
+ else if (i == 10 && !config.music)
cl = 0;
- if (i == 12 && config.effects)
+ else if (i == 12 && config.effects)
cl = 0;
- if (i == 13 && !config.effects)
+ else if (i == 13 && !config.effects)
cl = 0;
-
- if (i > 18)
+ else if (i > 18)
cl = 0;
sys_print(_videobuffer, vr[i], 156 - 8 * strlen(vr[i]), sy + i * 8, 0);
sys_print(_videobuffer, vl[i], 164, sy + i * 8, cl);
}
- int curselt = cursel;
- if (cursel > 4)
- curselt += 1;
- if (cursel > 6)
- curselt += 1;
+ int curselt = cursel + 2;
if (cursel > 8)
curselt += 1;
if (cursel > 10)
@@ -1468,104 +1433,33 @@ void GriffonEngine::game_configmenu() {
}
if (_event.kbd.keycode == Common::KEYCODE_RETURN) {
-#if 0
- if (cursel == 0) {
- fullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
-
- _video = SDL_SetVideoMode(320, 240, config.scr_bpp, fullscreen);
- if (_video == 0) {
- _video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
- } else {
- config.scr_width = 320;
- config.scr_height = 240;
- }
-
- SDL_UpdateRect(_video, 0, 0, config.scr_width, config.scr_height);
- }
- if (cursel == 1) {
- fullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
-
- _video = SDL_SetVideoMode(640, 480, config.scr_bpp, fullscreen);
- if (_video == 0) {
- _video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
- } else {
- config.scr_width = 640;
- config.scr_height = 480;
- }
-
- SDL_UpdateRect(_video, 0, 0, config.scr_width, config.scr_height);
- }
- if (cursel == 2 || cursel == 3 || cursel == 4) {
- fullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
-
- int b = 16;
- if (cursel == 3)
- b = 24;
- if (cursel == 4)
- b = 32;
- _video = SDL_SetVideoMode(config.scr_width, config.scr_height, b, fullscreen);
- if (_video == 0) {
- _video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
- } else {
- config.scr_bpp = b;
- }
-
- SDL_UpdateRect(_video, 0, 0, config.scr_width, config.scr_height);
- }
- if (cursel == 5) {
- ofullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
- fullscreen = SDL_FULLSCREEN | config.hwaccel | config.hwsurface;
-
- _video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
- if (_video == 0) {
- _video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, ofullscreen);
- } else {
- config.fullscreen = SDL_FULLSCREEN;
- }
-
- SDL_UpdateRect(_video, 0, 0, config.scr_width, config.scr_height);
- }
- if (cursel == 6) {
- ofullscreen = config.fullscreen | config.hwaccel | config.hwsurface;
- fullscreen = 0 | config.hwaccel | config.hwsurface;
-
- _video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, fullscreen);
- if (_video == 0) {
- _video = SDL_SetVideoMode(config.scr_width, config.scr_height, config.scr_bpp, ofullscreen);
- } else {
- config.fullscreen = 0;
- }
-
- SDL_UpdateRect(_video, 0, 0, config.scr_width, config.scr_height);
- }
- if (cursel == 7 && config.music == 0) {
- config.music = 1;
- if (_menabled == 1) {
+ if (cursel == 7 && !config.music) {
+ config.music = true;
+ if (_menabled) {
_menuchannel = playSound(_mmenu, true);
Mix_Volume(_menuchannel, config.musicvol);
}
}
- if (cursel == 8 && config.music == 1) {
- config.music = 0;
+ if (cursel == 8 && config.music) {
+ config.music = false;
Mix_HaltChannel(_musicchannel);
Mix_HaltChannel(_menuchannel);
}
- if (cursel == 9 && config.effects == 0) {
- config.effects = 1;
- if (_menabled == 1) {
+ if (cursel == 9 && !config.effects) {
+ config.effects = true;
+ if (_menabled) {
int snd = playSound(_sfx[kSndDoor]);
Mix_Volume(snd, config.effectsvol);
}
}
if (cursel == 10 && config.effects)
- config.effects = 0;
+ config.effects = false;
if (cursel == 13) {
config_save(&config);
break;
}
-#endif
if (cursel == 14) {
// reset keys to avoid returning
@@ -1578,7 +1472,7 @@ void GriffonEngine::game_configmenu() {
clouddeg += 0.01 * _fpsr;
while (clouddeg >= 360)
- clouddeg = clouddeg - 360;
+ clouddeg -= 360;
g_system->delayMillis(10);
} while (!_shouldQuit);
@@ -4571,7 +4465,7 @@ void GriffonEngine::game_newgame() {
_secsingame = 0;
_secstart = 0;
- int ldstop = 0;
+ bool ldstop = false;
do {
Common::Rect rc;
@@ -4579,10 +4473,10 @@ void GriffonEngine::game_newgame() {
ld += 4 * _fpsr;
if ((int)ld > config.musicvol)
ld = config.musicvol;
- if (_menabled && ldstop == 0) {
+ if (_menabled && !ldstop) {
Mix_Volume(_musicchannel, (int)ld);
if ((int)ld == config.musicvol)
- ldstop = 1;
+ ldstop = true;
}
rc.left = -xofs;
Commit: daa06c0c7d59690ae3e74aa73848265049c00c77
https://github.com/scummvm/scummvm/commit/daa06c0c7d59690ae3e74aa73848265049c00c77
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Remove menabled as it's unused (always true)
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 75bfa23..01021e0 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -419,7 +419,7 @@ void GriffonEngine::game_attack() {
_objmapf[_curmap][lx][ly - 1] = 1;
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -433,7 +433,7 @@ void GriffonEngine::game_attack() {
}
if (oscript == 0 && _player.inventory[kInvFlask] == 9) {
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndChest]);
Mix_Volume(snd, config.effectsvol);
}
@@ -457,7 +457,7 @@ void GriffonEngine::game_attack() {
if (_curmap == 81)
_scriptflag[kScriptCitadelMasterKey][0] = 2;
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -474,7 +474,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(7, lx * 16, (ly - 1) * 16);
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -494,7 +494,7 @@ void GriffonEngine::game_attack() {
_itemticks = _ticks + 215;
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -514,7 +514,7 @@ void GriffonEngine::game_attack() {
_itemticks = _ticks + 215;
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -535,7 +535,7 @@ void GriffonEngine::game_attack() {
}
}
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -548,7 +548,7 @@ void GriffonEngine::game_attack() {
game_eventtext("Found Key");
game_addFloatIcon(16, lx * 16, (ly - 1) * 16);
} else {
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndChest]);
Mix_Volume(snd, config.effectsvol);
}
@@ -563,7 +563,7 @@ void GriffonEngine::game_attack() {
_objmapf[_curmap][lx][ly - 1] = 1;
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -577,7 +577,7 @@ void GriffonEngine::game_attack() {
}
if (oscript == kScriptBlueFlask && _player.inventory[kInvDoubleFlask] == 9) {
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndChest]);
Mix_Volume(snd, config.effectsvol);
}
@@ -593,7 +593,7 @@ void GriffonEngine::game_attack() {
_objmapf[_curmap][lx][ly - 1] = 1;
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -607,7 +607,7 @@ void GriffonEngine::game_attack() {
}
if (oscript == kScriptBlueFlaskChest && _player.inventory[kInvDoubleFlask] == 9) {
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndChest]);
Mix_Volume(snd, config.effectsvol);
}
@@ -623,7 +623,7 @@ void GriffonEngine::game_attack() {
_objmapf[_curmap][lx][ly - 1] = 1;
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -637,7 +637,7 @@ void GriffonEngine::game_attack() {
}
if (oscript == kScriptLightningChest && _player.inventory[kInvShock] == 9) {
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndChest]);
Mix_Volume(snd, config.effectsvol);
}
@@ -652,7 +652,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(5, lx * 16, (ly - 1) * 16);
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -669,13 +669,13 @@ void GriffonEngine::game_attack() {
if (_curmap == 58 && _scriptflag[kScriptLever][0] == 0) {
_scriptflag[kScriptLever][0] = 1;
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndLever]);
Mix_Volume(snd, config.effectsvol);
}
} else if (_curmap == 58 && _scriptflag[kScriptLever][0] > 0) {
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndDoor]);
Mix_Volume(snd, config.effectsvol);
}
@@ -684,14 +684,14 @@ void GriffonEngine::game_attack() {
}
if (_curmap == 54 && _scriptflag[kScriptLever][0] == 1) {
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndLever]);
Mix_Volume(snd, config.effectsvol);
}
_scriptflag[kScriptLever][0] = 2;
} else if (_curmap == 54 && _scriptflag[kScriptLever][0] > 1) {
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndDoor]);
Mix_Volume(snd, config.effectsvol);
}
@@ -708,7 +708,7 @@ void GriffonEngine::game_attack() {
_itemticks = _ticks + 215;
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -725,7 +725,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(19, lx * 16, (ly - 1) * 16);
_itemticks = _ticks + 215;
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -742,7 +742,7 @@ void GriffonEngine::game_attack() {
game_addFloatIcon(20, lx * 16, (ly - 1) * 16);
_itemticks = _ticks + 215;
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -838,7 +838,7 @@ void GriffonEngine::game_castspell(int spellnum, float homex, float homey, float
spellinfo[i].nfballs = nballs;
}
- if (_menabled && config.effects) {
+ if (config.effects) {
if (spellnum == 1) {
int snd = playSound(_sfx[kSndThrow]);
Mix_Volume(snd, config.effectsvol);
@@ -893,7 +893,7 @@ void GriffonEngine::game_checkhit() {
}
if (hit) {
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndSwordHit]);
Mix_Volume(snd, config.effectsvol);
}
@@ -965,7 +965,7 @@ void GriffonEngine::game_checkinputs() {
_player.inventory[kInvFlask]--;
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -991,7 +991,7 @@ void GriffonEngine::game_checkinputs() {
_player.inventory[kInvDoubleFlask]--;
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -1391,7 +1391,7 @@ void GriffonEngine::game_configmenu() {
Mix_Volume(_musicchannel, config.musicvol);
Mix_Volume(_menuchannel, config.musicvol);
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndDoor]);
Mix_Volume(snd, config.effectsvol);
}
@@ -1414,7 +1414,7 @@ void GriffonEngine::game_configmenu() {
Mix_Volume(_musicchannel, config.musicvol);
Mix_Volume(_menuchannel, config.musicvol);
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndDoor]);
Mix_Volume(snd, config.effectsvol);
}
@@ -1435,10 +1435,8 @@ void GriffonEngine::game_configmenu() {
if (_event.kbd.keycode == Common::KEYCODE_RETURN) {
if (cursel == 7 && !config.music) {
config.music = true;
- if (_menabled) {
- _menuchannel = playSound(_mmenu, true);
- Mix_Volume(_menuchannel, config.musicvol);
- }
+ _menuchannel = playSound(_mmenu, true);
+ Mix_Volume(_menuchannel, config.musicvol);
}
if (cursel == 8 && config.music) {
config.music = false;
@@ -1447,10 +1445,8 @@ void GriffonEngine::game_configmenu() {
}
if (cursel == 9 && !config.effects) {
config.effects = true;
- if (_menabled) {
- int snd = playSound(_sfx[kSndDoor]);
- Mix_Volume(snd, config.effectsvol);
- }
+ int snd = playSound(_sfx[kSndDoor]);
+ Mix_Volume(snd, config.effectsvol);
}
if (cursel == 10 && config.effects)
@@ -2726,7 +2722,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (_player.hp > 0) {
game_damageplayer(damage);
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
Mix_Volume(snd, config.effectsvol);
}
@@ -2752,7 +2748,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (_player.hp > 0) {
game_damageplayer(damage);
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
Mix_Volume(snd, config.effectsvol);
}
@@ -3070,7 +3066,7 @@ void GriffonEngine::game_endofgame() {
float spd = 0.2f;
- if (_menabled && config.music) {
+ if (config.music) {
Mix_HaltChannel(-1);
_musicchannel = playSound(_mendofgame, true);
Mix_Volume(_musicchannel, 0);
@@ -3084,16 +3080,16 @@ void GriffonEngine::game_endofgame() {
_videobuffer2->copyRectToSurface(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
float ld = 0;
- int ldstop = 0;
+ bool ldstop = false; // CHECKME: Check if actually used
do {
ld = ld + 4 * _fpsr;
if (ld > config.musicvol)
ld = config.musicvol;
- if (_menabled && ldstop == 0) {
+ if (!ldstop) {
Mix_Volume(_musicchannel, (int)ld);
if ((int)ld == config.musicvol)
- ldstop = 1;
+ ldstop = true;
}
ya = 0;
@@ -3574,7 +3570,7 @@ void GriffonEngine::game_handlewalking() {
_objmapf[_curmap][lx][ly] = 1;
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -3588,7 +3584,7 @@ void GriffonEngine::game_handlewalking() {
_objmapf[_curmap][lx][ly] = 1;
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -3604,7 +3600,7 @@ void GriffonEngine::game_handlewalking() {
if (_curmap == 41)
_scriptflag[kScriptLightningBomb][1] = 1;
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -3619,7 +3615,7 @@ void GriffonEngine::game_handlewalking() {
_objmapf[_curmap][lx][ly] = 1;
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -4456,7 +4452,7 @@ void GriffonEngine::game_newgame() {
_fpsr = 0.0;
int y = 140;
- if (_menabled && config.music) {
+ if (config.music) {
Mix_HaltChannel(-1);
_musicchannel = playSound(_mendofgame, true);
Mix_Volume(_musicchannel, 0);
@@ -4473,7 +4469,7 @@ void GriffonEngine::game_newgame() {
ld += 4 * _fpsr;
if ((int)ld > config.musicvol)
ld = config.musicvol;
- if (_menabled && !ldstop) {
+ if (!ldstop) {
Mix_Volume(_musicchannel, (int)ld);
if ((int)ld == config.musicvol)
ldstop = true;
@@ -4622,7 +4618,7 @@ __exit_do:
void GriffonEngine::game_playgame() {
game_swash();
- if (_pmenu && _menabled) {
+ if (_pmenu) {
Mix_HaltChannel(_menuchannel);
_pmenu = false;
}
@@ -4699,7 +4695,7 @@ void GriffonEngine::game_processtrigger(int trignum) {
_player.py = 0;
if (tmap > 0) {
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndDoor]);
Mix_Volume(snd, config.effectsvol);
}
@@ -5229,7 +5225,7 @@ void GriffonEngine::game_title(int mode) {
int keypause = _ticks + 220;
int _ticks1 = _ticks;
- if (_menabled && config.music) {
+ if (config.music) {
Mix_Volume(_musicchannel, 0);
Mix_Pause(_musicchannel);
@@ -5247,7 +5243,7 @@ void GriffonEngine::game_title(int mode) {
ld += 4.0 * _fpsr;
if (ld > config.musicvol)
ld = config.musicvol;
- if (_menabled && !ldstop) {
+ if (!ldstop) {
Mix_Volume(_menuchannel, (int)ld);
if ((int)ld == config.musicvol)
ldstop = true;
@@ -5368,7 +5364,7 @@ void GriffonEngine::game_title(int mode) {
_itemticks = _ticks + 210;
- if (_menabled && config.music) {
+ if (config.music) {
Mix_HaltChannel(_menuchannel);
Mix_Resume(_musicchannel);
Mix_Volume(_musicchannel, config.musicvol);
@@ -5434,7 +5430,7 @@ void GriffonEngine::game_updatey() {
void GriffonEngine::game_updmusic() {
DataChunk *iplaysound = NULL;
- if (_menabled && config.music) {
+ if (config.music) {
// if(_curmap > 5 && _curmap < 42) iplaysound = macademy;
// if(_curmap > 47) iplaysound = _mgardens;
@@ -5900,7 +5896,7 @@ void GriffonEngine::game_updnpcs() {
if (abs(xdif) < 20 && abs(ydif) < 20) {
_npcinfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndEnemyHit]);
Mix_Volume(snd, config.effectsvol);
}
@@ -5927,7 +5923,7 @@ void GriffonEngine::game_updnpcs() {
float dist = sqrt(xdif * xdif + ydif * ydif);
if ((dist) < 24) {
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndBite]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6033,7 +6029,7 @@ void GriffonEngine::game_updnpcs() {
float dist = sqrt(xdif * xdif + ydif * ydif);
if ((dist) < 36) {
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndBite]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6213,7 +6209,7 @@ void GriffonEngine::game_updnpcs() {
float dist = sqrt(xdif * xdif + ydif * ydif);
if ((dist) < 24) {
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndBite]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6287,7 +6283,7 @@ void GriffonEngine::game_updnpcs() {
if (abs(xdif) < 32 && abs(ydif) < 32) {
_npcinfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndEnemyHit]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6312,7 +6308,7 @@ void GriffonEngine::game_updnpcs() {
if (abs(xdif) < 38 && abs(ydif) < 38) {
_npcinfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndIce]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6693,7 +6689,7 @@ void GriffonEngine::game_updspells() {
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
game_damagenpc(e, damage, 1);
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndIce]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6721,7 +6717,7 @@ void GriffonEngine::game_updspells() {
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndIce]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6772,7 +6768,7 @@ void GriffonEngine::game_updspells() {
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
game_damagenpc(e, damage, 1);
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndMetalHit]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6815,7 +6811,7 @@ void GriffonEngine::game_updspells() {
if (_player.hp > 0) {
game_damageplayer(damage);
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndMetalHit]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6843,7 +6839,7 @@ void GriffonEngine::game_updspells() {
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndMetalHit]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6894,7 +6890,7 @@ void GriffonEngine::game_updspells() {
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
game_damagenpc(e, damage, 1);
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndRocks]);
Mix_Volume(snd, config.effectsvol);
}
@@ -6923,7 +6919,7 @@ void GriffonEngine::game_updspells() {
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndRocks]);
Mix_Volume(snd, config.effectsvol);
}
@@ -7122,7 +7118,7 @@ void GriffonEngine::game_updspells() {
if (_player.hp > 0)
game_damageplayer(damage);
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
Mix_Volume(snd, config.effectsvol);
}
@@ -7610,7 +7606,7 @@ void GriffonEngine::game_updspellsunder() {
damage = -damage;
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
game_damagenpc(e, damage, 1);
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
Mix_Volume(snd, config.effectsvol);
}
@@ -7629,7 +7625,7 @@ void GriffonEngine::game_updspellsunder() {
if (_player.hp > 0) {
game_damageplayer(damage);
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
Mix_Volume(snd, config.effectsvol);
}
@@ -7654,7 +7650,7 @@ void GriffonEngine::game_updspellsunder() {
_clipbg2->fillRect(rcSrc, 0);
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
Mix_Volume(snd, config.effectsvol);
}
@@ -7725,7 +7721,7 @@ void GriffonEngine::game_updspellsunder() {
if (_player.hp > 0) {
game_damageplayer(damage);
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
Mix_Volume(snd, config.effectsvol);
}
@@ -8068,8 +8064,6 @@ void GriffonEngine::sys_progress(int w, int wm) {
}
void GriffonEngine::sys_setupAudio() {
- _menabled = true;
-
// FIXME
//Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 1024);
@@ -8099,52 +8093,50 @@ void GriffonEngine::sys_setupAudio() {
rcDest.top = 116 + 12 + 12;
rcDest.setHeight(8);
- if (_menabled) {
- _mboss = Mix_LoadWAV("music/boss.ogg");
- sys_progress(1, 21);
- _mgardens = Mix_LoadWAV("music/gardens.ogg");
- sys_progress(2, 21);
- _mgardens2 = Mix_LoadWAV("music/gardens2.ogg");
- sys_progress(3, 21);
- _mgardens3 = Mix_LoadWAV("music/gardens3.ogg");
- sys_progress(4, 21);
- _mgardens4 = Mix_LoadWAV("music/gardens4.ogg");
- sys_progress(5, 21);
- _mendofgame = Mix_LoadWAV("music/endofgame.ogg");
- sys_progress(6, 21);
- _mmenu = Mix_LoadWAV("music/menu.ogg");
- sys_progress(7, 21);
-
- _sfx[0] = Mix_LoadWAV("sfx/bite.ogg");
- sys_progress(8, 21);
- _sfx[1] = Mix_LoadWAV("sfx/crystal.ogg");
- sys_progress(9, 21);
- _sfx[2] = Mix_LoadWAV("sfx/door.ogg");
- sys_progress(10, 21);
- _sfx[3] = Mix_LoadWAV("sfx/enemyhit.ogg");
- sys_progress(11, 21);
- _sfx[4] = Mix_LoadWAV("sfx/ice.ogg");
- sys_progress(12, 21);
- _sfx[5] = Mix_LoadWAV("sfx/lever.ogg");
- sys_progress(13, 21);
- _sfx[6] = Mix_LoadWAV("sfx/lightning.ogg");
- sys_progress(14, 21);
- _sfx[7] = Mix_LoadWAV("sfx/metalhit.ogg");
- sys_progress(15, 21);
- _sfx[8] = Mix_LoadWAV("sfx/powerup.ogg");
- sys_progress(16, 21);
- _sfx[9] = Mix_LoadWAV("sfx/rocks.ogg");
- sys_progress(17, 21);
- _sfx[10] = Mix_LoadWAV("sfx/swordhit.ogg");
- sys_progress(18, 21);
- _sfx[11] = Mix_LoadWAV("sfx/throw.ogg");
- sys_progress(19, 21);
- _sfx[12] = Mix_LoadWAV("sfx/chest.ogg");
- sys_progress(20, 21);
- _sfx[13] = Mix_LoadWAV("sfx/fire.ogg");
- sys_progress(21, 21);
- _sfx[14] = Mix_LoadWAV("sfx/beep.ogg");
- }
+ _mboss = Mix_LoadWAV("music/boss.ogg");
+ sys_progress(1, 21);
+ _mgardens = Mix_LoadWAV("music/gardens.ogg");
+ sys_progress(2, 21);
+ _mgardens2 = Mix_LoadWAV("music/gardens2.ogg");
+ sys_progress(3, 21);
+ _mgardens3 = Mix_LoadWAV("music/gardens3.ogg");
+ sys_progress(4, 21);
+ _mgardens4 = Mix_LoadWAV("music/gardens4.ogg");
+ sys_progress(5, 21);
+ _mendofgame = Mix_LoadWAV("music/endofgame.ogg");
+ sys_progress(6, 21);
+ _mmenu = Mix_LoadWAV("music/menu.ogg");
+ sys_progress(7, 21);
+
+ _sfx[0] = Mix_LoadWAV("sfx/bite.ogg");
+ sys_progress(8, 21);
+ _sfx[1] = Mix_LoadWAV("sfx/crystal.ogg");
+ sys_progress(9, 21);
+ _sfx[2] = Mix_LoadWAV("sfx/door.ogg");
+ sys_progress(10, 21);
+ _sfx[3] = Mix_LoadWAV("sfx/enemyhit.ogg");
+ sys_progress(11, 21);
+ _sfx[4] = Mix_LoadWAV("sfx/ice.ogg");
+ sys_progress(12, 21);
+ _sfx[5] = Mix_LoadWAV("sfx/lever.ogg");
+ sys_progress(13, 21);
+ _sfx[6] = Mix_LoadWAV("sfx/lightning.ogg");
+ sys_progress(14, 21);
+ _sfx[7] = Mix_LoadWAV("sfx/metalhit.ogg");
+ sys_progress(15, 21);
+ _sfx[8] = Mix_LoadWAV("sfx/powerup.ogg");
+ sys_progress(16, 21);
+ _sfx[9] = Mix_LoadWAV("sfx/rocks.ogg");
+ sys_progress(17, 21);
+ _sfx[10] = Mix_LoadWAV("sfx/swordhit.ogg");
+ sys_progress(18, 21);
+ _sfx[11] = Mix_LoadWAV("sfx/throw.ogg");
+ sys_progress(19, 21);
+ _sfx[12] = Mix_LoadWAV("sfx/chest.ogg");
+ sys_progress(20, 21);
+ _sfx[13] = Mix_LoadWAV("sfx/fire.ogg");
+ sys_progress(21, 21);
+ _sfx[14] = Mix_LoadWAV("sfx/beep.ogg");
}
void GriffonEngine::sys_update() {
@@ -8236,7 +8228,7 @@ void GriffonEngine::sys_update() {
_player.sworddamage = _player.level * 14 / 10;
_player.spelldamage = _player.level * 13 / 10;
- if (_menabled && config.effects) {
+ if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
Mix_Volume(snd, config.effectsvol);
}
@@ -8298,7 +8290,7 @@ void GriffonEngine::sys_update() {
_player.hpflashb = _player.hpflashb + 1;
if (_player.hpflashb == 2)
_player.hpflashb = 0;
- if (_menabled && config.effects && _player.hpflashb == 0 && _player.hp < _player.maxhp / 4) {
+ if (config.effects && _player.hpflashb == 0 && _player.hp < _player.maxhp / 4) {
int snd = playSound(_sfx[kSndBeep]);
Mix_Volume(snd, config.effectsvol);
}
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index 59174bc..f7f852c 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -47,7 +47,6 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
_shouldQuit = false;
- _menabled = true; // TODO. Sync with config
_musicchannel = -1;
_menuchannel = -1;
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 4ddeec6..d35c65e 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -426,7 +426,6 @@ private:
// music info
DataChunk *_mgardens, *_mgardens2, *_mgardens3, *_mgardens4, *_mboss, *_mmenu, *_mendofgame;
- bool _menabled; // CHECKME: Always true?
int _musicchannel, _menuchannel;
bool _ptown, _pacademy, _pcitadel; // CHECKME: They look unused.
bool _pboss;
Commit: e313bc167d13e05f027d7e7832d97ccaacbb7d88
https://github.com/scummvm/scummvm/commit/e313bc167d13e05f027d7e7832d97ccaacbb7d88
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Add a check after calls to file.open
Changed paths:
engines/griffon/config.h
engines/griffon/engine.cpp
engines/griffon/saveload.cpp
diff --git a/engines/griffon/config.h b/engines/griffon/config.h
index 0b6ec89..187ff28 100644
--- a/engines/griffon/config.h
+++ b/engines/griffon/config.h
@@ -45,7 +45,7 @@ struct CONFIG {
int scr_bpp;
bool fullscreen;
int hwaccel;
- int hwsurface;
+ int hwsurface; // Unused
bool music;
int musicvol;
bool effects;
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 01021e0..7d418e2 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -155,9 +155,8 @@ DataChunk *Mix_LoadWAV(const char *name) {
DataChunk *res = new DataChunk;
file.open(name);
- if (!file.isOpen()) {
+ if (!file.isOpen())
error("Cannot open file %s", name);
- }
res->size = file.size();
res->data = (byte *)malloc(res->size);
@@ -3681,18 +3680,20 @@ void GriffonEngine::game_loadmap(int mapnum) {
Common::File file;
file.open(name);
+
+ if (!file.isOpen())
+ error("Cannot open file %s", name);
+
int tempmap[320][200];
for (int x = 0; x <= 319; x++) {
- for (int y = 0; y <= 199; y++) {
+ for (int y = 0; y <= 199; y++)
INPUT("%i", &tempmap[x][y]);
- }
}
file.close();
for (int x = 0; x <= 319; x++) {
- for (int y = 0; y <= 239; y++) {
+ for (int y = 0; y <= 239; y++)
_triggerloc[x][y] = -1;
- }
}
// read *.trg file
@@ -3700,6 +3701,9 @@ void GriffonEngine::game_loadmap(int mapnum) {
debug(1, "Reading %s", name);
file.open(name);
+ if (!file.isOpen())
+ error("Cannot open file %s", name);
+
INPUT("%i", &_ntriggers);
for (int i = 0; i < _ntriggers; i++) {
@@ -3945,6 +3949,9 @@ void GriffonEngine::game_loadmap(int mapnum) {
debug(1, "Reading %s", name);
file.open(name);
+ if (!file.isOpen())
+ error("Cannot open file %s", name);
+
for (int i = 0; i < kMaxNPC; i++) {
INPUT("%i", &_npcinfo[i].spriteset);
INPUT("%i", &_npcinfo[i].x1);
@@ -8007,10 +8014,12 @@ void GriffonEngine::sys_LoadTriggers() {
Common::File file;
file.open("data/triggers.dat");
+ if (!file.isOpen())
+ error("Cannot open file data/Triggers.dat");
+
for (int i = 0; i <= 9999; i++) {
- for (int a = 0; a <= 8; a++) {
+ for (int a = 0; a <= 8; a++)
INPUT("%i", &_triggers[i][a]);
- }
}
file.close();
@@ -8020,6 +8029,8 @@ void GriffonEngine::sys_LoadObjectDB() {
Common::File file;
file.open("objectdb.dat");
+ if (!file.isOpen())
+ error("Cannot open file objectdb.dat");
for (int a = 0; a <= 32; a++) {
for (int b = 0; b <= 5; b++) {
diff --git a/engines/griffon/saveload.cpp b/engines/griffon/saveload.cpp
index 2ff71d0..f0911fc 100644
--- a/engines/griffon/saveload.cpp
+++ b/engines/griffon/saveload.cpp
@@ -125,7 +125,7 @@ int GriffonEngine::state_load(int slotnum) {
return 1; // success
}
- return 0; // faliure
+ return 0; // failure
}
/* fill PLAYERTYPE _playera; */
Commit: 204c7893c0d4ce84bac6ceadc060a3abbb091bd8
https://github.com/scummvm/scummvm/commit/204c7893c0d4ce84bac6ceadc060a3abbb091bd8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Rename sound methods
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 7d418e2..4478c75 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -100,23 +100,22 @@ enum {
*/
-// stubs
-void GriffonEngine::Mix_Volume(int channel, int volume) {}
+void GriffonEngine::setChannelVolume(int channel, int volume) {}
-int GriffonEngine::Mix_getHandle() {
+int GriffonEngine::getSoundHandle() {
for (uint i = 0; i < kSoundHandles; i++) {
if (!_mixer->isSoundHandleActive(_handles[i])) {
return i;
}
}
- error("Mix_getHandle(): Too many sound handles");
+ error("getSoundHandle(): Too many sound handles");
return -1;
}
int GriffonEngine::playSound(DataChunk *chunk, bool looped) {
- int ch = Mix_getHandle();
+ int ch = getSoundHandle();
#ifdef USE_VORBIS
Audio::SeekableAudioStream *audioStream = Audio::makeVorbisStream(new Common::MemoryReadStream(chunk->data, chunk->size), DisposeAfterUse::YES);
@@ -134,23 +133,23 @@ int GriffonEngine::playSound(DataChunk *chunk, bool looped) {
return ch;
}
-void GriffonEngine::Mix_Pause(int channel) {
+void GriffonEngine::pauseSoundChannel(int channel) {
_mixer->pauseHandle(_handles[channel], true);
}
-void GriffonEngine::Mix_HaltChannel(int channel) {
+void GriffonEngine::haltSoundChannel(int channel) {
_mixer->stopHandle(_handles[channel]);
}
-void GriffonEngine::Mix_Resume(int channel) {
+void GriffonEngine::resumeSoundChannel(int channel) {
_mixer->pauseHandle(_handles[channel], false);
}
-bool GriffonEngine::Mix_Playing(int channel) {
+bool GriffonEngine::isSoundChannelPlaying(int channel) {
return _mixer->isSoundHandleActive(_handles[channel]);
}
-DataChunk *Mix_LoadWAV(const char *name) {
+DataChunk *cacheSound(const char *name) {
Common::File file;
DataChunk *res = new DataChunk;
@@ -420,7 +419,7 @@ void GriffonEngine::game_attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
if (_objectInfo[o][4] == 1)
@@ -434,7 +433,7 @@ void GriffonEngine::game_attack() {
if (oscript == 0 && _player.inventory[kInvFlask] == 9) {
if (config.effects) {
int snd = playSound(_sfx[kSndChest]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
game_eventtext("Cannot Carry any more Flasks!");
@@ -458,7 +457,7 @@ void GriffonEngine::game_attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
if (_objectInfo[o][4] == 1)
@@ -475,7 +474,7 @@ void GriffonEngine::game_attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
if (_objectInfo[o][4] == 1)
@@ -495,7 +494,7 @@ void GriffonEngine::game_attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
if (_objectInfo[o][4] == 1)
@@ -515,7 +514,7 @@ void GriffonEngine::game_attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
if (_objectInfo[o][4] == 1)
@@ -536,7 +535,7 @@ void GriffonEngine::game_attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
_objmapf[_curmap][lx][ly - 1] = 1;
@@ -549,7 +548,7 @@ void GriffonEngine::game_attack() {
} else {
if (config.effects) {
int snd = playSound(_sfx[kSndChest]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
game_eventtext("Cannot Carry Any More Keys");
@@ -564,7 +563,7 @@ void GriffonEngine::game_attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
if (_objectInfo[o][4] == 1)
@@ -578,7 +577,7 @@ void GriffonEngine::game_attack() {
if (oscript == kScriptBlueFlask && _player.inventory[kInvDoubleFlask] == 9) {
if (config.effects) {
int snd = playSound(_sfx[kSndChest]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
game_eventtext("Cannot Carry any more Mega Flasks!");
@@ -594,7 +593,7 @@ void GriffonEngine::game_attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
if (_objectInfo[o][4] == 1)
@@ -608,7 +607,7 @@ void GriffonEngine::game_attack() {
if (oscript == kScriptBlueFlaskChest && _player.inventory[kInvDoubleFlask] == 9) {
if (config.effects) {
int snd = playSound(_sfx[kSndChest]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
game_eventtext("Cannot Carry any more Mega Flasks!");
@@ -624,7 +623,7 @@ void GriffonEngine::game_attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
if (_objectInfo[o][4] == 1)
@@ -638,7 +637,7 @@ void GriffonEngine::game_attack() {
if (oscript == kScriptLightningChest && _player.inventory[kInvShock] == 9) {
if (config.effects) {
int snd = playSound(_sfx[kSndChest]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
game_eventtext("Cannot Carry any more Lightning Bombs!");
@@ -653,7 +652,7 @@ void GriffonEngine::game_attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
if (_objectInfo[o][4] == 1)
@@ -670,13 +669,13 @@ void GriffonEngine::game_attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndLever]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
} else if (_curmap == 58 && _scriptflag[kScriptLever][0] > 0) {
if (config.effects) {
int snd = playSound(_sfx[kSndDoor]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
game_eventtext("It's stuck!");
@@ -685,14 +684,14 @@ void GriffonEngine::game_attack() {
if (_curmap == 54 && _scriptflag[kScriptLever][0] == 1) {
if (config.effects) {
int snd = playSound(_sfx[kSndLever]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
_scriptflag[kScriptLever][0] = 2;
} else if (_curmap == 54 && _scriptflag[kScriptLever][0] > 1) {
if (config.effects) {
int snd = playSound(_sfx[kSndDoor]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
game_eventtext("It's stuck!");
@@ -709,7 +708,7 @@ void GriffonEngine::game_attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
if (_objectInfo[o][4] == 1)
@@ -726,7 +725,7 @@ void GriffonEngine::game_attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
if (_objectInfo[o][4] == 1)
@@ -743,7 +742,7 @@ void GriffonEngine::game_attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
if (_objectInfo[o][4] == 1)
@@ -840,13 +839,13 @@ void GriffonEngine::game_castspell(int spellnum, float homex, float homey, float
if (config.effects) {
if (spellnum == 1) {
int snd = playSound(_sfx[kSndThrow]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
} else if (spellnum == 5) {
int snd = playSound(_sfx[kSndCrystal]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
} else if (spellnum == 8 || spellnum == 9) {
int snd = playSound(_sfx[kSndLightning]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
}
@@ -894,7 +893,7 @@ void GriffonEngine::game_checkhit() {
if (hit) {
if (config.effects) {
int snd = playSound(_sfx[kSndSwordHit]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
game_damagenpc(i, damage, 0);
@@ -966,7 +965,7 @@ void GriffonEngine::game_checkinputs() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
_itemselon = 0;
@@ -992,7 +991,7 @@ void GriffonEngine::game_checkinputs() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
_itemselon = 0;
@@ -1379,20 +1378,20 @@ void GriffonEngine::game_configmenu() {
if (config.musicvol < 0)
config.musicvol = 0;
- Mix_Volume(_musicchannel, config.musicvol);
- Mix_Volume(_menuchannel, config.musicvol);
+ setChannelVolume(_musicchannel, config.musicvol);
+ setChannelVolume(_menuchannel, config.musicvol);
} else if (cursel == 12) {
config.effectsvol = config.effectsvol - 25;
if (config.effectsvol < 0)
config.effectsvol = 0;
- Mix_Volume(-1, config.effectsvol);
- Mix_Volume(_musicchannel, config.musicvol);
- Mix_Volume(_menuchannel, config.musicvol);
+ setChannelVolume(-1, config.effectsvol);
+ setChannelVolume(_musicchannel, config.musicvol);
+ setChannelVolume(_menuchannel, config.musicvol);
if (config.effects) {
int snd = playSound(_sfx[kSndDoor]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
}
}
@@ -1402,20 +1401,20 @@ void GriffonEngine::game_configmenu() {
if (config.musicvol > 255)
config.musicvol = 255;
- Mix_Volume(_musicchannel, config.musicvol);
- Mix_Volume(_menuchannel, config.musicvol);
+ setChannelVolume(_musicchannel, config.musicvol);
+ setChannelVolume(_menuchannel, config.musicvol);
} else if (cursel == 12) {
config.effectsvol = config.effectsvol + 25;
if (config.effectsvol > 255)
config.effectsvol = 255;
- Mix_Volume(-1, config.effectsvol);
- Mix_Volume(_musicchannel, config.musicvol);
- Mix_Volume(_menuchannel, config.musicvol);
+ setChannelVolume(-1, config.effectsvol);
+ setChannelVolume(_musicchannel, config.musicvol);
+ setChannelVolume(_menuchannel, config.musicvol);
if (config.effects) {
int snd = playSound(_sfx[kSndDoor]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
}
}
@@ -1435,17 +1434,17 @@ void GriffonEngine::game_configmenu() {
if (cursel == 7 && !config.music) {
config.music = true;
_menuchannel = playSound(_mmenu, true);
- Mix_Volume(_menuchannel, config.musicvol);
+ setChannelVolume(_menuchannel, config.musicvol);
}
if (cursel == 8 && config.music) {
config.music = false;
- Mix_HaltChannel(_musicchannel);
- Mix_HaltChannel(_menuchannel);
+ haltSoundChannel(_musicchannel);
+ haltSoundChannel(_menuchannel);
}
if (cursel == 9 && !config.effects) {
config.effects = true;
int snd = playSound(_sfx[kSndDoor]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
if (cursel == 10 && config.effects)
@@ -2723,7 +2722,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
game_damageplayer(damage);
if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
}
@@ -2749,7 +2748,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
game_damageplayer(damage);
if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
}
}
@@ -3066,9 +3065,9 @@ void GriffonEngine::game_endofgame() {
float spd = 0.2f;
if (config.music) {
- Mix_HaltChannel(-1);
+ haltSoundChannel(-1);
_musicchannel = playSound(_mendofgame, true);
- Mix_Volume(_musicchannel, 0);
+ setChannelVolume(_musicchannel, 0);
}
int _ticks1 = _ticks;
@@ -3086,7 +3085,7 @@ void GriffonEngine::game_endofgame() {
if (ld > config.musicvol)
ld = config.musicvol;
if (!ldstop) {
- Mix_Volume(_musicchannel, (int)ld);
+ setChannelVolume(_musicchannel, (int)ld);
if ((int)ld == config.musicvol)
ldstop = true;
}
@@ -3571,7 +3570,7 @@ void GriffonEngine::game_handlewalking() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
}
@@ -3585,7 +3584,7 @@ void GriffonEngine::game_handlewalking() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
}
@@ -3601,7 +3600,7 @@ void GriffonEngine::game_handlewalking() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
}
@@ -3616,7 +3615,7 @@ void GriffonEngine::game_handlewalking() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
}
@@ -4460,9 +4459,9 @@ void GriffonEngine::game_newgame() {
int y = 140;
if (config.music) {
- Mix_HaltChannel(-1);
+ haltSoundChannel(-1);
_musicchannel = playSound(_mendofgame, true);
- Mix_Volume(_musicchannel, 0);
+ setChannelVolume(_musicchannel, 0);
}
_secsingame = 0;
@@ -4477,7 +4476,7 @@ void GriffonEngine::game_newgame() {
if ((int)ld > config.musicvol)
ld = config.musicvol;
if (!ldstop) {
- Mix_Volume(_musicchannel, (int)ld);
+ setChannelVolume(_musicchannel, (int)ld);
if ((int)ld == config.musicvol)
ldstop = true;
}
@@ -4626,7 +4625,7 @@ void GriffonEngine::game_playgame() {
game_swash();
if (_pmenu) {
- Mix_HaltChannel(_menuchannel);
+ haltSoundChannel(_menuchannel);
_pmenu = false;
}
@@ -4704,7 +4703,7 @@ void GriffonEngine::game_processtrigger(int trignum) {
if (tmap > 0) {
if (config.effects) {
int snd = playSound(_sfx[kSndDoor]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
game_loadmap(tmap);
@@ -4824,7 +4823,7 @@ void GriffonEngine::game_saveloadnew() {
_pacademy = false;
_pcitadel = false;
- Mix_HaltChannel(-1);
+ haltSoundChannel(-1);
_secsingame = 0;
_saveslot = currow - 1;
@@ -5233,11 +5232,11 @@ void GriffonEngine::game_title(int mode) {
int _ticks1 = _ticks;
if (config.music) {
- Mix_Volume(_musicchannel, 0);
- Mix_Pause(_musicchannel);
+ setChannelVolume(_musicchannel, 0);
+ pauseSoundChannel(_musicchannel);
_menuchannel = playSound(_mmenu, true);
- Mix_Volume(_menuchannel, config.musicvol);
+ setChannelVolume(_menuchannel, config.musicvol);
_pmenu = true;
}
@@ -5251,7 +5250,7 @@ void GriffonEngine::game_title(int mode) {
if (ld > config.musicvol)
ld = config.musicvol;
if (!ldstop) {
- Mix_Volume(_menuchannel, (int)ld);
+ setChannelVolume(_menuchannel, (int)ld);
if ((int)ld == config.musicvol)
ldstop = true;
}
@@ -5372,9 +5371,9 @@ void GriffonEngine::game_title(int mode) {
_itemticks = _ticks + 210;
if (config.music) {
- Mix_HaltChannel(_menuchannel);
- Mix_Resume(_musicchannel);
- Mix_Volume(_musicchannel, config.musicvol);
+ haltSoundChannel(_menuchannel);
+ resumeSoundChannel(_musicchannel);
+ setChannelVolume(_musicchannel, config.musicvol);
_pmenu = false;
}
}
@@ -5451,7 +5450,7 @@ void GriffonEngine::game_updmusic() {
iplaysound = NULL;
if (iplaysound != NULL) {
- Mix_HaltChannel(_musicchannel);
+ haltSoundChannel(_musicchannel);
_pboss = false;
_pgardens = false;
@@ -5465,15 +5464,15 @@ void GriffonEngine::game_updmusic() {
_pgardens = true;
_musicchannel = playSound(iplaysound, true);
- Mix_Volume(_musicchannel, config.musicvol);
+ setChannelVolume(_musicchannel, config.musicvol);
} else {
- if (!Mix_Playing(_musicchannel)) {
+ if (!isSoundChannelPlaying(_musicchannel)) {
_loopseta += 1;
if (_loopseta == 4)
_loopseta = 0;
if (_pgardens) {
- Mix_HaltChannel(_musicchannel);
+ haltSoundChannel(_musicchannel);
if (_pgardens && _loopseta == 0)
_musicchannel = playSound(_mgardens);
if (_pgardens && _loopseta == 1)
@@ -5484,7 +5483,7 @@ void GriffonEngine::game_updmusic() {
_musicchannel = playSound(_mgardens4);
}
- Mix_Volume(_musicchannel, config.musicvol);
+ setChannelVolume(_musicchannel, config.musicvol);
}
}
}
@@ -5905,7 +5904,7 @@ void GriffonEngine::game_updnpcs() {
if ((int)(RND() * 2) == 0) {
if (config.effects) {
int snd = playSound(_sfx[kSndEnemyHit]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
_npcinfo[i].attacking = 1;
@@ -5932,7 +5931,7 @@ void GriffonEngine::game_updnpcs() {
if ((dist) < 24) {
if (config.effects) {
int snd = playSound(_sfx[kSndBite]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
_npcinfo[i].attacking = 1;
@@ -6038,7 +6037,7 @@ void GriffonEngine::game_updnpcs() {
if ((dist) < 36) {
if (config.effects) {
int snd = playSound(_sfx[kSndBite]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
_npcinfo[i].attacking = 1;
@@ -6218,7 +6217,7 @@ void GriffonEngine::game_updnpcs() {
if ((dist) < 24) {
if (config.effects) {
int snd = playSound(_sfx[kSndBite]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
_npcinfo[i].attacking = 1;
@@ -6292,7 +6291,7 @@ void GriffonEngine::game_updnpcs() {
if ((int)(RND() * 2) == 0) {
if (config.effects) {
int snd = playSound(_sfx[kSndEnemyHit]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
_npcinfo[i].attacking = 1;
@@ -6317,7 +6316,7 @@ void GriffonEngine::game_updnpcs() {
if ((int)(RND() * 2) == 0) {
if (config.effects) {
int snd = playSound(_sfx[kSndIce]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
_npcinfo[i].attacking = 1;
_npcinfo[i].attackframe = 0;
@@ -6698,7 +6697,7 @@ void GriffonEngine::game_updspells() {
game_damagenpc(e, damage, 1);
if (config.effects) {
int snd = playSound(_sfx[kSndIce]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
}
}
@@ -6726,7 +6725,7 @@ void GriffonEngine::game_updspells() {
if (config.effects) {
int snd = playSound(_sfx[kSndIce]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
}
}
@@ -6777,7 +6776,7 @@ void GriffonEngine::game_updspells() {
game_damagenpc(e, damage, 1);
if (config.effects) {
int snd = playSound(_sfx[kSndMetalHit]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
}
}
@@ -6820,7 +6819,7 @@ void GriffonEngine::game_updspells() {
game_damageplayer(damage);
if (config.effects) {
int snd = playSound(_sfx[kSndMetalHit]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
}
}
@@ -6848,7 +6847,7 @@ void GriffonEngine::game_updspells() {
if (config.effects) {
int snd = playSound(_sfx[kSndMetalHit]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
}
}
@@ -6899,7 +6898,7 @@ void GriffonEngine::game_updspells() {
game_damagenpc(e, damage, 1);
if (config.effects) {
int snd = playSound(_sfx[kSndRocks]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
}
}
@@ -6928,7 +6927,7 @@ void GriffonEngine::game_updspells() {
if (config.effects) {
int snd = playSound(_sfx[kSndRocks]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
}
}
@@ -7127,7 +7126,7 @@ void GriffonEngine::game_updspells() {
if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
}
}
@@ -7615,7 +7614,7 @@ void GriffonEngine::game_updspellsunder() {
game_damagenpc(e, damage, 1);
if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
}
}
@@ -7634,7 +7633,7 @@ void GriffonEngine::game_updspellsunder() {
if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
}
}
@@ -7659,7 +7658,7 @@ void GriffonEngine::game_updspellsunder() {
if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
@@ -7730,7 +7729,7 @@ void GriffonEngine::game_updspellsunder() {
game_damageplayer(damage);
if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
}
@@ -8104,50 +8103,50 @@ void GriffonEngine::sys_setupAudio() {
rcDest.top = 116 + 12 + 12;
rcDest.setHeight(8);
- _mboss = Mix_LoadWAV("music/boss.ogg");
+ _mboss = cacheSound("music/boss.ogg");
sys_progress(1, 21);
- _mgardens = Mix_LoadWAV("music/gardens.ogg");
+ _mgardens = cacheSound("music/gardens.ogg");
sys_progress(2, 21);
- _mgardens2 = Mix_LoadWAV("music/gardens2.ogg");
+ _mgardens2 = cacheSound("music/gardens2.ogg");
sys_progress(3, 21);
- _mgardens3 = Mix_LoadWAV("music/gardens3.ogg");
+ _mgardens3 = cacheSound("music/gardens3.ogg");
sys_progress(4, 21);
- _mgardens4 = Mix_LoadWAV("music/gardens4.ogg");
+ _mgardens4 = cacheSound("music/gardens4.ogg");
sys_progress(5, 21);
- _mendofgame = Mix_LoadWAV("music/endofgame.ogg");
+ _mendofgame = cacheSound("music/endofgame.ogg");
sys_progress(6, 21);
- _mmenu = Mix_LoadWAV("music/menu.ogg");
+ _mmenu = cacheSound("music/menu.ogg");
sys_progress(7, 21);
- _sfx[0] = Mix_LoadWAV("sfx/bite.ogg");
+ _sfx[0] = cacheSound("sfx/bite.ogg");
sys_progress(8, 21);
- _sfx[1] = Mix_LoadWAV("sfx/crystal.ogg");
+ _sfx[1] = cacheSound("sfx/crystal.ogg");
sys_progress(9, 21);
- _sfx[2] = Mix_LoadWAV("sfx/door.ogg");
+ _sfx[2] = cacheSound("sfx/door.ogg");
sys_progress(10, 21);
- _sfx[3] = Mix_LoadWAV("sfx/enemyhit.ogg");
+ _sfx[3] = cacheSound("sfx/enemyhit.ogg");
sys_progress(11, 21);
- _sfx[4] = Mix_LoadWAV("sfx/ice.ogg");
+ _sfx[4] = cacheSound("sfx/ice.ogg");
sys_progress(12, 21);
- _sfx[5] = Mix_LoadWAV("sfx/lever.ogg");
+ _sfx[5] = cacheSound("sfx/lever.ogg");
sys_progress(13, 21);
- _sfx[6] = Mix_LoadWAV("sfx/lightning.ogg");
+ _sfx[6] = cacheSound("sfx/lightning.ogg");
sys_progress(14, 21);
- _sfx[7] = Mix_LoadWAV("sfx/metalhit.ogg");
+ _sfx[7] = cacheSound("sfx/metalhit.ogg");
sys_progress(15, 21);
- _sfx[8] = Mix_LoadWAV("sfx/powerup.ogg");
+ _sfx[8] = cacheSound("sfx/powerup.ogg");
sys_progress(16, 21);
- _sfx[9] = Mix_LoadWAV("sfx/rocks.ogg");
+ _sfx[9] = cacheSound("sfx/rocks.ogg");
sys_progress(17, 21);
- _sfx[10] = Mix_LoadWAV("sfx/swordhit.ogg");
+ _sfx[10] = cacheSound("sfx/swordhit.ogg");
sys_progress(18, 21);
- _sfx[11] = Mix_LoadWAV("sfx/throw.ogg");
+ _sfx[11] = cacheSound("sfx/throw.ogg");
sys_progress(19, 21);
- _sfx[12] = Mix_LoadWAV("sfx/chest.ogg");
+ _sfx[12] = cacheSound("sfx/chest.ogg");
sys_progress(20, 21);
- _sfx[13] = Mix_LoadWAV("sfx/fire.ogg");
+ _sfx[13] = cacheSound("sfx/fire.ogg");
sys_progress(21, 21);
- _sfx[14] = Mix_LoadWAV("sfx/beep.ogg");
+ _sfx[14] = cacheSound("sfx/beep.ogg");
}
void GriffonEngine::sys_update() {
@@ -8241,7 +8240,7 @@ void GriffonEngine::sys_update() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
}
@@ -8303,7 +8302,7 @@ void GriffonEngine::sys_update() {
_player.hpflashb = 0;
if (config.effects && _player.hpflashb == 0 && _player.hp < _player.maxhp / 4) {
int snd = playSound(_sfx[kSndBeep]);
- Mix_Volume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsvol);
}
}
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index d35c65e..9c502d6 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -313,13 +313,13 @@ private:
int state_load_player(int slotnum);
int state_save(int slotnum);
- void Mix_Volume(int channel, int volume);
- int Mix_getHandle();
+ void setChannelVolume(int channel, int volume);
+ int getSoundHandle();
int playSound(DataChunk *chunk, bool looped = false);
- void Mix_Pause(int channel);
- void Mix_HaltChannel(int channel);
- void Mix_Resume(int channel);
- bool Mix_Playing(int channel);
+ void pauseSoundChannel(int channel);
+ void haltSoundChannel(int channel);
+ void resumeSoundChannel(int channel);
+ bool isSoundChannelPlaying(int channel);
private:
Graphics::TransparentSurface *_video, *_videobuffer, *_videobuffer2, *_videobuffer3;
Commit: 297fd21e76dd74717a63ecb536bc3fe68d761e0d
https://github.com/scummvm/scummvm/commit/297fd21e76dd74717a63ecb536bc3fe68d761e0d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Move sound-related method to separate file
Changed paths:
A engines/griffon/sound.cpp
engines/griffon/engine.cpp
engines/griffon/griffon.h
engines/griffon/module.mk
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 4478c75..0cfffac 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -34,10 +34,6 @@
*
*/
-#include "audio/audiostream.h"
-#include "audio/decoders/vorbis.h"
-#include "common/memstream.h"
-
#include "griffon/griffon.h"
#include "griffon/config.h"
#include "griffon/console.h"
@@ -100,72 +96,6 @@ enum {
*/
-void GriffonEngine::setChannelVolume(int channel, int volume) {}
-
-int GriffonEngine::getSoundHandle() {
- for (uint i = 0; i < kSoundHandles; i++) {
- if (!_mixer->isSoundHandleActive(_handles[i])) {
- return i;
- }
- }
-
- error("getSoundHandle(): Too many sound handles");
-
- return -1;
-}
-
-int GriffonEngine::playSound(DataChunk *chunk, bool looped) {
- int ch = getSoundHandle();
-
-#ifdef USE_VORBIS
- Audio::SeekableAudioStream *audioStream = Audio::makeVorbisStream(new Common::MemoryReadStream(chunk->data, chunk->size), DisposeAfterUse::YES);
-
-
- if (looped) {
- Audio::AudioStream *loopingStream = new Audio::LoopingAudioStream(audioStream, 0, DisposeAfterUse::YES);
- _mixer->playStream(Audio::Mixer::kSFXSoundType, &_handles[ch], loopingStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::YES, false, false);
-
- } else {
- _mixer->playStream(Audio::Mixer::kSFXSoundType, &_handles[ch], audioStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::YES, false, false);
- }
-#endif // USE_VORBIS
-
- return ch;
-}
-
-void GriffonEngine::pauseSoundChannel(int channel) {
- _mixer->pauseHandle(_handles[channel], true);
-}
-
-void GriffonEngine::haltSoundChannel(int channel) {
- _mixer->stopHandle(_handles[channel]);
-}
-
-void GriffonEngine::resumeSoundChannel(int channel) {
- _mixer->pauseHandle(_handles[channel], false);
-}
-
-bool GriffonEngine::isSoundChannelPlaying(int channel) {
- return _mixer->isSoundHandleActive(_handles[channel]);
-}
-
-DataChunk *cacheSound(const char *name) {
- Common::File file;
- DataChunk *res = new DataChunk;
-
- file.open(name);
- if (!file.isOpen())
- error("Cannot open file %s", name);
-
- res->size = file.size();
- res->data = (byte *)malloc(res->size);
-
- file.read(res->data, res->size);
-
- return res;
-}
-
-
void GriffonEngine::griffon_main() {
sys_initialize();
game_showlogos();
@@ -335,7 +265,7 @@ void game_fillrect(Graphics::TransparentSurface *surface, int x, int y, int w, i
surface->fillRect(Common::Rect(x, y, x + w, y + h), color);
}
-Graphics::TransparentSurface *IMG_Load(const char *name, bool colorkey = false) {
+Graphics::TransparentSurface *GriffonEngine::IMG_Load(const char *name, bool colorkey) {
Common::File file;
file.open(name);
@@ -8061,94 +7991,6 @@ void GriffonEngine::sys_print(Graphics::TransparentSurface *buffer, const char *
}
}
-void GriffonEngine::sys_progress(int w, int wm) {
- long ccc = _videobuffer->format.RGBToColor(0, 255, 0);
-
- rcDest.setWidth(w * 74 / wm);
- _videobuffer->fillRect(rcDest, ccc);
-
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
- g_system->updateScreen();
-
- g_system->getEventManager()->pollEvent(_event);
-}
-
-void GriffonEngine::sys_setupAudio() {
- // FIXME
- //Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 1024);
-
- //atexit(Mix_Quit);
- //atexit(Mix_CloseAudio);
-
- const char *stri = "Loading...";
- sys_print(_videobuffer, stri, 160 - 4 * strlen(stri), 116, 0);
-
- Graphics::TransparentSurface *loadimg = IMG_Load("art/load.bmp", true);
-
- rcSrc.left = 0;
- rcSrc.top = 0;
- rcSrc.setWidth(88);
- rcSrc.setHeight(32);
-
- rcDest.left = 160 - 44;
- rcDest.top = 116 + 12;
-
- loadimg->setAlpha(160, true); // 128
- loadimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
-
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
- g_system->updateScreen();
-
- rcDest.left = 160 - 44 + 7;
- rcDest.top = 116 + 12 + 12;
- rcDest.setHeight(8);
-
- _mboss = cacheSound("music/boss.ogg");
- sys_progress(1, 21);
- _mgardens = cacheSound("music/gardens.ogg");
- sys_progress(2, 21);
- _mgardens2 = cacheSound("music/gardens2.ogg");
- sys_progress(3, 21);
- _mgardens3 = cacheSound("music/gardens3.ogg");
- sys_progress(4, 21);
- _mgardens4 = cacheSound("music/gardens4.ogg");
- sys_progress(5, 21);
- _mendofgame = cacheSound("music/endofgame.ogg");
- sys_progress(6, 21);
- _mmenu = cacheSound("music/menu.ogg");
- sys_progress(7, 21);
-
- _sfx[0] = cacheSound("sfx/bite.ogg");
- sys_progress(8, 21);
- _sfx[1] = cacheSound("sfx/crystal.ogg");
- sys_progress(9, 21);
- _sfx[2] = cacheSound("sfx/door.ogg");
- sys_progress(10, 21);
- _sfx[3] = cacheSound("sfx/enemyhit.ogg");
- sys_progress(11, 21);
- _sfx[4] = cacheSound("sfx/ice.ogg");
- sys_progress(12, 21);
- _sfx[5] = cacheSound("sfx/lever.ogg");
- sys_progress(13, 21);
- _sfx[6] = cacheSound("sfx/lightning.ogg");
- sys_progress(14, 21);
- _sfx[7] = cacheSound("sfx/metalhit.ogg");
- sys_progress(15, 21);
- _sfx[8] = cacheSound("sfx/powerup.ogg");
- sys_progress(16, 21);
- _sfx[9] = cacheSound("sfx/rocks.ogg");
- sys_progress(17, 21);
- _sfx[10] = cacheSound("sfx/swordhit.ogg");
- sys_progress(18, 21);
- _sfx[11] = cacheSound("sfx/throw.ogg");
- sys_progress(19, 21);
- _sfx[12] = cacheSound("sfx/chest.ogg");
- sys_progress(20, 21);
- _sfx[13] = cacheSound("sfx/fire.ogg");
- sys_progress(21, 21);
- _sfx[14] = cacheSound("sfx/beep.ogg");
-}
-
void GriffonEngine::sys_update() {
g_system->updateScreen();
g_system->getEventManager()->pollEvent(_event);
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 9c502d6..ca4d98c 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -321,6 +321,8 @@ private:
void resumeSoundChannel(int channel);
bool isSoundChannelPlaying(int channel);
+ Graphics::TransparentSurface *IMG_Load(const char *name, bool colorkey = false);
+
private:
Graphics::TransparentSurface *_video, *_videobuffer, *_videobuffer2, *_videobuffer3;
diff --git a/engines/griffon/module.mk b/engines/griffon/module.mk
index de09712..5fa2a80 100644
--- a/engines/griffon/module.mk
+++ b/engines/griffon/module.mk
@@ -6,7 +6,8 @@ MODULE_OBJS := \
engine.o \
griffon.o \
detection.o \
- saveload.o
+ saveload.o \
+ sound.o
MODULE_DIRS += \
engines/griffon
diff --git a/engines/griffon/sound.cpp b/engines/griffon/sound.cpp
new file mode 100644
index 0000000..27ba2b3
--- /dev/null
+++ b/engines/griffon/sound.cpp
@@ -0,0 +1,202 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Originally written by Syn9 in FreeBASIC with SDL
+ * http://syn9.thehideoutgames.com/index_backup.php
+ *
+ * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
+ * http://github.com/dmitrysmagin/griffon_legend
+ *
+ *
+ * Programming/Graphics: Daniel "Syn9" Kennedy
+ * Music/Sound effects: David Turner
+ *
+ * Beta testing and gameplay design help:
+ * Deleter, Cha0s, Aether Fox, and Kiz
+ *
+ */
+
+#include "audio/audiostream.h"
+#include "audio/decoders/vorbis.h"
+#include "common/memstream.h"
+
+#include "common/file.h"
+#include "common/system.h"
+
+#include "griffon/griffon.h"
+
+namespace Griffon {
+
+void GriffonEngine::setChannelVolume(int channel, int volume) {}
+
+int GriffonEngine::getSoundHandle() {
+ for (uint i = 0; i < kSoundHandles; i++) {
+ if (!_mixer->isSoundHandleActive(_handles[i])) {
+ return i;
+ }
+ }
+
+ error("getSoundHandle(): Too many sound handles");
+
+ return -1;
+}
+
+int GriffonEngine::playSound(DataChunk *chunk, bool looped) {
+ int ch = getSoundHandle();
+
+#ifdef USE_VORBIS
+ Audio::SeekableAudioStream *audioStream = Audio::makeVorbisStream(new Common::MemoryReadStream(chunk->data, chunk->size), DisposeAfterUse::YES);
+
+
+ if (looped) {
+ Audio::AudioStream *loopingStream = new Audio::LoopingAudioStream(audioStream, 0, DisposeAfterUse::YES);
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, &_handles[ch], loopingStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::YES, false, false);
+
+ } else {
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, &_handles[ch], audioStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::YES, false, false);
+ }
+#endif // USE_VORBIS
+
+ return ch;
+}
+
+void GriffonEngine::pauseSoundChannel(int channel) {
+ _mixer->pauseHandle(_handles[channel], true);
+}
+
+void GriffonEngine::haltSoundChannel(int channel) {
+ _mixer->stopHandle(_handles[channel]);
+}
+
+void GriffonEngine::resumeSoundChannel(int channel) {
+ _mixer->pauseHandle(_handles[channel], false);
+}
+
+bool GriffonEngine::isSoundChannelPlaying(int channel) {
+ return _mixer->isSoundHandleActive(_handles[channel]);
+}
+
+DataChunk *cacheSound(const char *name) {
+ Common::File file;
+ DataChunk *res = new DataChunk;
+
+ file.open(name);
+ if (!file.isOpen())
+ error("Cannot open file %s", name);
+
+ res->size = file.size();
+ res->data = (byte *)malloc(res->size);
+
+ file.read(res->data, res->size);
+
+ return res;
+}
+
+void GriffonEngine::sys_progress(int w, int wm) {
+ long ccc = _videobuffer->format.RGBToColor(0, 255, 0);
+
+ rcDest.setWidth(w * 74 / wm);
+ _videobuffer->fillRect(rcDest, ccc);
+
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ g_system->updateScreen();
+
+ g_system->getEventManager()->pollEvent(_event);
+}
+
+void GriffonEngine::sys_setupAudio() {
+ // FIXME
+ //Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 1024);
+
+ //atexit(Mix_Quit);
+ //atexit(Mix_CloseAudio);
+
+ const char *stri = "Loading...";
+ sys_print(_videobuffer, stri, 160 - 4 * strlen(stri), 116, 0);
+
+ Graphics::TransparentSurface *loadimg = IMG_Load("art/load.bmp", true);
+
+ rcSrc.left = 0;
+ rcSrc.top = 0;
+ rcSrc.setWidth(88);
+ rcSrc.setHeight(32);
+
+ rcDest.left = 160 - 44;
+ rcDest.top = 116 + 12;
+
+ loadimg->setAlpha(160, true); // 128
+ loadimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ g_system->updateScreen();
+
+ rcDest.left = 160 - 44 + 7;
+ rcDest.top = 116 + 12 + 12;
+ rcDest.setHeight(8);
+
+ _mboss = cacheSound("music/boss.ogg");
+ sys_progress(1, 21);
+ _mgardens = cacheSound("music/gardens.ogg");
+ sys_progress(2, 21);
+ _mgardens2 = cacheSound("music/gardens2.ogg");
+ sys_progress(3, 21);
+ _mgardens3 = cacheSound("music/gardens3.ogg");
+ sys_progress(4, 21);
+ _mgardens4 = cacheSound("music/gardens4.ogg");
+ sys_progress(5, 21);
+ _mendofgame = cacheSound("music/endofgame.ogg");
+ sys_progress(6, 21);
+ _mmenu = cacheSound("music/menu.ogg");
+ sys_progress(7, 21);
+
+ _sfx[0] = cacheSound("sfx/bite.ogg");
+ sys_progress(8, 21);
+ _sfx[1] = cacheSound("sfx/crystal.ogg");
+ sys_progress(9, 21);
+ _sfx[2] = cacheSound("sfx/door.ogg");
+ sys_progress(10, 21);
+ _sfx[3] = cacheSound("sfx/enemyhit.ogg");
+ sys_progress(11, 21);
+ _sfx[4] = cacheSound("sfx/ice.ogg");
+ sys_progress(12, 21);
+ _sfx[5] = cacheSound("sfx/lever.ogg");
+ sys_progress(13, 21);
+ _sfx[6] = cacheSound("sfx/lightning.ogg");
+ sys_progress(14, 21);
+ _sfx[7] = cacheSound("sfx/metalhit.ogg");
+ sys_progress(15, 21);
+ _sfx[8] = cacheSound("sfx/powerup.ogg");
+ sys_progress(16, 21);
+ _sfx[9] = cacheSound("sfx/rocks.ogg");
+ sys_progress(17, 21);
+ _sfx[10] = cacheSound("sfx/swordhit.ogg");
+ sys_progress(18, 21);
+ _sfx[11] = cacheSound("sfx/throw.ogg");
+ sys_progress(19, 21);
+ _sfx[12] = cacheSound("sfx/chest.ogg");
+ sys_progress(20, 21);
+ _sfx[13] = cacheSound("sfx/fire.ogg");
+ sys_progress(21, 21);
+ _sfx[14] = cacheSound("sfx/beep.ogg");
+}
+
+
+} // end of namespace Griffon
Commit: 128f852b2742592293bb1c5e97301db25912cdd1
https://github.com/scummvm/scummvm/commit/128f852b2742592293bb1c5e97301db25912cdd1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Some function renames
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.h
engines/griffon/saveload.cpp
engines/griffon/sound.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 0cfffac..5d64bfb 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -4372,7 +4372,7 @@ void GriffonEngine::game_main() {
game_saveloadnew();
}
-void GriffonEngine::game_newgame() {
+void GriffonEngine::newGame() {
float xofs = 0;
float ld = 0, add;
int cnt = 0;
@@ -4714,7 +4714,7 @@ void GriffonEngine::game_saveloadnew() {
}
// NEW GAME
if (currow == 0 && curcol == 0)
- game_newgame();
+ newGame();
// LOAD GAME
if (currow == 0 && curcol == 1) {
@@ -4731,7 +4731,7 @@ void GriffonEngine::game_saveloadnew() {
if (lowerlock == 1 && curcol == 1 && tickpause < _ticks) {
- if (state_save(currow - 1)) {
+ if (saveState(currow - 1)) {
_secstart = _secstart + _secsingame;
_secsingame = 0;
lowerlock = 0;
@@ -4741,7 +4741,7 @@ void GriffonEngine::game_saveloadnew() {
}
if (lowerlock == 1 && curcol == 2 && tickpause < _ticks) {
- if (state_load(currow - 1)) {
+ if (loadState(currow - 1)) {
_player.walkspd = 1.1f;
_animspd = 0.5f;
attacking = false;
@@ -4819,7 +4819,7 @@ void GriffonEngine::game_saveloadnew() {
// read it only when needed!
for (int ff = 0; ff <= 3; ff++) {
- state_load_player(ff);
+ loadPlayer(ff);
if (_playera.level > 0) {
char line[256];
@@ -7752,7 +7752,7 @@ void GriffonEngine::sys_initialize() {
_playerattackofs[3][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2;
}
- sys_setupAudio();
+ setupAudio();
}
void GriffonEngine::sys_line(Graphics::TransparentSurface *buffer, int x1, int y1, int x2, int y2, int col) {
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index ca4d98c..88372fe 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -280,7 +280,7 @@ private:
void game_handlewalking();
void game_loadmap(int mapnum);
void game_main();
- void game_newgame();
+ void newGame();
void game_playgame();
void game_processtrigger(int trignum);
void game_saveloadnew();
@@ -304,14 +304,14 @@ private:
void sys_LoadTriggers();
void sys_LoadObjectDB();
void sys_print(Graphics::TransparentSurface *buffer, const char *stri, int xloc, int yloc, int col);
- void sys_progress(int w, int wm);
- void sys_setupAudio();
+ void drawProgress(int w, int wm);
+ void setupAudio();
void sys_update();
Common::String makeSaveGameName(int slot);
- int state_load(int slotnum);
- int state_load_player(int slotnum);
- int state_save(int slotnum);
+ int loadState(int slotnum);
+ int loadPlayer(int slotnum);
+ int saveState(int slotnum);
void setChannelVolume(int channel, int volume);
int getSoundHandle();
diff --git a/engines/griffon/saveload.cpp b/engines/griffon/saveload.cpp
index f0911fc..ae26567 100644
--- a/engines/griffon/saveload.cpp
+++ b/engines/griffon/saveload.cpp
@@ -58,7 +58,7 @@ Common::String GriffonEngine::makeSaveGameName(int slot) {
return (_targetName + Common::String::format(".%02d", slot));
}
-int GriffonEngine::state_load(int slotnum) {
+int GriffonEngine::loadState(int slotnum) {
Common::String filename = makeSaveGameName(slotnum);
Common::InSaveFile *file;
if (!(file = _saveFileMan->openForLoading(filename)))
@@ -129,7 +129,7 @@ int GriffonEngine::state_load(int slotnum) {
}
/* fill PLAYERTYPE _playera; */
-int GriffonEngine::state_load_player(int slotnum) {
+int GriffonEngine::loadPlayer(int slotnum) {
Common::String filename = makeSaveGameName(slotnum);
Common::InSaveFile *file;
@@ -182,7 +182,7 @@ int GriffonEngine::state_load_player(int slotnum) {
return 0; // fail
}
-int GriffonEngine::state_save(int slotnum) {
+int GriffonEngine::saveState(int slotnum) {
Common::String filename = makeSaveGameName(slotnum);
Common::OutSaveFile *file;
diff --git a/engines/griffon/sound.cpp b/engines/griffon/sound.cpp
index 27ba2b3..b27f13c 100644
--- a/engines/griffon/sound.cpp
+++ b/engines/griffon/sound.cpp
@@ -110,7 +110,7 @@ DataChunk *cacheSound(const char *name) {
return res;
}
-void GriffonEngine::sys_progress(int w, int wm) {
+void GriffonEngine::drawProgress(int w, int wm) {
long ccc = _videobuffer->format.RGBToColor(0, 255, 0);
rcDest.setWidth(w * 74 / wm);
@@ -122,7 +122,7 @@ void GriffonEngine::sys_progress(int w, int wm) {
g_system->getEventManager()->pollEvent(_event);
}
-void GriffonEngine::sys_setupAudio() {
+void GriffonEngine::setupAudio() {
// FIXME
//Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 1024);
@@ -153,48 +153,48 @@ void GriffonEngine::sys_setupAudio() {
rcDest.setHeight(8);
_mboss = cacheSound("music/boss.ogg");
- sys_progress(1, 21);
+ drawProgress(1, 21);
_mgardens = cacheSound("music/gardens.ogg");
- sys_progress(2, 21);
+ drawProgress(2, 21);
_mgardens2 = cacheSound("music/gardens2.ogg");
- sys_progress(3, 21);
+ drawProgress(3, 21);
_mgardens3 = cacheSound("music/gardens3.ogg");
- sys_progress(4, 21);
+ drawProgress(4, 21);
_mgardens4 = cacheSound("music/gardens4.ogg");
- sys_progress(5, 21);
+ drawProgress(5, 21);
_mendofgame = cacheSound("music/endofgame.ogg");
- sys_progress(6, 21);
+ drawProgress(6, 21);
_mmenu = cacheSound("music/menu.ogg");
- sys_progress(7, 21);
+ drawProgress(7, 21);
_sfx[0] = cacheSound("sfx/bite.ogg");
- sys_progress(8, 21);
+ drawProgress(8, 21);
_sfx[1] = cacheSound("sfx/crystal.ogg");
- sys_progress(9, 21);
+ drawProgress(9, 21);
_sfx[2] = cacheSound("sfx/door.ogg");
- sys_progress(10, 21);
+ drawProgress(10, 21);
_sfx[3] = cacheSound("sfx/enemyhit.ogg");
- sys_progress(11, 21);
+ drawProgress(11, 21);
_sfx[4] = cacheSound("sfx/ice.ogg");
- sys_progress(12, 21);
+ drawProgress(12, 21);
_sfx[5] = cacheSound("sfx/lever.ogg");
- sys_progress(13, 21);
+ drawProgress(13, 21);
_sfx[6] = cacheSound("sfx/lightning.ogg");
- sys_progress(14, 21);
+ drawProgress(14, 21);
_sfx[7] = cacheSound("sfx/metalhit.ogg");
- sys_progress(15, 21);
+ drawProgress(15, 21);
_sfx[8] = cacheSound("sfx/powerup.ogg");
- sys_progress(16, 21);
+ drawProgress(16, 21);
_sfx[9] = cacheSound("sfx/rocks.ogg");
- sys_progress(17, 21);
+ drawProgress(17, 21);
_sfx[10] = cacheSound("sfx/swordhit.ogg");
- sys_progress(18, 21);
+ drawProgress(18, 21);
_sfx[11] = cacheSound("sfx/throw.ogg");
- sys_progress(19, 21);
+ drawProgress(19, 21);
_sfx[12] = cacheSound("sfx/chest.ogg");
- sys_progress(20, 21);
+ drawProgress(20, 21);
_sfx[13] = cacheSound("sfx/fire.ogg");
- sys_progress(21, 21);
+ drawProgress(21, 21);
_sfx[14] = cacheSound("sfx/beep.ogg");
}
Commit: 5bedf5e1774c3bf466d13a1176a6aa20548791aa
https://github.com/scummvm/scummvm/commit/5bedf5e1774c3bf466d13a1176a6aa20548791aa
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Simplified main engine function
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 5d64bfb..9967d8b 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -96,16 +96,6 @@ enum {
*/
-void GriffonEngine::griffon_main() {
- sys_initialize();
- game_showlogos();
-
- if (_shouldQuit)
- return;
-
- game_main();
-}
-
// element tile locations
const int elementmap[15][20] = {
{ 2, 2, 2, 2, -1, -1, -1, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1 },
@@ -4363,15 +4353,6 @@ void GriffonEngine::game_loadmap(int mapnum) {
_clipbg2->copyRectToSurface(_clipbg->getPixels(), _clipbg->pitch, 0, 0, _clipbg->w, _clipbg->h);
}
-void GriffonEngine::game_main() {
- game_title(0);
-
- if (_shouldQuit)
- return;
-
- game_saveloadnew();
-}
-
void GriffonEngine::newGame() {
float xofs = 0;
float ld = 0, add;
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index f7f852c..5487ce7 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -66,7 +66,18 @@ Common::Error GriffonEngine::run() {
_console = new Console();
- griffon_main();
+ sys_initialize();
+ game_showlogos();
+
+ if (_shouldQuit)
+ return Common::kNoError;
+
+ game_title(0);
+
+ if (_shouldQuit)
+ return Common::kNoError;
+
+ game_saveloadnew();
return Common::kNoError;
}
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 88372fe..12ca51c 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -255,8 +255,6 @@ private:
Console *_console;
private:
- void griffon_main();
-
float RND();
void game_addFloatIcon(int ico, float xloc, float yloc);
@@ -279,7 +277,6 @@ private:
void game_eventtext(const char *stri);
void game_handlewalking();
void game_loadmap(int mapnum);
- void game_main();
void newGame();
void game_playgame();
void game_processtrigger(int trignum);
Commit: 1795573d13299c74ba22ea5311cd58662267bb64
https://github.com/scummvm/scummvm/commit/1795573d13299c74ba22ea5311cd58662267bb64
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: More function renames
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.cpp
engines/griffon/griffon.h
engines/griffon/sound.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 9967d8b..2a170d9 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -255,7 +255,7 @@ void game_fillrect(Graphics::TransparentSurface *surface, int x, int y, int w, i
surface->fillRect(Common::Rect(x, y, x + w, y + h), color);
}
-Graphics::TransparentSurface *GriffonEngine::IMG_Load(const char *name, bool colorkey) {
+Graphics::TransparentSurface *GriffonEngine::loadImage(const char *name, bool colorkey) {
Common::File file;
file.open(name);
@@ -283,7 +283,7 @@ float GriffonEngine::RND() {
return (float)_rnd->getRandomNumber(32767) * (1.0f / 32768.0f);
}
-void GriffonEngine::game_addFloatIcon(int ico, float xloc, float yloc) {
+void GriffonEngine::addFloatIcon(int ico, float xloc, float yloc) {
for (int i = 0; i < kMaxFloat; i++) {
if (ABS(_floaticon[i][0]) < kEpsilon) {
_floaticon[i][0] = 32;
@@ -295,7 +295,7 @@ void GriffonEngine::game_addFloatIcon(int ico, float xloc, float yloc) {
}
}
-void GriffonEngine::game_addFloatText(const char *stri, float xloc, float yloc, int col) {
+void GriffonEngine::addFloatText(const char *stri, float xloc, float yloc, int col) {
for (int i = 0; i < kMaxFloat; i++) {
if (ABS(_floattext[i][0]) < kEpsilon) {
_floattext[i][0] = 32;
@@ -308,7 +308,7 @@ void GriffonEngine::game_addFloatText(const char *stri, float xloc, float yloc,
}
}
-void GriffonEngine::game_attack() {
+void GriffonEngine::attack() {
float npx = _player.px + 12;
float npy = _player.py + 20;
@@ -333,7 +333,7 @@ void GriffonEngine::game_attack() {
int oscript = _objectInfo[o][5];
if (oscript == 0 && _player.inventory[kInvFlask] < 9) {
_player.inventory[kInvFlask]++;
- game_addFloatIcon(6, lx * 16, (ly - 1) * 16);
+ addFloatIcon(6, lx * 16, (ly - 1) * 16);
_objmapf[_curmap][lx][ly - 1] = 1;
@@ -345,7 +345,7 @@ void GriffonEngine::game_attack() {
if (_objectInfo[o][4] == 1)
_objectMap[lx][ly - 1] = 3;
- game_eventtext("Found Flask!");
+ eventText("Found Flask!");
_itemticks = _ticks + 215;
return;
}
@@ -356,7 +356,7 @@ void GriffonEngine::game_attack() {
setChannelVolume(snd, config.effectsvol);
}
- game_eventtext("Cannot Carry any more Flasks!");
+ eventText("Cannot Carry any more Flasks!");
_itemticks = _ticks + 215;
return;
}
@@ -364,7 +364,7 @@ void GriffonEngine::game_attack() {
if (oscript == kScriptMasterKey) {
_player.inventory[kInvMasterKey]++;
- game_addFloatIcon(14, lx * 16, (ly - 1) * 16);
+ addFloatIcon(14, lx * 16, (ly - 1) * 16);
_itemticks = _ticks + 215;
@@ -382,7 +382,7 @@ void GriffonEngine::game_attack() {
if (_objectInfo[o][4] == 1)
_objectMap[lx][ly - 1] = 3;
- game_eventtext("Found the Temple Key!");
+ eventText("Found the Temple Key!");
return;
}
@@ -390,7 +390,7 @@ void GriffonEngine::game_attack() {
_player.foundspell[0] = 1;
_player.spellcharge[0] = 0;
- game_addFloatIcon(7, lx * 16, (ly - 1) * 16);
+ addFloatIcon(7, lx * 16, (ly - 1) * 16);
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
@@ -400,7 +400,7 @@ void GriffonEngine::game_attack() {
if (_objectInfo[o][4] == 1)
_objectMap[lx][ly - 1] = 3;
- game_eventtext("Found the Infinite Crystal!");
+ eventText("Found the Infinite Crystal!");
_itemticks = _ticks + 215;
return;
}
@@ -408,7 +408,7 @@ void GriffonEngine::game_attack() {
if (oscript == kScriptFindShield && _player.shield == 1) {
_player.shield = 2;
- game_addFloatIcon(4, lx * 16, (ly - 1) * 16);
+ addFloatIcon(4, lx * 16, (ly - 1) * 16);
_itemticks = _ticks + 215;
@@ -420,7 +420,7 @@ void GriffonEngine::game_attack() {
if (_objectInfo[o][4] == 1)
_objectMap[lx][ly - 1] = 3;
- game_eventtext("Found the Obsidian Shield!");
+ eventText("Found the Obsidian Shield!");
_objmapf[4][1][2] = 1;
return;
}
@@ -428,7 +428,7 @@ void GriffonEngine::game_attack() {
if (oscript == kScriptFindSword && _player.sword == 1) {
_player.sword = 2;
- game_addFloatIcon(3, lx * 16, (ly - 1) * 16);
+ addFloatIcon(3, lx * 16, (ly - 1) * 16);
_itemticks = _ticks + 215;
@@ -439,7 +439,7 @@ void GriffonEngine::game_attack() {
if (_objectInfo[o][4] == 1)
_objectMap[lx][ly - 1] = 3;
- game_eventtext("Found the Fidelis Sword!");
+ eventText("Found the Fidelis Sword!");
return;
}
@@ -463,21 +463,21 @@ void GriffonEngine::game_attack() {
if (_objectInfo[o][4] == 1)
_objectMap[lx][ly - 1] = 3;
- game_eventtext("Found Key");
- game_addFloatIcon(16, lx * 16, (ly - 1) * 16);
+ eventText("Found Key");
+ addFloatIcon(16, lx * 16, (ly - 1) * 16);
} else {
if (config.effects) {
int snd = playSound(_sfx[kSndChest]);
setChannelVolume(snd, config.effectsvol);
}
- game_eventtext("Cannot Carry Any More Keys");
+ eventText("Cannot Carry Any More Keys");
}
}
if (oscript == kScriptBlueFlask && _player.inventory[kInvDoubleFlask] < 9) {
_player.inventory[kInvDoubleFlask]++;
- game_addFloatIcon(12, lx * 16, (ly - 1) * 16);
+ addFloatIcon(12, lx * 16, (ly - 1) * 16);
_objmapf[_curmap][lx][ly - 1] = 1;
@@ -489,7 +489,7 @@ void GriffonEngine::game_attack() {
if (_objectInfo[o][4] == 1)
_objectMap[lx][ly - 1] = 3;
- game_eventtext("Found Mega Flask!");
+ eventText("Found Mega Flask!");
_itemticks = _ticks + 215;
return;
}
@@ -500,14 +500,14 @@ void GriffonEngine::game_attack() {
setChannelVolume(snd, config.effectsvol);
}
- game_eventtext("Cannot Carry any more Mega Flasks!");
+ eventText("Cannot Carry any more Mega Flasks!");
_itemticks = _ticks + 215;
return;
}
if (oscript == kScriptBlueFlaskChest && _player.inventory[kInvDoubleFlask] < 9) {
_player.inventory[kInvDoubleFlask]++;
- game_addFloatIcon(12, lx * 16, (ly - 1) * 16);
+ addFloatIcon(12, lx * 16, (ly - 1) * 16);
_objmapf[_curmap][lx][ly - 1] = 1;
@@ -519,7 +519,7 @@ void GriffonEngine::game_attack() {
if (_objectInfo[o][4] == 1)
_objectMap[lx][ly - 1] = 3;
- game_eventtext("Found Mega Flask!");
+ eventText("Found Mega Flask!");
_itemticks = _ticks + 215;
return;
}
@@ -530,14 +530,14 @@ void GriffonEngine::game_attack() {
setChannelVolume(snd, config.effectsvol);
}
- game_eventtext("Cannot Carry any more Mega Flasks!");
+ eventText("Cannot Carry any more Mega Flasks!");
_itemticks = _ticks + 215;
return;
}
if (oscript == kScriptLightningChest && _player.inventory[kInvShock] < 9) {
_player.inventory[kInvShock]++;
- game_addFloatIcon(17, lx * 16, (ly - 1) * 16);
+ addFloatIcon(17, lx * 16, (ly - 1) * 16);
_objmapf[_curmap][lx][ly - 1] = 1;
@@ -549,7 +549,7 @@ void GriffonEngine::game_attack() {
if (_objectInfo[o][4] == 1)
_objectMap[lx][ly - 1] = 3;
- game_eventtext("Found Lightning Bomb!");
+ eventText("Found Lightning Bomb!");
_itemticks = _ticks + 215;
return;
}
@@ -560,7 +560,7 @@ void GriffonEngine::game_attack() {
setChannelVolume(snd, config.effectsvol);
}
- game_eventtext("Cannot Carry any more Lightning Bombs!");
+ eventText("Cannot Carry any more Lightning Bombs!");
_itemticks = _ticks + 215;
return;
}
@@ -568,7 +568,7 @@ void GriffonEngine::game_attack() {
if (oscript == kScriptArmourChest && _player.armour == 1) {
_player.armour = 2;
- game_addFloatIcon(5, lx * 16, (ly - 1) * 16);
+ addFloatIcon(5, lx * 16, (ly - 1) * 16);
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
@@ -578,7 +578,7 @@ void GriffonEngine::game_attack() {
if (_objectInfo[o][4] == 1)
_objectMap[lx][ly - 1] = 3;
- game_eventtext("Found the Fidelis Mail!");
+ eventText("Found the Fidelis Mail!");
_itemticks = _ticks + 215;
return;
}
@@ -598,7 +598,7 @@ void GriffonEngine::game_attack() {
setChannelVolume(snd, config.effectsvol);
}
- game_eventtext("It's stuck!");
+ eventText("It's stuck!");
}
if (_curmap == 54 && _scriptflag[kScriptLever][0] == 1) {
@@ -614,7 +614,7 @@ void GriffonEngine::game_attack() {
setChannelVolume(snd, config.effectsvol);
}
- game_eventtext("It's stuck!");
+ eventText("It's stuck!");
}
}
@@ -622,7 +622,7 @@ void GriffonEngine::game_attack() {
if (oscript == kScriptGetSword3 && _player.sword < 3) {
_player.sword = 3;
- game_addFloatIcon(18, lx * 16, (ly - 1) * 16);
+ addFloatIcon(18, lx * 16, (ly - 1) * 16);
_itemticks = _ticks + 215;
@@ -633,14 +633,14 @@ void GriffonEngine::game_attack() {
if (_objectInfo[o][4] == 1)
_objectMap[lx][ly - 1] = 3;
- game_eventtext("Found the Blood Sword!");
+ eventText("Found the Blood Sword!");
_objmapf[4][1][2] = 1;
return;
}
if (oscript == kScriptShield3 && _player.shield < 3) {
_player.shield = 3;
- game_addFloatIcon(19, lx * 16, (ly - 1) * 16);
+ addFloatIcon(19, lx * 16, (ly - 1) * 16);
_itemticks = _ticks + 215;
if (config.effects) {
@@ -650,14 +650,14 @@ void GriffonEngine::game_attack() {
if (_objectInfo[o][4] == 1)
_objectMap[lx][ly - 1] = 3;
- game_eventtext("Found the Entropy Shield!");
+ eventText("Found the Entropy Shield!");
_objmapf[4][1][2] = 1;
return;
}
if (oscript == kScriptArmour3 && _player.armour < 3) {
_player.armour = 3;
- game_addFloatIcon(20, lx * 16, (ly - 1) * 16);
+ addFloatIcon(20, lx * 16, (ly - 1) * 16);
_itemticks = _ticks + 215;
if (config.effects) {
@@ -667,7 +667,7 @@ void GriffonEngine::game_attack() {
if (_objectInfo[o][4] == 1)
_objectMap[lx][ly - 1] = 3;
- game_eventtext("Found the Rubyscale Armour!");
+ eventText("Found the Rubyscale Armour!");
_objmapf[4][1][2] = 1;
return;
}
@@ -690,7 +690,7 @@ void GriffonEngine::game_attack() {
}
}
-void GriffonEngine::game_castspell(int spellnum, float homex, float homey, float enemyx, float enemyy, int damagewho) {
+void GriffonEngine::castSpell(int spellnum, float homex, float homey, float enemyx, float enemyy, int damagewho) {
// spellnum 7 = sprite 6 spitfire
for (int i = 0; i < kMaxSpell; i++) {
@@ -774,7 +774,7 @@ void GriffonEngine::game_castspell(int spellnum, float homex, float homey, float
}
}
-void GriffonEngine::game_checkhit() {
+void GriffonEngine::checkHit() {
if (attacking) {
for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0 && _npcinfo[i].pause < _ticks && (int)(RND() * 2) == 0) {
@@ -816,14 +816,14 @@ void GriffonEngine::game_checkhit() {
setChannelVolume(snd, config.effectsvol);
}
- game_damagenpc(i, damage, 0);
+ damageNPC(i, damage, 0);
}
}
}
}
}
-void GriffonEngine::game_checkinputs() {
+void GriffonEngine::checkInputs() {
int ntickdelay = 175;
g_system->getEventManager()->pollEvent(_event);
@@ -857,13 +857,13 @@ void GriffonEngine::game_checkinputs() {
if (_event.type == Common::EVENT_KEYDOWN) {
if (_event.kbd.keycode == Common::KEYCODE_ESCAPE) {
if (_itemticks < _ticks)
- game_title(1);
+ title(1);
} else if (_event.kbd.keycode == Common::KEYCODE_d && _event.kbd.hasFlags(Common::KBD_CTRL)) {
_console->attach();
_event.type = Common::EVENT_INVALID;
} else if (_event.kbd.hasFlags(Common::KBD_CTRL)) {
if (_itemselon == 0 && _itemticks < _ticks)
- game_attack();
+ attack();
if (_itemselon == 1 && _itemticks < _ticks) {
if (_curitem == 0 && _player.inventory[kInvFlask] > 0) {
@@ -879,7 +879,7 @@ void GriffonEngine::game_checkinputs() {
char text[256];
sprintf(text, "+%i", heal);
- game_addFloatText(text, _player.px + 16 - 4 * strlen(text), _player.py + 16, 5);
+ addFloatText(text, _player.px + 16 - 4 * strlen(text), _player.py + 16, 5);
_player.inventory[kInvFlask]--;
@@ -905,7 +905,7 @@ void GriffonEngine::game_checkinputs() {
char text[256];
sprintf(text, "+%i", heal);
- game_addFloatText(text, _player.px + 16 - 4 * strlen(text), _player.py + 16, 5);
+ addFloatText(text, _player.px + 16 - 4 * strlen(text), _player.py + 16, 5);
_player.inventory[kInvDoubleFlask]--;
@@ -919,7 +919,7 @@ void GriffonEngine::game_checkinputs() {
}
if (_curitem == 2 && _player.inventory[kInvShock] > 0) {
- game_castspell(8, _player.px, _player.py, _npcinfo[_curenemy].x, _npcinfo[_curenemy].y, 0);
+ castSpell(8, _player.px, _player.py, _npcinfo[_curenemy].x, _npcinfo[_curenemy].y, 0);
_forcepause = true;
@@ -933,7 +933,7 @@ void GriffonEngine::game_checkinputs() {
if (_curitem == 3 && _player.inventory[kInvNormalKey] > 0 && _canUseKey && _lockType == 1) {
_roomLocks[_roomToUnlock] = 0;
- game_eventtext("UnLocked!");
+ eventText("UnLocked!");
_player.inventory[kInvNormalKey]--;
@@ -945,7 +945,7 @@ void GriffonEngine::game_checkinputs() {
if (_curitem == 4 && _player.inventory[kInvMasterKey] > 0 && _canUseKey && _lockType == 2) {
_roomLocks[_roomToUnlock] = 0;
- game_eventtext("UnLocked!");
+ eventText("UnLocked!");
_player.inventory[kInvMasterKey]--;
@@ -956,7 +956,7 @@ void GriffonEngine::game_checkinputs() {
}
if (_curitem == 5 && _player.spellcharge[0] == 100) {
- game_castspell(5, _player.px, _player.py, _npcinfo[_curenemy].x, _npcinfo[_curenemy].y, 0);
+ castSpell(5, _player.px, _player.py, _npcinfo[_curenemy].x, _npcinfo[_curenemy].y, 0);
_player.spellcharge[0] = 0;
@@ -969,10 +969,10 @@ void GriffonEngine::game_checkinputs() {
if (_curitem > 5 && _selenemyon == 1) {
if (_curenemy <= _lastnpc) {
- game_castspell(_curitem - 6, _player.px, _player.py, _npcinfo[_curenemy].x, _npcinfo[_curenemy].y, 0);
+ castSpell(_curitem - 6, _player.px, _player.py, _npcinfo[_curenemy].x, _npcinfo[_curenemy].y, 0);
} else {
int pst = _curenemy - _lastnpc - 1;
- game_castspell(_curitem - 6, _player.px, _player.py, postinfo[pst][0], postinfo[pst][1], 0);
+ castSpell(_curitem - 6, _player.px, _player.py, postinfo[pst][0], postinfo[pst][1], 0);
}
_player.spellcharge[_curitem - 5] = 0;
@@ -1124,7 +1124,7 @@ __exit_do:
}
}
-void GriffonEngine::game_checktrigger() {
+void GriffonEngine::checkTrigger() {
int npx = _player.px + 12;
int npy = _player.py + 20;
@@ -1134,14 +1134,14 @@ void GriffonEngine::game_checktrigger() {
_canUseKey = false;
if (_triggerloc[lx][ly] > -1)
- game_processtrigger(_triggerloc[lx][ly]);
+ processTrigger(_triggerloc[lx][ly]);
}
#define MINCURSEL 7
#define MAXCURSEL 14
#define SY 22
-void GriffonEngine::game_configmenu() {
+void GriffonEngine::configMenu() {
int cursel = MINCURSEL;
int tickwait = 1000 / 60;
@@ -1149,7 +1149,7 @@ void GriffonEngine::game_configmenu() {
_ticks = g_system->getMillis();
int keypause = _ticks + tickwait;
- Graphics::TransparentSurface *configwindow = IMG_Load("art/configwindow.bmp", true);
+ Graphics::TransparentSurface *configwindow = loadImage("art/configwindow.bmp", true);
configwindow->setAlpha(160, true);
int _ticks1 = _ticks;
@@ -1226,8 +1226,8 @@ void GriffonEngine::game_configmenu() {
else if (i > 18)
cl = 0;
- sys_print(_videobuffer, vr[i], 156 - 8 * strlen(vr[i]), sy + i * 8, 0);
- sys_print(_videobuffer, vl[i], 164, sy + i * 8, cl);
+ drawString(_videobuffer, vr[i], 156 - 8 * strlen(vr[i]), sy + i * 8, 0);
+ drawString(_videobuffer, vl[i], 164, sy + i * 8, cl);
}
int curselt = cursel + 2;
@@ -1397,7 +1397,7 @@ void GriffonEngine::game_configmenu() {
cloudimg->setAlpha(64, true);
}
-void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
+void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
char line[256];
int fcol;
@@ -1438,10 +1438,10 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
_player.attackstrength = ratio;
}
- game_addFloatText(line, _npcinfo[npcnum].x + 12 - 4 * strlen(line), _npcinfo[npcnum].y + 16, fcol);
+ addFloatText(line, _npcinfo[npcnum].x + 12 - 4 * strlen(line), _npcinfo[npcnum].y + 16, fcol);
if (_npcinfo[npcnum].spriteset == 12)
- game_castspell(9, _npcinfo[npcnum].x, _npcinfo[npcnum].y, _player.px, _player.py, npcnum);
+ castSpell(9, _npcinfo[npcnum].x, _npcinfo[npcnum].y, _player.px, _player.py, npcnum);
// if enemy is killed
if (_npcinfo[npcnum].hp == 0) {
@@ -1848,11 +1848,11 @@ void GriffonEngine::game_damagenpc(int npcnum, int damage, int spell) {
}
if (_npcinfo[npcnum].script == kScriptEndOfGame)
- game_endofgame();
+ endOfGame();
}
}
-void GriffonEngine::game_damageplayer(int damage) {
+void GriffonEngine::damagePlayer(int damage) {
char line[256];
if (!_console->_godMode)
@@ -1865,12 +1865,12 @@ void GriffonEngine::game_damageplayer(int damage) {
if (damage == 0)
strcpy(line, "miss!");
- game_addFloatText(line, _player.px + 12 - 4 * strlen(line), _player.py + 16, 4);
+ addFloatText(line, _player.px + 12 - 4 * strlen(line), _player.py + 16, 4);
_player.pause = _ticks + 1000;
}
-void GriffonEngine::game_drawanims(int Layer) {
+void GriffonEngine::drawAnims(int Layer) {
for (int sx = 0; sx <= 19; sx++) {
for (int sy = 0; sy <= 14; sy++) {
int o = _objectMap[sx][sy];
@@ -1961,9 +1961,9 @@ int hud_recalc(int a, int b, int c) {
#define RGB(R, G, B) (_videobuffer->format.RGBToColor((R), (G), (B)))
-void GriffonEngine::game_drawhud() {
+void GriffonEngine::drawHud() {
//sprintf(line, "_fps: %i, map: %i, exp: %i/%i", (int)_fps, _curmap, _player.exp, _player.nextlevel);
- //sys_print(_videobuffer, line, 0, 0, 0);
+ //drawString(_videobuffer, line, 0, 0, 0);
game_fillrect(_videobuffer2, 0, 0, 320, 240, 0);
@@ -1981,13 +1981,13 @@ void GriffonEngine::game_drawhud() {
c2 = 2;
if (fc != 0) {
- sys_print(_videobuffer, _floatstri[i], (int)(_floattext[i][1]) + 0, (int)(_floattext[i][2]) - 1, c2);
- sys_print(_videobuffer, _floatstri[i], (int)(_floattext[i][1]) + 0, (int)(_floattext[i][2]) + 1, c2);
- sys_print(_videobuffer, _floatstri[i], (int)(_floattext[i][1]) - 1, (int)(_floattext[i][2]) + 0, c2);
- sys_print(_videobuffer, _floatstri[i], (int)(_floattext[i][1]) + 1, (int)(_floattext[i][2]) + 0, c2);
+ drawString(_videobuffer, _floatstri[i], (int)(_floattext[i][1]) + 0, (int)(_floattext[i][2]) - 1, c2);
+ drawString(_videobuffer, _floatstri[i], (int)(_floattext[i][1]) + 0, (int)(_floattext[i][2]) + 1, c2);
+ drawString(_videobuffer, _floatstri[i], (int)(_floattext[i][1]) - 1, (int)(_floattext[i][2]) + 0, c2);
+ drawString(_videobuffer, _floatstri[i], (int)(_floattext[i][1]) + 1, (int)(_floattext[i][2]) + 0, c2);
}
- sys_print(_videobuffer, _floatstri[i], (int)(_floattext[i][1]), (int)(_floattext[i][2]), c);
+ drawString(_videobuffer, _floatstri[i], (int)(_floattext[i][1]), (int)(_floattext[i][2]), c);
}
if (_floaticon[i][0] > 0) {
@@ -2088,18 +2088,18 @@ void GriffonEngine::game_drawhud() {
}
if (amap == 1) {
- sys_print(_videobuffer, "L1", 46 + 9, 46 + 77, 0);
- sys_print(_videobuffer, "L2", 46 + 9 + 7 * 9, 46 + 77, 0);
+ drawString(_videobuffer, "L1", 46 + 9, 46 + 77, 0);
+ drawString(_videobuffer, "L2", 46 + 9 + 7 * 9, 46 + 77, 0);
}
char line[128];
sprintf(line, "Health: %i/%i", _player.hp, _player.maxhp);
- sys_print(_videobuffer, line, sx, sy, _player.hp <= _player.maxhp * 0.25 ? (int)_player.hpflash : 0);
+ drawString(_videobuffer, line, sx, sy, _player.hp <= _player.maxhp * 0.25 ? (int)_player.hpflash : 0);
sprintf(line, "Level : %i", _player.level);
if (_player.level == _player.maxlevel)
strcpy(line, "Level : MAX");
- sys_print(_videobuffer, line, sx, sy + 8, 0);
+ drawString(_videobuffer, line, sx, sy + 8, 0);
// experience
game_fillrect(_videobuffer, sx + 64, sy + 16, 16, 4, RGB(0, 32, 32));
@@ -2125,10 +2125,10 @@ void GriffonEngine::game_drawhud() {
int s = (ase - m * 60);
sprintf(line, "%02i:%02i:%02i", h, m, s);
- sys_print(_videobuffer, line, 46 + 38 - strlen(line) * 4, 46 + 49, 0);
+ drawString(_videobuffer, line, 46 + 38 - strlen(line) * 4, 46 + 49, 0);
- sys_print(_videobuffer, "Use", 193, 55, 0);
- sys_print(_videobuffer, "Cast", 236, 55, 0);
+ drawString(_videobuffer, "Use", 193, 55, 0);
+ drawString(_videobuffer, "Cast", 236, 55, 0);
rcSrc.left = 128;
rcSrc.top = 91;
@@ -2167,7 +2167,7 @@ void GriffonEngine::game_drawhud() {
_itemimg[14]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
sprintf(line, "x%i", _player.inventory[i]);
- sys_print(_videobuffer, line, sx + 17, sy + 7, 0);
+ drawString(_videobuffer, line, sx + 17, sy + 7, 0);
}
// spells in menu
@@ -2219,7 +2219,7 @@ void GriffonEngine::game_drawhud() {
}
}
-void GriffonEngine::game_drawnpcs(int mode) {
+void GriffonEngine::drawNPCs(int mode) {
unsigned int ccc = _videobuffer->format.RGBToColor(255, 128, 32);
int fst = _firsty;
int lst = _lasty;
@@ -2639,7 +2639,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
float damage = (float)_npcinfo[i].spelldamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
- game_damageplayer(damage);
+ damagePlayer(damage);
if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
setChannelVolume(snd, config.effectsvol);
@@ -2665,7 +2665,7 @@ void GriffonEngine::game_drawnpcs(int mode) {
float damage = (float)_npcinfo[i].spelldamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
- game_damageplayer(damage);
+ damagePlayer(damage);
if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
setChannelVolume(snd, config.effectsvol);
@@ -2780,14 +2780,14 @@ void GriffonEngine::game_drawnpcs(int mode) {
if (_npcinfo[i].spriteset == 3)
pass = 0;
if (pass == 1)
- game_drawover(npx, npy);
+ drawOver(npx, npy);
}
}
}
}
-void GriffonEngine::game_drawover(int modx, int mody) {
+void GriffonEngine::drawOver(int modx, int mody) {
int npx = modx + 12;
int npy = mody + 20;
@@ -2841,7 +2841,7 @@ void GriffonEngine::game_drawover(int modx, int mody) {
}
}
-void GriffonEngine::game_drawplayer() {
+void GriffonEngine::drawPlayer() {
int f = 0;
if (_player.armour == 3)
f = 13;
@@ -2941,25 +2941,25 @@ void GriffonEngine::game_drawplayer() {
_videobuffer->fillRect(rcDest, ccc);
}
-void GriffonEngine::game_drawview() {
+void GriffonEngine::drawView() {
_videobuffer->copyRectToSurface(_mapbg->getPixels(), _mapbg->pitch, 0, 0, _mapbg->w, _mapbg->h);
game_updspellsunder();
- game_drawanims(0);
+ drawAnims(0);
// ------dontdrawover = special case to make boss work right in room 24
if (dontdrawover == 1)
- game_drawanims(1);
- game_drawnpcs(0);
+ drawAnims(1);
+ drawNPCs(0);
- game_drawplayer();
+ drawPlayer();
- game_drawnpcs(1);
+ drawNPCs(1);
if (dontdrawover == 0)
- game_drawanims(1);
+ drawAnims(1);
- game_drawover((int)_player.px, (int)_player.py);
+ drawOver((int)_player.px, (int)_player.py);
game_updspells();
@@ -2973,12 +2973,12 @@ void GriffonEngine::game_drawview() {
cloudimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, &rc);
}
- game_drawhud();
+ drawHud();
g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
}
-void GriffonEngine::game_endofgame() {
+void GriffonEngine::endOfGame() {
float xofs = 0;
_ticks = g_system->getMillis();
@@ -3069,7 +3069,7 @@ void GriffonEngine::game_endofgame() {
int yy = y + i * 10;
if (yy > -8 && yy < 240) {
int x = 160 - strlen(story2[i]) * 4;
- sys_print(_videobuffer, story2[i], x, yy, 4);
+ drawString(_videobuffer, story2[i], x, yy, 4);
}
if (yy < 10 && i == 25)
@@ -3212,11 +3212,11 @@ void GriffonEngine::game_endofgame() {
_videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
_videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
- game_theend();
+ theEnd();
}
-void GriffonEngine::game_eventtext(const char *stri) {
+void GriffonEngine::eventText(const char *stri) {
_videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
_videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
@@ -3247,7 +3247,7 @@ void GriffonEngine::game_eventtext(const char *stri) {
_windowimg->blit(*_videobuffer);
if (pause_ticks < _ticks)
- sys_print(_videobuffer, stri, x, 15, 0);
+ drawString(_videobuffer, stri, x, 15, 0);
g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
g_system->updateScreen();
@@ -3277,7 +3277,7 @@ void GriffonEngine::game_eventtext(const char *stri) {
}
-void GriffonEngine::game_handlewalking() {
+void GriffonEngine::handleWalking() {
int xmax = 20 * 16 - 25;
int ymax = 15 * 16 - 25;
@@ -3484,7 +3484,7 @@ void GriffonEngine::game_handlewalking() {
_objectMap[lx][ly] = -1;
_player.inventory[kInvFlask]++;
- game_addFloatIcon(6, lx * 16, ly * 16);
+ addFloatIcon(6, lx * 16, ly * 16);
_objmapf[_curmap][lx][ly] = 1;
@@ -3498,7 +3498,7 @@ void GriffonEngine::game_handlewalking() {
_objectMap[lx][ly] = -1;
_player.inventory[kInvDoubleFlask]++;
- game_addFloatIcon(12, lx * 16, ly * 16);
+ addFloatIcon(12, lx * 16, ly * 16);
_objmapf[_curmap][lx][ly] = 1;
@@ -3512,7 +3512,7 @@ void GriffonEngine::game_handlewalking() {
_objectMap[lx][ly] = -1;
_player.inventory[kInvShock]++;
- game_addFloatIcon(17, lx * 16, ly * 16);
+ addFloatIcon(17, lx * 16, ly * 16);
_objmapf[_curmap][lx][ly] = 1;
if (_curmap == 41)
@@ -3529,7 +3529,7 @@ void GriffonEngine::game_handlewalking() {
_objectMap[lx][ly] = -1;
_player.inventory[kInvShock]++;
- game_addFloatIcon(17, lx * 16, ly * 16);
+ addFloatIcon(17, lx * 16, ly * 16);
_objmapf[_curmap][lx][ly] = 1;
@@ -3542,7 +3542,7 @@ void GriffonEngine::game_handlewalking() {
}
}
-void GriffonEngine::game_loadmap(int mapnum) {
+void GriffonEngine::loadMap(int mapnum) {
debug(2, "Loaded map %d", mapnum);
unsigned int ccc = _clipbg->format.RGBToColor(255, 255, 255);
@@ -3745,18 +3745,18 @@ void GriffonEngine::game_loadmap(int mapnum) {
if (d == 1) {
for (int i = 0; i <= 7; i++) {
- sys_line(_clipbg, x1, y1 + i, x1 + 7 - i, y1 + i, ccc);
+ drawLine(_clipbg, x1, y1 + i, x1 + 7 - i, y1 + i, ccc);
}
} else if (d == 2) {
- sys_line(_clipbg, x1, y1, x1 + 7, y1, ccc);
- sys_line(_clipbg, x1, y1 + 1, x1 + 7, y1 + 1, ccc);
+ drawLine(_clipbg, x1, y1, x1 + 7, y1, ccc);
+ drawLine(_clipbg, x1, y1 + 1, x1 + 7, y1 + 1, ccc);
} else if (d == 3) {
for (int i = 0; i <= 7; i++) {
- sys_line(_clipbg, x1 + i, y1 + i, x1 + 7, y1 + i, ccc);
+ drawLine(_clipbg, x1 + i, y1 + i, x1 + 7, y1 + i, ccc);
}
} else if (d == 4) {
- sys_line(_clipbg, x1, y1, x1, y1 + 7, ccc);
- sys_line(_clipbg, x1 + 1, y1, x1 + 1, y1 + 7, ccc);
+ drawLine(_clipbg, x1, y1, x1, y1 + 7, ccc);
+ drawLine(_clipbg, x1 + 1, y1, x1 + 1, y1 + 7, ccc);
} else if (d == 5) {
rcDest.left = x1;
rcDest.top = y1;
@@ -3764,18 +3764,18 @@ void GriffonEngine::game_loadmap(int mapnum) {
rcDest.setHeight(8);
_clipbg->fillRect(rcDest, ccc);
} else if (d == 6) {
- sys_line(_clipbg, x1 + 7, y1, x1 + 7, y1 + 7, ccc);
- sys_line(_clipbg, x1 + 6, y1, x1 + 6, y1 + 7, ccc);
+ drawLine(_clipbg, x1 + 7, y1, x1 + 7, y1 + 7, ccc);
+ drawLine(_clipbg, x1 + 6, y1, x1 + 6, y1 + 7, ccc);
} else if (d == 7) {
for (int i = 0; i <= 7; i++) {
- sys_line(_clipbg, x1, y1 + i, x1 + i, y1 + i, ccc);
+ drawLine(_clipbg, x1, y1 + i, x1 + i, y1 + i, ccc);
}
} else if (d == 8) {
- sys_line(_clipbg, x1, y1 + 7, x1 + 7, y1 + 7, ccc);
- sys_line(_clipbg, x1, y1 + 7, x1 + 6, y1 + 6, ccc);
+ drawLine(_clipbg, x1, y1 + 7, x1 + 7, y1 + 7, ccc);
+ drawLine(_clipbg, x1, y1 + 7, x1 + 6, y1 + 6, ccc);
} else if (d == 9) {
for (int i = 0; i <= 7; i++) {
- sys_line(_clipbg, x1 + 7 - i, y1 + i, x1 + 7, y1 + i, ccc);
+ drawLine(_clipbg, x1 + 7 - i, y1 + i, x1 + 7, y1 + i, ccc);
}
}
}
@@ -4413,7 +4413,7 @@ void GriffonEngine::newGame() {
yy = y + i * 10;
if (yy > -8 && yy < 240) {
x = 160 - strlen(story[i]) * 4;
- sys_print(_videobuffer, story[i], x, yy, 4);
+ drawString(_videobuffer, story[i], x, yy, 4);
}
if (yy < 10 && i == 47)
@@ -4527,13 +4527,13 @@ __exit_do:
_pacademy = false;
_pcitadel = false;
- game_loadmap(2);
+ loadMap(2);
- game_playgame();
+ mainLoop();
}
-void GriffonEngine::game_playgame() {
- game_swash();
+void GriffonEngine::mainLoop() {
+ swash();
if (_pmenu) {
haltSoundChannel(_menuchannel);
@@ -4542,20 +4542,20 @@ void GriffonEngine::game_playgame() {
do {
if (!_forcepause) {
- game_updanims();
+ updateAnims();
game_updnpcs();
}
- game_checktrigger();
- game_checkinputs();
+ checkTrigger();
+ checkInputs();
if (!_forcepause)
- game_handlewalking();
+ handleWalking();
- game_updatey();
- game_drawview();
+ updateY();
+ drawView();
- game_updmusic();
+ updateMusic();
_console->onFrame();
@@ -4563,7 +4563,7 @@ void GriffonEngine::game_playgame() {
} while (!_shouldQuit);
}
-void GriffonEngine::game_processtrigger(int trignum) {
+void GriffonEngine::processTrigger(int trignum) {
int trigtype = _triggers[trignum][0];
if (_roomlock)
@@ -4578,7 +4578,7 @@ void GriffonEngine::game_processtrigger(int trignum) {
if (_roomLocks[tmap] > 0) {
if (!_saidLocked)
- game_eventtext("Locked");
+ eventText("Locked");
_saidLocked = true;
_canUseKey = true;
_lockType = _roomLocks[tmap];
@@ -4588,7 +4588,7 @@ void GriffonEngine::game_processtrigger(int trignum) {
if (tmap == 1) {
if (!_saidJammed)
- game_eventtext("Door Jammed!");
+ eventText("Door Jammed!");
_saidJammed = true;
return;
}
@@ -4617,8 +4617,8 @@ void GriffonEngine::game_processtrigger(int trignum) {
setChannelVolume(snd, config.effectsvol);
}
- game_loadmap(tmap);
- game_swash();
+ loadMap(tmap);
+ swash();
}
}
}
@@ -4629,7 +4629,7 @@ void GriffonEngine::game_processtrigger(int trignum) {
}
}
-void GriffonEngine::game_saveloadnew() {
+void GriffonEngine::saveLoadNew() {
float y = 0.0;
clouddeg = 0;
@@ -4738,8 +4738,8 @@ void GriffonEngine::game_saveloadnew() {
_secsingame = 0;
_saveslot = currow - 1;
- game_loadmap(_curmap);
- game_playgame();
+ loadMap(_curmap);
+ mainLoop();
}
}
@@ -4817,21 +4817,21 @@ void GriffonEngine::game_saveloadnew() {
int s = (ase - m * 60);
sprintf(line, "Game Time: %02i:%02i:%02i", h, m, s);
- sys_print(_videobuffer, line, 160 - strlen(line) * 4, sy, 0);
+ drawString(_videobuffer, line, 160 - strlen(line) * 4, sy, 0);
sx = 12;
sy = sy + 11;
cc = 0;
sprintf(line, "Health: %i/%i", _playera.hp, _playera.maxhp);
- sys_print(_videobuffer, line, sx, sy, cc);
+ drawString(_videobuffer, line, sx, sy, cc);
if (_playera.level == 22)
strcpy(line, "Level: MAX");
else
sprintf(line, "Level: %i", _playera.level);
- sys_print(_videobuffer, line, sx, sy + 11, 0);
+ drawString(_videobuffer, line, sx, sy + 11, 0);
rcSrc.left = sx + 15 * 8 + 24;
rcSrc.top = sy + 1;
@@ -4865,7 +4865,7 @@ void GriffonEngine::game_saveloadnew() {
}
} else {
int sy = 57 + ff * 48;
- sys_print(_videobuffer, "Empty", 160 - 5 * 4, sy, 0);
+ drawString(_videobuffer, "Empty", 160 - 5 * 4, sy, 0);
}
}
// ------------------------------------------
@@ -4947,7 +4947,7 @@ void GriffonEngine::game_saveloadnew() {
cloudimg->setAlpha(64, true);
}
-void GriffonEngine::game_showlogos() {
+void GriffonEngine::showLogos() {
float y;
int _ticks1;
@@ -5005,7 +5005,7 @@ void GriffonEngine::game_showlogos() {
}
-void GriffonEngine::game_swash() {
+void GriffonEngine::swash() {
float y;
y = 0;
@@ -5090,7 +5090,7 @@ void GriffonEngine::game_swash() {
_videobuffer->setAlpha(255);
}
-void GriffonEngine::game_theend() {
+void GriffonEngine::theEnd() {
for (int i = 0; i < kMaxFloat; i++) {
_floattext[i][0] = 0;
_floaticon[i][0] = 0;
@@ -5119,10 +5119,10 @@ void GriffonEngine::game_theend() {
}
}
- game_title(0);
+ title(0);
}
-void GriffonEngine::game_title(int mode) {
+void GriffonEngine::title(int mode) {
float xofs = 0;
rcSrc.left = 0;
@@ -5184,14 +5184,14 @@ void GriffonEngine::game_title(int mode) {
int y = 172;
int x = 160 - 14 * 4;
- sys_print(_videobuffer, "new game/save/load", x, y, 4);
- sys_print(_videobuffer, "options", x, y + 16, 4);
- sys_print(_videobuffer, "quit game", x, y + 32, 4);
+ drawString(_videobuffer, "new game/save/load", x, y, 4);
+ drawString(_videobuffer, "options", x, y + 16, 4);
+ drawString(_videobuffer, "quit game", x, y + 32, 4);
if (mode == 1)
- sys_print(_videobuffer, "return", x, y + 48, 4);
+ drawString(_videobuffer, "return", x, y + 48, 4);
else
- sys_print(_videobuffer, "(c) 2005 by Daniel 'Syn9' Kennedy", 28, 224, 4);
+ drawString(_videobuffer, "(c) 2005 by Daniel 'Syn9' Kennedy", 28, 224, 4);
rc.left = (float)(x - 16 - 4 * cos(3.14159 * 2 * _itemyloc / 16));
rc.top = (float)(y - 4 + 16 * cursel);
@@ -5258,12 +5258,12 @@ void GriffonEngine::game_title(int mode) {
cursel = 0;
} else if (_event.kbd.keycode == Common::KEYCODE_RETURN) {
if (cursel == 0) {
- game_saveloadnew();
+ saveLoadNew();
_ticks = g_system->getMillis();
keypause = _ticks + 150;
_ticks1 = _ticks;
} else if (cursel == 1) {
- game_configmenu();
+ configMenu();
_ticks = g_system->getMillis();
keypause = _ticks + 150;
_ticks1 = _ticks;
@@ -5289,7 +5289,7 @@ void GriffonEngine::game_title(int mode) {
}
}
-void GriffonEngine::game_updanims() {
+void GriffonEngine::updateAnims() {
for (int i = 0; i <= _lastObj; i++) {
int nframes = _objectInfo[i][0];
int o_animspd = _objectInfo[i][3];
@@ -5314,7 +5314,7 @@ void GriffonEngine::game_updanims() {
}
}
-void GriffonEngine::game_updatey() {
+void GriffonEngine::updateY() {
for (int i = 0; i <= 2400; i++)
_ysort[i] = -1;
@@ -5344,7 +5344,7 @@ void GriffonEngine::game_updatey() {
}
}
-void GriffonEngine::game_updmusic() {
+void GriffonEngine::updateMusic() {
DataChunk *iplaysound = NULL;
if (config.music) {
@@ -5878,7 +5878,7 @@ void GriffonEngine::game_updnpcs() {
_npcinfo[i].attacknext = _ticks + 4500;
_npcinfo[i].castpause = _ticks + 4500;
- game_castspell(3, _npcinfo[i].x, _npcinfo[i].y, _npcinfo[i].x, _npcinfo[i].y, i);
+ castSpell(3, _npcinfo[i].x, _npcinfo[i].y, _npcinfo[i].x, _npcinfo[i].y, i);
_npcinfo[i].headtargetx[0] = _npcinfo[i].x;
_npcinfo[i].headtargety[0] = _npcinfo[i].y - 36 + 16;
@@ -5914,11 +5914,11 @@ void GriffonEngine::game_updnpcs() {
_npcinfo[i].attacking = 1;
_npcinfo[i].attackframe = 0;
- game_castspell(1, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i);
+ castSpell(1, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i);
}
if (_npcinfo[i].castpause < _ticks) {
- game_castspell(6, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i);
+ castSpell(6, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i);
_npcinfo[i].castpause = _ticks + 12000;
}
}
@@ -6037,7 +6037,7 @@ void GriffonEngine::game_updnpcs() {
nnxb = npx + 4;
}
- game_castspell(7, nnxa, nnya, nnxb, nnyb, i);
+ castSpell(7, nnxa, nnya, nnxb, nnyb, i);
}
}
}
@@ -6049,11 +6049,11 @@ void GriffonEngine::game_updnpcs() {
_npcinfo[i].attacking = 1;
_npcinfo[i].attackframe = 0;
- game_castspell(9, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i);
+ castSpell(9, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i);
}
if (_npcinfo[i].castpause < _ticks) {
- // game_castspell 6, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i
+ // castSpell 6, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i
// _npcinfo[i].castpause = _ticks + 12000
}
@@ -6107,7 +6107,7 @@ void GriffonEngine::game_updnpcs() {
_npcinfo[i].walkdir = 1;
}
- game_castspell(7, nnxa, nnya, nnxb, nnyb, i);
+ castSpell(7, nnxa, nnya, nnxb, nnyb, i);
}
}
}
@@ -6158,7 +6158,7 @@ void GriffonEngine::game_updnpcs() {
_npcinfo[i].attacknext = _ticks + 5000;
_npcinfo[i].castpause = _ticks + 3000;
- game_castspell(3, _npcinfo[i].x, _npcinfo[i].y, _npcinfo[i].x, _npcinfo[i].y, i);
+ castSpell(3, _npcinfo[i].x, _npcinfo[i].y, _npcinfo[i].x, _npcinfo[i].y, i);
_npcinfo[i].headtargetx[0] = _npcinfo[i].x;
_npcinfo[i].headtargety[0] = _npcinfo[i].y - 36 + 16;
@@ -6295,7 +6295,7 @@ void GriffonEngine::game_updnpcs() {
damage = (float)_npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
if (_player.hp > 0)
- game_damageplayer(damage);
+ damagePlayer(damage);
}
}
@@ -6344,7 +6344,7 @@ void GriffonEngine::game_updnpcs() {
// _npcinfo[i].attacking = 0
damage = (float)_npcinfo[i].attackdamage * (1.0 + (RND() * 0.5));
if (_player.hp > 0)
- game_damageplayer(damage);
+ damagePlayer(damage);
}
}
@@ -6396,7 +6396,7 @@ void GriffonEngine::game_updnpcs() {
// _npcinfo[i].attacking2(ff) = 0
damage = (float)_npcinfo[i].attackdamage * (1.0 + RND() * 0.5);
if (_player.hp > 0)
- game_damageplayer(damage);
+ damagePlayer(damage);
}
}
}
@@ -6449,7 +6449,7 @@ void GriffonEngine::game_updnpcs() {
// _npcinfo[i].attacking = 0
damage = (float)_npcinfo[i].attackdamage * (1.0 + RND() * 0.5);
if (_player.hp > 0)
- game_damageplayer(damage);
+ damagePlayer(damage);
}
}
@@ -6479,7 +6479,7 @@ void GriffonEngine::game_updnpcs() {
// _npcinfo[i].attacking = 0
damage = (float)_npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
if (_player.hp > 0)
- game_damageplayer(damage);
+ damagePlayer(damage);
}
}
@@ -6508,7 +6508,7 @@ void GriffonEngine::game_updnpcs() {
// _npcinfo[i].attacking = 0
damage = (float)_npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
if (_player.hp > 0)
- game_damageplayer(damage);
+ damagePlayer(damage);
}
}
}
@@ -6605,7 +6605,7 @@ void GriffonEngine::game_updspells() {
float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
- game_damagenpc(e, damage, 1);
+ damageNPC(e, damage, 1);
if (config.effects) {
int snd = playSound(_sfx[kSndIce]);
setChannelVolume(snd, config.effectsvol);
@@ -6632,7 +6632,7 @@ void GriffonEngine::game_updspells() {
_clipbg2->fillRect(rcSrc, 0);
- game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
if (config.effects) {
int snd = playSound(_sfx[kSndIce]);
@@ -6684,7 +6684,7 @@ void GriffonEngine::game_updspells() {
float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
- game_damagenpc(e, damage, 1);
+ damageNPC(e, damage, 1);
if (config.effects) {
int snd = playSound(_sfx[kSndMetalHit]);
setChannelVolume(snd, config.effectsvol);
@@ -6727,7 +6727,7 @@ void GriffonEngine::game_updspells() {
float damage = (float)_npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
- game_damageplayer(damage);
+ damagePlayer(damage);
if (config.effects) {
int snd = playSound(_sfx[kSndMetalHit]);
setChannelVolume(snd, config.effectsvol);
@@ -6754,7 +6754,7 @@ void GriffonEngine::game_updspells() {
_clipbg2->fillRect(rcSrc, 0);
- game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
if (config.effects) {
int snd = playSound(_sfx[kSndMetalHit]);
@@ -6806,7 +6806,7 @@ void GriffonEngine::game_updspells() {
float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
- game_damagenpc(e, damage, 1);
+ damageNPC(e, damage, 1);
if (config.effects) {
int snd = playSound(_sfx[kSndRocks]);
setChannelVolume(snd, config.effectsvol);
@@ -6834,7 +6834,7 @@ void GriffonEngine::game_updspells() {
_clipbg2->fillRect(rcSrc, 0);
- game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
if (config.effects) {
int snd = playSound(_sfx[kSndRocks]);
@@ -6946,7 +6946,7 @@ void GriffonEngine::game_updspells() {
}
}
- game_eventtext(line);
+ eventText(line);
}
}
@@ -7033,7 +7033,7 @@ void GriffonEngine::game_updspells() {
float damage = _npcinfo[spellinfo[i].npc].spelldamage * (1 + RND() * 0.5) / 3;
if (_player.hp > 0)
- game_damageplayer(damage);
+ damagePlayer(damage);
if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
@@ -7069,13 +7069,13 @@ void GriffonEngine::game_updspells() {
if (orn == 2)
y = y + 1;
- sys_line(_videobuffer, x, y - 1, x, y + 2, cl1);
- sys_line(_videobuffer, x, y, x, y + 1, cl3);
+ drawLine(_videobuffer, x, y - 1, x, y + 2, cl1);
+ drawLine(_videobuffer, x, y, x, y + 1, cl3);
if (rn == 0)
- sys_line(_videobuffer, x, y + 1, x, y + 1, cl2);
+ drawLine(_videobuffer, x, y + 1, x, y + 1, cl2);
if (rn == 2)
- sys_line(_videobuffer, x, y, x, y, cl2);
+ drawLine(_videobuffer, x, y, x, y, cl2);
orn = rn;
@@ -7089,7 +7089,7 @@ void GriffonEngine::game_updspells() {
float damage = 30 * (1 + RND() * 0.5);
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks)
- game_damagenpc(e, damage, 1);
+ damageNPC(e, damage, 1);
}
}
}
@@ -7111,7 +7111,7 @@ void GriffonEngine::game_updspells() {
_clipbg2->fillRect(rcSrc, 0);
- game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
}
}
}
@@ -7127,13 +7127,13 @@ void GriffonEngine::game_updspells() {
if (orn == 2)
y = y + 1;
- sys_line(_videobuffer, x, y - 1, x, y + 2, cl1);
- sys_line(_videobuffer, x, y, x, y + 1, cl3);
+ drawLine(_videobuffer, x, y - 1, x, y + 2, cl1);
+ drawLine(_videobuffer, x, y, x, y + 1, cl3);
if (rn == 0)
- sys_line(_videobuffer, x, y + 1, x, y + 1, cl2);
+ drawLine(_videobuffer, x, y + 1, x, y + 1, cl2);
if (rn == 2)
- sys_line(_videobuffer, x, y, x, y, cl2);
+ drawLine(_videobuffer, x, y, x, y, cl2);
orn = rn;
@@ -7147,7 +7147,7 @@ void GriffonEngine::game_updspells() {
float damage = 30 * (1 + RND() * 0.5);
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks)
- game_damagenpc(e, damage, 1);
+ damageNPC(e, damage, 1);
}
}
}
@@ -7169,7 +7169,7 @@ void GriffonEngine::game_updspells() {
_clipbg2->fillRect(rcSrc, 0);
- game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
}
}
}
@@ -7185,13 +7185,13 @@ void GriffonEngine::game_updspells() {
if (orn == 2)
x = x + 1;
- sys_line(_videobuffer, x - 1, y, x + 2, y, cl1);
- sys_line(_videobuffer, x, y, x + 1, y, cl3);
+ drawLine(_videobuffer, x - 1, y, x + 2, y, cl1);
+ drawLine(_videobuffer, x, y, x + 1, y, cl3);
if (rn == 0)
- sys_line(_videobuffer, x + 1, y, x + 1, y, cl2);
+ drawLine(_videobuffer, x + 1, y, x + 1, y, cl2);
if (rn == 2)
- sys_line(_videobuffer, x, y, x, y, cl2);
+ drawLine(_videobuffer, x, y, x, y, cl2);
orn = rn;
@@ -7204,7 +7204,7 @@ void GriffonEngine::game_updspells() {
float damage = 30 * (1 + RND() * 0.5);
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks)
- game_damagenpc(e, damage, 1);
+ damageNPC(e, damage, 1);
}
}
}
@@ -7226,7 +7226,7 @@ void GriffonEngine::game_updspells() {
_clipbg2->fillRect(rcSrc, 0);
- game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
}
}
}
@@ -7242,13 +7242,13 @@ void GriffonEngine::game_updspells() {
if (orn == 2)
x = x + 1;
- sys_line(_videobuffer, x - 1, y, x + 2, y, cl1);
- sys_line(_videobuffer, x, y, x + 1, y, cl3);
+ drawLine(_videobuffer, x - 1, y, x + 2, y, cl1);
+ drawLine(_videobuffer, x, y, x + 1, y, cl3);
if (rn == 0)
- sys_line(_videobuffer, x + 1, y, x + 1, y, cl2);
+ drawLine(_videobuffer, x + 1, y, x + 1, y, cl2);
if (rn == 2)
- sys_line(_videobuffer, x, y, x, y, cl2);
+ drawLine(_videobuffer, x, y, x, y, cl2);
orn = rn;
@@ -7261,7 +7261,7 @@ void GriffonEngine::game_updspells() {
float damage = 30 * (1 + RND() * 0.5);
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks)
- game_damagenpc(e, damage, 1);
+ damageNPC(e, damage, 1);
}
}
}
@@ -7283,7 +7283,7 @@ void GriffonEngine::game_updspells() {
_clipbg2->fillRect(rcSrc, 0);
- game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
}
}
}
@@ -7321,13 +7321,13 @@ void GriffonEngine::game_updspells() {
if (orn == 2)
x = x + 1;
- sys_line(_videobuffer, x - 1, y, x + 2, y, cl1);
- sys_line(_videobuffer, x, y, x + 1, y, cl3);
+ drawLine(_videobuffer, x - 1, y, x + 2, y, cl1);
+ drawLine(_videobuffer, x, y, x + 1, y, cl3);
if (rn == 0)
- sys_line(_videobuffer, x + 1, y, x + 1, y, cl2);
+ drawLine(_videobuffer, x + 1, y, x + 1, y, cl2);
if (rn == 2)
- sys_line(_videobuffer, x, y, x, y, cl2);
+ drawLine(_videobuffer, x, y, x, y, cl2);
orn = rn;
@@ -7347,7 +7347,7 @@ void GriffonEngine::game_updspells() {
}
if (_player.hp > 0)
- game_damageplayer(damage);
+ damagePlayer(damage);
}
}
}
@@ -7522,7 +7522,7 @@ void GriffonEngine::game_updspellsunder() {
if (_npcinfo[e].spriteset == 11)
damage = -damage;
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
- game_damagenpc(e, damage, 1);
+ damageNPC(e, damage, 1);
if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
setChannelVolume(snd, config.effectsvol);
@@ -7540,7 +7540,7 @@ void GriffonEngine::game_updspellsunder() {
float damage = (float)_npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
- game_damageplayer(damage);
+ damagePlayer(damage);
if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
@@ -7572,7 +7572,7 @@ void GriffonEngine::game_updspellsunder() {
setChannelVolume(snd, config.effectsvol);
}
- game_addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
}
}
}
@@ -7637,7 +7637,7 @@ void GriffonEngine::game_updspellsunder() {
float damage = (float)_npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
- game_damageplayer(damage);
+ damagePlayer(damage);
if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
setChannelVolume(snd, config.effectsvol);
@@ -7665,7 +7665,7 @@ void GriffonEngine::game_updspellsunder() {
}
}
-void GriffonEngine::sys_initialize() {
+void GriffonEngine::initialize() {
// init char *_floatstri[kMaxFloat]
for (int i = 0; i < kMaxFloat; i++)
_floatstri[i] = (char *)malloc(64); // 64 bytes each string (should be enough)
@@ -7689,24 +7689,24 @@ void GriffonEngine::sys_initialize() {
char name[128];
sprintf(name, "art/map%i.bmp", i + 1);
- mapimg[i] = IMG_Load(name, true);
+ mapimg[i] = loadImage(name, true);
}
- cloudimg = IMG_Load("art/clouds.bmp", true);
+ cloudimg = loadImage("art/clouds.bmp", true);
cloudimg->setAlpha(96, true);
- saveloadimg = IMG_Load("art/saveloadnew.bmp", true);
+ saveloadimg = loadImage("art/saveloadnew.bmp", true);
saveloadimg->setAlpha(160, true);
- _titleimg = IMG_Load("art/titleb.bmp");
- _titleimg2 = IMG_Load("art/titlea.bmp", true);
+ _titleimg = loadImage("art/titleb.bmp");
+ _titleimg2 = loadImage("art/titlea.bmp", true);
//_titleimg2->setAlpha(204, true);
- _inventoryimg = IMG_Load("art/inventory.bmp", true);
+ _inventoryimg = loadImage("art/inventory.bmp", true);
- _logosimg = IMG_Load("art/logos.bmp");
- _theendimg = IMG_Load("art/theend.bmp");
+ _logosimg = loadImage("art/logos.bmp");
+ _theendimg = loadImage("art/theend.bmp");
sys_LoadTiles();
@@ -7736,7 +7736,7 @@ void GriffonEngine::sys_initialize() {
setupAudio();
}
-void GriffonEngine::sys_line(Graphics::TransparentSurface *buffer, int x1, int y1, int x2, int y2, int col) {
+void GriffonEngine::drawLine(Graphics::TransparentSurface *buffer, int x1, int y1, int x2, int y2, int col) {
int xdif = x2 - x1;
int ydif = y2 - y1;
@@ -7756,14 +7756,14 @@ void GriffonEngine::sys_line(Graphics::TransparentSurface *buffer, int x1, int y
}
void GriffonEngine::sys_LoadAnims() {
- _spellimg = IMG_Load("art/spells.bmp", true);
- _anims[0] = IMG_Load("art/anims0.bmp", true);
- _animsa[0] = IMG_Load("art/anims0a.bmp", true);
- _anims[13] = IMG_Load("art/anims0x.bmp", true);
- _animsa[13] = IMG_Load("art/anims0xa.bmp", true);
- _anims[1] = IMG_Load("art/anims1.bmp", true);
- _animsa[1] = IMG_Load("art/anims1a.bmp", true);
- _anims[2] = IMG_Load("art/anims2.bmp", true);
+ _spellimg = loadImage("art/spells.bmp", true);
+ _anims[0] = loadImage("art/anims0.bmp", true);
+ _animsa[0] = loadImage("art/anims0a.bmp", true);
+ _anims[13] = loadImage("art/anims0x.bmp", true);
+ _animsa[13] = loadImage("art/anims0xa.bmp", true);
+ _anims[1] = loadImage("art/anims1.bmp", true);
+ _animsa[1] = loadImage("art/anims1a.bmp", true);
+ _anims[2] = loadImage("art/anims2.bmp", true);
// huge
_animset2[0].xofs = 8;
@@ -7808,7 +7808,7 @@ void GriffonEngine::sys_LoadAnims() {
_animset2[5].w = 42;
_animset2[5].h = 36;
- _anims[9] = IMG_Load("art/anims9.bmp", true);
+ _anims[9] = loadImage("art/anims9.bmp", true);
// huge
_animset9[0].xofs = 8;
@@ -7853,21 +7853,21 @@ void GriffonEngine::sys_LoadAnims() {
_animset9[5].w = 42;
_animset9[5].h = 36;
- _anims[3] = IMG_Load("art/anims3.bmp", true);
- _anims[4] = IMG_Load("art/anims4.bmp", true);
- _anims[5] = IMG_Load("art/anims5.bmp", true);
- _anims[6] = IMG_Load("art/anims6.bmp", true);
- _anims[7] = IMG_Load("art/anims7.bmp", true);
- _anims[8] = IMG_Load("art/anims8.bmp", true);
- _anims[10] = IMG_Load("art/anims10.bmp", true);
- _animsa[10] = IMG_Load("art/anims10a.bmp", true);
- _anims[11] = IMG_Load("art/anims11.bmp", true);
- _animsa[11] = IMG_Load("art/anims11a.bmp", true);
- _anims[12] = IMG_Load("art/anims12.bmp", true);
+ _anims[3] = loadImage("art/anims3.bmp", true);
+ _anims[4] = loadImage("art/anims4.bmp", true);
+ _anims[5] = loadImage("art/anims5.bmp", true);
+ _anims[6] = loadImage("art/anims6.bmp", true);
+ _anims[7] = loadImage("art/anims7.bmp", true);
+ _anims[8] = loadImage("art/anims8.bmp", true);
+ _anims[10] = loadImage("art/anims10.bmp", true);
+ _animsa[10] = loadImage("art/anims10a.bmp", true);
+ _anims[11] = loadImage("art/anims11.bmp", true);
+ _animsa[11] = loadImage("art/anims11a.bmp", true);
+ _anims[12] = loadImage("art/anims12.bmp", true);
}
void GriffonEngine::sys_LoadItemImgs() {
- Graphics::TransparentSurface *temp = IMG_Load("art/icons.bmp", true);
+ Graphics::TransparentSurface *temp = loadImage("art/icons.bmp", true);
for (int i = 0; i <= 20; i++) {
_itemimg[i] = new Graphics::TransparentSurface;
@@ -7885,7 +7885,7 @@ void GriffonEngine::sys_LoadItemImgs() {
}
void GriffonEngine::sys_LoadFont() {
- Graphics::TransparentSurface *font = IMG_Load("art/font.bmp", true);
+ Graphics::TransparentSurface *font = loadImage("art/font.bmp", true);
for (int i = 32; i <= 255; i++)
for (int f = 0; f <= 4; f++) {
@@ -7912,12 +7912,12 @@ void GriffonEngine::sys_LoadFont() {
}
void GriffonEngine::sys_LoadTiles() {
- _tiles[0] = IMG_Load("art/tx.bmp", true);
- _tiles[1] = IMG_Load("art/tx1.bmp", true);
- _tiles[2] = IMG_Load("art/tx2.bmp", true);
- _tiles[3] = IMG_Load("art/tx3.bmp", true);
+ _tiles[0] = loadImage("art/tx.bmp", true);
+ _tiles[1] = loadImage("art/tx1.bmp", true);
+ _tiles[2] = loadImage("art/tx2.bmp", true);
+ _tiles[3] = loadImage("art/tx3.bmp", true);
- _windowimg = IMG_Load("art/window.bmp", true);
+ _windowimg = loadImage("art/window.bmp", true);
}
void GriffonEngine::sys_LoadTriggers() {
@@ -7961,7 +7961,7 @@ void GriffonEngine::sys_LoadObjectDB() {
file.close();
}
-void GriffonEngine::sys_print(Graphics::TransparentSurface *buffer, const char *stri, int xloc, int yloc, int col) {
+void GriffonEngine::drawString(Graphics::TransparentSurface *buffer, const char *stri, int xloc, int yloc, int col) {
int l = strlen(stri);
for (int i = 0; i < l; i++) {
@@ -8024,7 +8024,7 @@ void GriffonEngine::sys_update() {
_player.opx = _player.px;
_player.opy = _player.py;
- game_checkhit();
+ checkHit();
}
for (int i = 0; i < kMaxFloat; i++) {
@@ -8050,7 +8050,7 @@ void GriffonEngine::sys_update() {
if (_player.exp >= _player.nextlevel) {
_player.level = _player.level + 1;
- game_addFloatText("LEVEL UP!", _player.px + 16 - 36, _player.py + 16, 3);
+ addFloatText("LEVEL UP!", _player.px + 16 - 36, _player.py + 16, 3);
_player.exp = _player.exp - _player.nextlevel;
_player.nextlevel = _player.nextlevel * 3 / 2; // 1.5
_player.maxhp = _player.maxhp + _player.level * 3;
@@ -8104,7 +8104,7 @@ void GriffonEngine::sys_update() {
_itemyloc -= 16;
if (_player.hp <= 0)
- game_theend();
+ theEnd();
if (_roomlock) {
_roomlock = false;
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index 5487ce7..d954269 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -66,18 +66,18 @@ Common::Error GriffonEngine::run() {
_console = new Console();
- sys_initialize();
- game_showlogos();
+ initialize();
+ showLogos();
if (_shouldQuit)
return Common::kNoError;
- game_title(0);
+ title(0);
if (_shouldQuit)
return Common::kNoError;
- game_saveloadnew();
+ saveLoadNew();
return Common::kNoError;
}
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 12ca51c..e691c59 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -257,50 +257,50 @@ private:
private:
float RND();
- void game_addFloatIcon(int ico, float xloc, float yloc);
- void game_addFloatText(const char *stri, float xloc, float yloc, int col);
- void game_attack();
- void game_castspell(int spellnum, float homex, float homey, float enemyx, float enemyy, int damagewho);
- void game_checkhit();
- void game_checkinputs();
- void game_checktrigger();
- void game_configmenu();
- void game_damagenpc(int npcnum, int damage, int spell);
- void game_damageplayer(int damage);
- void game_drawanims(int Layer);
- void game_drawhud();
- void game_drawnpcs(int mode);
- void game_drawover(int modx, int mody);
- void game_drawplayer();
- void game_drawview();
- void game_endofgame();
- void game_eventtext(const char *stri);
- void game_handlewalking();
- void game_loadmap(int mapnum);
+ void addFloatIcon(int ico, float xloc, float yloc);
+ void addFloatText(const char *stri, float xloc, float yloc, int col);
+ void attack();
+ void castSpell(int spellnum, float homex, float homey, float enemyx, float enemyy, int damagewho);
+ void checkHit();
+ void checkInputs();
+ void checkTrigger();
+ void configMenu();
+ void damageNPC(int npcnum, int damage, int spell);
+ void damagePlayer(int damage);
+ void drawAnims(int Layer);
+ void drawHud();
+ void drawNPCs(int mode);
+ void drawOver(int modx, int mody);
+ void drawPlayer();
+ void drawView();
+ void endOfGame();
+ void eventText(const char *stri);
+ void handleWalking();
+ void loadMap(int mapnum);
void newGame();
- void game_playgame();
- void game_processtrigger(int trignum);
- void game_saveloadnew();
- void game_showlogos();
- void game_swash();
- void game_theend();
- void game_title(int mode);
- void game_updanims();
- void game_updatey();
- void game_updmusic();
+ void mainLoop();
+ void processTrigger(int trignum);
+ void saveLoadNew();
+ void showLogos();
+ void swash();
+ void theEnd();
+ void title(int mode);
+ void updateAnims();
+ void updateY();
+ void updateMusic();
void game_updnpcs();
void game_updspells();
void game_updspellsunder();
- void sys_initialize();
- void sys_line(Graphics::TransparentSurface *buffer, int x1, int y1, int x2, int y2, int col);
+ void initialize();
+ void drawLine(Graphics::TransparentSurface *buffer, int x1, int y1, int x2, int y2, int col);
void sys_LoadAnims();
void sys_LoadFont();
void sys_LoadItemImgs();
void sys_LoadTiles();
void sys_LoadTriggers();
void sys_LoadObjectDB();
- void sys_print(Graphics::TransparentSurface *buffer, const char *stri, int xloc, int yloc, int col);
+ void drawString(Graphics::TransparentSurface *buffer, const char *stri, int xloc, int yloc, int col);
void drawProgress(int w, int wm);
void setupAudio();
void sys_update();
@@ -318,7 +318,7 @@ private:
void resumeSoundChannel(int channel);
bool isSoundChannelPlaying(int channel);
- Graphics::TransparentSurface *IMG_Load(const char *name, bool colorkey = false);
+ Graphics::TransparentSurface *loadImage(const char *name, bool colorkey = false);
private:
Graphics::TransparentSurface *_video, *_videobuffer, *_videobuffer2, *_videobuffer3;
diff --git a/engines/griffon/sound.cpp b/engines/griffon/sound.cpp
index b27f13c..a82cf4a 100644
--- a/engines/griffon/sound.cpp
+++ b/engines/griffon/sound.cpp
@@ -130,9 +130,9 @@ void GriffonEngine::setupAudio() {
//atexit(Mix_CloseAudio);
const char *stri = "Loading...";
- sys_print(_videobuffer, stri, 160 - 4 * strlen(stri), 116, 0);
+ drawString(_videobuffer, stri, 160 - 4 * strlen(stri), 116, 0);
- Graphics::TransparentSurface *loadimg = IMG_Load("art/load.bmp", true);
+ Graphics::TransparentSurface *loadimg = loadImage("art/load.bmp", true);
rcSrc.left = 0;
rcSrc.top = 0;
Commit: 23bd7eddf349414865f71088a77e12fcb2469d03
https://github.com/scummvm/scummvm/commit/23bd7eddf349414865f71088a77e12fcb2469d03
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Move another method to sound.cpp
Changed paths:
engines/griffon/engine.cpp
engines/griffon/sound.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 2a170d9..e86e2ab 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -5344,62 +5344,6 @@ void GriffonEngine::updateY() {
}
}
-void GriffonEngine::updateMusic() {
- DataChunk *iplaysound = NULL;
-
- if (config.music) {
-
- // if(_curmap > 5 && _curmap < 42) iplaysound = macademy;
- // if(_curmap > 47) iplaysound = _mgardens;
- iplaysound = _mgardens;
- if (_roomlock)
- iplaysound = _mboss;
-
- if (iplaysound == _mboss && _pboss)
- iplaysound = NULL;
- if (iplaysound == _mgardens && _pgardens)
- iplaysound = NULL;
-
- if (iplaysound != NULL) {
- haltSoundChannel(_musicchannel);
-
- _pboss = false;
- _pgardens = false;
- _ptown = false;
- _pacademy = false;
- _pcitadel = false;
-
- if (iplaysound == _mboss)
- _pboss = true;
- if (iplaysound == _mgardens)
- _pgardens = true;
-
- _musicchannel = playSound(iplaysound, true);
- setChannelVolume(_musicchannel, config.musicvol);
- } else {
- if (!isSoundChannelPlaying(_musicchannel)) {
- _loopseta += 1;
- if (_loopseta == 4)
- _loopseta = 0;
-
- if (_pgardens) {
- haltSoundChannel(_musicchannel);
- if (_pgardens && _loopseta == 0)
- _musicchannel = playSound(_mgardens);
- if (_pgardens && _loopseta == 1)
- _musicchannel = playSound(_mgardens2);
- if (_pgardens && _loopseta == 2)
- _musicchannel = playSound(_mgardens3);
- if (_pgardens && _loopseta == 3)
- _musicchannel = playSound(_mgardens4);
- }
-
- setChannelVolume(_musicchannel, config.musicvol);
- }
- }
- }
-}
-
void GriffonEngine::game_updnpcs() {
for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0) {
diff --git a/engines/griffon/sound.cpp b/engines/griffon/sound.cpp
index a82cf4a..eaa99c3 100644
--- a/engines/griffon/sound.cpp
+++ b/engines/griffon/sound.cpp
@@ -42,6 +42,7 @@
#include "common/system.h"
#include "griffon/griffon.h"
+#include "griffon/config.h"
namespace Griffon {
@@ -198,5 +199,61 @@ void GriffonEngine::setupAudio() {
_sfx[14] = cacheSound("sfx/beep.ogg");
}
+void GriffonEngine::updateMusic() {
+ DataChunk *iplaysound = NULL;
+
+ if (config.music) {
+
+ // if(_curmap > 5 && _curmap < 42) iplaysound = macademy;
+ // if(_curmap > 47) iplaysound = _mgardens;
+ iplaysound = _mgardens;
+ if (_roomlock)
+ iplaysound = _mboss;
+
+ if (iplaysound == _mboss && _pboss)
+ iplaysound = NULL;
+ if (iplaysound == _mgardens && _pgardens)
+ iplaysound = NULL;
+
+ if (iplaysound != NULL) {
+ haltSoundChannel(_musicchannel);
+
+ _pboss = false;
+ _pgardens = false;
+ _ptown = false;
+ _pacademy = false;
+ _pcitadel = false;
+
+ if (iplaysound == _mboss)
+ _pboss = true;
+ if (iplaysound == _mgardens)
+ _pgardens = true;
+
+ _musicchannel = playSound(iplaysound, true);
+ setChannelVolume(_musicchannel, config.musicvol);
+ } else {
+ if (!isSoundChannelPlaying(_musicchannel)) {
+ _loopseta += 1;
+ if (_loopseta == 4)
+ _loopseta = 0;
+
+ if (_pgardens) {
+ haltSoundChannel(_musicchannel);
+ if (_pgardens && _loopseta == 0)
+ _musicchannel = playSound(_mgardens);
+ if (_pgardens && _loopseta == 1)
+ _musicchannel = playSound(_mgardens2);
+ if (_pgardens && _loopseta == 2)
+ _musicchannel = playSound(_mgardens3);
+ if (_pgardens && _loopseta == 3)
+ _musicchannel = playSound(_mgardens4);
+ }
+
+ setChannelVolume(_musicchannel, config.musicvol);
+ }
+ }
+ }
+}
+
} // end of namespace Griffon
Commit: 227ba890774976825d08c6b5c48875bd18488917
https://github.com/scummvm/scummvm/commit/227ba890774976825d08c6b5c48875bd18488917
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Renamed remaining methods
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index e86e2ab..41adf35 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -2944,7 +2944,7 @@ void GriffonEngine::drawPlayer() {
void GriffonEngine::drawView() {
_videobuffer->copyRectToSurface(_mapbg->getPixels(), _mapbg->pitch, 0, 0, _mapbg->w, _mapbg->h);
- game_updspellsunder();
+ updateSpellsUnder();
drawAnims(0);
@@ -2961,7 +2961,7 @@ void GriffonEngine::drawView() {
drawOver((int)_player.px, (int)_player.py);
- game_updspells();
+ updateSpells();
if (cloudson == 1) {
Common::Rect rc;
@@ -4543,7 +4543,7 @@ void GriffonEngine::mainLoop() {
do {
if (!_forcepause) {
updateAnims();
- game_updnpcs();
+ updateNPCs();
}
checkTrigger();
@@ -4559,7 +4559,7 @@ void GriffonEngine::mainLoop() {
_console->onFrame();
- sys_update();
+ updateEngine();
} while (!_shouldQuit);
}
@@ -5344,7 +5344,7 @@ void GriffonEngine::updateY() {
}
}
-void GriffonEngine::game_updnpcs() {
+void GriffonEngine::updateNPCs() {
for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0) {
// is npc walking
@@ -6461,7 +6461,7 @@ void GriffonEngine::game_updnpcs() {
}
}
-void GriffonEngine::game_updspells() {
+void GriffonEngine::updateSpells() {
int foundel[5];
float npx, npy;
long cl1, cl2, cl3;
@@ -7311,7 +7311,7 @@ void GriffonEngine::game_updspells() {
-void GriffonEngine::game_updspellsunder() {
+void GriffonEngine::updateSpellsUnder() {
if (_forcepause)
return;
@@ -7653,12 +7653,12 @@ void GriffonEngine::initialize() {
_theendimg = loadImage("art/theend.bmp");
- sys_LoadTiles();
- sys_LoadTriggers();
- sys_LoadObjectDB();
- sys_LoadAnims();
- sys_LoadFont();
- sys_LoadItemImgs();
+ loadTiles();
+ loadTriggers();
+ loadObjectDB();
+ loadAnims();
+ loadFont();
+ loadItemImgs();
_fpsr = 1.0f;
_nextticks = _ticks + 1000;
@@ -7699,7 +7699,7 @@ void GriffonEngine::drawLine(Graphics::TransparentSurface *buffer, int x1, int y
}
}
-void GriffonEngine::sys_LoadAnims() {
+void GriffonEngine::loadAnims() {
_spellimg = loadImage("art/spells.bmp", true);
_anims[0] = loadImage("art/anims0.bmp", true);
_animsa[0] = loadImage("art/anims0a.bmp", true);
@@ -7810,7 +7810,7 @@ void GriffonEngine::sys_LoadAnims() {
_anims[12] = loadImage("art/anims12.bmp", true);
}
-void GriffonEngine::sys_LoadItemImgs() {
+void GriffonEngine::loadItemImgs() {
Graphics::TransparentSurface *temp = loadImage("art/icons.bmp", true);
for (int i = 0; i <= 20; i++) {
@@ -7828,7 +7828,7 @@ void GriffonEngine::sys_LoadItemImgs() {
temp->free();
}
-void GriffonEngine::sys_LoadFont() {
+void GriffonEngine::loadFont() {
Graphics::TransparentSurface *font = loadImage("art/font.bmp", true);
for (int i = 32; i <= 255; i++)
@@ -7855,7 +7855,7 @@ void GriffonEngine::sys_LoadFont() {
font->free();
}
-void GriffonEngine::sys_LoadTiles() {
+void GriffonEngine::loadTiles() {
_tiles[0] = loadImage("art/tx.bmp", true);
_tiles[1] = loadImage("art/tx1.bmp", true);
_tiles[2] = loadImage("art/tx2.bmp", true);
@@ -7864,7 +7864,7 @@ void GriffonEngine::sys_LoadTiles() {
_windowimg = loadImage("art/window.bmp", true);
}
-void GriffonEngine::sys_LoadTriggers() {
+void GriffonEngine::loadTriggers() {
Common::File file;
file.open("data/triggers.dat");
@@ -7879,7 +7879,7 @@ void GriffonEngine::sys_LoadTriggers() {
file.close();
}
-void GriffonEngine::sys_LoadObjectDB() {
+void GriffonEngine::loadObjectDB() {
Common::File file;
file.open("objectdb.dat");
@@ -7916,7 +7916,7 @@ void GriffonEngine::drawString(Graphics::TransparentSurface *buffer, const char
}
}
-void GriffonEngine::sys_update() {
+void GriffonEngine::updateEngine() {
g_system->updateScreen();
g_system->getEventManager()->pollEvent(_event);
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index e691c59..10e5585 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -288,22 +288,22 @@ private:
void updateAnims();
void updateY();
void updateMusic();
- void game_updnpcs();
- void game_updspells();
- void game_updspellsunder();
+ void updateNPCs();
+ void updateSpells();
+ void updateSpellsUnder();
void initialize();
void drawLine(Graphics::TransparentSurface *buffer, int x1, int y1, int x2, int y2, int col);
- void sys_LoadAnims();
- void sys_LoadFont();
- void sys_LoadItemImgs();
- void sys_LoadTiles();
- void sys_LoadTriggers();
- void sys_LoadObjectDB();
+ void loadAnims();
+ void loadFont();
+ void loadItemImgs();
+ void loadTiles();
+ void loadTriggers();
+ void loadObjectDB();
void drawString(Graphics::TransparentSurface *buffer, const char *stri, int xloc, int yloc, int col);
void drawProgress(int w, int wm);
void setupAudio();
- void sys_update();
+ void updateEngine();
Common::String makeSaveGameName(int slot);
int loadState(int slotnum);
Commit: 83ef0f3b4d0cf12aed161f8bf8ca84004e95c0f9
https://github.com/scummvm/scummvm/commit/83ef0f3b4d0cf12aed161f8bf8ca84004e95c0f9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Moved methods to combat.cpp
Changed paths:
A engines/griffon/combat.cpp
engines/griffon/engine.cpp
engines/griffon/griffon.h
engines/griffon/module.mk
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp
new file mode 100644
index 0000000..1374ea5
--- /dev/null
+++ b/engines/griffon/combat.cpp
@@ -0,0 +1,1032 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Originally written by Syn9 in FreeBASIC with SDL
+ * http://syn9.thehideoutgames.com/index_backup.php
+ *
+ * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
+ * http://github.com/dmitrysmagin/griffon_legend
+ *
+ *
+ * Programming/Graphics: Daniel "Syn9" Kennedy
+ * Music/Sound effects: David Turner
+ *
+ * Beta testing and gameplay design help:
+ * Deleter, Cha0s, Aether Fox, and Kiz
+ *
+ */
+
+#include "griffon/griffon.h"
+#include "griffon/config.h"
+#include "griffon/console.h"
+
+namespace Griffon {
+
+void GriffonEngine::attack() {
+ float npx = _player.px + 12;
+ float npy = _player.py + 20;
+
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
+
+ // if facing up
+ if (_player.walkdir == 0) {
+ if (ly > 0) {
+ int o2 = 0; // ??
+ int o = _objectMap[lx][ly - 1];
+ if (ly > 1 && _curmap == 58)
+ o2 = _objectMap[lx][ly - 2];
+ if (ly > 1 && _curmap == 54)
+ o2 = _objectMap[lx][ly - 2];
+
+ // cst
+ if ((_objectInfo[o][4] == 1 && (o == 0 || o > 4)) || (_objectInfo[o2][4] == 0 && o2 == 10)) {
+ if (o2 == 10)
+ o = 10;
+
+ int oscript = _objectInfo[o][5];
+ if (oscript == 0 && _player.inventory[kInvFlask] < 9) {
+ _player.inventory[kInvFlask]++;
+ addFloatIcon(6, lx * 16, (ly - 1) * 16);
+
+ _objmapf[_curmap][lx][ly - 1] = 1;
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
+
+ eventText("Found Flask!");
+ _itemticks = _ticks + 215;
+ return;
+ }
+
+ if (oscript == 0 && _player.inventory[kInvFlask] == 9) {
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndChest]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ eventText("Cannot Carry any more Flasks!");
+ _itemticks = _ticks + 215;
+ return;
+ }
+
+ if (oscript == kScriptMasterKey) {
+ _player.inventory[kInvMasterKey]++;
+
+ addFloatIcon(14, lx * 16, (ly - 1) * 16);
+
+ _itemticks = _ticks + 215;
+
+ if (_curmap == 34)
+ _scriptflag[kScriptMasterKey][0] = 2;
+ if (_curmap == 62)
+ _scriptflag[kScriptGardenMasterKey][0] = 2;
+ if (_curmap == 81)
+ _scriptflag[kScriptCitadelMasterKey][0] = 2;
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
+ eventText("Found the Temple Key!");
+ return;
+ }
+
+ if (oscript == kScriptFindCtystal) {
+ _player.foundspell[0] = 1;
+ _player.spellcharge[0] = 0;
+
+ addFloatIcon(7, lx * 16, (ly - 1) * 16);
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
+
+ eventText("Found the Infinite Crystal!");
+ _itemticks = _ticks + 215;
+ return;
+ }
+
+ if (oscript == kScriptFindShield && _player.shield == 1) {
+ _player.shield = 2;
+
+ addFloatIcon(4, lx * 16, (ly - 1) * 16);
+
+ _itemticks = _ticks + 215;
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
+
+ eventText("Found the Obsidian Shield!");
+ _objmapf[4][1][2] = 1;
+ return;
+ }
+
+ if (oscript == kScriptFindSword && _player.sword == 1) {
+ _player.sword = 2;
+
+ addFloatIcon(3, lx * 16, (ly - 1) * 16);
+
+ _itemticks = _ticks + 215;
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
+ eventText("Found the Fidelis Sword!");
+ return;
+ }
+
+ if (oscript == kScriptKeyChest) {
+ if (_player.inventory[kInvNormalKey] < 9) {
+ _player.inventory[kInvNormalKey]++;
+
+ for (int s = 20; s <= 23; s++) {
+ if (_scriptflag[s][0] == 1) {
+ _scriptflag[s][0] = 2;
+ }
+ }
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ _objmapf[_curmap][lx][ly - 1] = 1;
+
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
+
+ eventText("Found Key");
+ addFloatIcon(16, lx * 16, (ly - 1) * 16);
+ } else {
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndChest]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ eventText("Cannot Carry Any More Keys");
+ }
+ }
+
+ if (oscript == kScriptBlueFlask && _player.inventory[kInvDoubleFlask] < 9) {
+ _player.inventory[kInvDoubleFlask]++;
+ addFloatIcon(12, lx * 16, (ly - 1) * 16);
+
+ _objmapf[_curmap][lx][ly - 1] = 1;
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
+
+ eventText("Found Mega Flask!");
+ _itemticks = _ticks + 215;
+ return;
+ }
+
+ if (oscript == kScriptBlueFlask && _player.inventory[kInvDoubleFlask] == 9) {
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndChest]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ eventText("Cannot Carry any more Mega Flasks!");
+ _itemticks = _ticks + 215;
+ return;
+ }
+
+ if (oscript == kScriptBlueFlaskChest && _player.inventory[kInvDoubleFlask] < 9) {
+ _player.inventory[kInvDoubleFlask]++;
+ addFloatIcon(12, lx * 16, (ly - 1) * 16);
+
+ _objmapf[_curmap][lx][ly - 1] = 1;
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
+
+ eventText("Found Mega Flask!");
+ _itemticks = _ticks + 215;
+ return;
+ }
+
+ if (oscript == kScriptBlueFlaskChest && _player.inventory[kInvDoubleFlask] == 9) {
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndChest]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ eventText("Cannot Carry any more Mega Flasks!");
+ _itemticks = _ticks + 215;
+ return;
+ }
+
+ if (oscript == kScriptLightningChest && _player.inventory[kInvShock] < 9) {
+ _player.inventory[kInvShock]++;
+ addFloatIcon(17, lx * 16, (ly - 1) * 16);
+
+ _objmapf[_curmap][lx][ly - 1] = 1;
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
+
+ eventText("Found Lightning Bomb!");
+ _itemticks = _ticks + 215;
+ return;
+ }
+
+ if (oscript == kScriptLightningChest && _player.inventory[kInvShock] == 9) {
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndChest]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ eventText("Cannot Carry any more Lightning Bombs!");
+ _itemticks = _ticks + 215;
+ return;
+ }
+
+ if (oscript == kScriptArmourChest && _player.armour == 1) {
+ _player.armour = 2;
+
+ addFloatIcon(5, lx * 16, (ly - 1) * 16);
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
+
+ eventText("Found the Fidelis Mail!");
+ _itemticks = _ticks + 215;
+ return;
+ }
+
+ if (oscript == kScriptLever) {
+ if (_curmap == 58 && _scriptflag[kScriptLever][0] == 0) {
+ _scriptflag[kScriptLever][0] = 1;
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndLever]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ } else if (_curmap == 58 && _scriptflag[kScriptLever][0] > 0) {
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndDoor]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ eventText("It's stuck!");
+ }
+
+ if (_curmap == 54 && _scriptflag[kScriptLever][0] == 1) {
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndLever]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ _scriptflag[kScriptLever][0] = 2;
+ } else if (_curmap == 54 && _scriptflag[kScriptLever][0] > 1) {
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndDoor]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ eventText("It's stuck!");
+ }
+
+ }
+
+ if (oscript == kScriptGetSword3 && _player.sword < 3) {
+ _player.sword = 3;
+
+ addFloatIcon(18, lx * 16, (ly - 1) * 16);
+
+ _itemticks = _ticks + 215;
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
+ eventText("Found the Blood Sword!");
+ _objmapf[4][1][2] = 1;
+ return;
+ }
+
+ if (oscript == kScriptShield3 && _player.shield < 3) {
+ _player.shield = 3;
+ addFloatIcon(19, lx * 16, (ly - 1) * 16);
+ _itemticks = _ticks + 215;
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
+ eventText("Found the Entropy Shield!");
+ _objmapf[4][1][2] = 1;
+ return;
+ }
+
+ if (oscript == kScriptArmour3 && _player.armour < 3) {
+ _player.armour = 3;
+ addFloatIcon(20, lx * 16, (ly - 1) * 16);
+ _itemticks = _ticks + 215;
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
+ eventText("Found the Rubyscale Armour!");
+ _objmapf[4][1][2] = 1;
+ return;
+ }
+
+ }
+ }
+ }
+
+ attacking = true;
+ _player.attackframe = 0;
+ movingup = false;
+ movingdown = false;
+ movingleft = false;
+ movingright = false;
+
+ for (int i = 0; i <= 15; i++) {
+ for (int a = 0; a <= 3; a++) {
+ _playerattackofs[a][i][2] = 0;
+ }
+ }
+}
+
+void GriffonEngine::castSpell(int spellnum, float homex, float homey, float enemyx, float enemyy, int damagewho) {
+ // spellnum 7 = sprite 6 spitfire
+
+ for (int i = 0; i < kMaxSpell; i++) {
+ if (ABS(spellinfo[i].frame) < kEpsilon) {
+ spellinfo[i].homex = homex;
+ spellinfo[i].homey = homey;
+ spellinfo[i].enemyx = enemyx;
+ spellinfo[i].enemyy = enemyy;
+ spellinfo[i].spellnum = spellnum;
+ int dw = 0;
+ int npc = 0;
+ if (damagewho > 0) {
+ dw = 1;
+ npc = damagewho;
+ }
+
+ spellinfo[i].damagewho = dw;
+ spellinfo[i].npc = npc;
+
+ spellinfo[i].frame = 32.0f;
+ if (damagewho == 0) {
+ spellinfo[i].strength = _player.spellstrength / 100;
+ if (ABS(_player.spellstrength - 100) < kEpsilon)
+ spellinfo[i].strength = 1.5f;
+ }
+
+ // set earthslide vars
+ if (spellnum == 2) {
+ for (int f = 0; f <= 8; f++) {
+ spellinfo[i].rocky[f] = 0;
+ spellinfo[i].rockimg[f] = (int)(RND() * 4);
+ spellinfo[i].rockdeflect[f] = ((int)(RND() * 128) - 64) * 1.5;
+ }
+ }
+
+ // set fire vars
+ if (spellnum == 3) {
+ for (int f = 0; f <= 4; f++) {
+ spellinfo[i].legalive[f] = 32;
+ }
+ }
+
+
+ // room fireball vars
+ if (spellnum == 6) {
+ int nballs = 0;
+ for (int x = 0; x <= 19; x++) {
+ for (int y = 0; y <= 14; y++) {
+ if ((_objectMap[x][y] == 1 || _objectMap[x][y] == 2) && nballs < 5 && (int)(RND() * 4) == 0) {
+ int ax = x * 16;
+ int ay = y * 16;
+
+ spellinfo[i].fireballs[nballs][0] = ax;
+ spellinfo[i].fireballs[nballs][1] = ay;
+ spellinfo[i].fireballs[nballs][2] = 0;
+ spellinfo[i].fireballs[nballs][3] = 0;
+
+ spellinfo[i].ballon[nballs] = 1;
+ nballs = nballs + 1;
+ }
+ }
+ }
+ spellinfo[i].nfballs = nballs;
+ }
+
+ if (config.effects) {
+ if (spellnum == 1) {
+ int snd = playSound(_sfx[kSndThrow]);
+ setChannelVolume(snd, config.effectsvol);
+ } else if (spellnum == 5) {
+ int snd = playSound(_sfx[kSndCrystal]);
+ setChannelVolume(snd, config.effectsvol);
+ } else if (spellnum == 8 || spellnum == 9) {
+ int snd = playSound(_sfx[kSndLightning]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+ }
+
+ return;
+ }
+ }
+}
+
+void GriffonEngine::checkHit() {
+ if (attacking) {
+ for (int i = 1; i <= _lastnpc; i++) {
+ if (_npcinfo[i].hp > 0 && _npcinfo[i].pause < _ticks && (int)(RND() * 2) == 0) {
+ float npx = _npcinfo[i].x;
+ float npy = _npcinfo[i].y;
+
+ float xdif = _player.px - npx;
+ float ydif = _player.py - npy;
+
+ float ps = _player.sword;
+ if (ps > 1)
+ ps = ps * 0.75;
+ float damage = (float)_player.sworddamage * (1.0 + RND() * 1.0) * _player.attackstrength / 100.0 * ps;
+
+ if (_console->_godMode)
+ damage = 1000;
+
+ if (ABS(_player.attackstrength - 100) < kEpsilon)
+ damage *= 1.5;
+
+ bool hit = false;
+ if (_player.walkdir == 0) {
+ if (abs(xdif) <= 8 && ydif >= 0 && ydif < 8)
+ hit = true;
+ } else if (_player.walkdir == 1) {
+ if (abs(xdif) <= 8 && ydif <= 0 && ydif > -8)
+ hit = true;
+ } else if (_player.walkdir == 2) {
+ if (abs(ydif) <= 8 && xdif >= -8 && xdif < 8)
+ hit = true;
+ } else if (_player.walkdir == 3) {
+ if (abs(ydif) <= 8 && xdif <= 8 && xdif > -8)
+ hit = true;
+ }
+
+ if (hit) {
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndSwordHit]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ damageNPC(i, damage, 0);
+ }
+ }
+ }
+ }
+}
+
+void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
+ char line[256];
+ int fcol;
+
+ if (damage == 0) {
+ strcpy(line, "miss!");
+ fcol = 2;
+ } else {
+ int ratio = 0;
+ int heal = 0;
+ if (damage < 0)
+ heal = 1;
+ damage = abs(damage);
+
+ if (heal == 0) {
+ if (damage > _npcinfo[npcnum].hp) {
+ ratio = (damage - _npcinfo[npcnum].hp) * 100 / damage;
+ damage = _npcinfo[npcnum].hp;
+ }
+
+ _npcinfo[npcnum].hp -= damage;
+ if (_npcinfo[npcnum].hp < 0)
+ _npcinfo[npcnum].hp = 0;
+
+ sprintf(line, "-%i", damage);
+ fcol = 1;
+ } else {
+ _npcinfo[npcnum].hp += damage;
+ if (_npcinfo[npcnum].hp > _npcinfo[npcnum].maxhp)
+ _npcinfo[npcnum].hp = _npcinfo[npcnum].maxhp;
+
+ sprintf(line, "+%i", damage);
+ fcol = 5;
+ }
+
+ _npcinfo[npcnum].pause = _ticks + 900;
+
+ if (spell == 0)
+ _player.attackstrength = ratio;
+ }
+
+ addFloatText(line, _npcinfo[npcnum].x + 12 - 4 * strlen(line), _npcinfo[npcnum].y + 16, fcol);
+
+ if (_npcinfo[npcnum].spriteset == 12)
+ castSpell(9, _npcinfo[npcnum].x, _npcinfo[npcnum].y, _player.px, _player.py, npcnum);
+
+ // if enemy is killed
+ if (_npcinfo[npcnum].hp == 0) {
+ _player.exp = _player.exp + _npcinfo[npcnum].maxhp;
+
+ if (_npcinfo[npcnum].spriteset == 1 || _npcinfo[npcnum].spriteset == 7 || _npcinfo[npcnum].spriteset == 6) {
+ int ff = (int)(RND() * _player.level * 3);
+ if (ff == 0) {
+ float npx = _npcinfo[npcnum].x + 12;
+ float npy = _npcinfo[npcnum].y + 20;
+
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
+
+ if (_objectMap[lx][ly] == -1)
+ _objectMap[lx][ly] = 4;
+ }
+ }
+
+ if (_npcinfo[npcnum].spriteset == 2 || _npcinfo[npcnum].spriteset == 9 || _npcinfo[npcnum].spriteset == 4 || _npcinfo[npcnum].spriteset == 5) {
+ int ff = (int)(RND() * _player.level);
+ if (ff == 0) {
+ float npx = _npcinfo[npcnum].x + 12;
+ float npy = _npcinfo[npcnum].y + 20;
+
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
+
+ if (_objectMap[lx][ly] == -1)
+ _objectMap[lx][ly] = 12;
+ }
+ }
+
+ if (_npcinfo[npcnum].spriteset == 9 || _npcinfo[npcnum].spriteset == 10 || _npcinfo[npcnum].spriteset == 5) {
+ int ff = (int)(RND() * _player.level * 2);
+ if (ff == 0) {
+ float npx = _npcinfo[npcnum].x + 12;
+ float npy = _npcinfo[npcnum].y + 20;
+
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
+
+ if (_objectMap[lx][ly] == -1)
+ _objectMap[lx][ly] = 13;
+ }
+ }
+
+ // academy master key chest script
+ if (_npcinfo[npcnum].script == kScriptMasterKey) {
+ bool alive = false;
+ for (int i = 1; i <= _lastnpc; i++) {
+ if (_npcinfo[i].hp > 0)
+ alive = true;
+ }
+
+ if (!alive) {
+ int cx = 9;
+ int cy = 7;
+
+ _objectMap[cx][cy] = 5;
+
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
+
+ float npx = _player.px + 12;
+ float npy = _player.py + 20;
+
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
+
+ if (lx == cx && ly == cy)
+ _player.py = _player.py + 16;
+ _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
+ _scriptflag[kScriptMasterKey][0] = 1;
+ }
+ }
+
+ // academy crystal chest script
+ if (_npcinfo[npcnum].script == kScriptFindCtystal) {
+ bool alive = false;
+ for (int i = 1; i <= _lastnpc; i++) {
+ if (_npcinfo[i].hp > 0)
+ alive = true;
+ }
+
+ if (!alive) {
+ int cx = 9;
+ int cy = 7;
+
+ _objectMap[cx][cy] = 6;
+
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
+
+ float npx = _player.px + 12;
+ float npy = _player.py + 20;
+
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
+
+ if (lx == cx && ly == cy)
+ _player.py = _player.py + 16;
+ _scriptflag[kScriptFindCtystal][0] = 1;
+ _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
+ }
+ }
+
+ // tower shield chest script
+ if (_npcinfo[npcnum].script == kScriptFindShield && _scriptflag[kScriptFindShield][0] == 0) {
+ _triggerloc[9][7] = 5004;
+
+ int curtile = 40;
+ int curtilel = 0;
+ int curtilex = curtile % 20;
+ int curtiley = (curtile - curtilex) / 20;
+
+ int l = 0; // ?? not defined in original code
+ _tileinfo[l][9][7][0] = curtile + 1;
+ _tileinfo[l][9][7][1] = 0;
+
+ rcSrc.left = curtilex * 16;
+ rcSrc.top = curtiley * 16;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
+
+ rcDest.left = 9 * 16;
+ rcDest.top = 7 * 16;
+ rcDest.setWidth(16);
+ rcDest.setHeight(16);
+
+ _tiles[curtilel]->blit(*_mapbg, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ }
+
+ // firehydra sword chest
+ if (_npcinfo[npcnum].script == kScriptFindSword) {
+ bool alive = false;
+ for (int i = 1; i <= _lastnpc; i++) {
+ if (_npcinfo[i].hp > 0)
+ alive = true;
+ }
+
+ if (!alive) {
+ int cx = 9;
+ int cy = 6;
+
+ _objectMap[cx][cy] = 9;
+
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
+
+ float npx = _player.px + 12;
+ float npy = _player.py + 20;
+
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
+
+ if (lx == cx && ly == cy)
+ _player.py = _player.py + 16;
+ _scriptflag[kScriptFindSword][0] = 1;
+ _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
+ }
+
+ }
+
+ // gardens master key script
+ if (_npcinfo[npcnum].script == kScriptGardenMasterKey && _scriptflag[kScriptKeyChest][0] == 0) {
+ bool alive = false;
+ for (int i = 1; i <= _lastnpc; i++) {
+ if (_npcinfo[i].hp > 0)
+ alive = true;
+ }
+
+ if (!alive) {
+ int cx = 13;
+ int cy = 7;
+
+ _objectMap[cx][cy] = 5;
+
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
+
+ float npx = _player.px + 12;
+ float npy = _player.py + 20;
+
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
+
+ if (lx == cx && ly == cy)
+ _player.py = _player.py + 16;
+ _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
+ _scriptflag[kScriptGardenMasterKey][0] = 1;
+ }
+ }
+
+ // regular key chest 1
+ for (int s = 20; s <= 23; s++) {
+ if (_npcinfo[npcnum].script == s && _scriptflag[s][0] < 2) {
+ bool alive = false;
+ for (int i = 1; i <= _lastnpc; i++) {
+ if (_npcinfo[i].hp > 0)
+ alive = true;
+ }
+
+ if (!alive) {
+ int cx = 9;
+ int cy = 7;
+
+ _objectMap[cx][cy] = 11;
+
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
+
+ float npx = _player.px + 12;
+ float npy = _player.py + 20;
+
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
+
+ if (lx == cx && ly == cy)
+ _player.py = _player.py + 16;
+ _scriptflag[s][0] = 1;
+ _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
+ }
+ }
+ }
+
+ // pickup lightning bomb
+ if (_npcinfo[npcnum].script == kScriptLightningBomb && (_curmap == 41 && _scriptflag[kScriptLightningBomb][1] == 0)) {
+ bool alive = false;
+ for (int i = 1; i <= _lastnpc; i++) {
+ if (_npcinfo[i].hp > 0)
+ alive = true;
+ }
+
+ if (!alive) {
+ int cx = 9;
+ int cy = 7;
+
+ _objectMap[cx][cy] = 13;
+
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
+
+ float npx = _player.px + 12;
+ float npy = _player.py + 20;
+
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
+
+ if (lx == cx && ly == cy)
+ _player.py = _player.py + 16;
+ }
+ }
+
+ // citadel armour chest
+ if (_npcinfo[npcnum].script == kScriptArmourChest) {
+ bool alive = false;
+ for (int i = 1; i <= _lastnpc; i++) {
+ if (_npcinfo[i].hp > 0)
+ alive = true;
+ }
+
+ if (!alive) {
+ int cx = 8;
+ int cy = 7;
+
+ _objectMap[cx][cy] = 16;
+
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
+
+ float npx = _player.px + 12;
+ float npy = _player.py + 20;
+
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
+
+ if (lx == cx && ly == cy)
+ _player.py = _player.py + 16;
+ _scriptflag[kScriptArmourChest][0] = 1;
+ _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
+ }
+ }
+
+ // citadel master key script
+ if (_npcinfo[npcnum].script == kScriptCitadelMasterKey && _scriptflag[kScriptCitadelMasterKey][0] == 0) {
+ bool alive = false;
+ for (int i = 1; i <= _lastnpc; i++) {
+ if (_npcinfo[i].hp > 0)
+ alive = true;
+ }
+
+ if (!alive) {
+ int cx = 11;
+ int cy = 10;
+
+ _objectMap[cx][cy] = 5;
+
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
+
+ float npx = _player.px + 12;
+ float npy = _player.py + 20;
+
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
+
+ if (lx == cx && ly == cy)
+ _player.py = _player.py + 16;
+ _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
+ _scriptflag[kScriptCitadelMasterKey][0] = 1;
+ }
+ }
+
+ // max ups
+ if (_npcinfo[npcnum].script == kScriptGetSword3 && _scriptflag[kScriptGetSword3][0] == 0) {
+ bool alive = false;
+ for (int i = 1; i <= _lastnpc; i++) {
+ if (_npcinfo[i].hp > 0)
+ alive = true;
+ }
+
+ if (!alive) {
+ int cx = 6;
+ int cy = 8;
+
+ _objectMap[cx][cy] = 18;
+
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
+
+ float npx = _player.px + 12;
+ float npy = _player.py + 20;
+
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
+
+ if (lx == cx && ly == cy)
+ _player.py = _player.py + 16;
+ _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
+ _scriptflag[kScriptGetSword3][0] = 1;
+
+ cx = 9;
+ cy = 8;
+
+ _objectMap[cx][cy] = 19;
+
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
+
+ npx = _player.px + 12;
+ npy = _player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if (lx == cx && ly == cy)
+ _player.py = _player.py + 16;
+ _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
+
+ _scriptflag[kScriptShield3][0] = 1;
+
+ cx = 12;
+ cy = 8;
+
+ _objectMap[cx][cy] = 20;
+
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
+
+ npx = _player.px + 12;
+ npy = _player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if (lx == cx && ly == cy)
+ _player.py = _player.py + 16;
+ _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
+ _scriptflag[kScriptArmour3][0] = 1;
+ }
+ }
+
+ if (_npcinfo[npcnum].script == kScriptEndOfGame)
+ endOfGame();
+ }
+}
+
+void GriffonEngine::damagePlayer(int damage) {
+ char line[256];
+
+ if (!_console->_godMode)
+ _player.hp -= damage;
+
+ if (_player.hp < 0)
+ _player.hp = 0;
+
+ sprintf(line, "-%i", damage);
+ if (damage == 0)
+ strcpy(line, "miss!");
+
+ addFloatText(line, _player.px + 12 - 4 * strlen(line), _player.py + 16, 4);
+
+ _player.pause = _ticks + 1000;
+}
+
+
+} // end of namespace Griffon
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 41adf35..b32f890 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -45,28 +45,6 @@
namespace Griffon {
-// in game scripts
-enum {
- kScriptMasterKey = 2, // find master key
- kScriptFindCtystal = 3, // find crystal
- kScriptFindShield = 4, // find shield - obj 8
- kScriptFindSword = 5, // find sword - obj 9
- kScriptKeyChest = 6, // regular key chest
- kScriptBlueFlask = 7, // blue flask
- kScriptGardenMasterKey = 8, // garden's master key
- kScriptLightningBomb = 9, // lightning bomb
- kScriptBlueFlaskChest = 10, // blue flask chest
- kScriptLightningChest = 11, // lightning chest
- kScriptArmourChest = 12, // armour chest
- kScriptCitadelMasterKey = 13, // citadel master key
- kScriptEndOfGame = 14, // end of game
- kScriptGetSword3 = 15, // get sword3
- kScriptShield3 = 16, // shield3
- kScriptArmour3 = 17, // armour3
- kScriptKeyChest1 = 20, // key chest 1
- kScriptLever = 60 // lever
-};
-
// memo
/*
monsters
@@ -308,521 +286,6 @@ void GriffonEngine::addFloatText(const char *stri, float xloc, float yloc, int c
}
}
-void GriffonEngine::attack() {
- float npx = _player.px + 12;
- float npy = _player.py + 20;
-
- int lx = (int)npx / 16;
- int ly = (int)npy / 16;
-
- // if facing up
- if (_player.walkdir == 0) {
- if (ly > 0) {
- int o2 = 0; // ??
- int o = _objectMap[lx][ly - 1];
- if (ly > 1 && _curmap == 58)
- o2 = _objectMap[lx][ly - 2];
- if (ly > 1 && _curmap == 54)
- o2 = _objectMap[lx][ly - 2];
-
- // cst
- if ((_objectInfo[o][4] == 1 && (o == 0 || o > 4)) || (_objectInfo[o2][4] == 0 && o2 == 10)) {
- if (o2 == 10)
- o = 10;
-
- int oscript = _objectInfo[o][5];
- if (oscript == 0 && _player.inventory[kInvFlask] < 9) {
- _player.inventory[kInvFlask]++;
- addFloatIcon(6, lx * 16, (ly - 1) * 16);
-
- _objmapf[_curmap][lx][ly - 1] = 1;
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- if (_objectInfo[o][4] == 1)
- _objectMap[lx][ly - 1] = 3;
-
- eventText("Found Flask!");
- _itemticks = _ticks + 215;
- return;
- }
-
- if (oscript == 0 && _player.inventory[kInvFlask] == 9) {
- if (config.effects) {
- int snd = playSound(_sfx[kSndChest]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- eventText("Cannot Carry any more Flasks!");
- _itemticks = _ticks + 215;
- return;
- }
-
- if (oscript == kScriptMasterKey) {
- _player.inventory[kInvMasterKey]++;
-
- addFloatIcon(14, lx * 16, (ly - 1) * 16);
-
- _itemticks = _ticks + 215;
-
- if (_curmap == 34)
- _scriptflag[kScriptMasterKey][0] = 2;
- if (_curmap == 62)
- _scriptflag[kScriptGardenMasterKey][0] = 2;
- if (_curmap == 81)
- _scriptflag[kScriptCitadelMasterKey][0] = 2;
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- if (_objectInfo[o][4] == 1)
- _objectMap[lx][ly - 1] = 3;
- eventText("Found the Temple Key!");
- return;
- }
-
- if (oscript == kScriptFindCtystal) {
- _player.foundspell[0] = 1;
- _player.spellcharge[0] = 0;
-
- addFloatIcon(7, lx * 16, (ly - 1) * 16);
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- if (_objectInfo[o][4] == 1)
- _objectMap[lx][ly - 1] = 3;
-
- eventText("Found the Infinite Crystal!");
- _itemticks = _ticks + 215;
- return;
- }
-
- if (oscript == kScriptFindShield && _player.shield == 1) {
- _player.shield = 2;
-
- addFloatIcon(4, lx * 16, (ly - 1) * 16);
-
- _itemticks = _ticks + 215;
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- if (_objectInfo[o][4] == 1)
- _objectMap[lx][ly - 1] = 3;
-
- eventText("Found the Obsidian Shield!");
- _objmapf[4][1][2] = 1;
- return;
- }
-
- if (oscript == kScriptFindSword && _player.sword == 1) {
- _player.sword = 2;
-
- addFloatIcon(3, lx * 16, (ly - 1) * 16);
-
- _itemticks = _ticks + 215;
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- if (_objectInfo[o][4] == 1)
- _objectMap[lx][ly - 1] = 3;
- eventText("Found the Fidelis Sword!");
- return;
- }
-
- if (oscript == kScriptKeyChest) {
- if (_player.inventory[kInvNormalKey] < 9) {
- _player.inventory[kInvNormalKey]++;
-
- for (int s = 20; s <= 23; s++) {
- if (_scriptflag[s][0] == 1) {
- _scriptflag[s][0] = 2;
- }
- }
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- _objmapf[_curmap][lx][ly - 1] = 1;
-
- if (_objectInfo[o][4] == 1)
- _objectMap[lx][ly - 1] = 3;
-
- eventText("Found Key");
- addFloatIcon(16, lx * 16, (ly - 1) * 16);
- } else {
- if (config.effects) {
- int snd = playSound(_sfx[kSndChest]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- eventText("Cannot Carry Any More Keys");
- }
- }
-
- if (oscript == kScriptBlueFlask && _player.inventory[kInvDoubleFlask] < 9) {
- _player.inventory[kInvDoubleFlask]++;
- addFloatIcon(12, lx * 16, (ly - 1) * 16);
-
- _objmapf[_curmap][lx][ly - 1] = 1;
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- if (_objectInfo[o][4] == 1)
- _objectMap[lx][ly - 1] = 3;
-
- eventText("Found Mega Flask!");
- _itemticks = _ticks + 215;
- return;
- }
-
- if (oscript == kScriptBlueFlask && _player.inventory[kInvDoubleFlask] == 9) {
- if (config.effects) {
- int snd = playSound(_sfx[kSndChest]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- eventText("Cannot Carry any more Mega Flasks!");
- _itemticks = _ticks + 215;
- return;
- }
-
- if (oscript == kScriptBlueFlaskChest && _player.inventory[kInvDoubleFlask] < 9) {
- _player.inventory[kInvDoubleFlask]++;
- addFloatIcon(12, lx * 16, (ly - 1) * 16);
-
- _objmapf[_curmap][lx][ly - 1] = 1;
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- if (_objectInfo[o][4] == 1)
- _objectMap[lx][ly - 1] = 3;
-
- eventText("Found Mega Flask!");
- _itemticks = _ticks + 215;
- return;
- }
-
- if (oscript == kScriptBlueFlaskChest && _player.inventory[kInvDoubleFlask] == 9) {
- if (config.effects) {
- int snd = playSound(_sfx[kSndChest]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- eventText("Cannot Carry any more Mega Flasks!");
- _itemticks = _ticks + 215;
- return;
- }
-
- if (oscript == kScriptLightningChest && _player.inventory[kInvShock] < 9) {
- _player.inventory[kInvShock]++;
- addFloatIcon(17, lx * 16, (ly - 1) * 16);
-
- _objmapf[_curmap][lx][ly - 1] = 1;
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- if (_objectInfo[o][4] == 1)
- _objectMap[lx][ly - 1] = 3;
-
- eventText("Found Lightning Bomb!");
- _itemticks = _ticks + 215;
- return;
- }
-
- if (oscript == kScriptLightningChest && _player.inventory[kInvShock] == 9) {
- if (config.effects) {
- int snd = playSound(_sfx[kSndChest]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- eventText("Cannot Carry any more Lightning Bombs!");
- _itemticks = _ticks + 215;
- return;
- }
-
- if (oscript == kScriptArmourChest && _player.armour == 1) {
- _player.armour = 2;
-
- addFloatIcon(5, lx * 16, (ly - 1) * 16);
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- if (_objectInfo[o][4] == 1)
- _objectMap[lx][ly - 1] = 3;
-
- eventText("Found the Fidelis Mail!");
- _itemticks = _ticks + 215;
- return;
- }
-
- if (oscript == kScriptLever) {
- if (_curmap == 58 && _scriptflag[kScriptLever][0] == 0) {
- _scriptflag[kScriptLever][0] = 1;
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndLever]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- } else if (_curmap == 58 && _scriptflag[kScriptLever][0] > 0) {
- if (config.effects) {
- int snd = playSound(_sfx[kSndDoor]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- eventText("It's stuck!");
- }
-
- if (_curmap == 54 && _scriptflag[kScriptLever][0] == 1) {
- if (config.effects) {
- int snd = playSound(_sfx[kSndLever]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- _scriptflag[kScriptLever][0] = 2;
- } else if (_curmap == 54 && _scriptflag[kScriptLever][0] > 1) {
- if (config.effects) {
- int snd = playSound(_sfx[kSndDoor]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- eventText("It's stuck!");
- }
-
- }
-
- if (oscript == kScriptGetSword3 && _player.sword < 3) {
- _player.sword = 3;
-
- addFloatIcon(18, lx * 16, (ly - 1) * 16);
-
- _itemticks = _ticks + 215;
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- if (_objectInfo[o][4] == 1)
- _objectMap[lx][ly - 1] = 3;
- eventText("Found the Blood Sword!");
- _objmapf[4][1][2] = 1;
- return;
- }
-
- if (oscript == kScriptShield3 && _player.shield < 3) {
- _player.shield = 3;
- addFloatIcon(19, lx * 16, (ly - 1) * 16);
- _itemticks = _ticks + 215;
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- if (_objectInfo[o][4] == 1)
- _objectMap[lx][ly - 1] = 3;
- eventText("Found the Entropy Shield!");
- _objmapf[4][1][2] = 1;
- return;
- }
-
- if (oscript == kScriptArmour3 && _player.armour < 3) {
- _player.armour = 3;
- addFloatIcon(20, lx * 16, (ly - 1) * 16);
- _itemticks = _ticks + 215;
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- if (_objectInfo[o][4] == 1)
- _objectMap[lx][ly - 1] = 3;
- eventText("Found the Rubyscale Armour!");
- _objmapf[4][1][2] = 1;
- return;
- }
-
- }
- }
- }
-
- attacking = true;
- _player.attackframe = 0;
- movingup = false;
- movingdown = false;
- movingleft = false;
- movingright = false;
-
- for (int i = 0; i <= 15; i++) {
- for (int a = 0; a <= 3; a++) {
- _playerattackofs[a][i][2] = 0;
- }
- }
-}
-
-void GriffonEngine::castSpell(int spellnum, float homex, float homey, float enemyx, float enemyy, int damagewho) {
- // spellnum 7 = sprite 6 spitfire
-
- for (int i = 0; i < kMaxSpell; i++) {
- if (ABS(spellinfo[i].frame) < kEpsilon) {
- spellinfo[i].homex = homex;
- spellinfo[i].homey = homey;
- spellinfo[i].enemyx = enemyx;
- spellinfo[i].enemyy = enemyy;
- spellinfo[i].spellnum = spellnum;
- int dw = 0;
- int npc = 0;
- if (damagewho > 0) {
- dw = 1;
- npc = damagewho;
- }
-
- spellinfo[i].damagewho = dw;
- spellinfo[i].npc = npc;
-
- spellinfo[i].frame = 32.0f;
- if (damagewho == 0) {
- spellinfo[i].strength = _player.spellstrength / 100;
- if (ABS(_player.spellstrength - 100) < kEpsilon)
- spellinfo[i].strength = 1.5f;
- }
-
- // set earthslide vars
- if (spellnum == 2) {
- for (int f = 0; f <= 8; f++) {
- spellinfo[i].rocky[f] = 0;
- spellinfo[i].rockimg[f] = (int)(RND() * 4);
- spellinfo[i].rockdeflect[f] = ((int)(RND() * 128) - 64) * 1.5;
- }
- }
-
- // set fire vars
- if (spellnum == 3) {
- for (int f = 0; f <= 4; f++) {
- spellinfo[i].legalive[f] = 32;
- }
- }
-
-
- // room fireball vars
- if (spellnum == 6) {
- int nballs = 0;
- for (int x = 0; x <= 19; x++) {
- for (int y = 0; y <= 14; y++) {
- if ((_objectMap[x][y] == 1 || _objectMap[x][y] == 2) && nballs < 5 && (int)(RND() * 4) == 0) {
- int ax = x * 16;
- int ay = y * 16;
-
- spellinfo[i].fireballs[nballs][0] = ax;
- spellinfo[i].fireballs[nballs][1] = ay;
- spellinfo[i].fireballs[nballs][2] = 0;
- spellinfo[i].fireballs[nballs][3] = 0;
-
- spellinfo[i].ballon[nballs] = 1;
- nballs = nballs + 1;
- }
- }
- }
- spellinfo[i].nfballs = nballs;
- }
-
- if (config.effects) {
- if (spellnum == 1) {
- int snd = playSound(_sfx[kSndThrow]);
- setChannelVolume(snd, config.effectsvol);
- } else if (spellnum == 5) {
- int snd = playSound(_sfx[kSndCrystal]);
- setChannelVolume(snd, config.effectsvol);
- } else if (spellnum == 8 || spellnum == 9) {
- int snd = playSound(_sfx[kSndLightning]);
- setChannelVolume(snd, config.effectsvol);
- }
- }
-
- return;
- }
- }
-}
-
-void GriffonEngine::checkHit() {
- if (attacking) {
- for (int i = 1; i <= _lastnpc; i++) {
- if (_npcinfo[i].hp > 0 && _npcinfo[i].pause < _ticks && (int)(RND() * 2) == 0) {
- float npx = _npcinfo[i].x;
- float npy = _npcinfo[i].y;
-
- float xdif = _player.px - npx;
- float ydif = _player.py - npy;
-
- float ps = _player.sword;
- if (ps > 1)
- ps = ps * 0.75;
- float damage = (float)_player.sworddamage * (1.0 + RND() * 1.0) * _player.attackstrength / 100.0 * ps;
-
- if (_console->_godMode)
- damage = 1000;
-
- if (ABS(_player.attackstrength - 100) < kEpsilon)
- damage *= 1.5;
-
- bool hit = false;
- if (_player.walkdir == 0) {
- if (abs(xdif) <= 8 && ydif >= 0 && ydif < 8)
- hit = true;
- } else if (_player.walkdir == 1) {
- if (abs(xdif) <= 8 && ydif <= 0 && ydif > -8)
- hit = true;
- } else if (_player.walkdir == 2) {
- if (abs(ydif) <= 8 && xdif >= -8 && xdif < 8)
- hit = true;
- } else if (_player.walkdir == 3) {
- if (abs(ydif) <= 8 && xdif <= 8 && xdif > -8)
- hit = true;
- }
-
- if (hit) {
- if (config.effects) {
- int snd = playSound(_sfx[kSndSwordHit]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- damageNPC(i, damage, 0);
- }
- }
- }
- }
-}
-
void GriffonEngine::checkInputs() {
int ntickdelay = 175;
@@ -1397,479 +860,6 @@ void GriffonEngine::configMenu() {
cloudimg->setAlpha(64, true);
}
-void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
- char line[256];
- int fcol;
-
- if (damage == 0) {
- strcpy(line, "miss!");
- fcol = 2;
- } else {
- int ratio = 0;
- int heal = 0;
- if (damage < 0)
- heal = 1;
- damage = abs(damage);
-
- if (heal == 0) {
- if (damage > _npcinfo[npcnum].hp) {
- ratio = (damage - _npcinfo[npcnum].hp) * 100 / damage;
- damage = _npcinfo[npcnum].hp;
- }
-
- _npcinfo[npcnum].hp -= damage;
- if (_npcinfo[npcnum].hp < 0)
- _npcinfo[npcnum].hp = 0;
-
- sprintf(line, "-%i", damage);
- fcol = 1;
- } else {
- _npcinfo[npcnum].hp += damage;
- if (_npcinfo[npcnum].hp > _npcinfo[npcnum].maxhp)
- _npcinfo[npcnum].hp = _npcinfo[npcnum].maxhp;
-
- sprintf(line, "+%i", damage);
- fcol = 5;
- }
-
- _npcinfo[npcnum].pause = _ticks + 900;
-
- if (spell == 0)
- _player.attackstrength = ratio;
- }
-
- addFloatText(line, _npcinfo[npcnum].x + 12 - 4 * strlen(line), _npcinfo[npcnum].y + 16, fcol);
-
- if (_npcinfo[npcnum].spriteset == 12)
- castSpell(9, _npcinfo[npcnum].x, _npcinfo[npcnum].y, _player.px, _player.py, npcnum);
-
- // if enemy is killed
- if (_npcinfo[npcnum].hp == 0) {
- _player.exp = _player.exp + _npcinfo[npcnum].maxhp;
-
- if (_npcinfo[npcnum].spriteset == 1 || _npcinfo[npcnum].spriteset == 7 || _npcinfo[npcnum].spriteset == 6) {
- int ff = (int)(RND() * _player.level * 3);
- if (ff == 0) {
- float npx = _npcinfo[npcnum].x + 12;
- float npy = _npcinfo[npcnum].y + 20;
-
- int lx = (int)npx / 16;
- int ly = (int)npy / 16;
-
- if (_objectMap[lx][ly] == -1)
- _objectMap[lx][ly] = 4;
- }
- }
-
- if (_npcinfo[npcnum].spriteset == 2 || _npcinfo[npcnum].spriteset == 9 || _npcinfo[npcnum].spriteset == 4 || _npcinfo[npcnum].spriteset == 5) {
- int ff = (int)(RND() * _player.level);
- if (ff == 0) {
- float npx = _npcinfo[npcnum].x + 12;
- float npy = _npcinfo[npcnum].y + 20;
-
- int lx = (int)npx / 16;
- int ly = (int)npy / 16;
-
- if (_objectMap[lx][ly] == -1)
- _objectMap[lx][ly] = 12;
- }
- }
-
- if (_npcinfo[npcnum].spriteset == 9 || _npcinfo[npcnum].spriteset == 10 || _npcinfo[npcnum].spriteset == 5) {
- int ff = (int)(RND() * _player.level * 2);
- if (ff == 0) {
- float npx = _npcinfo[npcnum].x + 12;
- float npy = _npcinfo[npcnum].y + 20;
-
- int lx = (int)npx / 16;
- int ly = (int)npy / 16;
-
- if (_objectMap[lx][ly] == -1)
- _objectMap[lx][ly] = 13;
- }
- }
-
- // academy master key chest script
- if (_npcinfo[npcnum].script == kScriptMasterKey) {
- bool alive = false;
- for (int i = 1; i <= _lastnpc; i++) {
- if (_npcinfo[i].hp > 0)
- alive = true;
- }
-
- if (!alive) {
- int cx = 9;
- int cy = 7;
-
- _objectMap[cx][cy] = 5;
-
- rcDest.left = cx * 8;
- rcDest.top = cy * 8;
- rcDest.setWidth(8);
- rcDest.setHeight(8);
-
- float npx = _player.px + 12;
- float npy = _player.py + 20;
-
- int lx = (int)npx / 16;
- int ly = (int)npy / 16;
-
- if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
- _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- _scriptflag[kScriptMasterKey][0] = 1;
- }
- }
-
- // academy crystal chest script
- if (_npcinfo[npcnum].script == kScriptFindCtystal) {
- bool alive = false;
- for (int i = 1; i <= _lastnpc; i++) {
- if (_npcinfo[i].hp > 0)
- alive = true;
- }
-
- if (!alive) {
- int cx = 9;
- int cy = 7;
-
- _objectMap[cx][cy] = 6;
-
- rcDest.left = cx * 8;
- rcDest.top = cy * 8;
- rcDest.setWidth(8);
- rcDest.setHeight(8);
-
- float npx = _player.px + 12;
- float npy = _player.py + 20;
-
- int lx = (int)npx / 16;
- int ly = (int)npy / 16;
-
- if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
- _scriptflag[kScriptFindCtystal][0] = 1;
- _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- }
- }
-
- // tower shield chest script
- if (_npcinfo[npcnum].script == kScriptFindShield && _scriptflag[kScriptFindShield][0] == 0) {
- _triggerloc[9][7] = 5004;
-
- int curtile = 40;
- int curtilel = 0;
- int curtilex = curtile % 20;
- int curtiley = (curtile - curtilex) / 20;
-
- int l = 0; // ?? not defined in original code
- _tileinfo[l][9][7][0] = curtile + 1;
- _tileinfo[l][9][7][1] = 0;
-
- rcSrc.left = curtilex * 16;
- rcSrc.top = curtiley * 16;
- rcSrc.setWidth(16);
- rcSrc.setHeight(16);
-
- rcDest.left = 9 * 16;
- rcDest.top = 7 * 16;
- rcDest.setWidth(16);
- rcDest.setHeight(16);
-
- _tiles[curtilel]->blit(*_mapbg, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- }
-
- // firehydra sword chest
- if (_npcinfo[npcnum].script == kScriptFindSword) {
- bool alive = false;
- for (int i = 1; i <= _lastnpc; i++) {
- if (_npcinfo[i].hp > 0)
- alive = true;
- }
-
- if (!alive) {
- int cx = 9;
- int cy = 6;
-
- _objectMap[cx][cy] = 9;
-
- rcDest.left = cx * 8;
- rcDest.top = cy * 8;
- rcDest.setWidth(8);
- rcDest.setHeight(8);
-
- float npx = _player.px + 12;
- float npy = _player.py + 20;
-
- int lx = (int)npx / 16;
- int ly = (int)npy / 16;
-
- if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
- _scriptflag[kScriptFindSword][0] = 1;
- _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- }
-
- }
-
- // gardens master key script
- if (_npcinfo[npcnum].script == kScriptGardenMasterKey && _scriptflag[kScriptKeyChest][0] == 0) {
- bool alive = false;
- for (int i = 1; i <= _lastnpc; i++) {
- if (_npcinfo[i].hp > 0)
- alive = true;
- }
-
- if (!alive) {
- int cx = 13;
- int cy = 7;
-
- _objectMap[cx][cy] = 5;
-
- rcDest.left = cx * 8;
- rcDest.top = cy * 8;
- rcDest.setWidth(8);
- rcDest.setHeight(8);
-
- float npx = _player.px + 12;
- float npy = _player.py + 20;
-
- int lx = (int)npx / 16;
- int ly = (int)npy / 16;
-
- if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
- _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- _scriptflag[kScriptGardenMasterKey][0] = 1;
- }
- }
-
- // regular key chest 1
- for (int s = 20; s <= 23; s++) {
- if (_npcinfo[npcnum].script == s && _scriptflag[s][0] < 2) {
- bool alive = false;
- for (int i = 1; i <= _lastnpc; i++) {
- if (_npcinfo[i].hp > 0)
- alive = true;
- }
-
- if (!alive) {
- int cx = 9;
- int cy = 7;
-
- _objectMap[cx][cy] = 11;
-
- rcDest.left = cx * 8;
- rcDest.top = cy * 8;
- rcDest.setWidth(8);
- rcDest.setHeight(8);
-
- float npx = _player.px + 12;
- float npy = _player.py + 20;
-
- int lx = (int)npx / 16;
- int ly = (int)npy / 16;
-
- if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
- _scriptflag[s][0] = 1;
- _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- }
- }
- }
-
- // pickup lightning bomb
- if (_npcinfo[npcnum].script == kScriptLightningBomb && (_curmap == 41 && _scriptflag[kScriptLightningBomb][1] == 0)) {
- bool alive = false;
- for (int i = 1; i <= _lastnpc; i++) {
- if (_npcinfo[i].hp > 0)
- alive = true;
- }
-
- if (!alive) {
- int cx = 9;
- int cy = 7;
-
- _objectMap[cx][cy] = 13;
-
- rcDest.left = cx * 8;
- rcDest.top = cy * 8;
- rcDest.setWidth(8);
- rcDest.setHeight(8);
-
- float npx = _player.px + 12;
- float npy = _player.py + 20;
-
- int lx = (int)npx / 16;
- int ly = (int)npy / 16;
-
- if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
- }
- }
-
- // citadel armour chest
- if (_npcinfo[npcnum].script == kScriptArmourChest) {
- bool alive = false;
- for (int i = 1; i <= _lastnpc; i++) {
- if (_npcinfo[i].hp > 0)
- alive = true;
- }
-
- if (!alive) {
- int cx = 8;
- int cy = 7;
-
- _objectMap[cx][cy] = 16;
-
- rcDest.left = cx * 8;
- rcDest.top = cy * 8;
- rcDest.setWidth(8);
- rcDest.setHeight(8);
-
- float npx = _player.px + 12;
- float npy = _player.py + 20;
-
- int lx = (int)npx / 16;
- int ly = (int)npy / 16;
-
- if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
- _scriptflag[kScriptArmourChest][0] = 1;
- _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- }
- }
-
- // citadel master key script
- if (_npcinfo[npcnum].script == kScriptCitadelMasterKey && _scriptflag[kScriptCitadelMasterKey][0] == 0) {
- bool alive = false;
- for (int i = 1; i <= _lastnpc; i++) {
- if (_npcinfo[i].hp > 0)
- alive = true;
- }
-
- if (!alive) {
- int cx = 11;
- int cy = 10;
-
- _objectMap[cx][cy] = 5;
-
- rcDest.left = cx * 8;
- rcDest.top = cy * 8;
- rcDest.setWidth(8);
- rcDest.setHeight(8);
-
- float npx = _player.px + 12;
- float npy = _player.py + 20;
-
- int lx = (int)npx / 16;
- int ly = (int)npy / 16;
-
- if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
- _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- _scriptflag[kScriptCitadelMasterKey][0] = 1;
- }
- }
-
- // max ups
- if (_npcinfo[npcnum].script == kScriptGetSword3 && _scriptflag[kScriptGetSword3][0] == 0) {
- bool alive = false;
- for (int i = 1; i <= _lastnpc; i++) {
- if (_npcinfo[i].hp > 0)
- alive = true;
- }
-
- if (!alive) {
- int cx = 6;
- int cy = 8;
-
- _objectMap[cx][cy] = 18;
-
- rcDest.left = cx * 8;
- rcDest.top = cy * 8;
- rcDest.setWidth(8);
- rcDest.setHeight(8);
-
- float npx = _player.px + 12;
- float npy = _player.py + 20;
-
- int lx = (int)npx / 16;
- int ly = (int)npy / 16;
-
- if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
- _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- _scriptflag[kScriptGetSword3][0] = 1;
-
- cx = 9;
- cy = 8;
-
- _objectMap[cx][cy] = 19;
-
- rcDest.left = cx * 8;
- rcDest.top = cy * 8;
- rcDest.setWidth(8);
- rcDest.setHeight(8);
-
- npx = _player.px + 12;
- npy = _player.py + 20;
-
- lx = (int)npx / 16;
- ly = (int)npy / 16;
-
- if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
- _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
-
- _scriptflag[kScriptShield3][0] = 1;
-
- cx = 12;
- cy = 8;
-
- _objectMap[cx][cy] = 20;
-
- rcDest.left = cx * 8;
- rcDest.top = cy * 8;
- rcDest.setWidth(8);
- rcDest.setHeight(8);
-
- npx = _player.px + 12;
- npy = _player.py + 20;
-
- lx = (int)npx / 16;
- ly = (int)npy / 16;
-
- if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
- _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- _scriptflag[kScriptArmour3][0] = 1;
- }
- }
-
- if (_npcinfo[npcnum].script == kScriptEndOfGame)
- endOfGame();
- }
-}
-
-void GriffonEngine::damagePlayer(int damage) {
- char line[256];
-
- if (!_console->_godMode)
- _player.hp -= damage;
-
- if (_player.hp < 0)
- _player.hp = 0;
-
- sprintf(line, "-%i", damage);
- if (damage == 0)
- strcpy(line, "miss!");
-
- addFloatText(line, _player.px + 12 - 4 * strlen(line), _player.py + 16, 4);
-
- _player.pause = _ticks + 1000;
-}
-
void GriffonEngine::drawAnims(int Layer) {
for (int sx = 0; sx <= 19; sx++) {
for (int sy = 0; sy <= 14; sy++) {
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 10e5585..d0e8065 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -90,6 +90,29 @@ enum {
kSndBeep
};
+// in game scripts
+enum {
+ kScriptMasterKey = 2, // find master key
+ kScriptFindCtystal = 3, // find crystal
+ kScriptFindShield = 4, // find shield - obj 8
+ kScriptFindSword = 5, // find sword - obj 9
+ kScriptKeyChest = 6, // regular key chest
+ kScriptBlueFlask = 7, // blue flask
+ kScriptGardenMasterKey = 8, // garden's master key
+ kScriptLightningBomb = 9, // lightning bomb
+ kScriptBlueFlaskChest = 10, // blue flask chest
+ kScriptLightningChest = 11, // lightning chest
+ kScriptArmourChest = 12, // armour chest
+ kScriptCitadelMasterKey = 13, // citadel master key
+ kScriptEndOfGame = 14, // end of game
+ kScriptGetSword3 = 15, // get sword3
+ kScriptShield3 = 16, // shield3
+ kScriptArmour3 = 17, // armour3
+ kScriptKeyChest1 = 20, // key chest 1
+ kScriptLever = 60 // lever
+};
+
+
#define kEpsilon 0.001
struct Player {
@@ -255,18 +278,21 @@ private:
Console *_console;
private:
- float RND();
- void addFloatIcon(int ico, float xloc, float yloc);
- void addFloatText(const char *stri, float xloc, float yloc, int col);
+ // combat.cpp
void attack();
void castSpell(int spellnum, float homex, float homey, float enemyx, float enemyy, int damagewho);
void checkHit();
+ void damageNPC(int npcnum, int damage, int spell);
+ void damagePlayer(int damage);
+
+ float RND();
+
+ void addFloatIcon(int ico, float xloc, float yloc);
+ void addFloatText(const char *stri, float xloc, float yloc, int col);
void checkInputs();
void checkTrigger();
void configMenu();
- void damageNPC(int npcnum, int damage, int spell);
- void damagePlayer(int damage);
void drawAnims(int Layer);
void drawHud();
void drawNPCs(int mode);
diff --git a/engines/griffon/module.mk b/engines/griffon/module.mk
index 5fa2a80..bd64e73 100644
--- a/engines/griffon/module.mk
+++ b/engines/griffon/module.mk
@@ -1,6 +1,7 @@
MODULE := engines/griffon
MODULE_OBJS := \
+ combat.o \
config.o \
console.o \
engine.o \
Commit: 49e5040606c9dde44aa7f1dee8a3ebf4bb469c08
https://github.com/scummvm/scummvm/commit/49e5040606c9dde44aa7f1dee8a3ebf4bb469c08
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Moved functions to cutscenes.cpp
Changed paths:
A engines/griffon/cutscenes.cpp
engines/griffon/engine.cpp
engines/griffon/griffon.h
engines/griffon/module.mk
diff --git a/engines/griffon/cutscenes.cpp b/engines/griffon/cutscenes.cpp
new file mode 100644
index 0000000..a3df23d
--- /dev/null
+++ b/engines/griffon/cutscenes.cpp
@@ -0,0 +1,557 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Originally written by Syn9 in FreeBASIC with SDL
+ * http://syn9.thehideoutgames.com/index_backup.php
+ *
+ * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
+ * http://github.com/dmitrysmagin/griffon_legend
+ *
+ *
+ * Programming/Graphics: Daniel "Syn9" Kennedy
+ * Music/Sound effects: David Turner
+ *
+ * Beta testing and gameplay design help:
+ * Deleter, Cha0s, Aether Fox, and Kiz
+ *
+ */
+
+#include "common/system.h"
+
+#include "griffon/griffon.h"
+#include "griffon/config.h"
+
+namespace Griffon {
+
+const char *story[48] = {
+ "The Griffon Legend",
+ "http://syn9.thehideoutgames.com/",
+ "",
+ "Programming/Graphics: Daniel Kennedy",
+ "Music/Sound effects: David Turner",
+ "",
+ "Porting to GCW-Zero: Dmitry Smagin",
+ "",
+ "",
+ "Story",
+ "Ever since I was a child",
+ "I remember being told the",
+ "Legend of the Griffon Knights,",
+ "who rid the world of the",
+ "Dragon Empire. These great",
+ "heroes inspired us to become",
+ "knights as well.",
+ " ",
+ "Now, 500 years after the war",
+ "ended, the Dragons have",
+ "returned. Cities are falling",
+ "from the lack of knights to",
+ "protect them.",
+ " ",
+ "We never saw it coming.",
+ " ",
+ "And now, here I am, making",
+ "my way into the lower town",
+ "of Fidelis, a small city on",
+ "the main continent. The rest",
+ "of my men have died over",
+ "the last couple days from",
+ "aerial attacks.",
+ " ",
+ "We believed we could find",
+ "shelter here, only to find",
+ "every last griffon dead,",
+ "the town burned to the ground,",
+ "and transformed into a garrison",
+ "for the Dragon forces.",
+ " ",
+ "In these dark times, I try to",
+ "draw strength from the stories",
+ "of those knights that risked",
+ "everything to protect their homeland,",
+ " ",
+ "and hope that I can die",
+ "with that honor as well."
+};
+
+const char *story2[27] = {
+ "After the fall of Margrave Gradius,",
+ "All the dragons, struck with panic,",
+ "evacuated the city immediately.",
+ " ",
+ "It\'s funny how without a leader",
+ "everyone is so weak.",
+ " ",
+ " ",
+ "But yet another leader will rise,",
+ "and another city will fall.",
+ " ",
+ " ",
+ "I should return home to Asherton",
+ "It\'s time to leave this place",
+ "and cleanse this blood stained",
+ "life of mine.",
+ " ",
+ "No one should have to see as much",
+ "death as I have.",
+ " ",
+ " ",
+ "Before, I said that I wanted",
+ "to die an honorable death.",
+ " ",
+ "Now I say that I have lived an",
+ "honorable life,",
+ "and I am free to die as I please."
+};
+
+void GriffonEngine::showLogos() {
+ float y;
+ int _ticks1;
+
+ _ticks = g_system->getMillis();
+ _ticks1 = _ticks;
+
+ y = 0.0;
+
+ do {
+ y = 255.0;
+ if (_ticks < _ticks1 + 1000) {
+ y = 255.0 * ((float)(_ticks - _ticks1) / 1000.0);
+ if (y < 0.0)
+ y = 0.0;
+ if (y > 255.0)
+ y = 255.0;
+ }
+
+ if (_ticks > _ticks1 + 3000) {
+ y = 255.0 - 255.0 * ((float)(_ticks - _ticks1 - 3000.0) / 1000.0);
+ if (y < 0.0)
+ y = 0.0;
+ if (y > 255.0)
+ y = 255.0;
+ }
+
+ _videobuffer->fillRect(Common::Rect(0, 0, 320, 240), 0);
+ _logosimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, nullptr, TS_ARGB((int)y, (int)y, (int)y, (int)y));
+
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ g_system->updateScreen();
+
+ g_system->getEventManager()->pollEvent(_event);
+
+ if (_event.type == Common::EVENT_QUIT)
+ _shouldQuit = true;
+
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
+
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24;
+
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
+ }
+
+ g_system->delayMillis(10);
+ if (_ticks > _ticks1 + 4000)
+ break;
+ } while (!_shouldQuit);
+}
+
+void GriffonEngine::intro() {
+ float xofs = 0;
+ float ld = 0, add;
+ int cnt = 0;
+
+ _videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
+ _videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
+
+ _ticks = g_system->getMillis();
+
+ _videobuffer->blit(*_videobuffer3);
+ _videobuffer->blit(*_videobuffer2);
+
+ _fpsr = 0.0;
+ int y = 140;
+
+ if (config.music) {
+ haltSoundChannel(-1);
+ _musicchannel = playSound(_mendofgame, true);
+ setChannelVolume(_musicchannel, 0);
+ }
+
+ _secsingame = 0;
+ _secstart = 0;
+
+ bool ldstop = false;
+
+ do {
+ Common::Rect rc;
+
+ ld += 4 * _fpsr;
+ if ((int)ld > config.musicvol)
+ ld = config.musicvol;
+ if (!ldstop) {
+ setChannelVolume(_musicchannel, (int)ld);
+ if ((int)ld == config.musicvol)
+ ldstop = true;
+ }
+
+ rc.left = -xofs;
+ rc.top = 0;
+
+ _titleimg->blit(*_videobuffer, rc.left, rc.top);
+
+ rc.left = -xofs + 320;
+ rc.top = 0;
+
+ _titleimg->blit(*_videobuffer, rc.left, rc.top);
+
+ if (++cnt >= 6) {
+ cnt = 0;
+ y--;
+ }
+
+ for (int i = 0; i <= 37; i++) {
+ int yy, x;
+
+ yy = y + i * 10;
+ if (yy > -8 && yy < 240) {
+ x = 160 - strlen(story[i]) * 4;
+ drawString(_videobuffer, story[i], x, yy, 4);
+ }
+
+ if (yy < 10 && i == 47)
+ return;
+ }
+
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ g_system->updateScreen();
+
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
+
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24.0;
+
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
+ }
+
+ add = 0.5 * _fpsr;
+ if (add > 1)
+ add = 1;
+ xofs += add;
+ if (xofs >= 320)
+ xofs = xofs - 320;
+
+ g_system->getEventManager()->pollEvent(_event);
+
+ if (_event.type == Common::EVENT_KEYDOWN)
+ cnt = 6;
+ if (_event.kbd.keycode == Common::KEYCODE_ESCAPE)
+ return;
+
+ if (_event.type == Common::EVENT_QUIT)
+ _shouldQuit = true;
+
+ g_system->delayMillis(10);
+ } while (!_shouldQuit);
+}
+
+void GriffonEngine::endOfGame() {
+ float xofs = 0;
+ _ticks = g_system->getMillis();
+
+ float spd = 0.2f;
+
+ if (config.music) {
+ haltSoundChannel(-1);
+ _musicchannel = playSound(_mendofgame, true);
+ setChannelVolume(_musicchannel, 0);
+ }
+
+ int _ticks1 = _ticks;
+ int ya = 0;
+
+ _videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
+ _videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
+ _videobuffer2->copyRectToSurface(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+
+ float ld = 0;
+ bool ldstop = false; // CHECKME: Check if actually used
+
+ do {
+ ld = ld + 4 * _fpsr;
+ if (ld > config.musicvol)
+ ld = config.musicvol;
+ if (!ldstop) {
+ setChannelVolume(_musicchannel, (int)ld);
+ if ((int)ld == config.musicvol)
+ ldstop = true;
+ }
+
+ ya = 0;
+ if (_ticks < _ticks1 + 1500) {
+ ya = (255 * (_ticks - _ticks1)) / 1500;
+ if (ya < 0)
+ ya = 0;
+ if (ya > 255)
+ ya = 255;
+ } else {
+ break;
+ }
+
+ _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
+
+ _videobuffer->setAlpha(ya);
+ _videobuffer3->copyRectToSurface(_videobuffer2->getPixels(), _videobuffer2->pitch, 0, 0, _videobuffer2->w, _videobuffer2->h);
+ _videobuffer3->copyRectToSurface(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+
+ g_system->copyRectToScreen(_videobuffer3->getPixels(), _videobuffer3->pitch, 0, 0, _videobuffer3->w, _videobuffer3->h);
+ g_system->updateScreen();
+
+ g_system->getEventManager()->pollEvent(_event);
+ g_system->delayMillis(10);
+
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
+
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24;
+
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
+ }
+ } while (1);
+
+ _ticks1 = _ticks;
+ ya = 0;
+ float y = 140;
+
+ do {
+ Common::Rect rc;
+
+ rc.left = -xofs;
+ rc.top = 0;
+
+ _titleimg->blit(*_videobuffer, rc.left, rc.top);
+
+ rc.left = -xofs + 320;
+ rc.top = 0;
+
+ _titleimg->blit(*_videobuffer, rc.left, rc.top);
+
+ y = y - spd * _fpsr;
+ for (int i = 0; i <= 26; i++) {
+ int yy = y + i * 10;
+ if (yy > -8 && yy < 240) {
+ int x = 160 - strlen(story2[i]) * 4;
+ drawString(_videobuffer, story2[i], x, yy, 4);
+ }
+
+ if (yy < 10 && i == 25)
+ break;
+ }
+
+ ya = 255;
+ if (_ticks < _ticks1 + 1000) {
+ ya = 255 * (_ticks - _ticks1) / 1000;
+ if (ya < 0)
+ ya = 0;
+ if (ya > 255)
+ ya = 255;
+ }
+
+ _videobuffer->setAlpha(ya);
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ g_system->updateScreen();
+
+ g_system->getEventManager()->pollEvent(_event);
+ g_system->delayMillis(10);
+
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
+
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24;
+
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
+ }
+
+ float add = 0.5 * _fpsr;
+ if (add > 1)
+ add = 1;
+ xofs = xofs + add;
+ if (xofs >= 320)
+ xofs = xofs - 320;
+
+ if (_event.type == Common::EVENT_KEYDOWN)
+ spd = 1.0f;
+ if (_event.type == Common::EVENT_KEYUP)
+ spd = 0.2f;
+
+ if (_event.kbd.keycode == Common::KEYCODE_ESCAPE)
+ break;
+ } while (1);
+
+
+ _ticks1 = _ticks;
+ int y1 = 0;
+
+ _videobuffer2->copyRectToSurface(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+
+ do {
+ if (_ticks < _ticks1 + 1500) {
+ y1 = 255 * (_ticks - _ticks1) / 1500;
+ if (y1 < 0)
+ y1 = 0;
+ if (y1 > 255)
+ y1 = 255;
+ else
+ break;
+ }
+
+ _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
+
+ _videobuffer->setAlpha(y1);
+ _videobuffer2->blit(*_videobuffer3);
+ _videobuffer->blit(*_videobuffer3);
+
+ g_system->copyRectToScreen(_videobuffer3->getPixels(), _videobuffer3->pitch, 0, 0, _videobuffer3->w, _videobuffer3->h);
+ g_system->updateScreen();
+
+ g_system->getEventManager()->pollEvent(_event);
+ g_system->delayMillis(10);
+
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
+
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24;
+
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
+ }
+ } while (1);
+
+
+ int keywait = 2000 + _ticks;
+
+ _ticks1 = _ticks;
+ y1 = 0;
+ do {
+
+ _videobuffer->copyRectToSurface(_theendimg->getPixels(), _theendimg->pitch, 0, 0, _theendimg->w, _theendimg->h);
+
+ y1 = 255;
+ if (_ticks < _ticks1 + 1000) {
+ y1 = 255 * (_ticks - _ticks1) / 1000;
+ if (y1 < 0)
+ y1 = 0;
+ if (y1 > 255)
+ y1 = 255;
+ }
+
+ _videobuffer->setAlpha(y1);
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ g_system->updateScreen();
+
+ g_system->getEventManager()->pollEvent(_event);
+ g_system->delayMillis(10);
+
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
+
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24;
+
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
+ }
+
+ g_system->getEventManager()->pollEvent(_event);
+
+ if (_event.type == Common::EVENT_KEYDOWN && keywait < _ticks)
+ break;
+
+ } while (1);
+
+ _videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
+ _videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
+
+ theEnd();
+
+}
+
+void GriffonEngine::theEnd() {
+ for (int i = 0; i < kMaxFloat; i++) {
+ _floattext[i][0] = 0;
+ _floaticon[i][0] = 0;
+ }
+
+ for (float y = 0; y < 100; y += _fpsr) {
+ _videobuffer->setAlpha((int)y);
+ _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ g_system->updateScreen();
+
+ g_system->getEventManager()->pollEvent(_event);
+ g_system->delayMillis(10);
+
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
+
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24.0;
+
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
+ }
+ }
+
+ title(0);
+}
+
+
+} // end of namespace Griffon
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index b32f890..4dfe724 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -93,87 +93,6 @@ const int elementmap[15][20] = {
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
};
-const char *story[48] = {
- "The Griffon Legend",
- "http://syn9.thehideoutgames.com/",
- "",
- "Programming/Graphics: Daniel Kennedy",
- "Music/Sound effects: David Turner",
- "",
- "Porting to GCW-Zero: Dmitry Smagin",
- "",
- "",
- "Story",
- "Ever since I was a child",
- "I remember being told the",
- "Legend of the Griffon Knights,",
- "who rid the world of the",
- "Dragon Empire. These great",
- "heroes inspired us to become",
- "knights as well.",
- " ",
- "Now, 500 years after the war",
- "ended, the Dragons have",
- "returned. Cities are falling",
- "from the lack of knights to",
- "protect them.",
- " ",
- "We never saw it coming.",
- " ",
- "And now, here I am, making",
- "my way into the lower town",
- "of Fidelis, a small city on",
- "the main continent. The rest",
- "of my men have died over",
- "the last couple days from",
- "aerial attacks.",
- " ",
- "We believed we could find",
- "shelter here, only to find",
- "every last griffon dead,",
- "the town burned to the ground,",
- "and transformed into a garrison",
- "for the Dragon forces.",
- " ",
- "In these dark times, I try to",
- "draw strength from the stories",
- "of those knights that risked",
- "everything to protect their homeland,",
- " ",
- "and hope that I can die",
- "with that honor as well."
-};
-
-const char *story2[27] = {
- "After the fall of Margrave Gradius,",
- "All the dragons, struck with panic,",
- "evacuated the city immediately.",
- " ",
- "It\'s funny how without a leader",
- "everyone is so weak.",
- " ",
- " ",
- "But yet another leader will rise,",
- "and another city will fall.",
- " ",
- " ",
- "I should return home to Asherton",
- "It\'s time to leave this place",
- "and cleanse this blood stained",
- "life of mine.",
- " ",
- "No one should have to see as much",
- "death as I have.",
- " ",
- " ",
- "Before, I said that I wanted",
- "to die an honorable death.",
- " ",
- "Now I say that I have lived an",
- "honorable life,",
- "and I am free to die as I please."
-};
-
// map in inventory menu
const int invmap[4][7][13] = {
// map 0
@@ -1968,244 +1887,6 @@ void GriffonEngine::drawView() {
g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
}
-void GriffonEngine::endOfGame() {
- float xofs = 0;
- _ticks = g_system->getMillis();
-
- float spd = 0.2f;
-
- if (config.music) {
- haltSoundChannel(-1);
- _musicchannel = playSound(_mendofgame, true);
- setChannelVolume(_musicchannel, 0);
- }
-
- int _ticks1 = _ticks;
- int ya = 0;
-
- _videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
- _videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
- _videobuffer2->copyRectToSurface(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
-
- float ld = 0;
- bool ldstop = false; // CHECKME: Check if actually used
-
- do {
- ld = ld + 4 * _fpsr;
- if (ld > config.musicvol)
- ld = config.musicvol;
- if (!ldstop) {
- setChannelVolume(_musicchannel, (int)ld);
- if ((int)ld == config.musicvol)
- ldstop = true;
- }
-
- ya = 0;
- if (_ticks < _ticks1 + 1500) {
- ya = (255 * (_ticks - _ticks1)) / 1500;
- if (ya < 0)
- ya = 0;
- if (ya > 255)
- ya = 255;
- } else {
- break;
- }
-
- _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
-
- _videobuffer->setAlpha(ya);
- _videobuffer3->copyRectToSurface(_videobuffer2->getPixels(), _videobuffer2->pitch, 0, 0, _videobuffer2->w, _videobuffer2->h);
- _videobuffer3->copyRectToSurface(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
-
- g_system->copyRectToScreen(_videobuffer3->getPixels(), _videobuffer3->pitch, 0, 0, _videobuffer3->w, _videobuffer3->h);
- g_system->updateScreen();
-
- g_system->getEventManager()->pollEvent(_event);
- g_system->delayMillis(10);
-
- _tickspassed = _ticks;
- _ticks = g_system->getMillis();
-
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24;
-
- _fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
- _fps = _fp;
- _fp = 0;
- }
- } while (1);
-
- _ticks1 = _ticks;
- ya = 0;
- float y = 140;
-
- do {
- Common::Rect rc;
-
- rc.left = -xofs;
- rc.top = 0;
-
- _titleimg->blit(*_videobuffer, rc.left, rc.top);
-
- rc.left = -xofs + 320;
- rc.top = 0;
-
- _titleimg->blit(*_videobuffer, rc.left, rc.top);
-
- y = y - spd * _fpsr;
- for (int i = 0; i <= 26; i++) {
- int yy = y + i * 10;
- if (yy > -8 && yy < 240) {
- int x = 160 - strlen(story2[i]) * 4;
- drawString(_videobuffer, story2[i], x, yy, 4);
- }
-
- if (yy < 10 && i == 25)
- break;
- }
-
- ya = 255;
- if (_ticks < _ticks1 + 1000) {
- ya = 255 * (_ticks - _ticks1) / 1000;
- if (ya < 0)
- ya = 0;
- if (ya > 255)
- ya = 255;
- }
-
- _videobuffer->setAlpha(ya);
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
- g_system->updateScreen();
-
- g_system->getEventManager()->pollEvent(_event);
- g_system->delayMillis(10);
-
- _tickspassed = _ticks;
- _ticks = g_system->getMillis();
-
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24;
-
- _fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
- _fps = _fp;
- _fp = 0;
- }
-
- float add = 0.5 * _fpsr;
- if (add > 1)
- add = 1;
- xofs = xofs + add;
- if (xofs >= 320)
- xofs = xofs - 320;
-
- if (_event.type == Common::EVENT_KEYDOWN)
- spd = 1.0f;
- if (_event.type == Common::EVENT_KEYUP)
- spd = 0.2f;
-
- if (_event.kbd.keycode == Common::KEYCODE_ESCAPE)
- break;
- } while (1);
-
-
- _ticks1 = _ticks;
- int y1 = 0;
-
- _videobuffer2->copyRectToSurface(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
-
- do {
- if (_ticks < _ticks1 + 1500) {
- y1 = 255 * (_ticks - _ticks1) / 1500;
- if (y1 < 0)
- y1 = 0;
- if (y1 > 255)
- y1 = 255;
- else
- break;
- }
-
- _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
-
- _videobuffer->setAlpha(y1);
- _videobuffer2->blit(*_videobuffer3);
- _videobuffer->blit(*_videobuffer3);
-
- g_system->copyRectToScreen(_videobuffer3->getPixels(), _videobuffer3->pitch, 0, 0, _videobuffer3->w, _videobuffer3->h);
- g_system->updateScreen();
-
- g_system->getEventManager()->pollEvent(_event);
- g_system->delayMillis(10);
-
- _tickspassed = _ticks;
- _ticks = g_system->getMillis();
-
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24;
-
- _fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
- _fps = _fp;
- _fp = 0;
- }
- } while (1);
-
-
- int keywait = 2000 + _ticks;
-
- _ticks1 = _ticks;
- y1 = 0;
- do {
-
- _videobuffer->copyRectToSurface(_theendimg->getPixels(), _theendimg->pitch, 0, 0, _theendimg->w, _theendimg->h);
-
- y1 = 255;
- if (_ticks < _ticks1 + 1000) {
- y1 = 255 * (_ticks - _ticks1) / 1000;
- if (y1 < 0)
- y1 = 0;
- if (y1 > 255)
- y1 = 255;
- }
-
- _videobuffer->setAlpha(y1);
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
- g_system->updateScreen();
-
- g_system->getEventManager()->pollEvent(_event);
- g_system->delayMillis(10);
-
- _tickspassed = _ticks;
- _ticks = g_system->getMillis();
-
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24;
-
- _fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
- _fps = _fp;
- _fp = 0;
- }
-
- g_system->getEventManager()->pollEvent(_event);
-
- if (_event.type == Common::EVENT_KEYDOWN && keywait < _ticks)
- break;
-
- } while (1);
-
- _videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
- _videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
-
- theEnd();
-
-}
-
void GriffonEngine::eventText(const char *stri) {
_videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
_videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
@@ -3344,108 +3025,7 @@ void GriffonEngine::loadMap(int mapnum) {
}
void GriffonEngine::newGame() {
- float xofs = 0;
- float ld = 0, add;
- int cnt = 0;
-
- _videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
- _videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
-
- _ticks = g_system->getMillis();
-
- _videobuffer->blit(*_videobuffer3);
- _videobuffer->blit(*_videobuffer2);
-
- _fpsr = 0.0;
- int y = 140;
-
- if (config.music) {
- haltSoundChannel(-1);
- _musicchannel = playSound(_mendofgame, true);
- setChannelVolume(_musicchannel, 0);
- }
-
- _secsingame = 0;
- _secstart = 0;
-
- bool ldstop = false;
-
- do {
- Common::Rect rc;
-
- ld += 4 * _fpsr;
- if ((int)ld > config.musicvol)
- ld = config.musicvol;
- if (!ldstop) {
- setChannelVolume(_musicchannel, (int)ld);
- if ((int)ld == config.musicvol)
- ldstop = true;
- }
-
- rc.left = -xofs;
- rc.top = 0;
-
- _titleimg->blit(*_videobuffer, rc.left, rc.top);
-
- rc.left = -xofs + 320;
- rc.top = 0;
-
- _titleimg->blit(*_videobuffer, rc.left, rc.top);
-
- if (++cnt >= 6) {
- cnt = 0;
- y--;
- }
-
- for (int i = 0; i <= 37; i++) {
- int yy, x;
-
- yy = y + i * 10;
- if (yy > -8 && yy < 240) {
- x = 160 - strlen(story[i]) * 4;
- drawString(_videobuffer, story[i], x, yy, 4);
- }
-
- if (yy < 10 && i == 47)
- goto __exit_do;
- }
-
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
- g_system->updateScreen();
-
- _tickspassed = _ticks;
- _ticks = g_system->getMillis();
-
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24.0;
-
- _fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
- _fps = _fp;
- _fp = 0;
- }
-
- add = 0.5 * _fpsr;
- if (add > 1)
- add = 1;
- xofs += add;
- if (xofs >= 320)
- xofs = xofs - 320;
-
- g_system->getEventManager()->pollEvent(_event);
-
- if (_event.type == Common::EVENT_KEYDOWN)
- cnt = 6;
- if (_event.kbd.keycode == Common::KEYCODE_ESCAPE)
- goto __exit_do;
-
- if (_event.type == Common::EVENT_QUIT)
- _shouldQuit = true;
-
- g_system->delayMillis(10);
- } while (!_shouldQuit);
-__exit_do:
+ intro();
if (_shouldQuit)
return;
@@ -3937,64 +3517,6 @@ void GriffonEngine::saveLoadNew() {
cloudimg->setAlpha(64, true);
}
-void GriffonEngine::showLogos() {
- float y;
- int _ticks1;
-
- _ticks = g_system->getMillis();
- _ticks1 = _ticks;
-
- y = 0.0;
-
- do {
- y = 255.0;
- if (_ticks < _ticks1 + 1000) {
- y = 255.0 * ((float)(_ticks - _ticks1) / 1000.0);
- if (y < 0.0)
- y = 0.0;
- if (y > 255.0)
- y = 255.0;
- }
-
- if (_ticks > _ticks1 + 3000) {
- y = 255.0 - 255.0 * ((float)(_ticks - _ticks1 - 3000.0) / 1000.0);
- if (y < 0.0)
- y = 0.0;
- if (y > 255.0)
- y = 255.0;
- }
-
- _videobuffer->fillRect(Common::Rect(0, 0, 320, 240), 0);
- _logosimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, nullptr, TS_ARGB((int)y, (int)y, (int)y, (int)y));
-
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
- g_system->updateScreen();
-
- g_system->getEventManager()->pollEvent(_event);
-
- if (_event.type == Common::EVENT_QUIT)
- _shouldQuit = true;
-
- _tickspassed = _ticks;
- _ticks = g_system->getMillis();
-
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24;
-
- _fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
- _fps = _fp;
- _fp = 0;
- }
-
- g_system->delayMillis(10);
- if (_ticks > _ticks1 + 4000)
- break;
- } while (!_shouldQuit);
-}
-
-
void GriffonEngine::swash() {
float y;
@@ -4080,38 +3602,6 @@ void GriffonEngine::swash() {
_videobuffer->setAlpha(255);
}
-void GriffonEngine::theEnd() {
- for (int i = 0; i < kMaxFloat; i++) {
- _floattext[i][0] = 0;
- _floaticon[i][0] = 0;
- }
-
- for (float y = 0; y < 100; y += _fpsr) {
- _videobuffer->setAlpha((int)y);
- _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
- g_system->updateScreen();
-
- g_system->getEventManager()->pollEvent(_event);
- g_system->delayMillis(10);
-
- _tickspassed = _ticks;
- _ticks = g_system->getMillis();
-
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24.0;
-
- _fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
- _fps = _fp;
- _fp = 0;
- }
- }
-
- title(0);
-}
-
void GriffonEngine::title(int mode) {
float xofs = 0;
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index d0e8065..411a278 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -286,6 +286,12 @@ private:
void damageNPC(int npcnum, int damage, int spell);
void damagePlayer(int damage);
+ // cutscenes.cpp
+ void showLogos();
+ void intro();
+ void endOfGame();
+ void theEnd();
+
float RND();
void addFloatIcon(int ico, float xloc, float yloc);
@@ -299,7 +305,6 @@ private:
void drawOver(int modx, int mody);
void drawPlayer();
void drawView();
- void endOfGame();
void eventText(const char *stri);
void handleWalking();
void loadMap(int mapnum);
@@ -307,9 +312,7 @@ private:
void mainLoop();
void processTrigger(int trignum);
void saveLoadNew();
- void showLogos();
void swash();
- void theEnd();
void title(int mode);
void updateAnims();
void updateY();
diff --git a/engines/griffon/module.mk b/engines/griffon/module.mk
index bd64e73..ad322e9 100644
--- a/engines/griffon/module.mk
+++ b/engines/griffon/module.mk
@@ -4,6 +4,7 @@ MODULE_OBJS := \
combat.o \
config.o \
console.o \
+ cutscenes.o \
engine.o \
griffon.o \
detection.o \
Commit: 0efb016e3644488beee2e412729e017ef31f1f2a
https://github.com/scummvm/scummvm/commit/0efb016e3644488beee2e412729e017ef31f1f2a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Added dialogs.cpp
Changed paths:
A engines/griffon/dialogs.cpp
engines/griffon/engine.cpp
engines/griffon/griffon.h
engines/griffon/module.mk
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
new file mode 100644
index 0000000..03254ce
--- /dev/null
+++ b/engines/griffon/dialogs.cpp
@@ -0,0 +1,790 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Originally written by Syn9 in FreeBASIC with SDL
+ * http://syn9.thehideoutgames.com/index_backup.php
+ *
+ * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
+ * http://github.com/dmitrysmagin/griffon_legend
+ *
+ *
+ * Programming/Graphics: Daniel "Syn9" Kennedy
+ * Music/Sound effects: David Turner
+ *
+ * Beta testing and gameplay design help:
+ * Deleter, Cha0s, Aether Fox, and Kiz
+ *
+ */
+
+#include "common/system.h"
+
+#include "griffon/griffon.h"
+#include "griffon/config.h"
+
+namespace Griffon {
+
+#define MINCURSEL 7
+#define MAXCURSEL 14
+#define SY 22
+
+void GriffonEngine::title(int mode) {
+ float xofs = 0;
+
+ rcSrc.left = 0;
+ rcSrc.top = 0;
+ rcSrc.setWidth(320);
+ rcSrc.setHeight(240);
+
+ _videobuffer2->fillRect(rcSrc, 0);
+ _videobuffer3->fillRect(rcSrc, 0);
+
+ _ticks = g_system->getMillis();
+
+ _videobuffer->blit(*_videobuffer3);
+ _videobuffer->blit(*_videobuffer2);
+
+ int cursel = 0;
+ int keypause = _ticks + 220;
+ int _ticks1 = _ticks;
+
+ if (config.music) {
+ setChannelVolume(_musicchannel, 0);
+ pauseSoundChannel(_musicchannel);
+
+ _menuchannel = playSound(_mmenu, true);
+ setChannelVolume(_menuchannel, config.musicvol);
+ _pmenu = true;
+ }
+
+ bool ldstop = false;
+
+ float ld = 0;
+ do {
+ Common::Rect rc;
+
+ ld += 4.0 * _fpsr;
+ if (ld > config.musicvol)
+ ld = config.musicvol;
+ if (!ldstop) {
+ setChannelVolume(_menuchannel, (int)ld);
+ if ((int)ld == config.musicvol)
+ ldstop = true;
+ }
+
+ rc.left = -xofs;
+ rc.top = 0;
+
+ _titleimg->blit(*_videobuffer, rc.left, rc.top);
+
+ rc.left = -xofs + 320.0;
+ rc.top = 0;
+
+ _titleimg->blit(*_videobuffer, rc.left, rc.top);
+
+ rc.left = 0;
+ rc.top = 0;
+
+ _titleimg2->blit(*_videobuffer, rc.left, rc.top);
+
+ int y = 172;
+ int x = 160 - 14 * 4;
+
+ drawString(_videobuffer, "new game/save/load", x, y, 4);
+ drawString(_videobuffer, "options", x, y + 16, 4);
+ drawString(_videobuffer, "quit game", x, y + 32, 4);
+
+ if (mode == 1)
+ drawString(_videobuffer, "return", x, y + 48, 4);
+ else
+ drawString(_videobuffer, "(c) 2005 by Daniel 'Syn9' Kennedy", 28, 224, 4);
+
+ rc.left = (float)(x - 16 - 4 * cos(3.14159 * 2 * _itemyloc / 16));
+ rc.top = (float)(y - 4 + 16 * cursel);
+
+ _itemimg[15]->blit(*_videobuffer, rc.left, rc.top);
+
+ float yf = 255.0;
+ if (_ticks < _ticks1 + 1000) {
+ yf = 255.0 * ((float)(_ticks - _ticks1) / 1000.0);
+ if (y < 0.0)
+ yf = 0.0;
+ if (y > 255.0)
+ yf = 255.0;
+ }
+
+ _videobuffer->setAlpha((int)yf);
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ g_system->updateScreen();
+
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
+
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24.0;
+
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
+ }
+
+ float add = 0.5 * _fpsr;
+ if (add > 1)
+ add = 1;
+
+ xofs = xofs + add;
+ if (xofs >= 320.0)
+ xofs -= 320.0;
+
+ _itemyloc += 0.75 * _fpsr;
+
+ while (_itemyloc >= 16)
+ _itemyloc = _itemyloc - 16;
+
+ g_system->getEventManager()->pollEvent(_event);
+
+ if (_event.type == Common::EVENT_QUIT)
+ _shouldQuit = true;
+
+ if (keypause < _ticks) {
+ if (_event.type == Common::EVENT_KEYDOWN) {
+ keypause = _ticks + 150;
+
+ if (_event.kbd.keycode == Common::KEYCODE_ESCAPE && mode == 1)
+ break;
+ else if (_event.kbd.keycode == Common::KEYCODE_UP) {
+ cursel--;
+ if (cursel < 0)
+ cursel = (mode == 1 ? 3 : 2);
+ } else if (_event.kbd.keycode == Common::KEYCODE_DOWN) {
+ cursel++;
+ if (cursel >= (mode == 1 ? 4 : 3))
+ cursel = 0;
+ } else if (_event.kbd.keycode == Common::KEYCODE_RETURN) {
+ if (cursel == 0) {
+ saveLoadNew();
+ _ticks = g_system->getMillis();
+ keypause = _ticks + 150;
+ _ticks1 = _ticks;
+ } else if (cursel == 1) {
+ configMenu();
+ _ticks = g_system->getMillis();
+ keypause = _ticks + 150;
+ _ticks1 = _ticks;
+ } else if (cursel == 2) {
+ _shouldQuit = true;
+ } else if (cursel == 3) {
+ break;
+ }
+ }
+ }
+ }
+
+ g_system->delayMillis(10);
+ } while (!_shouldQuit);
+
+ _itemticks = _ticks + 210;
+
+ if (config.music) {
+ haltSoundChannel(_menuchannel);
+ resumeSoundChannel(_musicchannel);
+ setChannelVolume(_musicchannel, config.musicvol);
+ _pmenu = false;
+ }
+}
+
+void GriffonEngine::configMenu() {
+ int cursel = MINCURSEL;
+
+ int tickwait = 1000 / 60;
+
+ _ticks = g_system->getMillis();
+ int keypause = _ticks + tickwait;
+
+ Graphics::TransparentSurface *configwindow = loadImage("art/configwindow.bmp", true);
+ configwindow->setAlpha(160, true);
+
+ int _ticks1 = _ticks;
+ do {
+ _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
+
+ rcDest.left = 256 + 256 * cos(3.141592 / 180 * clouddeg * 40);
+ rcDest.top = 192 + 192 * sin(3.141592 / 180 * clouddeg * 40);
+ rcDest.setWidth(320);
+ rcDest.setHeight(240);
+
+ cloudimg->setAlpha(128, true);
+ cloudimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
+ cloudimg->setAlpha(64, true);
+
+ rcDest.left = 256;
+ rcDest.top = 192;
+ rcDest.setWidth(320);
+ rcDest.setHeight(240);
+
+ cloudimg->setAlpha(128, true);
+ cloudimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
+ cloudimg->setAlpha(64, true);
+
+ _videobuffer->copyRectToSurface(configwindow->getPixels(), configwindow->pitch, 0, 0, configwindow->w, configwindow->h);
+
+ int sy = SY;
+
+ for (int i = 0; i <= 21; i++) {
+ static const char *vr[22] = {
+ "", "",
+ "", "", "", "",
+ "", "", "",
+ "Music:", "", "",
+ "Sound Effects:", "", "",
+ "Music Volume:", "",
+ "Effects Volume:", "", "", "", ""
+ };
+ static const char *vl[22] = {
+ "", "",
+ "", "", "", "",
+ "", "", "",
+ "On", "Off", "",
+ "On", "Off", "",
+ "[----------]", "",
+ "[----------]", "",
+ "Exit + Save", "",
+ "Exit"
+ };
+ static char line[24];
+
+ if (i == 15 || i == 17) {
+ int vol = (i == 15 ? config.musicvol : config.effectsvol) * 9 / 255;
+ if (vol < 0)
+ vol = 0;
+ if (vol > 9)
+ vol = 9;
+
+ strcpy(line, "[----------]");
+ line[vol + 1] = 'X';
+ vl[i] = line;
+ }
+
+ int cl = 3;
+
+ if (i == 9 && config.music)
+ cl = 0;
+ else if (i == 10 && !config.music)
+ cl = 0;
+ else if (i == 12 && config.effects)
+ cl = 0;
+ else if (i == 13 && !config.effects)
+ cl = 0;
+ else if (i > 18)
+ cl = 0;
+
+ drawString(_videobuffer, vr[i], 156 - 8 * strlen(vr[i]), sy + i * 8, 0);
+ drawString(_videobuffer, vl[i], 164, sy + i * 8, cl);
+ }
+
+ int curselt = cursel + 2;
+ if (cursel > 8)
+ curselt += 1;
+ if (cursel > 10)
+ curselt += 1;
+ if (cursel > 11)
+ curselt += 1;
+ if (cursel > 12)
+ curselt += 1;
+ if (cursel > 13)
+ curselt += 1;
+
+ Common::Rect rc;
+ rc.left = 148 + 3 * cos(3.14159 * 2 * _itemyloc / 16.0);
+ rc.top = sy + 8 * curselt - 4;
+
+ _itemimg[15]->blit(*_videobuffer, rc.left, rc.top);
+
+ float yy = 255.0;
+ if (_ticks < _ticks1 + 1000) {
+ yy = 255.0 * ((float)(_ticks - _ticks1) / 1000.0);
+ if (yy < 0.0)
+ yy = 0.0;
+ if (yy > 255.0)
+ yy = 255.0;
+ }
+
+ _videobuffer->setAlpha((int)yy);
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ g_system->updateScreen();
+
+ g_system->getEventManager()->pollEvent(_event);
+
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
+
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24;
+
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
+ }
+
+ _itemyloc += 0.75 * _fpsr;
+ while (_itemyloc >= 16)
+ _itemyloc -= 16;
+
+ if (keypause < _ticks) {
+ g_system->getEventManager()->pollEvent(_event);
+
+ if (_event.type == Common::EVENT_QUIT)
+ _shouldQuit = true;
+
+ if (_event.type == Common::EVENT_KEYDOWN) {
+ keypause = _ticks + tickwait;
+
+ if (_event.kbd.keycode == Common::KEYCODE_ESCAPE)
+ break;
+
+ if (_event.kbd.keycode == Common::KEYCODE_LEFT) {
+ if (cursel == 11) {
+ config.musicvol = config.musicvol - 25;
+ if (config.musicvol < 0)
+ config.musicvol = 0;
+
+ setChannelVolume(_musicchannel, config.musicvol);
+ setChannelVolume(_menuchannel, config.musicvol);
+ } else if (cursel == 12) {
+ config.effectsvol = config.effectsvol - 25;
+ if (config.effectsvol < 0)
+ config.effectsvol = 0;
+
+ setChannelVolume(-1, config.effectsvol);
+ setChannelVolume(_musicchannel, config.musicvol);
+ setChannelVolume(_menuchannel, config.musicvol);
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndDoor]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+ }
+ }
+ if (_event.kbd.keycode == Common::KEYCODE_RIGHT) {
+ if (cursel == 11) {
+ config.musicvol = config.musicvol + 25;
+ if (config.musicvol > 255)
+ config.musicvol = 255;
+
+ setChannelVolume(_musicchannel, config.musicvol);
+ setChannelVolume(_menuchannel, config.musicvol);
+ } else if (cursel == 12) {
+ config.effectsvol = config.effectsvol + 25;
+ if (config.effectsvol > 255)
+ config.effectsvol = 255;
+
+ setChannelVolume(-1, config.effectsvol);
+ setChannelVolume(_musicchannel, config.musicvol);
+ setChannelVolume(_menuchannel, config.musicvol);
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndDoor]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+ }
+ }
+
+ if (_event.kbd.keycode == Common::KEYCODE_UP) {
+ cursel--;
+ if (cursel < MINCURSEL)
+ cursel = 14;
+ }
+ if (_event.kbd.keycode == Common::KEYCODE_DOWN) {
+ cursel++;
+ if (cursel > 14)
+ cursel = MINCURSEL;
+ }
+
+ if (_event.kbd.keycode == Common::KEYCODE_RETURN) {
+ if (cursel == 7 && !config.music) {
+ config.music = true;
+ _menuchannel = playSound(_mmenu, true);
+ setChannelVolume(_menuchannel, config.musicvol);
+ }
+ if (cursel == 8 && config.music) {
+ config.music = false;
+ haltSoundChannel(_musicchannel);
+ haltSoundChannel(_menuchannel);
+ }
+ if (cursel == 9 && !config.effects) {
+ config.effects = true;
+ int snd = playSound(_sfx[kSndDoor]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ if (cursel == 10 && config.effects)
+ config.effects = false;
+
+ if (cursel == 13) {
+ config_save(&config);
+ break;
+ }
+
+ if (cursel == 14) {
+ // reset keys to avoid returning
+ // keys[SDLK_SPACE] = keys[SDLK_RETURN] = 0; // FIXME
+ break;
+ }
+ }
+ }
+ }
+
+ clouddeg += 0.01 * _fpsr;
+ while (clouddeg >= 360)
+ clouddeg -= 360;
+
+ g_system->delayMillis(10);
+ } while (!_shouldQuit);
+
+ configwindow->free();
+ _itemticks = _ticks + 210;
+
+ cloudimg->setAlpha(64, true);
+}
+
+void GriffonEngine::saveLoadNew() {
+ float y = 0.0;
+
+ clouddeg = 0;
+
+ _videobuffer->setAlpha(255);
+ saveloadimg->setAlpha(192, true);
+
+ int currow = 0;
+ int curcol = 0;
+ int lowerlock = 0;
+
+ _ticks = g_system->getMillis();
+ int _ticks1 = _ticks;
+ int tickpause = _ticks + 150;
+
+ do {
+ _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
+
+ y = y + 1 * _fpsr;
+
+ rcDest.left = 256 + 256 * cos(3.141592 / 180 * clouddeg * 40);
+ rcDest.top = 192 + 192 * sin(3.141592 / 180 * clouddeg * 40);
+ rcDest.setWidth(320);
+ rcDest.setHeight(240);
+
+ cloudimg->setAlpha(128, true);
+ cloudimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
+ cloudimg->setAlpha(64, true);
+
+ rcDest.left = 256;
+ rcDest.top = 192;
+ rcDest.setWidth(320);
+ rcDest.setHeight(240);
+
+ cloudimg->setAlpha(128, true);
+ cloudimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
+ cloudimg->setAlpha(64, true);
+
+ saveloadimg->blit(*_videobuffer);
+
+ g_system->getEventManager()->pollEvent(_event);
+
+ if (_event.type == Common::EVENT_QUIT) {
+ _shouldQuit = true;
+ return;
+ }
+
+ if (tickpause < _ticks) {
+ if (_event.type == Common::EVENT_KEYDOWN) {
+ _itemticks = _ticks + 220;
+
+ if (_event.kbd.keycode == Common::KEYCODE_RETURN) {
+ // QUIT - non existent :)
+ if (currow == 0 && curcol == 4) {
+ _shouldQuit = true;
+ return;
+ }
+ // RETURN
+ if (currow == 0 && curcol == 3) {
+ // reset keys to avoid returning
+ // keys[SDLK_RETURN] = keys[SDLK_SPACE] = 0; // FIXME
+ return;
+ }
+ // NEW GAME
+ if (currow == 0 && curcol == 0)
+ newGame();
+
+ // LOAD GAME
+ if (currow == 0 && curcol == 1) {
+ lowerlock = 1;
+ currow = 1 + _saveslot;
+ tickpause = _ticks + 125;
+ }
+ // SAVE GAME
+ if (currow == 0 && curcol == 2) {
+ lowerlock = 1;
+ currow = 1;
+ tickpause = _ticks + 125;
+ }
+
+
+ if (lowerlock == 1 && curcol == 1 && tickpause < _ticks) {
+ if (saveState(currow - 1)) {
+ _secstart = _secstart + _secsingame;
+ _secsingame = 0;
+ lowerlock = 0;
+ _saveslot = currow - 1;
+ currow = 0;
+ }
+ }
+
+ if (lowerlock == 1 && curcol == 2 && tickpause < _ticks) {
+ if (loadState(currow - 1)) {
+ _player.walkspd = 1.1f;
+ _animspd = 0.5f;
+ attacking = false;
+ _player.attackspd = 1.5f;
+
+ _pgardens = false;
+ _ptown = false;
+ _pboss = false;
+ _pacademy = false;
+ _pcitadel = false;
+
+ haltSoundChannel(-1);
+
+ _secsingame = 0;
+ _saveslot = currow - 1;
+ loadMap(_curmap);
+ mainLoop();
+ }
+ }
+
+ tickpause = _ticks + 125;
+ }
+
+ switch (_event.kbd.keycode) {
+ case Common::KEYCODE_ESCAPE:
+ if (lowerlock == 0)
+ return;
+ lowerlock = 0;
+ currow = 0;
+ tickpause = _ticks + 125;
+ break;
+ case Common::KEYCODE_DOWN:
+ if (lowerlock == 1) {
+ currow = currow + 1;
+ if (currow == 5)
+ currow = 1;
+ tickpause = _ticks + 125;
+ }
+ break;
+
+ case Common::KEYCODE_UP:
+ if (lowerlock == 1) {
+ currow = currow - 1;
+ if (currow == 0)
+ currow = 4;
+ tickpause = _ticks + 125;
+ }
+ break;
+
+ case Common::KEYCODE_LEFT:
+ if (lowerlock == 0) {
+ curcol = curcol - 1;
+ if (curcol == -1)
+ curcol = 3;
+ tickpause = _ticks + 125;
+ }
+ break;
+
+ case Common::KEYCODE_RIGHT:
+ if (lowerlock == 0) {
+ curcol = curcol + 1;
+ if (curcol == 4)
+ curcol = 0;
+ tickpause = _ticks + 125;
+ }
+ break;
+ default:
+ ;
+ }
+ }
+ }
+
+
+ // savestates---------------------------------
+ // read it only when needed!
+
+ for (int ff = 0; ff <= 3; ff++) {
+ loadPlayer(ff);
+
+ if (_playera.level > 0) {
+ char line[256];
+ int sx, sy, cc, ss, nx;
+
+ sx = 8;
+ sy = 57 + ff * 48;
+
+ // time
+ int ase = _asecstart;
+ int h = ((ase - (ase % 3600)) / 3600);
+ ase = (ase - h * 3600);
+ int m = ((ase - (ase % 60)) / 60);
+ int s = (ase - m * 60);
+
+ sprintf(line, "Game Time: %02i:%02i:%02i", h, m, s);
+ drawString(_videobuffer, line, 160 - strlen(line) * 4, sy, 0);
+
+ sx = 12;
+ sy = sy + 11;
+ cc = 0;
+
+ sprintf(line, "Health: %i/%i", _playera.hp, _playera.maxhp);
+ drawString(_videobuffer, line, sx, sy, cc);
+
+ if (_playera.level == 22)
+ strcpy(line, "Level: MAX");
+ else
+ sprintf(line, "Level: %i", _playera.level);
+
+ drawString(_videobuffer, line, sx, sy + 11, 0);
+
+ rcSrc.left = sx + 15 * 8 + 24;
+ rcSrc.top = sy + 1;
+
+ ss = (_playera.sword - 1) * 3;
+ if (_playera.sword == 3)
+ ss = 18;
+ _itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+
+ rcSrc.left = rcSrc.left + 16;
+ ss = (_playera.shield - 1) * 3 + 1;
+ if (_playera.shield == 3)
+ ss = 19;
+ _itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+
+ rcSrc.left = rcSrc.left + 16;
+ ss = (_playera.armour - 1) * 3 + 2;
+ if (_playera.armour == 3)
+ ss = 20;
+ _itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+
+ nx = rcSrc.left + 13 + 3 * 8;
+ rcSrc.left = nx - 17;
+
+ if (_playera.foundspell[0] == 1) {
+ for (int i = 0; i < 5; i++) {
+ rcSrc.left = rcSrc.left + 17;
+ if (_playera.foundspell[i] == 1)
+ _itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ }
+ }
+ } else {
+ int sy = 57 + ff * 48;
+ drawString(_videobuffer, "Empty", 160 - 5 * 4, sy, 0);
+ }
+ }
+ // ------------------------------------------
+
+
+ if (currow == 0) {
+ rcDest.top = 18;
+ if (curcol == 0)
+ rcDest.left = 10;
+ if (curcol == 1)
+ rcDest.left = 108;
+ if (curcol == 2)
+ rcDest.left = 170;
+ if (curcol == 3)
+ rcDest.left = 230;
+ rcDest.left = (float)(rcDest.left + 2 + 2 * sin(3.14159 * 2 * _itemyloc / 16));
+ }
+
+ if (currow > 0) {
+ rcDest.left = (float)(0 + 2 * sin(3.14159 * 2 * _itemyloc / 16));
+ rcDest.top = (float)(53 + (currow - 1) * 48);
+ }
+
+ _itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
+
+
+ if (lowerlock == 1) {
+ rcDest.top = 18;
+ if (curcol == 1)
+ rcDest.left = 108;
+ if (curcol == 2)
+ rcDest.left = 170;
+
+ // CHECKME: Useless code? or temporary commented?
+ // rcDest.left = rcDest.left; // + 2 + 2 * sin(-3.14159 * 2 * _itemyloc / 16)
+
+ _itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
+ }
+
+ int yy = 255;
+ if (_ticks < _ticks1 + 1000) {
+ yy = 255 * (_ticks - _ticks1) / 1000;
+ if (yy < 0)
+ yy = 0;
+ if (yy > 255)
+ yy = 255;
+ }
+
+ _videobuffer->setAlpha((int)yy);
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ g_system->updateScreen();
+
+ g_system->getEventManager()->pollEvent(_event);
+
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
+
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24;
+
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
+ }
+
+ clouddeg += 0.01 * _fpsr;
+ while (clouddeg >= 360)
+ clouddeg -= 360;
+
+ _itemyloc += 0.6 * _fpsr;
+ while (_itemyloc >= 16)
+ _itemyloc -= 16;
+
+ g_system->delayMillis(10);
+ } while (!_shouldQuit);
+
+ cloudimg->setAlpha(64, true);
+}
+
+
+} // end of namespace Griffon
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 4dfe724..69bb423 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -519,266 +519,6 @@ void GriffonEngine::checkTrigger() {
processTrigger(_triggerloc[lx][ly]);
}
-#define MINCURSEL 7
-#define MAXCURSEL 14
-#define SY 22
-
-void GriffonEngine::configMenu() {
- int cursel = MINCURSEL;
-
- int tickwait = 1000 / 60;
-
- _ticks = g_system->getMillis();
- int keypause = _ticks + tickwait;
-
- Graphics::TransparentSurface *configwindow = loadImage("art/configwindow.bmp", true);
- configwindow->setAlpha(160, true);
-
- int _ticks1 = _ticks;
- do {
- _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
-
- rcDest.left = 256 + 256 * cos(3.141592 / 180 * clouddeg * 40);
- rcDest.top = 192 + 192 * sin(3.141592 / 180 * clouddeg * 40);
- rcDest.setWidth(320);
- rcDest.setHeight(240);
-
- cloudimg->setAlpha(128, true);
- cloudimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
- cloudimg->setAlpha(64, true);
-
- rcDest.left = 256;
- rcDest.top = 192;
- rcDest.setWidth(320);
- rcDest.setHeight(240);
-
- cloudimg->setAlpha(128, true);
- cloudimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
- cloudimg->setAlpha(64, true);
-
- _videobuffer->copyRectToSurface(configwindow->getPixels(), configwindow->pitch, 0, 0, configwindow->w, configwindow->h);
-
- int sy = SY;
-
- for (int i = 0; i <= 21; i++) {
- static const char *vr[22] = {
- "", "",
- "", "", "", "",
- "", "", "",
- "Music:", "", "",
- "Sound Effects:", "", "",
- "Music Volume:", "",
- "Effects Volume:", "", "", "", ""
- };
- static const char *vl[22] = {
- "", "",
- "", "", "", "",
- "", "", "",
- "On", "Off", "",
- "On", "Off", "",
- "[----------]", "",
- "[----------]", "",
- "Exit + Save", "",
- "Exit"
- };
- static char line[24];
-
- if (i == 15 || i == 17) {
- int vol = (i == 15 ? config.musicvol : config.effectsvol) * 9 / 255;
- if (vol < 0)
- vol = 0;
- if (vol > 9)
- vol = 9;
-
- strcpy(line, "[----------]");
- line[vol + 1] = 'X';
- vl[i] = line;
- }
-
- int cl = 3;
-
- if (i == 9 && config.music)
- cl = 0;
- else if (i == 10 && !config.music)
- cl = 0;
- else if (i == 12 && config.effects)
- cl = 0;
- else if (i == 13 && !config.effects)
- cl = 0;
- else if (i > 18)
- cl = 0;
-
- drawString(_videobuffer, vr[i], 156 - 8 * strlen(vr[i]), sy + i * 8, 0);
- drawString(_videobuffer, vl[i], 164, sy + i * 8, cl);
- }
-
- int curselt = cursel + 2;
- if (cursel > 8)
- curselt += 1;
- if (cursel > 10)
- curselt += 1;
- if (cursel > 11)
- curselt += 1;
- if (cursel > 12)
- curselt += 1;
- if (cursel > 13)
- curselt += 1;
-
- Common::Rect rc;
- rc.left = 148 + 3 * cos(3.14159 * 2 * _itemyloc / 16.0);
- rc.top = sy + 8 * curselt - 4;
-
- _itemimg[15]->blit(*_videobuffer, rc.left, rc.top);
-
- float yy = 255.0;
- if (_ticks < _ticks1 + 1000) {
- yy = 255.0 * ((float)(_ticks - _ticks1) / 1000.0);
- if (yy < 0.0)
- yy = 0.0;
- if (yy > 255.0)
- yy = 255.0;
- }
-
- _videobuffer->setAlpha((int)yy);
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
- g_system->updateScreen();
-
- g_system->getEventManager()->pollEvent(_event);
-
- _tickspassed = _ticks;
- _ticks = g_system->getMillis();
-
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24;
-
- _fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
- _fps = _fp;
- _fp = 0;
- }
-
- _itemyloc += 0.75 * _fpsr;
- while (_itemyloc >= 16)
- _itemyloc -= 16;
-
- if (keypause < _ticks) {
- g_system->getEventManager()->pollEvent(_event);
-
- if (_event.type == Common::EVENT_QUIT)
- _shouldQuit = true;
-
- if (_event.type == Common::EVENT_KEYDOWN) {
- keypause = _ticks + tickwait;
-
- if (_event.kbd.keycode == Common::KEYCODE_ESCAPE)
- break;
-
- if (_event.kbd.keycode == Common::KEYCODE_LEFT) {
- if (cursel == 11) {
- config.musicvol = config.musicvol - 25;
- if (config.musicvol < 0)
- config.musicvol = 0;
-
- setChannelVolume(_musicchannel, config.musicvol);
- setChannelVolume(_menuchannel, config.musicvol);
- } else if (cursel == 12) {
- config.effectsvol = config.effectsvol - 25;
- if (config.effectsvol < 0)
- config.effectsvol = 0;
-
- setChannelVolume(-1, config.effectsvol);
- setChannelVolume(_musicchannel, config.musicvol);
- setChannelVolume(_menuchannel, config.musicvol);
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndDoor]);
- setChannelVolume(snd, config.effectsvol);
- }
- }
- }
- if (_event.kbd.keycode == Common::KEYCODE_RIGHT) {
- if (cursel == 11) {
- config.musicvol = config.musicvol + 25;
- if (config.musicvol > 255)
- config.musicvol = 255;
-
- setChannelVolume(_musicchannel, config.musicvol);
- setChannelVolume(_menuchannel, config.musicvol);
- } else if (cursel == 12) {
- config.effectsvol = config.effectsvol + 25;
- if (config.effectsvol > 255)
- config.effectsvol = 255;
-
- setChannelVolume(-1, config.effectsvol);
- setChannelVolume(_musicchannel, config.musicvol);
- setChannelVolume(_menuchannel, config.musicvol);
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndDoor]);
- setChannelVolume(snd, config.effectsvol);
- }
- }
- }
-
- if (_event.kbd.keycode == Common::KEYCODE_UP) {
- cursel--;
- if (cursel < MINCURSEL)
- cursel = 14;
- }
- if (_event.kbd.keycode == Common::KEYCODE_DOWN) {
- cursel++;
- if (cursel > 14)
- cursel = MINCURSEL;
- }
-
- if (_event.kbd.keycode == Common::KEYCODE_RETURN) {
- if (cursel == 7 && !config.music) {
- config.music = true;
- _menuchannel = playSound(_mmenu, true);
- setChannelVolume(_menuchannel, config.musicvol);
- }
- if (cursel == 8 && config.music) {
- config.music = false;
- haltSoundChannel(_musicchannel);
- haltSoundChannel(_menuchannel);
- }
- if (cursel == 9 && !config.effects) {
- config.effects = true;
- int snd = playSound(_sfx[kSndDoor]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- if (cursel == 10 && config.effects)
- config.effects = false;
-
- if (cursel == 13) {
- config_save(&config);
- break;
- }
-
- if (cursel == 14) {
- // reset keys to avoid returning
- // keys[SDLK_SPACE] = keys[SDLK_RETURN] = 0; // FIXME
- break;
- }
- }
- }
- }
-
- clouddeg += 0.01 * _fpsr;
- while (clouddeg >= 360)
- clouddeg -= 360;
-
- g_system->delayMillis(10);
- } while (!_shouldQuit);
-
- configwindow->free();
- _itemticks = _ticks + 210;
-
- cloudimg->setAlpha(64, true);
-}
-
void GriffonEngine::drawAnims(int Layer) {
for (int sx = 0; sx <= 19; sx++) {
for (int sy = 0; sy <= 14; sy++) {
@@ -3199,324 +2939,6 @@ void GriffonEngine::processTrigger(int trignum) {
}
}
-void GriffonEngine::saveLoadNew() {
- float y = 0.0;
-
- clouddeg = 0;
-
- _videobuffer->setAlpha(255);
- saveloadimg->setAlpha(192, true);
-
- int currow = 0;
- int curcol = 0;
- int lowerlock = 0;
-
- _ticks = g_system->getMillis();
- int _ticks1 = _ticks;
- int tickpause = _ticks + 150;
-
- do {
- _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
-
- y = y + 1 * _fpsr;
-
- rcDest.left = 256 + 256 * cos(3.141592 / 180 * clouddeg * 40);
- rcDest.top = 192 + 192 * sin(3.141592 / 180 * clouddeg * 40);
- rcDest.setWidth(320);
- rcDest.setHeight(240);
-
- cloudimg->setAlpha(128, true);
- cloudimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
- cloudimg->setAlpha(64, true);
-
- rcDest.left = 256;
- rcDest.top = 192;
- rcDest.setWidth(320);
- rcDest.setHeight(240);
-
- cloudimg->setAlpha(128, true);
- cloudimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
- cloudimg->setAlpha(64, true);
-
- saveloadimg->blit(*_videobuffer);
-
- g_system->getEventManager()->pollEvent(_event);
-
- if (_event.type == Common::EVENT_QUIT) {
- _shouldQuit = true;
- return;
- }
-
- if (tickpause < _ticks) {
- if (_event.type == Common::EVENT_KEYDOWN) {
- _itemticks = _ticks + 220;
-
- if (_event.kbd.keycode == Common::KEYCODE_RETURN) {
- // QUIT - non existent :)
- if (currow == 0 && curcol == 4) {
- _shouldQuit = true;
- return;
- }
- // RETURN
- if (currow == 0 && curcol == 3) {
- // reset keys to avoid returning
- // keys[SDLK_RETURN] = keys[SDLK_SPACE] = 0; // FIXME
- return;
- }
- // NEW GAME
- if (currow == 0 && curcol == 0)
- newGame();
-
- // LOAD GAME
- if (currow == 0 && curcol == 1) {
- lowerlock = 1;
- currow = 1 + _saveslot;
- tickpause = _ticks + 125;
- }
- // SAVE GAME
- if (currow == 0 && curcol == 2) {
- lowerlock = 1;
- currow = 1;
- tickpause = _ticks + 125;
- }
-
-
- if (lowerlock == 1 && curcol == 1 && tickpause < _ticks) {
- if (saveState(currow - 1)) {
- _secstart = _secstart + _secsingame;
- _secsingame = 0;
- lowerlock = 0;
- _saveslot = currow - 1;
- currow = 0;
- }
- }
-
- if (lowerlock == 1 && curcol == 2 && tickpause < _ticks) {
- if (loadState(currow - 1)) {
- _player.walkspd = 1.1f;
- _animspd = 0.5f;
- attacking = false;
- _player.attackspd = 1.5f;
-
- _pgardens = false;
- _ptown = false;
- _pboss = false;
- _pacademy = false;
- _pcitadel = false;
-
- haltSoundChannel(-1);
-
- _secsingame = 0;
- _saveslot = currow - 1;
- loadMap(_curmap);
- mainLoop();
- }
- }
-
- tickpause = _ticks + 125;
- }
-
- switch (_event.kbd.keycode) {
- case Common::KEYCODE_ESCAPE:
- if (lowerlock == 0)
- return;
- lowerlock = 0;
- currow = 0;
- tickpause = _ticks + 125;
- break;
- case Common::KEYCODE_DOWN:
- if (lowerlock == 1) {
- currow = currow + 1;
- if (currow == 5)
- currow = 1;
- tickpause = _ticks + 125;
- }
- break;
-
- case Common::KEYCODE_UP:
- if (lowerlock == 1) {
- currow = currow - 1;
- if (currow == 0)
- currow = 4;
- tickpause = _ticks + 125;
- }
- break;
-
- case Common::KEYCODE_LEFT:
- if (lowerlock == 0) {
- curcol = curcol - 1;
- if (curcol == -1)
- curcol = 3;
- tickpause = _ticks + 125;
- }
- break;
-
- case Common::KEYCODE_RIGHT:
- if (lowerlock == 0) {
- curcol = curcol + 1;
- if (curcol == 4)
- curcol = 0;
- tickpause = _ticks + 125;
- }
- break;
- default:
- ;
- }
- }
- }
-
-
- // savestates---------------------------------
- // read it only when needed!
-
- for (int ff = 0; ff <= 3; ff++) {
- loadPlayer(ff);
-
- if (_playera.level > 0) {
- char line[256];
- int sx, sy, cc, ss, nx;
-
- sx = 8;
- sy = 57 + ff * 48;
-
- // time
- int ase = _asecstart;
- int h = ((ase - (ase % 3600)) / 3600);
- ase = (ase - h * 3600);
- int m = ((ase - (ase % 60)) / 60);
- int s = (ase - m * 60);
-
- sprintf(line, "Game Time: %02i:%02i:%02i", h, m, s);
- drawString(_videobuffer, line, 160 - strlen(line) * 4, sy, 0);
-
- sx = 12;
- sy = sy + 11;
- cc = 0;
-
- sprintf(line, "Health: %i/%i", _playera.hp, _playera.maxhp);
- drawString(_videobuffer, line, sx, sy, cc);
-
- if (_playera.level == 22)
- strcpy(line, "Level: MAX");
- else
- sprintf(line, "Level: %i", _playera.level);
-
- drawString(_videobuffer, line, sx, sy + 11, 0);
-
- rcSrc.left = sx + 15 * 8 + 24;
- rcSrc.top = sy + 1;
-
- ss = (_playera.sword - 1) * 3;
- if (_playera.sword == 3)
- ss = 18;
- _itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
-
- rcSrc.left = rcSrc.left + 16;
- ss = (_playera.shield - 1) * 3 + 1;
- if (_playera.shield == 3)
- ss = 19;
- _itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
-
- rcSrc.left = rcSrc.left + 16;
- ss = (_playera.armour - 1) * 3 + 2;
- if (_playera.armour == 3)
- ss = 20;
- _itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
-
- nx = rcSrc.left + 13 + 3 * 8;
- rcSrc.left = nx - 17;
-
- if (_playera.foundspell[0] == 1) {
- for (int i = 0; i < 5; i++) {
- rcSrc.left = rcSrc.left + 17;
- if (_playera.foundspell[i] == 1)
- _itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
- }
- }
- } else {
- int sy = 57 + ff * 48;
- drawString(_videobuffer, "Empty", 160 - 5 * 4, sy, 0);
- }
- }
- // ------------------------------------------
-
-
- if (currow == 0) {
- rcDest.top = 18;
- if (curcol == 0)
- rcDest.left = 10;
- if (curcol == 1)
- rcDest.left = 108;
- if (curcol == 2)
- rcDest.left = 170;
- if (curcol == 3)
- rcDest.left = 230;
- rcDest.left = (float)(rcDest.left + 2 + 2 * sin(3.14159 * 2 * _itemyloc / 16));
- }
-
- if (currow > 0) {
- rcDest.left = (float)(0 + 2 * sin(3.14159 * 2 * _itemyloc / 16));
- rcDest.top = (float)(53 + (currow - 1) * 48);
- }
-
- _itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
-
-
- if (lowerlock == 1) {
- rcDest.top = 18;
- if (curcol == 1)
- rcDest.left = 108;
- if (curcol == 2)
- rcDest.left = 170;
-
- // CHECKME: Useless code? or temporary commented?
- // rcDest.left = rcDest.left; // + 2 + 2 * sin(-3.14159 * 2 * _itemyloc / 16)
-
- _itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
- }
-
- int yy = 255;
- if (_ticks < _ticks1 + 1000) {
- yy = 255 * (_ticks - _ticks1) / 1000;
- if (yy < 0)
- yy = 0;
- if (yy > 255)
- yy = 255;
- }
-
- _videobuffer->setAlpha((int)yy);
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
- g_system->updateScreen();
-
- g_system->getEventManager()->pollEvent(_event);
-
- _tickspassed = _ticks;
- _ticks = g_system->getMillis();
-
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24;
-
- _fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
- _fps = _fp;
- _fp = 0;
- }
-
- clouddeg += 0.01 * _fpsr;
- while (clouddeg >= 360)
- clouddeg -= 360;
-
- _itemyloc += 0.6 * _fpsr;
- while (_itemyloc >= 16)
- _itemyloc -= 16;
-
- g_system->delayMillis(10);
- } while (!_shouldQuit);
-
- cloudimg->setAlpha(64, true);
-}
-
void GriffonEngine::swash() {
float y;
@@ -3602,173 +3024,6 @@ void GriffonEngine::swash() {
_videobuffer->setAlpha(255);
}
-void GriffonEngine::title(int mode) {
- float xofs = 0;
-
- rcSrc.left = 0;
- rcSrc.top = 0;
- rcSrc.setWidth(320);
- rcSrc.setHeight(240);
-
- _videobuffer2->fillRect(rcSrc, 0);
- _videobuffer3->fillRect(rcSrc, 0);
-
- _ticks = g_system->getMillis();
-
- _videobuffer->blit(*_videobuffer3);
- _videobuffer->blit(*_videobuffer2);
-
- int cursel = 0;
- int keypause = _ticks + 220;
- int _ticks1 = _ticks;
-
- if (config.music) {
- setChannelVolume(_musicchannel, 0);
- pauseSoundChannel(_musicchannel);
-
- _menuchannel = playSound(_mmenu, true);
- setChannelVolume(_menuchannel, config.musicvol);
- _pmenu = true;
- }
-
- bool ldstop = false;
-
- float ld = 0;
- do {
- Common::Rect rc;
-
- ld += 4.0 * _fpsr;
- if (ld > config.musicvol)
- ld = config.musicvol;
- if (!ldstop) {
- setChannelVolume(_menuchannel, (int)ld);
- if ((int)ld == config.musicvol)
- ldstop = true;
- }
-
- rc.left = -xofs;
- rc.top = 0;
-
- _titleimg->blit(*_videobuffer, rc.left, rc.top);
-
- rc.left = -xofs + 320.0;
- rc.top = 0;
-
- _titleimg->blit(*_videobuffer, rc.left, rc.top);
-
- rc.left = 0;
- rc.top = 0;
-
- _titleimg2->blit(*_videobuffer, rc.left, rc.top);
-
- int y = 172;
- int x = 160 - 14 * 4;
-
- drawString(_videobuffer, "new game/save/load", x, y, 4);
- drawString(_videobuffer, "options", x, y + 16, 4);
- drawString(_videobuffer, "quit game", x, y + 32, 4);
-
- if (mode == 1)
- drawString(_videobuffer, "return", x, y + 48, 4);
- else
- drawString(_videobuffer, "(c) 2005 by Daniel 'Syn9' Kennedy", 28, 224, 4);
-
- rc.left = (float)(x - 16 - 4 * cos(3.14159 * 2 * _itemyloc / 16));
- rc.top = (float)(y - 4 + 16 * cursel);
-
- _itemimg[15]->blit(*_videobuffer, rc.left, rc.top);
-
- float yf = 255.0;
- if (_ticks < _ticks1 + 1000) {
- yf = 255.0 * ((float)(_ticks - _ticks1) / 1000.0);
- if (y < 0.0)
- yf = 0.0;
- if (y > 255.0)
- yf = 255.0;
- }
-
- _videobuffer->setAlpha((int)yf);
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
- g_system->updateScreen();
-
- _tickspassed = _ticks;
- _ticks = g_system->getMillis();
-
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24.0;
-
- _fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
- _fps = _fp;
- _fp = 0;
- }
-
- float add = 0.5 * _fpsr;
- if (add > 1)
- add = 1;
-
- xofs = xofs + add;
- if (xofs >= 320.0)
- xofs -= 320.0;
-
- _itemyloc += 0.75 * _fpsr;
-
- while (_itemyloc >= 16)
- _itemyloc = _itemyloc - 16;
-
- g_system->getEventManager()->pollEvent(_event);
-
- if (_event.type == Common::EVENT_QUIT)
- _shouldQuit = true;
-
- if (keypause < _ticks) {
- if (_event.type == Common::EVENT_KEYDOWN) {
- keypause = _ticks + 150;
-
- if (_event.kbd.keycode == Common::KEYCODE_ESCAPE && mode == 1)
- break;
- else if (_event.kbd.keycode == Common::KEYCODE_UP) {
- cursel--;
- if (cursel < 0)
- cursel = (mode == 1 ? 3 : 2);
- } else if (_event.kbd.keycode == Common::KEYCODE_DOWN) {
- cursel++;
- if (cursel >= (mode == 1 ? 4 : 3))
- cursel = 0;
- } else if (_event.kbd.keycode == Common::KEYCODE_RETURN) {
- if (cursel == 0) {
- saveLoadNew();
- _ticks = g_system->getMillis();
- keypause = _ticks + 150;
- _ticks1 = _ticks;
- } else if (cursel == 1) {
- configMenu();
- _ticks = g_system->getMillis();
- keypause = _ticks + 150;
- _ticks1 = _ticks;
- } else if (cursel == 2) {
- _shouldQuit = true;
- } else if (cursel == 3) {
- break;
- }
- }
- }
- }
-
- g_system->delayMillis(10);
- } while (!_shouldQuit);
-
- _itemticks = _ticks + 210;
-
- if (config.music) {
- haltSoundChannel(_menuchannel);
- resumeSoundChannel(_musicchannel);
- setChannelVolume(_musicchannel, config.musicvol);
- _pmenu = false;
- }
-}
-
void GriffonEngine::updateAnims() {
for (int i = 0; i <= _lastObj; i++) {
int nframes = _objectInfo[i][0];
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 411a278..66ad2df 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -292,13 +292,17 @@ private:
void endOfGame();
void theEnd();
+ // dialogs.cpp
+ void title(int mode);
+ void configMenu();
+ void saveLoadNew();
+
float RND();
void addFloatIcon(int ico, float xloc, float yloc);
void addFloatText(const char *stri, float xloc, float yloc, int col);
void checkInputs();
void checkTrigger();
- void configMenu();
void drawAnims(int Layer);
void drawHud();
void drawNPCs(int mode);
@@ -311,9 +315,7 @@ private:
void newGame();
void mainLoop();
void processTrigger(int trignum);
- void saveLoadNew();
void swash();
- void title(int mode);
void updateAnims();
void updateY();
void updateMusic();
diff --git a/engines/griffon/module.mk b/engines/griffon/module.mk
index ad322e9..9c2924b 100644
--- a/engines/griffon/module.mk
+++ b/engines/griffon/module.mk
@@ -5,6 +5,7 @@ MODULE_OBJS := \
config.o \
console.o \
cutscenes.o \
+ dialogs.o \
engine.o \
griffon.o \
detection.o \
Commit: f1c9e91381b730828dd916c2be5fd13469749d66
https://github.com/scummvm/scummvm/commit/f1c9e91381b730828dd916c2be5fd13469749d66
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Created draw.cpp
Changed paths:
A engines/griffon/draw.cpp
engines/griffon/engine.cpp
engines/griffon/griffon.h
engines/griffon/module.mk
diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp
new file mode 100644
index 0000000..fae2424
--- /dev/null
+++ b/engines/griffon/draw.cpp
@@ -0,0 +1,1288 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Originally written by Syn9 in FreeBASIC with SDL
+ * http://syn9.thehideoutgames.com/index_backup.php
+ *
+ * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
+ * http://github.com/dmitrysmagin/griffon_legend
+ *
+ *
+ * Programming/Graphics: Daniel "Syn9" Kennedy
+ * Music/Sound effects: David Turner
+ *
+ * Beta testing and gameplay design help:
+ * Deleter, Cha0s, Aether Fox, and Kiz
+ *
+ */
+
+#include "common/system.h"
+
+#include "griffon/griffon.h"
+#include "griffon/config.h"
+
+namespace Griffon {
+
+// map in inventory menu
+const int invmap[4][7][13] = {
+ // map 0
+ {
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 43, 44, 45, 46, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 3, 2, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 4, 5, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+ },
+ // map 1
+ {
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 19, 20, 21, 22, 0, 0, 0, 27, 0, 0, 0},
+ {0, 0, 16, 17, 18, 0, 0, 0, 29, 30, 31, 0, 0},
+ {0, 0, 12, 0, 13, 14, 0, 32, 33, 34, 35, 36, 0},
+ {0, 8, 7, 6, 9, 10, 0, 37, 38, 39, 40, 41, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+ },
+ // map 2
+ {
+ {0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 63, 64, 65, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 58, 59, 60, 61, 62, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 55, 56, 57, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 50, 51, 52, 53, 54, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 48, 47, 49, 0, 0, 0, 0, 0}
+ },
+
+ // map 3
+ {
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 79, 80, 81, 0, 74, 72, 0, 0, 0, 0},
+ {0, 0, 0, 78, 0, 0, 0, 73, 70, 69, 68, 0, 0},
+ {0, 0, 77, 76, 75, 0, 0, 0, 71, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+ }
+};
+
+
+void game_fillrect(Graphics::TransparentSurface *surface, int x, int y, int w, int h, int color) {
+ surface->fillRect(Common::Rect(x, y, x + w, y + h), color);
+}
+
+void GriffonEngine::drawAnims(int Layer) {
+ for (int sx = 0; sx <= 19; sx++) {
+ for (int sy = 0; sy <= 14; sy++) {
+ int o = _objectMap[sx][sy];
+
+ if (o > -1) {
+ int xtiles = _objectInfo[o][1];
+ int ytiles = _objectInfo[o][2];
+ int cframe = _objectFrame[o][1];
+
+ for (int x = 0; x <= xtiles - 1; x++) {
+ for (int y = 0; y <= ytiles - 1; y++) {
+ int x1 = (sx + x) * 16;
+ int y1 = (sy + y) * 16;
+
+ if (_objectTile[o][cframe][x][y][1] == Layer) {
+ int c = _objectTile[o][cframe][x][y][0];
+ c = c - 1;
+ int curtilel = 3;
+ int curtilex = c % 20;
+ int curtiley = (c - curtilex) / 20;
+
+ if (_curmap == 58 && _scriptflag[kScriptLever][0] > 0)
+ curtilex = 1;
+ if (_curmap == 54 && _scriptflag[kScriptLever][0] > 1)
+ curtilex = 1;
+ rcSrc.left = curtilex * 16;
+ rcSrc.top = curtiley * 16;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
+
+ rcDest.left = x1;
+ rcDest.top = y1;
+ rcDest.setWidth(16);
+ rcDest.setHeight(16);
+
+ _tiles[curtilel]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ }
+
+ if (Layer == 1) {
+ for (int l = 1; l <= 2; l++) {
+ int c = _tileinfo[l][sx + x][sy + y][0];
+ if (c > 0) {
+ int cl = _tileinfo[l][sx + x][sy + y][1];
+
+ c = c - 1;
+ int curtile = c;
+ int curtilel = cl;
+ int curtilex = c % 20;
+ int curtiley = (c - curtilex) / 20;
+
+ rcSrc.left = curtilex * 16;
+ rcSrc.top = curtiley * 16;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
+
+ rcDest.left = (sx + x) * 16;
+ rcDest.top = (sy + y) * 16;
+ rcDest.setWidth(16);
+ rcDest.setHeight(16);
+
+ int pass = 1;
+ if (curtilel == 1) {
+ for (int ff = 0; ff <= 5; ff++) {
+ int ffa = 20 * 5 - 1 + ff * 20;
+ int ffb = 20 * 5 + 4 + ff * 20;
+ if (curtile > ffa && curtile < ffb)
+ pass = 0;
+ }
+ }
+
+ if (pass == 1)
+ _tiles[curtilel]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+int hud_recalc(int a, int b, int c) {
+ int result = a * b / c;
+
+ return result > b ? b : result;
+}
+
+#define RGB(R, G, B) (_videobuffer->format.RGBToColor((R), (G), (B)))
+
+void GriffonEngine::drawHud() {
+ //sprintf(line, "_fps: %i, map: %i, exp: %i/%i", (int)_fps, _curmap, _player.exp, _player.nextlevel);
+ //drawString(_videobuffer, line, 0, 0, 0);
+
+ game_fillrect(_videobuffer2, 0, 0, 320, 240, 0);
+
+ for (int i = 0; i < kMaxFloat; i++) {
+ if (_floattext[i][0] > 0) {
+ int fc = (int)_floattext[i][3];
+ int c = fc, c2 = 3;
+
+ if (fc == 4)
+ c = 1;
+ else if (fc == 5)
+ c = 0;
+
+ if (fc == 1 || fc == 3)
+ c2 = 2;
+
+ if (fc != 0) {
+ drawString(_videobuffer, _floatstri[i], (int)(_floattext[i][1]) + 0, (int)(_floattext[i][2]) - 1, c2);
+ drawString(_videobuffer, _floatstri[i], (int)(_floattext[i][1]) + 0, (int)(_floattext[i][2]) + 1, c2);
+ drawString(_videobuffer, _floatstri[i], (int)(_floattext[i][1]) - 1, (int)(_floattext[i][2]) + 0, c2);
+ drawString(_videobuffer, _floatstri[i], (int)(_floattext[i][1]) + 1, (int)(_floattext[i][2]) + 0, c2);
+ }
+
+ drawString(_videobuffer, _floatstri[i], (int)(_floattext[i][1]), (int)(_floattext[i][2]), c);
+ }
+
+ if (_floaticon[i][0] > 0) {
+ int ico = _floaticon[i][3];
+ int ix = _floaticon[i][1];
+ int iy = _floaticon[i][2];
+
+ rcDest.left = ix;
+ rcDest.top = iy;
+
+ if (ico != 99)
+ _itemimg[ico]->blit(*_videobuffer, rcDest.left, rcDest.top);
+ if (ico == 99) {
+ _spellimg->setAlpha((int)(RND() * 96) + 96, true);
+
+ rcSrc.left = 16 * (int)(RND() * 2);
+ rcSrc.top = 80;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
+
+ rcDest.left = ix;
+ rcDest.top = iy;
+
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+
+ _spellimg->setAlpha(255, true);
+ }
+ }
+ }
+
+ if (_itemselon == 0) {
+ int sy = 211;
+
+
+ int nx = 19 * 8 + 13;
+ rcSrc.left = nx - 17 + 48;
+ rcSrc.top = sy;
+
+ // spells in game
+ if (_player.foundspell[0] == 1) {
+ for (int i = 0; i < 5; i++) {
+ rcSrc.left = rcSrc.left + 17;
+
+ if (_player.foundspell[i] == 1) {
+ _itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+
+ game_fillrect(_videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32));
+ game_fillrect(_videobuffer, rcSrc.left + 1, sy + 17,
+ hud_recalc(_player.spellcharge[i], 14, 100), 2,
+ ABS(_player.spellcharge[i] - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 224, 64));
+ }
+ }
+ }
+ return;
+ }
+
+ if (_selenemyon == 0) {
+ rcDest.left = 0;
+ rcDest.top = 0;
+ rcDest.right = 320;
+ rcDest.bottom = 240;
+ _videobuffer2->fillRect(rcDest, 0);
+ _videobuffer2->setAlpha((int)(_player.itemselshade * 4)); // FIXME
+ _videobuffer2->blit(*_videobuffer);
+
+ int sy = 202;
+ rcSrc.left = 46;
+ rcSrc.top = 46;
+
+ _inventoryimg->setAlpha(160, true); // 128
+ _inventoryimg->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _inventoryimg->setAlpha(255, true);
+
+ int sx = 54;
+ sy = 55;
+
+ // draw map 9,77
+ rcDest.left = 46 + 9;
+ rcDest.top = 46 + 77;
+
+ int amap = 0;
+ if (_curmap > 46)
+ amap = 2;
+ if (_curmap > 67)
+ amap = 3;
+ if (_curmap > 5 && _curmap < 42)
+ amap = 1;
+ mapimg[amap]->blit(*_videobuffer, rcDest.left, rcDest.top);
+
+ long ccc = _videobuffer->format.RGBToColor(128 + 127 * sin(3.141592 * 2 * _itemyloc / 16), 0, 0);
+
+ for (int b = 0; b <= 6; b++) {
+ for (int a = 0; a <= 12; a++) {
+ if (invmap[amap][b][a] == _curmap) {
+ game_fillrect(_videobuffer, 46 + 9 + a * 9 + 2, 46 + 77 + b * 9 + 1, 6, 6, ccc);
+ }
+ }
+ }
+
+ if (amap == 1) {
+ drawString(_videobuffer, "L1", 46 + 9, 46 + 77, 0);
+ drawString(_videobuffer, "L2", 46 + 9 + 7 * 9, 46 + 77, 0);
+ }
+
+ char line[128];
+ sprintf(line, "Health: %i/%i", _player.hp, _player.maxhp);
+ drawString(_videobuffer, line, sx, sy, _player.hp <= _player.maxhp * 0.25 ? (int)_player.hpflash : 0);
+
+ sprintf(line, "Level : %i", _player.level);
+ if (_player.level == _player.maxlevel)
+ strcpy(line, "Level : MAX");
+ drawString(_videobuffer, line, sx, sy + 8, 0);
+
+ // experience
+ game_fillrect(_videobuffer, sx + 64, sy + 16, 16, 4, RGB(0, 32, 32));
+ game_fillrect(_videobuffer, sx + 65, sy + 17,
+ hud_recalc(_player.exp, 14, _player.nextlevel), 2, RGB(0, 224, 64));
+
+ // attack strength
+ game_fillrect(_videobuffer, sx + 1, sy + 16, 56, 6, RGB(0, 32, 32));
+ game_fillrect(_videobuffer, sx + 1, sy + 17,
+ hud_recalc(_player.attackstrength, 54, 100), 2,
+ ABS(_player.attackstrength - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 64, 224));
+
+ // spell strength
+ game_fillrect(_videobuffer, sx + 1, sy + 19,
+ hud_recalc(_player.spellstrength, 54, 100), 2,
+ ABS(_player.spellstrength - 100) < kEpsilon ? RGB(224, 0, 0) : RGB(128, 0, 224));
+
+ // time
+ int ase = _secstart + _secsingame;
+ int h = ((ase - (ase % 3600)) / 3600);
+ ase = (ase - h * 3600);
+ int m = ((ase - (ase % 60)) / 60);
+ int s = (ase - m * 60);
+
+ sprintf(line, "%02i:%02i:%02i", h, m, s);
+ drawString(_videobuffer, line, 46 + 38 - strlen(line) * 4, 46 + 49, 0);
+
+ drawString(_videobuffer, "Use", 193, 55, 0);
+ drawString(_videobuffer, "Cast", 236, 55, 0);
+
+ rcSrc.left = 128;
+ rcSrc.top = 91;
+
+ int ss = (_player.sword - 1) * 3;
+ if (_player.sword == 3)
+ ss = 18;
+ _itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+
+ rcSrc.left = rcSrc.left + 16;
+ ss = (_player.shield - 1) * 3 + 1;
+ if (_player.shield == 3)
+ ss = 19;
+ _itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+
+ rcSrc.left = rcSrc.left + 16;
+ ss = (_player.armour - 1) * 3 + 2;
+ if (_player.armour == 3)
+ ss = 20;
+ _itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+
+ for (int i = 0; i <= 4; i++) {
+ sx = 188;
+ sy = 70 + i * 24;
+ rcSrc.left = sx;
+ rcSrc.top = sy;
+ if (i == 0)
+ _itemimg[6]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ if (i == 1)
+ _itemimg[12]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ if (i == 2)
+ _itemimg[17]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ if (i == 3)
+ _itemimg[16]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ if (i == 4)
+ _itemimg[14]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+
+ sprintf(line, "x%i", _player.inventory[i]);
+ drawString(_videobuffer, line, sx + 17, sy + 7, 0);
+ }
+
+ // spells in menu
+ if (_player.foundspell[0] == 1) {
+ for (int i = 0; i < 5; i++) {
+ rcSrc.left = 243;
+ rcSrc.top = 67 + i * 24;
+ sy = rcSrc.top;
+
+ if (_player.foundspell[i] == 1) {
+ _itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+
+ game_fillrect(_videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32));
+ game_fillrect(_videobuffer, rcSrc.left + 1, sy + 17,
+ hud_recalc(_player.spellcharge[i], 14, 100), 2,
+ ABS(_player.spellcharge[i] - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 224, 64));
+ }
+ }
+ }
+
+ if (_itemselon == 1) {
+ for (int i = 0; i <= 4; i++) {
+ if (_curitem == 5 + i) {
+ rcDest.left = (float)(243 - 12 + 3 * sin(3.141592 * 2 * _itemyloc / 16));
+ rcDest.top = 67 + 24 * i;
+ _itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
+ }
+
+ if (_curitem == i) {
+ rcDest.left = (float)(189 - 12 + 3 * sin(3.141592 * 2 * _itemyloc / 16));
+ rcDest.top = 70 + 24 * i;
+ _itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
+ }
+ }
+ }
+ }
+
+ if (_selenemyon == 1) {
+ if (_curenemy > _lastnpc) {
+ int pst = _curenemy - _lastnpc - 1;
+ rcDest.left = postinfo[pst][0];
+ rcDest.top = (float)(postinfo[pst][1] - 4 - sin(3.141592 / 8 * _itemyloc));
+ } else {
+ rcDest.left = _npcinfo[_curenemy].x + 4;
+ rcDest.top = (float)(_npcinfo[_curenemy].y + 4 - 16 - sin(3.141592 / 8 * _itemyloc));
+ }
+
+ _itemimg[13]->blit(*_videobuffer, rcDest.left, rcDest.top);
+ }
+}
+
+void GriffonEngine::drawNPCs(int mode) {
+ unsigned int ccc = _videobuffer->format.RGBToColor(255, 128, 32);
+ int fst = _firsty;
+ int lst = _lasty;
+
+ if (mode == 0)
+ lst = _player.ysort;
+ if (mode == 1)
+ fst = _player.ysort;
+
+ for (int yy = fst; yy <= lst; yy++) {
+
+ if (_ysort[yy] > 0) {
+ int i = _ysort[yy];
+
+ if (_npcinfo[i].hp > 0) {
+ int npx = (int)(_npcinfo[i].x);
+ int npy = (int)(_npcinfo[i].y);
+
+ int sprite = _npcinfo[i].spriteset;
+
+ int wdir = _npcinfo[i].walkdir;
+
+ // spriteset1 specific
+ if (_npcinfo[i].spriteset == 1) {
+
+ if (_npcinfo[i].attacking == 0) {
+
+ int cframe = _npcinfo[i].cframe;
+
+ rcSrc.left = (int)(cframe / 4) * 24;
+ rcSrc.top = wdir * 24;
+ rcSrc.setWidth(24);
+ rcSrc.setHeight(24);
+
+ rcDest.left = npx;
+ rcDest.top = npy;
+ rcDest.setWidth(24);
+ rcDest.setHeight(24);
+
+ if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
+ _npcinfo[i].shake = _ticks + 50;
+ rcDest.left += (int)(RND() * 3) - 1;
+ rcDest.top += (int)(RND() * 3) - 1;
+ }
+
+ _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ } else {
+ int cframe = _npcinfo[i].cattackframe;
+
+ rcSrc.left = (int)(cframe / 4) * 24;
+ rcSrc.top = wdir * 24;
+ rcSrc.setWidth(24);
+ rcSrc.setHeight(24);
+
+ rcDest.left = npx;
+ rcDest.top = npy;
+ rcDest.setWidth(24);
+ rcDest.setHeight(24);
+
+ _animsa[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ }
+
+ }
+
+ // onewing
+ if (_npcinfo[i].spriteset == 2) {
+ for (int f = 0; f <= 7; f++) {
+ int s = _npcinfo[i].bodysection[f].sprite;
+ rcSrc.left = _animset2[s].x;
+ rcSrc.top = _animset2[s].y;
+ rcSrc.setWidth(_animset2[s].w);
+ rcSrc.setHeight(_animset2[s].h);
+
+ rcDest.left = _npcinfo[i].bodysection[f].x - _animset2[s].xofs;
+ rcDest.top = _npcinfo[i].bodysection[f].y - _animset2[s].yofs + 2;
+
+ _anims[2]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ }
+
+ }
+
+ // twowing
+ if (_npcinfo[i].spriteset == 9) {
+ for (int f = 0; f <= 7; f++) {
+ int yp = 0;
+
+ if (f == 0 && (_curmap == 53 || _curmap == 57 || _curmap == 61 || _curmap == 65 || _curmap == 56 || _curmap > 66) && _scriptflag[kScriptLever][0] > 0)
+ yp = 16;
+ int s = _npcinfo[i].bodysection[f].sprite;
+ rcSrc.left = _animset9[s].x;
+ rcSrc.top = _animset9[s].y + yp;
+ rcSrc.setWidth(_animset9[s].w);
+ rcSrc.setHeight(_animset9[s].h);
+
+ rcDest.left = _npcinfo[i].bodysection[f].x - _animset9[s].xofs;
+ rcDest.top = _npcinfo[i].bodysection[f].y - _animset9[s].yofs + 2;
+
+ _anims[9]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ }
+
+ }
+
+
+ // boss 1
+ if (_npcinfo[i].spriteset == 3) {
+ if (_npcinfo[i].attacking == 0) {
+ int cframe = _npcinfo[i].cframe;
+
+ rcSrc.left = (int)(cframe / 4) * 24;
+ rcSrc.top = 0;
+ rcSrc.setWidth(24);
+ rcSrc.setHeight(48);
+
+ rcDest.left = npx - 2;
+ rcDest.top = npy - 24;
+
+ _anims[3]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ } else {
+ rcSrc.left = 4 * 24;
+ rcSrc.top = 0;
+ rcSrc.setWidth(24);
+ rcSrc.setHeight(48);
+
+ rcDest.left = npx - 2;
+ rcDest.top = npy - 24;
+
+ _anims[3]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ }
+
+ }
+
+ // black knight
+ if (_npcinfo[i].spriteset == 4) {
+ if (_npcinfo[i].attacking == 0) {
+ int cframe = _npcinfo[i].cframe;
+
+ rcSrc.left = (int)(cframe / 4) * 24;
+ rcSrc.top = 0;
+ rcSrc.setWidth(24);
+ rcSrc.setHeight(48);
+
+ rcDest.left = npx - 2;
+ rcDest.top = npy - 24;
+
+ _anims[4]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ } else {
+ rcSrc.left = 4 * 24;
+ rcSrc.top = 0;
+ rcSrc.setWidth(24);
+ rcSrc.setHeight(48);
+
+ rcDest.left = npx - 2;
+ rcDest.top = npy - 24;
+
+ _anims[4]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ }
+ }
+
+
+ // firehydra
+ if (_npcinfo[i].spriteset == 5) {
+ for (int ff = 0; ff <= 2; ff++) {
+ if (_npcinfo[i].hp > 10 * ff * 20) {
+ rcSrc.left = 16 * (int)(RND() * 2);
+ rcSrc.top = 80;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
+
+ rcDest.left = _npcinfo[i].bodysection[10 * ff].x - 8;
+ rcDest.top = _npcinfo[i].bodysection[10 * ff].y - 8;
+
+ int x = 192 + ((int)(_itemyloc + ff * 5) % 3) * 64;
+ if (x > 255)
+ x = 255;
+ _spellimg->setAlpha(x, true);
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellimg->setAlpha(255, true);
+
+ for (int f = 1; f <= 8; f++) {
+ rcSrc.left = 16 * (int)(RND() * 2);
+ rcSrc.top = 80;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
+
+ rcDest.left = _npcinfo[i].bodysection[ff * 10 + f].x - 8 + (int)(RND() * 3) - 1;
+ rcDest.top = _npcinfo[i].bodysection[ff * 10 + f].y - 8 + (int)(RND() * 3) - 1;
+
+ x = 192 + f % 3 * 64;
+ if (x > 255)
+ x = 255;
+ _spellimg->setAlpha(x, true);
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellimg->setAlpha(255, true);
+ }
+
+ rcSrc.left = 0;
+ rcSrc.top = 0;
+ rcSrc.setWidth(42);
+ rcSrc.setHeight(36);
+
+ rcDest.left = _npcinfo[i].bodysection[10 * ff + 9].x - 21;
+ rcDest.top = _npcinfo[i].bodysection[10 * ff + 9].y - 21;
+
+ _spellimg->setAlpha(192, true);
+ _anims[5]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellimg->setAlpha(255, true);
+ }
+
+ }
+
+ }
+
+ // red dragon
+ if (_npcinfo[i].spriteset == 6) {
+ int cframe = _npcinfo[i].cframe;
+
+ rcSrc.left = (int)(cframe / 4) * 24;
+ rcSrc.top = wdir * 24;
+ rcSrc.setWidth(24);
+ rcSrc.setHeight(24);
+
+ rcDest.left = npx;
+ rcDest.top = npy;
+ rcDest.setWidth(24);
+ rcDest.setHeight(24);
+
+ if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
+ _npcinfo[i].shake = _ticks + 50;
+ rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
+ rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
+ }
+
+ _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ }
+
+ // wizard
+ if (_npcinfo[i].spriteset == 7) {
+ // if(_npcinfo[i].attacking == 0) {
+ int cframe = _npcinfo[i].cframe;
+
+ rcSrc.left = (int)(cframe / 4) * 24;
+ rcSrc.top = wdir * 24;
+ rcSrc.setWidth(24);
+ rcSrc.setHeight(24);
+
+ rcDest.left = npx;
+ rcDest.top = npy;
+ rcDest.setWidth(24);
+ rcDest.setHeight(24);
+
+ if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
+ _npcinfo[i].shake = _ticks + 50;
+ rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
+ rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
+ }
+ _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ // } else {
+ //cframe = _npcinfo[i].cattackframe;
+
+ //rcSrc.left = (int)(cframe / 4) * 24;
+ //rcSrc.top = wdir * 24;
+ //rcSrc.setWidth(24);
+ //rcSrc.setHeight(24);
+
+ //rcDest.left = npx;
+ //rcDest.top = npy;
+ //rcDest.setWidth(24);
+ //rcDest.setHeight(24);
+ // _animsa(sprite)->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ // }
+ }
+
+
+ // yellow dragon
+ if (_npcinfo[i].spriteset == 8) {
+ int cframe = _npcinfo[i].cframe;
+
+ rcSrc.left = (int)(cframe / 4) * 24;
+ rcSrc.top = wdir * 24;
+ rcSrc.setWidth(24);
+ rcSrc.setHeight(24);
+
+ rcDest.left = npx;
+ rcDest.top = npy;
+ rcDest.setWidth(24);
+ rcDest.setHeight(24);
+
+ if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
+ _npcinfo[i].shake = _ticks + 50;
+ rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
+ rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
+ }
+ _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ }
+
+
+ // dragon2
+ if (_npcinfo[i].spriteset == 10) {
+ if (_npcinfo[i].attacking == 0) {
+ _npcinfo[i].floating = _npcinfo[i].floating + 0.25 * _fpsr;
+ while (_npcinfo[i].floating >= 16)
+ _npcinfo[i].floating = _npcinfo[i].floating - 16;
+
+ float frame = _npcinfo[i].frame;
+ int cframe = _npcinfo[i].cframe;
+
+ frame = frame + 0.5 * _fpsr;
+ while (frame >= 16)
+ frame = frame - 16;
+
+ cframe = (int)(frame);
+ if (cframe > 16)
+ cframe = 16 - 1;
+ if (cframe < 0)
+ cframe = 0;
+
+ _npcinfo[i].frame = frame;
+ _npcinfo[i].cframe = cframe;
+
+ cframe = _npcinfo[i].cframe;
+
+ rcSrc.left = 74 * wdir;
+ rcSrc.top = (int)(cframe / 4) * 48;
+ rcSrc.setWidth(74);
+ rcSrc.setHeight(48);
+
+ rcDest.left = npx + 12 - 37;
+ rcDest.top = (float)(npy + 12 - 32 - 3 * sin(3.141592 * 2 * _npcinfo[i].floating / 16));
+ rcDest.setWidth(24);
+ rcDest.setHeight(24);
+
+ if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
+ _npcinfo[i].shake = _ticks + 50;
+ rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
+ rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
+ }
+
+ _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ } else {
+ _npcinfo[i].floating = _npcinfo[i].floating + 0.25 * _fpsr;
+ while (_npcinfo[i].floating >= 16)
+ _npcinfo[i].floating = _npcinfo[i].floating - 16;
+
+ int cframe = _npcinfo[i].cattackframe;
+
+ rcSrc.left = 74 * wdir;
+ rcSrc.top = (int)(cframe / 4) * 48;
+ rcSrc.setWidth(74);
+ rcSrc.setHeight(48);
+
+ rcDest.left = npx + 12 - 37;
+ rcDest.top = (float)(npy + 12 - 32 - 3 * sin(3.141592 * 2 * _npcinfo[i].floating / 16));
+ rcDest.setWidth(24);
+ rcDest.setHeight(24);
+
+ _animsa[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ }
+ }
+
+ // end boss
+ if (_npcinfo[i].spriteset == 11) {
+
+ _npcinfo[i].floating = _npcinfo[i].floating + .3 * _fpsr;
+ while (_npcinfo[i].floating >= 16)
+ _npcinfo[i].floating = _npcinfo[i].floating - 16;
+
+
+ float frame = _npcinfo[i].frame2;
+
+ frame = frame + 0.5 * _fpsr;
+ while (frame >= 16)
+ frame = frame - 16;
+
+ _npcinfo[i].frame2 = frame;
+
+ int sx = npx + 12 - 40;
+ int sy = (float)(npy + 12 - 50 - 3 * sin(3.141592 * 2 * _npcinfo[i].floating / 16));
+
+ for (int fr = 0; fr <= 3; fr++) {
+ _spellimg->setAlpha(128 + (int)(RND() * 96), true);
+
+ rcSrc.left = 16 * (int)(RND() * 2);
+ rcSrc.top = 80;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
+
+ rcDest.left = sx + 32 + (int)(RND() * 3) - 1;
+ rcDest.top = sy - (int)(RND() * 6);
+
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ }
+
+ for (int ii = 0; ii <= 8; ii++) {
+ for (int i2 = 0; i2 <= 3; i2++) {
+ rcSrc.left = 16 * (int)(RND() * 2);
+ rcSrc.top = 80;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
+
+ float fr3 = frame - 3 + i2;
+ if (fr3 < 0)
+ fr3 = fr3 + 16;
+
+ rcDest.left = (float)(sx + 36 + ii * 8 - ii * cos(3.14159 * 2 * (fr3 - ii) / 16) * 2);
+ rcDest.top = (float)(sy + 16 + ii * sin(3.14159 * 2 * (fr3 - ii) / 16) * 3 - ii); // * 4
+
+ _spellimg->setAlpha(i2 / 3 * 224, true);
+
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+
+ int xloc = rcDest.left;
+ int yloc = rcDest.top;
+ int xdif = (xloc + 8) - (_player.px + 12);
+ int ydif = (yloc + 8) - (_player.py + 12);
+
+ if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
+ float damage = (float)_npcinfo[i].spelldamage * (1.0 + RND() * 0.5);
+
+ if (_player.hp > 0) {
+ damagePlayer(damage);
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndFire]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+ }
+
+ }
+
+
+ rcDest.left = (float)(sx + 36 - ii * 8 + ii * cos(3.14159 * 2 * (fr3 - ii) / 16) * 2);
+ rcDest.top = (float)(sy + 16 + ii * sin(3.14159 * 2 * (fr3 - ii) / 16) * 3 - ii); // * 4
+
+ _spellimg->setAlpha(i2 / 3 * 224, true);
+
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+
+ xloc = rcDest.left;
+ yloc = rcDest.top;
+ xdif = (xloc + 8) - (_player.px + 12);
+ ydif = (yloc + 8) - (_player.py + 12);
+
+ if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
+ float damage = (float)_npcinfo[i].spelldamage * (1.0 + RND() * 0.5);
+
+ if (_player.hp > 0) {
+ damagePlayer(damage);
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndFire]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+ }
+ }
+ }
+ }
+
+ _spellimg->setAlpha(255, true);
+
+ if (_npcinfo[i].attacking == 0) {
+ int cframe = (int)(frame);
+ rcSrc.left = 0;
+ rcSrc.top = 72 * (int)(cframe / 4);
+ rcSrc.setWidth(80);
+ rcSrc.setHeight(72);
+
+ rcDest.left = sx;
+ rcDest.top = sy;
+
+ if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
+ _npcinfo[i].shake = _ticks + 50;
+ rcDest.left = rcDest.top + (int)(RND() * 3) - 1;
+ rcDest.left = rcDest.top + (int)(RND() * 3) - 1;
+ }
+
+ _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ } else {
+ int cframe = (int)(_npcinfo[i].cattackframe);
+
+ rcSrc.left = 0;
+ rcSrc.top = 72 * (int)(cframe / 4);
+ rcSrc.setWidth(80);
+ rcSrc.setHeight(72);
+
+ rcDest.left = sx;
+ rcDest.top = sy;
+
+ _animsa[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ }
+ }
+
+ // bat kitty
+ if (_npcinfo[i].spriteset == 12) {
+ _npcinfo[i].floating = _npcinfo[i].floating + 1 * _fpsr;
+ while (_npcinfo[i].floating >= 16)
+ _npcinfo[i].floating = _npcinfo[i].floating - 16;
+
+ float frame = _npcinfo[i].frame;
+ int cframe = _npcinfo[i].cframe;
+
+ frame = frame + 0.5 * _fpsr;
+ while (frame >= 16)
+ frame = frame - 16;
+
+ cframe = (int)(frame);
+ if (cframe > 16)
+ cframe = 16 - 1;
+ if (cframe < 0)
+ cframe = 0;
+
+ _npcinfo[i].frame = frame;
+ _npcinfo[i].cframe = cframe;
+
+ cframe = _npcinfo[i].cframe;
+
+ rcSrc.left = 0;
+ rcSrc.top = 0;
+ rcSrc.setWidth(99);
+ rcSrc.setHeight(80);
+
+ rcDest.left = npx + 12 - 50;
+ rcDest.top = (float)(npy + 12 - 64 + 2 * sin(3.141592 * 2 * _npcinfo[i].floating / 16));
+ rcDest.setWidth(99);
+ rcDest.setHeight(80);
+
+ if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
+ _npcinfo[i].shake = _ticks + 50;
+ rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
+ rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
+ }
+
+ _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ }
+
+ rcDest.left = npx + 4;
+ rcDest.top = npy + 22;
+ rcDest.setWidth(16);
+ rcDest.setHeight(4);
+
+ _videobuffer->fillRect(rcDest, 0);
+
+ rcDest.left = npx + 5;
+ rcDest.top = npy + 23;
+
+
+ int ww = 14 * _npcinfo[i].hp / _npcinfo[i].maxhp;
+ if (ww > 14)
+ ww = 14;
+ if (ww < 1)
+ ww = 1;
+
+ rcDest.setWidth(ww);
+ rcDest.setHeight(2);
+
+
+ _videobuffer->fillRect(rcDest, ccc);
+
+ int pass = 1;
+
+ if (_npcinfo[i].spriteset == 3)
+ pass = 0;
+ if (pass == 1)
+ drawOver(npx, npy);
+
+ }
+ }
+ }
+}
+
+void GriffonEngine::drawOver(int modx, int mody) {
+ int npx = modx + 12;
+ int npy = mody + 20;
+
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
+
+ for (int xo = -1; xo <= 1; xo++) {
+ for (int yo = -1; yo <= 1; yo++) {
+
+ int sx = lx + xo;
+ int sy = ly + yo;
+
+ int sx2 = sx * 16;
+ int sy2 = sy * 16;
+
+ if (sx > -1 && sx < 40 && sy > -1 && sy < 24) {
+
+ int curtile = _tileinfo[2][sx][sy][0];
+ int curtilel = _tileinfo[2][sx][sy][1];
+
+ if (curtile > 0) {
+ curtile = curtile - 1;
+ int curtilex = curtile % 20;
+ int curtiley = (curtile - curtilex) / 20;
+
+ rcSrc.left = curtilex * 16;
+ rcSrc.top = curtiley * 16;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
+
+ rcDest.left = sx2;
+ rcDest.top = sy2;
+ rcDest.setWidth(16);
+ rcDest.setHeight(16);
+
+ int pass = 1;
+ if (curtilel == 1) {
+ for (int ff = 0; ff <= 5; ff++) {
+ int ffa = 20 * 5 - 1 + ff * 20;
+ int ffb = 20 * 5 + 4 + ff * 20;
+ if (curtile > ffa && curtile < ffb)
+ pass = 0;
+ }
+ }
+
+ if (pass == 1)
+ _tiles[curtilel]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ }
+ }
+ }
+ }
+}
+
+void GriffonEngine::drawPlayer() {
+ int f = 0;
+ if (_player.armour == 3)
+ f = 13;
+
+ if (!attacking) {
+ rcSrc.left = (int)(_player.walkframe / 4) * 24;
+ rcSrc.top = _player.walkdir * 24;
+ rcSrc.setWidth(24);
+ rcSrc.setHeight(24);
+
+ rcDest.left = (int)(_player.px);
+ rcDest.top = (int)(_player.py);
+ rcDest.setWidth(24);
+ rcDest.setHeight(24);
+
+ _anims[f]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ } else {
+ rcSrc.left = (int)(_player.attackframe / 4) * 24;
+ rcSrc.top = _player.walkdir * 24;
+ rcSrc.setWidth(24);
+ rcSrc.setHeight(24);
+
+ rcDest.left = (int)(_player.px);
+ rcDest.top = (int)(_player.py);
+ rcDest.setWidth(24);
+ rcDest.setHeight(24);
+
+ _animsa[f]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+
+ }
+
+ long ccc = _videobuffer->format.RGBToColor(224, 224, 64);
+
+ int pass = 0;
+ if (_player.hp <= _player.maxhp * 0.25)
+ pass = 1;
+
+ if (pass == 1) {
+ ccc = _videobuffer->format.RGBToColor(255, 255, 255);
+ if ((int)(_player.hpflash) == 1)
+ ccc = _videobuffer->format.RGBToColor(255, 0, 0);
+ }
+
+ int sss = 6;
+ if (_player.foundspell[0])
+ sss = 8;
+ int npx = _player.px;
+ int npy = _player.py;
+ rcDest.left = npx + 4;
+ rcDest.top = npy + 22;
+ rcDest.setWidth(16);
+ rcDest.setHeight(sss);
+
+ _videobuffer->fillRect(rcDest, 0);
+
+ rcDest.left = npx + 5;
+ rcDest.top = npy + 23;
+
+
+ int ww = 14 * _player.hp / _player.maxhp;
+ if (ww > 14)
+ ww = 14;
+ if (ww < 1)
+ ww = 1;
+
+ rcDest.setWidth(ww);
+ rcDest.setHeight(2);
+
+ _videobuffer->fillRect(rcDest, ccc);
+
+ ccc = _videobuffer->format.RGBToColor(0, 224, 64);
+ if (ABS(_player.attackstrength - 100) < kEpsilon)
+ ccc = _videobuffer->format.RGBToColor(255, 128, 32);
+
+ ww = 14 * _player.attackstrength / 100;
+ if (ww > 14)
+ ww = 14;
+
+ int ww2 = 14 * _player.spellstrength / 100;
+ if (ww2 > 14)
+ ww2 = 14;
+
+ rcDest.top = rcDest.top + 2;
+ rcDest.setWidth(ww);
+ rcDest.setHeight(2);
+
+ _videobuffer->fillRect(rcDest, ccc);
+
+ ccc = _videobuffer->format.RGBToColor(128, 0, 224);
+ if (ABS(_player.spellstrength - 100) < kEpsilon)
+ ccc = _videobuffer->format.RGBToColor(224, 0, 0);
+
+ rcDest.top = rcDest.top + 2;
+ rcDest.setWidth(ww2);
+ rcDest.setHeight(2);
+
+ _videobuffer->fillRect(rcDest, ccc);
+}
+
+void GriffonEngine::drawView() {
+ _videobuffer->copyRectToSurface(_mapbg->getPixels(), _mapbg->pitch, 0, 0, _mapbg->w, _mapbg->h);
+
+ updateSpellsUnder();
+
+ drawAnims(0);
+
+ // ------dontdrawover = special case to make boss work right in room 24
+ if (dontdrawover == 1)
+ drawAnims(1);
+ drawNPCs(0);
+
+ drawPlayer();
+
+ drawNPCs(1);
+ if (dontdrawover == 0)
+ drawAnims(1);
+
+ drawOver((int)_player.px, (int)_player.py);
+
+ updateSpells();
+
+ if (cloudson == 1) {
+ Common::Rect rc;
+ rc.left = (float)(256 + 256 * cos(3.141592 / 180 * clouddeg));
+ rc.top = (float)(192 + 192 * sin(3.141592 / 180 * clouddeg));
+ rc.setWidth(320);
+ rc.setHeight(240);
+
+ cloudimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, &rc);
+ }
+
+ drawHud();
+
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+}
+
+void GriffonEngine::swash() {
+ float y;
+
+ y = 0;
+
+ do {
+ y = y + 1 * _fpsr;
+
+ _videobuffer->setAlpha((int)y);
+ _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
+
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ g_system->updateScreen();
+
+ g_system->getEventManager()->pollEvent(_event);
+ g_system->delayMillis(10);
+
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
+
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24.0;
+
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
+ }
+
+ clouddeg += 0.01 * _fpsr;
+ while (clouddeg >= 360)
+ clouddeg = clouddeg - 360;
+
+ if (y > 10)
+ break;
+ } while (1);
+
+ y = 0;
+ do {
+ y = y + 1 * _fpsr;
+
+ _videobuffer->setAlpha((int)(y * 25));
+ _mapbg->blit(*_videobuffer);
+
+ if (cloudson == 1) {
+ rcDest.left = (float)(256 + 256 * cos(3.141592 / 180 * clouddeg));
+ rcDest.top = (float)(192 + 192 * sin(3.141592 / 180 * clouddeg));
+ rcDest.setWidth(320);
+ rcDest.setHeight(240);
+
+ cloudimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
+ }
+
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ g_system->updateScreen();
+
+ g_system->getEventManager()->pollEvent(_event);
+ g_system->delayMillis(10);
+
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
+
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24.0;
+
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
+ }
+
+ clouddeg += 0.01 * _fpsr;
+ while (clouddeg >= 360)
+ clouddeg = clouddeg - 360;
+
+ if (y > 10)
+ break;
+ } while (1);
+
+
+ _videobuffer->setAlpha(255);
+}
+
+
+} // end of namespace Griffon
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 69bb423..79e564f 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -93,51 +93,6 @@ const int elementmap[15][20] = {
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
};
-// map in inventory menu
-const int invmap[4][7][13] = {
- // map 0
- {
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 43, 44, 45, 46, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 3, 2, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 4, 5, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
- },
- // map 1
- {
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 19, 20, 21, 22, 0, 0, 0, 27, 0, 0, 0},
- {0, 0, 16, 17, 18, 0, 0, 0, 29, 30, 31, 0, 0},
- {0, 0, 12, 0, 13, 14, 0, 32, 33, 34, 35, 36, 0},
- {0, 8, 7, 6, 9, 10, 0, 37, 38, 39, 40, 41, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
- },
- // map 2
- {
- {0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 63, 64, 65, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 58, 59, 60, 61, 62, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 55, 56, 57, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 50, 51, 52, 53, 54, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 48, 47, 49, 0, 0, 0, 0, 0}
- },
-
- // map 3
- {
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 79, 80, 81, 0, 74, 72, 0, 0, 0, 0},
- {0, 0, 0, 78, 0, 0, 0, 73, 70, 69, 68, 0, 0},
- {0, 0, 77, 76, 75, 0, 0, 0, 71, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
- }
-};
-
// HELPER MACRO ---------------------------------------------------------------
#define INPUT(A, B) \
do { \
@@ -148,10 +103,6 @@ const int invmap[4][7][13] = {
// CODE GOES HERE -------------------------------------------------------------
-void game_fillrect(Graphics::TransparentSurface *surface, int x, int y, int w, int h, int color) {
- surface->fillRect(Common::Rect(x, y, x + w, y + h), color);
-}
-
Graphics::TransparentSurface *GriffonEngine::loadImage(const char *name, bool colorkey) {
Common::File file;
@@ -519,1114 +470,6 @@ void GriffonEngine::checkTrigger() {
processTrigger(_triggerloc[lx][ly]);
}
-void GriffonEngine::drawAnims(int Layer) {
- for (int sx = 0; sx <= 19; sx++) {
- for (int sy = 0; sy <= 14; sy++) {
- int o = _objectMap[sx][sy];
-
- if (o > -1) {
- int xtiles = _objectInfo[o][1];
- int ytiles = _objectInfo[o][2];
- int cframe = _objectFrame[o][1];
-
- for (int x = 0; x <= xtiles - 1; x++) {
- for (int y = 0; y <= ytiles - 1; y++) {
- int x1 = (sx + x) * 16;
- int y1 = (sy + y) * 16;
-
- if (_objectTile[o][cframe][x][y][1] == Layer) {
- int c = _objectTile[o][cframe][x][y][0];
- c = c - 1;
- int curtilel = 3;
- int curtilex = c % 20;
- int curtiley = (c - curtilex) / 20;
-
- if (_curmap == 58 && _scriptflag[kScriptLever][0] > 0)
- curtilex = 1;
- if (_curmap == 54 && _scriptflag[kScriptLever][0] > 1)
- curtilex = 1;
- rcSrc.left = curtilex * 16;
- rcSrc.top = curtiley * 16;
- rcSrc.setWidth(16);
- rcSrc.setHeight(16);
-
- rcDest.left = x1;
- rcDest.top = y1;
- rcDest.setWidth(16);
- rcDest.setHeight(16);
-
- _tiles[curtilel]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- }
-
- if (Layer == 1) {
- for (int l = 1; l <= 2; l++) {
- int c = _tileinfo[l][sx + x][sy + y][0];
- if (c > 0) {
- int cl = _tileinfo[l][sx + x][sy + y][1];
-
- c = c - 1;
- int curtile = c;
- int curtilel = cl;
- int curtilex = c % 20;
- int curtiley = (c - curtilex) / 20;
-
- rcSrc.left = curtilex * 16;
- rcSrc.top = curtiley * 16;
- rcSrc.setWidth(16);
- rcSrc.setHeight(16);
-
- rcDest.left = (sx + x) * 16;
- rcDest.top = (sy + y) * 16;
- rcDest.setWidth(16);
- rcDest.setHeight(16);
-
- int pass = 1;
- if (curtilel == 1) {
- for (int ff = 0; ff <= 5; ff++) {
- int ffa = 20 * 5 - 1 + ff * 20;
- int ffb = 20 * 5 + 4 + ff * 20;
- if (curtile > ffa && curtile < ffb)
- pass = 0;
- }
- }
-
- if (pass == 1)
- _tiles[curtilel]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- }
- }
- }
- }
- }
- }
- }
- }
-}
-
-int hud_recalc(int a, int b, int c) {
- int result = a * b / c;
-
- return result > b ? b : result;
-}
-
-#define RGB(R, G, B) (_videobuffer->format.RGBToColor((R), (G), (B)))
-
-void GriffonEngine::drawHud() {
- //sprintf(line, "_fps: %i, map: %i, exp: %i/%i", (int)_fps, _curmap, _player.exp, _player.nextlevel);
- //drawString(_videobuffer, line, 0, 0, 0);
-
- game_fillrect(_videobuffer2, 0, 0, 320, 240, 0);
-
- for (int i = 0; i < kMaxFloat; i++) {
- if (_floattext[i][0] > 0) {
- int fc = (int)_floattext[i][3];
- int c = fc, c2 = 3;
-
- if (fc == 4)
- c = 1;
- else if (fc == 5)
- c = 0;
-
- if (fc == 1 || fc == 3)
- c2 = 2;
-
- if (fc != 0) {
- drawString(_videobuffer, _floatstri[i], (int)(_floattext[i][1]) + 0, (int)(_floattext[i][2]) - 1, c2);
- drawString(_videobuffer, _floatstri[i], (int)(_floattext[i][1]) + 0, (int)(_floattext[i][2]) + 1, c2);
- drawString(_videobuffer, _floatstri[i], (int)(_floattext[i][1]) - 1, (int)(_floattext[i][2]) + 0, c2);
- drawString(_videobuffer, _floatstri[i], (int)(_floattext[i][1]) + 1, (int)(_floattext[i][2]) + 0, c2);
- }
-
- drawString(_videobuffer, _floatstri[i], (int)(_floattext[i][1]), (int)(_floattext[i][2]), c);
- }
-
- if (_floaticon[i][0] > 0) {
- int ico = _floaticon[i][3];
- int ix = _floaticon[i][1];
- int iy = _floaticon[i][2];
-
- rcDest.left = ix;
- rcDest.top = iy;
-
- if (ico != 99)
- _itemimg[ico]->blit(*_videobuffer, rcDest.left, rcDest.top);
- if (ico == 99) {
- _spellimg->setAlpha((int)(RND() * 96) + 96, true);
-
- rcSrc.left = 16 * (int)(RND() * 2);
- rcSrc.top = 80;
- rcSrc.setWidth(16);
- rcSrc.setHeight(16);
-
- rcDest.left = ix;
- rcDest.top = iy;
-
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
-
- _spellimg->setAlpha(255, true);
- }
- }
- }
-
- if (_itemselon == 0) {
- int sy = 211;
-
-
- int nx = 19 * 8 + 13;
- rcSrc.left = nx - 17 + 48;
- rcSrc.top = sy;
-
- // spells in game
- if (_player.foundspell[0] == 1) {
- for (int i = 0; i < 5; i++) {
- rcSrc.left = rcSrc.left + 17;
-
- if (_player.foundspell[i] == 1) {
- _itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
-
- game_fillrect(_videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32));
- game_fillrect(_videobuffer, rcSrc.left + 1, sy + 17,
- hud_recalc(_player.spellcharge[i], 14, 100), 2,
- ABS(_player.spellcharge[i] - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 224, 64));
- }
- }
- }
- return;
- }
-
- if (_selenemyon == 0) {
- rcDest.left = 0;
- rcDest.top = 0;
- rcDest.right = 320;
- rcDest.bottom = 240;
- _videobuffer2->fillRect(rcDest, 0);
- _videobuffer2->setAlpha((int)(_player.itemselshade * 4)); // FIXME
- _videobuffer2->blit(*_videobuffer);
-
- int sy = 202;
- rcSrc.left = 46;
- rcSrc.top = 46;
-
- _inventoryimg->setAlpha(160, true); // 128
- _inventoryimg->blit(*_videobuffer, rcSrc.left, rcSrc.top);
- _inventoryimg->setAlpha(255, true);
-
- int sx = 54;
- sy = 55;
-
- // draw map 9,77
- rcDest.left = 46 + 9;
- rcDest.top = 46 + 77;
-
- int amap = 0;
- if (_curmap > 46)
- amap = 2;
- if (_curmap > 67)
- amap = 3;
- if (_curmap > 5 && _curmap < 42)
- amap = 1;
- mapimg[amap]->blit(*_videobuffer, rcDest.left, rcDest.top);
-
- long ccc = _videobuffer->format.RGBToColor(128 + 127 * sin(3.141592 * 2 * _itemyloc / 16), 0, 0);
-
- for (int b = 0; b <= 6; b++) {
- for (int a = 0; a <= 12; a++) {
- if (invmap[amap][b][a] == _curmap) {
- game_fillrect(_videobuffer, 46 + 9 + a * 9 + 2, 46 + 77 + b * 9 + 1, 6, 6, ccc);
- }
- }
- }
-
- if (amap == 1) {
- drawString(_videobuffer, "L1", 46 + 9, 46 + 77, 0);
- drawString(_videobuffer, "L2", 46 + 9 + 7 * 9, 46 + 77, 0);
- }
-
- char line[128];
- sprintf(line, "Health: %i/%i", _player.hp, _player.maxhp);
- drawString(_videobuffer, line, sx, sy, _player.hp <= _player.maxhp * 0.25 ? (int)_player.hpflash : 0);
-
- sprintf(line, "Level : %i", _player.level);
- if (_player.level == _player.maxlevel)
- strcpy(line, "Level : MAX");
- drawString(_videobuffer, line, sx, sy + 8, 0);
-
- // experience
- game_fillrect(_videobuffer, sx + 64, sy + 16, 16, 4, RGB(0, 32, 32));
- game_fillrect(_videobuffer, sx + 65, sy + 17,
- hud_recalc(_player.exp, 14, _player.nextlevel), 2, RGB(0, 224, 64));
-
- // attack strength
- game_fillrect(_videobuffer, sx + 1, sy + 16, 56, 6, RGB(0, 32, 32));
- game_fillrect(_videobuffer, sx + 1, sy + 17,
- hud_recalc(_player.attackstrength, 54, 100), 2,
- ABS(_player.attackstrength - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 64, 224));
-
- // spell strength
- game_fillrect(_videobuffer, sx + 1, sy + 19,
- hud_recalc(_player.spellstrength, 54, 100), 2,
- ABS(_player.spellstrength - 100) < kEpsilon ? RGB(224, 0, 0) : RGB(128, 0, 224));
-
- // time
- int ase = _secstart + _secsingame;
- int h = ((ase - (ase % 3600)) / 3600);
- ase = (ase - h * 3600);
- int m = ((ase - (ase % 60)) / 60);
- int s = (ase - m * 60);
-
- sprintf(line, "%02i:%02i:%02i", h, m, s);
- drawString(_videobuffer, line, 46 + 38 - strlen(line) * 4, 46 + 49, 0);
-
- drawString(_videobuffer, "Use", 193, 55, 0);
- drawString(_videobuffer, "Cast", 236, 55, 0);
-
- rcSrc.left = 128;
- rcSrc.top = 91;
-
- int ss = (_player.sword - 1) * 3;
- if (_player.sword == 3)
- ss = 18;
- _itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
-
- rcSrc.left = rcSrc.left + 16;
- ss = (_player.shield - 1) * 3 + 1;
- if (_player.shield == 3)
- ss = 19;
- _itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
-
- rcSrc.left = rcSrc.left + 16;
- ss = (_player.armour - 1) * 3 + 2;
- if (_player.armour == 3)
- ss = 20;
- _itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
-
- for (int i = 0; i <= 4; i++) {
- sx = 188;
- sy = 70 + i * 24;
- rcSrc.left = sx;
- rcSrc.top = sy;
- if (i == 0)
- _itemimg[6]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
- if (i == 1)
- _itemimg[12]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
- if (i == 2)
- _itemimg[17]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
- if (i == 3)
- _itemimg[16]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
- if (i == 4)
- _itemimg[14]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
-
- sprintf(line, "x%i", _player.inventory[i]);
- drawString(_videobuffer, line, sx + 17, sy + 7, 0);
- }
-
- // spells in menu
- if (_player.foundspell[0] == 1) {
- for (int i = 0; i < 5; i++) {
- rcSrc.left = 243;
- rcSrc.top = 67 + i * 24;
- sy = rcSrc.top;
-
- if (_player.foundspell[i] == 1) {
- _itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
-
- game_fillrect(_videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32));
- game_fillrect(_videobuffer, rcSrc.left + 1, sy + 17,
- hud_recalc(_player.spellcharge[i], 14, 100), 2,
- ABS(_player.spellcharge[i] - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 224, 64));
- }
- }
- }
-
- if (_itemselon == 1) {
- for (int i = 0; i <= 4; i++) {
- if (_curitem == 5 + i) {
- rcDest.left = (float)(243 - 12 + 3 * sin(3.141592 * 2 * _itemyloc / 16));
- rcDest.top = 67 + 24 * i;
- _itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
- }
-
- if (_curitem == i) {
- rcDest.left = (float)(189 - 12 + 3 * sin(3.141592 * 2 * _itemyloc / 16));
- rcDest.top = 70 + 24 * i;
- _itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
- }
- }
- }
- }
-
- if (_selenemyon == 1) {
- if (_curenemy > _lastnpc) {
- int pst = _curenemy - _lastnpc - 1;
- rcDest.left = postinfo[pst][0];
- rcDest.top = (float)(postinfo[pst][1] - 4 - sin(3.141592 / 8 * _itemyloc));
- } else {
- rcDest.left = _npcinfo[_curenemy].x + 4;
- rcDest.top = (float)(_npcinfo[_curenemy].y + 4 - 16 - sin(3.141592 / 8 * _itemyloc));
- }
-
- _itemimg[13]->blit(*_videobuffer, rcDest.left, rcDest.top);
- }
-}
-
-void GriffonEngine::drawNPCs(int mode) {
- unsigned int ccc = _videobuffer->format.RGBToColor(255, 128, 32);
- int fst = _firsty;
- int lst = _lasty;
-
- if (mode == 0)
- lst = _player.ysort;
- if (mode == 1)
- fst = _player.ysort;
-
- for (int yy = fst; yy <= lst; yy++) {
-
- if (_ysort[yy] > 0) {
- int i = _ysort[yy];
-
- if (_npcinfo[i].hp > 0) {
- int npx = (int)(_npcinfo[i].x);
- int npy = (int)(_npcinfo[i].y);
-
- int sprite = _npcinfo[i].spriteset;
-
- int wdir = _npcinfo[i].walkdir;
-
- // spriteset1 specific
- if (_npcinfo[i].spriteset == 1) {
-
- if (_npcinfo[i].attacking == 0) {
-
- int cframe = _npcinfo[i].cframe;
-
- rcSrc.left = (int)(cframe / 4) * 24;
- rcSrc.top = wdir * 24;
- rcSrc.setWidth(24);
- rcSrc.setHeight(24);
-
- rcDest.left = npx;
- rcDest.top = npy;
- rcDest.setWidth(24);
- rcDest.setHeight(24);
-
- if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
- _npcinfo[i].shake = _ticks + 50;
- rcDest.left += (int)(RND() * 3) - 1;
- rcDest.top += (int)(RND() * 3) - 1;
- }
-
- _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- } else {
- int cframe = _npcinfo[i].cattackframe;
-
- rcSrc.left = (int)(cframe / 4) * 24;
- rcSrc.top = wdir * 24;
- rcSrc.setWidth(24);
- rcSrc.setHeight(24);
-
- rcDest.left = npx;
- rcDest.top = npy;
- rcDest.setWidth(24);
- rcDest.setHeight(24);
-
- _animsa[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- }
-
- }
-
- // onewing
- if (_npcinfo[i].spriteset == 2) {
- for (int f = 0; f <= 7; f++) {
- int s = _npcinfo[i].bodysection[f].sprite;
- rcSrc.left = _animset2[s].x;
- rcSrc.top = _animset2[s].y;
- rcSrc.setWidth(_animset2[s].w);
- rcSrc.setHeight(_animset2[s].h);
-
- rcDest.left = _npcinfo[i].bodysection[f].x - _animset2[s].xofs;
- rcDest.top = _npcinfo[i].bodysection[f].y - _animset2[s].yofs + 2;
-
- _anims[2]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- }
-
- }
-
- // twowing
- if (_npcinfo[i].spriteset == 9) {
- for (int f = 0; f <= 7; f++) {
- int yp = 0;
-
- if (f == 0 && (_curmap == 53 || _curmap == 57 || _curmap == 61 || _curmap == 65 || _curmap == 56 || _curmap > 66) && _scriptflag[kScriptLever][0] > 0)
- yp = 16;
- int s = _npcinfo[i].bodysection[f].sprite;
- rcSrc.left = _animset9[s].x;
- rcSrc.top = _animset9[s].y + yp;
- rcSrc.setWidth(_animset9[s].w);
- rcSrc.setHeight(_animset9[s].h);
-
- rcDest.left = _npcinfo[i].bodysection[f].x - _animset9[s].xofs;
- rcDest.top = _npcinfo[i].bodysection[f].y - _animset9[s].yofs + 2;
-
- _anims[9]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- }
-
- }
-
-
- // boss 1
- if (_npcinfo[i].spriteset == 3) {
- if (_npcinfo[i].attacking == 0) {
- int cframe = _npcinfo[i].cframe;
-
- rcSrc.left = (int)(cframe / 4) * 24;
- rcSrc.top = 0;
- rcSrc.setWidth(24);
- rcSrc.setHeight(48);
-
- rcDest.left = npx - 2;
- rcDest.top = npy - 24;
-
- _anims[3]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- } else {
- rcSrc.left = 4 * 24;
- rcSrc.top = 0;
- rcSrc.setWidth(24);
- rcSrc.setHeight(48);
-
- rcDest.left = npx - 2;
- rcDest.top = npy - 24;
-
- _anims[3]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- }
-
- }
-
- // black knight
- if (_npcinfo[i].spriteset == 4) {
- if (_npcinfo[i].attacking == 0) {
- int cframe = _npcinfo[i].cframe;
-
- rcSrc.left = (int)(cframe / 4) * 24;
- rcSrc.top = 0;
- rcSrc.setWidth(24);
- rcSrc.setHeight(48);
-
- rcDest.left = npx - 2;
- rcDest.top = npy - 24;
-
- _anims[4]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- } else {
- rcSrc.left = 4 * 24;
- rcSrc.top = 0;
- rcSrc.setWidth(24);
- rcSrc.setHeight(48);
-
- rcDest.left = npx - 2;
- rcDest.top = npy - 24;
-
- _anims[4]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- }
- }
-
-
- // firehydra
- if (_npcinfo[i].spriteset == 5) {
- for (int ff = 0; ff <= 2; ff++) {
- if (_npcinfo[i].hp > 10 * ff * 20) {
- rcSrc.left = 16 * (int)(RND() * 2);
- rcSrc.top = 80;
- rcSrc.setWidth(16);
- rcSrc.setHeight(16);
-
- rcDest.left = _npcinfo[i].bodysection[10 * ff].x - 8;
- rcDest.top = _npcinfo[i].bodysection[10 * ff].y - 8;
-
- int x = 192 + ((int)(_itemyloc + ff * 5) % 3) * 64;
- if (x > 255)
- x = 255;
- _spellimg->setAlpha(x, true);
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- _spellimg->setAlpha(255, true);
-
- for (int f = 1; f <= 8; f++) {
- rcSrc.left = 16 * (int)(RND() * 2);
- rcSrc.top = 80;
- rcSrc.setWidth(16);
- rcSrc.setHeight(16);
-
- rcDest.left = _npcinfo[i].bodysection[ff * 10 + f].x - 8 + (int)(RND() * 3) - 1;
- rcDest.top = _npcinfo[i].bodysection[ff * 10 + f].y - 8 + (int)(RND() * 3) - 1;
-
- x = 192 + f % 3 * 64;
- if (x > 255)
- x = 255;
- _spellimg->setAlpha(x, true);
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- _spellimg->setAlpha(255, true);
- }
-
- rcSrc.left = 0;
- rcSrc.top = 0;
- rcSrc.setWidth(42);
- rcSrc.setHeight(36);
-
- rcDest.left = _npcinfo[i].bodysection[10 * ff + 9].x - 21;
- rcDest.top = _npcinfo[i].bodysection[10 * ff + 9].y - 21;
-
- _spellimg->setAlpha(192, true);
- _anims[5]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- _spellimg->setAlpha(255, true);
- }
-
- }
-
- }
-
- // red dragon
- if (_npcinfo[i].spriteset == 6) {
- int cframe = _npcinfo[i].cframe;
-
- rcSrc.left = (int)(cframe / 4) * 24;
- rcSrc.top = wdir * 24;
- rcSrc.setWidth(24);
- rcSrc.setHeight(24);
-
- rcDest.left = npx;
- rcDest.top = npy;
- rcDest.setWidth(24);
- rcDest.setHeight(24);
-
- if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
- _npcinfo[i].shake = _ticks + 50;
- rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
- rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
- }
-
- _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- }
-
- // wizard
- if (_npcinfo[i].spriteset == 7) {
- // if(_npcinfo[i].attacking == 0) {
- int cframe = _npcinfo[i].cframe;
-
- rcSrc.left = (int)(cframe / 4) * 24;
- rcSrc.top = wdir * 24;
- rcSrc.setWidth(24);
- rcSrc.setHeight(24);
-
- rcDest.left = npx;
- rcDest.top = npy;
- rcDest.setWidth(24);
- rcDest.setHeight(24);
-
- if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
- _npcinfo[i].shake = _ticks + 50;
- rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
- rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
- }
- _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- // } else {
- //cframe = _npcinfo[i].cattackframe;
-
- //rcSrc.left = (int)(cframe / 4) * 24;
- //rcSrc.top = wdir * 24;
- //rcSrc.setWidth(24);
- //rcSrc.setHeight(24);
-
- //rcDest.left = npx;
- //rcDest.top = npy;
- //rcDest.setWidth(24);
- //rcDest.setHeight(24);
- // _animsa(sprite)->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- // }
- }
-
-
- // yellow dragon
- if (_npcinfo[i].spriteset == 8) {
- int cframe = _npcinfo[i].cframe;
-
- rcSrc.left = (int)(cframe / 4) * 24;
- rcSrc.top = wdir * 24;
- rcSrc.setWidth(24);
- rcSrc.setHeight(24);
-
- rcDest.left = npx;
- rcDest.top = npy;
- rcDest.setWidth(24);
- rcDest.setHeight(24);
-
- if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
- _npcinfo[i].shake = _ticks + 50;
- rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
- rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
- }
- _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- }
-
-
- // dragon2
- if (_npcinfo[i].spriteset == 10) {
- if (_npcinfo[i].attacking == 0) {
- _npcinfo[i].floating = _npcinfo[i].floating + 0.25 * _fpsr;
- while (_npcinfo[i].floating >= 16)
- _npcinfo[i].floating = _npcinfo[i].floating - 16;
-
- float frame = _npcinfo[i].frame;
- int cframe = _npcinfo[i].cframe;
-
- frame = frame + 0.5 * _fpsr;
- while (frame >= 16)
- frame = frame - 16;
-
- cframe = (int)(frame);
- if (cframe > 16)
- cframe = 16 - 1;
- if (cframe < 0)
- cframe = 0;
-
- _npcinfo[i].frame = frame;
- _npcinfo[i].cframe = cframe;
-
- cframe = _npcinfo[i].cframe;
-
- rcSrc.left = 74 * wdir;
- rcSrc.top = (int)(cframe / 4) * 48;
- rcSrc.setWidth(74);
- rcSrc.setHeight(48);
-
- rcDest.left = npx + 12 - 37;
- rcDest.top = (float)(npy + 12 - 32 - 3 * sin(3.141592 * 2 * _npcinfo[i].floating / 16));
- rcDest.setWidth(24);
- rcDest.setHeight(24);
-
- if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
- _npcinfo[i].shake = _ticks + 50;
- rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
- rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
- }
-
- _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- } else {
- _npcinfo[i].floating = _npcinfo[i].floating + 0.25 * _fpsr;
- while (_npcinfo[i].floating >= 16)
- _npcinfo[i].floating = _npcinfo[i].floating - 16;
-
- int cframe = _npcinfo[i].cattackframe;
-
- rcSrc.left = 74 * wdir;
- rcSrc.top = (int)(cframe / 4) * 48;
- rcSrc.setWidth(74);
- rcSrc.setHeight(48);
-
- rcDest.left = npx + 12 - 37;
- rcDest.top = (float)(npy + 12 - 32 - 3 * sin(3.141592 * 2 * _npcinfo[i].floating / 16));
- rcDest.setWidth(24);
- rcDest.setHeight(24);
-
- _animsa[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- }
- }
-
- // end boss
- if (_npcinfo[i].spriteset == 11) {
-
- _npcinfo[i].floating = _npcinfo[i].floating + .3 * _fpsr;
- while (_npcinfo[i].floating >= 16)
- _npcinfo[i].floating = _npcinfo[i].floating - 16;
-
-
- float frame = _npcinfo[i].frame2;
-
- frame = frame + 0.5 * _fpsr;
- while (frame >= 16)
- frame = frame - 16;
-
- _npcinfo[i].frame2 = frame;
-
- int sx = npx + 12 - 40;
- int sy = (float)(npy + 12 - 50 - 3 * sin(3.141592 * 2 * _npcinfo[i].floating / 16));
-
- for (int fr = 0; fr <= 3; fr++) {
- _spellimg->setAlpha(128 + (int)(RND() * 96), true);
-
- rcSrc.left = 16 * (int)(RND() * 2);
- rcSrc.top = 80;
- rcSrc.setWidth(16);
- rcSrc.setHeight(16);
-
- rcDest.left = sx + 32 + (int)(RND() * 3) - 1;
- rcDest.top = sy - (int)(RND() * 6);
-
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- }
-
- for (int ii = 0; ii <= 8; ii++) {
- for (int i2 = 0; i2 <= 3; i2++) {
- rcSrc.left = 16 * (int)(RND() * 2);
- rcSrc.top = 80;
- rcSrc.setWidth(16);
- rcSrc.setHeight(16);
-
- float fr3 = frame - 3 + i2;
- if (fr3 < 0)
- fr3 = fr3 + 16;
-
- rcDest.left = (float)(sx + 36 + ii * 8 - ii * cos(3.14159 * 2 * (fr3 - ii) / 16) * 2);
- rcDest.top = (float)(sy + 16 + ii * sin(3.14159 * 2 * (fr3 - ii) / 16) * 3 - ii); // * 4
-
- _spellimg->setAlpha(i2 / 3 * 224, true);
-
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
-
- int xloc = rcDest.left;
- int yloc = rcDest.top;
- int xdif = (xloc + 8) - (_player.px + 12);
- int ydif = (yloc + 8) - (_player.py + 12);
-
- if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
- float damage = (float)_npcinfo[i].spelldamage * (1.0 + RND() * 0.5);
-
- if (_player.hp > 0) {
- damagePlayer(damage);
- if (config.effects) {
- int snd = playSound(_sfx[kSndFire]);
- setChannelVolume(snd, config.effectsvol);
- }
- }
-
- }
-
-
- rcDest.left = (float)(sx + 36 - ii * 8 + ii * cos(3.14159 * 2 * (fr3 - ii) / 16) * 2);
- rcDest.top = (float)(sy + 16 + ii * sin(3.14159 * 2 * (fr3 - ii) / 16) * 3 - ii); // * 4
-
- _spellimg->setAlpha(i2 / 3 * 224, true);
-
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
-
- xloc = rcDest.left;
- yloc = rcDest.top;
- xdif = (xloc + 8) - (_player.px + 12);
- ydif = (yloc + 8) - (_player.py + 12);
-
- if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
- float damage = (float)_npcinfo[i].spelldamage * (1.0 + RND() * 0.5);
-
- if (_player.hp > 0) {
- damagePlayer(damage);
- if (config.effects) {
- int snd = playSound(_sfx[kSndFire]);
- setChannelVolume(snd, config.effectsvol);
- }
- }
- }
- }
- }
-
- _spellimg->setAlpha(255, true);
-
- if (_npcinfo[i].attacking == 0) {
- int cframe = (int)(frame);
- rcSrc.left = 0;
- rcSrc.top = 72 * (int)(cframe / 4);
- rcSrc.setWidth(80);
- rcSrc.setHeight(72);
-
- rcDest.left = sx;
- rcDest.top = sy;
-
- if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
- _npcinfo[i].shake = _ticks + 50;
- rcDest.left = rcDest.top + (int)(RND() * 3) - 1;
- rcDest.left = rcDest.top + (int)(RND() * 3) - 1;
- }
-
- _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- } else {
- int cframe = (int)(_npcinfo[i].cattackframe);
-
- rcSrc.left = 0;
- rcSrc.top = 72 * (int)(cframe / 4);
- rcSrc.setWidth(80);
- rcSrc.setHeight(72);
-
- rcDest.left = sx;
- rcDest.top = sy;
-
- _animsa[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- }
- }
-
- // bat kitty
- if (_npcinfo[i].spriteset == 12) {
- _npcinfo[i].floating = _npcinfo[i].floating + 1 * _fpsr;
- while (_npcinfo[i].floating >= 16)
- _npcinfo[i].floating = _npcinfo[i].floating - 16;
-
- float frame = _npcinfo[i].frame;
- int cframe = _npcinfo[i].cframe;
-
- frame = frame + 0.5 * _fpsr;
- while (frame >= 16)
- frame = frame - 16;
-
- cframe = (int)(frame);
- if (cframe > 16)
- cframe = 16 - 1;
- if (cframe < 0)
- cframe = 0;
-
- _npcinfo[i].frame = frame;
- _npcinfo[i].cframe = cframe;
-
- cframe = _npcinfo[i].cframe;
-
- rcSrc.left = 0;
- rcSrc.top = 0;
- rcSrc.setWidth(99);
- rcSrc.setHeight(80);
-
- rcDest.left = npx + 12 - 50;
- rcDest.top = (float)(npy + 12 - 64 + 2 * sin(3.141592 * 2 * _npcinfo[i].floating / 16));
- rcDest.setWidth(99);
- rcDest.setHeight(80);
-
- if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
- _npcinfo[i].shake = _ticks + 50;
- rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
- rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
- }
-
- _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- }
-
- rcDest.left = npx + 4;
- rcDest.top = npy + 22;
- rcDest.setWidth(16);
- rcDest.setHeight(4);
-
- _videobuffer->fillRect(rcDest, 0);
-
- rcDest.left = npx + 5;
- rcDest.top = npy + 23;
-
-
- int ww = 14 * _npcinfo[i].hp / _npcinfo[i].maxhp;
- if (ww > 14)
- ww = 14;
- if (ww < 1)
- ww = 1;
-
- rcDest.setWidth(ww);
- rcDest.setHeight(2);
-
-
- _videobuffer->fillRect(rcDest, ccc);
-
- int pass = 1;
-
- if (_npcinfo[i].spriteset == 3)
- pass = 0;
- if (pass == 1)
- drawOver(npx, npy);
-
- }
- }
- }
-}
-
-void GriffonEngine::drawOver(int modx, int mody) {
- int npx = modx + 12;
- int npy = mody + 20;
-
- int lx = (int)npx / 16;
- int ly = (int)npy / 16;
-
- for (int xo = -1; xo <= 1; xo++) {
- for (int yo = -1; yo <= 1; yo++) {
-
- int sx = lx + xo;
- int sy = ly + yo;
-
- int sx2 = sx * 16;
- int sy2 = sy * 16;
-
- if (sx > -1 && sx < 40 && sy > -1 && sy < 24) {
-
- int curtile = _tileinfo[2][sx][sy][0];
- int curtilel = _tileinfo[2][sx][sy][1];
-
- if (curtile > 0) {
- curtile = curtile - 1;
- int curtilex = curtile % 20;
- int curtiley = (curtile - curtilex) / 20;
-
- rcSrc.left = curtilex * 16;
- rcSrc.top = curtiley * 16;
- rcSrc.setWidth(16);
- rcSrc.setHeight(16);
-
- rcDest.left = sx2;
- rcDest.top = sy2;
- rcDest.setWidth(16);
- rcDest.setHeight(16);
-
- int pass = 1;
- if (curtilel == 1) {
- for (int ff = 0; ff <= 5; ff++) {
- int ffa = 20 * 5 - 1 + ff * 20;
- int ffb = 20 * 5 + 4 + ff * 20;
- if (curtile > ffa && curtile < ffb)
- pass = 0;
- }
- }
-
- if (pass == 1)
- _tiles[curtilel]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- }
- }
- }
- }
-}
-
-void GriffonEngine::drawPlayer() {
- int f = 0;
- if (_player.armour == 3)
- f = 13;
-
- if (!attacking) {
- rcSrc.left = (int)(_player.walkframe / 4) * 24;
- rcSrc.top = _player.walkdir * 24;
- rcSrc.setWidth(24);
- rcSrc.setHeight(24);
-
- rcDest.left = (int)(_player.px);
- rcDest.top = (int)(_player.py);
- rcDest.setWidth(24);
- rcDest.setHeight(24);
-
- _anims[f]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- } else {
- rcSrc.left = (int)(_player.attackframe / 4) * 24;
- rcSrc.top = _player.walkdir * 24;
- rcSrc.setWidth(24);
- rcSrc.setHeight(24);
-
- rcDest.left = (int)(_player.px);
- rcDest.top = (int)(_player.py);
- rcDest.setWidth(24);
- rcDest.setHeight(24);
-
- _animsa[f]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
-
- }
-
- long ccc = _videobuffer->format.RGBToColor(224, 224, 64);
-
- int pass = 0;
- if (_player.hp <= _player.maxhp * 0.25)
- pass = 1;
-
- if (pass == 1) {
- ccc = _videobuffer->format.RGBToColor(255, 255, 255);
- if ((int)(_player.hpflash) == 1)
- ccc = _videobuffer->format.RGBToColor(255, 0, 0);
- }
-
- int sss = 6;
- if (_player.foundspell[0])
- sss = 8;
- int npx = _player.px;
- int npy = _player.py;
- rcDest.left = npx + 4;
- rcDest.top = npy + 22;
- rcDest.setWidth(16);
- rcDest.setHeight(sss);
-
- _videobuffer->fillRect(rcDest, 0);
-
- rcDest.left = npx + 5;
- rcDest.top = npy + 23;
-
-
- int ww = 14 * _player.hp / _player.maxhp;
- if (ww > 14)
- ww = 14;
- if (ww < 1)
- ww = 1;
-
- rcDest.setWidth(ww);
- rcDest.setHeight(2);
-
- _videobuffer->fillRect(rcDest, ccc);
-
- ccc = _videobuffer->format.RGBToColor(0, 224, 64);
- if (ABS(_player.attackstrength - 100) < kEpsilon)
- ccc = _videobuffer->format.RGBToColor(255, 128, 32);
-
- ww = 14 * _player.attackstrength / 100;
- if (ww > 14)
- ww = 14;
-
- int ww2 = 14 * _player.spellstrength / 100;
- if (ww2 > 14)
- ww2 = 14;
-
- rcDest.top = rcDest.top + 2;
- rcDest.setWidth(ww);
- rcDest.setHeight(2);
-
- _videobuffer->fillRect(rcDest, ccc);
-
- ccc = _videobuffer->format.RGBToColor(128, 0, 224);
- if (ABS(_player.spellstrength - 100) < kEpsilon)
- ccc = _videobuffer->format.RGBToColor(224, 0, 0);
-
- rcDest.top = rcDest.top + 2;
- rcDest.setWidth(ww2);
- rcDest.setHeight(2);
-
- _videobuffer->fillRect(rcDest, ccc);
-}
-
-void GriffonEngine::drawView() {
- _videobuffer->copyRectToSurface(_mapbg->getPixels(), _mapbg->pitch, 0, 0, _mapbg->w, _mapbg->h);
-
- updateSpellsUnder();
-
- drawAnims(0);
-
- // ------dontdrawover = special case to make boss work right in room 24
- if (dontdrawover == 1)
- drawAnims(1);
- drawNPCs(0);
-
- drawPlayer();
-
- drawNPCs(1);
- if (dontdrawover == 0)
- drawAnims(1);
-
- drawOver((int)_player.px, (int)_player.py);
-
- updateSpells();
-
- if (cloudson == 1) {
- Common::Rect rc;
- rc.left = (float)(256 + 256 * cos(3.141592 / 180 * clouddeg));
- rc.top = (float)(192 + 192 * sin(3.141592 / 180 * clouddeg));
- rc.setWidth(320);
- rc.setHeight(240);
-
- cloudimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, &rc);
- }
-
- drawHud();
-
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
-}
-
void GriffonEngine::eventText(const char *stri) {
_videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
_videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
@@ -2939,91 +1782,6 @@ void GriffonEngine::processTrigger(int trignum) {
}
}
-void GriffonEngine::swash() {
- float y;
-
- y = 0;
-
- do {
- y = y + 1 * _fpsr;
-
- _videobuffer->setAlpha((int)y);
- _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
-
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
- g_system->updateScreen();
-
- g_system->getEventManager()->pollEvent(_event);
- g_system->delayMillis(10);
-
- _tickspassed = _ticks;
- _ticks = g_system->getMillis();
-
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24.0;
-
- _fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
- _fps = _fp;
- _fp = 0;
- }
-
- clouddeg += 0.01 * _fpsr;
- while (clouddeg >= 360)
- clouddeg = clouddeg - 360;
-
- if (y > 10)
- break;
- } while (1);
-
- y = 0;
- do {
- y = y + 1 * _fpsr;
-
- _videobuffer->setAlpha((int)(y * 25));
- _mapbg->blit(*_videobuffer);
-
- if (cloudson == 1) {
- rcDest.left = (float)(256 + 256 * cos(3.141592 / 180 * clouddeg));
- rcDest.top = (float)(192 + 192 * sin(3.141592 / 180 * clouddeg));
- rcDest.setWidth(320);
- rcDest.setHeight(240);
-
- cloudimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
- }
-
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
- g_system->updateScreen();
-
- g_system->getEventManager()->pollEvent(_event);
- g_system->delayMillis(10);
-
- _tickspassed = _ticks;
- _ticks = g_system->getMillis();
-
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24.0;
-
- _fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
- _fps = _fp;
- _fp = 0;
- }
-
- clouddeg += 0.01 * _fpsr;
- while (clouddeg >= 360)
- clouddeg = clouddeg - 360;
-
- if (y > 10)
- break;
- } while (1);
-
-
- _videobuffer->setAlpha(255);
-}
-
void GriffonEngine::updateAnims() {
for (int i = 0; i <= _lastObj; i++) {
int nframes = _objectInfo[i][0];
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 66ad2df..7281702 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -297,25 +297,27 @@ private:
void configMenu();
void saveLoadNew();
- float RND();
-
- void addFloatIcon(int ico, float xloc, float yloc);
- void addFloatText(const char *stri, float xloc, float yloc, int col);
- void checkInputs();
- void checkTrigger();
+ // draw.cpp
void drawAnims(int Layer);
void drawHud();
void drawNPCs(int mode);
void drawOver(int modx, int mody);
void drawPlayer();
void drawView();
+ void swash();
+
+ float RND();
+
+ void addFloatIcon(int ico, float xloc, float yloc);
+ void addFloatText(const char *stri, float xloc, float yloc, int col);
+ void checkInputs();
+ void checkTrigger();
void eventText(const char *stri);
void handleWalking();
void loadMap(int mapnum);
void newGame();
void mainLoop();
void processTrigger(int trignum);
- void swash();
void updateAnims();
void updateY();
void updateMusic();
diff --git a/engines/griffon/module.mk b/engines/griffon/module.mk
index 9c2924b..6798353 100644
--- a/engines/griffon/module.mk
+++ b/engines/griffon/module.mk
@@ -6,6 +6,7 @@ MODULE_OBJS := \
console.o \
cutscenes.o \
dialogs.o \
+ draw.o \
engine.o \
griffon.o \
detection.o \
Commit: 3660f483b53648a8c91533f36ba26d452fbbb190
https://github.com/scummvm/scummvm/commit/3660f483b53648a8c91533f36ba26d452fbbb190
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Added resources.cpp
Changed paths:
A engines/griffon/resources.cpp
engines/griffon/engine.cpp
engines/griffon/griffon.h
engines/griffon/module.mk
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 79e564f..b916f86 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -38,11 +38,8 @@
#include "griffon/config.h"
#include "griffon/console.h"
-#include "common/file.h"
#include "common/system.h"
-#include "image/bmp.h"
-
namespace Griffon {
// memo
@@ -93,38 +90,8 @@ const int elementmap[15][20] = {
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
};
-// HELPER MACRO ---------------------------------------------------------------
-#define INPUT(A, B) \
- do { \
- Common::String line; \
- line = file.readLine(); \
- sscanf(line.c_str(), A, B); \
- } while(0)
-
// CODE GOES HERE -------------------------------------------------------------
-Graphics::TransparentSurface *GriffonEngine::loadImage(const char *name, bool colorkey) {
- Common::File file;
-
- file.open(name);
- if (!file.isOpen()) {
- error("Cannot open file %s", name);
- }
-
- debug(1, "Loading: %s", name);
-
- Image::BitmapDecoder bitmapDecoder;
- bitmapDecoder.loadStream(file);
- file.close();
-
- Graphics::TransparentSurface *surface = new Graphics::TransparentSurface(*bitmapDecoder.getSurface()->convertTo(g_system->getScreenFormat()));
-
- if (colorkey)
- surface->applyColorKey(255, 0, 255);
-
- return surface;
-}
-
// copypaste from hRnd_CRT()
float GriffonEngine::RND() {
/* return between 0 and 1 (but never 1) */
@@ -796,817 +763,6 @@ void GriffonEngine::handleWalking() {
}
}
-void GriffonEngine::loadMap(int mapnum) {
- debug(2, "Loaded map %d", mapnum);
-
- unsigned int ccc = _clipbg->format.RGBToColor(255, 255, 255);
-
- _curmap = mapnum;
- Common::Rect trect(320, 240);
-
- _mapbg->fillRect(trect, 0);
- _clipbg->fillRect(trect, ccc);
- _clipbg2->fillRect(trect, ccc);
-
- _forcepause = false;
- cloudson = 0;
- if (mapnum < 6)
- cloudson = 1;
- if (mapnum > 41)
- cloudson = 1;
- if (mapnum > 47)
- cloudson = 0;
- if (mapnum == 52)
- cloudson = 1;
- if (mapnum == 60)
- cloudson = 1;
- if (mapnum == 50)
- cloudson = 1;
- if (mapnum == 54)
- cloudson = 1;
- if (mapnum == 58)
- cloudson = 1;
- if (mapnum == 62)
- cloudson = 1;
- if (mapnum == 83)
- cloudson = 1;
-
- // -----------special case
- dontdrawover = 0;
- if (mapnum == 24)
- dontdrawover = 1;
-
- if ((mapnum == 53 || mapnum == 57 || mapnum == 61 || mapnum == 65 || mapnum == 62) && _scriptflag[kScriptLever][0] > 0)
- mapnum = mapnum + 100;
- if ((mapnum == 161 || mapnum == 162) && _scriptflag[kScriptLever][0] == 2)
- mapnum = mapnum + 100;
-
- for (int i = 0; i < kMaxSpell; i++)
- spellinfo[i].frame = 0;
-
- _roomlock = false;
-
- char name[256];
- // read *.map file
- sprintf(name, "mapdb/%04i.map", mapnum);
- debug(1, "Reading %s", name);
-
- Common::File file;
- file.open(name);
-
- if (!file.isOpen())
- error("Cannot open file %s", name);
-
- int tempmap[320][200];
- for (int x = 0; x <= 319; x++) {
- for (int y = 0; y <= 199; y++)
- INPUT("%i", &tempmap[x][y]);
- }
- file.close();
-
- for (int x = 0; x <= 319; x++) {
- for (int y = 0; y <= 239; y++)
- _triggerloc[x][y] = -1;
- }
-
- // read *.trg file
- sprintf(name, "mapdb/%04i.trg", mapnum);
- debug(1, "Reading %s", name);
- file.open(name);
-
- if (!file.isOpen())
- error("Cannot open file %s", name);
-
- INPUT("%i", &_ntriggers);
-
- for (int i = 0; i < _ntriggers; i++) {
- int mapx, mapy, trig;
-
- INPUT("%i", &mapx);
- INPUT("%i", &mapy);
- INPUT("%i", &trig);
-
- _triggerloc[mapx][mapy] = trig;
- }
- file.close();
-
-
- for (int y = 0; y <= 23; y++) {
- for (int x = 0; x <= 39; x++)
- _rampdata[x][y] = tempmap[3 * 40 + x][y + 40];
- }
-
- for (int y = 0; y <= 23; y++) {
- for (int x = 0; x <= 39; x++) {
- for (int l = 0; l <= 2; l++) {
- for (int a = 0; a <= 2; a++)
- _tileinfo[l][x][y][a] = 0;
- }
- }
- }
-
- if (_scriptflag[kScriptFindShield][0] == 1 && _curmap == 4) {
- _triggerloc[9][7] = 5004;
- tempmap[9][7] = 41;
- tempmap[9][7 + 40] = 0;
- }
-
- for (int y = 0; y <= 23; y++) {
- for (int x = 0; x <= 39; x++) {
- for (int l = 0; l <= 2; l++) {
- int ly = y;
- int lx = x + l * 40;
-
- // tile
- int curtile = tempmap[lx][ly];
- int curtilelayer = tempmap[lx][ly + 40];
-
- if (curtile > 0) {
- curtile = curtile - 1;
- int curtilel = curtilelayer;
- int curtilex = curtile % 20;
- int curtiley = (curtile - curtilex) / 20;
-
- _tileinfo[l][x][y][0] = curtile + 1;
- _tileinfo[l][x][y][1] = curtilelayer;
-
- rcSrc.left = curtilex * 16;
- rcSrc.top = curtiley * 16;
- rcSrc.setWidth(16);
- rcSrc.setHeight(16);
-
- rcDest.left = x * 16;
- rcDest.top = y * 16;
- rcDest.setWidth(16);
- rcDest.setHeight(16);
-
- if (l == 2 && curtilel == 1) {
- for (int ff = 0; ff <= 5; ff++) {
- int ffa = 20 * 5 - 1 + ff * 20;
- int ffb = 20 * 5 + 4 + ff * 20;
- if (curtile > ffa && curtile < ffb) {
- _tiles[curtilel]->setAlpha(128, true);
- }
- }
- }
- if (l == 1 && curtilel == 2) {
- for (int ff = 0; ff <= 4; ff++) {
- int ffa = 20 * (5 + ff) + 3;
- if (curtile == ffa) {
- _tiles[curtilel]->setAlpha(192, true);
- }
- }
- }
-
- _tiles[curtilel]->blit(*_mapbg, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- _tiles[curtilel]->setAlpha(255, true);
-
- rcDest.left = x * 8;
- rcDest.top = y * 8;
- rcDest.setWidth(8);
- rcDest.setHeight(8);
-
- _clipbg->fillRect(rcDest, 0);
- }
- }
- }
- }
-
- for (int x = 0; x <= 39; x++) {
- for (int y = 0; y <= 23; y++) {
- int d = tempmap[3 * 40 + x][y];
-
- if (_scriptflag[kScriptFindShield][0] == 1 && x == 9 && y == 7)
- d = 99;
-
- if (d > 0) {
- int clip = d % 2;
- d = (d - clip) / 2;
- int npc = d % 2;
- d = (d - npc) / 2;
-
- if (d == 99 && x == 9 && y == 7)
- clip = 1;
-
- if (clip) {
- if (d != 99)
- d = tempmap[6 * 40 + x][y];
- if (d == 99)
- d = 1;
-
- int x1 = x * 8;
- int y1 = y * 8;
-
- if (d == 1) {
- for (int i = 0; i <= 7; i++) {
- drawLine(_clipbg, x1, y1 + i, x1 + 7 - i, y1 + i, ccc);
- }
- } else if (d == 2) {
- drawLine(_clipbg, x1, y1, x1 + 7, y1, ccc);
- drawLine(_clipbg, x1, y1 + 1, x1 + 7, y1 + 1, ccc);
- } else if (d == 3) {
- for (int i = 0; i <= 7; i++) {
- drawLine(_clipbg, x1 + i, y1 + i, x1 + 7, y1 + i, ccc);
- }
- } else if (d == 4) {
- drawLine(_clipbg, x1, y1, x1, y1 + 7, ccc);
- drawLine(_clipbg, x1 + 1, y1, x1 + 1, y1 + 7, ccc);
- } else if (d == 5) {
- rcDest.left = x1;
- rcDest.top = y1;
- rcDest.setWidth(8);
- rcDest.setHeight(8);
- _clipbg->fillRect(rcDest, ccc);
- } else if (d == 6) {
- drawLine(_clipbg, x1 + 7, y1, x1 + 7, y1 + 7, ccc);
- drawLine(_clipbg, x1 + 6, y1, x1 + 6, y1 + 7, ccc);
- } else if (d == 7) {
- for (int i = 0; i <= 7; i++) {
- drawLine(_clipbg, x1, y1 + i, x1 + i, y1 + i, ccc);
- }
- } else if (d == 8) {
- drawLine(_clipbg, x1, y1 + 7, x1 + 7, y1 + 7, ccc);
- drawLine(_clipbg, x1, y1 + 7, x1 + 6, y1 + 6, ccc);
- } else if (d == 9) {
- for (int i = 0; i <= 7; i++) {
- drawLine(_clipbg, x1 + 7 - i, y1 + i, x1 + 7, y1 + i, ccc);
- }
- }
- }
- }
- }
- }
-
- _lastObj = 0;
- _lastnpc = 0;
-
- for (int i = 0; i < kMaxNPC; i++)
- _npcinfo[i].onmap = 0;
-
- for (int x = 0; x <= 19; x++) {
- for (int y = 0; y <= 19; y++) {
- int d = tempmap[3 * 40 + x][y];
-
- int npc = 0;
- int obj = 0;
- if (d > 0) {
- int clip = d % 2;
- d = (d - clip) / 2;
- npc = d % 2;
- d = (d - npc) / 2;
- obj = d % 2;
- }
-
- _objectMap[x][y] = -1;
-
- if (obj == 1) {
-
- int o = tempmap[5 * 40 + x][y];
-
- if (_objmapf[_curmap][x][y] == 0) {
- _objectMap[x][y] = o;
-
- if (_objectInfo[o][0] > 1) {
- if (o > _lastObj)
- _lastObj = o;
- }
-
- int x1 = x * 8;
- int y1 = y * 8;
-
- rcDest.left = x1;
- rcDest.top = y1;
- rcDest.setWidth(8);
- rcDest.setHeight(8);
-
- if (_objectInfo[o][4] == 1)
- _clipbg->fillRect(rcDest, ccc);
- if (_objectInfo[o][4] == 3)
- _clipbg->fillRect(rcDest, ccc);
- }
- }
- if (npc == 1) {
- int o = tempmap[4 * 40 + x][y];
-
- if (o > _lastnpc)
- _lastnpc = o;
-
- _npcinfo[o].x = x * 16 - 4;
- _npcinfo[o].y = y * 16 - 5;
-
- _npcinfo[o].walkdir = 1;
- _npcinfo[o].onmap = 1;
- }
- }
- }
-
-
- if (_curmap == 62 && _scriptflag[kScriptGardenMasterKey][0] > 0)
- _lastnpc = 0;
- if (_curmap == 73 && _scriptflag[kScriptArmourChest][0] > 0)
- _lastnpc = 0;
- if (_curmap == 81 && _scriptflag[kScriptCitadelMasterKey][0] > 0)
- _lastnpc = 0;
-
- if (_curmap == 73 && _scriptflag[kScriptArmourChest][0] == 0)
- _roomlock = true;
- if (_curmap == 81 && _scriptflag[kScriptCitadelMasterKey][0] == 0)
- _roomlock = true;
- if (_curmap == 83 && _scriptflag[kScriptGetSword3][0] == 0)
- _roomlock = true;
- if (_curmap == 82)
- _roomlock = true;
-
- // read *.npc file
- sprintf(name, "mapdb/%04i.npc", mapnum);
- debug(1, "Reading %s", name);
- file.open(name);
-
- if (!file.isOpen())
- error("Cannot open file %s", name);
-
- for (int i = 0; i < kMaxNPC; i++) {
- INPUT("%i", &_npcinfo[i].spriteset);
- INPUT("%i", &_npcinfo[i].x1);
- INPUT("%i", &_npcinfo[i].y1);
- INPUT("%i", &_npcinfo[i].x2);
- INPUT("%i", &_npcinfo[i].y2);
- INPUT("%i", &_npcinfo[i].movementmode);
- INPUT("%i", &_npcinfo[i].hp);
- INPUT("%i", &_npcinfo[i].item1);
- INPUT("%i", &_npcinfo[i].item2);
- INPUT("%i", &_npcinfo[i].item3);
- INPUT("%i", &_npcinfo[i].script);
-
- // baby dragon
- if (_npcinfo[i].spriteset == 1) {
- _npcinfo[i].hp = 12;
- _npcinfo[i].attackdelay = 2000;
-
- _npcinfo[i].attackdamage = 2;
- _npcinfo[i].spelldamage = 0;
-
- _npcinfo[i].walkspd = 1;
-
- if (RND() * 5 == 0)
- _npcinfo[i].hp = 0;
- }
-
- // onewing
- if (_npcinfo[i].spriteset == 2) {
- _npcinfo[i].hp = 200;
- _npcinfo[i].attackdelay = 2000;
- _npcinfo[i].swayspd = 1;
-
- _npcinfo[i].attackdamage = 24;
- _npcinfo[i].spelldamage = 30;
-
- _npcinfo[i].walkspd = 1.4f;
- _npcinfo[i].castpause = _ticks;
- }
-
- // boss1
- if (_npcinfo[i].spriteset == 3) {
- _npcinfo[i].hp = 300;
- _npcinfo[i].attackdelay = 2200;
-
- _npcinfo[i].attackdamage = 0;
- _npcinfo[i].spelldamage = 30;
-
- _npcinfo[i].walkspd = 1.2f;
- }
-
- // black knights
- if (_npcinfo[i].spriteset == 4) {
- _npcinfo[i].hp = 200;
- _npcinfo[i].attackdelay = 2800;
-
- _npcinfo[i].attackdamage = 0;
- _npcinfo[i].spelldamage = 30;
-
- _npcinfo[i].walkspd = 1;
- }
-
- // boss2 firehydra
- if (_npcinfo[i].spriteset == 5) {
- _npcinfo[i].hp = 600;
- _npcinfo[i].attackdelay = 2200;
-
- _npcinfo[i].attackdamage = 50;
- _npcinfo[i].spelldamage = 30;
-
- _npcinfo[i].walkspd = 1.3f;
-
- _npcinfo[i].swayangle = 0;
- }
-
- // baby fire dragon
- if (_npcinfo[i].spriteset == 6) {
- _npcinfo[i].hp = 20;
- _npcinfo[i].attackdelay = 1500;
-
- _npcinfo[i].attackdamage = 0;
- _npcinfo[i].spelldamage = 12;
-
- _npcinfo[i].walkspd = 1;
-
- if (RND() * 5 == 0)
- _npcinfo[i].hp = 0;
- }
-
- // priest1
- if (_npcinfo[i].spriteset == 7) {
- _npcinfo[i].hp = 40;
- _npcinfo[i].attackdelay = 5000;
-
- _npcinfo[i].attackdamage = 0;
- _npcinfo[i].spelldamage = 8;
-
- _npcinfo[i].walkspd = 1;
-
- if (RND() * 8 == 0)
- _npcinfo[i].hp = 0;
- }
-
- // yellow fire dragon
- if (_npcinfo[i].spriteset == 8) {
- _npcinfo[i].hp = 100;
- _npcinfo[i].attackdelay = 1500;
-
- _npcinfo[i].attackdamage = 0;
- _npcinfo[i].spelldamage = 24;
-
- _npcinfo[i].walkspd = 1;
-
- if (RND() * 5 == 0)
- _npcinfo[i].hp = 0;
- }
-
- // twowing
- if (_npcinfo[i].spriteset == 9) {
- _npcinfo[i].hp = 140;
- _npcinfo[i].attackdelay = 2000;
- _npcinfo[i].swayspd = 1;
-
- _npcinfo[i].attackdamage = 30;
- _npcinfo[i].spelldamage = 0;
-
- _npcinfo[i].walkspd = 1;
-
- _npcinfo[i].castpause = 0;
- }
-
- // dragon2
- if (_npcinfo[i].spriteset == 10) {
- _npcinfo[i].hp = 80;
- _npcinfo[i].attackdelay = 1500;
-
- _npcinfo[i].attackdamage = 24;
- _npcinfo[i].spelldamage = 0;
-
- _npcinfo[i].walkspd = 1;
-
- _npcinfo[i].floating = RND() * 16;
- }
-
- // end boss
- if (_npcinfo[i].spriteset == 11) {
- _npcinfo[i].hp = 1200;
- _npcinfo[i].attackdelay = 2000;
-
- _npcinfo[i].attackdamage = 100;
- _npcinfo[i].spelldamage = 60;
-
- _npcinfo[i].walkspd = 1;
-
- _npcinfo[i].floating = RND() * 16;
- }
-
- // bat kitty
- if (_npcinfo[i].spriteset == 12) {
- _npcinfo[i].hp = 800;
- _npcinfo[i].attackdelay = 2000;
-
- _npcinfo[i].attackdamage = 100;
- _npcinfo[i].spelldamage = 50;
-
- _npcinfo[i].walkspd = 1;
-
- _npcinfo[i].floating = RND() * 16;
- }
-
- if (_npcinfo[i].onmap == 0)
- _npcinfo[i].hp = 0;
-
- _npcinfo[i].maxhp = _npcinfo[i].hp;
-
- _npcinfo[i].attacking = 0;
- _npcinfo[i].attackframe = 0;
- _npcinfo[i].cattackframe = 0;
- _npcinfo[i].attackspd = 1.5;
- _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay * (1 + RND() * 2);
-
- if (_npcinfo[i].spriteset == 2 || _npcinfo[i].spriteset == 9) {
- _npcinfo[i].bodysection[0].sprite = 0;
- _npcinfo[i].bodysection[1].sprite = 1;
- _npcinfo[i].bodysection[2].sprite = 2;
- _npcinfo[i].bodysection[3].sprite = 3;
- _npcinfo[i].bodysection[4].sprite = 4;
- _npcinfo[i].bodysection[5].sprite = 3;
- _npcinfo[i].bodysection[6].sprite = 3;
- _npcinfo[i].bodysection[7].sprite = 5;
-
- _npcinfo[i].bodysection[0].bonelength = 8;
- _npcinfo[i].bodysection[1].bonelength = 7;
- _npcinfo[i].bodysection[2].bonelength = 6;
- _npcinfo[i].bodysection[3].bonelength = 4;
- _npcinfo[i].bodysection[4].bonelength = 4;
- _npcinfo[i].bodysection[5].bonelength = 4;
- _npcinfo[i].bodysection[6].bonelength = 4;
-
- for (int f = 0; f <= 7; f++) {
- _npcinfo[i].bodysection[f].x = _npcinfo[i].x + 12;
- _npcinfo[i].bodysection[f].y = _npcinfo[i].y + 14;
- }
-
- _npcinfo[i].headtargetx[0] = _npcinfo[i].x + 12;
- _npcinfo[i].headtargety[0] = _npcinfo[i].y + 14;
-
- }
-
- if (_npcinfo[i].spriteset == 5) {
- for (int f = 0; f <= 29; f++) {
- _npcinfo[i].bodysection[f].x = _npcinfo[i].x + 12;
- _npcinfo[i].bodysection[f].y = _npcinfo[i].y + 14;
- }
-
- for (int f = 0; f <= 2; f++) {
- _npcinfo[i].headtargetx[f] = _npcinfo[i].x + 12;
- _npcinfo[i].headtargety[f] = _npcinfo[i].y + 14;
-
- _npcinfo[i].attacking2[f] = 0;
- _npcinfo[i].attackframe2[f] = 0;
- }
- }
-
- if (_npcinfo[i].script == kScriptMasterKey) {
- _roomlock = true;
- if (_scriptflag[kScriptMasterKey][0] > 0) {
- _roomlock = false;
- _npcinfo[i].hp = 0;
- }
- }
-
- if (_npcinfo[i].script == kScriptFindCtystal) {
- _roomlock = true;
- if (_scriptflag[kScriptFindCtystal][0] > 0) {
- _roomlock = false;
- _npcinfo[i].hp = 0;
- }
- }
-
- if (_npcinfo[i].script == kScriptFindSword) {
- _roomlock = true;
- if (_scriptflag[kScriptFindSword][0] > 0) {
- _roomlock = false;
- _npcinfo[i].hp = 0;
- }
- }
-
- if (_npcinfo[i].script == kScriptGetSword3) {
- _roomlock = true;
- if (_scriptflag[kScriptGetSword3][0] > 0) {
- _roomlock = false;
- _npcinfo[i].hp = 0;
- }
- }
-
- _npcinfo[i].pause = _ticks;
- }
-
- file.close();
-
-
- int cx, cy, npx, npy, lx, ly;
-
- // academy master key
- if (_curmap == 34 && _scriptflag[kScriptMasterKey][0] == 1) {
- cx = 9;
- cy = 7;
-
- _objectMap[cx][cy] = 5;
-
- rcDest.left = cx * 8;
- rcDest.top = cy * 8;
- rcDest.setWidth(8);
- rcDest.setHeight(8);
-
- npx = _player.px + 12;
- npy = _player.py + 20;
-
- lx = (int)npx / 16;
- ly = (int)npy / 16;
-
- if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
-
- _clipbg->fillRect(rcDest, ccc);
- }
-
- // academy crystal
- if (_curmap == 24 && _player.foundspell[0] == 0 && _scriptflag[kScriptFindCtystal][0] == 1) {
- cx = 9;
- cy = 7;
-
- _objectMap[cx][cy] = 6;
-
- rcDest.left = cx * 8;
- rcDest.top = cy * 8;
- rcDest.setWidth(8);
- rcDest.setHeight(8);
-
- npx = _player.px + 12;
- npy = _player.py + 20;
-
- lx = (int)npx / 16;
- ly = (int)npy / 16;
-
- if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
-
- _clipbg->fillRect(rcDest, ccc);
- }
-
- // gardens master key
- if (_curmap == 62 && _scriptflag[kScriptGardenMasterKey][0] == 1) {
- cx = 13;
- cy = 7;
-
- _objectMap[cx][cy] = 5;
-
- rcDest.left = cx * 8;
- rcDest.top = cy * 8;
- rcDest.setWidth(8);
- rcDest.setHeight(8);
-
- npx = _player.px + 12;
- npy = _player.py + 20;
-
- lx = (int)npx / 16;
- ly = (int)npy / 16;
-
- if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
-
- _clipbg->fillRect(rcDest, ccc);
- }
-
- // gardens fidelis sword
- if (_curmap == 66 && _scriptflag[kScriptFindSword][0] == 1 && _player.sword == 1) {
- cx = 9;
- cy = 6;
-
- _objectMap[cx][cy] = 9;
-
- rcDest.left = cx * 8;
- rcDest.top = cy * 8;
- rcDest.setWidth(8);
- rcDest.setHeight(8);
-
- npx = _player.px + 12;
- npy = _player.py + 20;
-
- lx = (int)npx / 16;
- ly = (int)npy / 16;
-
- if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
-
- _clipbg->fillRect(rcDest, ccc);
- }
-
- // citadel armour
- if (_curmap == 73 && _scriptflag[kScriptArmourChest][0] == 1 && _player.armour == 1) {
- cx = 8;
- cy = 7;
-
- _objectMap[cx][cy] = 16;
-
- rcDest.left = cx * 8;
- rcDest.top = cy * 8;
- rcDest.setWidth(8);
- rcDest.setHeight(8);
-
- npx = _player.px + 12;
- npy = _player.py + 20;
-
- lx = (int)npx / 16;
- ly = (int)npy / 16;
-
- if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
-
- _clipbg->fillRect(rcDest, ccc);
- }
-
- // citadel master key
- if (_curmap == 81 && _scriptflag[kScriptCitadelMasterKey][0] == 1) {
- cx = 11;
- cy = 10;
-
- _objectMap[cx][cy] = 5;
-
- rcDest.left = cx * 8;
- rcDest.top = cy * 8;
- rcDest.setWidth(8);
- rcDest.setHeight(8);
-
- npx = _player.px + 12;
- npy = _player.py + 20;
-
- lx = (int)npx / 16;
- ly = (int)npy / 16;
-
- if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
-
- _clipbg->fillRect(rcDest, ccc);
- }
-
-
- // max ups
- if (_curmap == 83 && _scriptflag[kScriptGetSword3][0] == 1 && _player.sword < 3) {
- cx = 6;
- cy = 8;
-
- _objectMap[cx][cy] = 18;
-
- rcDest.left = cx * 8;
- rcDest.top = cy * 8;
- rcDest.setWidth(8);
- rcDest.setHeight(8);
-
- npx = _player.px + 12;
- npy = _player.py + 20;
-
- lx = (int)npx / 16;
- ly = (int)npy / 16;
-
- if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
-
- _clipbg->fillRect(rcDest, ccc);
- }
-
- if (_curmap == 83 && _scriptflag[kScriptShield3][0] == 1 && _player.shield < 3) {
- cx = 9;
- cy = 8;
-
- _objectMap[cx][cy] = 19;
-
- rcDest.left = cx * 8;
- rcDest.top = cy * 8;
- rcDest.setWidth(8);
- rcDest.setHeight(8);
-
- npx = _player.px + 12;
- npy = _player.py + 20;
-
- lx = (int)npx / 16;
- ly = (int)npy / 16;
-
- if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
-
- _clipbg->fillRect(rcDest, ccc);
- }
-
- if (_curmap == 83 && _scriptflag[kScriptArmour3][0] == 1 && _player.armour < 3) {
- cx = 12;
- cy = 8;
-
- _objectMap[cx][cy] = 20;
-
- rcDest.left = cx * 8;
- rcDest.top = cy * 8;
- rcDest.setWidth(8);
- rcDest.setHeight(8);
-
- npx = _player.px + 12;
- npy = _player.py + 20;
-
- lx = (int)npx / 16;
- ly = (int)npy / 16;
-
- if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
-
- _clipbg->fillRect(rcDest, ccc);
- }
-
- _clipbg2->copyRectToSurface(_clipbg->getPixels(), _clipbg->pitch, 0, 0, _clipbg->w, _clipbg->h);
-}
-
void GriffonEngine::newGame() {
intro();
@@ -4102,77 +3258,6 @@ void GriffonEngine::updateSpellsUnder() {
}
}
-void GriffonEngine::initialize() {
- // init char *_floatstri[kMaxFloat]
- for (int i = 0; i < kMaxFloat; i++)
- _floatstri[i] = (char *)malloc(64); // 64 bytes each string (should be enough)
-
- _video = new Graphics::TransparentSurface;
- _video->create(320, 240, g_system->getScreenFormat());
- _videobuffer = new Graphics::TransparentSurface;
- _videobuffer->create(320, 240, g_system->getScreenFormat());
- _videobuffer2 = new Graphics::TransparentSurface;
- _videobuffer2->create(320, 240, g_system->getScreenFormat());
- _videobuffer3 = new Graphics::TransparentSurface;
- _videobuffer3->create(320, 240, g_system->getScreenFormat());
- _mapbg = new Graphics::TransparentSurface;
- _mapbg->create(320, 240, g_system->getScreenFormat());
- _clipbg = new Graphics::TransparentSurface;
- _clipbg->create(320, 240, g_system->getScreenFormat());
- _clipbg2 = new Graphics::TransparentSurface;
- _clipbg2->create(320, 240, g_system->getScreenFormat());
-
- for (int i = 0; i <= 3; i++) {
- char name[128];
-
- sprintf(name, "art/map%i.bmp", i + 1);
- mapimg[i] = loadImage(name, true);
- }
-
- cloudimg = loadImage("art/clouds.bmp", true);
- cloudimg->setAlpha(96, true);
-
-
- saveloadimg = loadImage("art/saveloadnew.bmp", true);
- saveloadimg->setAlpha(160, true);
-
- _titleimg = loadImage("art/titleb.bmp");
- _titleimg2 = loadImage("art/titlea.bmp", true);
- //_titleimg2->setAlpha(204, true);
-
- _inventoryimg = loadImage("art/inventory.bmp", true);
-
- _logosimg = loadImage("art/logos.bmp");
- _theendimg = loadImage("art/theend.bmp");
-
-
- loadTiles();
- loadTriggers();
- loadObjectDB();
- loadAnims();
- loadFont();
- loadItemImgs();
-
- _fpsr = 1.0f;
- _nextticks = _ticks + 1000;
-
- for (int i = 0; i <= 15; i++) {
- _playerattackofs[0][i][0] = 0; // -1// -(i + 1)
- _playerattackofs[0][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2 - 1;
-
- _playerattackofs[1][i][0] = 0; // i + 1
- _playerattackofs[1][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2 + 1;
-
- _playerattackofs[2][i][0] = -1; // -(i + 1)
- _playerattackofs[2][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2;
-
- _playerattackofs[3][i][0] = 1; // i + 1
- _playerattackofs[3][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2;
- }
-
- setupAudio();
-}
-
void GriffonEngine::drawLine(Graphics::TransparentSurface *buffer, int x1, int y1, int x2, int y2, int col) {
int xdif = x2 - x1;
int ydif = y2 - y1;
@@ -4192,212 +3277,6 @@ void GriffonEngine::drawLine(Graphics::TransparentSurface *buffer, int x1, int y
}
}
-void GriffonEngine::loadAnims() {
- _spellimg = loadImage("art/spells.bmp", true);
- _anims[0] = loadImage("art/anims0.bmp", true);
- _animsa[0] = loadImage("art/anims0a.bmp", true);
- _anims[13] = loadImage("art/anims0x.bmp", true);
- _animsa[13] = loadImage("art/anims0xa.bmp", true);
- _anims[1] = loadImage("art/anims1.bmp", true);
- _animsa[1] = loadImage("art/anims1a.bmp", true);
- _anims[2] = loadImage("art/anims2.bmp", true);
-
- // huge
- _animset2[0].xofs = 8;
- _animset2[0].yofs = 7;
- _animset2[0].x = 123;
- _animset2[0].y = 0;
- _animset2[0].w = 18;
- _animset2[0].h = 16;
- // big
- _animset2[1].xofs = 7;
- _animset2[1].yofs = 7;
- _animset2[1].x = 107;
- _animset2[1].y = 0;
- _animset2[1].w = 16;
- _animset2[1].h = 14;
- // med
- _animset2[2].xofs = 6;
- _animset2[2].yofs = 6;
- _animset2[2].x = 93;
- _animset2[2].y = 0;
- _animset2[2].w = 14;
- _animset2[2].h = 13;
- // small
- _animset2[3].xofs = 4;
- _animset2[3].yofs = 4;
- _animset2[3].x = 83;
- _animset2[3].y = 0;
- _animset2[3].w = 10;
- _animset2[3].h = 10;
- // wing
- _animset2[4].xofs = 4;
- _animset2[4].yofs = 20;
- _animset2[4].x = 42;
- _animset2[4].y = 0;
- _animset2[4].w = 41;
- _animset2[4].h = 33;
- // head
- _animset2[5].xofs = 20;
- _animset2[5].yofs = 18;
- _animset2[5].x = 0;
- _animset2[5].y = 0;
- _animset2[5].w = 42;
- _animset2[5].h = 36;
-
- _anims[9] = loadImage("art/anims9.bmp", true);
-
- // huge
- _animset9[0].xofs = 8;
- _animset9[0].yofs = 7;
- _animset9[0].x = 154;
- _animset9[0].y = 0;
- _animset9[0].w = 18;
- _animset9[0].h = 16;
- // big
- _animset9[1].xofs = 7;
- _animset9[1].yofs = 7;
- _animset9[1].x = 138;
- _animset9[1].y = 0;
- _animset9[1].w = 16;
- _animset9[1].h = 14;
- // med
- _animset9[2].xofs = 6;
- _animset9[2].yofs = 6;
- _animset9[2].x = 93 + 31;
- _animset9[2].y = 0;
- _animset9[2].w = 14;
- _animset9[2].h = 13;
- // small
- _animset9[3].xofs = 4;
- _animset9[3].yofs = 4;
- _animset9[3].x = 83 + 31;
- _animset9[3].y = 0;
- _animset9[3].w = 10;
- _animset9[3].h = 10;
- // wing
- _animset9[4].xofs = 36;
- _animset9[4].yofs = 20;
- _animset9[4].x = 42;
- _animset9[4].y = 0;
- _animset9[4].w = 72;
- _animset9[4].h = 33;
- // head
- _animset9[5].xofs = 20;
- _animset9[5].yofs = 18;
- _animset9[5].x = 0;
- _animset9[5].y = 0;
- _animset9[5].w = 42;
- _animset9[5].h = 36;
-
- _anims[3] = loadImage("art/anims3.bmp", true);
- _anims[4] = loadImage("art/anims4.bmp", true);
- _anims[5] = loadImage("art/anims5.bmp", true);
- _anims[6] = loadImage("art/anims6.bmp", true);
- _anims[7] = loadImage("art/anims7.bmp", true);
- _anims[8] = loadImage("art/anims8.bmp", true);
- _anims[10] = loadImage("art/anims10.bmp", true);
- _animsa[10] = loadImage("art/anims10a.bmp", true);
- _anims[11] = loadImage("art/anims11.bmp", true);
- _animsa[11] = loadImage("art/anims11a.bmp", true);
- _anims[12] = loadImage("art/anims12.bmp", true);
-}
-
-void GriffonEngine::loadItemImgs() {
- Graphics::TransparentSurface *temp = loadImage("art/icons.bmp", true);
-
- for (int i = 0; i <= 20; i++) {
- _itemimg[i] = new Graphics::TransparentSurface;
- _itemimg[i]->create(16, 16, g_system->getScreenFormat());
-
- rcSrc.left = i * 16;
- rcSrc.top = 0;
- rcSrc.setWidth(16);
- rcSrc.setHeight(16);
-
- temp->blit(*_itemimg[i], 0, 0, Graphics::FLIP_NONE, &rcSrc);
- }
-
- temp->free();
-}
-
-void GriffonEngine::loadFont() {
- Graphics::TransparentSurface *font = loadImage("art/font.bmp", true);
-
- for (int i = 32; i <= 255; i++)
- for (int f = 0; f <= 4; f++) {
- int i2 = i - 32;
-
- _fontchr[i2][f] = new Graphics::TransparentSurface;
- _fontchr[i2][f]->create(8, 8, g_system->getScreenFormat());
-
- int col = i2 % 40;
-
- int row = (i2 - col) / 40;
-
- rcSrc.left = col * 8;
- rcSrc.top = row * 8 + f * 48;
- rcSrc.setWidth(8);
- rcSrc.setHeight(8);
-
- rcDest.left = 0;
- rcDest.top = 0;
- font->blit(*_fontchr[i2][f], rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- }
-
- font->free();
-}
-
-void GriffonEngine::loadTiles() {
- _tiles[0] = loadImage("art/tx.bmp", true);
- _tiles[1] = loadImage("art/tx1.bmp", true);
- _tiles[2] = loadImage("art/tx2.bmp", true);
- _tiles[3] = loadImage("art/tx3.bmp", true);
-
- _windowimg = loadImage("art/window.bmp", true);
-}
-
-void GriffonEngine::loadTriggers() {
- Common::File file;
- file.open("data/triggers.dat");
-
- if (!file.isOpen())
- error("Cannot open file data/Triggers.dat");
-
- for (int i = 0; i <= 9999; i++) {
- for (int a = 0; a <= 8; a++)
- INPUT("%i", &_triggers[i][a]);
- }
-
- file.close();
-}
-
-void GriffonEngine::loadObjectDB() {
- Common::File file;
-
- file.open("objectdb.dat");
- if (!file.isOpen())
- error("Cannot open file objectdb.dat");
-
- for (int a = 0; a <= 32; a++) {
- for (int b = 0; b <= 5; b++) {
- INPUT("%i", &_objectInfo[a][b]);
- }
-
- for (int b = 0; b <= 8; b++) {
- for (int c = 0; c <= 2; c++) {
- for (int d = 0; d <= 2; d++) {
- for (int e = 0; e <= 1; e++) {
- INPUT("%i", &_objectTile[a][b][c][d][e]);
- }
- }
- }
- }
- }
-
- file.close();
-}
-
void GriffonEngine::drawString(Graphics::TransparentSurface *buffer, const char *stri, int xloc, int yloc, int col) {
int l = strlen(stri);
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 7281702..3296b91 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -306,43 +306,24 @@ private:
void drawView();
void swash();
- float RND();
-
- void addFloatIcon(int ico, float xloc, float yloc);
- void addFloatText(const char *stri, float xloc, float yloc, int col);
- void checkInputs();
- void checkTrigger();
- void eventText(const char *stri);
- void handleWalking();
- void loadMap(int mapnum);
- void newGame();
- void mainLoop();
- void processTrigger(int trignum);
- void updateAnims();
- void updateY();
- void updateMusic();
- void updateNPCs();
- void updateSpells();
- void updateSpellsUnder();
-
+ // resources.cpp
void initialize();
- void drawLine(Graphics::TransparentSurface *buffer, int x1, int y1, int x2, int y2, int col);
+ Graphics::TransparentSurface *loadImage(const char *name, bool colorkey = false);
+ void loadMap(int mapnum);
void loadAnims();
void loadFont();
void loadItemImgs();
void loadTiles();
void loadTriggers();
void loadObjectDB();
- void drawString(Graphics::TransparentSurface *buffer, const char *stri, int xloc, int yloc, int col);
- void drawProgress(int w, int wm);
- void setupAudio();
- void updateEngine();
+ // saveload.cpp
Common::String makeSaveGameName(int slot);
int loadState(int slotnum);
int loadPlayer(int slotnum);
int saveState(int slotnum);
+ // sound.cpp
void setChannelVolume(int channel, int volume);
int getSoundHandle();
int playSound(DataChunk *chunk, bool looped = false);
@@ -350,8 +331,30 @@ private:
void haltSoundChannel(int channel);
void resumeSoundChannel(int channel);
bool isSoundChannelPlaying(int channel);
+ void setupAudio();
+ void updateMusic();
- Graphics::TransparentSurface *loadImage(const char *name, bool colorkey = false);
+ float RND();
+
+ void addFloatIcon(int ico, float xloc, float yloc);
+ void addFloatText(const char *stri, float xloc, float yloc, int col);
+ void checkInputs();
+ void checkTrigger();
+ void eventText(const char *stri);
+ void handleWalking();
+ void newGame();
+ void mainLoop();
+ void processTrigger(int trignum);
+ void updateAnims();
+ void updateY();
+ void updateNPCs();
+ void updateSpells();
+ void updateSpellsUnder();
+
+ void drawLine(Graphics::TransparentSurface *buffer, int x1, int y1, int x2, int y2, int col);
+ void drawString(Graphics::TransparentSurface *buffer, const char *stri, int xloc, int yloc, int col);
+ void drawProgress(int w, int wm);
+ void updateEngine();
private:
Graphics::TransparentSurface *_video, *_videobuffer, *_videobuffer2, *_videobuffer3;
diff --git a/engines/griffon/module.mk b/engines/griffon/module.mk
index 6798353..697e0b9 100644
--- a/engines/griffon/module.mk
+++ b/engines/griffon/module.mk
@@ -5,11 +5,12 @@ MODULE_OBJS := \
config.o \
console.o \
cutscenes.o \
+ detection.o \
dialogs.o \
draw.o \
engine.o \
griffon.o \
- detection.o \
+ resources.o \
saveload.o \
sound.o
diff --git a/engines/griffon/resources.cpp b/engines/griffon/resources.cpp
new file mode 100644
index 0000000..d016a62
--- /dev/null
+++ b/engines/griffon/resources.cpp
@@ -0,0 +1,1166 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Originally written by Syn9 in FreeBASIC with SDL
+ * http://syn9.thehideoutgames.com/index_backup.php
+ *
+ * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
+ * http://github.com/dmitrysmagin/griffon_legend
+ *
+ *
+ * Programming/Graphics: Daniel "Syn9" Kennedy
+ * Music/Sound effects: David Turner
+ *
+ * Beta testing and gameplay design help:
+ * Deleter, Cha0s, Aether Fox, and Kiz
+ *
+ */
+
+#include "common/file.h"
+#include "common/system.h"
+
+#include "image/bmp.h"
+
+#include "griffon/griffon.h"
+
+namespace Griffon {
+
+// HELPER MACRO ---------------------------------------------------------------
+#define INPUT(A, B) \
+ do { \
+ Common::String line; \
+ line = file.readLine(); \
+ sscanf(line.c_str(), A, B); \
+ } while(0)
+
+
+void GriffonEngine::initialize() {
+ // init char *_floatstri[kMaxFloat]
+ for (int i = 0; i < kMaxFloat; i++)
+ _floatstri[i] = (char *)malloc(64); // 64 bytes each string (should be enough)
+
+ _video = new Graphics::TransparentSurface;
+ _video->create(320, 240, g_system->getScreenFormat());
+ _videobuffer = new Graphics::TransparentSurface;
+ _videobuffer->create(320, 240, g_system->getScreenFormat());
+ _videobuffer2 = new Graphics::TransparentSurface;
+ _videobuffer2->create(320, 240, g_system->getScreenFormat());
+ _videobuffer3 = new Graphics::TransparentSurface;
+ _videobuffer3->create(320, 240, g_system->getScreenFormat());
+ _mapbg = new Graphics::TransparentSurface;
+ _mapbg->create(320, 240, g_system->getScreenFormat());
+ _clipbg = new Graphics::TransparentSurface;
+ _clipbg->create(320, 240, g_system->getScreenFormat());
+ _clipbg2 = new Graphics::TransparentSurface;
+ _clipbg2->create(320, 240, g_system->getScreenFormat());
+
+ for (int i = 0; i <= 3; i++) {
+ char name[128];
+
+ sprintf(name, "art/map%i.bmp", i + 1);
+ mapimg[i] = loadImage(name, true);
+ }
+
+ cloudimg = loadImage("art/clouds.bmp", true);
+ cloudimg->setAlpha(96, true);
+
+
+ saveloadimg = loadImage("art/saveloadnew.bmp", true);
+ saveloadimg->setAlpha(160, true);
+
+ _titleimg = loadImage("art/titleb.bmp");
+ _titleimg2 = loadImage("art/titlea.bmp", true);
+ //_titleimg2->setAlpha(204, true);
+
+ _inventoryimg = loadImage("art/inventory.bmp", true);
+
+ _logosimg = loadImage("art/logos.bmp");
+ _theendimg = loadImage("art/theend.bmp");
+
+
+ loadTiles();
+ loadTriggers();
+ loadObjectDB();
+ loadAnims();
+ loadFont();
+ loadItemImgs();
+
+ _fpsr = 1.0f;
+ _nextticks = _ticks + 1000;
+
+ for (int i = 0; i <= 15; i++) {
+ _playerattackofs[0][i][0] = 0; // -1// -(i + 1)
+ _playerattackofs[0][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2 - 1;
+
+ _playerattackofs[1][i][0] = 0; // i + 1
+ _playerattackofs[1][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2 + 1;
+
+ _playerattackofs[2][i][0] = -1; // -(i + 1)
+ _playerattackofs[2][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2;
+
+ _playerattackofs[3][i][0] = 1; // i + 1
+ _playerattackofs[3][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2;
+ }
+
+ setupAudio();
+}
+
+Graphics::TransparentSurface *GriffonEngine::loadImage(const char *name, bool colorkey) {
+ Common::File file;
+
+ file.open(name);
+ if (!file.isOpen()) {
+ error("Cannot open file %s", name);
+ }
+
+ debug(1, "Loading: %s", name);
+
+ Image::BitmapDecoder bitmapDecoder;
+ bitmapDecoder.loadStream(file);
+ file.close();
+
+ Graphics::TransparentSurface *surface = new Graphics::TransparentSurface(*bitmapDecoder.getSurface()->convertTo(g_system->getScreenFormat()));
+
+ if (colorkey)
+ surface->applyColorKey(255, 0, 255);
+
+ return surface;
+}
+
+void GriffonEngine::loadMap(int mapnum) {
+ debug(2, "Loaded map %d", mapnum);
+
+ unsigned int ccc = _clipbg->format.RGBToColor(255, 255, 255);
+
+ _curmap = mapnum;
+ Common::Rect trect(320, 240);
+
+ _mapbg->fillRect(trect, 0);
+ _clipbg->fillRect(trect, ccc);
+ _clipbg2->fillRect(trect, ccc);
+
+ _forcepause = false;
+ cloudson = 0;
+ if (mapnum < 6)
+ cloudson = 1;
+ if (mapnum > 41)
+ cloudson = 1;
+ if (mapnum > 47)
+ cloudson = 0;
+ if (mapnum == 52)
+ cloudson = 1;
+ if (mapnum == 60)
+ cloudson = 1;
+ if (mapnum == 50)
+ cloudson = 1;
+ if (mapnum == 54)
+ cloudson = 1;
+ if (mapnum == 58)
+ cloudson = 1;
+ if (mapnum == 62)
+ cloudson = 1;
+ if (mapnum == 83)
+ cloudson = 1;
+
+ // -----------special case
+ dontdrawover = 0;
+ if (mapnum == 24)
+ dontdrawover = 1;
+
+ if ((mapnum == 53 || mapnum == 57 || mapnum == 61 || mapnum == 65 || mapnum == 62) && _scriptflag[kScriptLever][0] > 0)
+ mapnum = mapnum + 100;
+ if ((mapnum == 161 || mapnum == 162) && _scriptflag[kScriptLever][0] == 2)
+ mapnum = mapnum + 100;
+
+ for (int i = 0; i < kMaxSpell; i++)
+ spellinfo[i].frame = 0;
+
+ _roomlock = false;
+
+ char name[256];
+ // read *.map file
+ sprintf(name, "mapdb/%04i.map", mapnum);
+ debug(1, "Reading %s", name);
+
+ Common::File file;
+ file.open(name);
+
+ if (!file.isOpen())
+ error("Cannot open file %s", name);
+
+ int tempmap[320][200];
+ for (int x = 0; x <= 319; x++) {
+ for (int y = 0; y <= 199; y++)
+ INPUT("%i", &tempmap[x][y]);
+ }
+ file.close();
+
+ for (int x = 0; x <= 319; x++) {
+ for (int y = 0; y <= 239; y++)
+ _triggerloc[x][y] = -1;
+ }
+
+ // read *.trg file
+ sprintf(name, "mapdb/%04i.trg", mapnum);
+ debug(1, "Reading %s", name);
+ file.open(name);
+
+ if (!file.isOpen())
+ error("Cannot open file %s", name);
+
+ INPUT("%i", &_ntriggers);
+
+ for (int i = 0; i < _ntriggers; i++) {
+ int mapx, mapy, trig;
+
+ INPUT("%i", &mapx);
+ INPUT("%i", &mapy);
+ INPUT("%i", &trig);
+
+ _triggerloc[mapx][mapy] = trig;
+ }
+ file.close();
+
+
+ for (int y = 0; y <= 23; y++) {
+ for (int x = 0; x <= 39; x++)
+ _rampdata[x][y] = tempmap[3 * 40 + x][y + 40];
+ }
+
+ for (int y = 0; y <= 23; y++) {
+ for (int x = 0; x <= 39; x++) {
+ for (int l = 0; l <= 2; l++) {
+ for (int a = 0; a <= 2; a++)
+ _tileinfo[l][x][y][a] = 0;
+ }
+ }
+ }
+
+ if (_scriptflag[kScriptFindShield][0] == 1 && _curmap == 4) {
+ _triggerloc[9][7] = 5004;
+ tempmap[9][7] = 41;
+ tempmap[9][7 + 40] = 0;
+ }
+
+ for (int y = 0; y <= 23; y++) {
+ for (int x = 0; x <= 39; x++) {
+ for (int l = 0; l <= 2; l++) {
+ int ly = y;
+ int lx = x + l * 40;
+
+ // tile
+ int curtile = tempmap[lx][ly];
+ int curtilelayer = tempmap[lx][ly + 40];
+
+ if (curtile > 0) {
+ curtile = curtile - 1;
+ int curtilel = curtilelayer;
+ int curtilex = curtile % 20;
+ int curtiley = (curtile - curtilex) / 20;
+
+ _tileinfo[l][x][y][0] = curtile + 1;
+ _tileinfo[l][x][y][1] = curtilelayer;
+
+ rcSrc.left = curtilex * 16;
+ rcSrc.top = curtiley * 16;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
+
+ rcDest.left = x * 16;
+ rcDest.top = y * 16;
+ rcDest.setWidth(16);
+ rcDest.setHeight(16);
+
+ if (l == 2 && curtilel == 1) {
+ for (int ff = 0; ff <= 5; ff++) {
+ int ffa = 20 * 5 - 1 + ff * 20;
+ int ffb = 20 * 5 + 4 + ff * 20;
+ if (curtile > ffa && curtile < ffb) {
+ _tiles[curtilel]->setAlpha(128, true);
+ }
+ }
+ }
+ if (l == 1 && curtilel == 2) {
+ for (int ff = 0; ff <= 4; ff++) {
+ int ffa = 20 * (5 + ff) + 3;
+ if (curtile == ffa) {
+ _tiles[curtilel]->setAlpha(192, true);
+ }
+ }
+ }
+
+ _tiles[curtilel]->blit(*_mapbg, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _tiles[curtilel]->setAlpha(255, true);
+
+ rcDest.left = x * 8;
+ rcDest.top = y * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
+
+ _clipbg->fillRect(rcDest, 0);
+ }
+ }
+ }
+ }
+
+ for (int x = 0; x <= 39; x++) {
+ for (int y = 0; y <= 23; y++) {
+ int d = tempmap[3 * 40 + x][y];
+
+ if (_scriptflag[kScriptFindShield][0] == 1 && x == 9 && y == 7)
+ d = 99;
+
+ if (d > 0) {
+ int clip = d % 2;
+ d = (d - clip) / 2;
+ int npc = d % 2;
+ d = (d - npc) / 2;
+
+ if (d == 99 && x == 9 && y == 7)
+ clip = 1;
+
+ if (clip) {
+ if (d != 99)
+ d = tempmap[6 * 40 + x][y];
+ if (d == 99)
+ d = 1;
+
+ int x1 = x * 8;
+ int y1 = y * 8;
+
+ if (d == 1) {
+ for (int i = 0; i <= 7; i++) {
+ drawLine(_clipbg, x1, y1 + i, x1 + 7 - i, y1 + i, ccc);
+ }
+ } else if (d == 2) {
+ drawLine(_clipbg, x1, y1, x1 + 7, y1, ccc);
+ drawLine(_clipbg, x1, y1 + 1, x1 + 7, y1 + 1, ccc);
+ } else if (d == 3) {
+ for (int i = 0; i <= 7; i++) {
+ drawLine(_clipbg, x1 + i, y1 + i, x1 + 7, y1 + i, ccc);
+ }
+ } else if (d == 4) {
+ drawLine(_clipbg, x1, y1, x1, y1 + 7, ccc);
+ drawLine(_clipbg, x1 + 1, y1, x1 + 1, y1 + 7, ccc);
+ } else if (d == 5) {
+ rcDest.left = x1;
+ rcDest.top = y1;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
+ _clipbg->fillRect(rcDest, ccc);
+ } else if (d == 6) {
+ drawLine(_clipbg, x1 + 7, y1, x1 + 7, y1 + 7, ccc);
+ drawLine(_clipbg, x1 + 6, y1, x1 + 6, y1 + 7, ccc);
+ } else if (d == 7) {
+ for (int i = 0; i <= 7; i++) {
+ drawLine(_clipbg, x1, y1 + i, x1 + i, y1 + i, ccc);
+ }
+ } else if (d == 8) {
+ drawLine(_clipbg, x1, y1 + 7, x1 + 7, y1 + 7, ccc);
+ drawLine(_clipbg, x1, y1 + 7, x1 + 6, y1 + 6, ccc);
+ } else if (d == 9) {
+ for (int i = 0; i <= 7; i++) {
+ drawLine(_clipbg, x1 + 7 - i, y1 + i, x1 + 7, y1 + i, ccc);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ _lastObj = 0;
+ _lastnpc = 0;
+
+ for (int i = 0; i < kMaxNPC; i++)
+ _npcinfo[i].onmap = 0;
+
+ for (int x = 0; x <= 19; x++) {
+ for (int y = 0; y <= 19; y++) {
+ int d = tempmap[3 * 40 + x][y];
+
+ int npc = 0;
+ int obj = 0;
+ if (d > 0) {
+ int clip = d % 2;
+ d = (d - clip) / 2;
+ npc = d % 2;
+ d = (d - npc) / 2;
+ obj = d % 2;
+ }
+
+ _objectMap[x][y] = -1;
+
+ if (obj == 1) {
+
+ int o = tempmap[5 * 40 + x][y];
+
+ if (_objmapf[_curmap][x][y] == 0) {
+ _objectMap[x][y] = o;
+
+ if (_objectInfo[o][0] > 1) {
+ if (o > _lastObj)
+ _lastObj = o;
+ }
+
+ int x1 = x * 8;
+ int y1 = y * 8;
+
+ rcDest.left = x1;
+ rcDest.top = y1;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
+
+ if (_objectInfo[o][4] == 1)
+ _clipbg->fillRect(rcDest, ccc);
+ if (_objectInfo[o][4] == 3)
+ _clipbg->fillRect(rcDest, ccc);
+ }
+ }
+ if (npc == 1) {
+ int o = tempmap[4 * 40 + x][y];
+
+ if (o > _lastnpc)
+ _lastnpc = o;
+
+ _npcinfo[o].x = x * 16 - 4;
+ _npcinfo[o].y = y * 16 - 5;
+
+ _npcinfo[o].walkdir = 1;
+ _npcinfo[o].onmap = 1;
+ }
+ }
+ }
+
+
+ if (_curmap == 62 && _scriptflag[kScriptGardenMasterKey][0] > 0)
+ _lastnpc = 0;
+ if (_curmap == 73 && _scriptflag[kScriptArmourChest][0] > 0)
+ _lastnpc = 0;
+ if (_curmap == 81 && _scriptflag[kScriptCitadelMasterKey][0] > 0)
+ _lastnpc = 0;
+
+ if (_curmap == 73 && _scriptflag[kScriptArmourChest][0] == 0)
+ _roomlock = true;
+ if (_curmap == 81 && _scriptflag[kScriptCitadelMasterKey][0] == 0)
+ _roomlock = true;
+ if (_curmap == 83 && _scriptflag[kScriptGetSword3][0] == 0)
+ _roomlock = true;
+ if (_curmap == 82)
+ _roomlock = true;
+
+ // read *.npc file
+ sprintf(name, "mapdb/%04i.npc", mapnum);
+ debug(1, "Reading %s", name);
+ file.open(name);
+
+ if (!file.isOpen())
+ error("Cannot open file %s", name);
+
+ for (int i = 0; i < kMaxNPC; i++) {
+ INPUT("%i", &_npcinfo[i].spriteset);
+ INPUT("%i", &_npcinfo[i].x1);
+ INPUT("%i", &_npcinfo[i].y1);
+ INPUT("%i", &_npcinfo[i].x2);
+ INPUT("%i", &_npcinfo[i].y2);
+ INPUT("%i", &_npcinfo[i].movementmode);
+ INPUT("%i", &_npcinfo[i].hp);
+ INPUT("%i", &_npcinfo[i].item1);
+ INPUT("%i", &_npcinfo[i].item2);
+ INPUT("%i", &_npcinfo[i].item3);
+ INPUT("%i", &_npcinfo[i].script);
+
+ // baby dragon
+ if (_npcinfo[i].spriteset == 1) {
+ _npcinfo[i].hp = 12;
+ _npcinfo[i].attackdelay = 2000;
+
+ _npcinfo[i].attackdamage = 2;
+ _npcinfo[i].spelldamage = 0;
+
+ _npcinfo[i].walkspd = 1;
+
+ if (RND() * 5 == 0)
+ _npcinfo[i].hp = 0;
+ }
+
+ // onewing
+ if (_npcinfo[i].spriteset == 2) {
+ _npcinfo[i].hp = 200;
+ _npcinfo[i].attackdelay = 2000;
+ _npcinfo[i].swayspd = 1;
+
+ _npcinfo[i].attackdamage = 24;
+ _npcinfo[i].spelldamage = 30;
+
+ _npcinfo[i].walkspd = 1.4f;
+ _npcinfo[i].castpause = _ticks;
+ }
+
+ // boss1
+ if (_npcinfo[i].spriteset == 3) {
+ _npcinfo[i].hp = 300;
+ _npcinfo[i].attackdelay = 2200;
+
+ _npcinfo[i].attackdamage = 0;
+ _npcinfo[i].spelldamage = 30;
+
+ _npcinfo[i].walkspd = 1.2f;
+ }
+
+ // black knights
+ if (_npcinfo[i].spriteset == 4) {
+ _npcinfo[i].hp = 200;
+ _npcinfo[i].attackdelay = 2800;
+
+ _npcinfo[i].attackdamage = 0;
+ _npcinfo[i].spelldamage = 30;
+
+ _npcinfo[i].walkspd = 1;
+ }
+
+ // boss2 firehydra
+ if (_npcinfo[i].spriteset == 5) {
+ _npcinfo[i].hp = 600;
+ _npcinfo[i].attackdelay = 2200;
+
+ _npcinfo[i].attackdamage = 50;
+ _npcinfo[i].spelldamage = 30;
+
+ _npcinfo[i].walkspd = 1.3f;
+
+ _npcinfo[i].swayangle = 0;
+ }
+
+ // baby fire dragon
+ if (_npcinfo[i].spriteset == 6) {
+ _npcinfo[i].hp = 20;
+ _npcinfo[i].attackdelay = 1500;
+
+ _npcinfo[i].attackdamage = 0;
+ _npcinfo[i].spelldamage = 12;
+
+ _npcinfo[i].walkspd = 1;
+
+ if (RND() * 5 == 0)
+ _npcinfo[i].hp = 0;
+ }
+
+ // priest1
+ if (_npcinfo[i].spriteset == 7) {
+ _npcinfo[i].hp = 40;
+ _npcinfo[i].attackdelay = 5000;
+
+ _npcinfo[i].attackdamage = 0;
+ _npcinfo[i].spelldamage = 8;
+
+ _npcinfo[i].walkspd = 1;
+
+ if (RND() * 8 == 0)
+ _npcinfo[i].hp = 0;
+ }
+
+ // yellow fire dragon
+ if (_npcinfo[i].spriteset == 8) {
+ _npcinfo[i].hp = 100;
+ _npcinfo[i].attackdelay = 1500;
+
+ _npcinfo[i].attackdamage = 0;
+ _npcinfo[i].spelldamage = 24;
+
+ _npcinfo[i].walkspd = 1;
+
+ if (RND() * 5 == 0)
+ _npcinfo[i].hp = 0;
+ }
+
+ // twowing
+ if (_npcinfo[i].spriteset == 9) {
+ _npcinfo[i].hp = 140;
+ _npcinfo[i].attackdelay = 2000;
+ _npcinfo[i].swayspd = 1;
+
+ _npcinfo[i].attackdamage = 30;
+ _npcinfo[i].spelldamage = 0;
+
+ _npcinfo[i].walkspd = 1;
+
+ _npcinfo[i].castpause = 0;
+ }
+
+ // dragon2
+ if (_npcinfo[i].spriteset == 10) {
+ _npcinfo[i].hp = 80;
+ _npcinfo[i].attackdelay = 1500;
+
+ _npcinfo[i].attackdamage = 24;
+ _npcinfo[i].spelldamage = 0;
+
+ _npcinfo[i].walkspd = 1;
+
+ _npcinfo[i].floating = RND() * 16;
+ }
+
+ // end boss
+ if (_npcinfo[i].spriteset == 11) {
+ _npcinfo[i].hp = 1200;
+ _npcinfo[i].attackdelay = 2000;
+
+ _npcinfo[i].attackdamage = 100;
+ _npcinfo[i].spelldamage = 60;
+
+ _npcinfo[i].walkspd = 1;
+
+ _npcinfo[i].floating = RND() * 16;
+ }
+
+ // bat kitty
+ if (_npcinfo[i].spriteset == 12) {
+ _npcinfo[i].hp = 800;
+ _npcinfo[i].attackdelay = 2000;
+
+ _npcinfo[i].attackdamage = 100;
+ _npcinfo[i].spelldamage = 50;
+
+ _npcinfo[i].walkspd = 1;
+
+ _npcinfo[i].floating = RND() * 16;
+ }
+
+ if (_npcinfo[i].onmap == 0)
+ _npcinfo[i].hp = 0;
+
+ _npcinfo[i].maxhp = _npcinfo[i].hp;
+
+ _npcinfo[i].attacking = 0;
+ _npcinfo[i].attackframe = 0;
+ _npcinfo[i].cattackframe = 0;
+ _npcinfo[i].attackspd = 1.5;
+ _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay * (1 + RND() * 2);
+
+ if (_npcinfo[i].spriteset == 2 || _npcinfo[i].spriteset == 9) {
+ _npcinfo[i].bodysection[0].sprite = 0;
+ _npcinfo[i].bodysection[1].sprite = 1;
+ _npcinfo[i].bodysection[2].sprite = 2;
+ _npcinfo[i].bodysection[3].sprite = 3;
+ _npcinfo[i].bodysection[4].sprite = 4;
+ _npcinfo[i].bodysection[5].sprite = 3;
+ _npcinfo[i].bodysection[6].sprite = 3;
+ _npcinfo[i].bodysection[7].sprite = 5;
+
+ _npcinfo[i].bodysection[0].bonelength = 8;
+ _npcinfo[i].bodysection[1].bonelength = 7;
+ _npcinfo[i].bodysection[2].bonelength = 6;
+ _npcinfo[i].bodysection[3].bonelength = 4;
+ _npcinfo[i].bodysection[4].bonelength = 4;
+ _npcinfo[i].bodysection[5].bonelength = 4;
+ _npcinfo[i].bodysection[6].bonelength = 4;
+
+ for (int f = 0; f <= 7; f++) {
+ _npcinfo[i].bodysection[f].x = _npcinfo[i].x + 12;
+ _npcinfo[i].bodysection[f].y = _npcinfo[i].y + 14;
+ }
+
+ _npcinfo[i].headtargetx[0] = _npcinfo[i].x + 12;
+ _npcinfo[i].headtargety[0] = _npcinfo[i].y + 14;
+
+ }
+
+ if (_npcinfo[i].spriteset == 5) {
+ for (int f = 0; f <= 29; f++) {
+ _npcinfo[i].bodysection[f].x = _npcinfo[i].x + 12;
+ _npcinfo[i].bodysection[f].y = _npcinfo[i].y + 14;
+ }
+
+ for (int f = 0; f <= 2; f++) {
+ _npcinfo[i].headtargetx[f] = _npcinfo[i].x + 12;
+ _npcinfo[i].headtargety[f] = _npcinfo[i].y + 14;
+
+ _npcinfo[i].attacking2[f] = 0;
+ _npcinfo[i].attackframe2[f] = 0;
+ }
+ }
+
+ if (_npcinfo[i].script == kScriptMasterKey) {
+ _roomlock = true;
+ if (_scriptflag[kScriptMasterKey][0] > 0) {
+ _roomlock = false;
+ _npcinfo[i].hp = 0;
+ }
+ }
+
+ if (_npcinfo[i].script == kScriptFindCtystal) {
+ _roomlock = true;
+ if (_scriptflag[kScriptFindCtystal][0] > 0) {
+ _roomlock = false;
+ _npcinfo[i].hp = 0;
+ }
+ }
+
+ if (_npcinfo[i].script == kScriptFindSword) {
+ _roomlock = true;
+ if (_scriptflag[kScriptFindSword][0] > 0) {
+ _roomlock = false;
+ _npcinfo[i].hp = 0;
+ }
+ }
+
+ if (_npcinfo[i].script == kScriptGetSword3) {
+ _roomlock = true;
+ if (_scriptflag[kScriptGetSword3][0] > 0) {
+ _roomlock = false;
+ _npcinfo[i].hp = 0;
+ }
+ }
+
+ _npcinfo[i].pause = _ticks;
+ }
+
+ file.close();
+
+
+ int cx, cy, npx, npy, lx, ly;
+
+ // academy master key
+ if (_curmap == 34 && _scriptflag[kScriptMasterKey][0] == 1) {
+ cx = 9;
+ cy = 7;
+
+ _objectMap[cx][cy] = 5;
+
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
+
+ npx = _player.px + 12;
+ npy = _player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if (lx == cx && ly == cy)
+ _player.py = _player.py + 16;
+
+ _clipbg->fillRect(rcDest, ccc);
+ }
+
+ // academy crystal
+ if (_curmap == 24 && _player.foundspell[0] == 0 && _scriptflag[kScriptFindCtystal][0] == 1) {
+ cx = 9;
+ cy = 7;
+
+ _objectMap[cx][cy] = 6;
+
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
+
+ npx = _player.px + 12;
+ npy = _player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if (lx == cx && ly == cy)
+ _player.py = _player.py + 16;
+
+ _clipbg->fillRect(rcDest, ccc);
+ }
+
+ // gardens master key
+ if (_curmap == 62 && _scriptflag[kScriptGardenMasterKey][0] == 1) {
+ cx = 13;
+ cy = 7;
+
+ _objectMap[cx][cy] = 5;
+
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
+
+ npx = _player.px + 12;
+ npy = _player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if (lx == cx && ly == cy)
+ _player.py = _player.py + 16;
+
+ _clipbg->fillRect(rcDest, ccc);
+ }
+
+ // gardens fidelis sword
+ if (_curmap == 66 && _scriptflag[kScriptFindSword][0] == 1 && _player.sword == 1) {
+ cx = 9;
+ cy = 6;
+
+ _objectMap[cx][cy] = 9;
+
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
+
+ npx = _player.px + 12;
+ npy = _player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if (lx == cx && ly == cy)
+ _player.py = _player.py + 16;
+
+ _clipbg->fillRect(rcDest, ccc);
+ }
+
+ // citadel armour
+ if (_curmap == 73 && _scriptflag[kScriptArmourChest][0] == 1 && _player.armour == 1) {
+ cx = 8;
+ cy = 7;
+
+ _objectMap[cx][cy] = 16;
+
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
+
+ npx = _player.px + 12;
+ npy = _player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if (lx == cx && ly == cy)
+ _player.py = _player.py + 16;
+
+ _clipbg->fillRect(rcDest, ccc);
+ }
+
+ // citadel master key
+ if (_curmap == 81 && _scriptflag[kScriptCitadelMasterKey][0] == 1) {
+ cx = 11;
+ cy = 10;
+
+ _objectMap[cx][cy] = 5;
+
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
+
+ npx = _player.px + 12;
+ npy = _player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if (lx == cx && ly == cy)
+ _player.py = _player.py + 16;
+
+ _clipbg->fillRect(rcDest, ccc);
+ }
+
+
+ // max ups
+ if (_curmap == 83 && _scriptflag[kScriptGetSword3][0] == 1 && _player.sword < 3) {
+ cx = 6;
+ cy = 8;
+
+ _objectMap[cx][cy] = 18;
+
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
+
+ npx = _player.px + 12;
+ npy = _player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if (lx == cx && ly == cy)
+ _player.py = _player.py + 16;
+
+ _clipbg->fillRect(rcDest, ccc);
+ }
+
+ if (_curmap == 83 && _scriptflag[kScriptShield3][0] == 1 && _player.shield < 3) {
+ cx = 9;
+ cy = 8;
+
+ _objectMap[cx][cy] = 19;
+
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
+
+ npx = _player.px + 12;
+ npy = _player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if (lx == cx && ly == cy)
+ _player.py = _player.py + 16;
+
+ _clipbg->fillRect(rcDest, ccc);
+ }
+
+ if (_curmap == 83 && _scriptflag[kScriptArmour3][0] == 1 && _player.armour < 3) {
+ cx = 12;
+ cy = 8;
+
+ _objectMap[cx][cy] = 20;
+
+ rcDest.left = cx * 8;
+ rcDest.top = cy * 8;
+ rcDest.setWidth(8);
+ rcDest.setHeight(8);
+
+ npx = _player.px + 12;
+ npy = _player.py + 20;
+
+ lx = (int)npx / 16;
+ ly = (int)npy / 16;
+
+ if (lx == cx && ly == cy)
+ _player.py = _player.py + 16;
+
+ _clipbg->fillRect(rcDest, ccc);
+ }
+
+ _clipbg2->copyRectToSurface(_clipbg->getPixels(), _clipbg->pitch, 0, 0, _clipbg->w, _clipbg->h);
+}
+
+void GriffonEngine::loadAnims() {
+ _spellimg = loadImage("art/spells.bmp", true);
+ _anims[0] = loadImage("art/anims0.bmp", true);
+ _animsa[0] = loadImage("art/anims0a.bmp", true);
+ _anims[13] = loadImage("art/anims0x.bmp", true);
+ _animsa[13] = loadImage("art/anims0xa.bmp", true);
+ _anims[1] = loadImage("art/anims1.bmp", true);
+ _animsa[1] = loadImage("art/anims1a.bmp", true);
+ _anims[2] = loadImage("art/anims2.bmp", true);
+
+ // huge
+ _animset2[0].xofs = 8;
+ _animset2[0].yofs = 7;
+ _animset2[0].x = 123;
+ _animset2[0].y = 0;
+ _animset2[0].w = 18;
+ _animset2[0].h = 16;
+ // big
+ _animset2[1].xofs = 7;
+ _animset2[1].yofs = 7;
+ _animset2[1].x = 107;
+ _animset2[1].y = 0;
+ _animset2[1].w = 16;
+ _animset2[1].h = 14;
+ // med
+ _animset2[2].xofs = 6;
+ _animset2[2].yofs = 6;
+ _animset2[2].x = 93;
+ _animset2[2].y = 0;
+ _animset2[2].w = 14;
+ _animset2[2].h = 13;
+ // small
+ _animset2[3].xofs = 4;
+ _animset2[3].yofs = 4;
+ _animset2[3].x = 83;
+ _animset2[3].y = 0;
+ _animset2[3].w = 10;
+ _animset2[3].h = 10;
+ // wing
+ _animset2[4].xofs = 4;
+ _animset2[4].yofs = 20;
+ _animset2[4].x = 42;
+ _animset2[4].y = 0;
+ _animset2[4].w = 41;
+ _animset2[4].h = 33;
+ // head
+ _animset2[5].xofs = 20;
+ _animset2[5].yofs = 18;
+ _animset2[5].x = 0;
+ _animset2[5].y = 0;
+ _animset2[5].w = 42;
+ _animset2[5].h = 36;
+
+ _anims[9] = loadImage("art/anims9.bmp", true);
+
+ // huge
+ _animset9[0].xofs = 8;
+ _animset9[0].yofs = 7;
+ _animset9[0].x = 154;
+ _animset9[0].y = 0;
+ _animset9[0].w = 18;
+ _animset9[0].h = 16;
+ // big
+ _animset9[1].xofs = 7;
+ _animset9[1].yofs = 7;
+ _animset9[1].x = 138;
+ _animset9[1].y = 0;
+ _animset9[1].w = 16;
+ _animset9[1].h = 14;
+ // med
+ _animset9[2].xofs = 6;
+ _animset9[2].yofs = 6;
+ _animset9[2].x = 93 + 31;
+ _animset9[2].y = 0;
+ _animset9[2].w = 14;
+ _animset9[2].h = 13;
+ // small
+ _animset9[3].xofs = 4;
+ _animset9[3].yofs = 4;
+ _animset9[3].x = 83 + 31;
+ _animset9[3].y = 0;
+ _animset9[3].w = 10;
+ _animset9[3].h = 10;
+ // wing
+ _animset9[4].xofs = 36;
+ _animset9[4].yofs = 20;
+ _animset9[4].x = 42;
+ _animset9[4].y = 0;
+ _animset9[4].w = 72;
+ _animset9[4].h = 33;
+ // head
+ _animset9[5].xofs = 20;
+ _animset9[5].yofs = 18;
+ _animset9[5].x = 0;
+ _animset9[5].y = 0;
+ _animset9[5].w = 42;
+ _animset9[5].h = 36;
+
+ _anims[3] = loadImage("art/anims3.bmp", true);
+ _anims[4] = loadImage("art/anims4.bmp", true);
+ _anims[5] = loadImage("art/anims5.bmp", true);
+ _anims[6] = loadImage("art/anims6.bmp", true);
+ _anims[7] = loadImage("art/anims7.bmp", true);
+ _anims[8] = loadImage("art/anims8.bmp", true);
+ _anims[10] = loadImage("art/anims10.bmp", true);
+ _animsa[10] = loadImage("art/anims10a.bmp", true);
+ _anims[11] = loadImage("art/anims11.bmp", true);
+ _animsa[11] = loadImage("art/anims11a.bmp", true);
+ _anims[12] = loadImage("art/anims12.bmp", true);
+}
+
+void GriffonEngine::loadItemImgs() {
+ Graphics::TransparentSurface *temp = loadImage("art/icons.bmp", true);
+
+ for (int i = 0; i <= 20; i++) {
+ _itemimg[i] = new Graphics::TransparentSurface;
+ _itemimg[i]->create(16, 16, g_system->getScreenFormat());
+
+ rcSrc.left = i * 16;
+ rcSrc.top = 0;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
+
+ temp->blit(*_itemimg[i], 0, 0, Graphics::FLIP_NONE, &rcSrc);
+ }
+
+ temp->free();
+}
+
+void GriffonEngine::loadFont() {
+ Graphics::TransparentSurface *font = loadImage("art/font.bmp", true);
+
+ for (int i = 32; i <= 255; i++)
+ for (int f = 0; f <= 4; f++) {
+ int i2 = i - 32;
+
+ _fontchr[i2][f] = new Graphics::TransparentSurface;
+ _fontchr[i2][f]->create(8, 8, g_system->getScreenFormat());
+
+ int col = i2 % 40;
+
+ int row = (i2 - col) / 40;
+
+ rcSrc.left = col * 8;
+ rcSrc.top = row * 8 + f * 48;
+ rcSrc.setWidth(8);
+ rcSrc.setHeight(8);
+
+ rcDest.left = 0;
+ rcDest.top = 0;
+ font->blit(*_fontchr[i2][f], rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ }
+
+ font->free();
+}
+
+void GriffonEngine::loadTiles() {
+ _tiles[0] = loadImage("art/tx.bmp", true);
+ _tiles[1] = loadImage("art/tx1.bmp", true);
+ _tiles[2] = loadImage("art/tx2.bmp", true);
+ _tiles[3] = loadImage("art/tx3.bmp", true);
+
+ _windowimg = loadImage("art/window.bmp", true);
+}
+
+void GriffonEngine::loadTriggers() {
+ Common::File file;
+ file.open("data/triggers.dat");
+
+ if (!file.isOpen())
+ error("Cannot open file data/Triggers.dat");
+
+ for (int i = 0; i <= 9999; i++) {
+ for (int a = 0; a <= 8; a++)
+ INPUT("%i", &_triggers[i][a]);
+ }
+
+ file.close();
+}
+
+void GriffonEngine::loadObjectDB() {
+ Common::File file;
+
+ file.open("objectdb.dat");
+ if (!file.isOpen())
+ error("Cannot open file objectdb.dat");
+
+ for (int a = 0; a <= 32; a++) {
+ for (int b = 0; b <= 5; b++) {
+ INPUT("%i", &_objectInfo[a][b]);
+ }
+
+ for (int b = 0; b <= 8; b++) {
+ for (int c = 0; c <= 2; c++) {
+ for (int d = 0; d <= 2; d++) {
+ for (int e = 0; e <= 1; e++) {
+ INPUT("%i", &_objectTile[a][b][c][d][e]);
+ }
+ }
+ }
+ }
+ }
+
+ file.close();
+}
+
+
+} // end of namespace Griffon
Commit: 8b62fa8947bf3cac3a9d87d1521265f6edc59d05
https://github.com/scummvm/scummvm/commit/8b62fa8947bf3cac3a9d87d1521265f6edc59d05
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Added input.cpp
Changed paths:
A engines/griffon/input.cpp
engines/griffon/engine.cpp
engines/griffon/griffon.h
engines/griffon/module.mk
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index b916f86..1c7cac9 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -123,320 +123,6 @@ void GriffonEngine::addFloatText(const char *stri, float xloc, float yloc, int c
}
}
-void GriffonEngine::checkInputs() {
- int ntickdelay = 175;
-
- g_system->getEventManager()->pollEvent(_event);
-
- nposts = 0;
-
- for (int i = 0; i <= 20; i++) {
- postinfo[i][0] = 0;
- postinfo[i][1] = 0;
- }
-
- for (int x = 0; x <= 19; x++) {
- for (int y = 0; y <= 14; y++) {
- int o = _objectMap[x][y];
- if (_objectInfo[o][4] == 3) {
- postinfo[nposts][0] = x * 16;
- postinfo[nposts][1] = y * 16;
- nposts = nposts + 1;
- }
- }
- }
-
- if (attacking || (_forcepause && _itemselon == 0))
- return;
-
- if (_event.type == Common::EVENT_QUIT) {
- _shouldQuit = true;
- return;
- }
-
- if (_event.type == Common::EVENT_KEYDOWN) {
- if (_event.kbd.keycode == Common::KEYCODE_ESCAPE) {
- if (_itemticks < _ticks)
- title(1);
- } else if (_event.kbd.keycode == Common::KEYCODE_d && _event.kbd.hasFlags(Common::KBD_CTRL)) {
- _console->attach();
- _event.type = Common::EVENT_INVALID;
- } else if (_event.kbd.hasFlags(Common::KBD_CTRL)) {
- if (_itemselon == 0 && _itemticks < _ticks)
- attack();
-
- if (_itemselon == 1 && _itemticks < _ticks) {
- if (_curitem == 0 && _player.inventory[kInvFlask] > 0) {
- _itemticks = _ticks + ntickdelay;
-
- int heal = 50;
- int maxh = _player.maxhp - _player.hp;
-
- if (heal > maxh)
- heal = maxh;
-
- _player.hp = _player.hp + heal;
-
- char text[256];
- sprintf(text, "+%i", heal);
- addFloatText(text, _player.px + 16 - 4 * strlen(text), _player.py + 16, 5);
-
- _player.inventory[kInvFlask]--;
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- _itemselon = 0;
- _forcepause = false;
- }
-
- if (_curitem == 1 && _player.inventory[kInvDoubleFlask] > 0) {
- _itemticks = _ticks + ntickdelay;
-
- int heal = 200;
- int maxh = _player.maxhp - _player.hp;
-
- if (heal > maxh)
- heal = maxh;
-
- _player.hp = _player.hp + heal;
-
- char text[256];
- sprintf(text, "+%i", heal);
- addFloatText(text, _player.px + 16 - 4 * strlen(text), _player.py + 16, 5);
-
- _player.inventory[kInvDoubleFlask]--;
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- _itemselon = 0;
- _forcepause = false;
- }
-
- if (_curitem == 2 && _player.inventory[kInvShock] > 0) {
- castSpell(8, _player.px, _player.py, _npcinfo[_curenemy].x, _npcinfo[_curenemy].y, 0);
-
- _forcepause = true;
-
- _player.inventory[kInvShock]--;
-
- _itemticks = _ticks + ntickdelay;
- _selenemyon = 0;
- _itemselon = 0;
-
- }
-
- if (_curitem == 3 && _player.inventory[kInvNormalKey] > 0 && _canUseKey && _lockType == 1) {
- _roomLocks[_roomToUnlock] = 0;
- eventText("UnLocked!");
-
- _player.inventory[kInvNormalKey]--;
-
- _itemticks = _ticks + ntickdelay;
- _selenemyon = 0;
- _itemselon = 0;
- return;
- }
-
- if (_curitem == 4 && _player.inventory[kInvMasterKey] > 0 && _canUseKey && _lockType == 2) {
- _roomLocks[_roomToUnlock] = 0;
- eventText("UnLocked!");
-
- _player.inventory[kInvMasterKey]--;
-
- _itemticks = _ticks + ntickdelay;
- _selenemyon = 0;
- _itemselon = 0;
- return;
- }
-
- if (_curitem == 5 && _player.spellcharge[0] == 100) {
- castSpell(5, _player.px, _player.py, _npcinfo[_curenemy].x, _npcinfo[_curenemy].y, 0);
-
- _player.spellcharge[0] = 0;
-
- _forcepause = true;
-
- _itemticks = _ticks + ntickdelay;
- _selenemyon = 0;
- _itemselon = 0;
- }
-
- if (_curitem > 5 && _selenemyon == 1) {
- if (_curenemy <= _lastnpc) {
- castSpell(_curitem - 6, _player.px, _player.py, _npcinfo[_curenemy].x, _npcinfo[_curenemy].y, 0);
- } else {
- int pst = _curenemy - _lastnpc - 1;
- castSpell(_curitem - 6, _player.px, _player.py, postinfo[pst][0], postinfo[pst][1], 0);
- }
-
- _player.spellcharge[_curitem - 5] = 0;
-
- _player.spellstrength = 0;
-
- _itemticks = _ticks + ntickdelay;
- _selenemyon = 0;
- _itemselon = 0;
- _forcepause = false;
- }
-
- if (_curitem > 5 && _selenemyon == 0 && _itemselon == 1) {
- if (ABS(_player.spellcharge[_curitem - 5] - 100) < kEpsilon) {
- _itemticks = _ticks + ntickdelay;
-
- _selenemyon = 1;
-
- int i = 0;
- do {
- if (_npcinfo[i].hp > 0) {
- _curenemy = i;
- goto __exit_do;
- }
- i = i + 1;
- if (i == _lastnpc + 1) {
- _selenemyon = 0;
- goto __exit_do;
- }
- } while (1);
-__exit_do:
-
- if (nposts > 0 && _selenemyon == 0) {
- _selenemyon = 1;
- _curenemy = _lastnpc + 1;
- }
- }
-
- }
- }
- } else if (_event.kbd.hasFlags(Common::KBD_ALT)) {
- if (_itemticks < _ticks) {
- _selenemyon = 0;
- if (_itemselon == 1) {
- _itemselon = 0;
- _itemticks = _ticks + 220;
- _forcepause = false;
- } else {
- _itemselon = 1;
- _itemticks = _ticks + 220;
- _forcepause = true;
- _player.itemselshade = 0;
- }
- }
- }
- }
-
- if (_itemselon == 0) {
- movingup = false;
- movingdown = false;
- movingleft = false;
- movingright = false;
- if (_event.kbd.keycode == Common::KEYCODE_UP)
- movingup = true;
- if (_event.kbd.keycode == Common::KEYCODE_DOWN)
- movingdown = true;
- if (_event.kbd.keycode == Common::KEYCODE_LEFT)
- movingleft = true;
- if (_event.kbd.keycode == Common::KEYCODE_RIGHT)
- movingright = true;
- } else {
- movingup = false;
- movingdown = false;
- movingleft = false;
- movingright = false;
-
- if (_selenemyon == 1) {
- if (_itemticks < _ticks) {
- if (_event.kbd.keycode == Common::KEYCODE_LEFT) {
- int origin = _curenemy;
- do {
- _curenemy = _curenemy - 1;
- if (_curenemy < 1)
- _curenemy = _lastnpc + nposts;
- if (_curenemy == origin)
- break;
- if (_curenemy <= _lastnpc && _npcinfo[_curenemy].hp > 0)
- break;
- if (_curenemy > _lastnpc)
- break;
- } while (1);
- _itemticks = _ticks + ntickdelay;
- }
- if (_event.kbd.keycode == Common::KEYCODE_RIGHT) {
- int origin = _curenemy;
- do {
- _curenemy = _curenemy + 1;
- if (_curenemy > _lastnpc + nposts)
- _curenemy = 1;
- if (_curenemy == origin)
- break;
- if (_curenemy <= _lastnpc && _npcinfo[_curenemy].hp > 0)
- break;
- if (_curenemy > _lastnpc)
- break;
- } while (1);
- _itemticks = _ticks + ntickdelay;
- }
-
-
- if (_curenemy > _lastnpc + nposts)
- _curenemy = 1;
- if (_curenemy < 1)
- _curenemy = _lastnpc + nposts;
- }
- } else {
- if (_itemticks < _ticks) {
- if (_event.kbd.keycode == Common::KEYCODE_UP) {
- _curitem = _curitem - 1;
- _itemticks = _ticks + ntickdelay;
- if (_curitem == 4)
- _curitem = 9;
- if (_curitem == -1)
- _curitem = 4;
- }
- if (_event.kbd.keycode == Common::KEYCODE_DOWN) {
- _curitem = _curitem + 1;
- _itemticks = _ticks + ntickdelay;
- if (_curitem == 5)
- _curitem = 0;
- if (_curitem == 10)
- _curitem = 5;
- }
- if (_event.kbd.keycode == Common::KEYCODE_LEFT) {
- _curitem = _curitem - 5;
- _itemticks = _ticks + ntickdelay;
- }
- if (_event.kbd.keycode == Common::KEYCODE_RIGHT) {
- _curitem = _curitem + 5;
- _itemticks = _ticks + ntickdelay;
- }
-
- if (_curitem > 9)
- _curitem = _curitem - 10;
- if (_curitem < 0)
- _curitem = _curitem + 10;
- }
- }
- }
-}
-
-void GriffonEngine::checkTrigger() {
- int npx = _player.px + 12;
- int npy = _player.py + 20;
-
- int lx = (int)npx / 16;
- int ly = (int)npy / 16;
-
- _canUseKey = false;
-
- if (_triggerloc[lx][ly] > -1)
- processTrigger(_triggerloc[lx][ly]);
-}
-
void GriffonEngine::eventText(const char *stri) {
_videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
_videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
@@ -498,271 +184,6 @@ void GriffonEngine::eventText(const char *stri) {
}
-void GriffonEngine::handleWalking() {
- int xmax = 20 * 16 - 25;
- int ymax = 15 * 16 - 25;
-
- float px = _player.px;
- float py = _player.py;
- float opx = px;
- float opy = py;
-
- float spd = _player.walkspd * _fpsr;
-
- float nx = (px / 2 + 6);
- float ny = (py / 2 + 10);
-
- float npx = px + 12;
- float npy = py + 20;
- int lx = (int)npx / 16;
- int ly = (int)npy / 16;
-
- int ramp = _rampdata[lx][ly];
- if (ramp == 1 && movingup)
- spd *= 2;
- if (ramp == 1 && movingdown)
- spd *= 2;
-
- if (ramp == 2 && movingleft)
- movingup = true;
- if (ramp == 2 && movingright)
- movingdown = true;
-
- if (ramp == 3 && movingright)
- movingup = true;
- if (ramp == 3 && movingleft)
- movingdown = true;
-
- unsigned int *temp/*, c*/, bgc;
-
- for (int x = -1; x <= 1; x++) {
- for (int y = -1; y <= 1; y++) {
- int sx = nx + x;
- int sy = ny + y;
-
- _clipsurround[x + 1][y + 1] = 0;
- if (sx > -1 && sx < 320 && sy > -1 && sy < 192) {
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
- _clipsurround[x + 1][y + 1] = *temp;
- }
- }
- }
-
- if (movingup)
- _player.walkdir = 0;
- if (movingdown)
- _player.walkdir = 1;
- if (movingleft)
- _player.walkdir = 2;
- if (movingright)
- _player.walkdir = 3;
-
- if (movingup && _clipsurround[1][0] == 0) {
- py -= spd;
- _player.walkdir = 0;
- } else if (movingup && _clipsurround[1][0] > 0) {
- // move upleft
- if (!movingright && _clipsurround[0][0] == 0) {
- py -= spd;
- px -= spd;
- }
-
- // move upright
- if (!movingleft && _clipsurround[2][0] == 0) {
- py -= spd;
- px += spd;
- }
- }
- if (movingdown && _clipsurround[1][2] == 0) {
- py += spd;
- _player.walkdir = 1;
- } else if (movingdown && _clipsurround[1][2] > 0) {
- // move downleft
- if (movingright == 0 && _clipsurround[0][2] == 0) {
- py += spd;
- px -= spd;
- }
-
- // move downright
- if (movingleft == 0 && _clipsurround[2][2] == 0) {
- py += spd;
- px += spd;
- }
- }
- if (movingleft && _clipsurround[0][1] == 0) {
- px -= spd;
- _player.walkdir = 2;
- } else if (movingleft && _clipsurround[0][1] > 0) {
- // move leftup
- if (!movingdown && _clipsurround[0][0] == 0) {
- py -= spd;
- px -= spd;
- }
-
- // move leftdown
- if (!movingup && _clipsurround[0][2] == 0) {
- py += spd;
- px -= spd;
- }
- }
- if (movingright && _clipsurround[2][1] == 0) {
- px += spd;
- _player.walkdir = 3;
- } else if (movingright && _clipsurround[2][1] > 0) {
- // move rightup
- if (!movingdown && _clipsurround[2][0] == 0) {
- px += spd;
- py -= spd;
- }
-
- // move rightdown
- if (!movingup && _clipsurround[2][2] == 0) {
- py += spd;
- px += spd;
- }
- }
-
- if (px < -8)
- px = -8;
- if (px > xmax)
- px = xmax;
- if (py < -8)
- py = -8;
- if (py > ymax)
- py = ymax;
-
- int pass = 1;
-
- int sx = (px / 2 + 6);
- int sy = (py / 2 + 10);
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
- bgc = *temp;
- if (bgc > 0 && bgc != 1000) {
- px = opx;
- py = opy;
- pass = 0;
- }
-
- // push npc
- if (pass == 1) {
- for (int i = 1; i <= _lastnpc; i++) {
- if (_npcinfo[i].hp > 0) {
- npx = _npcinfo[i].x;
- npy = _npcinfo[i].y;
-
- opx = npx;
- opy = npy;
-
- int xdif = _player.px - npx;
- int ydif = _player.py - npy;
-
- if (_player.walkdir == 0) {
- if (abs(xdif) <= 8 && ydif > 0 && ydif < 8)
- _npcinfo[i].y -= spd;
- } else if (_player.walkdir == 1) {
- if (abs(xdif) <= 8 && ydif < 0 && ydif > -8)
- _npcinfo[i].y += spd;
- } else if (_player.walkdir == 2) {
- if (abs(ydif) <= 8 && xdif > 0 && xdif < 8)
- _npcinfo[i].x -= spd;
- } else if (_player.walkdir == 3) {
- if (abs(ydif) <= 8 && xdif < 0 && xdif > -8)
- _npcinfo[i].x += spd;
- }
-
- npx = _npcinfo[i].x;
- npy = _npcinfo[i].y;
-
- sx = (int)(npx / 2 + 6);
- sy = (int)(npy / 2 + 10);
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
- bgc = *temp;
-
- if (bgc > 0) {
- _npcinfo[i].x = opx;
- _npcinfo[i].y = opy;
- }
- }
- }
- }
-
- _player.opx = _player.px;
- _player.opy = _player.py;
- _player.px = px;
- _player.py = py;
-
- if (_player.px != _player.opx || _player.py != _player.opy)
- _player.walkframe += _animspd * _fpsr;
- if (_player.walkframe >= 16)
- _player.walkframe -= 16;
-
- // walking over items to pickup :::
- int o = _objectMap[lx][ly];
-
- if (o > -1) {
- // fsk
- if (_objectInfo[o][4] == 2 && _player.inventory[kInvFlask] < 9) {
- _objectMap[lx][ly] = -1;
-
- _player.inventory[kInvFlask]++;
- addFloatIcon(6, lx * 16, ly * 16);
-
- _objmapf[_curmap][lx][ly] = 1;
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
- }
- }
-
- if (_objectInfo[o][5] == 7 && _player.inventory[kInvDoubleFlask] < 9) {
- _objectMap[lx][ly] = -1;
-
- _player.inventory[kInvDoubleFlask]++;
- addFloatIcon(12, lx * 16, ly * 16);
-
- _objmapf[_curmap][lx][ly] = 1;
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
- }
- }
-
- if (_objectInfo[o][5] == 9 && _player.inventory[kInvShock] < 9 && (_curmap == 41 && _scriptflag[kScriptLightningBomb][1] == 0)) {
- _objectMap[lx][ly] = -1;
-
- _player.inventory[kInvShock]++;
- addFloatIcon(17, lx * 16, ly * 16);
-
- _objmapf[_curmap][lx][ly] = 1;
- if (_curmap == 41)
- _scriptflag[kScriptLightningBomb][1] = 1;
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- }
-
- if (_objectInfo[o][5] == 9 && _player.inventory[kInvShock] < 9) {
- _objectMap[lx][ly] = -1;
-
- _player.inventory[kInvShock]++;
- addFloatIcon(17, lx * 16, ly * 16);
-
- _objmapf[_curmap][lx][ly] = 1;
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- }
- }
-}
-
void GriffonEngine::newGame() {
intro();
@@ -872,72 +293,6 @@ void GriffonEngine::mainLoop() {
} while (!_shouldQuit);
}
-void GriffonEngine::processTrigger(int trignum) {
- int trigtype = _triggers[trignum][0];
-
- if (_roomlock)
- return;
-
- // map jump------------------------------
- if (trigtype == 0) {
- int tx = _triggers[trignum][1];
- int ty = _triggers[trignum][2];
- int tmap = _triggers[trignum][3];
- int tjumpstyle = _triggers[trignum][4];
-
- if (_roomLocks[tmap] > 0) {
- if (!_saidLocked)
- eventText("Locked");
- _saidLocked = true;
- _canUseKey = true;
- _lockType = _roomLocks[tmap];
- _roomToUnlock = tmap;
- return;
- }
-
- if (tmap == 1) {
- if (!_saidJammed)
- eventText("Door Jammed!");
- _saidJammed = true;
- return;
- }
-
- _saidLocked = false;
- _saidJammed = false;
-
- // loc-sxy+oldmaploc
- if (tjumpstyle == 0) {
-
- int tsx = _triggers[trignum][5];
- int tsy = _triggers[trignum][6];
-
- _player.px += (tx - tsx) * 16;
- _player.py += (ty - tsy) * 16;
-
- // HACKFIX
- if (_player.px < 0)
- _player.px = 0;
- if (_player.py < 0)
- _player.py = 0;
-
- if (tmap > 0) {
- if (config.effects) {
- int snd = playSound(_sfx[kSndDoor]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- loadMap(tmap);
- swash();
- }
- }
- }
-
- for (int i = 0; i < kMaxFloat; i++) {
- _floattext[i][0] = 0;
- _floaticon[i][0] = 0;
- }
-}
-
void GriffonEngine::updateAnims() {
for (int i = 0; i <= _lastObj; i++) {
int nframes = _objectInfo[i][0];
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 3296b91..26fe9b6 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -306,6 +306,12 @@ private:
void drawView();
void swash();
+ // input.cpp
+ void checkInputs();
+ void handleWalking();
+ void checkTrigger();
+ void processTrigger(int trignum);
+
// resources.cpp
void initialize();
Graphics::TransparentSurface *loadImage(const char *name, bool colorkey = false);
@@ -338,13 +344,9 @@ private:
void addFloatIcon(int ico, float xloc, float yloc);
void addFloatText(const char *stri, float xloc, float yloc, int col);
- void checkInputs();
- void checkTrigger();
void eventText(const char *stri);
- void handleWalking();
void newGame();
void mainLoop();
- void processTrigger(int trignum);
void updateAnims();
void updateY();
void updateNPCs();
diff --git a/engines/griffon/input.cpp b/engines/griffon/input.cpp
new file mode 100644
index 0000000..f7ebb15
--- /dev/null
+++ b/engines/griffon/input.cpp
@@ -0,0 +1,690 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Originally written by Syn9 in FreeBASIC with SDL
+ * http://syn9.thehideoutgames.com/index_backup.php
+ *
+ * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
+ * http://github.com/dmitrysmagin/griffon_legend
+ *
+ *
+ * Programming/Graphics: Daniel "Syn9" Kennedy
+ * Music/Sound effects: David Turner
+ *
+ * Beta testing and gameplay design help:
+ * Deleter, Cha0s, Aether Fox, and Kiz
+ *
+ */
+
+#include "common/system.h"
+
+#include "griffon/griffon.h"
+#include "griffon/config.h"
+#include "griffon/console.h"
+
+namespace Griffon {
+
+void GriffonEngine::checkInputs() {
+ int ntickdelay = 175;
+
+ g_system->getEventManager()->pollEvent(_event);
+
+ nposts = 0;
+
+ for (int i = 0; i <= 20; i++) {
+ postinfo[i][0] = 0;
+ postinfo[i][1] = 0;
+ }
+
+ for (int x = 0; x <= 19; x++) {
+ for (int y = 0; y <= 14; y++) {
+ int o = _objectMap[x][y];
+ if (_objectInfo[o][4] == 3) {
+ postinfo[nposts][0] = x * 16;
+ postinfo[nposts][1] = y * 16;
+ nposts = nposts + 1;
+ }
+ }
+ }
+
+ if (attacking || (_forcepause && _itemselon == 0))
+ return;
+
+ if (_event.type == Common::EVENT_QUIT) {
+ _shouldQuit = true;
+ return;
+ }
+
+ if (_event.type == Common::EVENT_KEYDOWN) {
+ if (_event.kbd.keycode == Common::KEYCODE_ESCAPE) {
+ if (_itemticks < _ticks)
+ title(1);
+ } else if (_event.kbd.keycode == Common::KEYCODE_d && _event.kbd.hasFlags(Common::KBD_CTRL)) {
+ _console->attach();
+ _event.type = Common::EVENT_INVALID;
+ } else if (_event.kbd.hasFlags(Common::KBD_CTRL)) {
+ if (_itemselon == 0 && _itemticks < _ticks)
+ attack();
+
+ if (_itemselon == 1 && _itemticks < _ticks) {
+ if (_curitem == 0 && _player.inventory[kInvFlask] > 0) {
+ _itemticks = _ticks + ntickdelay;
+
+ int heal = 50;
+ int maxh = _player.maxhp - _player.hp;
+
+ if (heal > maxh)
+ heal = maxh;
+
+ _player.hp = _player.hp + heal;
+
+ char text[256];
+ sprintf(text, "+%i", heal);
+ addFloatText(text, _player.px + 16 - 4 * strlen(text), _player.py + 16, 5);
+
+ _player.inventory[kInvFlask]--;
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ _itemselon = 0;
+ _forcepause = false;
+ }
+
+ if (_curitem == 1 && _player.inventory[kInvDoubleFlask] > 0) {
+ _itemticks = _ticks + ntickdelay;
+
+ int heal = 200;
+ int maxh = _player.maxhp - _player.hp;
+
+ if (heal > maxh)
+ heal = maxh;
+
+ _player.hp = _player.hp + heal;
+
+ char text[256];
+ sprintf(text, "+%i", heal);
+ addFloatText(text, _player.px + 16 - 4 * strlen(text), _player.py + 16, 5);
+
+ _player.inventory[kInvDoubleFlask]--;
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ _itemselon = 0;
+ _forcepause = false;
+ }
+
+ if (_curitem == 2 && _player.inventory[kInvShock] > 0) {
+ castSpell(8, _player.px, _player.py, _npcinfo[_curenemy].x, _npcinfo[_curenemy].y, 0);
+
+ _forcepause = true;
+
+ _player.inventory[kInvShock]--;
+
+ _itemticks = _ticks + ntickdelay;
+ _selenemyon = 0;
+ _itemselon = 0;
+
+ }
+
+ if (_curitem == 3 && _player.inventory[kInvNormalKey] > 0 && _canUseKey && _lockType == 1) {
+ _roomLocks[_roomToUnlock] = 0;
+ eventText("UnLocked!");
+
+ _player.inventory[kInvNormalKey]--;
+
+ _itemticks = _ticks + ntickdelay;
+ _selenemyon = 0;
+ _itemselon = 0;
+ return;
+ }
+
+ if (_curitem == 4 && _player.inventory[kInvMasterKey] > 0 && _canUseKey && _lockType == 2) {
+ _roomLocks[_roomToUnlock] = 0;
+ eventText("UnLocked!");
+
+ _player.inventory[kInvMasterKey]--;
+
+ _itemticks = _ticks + ntickdelay;
+ _selenemyon = 0;
+ _itemselon = 0;
+ return;
+ }
+
+ if (_curitem == 5 && _player.spellcharge[0] == 100) {
+ castSpell(5, _player.px, _player.py, _npcinfo[_curenemy].x, _npcinfo[_curenemy].y, 0);
+
+ _player.spellcharge[0] = 0;
+
+ _forcepause = true;
+
+ _itemticks = _ticks + ntickdelay;
+ _selenemyon = 0;
+ _itemselon = 0;
+ }
+
+ if (_curitem > 5 && _selenemyon == 1) {
+ if (_curenemy <= _lastnpc) {
+ castSpell(_curitem - 6, _player.px, _player.py, _npcinfo[_curenemy].x, _npcinfo[_curenemy].y, 0);
+ } else {
+ int pst = _curenemy - _lastnpc - 1;
+ castSpell(_curitem - 6, _player.px, _player.py, postinfo[pst][0], postinfo[pst][1], 0);
+ }
+
+ _player.spellcharge[_curitem - 5] = 0;
+
+ _player.spellstrength = 0;
+
+ _itemticks = _ticks + ntickdelay;
+ _selenemyon = 0;
+ _itemselon = 0;
+ _forcepause = false;
+ }
+
+ if (_curitem > 5 && _selenemyon == 0 && _itemselon == 1) {
+ if (ABS(_player.spellcharge[_curitem - 5] - 100) < kEpsilon) {
+ _itemticks = _ticks + ntickdelay;
+
+ _selenemyon = 1;
+
+ int i = 0;
+ do {
+ if (_npcinfo[i].hp > 0) {
+ _curenemy = i;
+ goto __exit_do;
+ }
+ i = i + 1;
+ if (i == _lastnpc + 1) {
+ _selenemyon = 0;
+ goto __exit_do;
+ }
+ } while (1);
+__exit_do:
+
+ if (nposts > 0 && _selenemyon == 0) {
+ _selenemyon = 1;
+ _curenemy = _lastnpc + 1;
+ }
+ }
+
+ }
+ }
+ } else if (_event.kbd.hasFlags(Common::KBD_ALT)) {
+ if (_itemticks < _ticks) {
+ _selenemyon = 0;
+ if (_itemselon == 1) {
+ _itemselon = 0;
+ _itemticks = _ticks + 220;
+ _forcepause = false;
+ } else {
+ _itemselon = 1;
+ _itemticks = _ticks + 220;
+ _forcepause = true;
+ _player.itemselshade = 0;
+ }
+ }
+ }
+ }
+
+ if (_itemselon == 0) {
+ movingup = false;
+ movingdown = false;
+ movingleft = false;
+ movingright = false;
+ if (_event.kbd.keycode == Common::KEYCODE_UP)
+ movingup = true;
+ if (_event.kbd.keycode == Common::KEYCODE_DOWN)
+ movingdown = true;
+ if (_event.kbd.keycode == Common::KEYCODE_LEFT)
+ movingleft = true;
+ if (_event.kbd.keycode == Common::KEYCODE_RIGHT)
+ movingright = true;
+ } else {
+ movingup = false;
+ movingdown = false;
+ movingleft = false;
+ movingright = false;
+
+ if (_selenemyon == 1) {
+ if (_itemticks < _ticks) {
+ if (_event.kbd.keycode == Common::KEYCODE_LEFT) {
+ int origin = _curenemy;
+ do {
+ _curenemy = _curenemy - 1;
+ if (_curenemy < 1)
+ _curenemy = _lastnpc + nposts;
+ if (_curenemy == origin)
+ break;
+ if (_curenemy <= _lastnpc && _npcinfo[_curenemy].hp > 0)
+ break;
+ if (_curenemy > _lastnpc)
+ break;
+ } while (1);
+ _itemticks = _ticks + ntickdelay;
+ }
+ if (_event.kbd.keycode == Common::KEYCODE_RIGHT) {
+ int origin = _curenemy;
+ do {
+ _curenemy = _curenemy + 1;
+ if (_curenemy > _lastnpc + nposts)
+ _curenemy = 1;
+ if (_curenemy == origin)
+ break;
+ if (_curenemy <= _lastnpc && _npcinfo[_curenemy].hp > 0)
+ break;
+ if (_curenemy > _lastnpc)
+ break;
+ } while (1);
+ _itemticks = _ticks + ntickdelay;
+ }
+
+
+ if (_curenemy > _lastnpc + nposts)
+ _curenemy = 1;
+ if (_curenemy < 1)
+ _curenemy = _lastnpc + nposts;
+ }
+ } else {
+ if (_itemticks < _ticks) {
+ if (_event.kbd.keycode == Common::KEYCODE_UP) {
+ _curitem = _curitem - 1;
+ _itemticks = _ticks + ntickdelay;
+ if (_curitem == 4)
+ _curitem = 9;
+ if (_curitem == -1)
+ _curitem = 4;
+ }
+ if (_event.kbd.keycode == Common::KEYCODE_DOWN) {
+ _curitem = _curitem + 1;
+ _itemticks = _ticks + ntickdelay;
+ if (_curitem == 5)
+ _curitem = 0;
+ if (_curitem == 10)
+ _curitem = 5;
+ }
+ if (_event.kbd.keycode == Common::KEYCODE_LEFT) {
+ _curitem = _curitem - 5;
+ _itemticks = _ticks + ntickdelay;
+ }
+ if (_event.kbd.keycode == Common::KEYCODE_RIGHT) {
+ _curitem = _curitem + 5;
+ _itemticks = _ticks + ntickdelay;
+ }
+
+ if (_curitem > 9)
+ _curitem = _curitem - 10;
+ if (_curitem < 0)
+ _curitem = _curitem + 10;
+ }
+ }
+ }
+}
+
+void GriffonEngine::handleWalking() {
+ int xmax = 20 * 16 - 25;
+ int ymax = 15 * 16 - 25;
+
+ float px = _player.px;
+ float py = _player.py;
+ float opx = px;
+ float opy = py;
+
+ float spd = _player.walkspd * _fpsr;
+
+ float nx = (px / 2 + 6);
+ float ny = (py / 2 + 10);
+
+ float npx = px + 12;
+ float npy = py + 20;
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
+
+ int ramp = _rampdata[lx][ly];
+ if (ramp == 1 && movingup)
+ spd *= 2;
+ if (ramp == 1 && movingdown)
+ spd *= 2;
+
+ if (ramp == 2 && movingleft)
+ movingup = true;
+ if (ramp == 2 && movingright)
+ movingdown = true;
+
+ if (ramp == 3 && movingright)
+ movingup = true;
+ if (ramp == 3 && movingleft)
+ movingdown = true;
+
+ unsigned int *temp/*, c*/, bgc;
+
+ for (int x = -1; x <= 1; x++) {
+ for (int y = -1; y <= 1; y++) {
+ int sx = nx + x;
+ int sy = ny + y;
+
+ _clipsurround[x + 1][y + 1] = 0;
+ if (sx > -1 && sx < 320 && sy > -1 && sy < 192) {
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ _clipsurround[x + 1][y + 1] = *temp;
+ }
+ }
+ }
+
+ if (movingup)
+ _player.walkdir = 0;
+ if (movingdown)
+ _player.walkdir = 1;
+ if (movingleft)
+ _player.walkdir = 2;
+ if (movingright)
+ _player.walkdir = 3;
+
+ if (movingup && _clipsurround[1][0] == 0) {
+ py -= spd;
+ _player.walkdir = 0;
+ } else if (movingup && _clipsurround[1][0] > 0) {
+ // move upleft
+ if (!movingright && _clipsurround[0][0] == 0) {
+ py -= spd;
+ px -= spd;
+ }
+
+ // move upright
+ if (!movingleft && _clipsurround[2][0] == 0) {
+ py -= spd;
+ px += spd;
+ }
+ }
+ if (movingdown && _clipsurround[1][2] == 0) {
+ py += spd;
+ _player.walkdir = 1;
+ } else if (movingdown && _clipsurround[1][2] > 0) {
+ // move downleft
+ if (movingright == 0 && _clipsurround[0][2] == 0) {
+ py += spd;
+ px -= spd;
+ }
+
+ // move downright
+ if (movingleft == 0 && _clipsurround[2][2] == 0) {
+ py += spd;
+ px += spd;
+ }
+ }
+ if (movingleft && _clipsurround[0][1] == 0) {
+ px -= spd;
+ _player.walkdir = 2;
+ } else if (movingleft && _clipsurround[0][1] > 0) {
+ // move leftup
+ if (!movingdown && _clipsurround[0][0] == 0) {
+ py -= spd;
+ px -= spd;
+ }
+
+ // move leftdown
+ if (!movingup && _clipsurround[0][2] == 0) {
+ py += spd;
+ px -= spd;
+ }
+ }
+ if (movingright && _clipsurround[2][1] == 0) {
+ px += spd;
+ _player.walkdir = 3;
+ } else if (movingright && _clipsurround[2][1] > 0) {
+ // move rightup
+ if (!movingdown && _clipsurround[2][0] == 0) {
+ px += spd;
+ py -= spd;
+ }
+
+ // move rightdown
+ if (!movingup && _clipsurround[2][2] == 0) {
+ py += spd;
+ px += spd;
+ }
+ }
+
+ if (px < -8)
+ px = -8;
+ if (px > xmax)
+ px = xmax;
+ if (py < -8)
+ py = -8;
+ if (py > ymax)
+ py = ymax;
+
+ int pass = 1;
+
+ int sx = (px / 2 + 6);
+ int sy = (py / 2 + 10);
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ bgc = *temp;
+ if (bgc > 0 && bgc != 1000) {
+ px = opx;
+ py = opy;
+ pass = 0;
+ }
+
+ // push npc
+ if (pass == 1) {
+ for (int i = 1; i <= _lastnpc; i++) {
+ if (_npcinfo[i].hp > 0) {
+ npx = _npcinfo[i].x;
+ npy = _npcinfo[i].y;
+
+ opx = npx;
+ opy = npy;
+
+ int xdif = _player.px - npx;
+ int ydif = _player.py - npy;
+
+ if (_player.walkdir == 0) {
+ if (abs(xdif) <= 8 && ydif > 0 && ydif < 8)
+ _npcinfo[i].y -= spd;
+ } else if (_player.walkdir == 1) {
+ if (abs(xdif) <= 8 && ydif < 0 && ydif > -8)
+ _npcinfo[i].y += spd;
+ } else if (_player.walkdir == 2) {
+ if (abs(ydif) <= 8 && xdif > 0 && xdif < 8)
+ _npcinfo[i].x -= spd;
+ } else if (_player.walkdir == 3) {
+ if (abs(ydif) <= 8 && xdif < 0 && xdif > -8)
+ _npcinfo[i].x += spd;
+ }
+
+ npx = _npcinfo[i].x;
+ npy = _npcinfo[i].y;
+
+ sx = (int)(npx / 2 + 6);
+ sy = (int)(npy / 2 + 10);
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ bgc = *temp;
+
+ if (bgc > 0) {
+ _npcinfo[i].x = opx;
+ _npcinfo[i].y = opy;
+ }
+ }
+ }
+ }
+
+ _player.opx = _player.px;
+ _player.opy = _player.py;
+ _player.px = px;
+ _player.py = py;
+
+ if (_player.px != _player.opx || _player.py != _player.opy)
+ _player.walkframe += _animspd * _fpsr;
+ if (_player.walkframe >= 16)
+ _player.walkframe -= 16;
+
+ // walking over items to pickup :::
+ int o = _objectMap[lx][ly];
+
+ if (o > -1) {
+ // fsk
+ if (_objectInfo[o][4] == 2 && _player.inventory[kInvFlask] < 9) {
+ _objectMap[lx][ly] = -1;
+
+ _player.inventory[kInvFlask]++;
+ addFloatIcon(6, lx * 16, ly * 16);
+
+ _objmapf[_curmap][lx][ly] = 1;
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+ }
+
+ if (_objectInfo[o][5] == 7 && _player.inventory[kInvDoubleFlask] < 9) {
+ _objectMap[lx][ly] = -1;
+
+ _player.inventory[kInvDoubleFlask]++;
+ addFloatIcon(12, lx * 16, ly * 16);
+
+ _objmapf[_curmap][lx][ly] = 1;
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+ }
+
+ if (_objectInfo[o][5] == 9 && _player.inventory[kInvShock] < 9 && (_curmap == 41 && _scriptflag[kScriptLightningBomb][1] == 0)) {
+ _objectMap[lx][ly] = -1;
+
+ _player.inventory[kInvShock]++;
+ addFloatIcon(17, lx * 16, ly * 16);
+
+ _objmapf[_curmap][lx][ly] = 1;
+ if (_curmap == 41)
+ _scriptflag[kScriptLightningBomb][1] = 1;
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ }
+
+ if (_objectInfo[o][5] == 9 && _player.inventory[kInvShock] < 9) {
+ _objectMap[lx][ly] = -1;
+
+ _player.inventory[kInvShock]++;
+ addFloatIcon(17, lx * 16, ly * 16);
+
+ _objmapf[_curmap][lx][ly] = 1;
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ }
+ }
+}
+
+void GriffonEngine::checkTrigger() {
+ int npx = _player.px + 12;
+ int npy = _player.py + 20;
+
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
+
+ _canUseKey = false;
+
+ if (_triggerloc[lx][ly] > -1)
+ processTrigger(_triggerloc[lx][ly]);
+}
+
+void GriffonEngine::processTrigger(int trignum) {
+ int trigtype = _triggers[trignum][0];
+
+ if (_roomlock)
+ return;
+
+ // map jump------------------------------
+ if (trigtype == 0) {
+ int tx = _triggers[trignum][1];
+ int ty = _triggers[trignum][2];
+ int tmap = _triggers[trignum][3];
+ int tjumpstyle = _triggers[trignum][4];
+
+ if (_roomLocks[tmap] > 0) {
+ if (!_saidLocked)
+ eventText("Locked");
+ _saidLocked = true;
+ _canUseKey = true;
+ _lockType = _roomLocks[tmap];
+ _roomToUnlock = tmap;
+ return;
+ }
+
+ if (tmap == 1) {
+ if (!_saidJammed)
+ eventText("Door Jammed!");
+ _saidJammed = true;
+ return;
+ }
+
+ _saidLocked = false;
+ _saidJammed = false;
+
+ // loc-sxy+oldmaploc
+ if (tjumpstyle == 0) {
+
+ int tsx = _triggers[trignum][5];
+ int tsy = _triggers[trignum][6];
+
+ _player.px += (tx - tsx) * 16;
+ _player.py += (ty - tsy) * 16;
+
+ // HACKFIX
+ if (_player.px < 0)
+ _player.px = 0;
+ if (_player.py < 0)
+ _player.py = 0;
+
+ if (tmap > 0) {
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndDoor]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ loadMap(tmap);
+ swash();
+ }
+ }
+ }
+
+ for (int i = 0; i < kMaxFloat; i++) {
+ _floattext[i][0] = 0;
+ _floaticon[i][0] = 0;
+ }
+}
+
+} // end of namespace Griffon
diff --git a/engines/griffon/module.mk b/engines/griffon/module.mk
index 697e0b9..4eecec6 100644
--- a/engines/griffon/module.mk
+++ b/engines/griffon/module.mk
@@ -10,6 +10,7 @@ MODULE_OBJS := \
draw.o \
engine.o \
griffon.o \
+ input.o \
resources.o \
saveload.o \
sound.o
Commit: 24edfa07ec63c43d9bbd3a1788195bf5f13b3dff
https://github.com/scummvm/scummvm/commit/24edfa07ec63c43d9bbd3a1788195bf5f13b3dff
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Added gfx.cpp
Changed paths:
A engines/griffon/gfx.cpp
engines/griffon/engine.cpp
engines/griffon/griffon.h
engines/griffon/module.mk
engines/griffon/sound.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 1c7cac9..8809e8c 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -98,92 +98,206 @@ float GriffonEngine::RND() {
return (float)_rnd->getRandomNumber(32767) * (1.0f / 32768.0f);
}
-void GriffonEngine::addFloatIcon(int ico, float xloc, float yloc) {
- for (int i = 0; i < kMaxFloat; i++) {
- if (ABS(_floaticon[i][0]) < kEpsilon) {
- _floaticon[i][0] = 32;
- _floaticon[i][1] = xloc;
- _floaticon[i][2] = yloc;
- _floaticon[i][3] = ico;
- return;
- }
+void GriffonEngine::mainLoop() {
+ swash();
+
+ if (_pmenu) {
+ haltSoundChannel(_menuchannel);
+ _pmenu = false;
}
+
+ do {
+ if (!_forcepause) {
+ updateAnims();
+ updateNPCs();
+ }
+
+ checkTrigger();
+ checkInputs();
+
+ if (!_forcepause)
+ handleWalking();
+
+ updateY();
+ drawView();
+
+ updateMusic();
+
+ _console->onFrame();
+
+ updateEngine();
+ } while (!_shouldQuit);
}
-void GriffonEngine::addFloatText(const char *stri, float xloc, float yloc, int col) {
+void GriffonEngine::updateEngine() {
+ g_system->updateScreen();
+ g_system->getEventManager()->pollEvent(_event);
+
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
+
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24.0;
+
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
+ _secsingame = _secsingame + 1;
+ }
+
+ if (attacking) {
+ _player.attackframe += _player.attackspd * _fpsr;
+ if (_player.attackframe >= 16) {
+ attacking = false;
+ _player.attackframe = 0;
+ _player.walkframe = 0;
+ }
+
+ int pa = (int)(_player.attackframe);
+
+ for (int i = 0; i <= pa; i++) {
+ if (ABS(_playerattackofs[_player.walkdir][i][2]) < kEpsilon) {
+ _playerattackofs[_player.walkdir][i][2] = 1;
+
+ float opx = _player.px;
+ float opy = _player.py;
+
+ _player.px = _player.px + _playerattackofs[_player.walkdir][i][0];
+ _player.py = _player.py + _playerattackofs[_player.walkdir][i][1];
+
+ int sx = (int)(_player.px / 2 + 6);
+ int sy = (int)(_player.py / 2 + 10);
+ uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ uint32 bgc = *temp;
+ if (bgc > 0) {
+ _player.px = opx;
+ _player.py = opy;
+ }
+ }
+ }
+
+ _player.opx = _player.px;
+ _player.opy = _player.py;
+
+ checkHit();
+ }
+
for (int i = 0; i < kMaxFloat; i++) {
- if (ABS(_floattext[i][0]) < kEpsilon) {
- _floattext[i][0] = 32;
- _floattext[i][1] = xloc;
- _floattext[i][2] = yloc;
- _floattext[i][3] = col;
- strcpy(_floatstri[i], stri);
- return;
+ if (_floattext[i][0] > 0) {
+ float spd = 0.5 * _fpsr;
+ _floattext[i][0] = _floattext[i][0] - spd;
+ _floattext[i][2] = _floattext[i][2] - spd;
+ if (_floattext[i][0] < 0)
+ _floattext[i][0] = 0;
+ }
+
+ if (_floaticon[i][0] > 0) {
+ float spd = 0.5 * _fpsr;
+ _floaticon[i][0] = _floaticon[i][0] - spd;
+ _floaticon[i][2] = _floaticon[i][2] - spd;
+ if (_floaticon[i][0] < 0)
+ _floaticon[i][0] = 0;
}
}
-}
-void GriffonEngine::eventText(const char *stri) {
- _videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
- _videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
+ if (_player.level == _player.maxlevel)
+ _player.exp = 0;
- int x = 160 - 4 * strlen(stri);
+ if (_player.exp >= _player.nextlevel) {
+ _player.level = _player.level + 1;
+ addFloatText("LEVEL UP!", _player.px + 16 - 36, _player.py + 16, 3);
+ _player.exp = _player.exp - _player.nextlevel;
+ _player.nextlevel = _player.nextlevel * 3 / 2; // 1.5
+ _player.maxhp = _player.maxhp + _player.level * 3;
+ if (_player.maxhp > 999)
+ _player.maxhp = 999;
+ _player.hp = _player.maxhp;
- _ticks = g_system->getMillis();
- int pause_ticks = _ticks + 500;
- int b_ticks = _ticks;
+ _player.sworddamage = _player.level * 14 / 10;
+ _player.spelldamage = _player.level * 13 / 10;
- _videobuffer->blit(*_videobuffer3);
- _videobuffer->blit(*_videobuffer2);
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+ }
- do {
- g_system->getEventManager()->pollEvent(_event);
+ _clipbg->copyRectToSurface(_clipbg2->getPixels(), _clipbg2->pitch, 0, 0, _clipbg2->w, _clipbg2->h);
- if (_event.type == Common::EVENT_KEYDOWN && pause_ticks < _ticks)
- break;
- _videobuffer2->blit(*_videobuffer);
+ Common::Rect rc;
- int fr = 192;
+ rc.left = _player.px - 2;
+ rc.top = _player.py - 2;
+ rc.setWidth(5);
+ rc.setHeight(5);
+
+ _clipbg->fillRect(rc, 1000);
+
+ if (!_forcepause) {
+ for (int i = 0; i < 5; i++) {
+ if (_player.foundspell[i] == 1)
+ _player.spellcharge[i] += 1 * _player.level * 0.01 * _fpsr;
+ if (_player.spellcharge[i] > 100)
+ _player.spellcharge[i] = 100;
+ }
+
+ if (_player.foundspell[0]) {
+ _player.spellstrength += 3 * _player.level * .01 * _fpsr;
+ }
- if (pause_ticks > _ticks)
- fr = 192 * (_ticks - b_ticks) / 500;
- if (fr > 192)
- fr = 192;
+ _player.attackstrength += (30 + 3 * (float)_player.level) / 50 * _fpsr;
+ }
- _windowimg->setAlpha(fr, true);
+ if (_player.attackstrength > 100)
+ _player.attackstrength = 100;
- _windowimg->blit(*_videobuffer);
- if (pause_ticks < _ticks)
- drawString(_videobuffer, stri, x, 15, 0);
+ if (_player.spellstrength > 100)
+ _player.spellstrength = 100;
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
- g_system->updateScreen();
+ _itemyloc += 0.75 * _fpsr;
+ while (_itemyloc >= 16)
+ _itemyloc -= 16;
- g_system->getEventManager()->pollEvent(_event);
- g_system->delayMillis(10);
+ if (_player.hp <= 0)
+ theEnd();
- _tickspassed = _ticks;
- _ticks = g_system->getMillis();
+ if (_roomlock) {
+ _roomlock = false;
+ for (int i = 1; i <= _lastnpc; i++)
+ if (_npcinfo[i].hp > 0)
+ _roomlock = true;
+ }
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24.0;
+ clouddeg += 0.1 * _fpsr;
+ while (clouddeg >= 360)
+ clouddeg = clouddeg - 360;
- _fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
- _fps = _fp;
- _fp = 0;
+ _player.hpflash = _player.hpflash + 0.1 * _fpsr;
+ if (_player.hpflash >= 2) {
+ _player.hpflash = 0;
+ _player.hpflashb = _player.hpflashb + 1;
+ if (_player.hpflashb == 2)
+ _player.hpflashb = 0;
+ if (config.effects && _player.hpflashb == 0 && _player.hp < _player.maxhp / 4) {
+ int snd = playSound(_sfx[kSndBeep]);
+ setChannelVolume(snd, config.effectsvol);
}
+ }
- g_system->delayMillis(10);
- } while (1);
+ // cloudson = 0
- _videobuffer3->blit(*_videobuffer);
+ if (_itemselon == 1)
+ _player.itemselshade = _player.itemselshade + 2 * _fpsr;
+ if (_player.itemselshade > 24)
+ _player.itemselshade = 24;
- _itemticks = _ticks + 210;
+ for (int i = 0; i <= 4; i++)
+ if (_player.inventory[i] > 9)
+ _player.inventory[i] = 9;
}
-
void GriffonEngine::newGame() {
intro();
@@ -262,37 +376,6 @@ void GriffonEngine::newGame() {
mainLoop();
}
-void GriffonEngine::mainLoop() {
- swash();
-
- if (_pmenu) {
- haltSoundChannel(_menuchannel);
- _pmenu = false;
- }
-
- do {
- if (!_forcepause) {
- updateAnims();
- updateNPCs();
- }
-
- checkTrigger();
- checkInputs();
-
- if (!_forcepause)
- handleWalking();
-
- updateY();
- drawView();
-
- updateMusic();
-
- _console->onFrame();
-
- updateEngine();
- } while (!_shouldQuit);
-}
-
void GriffonEngine::updateAnims() {
for (int i = 0; i <= _lastObj; i++) {
int nframes = _objectInfo[i][0];
@@ -2613,203 +2696,5 @@ void GriffonEngine::updateSpellsUnder() {
}
}
-void GriffonEngine::drawLine(Graphics::TransparentSurface *buffer, int x1, int y1, int x2, int y2, int col) {
- int xdif = x2 - x1;
- int ydif = y2 - y1;
-
- if (xdif == 0) {
- for (int y = y1; y <= y2; y++) {
- uint32 *temp = (uint32 *)buffer->getBasePtr(x1, y);
- *temp = col;
- }
- }
-
- if (ydif == 0) {
- for (int x = x1; x <= x2; x++) {
- uint32 *temp = (uint32 *)buffer->getBasePtr(x, y1);
- *temp = col;
- }
- }
-}
-
-void GriffonEngine::drawString(Graphics::TransparentSurface *buffer, const char *stri, int xloc, int yloc, int col) {
- int l = strlen(stri);
-
- for (int i = 0; i < l; i++) {
- rcDest.left = xloc + i * 8;
- rcDest.top = yloc;
-
- _fontchr[stri[i] - 32][col]->blit(*buffer, rcDest.left, rcDest.top);
- }
-}
-
-void GriffonEngine::updateEngine() {
- g_system->updateScreen();
- g_system->getEventManager()->pollEvent(_event);
-
- _tickspassed = _ticks;
- _ticks = g_system->getMillis();
-
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24.0;
-
- _fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
- _fps = _fp;
- _fp = 0;
- _secsingame = _secsingame + 1;
- }
-
- if (attacking) {
- _player.attackframe += _player.attackspd * _fpsr;
- if (_player.attackframe >= 16) {
- attacking = false;
- _player.attackframe = 0;
- _player.walkframe = 0;
- }
-
- int pa = (int)(_player.attackframe);
-
- for (int i = 0; i <= pa; i++) {
- if (ABS(_playerattackofs[_player.walkdir][i][2]) < kEpsilon) {
- _playerattackofs[_player.walkdir][i][2] = 1;
-
- float opx = _player.px;
- float opy = _player.py;
-
- _player.px = _player.px + _playerattackofs[_player.walkdir][i][0];
- _player.py = _player.py + _playerattackofs[_player.walkdir][i][1];
-
- int sx = (int)(_player.px / 2 + 6);
- int sy = (int)(_player.py / 2 + 10);
- uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
- uint32 bgc = *temp;
- if (bgc > 0) {
- _player.px = opx;
- _player.py = opy;
- }
- }
- }
-
- _player.opx = _player.px;
- _player.opy = _player.py;
-
- checkHit();
- }
-
- for (int i = 0; i < kMaxFloat; i++) {
- if (_floattext[i][0] > 0) {
- float spd = 0.5 * _fpsr;
- _floattext[i][0] = _floattext[i][0] - spd;
- _floattext[i][2] = _floattext[i][2] - spd;
- if (_floattext[i][0] < 0)
- _floattext[i][0] = 0;
- }
-
- if (_floaticon[i][0] > 0) {
- float spd = 0.5 * _fpsr;
- _floaticon[i][0] = _floaticon[i][0] - spd;
- _floaticon[i][2] = _floaticon[i][2] - spd;
- if (_floaticon[i][0] < 0)
- _floaticon[i][0] = 0;
- }
- }
-
- if (_player.level == _player.maxlevel)
- _player.exp = 0;
-
- if (_player.exp >= _player.nextlevel) {
- _player.level = _player.level + 1;
- addFloatText("LEVEL UP!", _player.px + 16 - 36, _player.py + 16, 3);
- _player.exp = _player.exp - _player.nextlevel;
- _player.nextlevel = _player.nextlevel * 3 / 2; // 1.5
- _player.maxhp = _player.maxhp + _player.level * 3;
- if (_player.maxhp > 999)
- _player.maxhp = 999;
- _player.hp = _player.maxhp;
-
- _player.sworddamage = _player.level * 14 / 10;
- _player.spelldamage = _player.level * 13 / 10;
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
- }
- }
-
- _clipbg->copyRectToSurface(_clipbg2->getPixels(), _clipbg2->pitch, 0, 0, _clipbg2->w, _clipbg2->h);
-
- Common::Rect rc;
-
- rc.left = _player.px - 2;
- rc.top = _player.py - 2;
- rc.setWidth(5);
- rc.setHeight(5);
-
- _clipbg->fillRect(rc, 1000);
-
- if (!_forcepause) {
- for (int i = 0; i < 5; i++) {
- if (_player.foundspell[i] == 1)
- _player.spellcharge[i] += 1 * _player.level * 0.01 * _fpsr;
- if (_player.spellcharge[i] > 100)
- _player.spellcharge[i] = 100;
- }
-
- if (_player.foundspell[0]) {
- _player.spellstrength += 3 * _player.level * .01 * _fpsr;
- }
-
- _player.attackstrength += (30 + 3 * (float)_player.level) / 50 * _fpsr;
- }
-
- if (_player.attackstrength > 100)
- _player.attackstrength = 100;
-
- if (_player.spellstrength > 100)
- _player.spellstrength = 100;
-
- _itemyloc += 0.75 * _fpsr;
- while (_itemyloc >= 16)
- _itemyloc -= 16;
-
- if (_player.hp <= 0)
- theEnd();
-
- if (_roomlock) {
- _roomlock = false;
- for (int i = 1; i <= _lastnpc; i++)
- if (_npcinfo[i].hp > 0)
- _roomlock = true;
- }
-
- clouddeg += 0.1 * _fpsr;
- while (clouddeg >= 360)
- clouddeg = clouddeg - 360;
-
- _player.hpflash = _player.hpflash + 0.1 * _fpsr;
- if (_player.hpflash >= 2) {
- _player.hpflash = 0;
- _player.hpflashb = _player.hpflashb + 1;
- if (_player.hpflashb == 2)
- _player.hpflashb = 0;
- if (config.effects && _player.hpflashb == 0 && _player.hp < _player.maxhp / 4) {
- int snd = playSound(_sfx[kSndBeep]);
- setChannelVolume(snd, config.effectsvol);
- }
- }
-
- // cloudson = 0
-
- if (_itemselon == 1)
- _player.itemselshade = _player.itemselshade + 2 * _fpsr;
- if (_player.itemselshade > 24)
- _player.itemselshade = 24;
-
- for (int i = 0; i <= 4; i++)
- if (_player.inventory[i] > 9)
- _player.inventory[i] = 9;
-}
} // end of namespace Griffon
diff --git a/engines/griffon/gfx.cpp b/engines/griffon/gfx.cpp
new file mode 100644
index 0000000..31dfc6a
--- /dev/null
+++ b/engines/griffon/gfx.cpp
@@ -0,0 +1,171 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Originally written by Syn9 in FreeBASIC with SDL
+ * http://syn9.thehideoutgames.com/index_backup.php
+ *
+ * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
+ * http://github.com/dmitrysmagin/griffon_legend
+ *
+ *
+ * Programming/Graphics: Daniel "Syn9" Kennedy
+ * Music/Sound effects: David Turner
+ *
+ * Beta testing and gameplay design help:
+ * Deleter, Cha0s, Aether Fox, and Kiz
+ *
+ */
+
+#include "common/system.h"
+
+#include "griffon/griffon.h"
+
+namespace Griffon {
+
+void GriffonEngine::addFloatIcon(int ico, float xloc, float yloc) {
+ for (int i = 0; i < kMaxFloat; i++) {
+ if (ABS(_floaticon[i][0]) < kEpsilon) {
+ _floaticon[i][0] = 32;
+ _floaticon[i][1] = xloc;
+ _floaticon[i][2] = yloc;
+ _floaticon[i][3] = ico;
+ return;
+ }
+ }
+}
+
+void GriffonEngine::addFloatText(const char *stri, float xloc, float yloc, int col) {
+ for (int i = 0; i < kMaxFloat; i++) {
+ if (ABS(_floattext[i][0]) < kEpsilon) {
+ _floattext[i][0] = 32;
+ _floattext[i][1] = xloc;
+ _floattext[i][2] = yloc;
+ _floattext[i][3] = col;
+ strcpy(_floatstri[i], stri);
+ return;
+ }
+ }
+}
+
+void GriffonEngine::eventText(const char *stri) {
+ _videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
+ _videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
+
+ int x = 160 - 4 * strlen(stri);
+
+ _ticks = g_system->getMillis();
+ int pause_ticks = _ticks + 500;
+ int b_ticks = _ticks;
+
+ _videobuffer->blit(*_videobuffer3);
+ _videobuffer->blit(*_videobuffer2);
+
+ do {
+ g_system->getEventManager()->pollEvent(_event);
+
+ if (_event.type == Common::EVENT_KEYDOWN && pause_ticks < _ticks)
+ break;
+ _videobuffer2->blit(*_videobuffer);
+
+ int fr = 192;
+
+ if (pause_ticks > _ticks)
+ fr = 192 * (_ticks - b_ticks) / 500;
+ if (fr > 192)
+ fr = 192;
+
+ _windowimg->setAlpha(fr, true);
+
+ _windowimg->blit(*_videobuffer);
+ if (pause_ticks < _ticks)
+ drawString(_videobuffer, stri, x, 15, 0);
+
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ g_system->updateScreen();
+
+ g_system->getEventManager()->pollEvent(_event);
+ g_system->delayMillis(10);
+
+ _tickspassed = _ticks;
+ _ticks = g_system->getMillis();
+
+ _tickspassed = _ticks - _tickspassed;
+ _fpsr = (float)_tickspassed / 24.0;
+
+ _fp++;
+ if (_ticks > _nextticks) {
+ _nextticks = _ticks + 1000;
+ _fps = _fp;
+ _fp = 0;
+ }
+
+ g_system->delayMillis(10);
+ } while (1);
+
+ _videobuffer3->blit(*_videobuffer);
+
+ _itemticks = _ticks + 210;
+}
+
+void GriffonEngine::drawLine(Graphics::TransparentSurface *buffer, int x1, int y1, int x2, int y2, int col) {
+ int xdif = x2 - x1;
+ int ydif = y2 - y1;
+
+ if (xdif == 0) {
+ for (int y = y1; y <= y2; y++) {
+ uint32 *temp = (uint32 *)buffer->getBasePtr(x1, y);
+ *temp = col;
+ }
+ }
+
+ if (ydif == 0) {
+ for (int x = x1; x <= x2; x++) {
+ uint32 *temp = (uint32 *)buffer->getBasePtr(x, y1);
+ *temp = col;
+ }
+ }
+}
+
+void GriffonEngine::drawString(Graphics::TransparentSurface *buffer, const char *stri, int xloc, int yloc, int col) {
+ int l = strlen(stri);
+
+ for (int i = 0; i < l; i++) {
+ rcDest.left = xloc + i * 8;
+ rcDest.top = yloc;
+
+ _fontchr[stri[i] - 32][col]->blit(*buffer, rcDest.left, rcDest.top);
+ }
+}
+
+void GriffonEngine::drawProgress(int w, int wm) {
+ long ccc = _videobuffer->format.RGBToColor(0, 255, 0);
+
+ rcDest.setWidth(w * 74 / wm);
+ _videobuffer->fillRect(rcDest, ccc);
+
+ g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ g_system->updateScreen();
+
+ g_system->getEventManager()->pollEvent(_event);
+}
+
+
+} // end of namespace Griffon
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 26fe9b6..e5b98ad 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -306,6 +306,27 @@ private:
void drawView();
void swash();
+ // engine.cpp
+ float RND();
+
+ void newGame();
+ void mainLoop();
+ void updateAnims();
+ void updateY();
+ void updateNPCs();
+ void updateSpells();
+ void updateSpellsUnder();
+
+ void updateEngine();
+
+ // gfx.cpp
+ void addFloatIcon(int ico, float xloc, float yloc);
+ void addFloatText(const char *stri, float xloc, float yloc, int col);
+ void eventText(const char *stri);
+ void drawLine(Graphics::TransparentSurface *buffer, int x1, int y1, int x2, int y2, int col);
+ void drawString(Graphics::TransparentSurface *buffer, const char *stri, int xloc, int yloc, int col);
+ void drawProgress(int w, int wm);
+
// input.cpp
void checkInputs();
void handleWalking();
@@ -340,24 +361,6 @@ private:
void setupAudio();
void updateMusic();
- float RND();
-
- void addFloatIcon(int ico, float xloc, float yloc);
- void addFloatText(const char *stri, float xloc, float yloc, int col);
- void eventText(const char *stri);
- void newGame();
- void mainLoop();
- void updateAnims();
- void updateY();
- void updateNPCs();
- void updateSpells();
- void updateSpellsUnder();
-
- void drawLine(Graphics::TransparentSurface *buffer, int x1, int y1, int x2, int y2, int col);
- void drawString(Graphics::TransparentSurface *buffer, const char *stri, int xloc, int yloc, int col);
- void drawProgress(int w, int wm);
- void updateEngine();
-
private:
Graphics::TransparentSurface *_video, *_videobuffer, *_videobuffer2, *_videobuffer3;
diff --git a/engines/griffon/module.mk b/engines/griffon/module.mk
index 4eecec6..43a198b 100644
--- a/engines/griffon/module.mk
+++ b/engines/griffon/module.mk
@@ -9,6 +9,7 @@ MODULE_OBJS := \
dialogs.o \
draw.o \
engine.o \
+ gfx.o \
griffon.o \
input.o \
resources.o \
diff --git a/engines/griffon/sound.cpp b/engines/griffon/sound.cpp
index eaa99c3..f488c5b 100644
--- a/engines/griffon/sound.cpp
+++ b/engines/griffon/sound.cpp
@@ -111,18 +111,6 @@ DataChunk *cacheSound(const char *name) {
return res;
}
-void GriffonEngine::drawProgress(int w, int wm) {
- long ccc = _videobuffer->format.RGBToColor(0, 255, 0);
-
- rcDest.setWidth(w * 74 / wm);
- _videobuffer->fillRect(rcDest, ccc);
-
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
- g_system->updateScreen();
-
- g_system->getEventManager()->pollEvent(_event);
-}
-
void GriffonEngine::setupAudio() {
// FIXME
//Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 1024);
Commit: f7459b027c6d44ff20755a4b0e7d031d317425a0
https://github.com/scummvm/scummvm/commit/f7459b027c6d44ff20755a4b0e7d031d317425a0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Added monsters enum
Changed paths:
engines/griffon/combat.cpp
engines/griffon/draw.cpp
engines/griffon/engine.cpp
engines/griffon/griffon.h
engines/griffon/resources.cpp
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp
index 1374ea5..ecdcf55 100644
--- a/engines/griffon/combat.cpp
+++ b/engines/griffon/combat.cpp
@@ -598,14 +598,15 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
addFloatText(line, _npcinfo[npcnum].x + 12 - 4 * strlen(line), _npcinfo[npcnum].y + 16, fcol);
- if (_npcinfo[npcnum].spriteset == 12)
+ if (_npcinfo[npcnum].spriteset == kMonsterBatKitty)
castSpell(9, _npcinfo[npcnum].x, _npcinfo[npcnum].y, _player.px, _player.py, npcnum);
// if enemy is killed
if (_npcinfo[npcnum].hp == 0) {
_player.exp = _player.exp + _npcinfo[npcnum].maxhp;
- if (_npcinfo[npcnum].spriteset == 1 || _npcinfo[npcnum].spriteset == 7 || _npcinfo[npcnum].spriteset == 6) {
+ if (_npcinfo[npcnum].spriteset == kMonsterBabyDragon || _npcinfo[npcnum].spriteset == kMonsterPriest ||
+ _npcinfo[npcnum].spriteset == kMonsterRedDragon) {
int ff = (int)(RND() * _player.level * 3);
if (ff == 0) {
float npx = _npcinfo[npcnum].x + 12;
@@ -619,7 +620,8 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
}
}
- if (_npcinfo[npcnum].spriteset == 2 || _npcinfo[npcnum].spriteset == 9 || _npcinfo[npcnum].spriteset == 4 || _npcinfo[npcnum].spriteset == 5) {
+ if (_npcinfo[npcnum].spriteset == kMonsterOneWing || _npcinfo[npcnum].spriteset == kMonsterTwoWing ||
+ _npcinfo[npcnum].spriteset == kMonsterBlackKnight || _npcinfo[npcnum].spriteset == kMonsterFireHydra) {
int ff = (int)(RND() * _player.level);
if (ff == 0) {
float npx = _npcinfo[npcnum].x + 12;
@@ -633,7 +635,8 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
}
}
- if (_npcinfo[npcnum].spriteset == 9 || _npcinfo[npcnum].spriteset == 10 || _npcinfo[npcnum].spriteset == 5) {
+ if (_npcinfo[npcnum].spriteset == kMonsterTwoWing || _npcinfo[npcnum].spriteset == kMonsterDragon2 ||
+ _npcinfo[npcnum].spriteset == kMonsterFireHydra) {
int ff = (int)(RND() * _player.level * 2);
if (ff == 0) {
float npx = _npcinfo[npcnum].x + 12;
diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp
index fae2424..7d364f7 100644
--- a/engines/griffon/draw.cpp
+++ b/engines/griffon/draw.cpp
@@ -464,7 +464,7 @@ void GriffonEngine::drawNPCs(int mode) {
int wdir = _npcinfo[i].walkdir;
// spriteset1 specific
- if (_npcinfo[i].spriteset == 1) {
+ if (_npcinfo[i].spriteset == kMonsterBabyDragon) {
if (_npcinfo[i].attacking == 0) {
@@ -506,7 +506,7 @@ void GriffonEngine::drawNPCs(int mode) {
}
// onewing
- if (_npcinfo[i].spriteset == 2) {
+ if (_npcinfo[i].spriteset == kMonsterOneWing) {
for (int f = 0; f <= 7; f++) {
int s = _npcinfo[i].bodysection[f].sprite;
rcSrc.left = _animset2[s].x;
@@ -523,7 +523,7 @@ void GriffonEngine::drawNPCs(int mode) {
}
// twowing
- if (_npcinfo[i].spriteset == 9) {
+ if (_npcinfo[i].spriteset == kMonsterTwoWing) {
for (int f = 0; f <= 7; f++) {
int yp = 0;
@@ -545,7 +545,7 @@ void GriffonEngine::drawNPCs(int mode) {
// boss 1
- if (_npcinfo[i].spriteset == 3) {
+ if (_npcinfo[i].spriteset == kMonsterBoss1) {
if (_npcinfo[i].attacking == 0) {
int cframe = _npcinfo[i].cframe;
@@ -573,7 +573,7 @@ void GriffonEngine::drawNPCs(int mode) {
}
// black knight
- if (_npcinfo[i].spriteset == 4) {
+ if (_npcinfo[i].spriteset == kMonsterBlackKnight) {
if (_npcinfo[i].attacking == 0) {
int cframe = _npcinfo[i].cframe;
@@ -601,7 +601,7 @@ void GriffonEngine::drawNPCs(int mode) {
// firehydra
- if (_npcinfo[i].spriteset == 5) {
+ if (_npcinfo[i].spriteset == kMonsterFireHydra) {
for (int ff = 0; ff <= 2; ff++) {
if (_npcinfo[i].hp > 10 * ff * 20) {
rcSrc.left = 16 * (int)(RND() * 2);
@@ -654,7 +654,7 @@ void GriffonEngine::drawNPCs(int mode) {
}
// red dragon
- if (_npcinfo[i].spriteset == 6) {
+ if (_npcinfo[i].spriteset == kMonsterRedDragon) {
int cframe = _npcinfo[i].cframe;
rcSrc.left = (int)(cframe / 4) * 24;
@@ -677,7 +677,7 @@ void GriffonEngine::drawNPCs(int mode) {
}
// wizard
- if (_npcinfo[i].spriteset == 7) {
+ if (_npcinfo[i].spriteset == kMonsterPriest) {
// if(_npcinfo[i].attacking == 0) {
int cframe = _npcinfo[i].cframe;
@@ -715,7 +715,7 @@ void GriffonEngine::drawNPCs(int mode) {
// yellow dragon
- if (_npcinfo[i].spriteset == 8) {
+ if (_npcinfo[i].spriteset == kMonsterYellowDragon) {
int cframe = _npcinfo[i].cframe;
rcSrc.left = (int)(cframe / 4) * 24;
@@ -738,7 +738,7 @@ void GriffonEngine::drawNPCs(int mode) {
// dragon2
- if (_npcinfo[i].spriteset == 10) {
+ if (_npcinfo[i].spriteset == kMonsterDragon2) {
if (_npcinfo[i].attacking == 0) {
_npcinfo[i].floating = _npcinfo[i].floating + 0.25 * _fpsr;
while (_npcinfo[i].floating >= 16)
@@ -801,7 +801,7 @@ void GriffonEngine::drawNPCs(int mode) {
}
// end boss
- if (_npcinfo[i].spriteset == 11) {
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss) {
_npcinfo[i].floating = _npcinfo[i].floating + .3 * _fpsr;
while (_npcinfo[i].floating >= 16)
@@ -931,7 +931,7 @@ void GriffonEngine::drawNPCs(int mode) {
}
// bat kitty
- if (_npcinfo[i].spriteset == 12) {
+ if (_npcinfo[i].spriteset == kMonsterBatKitty) {
_npcinfo[i].floating = _npcinfo[i].floating + 1 * _fpsr;
while (_npcinfo[i].floating >= 16)
_npcinfo[i].floating = _npcinfo[i].floating - 16;
@@ -998,7 +998,7 @@ void GriffonEngine::drawNPCs(int mode) {
int pass = 1;
- if (_npcinfo[i].spriteset == 3)
+ if (_npcinfo[i].spriteset == kMonsterBoss1)
pass = 0;
if (pass == 1)
drawOver(npx, npy);
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 8809e8c..4344b8d 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -43,21 +43,8 @@
namespace Griffon {
// memo
-/*
- monsters
- 1 - baby dragon
- 2 - one wing
- 3 - boss 1
- 4 - black knight
- 5 - fire hydra
- 6 - red dragon
- 7 - priest
- 8 - yellow fire dragon
- 9 - two wing
-10 - dragon2
-11 - final boss
-12 - bat kitty
+/*
chests
0 - regular flask
11 - key chest
@@ -438,7 +425,7 @@ void GriffonEngine::updateNPCs() {
int pass = 0;
if (_npcinfo[i].attacking == 0)
pass = 1;
- if (_npcinfo[i].spriteset == 5)
+ if (_npcinfo[i].spriteset == kMonsterFireHydra)
pass = 1;
if (pass == 1) {
int moveup = 0;
@@ -454,7 +441,7 @@ void GriffonEngine::updateNPCs() {
float wspd = _npcinfo[i].walkspd / 4;
- if (_npcinfo[i].spriteset == 10)
+ if (_npcinfo[i].spriteset == kMonsterDragon2)
wspd = wspd * 2;
int wdir = _npcinfo[i].walkdir;
@@ -470,7 +457,7 @@ void GriffonEngine::updateNPCs() {
if (_npcinfo[i].pause > _ticks)
mode = -1;
- if (_npcinfo[i].spriteset == 2 && _npcinfo[i].castpause > _ticks)
+ if (_npcinfo[i].spriteset == kMonsterOneWing && _npcinfo[i].castpause > _ticks)
mode = -1;
if (mode == 3) {
@@ -601,7 +588,7 @@ void GriffonEngine::updateNPCs() {
float xp = (npx / 2 + 6);
float yp = (npy / 2 + 10);
- if (_npcinfo[i].spriteset == 10)
+ if (_npcinfo[i].spriteset == kMonsterDragon2)
wspd = wspd * 2;
float ii = wspd * _fpsr;
@@ -613,7 +600,7 @@ void GriffonEngine::updateNPCs() {
int sy = yp - ii;
uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
uint32 dq = *temp;
- if (_npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0)
@@ -623,7 +610,7 @@ void GriffonEngine::updateNPCs() {
sy = yp - ii;
temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
- if (_npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0) {
movinup = 1;
@@ -635,7 +622,7 @@ void GriffonEngine::updateNPCs() {
sy = yp - ii;
temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
- if (_npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0) {
movinup = 1;
@@ -649,7 +636,7 @@ void GriffonEngine::updateNPCs() {
int sy = yp + ii;
uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
uint32 dq = *temp;
- if (_npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0)
movindown = 1;
@@ -658,7 +645,7 @@ void GriffonEngine::updateNPCs() {
sy = yp + ii;
temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
- if (_npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0) {
movindown = 1;
@@ -670,7 +657,7 @@ void GriffonEngine::updateNPCs() {
sy = yp + ii;
temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
- if (_npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0) {
movindown = 1;
@@ -684,7 +671,7 @@ void GriffonEngine::updateNPCs() {
int sy = yp;
uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
uint32 dq = *temp;
- if (_npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0)
movinleft = 1;
@@ -693,7 +680,7 @@ void GriffonEngine::updateNPCs() {
sy = yp - ii;
temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
- if (_npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0) {
movinleft = 1;
@@ -705,7 +692,7 @@ void GriffonEngine::updateNPCs() {
sy = yp + ii;
temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
- if (_npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0) {
movinleft = 1;
@@ -719,7 +706,7 @@ void GriffonEngine::updateNPCs() {
int sy = yp;
uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
uint32 dq = *temp;
- if (_npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0)
movinright = 1;
@@ -728,7 +715,7 @@ void GriffonEngine::updateNPCs() {
sy = yp - ii;
temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
- if (_npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0) {
movinright = 1;
@@ -740,7 +727,7 @@ void GriffonEngine::updateNPCs() {
sy = yp + ii;
temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
dq = *temp;
- if (_npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0) {
movinright = 1;
@@ -771,7 +758,7 @@ void GriffonEngine::updateNPCs() {
float aspd = wspd;
- if (_npcinfo[i].spriteset == 10)
+ if (_npcinfo[i].spriteset == kMonsterDragon2)
aspd = wspd / 2;
xp = (npx / 2 + 6);
@@ -790,12 +777,12 @@ void GriffonEngine::updateNPCs() {
if (_triggerloc[lx][ly] > -1)
bgc = 1;
- if (_npcinfo[i].spriteset == 11)
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
bgc = 0;
int rst = 0;
- if (_npcinfo[i].spriteset == 11) {
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss) {
if (npx < 40 || npx > 280 || npy < 36 || npy > 204)
rst = 1;
}
@@ -833,7 +820,7 @@ void GriffonEngine::updateNPCs() {
}
// spriteset1 specific
- if (_npcinfo[i].spriteset == 1 && _npcinfo[i].attackattempt < _ticks) {
+ if (_npcinfo[i].spriteset == kMonsterBabyDragon && _npcinfo[i].attackattempt < _ticks) {
if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
npx = _npcinfo[i].x;
npy = _npcinfo[i].y;
@@ -859,7 +846,7 @@ void GriffonEngine::updateNPCs() {
bool dospell = false;
// onewing specific
- if (_npcinfo[i].spriteset == 2) {
+ if (_npcinfo[i].spriteset == kMonsterOneWing) {
if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
npx = _npcinfo[i].x;
npy = _npcinfo[i].y;
@@ -940,7 +927,7 @@ void GriffonEngine::updateNPCs() {
}
// boss1 specific and blackknight
- if (_npcinfo[i].spriteset == 3 || _npcinfo[i].spriteset == 4) {
+ if (_npcinfo[i].spriteset == kMonsterBoss1 || _npcinfo[i].spriteset == kMonsterBlackKnight) {
if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
_npcinfo[i].attacking = 1;
_npcinfo[i].attackframe = 0;
@@ -956,7 +943,7 @@ void GriffonEngine::updateNPCs() {
// firehydra specific
- if (_npcinfo[i].spriteset == 5) {
+ if (_npcinfo[i].spriteset == kMonsterFireHydra) {
_npcinfo[i].swayspd = 4;
// sway code
@@ -1025,7 +1012,7 @@ void GriffonEngine::updateNPCs() {
}
// spriteset6 specific
- if (_npcinfo[i].spriteset == 6 && _npcinfo[i].attackattempt < _ticks) {
+ if (_npcinfo[i].spriteset == kMonsterRedDragon && _npcinfo[i].attackattempt < _ticks) {
if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
npx = _npcinfo[i].x;
npy = _npcinfo[i].y;
@@ -1075,7 +1062,7 @@ void GriffonEngine::updateNPCs() {
}
// wizard1 specific
- if (_npcinfo[i].spriteset == 7) {
+ if (_npcinfo[i].spriteset == kMonsterPriest) {
if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
_npcinfo[i].attacking = 1;
_npcinfo[i].attackframe = 0;
@@ -1091,7 +1078,7 @@ void GriffonEngine::updateNPCs() {
}
// spriteset6 specific
- if (_npcinfo[i].spriteset == 8 && _npcinfo[i].attackattempt < _ticks) {
+ if (_npcinfo[i].spriteset == kMonsterYellowDragon && _npcinfo[i].attackattempt < _ticks) {
if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
npx = _npcinfo[i].x;
npy = _npcinfo[i].y;
@@ -1145,7 +1132,7 @@ void GriffonEngine::updateNPCs() {
}
// twowing specific
- if (_npcinfo[i].spriteset == 9) {
+ if (_npcinfo[i].spriteset == kMonsterTwoWing) {
if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
npx = _npcinfo[i].bodysection[7].x;
npy = _npcinfo[i].bodysection[7].y;
@@ -1220,7 +1207,7 @@ void GriffonEngine::updateNPCs() {
}
// dragon2 specific
- if (_npcinfo[i].spriteset == 10 && _npcinfo[i].attackattempt < _ticks) {
+ if (_npcinfo[i].spriteset == kMonsterDragon2 && _npcinfo[i].attackattempt < _ticks) {
if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
npx = _npcinfo[i].x;
npy = _npcinfo[i].y;
@@ -1245,7 +1232,7 @@ void GriffonEngine::updateNPCs() {
// endboss specific
- if (_npcinfo[i].spriteset == 11 && _npcinfo[i].attackattempt < _ticks) {
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss && _npcinfo[i].attackattempt < _ticks) {
if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
npx = _npcinfo[i].x;
npy = _npcinfo[i].y;
@@ -1287,7 +1274,7 @@ void GriffonEngine::updateNPCs() {
pass = 0;
if (_npcinfo[i].attacking == 1)
pass = 1;
- if (_npcinfo[i].spriteset == 5) {
+ if (_npcinfo[i].spriteset == kMonsterFireHydra) {
if (_npcinfo[i].attacking2[0] == 1)
pass = 1;
if (_npcinfo[i].attacking2[1] == 1)
@@ -1300,7 +1287,7 @@ void GriffonEngine::updateNPCs() {
int dist;
float damage;
// spriteset1 specific
- if (_npcinfo[i].spriteset == 1) {
+ if (_npcinfo[i].spriteset == kMonsterBabyDragon) {
_npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
if (_npcinfo[i].attackframe >= 16) {
_npcinfo[i].attackframe = 0;
@@ -1330,7 +1317,7 @@ void GriffonEngine::updateNPCs() {
}
}
- if (_npcinfo[i].spriteset == 2) {
+ if (_npcinfo[i].spriteset == kMonsterOneWing) {
// targethead code
float xdif = _npcinfo[i].bodysection[7].x - _npcinfo[i].headtargetx[0];
float ydif = _npcinfo[i].bodysection[7].y - _npcinfo[i].headtargety[0];
@@ -1381,7 +1368,7 @@ void GriffonEngine::updateNPCs() {
// firehydra
- if (_npcinfo[i].spriteset == 5) {
+ if (_npcinfo[i].spriteset == kMonsterFireHydra) {
for (int ff = 0; ff <= 2; ff++) {
if (_npcinfo[i].attacking2[ff] == 1) {
float xdif = _npcinfo[i].bodysection[10 * ff + 9].x - _npcinfo[i].headtargetx[ff];
@@ -1435,7 +1422,7 @@ void GriffonEngine::updateNPCs() {
}
// twowing specific
- if (_npcinfo[i].spriteset == 9) {
+ if (_npcinfo[i].spriteset == kMonsterTwoWing) {
// targethead code
float xdif = _npcinfo[i].bodysection[7].x - _npcinfo[i].headtargetx[0];
float ydif = _npcinfo[i].bodysection[7].y - _npcinfo[i].headtargety[0];
@@ -1485,7 +1472,7 @@ void GriffonEngine::updateNPCs() {
}
// dragon 2 specific
- if (_npcinfo[i].spriteset == 10) {
+ if (_npcinfo[i].spriteset == kMonsterDragon2) {
_npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
if (_npcinfo[i].attackframe >= 16) {
@@ -1515,7 +1502,7 @@ void GriffonEngine::updateNPCs() {
}
// endboss specific
- if (_npcinfo[i].spriteset == 11) {
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss) {
_npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
if (_npcinfo[i].attackframe >= 16) {
_npcinfo[i].attackframe = 0;
@@ -1727,7 +1714,7 @@ void GriffonEngine::updateSpells() {
if (spellinfo[i].damagewho == 1) {
// --------- boss 1 specific
- if (ABS(spellinfo[i].frame) < 0 && _npcinfo[spellinfo[i].npc].spriteset == 3) {
+ if (ABS(spellinfo[i].frame) < 0 && _npcinfo[spellinfo[i].npc].spriteset == kMonsterBoss1) {
int npc = spellinfo[i].npc;
_npcinfo[npc].attackframe = 0;
_npcinfo[npc].attacking = 0;
@@ -1738,7 +1725,7 @@ void GriffonEngine::updateSpells() {
// ---------------
// --------- blackknight specific
- if (ABS(spellinfo[i].frame) < 0 && _npcinfo[spellinfo[i].npc].spriteset == 4) {
+ if (ABS(spellinfo[i].frame) < 0 && _npcinfo[spellinfo[i].npc].spriteset == kMonsterBlackKnight) {
int npc = spellinfo[i].npc;
_npcinfo[npc].attackframe = 0;
_npcinfo[npc].attacking = 0;
@@ -2372,7 +2359,7 @@ void GriffonEngine::updateSpells() {
if (damage < 5)
damage = 5;
- if (_npcinfo[spellinfo[i].npc].spriteset == 12) {
+ if (_npcinfo[spellinfo[i].npc].spriteset == kMonsterBatKitty) {
if (damage < 50)
damage = 40 + (int)(RND() * 40);
}
@@ -2548,9 +2535,9 @@ void GriffonEngine::updateSpellsUnder() {
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
- if (_npcinfo[e].spriteset == 5)
+ if (_npcinfo[e].spriteset == kMonsterFireHydra)
damage = -damage;
- if (_npcinfo[e].spriteset == 11)
+ if (_npcinfo[e].spriteset == kMonsterFinalBoss)
damage = -damage;
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
damageNPC(e, damage, 1);
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index e5b98ad..704d6f6 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -112,6 +112,22 @@ enum {
kScriptLever = 60 // lever
};
+// monsters
+enum {
+ kMonsterBabyDragon = 1, // baby dragon
+ kMonsterOneWing = 2, // one wing
+ kMonsterBoss1 = 3, // boss 1
+ kMonsterBlackKnight = 4, // black knight
+ kMonsterFireHydra = 5, // fire hydra
+ kMonsterRedDragon = 6, // red dragon
+ kMonsterPriest = 7, // priest
+ kMonsterYellowDragon = 8, // yellow fire dragon
+ kMonsterTwoWing = 9, // two wing
+ kMonsterDragon2 = 10, // dragon2
+ kMonsterFinalBoss = 11, // final boss
+ kMonsterBatKitty = 12 // bat kitty
+};
+
#define kEpsilon 0.001
diff --git a/engines/griffon/resources.cpp b/engines/griffon/resources.cpp
index d016a62..19c80e4 100644
--- a/engines/griffon/resources.cpp
+++ b/engines/griffon/resources.cpp
@@ -488,7 +488,7 @@ void GriffonEngine::loadMap(int mapnum) {
INPUT("%i", &_npcinfo[i].script);
// baby dragon
- if (_npcinfo[i].spriteset == 1) {
+ if (_npcinfo[i].spriteset == kMonsterBabyDragon) {
_npcinfo[i].hp = 12;
_npcinfo[i].attackdelay = 2000;
@@ -502,7 +502,7 @@ void GriffonEngine::loadMap(int mapnum) {
}
// onewing
- if (_npcinfo[i].spriteset == 2) {
+ if (_npcinfo[i].spriteset == kMonsterOneWing) {
_npcinfo[i].hp = 200;
_npcinfo[i].attackdelay = 2000;
_npcinfo[i].swayspd = 1;
@@ -515,7 +515,7 @@ void GriffonEngine::loadMap(int mapnum) {
}
// boss1
- if (_npcinfo[i].spriteset == 3) {
+ if (_npcinfo[i].spriteset == kMonsterBoss1) {
_npcinfo[i].hp = 300;
_npcinfo[i].attackdelay = 2200;
@@ -526,7 +526,7 @@ void GriffonEngine::loadMap(int mapnum) {
}
// black knights
- if (_npcinfo[i].spriteset == 4) {
+ if (_npcinfo[i].spriteset == kMonsterBlackKnight) {
_npcinfo[i].hp = 200;
_npcinfo[i].attackdelay = 2800;
@@ -537,7 +537,7 @@ void GriffonEngine::loadMap(int mapnum) {
}
// boss2 firehydra
- if (_npcinfo[i].spriteset == 5) {
+ if (_npcinfo[i].spriteset == kMonsterFireHydra) {
_npcinfo[i].hp = 600;
_npcinfo[i].attackdelay = 2200;
@@ -550,7 +550,7 @@ void GriffonEngine::loadMap(int mapnum) {
}
// baby fire dragon
- if (_npcinfo[i].spriteset == 6) {
+ if (_npcinfo[i].spriteset == kMonsterRedDragon) {
_npcinfo[i].hp = 20;
_npcinfo[i].attackdelay = 1500;
@@ -564,7 +564,7 @@ void GriffonEngine::loadMap(int mapnum) {
}
// priest1
- if (_npcinfo[i].spriteset == 7) {
+ if (_npcinfo[i].spriteset == kMonsterPriest) {
_npcinfo[i].hp = 40;
_npcinfo[i].attackdelay = 5000;
@@ -578,7 +578,7 @@ void GriffonEngine::loadMap(int mapnum) {
}
// yellow fire dragon
- if (_npcinfo[i].spriteset == 8) {
+ if (_npcinfo[i].spriteset == kMonsterYellowDragon) {
_npcinfo[i].hp = 100;
_npcinfo[i].attackdelay = 1500;
@@ -592,7 +592,7 @@ void GriffonEngine::loadMap(int mapnum) {
}
// twowing
- if (_npcinfo[i].spriteset == 9) {
+ if (_npcinfo[i].spriteset == kMonsterTwoWing) {
_npcinfo[i].hp = 140;
_npcinfo[i].attackdelay = 2000;
_npcinfo[i].swayspd = 1;
@@ -606,7 +606,7 @@ void GriffonEngine::loadMap(int mapnum) {
}
// dragon2
- if (_npcinfo[i].spriteset == 10) {
+ if (_npcinfo[i].spriteset == kMonsterDragon2) {
_npcinfo[i].hp = 80;
_npcinfo[i].attackdelay = 1500;
@@ -619,7 +619,7 @@ void GriffonEngine::loadMap(int mapnum) {
}
// end boss
- if (_npcinfo[i].spriteset == 11) {
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss) {
_npcinfo[i].hp = 1200;
_npcinfo[i].attackdelay = 2000;
@@ -632,7 +632,7 @@ void GriffonEngine::loadMap(int mapnum) {
}
// bat kitty
- if (_npcinfo[i].spriteset == 12) {
+ if (_npcinfo[i].spriteset == kMonsterBatKitty) {
_npcinfo[i].hp = 800;
_npcinfo[i].attackdelay = 2000;
@@ -655,7 +655,7 @@ void GriffonEngine::loadMap(int mapnum) {
_npcinfo[i].attackspd = 1.5;
_npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay * (1 + RND() * 2);
- if (_npcinfo[i].spriteset == 2 || _npcinfo[i].spriteset == 9) {
+ if (_npcinfo[i].spriteset == kMonsterOneWing || _npcinfo[i].spriteset == kMonsterTwoWing) {
_npcinfo[i].bodysection[0].sprite = 0;
_npcinfo[i].bodysection[1].sprite = 1;
_npcinfo[i].bodysection[2].sprite = 2;
@@ -683,7 +683,7 @@ void GriffonEngine::loadMap(int mapnum) {
}
- if (_npcinfo[i].spriteset == 5) {
+ if (_npcinfo[i].spriteset == kMonsterFireHydra) {
for (int f = 0; f <= 29; f++) {
_npcinfo[i].bodysection[f].x = _npcinfo[i].x + 12;
_npcinfo[i].bodysection[f].y = _npcinfo[i].y + 14;
Commit: 040513ae5d2655c0fe25c2a44c2263b0710fa565
https://github.com/scummvm/scummvm/commit/040513ae5d2655c0fe25c2a44c2263b0710fa565
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Added logic.cpp
Changed paths:
A engines/griffon/logic.cpp
engines/griffon/engine.cpp
engines/griffon/griffon.h
engines/griffon/module.mk
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 4344b8d..25f580e 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -42,43 +42,6 @@
namespace Griffon {
-// memo
-
-/*
- chests
- 0 - regular flask
- 11 - key chest
- 14 - blue flask chest
- 15 - lightning chest
- 16 - armour chest
- 17 - citadel master key
- 18 - sword3
- 19 - shield3
- 20 - armour3
-
-*/
-
-// element tile locations
-const int elementmap[15][20] = {
- { 2, 2, 2, 2, -1, -1, -1, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1 },
- { 2, -1, -1, -1, -1, -1, -1, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1 },
- { 2, -1, 2, 2, -1, -1, -1, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1 },
- { 2, -1, 2, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
- { 2, 2, 2, 2, 2, -1, -1, -1, 2, -1, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1 },
- { -1, -1, -1, -1, 2, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
- { -1, -1, -1, -1, -1, 0, 0, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
- { -1, -1, -1, -1, -1, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
- { -1, -1, -1, -1, -1, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
- { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
- { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
- { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
- { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
- { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
- { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
-};
-
-// CODE GOES HERE -------------------------------------------------------------
-
// copypaste from hRnd_CRT()
float GriffonEngine::RND() {
/* return between 0 and 1 (but never 1) */
@@ -363,2325 +326,5 @@ void GriffonEngine::newGame() {
mainLoop();
}
-void GriffonEngine::updateAnims() {
- for (int i = 0; i <= _lastObj; i++) {
- int nframes = _objectInfo[i][0];
- int o_animspd = _objectInfo[i][3];
- float frame = _objectFrame[i][0];
- int cframe = _objectFrame[i][1];
- // _objectinfo[i][6] = 0; // ?? out of bounds
-
- if (nframes > 1) {
- frame = frame + o_animspd / 50 * _fpsr;
- while (frame >= nframes)
- frame = frame - nframes;
-
- cframe = (int)frame; // truncate fractional part
- if (cframe > nframes)
- cframe = nframes - 1;
- if (cframe < 0)
- cframe = 0;
-
- _objectFrame[i][0] = frame;
- _objectFrame[i][1] = cframe;
- }
- }
-}
-
-void GriffonEngine::updateY() {
- for (int i = 0; i <= 2400; i++)
- _ysort[i] = -1;
-
- int ff = (int)(_player.py * 10);
- if (ff < 0) // HACKFIX or _ysort[yy] may go out of bounds
- ff = 0;
- _player.ysort = ff;
- _ysort[ff] = 0;
-
- _firsty = 2400;
- _lasty = 0;
-
- for (int i = 1; i <= _lastnpc; i++) {
- int yy = (int)(_npcinfo[i].y * 10);
-
- do {
- if (_ysort[yy] == -1 || yy == 2400)
- break;
- yy = yy + 1;
- } while (1);
-
- _ysort[yy] = i;
- if (yy < _firsty)
- _firsty = yy;
- if (yy > _lasty)
- _lasty = yy;
- }
-}
-
-void GriffonEngine::updateNPCs() {
- for (int i = 1; i <= _lastnpc; i++) {
- if (_npcinfo[i].hp > 0) {
- // is npc walking
- int pass = 0;
- if (_npcinfo[i].attacking == 0)
- pass = 1;
- if (_npcinfo[i].spriteset == kMonsterFireHydra)
- pass = 1;
- if (pass == 1) {
- int moveup = 0;
- int movedown = 0;
- int moveleft = 0;
- int moveright = 0;
-
- float npx = _npcinfo[i].x;
- float npy = _npcinfo[i].y;
-
- float onpx = npx;
- float onpy = npy;
-
- float wspd = _npcinfo[i].walkspd / 4;
-
- if (_npcinfo[i].spriteset == kMonsterDragon2)
- wspd = wspd * 2;
- int wdir = _npcinfo[i].walkdir;
-
- int mode = _npcinfo[i].movementmode;
-
- float xdif = _player.px - npx;
- float ydif = _player.py - npy;
-
- if (abs(xdif) < 4 * 16 && abs(ydif) < 4 * 16 && mode < 3)
- mode = 0;
- if (_npcinfo[i].hp < _npcinfo[i].maxhp * 0.25)
- mode = 3;
-
- if (_npcinfo[i].pause > _ticks)
- mode = -1;
- if (_npcinfo[i].spriteset == kMonsterOneWing && _npcinfo[i].castpause > _ticks)
- mode = -1;
-
- if (mode == 3) {
- mode = 1;
- if (abs(xdif) < 4 * 16 && abs(ydif) < 4 * 16)
- mode = 3;
- }
-
- bool checkpass = false;
-
- // npc AI CODE
- // --------------
-
- // *** aggressive
- if (mode == 0) {
- wspd = _npcinfo[i].walkspd / 2;
-
- xdif = _player.px - npx;
- ydif = _player.py - npy;
-
- if (abs(xdif) > abs(ydif)) {
- if (xdif < 4)
- wdir = 2;
- if (xdif > -4)
- wdir = 3;
- } else {
- if (ydif < 4)
- wdir = 0;
- if (ydif > -4)
- wdir = 1;
- }
-
- if (xdif < 4)
- moveleft = 1;
- if (xdif > -4)
- moveright = 1;
- if (ydif < 4)
- moveup = 1;
- if (ydif > -4)
- movedown = 1;
- }
- // *******************
-
- // *** defensive
- if (mode == 1) {
-
- int movingdir = _npcinfo[i].movingdir;
-
- if (_npcinfo[i].ticks > _ticks + 100000)
- _npcinfo[i].ticks = _ticks;
-
- if (_npcinfo[i].ticks < _ticks) {
- _npcinfo[i].ticks = _ticks + 2000;
- movingdir = (int)(RND() * 8);
- _npcinfo[i].movingdir = movingdir;
- }
-
- if (movingdir == 0) {
- wdir = 2; // left
- moveup = 1;
- moveleft = 1;
- } else if (movingdir == 1) {
- wdir = 0; // up
- moveup = 1;
- } else if (movingdir == 2) {
- wdir = 3; // right
- moveup = 1;
- moveright = 1;
- } else if (movingdir == 3) {
- wdir = 3; // right
- moveright = 1;
- } else if (movingdir == 4) {
- wdir = 3; // right
- moveright = 1;
- movedown = 1;
- } else if (movingdir == 5) {
- wdir = 1; // down
- movedown = 1;
- } else if (movingdir == 6) {
- wdir = 2; // left
- movedown = 1;
- moveleft = 1;
- } else if (movingdir == 7) {
- wdir = 2; // left
- moveleft = 1;
- }
-
- checkpass = true;
- }
- // *******************
-
- // *** run away
- if (mode == 3) {
- wspd = _npcinfo[i].walkspd / 2;
-
- xdif = _player.px - npx;
- ydif = _player.py - npy;
-
- if (abs(xdif) > abs(ydif)) {
- if (xdif < 4)
- wdir = 3;
- if (xdif > -4)
- wdir = 2;
- } else {
- if (ydif < 4)
- wdir = 1;
- if (ydif > -4)
- wdir = 0;
- }
-
- if (xdif < 4)
- moveright = 1;
- if (xdif > -4)
- moveleft = 1;
- if (ydif < 4)
- movedown = 1;
- if (ydif > -4)
- moveup = 1;
- }
- // *******************
-
- // -------------- ?? move*** vs movin***
- int movinup = 0;
- int movindown = 0;
- int movinleft = 0;
- int movinright = 0;
-
- float xp = (npx / 2 + 6);
- float yp = (npy / 2 + 10);
-
- if (_npcinfo[i].spriteset == kMonsterDragon2)
- wspd = wspd * 2;
-
- float ii = wspd * _fpsr;
- if (ii < 1)
- ii = 1;
-
- if (moveup) {
- int sx = xp;
- int sy = yp - ii;
- uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
- uint32 dq = *temp;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
- dq = 0;
-
- if (dq == 0)
- movinup = 1;
- if (dq > 0) {
- sx = xp - ii;
- sy = yp - ii;
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
- dq = *temp;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
- dq = 0;
- if (dq == 0) {
- movinup = 1;
- movinleft = 1;
- }
- }
- if (dq > 0) {
- sx = xp + ii;
- sy = yp - ii;
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
- dq = *temp;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
- dq = 0;
- if (dq == 0) {
- movinup = 1;
- movinright = 1;
- }
- }
- }
-
- if (movedown) {
- int sx = xp;
- int sy = yp + ii;
- uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
- uint32 dq = *temp;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
- dq = 0;
- if (dq == 0)
- movindown = 1;
- if (dq > 0) {
- sx = xp - ii;
- sy = yp + ii;
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
- dq = *temp;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
- dq = 0;
- if (dq == 0) {
- movindown = 1;
- movinleft = 1;
- }
- }
- if (dq > 0) {
- sx = xp + ii;
- sy = yp + ii;
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
- dq = *temp;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
- dq = 0;
- if (dq == 0) {
- movindown = 1;
- movinright = 1;
- }
- }
- }
-
- if (moveleft) {
- int sx = xp - ii;
- int sy = yp;
- uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
- uint32 dq = *temp;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
- dq = 0;
- if (dq == 0)
- movinleft = 1;
- if (dq > 0) {
- sx = xp - ii;
- sy = yp - ii;
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
- dq = *temp;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
- dq = 0;
- if (dq == 0) {
- movinleft = 1;
- movinup = 1;
- }
- }
- if (dq > 0) {
- sx = xp - ii;
- sy = yp + ii;
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
- dq = *temp;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
- dq = 0;
- if (dq == 0) {
- movinleft = 1;
- movindown = 1;
- }
- }
- }
-
- if (moveright) {
- int sx = xp + ii;
- int sy = yp;
- uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
- uint32 dq = *temp;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
- dq = 0;
- if (dq == 0)
- movinright = 1;
- if (dq > 0) {
- sx = xp + ii;
- sy = yp - ii;
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
- dq = *temp;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
- dq = 0;
- if (dq == 0) {
- movinright = 1;
- movinup = 1;
- }
- }
- if (dq > 0) {
- sx = xp + ii;
- sy = yp + ii;
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
- dq = *temp;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
- dq = 0;
- if (dq == 0) {
- movinright = 1;
- movindown = 1;
- }
- }
- }
-
- if (movinup)
- npy = npy - wspd * _fpsr;
- if (movindown)
- npy = npy + wspd * _fpsr;
- if (movinleft)
- npx = npx - wspd * _fpsr;
- if (movinright)
- npx = npx + wspd * _fpsr;
-
- if (checkpass) {
- pass = 0;
- if (npx >= _npcinfo[i].x1 * 16 - 8 && npx <= _npcinfo[i].x2 * 16 + 8 && npy >= _npcinfo[i].y1 * 16 - 8 && npy <= _npcinfo[i].y2 * 16 + 8)
- pass = 1;
- if (pass == 0) {
- npx = onpx;
- npy = onpy;
- _npcinfo[i].ticks = _ticks;
- }
- }
-
- float aspd = wspd;
-
- if (_npcinfo[i].spriteset == kMonsterDragon2)
- aspd = wspd / 2;
-
- xp = (npx / 2 + 6);
- yp = (npy / 2 + 10);
-
- int sx = xp;
- int sy = yp;
- uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
- uint32 bgc = *temp;
-
- float anpx = npx + 12;
- float anpy = npy + 20;
-
- int lx = (int)anpx / 16;
- int ly = (int)anpy / 16;
-
- if (_triggerloc[lx][ly] > -1)
- bgc = 1;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
- bgc = 0;
-
- int rst = 0;
-
- if (_npcinfo[i].spriteset == kMonsterFinalBoss) {
- if (npx < 40 || npx > 280 || npy < 36 || npy > 204)
- rst = 1;
- }
-
- if (bgc > 0 || rst == 1) {
- npx = onpx;
- npy = onpy;
- }
-
- _npcinfo[i].x = npx;
- _npcinfo[i].y = npy;
-
- _npcinfo[i].walkdir = wdir;
- _npcinfo[i].moving = 0;
-
- if (npx != onpx || npy != onpy)
- _npcinfo[i].moving = 1;
-
- if (_npcinfo[i].moving == 1) {
- float frame = _npcinfo[i].frame;
- int cframe = _npcinfo[i].cframe;
-
- frame = frame + aspd * _fpsr;
- while (frame >= 16)
- frame = frame - 16;
-
- cframe = (int)(frame);
- if (cframe > 16)
- cframe = 16 - 1;
- if (cframe < 0)
- cframe = 0;
-
- _npcinfo[i].frame = frame;
- _npcinfo[i].cframe = cframe;
- }
-
- // spriteset1 specific
- if (_npcinfo[i].spriteset == kMonsterBabyDragon && _npcinfo[i].attackattempt < _ticks) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
- npx = _npcinfo[i].x;
- npy = _npcinfo[i].y;
-
- xdif = _player.px - npx;
- ydif = _player.py - npy;
-
- if (abs(xdif) < 20 && abs(ydif) < 20) {
- _npcinfo[i].attackattempt = _ticks + 100;
- if ((int)(RND() * 2) == 0) {
- if (config.effects) {
- int snd = playSound(_sfx[kSndEnemyHit]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- _npcinfo[i].attacking = 1;
- _npcinfo[i].attackframe = 0;
- }
- }
- }
- }
-
- bool dospell = false;
-
- // onewing specific
- if (_npcinfo[i].spriteset == kMonsterOneWing) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
- npx = _npcinfo[i].x;
- npy = _npcinfo[i].y;
-
- xdif = _player.px - npx;
- ydif = _player.py - npy;
-
- if (abs(xdif) < 24 && abs(ydif) < 24) {
- float dist = sqrt(xdif * xdif + ydif * ydif);
-
- if ((dist) < 24) {
- if (config.effects) {
- int snd = playSound(_sfx[kSndBite]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- _npcinfo[i].attacking = 1;
- _npcinfo[i].attackframe = 0;
-
- _npcinfo[i].headtargetx[0] = _player.px + 12;
- _npcinfo[i].headtargety[0] = _player.py - 4;
- }
- }
-
- }
-
- dospell = false;
-
- if (_npcinfo[i].attacking == 0 && _npcinfo[i].castpause < _ticks) {
- _npcinfo[i].swayspd = _npcinfo[i].swayspd + _npcinfo[i].swayspd / 200 * _fpsr;
- if (_npcinfo[i].swayspd > 15) {
- dospell = true;
- _npcinfo[i].swayspd = 1;
- }
-
- // sway code
- _npcinfo[i].swayangle = _npcinfo[i].swayangle + _npcinfo[i].swayspd * _fpsr;
- if (_npcinfo[i].swayangle >= 360)
- _npcinfo[i].swayangle = _npcinfo[i].swayangle - 360;
-
- _npcinfo[i].headtargetx[0] = _npcinfo[i].x + (24 - _npcinfo[i].swayspd / 2) * sin(3.14159 / 180 * _npcinfo[i].swayangle) + 12;
- _npcinfo[i].headtargety[0] = _npcinfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * _npcinfo[i].swayangle);
- }
-
- if (dospell) {
- _npcinfo[i].pause = _ticks + 3000;
- _npcinfo[i].attacknext = _ticks + 4500;
- _npcinfo[i].castpause = _ticks + 4500;
-
- castSpell(3, _npcinfo[i].x, _npcinfo[i].y, _npcinfo[i].x, _npcinfo[i].y, i);
-
- _npcinfo[i].headtargetx[0] = _npcinfo[i].x;
- _npcinfo[i].headtargety[0] = _npcinfo[i].y - 36 + 16;
- }
-
- // targethead code
- xdif = _npcinfo[i].bodysection[7].x - _npcinfo[i].headtargetx[0];
- ydif = _npcinfo[i].bodysection[7].y - _npcinfo[i].headtargety[0];
-
-
- _npcinfo[i].bodysection[7].x = _npcinfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
- _npcinfo[i].bodysection[7].y = _npcinfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
-
-
- _npcinfo[i].bodysection[0].x = _npcinfo[i].x + 12;
- _npcinfo[i].bodysection[0].y = _npcinfo[i].y + 12;
-
- for (int f = 6; f >= 1; f--) {
- xdif = _npcinfo[i].bodysection[f + 1].x - _npcinfo[i].bodysection[f - 1].x;
- ydif = _npcinfo[i].bodysection[f + 1].y - _npcinfo[i].bodysection[f - 1].y;
-
- float tx = _npcinfo[i].bodysection[f - 1].x + xdif / 2;
- float ty = _npcinfo[i].bodysection[f - 1].y + ydif / 2;
-
- _npcinfo[i].bodysection[f].x = _npcinfo[i].bodysection[f].x - (_npcinfo[i].bodysection[f].x - tx) / 3;
- _npcinfo[i].bodysection[f].y = _npcinfo[i].bodysection[f].y - (_npcinfo[i].bodysection[f].y - ty) / 3;
- }
- }
-
- // boss1 specific and blackknight
- if (_npcinfo[i].spriteset == kMonsterBoss1 || _npcinfo[i].spriteset == kMonsterBlackKnight) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
- _npcinfo[i].attacking = 1;
- _npcinfo[i].attackframe = 0;
-
- castSpell(1, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i);
- }
-
- if (_npcinfo[i].castpause < _ticks) {
- castSpell(6, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i);
- _npcinfo[i].castpause = _ticks + 12000;
- }
- }
-
-
- // firehydra specific
- if (_npcinfo[i].spriteset == kMonsterFireHydra) {
- _npcinfo[i].swayspd = 4;
-
- // sway code
- _npcinfo[i].swayangle = _npcinfo[i].swayangle + _npcinfo[i].swayspd * _fpsr;
- if (_npcinfo[i].swayangle >= 360)
- _npcinfo[i].swayangle = _npcinfo[i].swayangle - 360;
-
- for (int ff = 0; ff <= 2; ff++) {
- if (_npcinfo[i].hp > 10 * ff * 20) {
- if (_npcinfo[i].pause < _ticks && _npcinfo[i].attacking2[ff] == 0 && _npcinfo[i].attacknext2[ff] < _ticks) {
- npx = _npcinfo[i].x;
- npy = _npcinfo[i].y;
-
- xdif = _player.px - npx;
- ydif = _player.py - npy;
-
- if (abs(xdif) < 48 && abs(ydif) < 48) {
- float dist = sqrt(xdif * xdif + ydif * ydif);
-
- if ((dist) < 36) {
- if (config.effects) {
- int snd = playSound(_sfx[kSndBite]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- _npcinfo[i].attacking = 1;
- _npcinfo[i].attacking2[ff] = 1;
- _npcinfo[i].attackframe2[ff] = 0;
-
- _npcinfo[i].headtargetx[ff] = _player.px + 12;
- _npcinfo[i].headtargety[ff] = _player.py - 4;
-
- _npcinfo[i].swayangle = 0;
- }
- }
-
- }
-
- if (_npcinfo[i].attacking2[ff] == 0) {
- _npcinfo[i].headtargetx[ff] = _npcinfo[i].x + 38 * sin(3.14159 / 180 * (_npcinfo[i].swayangle + 120 * ff)) + 12;
- _npcinfo[i].headtargety[ff] = _npcinfo[i].y - 46 + 16 + 16 * sin(3.14159 * 2 / 180 * (_npcinfo[i].swayangle + 120 * ff));
- }
-
- // targethead code
- xdif = _npcinfo[i].bodysection[10 * ff + 9].x - _npcinfo[i].headtargetx[ff];
- ydif = _npcinfo[i].bodysection[10 * ff + 9].y - _npcinfo[i].headtargety[ff];
-
- _npcinfo[i].bodysection[10 * ff + 9].x = _npcinfo[i].bodysection[10 * ff + 9].x - xdif * 0.4 * _fpsr;
- _npcinfo[i].bodysection[10 * ff + 9].y = _npcinfo[i].bodysection[10 * ff + 9].y - ydif * 0.4 * _fpsr;
-
- _npcinfo[i].bodysection[10 * ff].x = _npcinfo[i].x + 12 + 8 * cos(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
- _npcinfo[i].bodysection[10 * ff].y = _npcinfo[i].y + 12 + 8 * sin(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
-
- for (int f = 8; f >= 1; f--) {
- xdif = _npcinfo[i].bodysection[ff * 10 + f + 1].x - _npcinfo[i].bodysection[ff * 10 + f - 1].x;
- ydif = _npcinfo[i].bodysection[ff * 10 + f + 1].y - _npcinfo[i].bodysection[ff * 10 + f - 1].y;
-
- float tx = _npcinfo[i].bodysection[ff * 10 + f - 1].x + xdif / 2;
- float ty = _npcinfo[i].bodysection[ff * 10 + f - 1].y + ydif / 2;
-
- _npcinfo[i].bodysection[ff * 10 + f].x = _npcinfo[i].bodysection[ff * 10 + f].x - (_npcinfo[i].bodysection[ff * 10 + f].x - tx) / 3;
- _npcinfo[i].bodysection[ff * 10 + f].y = _npcinfo[i].bodysection[ff * 10 + f].y - (_npcinfo[i].bodysection[ff * 10 + f].y - ty) / 3;
- }
- }
- }
- }
-
- // spriteset6 specific
- if (_npcinfo[i].spriteset == kMonsterRedDragon && _npcinfo[i].attackattempt < _ticks) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
- npx = _npcinfo[i].x;
- npy = _npcinfo[i].y;
-
- xdif = _player.px - npx;
- ydif = _player.py - npy;
-
- pass = 0;
- if (abs(xdif) < 48 && abs(ydif) < 6)
- pass = 1;
- if (abs(ydif) < 48 && abs(xdif) < 6)
- pass = 2;
-
- if (pass > 0) {
- _npcinfo[i].attackattempt = _ticks + 100;
- if ((int)(RND() * 2) == 0) {
- _npcinfo[i].attacking = 1;
- _npcinfo[i].attackframe = 0;
- float nnxa = 0, nnya = 0, nnxb = 0, nnyb = 0;
-
- if (pass == 1 && xdif < 0) {
- nnxa = npx - 8;
- nnya = npy + 4;
- nnxb = npx - 48 - 8;
- nnyb = npy + 4;
- } else if (pass == 1 && xdif > 0) {
- nnxa = npx + 16;
- nnya = npy + 4;
- nnxb = npx + 16 + 48;
- nnyb = npy + 4;
- } else if (pass == 2 && ydif < 0) {
- nnya = npy;
- nnxa = npx + 4;
- nnyb = npy - 48;
- nnxb = npx + 4;
- } else if (pass == 2 && ydif > 0) {
- nnya = npy + 20;
- nnxa = npx + 4;
- nnyb = npy + 20 + 48;
- nnxb = npx + 4;
- }
-
- castSpell(7, nnxa, nnya, nnxb, nnyb, i);
- }
- }
- }
- }
-
- // wizard1 specific
- if (_npcinfo[i].spriteset == kMonsterPriest) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
- _npcinfo[i].attacking = 1;
- _npcinfo[i].attackframe = 0;
-
- castSpell(9, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i);
- }
-
- if (_npcinfo[i].castpause < _ticks) {
- // castSpell 6, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i
- // _npcinfo[i].castpause = _ticks + 12000
- }
-
- }
-
- // spriteset6 specific
- if (_npcinfo[i].spriteset == kMonsterYellowDragon && _npcinfo[i].attackattempt < _ticks) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
- npx = _npcinfo[i].x;
- npy = _npcinfo[i].y;
-
- xdif = _player.px - npx;
- ydif = _player.py - npy;
-
- pass = 0;
- if (abs(xdif) < 56 && abs(ydif) < 6)
- pass = 1;
- if (abs(ydif) < 56 && abs(xdif) < 6)
- pass = 2;
-
- if (pass > 0) {
- _npcinfo[i].attackattempt = _ticks + 100;
- if ((int)(RND() * 2) == 0) {
- _npcinfo[i].attacking = 1;
- _npcinfo[i].attackframe = 0;
-
- float nnxa = 0, nnya = 0, nnxb = 0, nnyb = 0;
- if (pass == 1 && xdif < 0) {
- nnxa = npx - 8;
- nnya = npy + 4;
- nnxb = npx - 56 - 8;
- nnyb = npy + 4;
- _npcinfo[i].walkdir = 2;
- } else if (pass == 1 && xdif > 0) {
- nnxa = npx + 16;
- nnya = npy + 4;
- nnxb = npx + 16 + 56;
- nnyb = npy + 4;
- _npcinfo[i].walkdir = 3;
- } else if (pass == 2 && ydif < 0) {
- nnya = npy;
- nnxa = npx + 4;
- nnyb = npy - 56;
- nnxb = npx + 4;
- _npcinfo[i].walkdir = 0;
- } else if (pass == 2 && ydif > 0) {
- nnya = npy + 20;
- nnxa = npx + 4;
- nnyb = npy + 20 + 56;
- nnxb = npx + 4;
- _npcinfo[i].walkdir = 1;
- }
-
- castSpell(7, nnxa, nnya, nnxb, nnyb, i);
- }
- }
- }
- }
-
- // twowing specific
- if (_npcinfo[i].spriteset == kMonsterTwoWing) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
- npx = _npcinfo[i].bodysection[7].x;
- npy = _npcinfo[i].bodysection[7].y;
-
- xdif = _player.px - npx;
- ydif = _player.py - npy;
-
- if (abs(xdif) < 24 && abs(ydif) < 24) {
- float dist = sqrt(xdif * xdif + ydif * ydif);
-
- if ((dist) < 24) {
- if (config.effects) {
- int snd = playSound(_sfx[kSndBite]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- _npcinfo[i].attacking = 1;
- _npcinfo[i].attackframe = 0;
-
- _npcinfo[i].headtargetx[0] = _player.px + 12;
- _npcinfo[i].headtargety[0] = _player.py - 4;
- }
- }
-
- }
-
- if (_npcinfo[i].attacking == 0 && _npcinfo[i].castpause < _ticks) {
- _npcinfo[i].swayspd = 4;
-
- // sway code
- _npcinfo[i].swayangle = _npcinfo[i].swayangle + _npcinfo[i].swayspd * _fpsr;
- if (_npcinfo[i].swayangle >= 360)
- _npcinfo[i].swayangle = _npcinfo[i].swayangle - 360;
-
- _npcinfo[i].headtargetx[0] = _npcinfo[i].x + (24 - _npcinfo[i].swayspd / 2) * sin(3.14159 / 180 * _npcinfo[i].swayangle) + 12;
- _npcinfo[i].headtargety[0] = _npcinfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * _npcinfo[i].swayangle);
- }
-
- if (dospell) {
- _npcinfo[i].pause = _ticks + 3000;
- _npcinfo[i].attacknext = _ticks + 5000;
- _npcinfo[i].castpause = _ticks + 3000;
-
- castSpell(3, _npcinfo[i].x, _npcinfo[i].y, _npcinfo[i].x, _npcinfo[i].y, i);
-
- _npcinfo[i].headtargetx[0] = _npcinfo[i].x;
- _npcinfo[i].headtargety[0] = _npcinfo[i].y - 36 + 16;
- }
-
- // targethead code
- xdif = _npcinfo[i].bodysection[7].x - _npcinfo[i].headtargetx[0];
- ydif = _npcinfo[i].bodysection[7].y - _npcinfo[i].headtargety[0];
-
-
- _npcinfo[i].bodysection[7].x = _npcinfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
- _npcinfo[i].bodysection[7].y = _npcinfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
-
- _npcinfo[i].bodysection[0].x = _npcinfo[i].x + 12;
- _npcinfo[i].bodysection[0].y = _npcinfo[i].y + 12;
-
- for (int f = 6; f >= 1; f--) {
- xdif = _npcinfo[i].bodysection[f + 1].x - _npcinfo[i].bodysection[f - 1].x;
- ydif = _npcinfo[i].bodysection[f + 1].y - _npcinfo[i].bodysection[f - 1].y;
-
- float tx = _npcinfo[i].bodysection[f - 1].x + xdif / 2;
- float ty = _npcinfo[i].bodysection[f - 1].y + ydif / 2;
-
- _npcinfo[i].bodysection[f].x = _npcinfo[i].bodysection[f].x - (_npcinfo[i].bodysection[f].x - tx) / 3;
- _npcinfo[i].bodysection[f].y = _npcinfo[i].bodysection[f].y - (_npcinfo[i].bodysection[f].y - ty) / 3;
- }
-
- }
-
- // dragon2 specific
- if (_npcinfo[i].spriteset == kMonsterDragon2 && _npcinfo[i].attackattempt < _ticks) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
- npx = _npcinfo[i].x;
- npy = _npcinfo[i].y;
-
- xdif = _player.px - npx;
- ydif = _player.py - npy;
-
- if (abs(xdif) < 32 && abs(ydif) < 32) {
- _npcinfo[i].attackattempt = _ticks + 100;
- if ((int)(RND() * 2) == 0) {
- if (config.effects) {
- int snd = playSound(_sfx[kSndEnemyHit]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- _npcinfo[i].attacking = 1;
- _npcinfo[i].attackframe = 0;
- }
- }
- }
- }
-
-
- // endboss specific
- if (_npcinfo[i].spriteset == kMonsterFinalBoss && _npcinfo[i].attackattempt < _ticks) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
- npx = _npcinfo[i].x;
- npy = _npcinfo[i].y;
-
- xdif = _player.px - npx;
- ydif = _player.py - npy;
-
- if (abs(xdif) < 38 && abs(ydif) < 38) {
- _npcinfo[i].attackattempt = _ticks + 100;
- if ((int)(RND() * 2) == 0) {
- if (config.effects) {
- int snd = playSound(_sfx[kSndIce]);
- setChannelVolume(snd, config.effectsvol);
- }
- _npcinfo[i].attacking = 1;
- _npcinfo[i].attackframe = 0;
- }
- }
- }
- }
- }
-
-
- float npx = _npcinfo[i].x;
- float npy = _npcinfo[i].y;
-
- int xp = (npx / 2 + 6);
- int yp = (npy / 2 + 10);
-
- rcSrc.left = xp - 1;
- rcSrc.top = yp - 1;
- rcSrc.setWidth(3);
- rcSrc.setHeight(3);
-
- if (_npcinfo[i].pause < _ticks)
- _clipbg->fillRect(rcSrc, i);
-
-
- pass = 0;
- if (_npcinfo[i].attacking == 1)
- pass = 1;
- if (_npcinfo[i].spriteset == kMonsterFireHydra) {
- if (_npcinfo[i].attacking2[0] == 1)
- pass = 1;
- if (_npcinfo[i].attacking2[1] == 1)
- pass = 1;
- if (_npcinfo[i].attacking2[2] == 1)
- pass = 1;
- }
-
- if (pass == 1) {
- int dist;
- float damage;
- // spriteset1 specific
- if (_npcinfo[i].spriteset == kMonsterBabyDragon) {
- _npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
- if (_npcinfo[i].attackframe >= 16) {
- _npcinfo[i].attackframe = 0;
- _npcinfo[i].attacking = 0;
- _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
- }
-
- _npcinfo[i].cattackframe = (int)(_npcinfo[i].attackframe);
-
- npx = _npcinfo[i].x;
- npy = _npcinfo[i].y;
-
- float xdif = _player.px - npx;
- float ydif = _player.py - npy;
-
- dist = 10;
-
- if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
- _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
- // _npcinfo[i].attackframe = 0;
- // _npcinfo[i].attacking = 0;
-
- damage = (float)_npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
-
- if (_player.hp > 0)
- damagePlayer(damage);
- }
- }
-
- if (_npcinfo[i].spriteset == kMonsterOneWing) {
- // targethead code
- float xdif = _npcinfo[i].bodysection[7].x - _npcinfo[i].headtargetx[0];
- float ydif = _npcinfo[i].bodysection[7].y - _npcinfo[i].headtargety[0];
-
- _npcinfo[i].bodysection[7].x = _npcinfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
- _npcinfo[i].bodysection[7].y = _npcinfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
-
- _npcinfo[i].bodysection[0].x = _npcinfo[i].x + 12;
- _npcinfo[i].bodysection[0].y = _npcinfo[i].y + 12;
-
- for (int f = 6; f >= 1; f--) {
- xdif = _npcinfo[i].bodysection[f + 1].x - _npcinfo[i].bodysection[f - 1].x;
- ydif = _npcinfo[i].bodysection[f + 1].y - _npcinfo[i].bodysection[f - 1].y;
-
- float tx = _npcinfo[i].bodysection[f - 1].x + xdif / 2;
- float ty = _npcinfo[i].bodysection[f - 1].y + ydif / 2;
-
- _npcinfo[i].bodysection[f].x = _npcinfo[i].bodysection[f].x - (_npcinfo[i].bodysection[f].x - tx);
- _npcinfo[i].bodysection[f].y = _npcinfo[i].bodysection[f].y - (_npcinfo[i].bodysection[f].y - ty);
- }
-
- _npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
- if (_npcinfo[i].attackframe >= 16) {
- _npcinfo[i].attackframe = 0;
- _npcinfo[i].attacking = 0;
- _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
- }
-
- _npcinfo[i].cattackframe = (int)(_npcinfo[i].attackframe);
-
- npx = _npcinfo[i].bodysection[7].x;
- npy = (_npcinfo[i].bodysection[7].y + 16);
-
- xdif = (_player.px + 12) - npx;
- ydif = (_player.py + 12) - npy;
-
- dist = 8;
-
- if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
- _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
- // _npcinfo[i].attackframe = 0
- // _npcinfo[i].attacking = 0
- damage = (float)_npcinfo[i].attackdamage * (1.0 + (RND() * 0.5));
- if (_player.hp > 0)
- damagePlayer(damage);
- }
- }
-
-
- // firehydra
- if (_npcinfo[i].spriteset == kMonsterFireHydra) {
- for (int ff = 0; ff <= 2; ff++) {
- if (_npcinfo[i].attacking2[ff] == 1) {
- float xdif = _npcinfo[i].bodysection[10 * ff + 9].x - _npcinfo[i].headtargetx[ff];
- float ydif = _npcinfo[i].bodysection[10 * ff + 9].y - _npcinfo[i].headtargety[ff];
-
- _npcinfo[i].bodysection[10 * ff + 9].x = _npcinfo[i].bodysection[10 * ff + 9].x - xdif * .2 * _fpsr;
- _npcinfo[i].bodysection[10 * ff + 9].y = _npcinfo[i].bodysection[10 * ff + 9].y - ydif * .2 * _fpsr;
-
- _npcinfo[i].bodysection[10 * ff].x = _npcinfo[i].x + 12 + 8 * cos(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
- _npcinfo[i].bodysection[10 * ff].y = _npcinfo[i].y + 12 + 8 * sin(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
-
- for (int f = 8; f >= 1; f--) {
- xdif = _npcinfo[i].bodysection[ff * 10 + f + 1].x - _npcinfo[i].bodysection[ff * 10 + f - 1].x;
- ydif = _npcinfo[i].bodysection[ff * 10 + f + 1].y - _npcinfo[i].bodysection[ff * 10 + f - 1].y;
-
- float tx = _npcinfo[i].bodysection[ff * 10 + f - 1].x + xdif / 2;
- float ty = _npcinfo[i].bodysection[ff * 10 + f - 1].y + ydif / 2;
-
- _npcinfo[i].bodysection[ff * 10 + f].x = _npcinfo[i].bodysection[ff * 10 + f].x - (_npcinfo[i].bodysection[ff * 10 + f].x - tx) / 3;
- _npcinfo[i].bodysection[ff * 10 + f].y = _npcinfo[i].bodysection[ff * 10 + f].y - (_npcinfo[i].bodysection[ff * 10 + f].y - ty) / 3;
- }
-
- _npcinfo[i].attackframe2[ff] = _npcinfo[i].attackframe2[ff] + _npcinfo[i].attackspd * _fpsr;
- if (_npcinfo[i].attackframe2[ff] >= 16) {
- _npcinfo[i].attackframe2[ff] = 0;
- _npcinfo[i].attacking2[ff] = 0;
- _npcinfo[i].attacknext2[ff] = _ticks + _npcinfo[i].attackdelay;
- }
-
- _npcinfo[i].cattackframe = (int)(_npcinfo[i].attackframe);
-
- npx = _npcinfo[i].bodysection[10 * ff + 9].x;
- npy = (_npcinfo[i].bodysection[10 * ff + 9].y + 16);
-
- xdif = (_player.px + 12) - npx;
- ydif = (_player.py + 12) - npy;
-
- dist = 8;
-
- if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
- _npcinfo[i].attacknext2[ff] = _ticks + _npcinfo[i].attackdelay;
- // _npcinfo[i].attackframe2(ff) = 0
- // _npcinfo[i].attacking2(ff) = 0
- damage = (float)_npcinfo[i].attackdamage * (1.0 + RND() * 0.5);
- if (_player.hp > 0)
- damagePlayer(damage);
- }
- }
- }
-
- }
-
- // twowing specific
- if (_npcinfo[i].spriteset == kMonsterTwoWing) {
- // targethead code
- float xdif = _npcinfo[i].bodysection[7].x - _npcinfo[i].headtargetx[0];
- float ydif = _npcinfo[i].bodysection[7].y - _npcinfo[i].headtargety[0];
-
- _npcinfo[i].bodysection[7].x = _npcinfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
- _npcinfo[i].bodysection[7].y = _npcinfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
-
- _npcinfo[i].bodysection[0].x = _npcinfo[i].x + 12;
- _npcinfo[i].bodysection[0].y = _npcinfo[i].y + 12;
-
- for (int f = 6; f >= 1; f--) {
- xdif = _npcinfo[i].bodysection[f + 1].x - _npcinfo[i].bodysection[f - 1].x;
- ydif = _npcinfo[i].bodysection[f + 1].y - _npcinfo[i].bodysection[f - 1].y;
-
- float tx = _npcinfo[i].bodysection[f - 1].x + xdif / 2;
- float ty = _npcinfo[i].bodysection[f - 1].y + ydif / 2;
-
- _npcinfo[i].bodysection[f].x = _npcinfo[i].bodysection[f].x - (_npcinfo[i].bodysection[f].x - tx);
- _npcinfo[i].bodysection[f].y = _npcinfo[i].bodysection[f].y - (_npcinfo[i].bodysection[f].y - ty);
- }
-
- _npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
- if (_npcinfo[i].attackframe >= 16) {
- _npcinfo[i].attackframe = 0;
- _npcinfo[i].attacking = 0;
- _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
- }
-
- _npcinfo[i].cattackframe = (int)(_npcinfo[i].attackframe);
-
- npx = _npcinfo[i].bodysection[7].x;
- npy = (_npcinfo[i].bodysection[7].y + 16);
-
- xdif = (_player.px + 12) - npx;
- ydif = (_player.py + 12) - npy;
-
- dist = 8;
-
- if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
- _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
- // _npcinfo[i].attackframe = 0
- // _npcinfo[i].attacking = 0
- damage = (float)_npcinfo[i].attackdamage * (1.0 + RND() * 0.5);
- if (_player.hp > 0)
- damagePlayer(damage);
- }
- }
-
- // dragon 2 specific
- if (_npcinfo[i].spriteset == kMonsterDragon2) {
-
- _npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
- if (_npcinfo[i].attackframe >= 16) {
- _npcinfo[i].attackframe = 0;
- _npcinfo[i].attacking = 0;
- _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
- }
-
- _npcinfo[i].cattackframe = (int)(_npcinfo[i].attackframe);
-
- npx = _npcinfo[i].x;
- npy = _npcinfo[i].y;
-
- float xdif = _player.px - npx;
- float ydif = _player.py - npy;
-
- dist = 16 + _npcinfo[i].attackframe;
-
- if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
- _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
- // _npcinfo[i].attackframe = 0
- // _npcinfo[i].attacking = 0
- damage = (float)_npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
- if (_player.hp > 0)
- damagePlayer(damage);
- }
- }
-
- // endboss specific
- if (_npcinfo[i].spriteset == kMonsterFinalBoss) {
- _npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
- if (_npcinfo[i].attackframe >= 16) {
- _npcinfo[i].attackframe = 0;
- _npcinfo[i].attacking = 0;
- _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
- }
-
- _npcinfo[i].cattackframe = (int)(_npcinfo[i].attackframe);
-
- npx = _npcinfo[i].x;
- npy = _npcinfo[i].y;
-
- float xdif = _player.px - npx;
- float ydif = _player.py - npy;
-
- dist = 36;
-
- if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
- _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
- // _npcinfo[i].attackframe = 0
- // _npcinfo[i].attacking = 0
- damage = (float)_npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
- if (_player.hp > 0)
- damagePlayer(damage);
- }
- }
- }
- // -------end fight code
- }
- }
-}
-
-void GriffonEngine::updateSpells() {
- int foundel[5];
- float npx, npy;
- long cl1, cl2, cl3;
- int ll[4][2];
-
- float xloc = 0, yloc = 0, xst, yst, xdif, ydif;
-
- for (int i = 0; i < kMaxSpell; i++) {
- if (spellinfo[i].frame > 0) {
- int spellnum = spellinfo[i].spellnum;
-
- // water
- if (spellnum == 0 && !_forcepause) {
- float fr = (32 - spellinfo[i].frame);
-
- ll[0][0] = -2;
- ll[0][1] = -3;
- ll[1][0] = 2;
- ll[1][1] = -3;
- ll[2][0] = -4;
- ll[2][1] = -2;
- ll[3][0] = 4;
- ll[3][1] = -2;
-
- for (int f = 0; f <= 3; f++) {
- if (fr > f * 4 && fr < f * 4 + 16) {
- float alf = 255;
-
- if (fr < f * 4 + 8) {
- int fi = (int)((fr - f * 4) * 3) % 4;
- rcSrc.left = 32 + fi * 16;
- rcSrc.top = 80;
- rcSrc.setWidth(16);
- rcSrc.setHeight(16);
-
- xloc = spellinfo[i].enemyx + 12 + ll[f][0] * 16;
- yloc = spellinfo[i].enemyy + 16 + ll[f][1] * 16;
-
- rcDest.left = xloc;
- rcDest.top = yloc;
-
- alf = 255 * ((fr - f * 4) / 8);
- }
-
- if (fr >= f * 4 + 8) {
- int fi = 0; // ??
-
- if (f == 0 || f == 2)
- fi = 0;
- if (f == 1 || f == 3)
- fi = 1;
- rcSrc.left = 32 + fi * 16;
- rcSrc.top = 80;
- rcSrc.setWidth(16);
- rcSrc.setHeight(16);
-
- xst = spellinfo[i].enemyx + 12 + ll[f][0] * 16;
- yst = spellinfo[i].enemyy + 16 + ll[f][1] * 16;
-
- float xi = (spellinfo[i].enemyx - xst) * 2 / 8;
- float yi = (spellinfo[i].enemyy - yst) * 2 / 8;
-
- float fl = (fr - f * 4 - 8) / 2;
- xloc = xst + xi * fl * fl;
- yloc = yst + yi * fl * fl;
-
- rcDest.left = xloc;
- rcDest.top = yloc;
-
- alf = 255;
- }
-
- if (xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
- _spellimg->setAlpha(alf, true);
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- _spellimg->setAlpha(255, true);
-
- if (spellinfo[i].damagewho == 0) {
- for (int e = 1; e <= _lastnpc; e++) {
-
- xdif = (xloc + 16) - (_npcinfo[e].x + 12);
- ydif = (yloc + 16) - (_npcinfo[e].y + 12);
-
- if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
-
- if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
- damageNPC(e, damage, 1);
- if (config.effects) {
- int snd = playSound(_sfx[kSndIce]);
- setChannelVolume(snd, config.effectsvol);
- }
- }
- }
- }
- }
-
- // check for post damage
- if (nposts > 0) {
- for (int e = 0; e <= nposts - 1; e++) {
- xdif = (xloc + 16) - (postinfo[e][0] + 8);
- ydif = (yloc + 16) - (postinfo[e][1] + 8);
-
- if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
-
- rcSrc.left = postinfo[e][0] / 2;
- rcSrc.top = postinfo[e][1] / 2;
- rcSrc.setWidth(8);
- rcSrc.setHeight(8);
-
- _clipbg2->fillRect(rcSrc, 0);
-
- addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndIce]);
- setChannelVolume(snd, config.effectsvol);
- }
- }
- }
- }
- }
- }
- }
- }
-
- // metal
- if (spellnum == 1 && !_forcepause) {
- int fr = (int)((32 - spellinfo[i].frame) * 4) % 3;
-
- rcSrc.left = fr * 48;
- rcSrc.top = 0;
- rcSrc.setWidth(48);
- rcSrc.setHeight(48);
-
- float c1 = (32 - spellinfo[i].frame) / 16;
-
- float halfx = (spellinfo[i].homex - 12) + ((spellinfo[i].enemyx - 12) - (spellinfo[i].homex - 12)) / 2;
- float halfy = (spellinfo[i].homey - 12) + ((spellinfo[i].enemyy - 12) - (spellinfo[i].homey - 12)) / 2;
-
- float wdth = (halfx - spellinfo[i].homex) * 1.2;
- float hight = (halfy - spellinfo[i].homey) * 1.2;
-
- xloc = halfx + wdth * cos(3.14159 + 3.14159 * 2 * c1);
- yloc = halfy + hight * sin(3.14159 + 3.14159 * 2 * c1);
-
- rcDest.left = xloc;
- rcDest.top = yloc;
-
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
-
- spellinfo[i].frame = spellinfo[i].frame - 0.2 * _fpsr;
- if (spellinfo[i].frame < 0)
- spellinfo[i].frame = 0;
-
- if (spellinfo[i].damagewho == 0) {
- for (int e = 1; e <= _lastnpc; e++) {
- xdif = (xloc + 24) - (_npcinfo[e].x + 12);
- ydif = (yloc + 24) - (_npcinfo[e].y + 12);
-
- if ((abs(xdif) < 24 && abs(ydif) < 24)) {
- float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
-
- if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
- damageNPC(e, damage, 1);
- if (config.effects) {
- int snd = playSound(_sfx[kSndMetalHit]);
- setChannelVolume(snd, config.effectsvol);
- }
- }
- }
- }
- }
-
- if (spellinfo[i].damagewho == 1) {
- // --------- boss 1 specific
- if (ABS(spellinfo[i].frame) < 0 && _npcinfo[spellinfo[i].npc].spriteset == kMonsterBoss1) {
- int npc = spellinfo[i].npc;
- _npcinfo[npc].attackframe = 0;
- _npcinfo[npc].attacking = 0;
-
- _npcinfo[npc].pause = _ticks + 1000;
- _npcinfo[npc].attacknext = _ticks + 4000;
- }
- // ---------------
-
- // --------- blackknight specific
- if (ABS(spellinfo[i].frame) < 0 && _npcinfo[spellinfo[i].npc].spriteset == kMonsterBlackKnight) {
- int npc = spellinfo[i].npc;
- _npcinfo[npc].attackframe = 0;
- _npcinfo[npc].attacking = 0;
-
- _npcinfo[npc].pause = _ticks + 1000;
- _npcinfo[npc].attacknext = _ticks + 3500;
- }
- // ---------------
-
- xdif = (xloc + 24) - (_player.px + 12);
- ydif = (yloc + 24) - (_player.py + 12);
-
- if ((abs(xdif) < 24 && abs(ydif) < 24) && _player.pause < _ticks) {
- npx = _player.px;
- npy = _player.py;
-
- float damage = (float)_npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
-
- if (_player.hp > 0) {
- damagePlayer(damage);
- if (config.effects) {
- int snd = playSound(_sfx[kSndMetalHit]);
- setChannelVolume(snd, config.effectsvol);
- }
- }
- }
- }
-
-
- // check for(int post damage
- if (nposts > 0) {
- for (int e = 0; e <= nposts - 1; e++) {
- xdif = (xloc + 24) - (postinfo[e][0] + 8);
- ydif = (yloc + 24) - (postinfo[e][1] + 8);
-
- if ((abs(xdif) < 24 && abs(ydif) < 24)) {
- _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
-
- rcSrc.left = postinfo[e][0] / 2;
- rcSrc.top = postinfo[e][1] / 2;
- rcSrc.setWidth(8);
- rcSrc.setHeight(8);
-
- _clipbg2->fillRect(rcSrc, 0);
-
- addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndMetalHit]);
- setChannelVolume(snd, config.effectsvol);
- }
- }
- }
- }
- }
-
- // earth
- if (spellnum == 2 && !_forcepause) {
- float hght = 240 - spellinfo[i].enemyy;
-
- for (int f = 8; f >= 0; f--) {
-
- float fr = (32 - spellinfo[i].frame);
-
- if (fr > f && fr < f + 16) {
- rcSrc.left = 32 * spellinfo[i].rockimg[f];
- rcSrc.top = 48;
- rcSrc.setWidth(32);
- rcSrc.setHeight(32);
-
- int scatter = 0;
- if (fr < 8 + f) {
- xloc = spellinfo[i].enemyx - 4;
- yloc = spellinfo[i].enemyy * (1 - cos(3.14159 / 2 * (fr - f) / 8)); // ^ 2;
- yloc *= yloc;
- } else {
- scatter = 1;
- xloc = spellinfo[i].enemyx - 4 - spellinfo[i].rockdeflect[f] * sin(3.14159 / 2 * ((fr - f) - 8) / 8);
- yloc = spellinfo[i].enemyy + hght * (1 - cos(3.14159 / 2 * ((fr - f) - 8) / 8));
- }
-
- rcDest.left = xloc;
- rcDest.top = yloc;
-
- if (xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
-
- if (scatter == 1) {
- if (spellinfo[i].damagewho == 0) {
- for (int e = 1; e <= _lastnpc; e++) {
- xdif = (xloc + 16) - (_npcinfo[e].x + 12);
- ydif = (yloc + 16) - (_npcinfo[e].y + 12);
-
- if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
-
- if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
- damageNPC(e, damage, 1);
- if (config.effects) {
- int snd = playSound(_sfx[kSndRocks]);
- setChannelVolume(snd, config.effectsvol);
- }
- }
- }
- }
- }
-
-
- // check for(int post damage
- if (nposts > 0) {
- for (int e = 0; e <= nposts - 1; e++) {
- xdif = (xloc + 16) - (postinfo[e][0] + 8);
- ydif = (yloc + 16) - (postinfo[e][1] + 8);
-
- if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
-
- rcSrc.left = postinfo[e][0] / 2;
- rcSrc.top = postinfo[e][1] / 2;
- rcSrc.setWidth(8);
- rcSrc.setHeight(8);
-
- _clipbg2->fillRect(rcSrc, 0);
-
- addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndRocks]);
- setChannelVolume(snd, config.effectsvol);
- }
- }
- }
- }
- }
- }
- }
- }
-
- spellinfo[i].frame = spellinfo[i].frame - 0.2 * _fpsr;
- if (spellinfo[i].frame < 0)
- spellinfo[i].frame = 0;
- }
-
- // crystal
- if (spellnum == 5) {
-
- float fra = (32 - spellinfo[i].frame);
- int fr = (int)((spellinfo[i].frame) * 2) % 8;
-
- rcSrc.left = fr * 32;
- rcSrc.top = 96 + 48;
- rcSrc.setWidth(32);
- rcSrc.setHeight(64);
-
- rcDest.left = _player.px - 4;
- rcDest.top = _player.py + 16 - 48;
-
- int f = 160;
- if (fra < 8)
- f = 192 * fra / 8;
- if (fra > 24)
- f = 192 * (1 - (fra - 24) / 8);
-
- _spellimg->setAlpha(f, true);
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- _spellimg->setAlpha(255, true);
-
- spellinfo[i].frame = spellinfo[i].frame - 0.3 * _fpsr;
- if (spellinfo[i].frame < 0) {
- spellinfo[i].frame = 0;
- _forcepause = false;
-
- npx = _player.px + 12;
- npy = _player.py + 20;
-
- int lx = (int)npx / 16;
- int ly = (int)npy / 16;
-
- for (int f1 = 0; f1 < 5; f1++) { // !! f < 5
- foundel[f1] = 0;
- }
-
- for (int xo = -2; xo <= 2; xo++) {
- for (int yo = -2; yo <= 2; yo++) {
-
- int sx = lx + xo;
- int sy = ly + yo;
-
- if (sx > -1 && sx < 20 && sy > -1 && sy < 15) {
- for (int l = 0; l <= 2; l++) {
- int curtile = _tileinfo[l][sx][sy][0];
- int curtilel = _tileinfo[l][sx][sy][1];
-
- if (curtile > 0) {
- curtile = curtile - 1;
- int curtilex = curtile % 20;
- int curtiley = (curtile - curtilex) / 20;
-
- int element = elementmap[curtiley][curtilex];
- if (element > -1 && curtilel == 0)
- foundel[element + 1] = 1;
- }
- }
-
- int o = _objectMap[sx][sy];
- if (o > -1) {
- if (_objectInfo[o][4] == 1)
- foundel[2] = 1;
- if (o == 1 || o == 2) {
- foundel[2] = 1;
- foundel[4] = 1;
- }
- }
- }
- }
- }
-
- char line[256];
- strcpy(line, "Found... nothing...");
-
- for (int f1 = 0; f1 < 5; f1++) {
- if (foundel[f1] == 1 && _player.foundspell[f1] == 0) {
- _player.foundspell[f1] = 1;
- _player.spellcharge[f1] = 0;
- if (f1 == 1)
- strcpy(line, "Found... Water Essence");
- if (f1 == 2)
- strcpy(line, "Found... Metal Essence");
- if (f1 == 3)
- strcpy(line, "Found... Earth Essence");
- if (f1 == 4)
- strcpy(line, "Found... Fire Essence");
- break;
- }
- }
-
- eventText(line);
- }
- }
-
- // room fireballs
- if (spellnum == 6 && !_forcepause) {
-
- if (spellinfo[i].frame > 16) {
- float fr = (32 - spellinfo[i].frame);
-
- _spellimg->setAlpha(192 * sin(3.14159 * fr / 4), true);
-
- rcSrc.left = 16 * (int)(RND() * 2);
- rcSrc.top = 80;
- rcSrc.setWidth(16);
- rcSrc.setHeight(16);
-
- for (int ff = 0; ff <= spellinfo[i].nfballs - 1; ff++) {
-
- xloc = spellinfo[i].fireballs[ff][0] + (int)(RND() * 3) - 1;
- yloc = spellinfo[i].fireballs[ff][1] + (int)(RND() * 3) - 1;
-
- rcDest.left = xloc;
- rcDest.top = yloc;
-
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- }
-
- _spellimg->setAlpha(255, true);
- } else {
- _spellimg->setAlpha(192, true);
-
- rcSrc.left = 16 * (int)(RND() * 2);
- rcSrc.top = 80;
- rcSrc.setWidth(16);
- rcSrc.setHeight(16);
-
- for (int ff = 0; ff <= spellinfo[i].nfballs - 1; ff++) {
- float ax = spellinfo[i].fireballs[ff][0];
- float ay = spellinfo[i].fireballs[ff][1];
- float bx = _player.px + 4;
- float by = _player.py + 4;
- float d = sqrt((bx - ax) * (bx - ax) + (by - ay) * (by - ay));
-
- float tx = (bx - ax) / d;
- float ty = (by - ay) / d;
-
- spellinfo[i].fireballs[ff][2] += tx * 1.2 * _fpsr;
- spellinfo[i].fireballs[ff][3] += ty * 1.2 * _fpsr;
-
- if (spellinfo[i].ballon[ff] == 1) {
- spellinfo[i].fireballs[ff][0] = ax + spellinfo[i].fireballs[ff][2] * 0.2 * _fpsr;
- spellinfo[i].fireballs[ff][1] = ay + spellinfo[i].fireballs[ff][3] * 0.2 * _fpsr;
-
- xloc = spellinfo[i].fireballs[ff][0] + (int)(RND() * 3) - 1;
- yloc = spellinfo[i].fireballs[ff][1] + (int)(RND() * 3) - 1;
-
- rcDest.left = xloc;
- rcDest.top = yloc;
-
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- }
-
- if (xloc < -1 || yloc < -1 || xloc > 304 || yloc > 224)
- spellinfo[i].ballon[ff] = 0;
- }
-
- _spellimg->setAlpha(255, true);
- }
-
- spellinfo[i].frame = spellinfo[i].frame - 0.2 * _fpsr;
- if (spellinfo[i].frame < 0)
- spellinfo[i].frame = 0;
-
- if (spellinfo[i].damagewho == 1) {
- for (int ff = 0; ff <= spellinfo[i].nfballs - 1; ff++) {
- if (spellinfo[i].ballon[ff] == 1) {
- xloc = spellinfo[i].fireballs[ff][0] + (int)(RND() * 3) - 1;
- yloc = spellinfo[i].fireballs[ff][1] + (int)(RND() * 3) - 1;
-
- xdif = (xloc + 8) - (_player.px + 12);
- ydif = (yloc + 8) - (_player.py + 12);
-
- if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
- float damage = _npcinfo[spellinfo[i].npc].spelldamage * (1 + RND() * 0.5) / 3;
-
- if (_player.hp > 0)
- damagePlayer(damage);
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndFire]);
- setChannelVolume(snd, config.effectsvol);
- }
- }
- }
- }
- }
- }
-
- // lightning bomb
- if (spellnum == 8) {
-
- cl1 = _videobuffer->format.RGBToColor(0, 32, 204);
- cl2 = _videobuffer->format.RGBToColor(142, 173, 191);
- cl3 = _videobuffer->format.RGBToColor(240, 240, 240);
-
- float px = _player.px + 12;
- float py = _player.py + 12;
-
- int apx = px + (int)(RND() * 5 - 2);
- int apy = py + (int)(RND() * 5 - 2);
-
- for (int f = 0; f <= 0; f++) { // ??
- int y = apy;
- int orn = 0;
- for (int x = apx; x <= 319; x++) {
- int rn = (int)(RND() * 3);
-
- if (orn == 0)
- y = y - 1;
- if (orn == 2)
- y = y + 1;
-
- drawLine(_videobuffer, x, y - 1, x, y + 2, cl1);
- drawLine(_videobuffer, x, y, x, y + 1, cl3);
-
- if (rn == 0)
- drawLine(_videobuffer, x, y + 1, x, y + 1, cl2);
- if (rn == 2)
- drawLine(_videobuffer, x, y, x, y, cl2);
-
- orn = rn;
-
- if (spellinfo[i].damagewho == 0) {
- for (int e = 1; e <= _lastnpc; e++) {
-
- xdif = (x + 16) - (_npcinfo[e].x + 12);
- ydif = (y + 16) - (_npcinfo[e].y + 12);
-
- if ((abs(xdif) < 8 && abs(ydif) < 8)) {
- float damage = 30 * (1 + RND() * 0.5);
-
- if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks)
- damageNPC(e, damage, 1);
- }
- }
- }
-
- // check for post damage
- if (nposts > 0) {
- for (int e = 0; e <= nposts - 1; e++) {
- xdif = (xloc + 16) - (postinfo[e][0] + 8);
- ydif = (yloc + 16) - (postinfo[e][1] + 8);
-
- if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
-
- rcSrc.left = postinfo[e][0] / 2;
- rcSrc.top = postinfo[e][1] / 2;
- rcSrc.setWidth(8);
- rcSrc.setHeight(8);
-
- _clipbg2->fillRect(rcSrc, 0);
-
- addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
- }
- }
- }
- }
-
- y = apy;
- orn = 0;
- for (int x = apx; x >= 0; x--) {
- int rn = (int)(RND() * 3);
-
- if (orn == 0)
- y = y - 1;
- if (orn == 2)
- y = y + 1;
-
- drawLine(_videobuffer, x, y - 1, x, y + 2, cl1);
- drawLine(_videobuffer, x, y, x, y + 1, cl3);
-
- if (rn == 0)
- drawLine(_videobuffer, x, y + 1, x, y + 1, cl2);
- if (rn == 2)
- drawLine(_videobuffer, x, y, x, y, cl2);
-
- orn = rn;
-
- if (spellinfo[i].damagewho == 0) {
- for (int e = 1; e <= _lastnpc; e++) {
-
- xdif = (x + 16) - (_npcinfo[e].x + 12);
- ydif = (y + 16) - (_npcinfo[e].y + 12);
-
- if ((abs(xdif) < 8 && abs(ydif) < 8)) {
- float damage = 30 * (1 + RND() * 0.5);
-
- if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks)
- damageNPC(e, damage, 1);
- }
- }
- }
-
- // check for post damage
- if (nposts > 0) {
- for (int e = 0; e <= nposts - 1; e++) {
- xdif = (xloc + 16) - (postinfo[e][0] + 8);
- ydif = (yloc + 16) - (postinfo[e][1] + 8);
-
- if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
-
- rcSrc.left = postinfo[e][0] / 2;
- rcSrc.top = postinfo[e][1] / 2;
- rcSrc.setWidth(8);
- rcSrc.setHeight(8);
-
- _clipbg2->fillRect(rcSrc, 0);
-
- addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
- }
- }
- }
- }
-
- int x = apx;
- orn = 0;
- for (y = apy; y <= 239; y++) {
- int rn = (int)(RND() * 3);
-
- if (orn == 0)
- x = x - 1;
- if (orn == 2)
- x = x + 1;
-
- drawLine(_videobuffer, x - 1, y, x + 2, y, cl1);
- drawLine(_videobuffer, x, y, x + 1, y, cl3);
-
- if (rn == 0)
- drawLine(_videobuffer, x + 1, y, x + 1, y, cl2);
- if (rn == 2)
- drawLine(_videobuffer, x, y, x, y, cl2);
-
- orn = rn;
-
- if (spellinfo[i].damagewho == 0) {
- for (int e = 1; e <= _lastnpc; e++) {
- xdif = (x + 16) - (_npcinfo[e].x + 12);
- ydif = (y + 16) - (_npcinfo[e].y + 12);
-
- if ((abs(xdif) < 8 && abs(ydif) < 8)) {
- float damage = 30 * (1 + RND() * 0.5);
-
- if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks)
- damageNPC(e, damage, 1);
- }
- }
- }
-
- // check for post damage
- if (nposts > 0) {
- for (int e = 0; e <= nposts - 1; e++) {
- xdif = (xloc + 16) - (postinfo[e][0] + 8);
- ydif = (yloc + 16) - (postinfo[e][1] + 8);
-
- if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
-
- rcSrc.left = postinfo[e][0] / 2;
- rcSrc.top = postinfo[e][1] / 2;
- rcSrc.setWidth(8);
- rcSrc.setHeight(8);
-
- _clipbg2->fillRect(rcSrc, 0);
-
- addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
- }
- }
- }
- }
-
- x = apx;
- orn = 0;
- for (y = apy; y >= 0; y--) {
- int rn = (int)(RND() * 3);
-
- if (orn == 0)
- x = x - 1;
- if (orn == 2)
- x = x + 1;
-
- drawLine(_videobuffer, x - 1, y, x + 2, y, cl1);
- drawLine(_videobuffer, x, y, x + 1, y, cl3);
-
- if (rn == 0)
- drawLine(_videobuffer, x + 1, y, x + 1, y, cl2);
- if (rn == 2)
- drawLine(_videobuffer, x, y, x, y, cl2);
-
- orn = rn;
-
- if (spellinfo[i].damagewho == 0) {
- for (int e = 1; e <= _lastnpc; e++) {
- xdif = (x + 16) - (_npcinfo[e].x + 12);
- ydif = (y + 16) - (_npcinfo[e].y + 12);
-
- if ((abs(xdif) < 8 && abs(ydif) < 8)) {
- float damage = 30 * (1 + RND() * 0.5);
-
- if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks)
- damageNPC(e, damage, 1);
- }
- }
- }
-
- // check for post damage
- if (nposts > 0) {
- for (int e = 0; e <= nposts - 1; e++) {
- xdif = (xloc + 16) - (postinfo[e][0] + 8);
- ydif = (yloc + 16) - (postinfo[e][1] + 8);
-
- if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
-
- rcSrc.left = postinfo[e][0] / 2;
- rcSrc.top = postinfo[e][1] / 2;
- rcSrc.setWidth(8);
- rcSrc.setHeight(8);
-
- _clipbg2->fillRect(rcSrc, 0);
-
- addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
- }
- }
- }
- }
- }
-
- spellinfo[i].frame -= 0.5 * _fpsr;
- if (spellinfo[i].frame < 0) {
- spellinfo[i].frame = 0;
- _forcepause = false;
- }
- }
-
- // wizard 1 lightning
- if (spellnum == 9) {
-
- cl1 = _videobuffer->format.RGBToColor(0, 32, 204);
- cl2 = _videobuffer->format.RGBToColor(142, 173, 191);
- cl3 = _videobuffer->format.RGBToColor(240, 240, 240);
-
- int px = spellinfo[i].enemyx + 12;
- int py = spellinfo[i].enemyy + 24;
-
- int apx = px + (int)(RND() * 20 - 10);
- int apy = py + (int)(RND() * 20 - 10);
-
- int x = apx;
- int orn = 0;
- for (int y = 0; y <= apy; y++) {
- if (y < 240) {
- int rn = (int)(RND() * 3);
-
- if (orn == 0)
- x = x - 1;
- if (orn == 2)
- x = x + 1;
-
- drawLine(_videobuffer, x - 1, y, x + 2, y, cl1);
- drawLine(_videobuffer, x, y, x + 1, y, cl3);
-
- if (rn == 0)
- drawLine(_videobuffer, x + 1, y, x + 1, y, cl2);
- if (rn == 2)
- drawLine(_videobuffer, x, y, x, y, cl2);
-
- orn = rn;
-
- if (spellinfo[i].damagewho == 1) {
-
- xdif = (x + 8) - (_player.px + 12);
- ydif = (y + 8) - (_player.py + 12);
-
- if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
- float damage = ((float)_player.hp * 0.75) * (RND() * 0.5 + 0.5);
- if (damage < 5)
- damage = 5;
-
- if (_npcinfo[spellinfo[i].npc].spriteset == kMonsterBatKitty) {
- if (damage < 50)
- damage = 40 + (int)(RND() * 40);
- }
-
- if (_player.hp > 0)
- damagePlayer(damage);
- }
- }
- }
- }
-
- spellinfo[i].frame -= 0.5 * _fpsr;
- if (spellinfo[i].frame < 0) {
- spellinfo[i].frame = 0;
-
- _npcinfo[spellinfo[i].npc].attacking = 0;
- _npcinfo[spellinfo[i].npc].attacknext = _ticks + _npcinfo[spellinfo[i].npc].attackdelay;
- }
- }
- }
- }
-}
-
-
-
-void GriffonEngine::updateSpellsUnder() {
- if (_forcepause)
- return;
-
- for (int i = 0; i < kMaxSpell; i++) {
- if (spellinfo[i].frame > 0) {
- int spellnum = spellinfo[i].spellnum;
-
- // water
- if (spellnum == 0) {
- int fra = (32 - spellinfo[i].frame);
- int fr = (int)((32 - spellinfo[i].frame) * 2) % 4;
-
- rcSrc.left = fr * 48;
- rcSrc.top = 96;
- rcSrc.setWidth(48);
- rcSrc.setHeight(48);
-
- rcDest.left = spellinfo[i].enemyx - 12;
- rcDest.top = spellinfo[i].enemyy - 8;
-
- int f = 160;
- if (fra < 8)
- f = 160 * fra / 8;
- if (fra > 24)
- f = 160 * (1 - (fra - 24) / 8);
-
- _spellimg->setAlpha(f, true);
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- _spellimg->setAlpha(255, true);
-
- spellinfo[i].frame = spellinfo[i].frame - 0.2 * _fpsr;
- if (spellinfo[i].frame < 0)
- spellinfo[i].frame = 0;
-
-
- for (f = 1; f <= _lastnpc; f++) {
- int xdif = spellinfo[i].enemyx - _npcinfo[f].x;
- int ydif = spellinfo[i].enemyy - _npcinfo[f].y;
-
- float dist = sqrt((float)(xdif * xdif + ydif * ydif));
-
- if (dist > 20)
- dist = 20;
-
- if (dist > 5) {
- float ratio = (1 - dist / 25);
-
- float newx = _npcinfo[f].x + ratio * xdif / 3 * _fpsr;
- float newy = _npcinfo[f].y + ratio * ydif / 3 * _fpsr;
-
- int sx = (newx / 2 + 6);
- int sy = (newy / 2 + 10);
-
- unsigned int *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
- unsigned int dq = *temp;
-
- if (dq == 0) {
- _npcinfo[f].x = newx;
- _npcinfo[f].y = newy;
- // _npcinfo[f].castpause = _ticks + 200;
- } else {
- int xpass = 0;
- int ypass = 0;
-
- sx = (newx / 2 + 6);
- sy = (_npcinfo[f].y / 2 + 10);
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
- dq = *temp;
-
- if (dq == 0)
- xpass = 1;
-
-
- sx = (_npcinfo[f].x / 2 + 6);
- sy = (newy / 2 + 10);
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
- dq = *temp;
-
- if (dq == 0)
- ypass = 1;
-
- if (ypass == 1) {
- newx = _npcinfo[f].x;
- } else if (xpass == 1) {
- newy = _npcinfo[f].y;
- }
-
- if (xpass == 1 || ypass == 1) {
- _npcinfo[f].x = newx;
- _npcinfo[f].y = newy;
- // _npcinfo[f].castpause = _ticks + 200;
- }
- }
- }
- }
- }
-
- // fire
- if (spellnum == 3) {
- float fr = (32 - spellinfo[i].frame);
-
- fr = fr * fr * (1 - cos(3.14159 / 4 + 3.14159 / 4 * fr / 32));
-
- if (fr > 32)
- fr = 32;
-
- float s = 8;
- if (spellinfo[i].frame < 8)
- s = spellinfo[i].frame;
-
- int fra = (int)fr;
-
- for (int f = 0; f <= 4; f++) {
- for (int x = 0; x <= fra; x += 2) {
- if (spellinfo[i].legalive[f] >= x) {
- _spellimg->setAlpha(192 * sin(3.14159 * x / 32) * s / 8, true);
-
- float an = 360 / 5 * f + x / 32 * 180;
-
- rcSrc.left = 16 * (int)(RND() * 2);
- rcSrc.top = 80;
- rcSrc.setWidth(16);
- rcSrc.setHeight(16);
-
- float xloc = (float)(spellinfo[i].enemyx + 4 + x * 2 * cos(3.14159 / 180 * an) + (int)(RND() * 3) - 1);
- float yloc = (float)(spellinfo[i].enemyy + 4 + x * 2 * sin(3.14159 / 180 * an) + (int)(RND() * 3) - 1);
- rcDest.left = (int)xloc;
- rcDest.top = (int)yloc;
-
- if (xloc > -1 && xloc < 304 && yloc > -1 && yloc < 224) {
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
-
- int sx = (xloc / 2 + 4);
- int sy = (yloc / 2 + 8);
-
- unsigned int *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
- unsigned int dq = *temp;
-
- if (dq > 1000 && x > 4)
- spellinfo[i].legalive[f] = x;
-
- if (spellinfo[i].damagewho == 0) {
- for (int e = 1; e <= _lastnpc; e++) {
- float xdif = (xloc + 8) - (_npcinfo[e].x + 12);
- float ydif = (yloc + 8) - (_npcinfo[e].y + 12);
-
- if ((abs(xdif) < 8 && abs(ydif) < 8)) {
- float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
-
- if (_npcinfo[e].spriteset == kMonsterFireHydra)
- damage = -damage;
- if (_npcinfo[e].spriteset == kMonsterFinalBoss)
- damage = -damage;
- if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
- damageNPC(e, damage, 1);
- if (config.effects) {
- int snd = playSound(_sfx[kSndFire]);
- setChannelVolume(snd, config.effectsvol);
- }
- }
- }
- }
- }
-
- if (spellinfo[i].damagewho == 1) {
- float xdif = (xloc + 8) - (_player.px + 12);
- float ydif = (yloc + 8) - (_player.py + 12);
-
- if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
- float damage = (float)_npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
-
- if (_player.hp > 0) {
- damagePlayer(damage);
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndFire]);
- setChannelVolume(snd, config.effectsvol);
- }
- }
- }
- }
-
- // check for post damage
- if (nposts > 0) {
- for (int e = 0; e <= nposts - 1; e++) {
- float xdif = (xloc + 8) - (postinfo[e][0] + 8);
- float ydif = (yloc + 8) - (postinfo[e][1] + 8);
-
- if ((abs(xdif) < 8 && abs(ydif) < 8)) {
- _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
-
- rcSrc.left = postinfo[e][0] / 2;
- rcSrc.top = postinfo[e][1] / 2;
- rcSrc.setWidth(8);
- rcSrc.setHeight(8);
-
- _clipbg2->fillRect(rcSrc, 0);
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndFire]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
- }
- }
- }
- }
- }
- }
- }
-
- _spellimg->setAlpha(255, true);
-
- spellinfo[i].frame = spellinfo[i].frame - 0.2 * _fpsr;
- if (spellinfo[i].frame < 0)
- spellinfo[i].frame = 0;
-
-
- }
-
-
- // sprite 6 spitfire
- if (spellnum == 7) {
- float xspan = spellinfo[i].enemyx - spellinfo[i].homex;
- float yspan = spellinfo[i].enemyy - spellinfo[i].homey;
- float fr = (32 - spellinfo[i].frame);
-
- for (int f = 0; f <= 7; f++) {
- int alpha = 0;
- float xx = 0;
- if (fr > f * 2 && fr < f * 2 + 16)
- xx = fr - f * 2;
- if (xx < 8)
- alpha = 255 * xx / 8;
- if (xx > 8)
- alpha = 255 * (1 - (xx - 8) / 8);
- float yy = 16 * sin(3.141592 / 2 * xx / 16) - 8;
-
- if (alpha < 0)
- alpha = 0;
- if (alpha > 255)
- alpha = 255;
-
- _spellimg->setAlpha(alpha, true);
-
- rcSrc.left = 16 * (int)(RND() * 2);
- rcSrc.top = 80;
- rcSrc.setWidth(16);
- rcSrc.setHeight(16);
-
- float xloc = spellinfo[i].homex + xspan / 7 * f;
- float yloc = spellinfo[i].homey + yspan / 7 * f - yy;
-
- rcDest.left = xloc;
- rcDest.top = yloc;
-
- if (xloc > -16 && xloc < 320 && yloc > -16 && yloc < 240) {
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
-
- if (spellinfo[i].damagewho == 1) {
- float xdif = (xloc + 8) - (_player.px + 12);
- float ydif = (yloc + 8) - (_player.py + 12);
-
- if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks && alpha > 64) {
- float damage = (float)_npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
-
- if (_player.hp > 0) {
- damagePlayer(damage);
- if (config.effects) {
- int snd = playSound(_sfx[kSndFire]);
- setChannelVolume(snd, config.effectsvol);
- }
- }
-
- }
- }
-
- }
-
- }
-
- _spellimg->setAlpha(255, true);
- spellinfo[i].frame = spellinfo[i].frame - 0.5 * _fpsr;
- if (spellinfo[i].frame < 0)
- spellinfo[i].frame = 0;
-
- if (ABS(spellinfo[i].frame) < 0) {
- _npcinfo[spellinfo[i].npc].attacking = 0;
- _npcinfo[spellinfo[i].npc].attacknext = _ticks + _npcinfo[spellinfo[i].npc].attackdelay;
- }
- }
- }
- }
-}
-
} // end of namespace Griffon
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 704d6f6..f56ec87 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -325,15 +325,9 @@ private:
// engine.cpp
float RND();
- void newGame();
void mainLoop();
- void updateAnims();
- void updateY();
- void updateNPCs();
- void updateSpells();
- void updateSpellsUnder();
-
void updateEngine();
+ void newGame();
// gfx.cpp
void addFloatIcon(int ico, float xloc, float yloc);
@@ -349,6 +343,13 @@ private:
void checkTrigger();
void processTrigger(int trignum);
+ // logic.cpp
+ void updateAnims();
+ void updateY();
+ void updateNPCs();
+ void updateSpells();
+ void updateSpellsUnder();
+
// resources.cpp
void initialize();
Graphics::TransparentSurface *loadImage(const char *name, bool colorkey = false);
diff --git a/engines/griffon/logic.cpp b/engines/griffon/logic.cpp
new file mode 100644
index 0000000..50ca72c
--- /dev/null
+++ b/engines/griffon/logic.cpp
@@ -0,0 +1,2397 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Originally written by Syn9 in FreeBASIC with SDL
+ * http://syn9.thehideoutgames.com/index_backup.php
+ *
+ * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
+ * http://github.com/dmitrysmagin/griffon_legend
+ *
+ *
+ * Programming/Graphics: Daniel "Syn9" Kennedy
+ * Music/Sound effects: David Turner
+ *
+ * Beta testing and gameplay design help:
+ * Deleter, Cha0s, Aether Fox, and Kiz
+ *
+ */
+
+#include "griffon/griffon.h"
+#include "griffon/config.h"
+
+namespace Griffon {
+
+// memo
+
+/*
+ chests
+ 0 - regular flask
+ 11 - key chest
+ 14 - blue flask chest
+ 15 - lightning chest
+ 16 - armour chest
+ 17 - citadel master key
+ 18 - sword3
+ 19 - shield3
+ 20 - armour3
+
+*/
+
+// element tile locations
+const int elementmap[15][20] = {
+ { 2, 2, 2, 2, -1, -1, -1, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1 },
+ { 2, -1, -1, -1, -1, -1, -1, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1 },
+ { 2, -1, 2, 2, -1, -1, -1, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1 },
+ { 2, -1, 2, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ { 2, 2, 2, 2, 2, -1, -1, -1, 2, -1, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1 },
+ { -1, -1, -1, -1, 2, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ { -1, -1, -1, -1, -1, 0, 0, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ { -1, -1, -1, -1, -1, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ { -1, -1, -1, -1, -1, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
+};
+
+
+void GriffonEngine::updateAnims() {
+ for (int i = 0; i <= _lastObj; i++) {
+ int nframes = _objectInfo[i][0];
+ int o_animspd = _objectInfo[i][3];
+ float frame = _objectFrame[i][0];
+ int cframe = _objectFrame[i][1];
+ // _objectinfo[i][6] = 0; // ?? out of bounds
+
+ if (nframes > 1) {
+ frame = frame + o_animspd / 50 * _fpsr;
+ while (frame >= nframes)
+ frame = frame - nframes;
+
+ cframe = (int)frame; // truncate fractional part
+ if (cframe > nframes)
+ cframe = nframes - 1;
+ if (cframe < 0)
+ cframe = 0;
+
+ _objectFrame[i][0] = frame;
+ _objectFrame[i][1] = cframe;
+ }
+ }
+}
+
+void GriffonEngine::updateY() {
+ for (int i = 0; i <= 2400; i++)
+ _ysort[i] = -1;
+
+ int ff = (int)(_player.py * 10);
+ if (ff < 0) // HACKFIX or _ysort[yy] may go out of bounds
+ ff = 0;
+ _player.ysort = ff;
+ _ysort[ff] = 0;
+
+ _firsty = 2400;
+ _lasty = 0;
+
+ for (int i = 1; i <= _lastnpc; i++) {
+ int yy = (int)(_npcinfo[i].y * 10);
+
+ do {
+ if (_ysort[yy] == -1 || yy == 2400)
+ break;
+ yy = yy + 1;
+ } while (1);
+
+ _ysort[yy] = i;
+ if (yy < _firsty)
+ _firsty = yy;
+ if (yy > _lasty)
+ _lasty = yy;
+ }
+}
+
+void GriffonEngine::updateNPCs() {
+ for (int i = 1; i <= _lastnpc; i++) {
+ if (_npcinfo[i].hp > 0) {
+ // is npc walking
+ int pass = 0;
+ if (_npcinfo[i].attacking == 0)
+ pass = 1;
+ if (_npcinfo[i].spriteset == kMonsterFireHydra)
+ pass = 1;
+ if (pass == 1) {
+ int moveup = 0;
+ int movedown = 0;
+ int moveleft = 0;
+ int moveright = 0;
+
+ float npx = _npcinfo[i].x;
+ float npy = _npcinfo[i].y;
+
+ float onpx = npx;
+ float onpy = npy;
+
+ float wspd = _npcinfo[i].walkspd / 4;
+
+ if (_npcinfo[i].spriteset == kMonsterDragon2)
+ wspd = wspd * 2;
+ int wdir = _npcinfo[i].walkdir;
+
+ int mode = _npcinfo[i].movementmode;
+
+ float xdif = _player.px - npx;
+ float ydif = _player.py - npy;
+
+ if (abs(xdif) < 4 * 16 && abs(ydif) < 4 * 16 && mode < 3)
+ mode = 0;
+ if (_npcinfo[i].hp < _npcinfo[i].maxhp * 0.25)
+ mode = 3;
+
+ if (_npcinfo[i].pause > _ticks)
+ mode = -1;
+ if (_npcinfo[i].spriteset == kMonsterOneWing && _npcinfo[i].castpause > _ticks)
+ mode = -1;
+
+ if (mode == 3) {
+ mode = 1;
+ if (abs(xdif) < 4 * 16 && abs(ydif) < 4 * 16)
+ mode = 3;
+ }
+
+ bool checkpass = false;
+
+ // npc AI CODE
+ // --------------
+
+ // *** aggressive
+ if (mode == 0) {
+ wspd = _npcinfo[i].walkspd / 2;
+
+ xdif = _player.px - npx;
+ ydif = _player.py - npy;
+
+ if (abs(xdif) > abs(ydif)) {
+ if (xdif < 4)
+ wdir = 2;
+ if (xdif > -4)
+ wdir = 3;
+ } else {
+ if (ydif < 4)
+ wdir = 0;
+ if (ydif > -4)
+ wdir = 1;
+ }
+
+ if (xdif < 4)
+ moveleft = 1;
+ if (xdif > -4)
+ moveright = 1;
+ if (ydif < 4)
+ moveup = 1;
+ if (ydif > -4)
+ movedown = 1;
+ }
+ // *******************
+
+ // *** defensive
+ if (mode == 1) {
+
+ int movingdir = _npcinfo[i].movingdir;
+
+ if (_npcinfo[i].ticks > _ticks + 100000)
+ _npcinfo[i].ticks = _ticks;
+
+ if (_npcinfo[i].ticks < _ticks) {
+ _npcinfo[i].ticks = _ticks + 2000;
+ movingdir = (int)(RND() * 8);
+ _npcinfo[i].movingdir = movingdir;
+ }
+
+ if (movingdir == 0) {
+ wdir = 2; // left
+ moveup = 1;
+ moveleft = 1;
+ } else if (movingdir == 1) {
+ wdir = 0; // up
+ moveup = 1;
+ } else if (movingdir == 2) {
+ wdir = 3; // right
+ moveup = 1;
+ moveright = 1;
+ } else if (movingdir == 3) {
+ wdir = 3; // right
+ moveright = 1;
+ } else if (movingdir == 4) {
+ wdir = 3; // right
+ moveright = 1;
+ movedown = 1;
+ } else if (movingdir == 5) {
+ wdir = 1; // down
+ movedown = 1;
+ } else if (movingdir == 6) {
+ wdir = 2; // left
+ movedown = 1;
+ moveleft = 1;
+ } else if (movingdir == 7) {
+ wdir = 2; // left
+ moveleft = 1;
+ }
+
+ checkpass = true;
+ }
+ // *******************
+
+ // *** run away
+ if (mode == 3) {
+ wspd = _npcinfo[i].walkspd / 2;
+
+ xdif = _player.px - npx;
+ ydif = _player.py - npy;
+
+ if (abs(xdif) > abs(ydif)) {
+ if (xdif < 4)
+ wdir = 3;
+ if (xdif > -4)
+ wdir = 2;
+ } else {
+ if (ydif < 4)
+ wdir = 1;
+ if (ydif > -4)
+ wdir = 0;
+ }
+
+ if (xdif < 4)
+ moveright = 1;
+ if (xdif > -4)
+ moveleft = 1;
+ if (ydif < 4)
+ movedown = 1;
+ if (ydif > -4)
+ moveup = 1;
+ }
+ // *******************
+
+ // -------------- ?? move*** vs movin***
+ int movinup = 0;
+ int movindown = 0;
+ int movinleft = 0;
+ int movinright = 0;
+
+ float xp = (npx / 2 + 6);
+ float yp = (npy / 2 + 10);
+
+ if (_npcinfo[i].spriteset == kMonsterDragon2)
+ wspd = wspd * 2;
+
+ float ii = wspd * _fpsr;
+ if (ii < 1)
+ ii = 1;
+
+ if (moveup) {
+ int sx = xp;
+ int sy = yp - ii;
+ uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ uint32 dq = *temp;
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ dq = 0;
+
+ if (dq == 0)
+ movinup = 1;
+ if (dq > 0) {
+ sx = xp - ii;
+ sy = yp - ii;
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ dq = *temp;
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ dq = 0;
+ if (dq == 0) {
+ movinup = 1;
+ movinleft = 1;
+ }
+ }
+ if (dq > 0) {
+ sx = xp + ii;
+ sy = yp - ii;
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ dq = *temp;
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ dq = 0;
+ if (dq == 0) {
+ movinup = 1;
+ movinright = 1;
+ }
+ }
+ }
+
+ if (movedown) {
+ int sx = xp;
+ int sy = yp + ii;
+ uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ uint32 dq = *temp;
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ dq = 0;
+ if (dq == 0)
+ movindown = 1;
+ if (dq > 0) {
+ sx = xp - ii;
+ sy = yp + ii;
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ dq = *temp;
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ dq = 0;
+ if (dq == 0) {
+ movindown = 1;
+ movinleft = 1;
+ }
+ }
+ if (dq > 0) {
+ sx = xp + ii;
+ sy = yp + ii;
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ dq = *temp;
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ dq = 0;
+ if (dq == 0) {
+ movindown = 1;
+ movinright = 1;
+ }
+ }
+ }
+
+ if (moveleft) {
+ int sx = xp - ii;
+ int sy = yp;
+ uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ uint32 dq = *temp;
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ dq = 0;
+ if (dq == 0)
+ movinleft = 1;
+ if (dq > 0) {
+ sx = xp - ii;
+ sy = yp - ii;
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ dq = *temp;
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ dq = 0;
+ if (dq == 0) {
+ movinleft = 1;
+ movinup = 1;
+ }
+ }
+ if (dq > 0) {
+ sx = xp - ii;
+ sy = yp + ii;
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ dq = *temp;
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ dq = 0;
+ if (dq == 0) {
+ movinleft = 1;
+ movindown = 1;
+ }
+ }
+ }
+
+ if (moveright) {
+ int sx = xp + ii;
+ int sy = yp;
+ uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ uint32 dq = *temp;
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ dq = 0;
+ if (dq == 0)
+ movinright = 1;
+ if (dq > 0) {
+ sx = xp + ii;
+ sy = yp - ii;
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ dq = *temp;
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ dq = 0;
+ if (dq == 0) {
+ movinright = 1;
+ movinup = 1;
+ }
+ }
+ if (dq > 0) {
+ sx = xp + ii;
+ sy = yp + ii;
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ dq = *temp;
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ dq = 0;
+ if (dq == 0) {
+ movinright = 1;
+ movindown = 1;
+ }
+ }
+ }
+
+ if (movinup)
+ npy = npy - wspd * _fpsr;
+ if (movindown)
+ npy = npy + wspd * _fpsr;
+ if (movinleft)
+ npx = npx - wspd * _fpsr;
+ if (movinright)
+ npx = npx + wspd * _fpsr;
+
+ if (checkpass) {
+ pass = 0;
+ if (npx >= _npcinfo[i].x1 * 16 - 8 && npx <= _npcinfo[i].x2 * 16 + 8 && npy >= _npcinfo[i].y1 * 16 - 8 && npy <= _npcinfo[i].y2 * 16 + 8)
+ pass = 1;
+ if (pass == 0) {
+ npx = onpx;
+ npy = onpy;
+ _npcinfo[i].ticks = _ticks;
+ }
+ }
+
+ float aspd = wspd;
+
+ if (_npcinfo[i].spriteset == kMonsterDragon2)
+ aspd = wspd / 2;
+
+ xp = (npx / 2 + 6);
+ yp = (npy / 2 + 10);
+
+ int sx = xp;
+ int sy = yp;
+ uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ uint32 bgc = *temp;
+
+ float anpx = npx + 12;
+ float anpy = npy + 20;
+
+ int lx = (int)anpx / 16;
+ int ly = (int)anpy / 16;
+
+ if (_triggerloc[lx][ly] > -1)
+ bgc = 1;
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ bgc = 0;
+
+ int rst = 0;
+
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss) {
+ if (npx < 40 || npx > 280 || npy < 36 || npy > 204)
+ rst = 1;
+ }
+
+ if (bgc > 0 || rst == 1) {
+ npx = onpx;
+ npy = onpy;
+ }
+
+ _npcinfo[i].x = npx;
+ _npcinfo[i].y = npy;
+
+ _npcinfo[i].walkdir = wdir;
+ _npcinfo[i].moving = 0;
+
+ if (npx != onpx || npy != onpy)
+ _npcinfo[i].moving = 1;
+
+ if (_npcinfo[i].moving == 1) {
+ float frame = _npcinfo[i].frame;
+ int cframe = _npcinfo[i].cframe;
+
+ frame = frame + aspd * _fpsr;
+ while (frame >= 16)
+ frame = frame - 16;
+
+ cframe = (int)(frame);
+ if (cframe > 16)
+ cframe = 16 - 1;
+ if (cframe < 0)
+ cframe = 0;
+
+ _npcinfo[i].frame = frame;
+ _npcinfo[i].cframe = cframe;
+ }
+
+ // spriteset1 specific
+ if (_npcinfo[i].spriteset == kMonsterBabyDragon && _npcinfo[i].attackattempt < _ticks) {
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
+ npx = _npcinfo[i].x;
+ npy = _npcinfo[i].y;
+
+ xdif = _player.px - npx;
+ ydif = _player.py - npy;
+
+ if (abs(xdif) < 20 && abs(ydif) < 20) {
+ _npcinfo[i].attackattempt = _ticks + 100;
+ if ((int)(RND() * 2) == 0) {
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndEnemyHit]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ _npcinfo[i].attacking = 1;
+ _npcinfo[i].attackframe = 0;
+ }
+ }
+ }
+ }
+
+ bool dospell = false;
+
+ // onewing specific
+ if (_npcinfo[i].spriteset == kMonsterOneWing) {
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
+ npx = _npcinfo[i].x;
+ npy = _npcinfo[i].y;
+
+ xdif = _player.px - npx;
+ ydif = _player.py - npy;
+
+ if (abs(xdif) < 24 && abs(ydif) < 24) {
+ float dist = sqrt(xdif * xdif + ydif * ydif);
+
+ if ((dist) < 24) {
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndBite]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ _npcinfo[i].attacking = 1;
+ _npcinfo[i].attackframe = 0;
+
+ _npcinfo[i].headtargetx[0] = _player.px + 12;
+ _npcinfo[i].headtargety[0] = _player.py - 4;
+ }
+ }
+
+ }
+
+ dospell = false;
+
+ if (_npcinfo[i].attacking == 0 && _npcinfo[i].castpause < _ticks) {
+ _npcinfo[i].swayspd = _npcinfo[i].swayspd + _npcinfo[i].swayspd / 200 * _fpsr;
+ if (_npcinfo[i].swayspd > 15) {
+ dospell = true;
+ _npcinfo[i].swayspd = 1;
+ }
+
+ // sway code
+ _npcinfo[i].swayangle = _npcinfo[i].swayangle + _npcinfo[i].swayspd * _fpsr;
+ if (_npcinfo[i].swayangle >= 360)
+ _npcinfo[i].swayangle = _npcinfo[i].swayangle - 360;
+
+ _npcinfo[i].headtargetx[0] = _npcinfo[i].x + (24 - _npcinfo[i].swayspd / 2) * sin(3.14159 / 180 * _npcinfo[i].swayangle) + 12;
+ _npcinfo[i].headtargety[0] = _npcinfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * _npcinfo[i].swayangle);
+ }
+
+ if (dospell) {
+ _npcinfo[i].pause = _ticks + 3000;
+ _npcinfo[i].attacknext = _ticks + 4500;
+ _npcinfo[i].castpause = _ticks + 4500;
+
+ castSpell(3, _npcinfo[i].x, _npcinfo[i].y, _npcinfo[i].x, _npcinfo[i].y, i);
+
+ _npcinfo[i].headtargetx[0] = _npcinfo[i].x;
+ _npcinfo[i].headtargety[0] = _npcinfo[i].y - 36 + 16;
+ }
+
+ // targethead code
+ xdif = _npcinfo[i].bodysection[7].x - _npcinfo[i].headtargetx[0];
+ ydif = _npcinfo[i].bodysection[7].y - _npcinfo[i].headtargety[0];
+
+
+ _npcinfo[i].bodysection[7].x = _npcinfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
+ _npcinfo[i].bodysection[7].y = _npcinfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
+
+
+ _npcinfo[i].bodysection[0].x = _npcinfo[i].x + 12;
+ _npcinfo[i].bodysection[0].y = _npcinfo[i].y + 12;
+
+ for (int f = 6; f >= 1; f--) {
+ xdif = _npcinfo[i].bodysection[f + 1].x - _npcinfo[i].bodysection[f - 1].x;
+ ydif = _npcinfo[i].bodysection[f + 1].y - _npcinfo[i].bodysection[f - 1].y;
+
+ float tx = _npcinfo[i].bodysection[f - 1].x + xdif / 2;
+ float ty = _npcinfo[i].bodysection[f - 1].y + ydif / 2;
+
+ _npcinfo[i].bodysection[f].x = _npcinfo[i].bodysection[f].x - (_npcinfo[i].bodysection[f].x - tx) / 3;
+ _npcinfo[i].bodysection[f].y = _npcinfo[i].bodysection[f].y - (_npcinfo[i].bodysection[f].y - ty) / 3;
+ }
+ }
+
+ // boss1 specific and blackknight
+ if (_npcinfo[i].spriteset == kMonsterBoss1 || _npcinfo[i].spriteset == kMonsterBlackKnight) {
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
+ _npcinfo[i].attacking = 1;
+ _npcinfo[i].attackframe = 0;
+
+ castSpell(1, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i);
+ }
+
+ if (_npcinfo[i].castpause < _ticks) {
+ castSpell(6, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i);
+ _npcinfo[i].castpause = _ticks + 12000;
+ }
+ }
+
+
+ // firehydra specific
+ if (_npcinfo[i].spriteset == kMonsterFireHydra) {
+ _npcinfo[i].swayspd = 4;
+
+ // sway code
+ _npcinfo[i].swayangle = _npcinfo[i].swayangle + _npcinfo[i].swayspd * _fpsr;
+ if (_npcinfo[i].swayangle >= 360)
+ _npcinfo[i].swayangle = _npcinfo[i].swayangle - 360;
+
+ for (int ff = 0; ff <= 2; ff++) {
+ if (_npcinfo[i].hp > 10 * ff * 20) {
+ if (_npcinfo[i].pause < _ticks && _npcinfo[i].attacking2[ff] == 0 && _npcinfo[i].attacknext2[ff] < _ticks) {
+ npx = _npcinfo[i].x;
+ npy = _npcinfo[i].y;
+
+ xdif = _player.px - npx;
+ ydif = _player.py - npy;
+
+ if (abs(xdif) < 48 && abs(ydif) < 48) {
+ float dist = sqrt(xdif * xdif + ydif * ydif);
+
+ if ((dist) < 36) {
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndBite]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ _npcinfo[i].attacking = 1;
+ _npcinfo[i].attacking2[ff] = 1;
+ _npcinfo[i].attackframe2[ff] = 0;
+
+ _npcinfo[i].headtargetx[ff] = _player.px + 12;
+ _npcinfo[i].headtargety[ff] = _player.py - 4;
+
+ _npcinfo[i].swayangle = 0;
+ }
+ }
+
+ }
+
+ if (_npcinfo[i].attacking2[ff] == 0) {
+ _npcinfo[i].headtargetx[ff] = _npcinfo[i].x + 38 * sin(3.14159 / 180 * (_npcinfo[i].swayangle + 120 * ff)) + 12;
+ _npcinfo[i].headtargety[ff] = _npcinfo[i].y - 46 + 16 + 16 * sin(3.14159 * 2 / 180 * (_npcinfo[i].swayangle + 120 * ff));
+ }
+
+ // targethead code
+ xdif = _npcinfo[i].bodysection[10 * ff + 9].x - _npcinfo[i].headtargetx[ff];
+ ydif = _npcinfo[i].bodysection[10 * ff + 9].y - _npcinfo[i].headtargety[ff];
+
+ _npcinfo[i].bodysection[10 * ff + 9].x = _npcinfo[i].bodysection[10 * ff + 9].x - xdif * 0.4 * _fpsr;
+ _npcinfo[i].bodysection[10 * ff + 9].y = _npcinfo[i].bodysection[10 * ff + 9].y - ydif * 0.4 * _fpsr;
+
+ _npcinfo[i].bodysection[10 * ff].x = _npcinfo[i].x + 12 + 8 * cos(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
+ _npcinfo[i].bodysection[10 * ff].y = _npcinfo[i].y + 12 + 8 * sin(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
+
+ for (int f = 8; f >= 1; f--) {
+ xdif = _npcinfo[i].bodysection[ff * 10 + f + 1].x - _npcinfo[i].bodysection[ff * 10 + f - 1].x;
+ ydif = _npcinfo[i].bodysection[ff * 10 + f + 1].y - _npcinfo[i].bodysection[ff * 10 + f - 1].y;
+
+ float tx = _npcinfo[i].bodysection[ff * 10 + f - 1].x + xdif / 2;
+ float ty = _npcinfo[i].bodysection[ff * 10 + f - 1].y + ydif / 2;
+
+ _npcinfo[i].bodysection[ff * 10 + f].x = _npcinfo[i].bodysection[ff * 10 + f].x - (_npcinfo[i].bodysection[ff * 10 + f].x - tx) / 3;
+ _npcinfo[i].bodysection[ff * 10 + f].y = _npcinfo[i].bodysection[ff * 10 + f].y - (_npcinfo[i].bodysection[ff * 10 + f].y - ty) / 3;
+ }
+ }
+ }
+ }
+
+ // spriteset6 specific
+ if (_npcinfo[i].spriteset == kMonsterRedDragon && _npcinfo[i].attackattempt < _ticks) {
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
+ npx = _npcinfo[i].x;
+ npy = _npcinfo[i].y;
+
+ xdif = _player.px - npx;
+ ydif = _player.py - npy;
+
+ pass = 0;
+ if (abs(xdif) < 48 && abs(ydif) < 6)
+ pass = 1;
+ if (abs(ydif) < 48 && abs(xdif) < 6)
+ pass = 2;
+
+ if (pass > 0) {
+ _npcinfo[i].attackattempt = _ticks + 100;
+ if ((int)(RND() * 2) == 0) {
+ _npcinfo[i].attacking = 1;
+ _npcinfo[i].attackframe = 0;
+ float nnxa = 0, nnya = 0, nnxb = 0, nnyb = 0;
+
+ if (pass == 1 && xdif < 0) {
+ nnxa = npx - 8;
+ nnya = npy + 4;
+ nnxb = npx - 48 - 8;
+ nnyb = npy + 4;
+ } else if (pass == 1 && xdif > 0) {
+ nnxa = npx + 16;
+ nnya = npy + 4;
+ nnxb = npx + 16 + 48;
+ nnyb = npy + 4;
+ } else if (pass == 2 && ydif < 0) {
+ nnya = npy;
+ nnxa = npx + 4;
+ nnyb = npy - 48;
+ nnxb = npx + 4;
+ } else if (pass == 2 && ydif > 0) {
+ nnya = npy + 20;
+ nnxa = npx + 4;
+ nnyb = npy + 20 + 48;
+ nnxb = npx + 4;
+ }
+
+ castSpell(7, nnxa, nnya, nnxb, nnyb, i);
+ }
+ }
+ }
+ }
+
+ // wizard1 specific
+ if (_npcinfo[i].spriteset == kMonsterPriest) {
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
+ _npcinfo[i].attacking = 1;
+ _npcinfo[i].attackframe = 0;
+
+ castSpell(9, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i);
+ }
+
+ if (_npcinfo[i].castpause < _ticks) {
+ // castSpell 6, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i
+ // _npcinfo[i].castpause = _ticks + 12000
+ }
+
+ }
+
+ // spriteset6 specific
+ if (_npcinfo[i].spriteset == kMonsterYellowDragon && _npcinfo[i].attackattempt < _ticks) {
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
+ npx = _npcinfo[i].x;
+ npy = _npcinfo[i].y;
+
+ xdif = _player.px - npx;
+ ydif = _player.py - npy;
+
+ pass = 0;
+ if (abs(xdif) < 56 && abs(ydif) < 6)
+ pass = 1;
+ if (abs(ydif) < 56 && abs(xdif) < 6)
+ pass = 2;
+
+ if (pass > 0) {
+ _npcinfo[i].attackattempt = _ticks + 100;
+ if ((int)(RND() * 2) == 0) {
+ _npcinfo[i].attacking = 1;
+ _npcinfo[i].attackframe = 0;
+
+ float nnxa = 0, nnya = 0, nnxb = 0, nnyb = 0;
+ if (pass == 1 && xdif < 0) {
+ nnxa = npx - 8;
+ nnya = npy + 4;
+ nnxb = npx - 56 - 8;
+ nnyb = npy + 4;
+ _npcinfo[i].walkdir = 2;
+ } else if (pass == 1 && xdif > 0) {
+ nnxa = npx + 16;
+ nnya = npy + 4;
+ nnxb = npx + 16 + 56;
+ nnyb = npy + 4;
+ _npcinfo[i].walkdir = 3;
+ } else if (pass == 2 && ydif < 0) {
+ nnya = npy;
+ nnxa = npx + 4;
+ nnyb = npy - 56;
+ nnxb = npx + 4;
+ _npcinfo[i].walkdir = 0;
+ } else if (pass == 2 && ydif > 0) {
+ nnya = npy + 20;
+ nnxa = npx + 4;
+ nnyb = npy + 20 + 56;
+ nnxb = npx + 4;
+ _npcinfo[i].walkdir = 1;
+ }
+
+ castSpell(7, nnxa, nnya, nnxb, nnyb, i);
+ }
+ }
+ }
+ }
+
+ // twowing specific
+ if (_npcinfo[i].spriteset == kMonsterTwoWing) {
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
+ npx = _npcinfo[i].bodysection[7].x;
+ npy = _npcinfo[i].bodysection[7].y;
+
+ xdif = _player.px - npx;
+ ydif = _player.py - npy;
+
+ if (abs(xdif) < 24 && abs(ydif) < 24) {
+ float dist = sqrt(xdif * xdif + ydif * ydif);
+
+ if ((dist) < 24) {
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndBite]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ _npcinfo[i].attacking = 1;
+ _npcinfo[i].attackframe = 0;
+
+ _npcinfo[i].headtargetx[0] = _player.px + 12;
+ _npcinfo[i].headtargety[0] = _player.py - 4;
+ }
+ }
+
+ }
+
+ if (_npcinfo[i].attacking == 0 && _npcinfo[i].castpause < _ticks) {
+ _npcinfo[i].swayspd = 4;
+
+ // sway code
+ _npcinfo[i].swayangle = _npcinfo[i].swayangle + _npcinfo[i].swayspd * _fpsr;
+ if (_npcinfo[i].swayangle >= 360)
+ _npcinfo[i].swayangle = _npcinfo[i].swayangle - 360;
+
+ _npcinfo[i].headtargetx[0] = _npcinfo[i].x + (24 - _npcinfo[i].swayspd / 2) * sin(3.14159 / 180 * _npcinfo[i].swayangle) + 12;
+ _npcinfo[i].headtargety[0] = _npcinfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * _npcinfo[i].swayangle);
+ }
+
+ if (dospell) {
+ _npcinfo[i].pause = _ticks + 3000;
+ _npcinfo[i].attacknext = _ticks + 5000;
+ _npcinfo[i].castpause = _ticks + 3000;
+
+ castSpell(3, _npcinfo[i].x, _npcinfo[i].y, _npcinfo[i].x, _npcinfo[i].y, i);
+
+ _npcinfo[i].headtargetx[0] = _npcinfo[i].x;
+ _npcinfo[i].headtargety[0] = _npcinfo[i].y - 36 + 16;
+ }
+
+ // targethead code
+ xdif = _npcinfo[i].bodysection[7].x - _npcinfo[i].headtargetx[0];
+ ydif = _npcinfo[i].bodysection[7].y - _npcinfo[i].headtargety[0];
+
+
+ _npcinfo[i].bodysection[7].x = _npcinfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
+ _npcinfo[i].bodysection[7].y = _npcinfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
+
+ _npcinfo[i].bodysection[0].x = _npcinfo[i].x + 12;
+ _npcinfo[i].bodysection[0].y = _npcinfo[i].y + 12;
+
+ for (int f = 6; f >= 1; f--) {
+ xdif = _npcinfo[i].bodysection[f + 1].x - _npcinfo[i].bodysection[f - 1].x;
+ ydif = _npcinfo[i].bodysection[f + 1].y - _npcinfo[i].bodysection[f - 1].y;
+
+ float tx = _npcinfo[i].bodysection[f - 1].x + xdif / 2;
+ float ty = _npcinfo[i].bodysection[f - 1].y + ydif / 2;
+
+ _npcinfo[i].bodysection[f].x = _npcinfo[i].bodysection[f].x - (_npcinfo[i].bodysection[f].x - tx) / 3;
+ _npcinfo[i].bodysection[f].y = _npcinfo[i].bodysection[f].y - (_npcinfo[i].bodysection[f].y - ty) / 3;
+ }
+
+ }
+
+ // dragon2 specific
+ if (_npcinfo[i].spriteset == kMonsterDragon2 && _npcinfo[i].attackattempt < _ticks) {
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
+ npx = _npcinfo[i].x;
+ npy = _npcinfo[i].y;
+
+ xdif = _player.px - npx;
+ ydif = _player.py - npy;
+
+ if (abs(xdif) < 32 && abs(ydif) < 32) {
+ _npcinfo[i].attackattempt = _ticks + 100;
+ if ((int)(RND() * 2) == 0) {
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndEnemyHit]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ _npcinfo[i].attacking = 1;
+ _npcinfo[i].attackframe = 0;
+ }
+ }
+ }
+ }
+
+
+ // endboss specific
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss && _npcinfo[i].attackattempt < _ticks) {
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
+ npx = _npcinfo[i].x;
+ npy = _npcinfo[i].y;
+
+ xdif = _player.px - npx;
+ ydif = _player.py - npy;
+
+ if (abs(xdif) < 38 && abs(ydif) < 38) {
+ _npcinfo[i].attackattempt = _ticks + 100;
+ if ((int)(RND() * 2) == 0) {
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndIce]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+ _npcinfo[i].attacking = 1;
+ _npcinfo[i].attackframe = 0;
+ }
+ }
+ }
+ }
+ }
+
+
+ float npx = _npcinfo[i].x;
+ float npy = _npcinfo[i].y;
+
+ int xp = (npx / 2 + 6);
+ int yp = (npy / 2 + 10);
+
+ rcSrc.left = xp - 1;
+ rcSrc.top = yp - 1;
+ rcSrc.setWidth(3);
+ rcSrc.setHeight(3);
+
+ if (_npcinfo[i].pause < _ticks)
+ _clipbg->fillRect(rcSrc, i);
+
+
+ pass = 0;
+ if (_npcinfo[i].attacking == 1)
+ pass = 1;
+ if (_npcinfo[i].spriteset == kMonsterFireHydra) {
+ if (_npcinfo[i].attacking2[0] == 1)
+ pass = 1;
+ if (_npcinfo[i].attacking2[1] == 1)
+ pass = 1;
+ if (_npcinfo[i].attacking2[2] == 1)
+ pass = 1;
+ }
+
+ if (pass == 1) {
+ int dist;
+ float damage;
+ // spriteset1 specific
+ if (_npcinfo[i].spriteset == kMonsterBabyDragon) {
+ _npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
+ if (_npcinfo[i].attackframe >= 16) {
+ _npcinfo[i].attackframe = 0;
+ _npcinfo[i].attacking = 0;
+ _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
+ }
+
+ _npcinfo[i].cattackframe = (int)(_npcinfo[i].attackframe);
+
+ npx = _npcinfo[i].x;
+ npy = _npcinfo[i].y;
+
+ float xdif = _player.px - npx;
+ float ydif = _player.py - npy;
+
+ dist = 10;
+
+ if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
+ _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
+ // _npcinfo[i].attackframe = 0;
+ // _npcinfo[i].attacking = 0;
+
+ damage = (float)_npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
+
+ if (_player.hp > 0)
+ damagePlayer(damage);
+ }
+ }
+
+ if (_npcinfo[i].spriteset == kMonsterOneWing) {
+ // targethead code
+ float xdif = _npcinfo[i].bodysection[7].x - _npcinfo[i].headtargetx[0];
+ float ydif = _npcinfo[i].bodysection[7].y - _npcinfo[i].headtargety[0];
+
+ _npcinfo[i].bodysection[7].x = _npcinfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
+ _npcinfo[i].bodysection[7].y = _npcinfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
+
+ _npcinfo[i].bodysection[0].x = _npcinfo[i].x + 12;
+ _npcinfo[i].bodysection[0].y = _npcinfo[i].y + 12;
+
+ for (int f = 6; f >= 1; f--) {
+ xdif = _npcinfo[i].bodysection[f + 1].x - _npcinfo[i].bodysection[f - 1].x;
+ ydif = _npcinfo[i].bodysection[f + 1].y - _npcinfo[i].bodysection[f - 1].y;
+
+ float tx = _npcinfo[i].bodysection[f - 1].x + xdif / 2;
+ float ty = _npcinfo[i].bodysection[f - 1].y + ydif / 2;
+
+ _npcinfo[i].bodysection[f].x = _npcinfo[i].bodysection[f].x - (_npcinfo[i].bodysection[f].x - tx);
+ _npcinfo[i].bodysection[f].y = _npcinfo[i].bodysection[f].y - (_npcinfo[i].bodysection[f].y - ty);
+ }
+
+ _npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
+ if (_npcinfo[i].attackframe >= 16) {
+ _npcinfo[i].attackframe = 0;
+ _npcinfo[i].attacking = 0;
+ _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
+ }
+
+ _npcinfo[i].cattackframe = (int)(_npcinfo[i].attackframe);
+
+ npx = _npcinfo[i].bodysection[7].x;
+ npy = (_npcinfo[i].bodysection[7].y + 16);
+
+ xdif = (_player.px + 12) - npx;
+ ydif = (_player.py + 12) - npy;
+
+ dist = 8;
+
+ if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
+ _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
+ // _npcinfo[i].attackframe = 0
+ // _npcinfo[i].attacking = 0
+ damage = (float)_npcinfo[i].attackdamage * (1.0 + (RND() * 0.5));
+ if (_player.hp > 0)
+ damagePlayer(damage);
+ }
+ }
+
+
+ // firehydra
+ if (_npcinfo[i].spriteset == kMonsterFireHydra) {
+ for (int ff = 0; ff <= 2; ff++) {
+ if (_npcinfo[i].attacking2[ff] == 1) {
+ float xdif = _npcinfo[i].bodysection[10 * ff + 9].x - _npcinfo[i].headtargetx[ff];
+ float ydif = _npcinfo[i].bodysection[10 * ff + 9].y - _npcinfo[i].headtargety[ff];
+
+ _npcinfo[i].bodysection[10 * ff + 9].x = _npcinfo[i].bodysection[10 * ff + 9].x - xdif * .2 * _fpsr;
+ _npcinfo[i].bodysection[10 * ff + 9].y = _npcinfo[i].bodysection[10 * ff + 9].y - ydif * .2 * _fpsr;
+
+ _npcinfo[i].bodysection[10 * ff].x = _npcinfo[i].x + 12 + 8 * cos(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
+ _npcinfo[i].bodysection[10 * ff].y = _npcinfo[i].y + 12 + 8 * sin(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
+
+ for (int f = 8; f >= 1; f--) {
+ xdif = _npcinfo[i].bodysection[ff * 10 + f + 1].x - _npcinfo[i].bodysection[ff * 10 + f - 1].x;
+ ydif = _npcinfo[i].bodysection[ff * 10 + f + 1].y - _npcinfo[i].bodysection[ff * 10 + f - 1].y;
+
+ float tx = _npcinfo[i].bodysection[ff * 10 + f - 1].x + xdif / 2;
+ float ty = _npcinfo[i].bodysection[ff * 10 + f - 1].y + ydif / 2;
+
+ _npcinfo[i].bodysection[ff * 10 + f].x = _npcinfo[i].bodysection[ff * 10 + f].x - (_npcinfo[i].bodysection[ff * 10 + f].x - tx) / 3;
+ _npcinfo[i].bodysection[ff * 10 + f].y = _npcinfo[i].bodysection[ff * 10 + f].y - (_npcinfo[i].bodysection[ff * 10 + f].y - ty) / 3;
+ }
+
+ _npcinfo[i].attackframe2[ff] = _npcinfo[i].attackframe2[ff] + _npcinfo[i].attackspd * _fpsr;
+ if (_npcinfo[i].attackframe2[ff] >= 16) {
+ _npcinfo[i].attackframe2[ff] = 0;
+ _npcinfo[i].attacking2[ff] = 0;
+ _npcinfo[i].attacknext2[ff] = _ticks + _npcinfo[i].attackdelay;
+ }
+
+ _npcinfo[i].cattackframe = (int)(_npcinfo[i].attackframe);
+
+ npx = _npcinfo[i].bodysection[10 * ff + 9].x;
+ npy = (_npcinfo[i].bodysection[10 * ff + 9].y + 16);
+
+ xdif = (_player.px + 12) - npx;
+ ydif = (_player.py + 12) - npy;
+
+ dist = 8;
+
+ if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
+ _npcinfo[i].attacknext2[ff] = _ticks + _npcinfo[i].attackdelay;
+ // _npcinfo[i].attackframe2(ff) = 0
+ // _npcinfo[i].attacking2(ff) = 0
+ damage = (float)_npcinfo[i].attackdamage * (1.0 + RND() * 0.5);
+ if (_player.hp > 0)
+ damagePlayer(damage);
+ }
+ }
+ }
+
+ }
+
+ // twowing specific
+ if (_npcinfo[i].spriteset == kMonsterTwoWing) {
+ // targethead code
+ float xdif = _npcinfo[i].bodysection[7].x - _npcinfo[i].headtargetx[0];
+ float ydif = _npcinfo[i].bodysection[7].y - _npcinfo[i].headtargety[0];
+
+ _npcinfo[i].bodysection[7].x = _npcinfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
+ _npcinfo[i].bodysection[7].y = _npcinfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
+
+ _npcinfo[i].bodysection[0].x = _npcinfo[i].x + 12;
+ _npcinfo[i].bodysection[0].y = _npcinfo[i].y + 12;
+
+ for (int f = 6; f >= 1; f--) {
+ xdif = _npcinfo[i].bodysection[f + 1].x - _npcinfo[i].bodysection[f - 1].x;
+ ydif = _npcinfo[i].bodysection[f + 1].y - _npcinfo[i].bodysection[f - 1].y;
+
+ float tx = _npcinfo[i].bodysection[f - 1].x + xdif / 2;
+ float ty = _npcinfo[i].bodysection[f - 1].y + ydif / 2;
+
+ _npcinfo[i].bodysection[f].x = _npcinfo[i].bodysection[f].x - (_npcinfo[i].bodysection[f].x - tx);
+ _npcinfo[i].bodysection[f].y = _npcinfo[i].bodysection[f].y - (_npcinfo[i].bodysection[f].y - ty);
+ }
+
+ _npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
+ if (_npcinfo[i].attackframe >= 16) {
+ _npcinfo[i].attackframe = 0;
+ _npcinfo[i].attacking = 0;
+ _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
+ }
+
+ _npcinfo[i].cattackframe = (int)(_npcinfo[i].attackframe);
+
+ npx = _npcinfo[i].bodysection[7].x;
+ npy = (_npcinfo[i].bodysection[7].y + 16);
+
+ xdif = (_player.px + 12) - npx;
+ ydif = (_player.py + 12) - npy;
+
+ dist = 8;
+
+ if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
+ _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
+ // _npcinfo[i].attackframe = 0
+ // _npcinfo[i].attacking = 0
+ damage = (float)_npcinfo[i].attackdamage * (1.0 + RND() * 0.5);
+ if (_player.hp > 0)
+ damagePlayer(damage);
+ }
+ }
+
+ // dragon 2 specific
+ if (_npcinfo[i].spriteset == kMonsterDragon2) {
+
+ _npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
+ if (_npcinfo[i].attackframe >= 16) {
+ _npcinfo[i].attackframe = 0;
+ _npcinfo[i].attacking = 0;
+ _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
+ }
+
+ _npcinfo[i].cattackframe = (int)(_npcinfo[i].attackframe);
+
+ npx = _npcinfo[i].x;
+ npy = _npcinfo[i].y;
+
+ float xdif = _player.px - npx;
+ float ydif = _player.py - npy;
+
+ dist = 16 + _npcinfo[i].attackframe;
+
+ if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
+ _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
+ // _npcinfo[i].attackframe = 0
+ // _npcinfo[i].attacking = 0
+ damage = (float)_npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
+ if (_player.hp > 0)
+ damagePlayer(damage);
+ }
+ }
+
+ // endboss specific
+ if (_npcinfo[i].spriteset == kMonsterFinalBoss) {
+ _npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
+ if (_npcinfo[i].attackframe >= 16) {
+ _npcinfo[i].attackframe = 0;
+ _npcinfo[i].attacking = 0;
+ _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
+ }
+
+ _npcinfo[i].cattackframe = (int)(_npcinfo[i].attackframe);
+
+ npx = _npcinfo[i].x;
+ npy = _npcinfo[i].y;
+
+ float xdif = _player.px - npx;
+ float ydif = _player.py - npy;
+
+ dist = 36;
+
+ if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
+ _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
+ // _npcinfo[i].attackframe = 0
+ // _npcinfo[i].attacking = 0
+ damage = (float)_npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
+ if (_player.hp > 0)
+ damagePlayer(damage);
+ }
+ }
+ }
+ // -------end fight code
+ }
+ }
+}
+
+void GriffonEngine::updateSpells() {
+ int foundel[5];
+ float npx, npy;
+ long cl1, cl2, cl3;
+ int ll[4][2];
+
+ float xloc = 0, yloc = 0, xst, yst, xdif, ydif;
+
+ for (int i = 0; i < kMaxSpell; i++) {
+ if (spellinfo[i].frame > 0) {
+ int spellnum = spellinfo[i].spellnum;
+
+ // water
+ if (spellnum == 0 && !_forcepause) {
+ float fr = (32 - spellinfo[i].frame);
+
+ ll[0][0] = -2;
+ ll[0][1] = -3;
+ ll[1][0] = 2;
+ ll[1][1] = -3;
+ ll[2][0] = -4;
+ ll[2][1] = -2;
+ ll[3][0] = 4;
+ ll[3][1] = -2;
+
+ for (int f = 0; f <= 3; f++) {
+ if (fr > f * 4 && fr < f * 4 + 16) {
+ float alf = 255;
+
+ if (fr < f * 4 + 8) {
+ int fi = (int)((fr - f * 4) * 3) % 4;
+ rcSrc.left = 32 + fi * 16;
+ rcSrc.top = 80;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
+
+ xloc = spellinfo[i].enemyx + 12 + ll[f][0] * 16;
+ yloc = spellinfo[i].enemyy + 16 + ll[f][1] * 16;
+
+ rcDest.left = xloc;
+ rcDest.top = yloc;
+
+ alf = 255 * ((fr - f * 4) / 8);
+ }
+
+ if (fr >= f * 4 + 8) {
+ int fi = 0; // ??
+
+ if (f == 0 || f == 2)
+ fi = 0;
+ if (f == 1 || f == 3)
+ fi = 1;
+ rcSrc.left = 32 + fi * 16;
+ rcSrc.top = 80;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
+
+ xst = spellinfo[i].enemyx + 12 + ll[f][0] * 16;
+ yst = spellinfo[i].enemyy + 16 + ll[f][1] * 16;
+
+ float xi = (spellinfo[i].enemyx - xst) * 2 / 8;
+ float yi = (spellinfo[i].enemyy - yst) * 2 / 8;
+
+ float fl = (fr - f * 4 - 8) / 2;
+ xloc = xst + xi * fl * fl;
+ yloc = yst + yi * fl * fl;
+
+ rcDest.left = xloc;
+ rcDest.top = yloc;
+
+ alf = 255;
+ }
+
+ if (xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
+ _spellimg->setAlpha(alf, true);
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellimg->setAlpha(255, true);
+
+ if (spellinfo[i].damagewho == 0) {
+ for (int e = 1; e <= _lastnpc; e++) {
+
+ xdif = (xloc + 16) - (_npcinfo[e].x + 12);
+ ydif = (yloc + 16) - (_npcinfo[e].y + 12);
+
+ if ((abs(xdif) < 16 && abs(ydif) < 16)) {
+ float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
+
+ if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
+ damageNPC(e, damage, 1);
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndIce]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+ }
+ }
+ }
+ }
+
+ // check for post damage
+ if (nposts > 0) {
+ for (int e = 0; e <= nposts - 1; e++) {
+ xdif = (xloc + 16) - (postinfo[e][0] + 8);
+ ydif = (yloc + 16) - (postinfo[e][1] + 8);
+
+ if ((abs(xdif) < 16 && abs(ydif) < 16)) {
+ _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+
+ rcSrc.left = postinfo[e][0] / 2;
+ rcSrc.top = postinfo[e][1] / 2;
+ rcSrc.setWidth(8);
+ rcSrc.setHeight(8);
+
+ _clipbg2->fillRect(rcSrc, 0);
+
+ addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndIce]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // metal
+ if (spellnum == 1 && !_forcepause) {
+ int fr = (int)((32 - spellinfo[i].frame) * 4) % 3;
+
+ rcSrc.left = fr * 48;
+ rcSrc.top = 0;
+ rcSrc.setWidth(48);
+ rcSrc.setHeight(48);
+
+ float c1 = (32 - spellinfo[i].frame) / 16;
+
+ float halfx = (spellinfo[i].homex - 12) + ((spellinfo[i].enemyx - 12) - (spellinfo[i].homex - 12)) / 2;
+ float halfy = (spellinfo[i].homey - 12) + ((spellinfo[i].enemyy - 12) - (spellinfo[i].homey - 12)) / 2;
+
+ float wdth = (halfx - spellinfo[i].homex) * 1.2;
+ float hight = (halfy - spellinfo[i].homey) * 1.2;
+
+ xloc = halfx + wdth * cos(3.14159 + 3.14159 * 2 * c1);
+ yloc = halfy + hight * sin(3.14159 + 3.14159 * 2 * c1);
+
+ rcDest.left = xloc;
+ rcDest.top = yloc;
+
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+
+ spellinfo[i].frame = spellinfo[i].frame - 0.2 * _fpsr;
+ if (spellinfo[i].frame < 0)
+ spellinfo[i].frame = 0;
+
+ if (spellinfo[i].damagewho == 0) {
+ for (int e = 1; e <= _lastnpc; e++) {
+ xdif = (xloc + 24) - (_npcinfo[e].x + 12);
+ ydif = (yloc + 24) - (_npcinfo[e].y + 12);
+
+ if ((abs(xdif) < 24 && abs(ydif) < 24)) {
+ float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
+
+ if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
+ damageNPC(e, damage, 1);
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndMetalHit]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+ }
+ }
+ }
+ }
+
+ if (spellinfo[i].damagewho == 1) {
+ // --------- boss 1 specific
+ if (ABS(spellinfo[i].frame) < 0 && _npcinfo[spellinfo[i].npc].spriteset == kMonsterBoss1) {
+ int npc = spellinfo[i].npc;
+ _npcinfo[npc].attackframe = 0;
+ _npcinfo[npc].attacking = 0;
+
+ _npcinfo[npc].pause = _ticks + 1000;
+ _npcinfo[npc].attacknext = _ticks + 4000;
+ }
+ // ---------------
+
+ // --------- blackknight specific
+ if (ABS(spellinfo[i].frame) < 0 && _npcinfo[spellinfo[i].npc].spriteset == kMonsterBlackKnight) {
+ int npc = spellinfo[i].npc;
+ _npcinfo[npc].attackframe = 0;
+ _npcinfo[npc].attacking = 0;
+
+ _npcinfo[npc].pause = _ticks + 1000;
+ _npcinfo[npc].attacknext = _ticks + 3500;
+ }
+ // ---------------
+
+ xdif = (xloc + 24) - (_player.px + 12);
+ ydif = (yloc + 24) - (_player.py + 12);
+
+ if ((abs(xdif) < 24 && abs(ydif) < 24) && _player.pause < _ticks) {
+ npx = _player.px;
+ npy = _player.py;
+
+ float damage = (float)_npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
+
+ if (_player.hp > 0) {
+ damagePlayer(damage);
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndMetalHit]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+ }
+ }
+ }
+
+
+ // check for(int post damage
+ if (nposts > 0) {
+ for (int e = 0; e <= nposts - 1; e++) {
+ xdif = (xloc + 24) - (postinfo[e][0] + 8);
+ ydif = (yloc + 24) - (postinfo[e][1] + 8);
+
+ if ((abs(xdif) < 24 && abs(ydif) < 24)) {
+ _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+
+ rcSrc.left = postinfo[e][0] / 2;
+ rcSrc.top = postinfo[e][1] / 2;
+ rcSrc.setWidth(8);
+ rcSrc.setHeight(8);
+
+ _clipbg2->fillRect(rcSrc, 0);
+
+ addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndMetalHit]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+ }
+ }
+ }
+ }
+
+ // earth
+ if (spellnum == 2 && !_forcepause) {
+ float hght = 240 - spellinfo[i].enemyy;
+
+ for (int f = 8; f >= 0; f--) {
+
+ float fr = (32 - spellinfo[i].frame);
+
+ if (fr > f && fr < f + 16) {
+ rcSrc.left = 32 * spellinfo[i].rockimg[f];
+ rcSrc.top = 48;
+ rcSrc.setWidth(32);
+ rcSrc.setHeight(32);
+
+ int scatter = 0;
+ if (fr < 8 + f) {
+ xloc = spellinfo[i].enemyx - 4;
+ yloc = spellinfo[i].enemyy * (1 - cos(3.14159 / 2 * (fr - f) / 8)); // ^ 2;
+ yloc *= yloc;
+ } else {
+ scatter = 1;
+ xloc = spellinfo[i].enemyx - 4 - spellinfo[i].rockdeflect[f] * sin(3.14159 / 2 * ((fr - f) - 8) / 8);
+ yloc = spellinfo[i].enemyy + hght * (1 - cos(3.14159 / 2 * ((fr - f) - 8) / 8));
+ }
+
+ rcDest.left = xloc;
+ rcDest.top = yloc;
+
+ if (xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+
+ if (scatter == 1) {
+ if (spellinfo[i].damagewho == 0) {
+ for (int e = 1; e <= _lastnpc; e++) {
+ xdif = (xloc + 16) - (_npcinfo[e].x + 12);
+ ydif = (yloc + 16) - (_npcinfo[e].y + 12);
+
+ if ((abs(xdif) < 16 && abs(ydif) < 16)) {
+ float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
+
+ if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
+ damageNPC(e, damage, 1);
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndRocks]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+ }
+ }
+ }
+ }
+
+
+ // check for(int post damage
+ if (nposts > 0) {
+ for (int e = 0; e <= nposts - 1; e++) {
+ xdif = (xloc + 16) - (postinfo[e][0] + 8);
+ ydif = (yloc + 16) - (postinfo[e][1] + 8);
+
+ if ((abs(xdif) < 16 && abs(ydif) < 16)) {
+ _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+
+ rcSrc.left = postinfo[e][0] / 2;
+ rcSrc.top = postinfo[e][1] / 2;
+ rcSrc.setWidth(8);
+ rcSrc.setHeight(8);
+
+ _clipbg2->fillRect(rcSrc, 0);
+
+ addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndRocks]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ spellinfo[i].frame = spellinfo[i].frame - 0.2 * _fpsr;
+ if (spellinfo[i].frame < 0)
+ spellinfo[i].frame = 0;
+ }
+
+ // crystal
+ if (spellnum == 5) {
+
+ float fra = (32 - spellinfo[i].frame);
+ int fr = (int)((spellinfo[i].frame) * 2) % 8;
+
+ rcSrc.left = fr * 32;
+ rcSrc.top = 96 + 48;
+ rcSrc.setWidth(32);
+ rcSrc.setHeight(64);
+
+ rcDest.left = _player.px - 4;
+ rcDest.top = _player.py + 16 - 48;
+
+ int f = 160;
+ if (fra < 8)
+ f = 192 * fra / 8;
+ if (fra > 24)
+ f = 192 * (1 - (fra - 24) / 8);
+
+ _spellimg->setAlpha(f, true);
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellimg->setAlpha(255, true);
+
+ spellinfo[i].frame = spellinfo[i].frame - 0.3 * _fpsr;
+ if (spellinfo[i].frame < 0) {
+ spellinfo[i].frame = 0;
+ _forcepause = false;
+
+ npx = _player.px + 12;
+ npy = _player.py + 20;
+
+ int lx = (int)npx / 16;
+ int ly = (int)npy / 16;
+
+ for (int f1 = 0; f1 < 5; f1++) { // !! f < 5
+ foundel[f1] = 0;
+ }
+
+ for (int xo = -2; xo <= 2; xo++) {
+ for (int yo = -2; yo <= 2; yo++) {
+
+ int sx = lx + xo;
+ int sy = ly + yo;
+
+ if (sx > -1 && sx < 20 && sy > -1 && sy < 15) {
+ for (int l = 0; l <= 2; l++) {
+ int curtile = _tileinfo[l][sx][sy][0];
+ int curtilel = _tileinfo[l][sx][sy][1];
+
+ if (curtile > 0) {
+ curtile = curtile - 1;
+ int curtilex = curtile % 20;
+ int curtiley = (curtile - curtilex) / 20;
+
+ int element = elementmap[curtiley][curtilex];
+ if (element > -1 && curtilel == 0)
+ foundel[element + 1] = 1;
+ }
+ }
+
+ int o = _objectMap[sx][sy];
+ if (o > -1) {
+ if (_objectInfo[o][4] == 1)
+ foundel[2] = 1;
+ if (o == 1 || o == 2) {
+ foundel[2] = 1;
+ foundel[4] = 1;
+ }
+ }
+ }
+ }
+ }
+
+ char line[256];
+ strcpy(line, "Found... nothing...");
+
+ for (int f1 = 0; f1 < 5; f1++) {
+ if (foundel[f1] == 1 && _player.foundspell[f1] == 0) {
+ _player.foundspell[f1] = 1;
+ _player.spellcharge[f1] = 0;
+ if (f1 == 1)
+ strcpy(line, "Found... Water Essence");
+ if (f1 == 2)
+ strcpy(line, "Found... Metal Essence");
+ if (f1 == 3)
+ strcpy(line, "Found... Earth Essence");
+ if (f1 == 4)
+ strcpy(line, "Found... Fire Essence");
+ break;
+ }
+ }
+
+ eventText(line);
+ }
+ }
+
+ // room fireballs
+ if (spellnum == 6 && !_forcepause) {
+
+ if (spellinfo[i].frame > 16) {
+ float fr = (32 - spellinfo[i].frame);
+
+ _spellimg->setAlpha(192 * sin(3.14159 * fr / 4), true);
+
+ rcSrc.left = 16 * (int)(RND() * 2);
+ rcSrc.top = 80;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
+
+ for (int ff = 0; ff <= spellinfo[i].nfballs - 1; ff++) {
+
+ xloc = spellinfo[i].fireballs[ff][0] + (int)(RND() * 3) - 1;
+ yloc = spellinfo[i].fireballs[ff][1] + (int)(RND() * 3) - 1;
+
+ rcDest.left = xloc;
+ rcDest.top = yloc;
+
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ }
+
+ _spellimg->setAlpha(255, true);
+ } else {
+ _spellimg->setAlpha(192, true);
+
+ rcSrc.left = 16 * (int)(RND() * 2);
+ rcSrc.top = 80;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
+
+ for (int ff = 0; ff <= spellinfo[i].nfballs - 1; ff++) {
+ float ax = spellinfo[i].fireballs[ff][0];
+ float ay = spellinfo[i].fireballs[ff][1];
+ float bx = _player.px + 4;
+ float by = _player.py + 4;
+ float d = sqrt((bx - ax) * (bx - ax) + (by - ay) * (by - ay));
+
+ float tx = (bx - ax) / d;
+ float ty = (by - ay) / d;
+
+ spellinfo[i].fireballs[ff][2] += tx * 1.2 * _fpsr;
+ spellinfo[i].fireballs[ff][3] += ty * 1.2 * _fpsr;
+
+ if (spellinfo[i].ballon[ff] == 1) {
+ spellinfo[i].fireballs[ff][0] = ax + spellinfo[i].fireballs[ff][2] * 0.2 * _fpsr;
+ spellinfo[i].fireballs[ff][1] = ay + spellinfo[i].fireballs[ff][3] * 0.2 * _fpsr;
+
+ xloc = spellinfo[i].fireballs[ff][0] + (int)(RND() * 3) - 1;
+ yloc = spellinfo[i].fireballs[ff][1] + (int)(RND() * 3) - 1;
+
+ rcDest.left = xloc;
+ rcDest.top = yloc;
+
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ }
+
+ if (xloc < -1 || yloc < -1 || xloc > 304 || yloc > 224)
+ spellinfo[i].ballon[ff] = 0;
+ }
+
+ _spellimg->setAlpha(255, true);
+ }
+
+ spellinfo[i].frame = spellinfo[i].frame - 0.2 * _fpsr;
+ if (spellinfo[i].frame < 0)
+ spellinfo[i].frame = 0;
+
+ if (spellinfo[i].damagewho == 1) {
+ for (int ff = 0; ff <= spellinfo[i].nfballs - 1; ff++) {
+ if (spellinfo[i].ballon[ff] == 1) {
+ xloc = spellinfo[i].fireballs[ff][0] + (int)(RND() * 3) - 1;
+ yloc = spellinfo[i].fireballs[ff][1] + (int)(RND() * 3) - 1;
+
+ xdif = (xloc + 8) - (_player.px + 12);
+ ydif = (yloc + 8) - (_player.py + 12);
+
+ if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
+ float damage = _npcinfo[spellinfo[i].npc].spelldamage * (1 + RND() * 0.5) / 3;
+
+ if (_player.hp > 0)
+ damagePlayer(damage);
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndFire]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // lightning bomb
+ if (spellnum == 8) {
+
+ cl1 = _videobuffer->format.RGBToColor(0, 32, 204);
+ cl2 = _videobuffer->format.RGBToColor(142, 173, 191);
+ cl3 = _videobuffer->format.RGBToColor(240, 240, 240);
+
+ float px = _player.px + 12;
+ float py = _player.py + 12;
+
+ int apx = px + (int)(RND() * 5 - 2);
+ int apy = py + (int)(RND() * 5 - 2);
+
+ for (int f = 0; f <= 0; f++) { // ??
+ int y = apy;
+ int orn = 0;
+ for (int x = apx; x <= 319; x++) {
+ int rn = (int)(RND() * 3);
+
+ if (orn == 0)
+ y = y - 1;
+ if (orn == 2)
+ y = y + 1;
+
+ drawLine(_videobuffer, x, y - 1, x, y + 2, cl1);
+ drawLine(_videobuffer, x, y, x, y + 1, cl3);
+
+ if (rn == 0)
+ drawLine(_videobuffer, x, y + 1, x, y + 1, cl2);
+ if (rn == 2)
+ drawLine(_videobuffer, x, y, x, y, cl2);
+
+ orn = rn;
+
+ if (spellinfo[i].damagewho == 0) {
+ for (int e = 1; e <= _lastnpc; e++) {
+
+ xdif = (x + 16) - (_npcinfo[e].x + 12);
+ ydif = (y + 16) - (_npcinfo[e].y + 12);
+
+ if ((abs(xdif) < 8 && abs(ydif) < 8)) {
+ float damage = 30 * (1 + RND() * 0.5);
+
+ if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks)
+ damageNPC(e, damage, 1);
+ }
+ }
+ }
+
+ // check for post damage
+ if (nposts > 0) {
+ for (int e = 0; e <= nposts - 1; e++) {
+ xdif = (xloc + 16) - (postinfo[e][0] + 8);
+ ydif = (yloc + 16) - (postinfo[e][1] + 8);
+
+ if ((abs(xdif) < 16 && abs(ydif) < 16)) {
+ _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+
+ rcSrc.left = postinfo[e][0] / 2;
+ rcSrc.top = postinfo[e][1] / 2;
+ rcSrc.setWidth(8);
+ rcSrc.setHeight(8);
+
+ _clipbg2->fillRect(rcSrc, 0);
+
+ addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ }
+ }
+ }
+ }
+
+ y = apy;
+ orn = 0;
+ for (int x = apx; x >= 0; x--) {
+ int rn = (int)(RND() * 3);
+
+ if (orn == 0)
+ y = y - 1;
+ if (orn == 2)
+ y = y + 1;
+
+ drawLine(_videobuffer, x, y - 1, x, y + 2, cl1);
+ drawLine(_videobuffer, x, y, x, y + 1, cl3);
+
+ if (rn == 0)
+ drawLine(_videobuffer, x, y + 1, x, y + 1, cl2);
+ if (rn == 2)
+ drawLine(_videobuffer, x, y, x, y, cl2);
+
+ orn = rn;
+
+ if (spellinfo[i].damagewho == 0) {
+ for (int e = 1; e <= _lastnpc; e++) {
+
+ xdif = (x + 16) - (_npcinfo[e].x + 12);
+ ydif = (y + 16) - (_npcinfo[e].y + 12);
+
+ if ((abs(xdif) < 8 && abs(ydif) < 8)) {
+ float damage = 30 * (1 + RND() * 0.5);
+
+ if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks)
+ damageNPC(e, damage, 1);
+ }
+ }
+ }
+
+ // check for post damage
+ if (nposts > 0) {
+ for (int e = 0; e <= nposts - 1; e++) {
+ xdif = (xloc + 16) - (postinfo[e][0] + 8);
+ ydif = (yloc + 16) - (postinfo[e][1] + 8);
+
+ if ((abs(xdif) < 16 && abs(ydif) < 16)) {
+ _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+
+ rcSrc.left = postinfo[e][0] / 2;
+ rcSrc.top = postinfo[e][1] / 2;
+ rcSrc.setWidth(8);
+ rcSrc.setHeight(8);
+
+ _clipbg2->fillRect(rcSrc, 0);
+
+ addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ }
+ }
+ }
+ }
+
+ int x = apx;
+ orn = 0;
+ for (y = apy; y <= 239; y++) {
+ int rn = (int)(RND() * 3);
+
+ if (orn == 0)
+ x = x - 1;
+ if (orn == 2)
+ x = x + 1;
+
+ drawLine(_videobuffer, x - 1, y, x + 2, y, cl1);
+ drawLine(_videobuffer, x, y, x + 1, y, cl3);
+
+ if (rn == 0)
+ drawLine(_videobuffer, x + 1, y, x + 1, y, cl2);
+ if (rn == 2)
+ drawLine(_videobuffer, x, y, x, y, cl2);
+
+ orn = rn;
+
+ if (spellinfo[i].damagewho == 0) {
+ for (int e = 1; e <= _lastnpc; e++) {
+ xdif = (x + 16) - (_npcinfo[e].x + 12);
+ ydif = (y + 16) - (_npcinfo[e].y + 12);
+
+ if ((abs(xdif) < 8 && abs(ydif) < 8)) {
+ float damage = 30 * (1 + RND() * 0.5);
+
+ if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks)
+ damageNPC(e, damage, 1);
+ }
+ }
+ }
+
+ // check for post damage
+ if (nposts > 0) {
+ for (int e = 0; e <= nposts - 1; e++) {
+ xdif = (xloc + 16) - (postinfo[e][0] + 8);
+ ydif = (yloc + 16) - (postinfo[e][1] + 8);
+
+ if ((abs(xdif) < 16 && abs(ydif) < 16)) {
+ _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+
+ rcSrc.left = postinfo[e][0] / 2;
+ rcSrc.top = postinfo[e][1] / 2;
+ rcSrc.setWidth(8);
+ rcSrc.setHeight(8);
+
+ _clipbg2->fillRect(rcSrc, 0);
+
+ addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ }
+ }
+ }
+ }
+
+ x = apx;
+ orn = 0;
+ for (y = apy; y >= 0; y--) {
+ int rn = (int)(RND() * 3);
+
+ if (orn == 0)
+ x = x - 1;
+ if (orn == 2)
+ x = x + 1;
+
+ drawLine(_videobuffer, x - 1, y, x + 2, y, cl1);
+ drawLine(_videobuffer, x, y, x + 1, y, cl3);
+
+ if (rn == 0)
+ drawLine(_videobuffer, x + 1, y, x + 1, y, cl2);
+ if (rn == 2)
+ drawLine(_videobuffer, x, y, x, y, cl2);
+
+ orn = rn;
+
+ if (spellinfo[i].damagewho == 0) {
+ for (int e = 1; e <= _lastnpc; e++) {
+ xdif = (x + 16) - (_npcinfo[e].x + 12);
+ ydif = (y + 16) - (_npcinfo[e].y + 12);
+
+ if ((abs(xdif) < 8 && abs(ydif) < 8)) {
+ float damage = 30 * (1 + RND() * 0.5);
+
+ if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks)
+ damageNPC(e, damage, 1);
+ }
+ }
+ }
+
+ // check for post damage
+ if (nposts > 0) {
+ for (int e = 0; e <= nposts - 1; e++) {
+ xdif = (xloc + 16) - (postinfo[e][0] + 8);
+ ydif = (yloc + 16) - (postinfo[e][1] + 8);
+
+ if ((abs(xdif) < 16 && abs(ydif) < 16)) {
+ _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+
+ rcSrc.left = postinfo[e][0] / 2;
+ rcSrc.top = postinfo[e][1] / 2;
+ rcSrc.setWidth(8);
+ rcSrc.setHeight(8);
+
+ _clipbg2->fillRect(rcSrc, 0);
+
+ addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ }
+ }
+ }
+ }
+ }
+
+ spellinfo[i].frame -= 0.5 * _fpsr;
+ if (spellinfo[i].frame < 0) {
+ spellinfo[i].frame = 0;
+ _forcepause = false;
+ }
+ }
+
+ // wizard 1 lightning
+ if (spellnum == 9) {
+
+ cl1 = _videobuffer->format.RGBToColor(0, 32, 204);
+ cl2 = _videobuffer->format.RGBToColor(142, 173, 191);
+ cl3 = _videobuffer->format.RGBToColor(240, 240, 240);
+
+ int px = spellinfo[i].enemyx + 12;
+ int py = spellinfo[i].enemyy + 24;
+
+ int apx = px + (int)(RND() * 20 - 10);
+ int apy = py + (int)(RND() * 20 - 10);
+
+ int x = apx;
+ int orn = 0;
+ for (int y = 0; y <= apy; y++) {
+ if (y < 240) {
+ int rn = (int)(RND() * 3);
+
+ if (orn == 0)
+ x = x - 1;
+ if (orn == 2)
+ x = x + 1;
+
+ drawLine(_videobuffer, x - 1, y, x + 2, y, cl1);
+ drawLine(_videobuffer, x, y, x + 1, y, cl3);
+
+ if (rn == 0)
+ drawLine(_videobuffer, x + 1, y, x + 1, y, cl2);
+ if (rn == 2)
+ drawLine(_videobuffer, x, y, x, y, cl2);
+
+ orn = rn;
+
+ if (spellinfo[i].damagewho == 1) {
+
+ xdif = (x + 8) - (_player.px + 12);
+ ydif = (y + 8) - (_player.py + 12);
+
+ if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
+ float damage = ((float)_player.hp * 0.75) * (RND() * 0.5 + 0.5);
+ if (damage < 5)
+ damage = 5;
+
+ if (_npcinfo[spellinfo[i].npc].spriteset == kMonsterBatKitty) {
+ if (damage < 50)
+ damage = 40 + (int)(RND() * 40);
+ }
+
+ if (_player.hp > 0)
+ damagePlayer(damage);
+ }
+ }
+ }
+ }
+
+ spellinfo[i].frame -= 0.5 * _fpsr;
+ if (spellinfo[i].frame < 0) {
+ spellinfo[i].frame = 0;
+
+ _npcinfo[spellinfo[i].npc].attacking = 0;
+ _npcinfo[spellinfo[i].npc].attacknext = _ticks + _npcinfo[spellinfo[i].npc].attackdelay;
+ }
+ }
+ }
+ }
+}
+
+void GriffonEngine::updateSpellsUnder() {
+ if (_forcepause)
+ return;
+
+ for (int i = 0; i < kMaxSpell; i++) {
+ if (spellinfo[i].frame > 0) {
+ int spellnum = spellinfo[i].spellnum;
+
+ // water
+ if (spellnum == 0) {
+ int fra = (32 - spellinfo[i].frame);
+ int fr = (int)((32 - spellinfo[i].frame) * 2) % 4;
+
+ rcSrc.left = fr * 48;
+ rcSrc.top = 96;
+ rcSrc.setWidth(48);
+ rcSrc.setHeight(48);
+
+ rcDest.left = spellinfo[i].enemyx - 12;
+ rcDest.top = spellinfo[i].enemyy - 8;
+
+ int f = 160;
+ if (fra < 8)
+ f = 160 * fra / 8;
+ if (fra > 24)
+ f = 160 * (1 - (fra - 24) / 8);
+
+ _spellimg->setAlpha(f, true);
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellimg->setAlpha(255, true);
+
+ spellinfo[i].frame = spellinfo[i].frame - 0.2 * _fpsr;
+ if (spellinfo[i].frame < 0)
+ spellinfo[i].frame = 0;
+
+
+ for (f = 1; f <= _lastnpc; f++) {
+ int xdif = spellinfo[i].enemyx - _npcinfo[f].x;
+ int ydif = spellinfo[i].enemyy - _npcinfo[f].y;
+
+ float dist = sqrt((float)(xdif * xdif + ydif * ydif));
+
+ if (dist > 20)
+ dist = 20;
+
+ if (dist > 5) {
+ float ratio = (1 - dist / 25);
+
+ float newx = _npcinfo[f].x + ratio * xdif / 3 * _fpsr;
+ float newy = _npcinfo[f].y + ratio * ydif / 3 * _fpsr;
+
+ int sx = (newx / 2 + 6);
+ int sy = (newy / 2 + 10);
+
+ unsigned int *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ unsigned int dq = *temp;
+
+ if (dq == 0) {
+ _npcinfo[f].x = newx;
+ _npcinfo[f].y = newy;
+ // _npcinfo[f].castpause = _ticks + 200;
+ } else {
+ int xpass = 0;
+ int ypass = 0;
+
+ sx = (newx / 2 + 6);
+ sy = (_npcinfo[f].y / 2 + 10);
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ dq = *temp;
+
+ if (dq == 0)
+ xpass = 1;
+
+
+ sx = (_npcinfo[f].x / 2 + 6);
+ sy = (newy / 2 + 10);
+ temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ dq = *temp;
+
+ if (dq == 0)
+ ypass = 1;
+
+ if (ypass == 1) {
+ newx = _npcinfo[f].x;
+ } else if (xpass == 1) {
+ newy = _npcinfo[f].y;
+ }
+
+ if (xpass == 1 || ypass == 1) {
+ _npcinfo[f].x = newx;
+ _npcinfo[f].y = newy;
+ // _npcinfo[f].castpause = _ticks + 200;
+ }
+ }
+ }
+ }
+ }
+
+ // fire
+ if (spellnum == 3) {
+ float fr = (32 - spellinfo[i].frame);
+
+ fr = fr * fr * (1 - cos(3.14159 / 4 + 3.14159 / 4 * fr / 32));
+
+ if (fr > 32)
+ fr = 32;
+
+ float s = 8;
+ if (spellinfo[i].frame < 8)
+ s = spellinfo[i].frame;
+
+ int fra = (int)fr;
+
+ for (int f = 0; f <= 4; f++) {
+ for (int x = 0; x <= fra; x += 2) {
+ if (spellinfo[i].legalive[f] >= x) {
+ _spellimg->setAlpha(192 * sin(3.14159 * x / 32) * s / 8, true);
+
+ float an = 360 / 5 * f + x / 32 * 180;
+
+ rcSrc.left = 16 * (int)(RND() * 2);
+ rcSrc.top = 80;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
+
+ float xloc = (float)(spellinfo[i].enemyx + 4 + x * 2 * cos(3.14159 / 180 * an) + (int)(RND() * 3) - 1);
+ float yloc = (float)(spellinfo[i].enemyy + 4 + x * 2 * sin(3.14159 / 180 * an) + (int)(RND() * 3) - 1);
+ rcDest.left = (int)xloc;
+ rcDest.top = (int)yloc;
+
+ if (xloc > -1 && xloc < 304 && yloc > -1 && yloc < 224) {
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+
+ int sx = (xloc / 2 + 4);
+ int sy = (yloc / 2 + 8);
+
+ unsigned int *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ unsigned int dq = *temp;
+
+ if (dq > 1000 && x > 4)
+ spellinfo[i].legalive[f] = x;
+
+ if (spellinfo[i].damagewho == 0) {
+ for (int e = 1; e <= _lastnpc; e++) {
+ float xdif = (xloc + 8) - (_npcinfo[e].x + 12);
+ float ydif = (yloc + 8) - (_npcinfo[e].y + 12);
+
+ if ((abs(xdif) < 8 && abs(ydif) < 8)) {
+ float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
+
+ if (_npcinfo[e].spriteset == kMonsterFireHydra)
+ damage = -damage;
+ if (_npcinfo[e].spriteset == kMonsterFinalBoss)
+ damage = -damage;
+ if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
+ damageNPC(e, damage, 1);
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndFire]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+ }
+ }
+ }
+ }
+
+ if (spellinfo[i].damagewho == 1) {
+ float xdif = (xloc + 8) - (_player.px + 12);
+ float ydif = (yloc + 8) - (_player.py + 12);
+
+ if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
+ float damage = (float)_npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
+
+ if (_player.hp > 0) {
+ damagePlayer(damage);
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndFire]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+ }
+ }
+ }
+
+ // check for post damage
+ if (nposts > 0) {
+ for (int e = 0; e <= nposts - 1; e++) {
+ float xdif = (xloc + 8) - (postinfo[e][0] + 8);
+ float ydif = (yloc + 8) - (postinfo[e][1] + 8);
+
+ if ((abs(xdif) < 8 && abs(ydif) < 8)) {
+ _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
+ _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+
+ rcSrc.left = postinfo[e][0] / 2;
+ rcSrc.top = postinfo[e][1] / 2;
+ rcSrc.setWidth(8);
+ rcSrc.setHeight(8);
+
+ _clipbg2->fillRect(rcSrc, 0);
+
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndFire]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+
+ addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ _spellimg->setAlpha(255, true);
+
+ spellinfo[i].frame = spellinfo[i].frame - 0.2 * _fpsr;
+ if (spellinfo[i].frame < 0)
+ spellinfo[i].frame = 0;
+
+
+ }
+
+
+ // sprite 6 spitfire
+ if (spellnum == 7) {
+ float xspan = spellinfo[i].enemyx - spellinfo[i].homex;
+ float yspan = spellinfo[i].enemyy - spellinfo[i].homey;
+ float fr = (32 - spellinfo[i].frame);
+
+ for (int f = 0; f <= 7; f++) {
+ int alpha = 0;
+ float xx = 0;
+ if (fr > f * 2 && fr < f * 2 + 16)
+ xx = fr - f * 2;
+ if (xx < 8)
+ alpha = 255 * xx / 8;
+ if (xx > 8)
+ alpha = 255 * (1 - (xx - 8) / 8);
+ float yy = 16 * sin(3.141592 / 2 * xx / 16) - 8;
+
+ if (alpha < 0)
+ alpha = 0;
+ if (alpha > 255)
+ alpha = 255;
+
+ _spellimg->setAlpha(alpha, true);
+
+ rcSrc.left = 16 * (int)(RND() * 2);
+ rcSrc.top = 80;
+ rcSrc.setWidth(16);
+ rcSrc.setHeight(16);
+
+ float xloc = spellinfo[i].homex + xspan / 7 * f;
+ float yloc = spellinfo[i].homey + yspan / 7 * f - yy;
+
+ rcDest.left = xloc;
+ rcDest.top = yloc;
+
+ if (xloc > -16 && xloc < 320 && yloc > -16 && yloc < 240) {
+ _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+
+ if (spellinfo[i].damagewho == 1) {
+ float xdif = (xloc + 8) - (_player.px + 12);
+ float ydif = (yloc + 8) - (_player.py + 12);
+
+ if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks && alpha > 64) {
+ float damage = (float)_npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
+
+ if (_player.hp > 0) {
+ damagePlayer(damage);
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndFire]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+ }
+
+ }
+ }
+
+ }
+
+ }
+
+ _spellimg->setAlpha(255, true);
+ spellinfo[i].frame = spellinfo[i].frame - 0.5 * _fpsr;
+ if (spellinfo[i].frame < 0)
+ spellinfo[i].frame = 0;
+
+ if (ABS(spellinfo[i].frame) < 0) {
+ _npcinfo[spellinfo[i].npc].attacking = 0;
+ _npcinfo[spellinfo[i].npc].attacknext = _ticks + _npcinfo[spellinfo[i].npc].attackdelay;
+ }
+ }
+ }
+ }
+}
+
+
+} // end of namespace Griffon
diff --git a/engines/griffon/module.mk b/engines/griffon/module.mk
index 43a198b..857fcd7 100644
--- a/engines/griffon/module.mk
+++ b/engines/griffon/module.mk
@@ -12,6 +12,7 @@ MODULE_OBJS := \
gfx.o \
griffon.o \
input.o \
+ logic.o \
resources.o \
saveload.o \
sound.o
Commit: 775aa1a63b4d44d2eb77b3e53c4e10348440a6e2
https://github.com/scummvm/scummvm/commit/775aa1a63b4d44d2eb77b3e53c4e10348440a6e2
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Use CLIP where possible
Changed paths:
engines/griffon/cutscenes.cpp
engines/griffon/dialogs.cpp
engines/griffon/draw.cpp
engines/griffon/logic.cpp
diff --git a/engines/griffon/cutscenes.cpp b/engines/griffon/cutscenes.cpp
index a3df23d..a61f564 100644
--- a/engines/griffon/cutscenes.cpp
+++ b/engines/griffon/cutscenes.cpp
@@ -123,30 +123,19 @@ const char *story2[27] = {
};
void GriffonEngine::showLogos() {
- float y;
- int _ticks1;
-
_ticks = g_system->getMillis();
- _ticks1 = _ticks;
-
- y = 0.0;
+ int ticks1 = _ticks;
do {
- y = 255.0;
- if (_ticks < _ticks1 + 1000) {
- y = 255.0 * ((float)(_ticks - _ticks1) / 1000.0);
- if (y < 0.0)
- y = 0.0;
- if (y > 255.0)
- y = 255.0;
+ float y = 255.0;
+ if (_ticks < ticks1 + 1000) {
+ y = 255.0 * ((float)(_ticks - ticks1) / 1000.0);
+ y = CLIP<float>(y, 0.0, 255.0);
}
- if (_ticks > _ticks1 + 3000) {
- y = 255.0 - 255.0 * ((float)(_ticks - _ticks1 - 3000.0) / 1000.0);
- if (y < 0.0)
- y = 0.0;
- if (y > 255.0)
- y = 255.0;
+ if (_ticks > ticks1 + 3000) {
+ y = 255.0 - 255.0 * ((float)(_ticks - ticks1 - 3000.0) / 1000.0);
+ y = CLIP<float>(y, 0.0, 255.0);
}
_videobuffer->fillRect(Common::Rect(0, 0, 320, 240), 0);
@@ -174,7 +163,7 @@ void GriffonEngine::showLogos() {
}
g_system->delayMillis(10);
- if (_ticks > _ticks1 + 4000)
+ if (_ticks > ticks1 + 4000)
break;
} while (!_shouldQuit);
}
@@ -295,7 +284,7 @@ void GriffonEngine::endOfGame() {
setChannelVolume(_musicchannel, 0);
}
- int _ticks1 = _ticks;
+ int ticks1 = _ticks;
int ya = 0;
_videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
@@ -316,15 +305,11 @@ void GriffonEngine::endOfGame() {
}
ya = 0;
- if (_ticks < _ticks1 + 1500) {
- ya = (255 * (_ticks - _ticks1)) / 1500;
- if (ya < 0)
- ya = 0;
- if (ya > 255)
- ya = 255;
- } else {
+ if (_ticks < ticks1 + 1500) {
+ ya = (255 * (_ticks - ticks1)) / 1500;
+ ya = CLIP(ya, 0, 255);
+ } else
break;
- }
_videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
@@ -352,7 +337,7 @@ void GriffonEngine::endOfGame() {
}
} while (1);
- _ticks1 = _ticks;
+ ticks1 = _ticks;
ya = 0;
float y = 140;
@@ -382,12 +367,9 @@ void GriffonEngine::endOfGame() {
}
ya = 255;
- if (_ticks < _ticks1 + 1000) {
- ya = 255 * (_ticks - _ticks1) / 1000;
- if (ya < 0)
- ya = 0;
- if (ya > 255)
- ya = 255;
+ if (_ticks < ticks1 + 1000) {
+ ya = 255 * (_ticks - ticks1) / 1000;
+ ya = CLIP(ya, 0, 255);
}
_videobuffer->setAlpha(ya);
@@ -427,14 +409,15 @@ void GriffonEngine::endOfGame() {
} while (1);
- _ticks1 = _ticks;
+ ticks1 = _ticks;
int y1 = 0;
_videobuffer2->copyRectToSurface(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
do {
- if (_ticks < _ticks1 + 1500) {
- y1 = 255 * (_ticks - _ticks1) / 1500;
+ if (_ticks < ticks1 + 1500) {
+ y1 = 255 * (_ticks - ticks1) / 1500;
+
if (y1 < 0)
y1 = 0;
if (y1 > 255)
@@ -472,19 +455,16 @@ void GriffonEngine::endOfGame() {
int keywait = 2000 + _ticks;
- _ticks1 = _ticks;
+ ticks1 = _ticks;
y1 = 0;
do {
_videobuffer->copyRectToSurface(_theendimg->getPixels(), _theendimg->pitch, 0, 0, _theendimg->w, _theendimg->h);
y1 = 255;
- if (_ticks < _ticks1 + 1000) {
- y1 = 255 * (_ticks - _ticks1) / 1000;
- if (y1 < 0)
- y1 = 0;
- if (y1 > 255)
- y1 = 255;
+ if (_ticks < ticks1 + 1000) {
+ y1 = 255 * (_ticks - ticks1) / 1000;
+ y1 = CLIP(y1, 0, 255);
}
_videobuffer->setAlpha(y1);
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 03254ce..e30b476 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -124,10 +124,7 @@ void GriffonEngine::title(int mode) {
float yf = 255.0;
if (_ticks < _ticks1 + 1000) {
yf = 255.0 * ((float)(_ticks - _ticks1) / 1000.0);
- if (y < 0.0)
- yf = 0.0;
- if (y > 255.0)
- yf = 255.0;
+ yf = CLIP<float>(yf, 0.0, 255.0);
}
_videobuffer->setAlpha((int)yf);
@@ -274,10 +271,7 @@ void GriffonEngine::configMenu() {
if (i == 15 || i == 17) {
int vol = (i == 15 ? config.musicvol : config.effectsvol) * 9 / 255;
- if (vol < 0)
- vol = 0;
- if (vol > 9)
- vol = 9;
+ vol = CLIP(vol, 0, 9);
strcpy(line, "[----------]");
line[vol + 1] = 'X';
@@ -322,10 +316,7 @@ void GriffonEngine::configMenu() {
float yy = 255.0;
if (_ticks < _ticks1 + 1000) {
yy = 255.0 * ((float)(_ticks - _ticks1) / 1000.0);
- if (yy < 0.0)
- yy = 0.0;
- if (yy > 255.0)
- yy = 255.0;
+ yy = CLIP<float>(yy, 0.0, 255.0);
}
_videobuffer->setAlpha((int)yy);
@@ -747,10 +738,7 @@ void GriffonEngine::saveLoadNew() {
int yy = 255;
if (_ticks < _ticks1 + 1000) {
yy = 255 * (_ticks - _ticks1) / 1000;
- if (yy < 0)
- yy = 0;
- if (yy > 255)
- yy = 255;
+ yy = CLIP(yy, 0, 255);
}
_videobuffer->setAlpha((int)yy);
diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp
index 7d364f7..50d3fe4 100644
--- a/engines/griffon/draw.cpp
+++ b/engines/griffon/draw.cpp
@@ -996,11 +996,11 @@ void GriffonEngine::drawNPCs(int mode) {
_videobuffer->fillRect(rcDest, ccc);
- int pass = 1;
+ bool pass = true;
if (_npcinfo[i].spriteset == kMonsterBoss1)
- pass = 0;
- if (pass == 1)
+ pass = false;
+ if (pass)
drawOver(npx, npy);
}
@@ -1044,17 +1044,17 @@ void GriffonEngine::drawOver(int modx, int mody) {
rcDest.setWidth(16);
rcDest.setHeight(16);
- int pass = 1;
+ bool pass = true;
if (curtilel == 1) {
for (int ff = 0; ff <= 5; ff++) {
int ffa = 20 * 5 - 1 + ff * 20;
int ffb = 20 * 5 + 4 + ff * 20;
if (curtile > ffa && curtile < ffb)
- pass = 0;
+ pass = false;
}
}
- if (pass == 1)
+ if (pass)
_tiles[curtilel]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -1096,11 +1096,11 @@ void GriffonEngine::drawPlayer() {
long ccc = _videobuffer->format.RGBToColor(224, 224, 64);
- int pass = 0;
+ bool pass = false;
if (_player.hp <= _player.maxhp * 0.25)
- pass = 1;
+ pass = true;
- if (pass == 1) {
+ if (pass) {
ccc = _videobuffer->format.RGBToColor(255, 255, 255);
if ((int)(_player.hpflash) == 1)
ccc = _videobuffer->format.RGBToColor(255, 0, 0);
@@ -1200,10 +1200,7 @@ void GriffonEngine::drawView() {
}
void GriffonEngine::swash() {
- float y;
-
- y = 0;
-
+ float y = 0.0;
do {
y = y + 1 * _fpsr;
diff --git a/engines/griffon/logic.cpp b/engines/griffon/logic.cpp
index 50ca72c..f762458 100644
--- a/engines/griffon/logic.cpp
+++ b/engines/griffon/logic.cpp
@@ -2336,11 +2336,7 @@ void GriffonEngine::updateSpellsUnder() {
alpha = 255 * (1 - (xx - 8) / 8);
float yy = 16 * sin(3.141592 / 2 * xx / 16) - 8;
- if (alpha < 0)
- alpha = 0;
- if (alpha > 255)
- alpha = 255;
-
+ alpha = CLIP(alpha, 0, 255);
_spellimg->setAlpha(alpha, true);
rcSrc.left = 16 * (int)(RND() * 2);
Commit: ac362bafa764dd84e1a6398ca7601e056c3c5142
https://github.com/scummvm/scummvm/commit/ac362bafa764dd84e1a6398ca7601e056c3c5142
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix bug introduced in original C conversion
Changed paths:
engines/griffon/cutscenes.cpp
diff --git a/engines/griffon/cutscenes.cpp b/engines/griffon/cutscenes.cpp
index a61f564..72fc08d 100644
--- a/engines/griffon/cutscenes.cpp
+++ b/engines/griffon/cutscenes.cpp
@@ -417,14 +417,10 @@ void GriffonEngine::endOfGame() {
do {
if (_ticks < ticks1 + 1500) {
y1 = 255 * (_ticks - ticks1) / 1500;
-
- if (y1 < 0)
- y1 = 0;
- if (y1 > 255)
- y1 = 255;
- else
- break;
+ y1 = CLIP(y1, 0, 255);
}
+ else
+ break;
_videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
Commit: b1bd677ad0a820bf9df71e3e269d3664e572c1ed
https://github.com/scummvm/scummvm/commit/b1bd677ad0a820bf9df71e3e269d3664e572c1ed
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix broken comparison
Changed paths:
engines/griffon/logic.cpp
diff --git a/engines/griffon/logic.cpp b/engines/griffon/logic.cpp
index f762458..bbbca90 100644
--- a/engines/griffon/logic.cpp
+++ b/engines/griffon/logic.cpp
@@ -2380,7 +2380,7 @@ void GriffonEngine::updateSpellsUnder() {
if (spellinfo[i].frame < 0)
spellinfo[i].frame = 0;
- if (ABS(spellinfo[i].frame) < 0) {
+ if (ABS(spellinfo[i].frame) < kEpsilon) {
_npcinfo[spellinfo[i].npc].attacking = 0;
_npcinfo[spellinfo[i].npc].attacknext = _ticks + _npcinfo[spellinfo[i].npc].attackdelay;
}
Commit: a27a54433c7b2cfcdd97a8f12e9e38b69961fdb9
https://github.com/scummvm/scummvm/commit/a27a54433c7b2cfcdd97a8f12e9e38b69961fdb9
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Simplify some assignments, reduce some variable scopes
Changed paths:
engines/griffon/cutscenes.cpp
engines/griffon/dialogs.cpp
engines/griffon/draw.cpp
engines/griffon/logic.cpp
diff --git a/engines/griffon/cutscenes.cpp b/engines/griffon/cutscenes.cpp
index 72fc08d..79bc5da 100644
--- a/engines/griffon/cutscenes.cpp
+++ b/engines/griffon/cutscenes.cpp
@@ -169,10 +169,6 @@ void GriffonEngine::showLogos() {
}
void GriffonEngine::intro() {
- float xofs = 0;
- float ld = 0, add;
- int cnt = 0;
-
_videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
_videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
@@ -194,7 +190,9 @@ void GriffonEngine::intro() {
_secstart = 0;
bool ldstop = false;
-
+ int cnt = 0;
+ float xofs = 0.0;
+ float ld = 0.0;
do {
Common::Rect rc;
@@ -223,11 +221,9 @@ void GriffonEngine::intro() {
}
for (int i = 0; i <= 37; i++) {
- int yy, x;
-
- yy = y + i * 10;
+ int yy = y + i * 10;
if (yy > -8 && yy < 240) {
- x = 160 - strlen(story[i]) * 4;
+ int x = 160 - strlen(story[i]) * 4;
drawString(_videobuffer, story[i], x, yy, 4);
}
@@ -251,7 +247,7 @@ void GriffonEngine::intro() {
_fp = 0;
}
- add = 0.5 * _fpsr;
+ float add = 0.5 * _fpsr;
if (add > 1)
add = 1;
xofs += add;
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index e30b476..8fe7e8c 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -633,11 +633,8 @@ void GriffonEngine::saveLoadNew() {
loadPlayer(ff);
if (_playera.level > 0) {
- char line[256];
- int sx, sy, cc, ss, nx;
-
- sx = 8;
- sy = 57 + ff * 48;
+ int sx = 8;
+ int sy = 57 + ff * 48;
// time
int ase = _asecstart;
@@ -646,12 +643,13 @@ void GriffonEngine::saveLoadNew() {
int m = ((ase - (ase % 60)) / 60);
int s = (ase - m * 60);
+ char line[256];
sprintf(line, "Game Time: %02i:%02i:%02i", h, m, s);
drawString(_videobuffer, line, 160 - strlen(line) * 4, sy, 0);
sx = 12;
sy = sy + 11;
- cc = 0;
+ int cc = 0;
sprintf(line, "Health: %i/%i", _playera.hp, _playera.maxhp);
drawString(_videobuffer, line, sx, sy, cc);
@@ -666,7 +664,7 @@ void GriffonEngine::saveLoadNew() {
rcSrc.left = sx + 15 * 8 + 24;
rcSrc.top = sy + 1;
- ss = (_playera.sword - 1) * 3;
+ int ss = (_playera.sword - 1) * 3;
if (_playera.sword == 3)
ss = 18;
_itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
@@ -683,7 +681,7 @@ void GriffonEngine::saveLoadNew() {
ss = 20;
_itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
- nx = rcSrc.left + 13 + 3 * 8;
+ int nx = rcSrc.left + 13 + 3 * 8;
rcSrc.left = nx - 17;
if (_playera.foundspell[0] == 1) {
diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp
index 50d3fe4..e1eb308 100644
--- a/engines/griffon/draw.cpp
+++ b/engines/griffon/draw.cpp
@@ -747,9 +747,9 @@ void GriffonEngine::drawNPCs(int mode) {
float frame = _npcinfo[i].frame;
int cframe = _npcinfo[i].cframe;
- frame = frame + 0.5 * _fpsr;
+ frame += 0.5 * _fpsr;
while (frame >= 16)
- frame = frame - 16;
+ frame -= 16;
cframe = (int)(frame);
if (cframe > 16)
@@ -810,9 +810,9 @@ void GriffonEngine::drawNPCs(int mode) {
float frame = _npcinfo[i].frame2;
- frame = frame + 0.5 * _fpsr;
+ frame += 0.5 * _fpsr;
while (frame >= 16)
- frame = frame - 16;
+ frame -= 16;
_npcinfo[i].frame2 = frame;
@@ -842,7 +842,7 @@ void GriffonEngine::drawNPCs(int mode) {
float fr3 = frame - 3 + i2;
if (fr3 < 0)
- fr3 = fr3 + 16;
+ fr3 += 16;
rcDest.left = (float)(sx + 36 + ii * 8 - ii * cos(3.14159 * 2 * (fr3 - ii) / 16) * 2);
rcDest.top = (float)(sy + 16 + ii * sin(3.14159 * 2 * (fr3 - ii) / 16) * 3 - ii); // * 4
@@ -939,9 +939,9 @@ void GriffonEngine::drawNPCs(int mode) {
float frame = _npcinfo[i].frame;
int cframe = _npcinfo[i].cframe;
- frame = frame + 0.5 * _fpsr;
+ frame += 0.5 * _fpsr;
while (frame >= 16)
- frame = frame - 16;
+ frame -= 16;
cframe = (int)(frame);
if (cframe > 16)
diff --git a/engines/griffon/logic.cpp b/engines/griffon/logic.cpp
index bbbca90..31bd5c4 100644
--- a/engines/griffon/logic.cpp
+++ b/engines/griffon/logic.cpp
@@ -84,9 +84,9 @@ void GriffonEngine::updateAnims() {
// _objectinfo[i][6] = 0; // ?? out of bounds
if (nframes > 1) {
- frame = frame + o_animspd / 50 * _fpsr;
+ frame += o_animspd / 50 * _fpsr;
while (frame >= nframes)
- frame = frame - nframes;
+ frame -= nframes;
cframe = (int)frame; // truncate fractional part
if (cframe > nframes)
@@ -515,13 +515,12 @@ void GriffonEngine::updateNPCs() {
if (_npcinfo[i].moving == 1) {
float frame = _npcinfo[i].frame;
- int cframe = _npcinfo[i].cframe;
- frame = frame + aspd * _fpsr;
+ frame += aspd * _fpsr;
while (frame >= 16)
- frame = frame - 16;
+ frame -= 16;
- cframe = (int)(frame);
+ int cframe = (int)(frame);
if (cframe > 16)
cframe = 16 - 1;
if (cframe < 0)
Commit: 92e22e4153963b8bd57f149dc335ee852beaf7c0
https://github.com/scummvm/scummvm/commit/92e22e4153963b8bd57f149dc335ee852beaf7c0
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Remove some dead code
Changed paths:
engines/griffon/draw.cpp
engines/griffon/logic.cpp
diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp
index e1eb308..37d9f46 100644
--- a/engines/griffon/draw.cpp
+++ b/engines/griffon/draw.cpp
@@ -745,23 +745,18 @@ void GriffonEngine::drawNPCs(int mode) {
_npcinfo[i].floating = _npcinfo[i].floating - 16;
float frame = _npcinfo[i].frame;
- int cframe = _npcinfo[i].cframe;
frame += 0.5 * _fpsr;
while (frame >= 16)
frame -= 16;
- cframe = (int)(frame);
- if (cframe > 16)
- cframe = 16 - 1;
+ int cframe = (int)(frame);
if (cframe < 0)
cframe = 0;
_npcinfo[i].frame = frame;
_npcinfo[i].cframe = cframe;
- cframe = _npcinfo[i].cframe;
-
rcSrc.left = 74 * wdir;
rcSrc.top = (int)(cframe / 4) * 48;
rcSrc.setWidth(74);
@@ -937,23 +932,18 @@ void GriffonEngine::drawNPCs(int mode) {
_npcinfo[i].floating = _npcinfo[i].floating - 16;
float frame = _npcinfo[i].frame;
- int cframe = _npcinfo[i].cframe;
frame += 0.5 * _fpsr;
while (frame >= 16)
frame -= 16;
- cframe = (int)(frame);
- if (cframe > 16)
- cframe = 16 - 1;
+ int cframe = (int)(frame);
if (cframe < 0)
cframe = 0;
_npcinfo[i].frame = frame;
_npcinfo[i].cframe = cframe;
- cframe = _npcinfo[i].cframe;
-
rcSrc.left = 0;
rcSrc.top = 0;
rcSrc.setWidth(99);
diff --git a/engines/griffon/logic.cpp b/engines/griffon/logic.cpp
index 31bd5c4..310bfcc 100644
--- a/engines/griffon/logic.cpp
+++ b/engines/griffon/logic.cpp
@@ -80,7 +80,6 @@ void GriffonEngine::updateAnims() {
int nframes = _objectInfo[i][0];
int o_animspd = _objectInfo[i][3];
float frame = _objectFrame[i][0];
- int cframe = _objectFrame[i][1];
// _objectinfo[i][6] = 0; // ?? out of bounds
if (nframes > 1) {
@@ -88,9 +87,7 @@ void GriffonEngine::updateAnims() {
while (frame >= nframes)
frame -= nframes;
- cframe = (int)frame; // truncate fractional part
- if (cframe > nframes)
- cframe = nframes - 1;
+ int cframe = (int)frame; // truncate fractional part
if (cframe < 0)
cframe = 0;
@@ -521,8 +518,6 @@ void GriffonEngine::updateNPCs() {
frame -= 16;
int cframe = (int)(frame);
- if (cframe > 16)
- cframe = 16 - 1;
if (cframe < 0)
cframe = 0;
@@ -1248,7 +1243,6 @@ void GriffonEngine::updateNPCs() {
void GriffonEngine::updateSpells() {
int foundel[5];
- float npx, npy;
long cl1, cl2, cl3;
int ll[4][2];
@@ -1450,9 +1444,6 @@ void GriffonEngine::updateSpells() {
ydif = (yloc + 24) - (_player.py + 12);
if ((abs(xdif) < 24 && abs(ydif) < 24) && _player.pause < _ticks) {
- npx = _player.px;
- npy = _player.py;
-
float damage = (float)_npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
@@ -1611,8 +1602,8 @@ void GriffonEngine::updateSpells() {
spellinfo[i].frame = 0;
_forcepause = false;
- npx = _player.px + 12;
- npy = _player.py + 20;
+ float npx = _player.px + 12;
+ float npy = _player.py + 20;
int lx = (int)npx / 16;
int ly = (int)npy / 16;
Commit: 57af73cb18c243d6af86cbaf56da73eb0f2cc96e
https://github.com/scummvm/scummvm/commit/57af73cb18c243d6af86cbaf56da73eb0f2cc96e
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Various code simplifications and renaming
Changed paths:
engines/griffon/combat.cpp
engines/griffon/dialogs.cpp
engines/griffon/draw.cpp
engines/griffon/engine.cpp
engines/griffon/griffon.h
engines/griffon/input.cpp
engines/griffon/logic.cpp
engines/griffon/resources.cpp
engines/griffon/saveload.cpp
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp
index ecdcf55..2ef46c7 100644
--- a/engines/griffon/combat.cpp
+++ b/engines/griffon/combat.cpp
@@ -48,7 +48,7 @@ void GriffonEngine::attack() {
int ly = (int)npy / 16;
// if facing up
- if (_player.walkdir == 0) {
+ if (_player.walkDir == 0) {
if (ly > 0) {
int o2 = 0; // ??
int o = _objectMap[lx][ly - 1];
@@ -119,8 +119,8 @@ void GriffonEngine::attack() {
}
if (oscript == kScriptFindCtystal) {
- _player.foundspell[0] = 1;
- _player.spellcharge[0] = 0;
+ _player.foundSpell[0] = 1;
+ _player.spellCharge[0] = 0;
addFloatIcon(7, lx * 16, (ly - 1) * 16);
@@ -409,7 +409,7 @@ void GriffonEngine::attack() {
}
attacking = true;
- _player.attackframe = 0;
+ _player.attackFrame = 0;
movingup = false;
movingdown = false;
movingleft = false;
@@ -444,8 +444,8 @@ void GriffonEngine::castSpell(int spellnum, float homex, float homey, float enem
spellinfo[i].frame = 32.0f;
if (damagewho == 0) {
- spellinfo[i].strength = _player.spellstrength / 100;
- if (ABS(_player.spellstrength - 100) < kEpsilon)
+ spellinfo[i].strength = _player.spellStrength / 100;
+ if (ABS(_player.spellStrength - 100) < kEpsilon)
spellinfo[i].strength = 1.5f;
}
@@ -518,26 +518,26 @@ void GriffonEngine::checkHit() {
float ps = _player.sword;
if (ps > 1)
- ps = ps * 0.75;
- float damage = (float)_player.sworddamage * (1.0 + RND() * 1.0) * _player.attackstrength / 100.0 * ps;
+ ps *= 0.75;
+ float damage = (float)_player.swordDamage * (1.0 + RND() * 1.0) * _player.attackStrength / 100.0 * ps;
if (_console->_godMode)
damage = 1000;
- if (ABS(_player.attackstrength - 100) < kEpsilon)
+ if (ABS(_player.attackStrength - 100) < kEpsilon)
damage *= 1.5;
bool hit = false;
- if (_player.walkdir == 0) {
+ if (_player.walkDir == 0) {
if (abs(xdif) <= 8 && ydif >= 0 && ydif < 8)
hit = true;
- } else if (_player.walkdir == 1) {
+ } else if (_player.walkDir == 1) {
if (abs(xdif) <= 8 && ydif <= 0 && ydif > -8)
hit = true;
- } else if (_player.walkdir == 2) {
+ } else if (_player.walkDir == 2) {
if (abs(ydif) <= 8 && xdif >= -8 && xdif < 8)
hit = true;
- } else if (_player.walkdir == 3) {
+ } else if (_player.walkDir == 3) {
if (abs(ydif) <= 8 && xdif <= 8 && xdif > -8)
hit = true;
}
@@ -593,7 +593,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
_npcinfo[npcnum].pause = _ticks + 900;
if (spell == 0)
- _player.attackstrength = ratio;
+ _player.attackStrength = ratio;
}
addFloatText(line, _npcinfo[npcnum].x + 12 - 4 * strlen(line), _npcinfo[npcnum].y + 16, fcol);
@@ -603,7 +603,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
// if enemy is killed
if (_npcinfo[npcnum].hp == 0) {
- _player.exp = _player.exp + _npcinfo[npcnum].maxhp;
+ _player.exp += _npcinfo[npcnum].maxhp;
if (_npcinfo[npcnum].spriteset == kMonsterBabyDragon || _npcinfo[npcnum].spriteset == kMonsterPriest ||
_npcinfo[npcnum].spriteset == kMonsterRedDragon) {
@@ -676,7 +676,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
int ly = (int)npy / 16;
if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
+ _player.py += 16;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
_scriptflag[kScriptMasterKey][0] = 1;
}
@@ -708,7 +708,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
int ly = (int)npy / 16;
if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
+ _player.py += 16;
_scriptflag[kScriptFindCtystal][0] = 1;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
}
@@ -718,17 +718,17 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
if (_npcinfo[npcnum].script == kScriptFindShield && _scriptflag[kScriptFindShield][0] == 0) {
_triggerloc[9][7] = 5004;
- int curtile = 40;
- int curtilel = 0;
- int curtilex = curtile % 20;
- int curtiley = (curtile - curtilex) / 20;
+ int curTile = 40;
+ int curTileL = 0;
+ int curTileX = curTile % 20;
+ int curTileY = (curTile - curTileX) / 20;
int l = 0; // ?? not defined in original code
- _tileinfo[l][9][7][0] = curtile + 1;
+ _tileinfo[l][9][7][0] = curTile + 1;
_tileinfo[l][9][7][1] = 0;
- rcSrc.left = curtilex * 16;
- rcSrc.top = curtiley * 16;
+ rcSrc.left = curTileX * 16;
+ rcSrc.top = curTileY * 16;
rcSrc.setWidth(16);
rcSrc.setHeight(16);
@@ -737,7 +737,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
rcDest.setWidth(16);
rcDest.setHeight(16);
- _tiles[curtilel]->blit(*_mapbg, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _tiles[curTileL]->blit(*_mapbg, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
// firehydra sword chest
@@ -766,7 +766,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
int ly = (int)npy / 16;
if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
+ _player.py += 16;
_scriptflag[kScriptFindSword][0] = 1;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
}
@@ -799,7 +799,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
int ly = (int)npy / 16;
if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
+ _player.py += 16;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
_scriptflag[kScriptGardenMasterKey][0] = 1;
}
@@ -832,7 +832,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
int ly = (int)npy / 16;
if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
+ _player.py += 16;
_scriptflag[s][0] = 1;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
}
@@ -865,7 +865,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
int ly = (int)npy / 16;
if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
+ _player.py += 16;
}
}
@@ -895,7 +895,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
int ly = (int)npy / 16;
if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
+ _player.py += 16;
_scriptflag[kScriptArmourChest][0] = 1;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
}
@@ -927,7 +927,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
int ly = (int)npy / 16;
if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
+ _player.py += 16;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
_scriptflag[kScriptCitadelMasterKey][0] = 1;
}
@@ -959,7 +959,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
int ly = (int)npy / 16;
if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
+ _player.py += 16;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
_scriptflag[kScriptGetSword3][0] = 1;
@@ -980,7 +980,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
ly = (int)npy / 16;
if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
+ _player.py += 16;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
_scriptflag[kScriptShield3][0] = 1;
@@ -1002,7 +1002,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
ly = (int)npy / 16;
if (lx == cx && ly == cy)
- _player.py = _player.py + 16;
+ _player.py += 16;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
_scriptflag[kScriptArmour3][0] = 1;
}
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 8fe7e8c..d822945 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -148,7 +148,7 @@ void GriffonEngine::title(int mode) {
if (add > 1)
add = 1;
- xofs = xofs + add;
+ xofs += add;
if (xofs >= 320.0)
xofs -= 320.0;
@@ -407,7 +407,7 @@ void GriffonEngine::configMenu() {
cursel = 14;
}
if (_event.kbd.keycode == Common::KEYCODE_DOWN) {
- cursel++;
+ ++cursel;
if (cursel > 14)
cursel = MINCURSEL;
}
@@ -469,7 +469,7 @@ void GriffonEngine::saveLoadNew() {
int currow = 0;
int curcol = 0;
- int lowerlock = 0;
+ bool lowerLock = false;
_ticks = g_system->getMillis();
int _ticks1 = _ticks;
@@ -478,7 +478,7 @@ void GriffonEngine::saveLoadNew() {
do {
_videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
- y = y + 1 * _fpsr;
+ y += 1 * _fpsr;
rcDest.left = 256 + 256 * cos(3.141592 / 180 * clouddeg * 40);
rcDest.top = 192 + 192 * sin(3.141592 / 180 * clouddeg * 40);
@@ -529,34 +529,34 @@ void GriffonEngine::saveLoadNew() {
// LOAD GAME
if (currow == 0 && curcol == 1) {
- lowerlock = 1;
+ lowerLock = true;
currow = 1 + _saveslot;
tickpause = _ticks + 125;
}
// SAVE GAME
if (currow == 0 && curcol == 2) {
- lowerlock = 1;
+ lowerLock = true;
currow = 1;
tickpause = _ticks + 125;
}
- if (lowerlock == 1 && curcol == 1 && tickpause < _ticks) {
+ if (lowerLock && curcol == 1 && tickpause < _ticks) {
if (saveState(currow - 1)) {
_secstart = _secstart + _secsingame;
_secsingame = 0;
- lowerlock = 0;
+ lowerLock = false;
_saveslot = currow - 1;
currow = 0;
}
}
- if (lowerlock == 1 && curcol == 2 && tickpause < _ticks) {
+ if (lowerLock && curcol == 2 && tickpause < _ticks) {
if (loadState(currow - 1)) {
- _player.walkspd = 1.1f;
+ _player.walkSpeed = 1.1f;
_animspd = 0.5f;
attacking = false;
- _player.attackspd = 1.5f;
+ _player.attackSpeed = 1.5f;
_pgardens = false;
_ptown = false;
@@ -578,15 +578,15 @@ void GriffonEngine::saveLoadNew() {
switch (_event.kbd.keycode) {
case Common::KEYCODE_ESCAPE:
- if (lowerlock == 0)
+ if (!lowerLock)
return;
- lowerlock = 0;
+ lowerLock = false;
currow = 0;
tickpause = _ticks + 125;
break;
case Common::KEYCODE_DOWN:
- if (lowerlock == 1) {
- currow = currow + 1;
+ if (lowerLock) {
+ ++currow;
if (currow == 5)
currow = 1;
tickpause = _ticks + 125;
@@ -594,8 +594,8 @@ void GriffonEngine::saveLoadNew() {
break;
case Common::KEYCODE_UP:
- if (lowerlock == 1) {
- currow = currow - 1;
+ if (lowerLock) {
+ --currow;
if (currow == 0)
currow = 4;
tickpause = _ticks + 125;
@@ -603,8 +603,8 @@ void GriffonEngine::saveLoadNew() {
break;
case Common::KEYCODE_LEFT:
- if (lowerlock == 0) {
- curcol = curcol - 1;
+ if (!lowerLock) {
+ --curcol;
if (curcol == -1)
curcol = 3;
tickpause = _ticks + 125;
@@ -612,8 +612,8 @@ void GriffonEngine::saveLoadNew() {
break;
case Common::KEYCODE_RIGHT:
- if (lowerlock == 0) {
- curcol = curcol + 1;
+ if (!lowerLock) {
+ ++curcol;
if (curcol == 4)
curcol = 0;
tickpause = _ticks + 125;
@@ -648,10 +648,10 @@ void GriffonEngine::saveLoadNew() {
drawString(_videobuffer, line, 160 - strlen(line) * 4, sy, 0);
sx = 12;
- sy = sy + 11;
+ sy += 11;
int cc = 0;
- sprintf(line, "Health: %i/%i", _playera.hp, _playera.maxhp);
+ sprintf(line, "Health: %i/%i", _playera.hp, _playera.maxHp);
drawString(_videobuffer, line, sx, sy, cc);
if (_playera.level == 22)
@@ -684,10 +684,10 @@ void GriffonEngine::saveLoadNew() {
int nx = rcSrc.left + 13 + 3 * 8;
rcSrc.left = nx - 17;
- if (_playera.foundspell[0] == 1) {
+ if (_playera.foundSpell[0] == 1) {
for (int i = 0; i < 5; i++) {
- rcSrc.left = rcSrc.left + 17;
- if (_playera.foundspell[i] == 1)
+ rcSrc.left += 17;
+ if (_playera.foundSpell[i] == 1)
_itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
}
}
@@ -720,7 +720,7 @@ void GriffonEngine::saveLoadNew() {
_itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
- if (lowerlock == 1) {
+ if (lowerLock) {
rcDest.top = 18;
if (curcol == 1)
rcDest.left = 108;
diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp
index 37d9f46..4810667 100644
--- a/engines/griffon/draw.cpp
+++ b/engines/griffon/draw.cpp
@@ -248,17 +248,17 @@ void GriffonEngine::drawHud() {
rcSrc.top = sy;
// spells in game
- if (_player.foundspell[0] == 1) {
+ if (_player.foundSpell[0] == 1) {
for (int i = 0; i < 5; i++) {
rcSrc.left = rcSrc.left + 17;
- if (_player.foundspell[i] == 1) {
+ if (_player.foundSpell[i] == 1) {
_itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
game_fillrect(_videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32));
game_fillrect(_videobuffer, rcSrc.left + 1, sy + 17,
- hud_recalc(_player.spellcharge[i], 14, 100), 2,
- ABS(_player.spellcharge[i] - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 224, 64));
+ hud_recalc(_player.spellCharge[i], 14, 100), 2,
+ ABS(_player.spellCharge[i] - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 224, 64));
}
}
}
@@ -314,29 +314,29 @@ void GriffonEngine::drawHud() {
}
char line[128];
- sprintf(line, "Health: %i/%i", _player.hp, _player.maxhp);
- drawString(_videobuffer, line, sx, sy, _player.hp <= _player.maxhp * 0.25 ? (int)_player.hpflash : 0);
+ sprintf(line, "Health: %i/%i", _player.hp, _player.maxHp);
+ drawString(_videobuffer, line, sx, sy, _player.hp <= _player.maxHp * 0.25 ? (int)_player.hpflash : 0);
sprintf(line, "Level : %i", _player.level);
- if (_player.level == _player.maxlevel)
+ if (_player.level == _player.maxLevel)
strcpy(line, "Level : MAX");
drawString(_videobuffer, line, sx, sy + 8, 0);
// experience
game_fillrect(_videobuffer, sx + 64, sy + 16, 16, 4, RGB(0, 32, 32));
game_fillrect(_videobuffer, sx + 65, sy + 17,
- hud_recalc(_player.exp, 14, _player.nextlevel), 2, RGB(0, 224, 64));
+ hud_recalc(_player.exp, 14, _player.nextLevel), 2, RGB(0, 224, 64));
// attack strength
game_fillrect(_videobuffer, sx + 1, sy + 16, 56, 6, RGB(0, 32, 32));
game_fillrect(_videobuffer, sx + 1, sy + 17,
- hud_recalc(_player.attackstrength, 54, 100), 2,
- ABS(_player.attackstrength - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 64, 224));
+ hud_recalc(_player.attackStrength, 54, 100), 2,
+ ABS(_player.attackStrength - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 64, 224));
// spell strength
game_fillrect(_videobuffer, sx + 1, sy + 19,
- hud_recalc(_player.spellstrength, 54, 100), 2,
- ABS(_player.spellstrength - 100) < kEpsilon ? RGB(224, 0, 0) : RGB(128, 0, 224));
+ hud_recalc(_player.spellStrength, 54, 100), 2,
+ ABS(_player.spellStrength - 100) < kEpsilon ? RGB(224, 0, 0) : RGB(128, 0, 224));
// time
int ase = _secstart + _secsingame;
@@ -392,19 +392,19 @@ void GriffonEngine::drawHud() {
}
// spells in menu
- if (_player.foundspell[0] == 1) {
+ if (_player.foundSpell[0] == 1) {
for (int i = 0; i < 5; i++) {
rcSrc.left = 243;
rcSrc.top = 67 + i * 24;
sy = rcSrc.top;
- if (_player.foundspell[i] == 1) {
+ if (_player.foundSpell[i] == 1) {
_itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
game_fillrect(_videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32));
game_fillrect(_videobuffer, rcSrc.left + 1, sy + 17,
- hud_recalc(_player.spellcharge[i], 14, 100), 2,
- ABS(_player.spellcharge[i] - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 224, 64));
+ hud_recalc(_player.spellCharge[i], 14, 100), 2,
+ ABS(_player.spellCharge[i] - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 224, 64));
}
}
}
@@ -1058,8 +1058,8 @@ void GriffonEngine::drawPlayer() {
f = 13;
if (!attacking) {
- rcSrc.left = (int)(_player.walkframe / 4) * 24;
- rcSrc.top = _player.walkdir * 24;
+ rcSrc.left = (int)(_player.walkFrame / 4) * 24;
+ rcSrc.top = _player.walkDir * 24;
rcSrc.setWidth(24);
rcSrc.setHeight(24);
@@ -1070,8 +1070,8 @@ void GriffonEngine::drawPlayer() {
_anims[f]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
- rcSrc.left = (int)(_player.attackframe / 4) * 24;
- rcSrc.top = _player.walkdir * 24;
+ rcSrc.left = (int)(_player.attackFrame / 4) * 24;
+ rcSrc.top = _player.walkDir * 24;
rcSrc.setWidth(24);
rcSrc.setHeight(24);
@@ -1087,7 +1087,7 @@ void GriffonEngine::drawPlayer() {
long ccc = _videobuffer->format.RGBToColor(224, 224, 64);
bool pass = false;
- if (_player.hp <= _player.maxhp * 0.25)
+ if (_player.hp <= _player.maxHp * 0.25)
pass = true;
if (pass) {
@@ -1097,7 +1097,7 @@ void GriffonEngine::drawPlayer() {
}
int sss = 6;
- if (_player.foundspell[0])
+ if (_player.foundSpell[0])
sss = 8;
int npx = _player.px;
int npy = _player.py;
@@ -1112,7 +1112,7 @@ void GriffonEngine::drawPlayer() {
rcDest.top = npy + 23;
- int ww = 14 * _player.hp / _player.maxhp;
+ int ww = 14 * _player.hp / _player.maxHp;
if (ww > 14)
ww = 14;
if (ww < 1)
@@ -1124,14 +1124,14 @@ void GriffonEngine::drawPlayer() {
_videobuffer->fillRect(rcDest, ccc);
ccc = _videobuffer->format.RGBToColor(0, 224, 64);
- if (ABS(_player.attackstrength - 100) < kEpsilon)
+ if (ABS(_player.attackStrength - 100) < kEpsilon)
ccc = _videobuffer->format.RGBToColor(255, 128, 32);
- ww = 14 * _player.attackstrength / 100;
+ ww = 14 * _player.attackStrength / 100;
if (ww > 14)
ww = 14;
- int ww2 = 14 * _player.spellstrength / 100;
+ int ww2 = 14 * _player.spellStrength / 100;
if (ww2 > 14)
ww2 = 14;
@@ -1142,7 +1142,7 @@ void GriffonEngine::drawPlayer() {
_videobuffer->fillRect(rcDest, ccc);
ccc = _videobuffer->format.RGBToColor(128, 0, 224);
- if (ABS(_player.spellstrength - 100) < kEpsilon)
+ if (ABS(_player.spellStrength - 100) < kEpsilon)
ccc = _videobuffer->format.RGBToColor(224, 0, 0);
rcDest.top = rcDest.top + 2;
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 25f580e..e2281b3 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -98,24 +98,24 @@ void GriffonEngine::updateEngine() {
}
if (attacking) {
- _player.attackframe += _player.attackspd * _fpsr;
- if (_player.attackframe >= 16) {
+ _player.attackFrame += _player.attackSpeed * _fpsr;
+ if (_player.attackFrame >= 16) {
attacking = false;
- _player.attackframe = 0;
- _player.walkframe = 0;
+ _player.attackFrame = 0;
+ _player.walkFrame = 0;
}
- int pa = (int)(_player.attackframe);
+ int pa = (int)(_player.attackFrame);
for (int i = 0; i <= pa; i++) {
- if (ABS(_playerattackofs[_player.walkdir][i][2]) < kEpsilon) {
- _playerattackofs[_player.walkdir][i][2] = 1;
+ if (ABS(_playerattackofs[_player.walkDir][i][2]) < kEpsilon) {
+ _playerattackofs[_player.walkDir][i][2] = 1;
float opx = _player.px;
float opy = _player.py;
- _player.px = _player.px + _playerattackofs[_player.walkdir][i][0];
- _player.py = _player.py + _playerattackofs[_player.walkdir][i][1];
+ _player.px = _player.px + _playerattackofs[_player.walkDir][i][0];
+ _player.py = _player.py + _playerattackofs[_player.walkDir][i][1];
int sx = (int)(_player.px / 2 + 6);
int sy = (int)(_player.py / 2 + 10);
@@ -152,21 +152,21 @@ void GriffonEngine::updateEngine() {
}
}
- if (_player.level == _player.maxlevel)
+ if (_player.level == _player.maxLevel)
_player.exp = 0;
- if (_player.exp >= _player.nextlevel) {
+ if (_player.exp >= _player.nextLevel) {
_player.level = _player.level + 1;
addFloatText("LEVEL UP!", _player.px + 16 - 36, _player.py + 16, 3);
- _player.exp = _player.exp - _player.nextlevel;
- _player.nextlevel = _player.nextlevel * 3 / 2; // 1.5
- _player.maxhp = _player.maxhp + _player.level * 3;
- if (_player.maxhp > 999)
- _player.maxhp = 999;
- _player.hp = _player.maxhp;
+ _player.exp = _player.exp - _player.nextLevel;
+ _player.nextLevel = _player.nextLevel * 3 / 2; // 1.5
+ _player.maxHp = _player.maxHp + _player.level * 3;
+ if (_player.maxHp > 999)
+ _player.maxHp = 999;
+ _player.hp = _player.maxHp;
- _player.sworddamage = _player.level * 14 / 10;
- _player.spelldamage = _player.level * 13 / 10;
+ _player.swordDamage = _player.level * 14 / 10;
+ _player.spellDamage = _player.level * 13 / 10;
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
@@ -187,24 +187,24 @@ void GriffonEngine::updateEngine() {
if (!_forcepause) {
for (int i = 0; i < 5; i++) {
- if (_player.foundspell[i] == 1)
- _player.spellcharge[i] += 1 * _player.level * 0.01 * _fpsr;
- if (_player.spellcharge[i] > 100)
- _player.spellcharge[i] = 100;
+ if (_player.foundSpell[i] == 1)
+ _player.spellCharge[i] += 1 * _player.level * 0.01 * _fpsr;
+ if (_player.spellCharge[i] > 100)
+ _player.spellCharge[i] = 100;
}
- if (_player.foundspell[0]) {
- _player.spellstrength += 3 * _player.level * .01 * _fpsr;
+ if (_player.foundSpell[0]) {
+ _player.spellStrength += 3 * _player.level * .01 * _fpsr;
}
- _player.attackstrength += (30 + 3 * (float)_player.level) / 50 * _fpsr;
+ _player.attackStrength += (30 + 3 * (float)_player.level) / 50 * _fpsr;
}
- if (_player.attackstrength > 100)
- _player.attackstrength = 100;
+ if (_player.attackStrength > 100)
+ _player.attackStrength = 100;
- if (_player.spellstrength > 100)
- _player.spellstrength = 100;
+ if (_player.spellStrength > 100)
+ _player.spellStrength = 100;
_itemyloc += 0.75 * _fpsr;
while (_itemyloc >= 16)
@@ -230,7 +230,7 @@ void GriffonEngine::updateEngine() {
_player.hpflashb = _player.hpflashb + 1;
if (_player.hpflashb == 2)
_player.hpflashb = 0;
- if (config.effects && _player.hpflashb == 0 && _player.hp < _player.maxhp / 4) {
+ if (config.effects && _player.hpflashb == 0 && _player.hp < _player.maxHp / 4) {
int snd = playSound(_sfx[kSndBeep]);
setChannelVolume(snd, config.effectsvol);
}
@@ -258,29 +258,29 @@ void GriffonEngine::newGame() {
_player.py = 0;
_player.opx = 0;
_player.opy = 0;
- _player.walkdir = 0;
- _player.walkframe = 0;
- _player.walkspd = 0;
- _player.attackframe = 0;
- _player.attackspd = 0;
+ _player.walkDir = 0;
+ _player.walkFrame = 0;
+ _player.walkSpeed = 0;
+ _player.attackFrame = 0;
+ _player.attackSpeed = 0;
_player.hp = 0;
- _player.maxhp = 0;
+ _player.maxHp = 0;
_player.hpflash = 0;
_player.level = 0;
- _player.maxlevel = 0;
+ _player.maxLevel = 0;
_player.sword = 0;
_player.shield = 0;
_player.armour = 0;
for (int i = 0; i < 5; i++) {
- _player.foundspell[i] = 0;
- _player.spellcharge[i] = 0;
+ _player.foundSpell[i] = 0;
+ _player.spellCharge[i] = 0;
_player.inventory[i] = 0;
}
- _player.attackstrength = 0;
- _player.spelldamage = 0;
- _player.sworddamage = 0;
+ _player.attackStrength = 0;
+ _player.spellDamage = 0;
+ _player.swordDamage = 0;
_player.exp = 0;
- _player.nextlevel = 0;
+ _player.nextLevel = 0;
memset(_scriptflag, 0, sizeof(_scriptflag));
memset(_objmapf, 0, sizeof(_objmapf));
@@ -294,26 +294,26 @@ void GriffonEngine::newGame() {
_roomLocks[73] = 1;
_roomLocks[82] = 2;
- _player.walkspd = 1.1f;
+ _player.walkSpeed = 1.1f;
_animspd = 0.5f;
attacking = false;
- _player.attackspd = 1.5f;
+ _player.attackSpeed = 1.5f;
_player.sword = 1;
_player.level = 1;
- _player.maxlevel = 22;
- _player.nextlevel = 50;
+ _player.maxLevel = 22;
+ _player.nextLevel = 50;
_player.shield = 1;
_player.armour = 1;
_player.hp = 14;
- _player.maxhp = _player.hp;
+ _player.maxHp = _player.hp;
- _player.sworddamage = _player.level * 2;
- _player.spelldamage = _player.level * 3 / 2;
+ _player.swordDamage = _player.level * 2;
+ _player.spellDamage = _player.level * 3 / 2;
_player.px = 15 * 16 - 4;
_player.py = 6 * 16 - 4;
- _player.walkdir = 1;
+ _player.walkDir = 1;
_pgardens = false;
_ptown = false;
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index f56ec87..55fedeb 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -136,31 +136,31 @@ struct Player {
float py;
float opx;
float opy;
- int walkdir;
- float walkframe;
- float walkspd;
- float attackframe;
- float attackspd;
+ int walkDir;
+ float walkFrame;
+ float walkSpeed;
+ float attackFrame;
+ float attackSpeed;
int hp;
- int maxhp;
+ int maxHp;
float hpflash;
int hpflashb;
int level;
- int maxlevel;
+ int maxLevel;
int sword;
int shield;
int armour;
- int foundspell[5];
- float spellcharge[5];
+ int foundSpell[5];
+ float spellCharge[5];
int inventory[5];
- float attackstrength;
- float spellstrength;
- int spelldamage;
- int sworddamage;
+ float attackStrength;
+ float spellStrength;
+ int spellDamage;
+ int swordDamage;
int exp;
- int nextlevel;
+ int nextLevel;
int pause;
diff --git a/engines/griffon/input.cpp b/engines/griffon/input.cpp
index f7ebb15..a7540e6 100644
--- a/engines/griffon/input.cpp
+++ b/engines/griffon/input.cpp
@@ -89,7 +89,7 @@ void GriffonEngine::checkInputs() {
_itemticks = _ticks + ntickdelay;
int heal = 50;
- int maxh = _player.maxhp - _player.hp;
+ int maxh = _player.maxHp - _player.hp;
if (heal > maxh)
heal = maxh;
@@ -115,7 +115,7 @@ void GriffonEngine::checkInputs() {
_itemticks = _ticks + ntickdelay;
int heal = 200;
- int maxh = _player.maxhp - _player.hp;
+ int maxh = _player.maxHp - _player.hp;
if (heal > maxh)
heal = maxh;
@@ -174,10 +174,10 @@ void GriffonEngine::checkInputs() {
return;
}
- if (_curitem == 5 && _player.spellcharge[0] == 100) {
+ if (_curitem == 5 && _player.spellCharge[0] == 100) {
castSpell(5, _player.px, _player.py, _npcinfo[_curenemy].x, _npcinfo[_curenemy].y, 0);
- _player.spellcharge[0] = 0;
+ _player.spellCharge[0] = 0;
_forcepause = true;
@@ -194,9 +194,9 @@ void GriffonEngine::checkInputs() {
castSpell(_curitem - 6, _player.px, _player.py, postinfo[pst][0], postinfo[pst][1], 0);
}
- _player.spellcharge[_curitem - 5] = 0;
+ _player.spellCharge[_curitem - 5] = 0;
- _player.spellstrength = 0;
+ _player.spellStrength = 0;
_itemticks = _ticks + ntickdelay;
_selenemyon = 0;
@@ -205,7 +205,7 @@ void GriffonEngine::checkInputs() {
}
if (_curitem > 5 && _selenemyon == 0 && _itemselon == 1) {
- if (ABS(_player.spellcharge[_curitem - 5] - 100) < kEpsilon) {
+ if (ABS(_player.spellCharge[_curitem - 5] - 100) < kEpsilon) {
_itemticks = _ticks + ntickdelay;
_selenemyon = 1;
@@ -352,7 +352,7 @@ void GriffonEngine::handleWalking() {
float opx = px;
float opy = py;
- float spd = _player.walkspd * _fpsr;
+ float spd = _player.walkSpeed * _fpsr;
float nx = (px / 2 + 6);
float ny = (py / 2 + 10);
@@ -394,17 +394,17 @@ void GriffonEngine::handleWalking() {
}
if (movingup)
- _player.walkdir = 0;
+ _player.walkDir = 0;
if (movingdown)
- _player.walkdir = 1;
+ _player.walkDir = 1;
if (movingleft)
- _player.walkdir = 2;
+ _player.walkDir = 2;
if (movingright)
- _player.walkdir = 3;
+ _player.walkDir = 3;
if (movingup && _clipsurround[1][0] == 0) {
py -= spd;
- _player.walkdir = 0;
+ _player.walkDir = 0;
} else if (movingup && _clipsurround[1][0] > 0) {
// move upleft
if (!movingright && _clipsurround[0][0] == 0) {
@@ -420,7 +420,7 @@ void GriffonEngine::handleWalking() {
}
if (movingdown && _clipsurround[1][2] == 0) {
py += spd;
- _player.walkdir = 1;
+ _player.walkDir = 1;
} else if (movingdown && _clipsurround[1][2] > 0) {
// move downleft
if (movingright == 0 && _clipsurround[0][2] == 0) {
@@ -436,7 +436,7 @@ void GriffonEngine::handleWalking() {
}
if (movingleft && _clipsurround[0][1] == 0) {
px -= spd;
- _player.walkdir = 2;
+ _player.walkDir = 2;
} else if (movingleft && _clipsurround[0][1] > 0) {
// move leftup
if (!movingdown && _clipsurround[0][0] == 0) {
@@ -452,7 +452,7 @@ void GriffonEngine::handleWalking() {
}
if (movingright && _clipsurround[2][1] == 0) {
px += spd;
- _player.walkdir = 3;
+ _player.walkDir = 3;
} else if (movingright && _clipsurround[2][1] > 0) {
// move rightup
if (!movingdown && _clipsurround[2][0] == 0) {
@@ -501,16 +501,16 @@ void GriffonEngine::handleWalking() {
int xdif = _player.px - npx;
int ydif = _player.py - npy;
- if (_player.walkdir == 0) {
+ if (_player.walkDir == 0) {
if (abs(xdif) <= 8 && ydif > 0 && ydif < 8)
_npcinfo[i].y -= spd;
- } else if (_player.walkdir == 1) {
+ } else if (_player.walkDir == 1) {
if (abs(xdif) <= 8 && ydif < 0 && ydif > -8)
_npcinfo[i].y += spd;
- } else if (_player.walkdir == 2) {
+ } else if (_player.walkDir == 2) {
if (abs(ydif) <= 8 && xdif > 0 && xdif < 8)
_npcinfo[i].x -= spd;
- } else if (_player.walkdir == 3) {
+ } else if (_player.walkDir == 3) {
if (abs(ydif) <= 8 && xdif < 0 && xdif > -8)
_npcinfo[i].x += spd;
}
@@ -537,9 +537,9 @@ void GriffonEngine::handleWalking() {
_player.py = py;
if (_player.px != _player.opx || _player.py != _player.opy)
- _player.walkframe += _animspd * _fpsr;
- if (_player.walkframe >= 16)
- _player.walkframe -= 16;
+ _player.walkFrame += _animspd * _fpsr;
+ if (_player.walkFrame >= 16)
+ _player.walkFrame -= 16;
// walking over items to pickup :::
int o = _objectMap[lx][ly];
diff --git a/engines/griffon/logic.cpp b/engines/griffon/logic.cpp
index 310bfcc..7a691b8 100644
--- a/engines/griffon/logic.cpp
+++ b/engines/griffon/logic.cpp
@@ -116,7 +116,7 @@ void GriffonEngine::updateY() {
do {
if (_ysort[yy] == -1 || yy == 2400)
break;
- yy = yy + 1;
+ ++yy;
} while (1);
_ysort[yy] = i;
@@ -1242,11 +1242,7 @@ void GriffonEngine::updateNPCs() {
}
void GriffonEngine::updateSpells() {
- int foundel[5];
- long cl1, cl2, cl3;
- int ll[4][2];
-
- float xloc = 0, yloc = 0, xst, yst, xdif, ydif;
+ float xloc = 0, yloc = 0;
for (int i = 0; i < kMaxSpell; i++) {
if (spellinfo[i].frame > 0) {
@@ -1255,6 +1251,7 @@ void GriffonEngine::updateSpells() {
// water
if (spellnum == 0 && !_forcepause) {
float fr = (32 - spellinfo[i].frame);
+ int ll[4][2];
ll[0][0] = -2;
ll[0][1] = -3;
@@ -1297,8 +1294,8 @@ void GriffonEngine::updateSpells() {
rcSrc.setWidth(16);
rcSrc.setHeight(16);
- xst = spellinfo[i].enemyx + 12 + ll[f][0] * 16;
- yst = spellinfo[i].enemyy + 16 + ll[f][1] * 16;
+ float xst = spellinfo[i].enemyx + 12 + ll[f][0] * 16;
+ float yst = spellinfo[i].enemyy + 16 + ll[f][1] * 16;
float xi = (spellinfo[i].enemyx - xst) * 2 / 8;
float yi = (spellinfo[i].enemyy - yst) * 2 / 8;
@@ -1320,12 +1317,11 @@ void GriffonEngine::updateSpells() {
if (spellinfo[i].damagewho == 0) {
for (int e = 1; e <= _lastnpc; e++) {
-
- xdif = (xloc + 16) - (_npcinfo[e].x + 12);
- ydif = (yloc + 16) - (_npcinfo[e].y + 12);
+ float xdif = (xloc + 16) - (_npcinfo[e].x + 12);
+ float ydif = (yloc + 16) - (_npcinfo[e].y + 12);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
+ float damage = (float)_player.spellDamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
damageNPC(e, damage, 1);
@@ -1341,8 +1337,8 @@ void GriffonEngine::updateSpells() {
// check for post damage
if (nposts > 0) {
for (int e = 0; e <= nposts - 1; e++) {
- xdif = (xloc + 16) - (postinfo[e][0] + 8);
- ydif = (yloc + 16) - (postinfo[e][1] + 8);
+ float xdif = (xloc + 16) - (postinfo[e][0] + 8);
+ float ydif = (yloc + 16) - (postinfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
_objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
@@ -1400,11 +1396,11 @@ void GriffonEngine::updateSpells() {
if (spellinfo[i].damagewho == 0) {
for (int e = 1; e <= _lastnpc; e++) {
- xdif = (xloc + 24) - (_npcinfo[e].x + 12);
- ydif = (yloc + 24) - (_npcinfo[e].y + 12);
+ float xdif = (xloc + 24) - (_npcinfo[e].x + 12);
+ float ydif = (yloc + 24) - (_npcinfo[e].y + 12);
if ((abs(xdif) < 24 && abs(ydif) < 24)) {
- float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
+ float damage = (float)_player.spellDamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
damageNPC(e, damage, 1);
@@ -1440,8 +1436,8 @@ void GriffonEngine::updateSpells() {
}
// ---------------
- xdif = (xloc + 24) - (_player.px + 12);
- ydif = (yloc + 24) - (_player.py + 12);
+ float xdif = (xloc + 24) - (_player.px + 12);
+ float ydif = (yloc + 24) - (_player.py + 12);
if ((abs(xdif) < 24 && abs(ydif) < 24) && _player.pause < _ticks) {
float damage = (float)_npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
@@ -1460,8 +1456,8 @@ void GriffonEngine::updateSpells() {
// check for(int post damage
if (nposts > 0) {
for (int e = 0; e <= nposts - 1; e++) {
- xdif = (xloc + 24) - (postinfo[e][0] + 8);
- ydif = (yloc + 24) - (postinfo[e][1] + 8);
+ float xdif = (xloc + 24) - (postinfo[e][0] + 8);
+ float ydif = (yloc + 24) - (postinfo[e][1] + 8);
if ((abs(xdif) < 24 && abs(ydif) < 24)) {
_objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
@@ -1519,11 +1515,11 @@ void GriffonEngine::updateSpells() {
if (scatter == 1) {
if (spellinfo[i].damagewho == 0) {
for (int e = 1; e <= _lastnpc; e++) {
- xdif = (xloc + 16) - (_npcinfo[e].x + 12);
- ydif = (yloc + 16) - (_npcinfo[e].y + 12);
+ float xdif = (xloc + 16) - (_npcinfo[e].x + 12);
+ float ydif = (yloc + 16) - (_npcinfo[e].y + 12);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
+ float damage = (float)_player.spellDamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
damageNPC(e, damage, 1);
@@ -1540,8 +1536,8 @@ void GriffonEngine::updateSpells() {
// check for(int post damage
if (nposts > 0) {
for (int e = 0; e <= nposts - 1; e++) {
- xdif = (xloc + 16) - (postinfo[e][0] + 8);
- ydif = (yloc + 16) - (postinfo[e][1] + 8);
+ float xdif = (xloc + 16) - (postinfo[e][0] + 8);
+ float ydif = (yloc + 16) - (postinfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
_objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
@@ -1608,6 +1604,7 @@ void GriffonEngine::updateSpells() {
int lx = (int)npx / 16;
int ly = (int)npy / 16;
+ int foundel[5];
for (int f1 = 0; f1 < 5; f1++) { // !! f < 5
foundel[f1] = 0;
}
@@ -1651,9 +1648,9 @@ void GriffonEngine::updateSpells() {
strcpy(line, "Found... nothing...");
for (int f1 = 0; f1 < 5; f1++) {
- if (foundel[f1] == 1 && _player.foundspell[f1] == 0) {
- _player.foundspell[f1] = 1;
- _player.spellcharge[f1] = 0;
+ if (foundel[f1] == 1 && _player.foundSpell[f1] == 0) {
+ _player.foundSpell[f1] = 1;
+ _player.spellCharge[f1] = 0;
if (f1 == 1)
strcpy(line, "Found... Water Essence");
if (f1 == 2)
@@ -1746,8 +1743,8 @@ void GriffonEngine::updateSpells() {
xloc = spellinfo[i].fireballs[ff][0] + (int)(RND() * 3) - 1;
yloc = spellinfo[i].fireballs[ff][1] + (int)(RND() * 3) - 1;
- xdif = (xloc + 8) - (_player.px + 12);
- ydif = (yloc + 8) - (_player.py + 12);
+ float xdif = (xloc + 8) - (_player.px + 12);
+ float ydif = (yloc + 8) - (_player.py + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
float damage = _npcinfo[spellinfo[i].npc].spelldamage * (1 + RND() * 0.5) / 3;
@@ -1767,10 +1764,9 @@ void GriffonEngine::updateSpells() {
// lightning bomb
if (spellnum == 8) {
-
- cl1 = _videobuffer->format.RGBToColor(0, 32, 204);
- cl2 = _videobuffer->format.RGBToColor(142, 173, 191);
- cl3 = _videobuffer->format.RGBToColor(240, 240, 240);
+ long cl1 = _videobuffer->format.RGBToColor(0, 32, 204);
+ long cl2 = _videobuffer->format.RGBToColor(142, 173, 191);
+ long cl3 = _videobuffer->format.RGBToColor(240, 240, 240);
float px = _player.px + 12;
float py = _player.py + 12;
@@ -1785,9 +1781,9 @@ void GriffonEngine::updateSpells() {
int rn = (int)(RND() * 3);
if (orn == 0)
- y = y - 1;
- if (orn == 2)
- y = y + 1;
+ --y;
+ else if (orn == 2)
+ ++y;
drawLine(_videobuffer, x, y - 1, x, y + 2, cl1);
drawLine(_videobuffer, x, y, x, y + 1, cl3);
@@ -1801,9 +1797,8 @@ void GriffonEngine::updateSpells() {
if (spellinfo[i].damagewho == 0) {
for (int e = 1; e <= _lastnpc; e++) {
-
- xdif = (x + 16) - (_npcinfo[e].x + 12);
- ydif = (y + 16) - (_npcinfo[e].y + 12);
+ float xdif = (x + 16) - (_npcinfo[e].x + 12);
+ float ydif = (y + 16) - (_npcinfo[e].y + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = 30 * (1 + RND() * 0.5);
@@ -1817,8 +1812,8 @@ void GriffonEngine::updateSpells() {
// check for post damage
if (nposts > 0) {
for (int e = 0; e <= nposts - 1; e++) {
- xdif = (xloc + 16) - (postinfo[e][0] + 8);
- ydif = (yloc + 16) - (postinfo[e][1] + 8);
+ float xdif = (xloc + 16) - (postinfo[e][0] + 8);
+ float ydif = (yloc + 16) - (postinfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
_objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
@@ -1843,9 +1838,9 @@ void GriffonEngine::updateSpells() {
int rn = (int)(RND() * 3);
if (orn == 0)
- y = y - 1;
- if (orn == 2)
- y = y + 1;
+ --y;
+ else if (orn == 2)
+ ++y;
drawLine(_videobuffer, x, y - 1, x, y + 2, cl1);
drawLine(_videobuffer, x, y, x, y + 1, cl3);
@@ -1859,9 +1854,8 @@ void GriffonEngine::updateSpells() {
if (spellinfo[i].damagewho == 0) {
for (int e = 1; e <= _lastnpc; e++) {
-
- xdif = (x + 16) - (_npcinfo[e].x + 12);
- ydif = (y + 16) - (_npcinfo[e].y + 12);
+ float xdif = (x + 16) - (_npcinfo[e].x + 12);
+ float ydif = (y + 16) - (_npcinfo[e].y + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = 30 * (1 + RND() * 0.5);
@@ -1875,8 +1869,8 @@ void GriffonEngine::updateSpells() {
// check for post damage
if (nposts > 0) {
for (int e = 0; e <= nposts - 1; e++) {
- xdif = (xloc + 16) - (postinfo[e][0] + 8);
- ydif = (yloc + 16) - (postinfo[e][1] + 8);
+ float xdif = (xloc + 16) - (postinfo[e][0] + 8);
+ float ydif = (yloc + 16) - (postinfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
_objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
@@ -1917,8 +1911,8 @@ void GriffonEngine::updateSpells() {
if (spellinfo[i].damagewho == 0) {
for (int e = 1; e <= _lastnpc; e++) {
- xdif = (x + 16) - (_npcinfo[e].x + 12);
- ydif = (y + 16) - (_npcinfo[e].y + 12);
+ float xdif = (x + 16) - (_npcinfo[e].x + 12);
+ float ydif = (y + 16) - (_npcinfo[e].y + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = 30 * (1 + RND() * 0.5);
@@ -1932,8 +1926,8 @@ void GriffonEngine::updateSpells() {
// check for post damage
if (nposts > 0) {
for (int e = 0; e <= nposts - 1; e++) {
- xdif = (xloc + 16) - (postinfo[e][0] + 8);
- ydif = (yloc + 16) - (postinfo[e][1] + 8);
+ float xdif = (xloc + 16) - (postinfo[e][0] + 8);
+ float ydif = (yloc + 16) - (postinfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
_objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
@@ -1974,8 +1968,8 @@ void GriffonEngine::updateSpells() {
if (spellinfo[i].damagewho == 0) {
for (int e = 1; e <= _lastnpc; e++) {
- xdif = (x + 16) - (_npcinfo[e].x + 12);
- ydif = (y + 16) - (_npcinfo[e].y + 12);
+ float xdif = (x + 16) - (_npcinfo[e].x + 12);
+ float ydif = (y + 16) - (_npcinfo[e].y + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = 30 * (1 + RND() * 0.5);
@@ -1989,8 +1983,8 @@ void GriffonEngine::updateSpells() {
// check for post damage
if (nposts > 0) {
for (int e = 0; e <= nposts - 1; e++) {
- xdif = (xloc + 16) - (postinfo[e][0] + 8);
- ydif = (yloc + 16) - (postinfo[e][1] + 8);
+ float xdif = (xloc + 16) - (postinfo[e][0] + 8);
+ float ydif = (yloc + 16) - (postinfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
_objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
@@ -2019,10 +2013,9 @@ void GriffonEngine::updateSpells() {
// wizard 1 lightning
if (spellnum == 9) {
-
- cl1 = _videobuffer->format.RGBToColor(0, 32, 204);
- cl2 = _videobuffer->format.RGBToColor(142, 173, 191);
- cl3 = _videobuffer->format.RGBToColor(240, 240, 240);
+ long cl1 = _videobuffer->format.RGBToColor(0, 32, 204);
+ long cl2 = _videobuffer->format.RGBToColor(142, 173, 191);
+ long cl3 = _videobuffer->format.RGBToColor(240, 240, 240);
int px = spellinfo[i].enemyx + 12;
int py = spellinfo[i].enemyy + 24;
@@ -2052,19 +2045,16 @@ void GriffonEngine::updateSpells() {
orn = rn;
if (spellinfo[i].damagewho == 1) {
-
- xdif = (x + 8) - (_player.px + 12);
- ydif = (y + 8) - (_player.py + 12);
+ float xdif = (x + 8) - (_player.px + 12);
+ float ydif = (y + 8) - (_player.py + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
float damage = ((float)_player.hp * 0.75) * (RND() * 0.5 + 0.5);
if (damage < 5)
damage = 5;
- if (_npcinfo[spellinfo[i].npc].spriteset == kMonsterBatKitty) {
- if (damage < 50)
- damage = 40 + (int)(RND() * 40);
- }
+ if ((_npcinfo[spellinfo[i].npc].spriteset == kMonsterBatKitty) && (damage < 50))
+ damage = 40 + (int)(RND() * 40);
if (_player.hp > 0)
damagePlayer(damage);
@@ -2233,7 +2223,7 @@ void GriffonEngine::updateSpellsUnder() {
float ydif = (yloc + 8) - (_npcinfo[e].y + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
- float damage = (float)_player.spelldamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
+ float damage = (float)_player.spellDamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
if (_npcinfo[e].spriteset == kMonsterFireHydra)
damage = -damage;
diff --git a/engines/griffon/resources.cpp b/engines/griffon/resources.cpp
index 19c80e4..e81502e 100644
--- a/engines/griffon/resources.cpp
+++ b/engines/griffon/resources.cpp
@@ -763,7 +763,7 @@ void GriffonEngine::loadMap(int mapnum) {
}
// academy crystal
- if (_curmap == 24 && _player.foundspell[0] == 0 && _scriptflag[kScriptFindCtystal][0] == 1) {
+ if (_curmap == 24 && _player.foundSpell[0] == 0 && _scriptflag[kScriptFindCtystal][0] == 1) {
cx = 9;
cy = 7;
diff --git a/engines/griffon/saveload.cpp b/engines/griffon/saveload.cpp
index ae26567..972d1b0 100644
--- a/engines/griffon/saveload.cpp
+++ b/engines/griffon/saveload.cpp
@@ -76,31 +76,31 @@ int GriffonEngine::loadState(int slotnum) {
INPUT("%f", &_player.py);
INPUT("%f", &_player.opx);
INPUT("%f", &_player.opy);
- INPUT("%i", &_player.walkdir);
- INPUT("%f", &_player.walkframe);
- INPUT("%f", &_player.walkspd);
- INPUT("%f", &_player.attackframe);
- INPUT("%f", &_player.attackspd);
+ INPUT("%i", &_player.walkDir);
+ INPUT("%f", &_player.walkFrame);
+ INPUT("%f", &_player.walkSpeed);
+ INPUT("%f", &_player.attackFrame);
+ INPUT("%f", &_player.attackSpeed);
INPUT("%i", &_player.hp);
- INPUT("%i", &_player.maxhp);
+ INPUT("%i", &_player.maxHp);
INPUT("%f", &_player.hpflash);
INPUT("%i", &_player.level);
- INPUT("%i", &_player.maxlevel);
+ INPUT("%i", &_player.maxLevel);
INPUT("%i", &_player.sword);
INPUT("%i", &_player.shield);
INPUT("%i", &_player.armour);
for (int i = 0; i < 5; i++) {
- INPUT("%i", &_player.foundspell[i]);
- INPUT("%f", &_player.spellcharge[i]);
+ INPUT("%i", &_player.foundSpell[i]);
+ INPUT("%f", &_player.spellCharge[i]);
}
for (int a = 0; a < 5; a++) {
INPUT("%i", &_player.inventory[a]);
}
- INPUT("%f", &_player.attackstrength);
- INPUT("%i", &_player.spelldamage);
- INPUT("%i", &_player.sworddamage);
+ INPUT("%f", &_player.attackStrength);
+ INPUT("%i", &_player.spellDamage);
+ INPUT("%i", &_player.swordDamage);
INPUT("%i", &_player.exp);
- INPUT("%i", &_player.nextlevel);
+ INPUT("%i", &_player.nextLevel);
for (int a = 0; a <= 99; a++) {
for (int b = 0; b <= 9; b++) {
INPUT("%i", &_scriptflag[a][b]);
@@ -120,7 +120,7 @@ int GriffonEngine::loadState(int slotnum) {
INPUT("%i", &_roomLocks[a]);
}
- INPUT("%f", &_player.spellstrength);
+ INPUT("%f", &_player.spellStrength);
return 1; // success
}
@@ -150,31 +150,31 @@ int GriffonEngine::loadPlayer(int slotnum) {
INPUT("%f", &_playera.py);
INPUT("%f", &_playera.opx);
INPUT("%f", &_playera.opy);
- INPUT("%i", &_playera.walkdir);
- INPUT("%f", &_playera.walkframe);
- INPUT("%f", &_playera.walkspd);
- INPUT("%f", &_playera.attackframe);
- INPUT("%f", &_playera.attackspd);
+ INPUT("%i", &_playera.walkDir);
+ INPUT("%f", &_playera.walkFrame);
+ INPUT("%f", &_playera.walkSpeed);
+ INPUT("%f", &_playera.attackFrame);
+ INPUT("%f", &_playera.attackSpeed);
INPUT("%i", &_playera.hp);
- INPUT("%i", &_playera.maxhp);
+ INPUT("%i", &_playera.maxHp);
INPUT("%f", &_playera.hpflash);
INPUT("%i", &_playera.level);
- INPUT("%i", &_playera.maxlevel);
+ INPUT("%i", &_playera.maxLevel);
INPUT("%i", &_playera.sword);
INPUT("%i", &_playera.shield);
INPUT("%i", &_playera.armour);
for (int i = 0; i < 5; i++) {
- INPUT("%i", &_playera.foundspell[i]);
- INPUT("%f", &_playera.spellcharge[i]);
+ INPUT("%i", &_playera.foundSpell[i]);
+ INPUT("%f", &_playera.spellCharge[i]);
}
for (int a = 0; a < 5; a++) {
INPUT("%i", &_playera.inventory[a]);
}
- INPUT("%f", &_playera.attackstrength);
- INPUT("%i", &_playera.spelldamage);
- INPUT("%i", &_playera.sworddamage);
+ INPUT("%f", &_playera.attackStrength);
+ INPUT("%i", &_playera.spellDamage);
+ INPUT("%i", &_playera.swordDamage);
INPUT("%i", &_playera.exp);
- INPUT("%i", &_playera.nextlevel);
+ INPUT("%i", &_playera.nextLevel);
return 1; // success
}
@@ -201,31 +201,31 @@ int GriffonEngine::saveState(int slotnum) {
PRINT("%f", _player.py);
PRINT("%f", _player.opx);
PRINT("%f", _player.opy);
- PRINT("%i", _player.walkdir);
- PRINT("%f", _player.walkframe);
- PRINT("%f", _player.walkspd);
- PRINT("%f", _player.attackframe);
- PRINT("%f", _player.attackspd);
+ PRINT("%i", _player.walkDir);
+ PRINT("%f", _player.walkFrame);
+ PRINT("%f", _player.walkSpeed);
+ PRINT("%f", _player.attackFrame);
+ PRINT("%f", _player.attackSpeed);
PRINT("%i", _player.hp);
- PRINT("%i", _player.maxhp);
+ PRINT("%i", _player.maxHp);
PRINT("%f", _player.hpflash);
PRINT("%i", _player.level);
- PRINT("%i", _player.maxlevel);
+ PRINT("%i", _player.maxLevel);
PRINT("%i", _player.sword);
PRINT("%i", _player.shield);
PRINT("%i", _player.armour);
for (int i = 0; i < 5; i++) {
- PRINT("%i", _player.foundspell[i]);
- PRINT("%f", _player.spellcharge[i]);
+ PRINT("%i", _player.foundSpell[i]);
+ PRINT("%f", _player.spellCharge[i]);
}
for (int a = 0; a < 5; a++) {
PRINT("%i", _player.inventory[a]);
}
- PRINT("%f", _player.attackstrength);
- PRINT("%i", _player.spelldamage);
- PRINT("%i", _player.sworddamage);
+ PRINT("%f", _player.attackStrength);
+ PRINT("%i", _player.spellDamage);
+ PRINT("%i", _player.swordDamage);
PRINT("%i", _player.exp);
- PRINT("%i", _player.nextlevel);
+ PRINT("%i", _player.nextLevel);
for (int a = 0; a <= 99; a++) {
for (int b = 0; b <= 9; b++) {
PRINT("%i", _scriptflag[a][b]);
@@ -245,7 +245,7 @@ int GriffonEngine::saveState(int slotnum) {
PRINT("%i", _roomLocks[a]);
}
- PRINT("%f", _player.spellstrength);
+ PRINT("%f", _player.spellStrength);
}
file->finalize();
Commit: bfd5abdee35f3b0b720ba19f021433f7e6b9f477
https://github.com/scummvm/scummvm/commit/bfd5abdee35f3b0b720ba19f021433f7e6b9f477
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Rename _ticks1 to ticks1 as it's at function level
Changed paths:
engines/griffon/dialogs.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index d822945..c7d7a6a 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -63,7 +63,7 @@ void GriffonEngine::title(int mode) {
int cursel = 0;
int keypause = _ticks + 220;
- int _ticks1 = _ticks;
+ int ticks1 = _ticks;
if (config.music) {
setChannelVolume(_musicchannel, 0);
@@ -122,8 +122,8 @@ void GriffonEngine::title(int mode) {
_itemimg[15]->blit(*_videobuffer, rc.left, rc.top);
float yf = 255.0;
- if (_ticks < _ticks1 + 1000) {
- yf = 255.0 * ((float)(_ticks - _ticks1) / 1000.0);
+ if (_ticks < ticks1 + 1000) {
+ yf = 255.0 * ((float)(_ticks - ticks1) / 1000.0);
yf = CLIP<float>(yf, 0.0, 255.0);
}
@@ -181,12 +181,12 @@ void GriffonEngine::title(int mode) {
saveLoadNew();
_ticks = g_system->getMillis();
keypause = _ticks + 150;
- _ticks1 = _ticks;
+ ticks1 = _ticks;
} else if (cursel == 1) {
configMenu();
_ticks = g_system->getMillis();
keypause = _ticks + 150;
- _ticks1 = _ticks;
+ ticks1 = _ticks;
} else if (cursel == 2) {
_shouldQuit = true;
} else if (cursel == 3) {
@@ -220,7 +220,7 @@ void GriffonEngine::configMenu() {
Graphics::TransparentSurface *configwindow = loadImage("art/configwindow.bmp", true);
configwindow->setAlpha(160, true);
- int _ticks1 = _ticks;
+ int ticks1 = _ticks;
do {
_videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
@@ -314,8 +314,8 @@ void GriffonEngine::configMenu() {
_itemimg[15]->blit(*_videobuffer, rc.left, rc.top);
float yy = 255.0;
- if (_ticks < _ticks1 + 1000) {
- yy = 255.0 * ((float)(_ticks - _ticks1) / 1000.0);
+ if (_ticks < ticks1 + 1000) {
+ yy = 255.0 * ((float)(_ticks - ticks1) / 1000.0);
yy = CLIP<float>(yy, 0.0, 255.0);
}
@@ -472,7 +472,7 @@ void GriffonEngine::saveLoadNew() {
bool lowerLock = false;
_ticks = g_system->getMillis();
- int _ticks1 = _ticks;
+ int ticks1 = _ticks;
int tickpause = _ticks + 150;
do {
@@ -734,8 +734,8 @@ void GriffonEngine::saveLoadNew() {
}
int yy = 255;
- if (_ticks < _ticks1 + 1000) {
- yy = 255 * (_ticks - _ticks1) / 1000;
+ if (_ticks < ticks1 + 1000) {
+ yy = 255 * (_ticks - ticks1) / 1000;
yy = CLIP(yy, 0, 255);
}
Commit: 4f8753d839c4a038678d5c93ab2d35b70e64e5d4
https://github.com/scummvm/scummvm/commit/4f8753d839c4a038678d5c93ab2d35b70e64e5d4
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Change volume in option menu
Changed paths:
engines/griffon/dialogs.cpp
engines/griffon/sound.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index c7d7a6a..4031da7 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -35,6 +35,7 @@
*/
#include "common/system.h"
+#include "common/config-manager.h"
#include "griffon/griffon.h"
#include "griffon/config.h"
@@ -221,6 +222,10 @@ void GriffonEngine::configMenu() {
configwindow->setAlpha(160, true);
int ticks1 = _ticks;
+
+ config.musicvol = ConfMan.getInt("music_volume");
+ config.effectsvol = ConfMan.getInt("sfx_volume");
+
do {
_videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
@@ -356,14 +361,14 @@ void GriffonEngine::configMenu() {
if (_event.kbd.keycode == Common::KEYCODE_LEFT) {
if (cursel == 11) {
- config.musicvol = config.musicvol - 25;
+ config.musicvol -= 25;
if (config.musicvol < 0)
config.musicvol = 0;
setChannelVolume(_musicchannel, config.musicvol);
setChannelVolume(_menuchannel, config.musicvol);
} else if (cursel == 12) {
- config.effectsvol = config.effectsvol - 25;
+ config.effectsvol -= 25;
if (config.effectsvol < 0)
config.effectsvol = 0;
@@ -379,14 +384,14 @@ void GriffonEngine::configMenu() {
}
if (_event.kbd.keycode == Common::KEYCODE_RIGHT) {
if (cursel == 11) {
- config.musicvol = config.musicvol + 25;
+ config.musicvol += 25;
if (config.musicvol > 255)
config.musicvol = 255;
setChannelVolume(_musicchannel, config.musicvol);
setChannelVolume(_menuchannel, config.musicvol);
} else if (cursel == 12) {
- config.effectsvol = config.effectsvol + 25;
+ config.effectsvol += 25;
if (config.effectsvol > 255)
config.effectsvol = 255;
diff --git a/engines/griffon/sound.cpp b/engines/griffon/sound.cpp
index f488c5b..44373c9 100644
--- a/engines/griffon/sound.cpp
+++ b/engines/griffon/sound.cpp
@@ -46,7 +46,9 @@
namespace Griffon {
-void GriffonEngine::setChannelVolume(int channel, int volume) {}
+void GriffonEngine::setChannelVolume(int channel, int volume) {
+ _mixer->setChannelVolume(_handles[channel], volume);
+}
int GriffonEngine::getSoundHandle() {
for (uint i = 0; i < kSoundHandles; i++) {
Commit: 7ce2045ae03f65714556dda02acf98348ee8a0dc
https://github.com/scummvm/scummvm/commit/7ce2045ae03f65714556dda02acf98348ee8a0dc
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Synchronize sound settings
Changed paths:
engines/griffon/config.cpp
engines/griffon/config.h
engines/griffon/dialogs.cpp
engines/griffon/griffon.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/config.cpp b/engines/griffon/config.cpp
index 83e1e85..5e6d442 100644
--- a/engines/griffon/config.cpp
+++ b/engines/griffon/config.cpp
@@ -34,16 +34,12 @@
*
*/
-
#include "griffon/config.h"
+#include "common/config-manager.h"
namespace Griffon {
-CONFIG config = {
- 320, 240, 16, false, 0, 0, true, 127, true, 127
-};
-
-char config_ini[64] = "config.ini";
+CONFIG config;
#define PRINT(A,B) \
do { \
@@ -60,81 +56,30 @@ char config_ini[64] = "config.ini";
} while(0)
void config_load(CONFIG *config) {
-#if 0
- char line[128];
- char arg[128];
-
- FILE *fp = fopen(config_ini, "r");
- if (fp) {
- while (fgets(line, sizeof(line), fp) != NULL) {
- sscanf(line, "%s", arg); // eliminate eol and eof by this
+ bool mute = false;
+ if (ConfMan.hasKey("mute"))
+ mute = ConfMan.getBool("mute");
- if (strcmp(arg, "SCR_WIDTH:") == 0) {
- fgets(line, sizeof(line), fp);
- sscanf(line, "%i", &config->scr_width);
- } else if (strcmp(arg, "SCR_HEIGHT:") == 0) {
- fgets(line, sizeof(line), fp);
- sscanf(line, "%i", &config->scr_height);
- } else if (strcmp(arg, "SCR_BITS:") == 0) {
- fgets(line, sizeof(line), fp);
- sscanf(line, "%i", &config->scr_bpp);
- } else if (strcmp(arg, "HWACCEL:YES") == 0) {
- config->hwaccel = true;
- } else if (strcmp(arg, "HWACCEL:NO") == 0) {
- config->hwaccel = false;
- } else if (strcmp(arg, "HWSURFACE:YES") == 0) {
- config->hwsurface = true;
- } else if (strcmp(arg, "HWSURFACE:NO") == 0) {
- config->hwsurface = false;
- } else if (strcmp(arg, "FULLSCREEN:YES") == 0) {
- config->fullscreen = true;
- } else if (strcmp(arg, "FULLSCREEN:NO") == 0) {
- config->fullscreen = false;
- } else if (strcmp(arg, "MUSIC:YES") == 0) {
- config->music = true;
- } else if (strcmp(arg, "MUSIC:NO") == 0) {
- config->music = false;
- } else if (strcmp(arg, "SNDEFFECTS:YES") == 0) {
- config->effects = true;
- } else if (strcmp(arg, "SNDEFFECTS:NO") == 0) {
- config->effects = false;
- } else if (strcmp(arg, "opmusicvol:") == 0) {
- fgets(line, sizeof(line), fp);
- sscanf(line, "%i", &config->musicvol);
- } else if (strcmp(arg, "opeffectsvol:") == 0) {
- fgets(line, sizeof(line), fp);
- sscanf(line, "%i", &config->effectsvol);
- }
- }
+ config->music = mute;
+ config->effects = mute;
- fclose(fp);
+ if (!mute) {
+ config->music = !ConfMan.getBool("music_mute");
+ config->effects = !ConfMan.getBool("sfx_mute");
}
-#endif
+
+ config->musicvol = ConfMan.getInt("music_volume");
+ config->effectsvol = ConfMan.getInt("sfx_volume");
}
void config_save(CONFIG *config) {
-#if 0
- FILE *fp = fopen(config_ini, "w");
+ ConfMan.setBool("mute", !(config->music || config->effectsvol));
+ ConfMan.setBool("music_mute", !config->music);
+ ConfMan.setBool("sfx_mute", !config->effects);
+ ConfMan.setInt("music_volume", config->musicvol);
+ ConfMan.setInt("sfx_volume", config->effectsvol);
- if (fp) {
- PRINT("%s", "SCR_WIDTH:");
- PRINT("%i", config->scr_width);
- PRINT("%s", "SCR_HEIGHT:");
- PRINT("%i", config->scr_height);
- PRINT("%s", "SCR_BITS:");
- PRINT("%i", config->scr_bpp);
- PRINT("%s", config->hwaccel ? "HWACCEL:YES" : "HWACCEL:NO");
- PRINT("%s", config->hwsurface ? "HWSURFACE:YES" : "HWSURFACE:NO");
- PRINT("%s", config->fullscreen ? "FULLSCREEN:YES" : "FULLSCREEN:NO");
- PRINT("%s", config->music ? "MUSIC:YES" : "MUSIC:NO");
- PRINT("%s", config->effects ? "SNDEFFECTS:YES" : "SNDEFFECTS:NO");
- PRINT("%s", "opmusicvol:");
- PRINT("%i", config->musicvol);
- PRINT("%s", "opeffectsvol:");
- PRINT("%i", config->effectsvol);
- fclose(fp);
- }
-#endif
+ ConfMan.flushToDisk();
}
} // end of namespace Griffon
diff --git a/engines/griffon/config.h b/engines/griffon/config.h
index 187ff28..686b8ef 100644
--- a/engines/griffon/config.h
+++ b/engines/griffon/config.h
@@ -40,12 +40,6 @@
namespace Griffon {
struct CONFIG {
- int scr_width;
- int scr_height;
- int scr_bpp;
- bool fullscreen;
- int hwaccel;
- int hwsurface; // Unused
bool music;
int musicvol;
bool effects;
@@ -53,7 +47,6 @@ struct CONFIG {
};
extern CONFIG config;
-extern char config_ini[];
void config_load(CONFIG *config);
void config_save(CONFIG *config);
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 4031da7..8e20305 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -223,9 +223,6 @@ void GriffonEngine::configMenu() {
int ticks1 = _ticks;
- config.musicvol = ConfMan.getInt("music_volume");
- config.effectsvol = ConfMan.getInt("sfx_volume");
-
do {
_videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index d954269..33d1134 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -32,6 +32,7 @@
#include "engines/util.h"
#include "griffon/griffon.h"
+#include "griffon/config.h"
#include "griffon/console.h"
namespace Griffon {
@@ -51,14 +52,21 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
_menuchannel = -1;
_loopseta = 0;
-
clouddeg = 0.0f;
+
+ // Synchronize the sound settings from ScummVM
+ syncSoundSettings();
+ config_load(&config);
}
GriffonEngine::~GriffonEngine() {
delete _rnd;
}
+void GriffonEngine::syncSoundSettings() {
+ Engine::syncSoundSettings();
+}
+
Common::Error GriffonEngine::run() {
initGraphics(320, 240, new Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 55fedeb..0a8c06a 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -286,6 +286,7 @@ public:
~GriffonEngine();
virtual Common::Error run();
+ virtual void syncSoundSettings();
private:
Common::RandomSource *_rnd;
Commit: 51c1a11a464a3a1d24ce038770a3bd25f9a1e61f
https://github.com/scummvm/scummvm/commit/51c1a11a464a3a1d24ce038770a3bd25f9a1e61f
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Remove unused macros in config
Changed paths:
engines/griffon/config.cpp
diff --git a/engines/griffon/config.cpp b/engines/griffon/config.cpp
index 5e6d442..09d7e49 100644
--- a/engines/griffon/config.cpp
+++ b/engines/griffon/config.cpp
@@ -41,20 +41,6 @@ namespace Griffon {
CONFIG config;
-#define PRINT(A,B) \
- do { \
- char line[256]; \
- sprintf(line, A "\n", B); \
- fputs(line, fp); \
- } while(0)
-
-#define INPUT(A, B) \
- do { \
- char line[256]; \
- fgets(line, sizeof(line), fp); \
- sscanf(line, A, B); \
- } while(0)
-
void config_load(CONFIG *config) {
bool mute = false;
if (ConfMan.hasKey("mute"))
Commit: cb9603b624aeb62ada20bca2b072cfca18d6a5d1
https://github.com/scummvm/scummvm/commit/cb9603b624aeb62ada20bca2b072cfca18d6a5d1
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix define name in griffon.h
Changed paths:
engines/griffon/griffon.h
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 0a8c06a..dfd03da 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -33,8 +33,8 @@
*
*/
-#ifndef GRIFFON_H
-#define GRIFFON_H
+#ifndef GRIFFON_GRIFFON_H
+#define GRIFFON_GRIFFON_H
#include "common/scummsys.h"
#include "common/events.h"
@@ -511,4 +511,4 @@ private:
}
-#endif
+#endif // GRIFFON_GRIFFON_H
Commit: 3af6c2132a816ffed57f9cf8f9bfd12f5cf6f872
https://github.com/scummvm/scummvm/commit/3af6c2132a816ffed57f9cf8f9bfd12f5cf6f872
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Remove some unused class members
Changed paths:
engines/griffon/dialogs.cpp
engines/griffon/engine.cpp
engines/griffon/griffon.h
engines/griffon/sound.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 8e20305..cefc30b 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -561,10 +561,7 @@ void GriffonEngine::saveLoadNew() {
_player.attackSpeed = 1.5f;
_pgardens = false;
- _ptown = false;
_pboss = false;
- _pacademy = false;
- _pcitadel = false;
haltSoundChannel(-1);
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index e2281b3..00aed92 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -316,10 +316,7 @@ void GriffonEngine::newGame() {
_player.walkDir = 1;
_pgardens = false;
- _ptown = false;
_pboss = false;
- _pacademy = false;
- _pcitadel = false;
loadMap(2);
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index dfd03da..364e769 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -485,7 +485,6 @@ private:
// music info
DataChunk *_mgardens, *_mgardens2, *_mgardens3, *_mgardens4, *_mboss, *_mmenu, *_mendofgame;
int _musicchannel, _menuchannel;
- bool _ptown, _pacademy, _pcitadel; // CHECKME: They look unused.
bool _pboss;
bool _pgardens;
int _loopseta;
diff --git a/engines/griffon/sound.cpp b/engines/griffon/sound.cpp
index 44373c9..f80050d 100644
--- a/engines/griffon/sound.cpp
+++ b/engines/griffon/sound.cpp
@@ -210,9 +210,6 @@ void GriffonEngine::updateMusic() {
_pboss = false;
_pgardens = false;
- _ptown = false;
- _pacademy = false;
- _pcitadel = false;
if (iplaysound == _mboss)
_pboss = true;
Commit: 1a1c663ddd3531542610e7d0b2cb941add382916
https://github.com/scummvm/scummvm/commit/1a1c663ddd3531542610e7d0b2cb941add382916
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Some renaming
Changed paths:
engines/griffon/cutscenes.cpp
engines/griffon/dialogs.cpp
engines/griffon/engine.cpp
engines/griffon/griffon.cpp
engines/griffon/griffon.h
engines/griffon/sound.cpp
diff --git a/engines/griffon/cutscenes.cpp b/engines/griffon/cutscenes.cpp
index 79bc5da..ef77c76 100644
--- a/engines/griffon/cutscenes.cpp
+++ b/engines/griffon/cutscenes.cpp
@@ -182,8 +182,8 @@ void GriffonEngine::intro() {
if (config.music) {
haltSoundChannel(-1);
- _musicchannel = playSound(_mendofgame, true);
- setChannelVolume(_musicchannel, 0);
+ _musicChannel = playSound(_mendofgame, true);
+ setChannelVolume(_musicChannel, 0);
}
_secsingame = 0;
@@ -200,7 +200,7 @@ void GriffonEngine::intro() {
if ((int)ld > config.musicvol)
ld = config.musicvol;
if (!ldstop) {
- setChannelVolume(_musicchannel, (int)ld);
+ setChannelVolume(_musicChannel, (int)ld);
if ((int)ld == config.musicvol)
ldstop = true;
}
@@ -276,8 +276,8 @@ void GriffonEngine::endOfGame() {
if (config.music) {
haltSoundChannel(-1);
- _musicchannel = playSound(_mendofgame, true);
- setChannelVolume(_musicchannel, 0);
+ _musicChannel = playSound(_mendofgame, true);
+ setChannelVolume(_musicChannel, 0);
}
int ticks1 = _ticks;
@@ -295,7 +295,7 @@ void GriffonEngine::endOfGame() {
if (ld > config.musicvol)
ld = config.musicvol;
if (!ldstop) {
- setChannelVolume(_musicchannel, (int)ld);
+ setChannelVolume(_musicChannel, (int)ld);
if ((int)ld == config.musicvol)
ldstop = true;
}
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index cefc30b..7ef03ef 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -67,11 +67,11 @@ void GriffonEngine::title(int mode) {
int ticks1 = _ticks;
if (config.music) {
- setChannelVolume(_musicchannel, 0);
- pauseSoundChannel(_musicchannel);
+ setChannelVolume(_musicChannel, 0);
+ pauseSoundChannel(_musicChannel);
- _menuchannel = playSound(_mmenu, true);
- setChannelVolume(_menuchannel, config.musicvol);
+ _menuChannel = playSound(_mmenu, true);
+ setChannelVolume(_menuChannel, config.musicvol);
_pmenu = true;
}
@@ -85,7 +85,7 @@ void GriffonEngine::title(int mode) {
if (ld > config.musicvol)
ld = config.musicvol;
if (!ldstop) {
- setChannelVolume(_menuchannel, (int)ld);
+ setChannelVolume(_menuChannel, (int)ld);
if ((int)ld == config.musicvol)
ldstop = true;
}
@@ -203,9 +203,9 @@ void GriffonEngine::title(int mode) {
_itemticks = _ticks + 210;
if (config.music) {
- haltSoundChannel(_menuchannel);
- resumeSoundChannel(_musicchannel);
- setChannelVolume(_musicchannel, config.musicvol);
+ haltSoundChannel(_menuChannel);
+ resumeSoundChannel(_musicChannel);
+ setChannelVolume(_musicChannel, config.musicvol);
_pmenu = false;
}
}
@@ -362,16 +362,16 @@ void GriffonEngine::configMenu() {
if (config.musicvol < 0)
config.musicvol = 0;
- setChannelVolume(_musicchannel, config.musicvol);
- setChannelVolume(_menuchannel, config.musicvol);
+ setChannelVolume(_musicChannel, config.musicvol);
+ setChannelVolume(_menuChannel, config.musicvol);
} else if (cursel == 12) {
config.effectsvol -= 25;
if (config.effectsvol < 0)
config.effectsvol = 0;
setChannelVolume(-1, config.effectsvol);
- setChannelVolume(_musicchannel, config.musicvol);
- setChannelVolume(_menuchannel, config.musicvol);
+ setChannelVolume(_musicChannel, config.musicvol);
+ setChannelVolume(_menuChannel, config.musicvol);
if (config.effects) {
int snd = playSound(_sfx[kSndDoor]);
@@ -385,16 +385,16 @@ void GriffonEngine::configMenu() {
if (config.musicvol > 255)
config.musicvol = 255;
- setChannelVolume(_musicchannel, config.musicvol);
- setChannelVolume(_menuchannel, config.musicvol);
+ setChannelVolume(_musicChannel, config.musicvol);
+ setChannelVolume(_menuChannel, config.musicvol);
} else if (cursel == 12) {
config.effectsvol += 25;
if (config.effectsvol > 255)
config.effectsvol = 255;
setChannelVolume(-1, config.effectsvol);
- setChannelVolume(_musicchannel, config.musicvol);
- setChannelVolume(_menuchannel, config.musicvol);
+ setChannelVolume(_musicChannel, config.musicvol);
+ setChannelVolume(_menuChannel, config.musicvol);
if (config.effects) {
int snd = playSound(_sfx[kSndDoor]);
@@ -417,13 +417,13 @@ void GriffonEngine::configMenu() {
if (_event.kbd.keycode == Common::KEYCODE_RETURN) {
if (cursel == 7 && !config.music) {
config.music = true;
- _menuchannel = playSound(_mmenu, true);
- setChannelVolume(_menuchannel, config.musicvol);
+ _menuChannel = playSound(_mmenu, true);
+ setChannelVolume(_menuChannel, config.musicvol);
}
if (cursel == 8 && config.music) {
config.music = false;
- haltSoundChannel(_musicchannel);
- haltSoundChannel(_menuchannel);
+ haltSoundChannel(_musicChannel);
+ haltSoundChannel(_menuChannel);
}
if (cursel == 9 && !config.effects) {
config.effects = true;
@@ -560,8 +560,8 @@ void GriffonEngine::saveLoadNew() {
attacking = false;
_player.attackSpeed = 1.5f;
- _pgardens = false;
- _pboss = false;
+ _playingGardens = false;
+ _playingBoss = false;
haltSoundChannel(-1);
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 00aed92..b8f7e30 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -52,7 +52,7 @@ void GriffonEngine::mainLoop() {
swash();
if (_pmenu) {
- haltSoundChannel(_menuchannel);
+ haltSoundChannel(_menuChannel);
_pmenu = false;
}
@@ -315,8 +315,8 @@ void GriffonEngine::newGame() {
_player.py = 6 * 16 - 4;
_player.walkDir = 1;
- _pgardens = false;
- _pboss = false;
+ _playingGardens = false;
+ _playingBoss = false;
loadMap(2);
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index 33d1134..aaa69c7 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -48,8 +48,8 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
_shouldQuit = false;
- _musicchannel = -1;
- _menuchannel = -1;
+ _musicChannel = -1;
+ _menuChannel = -1;
_loopseta = 0;
clouddeg = 0.0f;
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 364e769..d82d44b 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -484,9 +484,8 @@ private:
// music info
DataChunk *_mgardens, *_mgardens2, *_mgardens3, *_mgardens4, *_mboss, *_mmenu, *_mendofgame;
- int _musicchannel, _menuchannel;
- bool _pboss;
- bool _pgardens;
+ int _musicChannel, _menuChannel;
+ bool _playingBoss, _playingGardens;
int _loopseta;
DataChunk *_sfx[21];
diff --git a/engines/griffon/sound.cpp b/engines/griffon/sound.cpp
index f80050d..59e7b07 100644
--- a/engines/griffon/sound.cpp
+++ b/engines/griffon/sound.cpp
@@ -193,50 +193,53 @@ void GriffonEngine::updateMusic() {
DataChunk *iplaysound = NULL;
if (config.music) {
-
// if(_curmap > 5 && _curmap < 42) iplaysound = macademy;
// if(_curmap > 47) iplaysound = _mgardens;
iplaysound = _mgardens;
if (_roomlock)
iplaysound = _mboss;
- if (iplaysound == _mboss && _pboss)
+ if (iplaysound == _mboss && _playingBoss)
iplaysound = NULL;
- if (iplaysound == _mgardens && _pgardens)
+ if (iplaysound == _mgardens && _playingGardens)
iplaysound = NULL;
if (iplaysound != NULL) {
- haltSoundChannel(_musicchannel);
-
- _pboss = false;
- _pgardens = false;
+ haltSoundChannel(_musicChannel);
- if (iplaysound == _mboss)
- _pboss = true;
- if (iplaysound == _mgardens)
- _pgardens = true;
+ _playingBoss = (iplaysound == _mboss);
+ _playingGardens = (iplaysound == _mgardens);
- _musicchannel = playSound(iplaysound, true);
- setChannelVolume(_musicchannel, config.musicvol);
+ _musicChannel = playSound(iplaysound, true);
+ setChannelVolume(_musicChannel, config.musicvol);
} else {
- if (!isSoundChannelPlaying(_musicchannel)) {
+ if (!isSoundChannelPlaying(_musicChannel)) {
_loopseta += 1;
if (_loopseta == 4)
_loopseta = 0;
- if (_pgardens) {
- haltSoundChannel(_musicchannel);
- if (_pgardens && _loopseta == 0)
- _musicchannel = playSound(_mgardens);
- if (_pgardens && _loopseta == 1)
- _musicchannel = playSound(_mgardens2);
- if (_pgardens && _loopseta == 2)
- _musicchannel = playSound(_mgardens3);
- if (_pgardens && _loopseta == 3)
- _musicchannel = playSound(_mgardens4);
+ if (_playingGardens) {
+ haltSoundChannel(_musicChannel);
+ if (_playingGardens) {
+ switch (_loopseta) {
+ case 0:
+ playSound(_mgardens);
+ break;
+ case 1:
+ playSound(_mgardens2);
+ break;
+ case 2:
+ playSound(_mgardens3);
+ break;
+ case 3:
+ playSound(_mgardens4);
+ default:
+ break;
+ }
+ }
}
- setChannelVolume(_musicchannel, config.musicvol);
+ setChannelVolume(_musicChannel, config.musicvol);
}
}
}
Commit: d87897a5c49b4aded7fd44a5048b0efd37c85bf7
https://github.com/scummvm/scummvm/commit/d87897a5c49b4aded7fd44a5048b0efd37c85bf7
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: make loopseta a local static, reduce size of sfx array, use constants for sfx loading
Changed paths:
engines/griffon/griffon.cpp
engines/griffon/griffon.h
engines/griffon/sound.cpp
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index aaa69c7..d107f4f 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -51,7 +51,6 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
_musicChannel = -1;
_menuChannel = -1;
- _loopseta = 0;
clouddeg = 0.0f;
// Synchronize the sound settings from ScummVM
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index d82d44b..af9ef9c 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -486,9 +486,8 @@ private:
DataChunk *_mgardens, *_mgardens2, *_mgardens3, *_mgardens4, *_mboss, *_mmenu, *_mendofgame;
int _musicChannel, _menuChannel;
bool _playingBoss, _playingGardens;
- int _loopseta;
- DataChunk *_sfx[21];
+ DataChunk *_sfx[15];
Audio::SoundHandle _handles[kSoundHandles];
Audio::Mixer *_mixer;
diff --git a/engines/griffon/sound.cpp b/engines/griffon/sound.cpp
index 59e7b07..c2de94d 100644
--- a/engines/griffon/sound.cpp
+++ b/engines/griffon/sound.cpp
@@ -158,38 +158,40 @@ void GriffonEngine::setupAudio() {
_mmenu = cacheSound("music/menu.ogg");
drawProgress(7, 21);
- _sfx[0] = cacheSound("sfx/bite.ogg");
+ _sfx[kSndBite] = cacheSound("sfx/bite.ogg");
drawProgress(8, 21);
- _sfx[1] = cacheSound("sfx/crystal.ogg");
+ _sfx[kSndCrystal] = cacheSound("sfx/crystal.ogg");
drawProgress(9, 21);
- _sfx[2] = cacheSound("sfx/door.ogg");
+ _sfx[kSndDoor] = cacheSound("sfx/door.ogg");
drawProgress(10, 21);
- _sfx[3] = cacheSound("sfx/enemyhit.ogg");
+ _sfx[kSndEnemyHit] = cacheSound("sfx/enemyhit.ogg");
drawProgress(11, 21);
- _sfx[4] = cacheSound("sfx/ice.ogg");
+ _sfx[kSndIce] = cacheSound("sfx/ice.ogg");
drawProgress(12, 21);
- _sfx[5] = cacheSound("sfx/lever.ogg");
+ _sfx[kSndLever] = cacheSound("sfx/lever.ogg");
drawProgress(13, 21);
- _sfx[6] = cacheSound("sfx/lightning.ogg");
+ _sfx[kSndLightning] = cacheSound("sfx/lightning.ogg");
drawProgress(14, 21);
- _sfx[7] = cacheSound("sfx/metalhit.ogg");
+ _sfx[kSndMetalHit] = cacheSound("sfx/metalhit.ogg");
drawProgress(15, 21);
- _sfx[8] = cacheSound("sfx/powerup.ogg");
+ _sfx[kSndPowerUp] = cacheSound("sfx/powerup.ogg");
drawProgress(16, 21);
- _sfx[9] = cacheSound("sfx/rocks.ogg");
+ _sfx[kSndRocks] = cacheSound("sfx/rocks.ogg");
drawProgress(17, 21);
- _sfx[10] = cacheSound("sfx/swordhit.ogg");
+ _sfx[kSndSwordHit] = cacheSound("sfx/swordhit.ogg");
drawProgress(18, 21);
- _sfx[11] = cacheSound("sfx/throw.ogg");
+ _sfx[kSndThrow] = cacheSound("sfx/throw.ogg");
drawProgress(19, 21);
- _sfx[12] = cacheSound("sfx/chest.ogg");
+ _sfx[kSndChest] = cacheSound("sfx/chest.ogg");
drawProgress(20, 21);
- _sfx[13] = cacheSound("sfx/fire.ogg");
+ _sfx[kSndFire] = cacheSound("sfx/fire.ogg");
drawProgress(21, 21);
- _sfx[14] = cacheSound("sfx/beep.ogg");
+ _sfx[kSndBeep] = cacheSound("sfx/beep.ogg");
}
void GriffonEngine::updateMusic() {
+ static int loopseta = 0;
+
DataChunk *iplaysound = NULL;
if (config.music) {
@@ -214,14 +216,14 @@ void GriffonEngine::updateMusic() {
setChannelVolume(_musicChannel, config.musicvol);
} else {
if (!isSoundChannelPlaying(_musicChannel)) {
- _loopseta += 1;
- if (_loopseta == 4)
- _loopseta = 0;
+ loopseta += 1;
+ if (loopseta == 4)
+ loopseta = 0;
if (_playingGardens) {
haltSoundChannel(_musicChannel);
if (_playingGardens) {
- switch (_loopseta) {
+ switch (loopseta) {
case 0:
playSound(_mgardens);
break;
Commit: 499e427c2853d64cd49b3d8e64a632ac07f8bef8
https://github.com/scummvm/scummvm/commit/499e427c2853d64cd49b3d8e64a632ac07f8bef8
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Add a de fine for Pi, change some casts to int16
Changed paths:
engines/griffon/dialogs.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 7ef03ef..8dbde31 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -45,6 +45,7 @@ namespace Griffon {
#define MINCURSEL 7
#define MAXCURSEL 14
#define SY 22
+#define PI 3.141593
void GriffonEngine::title(int mode) {
float xofs = 0;
@@ -117,8 +118,8 @@ void GriffonEngine::title(int mode) {
else
drawString(_videobuffer, "(c) 2005 by Daniel 'Syn9' Kennedy", 28, 224, 4);
- rc.left = (float)(x - 16 - 4 * cos(3.14159 * 2 * _itemyloc / 16));
- rc.top = (float)(y - 4 + 16 * cursel);
+ rc.left = (int16)(x - 16 - 4 * cos(2 * PI * _itemyloc / 16));
+ rc.top = (int16)(y - 4 + 16 * cursel);
_itemimg[15]->blit(*_videobuffer, rc.left, rc.top);
@@ -226,8 +227,8 @@ void GriffonEngine::configMenu() {
do {
_videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
- rcDest.left = 256 + 256 * cos(3.141592 / 180 * clouddeg * 40);
- rcDest.top = 192 + 192 * sin(3.141592 / 180 * clouddeg * 40);
+ rcDest.left = 256 + 256 * cos(PI / 180 * clouddeg * 40);
+ rcDest.top = 192 + 192 * sin(PI / 180 * clouddeg * 40);
rcDest.setWidth(320);
rcDest.setHeight(240);
@@ -310,7 +311,7 @@ void GriffonEngine::configMenu() {
curselt += 1;
Common::Rect rc;
- rc.left = 148 + 3 * cos(3.14159 * 2 * _itemyloc / 16.0);
+ rc.left = 148 + 3 * cos(2 * PI * _itemyloc / 16.0);
rc.top = sy + 8 * curselt - 4;
_itemimg[15]->blit(*_videobuffer, rc.left, rc.top);
@@ -406,11 +407,11 @@ void GriffonEngine::configMenu() {
if (_event.kbd.keycode == Common::KEYCODE_UP) {
cursel--;
if (cursel < MINCURSEL)
- cursel = 14;
+ cursel = MAXCURSEL;
}
if (_event.kbd.keycode == Common::KEYCODE_DOWN) {
++cursel;
- if (cursel > 14)
+ if (cursel > MAXCURSEL)
cursel = MINCURSEL;
}
@@ -482,8 +483,8 @@ void GriffonEngine::saveLoadNew() {
y += 1 * _fpsr;
- rcDest.left = 256 + 256 * cos(3.141592 / 180 * clouddeg * 40);
- rcDest.top = 192 + 192 * sin(3.141592 / 180 * clouddeg * 40);
+ rcDest.left = 256 + 256 * cos(PI / 180 * clouddeg * 40);
+ rcDest.top = 192 + 192 * sin(PI / 180 * clouddeg * 40);
rcDest.setWidth(320);
rcDest.setHeight(240);
@@ -545,7 +546,7 @@ void GriffonEngine::saveLoadNew() {
if (lowerLock && curcol == 1 && tickpause < _ticks) {
if (saveState(currow - 1)) {
- _secstart = _secstart + _secsingame;
+ _secstart += _secsingame;
_secsingame = 0;
lowerLock = false;
_saveslot = currow - 1;
@@ -668,13 +669,13 @@ void GriffonEngine::saveLoadNew() {
ss = 18;
_itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
- rcSrc.left = rcSrc.left + 16;
+ rcSrc.left += 16;
ss = (_playera.shield - 1) * 3 + 1;
if (_playera.shield == 3)
ss = 19;
_itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
- rcSrc.left = rcSrc.left + 16;
+ rcSrc.left += 16;
ss = (_playera.armour - 1) * 3 + 2;
if (_playera.armour == 3)
ss = 20;
@@ -700,20 +701,28 @@ void GriffonEngine::saveLoadNew() {
if (currow == 0) {
rcDest.top = 18;
- if (curcol == 0)
- rcDest.left = 10;
- if (curcol == 1)
- rcDest.left = 108;
- if (curcol == 2)
- rcDest.left = 170;
- if (curcol == 3)
- rcDest.left = 230;
- rcDest.left = (float)(rcDest.left + 2 + 2 * sin(3.14159 * 2 * _itemyloc / 16));
+ switch(curcol) {
+ case 0:
+ rcDest.left = 10;
+ break;
+ case 1:
+ rcDest.left = 108;
+ break;
+ case 2:
+ rcDest.left = 170;
+ break;
+ case 3:
+ rcDest.left = 230;
+ default:
+ break;
+ }
+
+ rcDest.left += (int16)(2 + 2 * sin(2 * PI * _itemyloc / 16));
}
if (currow > 0) {
- rcDest.left = (float)(0 + 2 * sin(3.14159 * 2 * _itemyloc / 16));
- rcDest.top = (float)(53 + (currow - 1) * 48);
+ rcDest.left = (int16)(0 + 2 * sin(2 * PI * _itemyloc / 16));
+ rcDest.top = (int16)(53 + (currow - 1) * 48);
}
_itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
@@ -723,11 +732,11 @@ void GriffonEngine::saveLoadNew() {
rcDest.top = 18;
if (curcol == 1)
rcDest.left = 108;
- if (curcol == 2)
+ else if (curcol == 2)
rcDest.left = 170;
// CHECKME: Useless code? or temporary commented?
- // rcDest.left = rcDest.left; // + 2 + 2 * sin(-3.14159 * 2 * _itemyloc / 16)
+ // rcDest.left = rcDest.left; // + 2 + 2 * sin(-2 * PI * _itemyloc / 16)
_itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
}
Commit: c8dd272de836436011cb2b27b86dce1e8abc3807
https://github.com/scummvm/scummvm/commit/c8dd272de836436011cb2b27b86dce1e8abc3807
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix to for loop in drawNPCs
Changed paths:
engines/griffon/draw.cpp
engines/griffon/griffon.cpp
diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp
index 4810667..d224c9f 100644
--- a/engines/griffon/draw.cpp
+++ b/engines/griffon/draw.cpp
@@ -507,7 +507,7 @@ void GriffonEngine::drawNPCs(int mode) {
// onewing
if (_npcinfo[i].spriteset == kMonsterOneWing) {
- for (int f = 0; f <= 7; f++) {
+ for (int f = 0; f < 7; f++) {
int s = _npcinfo[i].bodysection[f].sprite;
rcSrc.left = _animset2[s].x;
rcSrc.top = _animset2[s].y;
@@ -524,7 +524,7 @@ void GriffonEngine::drawNPCs(int mode) {
// twowing
if (_npcinfo[i].spriteset == kMonsterTwoWing) {
- for (int f = 0; f <= 7; f++) {
+ for (int f = 0; f < 7; f++) {
int yp = 0;
if (f == 0 && (_curmap == 53 || _curmap == 57 || _curmap == 61 || _curmap == 65 || _curmap == 56 || _curmap > 66) && _scriptflag[kScriptLever][0] > 0)
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index d107f4f..3fcd4e4 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -53,6 +53,11 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
clouddeg = 0.0f;
+ for (int i = 0; i < 33; ++i) {
+ for (int j = 0; j < 6; ++j)
+ _objectInfo[i][j] = 0;
+ }
+
// Synchronize the sound settings from ScummVM
syncSoundSettings();
config_load(&config);
Commit: 98e53ece57b9d22fd1029e45a498625266206e6c
https://github.com/scummvm/scummvm/commit/98e53ece57b9d22fd1029e45a498625266206e6c
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix uninitialized variables (game crash)
Changed paths:
engines/griffon/griffon.cpp
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index 3fcd4e4..03cf396 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -58,6 +58,11 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
_objectInfo[i][j] = 0;
}
+ for (int i = 0; i < 256; ++i) {
+ _objectFrame[i][0] = 0;
+ _objectFrame[i][1] = 0;
+ }
+
// Synchronize the sound settings from ScummVM
syncSoundSettings();
config_load(&config);
Commit: 7a549f85205b2b9663dcb18f7eaffc2c2b2afd5b
https://github.com/scummvm/scummvm/commit/7a549f85205b2b9663dcb18f7eaffc2c2b2afd5b
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix another game crash due to an uninitialized variable
Changed paths:
engines/griffon/engine.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index b8f7e30..20cff62 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -318,6 +318,8 @@ void GriffonEngine::newGame() {
_playingGardens = false;
_playingBoss = false;
+ _player.spellStrength = 0;
+
loadMap(2);
mainLoop();
Commit: 83e41cd04bcdc747c79bd17dcc20b78d7daa7dde
https://github.com/scummvm/scummvm/commit/83e41cd04bcdc747c79bd17dcc20b78d7daa7dde
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Some refactoring in dialogs
Changed paths:
engines/griffon/dialogs.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 8dbde31..374625d 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -49,6 +49,7 @@ namespace Griffon {
void GriffonEngine::title(int mode) {
float xofs = 0;
+ bool exitTitle = false;
rcSrc.left = 0;
rcSrc.top = 0;
@@ -168,38 +169,52 @@ void GriffonEngine::title(int mode) {
if (_event.type == Common::EVENT_KEYDOWN) {
keypause = _ticks + 150;
- if (_event.kbd.keycode == Common::KEYCODE_ESCAPE && mode == 1)
- break;
- else if (_event.kbd.keycode == Common::KEYCODE_UP) {
- cursel--;
- if (cursel < 0)
- cursel = (mode == 1 ? 3 : 2);
- } else if (_event.kbd.keycode == Common::KEYCODE_DOWN) {
- cursel++;
- if (cursel >= (mode == 1 ? 4 : 3))
- cursel = 0;
- } else if (_event.kbd.keycode == Common::KEYCODE_RETURN) {
- if (cursel == 0) {
- saveLoadNew();
- _ticks = g_system->getMillis();
- keypause = _ticks + 150;
- ticks1 = _ticks;
- } else if (cursel == 1) {
- configMenu();
- _ticks = g_system->getMillis();
- keypause = _ticks + 150;
- ticks1 = _ticks;
- } else if (cursel == 2) {
- _shouldQuit = true;
- } else if (cursel == 3) {
+ switch(_event.kbd.keycode){
+ case Common::KEYCODE_ESCAPE:
+ if (mode == 1)
+ exitTitle = true;
+ break;
+ case Common::KEYCODE_UP:
+ cursel--;
+ if (cursel < 0)
+ cursel = (mode == 1 ? 3 : 2);
+ break;
+ case Common::KEYCODE_DOWN:
+ cursel++;
+ if (cursel >= (mode == 1 ? 4 : 3))
+ cursel = 0;
+ break;
+ case Common::KEYCODE_RETURN:
+ switch(cursel) {
+ case 0:
+ saveLoadNew();
+ _ticks = g_system->getMillis();
+ keypause = _ticks + 150;
+ ticks1 = _ticks;
+ break;
+ case 1:
+ configMenu();
+ _ticks = g_system->getMillis();
+ keypause = _ticks + 150;
+ ticks1 = _ticks;
+ break;
+ case 2:
+ _shouldQuit = true;
+ break;
+ case 3:
+ exitTitle = true;
+ default:
+ break;
+ }
+ break;
+ default:
break;
- }
}
}
}
g_system->delayMillis(10);
- } while (!_shouldQuit);
+ } while (!_shouldQuit && !exitTitle);
_itemticks = _ticks + 210;
@@ -212,7 +227,29 @@ void GriffonEngine::title(int mode) {
}
void GriffonEngine::configMenu() {
+ static const char *vr[22] = {
+ "", "",
+ "", "", "", "",
+ "", "", "",
+ "Music:", "", "",
+ "Sound Effects:", "", "",
+ "Music Volume:", "",
+ "Effects Volume:", "", "", "", ""
+ };
+ static const char *vl[22] = {
+ "", "",
+ "", "", "", "",
+ "", "", "",
+ "On", "Off", "",
+ "On", "Off", "",
+ "[----------]", "",
+ "[----------]", "",
+ "Exit + Save", "",
+ "Exit"
+ };
+
int cursel = MINCURSEL;
+ bool exitMenu = false;
int tickwait = 1000 / 60;
@@ -250,26 +287,6 @@ void GriffonEngine::configMenu() {
int sy = SY;
for (int i = 0; i <= 21; i++) {
- static const char *vr[22] = {
- "", "",
- "", "", "", "",
- "", "", "",
- "Music:", "", "",
- "Sound Effects:", "", "",
- "Music Volume:", "",
- "Effects Volume:", "", "", "", ""
- };
- static const char *vl[22] = {
- "", "",
- "", "", "", "",
- "", "", "",
- "On", "Off", "",
- "On", "Off", "",
- "[----------]", "",
- "[----------]", "",
- "Exit + Save", "",
- "Exit"
- };
static char line[24];
if (i == 15 || i == 17) {
@@ -416,34 +433,39 @@ void GriffonEngine::configMenu() {
}
if (_event.kbd.keycode == Common::KEYCODE_RETURN) {
- if (cursel == 7 && !config.music) {
- config.music = true;
- _menuChannel = playSound(_mmenu, true);
- setChannelVolume(_menuChannel, config.musicvol);
- }
- if (cursel == 8 && config.music) {
- config.music = false;
- haltSoundChannel(_musicChannel);
- haltSoundChannel(_menuChannel);
- }
- if (cursel == 9 && !config.effects) {
- config.effects = true;
- int snd = playSound(_sfx[kSndDoor]);
- setChannelVolume(snd, config.effectsvol);
- }
-
- if (cursel == 10 && config.effects)
- config.effects = false;
-
- if (cursel == 13) {
- config_save(&config);
- break;
- }
-
- if (cursel == 14) {
- // reset keys to avoid returning
- // keys[SDLK_SPACE] = keys[SDLK_RETURN] = 0; // FIXME
- break;
+ switch (cursel) {
+ case 7:
+ if (!config.music) {
+ config.music = true;
+ _menuChannel = playSound(_mmenu, true);
+ setChannelVolume(_menuChannel, config.musicvol);
+ }
+ break;
+ case 8:
+ if (config.music) {
+ config.music = false;
+ haltSoundChannel(_musicChannel);
+ haltSoundChannel(_menuChannel);
+ }
+ break;
+ case 9:
+ if (!config.effects) {
+ config.effects = true;
+ int snd = playSound(_sfx[kSndDoor]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+ break;
+ case 10:
+ if (config.effects)
+ config.effects = false;
+ break;
+ case 13:
+ config_save(&config);
+ // no break on purpose
+ case 14:
+ exitMenu = true;
+ default:
+ break;
}
}
}
@@ -454,7 +476,7 @@ void GriffonEngine::configMenu() {
clouddeg -= 360;
g_system->delayMillis(10);
- } while (!_shouldQuit);
+ } while (!_shouldQuit && !exitMenu);
configwindow->free();
_itemticks = _ticks + 210;
@@ -543,7 +565,6 @@ void GriffonEngine::saveLoadNew() {
tickpause = _ticks + 125;
}
-
if (lowerLock && curcol == 1 && tickpause < _ticks) {
if (saveState(currow - 1)) {
_secstart += _secsingame;
Commit: bf94210ad975b9668006fddc4a085b024214817b
https://github.com/scummvm/scummvm/commit/bf94210ad975b9668006fddc4a085b024214817b
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: simplify some code in draw by using clip
Changed paths:
engines/griffon/draw.cpp
diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp
index d224c9f..9cc5ae8 100644
--- a/engines/griffon/draw.cpp
+++ b/engines/griffon/draw.cpp
@@ -1113,10 +1113,7 @@ void GriffonEngine::drawPlayer() {
int ww = 14 * _player.hp / _player.maxHp;
- if (ww > 14)
- ww = 14;
- if (ww < 1)
- ww = 1;
+ ww = CLIP(ww, 1, 14);
rcDest.setWidth(ww);
rcDest.setHeight(2);
Commit: 47e27334693bb5aad09d8ad481c34773438f1004
https://github.com/scummvm/scummvm/commit/47e27334693bb5aad09d8ad481c34773438f1004
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Some refactoring
Changed paths:
engines/griffon/combat.cpp
engines/griffon/config.cpp
engines/griffon/cutscenes.cpp
engines/griffon/dialogs.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp
index 2ef46c7..66f6eb5 100644
--- a/engines/griffon/combat.cpp
+++ b/engines/griffon/combat.cpp
@@ -52,9 +52,7 @@ void GriffonEngine::attack() {
if (ly > 0) {
int o2 = 0; // ??
int o = _objectMap[lx][ly - 1];
- if (ly > 1 && _curmap == 58)
- o2 = _objectMap[lx][ly - 2];
- if (ly > 1 && _curmap == 54)
+ if (ly > 1 && (_curmap == 54 || _curmap == 58))
o2 = _objectMap[lx][ly - 2];
// cst
@@ -63,7 +61,7 @@ void GriffonEngine::attack() {
o = 10;
int oscript = _objectInfo[o][5];
- if (oscript == 0 && _player.inventory[kInvFlask] < 9) {
+ if (oscript == kScriptFlask && _player.inventory[kInvFlask] < 9) {
_player.inventory[kInvFlask]++;
addFloatIcon(6, lx * 16, (ly - 1) * 16);
@@ -82,7 +80,7 @@ void GriffonEngine::attack() {
return;
}
- if (oscript == 0 && _player.inventory[kInvFlask] == 9) {
+ if (oscript == kScriptFlask && _player.inventory[kInvFlask] == 9) {
if (config.effects) {
int snd = playSound(_sfx[kSndChest]);
setChannelVolume(snd, config.effectsvol);
@@ -481,7 +479,7 @@ void GriffonEngine::castSpell(int spellnum, float homex, float homey, float enem
spellinfo[i].fireballs[nballs][3] = 0;
spellinfo[i].ballon[nballs] = 1;
- nballs = nballs + 1;
+ ++nballs;
}
}
}
diff --git a/engines/griffon/config.cpp b/engines/griffon/config.cpp
index 09d7e49..58ee59d 100644
--- a/engines/griffon/config.cpp
+++ b/engines/griffon/config.cpp
@@ -43,12 +43,11 @@ CONFIG config;
void config_load(CONFIG *config) {
bool mute = false;
+ config->music = config->effects = false;
+
if (ConfMan.hasKey("mute"))
mute = ConfMan.getBool("mute");
- config->music = mute;
- config->effects = mute;
-
if (!mute) {
config->music = !ConfMan.getBool("music_mute");
config->effects = !ConfMan.getBool("sfx_mute");
diff --git a/engines/griffon/cutscenes.cpp b/engines/griffon/cutscenes.cpp
index ef77c76..719e89f 100644
--- a/engines/griffon/cutscenes.cpp
+++ b/engines/griffon/cutscenes.cpp
@@ -252,7 +252,7 @@ void GriffonEngine::intro() {
add = 1;
xofs += add;
if (xofs >= 320)
- xofs = xofs - 320;
+ xofs -= 320;
g_system->getEventManager()->pollEvent(_event);
@@ -391,9 +391,9 @@ void GriffonEngine::endOfGame() {
float add = 0.5 * _fpsr;
if (add > 1)
add = 1;
- xofs = xofs + add;
+ xofs += add;
if (xofs >= 320)
- xofs = xofs - 320;
+ xofs -= 320;
if (_event.type == Common::EVENT_KEYDOWN)
spd = 1.0f;
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 374625d..7e606f1 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -227,7 +227,7 @@ void GriffonEngine::title(int mode) {
}
void GriffonEngine::configMenu() {
- static const char *vr[22] = {
+ static const char *optionTitles[22] = {
"", "",
"", "", "", "",
"", "", "",
@@ -236,7 +236,7 @@ void GriffonEngine::configMenu() {
"Music Volume:", "",
"Effects Volume:", "", "", "", ""
};
- static const char *vl[22] = {
+ static const char *optionValues[22] = {
"", "",
"", "", "", "",
"", "", "",
@@ -289,30 +289,27 @@ void GriffonEngine::configMenu() {
for (int i = 0; i <= 21; i++) {
static char line[24];
- if (i == 15 || i == 17) {
+ int destColumn = 3;
+ if (i == 9 && config.music)
+ destColumn = 0;
+ else if (i == 10 && !config.music)
+ destColumn = 0;
+ else if (i == 12 && config.effects)
+ destColumn = 0;
+ else if (i == 13 && !config.effects)
+ destColumn = 0;
+ else if (i == 15 || i == 17) {
int vol = (i == 15 ? config.musicvol : config.effectsvol) * 9 / 255;
vol = CLIP(vol, 0, 9);
strcpy(line, "[----------]");
line[vol + 1] = 'X';
- vl[i] = line;
- }
-
- int cl = 3;
-
- if (i == 9 && config.music)
- cl = 0;
- else if (i == 10 && !config.music)
- cl = 0;
- else if (i == 12 && config.effects)
- cl = 0;
- else if (i == 13 && !config.effects)
- cl = 0;
- else if (i > 18)
- cl = 0;
+ optionValues[i] = line;
+ } else if (i > 18)
+ destColumn = 0;
- drawString(_videobuffer, vr[i], 156 - 8 * strlen(vr[i]), sy + i * 8, 0);
- drawString(_videobuffer, vl[i], 164, sy + i * 8, cl);
+ drawString(_videobuffer, optionTitles[i], 156 - 8 * strlen(optionTitles[i]), sy + i * 8, 0);
+ drawString(_videobuffer, optionValues[i], 164, sy + i * 8, destColumn);
}
int curselt = cursel + 2;
@@ -376,17 +373,11 @@ void GriffonEngine::configMenu() {
if (_event.kbd.keycode == Common::KEYCODE_LEFT) {
if (cursel == 11) {
- config.musicvol -= 25;
- if (config.musicvol < 0)
- config.musicvol = 0;
-
+ config.musicvol = CLIP(config.musicvol - 25, 0, 255);
setChannelVolume(_musicChannel, config.musicvol);
setChannelVolume(_menuChannel, config.musicvol);
} else if (cursel == 12) {
- config.effectsvol -= 25;
- if (config.effectsvol < 0)
- config.effectsvol = 0;
-
+ config.effectsvol = CLIP(config.effectsvol - 25, 0, 255);
setChannelVolume(-1, config.effectsvol);
setChannelVolume(_musicChannel, config.musicvol);
setChannelVolume(_menuChannel, config.musicvol);
@@ -399,16 +390,11 @@ void GriffonEngine::configMenu() {
}
if (_event.kbd.keycode == Common::KEYCODE_RIGHT) {
if (cursel == 11) {
- config.musicvol += 25;
- if (config.musicvol > 255)
- config.musicvol = 255;
-
+ config.musicvol = CLIP(config.musicvol + 25, 0, 255);
setChannelVolume(_musicChannel, config.musicvol);
setChannelVolume(_menuChannel, config.musicvol);
} else if (cursel == 12) {
- config.effectsvol += 25;
- if (config.effectsvol > 255)
- config.effectsvol = 255;
+ config.effectsvol = CLIP(config.effectsvol + 25, 0, 255);
setChannelVolume(-1, config.effectsvol);
setChannelVolume(_musicChannel, config.musicvol);
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index af9ef9c..1a830f6 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -92,6 +92,7 @@ enum {
// in game scripts
enum {
+ kScriptFlask = 0, // get flask
kScriptMasterKey = 2, // find master key
kScriptFindCtystal = 3, // find crystal
kScriptFindShield = 4, // find shield - obj 8
Commit: ddb4e2eb3e28b58afc61907649b510cb9efa2a45
https://github.com/scummvm/scummvm/commit/ddb4e2eb3e28b58afc61907649b510cb9efa2a45
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Start refactoring Combat + rename constant due to typo
Changed paths:
engines/griffon/combat.cpp
engines/griffon/griffon.h
engines/griffon/resources.cpp
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp
index 66f6eb5..1e387d0 100644
--- a/engines/griffon/combat.cpp
+++ b/engines/griffon/combat.cpp
@@ -61,37 +61,37 @@ void GriffonEngine::attack() {
o = 10;
int oscript = _objectInfo[o][5];
- if (oscript == kScriptFlask && _player.inventory[kInvFlask] < 9) {
- _player.inventory[kInvFlask]++;
- addFloatIcon(6, lx * 16, (ly - 1) * 16);
+ switch (oscript) {
+ case kScriptFlask:
+ if (_player.inventory[kInvFlask] < 9) {
+ _player.inventory[kInvFlask]++;
+ addFloatIcon(6, lx * 16, (ly - 1) * 16);
- _objmapf[_curmap][lx][ly - 1] = 1;
+ _objmapf[_curmap][lx][ly - 1] = 1;
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
- }
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
- if (_objectInfo[o][4] == 1)
- _objectMap[lx][ly - 1] = 3;
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
- eventText("Found Flask!");
- _itemticks = _ticks + 215;
- return;
- }
+ eventText("Found Flask!");
+ _itemticks = _ticks + 215;
+ return;
+ } else if (_player.inventory[kInvFlask] == 9) {
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndChest]);
+ setChannelVolume(snd, config.effectsvol);
+ }
- if (oscript == kScriptFlask && _player.inventory[kInvFlask] == 9) {
- if (config.effects) {
- int snd = playSound(_sfx[kSndChest]);
- setChannelVolume(snd, config.effectsvol);
+ eventText("Cannot Carry any more Flasks!");
+ _itemticks = _ticks + 215;
+ return;
}
-
- eventText("Cannot Carry any more Flasks!");
- _itemticks = _ticks + 215;
- return;
- }
-
- if (oscript == kScriptMasterKey) {
+ break;
+ case kScriptMasterKey:
_player.inventory[kInvMasterKey]++;
addFloatIcon(14, lx * 16, (ly - 1) * 16);
@@ -100,9 +100,9 @@ void GriffonEngine::attack() {
if (_curmap == 34)
_scriptflag[kScriptMasterKey][0] = 2;
- if (_curmap == 62)
+ else if (_curmap == 62)
_scriptflag[kScriptGardenMasterKey][0] = 2;
- if (_curmap == 81)
+ else if (_curmap == 81)
_scriptflag[kScriptCitadelMasterKey][0] = 2;
if (config.effects) {
@@ -114,9 +114,7 @@ void GriffonEngine::attack() {
_objectMap[lx][ly - 1] = 3;
eventText("Found the Temple Key!");
return;
- }
-
- if (oscript == kScriptFindCtystal) {
+ case kScriptFindCrystal:
_player.foundSpell[0] = 1;
_player.spellCharge[0] = 0;
@@ -133,47 +131,47 @@ void GriffonEngine::attack() {
eventText("Found the Infinite Crystal!");
_itemticks = _ticks + 215;
return;
- }
+ case kScriptFindShield:
+ if (_player.shield == 1) {
+ _player.shield = 2;
- if (oscript == kScriptFindShield && _player.shield == 1) {
- _player.shield = 2;
+ addFloatIcon(4, lx * 16, (ly - 1) * 16);
- addFloatIcon(4, lx * 16, (ly - 1) * 16);
+ _itemticks = _ticks + 215;
- _itemticks = _ticks + 215;
-
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
- }
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
- if (_objectInfo[o][4] == 1)
- _objectMap[lx][ly - 1] = 3;
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
- eventText("Found the Obsidian Shield!");
- _objmapf[4][1][2] = 1;
- return;
- }
+ eventText("Found the Obsidian Shield!");
+ _objmapf[4][1][2] = 1;
+ return;
+ }
+ break;
+ case kScriptFindSword:
+ if (_player.sword == 1) {
+ _player.sword = 2;
- if (oscript == kScriptFindSword && _player.sword == 1) {
- _player.sword = 2;
+ addFloatIcon(3, lx * 16, (ly - 1) * 16);
- addFloatIcon(3, lx * 16, (ly - 1) * 16);
+ _itemticks = _ticks + 215;
- _itemticks = _ticks + 215;
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
+ eventText("Found the Fidelis Sword!");
+ return;
}
-
- if (_objectInfo[o][4] == 1)
- _objectMap[lx][ly - 1] = 3;
- eventText("Found the Fidelis Sword!");
- return;
- }
-
- if (oscript == kScriptKeyChest) {
+ break;
+ case kScriptKeyChest:
if (_player.inventory[kInvNormalKey] < 9) {
_player.inventory[kInvNormalKey]++;
@@ -203,117 +201,115 @@ void GriffonEngine::attack() {
eventText("Cannot Carry Any More Keys");
}
- }
-
- if (oscript == kScriptBlueFlask && _player.inventory[kInvDoubleFlask] < 9) {
- _player.inventory[kInvDoubleFlask]++;
- addFloatIcon(12, lx * 16, (ly - 1) * 16);
+ break;
+ case kScriptBlueFlask:
+ if (_player.inventory[kInvDoubleFlask] < 9) {
+ _player.inventory[kInvDoubleFlask]++;
+ addFloatIcon(12, lx * 16, (ly - 1) * 16);
- _objmapf[_curmap][lx][ly - 1] = 1;
+ _objmapf[_curmap][lx][ly - 1] = 1;
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
- }
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
- if (_objectInfo[o][4] == 1)
- _objectMap[lx][ly - 1] = 3;
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
- eventText("Found Mega Flask!");
- _itemticks = _ticks + 215;
- return;
- }
+ eventText("Found Mega Flask!");
+ _itemticks = _ticks + 215;
+ return;
+ } else if (_player.inventory[kInvDoubleFlask] == 9) {
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndChest]);
+ setChannelVolume(snd, config.effectsvol);
+ }
- if (oscript == kScriptBlueFlask && _player.inventory[kInvDoubleFlask] == 9) {
- if (config.effects) {
- int snd = playSound(_sfx[kSndChest]);
- setChannelVolume(snd, config.effectsvol);
+ eventText("Cannot Carry any more Mega Flasks!");
+ _itemticks = _ticks + 215;
+ return;
}
- eventText("Cannot Carry any more Mega Flasks!");
- _itemticks = _ticks + 215;
- return;
- }
-
- if (oscript == kScriptBlueFlaskChest && _player.inventory[kInvDoubleFlask] < 9) {
- _player.inventory[kInvDoubleFlask]++;
- addFloatIcon(12, lx * 16, (ly - 1) * 16);
+ break;
+ case kScriptBlueFlaskChest:
+ if (_player.inventory[kInvDoubleFlask] < 9) {
+ _player.inventory[kInvDoubleFlask]++;
+ addFloatIcon(12, lx * 16, (ly - 1) * 16);
- _objmapf[_curmap][lx][ly - 1] = 1;
+ _objmapf[_curmap][lx][ly - 1] = 1;
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
- }
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
- if (_objectInfo[o][4] == 1)
- _objectMap[lx][ly - 1] = 3;
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
- eventText("Found Mega Flask!");
- _itemticks = _ticks + 215;
- return;
- }
+ eventText("Found Mega Flask!");
+ _itemticks = _ticks + 215;
+ return;
+ } else if (_player.inventory[kInvDoubleFlask] == 9) {
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndChest]);
+ setChannelVolume(snd, config.effectsvol);
+ }
- if (oscript == kScriptBlueFlaskChest && _player.inventory[kInvDoubleFlask] == 9) {
- if (config.effects) {
- int snd = playSound(_sfx[kSndChest]);
- setChannelVolume(snd, config.effectsvol);
+ eventText("Cannot Carry any more Mega Flasks!");
+ _itemticks = _ticks + 215;
+ return;
}
+ break;
+ case kScriptLightningChest:
+ if (_player.inventory[kInvShock] < 9) {
+ _player.inventory[kInvShock]++;
+ addFloatIcon(17, lx * 16, (ly - 1) * 16);
- eventText("Cannot Carry any more Mega Flasks!");
- _itemticks = _ticks + 215;
- return;
- }
-
- if (oscript == kScriptLightningChest && _player.inventory[kInvShock] < 9) {
- _player.inventory[kInvShock]++;
- addFloatIcon(17, lx * 16, (ly - 1) * 16);
-
- _objmapf[_curmap][lx][ly - 1] = 1;
+ _objmapf[_curmap][lx][ly - 1] = 1;
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
- }
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
- if (_objectInfo[o][4] == 1)
- _objectMap[lx][ly - 1] = 3;
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
- eventText("Found Lightning Bomb!");
- _itemticks = _ticks + 215;
- return;
- }
+ eventText("Found Lightning Bomb!");
+ _itemticks = _ticks + 215;
+ return;
+ } else if (_player.inventory[kInvShock] == 9) {
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndChest]);
+ setChannelVolume(snd, config.effectsvol);
+ }
- if (oscript == kScriptLightningChest && _player.inventory[kInvShock] == 9) {
- if (config.effects) {
- int snd = playSound(_sfx[kSndChest]);
- setChannelVolume(snd, config.effectsvol);
+ eventText("Cannot Carry any more Lightning Bombs!");
+ _itemticks = _ticks + 215;
+ return;
}
+ break;
+ case kScriptArmourChest:
+ if (_player.armour == 1) {
+ _player.armour = 2;
- eventText("Cannot Carry any more Lightning Bombs!");
- _itemticks = _ticks + 215;
- return;
- }
+ addFloatIcon(5, lx * 16, (ly - 1) * 16);
- if (oscript == kScriptArmourChest && _player.armour == 1) {
- _player.armour = 2;
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
- addFloatIcon(5, lx * 16, (ly - 1) * 16);
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
+ eventText("Found the Fidelis Mail!");
+ _itemticks = _ticks + 215;
+ return;
}
-
- if (_objectInfo[o][4] == 1)
- _objectMap[lx][ly - 1] = 3;
-
- eventText("Found the Fidelis Mail!");
- _itemticks = _ticks + 215;
- return;
- }
-
- if (oscript == kScriptLever) {
+ break;
+ case kScriptLever:
if (_curmap == 58 && _scriptflag[kScriptLever][0] == 0) {
_scriptflag[kScriptLever][0] = 1;
@@ -346,62 +342,64 @@ void GriffonEngine::attack() {
eventText("It's stuck!");
}
+ break;
+ case kScriptGetSword3:
+ if (_player.sword < 3) {
+ _player.sword = 3;
- }
-
- if (oscript == kScriptGetSword3 && _player.sword < 3) {
- _player.sword = 3;
+ addFloatIcon(18, lx * 16, (ly - 1) * 16);
- addFloatIcon(18, lx * 16, (ly - 1) * 16);
+ _itemticks = _ticks + 215;
- _itemticks = _ticks + 215;
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
+ eventText("Found the Blood Sword!");
+ _objmapf[4][1][2] = 1;
+ return;
}
+ break;
+ case kScriptShield3:
+ if (_player.shield < 3) {
+ _player.shield = 3;
+ addFloatIcon(19, lx * 16, (ly - 1) * 16);
+ _itemticks = _ticks + 215;
- if (_objectInfo[o][4] == 1)
- _objectMap[lx][ly - 1] = 3;
- eventText("Found the Blood Sword!");
- _objmapf[4][1][2] = 1;
- return;
- }
-
- if (oscript == kScriptShield3 && _player.shield < 3) {
- _player.shield = 3;
- addFloatIcon(19, lx * 16, (ly - 1) * 16);
- _itemticks = _ticks + 215;
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
+ eventText("Found the Entropy Shield!");
+ _objmapf[4][1][2] = 1;
+ return;
}
+ break;
+ case kScriptArmour3:
+ if (_player.armour < 3) {
+ _player.armour = 3;
+ addFloatIcon(20, lx * 16, (ly - 1) * 16);
+ _itemticks = _ticks + 215;
- if (_objectInfo[o][4] == 1)
- _objectMap[lx][ly - 1] = 3;
- eventText("Found the Entropy Shield!");
- _objmapf[4][1][2] = 1;
- return;
- }
-
- if (oscript == kScriptArmour3 && _player.armour < 3) {
- _player.armour = 3;
- addFloatIcon(20, lx * 16, (ly - 1) * 16);
- _itemticks = _ticks + 215;
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndPowerUp]);
+ setChannelVolume(snd, config.effectsvol);
+ }
- if (config.effects) {
- int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
+ if (_objectInfo[o][4] == 1)
+ _objectMap[lx][ly - 1] = 3;
+ eventText("Found the Rubyscale Armour!");
+ _objmapf[4][1][2] = 1;
+ return;
}
-
- if (_objectInfo[o][4] == 1)
- _objectMap[lx][ly - 1] = 3;
- eventText("Found the Rubyscale Armour!");
- _objmapf[4][1][2] = 1;
- return;
+ break;
}
-
}
}
}
@@ -681,7 +679,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
}
// academy crystal chest script
- if (_npcinfo[npcnum].script == kScriptFindCtystal) {
+ if (_npcinfo[npcnum].script == kScriptFindCrystal) {
bool alive = false;
for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0)
@@ -707,7 +705,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py += 16;
- _scriptflag[kScriptFindCtystal][0] = 1;
+ _scriptflag[kScriptFindCrystal][0] = 1;
_clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
}
}
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 1a830f6..30df532 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -94,7 +94,7 @@ enum {
enum {
kScriptFlask = 0, // get flask
kScriptMasterKey = 2, // find master key
- kScriptFindCtystal = 3, // find crystal
+ kScriptFindCrystal = 3, // find crystal
kScriptFindShield = 4, // find shield - obj 8
kScriptFindSword = 5, // find sword - obj 9
kScriptKeyChest = 6, // regular key chest
diff --git a/engines/griffon/resources.cpp b/engines/griffon/resources.cpp
index e81502e..d24a947 100644
--- a/engines/griffon/resources.cpp
+++ b/engines/griffon/resources.cpp
@@ -706,9 +706,9 @@ void GriffonEngine::loadMap(int mapnum) {
}
}
- if (_npcinfo[i].script == kScriptFindCtystal) {
+ if (_npcinfo[i].script == kScriptFindCrystal) {
_roomlock = true;
- if (_scriptflag[kScriptFindCtystal][0] > 0) {
+ if (_scriptflag[kScriptFindCrystal][0] > 0) {
_roomlock = false;
_npcinfo[i].hp = 0;
}
@@ -763,7 +763,7 @@ void GriffonEngine::loadMap(int mapnum) {
}
// academy crystal
- if (_curmap == 24 && _player.foundSpell[0] == 0 && _scriptflag[kScriptFindCtystal][0] == 1) {
+ if (_curmap == 24 && _player.foundSpell[0] == 0 && _scriptflag[kScriptFindCrystal][0] == 1) {
cx = 9;
cy = 7;
Commit: f69cce13e5fecc88284716f42b8e3ad801d4fc53
https://github.com/scummvm/scummvm/commit/f69cce13e5fecc88284716f42b8e3ad801d4fc53
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Some more changes in Combat
Changed paths:
engines/griffon/combat.cpp
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp
index 1e387d0..c2aeee2 100644
--- a/engines/griffon/combat.cpp
+++ b/engines/griffon/combat.cpp
@@ -78,18 +78,16 @@ void GriffonEngine::attack() {
_objectMap[lx][ly - 1] = 3;
eventText("Found Flask!");
- _itemticks = _ticks + 215;
- return;
- } else if (_player.inventory[kInvFlask] == 9) {
+ } else {
if (config.effects) {
int snd = playSound(_sfx[kSndChest]);
setChannelVolume(snd, config.effectsvol);
}
eventText("Cannot Carry any more Flasks!");
- _itemticks = _ticks + 215;
- return;
}
+ _itemticks = _ticks + 215;
+ return;
break;
case kScriptMasterKey:
_player.inventory[kInvMasterKey]++;
@@ -218,19 +216,17 @@ void GriffonEngine::attack() {
_objectMap[lx][ly - 1] = 3;
eventText("Found Mega Flask!");
- _itemticks = _ticks + 215;
- return;
- } else if (_player.inventory[kInvDoubleFlask] == 9) {
+ } else {
if (config.effects) {
int snd = playSound(_sfx[kSndChest]);
setChannelVolume(snd, config.effectsvol);
}
eventText("Cannot Carry any more Mega Flasks!");
- _itemticks = _ticks + 215;
- return;
}
+ _itemticks = _ticks + 215;
+ return;
break;
case kScriptBlueFlaskChest:
if (_player.inventory[kInvDoubleFlask] < 9) {
@@ -248,18 +244,16 @@ void GriffonEngine::attack() {
_objectMap[lx][ly - 1] = 3;
eventText("Found Mega Flask!");
- _itemticks = _ticks + 215;
- return;
- } else if (_player.inventory[kInvDoubleFlask] == 9) {
+ } else {
if (config.effects) {
int snd = playSound(_sfx[kSndChest]);
setChannelVolume(snd, config.effectsvol);
}
eventText("Cannot Carry any more Mega Flasks!");
- _itemticks = _ticks + 215;
- return;
}
+ _itemticks = _ticks + 215;
+ return;
break;
case kScriptLightningChest:
if (_player.inventory[kInvShock] < 9) {
@@ -277,18 +271,16 @@ void GriffonEngine::attack() {
_objectMap[lx][ly - 1] = 3;
eventText("Found Lightning Bomb!");
- _itemticks = _ticks + 215;
- return;
- } else if (_player.inventory[kInvShock] == 9) {
+ } else {
if (config.effects) {
int snd = playSound(_sfx[kSndChest]);
setChannelVolume(snd, config.effectsvol);
}
eventText("Cannot Carry any more Lightning Bombs!");
- _itemticks = _ticks + 215;
- return;
}
+ _itemticks = _ticks + 215;
+ return;
break;
case kScriptArmourChest:
if (_player.armour == 1) {
@@ -317,7 +309,6 @@ void GriffonEngine::attack() {
int snd = playSound(_sfx[kSndLever]);
setChannelVolume(snd, config.effectsvol);
}
-
} else if (_curmap == 58 && _scriptflag[kScriptLever][0] > 0) {
if (config.effects) {
int snd = playSound(_sfx[kSndDoor]);
@@ -325,9 +316,7 @@ void GriffonEngine::attack() {
}
eventText("It's stuck!");
- }
-
- if (_curmap == 54 && _scriptflag[kScriptLever][0] == 1) {
+ } else if (_curmap == 54 && _scriptflag[kScriptLever][0] == 1) {
if (config.effects) {
int snd = playSound(_sfx[kSndLever]);
setChannelVolume(snd, config.effectsvol);
Commit: d384cc83e7d83f8fbd0eea3b622b665c7ef67a5e
https://github.com/scummvm/scummvm/commit/d384cc83e7d83f8fbd0eea3b622b665c7ef67a5e
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Refactor castSpell()
Changed paths:
engines/griffon/combat.cpp
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp
index c2aeee2..925a83c 100644
--- a/engines/griffon/combat.cpp
+++ b/engines/griffon/combat.cpp
@@ -434,25 +434,35 @@ void GriffonEngine::castSpell(int spellnum, float homex, float homey, float enem
spellinfo[i].strength = 1.5f;
}
- // set earthslide vars
- if (spellnum == 2) {
+ switch(spellnum) {
+ case 1:
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndThrow]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+ break;
+ case 2:
+ // set earthslide vars
for (int f = 0; f <= 8; f++) {
spellinfo[i].rocky[f] = 0;
spellinfo[i].rockimg[f] = (int)(RND() * 4);
spellinfo[i].rockdeflect[f] = ((int)(RND() * 128) - 64) * 1.5;
}
- }
-
- // set fire vars
- if (spellnum == 3) {
- for (int f = 0; f <= 4; f++) {
+ break;
+ case 3:
+ // set fire vars
+ for (int f = 0; f <= 4; f++)
spellinfo[i].legalive[f] = 32;
- }
- }
-
- // room fireball vars
- if (spellnum == 6) {
+ break;
+ case 5:
+ if (config.effects) {
+ int snd = playSound(_sfx[kSndCrystal]);
+ setChannelVolume(snd, config.effectsvol);
+ }
+ break;
+ case 6: {
+ // room fireball vars
int nballs = 0;
for (int x = 0; x <= 19; x++) {
for (int y = 0; y <= 14; y++) {
@@ -471,19 +481,17 @@ void GriffonEngine::castSpell(int spellnum, float homex, float homey, float enem
}
}
spellinfo[i].nfballs = nballs;
- }
-
- if (config.effects) {
- if (spellnum == 1) {
- int snd = playSound(_sfx[kSndThrow]);
- setChannelVolume(snd, config.effectsvol);
- } else if (spellnum == 5) {
- int snd = playSound(_sfx[kSndCrystal]);
- setChannelVolume(snd, config.effectsvol);
- } else if (spellnum == 8 || spellnum == 9) {
+ }
+ break;
+ case 8:
+ case 9:
+ if (config.effects) {
int snd = playSound(_sfx[kSndLightning]);
setChannelVolume(snd, config.effectsvol);
}
+ break;
+ default:
+ break;
}
return;
Commit: 4a822bc21dc50723c5ab528b119169d635fc275e
https://github.com/scummvm/scummvm/commit/4a822bc21dc50723c5ab528b119169d635fc275e
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Change some types to boolean, some code simplifications
Changed paths:
engines/griffon/combat.cpp
engines/griffon/dialogs.cpp
engines/griffon/draw.cpp
engines/griffon/engine.cpp
engines/griffon/griffon.h
engines/griffon/input.cpp
engines/griffon/logic.cpp
engines/griffon/resources.cpp
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp
index 925a83c..f854104 100644
--- a/engines/griffon/combat.cpp
+++ b/engines/griffon/combat.cpp
@@ -113,7 +113,7 @@ void GriffonEngine::attack() {
eventText("Found the Temple Key!");
return;
case kScriptFindCrystal:
- _player.foundSpell[0] = 1;
+ _player.foundSpell[0] = true;
_player.spellCharge[0] = 0;
addFloatIcon(7, lx * 16, (ly - 1) * 16);
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 7e606f1..a26f65c 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -691,10 +691,10 @@ void GriffonEngine::saveLoadNew() {
int nx = rcSrc.left + 13 + 3 * 8;
rcSrc.left = nx - 17;
- if (_playera.foundSpell[0] == 1) {
+ if (_playera.foundSpell[0]) {
for (int i = 0; i < 5; i++) {
rcSrc.left += 17;
- if (_playera.foundSpell[i] == 1)
+ if (_playera.foundSpell[i])
_itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
}
}
diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp
index 9cc5ae8..54d249a 100644
--- a/engines/griffon/draw.cpp
+++ b/engines/griffon/draw.cpp
@@ -152,17 +152,17 @@ void GriffonEngine::drawAnims(int Layer) {
rcDest.setWidth(16);
rcDest.setHeight(16);
- int pass = 1;
+ bool pass = true;
if (curtilel == 1) {
for (int ff = 0; ff <= 5; ff++) {
int ffa = 20 * 5 - 1 + ff * 20;
int ffb = 20 * 5 + 4 + ff * 20;
if (curtile > ffa && curtile < ffb)
- pass = 0;
+ pass = false;
}
}
- if (pass == 1)
+ if (pass)
_tiles[curtilel]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -197,8 +197,7 @@ void GriffonEngine::drawHud() {
c = 1;
else if (fc == 5)
c = 0;
-
- if (fc == 1 || fc == 3)
+ else if (fc == 1 || fc == 3)
c2 = 2;
if (fc != 0) {
@@ -239,20 +238,19 @@ void GriffonEngine::drawHud() {
}
}
- if (_itemselon == 0) {
+ if (!_itemSelOn) {
int sy = 211;
-
-
int nx = 19 * 8 + 13;
+
rcSrc.left = nx - 17 + 48;
rcSrc.top = sy;
// spells in game
- if (_player.foundSpell[0] == 1) {
+ if (_player.foundSpell[0]) {
for (int i = 0; i < 5; i++) {
rcSrc.left = rcSrc.left + 17;
- if (_player.foundSpell[i] == 1) {
+ if (_player.foundSpell[i]) {
_itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
game_fillrect(_videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32));
@@ -265,7 +263,7 @@ void GriffonEngine::drawHud() {
return;
}
- if (_selenemyon == 0) {
+ if (_selEnemyOn == false) {
rcDest.left = 0;
rcDest.top = 0;
rcDest.right = 320;
@@ -392,13 +390,13 @@ void GriffonEngine::drawHud() {
}
// spells in menu
- if (_player.foundSpell[0] == 1) {
+ if (_player.foundSpell[0]) {
for (int i = 0; i < 5; i++) {
rcSrc.left = 243;
rcSrc.top = 67 + i * 24;
sy = rcSrc.top;
- if (_player.foundSpell[i] == 1) {
+ if (_player.foundSpell[i]) {
_itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
game_fillrect(_videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32));
@@ -409,7 +407,7 @@ void GriffonEngine::drawHud() {
}
}
- if (_itemselon == 1) {
+ if (_itemSelOn) {
for (int i = 0; i <= 4; i++) {
if (_curitem == 5 + i) {
rcDest.left = (float)(243 - 12 + 3 * sin(3.141592 * 2 * _itemyloc / 16));
@@ -426,7 +424,7 @@ void GriffonEngine::drawHud() {
}
}
- if (_selenemyon == 1) {
+ if (_selEnemyOn) {
if (_curenemy > _lastnpc) {
int pst = _curenemy - _lastnpc - 1;
rcDest.left = postinfo[pst][0];
@@ -466,7 +464,7 @@ void GriffonEngine::drawNPCs(int mode) {
// spriteset1 specific
if (_npcinfo[i].spriteset == kMonsterBabyDragon) {
- if (_npcinfo[i].attacking == 0) {
+ if (!_npcinfo[i].attacking) {
int cframe = _npcinfo[i].cframe;
@@ -546,57 +544,40 @@ void GriffonEngine::drawNPCs(int mode) {
// boss 1
if (_npcinfo[i].spriteset == kMonsterBoss1) {
- if (_npcinfo[i].attacking == 0) {
+ if (!_npcinfo[i].attacking) {
int cframe = _npcinfo[i].cframe;
-
rcSrc.left = (int)(cframe / 4) * 24;
- rcSrc.top = 0;
- rcSrc.setWidth(24);
- rcSrc.setHeight(48);
-
- rcDest.left = npx - 2;
- rcDest.top = npy - 24;
-
- _anims[3]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
rcSrc.left = 4 * 24;
- rcSrc.top = 0;
- rcSrc.setWidth(24);
- rcSrc.setHeight(48);
+ }
+
+ rcSrc.top = 0;
+ rcSrc.setWidth(24);
+ rcSrc.setHeight(48);
- rcDest.left = npx - 2;
- rcDest.top = npy - 24;
+ rcDest.left = npx - 2;
+ rcDest.top = npy - 24;
- _anims[3]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- }
+ _anims[3]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
// black knight
if (_npcinfo[i].spriteset == kMonsterBlackKnight) {
- if (_npcinfo[i].attacking == 0) {
+ if (!_npcinfo[i].attacking) {
int cframe = _npcinfo[i].cframe;
-
rcSrc.left = (int)(cframe / 4) * 24;
- rcSrc.top = 0;
- rcSrc.setWidth(24);
- rcSrc.setHeight(48);
-
- rcDest.left = npx - 2;
- rcDest.top = npy - 24;
-
- _anims[4]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
rcSrc.left = 4 * 24;
- rcSrc.top = 0;
- rcSrc.setWidth(24);
- rcSrc.setHeight(48);
+ }
+ rcSrc.top = 0;
+ rcSrc.setWidth(24);
+ rcSrc.setHeight(48);
- rcDest.left = npx - 2;
- rcDest.top = npy - 24;
+ rcDest.left = npx - 2;
+ rcDest.top = npy - 24;
- _anims[4]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- }
+ _anims[4]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
@@ -739,7 +720,7 @@ void GriffonEngine::drawNPCs(int mode) {
// dragon2
if (_npcinfo[i].spriteset == kMonsterDragon2) {
- if (_npcinfo[i].attacking == 0) {
+ if (!_npcinfo[i].attacking) {
_npcinfo[i].floating = _npcinfo[i].floating + 0.25 * _fpsr;
while (_npcinfo[i].floating >= 16)
_npcinfo[i].floating = _npcinfo[i].floating - 16;
@@ -893,7 +874,7 @@ void GriffonEngine::drawNPCs(int mode) {
_spellimg->setAlpha(255, true);
- if (_npcinfo[i].attacking == 0) {
+ if (!_npcinfo[i].attacking) {
int cframe = (int)(frame);
rcSrc.left = 0;
rcSrc.top = 72 * (int)(cframe / 4);
@@ -1171,7 +1152,7 @@ void GriffonEngine::drawView() {
updateSpells();
- if (cloudson == 1) {
+ if (_cloudsOn) {
Common::Rect rc;
rc.left = (float)(256 + 256 * cos(3.141592 / 180 * clouddeg));
rc.top = (float)(192 + 192 * sin(3.141592 / 180 * clouddeg));
@@ -1189,7 +1170,7 @@ void GriffonEngine::drawView() {
void GriffonEngine::swash() {
float y = 0.0;
do {
- y = y + 1 * _fpsr;
+ y += 1 * _fpsr;
_videobuffer->setAlpha((int)y);
_videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
@@ -1228,7 +1209,7 @@ void GriffonEngine::swash() {
_videobuffer->setAlpha((int)(y * 25));
_mapbg->blit(*_videobuffer);
- if (cloudson == 1) {
+ if (_cloudsOn) {
rcDest.left = (float)(256 + 256 * cos(3.141592 / 180 * clouddeg));
rcDest.top = (float)(192 + 192 * sin(3.141592 / 180 * clouddeg));
rcDest.setWidth(320);
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 20cff62..a323feb 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -187,7 +187,7 @@ void GriffonEngine::updateEngine() {
if (!_forcepause) {
for (int i = 0; i < 5; i++) {
- if (_player.foundSpell[i] == 1)
+ if (_player.foundSpell[i])
_player.spellCharge[i] += 1 * _player.level * 0.01 * _fpsr;
if (_player.spellCharge[i] > 100)
_player.spellCharge[i] = 100;
@@ -236,9 +236,9 @@ void GriffonEngine::updateEngine() {
}
}
- // cloudson = 0
+ // cloudson = false
- if (_itemselon == 1)
+ if (_itemSelOn)
_player.itemselshade = _player.itemselshade + 2 * _fpsr;
if (_player.itemselshade > 24)
_player.itemselshade = 24;
@@ -272,7 +272,7 @@ void GriffonEngine::newGame() {
_player.shield = 0;
_player.armour = 0;
for (int i = 0; i < 5; i++) {
- _player.foundSpell[i] = 0;
+ _player.foundSpell[i] = false;
_player.spellCharge[i] = 0;
_player.inventory[i] = 0;
}
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 30df532..a312830 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -152,7 +152,7 @@ struct Player {
int sword;
int shield;
int armour;
- int foundSpell[5];
+ bool foundSpell[5];
float spellCharge[5];
int inventory[5];
float attackStrength;
@@ -197,7 +197,7 @@ struct NPC {
float frame;
float frame2; // end boss specific
int cframe;
- int onmap; // is this npc set to be genned in the mapfile
+ bool onmap; // is this npc set to be genned in the mapfile
int ticks;
int pause;
@@ -207,12 +207,12 @@ struct NPC {
int walkdir;
float walkspd;
int movingdir;
- int moving;
+ bool moving;
- int attacking;
- float attackframe;
+ bool attacking;
+ float attackframe;
int cattackframe;
- float attackspd;
+ float attackspd;
int attackdelay;
int attacknext;
int attackattempt;
@@ -231,7 +231,7 @@ struct NPC {
// firehydra specific
int attacknext2[4];
- int attacking2[4];
+ bool attacking2[4];
int attackframe2[4];
// dragon2 specific
@@ -399,9 +399,11 @@ private:
Graphics::TransparentSurface *_itemimg[21], *_windowimg;
Graphics::TransparentSurface *_spellimg;
- int _itemselon, _curitem, _itemticks;
+ bool _itemSelOn;
+ int _curitem, _itemticks;
float _itemyloc;
- int _selenemyon, _curenemy;
+ bool _selEnemyOn;
+ int _curenemy;
bool _forcepause;
bool _roomlock; // set to disable any room jumps while in the room
int _scriptflag[100][10], _saveslot; // script, flag
@@ -429,7 +431,7 @@ private:
// cloud info
Graphics::TransparentSurface *cloudimg;
float clouddeg;
- int cloudson;
+ int _cloudsOn;
// spell info
Spell spellinfo[kMaxSpell];
diff --git a/engines/griffon/input.cpp b/engines/griffon/input.cpp
index a7540e6..7239838 100644
--- a/engines/griffon/input.cpp
+++ b/engines/griffon/input.cpp
@@ -65,7 +65,7 @@ void GriffonEngine::checkInputs() {
}
}
- if (attacking || (_forcepause && _itemselon == 0))
+ if (attacking || (_forcepause && !_itemSelOn))
return;
if (_event.type == Common::EVENT_QUIT) {
@@ -81,10 +81,10 @@ void GriffonEngine::checkInputs() {
_console->attach();
_event.type = Common::EVENT_INVALID;
} else if (_event.kbd.hasFlags(Common::KBD_CTRL)) {
- if (_itemselon == 0 && _itemticks < _ticks)
+ if (!_itemSelOn && (_itemticks < _ticks))
attack();
- if (_itemselon == 1 && _itemticks < _ticks) {
+ if (_itemSelOn && _itemticks < _ticks) {
if (_curitem == 0 && _player.inventory[kInvFlask] > 0) {
_itemticks = _ticks + ntickdelay;
@@ -107,7 +107,7 @@ void GriffonEngine::checkInputs() {
setChannelVolume(snd, config.effectsvol);
}
- _itemselon = 0;
+ _itemSelOn = false;
_forcepause = false;
}
@@ -115,12 +115,12 @@ void GriffonEngine::checkInputs() {
_itemticks = _ticks + ntickdelay;
int heal = 200;
- int maxh = _player.maxHp - _player.hp;
+ int maxHeal = _player.maxHp - _player.hp;
- if (heal > maxh)
- heal = maxh;
+ if (heal > maxHeal)
+ heal = maxHeal;
- _player.hp = _player.hp + heal;
+ _player.hp += heal;
char text[256];
sprintf(text, "+%i", heal);
@@ -133,7 +133,7 @@ void GriffonEngine::checkInputs() {
setChannelVolume(snd, config.effectsvol);
}
- _itemselon = 0;
+ _itemSelOn = false;
_forcepause = false;
}
@@ -145,8 +145,8 @@ void GriffonEngine::checkInputs() {
_player.inventory[kInvShock]--;
_itemticks = _ticks + ntickdelay;
- _selenemyon = 0;
- _itemselon = 0;
+ _selEnemyOn = false;
+ _itemSelOn = false;
}
@@ -157,8 +157,8 @@ void GriffonEngine::checkInputs() {
_player.inventory[kInvNormalKey]--;
_itemticks = _ticks + ntickdelay;
- _selenemyon = 0;
- _itemselon = 0;
+ _selEnemyOn = false;
+ _itemSelOn = false;
return;
}
@@ -169,8 +169,8 @@ void GriffonEngine::checkInputs() {
_player.inventory[kInvMasterKey]--;
_itemticks = _ticks + ntickdelay;
- _selenemyon = 0;
- _itemselon = 0;
+ _selEnemyOn = false;
+ _itemSelOn = false;
return;
}
@@ -182,11 +182,11 @@ void GriffonEngine::checkInputs() {
_forcepause = true;
_itemticks = _ticks + ntickdelay;
- _selenemyon = 0;
- _itemselon = 0;
+ _selEnemyOn = false;
+ _itemSelOn = false;
}
- if (_curitem > 5 && _selenemyon == 1) {
+ if (_curitem > 5 && _selEnemyOn) {
if (_curenemy <= _lastnpc) {
castSpell(_curitem - 6, _player.px, _player.py, _npcinfo[_curenemy].x, _npcinfo[_curenemy].y, 0);
} else {
@@ -199,16 +199,16 @@ void GriffonEngine::checkInputs() {
_player.spellStrength = 0;
_itemticks = _ticks + ntickdelay;
- _selenemyon = 0;
- _itemselon = 0;
+ _selEnemyOn = false;
+ _itemSelOn = false;
_forcepause = false;
}
- if (_curitem > 5 && _selenemyon == 0 && _itemselon == 1) {
+ if (_curitem > 5 && !_selEnemyOn && _itemSelOn) {
if (ABS(_player.spellCharge[_curitem - 5] - 100) < kEpsilon) {
_itemticks = _ticks + ntickdelay;
- _selenemyon = 1;
+ _selEnemyOn = true;
int i = 0;
do {
@@ -218,14 +218,14 @@ void GriffonEngine::checkInputs() {
}
i = i + 1;
if (i == _lastnpc + 1) {
- _selenemyon = 0;
+ _selEnemyOn = false;
goto __exit_do;
}
} while (1);
__exit_do:
- if (nposts > 0 && _selenemyon == 0) {
- _selenemyon = 1;
+ if (nposts > 0 && !_selEnemyOn) {
+ _selEnemyOn = true;
_curenemy = _lastnpc + 1;
}
}
@@ -234,13 +234,13 @@ __exit_do:
}
} else if (_event.kbd.hasFlags(Common::KBD_ALT)) {
if (_itemticks < _ticks) {
- _selenemyon = 0;
- if (_itemselon == 1) {
- _itemselon = 0;
+ _selEnemyOn = false;
+ if (_itemSelOn) {
+ _itemSelOn = false;
_itemticks = _ticks + 220;
_forcepause = false;
} else {
- _itemselon = 1;
+ _itemSelOn = true;
_itemticks = _ticks + 220;
_forcepause = true;
_player.itemselshade = 0;
@@ -249,7 +249,7 @@ __exit_do:
}
}
- if (_itemselon == 0) {
+ if (!_itemSelOn) {
movingup = false;
movingdown = false;
movingleft = false;
@@ -268,7 +268,7 @@ __exit_do:
movingleft = false;
movingright = false;
- if (_selenemyon == 1) {
+ if (_selEnemyOn) {
if (_itemticks < _ticks) {
if (_event.kbd.keycode == Common::KEYCODE_LEFT) {
int origin = _curenemy;
diff --git a/engines/griffon/logic.cpp b/engines/griffon/logic.cpp
index 7a691b8..3225930 100644
--- a/engines/griffon/logic.cpp
+++ b/engines/griffon/logic.cpp
@@ -132,15 +132,15 @@ void GriffonEngine::updateNPCs() {
if (_npcinfo[i].hp > 0) {
// is npc walking
int pass = 0;
- if (_npcinfo[i].attacking == 0)
+ if (!_npcinfo[i].attacking)
pass = 1;
if (_npcinfo[i].spriteset == kMonsterFireHydra)
pass = 1;
if (pass == 1) {
- int moveup = 0;
- int movedown = 0;
- int moveleft = 0;
- int moveright = 0;
+ bool moveup = false;
+ bool movedown = false;
+ bool moveleft = false;
+ bool moveright = false;
float npx = _npcinfo[i].x;
float npy = _npcinfo[i].y;
@@ -200,13 +200,13 @@ void GriffonEngine::updateNPCs() {
}
if (xdif < 4)
- moveleft = 1;
+ moveleft = true;
if (xdif > -4)
- moveright = 1;
+ moveright = true;
if (ydif < 4)
- moveup = 1;
+ moveup = true;
if (ydif > -4)
- movedown = 1;
+ movedown = true;
}
// *******************
@@ -226,32 +226,32 @@ void GriffonEngine::updateNPCs() {
if (movingdir == 0) {
wdir = 2; // left
- moveup = 1;
- moveleft = 1;
+ moveup = true;
+ moveleft = true;
} else if (movingdir == 1) {
wdir = 0; // up
- moveup = 1;
+ moveup = true;
} else if (movingdir == 2) {
wdir = 3; // right
- moveup = 1;
- moveright = 1;
+ moveup = true;
+ moveright = true;
} else if (movingdir == 3) {
wdir = 3; // right
- moveright = 1;
+ moveright = true;
} else if (movingdir == 4) {
wdir = 3; // right
- moveright = 1;
- movedown = 1;
+ moveright = true;
+ movedown = true;
} else if (movingdir == 5) {
wdir = 1; // down
- movedown = 1;
+ movedown = true;
} else if (movingdir == 6) {
wdir = 2; // left
- movedown = 1;
- moveleft = 1;
+ movedown = true;
+ moveleft = true;
} else if (movingdir == 7) {
wdir = 2; // left
- moveleft = 1;
+ moveleft = true;
}
checkpass = true;
@@ -278,21 +278,21 @@ void GriffonEngine::updateNPCs() {
}
if (xdif < 4)
- moveright = 1;
+ moveright = true;
if (xdif > -4)
- moveleft = 1;
+ moveleft = true;
if (ydif < 4)
- movedown = 1;
+ movedown = true;
if (ydif > -4)
- moveup = 1;
+ moveup = true;
}
// *******************
// -------------- ?? move*** vs movin***
- int movinup = 0;
- int movindown = 0;
- int movinleft = 0;
- int movinright = 0;
+ bool movinup = false;
+ bool movindown = false;
+ bool movinleft = false;
+ bool movinright = false;
float xp = (npx / 2 + 6);
float yp = (npy / 2 + 10);
@@ -313,7 +313,7 @@ void GriffonEngine::updateNPCs() {
dq = 0;
if (dq == 0)
- movinup = 1;
+ movinup = true;
if (dq > 0) {
sx = xp - ii;
sy = yp - ii;
@@ -322,8 +322,8 @@ void GriffonEngine::updateNPCs() {
if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0) {
- movinup = 1;
- movinleft = 1;
+ movinup = true;
+ movinleft = true;
}
}
if (dq > 0) {
@@ -334,8 +334,8 @@ void GriffonEngine::updateNPCs() {
if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0) {
- movinup = 1;
- movinright = 1;
+ movinup = true;
+ movinright = true;
}
}
}
@@ -348,7 +348,7 @@ void GriffonEngine::updateNPCs() {
if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0)
- movindown = 1;
+ movindown = true;
if (dq > 0) {
sx = xp - ii;
sy = yp + ii;
@@ -357,8 +357,8 @@ void GriffonEngine::updateNPCs() {
if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0) {
- movindown = 1;
- movinleft = 1;
+ movindown = true;
+ movinleft = true;
}
}
if (dq > 0) {
@@ -369,8 +369,8 @@ void GriffonEngine::updateNPCs() {
if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0) {
- movindown = 1;
- movinright = 1;
+ movindown = true;
+ movinright = true;
}
}
}
@@ -383,7 +383,7 @@ void GriffonEngine::updateNPCs() {
if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0)
- movinleft = 1;
+ movinleft = true;
if (dq > 0) {
sx = xp - ii;
sy = yp - ii;
@@ -392,8 +392,8 @@ void GriffonEngine::updateNPCs() {
if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0) {
- movinleft = 1;
- movinup = 1;
+ movinleft = true;
+ movinup = true;
}
}
if (dq > 0) {
@@ -404,8 +404,8 @@ void GriffonEngine::updateNPCs() {
if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0) {
- movinleft = 1;
- movindown = 1;
+ movinleft = true;
+ movindown = true;
}
}
}
@@ -418,7 +418,7 @@ void GriffonEngine::updateNPCs() {
if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0)
- movinright = 1;
+ movinright = true;
if (dq > 0) {
sx = xp + ii;
sy = yp - ii;
@@ -427,8 +427,8 @@ void GriffonEngine::updateNPCs() {
if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0) {
- movinright = 1;
- movinup = 1;
+ movinright = true;
+ movinup = true;
}
}
if (dq > 0) {
@@ -439,20 +439,20 @@ void GriffonEngine::updateNPCs() {
if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0) {
- movinright = 1;
- movindown = 1;
+ movinright = true;
+ movindown = true;
}
}
}
if (movinup)
- npy = npy - wspd * _fpsr;
+ npy -= wspd * _fpsr;
if (movindown)
- npy = npy + wspd * _fpsr;
+ npy += wspd * _fpsr;
if (movinleft)
- npx = npx - wspd * _fpsr;
+ npx -= wspd * _fpsr;
if (movinright)
- npx = npx + wspd * _fpsr;
+ npx += wspd * _fpsr;
if (checkpass) {
pass = 0;
@@ -489,14 +489,14 @@ void GriffonEngine::updateNPCs() {
if (_npcinfo[i].spriteset == kMonsterFinalBoss)
bgc = 0;
- int rst = 0;
+ bool rst = false;
if (_npcinfo[i].spriteset == kMonsterFinalBoss) {
if (npx < 40 || npx > 280 || npy < 36 || npy > 204)
- rst = 1;
+ rst = true;
}
- if (bgc > 0 || rst == 1) {
+ if (bgc > 0 || rst) {
npx = onpx;
npy = onpy;
}
@@ -505,12 +505,12 @@ void GriffonEngine::updateNPCs() {
_npcinfo[i].y = npy;
_npcinfo[i].walkdir = wdir;
- _npcinfo[i].moving = 0;
+ _npcinfo[i].moving = false;
if (npx != onpx || npy != onpy)
- _npcinfo[i].moving = 1;
+ _npcinfo[i].moving = true;
- if (_npcinfo[i].moving == 1) {
+ if (_npcinfo[i].moving) {
float frame = _npcinfo[i].frame;
frame += aspd * _fpsr;
@@ -527,7 +527,7 @@ void GriffonEngine::updateNPCs() {
// spriteset1 specific
if (_npcinfo[i].spriteset == kMonsterBabyDragon && _npcinfo[i].attackattempt < _ticks) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) {
npx = _npcinfo[i].x;
npy = _npcinfo[i].y;
@@ -542,7 +542,7 @@ void GriffonEngine::updateNPCs() {
setChannelVolume(snd, config.effectsvol);
}
- _npcinfo[i].attacking = 1;
+ _npcinfo[i].attacking = true;
_npcinfo[i].attackframe = 0;
}
}
@@ -553,7 +553,7 @@ void GriffonEngine::updateNPCs() {
// onewing specific
if (_npcinfo[i].spriteset == kMonsterOneWing) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) {
npx = _npcinfo[i].x;
npy = _npcinfo[i].y;
@@ -569,7 +569,7 @@ void GriffonEngine::updateNPCs() {
setChannelVolume(snd, config.effectsvol);
}
- _npcinfo[i].attacking = 1;
+ _npcinfo[i].attacking = true;
_npcinfo[i].attackframe = 0;
_npcinfo[i].headtargetx[0] = _player.px + 12;
@@ -581,7 +581,7 @@ void GriffonEngine::updateNPCs() {
dospell = false;
- if (_npcinfo[i].attacking == 0 && _npcinfo[i].castpause < _ticks) {
+ if (!_npcinfo[i].attacking && _npcinfo[i].castpause < _ticks) {
_npcinfo[i].swayspd = _npcinfo[i].swayspd + _npcinfo[i].swayspd / 200 * _fpsr;
if (_npcinfo[i].swayspd > 15) {
dospell = true;
@@ -634,8 +634,8 @@ void GriffonEngine::updateNPCs() {
// boss1 specific and blackknight
if (_npcinfo[i].spriteset == kMonsterBoss1 || _npcinfo[i].spriteset == kMonsterBlackKnight) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
- _npcinfo[i].attacking = 1;
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) {
+ _npcinfo[i].attacking = true;
_npcinfo[i].attackframe = 0;
castSpell(1, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i);
@@ -675,7 +675,7 @@ void GriffonEngine::updateNPCs() {
setChannelVolume(snd, config.effectsvol);
}
- _npcinfo[i].attacking = 1;
+ _npcinfo[i].attacking = true;
_npcinfo[i].attacking2[ff] = 1;
_npcinfo[i].attackframe2[ff] = 0;
@@ -719,7 +719,7 @@ void GriffonEngine::updateNPCs() {
// spriteset6 specific
if (_npcinfo[i].spriteset == kMonsterRedDragon && _npcinfo[i].attackattempt < _ticks) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) {
npx = _npcinfo[i].x;
npy = _npcinfo[i].y;
@@ -735,7 +735,7 @@ void GriffonEngine::updateNPCs() {
if (pass > 0) {
_npcinfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
- _npcinfo[i].attacking = 1;
+ _npcinfo[i].attacking = true;
_npcinfo[i].attackframe = 0;
float nnxa = 0, nnya = 0, nnxb = 0, nnyb = 0;
@@ -769,8 +769,8 @@ void GriffonEngine::updateNPCs() {
// wizard1 specific
if (_npcinfo[i].spriteset == kMonsterPriest) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
- _npcinfo[i].attacking = 1;
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) {
+ _npcinfo[i].attacking = true;
_npcinfo[i].attackframe = 0;
castSpell(9, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i);
@@ -785,7 +785,7 @@ void GriffonEngine::updateNPCs() {
// spriteset6 specific
if (_npcinfo[i].spriteset == kMonsterYellowDragon && _npcinfo[i].attackattempt < _ticks) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) {
npx = _npcinfo[i].x;
npy = _npcinfo[i].y;
@@ -801,7 +801,7 @@ void GriffonEngine::updateNPCs() {
if (pass > 0) {
_npcinfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
- _npcinfo[i].attacking = 1;
+ _npcinfo[i].attacking = true;
_npcinfo[i].attackframe = 0;
float nnxa = 0, nnya = 0, nnxb = 0, nnyb = 0;
@@ -839,7 +839,7 @@ void GriffonEngine::updateNPCs() {
// twowing specific
if (_npcinfo[i].spriteset == kMonsterTwoWing) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) {
npx = _npcinfo[i].bodysection[7].x;
npy = _npcinfo[i].bodysection[7].y;
@@ -855,7 +855,7 @@ void GriffonEngine::updateNPCs() {
setChannelVolume(snd, config.effectsvol);
}
- _npcinfo[i].attacking = 1;
+ _npcinfo[i].attacking = true;
_npcinfo[i].attackframe = 0;
_npcinfo[i].headtargetx[0] = _player.px + 12;
@@ -865,7 +865,7 @@ void GriffonEngine::updateNPCs() {
}
- if (_npcinfo[i].attacking == 0 && _npcinfo[i].castpause < _ticks) {
+ if (!_npcinfo[i].attacking && _npcinfo[i].castpause < _ticks) {
_npcinfo[i].swayspd = 4;
// sway code
@@ -914,7 +914,7 @@ void GriffonEngine::updateNPCs() {
// dragon2 specific
if (_npcinfo[i].spriteset == kMonsterDragon2 && _npcinfo[i].attackattempt < _ticks) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) {
npx = _npcinfo[i].x;
npy = _npcinfo[i].y;
@@ -929,7 +929,7 @@ void GriffonEngine::updateNPCs() {
setChannelVolume(snd, config.effectsvol);
}
- _npcinfo[i].attacking = 1;
+ _npcinfo[i].attacking = true;
_npcinfo[i].attackframe = 0;
}
}
@@ -939,7 +939,7 @@ void GriffonEngine::updateNPCs() {
// endboss specific
if (_npcinfo[i].spriteset == kMonsterFinalBoss && _npcinfo[i].attackattempt < _ticks) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && _npcinfo[i].attacking == 0) {
+ if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) {
npx = _npcinfo[i].x;
npy = _npcinfo[i].y;
@@ -953,7 +953,7 @@ void GriffonEngine::updateNPCs() {
int snd = playSound(_sfx[kSndIce]);
setChannelVolume(snd, config.effectsvol);
}
- _npcinfo[i].attacking = 1;
+ _npcinfo[i].attacking = true;
_npcinfo[i].attackframe = 0;
}
}
@@ -978,14 +978,10 @@ void GriffonEngine::updateNPCs() {
pass = 0;
- if (_npcinfo[i].attacking == 1)
+ if (_npcinfo[i].attacking)
pass = 1;
if (_npcinfo[i].spriteset == kMonsterFireHydra) {
- if (_npcinfo[i].attacking2[0] == 1)
- pass = 1;
- if (_npcinfo[i].attacking2[1] == 1)
- pass = 1;
- if (_npcinfo[i].attacking2[2] == 1)
+ if (_npcinfo[i].attacking2[0] || _npcinfo[i].attacking2[1] || _npcinfo[i].attacking2[2])
pass = 1;
}
@@ -997,7 +993,7 @@ void GriffonEngine::updateNPCs() {
_npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
if (_npcinfo[i].attackframe >= 16) {
_npcinfo[i].attackframe = 0;
- _npcinfo[i].attacking = 0;
+ _npcinfo[i].attacking = false;
_npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
}
@@ -1014,7 +1010,7 @@ void GriffonEngine::updateNPCs() {
if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
_npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
// _npcinfo[i].attackframe = 0;
- // _npcinfo[i].attacking = 0;
+ // _npcinfo[i].attacking = false;
damage = (float)_npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
@@ -1048,7 +1044,7 @@ void GriffonEngine::updateNPCs() {
_npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
if (_npcinfo[i].attackframe >= 16) {
_npcinfo[i].attackframe = 0;
- _npcinfo[i].attacking = 0;
+ _npcinfo[i].attacking = false;
_npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
}
@@ -1065,7 +1061,7 @@ void GriffonEngine::updateNPCs() {
if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
_npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
// _npcinfo[i].attackframe = 0
- // _npcinfo[i].attacking = 0
+ // _npcinfo[i].attacking = false
damage = (float)_npcinfo[i].attackdamage * (1.0 + (RND() * 0.5));
if (_player.hp > 0)
damagePlayer(damage);
@@ -1076,7 +1072,7 @@ void GriffonEngine::updateNPCs() {
// firehydra
if (_npcinfo[i].spriteset == kMonsterFireHydra) {
for (int ff = 0; ff <= 2; ff++) {
- if (_npcinfo[i].attacking2[ff] == 1) {
+ if (_npcinfo[i].attacking2[ff]) {
float xdif = _npcinfo[i].bodysection[10 * ff + 9].x - _npcinfo[i].headtargetx[ff];
float ydif = _npcinfo[i].bodysection[10 * ff + 9].y - _npcinfo[i].headtargety[ff];
@@ -1100,7 +1096,7 @@ void GriffonEngine::updateNPCs() {
_npcinfo[i].attackframe2[ff] = _npcinfo[i].attackframe2[ff] + _npcinfo[i].attackspd * _fpsr;
if (_npcinfo[i].attackframe2[ff] >= 16) {
_npcinfo[i].attackframe2[ff] = 0;
- _npcinfo[i].attacking2[ff] = 0;
+ _npcinfo[i].attacking2[ff] = false;
_npcinfo[i].attacknext2[ff] = _ticks + _npcinfo[i].attackdelay;
}
@@ -1117,7 +1113,7 @@ void GriffonEngine::updateNPCs() {
if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
_npcinfo[i].attacknext2[ff] = _ticks + _npcinfo[i].attackdelay;
// _npcinfo[i].attackframe2(ff) = 0
- // _npcinfo[i].attacking2(ff) = 0
+ // _npcinfo[i].attacking2(ff) = false
damage = (float)_npcinfo[i].attackdamage * (1.0 + RND() * 0.5);
if (_player.hp > 0)
damagePlayer(damage);
@@ -1153,7 +1149,7 @@ void GriffonEngine::updateNPCs() {
_npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
if (_npcinfo[i].attackframe >= 16) {
_npcinfo[i].attackframe = 0;
- _npcinfo[i].attacking = 0;
+ _npcinfo[i].attacking = false;
_npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
}
@@ -1170,7 +1166,7 @@ void GriffonEngine::updateNPCs() {
if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
_npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
// _npcinfo[i].attackframe = 0
- // _npcinfo[i].attacking = 0
+ // _npcinfo[i].attacking = false
damage = (float)_npcinfo[i].attackdamage * (1.0 + RND() * 0.5);
if (_player.hp > 0)
damagePlayer(damage);
@@ -1183,7 +1179,7 @@ void GriffonEngine::updateNPCs() {
_npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
if (_npcinfo[i].attackframe >= 16) {
_npcinfo[i].attackframe = 0;
- _npcinfo[i].attacking = 0;
+ _npcinfo[i].attacking = false;
_npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
}
@@ -1200,7 +1196,7 @@ void GriffonEngine::updateNPCs() {
if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
_npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
// _npcinfo[i].attackframe = 0
- // _npcinfo[i].attacking = 0
+ // _npcinfo[i].attacking = false
damage = (float)_npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
if (_player.hp > 0)
damagePlayer(damage);
@@ -1212,7 +1208,7 @@ void GriffonEngine::updateNPCs() {
_npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
if (_npcinfo[i].attackframe >= 16) {
_npcinfo[i].attackframe = 0;
- _npcinfo[i].attacking = 0;
+ _npcinfo[i].attacking = false;
_npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
}
@@ -1229,7 +1225,7 @@ void GriffonEngine::updateNPCs() {
if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
_npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
// _npcinfo[i].attackframe = 0
- // _npcinfo[i].attacking = 0
+ // _npcinfo[i].attacking = false
damage = (float)_npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
if (_player.hp > 0)
damagePlayer(damage);
@@ -1418,7 +1414,7 @@ void GriffonEngine::updateSpells() {
if (ABS(spellinfo[i].frame) < 0 && _npcinfo[spellinfo[i].npc].spriteset == kMonsterBoss1) {
int npc = spellinfo[i].npc;
_npcinfo[npc].attackframe = 0;
- _npcinfo[npc].attacking = 0;
+ _npcinfo[npc].attacking = false;
_npcinfo[npc].pause = _ticks + 1000;
_npcinfo[npc].attacknext = _ticks + 4000;
@@ -1429,7 +1425,7 @@ void GriffonEngine::updateSpells() {
if (ABS(spellinfo[i].frame) < 0 && _npcinfo[spellinfo[i].npc].spriteset == kMonsterBlackKnight) {
int npc = spellinfo[i].npc;
_npcinfo[npc].attackframe = 0;
- _npcinfo[npc].attacking = 0;
+ _npcinfo[npc].attacking = false;
_npcinfo[npc].pause = _ticks + 1000;
_npcinfo[npc].attacknext = _ticks + 3500;
@@ -1495,13 +1491,13 @@ void GriffonEngine::updateSpells() {
rcSrc.setWidth(32);
rcSrc.setHeight(32);
- int scatter = 0;
+ bool scatter = false;
if (fr < 8 + f) {
xloc = spellinfo[i].enemyx - 4;
yloc = spellinfo[i].enemyy * (1 - cos(3.14159 / 2 * (fr - f) / 8)); // ^ 2;
yloc *= yloc;
} else {
- scatter = 1;
+ scatter = true;
xloc = spellinfo[i].enemyx - 4 - spellinfo[i].rockdeflect[f] * sin(3.14159 / 2 * ((fr - f) - 8) / 8);
yloc = spellinfo[i].enemyy + hght * (1 - cos(3.14159 / 2 * ((fr - f) - 8) / 8));
}
@@ -1512,7 +1508,7 @@ void GriffonEngine::updateSpells() {
if (xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
_spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- if (scatter == 1) {
+ if (scatter) {
if (spellinfo[i].damagewho == 0) {
for (int e = 1; e <= _lastnpc; e++) {
float xdif = (xloc + 16) - (_npcinfo[e].x + 12);
@@ -1604,9 +1600,9 @@ void GriffonEngine::updateSpells() {
int lx = (int)npx / 16;
int ly = (int)npy / 16;
- int foundel[5];
+ bool foundel[5];
for (int f1 = 0; f1 < 5; f1++) { // !! f < 5
- foundel[f1] = 0;
+ foundel[f1] = false;
}
for (int xo = -2; xo <= 2; xo++) {
@@ -1627,17 +1623,17 @@ void GriffonEngine::updateSpells() {
int element = elementmap[curtiley][curtilex];
if (element > -1 && curtilel == 0)
- foundel[element + 1] = 1;
+ foundel[element + 1] = true;
}
}
int o = _objectMap[sx][sy];
if (o > -1) {
if (_objectInfo[o][4] == 1)
- foundel[2] = 1;
+ foundel[2] = true;
if (o == 1 || o == 2) {
- foundel[2] = 1;
- foundel[4] = 1;
+ foundel[2] = true;
+ foundel[4] = true;
}
}
}
@@ -1648,8 +1644,8 @@ void GriffonEngine::updateSpells() {
strcpy(line, "Found... nothing...");
for (int f1 = 0; f1 < 5; f1++) {
- if (foundel[f1] == 1 && _player.foundSpell[f1] == 0) {
- _player.foundSpell[f1] = 1;
+ if (foundel[f1] && !_player.foundSpell[f1]) {
+ _player.foundSpell[f1] = true;
_player.spellCharge[f1] = 0;
if (f1 == 1)
strcpy(line, "Found... Water Essence");
@@ -2067,7 +2063,7 @@ void GriffonEngine::updateSpells() {
if (spellinfo[i].frame < 0) {
spellinfo[i].frame = 0;
- _npcinfo[spellinfo[i].npc].attacking = 0;
+ _npcinfo[spellinfo[i].npc].attacking = false;
_npcinfo[spellinfo[i].npc].attacknext = _ticks + _npcinfo[spellinfo[i].npc].attackdelay;
}
}
@@ -2361,7 +2357,7 @@ void GriffonEngine::updateSpellsUnder() {
spellinfo[i].frame = 0;
if (ABS(spellinfo[i].frame) < kEpsilon) {
- _npcinfo[spellinfo[i].npc].attacking = 0;
+ _npcinfo[spellinfo[i].npc].attacking = false;
_npcinfo[spellinfo[i].npc].attacknext = _ticks + _npcinfo[spellinfo[i].npc].attackdelay;
}
}
diff --git a/engines/griffon/resources.cpp b/engines/griffon/resources.cpp
index d24a947..0c8b704 100644
--- a/engines/griffon/resources.cpp
+++ b/engines/griffon/resources.cpp
@@ -158,27 +158,27 @@ void GriffonEngine::loadMap(int mapnum) {
_clipbg2->fillRect(trect, ccc);
_forcepause = false;
- cloudson = 0;
+ _cloudsOn = false;
if (mapnum < 6)
- cloudson = 1;
+ _cloudsOn = true;
if (mapnum > 41)
- cloudson = 1;
+ _cloudsOn = true;
if (mapnum > 47)
- cloudson = 0;
+ _cloudsOn = false;
if (mapnum == 52)
- cloudson = 1;
+ _cloudsOn = true;
if (mapnum == 60)
- cloudson = 1;
+ _cloudsOn = true;
if (mapnum == 50)
- cloudson = 1;
+ _cloudsOn = true;
if (mapnum == 54)
- cloudson = 1;
+ _cloudsOn = true;
if (mapnum == 58)
- cloudson = 1;
+ _cloudsOn = true;
if (mapnum == 62)
- cloudson = 1;
+ _cloudsOn = true;
if (mapnum == 83)
- cloudson = 1;
+ _cloudsOn = true;
// -----------special case
dontdrawover = 0;
@@ -390,7 +390,7 @@ void GriffonEngine::loadMap(int mapnum) {
_lastnpc = 0;
for (int i = 0; i < kMaxNPC; i++)
- _npcinfo[i].onmap = 0;
+ _npcinfo[i].onmap = false;
for (int x = 0; x <= 19; x++) {
for (int y = 0; y <= 19; y++) {
@@ -444,7 +444,7 @@ void GriffonEngine::loadMap(int mapnum) {
_npcinfo[o].y = y * 16 - 5;
_npcinfo[o].walkdir = 1;
- _npcinfo[o].onmap = 1;
+ _npcinfo[o].onmap = true;
}
}
}
@@ -644,12 +644,12 @@ void GriffonEngine::loadMap(int mapnum) {
_npcinfo[i].floating = RND() * 16;
}
- if (_npcinfo[i].onmap == 0)
+ if (!_npcinfo[i].onmap)
_npcinfo[i].hp = 0;
_npcinfo[i].maxhp = _npcinfo[i].hp;
- _npcinfo[i].attacking = 0;
+ _npcinfo[i].attacking = false;
_npcinfo[i].attackframe = 0;
_npcinfo[i].cattackframe = 0;
_npcinfo[i].attackspd = 1.5;
@@ -693,7 +693,7 @@ void GriffonEngine::loadMap(int mapnum) {
_npcinfo[i].headtargetx[f] = _npcinfo[i].x + 12;
_npcinfo[i].headtargety[f] = _npcinfo[i].y + 14;
- _npcinfo[i].attacking2[f] = 0;
+ _npcinfo[i].attacking2[f] = false;
_npcinfo[i].attackframe2[f] = 0;
}
}
@@ -763,7 +763,7 @@ void GriffonEngine::loadMap(int mapnum) {
}
// academy crystal
- if (_curmap == 24 && _player.foundSpell[0] == 0 && _scriptflag[kScriptFindCrystal][0] == 1) {
+ if (_curmap == 24 && !_player.foundSpell[0] && _scriptflag[kScriptFindCrystal][0] == 1) {
cx = 9;
cy = 7;
Commit: 9142bea88570f0b1dcf54ff84b3a421daabdab84
https://github.com/scummvm/scummvm/commit/9142bea88570f0b1dcf54ff84b3a421daabdab84
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: start renaming members of Griffon engine class
Changed paths:
engines/griffon/combat.cpp
engines/griffon/cutscenes.cpp
engines/griffon/dialogs.cpp
engines/griffon/draw.cpp
engines/griffon/engine.cpp
engines/griffon/gfx.cpp
engines/griffon/griffon.h
engines/griffon/input.cpp
engines/griffon/logic.cpp
engines/griffon/resources.cpp
engines/griffon/saveload.cpp
engines/griffon/sound.cpp
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp
index f854104..7279730 100644
--- a/engines/griffon/combat.cpp
+++ b/engines/griffon/combat.cpp
@@ -52,7 +52,7 @@ void GriffonEngine::attack() {
if (ly > 0) {
int o2 = 0; // ??
int o = _objectMap[lx][ly - 1];
- if (ly > 1 && (_curmap == 54 || _curmap == 58))
+ if (ly > 1 && (_curMap == 54 || _curMap == 58))
o2 = _objectMap[lx][ly - 2];
// cst
@@ -67,7 +67,7 @@ void GriffonEngine::attack() {
_player.inventory[kInvFlask]++;
addFloatIcon(6, lx * 16, (ly - 1) * 16);
- _objmapf[_curmap][lx][ly - 1] = 1;
+ _objmapf[_curMap][lx][ly - 1] = 1;
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
@@ -86,7 +86,7 @@ void GriffonEngine::attack() {
eventText("Cannot Carry any more Flasks!");
}
- _itemticks = _ticks + 215;
+ _itemTicks = _ticks + 215;
return;
break;
case kScriptMasterKey:
@@ -94,14 +94,14 @@ void GriffonEngine::attack() {
addFloatIcon(14, lx * 16, (ly - 1) * 16);
- _itemticks = _ticks + 215;
+ _itemTicks = _ticks + 215;
- if (_curmap == 34)
- _scriptflag[kScriptMasterKey][0] = 2;
- else if (_curmap == 62)
- _scriptflag[kScriptGardenMasterKey][0] = 2;
- else if (_curmap == 81)
- _scriptflag[kScriptCitadelMasterKey][0] = 2;
+ if (_curMap == 34)
+ _scriptFlag[kScriptMasterKey][0] = 2;
+ else if (_curMap == 62)
+ _scriptFlag[kScriptGardenMasterKey][0] = 2;
+ else if (_curMap == 81)
+ _scriptFlag[kScriptCitadelMasterKey][0] = 2;
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
@@ -127,7 +127,7 @@ void GriffonEngine::attack() {
_objectMap[lx][ly - 1] = 3;
eventText("Found the Infinite Crystal!");
- _itemticks = _ticks + 215;
+ _itemTicks = _ticks + 215;
return;
case kScriptFindShield:
if (_player.shield == 1) {
@@ -135,7 +135,7 @@ void GriffonEngine::attack() {
addFloatIcon(4, lx * 16, (ly - 1) * 16);
- _itemticks = _ticks + 215;
+ _itemTicks = _ticks + 215;
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
@@ -156,7 +156,7 @@ void GriffonEngine::attack() {
addFloatIcon(3, lx * 16, (ly - 1) * 16);
- _itemticks = _ticks + 215;
+ _itemTicks = _ticks + 215;
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
@@ -174,8 +174,8 @@ void GriffonEngine::attack() {
_player.inventory[kInvNormalKey]++;
for (int s = 20; s <= 23; s++) {
- if (_scriptflag[s][0] == 1) {
- _scriptflag[s][0] = 2;
+ if (_scriptFlag[s][0] == 1) {
+ _scriptFlag[s][0] = 2;
}
}
@@ -184,7 +184,7 @@ void GriffonEngine::attack() {
setChannelVolume(snd, config.effectsvol);
}
- _objmapf[_curmap][lx][ly - 1] = 1;
+ _objmapf[_curMap][lx][ly - 1] = 1;
if (_objectInfo[o][4] == 1)
_objectMap[lx][ly - 1] = 3;
@@ -205,7 +205,7 @@ void GriffonEngine::attack() {
_player.inventory[kInvDoubleFlask]++;
addFloatIcon(12, lx * 16, (ly - 1) * 16);
- _objmapf[_curmap][lx][ly - 1] = 1;
+ _objmapf[_curMap][lx][ly - 1] = 1;
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
@@ -225,7 +225,7 @@ void GriffonEngine::attack() {
eventText("Cannot Carry any more Mega Flasks!");
}
- _itemticks = _ticks + 215;
+ _itemTicks = _ticks + 215;
return;
break;
case kScriptBlueFlaskChest:
@@ -233,7 +233,7 @@ void GriffonEngine::attack() {
_player.inventory[kInvDoubleFlask]++;
addFloatIcon(12, lx * 16, (ly - 1) * 16);
- _objmapf[_curmap][lx][ly - 1] = 1;
+ _objmapf[_curMap][lx][ly - 1] = 1;
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
@@ -252,7 +252,7 @@ void GriffonEngine::attack() {
eventText("Cannot Carry any more Mega Flasks!");
}
- _itemticks = _ticks + 215;
+ _itemTicks = _ticks + 215;
return;
break;
case kScriptLightningChest:
@@ -260,7 +260,7 @@ void GriffonEngine::attack() {
_player.inventory[kInvShock]++;
addFloatIcon(17, lx * 16, (ly - 1) * 16);
- _objmapf[_curmap][lx][ly - 1] = 1;
+ _objmapf[_curMap][lx][ly - 1] = 1;
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
@@ -279,7 +279,7 @@ void GriffonEngine::attack() {
eventText("Cannot Carry any more Lightning Bombs!");
}
- _itemticks = _ticks + 215;
+ _itemTicks = _ticks + 215;
return;
break;
case kScriptArmourChest:
@@ -297,33 +297,33 @@ void GriffonEngine::attack() {
_objectMap[lx][ly - 1] = 3;
eventText("Found the Fidelis Mail!");
- _itemticks = _ticks + 215;
+ _itemTicks = _ticks + 215;
return;
}
break;
case kScriptLever:
- if (_curmap == 58 && _scriptflag[kScriptLever][0] == 0) {
- _scriptflag[kScriptLever][0] = 1;
+ if (_curMap == 58 && _scriptFlag[kScriptLever][0] == 0) {
+ _scriptFlag[kScriptLever][0] = 1;
if (config.effects) {
int snd = playSound(_sfx[kSndLever]);
setChannelVolume(snd, config.effectsvol);
}
- } else if (_curmap == 58 && _scriptflag[kScriptLever][0] > 0) {
+ } else if (_curMap == 58 && _scriptFlag[kScriptLever][0] > 0) {
if (config.effects) {
int snd = playSound(_sfx[kSndDoor]);
setChannelVolume(snd, config.effectsvol);
}
eventText("It's stuck!");
- } else if (_curmap == 54 && _scriptflag[kScriptLever][0] == 1) {
+ } else if (_curMap == 54 && _scriptFlag[kScriptLever][0] == 1) {
if (config.effects) {
int snd = playSound(_sfx[kSndLever]);
setChannelVolume(snd, config.effectsvol);
}
- _scriptflag[kScriptLever][0] = 2;
- } else if (_curmap == 54 && _scriptflag[kScriptLever][0] > 1) {
+ _scriptFlag[kScriptLever][0] = 2;
+ } else if (_curMap == 54 && _scriptFlag[kScriptLever][0] > 1) {
if (config.effects) {
int snd = playSound(_sfx[kSndDoor]);
setChannelVolume(snd, config.effectsvol);
@@ -338,7 +338,7 @@ void GriffonEngine::attack() {
addFloatIcon(18, lx * 16, (ly - 1) * 16);
- _itemticks = _ticks + 215;
+ _itemTicks = _ticks + 215;
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
@@ -356,7 +356,7 @@ void GriffonEngine::attack() {
if (_player.shield < 3) {
_player.shield = 3;
addFloatIcon(19, lx * 16, (ly - 1) * 16);
- _itemticks = _ticks + 215;
+ _itemTicks = _ticks + 215;
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
@@ -374,7 +374,7 @@ void GriffonEngine::attack() {
if (_player.armour < 3) {
_player.armour = 3;
addFloatIcon(20, lx * 16, (ly - 1) * 16);
- _itemticks = _ticks + 215;
+ _itemTicks = _ticks + 215;
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
@@ -670,8 +670,8 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py += 16;
- _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- _scriptflag[kScriptMasterKey][0] = 1;
+ _clipBg2->fillRect(rcDest, _clipBg->format.RGBToColor(255, 255, 255));
+ _scriptFlag[kScriptMasterKey][0] = 1;
}
}
@@ -702,13 +702,13 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py += 16;
- _scriptflag[kScriptFindCrystal][0] = 1;
- _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
+ _scriptFlag[kScriptFindCrystal][0] = 1;
+ _clipBg2->fillRect(rcDest, _clipBg->format.RGBToColor(255, 255, 255));
}
}
// tower shield chest script
- if (_npcinfo[npcnum].script == kScriptFindShield && _scriptflag[kScriptFindShield][0] == 0) {
+ if (_npcinfo[npcnum].script == kScriptFindShield && _scriptFlag[kScriptFindShield][0] == 0) {
_triggerloc[9][7] = 5004;
int curTile = 40;
@@ -730,7 +730,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
rcDest.setWidth(16);
rcDest.setHeight(16);
- _tiles[curTileL]->blit(*_mapbg, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _tiles[curTileL]->blit(*_mapBg, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
// firehydra sword chest
@@ -760,14 +760,14 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py += 16;
- _scriptflag[kScriptFindSword][0] = 1;
- _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
+ _scriptFlag[kScriptFindSword][0] = 1;
+ _clipBg2->fillRect(rcDest, _clipBg->format.RGBToColor(255, 255, 255));
}
}
// gardens master key script
- if (_npcinfo[npcnum].script == kScriptGardenMasterKey && _scriptflag[kScriptKeyChest][0] == 0) {
+ if (_npcinfo[npcnum].script == kScriptGardenMasterKey && _scriptFlag[kScriptKeyChest][0] == 0) {
bool alive = false;
for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0)
@@ -793,14 +793,14 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py += 16;
- _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- _scriptflag[kScriptGardenMasterKey][0] = 1;
+ _clipBg2->fillRect(rcDest, _clipBg->format.RGBToColor(255, 255, 255));
+ _scriptFlag[kScriptGardenMasterKey][0] = 1;
}
}
// regular key chest 1
for (int s = 20; s <= 23; s++) {
- if (_npcinfo[npcnum].script == s && _scriptflag[s][0] < 2) {
+ if (_npcinfo[npcnum].script == s && _scriptFlag[s][0] < 2) {
bool alive = false;
for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0)
@@ -826,14 +826,14 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py += 16;
- _scriptflag[s][0] = 1;
- _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
+ _scriptFlag[s][0] = 1;
+ _clipBg2->fillRect(rcDest, _clipBg->format.RGBToColor(255, 255, 255));
}
}
}
// pickup lightning bomb
- if (_npcinfo[npcnum].script == kScriptLightningBomb && (_curmap == 41 && _scriptflag[kScriptLightningBomb][1] == 0)) {
+ if (_npcinfo[npcnum].script == kScriptLightningBomb && (_curMap == 41 && _scriptFlag[kScriptLightningBomb][1] == 0)) {
bool alive = false;
for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0)
@@ -889,13 +889,13 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py += 16;
- _scriptflag[kScriptArmourChest][0] = 1;
- _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
+ _scriptFlag[kScriptArmourChest][0] = 1;
+ _clipBg2->fillRect(rcDest, _clipBg->format.RGBToColor(255, 255, 255));
}
}
// citadel master key script
- if (_npcinfo[npcnum].script == kScriptCitadelMasterKey && _scriptflag[kScriptCitadelMasterKey][0] == 0) {
+ if (_npcinfo[npcnum].script == kScriptCitadelMasterKey && _scriptFlag[kScriptCitadelMasterKey][0] == 0) {
bool alive = false;
for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0)
@@ -921,13 +921,13 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py += 16;
- _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- _scriptflag[kScriptCitadelMasterKey][0] = 1;
+ _clipBg2->fillRect(rcDest, _clipBg->format.RGBToColor(255, 255, 255));
+ _scriptFlag[kScriptCitadelMasterKey][0] = 1;
}
}
// max ups
- if (_npcinfo[npcnum].script == kScriptGetSword3 && _scriptflag[kScriptGetSword3][0] == 0) {
+ if (_npcinfo[npcnum].script == kScriptGetSword3 && _scriptFlag[kScriptGetSword3][0] == 0) {
bool alive = false;
for (int i = 1; i <= _lastnpc; i++) {
if (_npcinfo[i].hp > 0)
@@ -953,8 +953,8 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py += 16;
- _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- _scriptflag[kScriptGetSword3][0] = 1;
+ _clipBg2->fillRect(rcDest, _clipBg->format.RGBToColor(255, 255, 255));
+ _scriptFlag[kScriptGetSword3][0] = 1;
cx = 9;
cy = 8;
@@ -974,9 +974,9 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py += 16;
- _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
+ _clipBg2->fillRect(rcDest, _clipBg->format.RGBToColor(255, 255, 255));
- _scriptflag[kScriptShield3][0] = 1;
+ _scriptFlag[kScriptShield3][0] = 1;
cx = 12;
cy = 8;
@@ -996,8 +996,8 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
if (lx == cx && ly == cy)
_player.py += 16;
- _clipbg2->fillRect(rcDest, _clipbg->format.RGBToColor(255, 255, 255));
- _scriptflag[kScriptArmour3][0] = 1;
+ _clipBg2->fillRect(rcDest, _clipBg->format.RGBToColor(255, 255, 255));
+ _scriptFlag[kScriptArmour3][0] = 1;
}
}
diff --git a/engines/griffon/cutscenes.cpp b/engines/griffon/cutscenes.cpp
index 719e89f..ce58ad9 100644
--- a/engines/griffon/cutscenes.cpp
+++ b/engines/griffon/cutscenes.cpp
@@ -138,10 +138,10 @@ void GriffonEngine::showLogos() {
y = CLIP<float>(y, 0.0, 255.0);
}
- _videobuffer->fillRect(Common::Rect(0, 0, 320, 240), 0);
- _logosimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, nullptr, TS_ARGB((int)y, (int)y, (int)y, (int)y));
+ _videoBuffer->fillRect(Common::Rect(0, 0, 320, 240), 0);
+ _logosImg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, nullptr, TS_ARGB((int)y, (int)y, (int)y, (int)y));
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(_event);
@@ -149,15 +149,15 @@ void GriffonEngine::showLogos() {
if (_event.type == Common::EVENT_QUIT)
_shouldQuit = true;
- _tickspassed = _ticks;
+ _ticksPassed = _ticks;
_ticks = g_system->getMillis();
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24;
+ _ticksPassed = _ticks - _ticksPassed;
+ _fpsr = (float)_ticksPassed / 24;
_fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
+ if (_ticks > _nextTicks) {
+ _nextTicks = _ticks + 1000;
_fps = _fp;
_fp = 0;
}
@@ -169,13 +169,13 @@ void GriffonEngine::showLogos() {
}
void GriffonEngine::intro() {
- _videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
- _videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
+ _videoBuffer2->fillRect(Common::Rect(0, 0, _videoBuffer2->w, _videoBuffer2->h), 0);
+ _videoBuffer3->fillRect(Common::Rect(0, 0, _videoBuffer3->w, _videoBuffer3->h), 0);
_ticks = g_system->getMillis();
- _videobuffer->blit(*_videobuffer3);
- _videobuffer->blit(*_videobuffer2);
+ _videoBuffer->blit(*_videoBuffer3);
+ _videoBuffer->blit(*_videoBuffer2);
_fpsr = 0.0;
int y = 140;
@@ -187,7 +187,7 @@ void GriffonEngine::intro() {
}
_secsingame = 0;
- _secstart = 0;
+ _secStart = 0;
bool ldstop = false;
int cnt = 0;
@@ -208,12 +208,12 @@ void GriffonEngine::intro() {
rc.left = -xofs;
rc.top = 0;
- _titleimg->blit(*_videobuffer, rc.left, rc.top);
+ _titleImg->blit(*_videoBuffer, rc.left, rc.top);
rc.left = -xofs + 320;
rc.top = 0;
- _titleimg->blit(*_videobuffer, rc.left, rc.top);
+ _titleImg->blit(*_videoBuffer, rc.left, rc.top);
if (++cnt >= 6) {
cnt = 0;
@@ -224,25 +224,25 @@ void GriffonEngine::intro() {
int yy = y + i * 10;
if (yy > -8 && yy < 240) {
int x = 160 - strlen(story[i]) * 4;
- drawString(_videobuffer, story[i], x, yy, 4);
+ drawString(_videoBuffer, story[i], x, yy, 4);
}
if (yy < 10 && i == 47)
return;
}
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
g_system->updateScreen();
- _tickspassed = _ticks;
+ _ticksPassed = _ticks;
_ticks = g_system->getMillis();
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24.0;
+ _ticksPassed = _ticks - _ticksPassed;
+ _fpsr = (float)_ticksPassed / 24.0;
_fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
+ if (_ticks > _nextTicks) {
+ _nextTicks = _ticks + 1000;
_fps = _fp;
_fp = 0;
}
@@ -283,9 +283,9 @@ void GriffonEngine::endOfGame() {
int ticks1 = _ticks;
int ya = 0;
- _videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
- _videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
- _videobuffer2->copyRectToSurface(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ _videoBuffer2->fillRect(Common::Rect(0, 0, _videoBuffer2->w, _videoBuffer2->h), 0);
+ _videoBuffer3->fillRect(Common::Rect(0, 0, _videoBuffer3->w, _videoBuffer3->h), 0);
+ _videoBuffer2->copyRectToSurface(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
float ld = 0;
bool ldstop = false; // CHECKME: Check if actually used
@@ -307,27 +307,27 @@ void GriffonEngine::endOfGame() {
} else
break;
- _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
+ _videoBuffer->fillRect(Common::Rect(0, 0, _videoBuffer->w, _videoBuffer->h), 0);
- _videobuffer->setAlpha(ya);
- _videobuffer3->copyRectToSurface(_videobuffer2->getPixels(), _videobuffer2->pitch, 0, 0, _videobuffer2->w, _videobuffer2->h);
- _videobuffer3->copyRectToSurface(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ _videoBuffer->setAlpha(ya);
+ _videoBuffer3->copyRectToSurface(_videoBuffer2->getPixels(), _videoBuffer2->pitch, 0, 0, _videoBuffer2->w, _videoBuffer2->h);
+ _videoBuffer3->copyRectToSurface(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
- g_system->copyRectToScreen(_videobuffer3->getPixels(), _videobuffer3->pitch, 0, 0, _videobuffer3->w, _videobuffer3->h);
+ g_system->copyRectToScreen(_videoBuffer3->getPixels(), _videoBuffer3->pitch, 0, 0, _videoBuffer3->w, _videoBuffer3->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
- _tickspassed = _ticks;
+ _ticksPassed = _ticks;
_ticks = g_system->getMillis();
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24;
+ _ticksPassed = _ticks - _ticksPassed;
+ _fpsr = (float)_ticksPassed / 24;
_fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
+ if (_ticks > _nextTicks) {
+ _nextTicks = _ticks + 1000;
_fps = _fp;
_fp = 0;
}
@@ -343,19 +343,19 @@ void GriffonEngine::endOfGame() {
rc.left = -xofs;
rc.top = 0;
- _titleimg->blit(*_videobuffer, rc.left, rc.top);
+ _titleImg->blit(*_videoBuffer, rc.left, rc.top);
rc.left = -xofs + 320;
rc.top = 0;
- _titleimg->blit(*_videobuffer, rc.left, rc.top);
+ _titleImg->blit(*_videoBuffer, rc.left, rc.top);
y = y - spd * _fpsr;
for (int i = 0; i <= 26; i++) {
int yy = y + i * 10;
if (yy > -8 && yy < 240) {
int x = 160 - strlen(story2[i]) * 4;
- drawString(_videobuffer, story2[i], x, yy, 4);
+ drawString(_videoBuffer, story2[i], x, yy, 4);
}
if (yy < 10 && i == 25)
@@ -368,22 +368,22 @@ void GriffonEngine::endOfGame() {
ya = CLIP(ya, 0, 255);
}
- _videobuffer->setAlpha(ya);
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ _videoBuffer->setAlpha(ya);
+ g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
- _tickspassed = _ticks;
+ _ticksPassed = _ticks;
_ticks = g_system->getMillis();
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24;
+ _ticksPassed = _ticks - _ticksPassed;
+ _fpsr = (float)_ticksPassed / 24;
_fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
+ if (_ticks > _nextTicks) {
+ _nextTicks = _ticks + 1000;
_fps = _fp;
_fp = 0;
}
@@ -408,7 +408,7 @@ void GriffonEngine::endOfGame() {
ticks1 = _ticks;
int y1 = 0;
- _videobuffer2->copyRectToSurface(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ _videoBuffer2->copyRectToSurface(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
do {
if (_ticks < ticks1 + 1500) {
@@ -418,27 +418,27 @@ void GriffonEngine::endOfGame() {
else
break;
- _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
+ _videoBuffer->fillRect(Common::Rect(0, 0, _videoBuffer->w, _videoBuffer->h), 0);
- _videobuffer->setAlpha(y1);
- _videobuffer2->blit(*_videobuffer3);
- _videobuffer->blit(*_videobuffer3);
+ _videoBuffer->setAlpha(y1);
+ _videoBuffer2->blit(*_videoBuffer3);
+ _videoBuffer->blit(*_videoBuffer3);
- g_system->copyRectToScreen(_videobuffer3->getPixels(), _videobuffer3->pitch, 0, 0, _videobuffer3->w, _videobuffer3->h);
+ g_system->copyRectToScreen(_videoBuffer3->getPixels(), _videoBuffer3->pitch, 0, 0, _videoBuffer3->w, _videoBuffer3->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
- _tickspassed = _ticks;
+ _ticksPassed = _ticks;
_ticks = g_system->getMillis();
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24;
+ _ticksPassed = _ticks - _ticksPassed;
+ _fpsr = (float)_ticksPassed / 24;
_fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
+ if (_ticks > _nextTicks) {
+ _nextTicks = _ticks + 1000;
_fps = _fp;
_fp = 0;
}
@@ -451,7 +451,7 @@ void GriffonEngine::endOfGame() {
y1 = 0;
do {
- _videobuffer->copyRectToSurface(_theendimg->getPixels(), _theendimg->pitch, 0, 0, _theendimg->w, _theendimg->h);
+ _videoBuffer->copyRectToSurface(_theEndImg->getPixels(), _theEndImg->pitch, 0, 0, _theEndImg->w, _theEndImg->h);
y1 = 255;
if (_ticks < ticks1 + 1000) {
@@ -459,22 +459,22 @@ void GriffonEngine::endOfGame() {
y1 = CLIP(y1, 0, 255);
}
- _videobuffer->setAlpha(y1);
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ _videoBuffer->setAlpha(y1);
+ g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
- _tickspassed = _ticks;
+ _ticksPassed = _ticks;
_ticks = g_system->getMillis();
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24;
+ _ticksPassed = _ticks - _ticksPassed;
+ _fpsr = (float)_ticksPassed / 24;
_fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
+ if (_ticks > _nextTicks) {
+ _nextTicks = _ticks + 1000;
_fps = _fp;
_fp = 0;
}
@@ -486,8 +486,8 @@ void GriffonEngine::endOfGame() {
} while (1);
- _videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
- _videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
+ _videoBuffer2->fillRect(Common::Rect(0, 0, _videoBuffer2->w, _videoBuffer2->h), 0);
+ _videoBuffer3->fillRect(Common::Rect(0, 0, _videoBuffer3->w, _videoBuffer3->h), 0);
theEnd();
@@ -500,23 +500,23 @@ void GriffonEngine::theEnd() {
}
for (float y = 0; y < 100; y += _fpsr) {
- _videobuffer->setAlpha((int)y);
- _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ _videoBuffer->setAlpha((int)y);
+ _videoBuffer->fillRect(Common::Rect(0, 0, _videoBuffer->w, _videoBuffer->h), 0);
+ g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
- _tickspassed = _ticks;
+ _ticksPassed = _ticks;
_ticks = g_system->getMillis();
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24.0;
+ _ticksPassed = _ticks - _ticksPassed;
+ _fpsr = (float)_ticksPassed / 24.0;
_fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
+ if (_ticks > _nextTicks) {
+ _nextTicks = _ticks + 1000;
_fps = _fp;
_fp = 0;
}
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index a26f65c..959cdfe 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -56,13 +56,13 @@ void GriffonEngine::title(int mode) {
rcSrc.setWidth(320);
rcSrc.setHeight(240);
- _videobuffer2->fillRect(rcSrc, 0);
- _videobuffer3->fillRect(rcSrc, 0);
+ _videoBuffer2->fillRect(rcSrc, 0);
+ _videoBuffer3->fillRect(rcSrc, 0);
_ticks = g_system->getMillis();
- _videobuffer->blit(*_videobuffer3);
- _videobuffer->blit(*_videobuffer2);
+ _videoBuffer->blit(*_videoBuffer3);
+ _videoBuffer->blit(*_videoBuffer2);
int cursel = 0;
int keypause = _ticks + 220;
@@ -95,34 +95,34 @@ void GriffonEngine::title(int mode) {
rc.left = -xofs;
rc.top = 0;
- _titleimg->blit(*_videobuffer, rc.left, rc.top);
+ _titleImg->blit(*_videoBuffer, rc.left, rc.top);
rc.left = -xofs + 320.0;
rc.top = 0;
- _titleimg->blit(*_videobuffer, rc.left, rc.top);
+ _titleImg->blit(*_videoBuffer, rc.left, rc.top);
rc.left = 0;
rc.top = 0;
- _titleimg2->blit(*_videobuffer, rc.left, rc.top);
+ _titleImg2->blit(*_videoBuffer, rc.left, rc.top);
int y = 172;
int x = 160 - 14 * 4;
- drawString(_videobuffer, "new game/save/load", x, y, 4);
- drawString(_videobuffer, "options", x, y + 16, 4);
- drawString(_videobuffer, "quit game", x, y + 32, 4);
+ drawString(_videoBuffer, "new game/save/load", x, y, 4);
+ drawString(_videoBuffer, "options", x, y + 16, 4);
+ drawString(_videoBuffer, "quit game", x, y + 32, 4);
if (mode == 1)
- drawString(_videobuffer, "return", x, y + 48, 4);
+ drawString(_videoBuffer, "return", x, y + 48, 4);
else
- drawString(_videobuffer, "(c) 2005 by Daniel 'Syn9' Kennedy", 28, 224, 4);
+ drawString(_videoBuffer, "(c) 2005 by Daniel 'Syn9' Kennedy", 28, 224, 4);
rc.left = (int16)(x - 16 - 4 * cos(2 * PI * _itemyloc / 16));
rc.top = (int16)(y - 4 + 16 * cursel);
- _itemimg[15]->blit(*_videobuffer, rc.left, rc.top);
+ _itemImg[15]->blit(*_videoBuffer, rc.left, rc.top);
float yf = 255.0;
if (_ticks < ticks1 + 1000) {
@@ -130,19 +130,19 @@ void GriffonEngine::title(int mode) {
yf = CLIP<float>(yf, 0.0, 255.0);
}
- _videobuffer->setAlpha((int)yf);
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ _videoBuffer->setAlpha((int)yf);
+ g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
g_system->updateScreen();
- _tickspassed = _ticks;
+ _ticksPassed = _ticks;
_ticks = g_system->getMillis();
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24.0;
+ _ticksPassed = _ticks - _ticksPassed;
+ _fpsr = (float)_ticksPassed / 24.0;
_fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
+ if (_ticks > _nextTicks) {
+ _nextTicks = _ticks + 1000;
_fps = _fp;
_fp = 0;
}
@@ -216,7 +216,7 @@ void GriffonEngine::title(int mode) {
g_system->delayMillis(10);
} while (!_shouldQuit && !exitTitle);
- _itemticks = _ticks + 210;
+ _itemTicks = _ticks + 210;
if (config.music) {
haltSoundChannel(_menuChannel);
@@ -262,7 +262,7 @@ void GriffonEngine::configMenu() {
int ticks1 = _ticks;
do {
- _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
+ _videoBuffer->fillRect(Common::Rect(0, 0, _videoBuffer->w, _videoBuffer->h), 0);
rcDest.left = 256 + 256 * cos(PI / 180 * clouddeg * 40);
rcDest.top = 192 + 192 * sin(PI / 180 * clouddeg * 40);
@@ -270,7 +270,7 @@ void GriffonEngine::configMenu() {
rcDest.setHeight(240);
cloudimg->setAlpha(128, true);
- cloudimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
+ cloudimg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
cloudimg->setAlpha(64, true);
rcDest.left = 256;
@@ -279,10 +279,10 @@ void GriffonEngine::configMenu() {
rcDest.setHeight(240);
cloudimg->setAlpha(128, true);
- cloudimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
+ cloudimg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
cloudimg->setAlpha(64, true);
- _videobuffer->copyRectToSurface(configwindow->getPixels(), configwindow->pitch, 0, 0, configwindow->w, configwindow->h);
+ _videoBuffer->copyRectToSurface(configwindow->getPixels(), configwindow->pitch, 0, 0, configwindow->w, configwindow->h);
int sy = SY;
@@ -308,8 +308,8 @@ void GriffonEngine::configMenu() {
} else if (i > 18)
destColumn = 0;
- drawString(_videobuffer, optionTitles[i], 156 - 8 * strlen(optionTitles[i]), sy + i * 8, 0);
- drawString(_videobuffer, optionValues[i], 164, sy + i * 8, destColumn);
+ drawString(_videoBuffer, optionTitles[i], 156 - 8 * strlen(optionTitles[i]), sy + i * 8, 0);
+ drawString(_videoBuffer, optionValues[i], 164, sy + i * 8, destColumn);
}
int curselt = cursel + 2;
@@ -328,7 +328,7 @@ void GriffonEngine::configMenu() {
rc.left = 148 + 3 * cos(2 * PI * _itemyloc / 16.0);
rc.top = sy + 8 * curselt - 4;
- _itemimg[15]->blit(*_videobuffer, rc.left, rc.top);
+ _itemImg[15]->blit(*_videoBuffer, rc.left, rc.top);
float yy = 255.0;
if (_ticks < ticks1 + 1000) {
@@ -336,21 +336,21 @@ void GriffonEngine::configMenu() {
yy = CLIP<float>(yy, 0.0, 255.0);
}
- _videobuffer->setAlpha((int)yy);
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ _videoBuffer->setAlpha((int)yy);
+ g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(_event);
- _tickspassed = _ticks;
+ _ticksPassed = _ticks;
_ticks = g_system->getMillis();
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24;
+ _ticksPassed = _ticks - _ticksPassed;
+ _fpsr = (float)_ticksPassed / 24;
_fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
+ if (_ticks > _nextTicks) {
+ _nextTicks = _ticks + 1000;
_fps = _fp;
_fp = 0;
}
@@ -465,7 +465,7 @@ void GriffonEngine::configMenu() {
} while (!_shouldQuit && !exitMenu);
configwindow->free();
- _itemticks = _ticks + 210;
+ _itemTicks = _ticks + 210;
cloudimg->setAlpha(64, true);
}
@@ -475,8 +475,8 @@ void GriffonEngine::saveLoadNew() {
clouddeg = 0;
- _videobuffer->setAlpha(255);
- saveloadimg->setAlpha(192, true);
+ _videoBuffer->setAlpha(255);
+ _saveLoadImg->setAlpha(192, true);
int currow = 0;
int curcol = 0;
@@ -487,7 +487,7 @@ void GriffonEngine::saveLoadNew() {
int tickpause = _ticks + 150;
do {
- _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
+ _videoBuffer->fillRect(Common::Rect(0, 0, _videoBuffer->w, _videoBuffer->h), 0);
y += 1 * _fpsr;
@@ -497,7 +497,7 @@ void GriffonEngine::saveLoadNew() {
rcDest.setHeight(240);
cloudimg->setAlpha(128, true);
- cloudimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
+ cloudimg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
cloudimg->setAlpha(64, true);
rcDest.left = 256;
@@ -506,10 +506,10 @@ void GriffonEngine::saveLoadNew() {
rcDest.setHeight(240);
cloudimg->setAlpha(128, true);
- cloudimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
+ cloudimg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
cloudimg->setAlpha(64, true);
- saveloadimg->blit(*_videobuffer);
+ _saveLoadImg->blit(*_videoBuffer);
g_system->getEventManager()->pollEvent(_event);
@@ -520,7 +520,7 @@ void GriffonEngine::saveLoadNew() {
if (tickpause < _ticks) {
if (_event.type == Common::EVENT_KEYDOWN) {
- _itemticks = _ticks + 220;
+ _itemTicks = _ticks + 220;
if (_event.kbd.keycode == Common::KEYCODE_RETURN) {
// QUIT - non existent :)
@@ -541,7 +541,7 @@ void GriffonEngine::saveLoadNew() {
// LOAD GAME
if (currow == 0 && curcol == 1) {
lowerLock = true;
- currow = 1 + _saveslot;
+ currow = 1 + _saveSlot;
tickpause = _ticks + 125;
}
// SAVE GAME
@@ -553,10 +553,10 @@ void GriffonEngine::saveLoadNew() {
if (lowerLock && curcol == 1 && tickpause < _ticks) {
if (saveState(currow - 1)) {
- _secstart += _secsingame;
+ _secStart += _secsingame;
_secsingame = 0;
lowerLock = false;
- _saveslot = currow - 1;
+ _saveSlot = currow - 1;
currow = 0;
}
}
@@ -564,7 +564,7 @@ void GriffonEngine::saveLoadNew() {
if (lowerLock && curcol == 2 && tickpause < _ticks) {
if (loadState(currow - 1)) {
_player.walkSpeed = 1.1f;
- _animspd = 0.5f;
+ _animSpeed = 0.5f;
attacking = false;
_player.attackSpeed = 1.5f;
@@ -574,8 +574,8 @@ void GriffonEngine::saveLoadNew() {
haltSoundChannel(-1);
_secsingame = 0;
- _saveslot = currow - 1;
- loadMap(_curmap);
+ _saveSlot = currow - 1;
+ loadMap(_curMap);
mainLoop();
}
}
@@ -652,21 +652,21 @@ void GriffonEngine::saveLoadNew() {
char line[256];
sprintf(line, "Game Time: %02i:%02i:%02i", h, m, s);
- drawString(_videobuffer, line, 160 - strlen(line) * 4, sy, 0);
+ drawString(_videoBuffer, line, 160 - strlen(line) * 4, sy, 0);
sx = 12;
sy += 11;
int cc = 0;
sprintf(line, "Health: %i/%i", _playera.hp, _playera.maxHp);
- drawString(_videobuffer, line, sx, sy, cc);
+ drawString(_videoBuffer, line, sx, sy, cc);
if (_playera.level == 22)
strcpy(line, "Level: MAX");
else
sprintf(line, "Level: %i", _playera.level);
- drawString(_videobuffer, line, sx, sy + 11, 0);
+ drawString(_videoBuffer, line, sx, sy + 11, 0);
rcSrc.left = sx + 15 * 8 + 24;
rcSrc.top = sy + 1;
@@ -674,19 +674,19 @@ void GriffonEngine::saveLoadNew() {
int ss = (_playera.sword - 1) * 3;
if (_playera.sword == 3)
ss = 18;
- _itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _itemImg[ss]->blit(*_videoBuffer, rcSrc.left, rcSrc.top);
rcSrc.left += 16;
ss = (_playera.shield - 1) * 3 + 1;
if (_playera.shield == 3)
ss = 19;
- _itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _itemImg[ss]->blit(*_videoBuffer, rcSrc.left, rcSrc.top);
rcSrc.left += 16;
ss = (_playera.armour - 1) * 3 + 2;
if (_playera.armour == 3)
ss = 20;
- _itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _itemImg[ss]->blit(*_videoBuffer, rcSrc.left, rcSrc.top);
int nx = rcSrc.left + 13 + 3 * 8;
rcSrc.left = nx - 17;
@@ -695,12 +695,12 @@ void GriffonEngine::saveLoadNew() {
for (int i = 0; i < 5; i++) {
rcSrc.left += 17;
if (_playera.foundSpell[i])
- _itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _itemImg[7 + i]->blit(*_videoBuffer, rcSrc.left, rcSrc.top);
}
}
} else {
int sy = 57 + ff * 48;
- drawString(_videobuffer, "Empty", 160 - 5 * 4, sy, 0);
+ drawString(_videoBuffer, "Empty", 160 - 5 * 4, sy, 0);
}
}
// ------------------------------------------
@@ -732,7 +732,7 @@ void GriffonEngine::saveLoadNew() {
rcDest.top = (int16)(53 + (currow - 1) * 48);
}
- _itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
+ _itemImg[15]->blit(*_videoBuffer, rcDest.left, rcDest.top);
if (lowerLock) {
@@ -745,7 +745,7 @@ void GriffonEngine::saveLoadNew() {
// CHECKME: Useless code? or temporary commented?
// rcDest.left = rcDest.left; // + 2 + 2 * sin(-2 * PI * _itemyloc / 16)
- _itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
+ _itemImg[15]->blit(*_videoBuffer, rcDest.left, rcDest.top);
}
int yy = 255;
@@ -754,21 +754,21 @@ void GriffonEngine::saveLoadNew() {
yy = CLIP(yy, 0, 255);
}
- _videobuffer->setAlpha((int)yy);
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ _videoBuffer->setAlpha((int)yy);
+ g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(_event);
- _tickspassed = _ticks;
+ _ticksPassed = _ticks;
_ticks = g_system->getMillis();
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24;
+ _ticksPassed = _ticks - _ticksPassed;
+ _fpsr = (float)_ticksPassed / 24;
_fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
+ if (_ticks > _nextTicks) {
+ _nextTicks = _ticks + 1000;
_fps = _fp;
_fp = 0;
}
diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp
index 54d249a..0710e89 100644
--- a/engines/griffon/draw.cpp
+++ b/engines/griffon/draw.cpp
@@ -113,9 +113,9 @@ void GriffonEngine::drawAnims(int Layer) {
int curtilex = c % 20;
int curtiley = (c - curtilex) / 20;
- if (_curmap == 58 && _scriptflag[kScriptLever][0] > 0)
+ if (_curMap == 58 && _scriptFlag[kScriptLever][0] > 0)
curtilex = 1;
- if (_curmap == 54 && _scriptflag[kScriptLever][0] > 1)
+ if (_curMap == 54 && _scriptFlag[kScriptLever][0] > 1)
curtilex = 1;
rcSrc.left = curtilex * 16;
rcSrc.top = curtiley * 16;
@@ -127,7 +127,7 @@ void GriffonEngine::drawAnims(int Layer) {
rcDest.setWidth(16);
rcDest.setHeight(16);
- _tiles[curtilel]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _tiles[curtilel]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
if (Layer == 1) {
@@ -163,7 +163,7 @@ void GriffonEngine::drawAnims(int Layer) {
}
if (pass)
- _tiles[curtilel]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _tiles[curtilel]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
}
@@ -180,13 +180,13 @@ int hud_recalc(int a, int b, int c) {
return result > b ? b : result;
}
-#define RGB(R, G, B) (_videobuffer->format.RGBToColor((R), (G), (B)))
+#define RGB(R, G, B) (_videoBuffer->format.RGBToColor((R), (G), (B)))
void GriffonEngine::drawHud() {
//sprintf(line, "_fps: %i, map: %i, exp: %i/%i", (int)_fps, _curmap, _player.exp, _player.nextlevel);
//drawString(_videobuffer, line, 0, 0, 0);
- game_fillrect(_videobuffer2, 0, 0, 320, 240, 0);
+ game_fillrect(_videoBuffer2, 0, 0, 320, 240, 0);
for (int i = 0; i < kMaxFloat; i++) {
if (_floattext[i][0] > 0) {
@@ -201,13 +201,13 @@ void GriffonEngine::drawHud() {
c2 = 2;
if (fc != 0) {
- drawString(_videobuffer, _floatstri[i], (int)(_floattext[i][1]) + 0, (int)(_floattext[i][2]) - 1, c2);
- drawString(_videobuffer, _floatstri[i], (int)(_floattext[i][1]) + 0, (int)(_floattext[i][2]) + 1, c2);
- drawString(_videobuffer, _floatstri[i], (int)(_floattext[i][1]) - 1, (int)(_floattext[i][2]) + 0, c2);
- drawString(_videobuffer, _floatstri[i], (int)(_floattext[i][1]) + 1, (int)(_floattext[i][2]) + 0, c2);
+ drawString(_videoBuffer, _floatstri[i], (int)(_floattext[i][1]) + 0, (int)(_floattext[i][2]) - 1, c2);
+ drawString(_videoBuffer, _floatstri[i], (int)(_floattext[i][1]) + 0, (int)(_floattext[i][2]) + 1, c2);
+ drawString(_videoBuffer, _floatstri[i], (int)(_floattext[i][1]) - 1, (int)(_floattext[i][2]) + 0, c2);
+ drawString(_videoBuffer, _floatstri[i], (int)(_floattext[i][1]) + 1, (int)(_floattext[i][2]) + 0, c2);
}
- drawString(_videobuffer, _floatstri[i], (int)(_floattext[i][1]), (int)(_floattext[i][2]), c);
+ drawString(_videoBuffer, _floatstri[i], (int)(_floattext[i][1]), (int)(_floattext[i][2]), c);
}
if (_floaticon[i][0] > 0) {
@@ -219,9 +219,9 @@ void GriffonEngine::drawHud() {
rcDest.top = iy;
if (ico != 99)
- _itemimg[ico]->blit(*_videobuffer, rcDest.left, rcDest.top);
+ _itemImg[ico]->blit(*_videoBuffer, rcDest.left, rcDest.top);
if (ico == 99) {
- _spellimg->setAlpha((int)(RND() * 96) + 96, true);
+ _spellImg->setAlpha((int)(RND() * 96) + 96, true);
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -231,9 +231,9 @@ void GriffonEngine::drawHud() {
rcDest.left = ix;
rcDest.top = iy;
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- _spellimg->setAlpha(255, true);
+ _spellImg->setAlpha(255, true);
}
}
}
@@ -251,10 +251,10 @@ void GriffonEngine::drawHud() {
rcSrc.left = rcSrc.left + 17;
if (_player.foundSpell[i]) {
- _itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _itemImg[7 + i]->blit(*_videoBuffer, rcSrc.left, rcSrc.top);
- game_fillrect(_videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32));
- game_fillrect(_videobuffer, rcSrc.left + 1, sy + 17,
+ game_fillrect(_videoBuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32));
+ game_fillrect(_videoBuffer, rcSrc.left + 1, sy + 17,
hud_recalc(_player.spellCharge[i], 14, 100), 2,
ABS(_player.spellCharge[i] - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 224, 64));
}
@@ -268,17 +268,17 @@ void GriffonEngine::drawHud() {
rcDest.top = 0;
rcDest.right = 320;
rcDest.bottom = 240;
- _videobuffer2->fillRect(rcDest, 0);
- _videobuffer2->setAlpha((int)(_player.itemselshade * 4)); // FIXME
- _videobuffer2->blit(*_videobuffer);
+ _videoBuffer2->fillRect(rcDest, 0);
+ _videoBuffer2->setAlpha((int)(_player.itemselshade * 4)); // FIXME
+ _videoBuffer2->blit(*_videoBuffer);
int sy = 202;
rcSrc.left = 46;
rcSrc.top = 46;
- _inventoryimg->setAlpha(160, true); // 128
- _inventoryimg->blit(*_videobuffer, rcSrc.left, rcSrc.top);
- _inventoryimg->setAlpha(255, true);
+ _inventoryImg->setAlpha(160, true); // 128
+ _inventoryImg->blit(*_videoBuffer, rcSrc.left, rcSrc.top);
+ _inventoryImg->setAlpha(255, true);
int sx = 54;
sy = 55;
@@ -288,66 +288,66 @@ void GriffonEngine::drawHud() {
rcDest.top = 46 + 77;
int amap = 0;
- if (_curmap > 46)
+ if (_curMap > 46)
amap = 2;
- if (_curmap > 67)
+ if (_curMap > 67)
amap = 3;
- if (_curmap > 5 && _curmap < 42)
+ if (_curMap > 5 && _curMap < 42)
amap = 1;
- mapimg[amap]->blit(*_videobuffer, rcDest.left, rcDest.top);
+ mapImg[amap]->blit(*_videoBuffer, rcDest.left, rcDest.top);
- long ccc = _videobuffer->format.RGBToColor(128 + 127 * sin(3.141592 * 2 * _itemyloc / 16), 0, 0);
+ long ccc = _videoBuffer->format.RGBToColor(128 + 127 * sin(3.141592 * 2 * _itemyloc / 16), 0, 0);
for (int b = 0; b <= 6; b++) {
for (int a = 0; a <= 12; a++) {
- if (invmap[amap][b][a] == _curmap) {
- game_fillrect(_videobuffer, 46 + 9 + a * 9 + 2, 46 + 77 + b * 9 + 1, 6, 6, ccc);
+ if (invmap[amap][b][a] == _curMap) {
+ game_fillrect(_videoBuffer, 46 + 9 + a * 9 + 2, 46 + 77 + b * 9 + 1, 6, 6, ccc);
}
}
}
if (amap == 1) {
- drawString(_videobuffer, "L1", 46 + 9, 46 + 77, 0);
- drawString(_videobuffer, "L2", 46 + 9 + 7 * 9, 46 + 77, 0);
+ drawString(_videoBuffer, "L1", 46 + 9, 46 + 77, 0);
+ drawString(_videoBuffer, "L2", 46 + 9 + 7 * 9, 46 + 77, 0);
}
char line[128];
sprintf(line, "Health: %i/%i", _player.hp, _player.maxHp);
- drawString(_videobuffer, line, sx, sy, _player.hp <= _player.maxHp * 0.25 ? (int)_player.hpflash : 0);
+ drawString(_videoBuffer, line, sx, sy, _player.hp <= _player.maxHp * 0.25 ? (int)_player.hpflash : 0);
sprintf(line, "Level : %i", _player.level);
if (_player.level == _player.maxLevel)
strcpy(line, "Level : MAX");
- drawString(_videobuffer, line, sx, sy + 8, 0);
+ drawString(_videoBuffer, line, sx, sy + 8, 0);
// experience
- game_fillrect(_videobuffer, sx + 64, sy + 16, 16, 4, RGB(0, 32, 32));
- game_fillrect(_videobuffer, sx + 65, sy + 17,
+ game_fillrect(_videoBuffer, sx + 64, sy + 16, 16, 4, RGB(0, 32, 32));
+ game_fillrect(_videoBuffer, sx + 65, sy + 17,
hud_recalc(_player.exp, 14, _player.nextLevel), 2, RGB(0, 224, 64));
// attack strength
- game_fillrect(_videobuffer, sx + 1, sy + 16, 56, 6, RGB(0, 32, 32));
- game_fillrect(_videobuffer, sx + 1, sy + 17,
+ game_fillrect(_videoBuffer, sx + 1, sy + 16, 56, 6, RGB(0, 32, 32));
+ game_fillrect(_videoBuffer, sx + 1, sy + 17,
hud_recalc(_player.attackStrength, 54, 100), 2,
ABS(_player.attackStrength - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 64, 224));
// spell strength
- game_fillrect(_videobuffer, sx + 1, sy + 19,
+ game_fillrect(_videoBuffer, sx + 1, sy + 19,
hud_recalc(_player.spellStrength, 54, 100), 2,
ABS(_player.spellStrength - 100) < kEpsilon ? RGB(224, 0, 0) : RGB(128, 0, 224));
// time
- int ase = _secstart + _secsingame;
+ int ase = _secStart + _secsingame;
int h = ((ase - (ase % 3600)) / 3600);
- ase = (ase - h * 3600);
+ ase -= h * 3600;
int m = ((ase - (ase % 60)) / 60);
int s = (ase - m * 60);
sprintf(line, "%02i:%02i:%02i", h, m, s);
- drawString(_videobuffer, line, 46 + 38 - strlen(line) * 4, 46 + 49, 0);
+ drawString(_videoBuffer, line, 46 + 38 - strlen(line) * 4, 46 + 49, 0);
- drawString(_videobuffer, "Use", 193, 55, 0);
- drawString(_videobuffer, "Cast", 236, 55, 0);
+ drawString(_videoBuffer, "Use", 193, 55, 0);
+ drawString(_videoBuffer, "Cast", 236, 55, 0);
rcSrc.left = 128;
rcSrc.top = 91;
@@ -355,19 +355,19 @@ void GriffonEngine::drawHud() {
int ss = (_player.sword - 1) * 3;
if (_player.sword == 3)
ss = 18;
- _itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _itemImg[ss]->blit(*_videoBuffer, rcSrc.left, rcSrc.top);
rcSrc.left = rcSrc.left + 16;
ss = (_player.shield - 1) * 3 + 1;
if (_player.shield == 3)
ss = 19;
- _itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _itemImg[ss]->blit(*_videoBuffer, rcSrc.left, rcSrc.top);
rcSrc.left = rcSrc.left + 16;
ss = (_player.armour - 1) * 3 + 2;
if (_player.armour == 3)
ss = 20;
- _itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _itemImg[ss]->blit(*_videoBuffer, rcSrc.left, rcSrc.top);
for (int i = 0; i <= 4; i++) {
sx = 188;
@@ -375,18 +375,18 @@ void GriffonEngine::drawHud() {
rcSrc.left = sx;
rcSrc.top = sy;
if (i == 0)
- _itemimg[6]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _itemImg[6]->blit(*_videoBuffer, rcSrc.left, rcSrc.top);
if (i == 1)
- _itemimg[12]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _itemImg[12]->blit(*_videoBuffer, rcSrc.left, rcSrc.top);
if (i == 2)
- _itemimg[17]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _itemImg[17]->blit(*_videoBuffer, rcSrc.left, rcSrc.top);
if (i == 3)
- _itemimg[16]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _itemImg[16]->blit(*_videoBuffer, rcSrc.left, rcSrc.top);
if (i == 4)
- _itemimg[14]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _itemImg[14]->blit(*_videoBuffer, rcSrc.left, rcSrc.top);
sprintf(line, "x%i", _player.inventory[i]);
- drawString(_videobuffer, line, sx + 17, sy + 7, 0);
+ drawString(_videoBuffer, line, sx + 17, sy + 7, 0);
}
// spells in menu
@@ -397,10 +397,10 @@ void GriffonEngine::drawHud() {
sy = rcSrc.top;
if (_player.foundSpell[i]) {
- _itemimg[7 + i]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
+ _itemImg[7 + i]->blit(*_videoBuffer, rcSrc.left, rcSrc.top);
- game_fillrect(_videobuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32));
- game_fillrect(_videobuffer, rcSrc.left + 1, sy + 17,
+ game_fillrect(_videoBuffer, rcSrc.left, sy + 16, 16, 4, RGB(0, 32, 32));
+ game_fillrect(_videoBuffer, rcSrc.left + 1, sy + 17,
hud_recalc(_player.spellCharge[i], 14, 100), 2,
ABS(_player.spellCharge[i] - 100) < kEpsilon ? RGB(255, 128, 32) : RGB(0, 224, 64));
}
@@ -409,43 +409,43 @@ void GriffonEngine::drawHud() {
if (_itemSelOn) {
for (int i = 0; i <= 4; i++) {
- if (_curitem == 5 + i) {
+ if (_curItem == 5 + i) {
rcDest.left = (float)(243 - 12 + 3 * sin(3.141592 * 2 * _itemyloc / 16));
rcDest.top = 67 + 24 * i;
- _itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
+ _itemImg[15]->blit(*_videoBuffer, rcDest.left, rcDest.top);
}
- if (_curitem == i) {
+ if (_curItem == i) {
rcDest.left = (float)(189 - 12 + 3 * sin(3.141592 * 2 * _itemyloc / 16));
rcDest.top = 70 + 24 * i;
- _itemimg[15]->blit(*_videobuffer, rcDest.left, rcDest.top);
+ _itemImg[15]->blit(*_videoBuffer, rcDest.left, rcDest.top);
}
}
}
}
if (_selEnemyOn) {
- if (_curenemy > _lastnpc) {
- int pst = _curenemy - _lastnpc - 1;
- rcDest.left = postinfo[pst][0];
- rcDest.top = (float)(postinfo[pst][1] - 4 - sin(3.141592 / 8 * _itemyloc));
+ if (_curEnemy > _lastnpc) {
+ int pst = _curEnemy - _lastnpc - 1;
+ rcDest.left = _postInfo[pst][0];
+ rcDest.top = (float)(_postInfo[pst][1] - 4 - sin(3.141592 / 8 * _itemyloc));
} else {
- rcDest.left = _npcinfo[_curenemy].x + 4;
- rcDest.top = (float)(_npcinfo[_curenemy].y + 4 - 16 - sin(3.141592 / 8 * _itemyloc));
+ rcDest.left = _npcinfo[_curEnemy].x + 4;
+ rcDest.top = (float)(_npcinfo[_curEnemy].y + 4 - 16 - sin(3.141592 / 8 * _itemyloc));
}
- _itemimg[13]->blit(*_videobuffer, rcDest.left, rcDest.top);
+ _itemImg[13]->blit(*_videoBuffer, rcDest.left, rcDest.top);
}
}
void GriffonEngine::drawNPCs(int mode) {
- unsigned int ccc = _videobuffer->format.RGBToColor(255, 128, 32);
+ unsigned int ccc = _videoBuffer->format.RGBToColor(255, 128, 32);
int fst = _firsty;
int lst = _lasty;
if (mode == 0)
lst = _player.ysort;
- if (mode == 1)
+ else if (mode == 1)
fst = _player.ysort;
for (int yy = fst; yy <= lst; yy++) {
@@ -484,7 +484,7 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.top += (int)(RND() * 3) - 1;
}
- _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[sprite]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
int cframe = _npcinfo[i].cattackframe;
@@ -498,7 +498,7 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.setWidth(24);
rcDest.setHeight(24);
- _animsa[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _animsAttack[sprite]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -515,7 +515,7 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.left = _npcinfo[i].bodysection[f].x - _animset2[s].xofs;
rcDest.top = _npcinfo[i].bodysection[f].y - _animset2[s].yofs + 2;
- _anims[2]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[2]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -525,7 +525,7 @@ void GriffonEngine::drawNPCs(int mode) {
for (int f = 0; f < 7; f++) {
int yp = 0;
- if (f == 0 && (_curmap == 53 || _curmap == 57 || _curmap == 61 || _curmap == 65 || _curmap == 56 || _curmap > 66) && _scriptflag[kScriptLever][0] > 0)
+ if (f == 0 && (_curMap == 53 || _curMap == 57 || _curMap == 61 || _curMap == 65 || _curMap == 56 || _curMap > 66) && _scriptFlag[kScriptLever][0] > 0)
yp = 16;
int s = _npcinfo[i].bodysection[f].sprite;
rcSrc.left = _animset9[s].x;
@@ -536,7 +536,7 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.left = _npcinfo[i].bodysection[f].x - _animset9[s].xofs;
rcDest.top = _npcinfo[i].bodysection[f].y - _animset9[s].yofs + 2;
- _anims[9]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[9]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -558,7 +558,7 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.left = npx - 2;
rcDest.top = npy - 24;
- _anims[3]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[3]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
@@ -577,7 +577,7 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.left = npx - 2;
rcDest.top = npy - 24;
- _anims[4]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[4]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
@@ -596,9 +596,9 @@ void GriffonEngine::drawNPCs(int mode) {
int x = 192 + ((int)(_itemyloc + ff * 5) % 3) * 64;
if (x > 255)
x = 255;
- _spellimg->setAlpha(x, true);
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- _spellimg->setAlpha(255, true);
+ _spellImg->setAlpha(x, true);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->setAlpha(255, true);
for (int f = 1; f <= 8; f++) {
rcSrc.left = 16 * (int)(RND() * 2);
@@ -612,9 +612,9 @@ void GriffonEngine::drawNPCs(int mode) {
x = 192 + f % 3 * 64;
if (x > 255)
x = 255;
- _spellimg->setAlpha(x, true);
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- _spellimg->setAlpha(255, true);
+ _spellImg->setAlpha(x, true);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->setAlpha(255, true);
}
rcSrc.left = 0;
@@ -625,9 +625,9 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.left = _npcinfo[i].bodysection[10 * ff + 9].x - 21;
rcDest.top = _npcinfo[i].bodysection[10 * ff + 9].y - 21;
- _spellimg->setAlpha(192, true);
- _anims[5]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- _spellimg->setAlpha(255, true);
+ _spellImg->setAlpha(192, true);
+ _anims[5]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->setAlpha(255, true);
}
}
@@ -654,7 +654,7 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
- _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[sprite]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
// wizard
@@ -677,7 +677,7 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
- _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[sprite]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
// } else {
//cframe = _npcinfo[i].cattackframe;
@@ -714,7 +714,7 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
- _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[sprite]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
@@ -754,7 +754,7 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
- _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[sprite]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
_npcinfo[i].floating = _npcinfo[i].floating + 0.25 * _fpsr;
while (_npcinfo[i].floating >= 16)
@@ -772,7 +772,7 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.setWidth(24);
rcDest.setHeight(24);
- _animsa[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _animsAttack[sprite]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -796,7 +796,7 @@ void GriffonEngine::drawNPCs(int mode) {
int sy = (float)(npy + 12 - 50 - 3 * sin(3.141592 * 2 * _npcinfo[i].floating / 16));
for (int fr = 0; fr <= 3; fr++) {
- _spellimg->setAlpha(128 + (int)(RND() * 96), true);
+ _spellImg->setAlpha(128 + (int)(RND() * 96), true);
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -806,7 +806,7 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.left = sx + 32 + (int)(RND() * 3) - 1;
rcDest.top = sy - (int)(RND() * 6);
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
for (int ii = 0; ii <= 8; ii++) {
@@ -823,9 +823,9 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.left = (float)(sx + 36 + ii * 8 - ii * cos(3.14159 * 2 * (fr3 - ii) / 16) * 2);
rcDest.top = (float)(sy + 16 + ii * sin(3.14159 * 2 * (fr3 - ii) / 16) * 3 - ii); // * 4
- _spellimg->setAlpha(i2 / 3 * 224, true);
+ _spellImg->setAlpha(i2 / 3 * 224, true);
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
int xloc = rcDest.left;
int yloc = rcDest.top;
@@ -849,9 +849,9 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.left = (float)(sx + 36 - ii * 8 + ii * cos(3.14159 * 2 * (fr3 - ii) / 16) * 2);
rcDest.top = (float)(sy + 16 + ii * sin(3.14159 * 2 * (fr3 - ii) / 16) * 3 - ii); // * 4
- _spellimg->setAlpha(i2 / 3 * 224, true);
+ _spellImg->setAlpha(i2 / 3 * 224, true);
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
xloc = rcDest.left;
yloc = rcDest.top;
@@ -872,7 +872,7 @@ void GriffonEngine::drawNPCs(int mode) {
}
}
- _spellimg->setAlpha(255, true);
+ _spellImg->setAlpha(255, true);
if (!_npcinfo[i].attacking) {
int cframe = (int)(frame);
@@ -890,7 +890,7 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.left = rcDest.top + (int)(RND() * 3) - 1;
}
- _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[sprite]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
int cframe = (int)(_npcinfo[i].cattackframe);
@@ -902,7 +902,7 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.left = sx;
rcDest.top = sy;
- _animsa[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _animsAttack[sprite]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
@@ -941,7 +941,7 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
- _anims[sprite]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[sprite]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
rcDest.left = npx + 4;
@@ -949,31 +949,28 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.setWidth(16);
rcDest.setHeight(4);
- _videobuffer->fillRect(rcDest, 0);
+ _videoBuffer->fillRect(rcDest, 0);
rcDest.left = npx + 5;
rcDest.top = npy + 23;
int ww = 14 * _npcinfo[i].hp / _npcinfo[i].maxhp;
- if (ww > 14)
- ww = 14;
- if (ww < 1)
- ww = 1;
+ ww = CLIP(ww, 1, 14);
rcDest.setWidth(ww);
rcDest.setHeight(2);
- _videobuffer->fillRect(rcDest, ccc);
+ _videoBuffer->fillRect(rcDest, ccc);
bool pass = true;
if (_npcinfo[i].spriteset == kMonsterBoss1)
pass = false;
+
if (pass)
drawOver(npx, npy);
-
}
}
}
@@ -996,7 +993,6 @@ void GriffonEngine::drawOver(int modx, int mody) {
int sy2 = sy * 16;
if (sx > -1 && sx < 40 && sy > -1 && sy < 24) {
-
int curtile = _tileinfo[2][sx][sy][0];
int curtilel = _tileinfo[2][sx][sy][1];
@@ -1026,7 +1022,7 @@ void GriffonEngine::drawOver(int modx, int mody) {
}
if (pass)
- _tiles[curtilel]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _tiles[curtilel]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
}
}
@@ -1049,7 +1045,7 @@ void GriffonEngine::drawPlayer() {
rcDest.setWidth(24);
rcDest.setHeight(24);
- _anims[f]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _anims[f]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
rcSrc.left = (int)(_player.attackFrame / 4) * 24;
rcSrc.top = _player.walkDir * 24;
@@ -1061,20 +1057,19 @@ void GriffonEngine::drawPlayer() {
rcDest.setWidth(24);
rcDest.setHeight(24);
- _animsa[f]->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
-
+ _animsAttack[f]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
- long ccc = _videobuffer->format.RGBToColor(224, 224, 64);
+ long ccc = _videoBuffer->format.RGBToColor(224, 224, 64);
bool pass = false;
if (_player.hp <= _player.maxHp * 0.25)
pass = true;
if (pass) {
- ccc = _videobuffer->format.RGBToColor(255, 255, 255);
+ ccc = _videoBuffer->format.RGBToColor(255, 255, 255);
if ((int)(_player.hpflash) == 1)
- ccc = _videobuffer->format.RGBToColor(255, 0, 0);
+ ccc = _videoBuffer->format.RGBToColor(255, 0, 0);
}
int sss = 6;
@@ -1087,23 +1082,22 @@ void GriffonEngine::drawPlayer() {
rcDest.setWidth(16);
rcDest.setHeight(sss);
- _videobuffer->fillRect(rcDest, 0);
+ _videoBuffer->fillRect(rcDest, 0);
rcDest.left = npx + 5;
rcDest.top = npy + 23;
-
int ww = 14 * _player.hp / _player.maxHp;
ww = CLIP(ww, 1, 14);
rcDest.setWidth(ww);
rcDest.setHeight(2);
- _videobuffer->fillRect(rcDest, ccc);
+ _videoBuffer->fillRect(rcDest, ccc);
- ccc = _videobuffer->format.RGBToColor(0, 224, 64);
+ ccc = _videoBuffer->format.RGBToColor(0, 224, 64);
if (ABS(_player.attackStrength - 100) < kEpsilon)
- ccc = _videobuffer->format.RGBToColor(255, 128, 32);
+ ccc = _videoBuffer->format.RGBToColor(255, 128, 32);
ww = 14 * _player.attackStrength / 100;
if (ww > 14)
@@ -1117,35 +1111,35 @@ void GriffonEngine::drawPlayer() {
rcDest.setWidth(ww);
rcDest.setHeight(2);
- _videobuffer->fillRect(rcDest, ccc);
+ _videoBuffer->fillRect(rcDest, ccc);
- ccc = _videobuffer->format.RGBToColor(128, 0, 224);
+ ccc = _videoBuffer->format.RGBToColor(128, 0, 224);
if (ABS(_player.spellStrength - 100) < kEpsilon)
- ccc = _videobuffer->format.RGBToColor(224, 0, 0);
+ ccc = _videoBuffer->format.RGBToColor(224, 0, 0);
rcDest.top = rcDest.top + 2;
rcDest.setWidth(ww2);
rcDest.setHeight(2);
- _videobuffer->fillRect(rcDest, ccc);
+ _videoBuffer->fillRect(rcDest, ccc);
}
void GriffonEngine::drawView() {
- _videobuffer->copyRectToSurface(_mapbg->getPixels(), _mapbg->pitch, 0, 0, _mapbg->w, _mapbg->h);
+ _videoBuffer->copyRectToSurface(_mapBg->getPixels(), _mapBg->pitch, 0, 0, _mapBg->w, _mapBg->h);
updateSpellsUnder();
drawAnims(0);
// ------dontdrawover = special case to make boss work right in room 24
- if (dontdrawover == 1)
+ if (_dontDrawOver)
drawAnims(1);
drawNPCs(0);
drawPlayer();
drawNPCs(1);
- if (dontdrawover == 0)
+ if (!_dontDrawOver)
drawAnims(1);
drawOver((int)_player.px, (int)_player.py);
@@ -1159,12 +1153,12 @@ void GriffonEngine::drawView() {
rc.setWidth(320);
rc.setHeight(240);
- cloudimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, &rc);
+ cloudimg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rc);
}
drawHud();
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
}
void GriffonEngine::swash() {
@@ -1172,24 +1166,24 @@ void GriffonEngine::swash() {
do {
y += 1 * _fpsr;
- _videobuffer->setAlpha((int)y);
- _videobuffer->fillRect(Common::Rect(0, 0, _videobuffer->w, _videobuffer->h), 0);
+ _videoBuffer->setAlpha((int)y);
+ _videoBuffer->fillRect(Common::Rect(0, 0, _videoBuffer->w, _videoBuffer->h), 0);
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
- _tickspassed = _ticks;
+ _ticksPassed = _ticks;
_ticks = g_system->getMillis();
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24.0;
+ _ticksPassed = _ticks - _ticksPassed;
+ _fpsr = (float)_ticksPassed / 24.0;
_fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
+ if (_ticks > _nextTicks) {
+ _nextTicks = _ticks + 1000;
_fps = _fp;
_fp = 0;
}
@@ -1206,8 +1200,8 @@ void GriffonEngine::swash() {
do {
y = y + 1 * _fpsr;
- _videobuffer->setAlpha((int)(y * 25));
- _mapbg->blit(*_videobuffer);
+ _videoBuffer->setAlpha((int)(y * 25));
+ _mapBg->blit(*_videoBuffer);
if (_cloudsOn) {
rcDest.left = (float)(256 + 256 * cos(3.141592 / 180 * clouddeg));
@@ -1215,38 +1209,38 @@ void GriffonEngine::swash() {
rcDest.setWidth(320);
rcDest.setHeight(240);
- cloudimg->blit(*_videobuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
+ cloudimg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
}
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
- _tickspassed = _ticks;
+ _ticksPassed = _ticks;
_ticks = g_system->getMillis();
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24.0;
+ _ticksPassed = _ticks - _ticksPassed;
+ _fpsr = (float)_ticksPassed / 24.0;
_fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
+ if (_ticks > _nextTicks) {
+ _nextTicks = _ticks + 1000;
_fps = _fp;
_fp = 0;
}
clouddeg += 0.01 * _fpsr;
while (clouddeg >= 360)
- clouddeg = clouddeg - 360;
+ clouddeg -= 360;
if (y > 10)
break;
} while (1);
- _videobuffer->setAlpha(255);
+ _videoBuffer->setAlpha(255);
}
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index a323feb..9feca28 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -57,7 +57,7 @@ void GriffonEngine::mainLoop() {
}
do {
- if (!_forcepause) {
+ if (!_forcePause) {
updateAnims();
updateNPCs();
}
@@ -65,7 +65,7 @@ void GriffonEngine::mainLoop() {
checkTrigger();
checkInputs();
- if (!_forcepause)
+ if (!_forcePause)
handleWalking();
updateY();
@@ -83,15 +83,15 @@ void GriffonEngine::updateEngine() {
g_system->updateScreen();
g_system->getEventManager()->pollEvent(_event);
- _tickspassed = _ticks;
+ _ticksPassed = _ticks;
_ticks = g_system->getMillis();
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24.0;
+ _ticksPassed = _ticks - _ticksPassed;
+ _fpsr = (float)_ticksPassed / 24.0;
_fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
+ if (_ticks > _nextTicks) {
+ _nextTicks = _ticks + 1000;
_fps = _fp;
_fp = 0;
_secsingame = _secsingame + 1;
@@ -119,7 +119,7 @@ void GriffonEngine::updateEngine() {
int sx = (int)(_player.px / 2 + 6);
int sy = (int)(_player.py / 2 + 10);
- uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ uint32 *temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
uint32 bgc = *temp;
if (bgc > 0) {
_player.px = opx;
@@ -174,7 +174,7 @@ void GriffonEngine::updateEngine() {
}
}
- _clipbg->copyRectToSurface(_clipbg2->getPixels(), _clipbg2->pitch, 0, 0, _clipbg2->w, _clipbg2->h);
+ _clipBg->copyRectToSurface(_clipBg2->getPixels(), _clipBg2->pitch, 0, 0, _clipBg2->w, _clipBg2->h);
Common::Rect rc;
@@ -183,9 +183,9 @@ void GriffonEngine::updateEngine() {
rc.setWidth(5);
rc.setHeight(5);
- _clipbg->fillRect(rc, 1000);
+ _clipBg->fillRect(rc, 1000);
- if (!_forcepause) {
+ if (!_forcePause) {
for (int i = 0; i < 5; i++) {
if (_player.foundSpell[i])
_player.spellCharge[i] += 1 * _player.level * 0.01 * _fpsr;
@@ -213,11 +213,11 @@ void GriffonEngine::updateEngine() {
if (_player.hp <= 0)
theEnd();
- if (_roomlock) {
- _roomlock = false;
+ if (_roomLock) {
+ _roomLock = false;
for (int i = 1; i <= _lastnpc; i++)
if (_npcinfo[i].hp > 0)
- _roomlock = true;
+ _roomLock = true;
}
clouddeg += 0.1 * _fpsr;
@@ -282,7 +282,7 @@ void GriffonEngine::newGame() {
_player.exp = 0;
_player.nextLevel = 0;
- memset(_scriptflag, 0, sizeof(_scriptflag));
+ memset(_scriptFlag, 0, sizeof(_scriptFlag));
memset(_objmapf, 0, sizeof(_objmapf));
memset(_roomLocks, 0, sizeof(_roomLocks));
@@ -295,7 +295,7 @@ void GriffonEngine::newGame() {
_roomLocks[82] = 2;
_player.walkSpeed = 1.1f;
- _animspd = 0.5f;
+ _animSpeed = 0.5f;
attacking = false;
_player.attackSpeed = 1.5f;
diff --git a/engines/griffon/gfx.cpp b/engines/griffon/gfx.cpp
index 31dfc6a..2ba73a0 100644
--- a/engines/griffon/gfx.cpp
+++ b/engines/griffon/gfx.cpp
@@ -66,8 +66,8 @@ void GriffonEngine::addFloatText(const char *stri, float xloc, float yloc, int c
}
void GriffonEngine::eventText(const char *stri) {
- _videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
- _videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
+ _videoBuffer2->fillRect(Common::Rect(0, 0, _videoBuffer2->w, _videoBuffer2->h), 0);
+ _videoBuffer3->fillRect(Common::Rect(0, 0, _videoBuffer3->w, _videoBuffer3->h), 0);
int x = 160 - 4 * strlen(stri);
@@ -75,15 +75,15 @@ void GriffonEngine::eventText(const char *stri) {
int pause_ticks = _ticks + 500;
int b_ticks = _ticks;
- _videobuffer->blit(*_videobuffer3);
- _videobuffer->blit(*_videobuffer2);
+ _videoBuffer->blit(*_videoBuffer3);
+ _videoBuffer->blit(*_videoBuffer2);
do {
g_system->getEventManager()->pollEvent(_event);
if (_event.type == Common::EVENT_KEYDOWN && pause_ticks < _ticks)
break;
- _videobuffer2->blit(*_videobuffer);
+ _videoBuffer2->blit(*_videoBuffer);
int fr = 192;
@@ -92,27 +92,27 @@ void GriffonEngine::eventText(const char *stri) {
if (fr > 192)
fr = 192;
- _windowimg->setAlpha(fr, true);
+ _windowImg->setAlpha(fr, true);
- _windowimg->blit(*_videobuffer);
+ _windowImg->blit(*_videoBuffer);
if (pause_ticks < _ticks)
- drawString(_videobuffer, stri, x, 15, 0);
+ drawString(_videoBuffer, stri, x, 15, 0);
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(_event);
g_system->delayMillis(10);
- _tickspassed = _ticks;
+ _ticksPassed = _ticks;
_ticks = g_system->getMillis();
- _tickspassed = _ticks - _tickspassed;
- _fpsr = (float)_tickspassed / 24.0;
+ _ticksPassed = _ticks - _ticksPassed;
+ _fpsr = (float)_ticksPassed / 24.0;
_fp++;
- if (_ticks > _nextticks) {
- _nextticks = _ticks + 1000;
+ if (_ticks > _nextTicks) {
+ _nextTicks = _ticks + 1000;
_fps = _fp;
_fp = 0;
}
@@ -120,9 +120,9 @@ void GriffonEngine::eventText(const char *stri) {
g_system->delayMillis(10);
} while (1);
- _videobuffer3->blit(*_videobuffer);
+ _videoBuffer3->blit(*_videoBuffer);
- _itemticks = _ticks + 210;
+ _itemTicks = _ticks + 210;
}
void GriffonEngine::drawLine(Graphics::TransparentSurface *buffer, int x1, int y1, int x2, int y2, int col) {
@@ -151,17 +151,17 @@ void GriffonEngine::drawString(Graphics::TransparentSurface *buffer, const char
rcDest.left = xloc + i * 8;
rcDest.top = yloc;
- _fontchr[stri[i] - 32][col]->blit(*buffer, rcDest.left, rcDest.top);
+ _fontChr[stri[i] - 32][col]->blit(*buffer, rcDest.left, rcDest.top);
}
}
void GriffonEngine::drawProgress(int w, int wm) {
- long ccc = _videobuffer->format.RGBToColor(0, 255, 0);
+ long ccc = _videoBuffer->format.RGBToColor(0, 255, 0);
rcDest.setWidth(w * 74 / wm);
- _videobuffer->fillRect(rcDest, ccc);
+ _videoBuffer->fillRect(rcDest, ccc);
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(_event);
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index a312830..34f3c3e 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -381,51 +381,51 @@ private:
void updateMusic();
private:
- Graphics::TransparentSurface *_video, *_videobuffer, *_videobuffer2, *_videobuffer3;
+ Graphics::TransparentSurface *_video, *_videoBuffer, *_videoBuffer2, *_videoBuffer3;
// system
- Graphics::TransparentSurface *_titleimg, *_titleimg2, *_inventoryimg;
- Graphics::TransparentSurface *_logosimg, *_theendimg;
+ Graphics::TransparentSurface *_titleImg, *_titleImg2, *_inventoryImg;
+ Graphics::TransparentSurface *_logosImg, *_theEndImg;
Common::Event _event;
- Graphics::TransparentSurface *_mapbg, *_clipbg, *_clipbg2;
- unsigned int _clipsurround[4][4];
+ Graphics::TransparentSurface *_mapBg, *_clipBg, *_clipBg2;
+ unsigned int _clipSurround[4][4];
- float _animspd; // CHECKME: it seems to always be 0.5
- int _rampdata[40][24];
+ float _animSpeed; // CHECKME: it seems to always be 0.5
+ int _rampData[40][24];
- int _curmap;
- Graphics::TransparentSurface *_fontchr[224][5]; // 256 - 32
- Graphics::TransparentSurface *_itemimg[21], *_windowimg;
- Graphics::TransparentSurface *_spellimg;
+ int _curMap;
+ Graphics::TransparentSurface *_fontChr[224][5]; // 256 - 32
+ Graphics::TransparentSurface *_itemImg[21], *_windowImg;
+ Graphics::TransparentSurface *_spellImg;
bool _itemSelOn;
- int _curitem, _itemticks;
+ int _curItem, _itemTicks;
float _itemyloc;
bool _selEnemyOn;
- int _curenemy;
- bool _forcepause;
- bool _roomlock; // set to disable any room jumps while in the room
- int _scriptflag[100][10], _saveslot; // script, flag
+ int _curEnemy;
+ bool _forcePause;
+ bool _roomLock; // set to disable any room jumps while in the room
+ int _scriptFlag[100][10], _saveSlot; // script, flag
// timer related - move to local later
- int _ticks, _tickspassed, _nextticks;
+ int _ticks, _ticksPassed, _nextTicks;
float _fp, _fps, _fpsr; // CHECKME: _fp and _fps seems to be integers
- int _secsingame, _secstart;
+ int _secsingame, _secStart;
- Graphics::TransparentSurface *mapimg[4];
+ Graphics::TransparentSurface *mapImg[4];
Common::Rect rcSrc, rcDest;
// -----------special case
- int dontdrawover; // used in map24 so that the candles don't draw over the boss, default set to 0
+ bool _dontDrawOver; // used in map24 so that the candles don't draw over the boss, default set to 0
// saveload info
- Graphics::TransparentSurface *saveloadimg;
+ Graphics::TransparentSurface *_saveLoadImg;
// post info
- float postinfo[21][3];
+ float _postInfo[21][3];
int nposts;
// cloud info
@@ -450,7 +450,7 @@ private:
// animation info
Graphics::TransparentSurface *_anims[100];
// id number 0&1 = players
- Graphics::TransparentSurface *_animsa[100];
+ Graphics::TransparentSurface *_animsAttack[100];
// attack anims
float _playerattackofs[4][16][3];
// [dir] [frame] [x,y ofs, completed(0/1)]
diff --git a/engines/griffon/input.cpp b/engines/griffon/input.cpp
index 7239838..a1dba70 100644
--- a/engines/griffon/input.cpp
+++ b/engines/griffon/input.cpp
@@ -50,22 +50,22 @@ void GriffonEngine::checkInputs() {
nposts = 0;
for (int i = 0; i <= 20; i++) {
- postinfo[i][0] = 0;
- postinfo[i][1] = 0;
+ _postInfo[i][0] = 0;
+ _postInfo[i][1] = 0;
}
for (int x = 0; x <= 19; x++) {
for (int y = 0; y <= 14; y++) {
int o = _objectMap[x][y];
if (_objectInfo[o][4] == 3) {
- postinfo[nposts][0] = x * 16;
- postinfo[nposts][1] = y * 16;
+ _postInfo[nposts][0] = x * 16;
+ _postInfo[nposts][1] = y * 16;
nposts = nposts + 1;
}
}
}
- if (attacking || (_forcepause && !_itemSelOn))
+ if (attacking || (_forcePause && !_itemSelOn))
return;
if (_event.type == Common::EVENT_QUIT) {
@@ -75,18 +75,18 @@ void GriffonEngine::checkInputs() {
if (_event.type == Common::EVENT_KEYDOWN) {
if (_event.kbd.keycode == Common::KEYCODE_ESCAPE) {
- if (_itemticks < _ticks)
+ if (_itemTicks < _ticks)
title(1);
} else if (_event.kbd.keycode == Common::KEYCODE_d && _event.kbd.hasFlags(Common::KBD_CTRL)) {
_console->attach();
_event.type = Common::EVENT_INVALID;
} else if (_event.kbd.hasFlags(Common::KBD_CTRL)) {
- if (!_itemSelOn && (_itemticks < _ticks))
+ if (!_itemSelOn && (_itemTicks < _ticks))
attack();
- if (_itemSelOn && _itemticks < _ticks) {
- if (_curitem == 0 && _player.inventory[kInvFlask] > 0) {
- _itemticks = _ticks + ntickdelay;
+ if (_itemSelOn && _itemTicks < _ticks) {
+ if (_curItem == 0 && _player.inventory[kInvFlask] > 0) {
+ _itemTicks = _ticks + ntickdelay;
int heal = 50;
int maxh = _player.maxHp - _player.hp;
@@ -108,11 +108,11 @@ void GriffonEngine::checkInputs() {
}
_itemSelOn = false;
- _forcepause = false;
+ _forcePause = false;
}
- if (_curitem == 1 && _player.inventory[kInvDoubleFlask] > 0) {
- _itemticks = _ticks + ntickdelay;
+ if (_curItem == 1 && _player.inventory[kInvDoubleFlask] > 0) {
+ _itemTicks = _ticks + ntickdelay;
int heal = 200;
int maxHeal = _player.maxHp - _player.hp;
@@ -134,86 +134,86 @@ void GriffonEngine::checkInputs() {
}
_itemSelOn = false;
- _forcepause = false;
+ _forcePause = false;
}
- if (_curitem == 2 && _player.inventory[kInvShock] > 0) {
- castSpell(8, _player.px, _player.py, _npcinfo[_curenemy].x, _npcinfo[_curenemy].y, 0);
+ if (_curItem == 2 && _player.inventory[kInvShock] > 0) {
+ castSpell(8, _player.px, _player.py, _npcinfo[_curEnemy].x, _npcinfo[_curEnemy].y, 0);
- _forcepause = true;
+ _forcePause = true;
_player.inventory[kInvShock]--;
- _itemticks = _ticks + ntickdelay;
+ _itemTicks = _ticks + ntickdelay;
_selEnemyOn = false;
_itemSelOn = false;
}
- if (_curitem == 3 && _player.inventory[kInvNormalKey] > 0 && _canUseKey && _lockType == 1) {
+ if (_curItem == 3 && _player.inventory[kInvNormalKey] > 0 && _canUseKey && _lockType == 1) {
_roomLocks[_roomToUnlock] = 0;
eventText("UnLocked!");
_player.inventory[kInvNormalKey]--;
- _itemticks = _ticks + ntickdelay;
+ _itemTicks = _ticks + ntickdelay;
_selEnemyOn = false;
_itemSelOn = false;
return;
}
- if (_curitem == 4 && _player.inventory[kInvMasterKey] > 0 && _canUseKey && _lockType == 2) {
+ if (_curItem == 4 && _player.inventory[kInvMasterKey] > 0 && _canUseKey && _lockType == 2) {
_roomLocks[_roomToUnlock] = 0;
eventText("UnLocked!");
_player.inventory[kInvMasterKey]--;
- _itemticks = _ticks + ntickdelay;
+ _itemTicks = _ticks + ntickdelay;
_selEnemyOn = false;
_itemSelOn = false;
return;
}
- if (_curitem == 5 && _player.spellCharge[0] == 100) {
- castSpell(5, _player.px, _player.py, _npcinfo[_curenemy].x, _npcinfo[_curenemy].y, 0);
+ if (_curItem == 5 && _player.spellCharge[0] == 100) {
+ castSpell(5, _player.px, _player.py, _npcinfo[_curEnemy].x, _npcinfo[_curEnemy].y, 0);
_player.spellCharge[0] = 0;
- _forcepause = true;
+ _forcePause = true;
- _itemticks = _ticks + ntickdelay;
+ _itemTicks = _ticks + ntickdelay;
_selEnemyOn = false;
_itemSelOn = false;
}
- if (_curitem > 5 && _selEnemyOn) {
- if (_curenemy <= _lastnpc) {
- castSpell(_curitem - 6, _player.px, _player.py, _npcinfo[_curenemy].x, _npcinfo[_curenemy].y, 0);
+ if (_curItem > 5 && _selEnemyOn) {
+ if (_curEnemy <= _lastnpc) {
+ castSpell(_curItem - 6, _player.px, _player.py, _npcinfo[_curEnemy].x, _npcinfo[_curEnemy].y, 0);
} else {
- int pst = _curenemy - _lastnpc - 1;
- castSpell(_curitem - 6, _player.px, _player.py, postinfo[pst][0], postinfo[pst][1], 0);
+ int pst = _curEnemy - _lastnpc - 1;
+ castSpell(_curItem - 6, _player.px, _player.py, _postInfo[pst][0], _postInfo[pst][1], 0);
}
- _player.spellCharge[_curitem - 5] = 0;
+ _player.spellCharge[_curItem - 5] = 0;
_player.spellStrength = 0;
- _itemticks = _ticks + ntickdelay;
+ _itemTicks = _ticks + ntickdelay;
_selEnemyOn = false;
_itemSelOn = false;
- _forcepause = false;
+ _forcePause = false;
}
- if (_curitem > 5 && !_selEnemyOn && _itemSelOn) {
- if (ABS(_player.spellCharge[_curitem - 5] - 100) < kEpsilon) {
- _itemticks = _ticks + ntickdelay;
+ if (_curItem > 5 && !_selEnemyOn && _itemSelOn) {
+ if (ABS(_player.spellCharge[_curItem - 5] - 100) < kEpsilon) {
+ _itemTicks = _ticks + ntickdelay;
_selEnemyOn = true;
int i = 0;
do {
if (_npcinfo[i].hp > 0) {
- _curenemy = i;
+ _curEnemy = i;
goto __exit_do;
}
i = i + 1;
@@ -226,23 +226,23 @@ __exit_do:
if (nposts > 0 && !_selEnemyOn) {
_selEnemyOn = true;
- _curenemy = _lastnpc + 1;
+ _curEnemy = _lastnpc + 1;
}
}
}
}
} else if (_event.kbd.hasFlags(Common::KBD_ALT)) {
- if (_itemticks < _ticks) {
+ if (_itemTicks < _ticks) {
_selEnemyOn = false;
if (_itemSelOn) {
_itemSelOn = false;
- _itemticks = _ticks + 220;
- _forcepause = false;
+ _itemTicks = _ticks + 220;
+ _forcePause = false;
} else {
_itemSelOn = true;
- _itemticks = _ticks + 220;
- _forcepause = true;
+ _itemTicks = _ticks + 220;
+ _forcePause = true;
_player.itemselshade = 0;
}
}
@@ -269,75 +269,75 @@ __exit_do:
movingright = false;
if (_selEnemyOn) {
- if (_itemticks < _ticks) {
+ if (_itemTicks < _ticks) {
if (_event.kbd.keycode == Common::KEYCODE_LEFT) {
- int origin = _curenemy;
+ int origin = _curEnemy;
do {
- _curenemy = _curenemy - 1;
- if (_curenemy < 1)
- _curenemy = _lastnpc + nposts;
- if (_curenemy == origin)
+ _curEnemy = _curEnemy - 1;
+ if (_curEnemy < 1)
+ _curEnemy = _lastnpc + nposts;
+ if (_curEnemy == origin)
break;
- if (_curenemy <= _lastnpc && _npcinfo[_curenemy].hp > 0)
+ if (_curEnemy <= _lastnpc && _npcinfo[_curEnemy].hp > 0)
break;
- if (_curenemy > _lastnpc)
+ if (_curEnemy > _lastnpc)
break;
} while (1);
- _itemticks = _ticks + ntickdelay;
+ _itemTicks = _ticks + ntickdelay;
}
if (_event.kbd.keycode == Common::KEYCODE_RIGHT) {
- int origin = _curenemy;
+ int origin = _curEnemy;
do {
- _curenemy = _curenemy + 1;
- if (_curenemy > _lastnpc + nposts)
- _curenemy = 1;
- if (_curenemy == origin)
+ _curEnemy = _curEnemy + 1;
+ if (_curEnemy > _lastnpc + nposts)
+ _curEnemy = 1;
+ if (_curEnemy == origin)
break;
- if (_curenemy <= _lastnpc && _npcinfo[_curenemy].hp > 0)
+ if (_curEnemy <= _lastnpc && _npcinfo[_curEnemy].hp > 0)
break;
- if (_curenemy > _lastnpc)
+ if (_curEnemy > _lastnpc)
break;
} while (1);
- _itemticks = _ticks + ntickdelay;
+ _itemTicks = _ticks + ntickdelay;
}
- if (_curenemy > _lastnpc + nposts)
- _curenemy = 1;
- if (_curenemy < 1)
- _curenemy = _lastnpc + nposts;
+ if (_curEnemy > _lastnpc + nposts)
+ _curEnemy = 1;
+ if (_curEnemy < 1)
+ _curEnemy = _lastnpc + nposts;
}
} else {
- if (_itemticks < _ticks) {
+ if (_itemTicks < _ticks) {
if (_event.kbd.keycode == Common::KEYCODE_UP) {
- _curitem = _curitem - 1;
- _itemticks = _ticks + ntickdelay;
- if (_curitem == 4)
- _curitem = 9;
- if (_curitem == -1)
- _curitem = 4;
+ _curItem = _curItem - 1;
+ _itemTicks = _ticks + ntickdelay;
+ if (_curItem == 4)
+ _curItem = 9;
+ if (_curItem == -1)
+ _curItem = 4;
}
if (_event.kbd.keycode == Common::KEYCODE_DOWN) {
- _curitem = _curitem + 1;
- _itemticks = _ticks + ntickdelay;
- if (_curitem == 5)
- _curitem = 0;
- if (_curitem == 10)
- _curitem = 5;
+ _curItem = _curItem + 1;
+ _itemTicks = _ticks + ntickdelay;
+ if (_curItem == 5)
+ _curItem = 0;
+ if (_curItem == 10)
+ _curItem = 5;
}
if (_event.kbd.keycode == Common::KEYCODE_LEFT) {
- _curitem = _curitem - 5;
- _itemticks = _ticks + ntickdelay;
+ _curItem = _curItem - 5;
+ _itemTicks = _ticks + ntickdelay;
}
if (_event.kbd.keycode == Common::KEYCODE_RIGHT) {
- _curitem = _curitem + 5;
- _itemticks = _ticks + ntickdelay;
+ _curItem = _curItem + 5;
+ _itemTicks = _ticks + ntickdelay;
}
- if (_curitem > 9)
- _curitem = _curitem - 10;
- if (_curitem < 0)
- _curitem = _curitem + 10;
+ if (_curItem > 9)
+ _curItem = _curItem - 10;
+ if (_curItem < 0)
+ _curItem = _curItem + 10;
}
}
}
@@ -362,7 +362,7 @@ void GriffonEngine::handleWalking() {
int lx = (int)npx / 16;
int ly = (int)npy / 16;
- int ramp = _rampdata[lx][ly];
+ int ramp = _rampData[lx][ly];
if (ramp == 1 && movingup)
spd *= 2;
if (ramp == 1 && movingdown)
@@ -385,10 +385,10 @@ void GriffonEngine::handleWalking() {
int sx = nx + x;
int sy = ny + y;
- _clipsurround[x + 1][y + 1] = 0;
+ _clipSurround[x + 1][y + 1] = 0;
if (sx > -1 && sx < 320 && sy > -1 && sy < 192) {
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
- _clipsurround[x + 1][y + 1] = *temp;
+ temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
+ _clipSurround[x + 1][y + 1] = *temp;
}
}
}
@@ -402,66 +402,66 @@ void GriffonEngine::handleWalking() {
if (movingright)
_player.walkDir = 3;
- if (movingup && _clipsurround[1][0] == 0) {
+ if (movingup && _clipSurround[1][0] == 0) {
py -= spd;
_player.walkDir = 0;
- } else if (movingup && _clipsurround[1][0] > 0) {
+ } else if (movingup && _clipSurround[1][0] > 0) {
// move upleft
- if (!movingright && _clipsurround[0][0] == 0) {
+ if (!movingright && _clipSurround[0][0] == 0) {
py -= spd;
px -= spd;
}
// move upright
- if (!movingleft && _clipsurround[2][0] == 0) {
+ if (!movingleft && _clipSurround[2][0] == 0) {
py -= spd;
px += spd;
}
}
- if (movingdown && _clipsurround[1][2] == 0) {
+ if (movingdown && _clipSurround[1][2] == 0) {
py += spd;
_player.walkDir = 1;
- } else if (movingdown && _clipsurround[1][2] > 0) {
+ } else if (movingdown && _clipSurround[1][2] > 0) {
// move downleft
- if (movingright == 0 && _clipsurround[0][2] == 0) {
+ if (movingright == 0 && _clipSurround[0][2] == 0) {
py += spd;
px -= spd;
}
// move downright
- if (movingleft == 0 && _clipsurround[2][2] == 0) {
+ if (movingleft == 0 && _clipSurround[2][2] == 0) {
py += spd;
px += spd;
}
}
- if (movingleft && _clipsurround[0][1] == 0) {
+ if (movingleft && _clipSurround[0][1] == 0) {
px -= spd;
_player.walkDir = 2;
- } else if (movingleft && _clipsurround[0][1] > 0) {
+ } else if (movingleft && _clipSurround[0][1] > 0) {
// move leftup
- if (!movingdown && _clipsurround[0][0] == 0) {
+ if (!movingdown && _clipSurround[0][0] == 0) {
py -= spd;
px -= spd;
}
// move leftdown
- if (!movingup && _clipsurround[0][2] == 0) {
+ if (!movingup && _clipSurround[0][2] == 0) {
py += spd;
px -= spd;
}
}
- if (movingright && _clipsurround[2][1] == 0) {
+ if (movingright && _clipSurround[2][1] == 0) {
px += spd;
_player.walkDir = 3;
- } else if (movingright && _clipsurround[2][1] > 0) {
+ } else if (movingright && _clipSurround[2][1] > 0) {
// move rightup
- if (!movingdown && _clipsurround[2][0] == 0) {
+ if (!movingdown && _clipSurround[2][0] == 0) {
px += spd;
py -= spd;
}
// move rightdown
- if (!movingup && _clipsurround[2][2] == 0) {
+ if (!movingup && _clipSurround[2][2] == 0) {
py += spd;
px += spd;
}
@@ -480,7 +480,7 @@ void GriffonEngine::handleWalking() {
int sx = (px / 2 + 6);
int sy = (py / 2 + 10);
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
bgc = *temp;
if (bgc > 0 && bgc != 1000) {
px = opx;
@@ -520,7 +520,7 @@ void GriffonEngine::handleWalking() {
sx = (int)(npx / 2 + 6);
sy = (int)(npy / 2 + 10);
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
bgc = *temp;
if (bgc > 0) {
@@ -537,7 +537,7 @@ void GriffonEngine::handleWalking() {
_player.py = py;
if (_player.px != _player.opx || _player.py != _player.opy)
- _player.walkFrame += _animspd * _fpsr;
+ _player.walkFrame += _animSpeed * _fpsr;
if (_player.walkFrame >= 16)
_player.walkFrame -= 16;
@@ -552,7 +552,7 @@ void GriffonEngine::handleWalking() {
_player.inventory[kInvFlask]++;
addFloatIcon(6, lx * 16, ly * 16);
- _objmapf[_curmap][lx][ly] = 1;
+ _objmapf[_curMap][lx][ly] = 1;
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
@@ -566,7 +566,7 @@ void GriffonEngine::handleWalking() {
_player.inventory[kInvDoubleFlask]++;
addFloatIcon(12, lx * 16, ly * 16);
- _objmapf[_curmap][lx][ly] = 1;
+ _objmapf[_curMap][lx][ly] = 1;
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
@@ -574,15 +574,15 @@ void GriffonEngine::handleWalking() {
}
}
- if (_objectInfo[o][5] == 9 && _player.inventory[kInvShock] < 9 && (_curmap == 41 && _scriptflag[kScriptLightningBomb][1] == 0)) {
+ if (_objectInfo[o][5] == 9 && _player.inventory[kInvShock] < 9 && (_curMap == 41 && _scriptFlag[kScriptLightningBomb][1] == 0)) {
_objectMap[lx][ly] = -1;
_player.inventory[kInvShock]++;
addFloatIcon(17, lx * 16, ly * 16);
- _objmapf[_curmap][lx][ly] = 1;
- if (_curmap == 41)
- _scriptflag[kScriptLightningBomb][1] = 1;
+ _objmapf[_curMap][lx][ly] = 1;
+ if (_curMap == 41)
+ _scriptFlag[kScriptLightningBomb][1] = 1;
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
@@ -597,7 +597,7 @@ void GriffonEngine::handleWalking() {
_player.inventory[kInvShock]++;
addFloatIcon(17, lx * 16, ly * 16);
- _objmapf[_curmap][lx][ly] = 1;
+ _objmapf[_curMap][lx][ly] = 1;
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
@@ -624,7 +624,7 @@ void GriffonEngine::checkTrigger() {
void GriffonEngine::processTrigger(int trignum) {
int trigtype = _triggers[trignum][0];
- if (_roomlock)
+ if (_roomLock)
return;
// map jump------------------------------
diff --git a/engines/griffon/logic.cpp b/engines/griffon/logic.cpp
index 3225930..01ee9f0 100644
--- a/engines/griffon/logic.cpp
+++ b/engines/griffon/logic.cpp
@@ -307,7 +307,7 @@ void GriffonEngine::updateNPCs() {
if (moveup) {
int sx = xp;
int sy = yp - ii;
- uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ uint32 *temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
uint32 dq = *temp;
if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
@@ -317,7 +317,7 @@ void GriffonEngine::updateNPCs() {
if (dq > 0) {
sx = xp - ii;
sy = yp - ii;
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
dq = *temp;
if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
@@ -329,7 +329,7 @@ void GriffonEngine::updateNPCs() {
if (dq > 0) {
sx = xp + ii;
sy = yp - ii;
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
dq = *temp;
if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
@@ -343,7 +343,7 @@ void GriffonEngine::updateNPCs() {
if (movedown) {
int sx = xp;
int sy = yp + ii;
- uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ uint32 *temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
uint32 dq = *temp;
if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
@@ -352,7 +352,7 @@ void GriffonEngine::updateNPCs() {
if (dq > 0) {
sx = xp - ii;
sy = yp + ii;
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
dq = *temp;
if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
@@ -364,7 +364,7 @@ void GriffonEngine::updateNPCs() {
if (dq > 0) {
sx = xp + ii;
sy = yp + ii;
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
dq = *temp;
if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
@@ -378,7 +378,7 @@ void GriffonEngine::updateNPCs() {
if (moveleft) {
int sx = xp - ii;
int sy = yp;
- uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ uint32 *temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
uint32 dq = *temp;
if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
@@ -387,7 +387,7 @@ void GriffonEngine::updateNPCs() {
if (dq > 0) {
sx = xp - ii;
sy = yp - ii;
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
dq = *temp;
if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
@@ -399,7 +399,7 @@ void GriffonEngine::updateNPCs() {
if (dq > 0) {
sx = xp - ii;
sy = yp + ii;
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
dq = *temp;
if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
@@ -413,7 +413,7 @@ void GriffonEngine::updateNPCs() {
if (moveright) {
int sx = xp + ii;
int sy = yp;
- uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ uint32 *temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
uint32 dq = *temp;
if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
@@ -422,7 +422,7 @@ void GriffonEngine::updateNPCs() {
if (dq > 0) {
sx = xp + ii;
sy = yp - ii;
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
dq = *temp;
if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
@@ -434,7 +434,7 @@ void GriffonEngine::updateNPCs() {
if (dq > 0) {
sx = xp + ii;
sy = yp + ii;
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
dq = *temp;
if (_npcinfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
@@ -475,7 +475,7 @@ void GriffonEngine::updateNPCs() {
int sx = xp;
int sy = yp;
- uint32 *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ uint32 *temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
uint32 bgc = *temp;
float anpx = npx + 12;
@@ -974,7 +974,7 @@ void GriffonEngine::updateNPCs() {
rcSrc.setHeight(3);
if (_npcinfo[i].pause < _ticks)
- _clipbg->fillRect(rcSrc, i);
+ _clipBg->fillRect(rcSrc, i);
pass = 0;
@@ -1245,7 +1245,7 @@ void GriffonEngine::updateSpells() {
int spellnum = spellinfo[i].spellnum;
// water
- if (spellnum == 0 && !_forcepause) {
+ if (spellnum == 0 && !_forcePause) {
float fr = (32 - spellinfo[i].frame);
int ll[4][2];
@@ -1307,9 +1307,9 @@ void GriffonEngine::updateSpells() {
}
if (xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
- _spellimg->setAlpha(alf, true);
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- _spellimg->setAlpha(255, true);
+ _spellImg->setAlpha(alf, true);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->setAlpha(255, true);
if (spellinfo[i].damagewho == 0) {
for (int e = 1; e <= _lastnpc; e++) {
@@ -1333,21 +1333,21 @@ void GriffonEngine::updateSpells() {
// check for post damage
if (nposts > 0) {
for (int e = 0; e <= nposts - 1; e++) {
- float xdif = (xloc + 16) - (postinfo[e][0] + 8);
- float ydif = (yloc + 16) - (postinfo[e][1] + 8);
+ float xdif = (xloc + 16) - (_postInfo[e][0] + 8);
+ float ydif = (yloc + 16) - (_postInfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+ _objmapf[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1;
+ _objectMap[(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = -1;
- rcSrc.left = postinfo[e][0] / 2;
- rcSrc.top = postinfo[e][1] / 2;
+ rcSrc.left = _postInfo[e][0] / 2;
+ rcSrc.top = _postInfo[e][1] / 2;
rcSrc.setWidth(8);
rcSrc.setHeight(8);
- _clipbg2->fillRect(rcSrc, 0);
+ _clipBg2->fillRect(rcSrc, 0);
- addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ addFloatIcon(99, _postInfo[e][0], _postInfo[e][1]);
if (config.effects) {
int snd = playSound(_sfx[kSndIce]);
@@ -1362,7 +1362,7 @@ void GriffonEngine::updateSpells() {
}
// metal
- if (spellnum == 1 && !_forcepause) {
+ if (spellnum == 1 && !_forcePause) {
int fr = (int)((32 - spellinfo[i].frame) * 4) % 3;
rcSrc.left = fr * 48;
@@ -1384,7 +1384,7 @@ void GriffonEngine::updateSpells() {
rcDest.left = xloc;
rcDest.top = yloc;
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
spellinfo[i].frame = spellinfo[i].frame - 0.2 * _fpsr;
if (spellinfo[i].frame < 0)
@@ -1452,21 +1452,21 @@ void GriffonEngine::updateSpells() {
// check for(int post damage
if (nposts > 0) {
for (int e = 0; e <= nposts - 1; e++) {
- float xdif = (xloc + 24) - (postinfo[e][0] + 8);
- float ydif = (yloc + 24) - (postinfo[e][1] + 8);
+ float xdif = (xloc + 24) - (_postInfo[e][0] + 8);
+ float ydif = (yloc + 24) - (_postInfo[e][1] + 8);
if ((abs(xdif) < 24 && abs(ydif) < 24)) {
- _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+ _objmapf[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1;
+ _objectMap[(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = -1;
- rcSrc.left = postinfo[e][0] / 2;
- rcSrc.top = postinfo[e][1] / 2;
+ rcSrc.left = _postInfo[e][0] / 2;
+ rcSrc.top = _postInfo[e][1] / 2;
rcSrc.setWidth(8);
rcSrc.setHeight(8);
- _clipbg2->fillRect(rcSrc, 0);
+ _clipBg2->fillRect(rcSrc, 0);
- addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ addFloatIcon(99, _postInfo[e][0], _postInfo[e][1]);
if (config.effects) {
int snd = playSound(_sfx[kSndMetalHit]);
@@ -1478,7 +1478,7 @@ void GriffonEngine::updateSpells() {
}
// earth
- if (spellnum == 2 && !_forcepause) {
+ if (spellnum == 2 && !_forcePause) {
float hght = 240 - spellinfo[i].enemyy;
for (int f = 8; f >= 0; f--) {
@@ -1506,7 +1506,7 @@ void GriffonEngine::updateSpells() {
rcDest.top = yloc;
if (xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
if (scatter) {
if (spellinfo[i].damagewho == 0) {
@@ -1532,21 +1532,21 @@ void GriffonEngine::updateSpells() {
// check for(int post damage
if (nposts > 0) {
for (int e = 0; e <= nposts - 1; e++) {
- float xdif = (xloc + 16) - (postinfo[e][0] + 8);
- float ydif = (yloc + 16) - (postinfo[e][1] + 8);
+ float xdif = (xloc + 16) - (_postInfo[e][0] + 8);
+ float ydif = (yloc + 16) - (_postInfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+ _objmapf[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1;
+ _objectMap[(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = -1;
- rcSrc.left = postinfo[e][0] / 2;
- rcSrc.top = postinfo[e][1] / 2;
+ rcSrc.left = _postInfo[e][0] / 2;
+ rcSrc.top = _postInfo[e][1] / 2;
rcSrc.setWidth(8);
rcSrc.setHeight(8);
- _clipbg2->fillRect(rcSrc, 0);
+ _clipBg2->fillRect(rcSrc, 0);
- addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ addFloatIcon(99, _postInfo[e][0], _postInfo[e][1]);
if (config.effects) {
int snd = playSound(_sfx[kSndRocks]);
@@ -1585,14 +1585,14 @@ void GriffonEngine::updateSpells() {
if (fra > 24)
f = 192 * (1 - (fra - 24) / 8);
- _spellimg->setAlpha(f, true);
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- _spellimg->setAlpha(255, true);
+ _spellImg->setAlpha(f, true);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->setAlpha(255, true);
spellinfo[i].frame = spellinfo[i].frame - 0.3 * _fpsr;
if (spellinfo[i].frame < 0) {
spellinfo[i].frame = 0;
- _forcepause = false;
+ _forcePause = false;
float npx = _player.px + 12;
float npy = _player.py + 20;
@@ -1664,12 +1664,12 @@ void GriffonEngine::updateSpells() {
}
// room fireballs
- if (spellnum == 6 && !_forcepause) {
+ if (spellnum == 6 && !_forcePause) {
if (spellinfo[i].frame > 16) {
float fr = (32 - spellinfo[i].frame);
- _spellimg->setAlpha(192 * sin(3.14159 * fr / 4), true);
+ _spellImg->setAlpha(192 * sin(3.14159 * fr / 4), true);
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -1684,12 +1684,12 @@ void GriffonEngine::updateSpells() {
rcDest.left = xloc;
rcDest.top = yloc;
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
- _spellimg->setAlpha(255, true);
+ _spellImg->setAlpha(255, true);
} else {
- _spellimg->setAlpha(192, true);
+ _spellImg->setAlpha(192, true);
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -1719,14 +1719,14 @@ void GriffonEngine::updateSpells() {
rcDest.left = xloc;
rcDest.top = yloc;
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
if (xloc < -1 || yloc < -1 || xloc > 304 || yloc > 224)
spellinfo[i].ballon[ff] = 0;
}
- _spellimg->setAlpha(255, true);
+ _spellImg->setAlpha(255, true);
}
spellinfo[i].frame = spellinfo[i].frame - 0.2 * _fpsr;
@@ -1760,9 +1760,9 @@ void GriffonEngine::updateSpells() {
// lightning bomb
if (spellnum == 8) {
- long cl1 = _videobuffer->format.RGBToColor(0, 32, 204);
- long cl2 = _videobuffer->format.RGBToColor(142, 173, 191);
- long cl3 = _videobuffer->format.RGBToColor(240, 240, 240);
+ long cl1 = _videoBuffer->format.RGBToColor(0, 32, 204);
+ long cl2 = _videoBuffer->format.RGBToColor(142, 173, 191);
+ long cl3 = _videoBuffer->format.RGBToColor(240, 240, 240);
float px = _player.px + 12;
float py = _player.py + 12;
@@ -1781,13 +1781,13 @@ void GriffonEngine::updateSpells() {
else if (orn == 2)
++y;
- drawLine(_videobuffer, x, y - 1, x, y + 2, cl1);
- drawLine(_videobuffer, x, y, x, y + 1, cl3);
+ drawLine(_videoBuffer, x, y - 1, x, y + 2, cl1);
+ drawLine(_videoBuffer, x, y, x, y + 1, cl3);
if (rn == 0)
- drawLine(_videobuffer, x, y + 1, x, y + 1, cl2);
+ drawLine(_videoBuffer, x, y + 1, x, y + 1, cl2);
if (rn == 2)
- drawLine(_videobuffer, x, y, x, y, cl2);
+ drawLine(_videoBuffer, x, y, x, y, cl2);
orn = rn;
@@ -1808,21 +1808,21 @@ void GriffonEngine::updateSpells() {
// check for post damage
if (nposts > 0) {
for (int e = 0; e <= nposts - 1; e++) {
- float xdif = (xloc + 16) - (postinfo[e][0] + 8);
- float ydif = (yloc + 16) - (postinfo[e][1] + 8);
+ float xdif = (xloc + 16) - (_postInfo[e][0] + 8);
+ float ydif = (yloc + 16) - (_postInfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+ _objmapf[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1;
+ _objectMap[(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = -1;
- rcSrc.left = postinfo[e][0] / 2;
- rcSrc.top = postinfo[e][1] / 2;
+ rcSrc.left = _postInfo[e][0] / 2;
+ rcSrc.top = _postInfo[e][1] / 2;
rcSrc.setWidth(8);
rcSrc.setHeight(8);
- _clipbg2->fillRect(rcSrc, 0);
+ _clipBg2->fillRect(rcSrc, 0);
- addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ addFloatIcon(99, _postInfo[e][0], _postInfo[e][1]);
}
}
}
@@ -1838,13 +1838,13 @@ void GriffonEngine::updateSpells() {
else if (orn == 2)
++y;
- drawLine(_videobuffer, x, y - 1, x, y + 2, cl1);
- drawLine(_videobuffer, x, y, x, y + 1, cl3);
+ drawLine(_videoBuffer, x, y - 1, x, y + 2, cl1);
+ drawLine(_videoBuffer, x, y, x, y + 1, cl3);
if (rn == 0)
- drawLine(_videobuffer, x, y + 1, x, y + 1, cl2);
+ drawLine(_videoBuffer, x, y + 1, x, y + 1, cl2);
if (rn == 2)
- drawLine(_videobuffer, x, y, x, y, cl2);
+ drawLine(_videoBuffer, x, y, x, y, cl2);
orn = rn;
@@ -1865,21 +1865,21 @@ void GriffonEngine::updateSpells() {
// check for post damage
if (nposts > 0) {
for (int e = 0; e <= nposts - 1; e++) {
- float xdif = (xloc + 16) - (postinfo[e][0] + 8);
- float ydif = (yloc + 16) - (postinfo[e][1] + 8);
+ float xdif = (xloc + 16) - (_postInfo[e][0] + 8);
+ float ydif = (yloc + 16) - (_postInfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+ _objmapf[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1;
+ _objectMap[(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = -1;
- rcSrc.left = postinfo[e][0] / 2;
- rcSrc.top = postinfo[e][1] / 2;
+ rcSrc.left = _postInfo[e][0] / 2;
+ rcSrc.top = _postInfo[e][1] / 2;
rcSrc.setWidth(8);
rcSrc.setHeight(8);
- _clipbg2->fillRect(rcSrc, 0);
+ _clipBg2->fillRect(rcSrc, 0);
- addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ addFloatIcon(99, _postInfo[e][0], _postInfo[e][1]);
}
}
}
@@ -1895,13 +1895,13 @@ void GriffonEngine::updateSpells() {
if (orn == 2)
x = x + 1;
- drawLine(_videobuffer, x - 1, y, x + 2, y, cl1);
- drawLine(_videobuffer, x, y, x + 1, y, cl3);
+ drawLine(_videoBuffer, x - 1, y, x + 2, y, cl1);
+ drawLine(_videoBuffer, x, y, x + 1, y, cl3);
if (rn == 0)
- drawLine(_videobuffer, x + 1, y, x + 1, y, cl2);
+ drawLine(_videoBuffer, x + 1, y, x + 1, y, cl2);
if (rn == 2)
- drawLine(_videobuffer, x, y, x, y, cl2);
+ drawLine(_videoBuffer, x, y, x, y, cl2);
orn = rn;
@@ -1922,21 +1922,21 @@ void GriffonEngine::updateSpells() {
// check for post damage
if (nposts > 0) {
for (int e = 0; e <= nposts - 1; e++) {
- float xdif = (xloc + 16) - (postinfo[e][0] + 8);
- float ydif = (yloc + 16) - (postinfo[e][1] + 8);
+ float xdif = (xloc + 16) - (_postInfo[e][0] + 8);
+ float ydif = (yloc + 16) - (_postInfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+ _objmapf[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1;
+ _objectMap[(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = -1;
- rcSrc.left = postinfo[e][0] / 2;
- rcSrc.top = postinfo[e][1] / 2;
+ rcSrc.left = _postInfo[e][0] / 2;
+ rcSrc.top = _postInfo[e][1] / 2;
rcSrc.setWidth(8);
rcSrc.setHeight(8);
- _clipbg2->fillRect(rcSrc, 0);
+ _clipBg2->fillRect(rcSrc, 0);
- addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ addFloatIcon(99, _postInfo[e][0], _postInfo[e][1]);
}
}
}
@@ -1952,13 +1952,13 @@ void GriffonEngine::updateSpells() {
if (orn == 2)
x = x + 1;
- drawLine(_videobuffer, x - 1, y, x + 2, y, cl1);
- drawLine(_videobuffer, x, y, x + 1, y, cl3);
+ drawLine(_videoBuffer, x - 1, y, x + 2, y, cl1);
+ drawLine(_videoBuffer, x, y, x + 1, y, cl3);
if (rn == 0)
- drawLine(_videobuffer, x + 1, y, x + 1, y, cl2);
+ drawLine(_videoBuffer, x + 1, y, x + 1, y, cl2);
if (rn == 2)
- drawLine(_videobuffer, x, y, x, y, cl2);
+ drawLine(_videoBuffer, x, y, x, y, cl2);
orn = rn;
@@ -1979,21 +1979,21 @@ void GriffonEngine::updateSpells() {
// check for post damage
if (nposts > 0) {
for (int e = 0; e <= nposts - 1; e++) {
- float xdif = (xloc + 16) - (postinfo[e][0] + 8);
- float ydif = (yloc + 16) - (postinfo[e][1] + 8);
+ float xdif = (xloc + 16) - (_postInfo[e][0] + 8);
+ float ydif = (yloc + 16) - (_postInfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+ _objmapf[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1;
+ _objectMap[(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = -1;
- rcSrc.left = postinfo[e][0] / 2;
- rcSrc.top = postinfo[e][1] / 2;
+ rcSrc.left = _postInfo[e][0] / 2;
+ rcSrc.top = _postInfo[e][1] / 2;
rcSrc.setWidth(8);
rcSrc.setHeight(8);
- _clipbg2->fillRect(rcSrc, 0);
+ _clipBg2->fillRect(rcSrc, 0);
- addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ addFloatIcon(99, _postInfo[e][0], _postInfo[e][1]);
}
}
}
@@ -2003,15 +2003,15 @@ void GriffonEngine::updateSpells() {
spellinfo[i].frame -= 0.5 * _fpsr;
if (spellinfo[i].frame < 0) {
spellinfo[i].frame = 0;
- _forcepause = false;
+ _forcePause = false;
}
}
// wizard 1 lightning
if (spellnum == 9) {
- long cl1 = _videobuffer->format.RGBToColor(0, 32, 204);
- long cl2 = _videobuffer->format.RGBToColor(142, 173, 191);
- long cl3 = _videobuffer->format.RGBToColor(240, 240, 240);
+ long cl1 = _videoBuffer->format.RGBToColor(0, 32, 204);
+ long cl2 = _videoBuffer->format.RGBToColor(142, 173, 191);
+ long cl3 = _videoBuffer->format.RGBToColor(240, 240, 240);
int px = spellinfo[i].enemyx + 12;
int py = spellinfo[i].enemyy + 24;
@@ -2030,13 +2030,13 @@ void GriffonEngine::updateSpells() {
if (orn == 2)
x = x + 1;
- drawLine(_videobuffer, x - 1, y, x + 2, y, cl1);
- drawLine(_videobuffer, x, y, x + 1, y, cl3);
+ drawLine(_videoBuffer, x - 1, y, x + 2, y, cl1);
+ drawLine(_videoBuffer, x, y, x + 1, y, cl3);
if (rn == 0)
- drawLine(_videobuffer, x + 1, y, x + 1, y, cl2);
+ drawLine(_videoBuffer, x + 1, y, x + 1, y, cl2);
if (rn == 2)
- drawLine(_videobuffer, x, y, x, y, cl2);
+ drawLine(_videoBuffer, x, y, x, y, cl2);
orn = rn;
@@ -2072,7 +2072,7 @@ void GriffonEngine::updateSpells() {
}
void GriffonEngine::updateSpellsUnder() {
- if (_forcepause)
+ if (_forcePause)
return;
for (int i = 0; i < kMaxSpell; i++) {
@@ -2098,9 +2098,9 @@ void GriffonEngine::updateSpellsUnder() {
if (fra > 24)
f = 160 * (1 - (fra - 24) / 8);
- _spellimg->setAlpha(f, true);
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- _spellimg->setAlpha(255, true);
+ _spellImg->setAlpha(f, true);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->setAlpha(255, true);
spellinfo[i].frame = spellinfo[i].frame - 0.2 * _fpsr;
if (spellinfo[i].frame < 0)
@@ -2125,7 +2125,7 @@ void GriffonEngine::updateSpellsUnder() {
int sx = (newx / 2 + 6);
int sy = (newy / 2 + 10);
- unsigned int *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ unsigned int *temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
unsigned int dq = *temp;
if (dq == 0) {
@@ -2138,7 +2138,7 @@ void GriffonEngine::updateSpellsUnder() {
sx = (newx / 2 + 6);
sy = (_npcinfo[f].y / 2 + 10);
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
dq = *temp;
if (dq == 0)
@@ -2147,7 +2147,7 @@ void GriffonEngine::updateSpellsUnder() {
sx = (_npcinfo[f].x / 2 + 6);
sy = (newy / 2 + 10);
- temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
dq = *temp;
if (dq == 0)
@@ -2187,7 +2187,7 @@ void GriffonEngine::updateSpellsUnder() {
for (int f = 0; f <= 4; f++) {
for (int x = 0; x <= fra; x += 2) {
if (spellinfo[i].legalive[f] >= x) {
- _spellimg->setAlpha(192 * sin(3.14159 * x / 32) * s / 8, true);
+ _spellImg->setAlpha(192 * sin(3.14159 * x / 32) * s / 8, true);
float an = 360 / 5 * f + x / 32 * 180;
@@ -2202,12 +2202,12 @@ void GriffonEngine::updateSpellsUnder() {
rcDest.top = (int)yloc;
if (xloc > -1 && xloc < 304 && yloc > -1 && yloc < 224) {
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
int sx = (xloc / 2 + 4);
int sy = (yloc / 2 + 8);
- unsigned int *temp = (uint32 *)_clipbg->getBasePtr(sx, sy);
+ unsigned int *temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
unsigned int dq = *temp;
if (dq > 1000 && x > 4)
@@ -2257,26 +2257,26 @@ void GriffonEngine::updateSpellsUnder() {
// check for post damage
if (nposts > 0) {
for (int e = 0; e <= nposts - 1; e++) {
- float xdif = (xloc + 8) - (postinfo[e][0] + 8);
- float ydif = (yloc + 8) - (postinfo[e][1] + 8);
+ float xdif = (xloc + 8) - (_postInfo[e][0] + 8);
+ float ydif = (yloc + 8) - (_postInfo[e][1] + 8);
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
- _objmapf[_curmap][(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = 1;
- _objectMap[(int)postinfo[e][0] / 16][(int)postinfo[e][1] / 16] = -1;
+ _objmapf[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1;
+ _objectMap[(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = -1;
- rcSrc.left = postinfo[e][0] / 2;
- rcSrc.top = postinfo[e][1] / 2;
+ rcSrc.left = _postInfo[e][0] / 2;
+ rcSrc.top = _postInfo[e][1] / 2;
rcSrc.setWidth(8);
rcSrc.setHeight(8);
- _clipbg2->fillRect(rcSrc, 0);
+ _clipBg2->fillRect(rcSrc, 0);
if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
setChannelVolume(snd, config.effectsvol);
}
- addFloatIcon(99, postinfo[e][0], postinfo[e][1]);
+ addFloatIcon(99, _postInfo[e][0], _postInfo[e][1]);
}
}
}
@@ -2285,7 +2285,7 @@ void GriffonEngine::updateSpellsUnder() {
}
}
- _spellimg->setAlpha(255, true);
+ _spellImg->setAlpha(255, true);
spellinfo[i].frame = spellinfo[i].frame - 0.2 * _fpsr;
if (spellinfo[i].frame < 0)
@@ -2313,7 +2313,7 @@ void GriffonEngine::updateSpellsUnder() {
float yy = 16 * sin(3.141592 / 2 * xx / 16) - 8;
alpha = CLIP(alpha, 0, 255);
- _spellimg->setAlpha(alpha, true);
+ _spellImg->setAlpha(alpha, true);
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
@@ -2327,7 +2327,7 @@ void GriffonEngine::updateSpellsUnder() {
rcDest.top = yloc;
if (xloc > -16 && xloc < 320 && yloc > -16 && yloc < 240) {
- _spellimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
if (spellinfo[i].damagewho == 1) {
float xdif = (xloc + 8) - (_player.px + 12);
@@ -2351,7 +2351,7 @@ void GriffonEngine::updateSpellsUnder() {
}
- _spellimg->setAlpha(255, true);
+ _spellImg->setAlpha(255, true);
spellinfo[i].frame = spellinfo[i].frame - 0.5 * _fpsr;
if (spellinfo[i].frame < 0)
spellinfo[i].frame = 0;
diff --git a/engines/griffon/resources.cpp b/engines/griffon/resources.cpp
index 0c8b704..e881845 100644
--- a/engines/griffon/resources.cpp
+++ b/engines/griffon/resources.cpp
@@ -59,41 +59,41 @@ void GriffonEngine::initialize() {
_video = new Graphics::TransparentSurface;
_video->create(320, 240, g_system->getScreenFormat());
- _videobuffer = new Graphics::TransparentSurface;
- _videobuffer->create(320, 240, g_system->getScreenFormat());
- _videobuffer2 = new Graphics::TransparentSurface;
- _videobuffer2->create(320, 240, g_system->getScreenFormat());
- _videobuffer3 = new Graphics::TransparentSurface;
- _videobuffer3->create(320, 240, g_system->getScreenFormat());
- _mapbg = new Graphics::TransparentSurface;
- _mapbg->create(320, 240, g_system->getScreenFormat());
- _clipbg = new Graphics::TransparentSurface;
- _clipbg->create(320, 240, g_system->getScreenFormat());
- _clipbg2 = new Graphics::TransparentSurface;
- _clipbg2->create(320, 240, g_system->getScreenFormat());
+ _videoBuffer = new Graphics::TransparentSurface;
+ _videoBuffer->create(320, 240, g_system->getScreenFormat());
+ _videoBuffer2 = new Graphics::TransparentSurface;
+ _videoBuffer2->create(320, 240, g_system->getScreenFormat());
+ _videoBuffer3 = new Graphics::TransparentSurface;
+ _videoBuffer3->create(320, 240, g_system->getScreenFormat());
+ _mapBg = new Graphics::TransparentSurface;
+ _mapBg->create(320, 240, g_system->getScreenFormat());
+ _clipBg = new Graphics::TransparentSurface;
+ _clipBg->create(320, 240, g_system->getScreenFormat());
+ _clipBg2 = new Graphics::TransparentSurface;
+ _clipBg2->create(320, 240, g_system->getScreenFormat());
for (int i = 0; i <= 3; i++) {
char name[128];
sprintf(name, "art/map%i.bmp", i + 1);
- mapimg[i] = loadImage(name, true);
+ mapImg[i] = loadImage(name, true);
}
cloudimg = loadImage("art/clouds.bmp", true);
cloudimg->setAlpha(96, true);
- saveloadimg = loadImage("art/saveloadnew.bmp", true);
- saveloadimg->setAlpha(160, true);
+ _saveLoadImg = loadImage("art/saveloadnew.bmp", true);
+ _saveLoadImg->setAlpha(160, true);
- _titleimg = loadImage("art/titleb.bmp");
- _titleimg2 = loadImage("art/titlea.bmp", true);
+ _titleImg = loadImage("art/titleb.bmp");
+ _titleImg2 = loadImage("art/titlea.bmp", true);
//_titleimg2->setAlpha(204, true);
- _inventoryimg = loadImage("art/inventory.bmp", true);
+ _inventoryImg = loadImage("art/inventory.bmp", true);
- _logosimg = loadImage("art/logos.bmp");
- _theendimg = loadImage("art/theend.bmp");
+ _logosImg = loadImage("art/logos.bmp");
+ _theEndImg = loadImage("art/theend.bmp");
loadTiles();
@@ -104,7 +104,7 @@ void GriffonEngine::initialize() {
loadItemImgs();
_fpsr = 1.0f;
- _nextticks = _ticks + 1000;
+ _nextTicks = _ticks + 1000;
for (int i = 0; i <= 15; i++) {
_playerattackofs[0][i][0] = 0; // -1// -(i + 1)
@@ -148,16 +148,16 @@ Graphics::TransparentSurface *GriffonEngine::loadImage(const char *name, bool co
void GriffonEngine::loadMap(int mapnum) {
debug(2, "Loaded map %d", mapnum);
- unsigned int ccc = _clipbg->format.RGBToColor(255, 255, 255);
+ unsigned int ccc = _clipBg->format.RGBToColor(255, 255, 255);
- _curmap = mapnum;
+ _curMap = mapnum;
Common::Rect trect(320, 240);
- _mapbg->fillRect(trect, 0);
- _clipbg->fillRect(trect, ccc);
- _clipbg2->fillRect(trect, ccc);
+ _mapBg->fillRect(trect, 0);
+ _clipBg->fillRect(trect, ccc);
+ _clipBg2->fillRect(trect, ccc);
- _forcepause = false;
+ _forcePause = false;
_cloudsOn = false;
if (mapnum < 6)
_cloudsOn = true;
@@ -181,19 +181,19 @@ void GriffonEngine::loadMap(int mapnum) {
_cloudsOn = true;
// -----------special case
- dontdrawover = 0;
+ _dontDrawOver = false;
if (mapnum == 24)
- dontdrawover = 1;
+ _dontDrawOver = true;
- if ((mapnum == 53 || mapnum == 57 || mapnum == 61 || mapnum == 65 || mapnum == 62) && _scriptflag[kScriptLever][0] > 0)
+ if ((mapnum == 53 || mapnum == 57 || mapnum == 61 || mapnum == 65 || mapnum == 62) && _scriptFlag[kScriptLever][0] > 0)
mapnum = mapnum + 100;
- if ((mapnum == 161 || mapnum == 162) && _scriptflag[kScriptLever][0] == 2)
+ if ((mapnum == 161 || mapnum == 162) && _scriptFlag[kScriptLever][0] == 2)
mapnum = mapnum + 100;
for (int i = 0; i < kMaxSpell; i++)
spellinfo[i].frame = 0;
- _roomlock = false;
+ _roomLock = false;
char name[256];
// read *.map file
@@ -242,7 +242,7 @@ void GriffonEngine::loadMap(int mapnum) {
for (int y = 0; y <= 23; y++) {
for (int x = 0; x <= 39; x++)
- _rampdata[x][y] = tempmap[3 * 40 + x][y + 40];
+ _rampData[x][y] = tempmap[3 * 40 + x][y + 40];
}
for (int y = 0; y <= 23; y++) {
@@ -254,7 +254,7 @@ void GriffonEngine::loadMap(int mapnum) {
}
}
- if (_scriptflag[kScriptFindShield][0] == 1 && _curmap == 4) {
+ if (_scriptFlag[kScriptFindShield][0] == 1 && _curMap == 4) {
_triggerloc[9][7] = 5004;
tempmap[9][7] = 41;
tempmap[9][7 + 40] = 0;
@@ -307,7 +307,7 @@ void GriffonEngine::loadMap(int mapnum) {
}
}
- _tiles[curtilel]->blit(*_mapbg, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ _tiles[curtilel]->blit(*_mapBg, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
_tiles[curtilel]->setAlpha(255, true);
rcDest.left = x * 8;
@@ -315,7 +315,7 @@ void GriffonEngine::loadMap(int mapnum) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- _clipbg->fillRect(rcDest, 0);
+ _clipBg->fillRect(rcDest, 0);
}
}
}
@@ -325,7 +325,7 @@ void GriffonEngine::loadMap(int mapnum) {
for (int y = 0; y <= 23; y++) {
int d = tempmap[3 * 40 + x][y];
- if (_scriptflag[kScriptFindShield][0] == 1 && x == 9 && y == 7)
+ if (_scriptFlag[kScriptFindShield][0] == 1 && x == 9 && y == 7)
d = 99;
if (d > 0) {
@@ -348,37 +348,37 @@ void GriffonEngine::loadMap(int mapnum) {
if (d == 1) {
for (int i = 0; i <= 7; i++) {
- drawLine(_clipbg, x1, y1 + i, x1 + 7 - i, y1 + i, ccc);
+ drawLine(_clipBg, x1, y1 + i, x1 + 7 - i, y1 + i, ccc);
}
} else if (d == 2) {
- drawLine(_clipbg, x1, y1, x1 + 7, y1, ccc);
- drawLine(_clipbg, x1, y1 + 1, x1 + 7, y1 + 1, ccc);
+ drawLine(_clipBg, x1, y1, x1 + 7, y1, ccc);
+ drawLine(_clipBg, x1, y1 + 1, x1 + 7, y1 + 1, ccc);
} else if (d == 3) {
for (int i = 0; i <= 7; i++) {
- drawLine(_clipbg, x1 + i, y1 + i, x1 + 7, y1 + i, ccc);
+ drawLine(_clipBg, x1 + i, y1 + i, x1 + 7, y1 + i, ccc);
}
} else if (d == 4) {
- drawLine(_clipbg, x1, y1, x1, y1 + 7, ccc);
- drawLine(_clipbg, x1 + 1, y1, x1 + 1, y1 + 7, ccc);
+ drawLine(_clipBg, x1, y1, x1, y1 + 7, ccc);
+ drawLine(_clipBg, x1 + 1, y1, x1 + 1, y1 + 7, ccc);
} else if (d == 5) {
rcDest.left = x1;
rcDest.top = y1;
rcDest.setWidth(8);
rcDest.setHeight(8);
- _clipbg->fillRect(rcDest, ccc);
+ _clipBg->fillRect(rcDest, ccc);
} else if (d == 6) {
- drawLine(_clipbg, x1 + 7, y1, x1 + 7, y1 + 7, ccc);
- drawLine(_clipbg, x1 + 6, y1, x1 + 6, y1 + 7, ccc);
+ drawLine(_clipBg, x1 + 7, y1, x1 + 7, y1 + 7, ccc);
+ drawLine(_clipBg, x1 + 6, y1, x1 + 6, y1 + 7, ccc);
} else if (d == 7) {
for (int i = 0; i <= 7; i++) {
- drawLine(_clipbg, x1, y1 + i, x1 + i, y1 + i, ccc);
+ drawLine(_clipBg, x1, y1 + i, x1 + i, y1 + i, ccc);
}
} else if (d == 8) {
- drawLine(_clipbg, x1, y1 + 7, x1 + 7, y1 + 7, ccc);
- drawLine(_clipbg, x1, y1 + 7, x1 + 6, y1 + 6, ccc);
+ drawLine(_clipBg, x1, y1 + 7, x1 + 7, y1 + 7, ccc);
+ drawLine(_clipBg, x1, y1 + 7, x1 + 6, y1 + 6, ccc);
} else if (d == 9) {
for (int i = 0; i <= 7; i++) {
- drawLine(_clipbg, x1 + 7 - i, y1 + i, x1 + 7, y1 + i, ccc);
+ drawLine(_clipBg, x1 + 7 - i, y1 + i, x1 + 7, y1 + i, ccc);
}
}
}
@@ -412,7 +412,7 @@ void GriffonEngine::loadMap(int mapnum) {
int o = tempmap[5 * 40 + x][y];
- if (_objmapf[_curmap][x][y] == 0) {
+ if (_objmapf[_curMap][x][y] == 0) {
_objectMap[x][y] = o;
if (_objectInfo[o][0] > 1) {
@@ -429,9 +429,9 @@ void GriffonEngine::loadMap(int mapnum) {
rcDest.setHeight(8);
if (_objectInfo[o][4] == 1)
- _clipbg->fillRect(rcDest, ccc);
+ _clipBg->fillRect(rcDest, ccc);
if (_objectInfo[o][4] == 3)
- _clipbg->fillRect(rcDest, ccc);
+ _clipBg->fillRect(rcDest, ccc);
}
}
if (npc == 1) {
@@ -450,21 +450,21 @@ void GriffonEngine::loadMap(int mapnum) {
}
- if (_curmap == 62 && _scriptflag[kScriptGardenMasterKey][0] > 0)
+ if (_curMap == 62 && _scriptFlag[kScriptGardenMasterKey][0] > 0)
_lastnpc = 0;
- if (_curmap == 73 && _scriptflag[kScriptArmourChest][0] > 0)
+ if (_curMap == 73 && _scriptFlag[kScriptArmourChest][0] > 0)
_lastnpc = 0;
- if (_curmap == 81 && _scriptflag[kScriptCitadelMasterKey][0] > 0)
+ if (_curMap == 81 && _scriptFlag[kScriptCitadelMasterKey][0] > 0)
_lastnpc = 0;
- if (_curmap == 73 && _scriptflag[kScriptArmourChest][0] == 0)
- _roomlock = true;
- if (_curmap == 81 && _scriptflag[kScriptCitadelMasterKey][0] == 0)
- _roomlock = true;
- if (_curmap == 83 && _scriptflag[kScriptGetSword3][0] == 0)
- _roomlock = true;
- if (_curmap == 82)
- _roomlock = true;
+ if (_curMap == 73 && _scriptFlag[kScriptArmourChest][0] == 0)
+ _roomLock = true;
+ if (_curMap == 81 && _scriptFlag[kScriptCitadelMasterKey][0] == 0)
+ _roomLock = true;
+ if (_curMap == 83 && _scriptFlag[kScriptGetSword3][0] == 0)
+ _roomLock = true;
+ if (_curMap == 82)
+ _roomLock = true;
// read *.npc file
sprintf(name, "mapdb/%04i.npc", mapnum);
@@ -699,33 +699,33 @@ void GriffonEngine::loadMap(int mapnum) {
}
if (_npcinfo[i].script == kScriptMasterKey) {
- _roomlock = true;
- if (_scriptflag[kScriptMasterKey][0] > 0) {
- _roomlock = false;
+ _roomLock = true;
+ if (_scriptFlag[kScriptMasterKey][0] > 0) {
+ _roomLock = false;
_npcinfo[i].hp = 0;
}
}
if (_npcinfo[i].script == kScriptFindCrystal) {
- _roomlock = true;
- if (_scriptflag[kScriptFindCrystal][0] > 0) {
- _roomlock = false;
+ _roomLock = true;
+ if (_scriptFlag[kScriptFindCrystal][0] > 0) {
+ _roomLock = false;
_npcinfo[i].hp = 0;
}
}
if (_npcinfo[i].script == kScriptFindSword) {
- _roomlock = true;
- if (_scriptflag[kScriptFindSword][0] > 0) {
- _roomlock = false;
+ _roomLock = true;
+ if (_scriptFlag[kScriptFindSword][0] > 0) {
+ _roomLock = false;
_npcinfo[i].hp = 0;
}
}
if (_npcinfo[i].script == kScriptGetSword3) {
- _roomlock = true;
- if (_scriptflag[kScriptGetSword3][0] > 0) {
- _roomlock = false;
+ _roomLock = true;
+ if (_scriptFlag[kScriptGetSword3][0] > 0) {
+ _roomLock = false;
_npcinfo[i].hp = 0;
}
}
@@ -739,7 +739,7 @@ void GriffonEngine::loadMap(int mapnum) {
int cx, cy, npx, npy, lx, ly;
// academy master key
- if (_curmap == 34 && _scriptflag[kScriptMasterKey][0] == 1) {
+ if (_curMap == 34 && _scriptFlag[kScriptMasterKey][0] == 1) {
cx = 9;
cy = 7;
@@ -759,11 +759,11 @@ void GriffonEngine::loadMap(int mapnum) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
- _clipbg->fillRect(rcDest, ccc);
+ _clipBg->fillRect(rcDest, ccc);
}
// academy crystal
- if (_curmap == 24 && !_player.foundSpell[0] && _scriptflag[kScriptFindCrystal][0] == 1) {
+ if (_curMap == 24 && !_player.foundSpell[0] && _scriptFlag[kScriptFindCrystal][0] == 1) {
cx = 9;
cy = 7;
@@ -783,11 +783,11 @@ void GriffonEngine::loadMap(int mapnum) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
- _clipbg->fillRect(rcDest, ccc);
+ _clipBg->fillRect(rcDest, ccc);
}
// gardens master key
- if (_curmap == 62 && _scriptflag[kScriptGardenMasterKey][0] == 1) {
+ if (_curMap == 62 && _scriptFlag[kScriptGardenMasterKey][0] == 1) {
cx = 13;
cy = 7;
@@ -807,11 +807,11 @@ void GriffonEngine::loadMap(int mapnum) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
- _clipbg->fillRect(rcDest, ccc);
+ _clipBg->fillRect(rcDest, ccc);
}
// gardens fidelis sword
- if (_curmap == 66 && _scriptflag[kScriptFindSword][0] == 1 && _player.sword == 1) {
+ if (_curMap == 66 && _scriptFlag[kScriptFindSword][0] == 1 && _player.sword == 1) {
cx = 9;
cy = 6;
@@ -831,11 +831,11 @@ void GriffonEngine::loadMap(int mapnum) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
- _clipbg->fillRect(rcDest, ccc);
+ _clipBg->fillRect(rcDest, ccc);
}
// citadel armour
- if (_curmap == 73 && _scriptflag[kScriptArmourChest][0] == 1 && _player.armour == 1) {
+ if (_curMap == 73 && _scriptFlag[kScriptArmourChest][0] == 1 && _player.armour == 1) {
cx = 8;
cy = 7;
@@ -855,11 +855,11 @@ void GriffonEngine::loadMap(int mapnum) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
- _clipbg->fillRect(rcDest, ccc);
+ _clipBg->fillRect(rcDest, ccc);
}
// citadel master key
- if (_curmap == 81 && _scriptflag[kScriptCitadelMasterKey][0] == 1) {
+ if (_curMap == 81 && _scriptFlag[kScriptCitadelMasterKey][0] == 1) {
cx = 11;
cy = 10;
@@ -879,12 +879,12 @@ void GriffonEngine::loadMap(int mapnum) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
- _clipbg->fillRect(rcDest, ccc);
+ _clipBg->fillRect(rcDest, ccc);
}
// max ups
- if (_curmap == 83 && _scriptflag[kScriptGetSword3][0] == 1 && _player.sword < 3) {
+ if (_curMap == 83 && _scriptFlag[kScriptGetSword3][0] == 1 && _player.sword < 3) {
cx = 6;
cy = 8;
@@ -904,10 +904,10 @@ void GriffonEngine::loadMap(int mapnum) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
- _clipbg->fillRect(rcDest, ccc);
+ _clipBg->fillRect(rcDest, ccc);
}
- if (_curmap == 83 && _scriptflag[kScriptShield3][0] == 1 && _player.shield < 3) {
+ if (_curMap == 83 && _scriptFlag[kScriptShield3][0] == 1 && _player.shield < 3) {
cx = 9;
cy = 8;
@@ -927,10 +927,10 @@ void GriffonEngine::loadMap(int mapnum) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
- _clipbg->fillRect(rcDest, ccc);
+ _clipBg->fillRect(rcDest, ccc);
}
- if (_curmap == 83 && _scriptflag[kScriptArmour3][0] == 1 && _player.armour < 3) {
+ if (_curMap == 83 && _scriptFlag[kScriptArmour3][0] == 1 && _player.armour < 3) {
cx = 12;
cy = 8;
@@ -950,20 +950,20 @@ void GriffonEngine::loadMap(int mapnum) {
if (lx == cx && ly == cy)
_player.py = _player.py + 16;
- _clipbg->fillRect(rcDest, ccc);
+ _clipBg->fillRect(rcDest, ccc);
}
- _clipbg2->copyRectToSurface(_clipbg->getPixels(), _clipbg->pitch, 0, 0, _clipbg->w, _clipbg->h);
+ _clipBg2->copyRectToSurface(_clipBg->getPixels(), _clipBg->pitch, 0, 0, _clipBg->w, _clipBg->h);
}
void GriffonEngine::loadAnims() {
- _spellimg = loadImage("art/spells.bmp", true);
+ _spellImg = loadImage("art/spells.bmp", true);
_anims[0] = loadImage("art/anims0.bmp", true);
- _animsa[0] = loadImage("art/anims0a.bmp", true);
+ _animsAttack[0] = loadImage("art/anims0a.bmp", true);
_anims[13] = loadImage("art/anims0x.bmp", true);
- _animsa[13] = loadImage("art/anims0xa.bmp", true);
+ _animsAttack[13] = loadImage("art/anims0xa.bmp", true);
_anims[1] = loadImage("art/anims1.bmp", true);
- _animsa[1] = loadImage("art/anims1a.bmp", true);
+ _animsAttack[1] = loadImage("art/anims1a.bmp", true);
_anims[2] = loadImage("art/anims2.bmp", true);
// huge
@@ -1061,9 +1061,9 @@ void GriffonEngine::loadAnims() {
_anims[7] = loadImage("art/anims7.bmp", true);
_anims[8] = loadImage("art/anims8.bmp", true);
_anims[10] = loadImage("art/anims10.bmp", true);
- _animsa[10] = loadImage("art/anims10a.bmp", true);
+ _animsAttack[10] = loadImage("art/anims10a.bmp", true);
_anims[11] = loadImage("art/anims11.bmp", true);
- _animsa[11] = loadImage("art/anims11a.bmp", true);
+ _animsAttack[11] = loadImage("art/anims11a.bmp", true);
_anims[12] = loadImage("art/anims12.bmp", true);
}
@@ -1071,15 +1071,15 @@ void GriffonEngine::loadItemImgs() {
Graphics::TransparentSurface *temp = loadImage("art/icons.bmp", true);
for (int i = 0; i <= 20; i++) {
- _itemimg[i] = new Graphics::TransparentSurface;
- _itemimg[i]->create(16, 16, g_system->getScreenFormat());
+ _itemImg[i] = new Graphics::TransparentSurface;
+ _itemImg[i]->create(16, 16, g_system->getScreenFormat());
rcSrc.left = i * 16;
rcSrc.top = 0;
rcSrc.setWidth(16);
rcSrc.setHeight(16);
- temp->blit(*_itemimg[i], 0, 0, Graphics::FLIP_NONE, &rcSrc);
+ temp->blit(*_itemImg[i], 0, 0, Graphics::FLIP_NONE, &rcSrc);
}
temp->free();
@@ -1092,8 +1092,8 @@ void GriffonEngine::loadFont() {
for (int f = 0; f <= 4; f++) {
int i2 = i - 32;
- _fontchr[i2][f] = new Graphics::TransparentSurface;
- _fontchr[i2][f]->create(8, 8, g_system->getScreenFormat());
+ _fontChr[i2][f] = new Graphics::TransparentSurface;
+ _fontChr[i2][f]->create(8, 8, g_system->getScreenFormat());
int col = i2 % 40;
@@ -1106,7 +1106,7 @@ void GriffonEngine::loadFont() {
rcDest.left = 0;
rcDest.top = 0;
- font->blit(*_fontchr[i2][f], rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ font->blit(*_fontChr[i2][f], rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
font->free();
@@ -1118,7 +1118,7 @@ void GriffonEngine::loadTiles() {
_tiles[2] = loadImage("art/tx2.bmp", true);
_tiles[3] = loadImage("art/tx3.bmp", true);
- _windowimg = loadImage("art/window.bmp", true);
+ _windowImg = loadImage("art/window.bmp", true);
}
void GriffonEngine::loadTriggers() {
diff --git a/engines/griffon/saveload.cpp b/engines/griffon/saveload.cpp
index 972d1b0..aab7bcb 100644
--- a/engines/griffon/saveload.cpp
+++ b/engines/griffon/saveload.cpp
@@ -69,7 +69,7 @@ int GriffonEngine::loadState(int slotnum) {
if (_player.level > 0) {
char temp[256];
- INPUT("%i", &_secstart);
+ INPUT("%i", &_secStart);
INPUT("%s", temp);
INPUT("%f", &_player.px);
@@ -103,10 +103,10 @@ int GriffonEngine::loadState(int slotnum) {
INPUT("%i", &_player.nextLevel);
for (int a = 0; a <= 99; a++) {
for (int b = 0; b <= 9; b++) {
- INPUT("%i", &_scriptflag[a][b]);
+ INPUT("%i", &_scriptFlag[a][b]);
}
}
- INPUT("%i", &_curmap);
+ INPUT("%i", &_curMap);
for (int a = 0; a <= 999; a++) {
for (int b = 0; b <= 20; b++) {
@@ -194,7 +194,7 @@ int GriffonEngine::saveState(int slotnum) {
PRINT("%i", _player.level);
if (_player.level > 0) {
- PRINT("%i", (_secstart + _secsingame));
+ PRINT("%i", (_secStart + _secsingame));
PRINT("%s", "a");
PRINT("%f", _player.px);
@@ -228,10 +228,10 @@ int GriffonEngine::saveState(int slotnum) {
PRINT("%i", _player.nextLevel);
for (int a = 0; a <= 99; a++) {
for (int b = 0; b <= 9; b++) {
- PRINT("%i", _scriptflag[a][b]);
+ PRINT("%i", _scriptFlag[a][b]);
}
}
- PRINT("%i", _curmap);
+ PRINT("%i", _curMap);
for (int a = 0; a <= 999; a++) {
for (int b = 0; b <= 20; b++) {
diff --git a/engines/griffon/sound.cpp b/engines/griffon/sound.cpp
index c2de94d..2e79320 100644
--- a/engines/griffon/sound.cpp
+++ b/engines/griffon/sound.cpp
@@ -121,7 +121,7 @@ void GriffonEngine::setupAudio() {
//atexit(Mix_CloseAudio);
const char *stri = "Loading...";
- drawString(_videobuffer, stri, 160 - 4 * strlen(stri), 116, 0);
+ drawString(_videoBuffer, stri, 160 - 4 * strlen(stri), 116, 0);
Graphics::TransparentSurface *loadimg = loadImage("art/load.bmp", true);
@@ -134,9 +134,9 @@ void GriffonEngine::setupAudio() {
rcDest.top = 116 + 12;
loadimg->setAlpha(160, true); // 128
- loadimg->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
+ loadimg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- g_system->copyRectToScreen(_videobuffer->getPixels(), _videobuffer->pitch, 0, 0, _videobuffer->w, _videobuffer->h);
+ g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
g_system->updateScreen();
rcDest.left = 160 - 44 + 7;
@@ -198,7 +198,7 @@ void GriffonEngine::updateMusic() {
// if(_curmap > 5 && _curmap < 42) iplaysound = macademy;
// if(_curmap > 47) iplaysound = _mgardens;
iplaysound = _mgardens;
- if (_roomlock)
+ if (_roomLock)
iplaysound = _mboss;
if (iplaysound == _mboss && _playingBoss)
Commit: b4b6f249f8ae965e295e395d268918b5b50613df
https://github.com/scummvm/scummvm/commit/b4b6f249f8ae965e295e395d268918b5b50613df
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: More renaming
Changed paths:
engines/griffon/combat.cpp
engines/griffon/cutscenes.cpp
engines/griffon/dialogs.cpp
engines/griffon/draw.cpp
engines/griffon/engine.cpp
engines/griffon/gfx.cpp
engines/griffon/griffon.cpp
engines/griffon/griffon.h
engines/griffon/input.cpp
engines/griffon/logic.cpp
engines/griffon/resources.cpp
engines/griffon/saveload.cpp
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp
index 7279730..ee76536 100644
--- a/engines/griffon/combat.cpp
+++ b/engines/griffon/combat.cpp
@@ -67,7 +67,7 @@ void GriffonEngine::attack() {
_player.inventory[kInvFlask]++;
addFloatIcon(6, lx * 16, (ly - 1) * 16);
- _objmapf[_curMap][lx][ly - 1] = 1;
+ _objectMapFull[_curMap][lx][ly - 1] = 1;
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
@@ -146,7 +146,7 @@ void GriffonEngine::attack() {
_objectMap[lx][ly - 1] = 3;
eventText("Found the Obsidian Shield!");
- _objmapf[4][1][2] = 1;
+ _objectMapFull[4][1][2] = 1;
return;
}
break;
@@ -184,7 +184,7 @@ void GriffonEngine::attack() {
setChannelVolume(snd, config.effectsvol);
}
- _objmapf[_curMap][lx][ly - 1] = 1;
+ _objectMapFull[_curMap][lx][ly - 1] = 1;
if (_objectInfo[o][4] == 1)
_objectMap[lx][ly - 1] = 3;
@@ -205,7 +205,7 @@ void GriffonEngine::attack() {
_player.inventory[kInvDoubleFlask]++;
addFloatIcon(12, lx * 16, (ly - 1) * 16);
- _objmapf[_curMap][lx][ly - 1] = 1;
+ _objectMapFull[_curMap][lx][ly - 1] = 1;
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
@@ -233,7 +233,7 @@ void GriffonEngine::attack() {
_player.inventory[kInvDoubleFlask]++;
addFloatIcon(12, lx * 16, (ly - 1) * 16);
- _objmapf[_curMap][lx][ly - 1] = 1;
+ _objectMapFull[_curMap][lx][ly - 1] = 1;
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
@@ -260,7 +260,7 @@ void GriffonEngine::attack() {
_player.inventory[kInvShock]++;
addFloatIcon(17, lx * 16, (ly - 1) * 16);
- _objmapf[_curMap][lx][ly - 1] = 1;
+ _objectMapFull[_curMap][lx][ly - 1] = 1;
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
@@ -348,7 +348,7 @@ void GriffonEngine::attack() {
if (_objectInfo[o][4] == 1)
_objectMap[lx][ly - 1] = 3;
eventText("Found the Blood Sword!");
- _objmapf[4][1][2] = 1;
+ _objectMapFull[4][1][2] = 1;
return;
}
break;
@@ -366,7 +366,7 @@ void GriffonEngine::attack() {
if (_objectInfo[o][4] == 1)
_objectMap[lx][ly - 1] = 3;
eventText("Found the Entropy Shield!");
- _objmapf[4][1][2] = 1;
+ _objectMapFull[4][1][2] = 1;
return;
}
break;
@@ -384,7 +384,7 @@ void GriffonEngine::attack() {
if (_objectInfo[o][4] == 1)
_objectMap[lx][ly - 1] = 3;
eventText("Found the Rubyscale Armour!");
- _objmapf[4][1][2] = 1;
+ _objectMapFull[4][1][2] = 1;
return;
}
break;
@@ -393,12 +393,12 @@ void GriffonEngine::attack() {
}
}
- attacking = true;
+ _attacking = true;
_player.attackFrame = 0;
- movingup = false;
- movingdown = false;
- movingleft = false;
- movingright = false;
+ _movingUp = false;
+ _movingDown = false;
+ _movingLeft = false;
+ _movingRight = false;
for (int i = 0; i <= 15; i++) {
for (int a = 0; a <= 3; a++) {
@@ -411,12 +411,12 @@ void GriffonEngine::castSpell(int spellnum, float homex, float homey, float enem
// spellnum 7 = sprite 6 spitfire
for (int i = 0; i < kMaxSpell; i++) {
- if (ABS(spellinfo[i].frame) < kEpsilon) {
- spellinfo[i].homex = homex;
- spellinfo[i].homey = homey;
- spellinfo[i].enemyx = enemyx;
- spellinfo[i].enemyy = enemyy;
- spellinfo[i].spellnum = spellnum;
+ if (ABS(_spellInfo[i].frame) < kEpsilon) {
+ _spellInfo[i].homex = homex;
+ _spellInfo[i].homey = homey;
+ _spellInfo[i].enemyx = enemyx;
+ _spellInfo[i].enemyy = enemyy;
+ _spellInfo[i].spellnum = spellnum;
int dw = 0;
int npc = 0;
if (damagewho > 0) {
@@ -424,14 +424,14 @@ void GriffonEngine::castSpell(int spellnum, float homex, float homey, float enem
npc = damagewho;
}
- spellinfo[i].damagewho = dw;
- spellinfo[i].npc = npc;
+ _spellInfo[i].damagewho = dw;
+ _spellInfo[i].npc = npc;
- spellinfo[i].frame = 32.0f;
+ _spellInfo[i].frame = 32.0f;
if (damagewho == 0) {
- spellinfo[i].strength = _player.spellStrength / 100;
+ _spellInfo[i].strength = _player.spellStrength / 100;
if (ABS(_player.spellStrength - 100) < kEpsilon)
- spellinfo[i].strength = 1.5f;
+ _spellInfo[i].strength = 1.5f;
}
switch(spellnum) {
@@ -444,15 +444,15 @@ void GriffonEngine::castSpell(int spellnum, float homex, float homey, float enem
case 2:
// set earthslide vars
for (int f = 0; f <= 8; f++) {
- spellinfo[i].rocky[f] = 0;
- spellinfo[i].rockimg[f] = (int)(RND() * 4);
- spellinfo[i].rockdeflect[f] = ((int)(RND() * 128) - 64) * 1.5;
+ _spellInfo[i].rocky[f] = 0;
+ _spellInfo[i].rockimg[f] = (int)(RND() * 4);
+ _spellInfo[i].rockdeflect[f] = ((int)(RND() * 128) - 64) * 1.5;
}
break;
case 3:
// set fire vars
for (int f = 0; f <= 4; f++)
- spellinfo[i].legalive[f] = 32;
+ _spellInfo[i].legalive[f] = 32;
break;
case 5:
@@ -470,17 +470,17 @@ void GriffonEngine::castSpell(int spellnum, float homex, float homey, float enem
int ax = x * 16;
int ay = y * 16;
- spellinfo[i].fireballs[nballs][0] = ax;
- spellinfo[i].fireballs[nballs][1] = ay;
- spellinfo[i].fireballs[nballs][2] = 0;
- spellinfo[i].fireballs[nballs][3] = 0;
+ _spellInfo[i].fireballs[nballs][0] = ax;
+ _spellInfo[i].fireballs[nballs][1] = ay;
+ _spellInfo[i].fireballs[nballs][2] = 0;
+ _spellInfo[i].fireballs[nballs][3] = 0;
- spellinfo[i].ballon[nballs] = 1;
+ _spellInfo[i].ballon[nballs] = 1;
++nballs;
}
}
}
- spellinfo[i].nfballs = nballs;
+ _spellInfo[i].nfballs = nballs;
}
break;
case 8:
@@ -500,11 +500,11 @@ void GriffonEngine::castSpell(int spellnum, float homex, float homey, float enem
}
void GriffonEngine::checkHit() {
- if (attacking) {
- for (int i = 1; i <= _lastnpc; i++) {
- if (_npcinfo[i].hp > 0 && _npcinfo[i].pause < _ticks && (int)(RND() * 2) == 0) {
- float npx = _npcinfo[i].x;
- float npy = _npcinfo[i].y;
+ if (_attacking) {
+ for (int i = 1; i <= _lastNpc; i++) {
+ if (_npcInfo[i].hp > 0 && _npcInfo[i].pause < _ticks && (int)(RND() * 2) == 0) {
+ float npx = _npcInfo[i].x;
+ float npy = _npcInfo[i].y;
float xdif = _player.px - npx;
float ydif = _player.py - npy;
@@ -563,47 +563,47 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
damage = abs(damage);
if (heal == 0) {
- if (damage > _npcinfo[npcnum].hp) {
- ratio = (damage - _npcinfo[npcnum].hp) * 100 / damage;
- damage = _npcinfo[npcnum].hp;
+ if (damage > _npcInfo[npcnum].hp) {
+ ratio = (damage - _npcInfo[npcnum].hp) * 100 / damage;
+ damage = _npcInfo[npcnum].hp;
}
- _npcinfo[npcnum].hp -= damage;
- if (_npcinfo[npcnum].hp < 0)
- _npcinfo[npcnum].hp = 0;
+ _npcInfo[npcnum].hp -= damage;
+ if (_npcInfo[npcnum].hp < 0)
+ _npcInfo[npcnum].hp = 0;
sprintf(line, "-%i", damage);
fcol = 1;
} else {
- _npcinfo[npcnum].hp += damage;
- if (_npcinfo[npcnum].hp > _npcinfo[npcnum].maxhp)
- _npcinfo[npcnum].hp = _npcinfo[npcnum].maxhp;
+ _npcInfo[npcnum].hp += damage;
+ if (_npcInfo[npcnum].hp > _npcInfo[npcnum].maxhp)
+ _npcInfo[npcnum].hp = _npcInfo[npcnum].maxhp;
sprintf(line, "+%i", damage);
fcol = 5;
}
- _npcinfo[npcnum].pause = _ticks + 900;
+ _npcInfo[npcnum].pause = _ticks + 900;
if (spell == 0)
_player.attackStrength = ratio;
}
- addFloatText(line, _npcinfo[npcnum].x + 12 - 4 * strlen(line), _npcinfo[npcnum].y + 16, fcol);
+ addFloatText(line, _npcInfo[npcnum].x + 12 - 4 * strlen(line), _npcInfo[npcnum].y + 16, fcol);
- if (_npcinfo[npcnum].spriteset == kMonsterBatKitty)
- castSpell(9, _npcinfo[npcnum].x, _npcinfo[npcnum].y, _player.px, _player.py, npcnum);
+ if (_npcInfo[npcnum].spriteset == kMonsterBatKitty)
+ castSpell(9, _npcInfo[npcnum].x, _npcInfo[npcnum].y, _player.px, _player.py, npcnum);
// if enemy is killed
- if (_npcinfo[npcnum].hp == 0) {
- _player.exp += _npcinfo[npcnum].maxhp;
+ if (_npcInfo[npcnum].hp == 0) {
+ _player.exp += _npcInfo[npcnum].maxhp;
- if (_npcinfo[npcnum].spriteset == kMonsterBabyDragon || _npcinfo[npcnum].spriteset == kMonsterPriest ||
- _npcinfo[npcnum].spriteset == kMonsterRedDragon) {
+ if (_npcInfo[npcnum].spriteset == kMonsterBabyDragon || _npcInfo[npcnum].spriteset == kMonsterPriest ||
+ _npcInfo[npcnum].spriteset == kMonsterRedDragon) {
int ff = (int)(RND() * _player.level * 3);
if (ff == 0) {
- float npx = _npcinfo[npcnum].x + 12;
- float npy = _npcinfo[npcnum].y + 20;
+ float npx = _npcInfo[npcnum].x + 12;
+ float npy = _npcInfo[npcnum].y + 20;
int lx = (int)npx / 16;
int ly = (int)npy / 16;
@@ -613,12 +613,12 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
}
}
- if (_npcinfo[npcnum].spriteset == kMonsterOneWing || _npcinfo[npcnum].spriteset == kMonsterTwoWing ||
- _npcinfo[npcnum].spriteset == kMonsterBlackKnight || _npcinfo[npcnum].spriteset == kMonsterFireHydra) {
+ if (_npcInfo[npcnum].spriteset == kMonsterOneWing || _npcInfo[npcnum].spriteset == kMonsterTwoWing ||
+ _npcInfo[npcnum].spriteset == kMonsterBlackKnight || _npcInfo[npcnum].spriteset == kMonsterFireHydra) {
int ff = (int)(RND() * _player.level);
if (ff == 0) {
- float npx = _npcinfo[npcnum].x + 12;
- float npy = _npcinfo[npcnum].y + 20;
+ float npx = _npcInfo[npcnum].x + 12;
+ float npy = _npcInfo[npcnum].y + 20;
int lx = (int)npx / 16;
int ly = (int)npy / 16;
@@ -628,12 +628,12 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
}
}
- if (_npcinfo[npcnum].spriteset == kMonsterTwoWing || _npcinfo[npcnum].spriteset == kMonsterDragon2 ||
- _npcinfo[npcnum].spriteset == kMonsterFireHydra) {
+ if (_npcInfo[npcnum].spriteset == kMonsterTwoWing || _npcInfo[npcnum].spriteset == kMonsterDragon2 ||
+ _npcInfo[npcnum].spriteset == kMonsterFireHydra) {
int ff = (int)(RND() * _player.level * 2);
if (ff == 0) {
- float npx = _npcinfo[npcnum].x + 12;
- float npy = _npcinfo[npcnum].y + 20;
+ float npx = _npcInfo[npcnum].x + 12;
+ float npy = _npcInfo[npcnum].y + 20;
int lx = (int)npx / 16;
int ly = (int)npy / 16;
@@ -644,10 +644,10 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
}
// academy master key chest script
- if (_npcinfo[npcnum].script == kScriptMasterKey) {
+ if (_npcInfo[npcnum].script == kScriptMasterKey) {
bool alive = false;
- for (int i = 1; i <= _lastnpc; i++) {
- if (_npcinfo[i].hp > 0)
+ for (int i = 1; i <= _lastNpc; i++) {
+ if (_npcInfo[i].hp > 0)
alive = true;
}
@@ -676,10 +676,10 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
}
// academy crystal chest script
- if (_npcinfo[npcnum].script == kScriptFindCrystal) {
+ if (_npcInfo[npcnum].script == kScriptFindCrystal) {
bool alive = false;
- for (int i = 1; i <= _lastnpc; i++) {
- if (_npcinfo[i].hp > 0)
+ for (int i = 1; i <= _lastNpc; i++) {
+ if (_npcInfo[i].hp > 0)
alive = true;
}
@@ -708,8 +708,8 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
}
// tower shield chest script
- if (_npcinfo[npcnum].script == kScriptFindShield && _scriptFlag[kScriptFindShield][0] == 0) {
- _triggerloc[9][7] = 5004;
+ if (_npcInfo[npcnum].script == kScriptFindShield && _scriptFlag[kScriptFindShield][0] == 0) {
+ _triggerLoc[9][7] = 5004;
int curTile = 40;
int curTileL = 0;
@@ -734,10 +734,10 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
}
// firehydra sword chest
- if (_npcinfo[npcnum].script == kScriptFindSword) {
+ if (_npcInfo[npcnum].script == kScriptFindSword) {
bool alive = false;
- for (int i = 1; i <= _lastnpc; i++) {
- if (_npcinfo[i].hp > 0)
+ for (int i = 1; i <= _lastNpc; i++) {
+ if (_npcInfo[i].hp > 0)
alive = true;
}
@@ -767,10 +767,10 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
}
// gardens master key script
- if (_npcinfo[npcnum].script == kScriptGardenMasterKey && _scriptFlag[kScriptKeyChest][0] == 0) {
+ if (_npcInfo[npcnum].script == kScriptGardenMasterKey && _scriptFlag[kScriptKeyChest][0] == 0) {
bool alive = false;
- for (int i = 1; i <= _lastnpc; i++) {
- if (_npcinfo[i].hp > 0)
+ for (int i = 1; i <= _lastNpc; i++) {
+ if (_npcInfo[i].hp > 0)
alive = true;
}
@@ -800,10 +800,10 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
// regular key chest 1
for (int s = 20; s <= 23; s++) {
- if (_npcinfo[npcnum].script == s && _scriptFlag[s][0] < 2) {
+ if (_npcInfo[npcnum].script == s && _scriptFlag[s][0] < 2) {
bool alive = false;
- for (int i = 1; i <= _lastnpc; i++) {
- if (_npcinfo[i].hp > 0)
+ for (int i = 1; i <= _lastNpc; i++) {
+ if (_npcInfo[i].hp > 0)
alive = true;
}
@@ -833,10 +833,10 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
}
// pickup lightning bomb
- if (_npcinfo[npcnum].script == kScriptLightningBomb && (_curMap == 41 && _scriptFlag[kScriptLightningBomb][1] == 0)) {
+ if (_npcInfo[npcnum].script == kScriptLightningBomb && (_curMap == 41 && _scriptFlag[kScriptLightningBomb][1] == 0)) {
bool alive = false;
- for (int i = 1; i <= _lastnpc; i++) {
- if (_npcinfo[i].hp > 0)
+ for (int i = 1; i <= _lastNpc; i++) {
+ if (_npcInfo[i].hp > 0)
alive = true;
}
@@ -863,10 +863,10 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
}
// citadel armour chest
- if (_npcinfo[npcnum].script == kScriptArmourChest) {
+ if (_npcInfo[npcnum].script == kScriptArmourChest) {
bool alive = false;
- for (int i = 1; i <= _lastnpc; i++) {
- if (_npcinfo[i].hp > 0)
+ for (int i = 1; i <= _lastNpc; i++) {
+ if (_npcInfo[i].hp > 0)
alive = true;
}
@@ -895,10 +895,10 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
}
// citadel master key script
- if (_npcinfo[npcnum].script == kScriptCitadelMasterKey && _scriptFlag[kScriptCitadelMasterKey][0] == 0) {
+ if (_npcInfo[npcnum].script == kScriptCitadelMasterKey && _scriptFlag[kScriptCitadelMasterKey][0] == 0) {
bool alive = false;
- for (int i = 1; i <= _lastnpc; i++) {
- if (_npcinfo[i].hp > 0)
+ for (int i = 1; i <= _lastNpc; i++) {
+ if (_npcInfo[i].hp > 0)
alive = true;
}
@@ -927,10 +927,10 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
}
// max ups
- if (_npcinfo[npcnum].script == kScriptGetSword3 && _scriptFlag[kScriptGetSword3][0] == 0) {
+ if (_npcInfo[npcnum].script == kScriptGetSword3 && _scriptFlag[kScriptGetSword3][0] == 0) {
bool alive = false;
- for (int i = 1; i <= _lastnpc; i++) {
- if (_npcinfo[i].hp > 0)
+ for (int i = 1; i <= _lastNpc; i++) {
+ if (_npcInfo[i].hp > 0)
alive = true;
}
@@ -1001,7 +1001,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
}
}
- if (_npcinfo[npcnum].script == kScriptEndOfGame)
+ if (_npcInfo[npcnum].script == kScriptEndOfGame)
endOfGame();
}
}
diff --git a/engines/griffon/cutscenes.cpp b/engines/griffon/cutscenes.cpp
index ce58ad9..994fcad 100644
--- a/engines/griffon/cutscenes.cpp
+++ b/engines/griffon/cutscenes.cpp
@@ -495,8 +495,8 @@ void GriffonEngine::endOfGame() {
void GriffonEngine::theEnd() {
for (int i = 0; i < kMaxFloat; i++) {
- _floattext[i][0] = 0;
- _floaticon[i][0] = 0;
+ _floatText[i][0] = 0;
+ _floatIcon[i][0] = 0;
}
for (float y = 0; y < 100; y += _fpsr) {
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 959cdfe..7d09d0e 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -264,23 +264,23 @@ void GriffonEngine::configMenu() {
do {
_videoBuffer->fillRect(Common::Rect(0, 0, _videoBuffer->w, _videoBuffer->h), 0);
- rcDest.left = 256 + 256 * cos(PI / 180 * clouddeg * 40);
- rcDest.top = 192 + 192 * sin(PI / 180 * clouddeg * 40);
+ rcDest.left = 256 + 256 * cos(PI / 180 * _cloudAngle * 40);
+ rcDest.top = 192 + 192 * sin(PI / 180 * _cloudAngle * 40);
rcDest.setWidth(320);
rcDest.setHeight(240);
- cloudimg->setAlpha(128, true);
- cloudimg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
- cloudimg->setAlpha(64, true);
+ _cloudImg->setAlpha(128, true);
+ _cloudImg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
+ _cloudImg->setAlpha(64, true);
rcDest.left = 256;
rcDest.top = 192;
rcDest.setWidth(320);
rcDest.setHeight(240);
- cloudimg->setAlpha(128, true);
- cloudimg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
- cloudimg->setAlpha(64, true);
+ _cloudImg->setAlpha(128, true);
+ _cloudImg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
+ _cloudImg->setAlpha(64, true);
_videoBuffer->copyRectToSurface(configwindow->getPixels(), configwindow->pitch, 0, 0, configwindow->w, configwindow->h);
@@ -457,9 +457,9 @@ void GriffonEngine::configMenu() {
}
}
- clouddeg += 0.01 * _fpsr;
- while (clouddeg >= 360)
- clouddeg -= 360;
+ _cloudAngle += 0.01 * _fpsr;
+ while (_cloudAngle >= 360)
+ _cloudAngle -= 360;
g_system->delayMillis(10);
} while (!_shouldQuit && !exitMenu);
@@ -467,13 +467,13 @@ void GriffonEngine::configMenu() {
configwindow->free();
_itemTicks = _ticks + 210;
- cloudimg->setAlpha(64, true);
+ _cloudImg->setAlpha(64, true);
}
void GriffonEngine::saveLoadNew() {
float y = 0.0;
- clouddeg = 0;
+ _cloudAngle = 0;
_videoBuffer->setAlpha(255);
_saveLoadImg->setAlpha(192, true);
@@ -491,23 +491,23 @@ void GriffonEngine::saveLoadNew() {
y += 1 * _fpsr;
- rcDest.left = 256 + 256 * cos(PI / 180 * clouddeg * 40);
- rcDest.top = 192 + 192 * sin(PI / 180 * clouddeg * 40);
+ rcDest.left = 256 + 256 * cos(PI / 180 * _cloudAngle * 40);
+ rcDest.top = 192 + 192 * sin(PI / 180 * _cloudAngle * 40);
rcDest.setWidth(320);
rcDest.setHeight(240);
- cloudimg->setAlpha(128, true);
- cloudimg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
- cloudimg->setAlpha(64, true);
+ _cloudImg->setAlpha(128, true);
+ _cloudImg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
+ _cloudImg->setAlpha(64, true);
rcDest.left = 256;
rcDest.top = 192;
rcDest.setWidth(320);
rcDest.setHeight(240);
- cloudimg->setAlpha(128, true);
- cloudimg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
- cloudimg->setAlpha(64, true);
+ _cloudImg->setAlpha(128, true);
+ _cloudImg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
+ _cloudImg->setAlpha(64, true);
_saveLoadImg->blit(*_videoBuffer);
@@ -565,7 +565,7 @@ void GriffonEngine::saveLoadNew() {
if (loadState(currow - 1)) {
_player.walkSpeed = 1.1f;
_animSpeed = 0.5f;
- attacking = false;
+ _attacking = false;
_player.attackSpeed = 1.5f;
_playingGardens = false;
@@ -773,9 +773,9 @@ void GriffonEngine::saveLoadNew() {
_fp = 0;
}
- clouddeg += 0.01 * _fpsr;
- while (clouddeg >= 360)
- clouddeg -= 360;
+ _cloudAngle += 0.01 * _fpsr;
+ while (_cloudAngle >= 360)
+ _cloudAngle -= 360;
_itemyloc += 0.6 * _fpsr;
while (_itemyloc >= 16)
@@ -784,7 +784,7 @@ void GriffonEngine::saveLoadNew() {
g_system->delayMillis(10);
} while (!_shouldQuit);
- cloudimg->setAlpha(64, true);
+ _cloudImg->setAlpha(64, true);
}
diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp
index 0710e89..70fb073 100644
--- a/engines/griffon/draw.cpp
+++ b/engines/griffon/draw.cpp
@@ -189,8 +189,8 @@ void GriffonEngine::drawHud() {
game_fillrect(_videoBuffer2, 0, 0, 320, 240, 0);
for (int i = 0; i < kMaxFloat; i++) {
- if (_floattext[i][0] > 0) {
- int fc = (int)_floattext[i][3];
+ if (_floatText[i][0] > 0) {
+ int fc = (int)_floatText[i][3];
int c = fc, c2 = 3;
if (fc == 4)
@@ -201,19 +201,19 @@ void GriffonEngine::drawHud() {
c2 = 2;
if (fc != 0) {
- drawString(_videoBuffer, _floatstri[i], (int)(_floattext[i][1]) + 0, (int)(_floattext[i][2]) - 1, c2);
- drawString(_videoBuffer, _floatstri[i], (int)(_floattext[i][1]) + 0, (int)(_floattext[i][2]) + 1, c2);
- drawString(_videoBuffer, _floatstri[i], (int)(_floattext[i][1]) - 1, (int)(_floattext[i][2]) + 0, c2);
- drawString(_videoBuffer, _floatstri[i], (int)(_floattext[i][1]) + 1, (int)(_floattext[i][2]) + 0, c2);
+ drawString(_videoBuffer, _floatStr[i], (int)(_floatText[i][1]) + 0, (int)(_floatText[i][2]) - 1, c2);
+ drawString(_videoBuffer, _floatStr[i], (int)(_floatText[i][1]) + 0, (int)(_floatText[i][2]) + 1, c2);
+ drawString(_videoBuffer, _floatStr[i], (int)(_floatText[i][1]) - 1, (int)(_floatText[i][2]) + 0, c2);
+ drawString(_videoBuffer, _floatStr[i], (int)(_floatText[i][1]) + 1, (int)(_floatText[i][2]) + 0, c2);
}
- drawString(_videoBuffer, _floatstri[i], (int)(_floattext[i][1]), (int)(_floattext[i][2]), c);
+ drawString(_videoBuffer, _floatStr[i], (int)(_floatText[i][1]), (int)(_floatText[i][2]), c);
}
- if (_floaticon[i][0] > 0) {
- int ico = _floaticon[i][3];
- int ix = _floaticon[i][1];
- int iy = _floaticon[i][2];
+ if (_floatIcon[i][0] > 0) {
+ int ico = _floatIcon[i][3];
+ int ix = _floatIcon[i][1];
+ int iy = _floatIcon[i][2];
rcDest.left = ix;
rcDest.top = iy;
@@ -425,13 +425,13 @@ void GriffonEngine::drawHud() {
}
if (_selEnemyOn) {
- if (_curEnemy > _lastnpc) {
- int pst = _curEnemy - _lastnpc - 1;
+ if (_curEnemy > _lastNpc) {
+ int pst = _curEnemy - _lastNpc - 1;
rcDest.left = _postInfo[pst][0];
rcDest.top = (float)(_postInfo[pst][1] - 4 - sin(3.141592 / 8 * _itemyloc));
} else {
- rcDest.left = _npcinfo[_curEnemy].x + 4;
- rcDest.top = (float)(_npcinfo[_curEnemy].y + 4 - 16 - sin(3.141592 / 8 * _itemyloc));
+ rcDest.left = _npcInfo[_curEnemy].x + 4;
+ rcDest.top = (float)(_npcInfo[_curEnemy].y + 4 - 16 - sin(3.141592 / 8 * _itemyloc));
}
_itemImg[13]->blit(*_videoBuffer, rcDest.left, rcDest.top);
@@ -453,20 +453,20 @@ void GriffonEngine::drawNPCs(int mode) {
if (_ysort[yy] > 0) {
int i = _ysort[yy];
- if (_npcinfo[i].hp > 0) {
- int npx = (int)(_npcinfo[i].x);
- int npy = (int)(_npcinfo[i].y);
+ if (_npcInfo[i].hp > 0) {
+ int npx = (int)(_npcInfo[i].x);
+ int npy = (int)(_npcInfo[i].y);
- int sprite = _npcinfo[i].spriteset;
+ int sprite = _npcInfo[i].spriteset;
- int wdir = _npcinfo[i].walkdir;
+ int wdir = _npcInfo[i].walkdir;
// spriteset1 specific
- if (_npcinfo[i].spriteset == kMonsterBabyDragon) {
+ if (_npcInfo[i].spriteset == kMonsterBabyDragon) {
- if (!_npcinfo[i].attacking) {
+ if (!_npcInfo[i].attacking) {
- int cframe = _npcinfo[i].cframe;
+ int cframe = _npcInfo[i].cframe;
rcSrc.left = (int)(cframe / 4) * 24;
rcSrc.top = wdir * 24;
@@ -478,15 +478,15 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.setWidth(24);
rcDest.setHeight(24);
- if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
- _npcinfo[i].shake = _ticks + 50;
+ if (_npcInfo[i].pause > _ticks && _npcInfo[i].shake < _ticks) {
+ _npcInfo[i].shake = _ticks + 50;
rcDest.left += (int)(RND() * 3) - 1;
rcDest.top += (int)(RND() * 3) - 1;
}
_anims[sprite]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
- int cframe = _npcinfo[i].cattackframe;
+ int cframe = _npcInfo[i].cattackframe;
rcSrc.left = (int)(cframe / 4) * 24;
rcSrc.top = wdir * 24;
@@ -504,16 +504,16 @@ void GriffonEngine::drawNPCs(int mode) {
}
// onewing
- if (_npcinfo[i].spriteset == kMonsterOneWing) {
+ if (_npcInfo[i].spriteset == kMonsterOneWing) {
for (int f = 0; f < 7; f++) {
- int s = _npcinfo[i].bodysection[f].sprite;
- rcSrc.left = _animset2[s].x;
- rcSrc.top = _animset2[s].y;
- rcSrc.setWidth(_animset2[s].w);
- rcSrc.setHeight(_animset2[s].h);
+ int s = _npcInfo[i].bodysection[f].sprite;
+ rcSrc.left = _animSet2[s].x;
+ rcSrc.top = _animSet2[s].y;
+ rcSrc.setWidth(_animSet2[s].w);
+ rcSrc.setHeight(_animSet2[s].h);
- rcDest.left = _npcinfo[i].bodysection[f].x - _animset2[s].xofs;
- rcDest.top = _npcinfo[i].bodysection[f].y - _animset2[s].yofs + 2;
+ rcDest.left = _npcInfo[i].bodysection[f].x - _animSet2[s].xofs;
+ rcDest.top = _npcInfo[i].bodysection[f].y - _animSet2[s].yofs + 2;
_anims[2]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
@@ -521,20 +521,20 @@ void GriffonEngine::drawNPCs(int mode) {
}
// twowing
- if (_npcinfo[i].spriteset == kMonsterTwoWing) {
+ if (_npcInfo[i].spriteset == kMonsterTwoWing) {
for (int f = 0; f < 7; f++) {
int yp = 0;
if (f == 0 && (_curMap == 53 || _curMap == 57 || _curMap == 61 || _curMap == 65 || _curMap == 56 || _curMap > 66) && _scriptFlag[kScriptLever][0] > 0)
yp = 16;
- int s = _npcinfo[i].bodysection[f].sprite;
- rcSrc.left = _animset9[s].x;
- rcSrc.top = _animset9[s].y + yp;
- rcSrc.setWidth(_animset9[s].w);
- rcSrc.setHeight(_animset9[s].h);
+ int s = _npcInfo[i].bodysection[f].sprite;
+ rcSrc.left = _animSet9[s].x;
+ rcSrc.top = _animSet9[s].y + yp;
+ rcSrc.setWidth(_animSet9[s].w);
+ rcSrc.setHeight(_animSet9[s].h);
- rcDest.left = _npcinfo[i].bodysection[f].x - _animset9[s].xofs;
- rcDest.top = _npcinfo[i].bodysection[f].y - _animset9[s].yofs + 2;
+ rcDest.left = _npcInfo[i].bodysection[f].x - _animSet9[s].xofs;
+ rcDest.top = _npcInfo[i].bodysection[f].y - _animSet9[s].yofs + 2;
_anims[9]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
@@ -543,9 +543,9 @@ void GriffonEngine::drawNPCs(int mode) {
// boss 1
- if (_npcinfo[i].spriteset == kMonsterBoss1) {
- if (!_npcinfo[i].attacking) {
- int cframe = _npcinfo[i].cframe;
+ if (_npcInfo[i].spriteset == kMonsterBoss1) {
+ if (!_npcInfo[i].attacking) {
+ int cframe = _npcInfo[i].cframe;
rcSrc.left = (int)(cframe / 4) * 24;
} else {
rcSrc.left = 4 * 24;
@@ -563,9 +563,9 @@ void GriffonEngine::drawNPCs(int mode) {
}
// black knight
- if (_npcinfo[i].spriteset == kMonsterBlackKnight) {
- if (!_npcinfo[i].attacking) {
- int cframe = _npcinfo[i].cframe;
+ if (_npcInfo[i].spriteset == kMonsterBlackKnight) {
+ if (!_npcInfo[i].attacking) {
+ int cframe = _npcInfo[i].cframe;
rcSrc.left = (int)(cframe / 4) * 24;
} else {
rcSrc.left = 4 * 24;
@@ -582,16 +582,16 @@ void GriffonEngine::drawNPCs(int mode) {
// firehydra
- if (_npcinfo[i].spriteset == kMonsterFireHydra) {
+ if (_npcInfo[i].spriteset == kMonsterFireHydra) {
for (int ff = 0; ff <= 2; ff++) {
- if (_npcinfo[i].hp > 10 * ff * 20) {
+ if (_npcInfo[i].hp > 10 * ff * 20) {
rcSrc.left = 16 * (int)(RND() * 2);
rcSrc.top = 80;
rcSrc.setWidth(16);
rcSrc.setHeight(16);
- rcDest.left = _npcinfo[i].bodysection[10 * ff].x - 8;
- rcDest.top = _npcinfo[i].bodysection[10 * ff].y - 8;
+ rcDest.left = _npcInfo[i].bodysection[10 * ff].x - 8;
+ rcDest.top = _npcInfo[i].bodysection[10 * ff].y - 8;
int x = 192 + ((int)(_itemyloc + ff * 5) % 3) * 64;
if (x > 255)
@@ -606,8 +606,8 @@ void GriffonEngine::drawNPCs(int mode) {
rcSrc.setWidth(16);
rcSrc.setHeight(16);
- rcDest.left = _npcinfo[i].bodysection[ff * 10 + f].x - 8 + (int)(RND() * 3) - 1;
- rcDest.top = _npcinfo[i].bodysection[ff * 10 + f].y - 8 + (int)(RND() * 3) - 1;
+ rcDest.left = _npcInfo[i].bodysection[ff * 10 + f].x - 8 + (int)(RND() * 3) - 1;
+ rcDest.top = _npcInfo[i].bodysection[ff * 10 + f].y - 8 + (int)(RND() * 3) - 1;
x = 192 + f % 3 * 64;
if (x > 255)
@@ -622,8 +622,8 @@ void GriffonEngine::drawNPCs(int mode) {
rcSrc.setWidth(42);
rcSrc.setHeight(36);
- rcDest.left = _npcinfo[i].bodysection[10 * ff + 9].x - 21;
- rcDest.top = _npcinfo[i].bodysection[10 * ff + 9].y - 21;
+ rcDest.left = _npcInfo[i].bodysection[10 * ff + 9].x - 21;
+ rcDest.top = _npcInfo[i].bodysection[10 * ff + 9].y - 21;
_spellImg->setAlpha(192, true);
_anims[5]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
@@ -635,8 +635,8 @@ void GriffonEngine::drawNPCs(int mode) {
}
// red dragon
- if (_npcinfo[i].spriteset == kMonsterRedDragon) {
- int cframe = _npcinfo[i].cframe;
+ if (_npcInfo[i].spriteset == kMonsterRedDragon) {
+ int cframe = _npcInfo[i].cframe;
rcSrc.left = (int)(cframe / 4) * 24;
rcSrc.top = wdir * 24;
@@ -648,8 +648,8 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.setWidth(24);
rcDest.setHeight(24);
- if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
- _npcinfo[i].shake = _ticks + 50;
+ if (_npcInfo[i].pause > _ticks && _npcInfo[i].shake < _ticks) {
+ _npcInfo[i].shake = _ticks + 50;
rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
@@ -658,9 +658,9 @@ void GriffonEngine::drawNPCs(int mode) {
}
// wizard
- if (_npcinfo[i].spriteset == kMonsterPriest) {
+ if (_npcInfo[i].spriteset == kMonsterPriest) {
// if(_npcinfo[i].attacking == 0) {
- int cframe = _npcinfo[i].cframe;
+ int cframe = _npcInfo[i].cframe;
rcSrc.left = (int)(cframe / 4) * 24;
rcSrc.top = wdir * 24;
@@ -672,8 +672,8 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.setWidth(24);
rcDest.setHeight(24);
- if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
- _npcinfo[i].shake = _ticks + 50;
+ if (_npcInfo[i].pause > _ticks && _npcInfo[i].shake < _ticks) {
+ _npcInfo[i].shake = _ticks + 50;
rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
@@ -696,8 +696,8 @@ void GriffonEngine::drawNPCs(int mode) {
// yellow dragon
- if (_npcinfo[i].spriteset == kMonsterYellowDragon) {
- int cframe = _npcinfo[i].cframe;
+ if (_npcInfo[i].spriteset == kMonsterYellowDragon) {
+ int cframe = _npcInfo[i].cframe;
rcSrc.left = (int)(cframe / 4) * 24;
rcSrc.top = wdir * 24;
@@ -709,8 +709,8 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.setWidth(24);
rcDest.setHeight(24);
- if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
- _npcinfo[i].shake = _ticks + 50;
+ if (_npcInfo[i].pause > _ticks && _npcInfo[i].shake < _ticks) {
+ _npcInfo[i].shake = _ticks + 50;
rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
@@ -719,13 +719,13 @@ void GriffonEngine::drawNPCs(int mode) {
// dragon2
- if (_npcinfo[i].spriteset == kMonsterDragon2) {
- if (!_npcinfo[i].attacking) {
- _npcinfo[i].floating = _npcinfo[i].floating + 0.25 * _fpsr;
- while (_npcinfo[i].floating >= 16)
- _npcinfo[i].floating = _npcinfo[i].floating - 16;
+ if (_npcInfo[i].spriteset == kMonsterDragon2) {
+ if (!_npcInfo[i].attacking) {
+ _npcInfo[i].floating = _npcInfo[i].floating + 0.25 * _fpsr;
+ while (_npcInfo[i].floating >= 16)
+ _npcInfo[i].floating = _npcInfo[i].floating - 16;
- float frame = _npcinfo[i].frame;
+ float frame = _npcInfo[i].frame;
frame += 0.5 * _fpsr;
while (frame >= 16)
@@ -735,8 +735,8 @@ void GriffonEngine::drawNPCs(int mode) {
if (cframe < 0)
cframe = 0;
- _npcinfo[i].frame = frame;
- _npcinfo[i].cframe = cframe;
+ _npcInfo[i].frame = frame;
+ _npcInfo[i].cframe = cframe;
rcSrc.left = 74 * wdir;
rcSrc.top = (int)(cframe / 4) * 48;
@@ -744,23 +744,23 @@ void GriffonEngine::drawNPCs(int mode) {
rcSrc.setHeight(48);
rcDest.left = npx + 12 - 37;
- rcDest.top = (float)(npy + 12 - 32 - 3 * sin(3.141592 * 2 * _npcinfo[i].floating / 16));
+ rcDest.top = (float)(npy + 12 - 32 - 3 * sin(3.141592 * 2 * _npcInfo[i].floating / 16));
rcDest.setWidth(24);
rcDest.setHeight(24);
- if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
- _npcinfo[i].shake = _ticks + 50;
+ if (_npcInfo[i].pause > _ticks && _npcInfo[i].shake < _ticks) {
+ _npcInfo[i].shake = _ticks + 50;
rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
_anims[sprite]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
- _npcinfo[i].floating = _npcinfo[i].floating + 0.25 * _fpsr;
- while (_npcinfo[i].floating >= 16)
- _npcinfo[i].floating = _npcinfo[i].floating - 16;
+ _npcInfo[i].floating = _npcInfo[i].floating + 0.25 * _fpsr;
+ while (_npcInfo[i].floating >= 16)
+ _npcInfo[i].floating = _npcInfo[i].floating - 16;
- int cframe = _npcinfo[i].cattackframe;
+ int cframe = _npcInfo[i].cattackframe;
rcSrc.left = 74 * wdir;
rcSrc.top = (int)(cframe / 4) * 48;
@@ -768,7 +768,7 @@ void GriffonEngine::drawNPCs(int mode) {
rcSrc.setHeight(48);
rcDest.left = npx + 12 - 37;
- rcDest.top = (float)(npy + 12 - 32 - 3 * sin(3.141592 * 2 * _npcinfo[i].floating / 16));
+ rcDest.top = (float)(npy + 12 - 32 - 3 * sin(3.141592 * 2 * _npcInfo[i].floating / 16));
rcDest.setWidth(24);
rcDest.setHeight(24);
@@ -777,23 +777,23 @@ void GriffonEngine::drawNPCs(int mode) {
}
// end boss
- if (_npcinfo[i].spriteset == kMonsterFinalBoss) {
+ if (_npcInfo[i].spriteset == kMonsterFinalBoss) {
- _npcinfo[i].floating = _npcinfo[i].floating + .3 * _fpsr;
- while (_npcinfo[i].floating >= 16)
- _npcinfo[i].floating = _npcinfo[i].floating - 16;
+ _npcInfo[i].floating = _npcInfo[i].floating + .3 * _fpsr;
+ while (_npcInfo[i].floating >= 16)
+ _npcInfo[i].floating = _npcInfo[i].floating - 16;
- float frame = _npcinfo[i].frame2;
+ float frame = _npcInfo[i].frame2;
frame += 0.5 * _fpsr;
while (frame >= 16)
frame -= 16;
- _npcinfo[i].frame2 = frame;
+ _npcInfo[i].frame2 = frame;
int sx = npx + 12 - 40;
- int sy = (float)(npy + 12 - 50 - 3 * sin(3.141592 * 2 * _npcinfo[i].floating / 16));
+ int sy = (float)(npy + 12 - 50 - 3 * sin(3.141592 * 2 * _npcInfo[i].floating / 16));
for (int fr = 0; fr <= 3; fr++) {
_spellImg->setAlpha(128 + (int)(RND() * 96), true);
@@ -833,7 +833,7 @@ void GriffonEngine::drawNPCs(int mode) {
int ydif = (yloc + 8) - (_player.py + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
- float damage = (float)_npcinfo[i].spelldamage * (1.0 + RND() * 0.5);
+ float damage = (float)_npcInfo[i].spelldamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
damagePlayer(damage);
@@ -859,7 +859,7 @@ void GriffonEngine::drawNPCs(int mode) {
ydif = (yloc + 8) - (_player.py + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
- float damage = (float)_npcinfo[i].spelldamage * (1.0 + RND() * 0.5);
+ float damage = (float)_npcInfo[i].spelldamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
damagePlayer(damage);
@@ -874,7 +874,7 @@ void GriffonEngine::drawNPCs(int mode) {
_spellImg->setAlpha(255, true);
- if (!_npcinfo[i].attacking) {
+ if (!_npcInfo[i].attacking) {
int cframe = (int)(frame);
rcSrc.left = 0;
rcSrc.top = 72 * (int)(cframe / 4);
@@ -884,15 +884,15 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.left = sx;
rcDest.top = sy;
- if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
- _npcinfo[i].shake = _ticks + 50;
+ if (_npcInfo[i].pause > _ticks && _npcInfo[i].shake < _ticks) {
+ _npcInfo[i].shake = _ticks + 50;
rcDest.left = rcDest.top + (int)(RND() * 3) - 1;
rcDest.left = rcDest.top + (int)(RND() * 3) - 1;
}
_anims[sprite]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
} else {
- int cframe = (int)(_npcinfo[i].cattackframe);
+ int cframe = (int)(_npcInfo[i].cattackframe);
rcSrc.left = 0;
rcSrc.top = 72 * (int)(cframe / 4);
@@ -907,12 +907,12 @@ void GriffonEngine::drawNPCs(int mode) {
}
// bat kitty
- if (_npcinfo[i].spriteset == kMonsterBatKitty) {
- _npcinfo[i].floating = _npcinfo[i].floating + 1 * _fpsr;
- while (_npcinfo[i].floating >= 16)
- _npcinfo[i].floating = _npcinfo[i].floating - 16;
+ if (_npcInfo[i].spriteset == kMonsterBatKitty) {
+ _npcInfo[i].floating = _npcInfo[i].floating + 1 * _fpsr;
+ while (_npcInfo[i].floating >= 16)
+ _npcInfo[i].floating = _npcInfo[i].floating - 16;
- float frame = _npcinfo[i].frame;
+ float frame = _npcInfo[i].frame;
frame += 0.5 * _fpsr;
while (frame >= 16)
@@ -922,8 +922,8 @@ void GriffonEngine::drawNPCs(int mode) {
if (cframe < 0)
cframe = 0;
- _npcinfo[i].frame = frame;
- _npcinfo[i].cframe = cframe;
+ _npcInfo[i].frame = frame;
+ _npcInfo[i].cframe = cframe;
rcSrc.left = 0;
rcSrc.top = 0;
@@ -931,12 +931,12 @@ void GriffonEngine::drawNPCs(int mode) {
rcSrc.setHeight(80);
rcDest.left = npx + 12 - 50;
- rcDest.top = (float)(npy + 12 - 64 + 2 * sin(3.141592 * 2 * _npcinfo[i].floating / 16));
+ rcDest.top = (float)(npy + 12 - 64 + 2 * sin(3.141592 * 2 * _npcInfo[i].floating / 16));
rcDest.setWidth(99);
rcDest.setHeight(80);
- if (_npcinfo[i].pause > _ticks && _npcinfo[i].shake < _ticks) {
- _npcinfo[i].shake = _ticks + 50;
+ if (_npcInfo[i].pause > _ticks && _npcInfo[i].shake < _ticks) {
+ _npcInfo[i].shake = _ticks + 50;
rcDest.left = rcDest.left + (int)(RND() * 3) - 1;
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
@@ -955,7 +955,7 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.top = npy + 23;
- int ww = 14 * _npcinfo[i].hp / _npcinfo[i].maxhp;
+ int ww = 14 * _npcInfo[i].hp / _npcInfo[i].maxhp;
ww = CLIP(ww, 1, 14);
rcDest.setWidth(ww);
@@ -966,7 +966,7 @@ void GriffonEngine::drawNPCs(int mode) {
bool pass = true;
- if (_npcinfo[i].spriteset == kMonsterBoss1)
+ if (_npcInfo[i].spriteset == kMonsterBoss1)
pass = false;
if (pass)
@@ -1034,7 +1034,7 @@ void GriffonEngine::drawPlayer() {
if (_player.armour == 3)
f = 13;
- if (!attacking) {
+ if (!_attacking) {
rcSrc.left = (int)(_player.walkFrame / 4) * 24;
rcSrc.top = _player.walkDir * 24;
rcSrc.setWidth(24);
@@ -1148,12 +1148,12 @@ void GriffonEngine::drawView() {
if (_cloudsOn) {
Common::Rect rc;
- rc.left = (float)(256 + 256 * cos(3.141592 / 180 * clouddeg));
- rc.top = (float)(192 + 192 * sin(3.141592 / 180 * clouddeg));
+ rc.left = (float)(256 + 256 * cos(3.141592 / 180 * _cloudAngle));
+ rc.top = (float)(192 + 192 * sin(3.141592 / 180 * _cloudAngle));
rc.setWidth(320);
rc.setHeight(240);
- cloudimg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rc);
+ _cloudImg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rc);
}
drawHud();
@@ -1188,9 +1188,9 @@ void GriffonEngine::swash() {
_fp = 0;
}
- clouddeg += 0.01 * _fpsr;
- while (clouddeg >= 360)
- clouddeg = clouddeg - 360;
+ _cloudAngle += 0.01 * _fpsr;
+ while (_cloudAngle >= 360)
+ _cloudAngle = _cloudAngle - 360;
if (y > 10)
break;
@@ -1204,12 +1204,12 @@ void GriffonEngine::swash() {
_mapBg->blit(*_videoBuffer);
if (_cloudsOn) {
- rcDest.left = (float)(256 + 256 * cos(3.141592 / 180 * clouddeg));
- rcDest.top = (float)(192 + 192 * sin(3.141592 / 180 * clouddeg));
+ rcDest.left = (float)(256 + 256 * cos(3.141592 / 180 * _cloudAngle));
+ rcDest.top = (float)(192 + 192 * sin(3.141592 / 180 * _cloudAngle));
rcDest.setWidth(320);
rcDest.setHeight(240);
- cloudimg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
+ _cloudImg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
}
g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
@@ -1231,9 +1231,9 @@ void GriffonEngine::swash() {
_fp = 0;
}
- clouddeg += 0.01 * _fpsr;
- while (clouddeg >= 360)
- clouddeg -= 360;
+ _cloudAngle += 0.01 * _fpsr;
+ while (_cloudAngle >= 360)
+ _cloudAngle -= 360;
if (y > 10)
break;
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 9feca28..9aa1c1b 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -97,10 +97,10 @@ void GriffonEngine::updateEngine() {
_secsingame = _secsingame + 1;
}
- if (attacking) {
+ if (_attacking) {
_player.attackFrame += _player.attackSpeed * _fpsr;
if (_player.attackFrame >= 16) {
- attacking = false;
+ _attacking = false;
_player.attackFrame = 0;
_player.walkFrame = 0;
}
@@ -135,20 +135,20 @@ void GriffonEngine::updateEngine() {
}
for (int i = 0; i < kMaxFloat; i++) {
- if (_floattext[i][0] > 0) {
+ if (_floatText[i][0] > 0) {
float spd = 0.5 * _fpsr;
- _floattext[i][0] = _floattext[i][0] - spd;
- _floattext[i][2] = _floattext[i][2] - spd;
- if (_floattext[i][0] < 0)
- _floattext[i][0] = 0;
+ _floatText[i][0] = _floatText[i][0] - spd;
+ _floatText[i][2] = _floatText[i][2] - spd;
+ if (_floatText[i][0] < 0)
+ _floatText[i][0] = 0;
}
- if (_floaticon[i][0] > 0) {
+ if (_floatIcon[i][0] > 0) {
float spd = 0.5 * _fpsr;
- _floaticon[i][0] = _floaticon[i][0] - spd;
- _floaticon[i][2] = _floaticon[i][2] - spd;
- if (_floaticon[i][0] < 0)
- _floaticon[i][0] = 0;
+ _floatIcon[i][0] = _floatIcon[i][0] - spd;
+ _floatIcon[i][2] = _floatIcon[i][2] - spd;
+ if (_floatIcon[i][0] < 0)
+ _floatIcon[i][0] = 0;
}
}
@@ -215,14 +215,14 @@ void GriffonEngine::updateEngine() {
if (_roomLock) {
_roomLock = false;
- for (int i = 1; i <= _lastnpc; i++)
- if (_npcinfo[i].hp > 0)
+ for (int i = 1; i <= _lastNpc; i++)
+ if (_npcInfo[i].hp > 0)
_roomLock = true;
}
- clouddeg += 0.1 * _fpsr;
- while (clouddeg >= 360)
- clouddeg = clouddeg - 360;
+ _cloudAngle += 0.1 * _fpsr;
+ while (_cloudAngle >= 360)
+ _cloudAngle = _cloudAngle - 360;
_player.hpflash = _player.hpflash + 0.1 * _fpsr;
if (_player.hpflash >= 2) {
@@ -283,7 +283,7 @@ void GriffonEngine::newGame() {
_player.nextLevel = 0;
memset(_scriptFlag, 0, sizeof(_scriptFlag));
- memset(_objmapf, 0, sizeof(_objmapf));
+ memset(_objectMapFull, 0, sizeof(_objectMapFull));
memset(_roomLocks, 0, sizeof(_roomLocks));
_roomLocks[66] = 2;
@@ -296,7 +296,7 @@ void GriffonEngine::newGame() {
_player.walkSpeed = 1.1f;
_animSpeed = 0.5f;
- attacking = false;
+ _attacking = false;
_player.attackSpeed = 1.5f;
_player.sword = 1;
diff --git a/engines/griffon/gfx.cpp b/engines/griffon/gfx.cpp
index 2ba73a0..de28eba 100644
--- a/engines/griffon/gfx.cpp
+++ b/engines/griffon/gfx.cpp
@@ -42,11 +42,11 @@ namespace Griffon {
void GriffonEngine::addFloatIcon(int ico, float xloc, float yloc) {
for (int i = 0; i < kMaxFloat; i++) {
- if (ABS(_floaticon[i][0]) < kEpsilon) {
- _floaticon[i][0] = 32;
- _floaticon[i][1] = xloc;
- _floaticon[i][2] = yloc;
- _floaticon[i][3] = ico;
+ if (ABS(_floatIcon[i][0]) < kEpsilon) {
+ _floatIcon[i][0] = 32;
+ _floatIcon[i][1] = xloc;
+ _floatIcon[i][2] = yloc;
+ _floatIcon[i][3] = ico;
return;
}
}
@@ -54,12 +54,12 @@ void GriffonEngine::addFloatIcon(int ico, float xloc, float yloc) {
void GriffonEngine::addFloatText(const char *stri, float xloc, float yloc, int col) {
for (int i = 0; i < kMaxFloat; i++) {
- if (ABS(_floattext[i][0]) < kEpsilon) {
- _floattext[i][0] = 32;
- _floattext[i][1] = xloc;
- _floattext[i][2] = yloc;
- _floattext[i][3] = col;
- strcpy(_floatstri[i], stri);
+ if (ABS(_floatText[i][0]) < kEpsilon) {
+ _floatText[i][0] = 32;
+ _floatText[i][1] = xloc;
+ _floatText[i][2] = yloc;
+ _floatText[i][3] = col;
+ strcpy(_floatStr[i], stri);
return;
}
}
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index 03cf396..ad9b665 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -51,7 +51,7 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
_musicChannel = -1;
_menuChannel = -1;
- clouddeg = 0.0f;
+ _cloudAngle = 0.0f;
for (int i = 0; i < 33; ++i) {
for (int j = 0; j < 6; ++j)
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 34f3c3e..556a701 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -423,24 +423,23 @@ private:
// saveload info
Graphics::TransparentSurface *_saveLoadImg;
-
// post info
float _postInfo[21][3];
- int nposts;
+ int _postInfoNbr;
// cloud info
- Graphics::TransparentSurface *cloudimg;
- float clouddeg;
+ Graphics::TransparentSurface *_cloudImg;
+ float _cloudAngle;
int _cloudsOn;
// spell info
- Spell spellinfo[kMaxSpell];
+ Spell _spellInfo[kMaxSpell];
// player info
- bool movingup, movingdown, movingleft, movingright;
Player _player;
- bool attacking;
Player _playera;
+ bool _movingUp, _movingDown, _movingLeft, _movingRight;
+ bool _attacking;
int _asecstart;
// tile info
@@ -455,12 +454,12 @@ private:
float _playerattackofs[4][16][3];
// [dir] [frame] [x,y ofs, completed(0/1)]
- float _floattext[kMaxFloat][4]; // [id] [framesleft, x, y, col]
- char *_floatstri[kMaxFloat];
- float _floaticon[kMaxFloat][4]; // [id] [framesleft, x, y, ico]
+ float _floatText[kMaxFloat][4]; // [id] [framesleft, x, y, col]
+ char *_floatStr[kMaxFloat];
+ float _floatIcon[kMaxFloat][4]; // [id] [framesleft, x, y, ico]
// special for animset2
- AnimSet _animset2[7], _animset9[7];
+ AnimSet _animSet2[7], _animSet9[7];
// object info
float _objectFrame[256][2];
@@ -472,18 +471,18 @@ private:
// [objnum] [frame] [x] [y] [tile/layer]
int _objectMap[21][15];
- int _objmapf[1000][21][15];
+ int _objectMapFull[1000][21][15];
// [mapnum] x, y set to 1 to make this objmap spot stay at -1
// trigger info
int _triggers[10000][9];
// [map#][index], [var]
// map#,x,y
- int _triggerloc[320][240], _ntriggers;
+ int _triggerLoc[320][240], _triggerNbr;
// npc info
- NPC _npcinfo[kMaxNPC];
- int _lastnpc;
+ NPC _npcInfo[kMaxNPC];
+ int _lastNpc;
// music info
DataChunk *_mgardens, *_mgardens2, *_mgardens3, *_mgardens4, *_mboss, *_mmenu, *_mendofgame;
diff --git a/engines/griffon/input.cpp b/engines/griffon/input.cpp
index a1dba70..7f8f599 100644
--- a/engines/griffon/input.cpp
+++ b/engines/griffon/input.cpp
@@ -47,7 +47,7 @@ void GriffonEngine::checkInputs() {
g_system->getEventManager()->pollEvent(_event);
- nposts = 0;
+ _postInfoNbr = 0;
for (int i = 0; i <= 20; i++) {
_postInfo[i][0] = 0;
@@ -58,14 +58,14 @@ void GriffonEngine::checkInputs() {
for (int y = 0; y <= 14; y++) {
int o = _objectMap[x][y];
if (_objectInfo[o][4] == 3) {
- _postInfo[nposts][0] = x * 16;
- _postInfo[nposts][1] = y * 16;
- nposts = nposts + 1;
+ _postInfo[_postInfoNbr][0] = x * 16;
+ _postInfo[_postInfoNbr][1] = y * 16;
+ _postInfoNbr = _postInfoNbr + 1;
}
}
}
- if (attacking || (_forcePause && !_itemSelOn))
+ if (_attacking || (_forcePause && !_itemSelOn))
return;
if (_event.type == Common::EVENT_QUIT) {
@@ -138,7 +138,7 @@ void GriffonEngine::checkInputs() {
}
if (_curItem == 2 && _player.inventory[kInvShock] > 0) {
- castSpell(8, _player.px, _player.py, _npcinfo[_curEnemy].x, _npcinfo[_curEnemy].y, 0);
+ castSpell(8, _player.px, _player.py, _npcInfo[_curEnemy].x, _npcInfo[_curEnemy].y, 0);
_forcePause = true;
@@ -175,7 +175,7 @@ void GriffonEngine::checkInputs() {
}
if (_curItem == 5 && _player.spellCharge[0] == 100) {
- castSpell(5, _player.px, _player.py, _npcinfo[_curEnemy].x, _npcinfo[_curEnemy].y, 0);
+ castSpell(5, _player.px, _player.py, _npcInfo[_curEnemy].x, _npcInfo[_curEnemy].y, 0);
_player.spellCharge[0] = 0;
@@ -187,10 +187,10 @@ void GriffonEngine::checkInputs() {
}
if (_curItem > 5 && _selEnemyOn) {
- if (_curEnemy <= _lastnpc) {
- castSpell(_curItem - 6, _player.px, _player.py, _npcinfo[_curEnemy].x, _npcinfo[_curEnemy].y, 0);
+ if (_curEnemy <= _lastNpc) {
+ castSpell(_curItem - 6, _player.px, _player.py, _npcInfo[_curEnemy].x, _npcInfo[_curEnemy].y, 0);
} else {
- int pst = _curEnemy - _lastnpc - 1;
+ int pst = _curEnemy - _lastNpc - 1;
castSpell(_curItem - 6, _player.px, _player.py, _postInfo[pst][0], _postInfo[pst][1], 0);
}
@@ -212,21 +212,21 @@ void GriffonEngine::checkInputs() {
int i = 0;
do {
- if (_npcinfo[i].hp > 0) {
+ if (_npcInfo[i].hp > 0) {
_curEnemy = i;
goto __exit_do;
}
i = i + 1;
- if (i == _lastnpc + 1) {
+ if (i == _lastNpc + 1) {
_selEnemyOn = false;
goto __exit_do;
}
} while (1);
__exit_do:
- if (nposts > 0 && !_selEnemyOn) {
+ if (_postInfoNbr > 0 && !_selEnemyOn) {
_selEnemyOn = true;
- _curEnemy = _lastnpc + 1;
+ _curEnemy = _lastNpc + 1;
}
}
@@ -250,23 +250,23 @@ __exit_do:
}
if (!_itemSelOn) {
- movingup = false;
- movingdown = false;
- movingleft = false;
- movingright = false;
+ _movingUp = false;
+ _movingDown = false;
+ _movingLeft = false;
+ _movingRight = false;
if (_event.kbd.keycode == Common::KEYCODE_UP)
- movingup = true;
+ _movingUp = true;
if (_event.kbd.keycode == Common::KEYCODE_DOWN)
- movingdown = true;
+ _movingDown = true;
if (_event.kbd.keycode == Common::KEYCODE_LEFT)
- movingleft = true;
+ _movingLeft = true;
if (_event.kbd.keycode == Common::KEYCODE_RIGHT)
- movingright = true;
+ _movingRight = true;
} else {
- movingup = false;
- movingdown = false;
- movingleft = false;
- movingright = false;
+ _movingUp = false;
+ _movingDown = false;
+ _movingLeft = false;
+ _movingRight = false;
if (_selEnemyOn) {
if (_itemTicks < _ticks) {
@@ -275,12 +275,12 @@ __exit_do:
do {
_curEnemy = _curEnemy - 1;
if (_curEnemy < 1)
- _curEnemy = _lastnpc + nposts;
+ _curEnemy = _lastNpc + _postInfoNbr;
if (_curEnemy == origin)
break;
- if (_curEnemy <= _lastnpc && _npcinfo[_curEnemy].hp > 0)
+ if (_curEnemy <= _lastNpc && _npcInfo[_curEnemy].hp > 0)
break;
- if (_curEnemy > _lastnpc)
+ if (_curEnemy > _lastNpc)
break;
} while (1);
_itemTicks = _ticks + ntickdelay;
@@ -289,23 +289,23 @@ __exit_do:
int origin = _curEnemy;
do {
_curEnemy = _curEnemy + 1;
- if (_curEnemy > _lastnpc + nposts)
+ if (_curEnemy > _lastNpc + _postInfoNbr)
_curEnemy = 1;
if (_curEnemy == origin)
break;
- if (_curEnemy <= _lastnpc && _npcinfo[_curEnemy].hp > 0)
+ if (_curEnemy <= _lastNpc && _npcInfo[_curEnemy].hp > 0)
break;
- if (_curEnemy > _lastnpc)
+ if (_curEnemy > _lastNpc)
break;
} while (1);
_itemTicks = _ticks + ntickdelay;
}
- if (_curEnemy > _lastnpc + nposts)
+ if (_curEnemy > _lastNpc + _postInfoNbr)
_curEnemy = 1;
if (_curEnemy < 1)
- _curEnemy = _lastnpc + nposts;
+ _curEnemy = _lastNpc + _postInfoNbr;
}
} else {
if (_itemTicks < _ticks) {
@@ -363,20 +363,20 @@ void GriffonEngine::handleWalking() {
int ly = (int)npy / 16;
int ramp = _rampData[lx][ly];
- if (ramp == 1 && movingup)
+ if (ramp == 1 && _movingUp)
spd *= 2;
- if (ramp == 1 && movingdown)
+ if (ramp == 1 && _movingDown)
spd *= 2;
- if (ramp == 2 && movingleft)
- movingup = true;
- if (ramp == 2 && movingright)
- movingdown = true;
+ if (ramp == 2 && _movingLeft)
+ _movingUp = true;
+ if (ramp == 2 && _movingRight)
+ _movingDown = true;
- if (ramp == 3 && movingright)
- movingup = true;
- if (ramp == 3 && movingleft)
- movingdown = true;
+ if (ramp == 3 && _movingRight)
+ _movingUp = true;
+ if (ramp == 3 && _movingLeft)
+ _movingDown = true;
unsigned int *temp/*, c*/, bgc;
@@ -393,75 +393,75 @@ void GriffonEngine::handleWalking() {
}
}
- if (movingup)
+ if (_movingUp)
_player.walkDir = 0;
- if (movingdown)
+ if (_movingDown)
_player.walkDir = 1;
- if (movingleft)
+ if (_movingLeft)
_player.walkDir = 2;
- if (movingright)
+ if (_movingRight)
_player.walkDir = 3;
- if (movingup && _clipSurround[1][0] == 0) {
+ if (_movingUp && _clipSurround[1][0] == 0) {
py -= spd;
_player.walkDir = 0;
- } else if (movingup && _clipSurround[1][0] > 0) {
+ } else if (_movingUp && _clipSurround[1][0] > 0) {
// move upleft
- if (!movingright && _clipSurround[0][0] == 0) {
+ if (!_movingRight && _clipSurround[0][0] == 0) {
py -= spd;
px -= spd;
}
// move upright
- if (!movingleft && _clipSurround[2][0] == 0) {
+ if (!_movingLeft && _clipSurround[2][0] == 0) {
py -= spd;
px += spd;
}
}
- if (movingdown && _clipSurround[1][2] == 0) {
+ if (_movingDown && _clipSurround[1][2] == 0) {
py += spd;
_player.walkDir = 1;
- } else if (movingdown && _clipSurround[1][2] > 0) {
+ } else if (_movingDown && _clipSurround[1][2] > 0) {
// move downleft
- if (movingright == 0 && _clipSurround[0][2] == 0) {
+ if (_movingRight == 0 && _clipSurround[0][2] == 0) {
py += spd;
px -= spd;
}
// move downright
- if (movingleft == 0 && _clipSurround[2][2] == 0) {
+ if (_movingLeft == 0 && _clipSurround[2][2] == 0) {
py += spd;
px += spd;
}
}
- if (movingleft && _clipSurround[0][1] == 0) {
+ if (_movingLeft && _clipSurround[0][1] == 0) {
px -= spd;
_player.walkDir = 2;
- } else if (movingleft && _clipSurround[0][1] > 0) {
+ } else if (_movingLeft && _clipSurround[0][1] > 0) {
// move leftup
- if (!movingdown && _clipSurround[0][0] == 0) {
+ if (!_movingDown && _clipSurround[0][0] == 0) {
py -= spd;
px -= spd;
}
// move leftdown
- if (!movingup && _clipSurround[0][2] == 0) {
+ if (!_movingUp && _clipSurround[0][2] == 0) {
py += spd;
px -= spd;
}
}
- if (movingright && _clipSurround[2][1] == 0) {
+ if (_movingRight && _clipSurround[2][1] == 0) {
px += spd;
_player.walkDir = 3;
- } else if (movingright && _clipSurround[2][1] > 0) {
+ } else if (_movingRight && _clipSurround[2][1] > 0) {
// move rightup
- if (!movingdown && _clipSurround[2][0] == 0) {
+ if (!_movingDown && _clipSurround[2][0] == 0) {
px += spd;
py -= spd;
}
// move rightdown
- if (!movingup && _clipSurround[2][2] == 0) {
+ if (!_movingUp && _clipSurround[2][2] == 0) {
py += spd;
px += spd;
}
@@ -490,10 +490,10 @@ void GriffonEngine::handleWalking() {
// push npc
if (pass == 1) {
- for (int i = 1; i <= _lastnpc; i++) {
- if (_npcinfo[i].hp > 0) {
- npx = _npcinfo[i].x;
- npy = _npcinfo[i].y;
+ for (int i = 1; i <= _lastNpc; i++) {
+ if (_npcInfo[i].hp > 0) {
+ npx = _npcInfo[i].x;
+ npy = _npcInfo[i].y;
opx = npx;
opy = npy;
@@ -503,20 +503,20 @@ void GriffonEngine::handleWalking() {
if (_player.walkDir == 0) {
if (abs(xdif) <= 8 && ydif > 0 && ydif < 8)
- _npcinfo[i].y -= spd;
+ _npcInfo[i].y -= spd;
} else if (_player.walkDir == 1) {
if (abs(xdif) <= 8 && ydif < 0 && ydif > -8)
- _npcinfo[i].y += spd;
+ _npcInfo[i].y += spd;
} else if (_player.walkDir == 2) {
if (abs(ydif) <= 8 && xdif > 0 && xdif < 8)
- _npcinfo[i].x -= spd;
+ _npcInfo[i].x -= spd;
} else if (_player.walkDir == 3) {
if (abs(ydif) <= 8 && xdif < 0 && xdif > -8)
- _npcinfo[i].x += spd;
+ _npcInfo[i].x += spd;
}
- npx = _npcinfo[i].x;
- npy = _npcinfo[i].y;
+ npx = _npcInfo[i].x;
+ npy = _npcInfo[i].y;
sx = (int)(npx / 2 + 6);
sy = (int)(npy / 2 + 10);
@@ -524,8 +524,8 @@ void GriffonEngine::handleWalking() {
bgc = *temp;
if (bgc > 0) {
- _npcinfo[i].x = opx;
- _npcinfo[i].y = opy;
+ _npcInfo[i].x = opx;
+ _npcInfo[i].y = opy;
}
}
}
@@ -552,7 +552,7 @@ void GriffonEngine::handleWalking() {
_player.inventory[kInvFlask]++;
addFloatIcon(6, lx * 16, ly * 16);
- _objmapf[_curMap][lx][ly] = 1;
+ _objectMapFull[_curMap][lx][ly] = 1;
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
@@ -566,7 +566,7 @@ void GriffonEngine::handleWalking() {
_player.inventory[kInvDoubleFlask]++;
addFloatIcon(12, lx * 16, ly * 16);
- _objmapf[_curMap][lx][ly] = 1;
+ _objectMapFull[_curMap][lx][ly] = 1;
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
@@ -580,7 +580,7 @@ void GriffonEngine::handleWalking() {
_player.inventory[kInvShock]++;
addFloatIcon(17, lx * 16, ly * 16);
- _objmapf[_curMap][lx][ly] = 1;
+ _objectMapFull[_curMap][lx][ly] = 1;
if (_curMap == 41)
_scriptFlag[kScriptLightningBomb][1] = 1;
@@ -597,7 +597,7 @@ void GriffonEngine::handleWalking() {
_player.inventory[kInvShock]++;
addFloatIcon(17, lx * 16, ly * 16);
- _objmapf[_curMap][lx][ly] = 1;
+ _objectMapFull[_curMap][lx][ly] = 1;
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
@@ -617,8 +617,8 @@ void GriffonEngine::checkTrigger() {
_canUseKey = false;
- if (_triggerloc[lx][ly] > -1)
- processTrigger(_triggerloc[lx][ly]);
+ if (_triggerLoc[lx][ly] > -1)
+ processTrigger(_triggerLoc[lx][ly]);
}
void GriffonEngine::processTrigger(int trignum) {
@@ -682,8 +682,8 @@ void GriffonEngine::processTrigger(int trignum) {
}
for (int i = 0; i < kMaxFloat; i++) {
- _floattext[i][0] = 0;
- _floaticon[i][0] = 0;
+ _floatText[i][0] = 0;
+ _floatIcon[i][0] = 0;
}
}
diff --git a/engines/griffon/logic.cpp b/engines/griffon/logic.cpp
index 01ee9f0..1918cc3 100644
--- a/engines/griffon/logic.cpp
+++ b/engines/griffon/logic.cpp
@@ -110,8 +110,8 @@ void GriffonEngine::updateY() {
_firsty = 2400;
_lasty = 0;
- for (int i = 1; i <= _lastnpc; i++) {
- int yy = (int)(_npcinfo[i].y * 10);
+ for (int i = 1; i <= _lastNpc; i++) {
+ int yy = (int)(_npcInfo[i].y * 10);
do {
if (_ysort[yy] == -1 || yy == 2400)
@@ -128,13 +128,13 @@ void GriffonEngine::updateY() {
}
void GriffonEngine::updateNPCs() {
- for (int i = 1; i <= _lastnpc; i++) {
- if (_npcinfo[i].hp > 0) {
+ for (int i = 1; i <= _lastNpc; i++) {
+ if (_npcInfo[i].hp > 0) {
// is npc walking
int pass = 0;
- if (!_npcinfo[i].attacking)
+ if (!_npcInfo[i].attacking)
pass = 1;
- if (_npcinfo[i].spriteset == kMonsterFireHydra)
+ if (_npcInfo[i].spriteset == kMonsterFireHydra)
pass = 1;
if (pass == 1) {
bool moveup = false;
@@ -142,31 +142,31 @@ void GriffonEngine::updateNPCs() {
bool moveleft = false;
bool moveright = false;
- float npx = _npcinfo[i].x;
- float npy = _npcinfo[i].y;
+ float npx = _npcInfo[i].x;
+ float npy = _npcInfo[i].y;
float onpx = npx;
float onpy = npy;
- float wspd = _npcinfo[i].walkspd / 4;
+ float wspd = _npcInfo[i].walkspd / 4;
- if (_npcinfo[i].spriteset == kMonsterDragon2)
+ if (_npcInfo[i].spriteset == kMonsterDragon2)
wspd = wspd * 2;
- int wdir = _npcinfo[i].walkdir;
+ int wdir = _npcInfo[i].walkdir;
- int mode = _npcinfo[i].movementmode;
+ int mode = _npcInfo[i].movementmode;
float xdif = _player.px - npx;
float ydif = _player.py - npy;
if (abs(xdif) < 4 * 16 && abs(ydif) < 4 * 16 && mode < 3)
mode = 0;
- if (_npcinfo[i].hp < _npcinfo[i].maxhp * 0.25)
+ if (_npcInfo[i].hp < _npcInfo[i].maxhp * 0.25)
mode = 3;
- if (_npcinfo[i].pause > _ticks)
+ if (_npcInfo[i].pause > _ticks)
mode = -1;
- if (_npcinfo[i].spriteset == kMonsterOneWing && _npcinfo[i].castpause > _ticks)
+ if (_npcInfo[i].spriteset == kMonsterOneWing && _npcInfo[i].castpause > _ticks)
mode = -1;
if (mode == 3) {
@@ -182,7 +182,7 @@ void GriffonEngine::updateNPCs() {
// *** aggressive
if (mode == 0) {
- wspd = _npcinfo[i].walkspd / 2;
+ wspd = _npcInfo[i].walkspd / 2;
xdif = _player.px - npx;
ydif = _player.py - npy;
@@ -213,15 +213,15 @@ void GriffonEngine::updateNPCs() {
// *** defensive
if (mode == 1) {
- int movingdir = _npcinfo[i].movingdir;
+ int movingdir = _npcInfo[i].movingdir;
- if (_npcinfo[i].ticks > _ticks + 100000)
- _npcinfo[i].ticks = _ticks;
+ if (_npcInfo[i].ticks > _ticks + 100000)
+ _npcInfo[i].ticks = _ticks;
- if (_npcinfo[i].ticks < _ticks) {
- _npcinfo[i].ticks = _ticks + 2000;
+ if (_npcInfo[i].ticks < _ticks) {
+ _npcInfo[i].ticks = _ticks + 2000;
movingdir = (int)(RND() * 8);
- _npcinfo[i].movingdir = movingdir;
+ _npcInfo[i].movingdir = movingdir;
}
if (movingdir == 0) {
@@ -260,7 +260,7 @@ void GriffonEngine::updateNPCs() {
// *** run away
if (mode == 3) {
- wspd = _npcinfo[i].walkspd / 2;
+ wspd = _npcInfo[i].walkspd / 2;
xdif = _player.px - npx;
ydif = _player.py - npy;
@@ -297,7 +297,7 @@ void GriffonEngine::updateNPCs() {
float xp = (npx / 2 + 6);
float yp = (npy / 2 + 10);
- if (_npcinfo[i].spriteset == kMonsterDragon2)
+ if (_npcInfo[i].spriteset == kMonsterDragon2)
wspd = wspd * 2;
float ii = wspd * _fpsr;
@@ -309,7 +309,7 @@ void GriffonEngine::updateNPCs() {
int sy = yp - ii;
uint32 *temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
uint32 dq = *temp;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ if (_npcInfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0)
@@ -319,7 +319,7 @@ void GriffonEngine::updateNPCs() {
sy = yp - ii;
temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
dq = *temp;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ if (_npcInfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0) {
movinup = true;
@@ -331,7 +331,7 @@ void GriffonEngine::updateNPCs() {
sy = yp - ii;
temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
dq = *temp;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ if (_npcInfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0) {
movinup = true;
@@ -345,7 +345,7 @@ void GriffonEngine::updateNPCs() {
int sy = yp + ii;
uint32 *temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
uint32 dq = *temp;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ if (_npcInfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0)
movindown = true;
@@ -354,7 +354,7 @@ void GriffonEngine::updateNPCs() {
sy = yp + ii;
temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
dq = *temp;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ if (_npcInfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0) {
movindown = true;
@@ -366,7 +366,7 @@ void GriffonEngine::updateNPCs() {
sy = yp + ii;
temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
dq = *temp;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ if (_npcInfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0) {
movindown = true;
@@ -380,7 +380,7 @@ void GriffonEngine::updateNPCs() {
int sy = yp;
uint32 *temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
uint32 dq = *temp;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ if (_npcInfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0)
movinleft = true;
@@ -389,7 +389,7 @@ void GriffonEngine::updateNPCs() {
sy = yp - ii;
temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
dq = *temp;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ if (_npcInfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0) {
movinleft = true;
@@ -401,7 +401,7 @@ void GriffonEngine::updateNPCs() {
sy = yp + ii;
temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
dq = *temp;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ if (_npcInfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0) {
movinleft = true;
@@ -415,7 +415,7 @@ void GriffonEngine::updateNPCs() {
int sy = yp;
uint32 *temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
uint32 dq = *temp;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ if (_npcInfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0)
movinright = true;
@@ -424,7 +424,7 @@ void GriffonEngine::updateNPCs() {
sy = yp - ii;
temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
dq = *temp;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ if (_npcInfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0) {
movinright = true;
@@ -436,7 +436,7 @@ void GriffonEngine::updateNPCs() {
sy = yp + ii;
temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
dq = *temp;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ if (_npcInfo[i].spriteset == kMonsterFinalBoss)
dq = 0;
if (dq == 0) {
movinright = true;
@@ -456,18 +456,18 @@ void GriffonEngine::updateNPCs() {
if (checkpass) {
pass = 0;
- if (npx >= _npcinfo[i].x1 * 16 - 8 && npx <= _npcinfo[i].x2 * 16 + 8 && npy >= _npcinfo[i].y1 * 16 - 8 && npy <= _npcinfo[i].y2 * 16 + 8)
+ if (npx >= _npcInfo[i].x1 * 16 - 8 && npx <= _npcInfo[i].x2 * 16 + 8 && npy >= _npcInfo[i].y1 * 16 - 8 && npy <= _npcInfo[i].y2 * 16 + 8)
pass = 1;
if (pass == 0) {
npx = onpx;
npy = onpy;
- _npcinfo[i].ticks = _ticks;
+ _npcInfo[i].ticks = _ticks;
}
}
float aspd = wspd;
- if (_npcinfo[i].spriteset == kMonsterDragon2)
+ if (_npcInfo[i].spriteset == kMonsterDragon2)
aspd = wspd / 2;
xp = (npx / 2 + 6);
@@ -484,14 +484,14 @@ void GriffonEngine::updateNPCs() {
int lx = (int)anpx / 16;
int ly = (int)anpy / 16;
- if (_triggerloc[lx][ly] > -1)
+ if (_triggerLoc[lx][ly] > -1)
bgc = 1;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss)
+ if (_npcInfo[i].spriteset == kMonsterFinalBoss)
bgc = 0;
bool rst = false;
- if (_npcinfo[i].spriteset == kMonsterFinalBoss) {
+ if (_npcInfo[i].spriteset == kMonsterFinalBoss) {
if (npx < 40 || npx > 280 || npy < 36 || npy > 204)
rst = true;
}
@@ -501,17 +501,17 @@ void GriffonEngine::updateNPCs() {
npy = onpy;
}
- _npcinfo[i].x = npx;
- _npcinfo[i].y = npy;
+ _npcInfo[i].x = npx;
+ _npcInfo[i].y = npy;
- _npcinfo[i].walkdir = wdir;
- _npcinfo[i].moving = false;
+ _npcInfo[i].walkdir = wdir;
+ _npcInfo[i].moving = false;
if (npx != onpx || npy != onpy)
- _npcinfo[i].moving = true;
+ _npcInfo[i].moving = true;
- if (_npcinfo[i].moving) {
- float frame = _npcinfo[i].frame;
+ if (_npcInfo[i].moving) {
+ float frame = _npcInfo[i].frame;
frame += aspd * _fpsr;
while (frame >= 16)
@@ -521,29 +521,29 @@ void GriffonEngine::updateNPCs() {
if (cframe < 0)
cframe = 0;
- _npcinfo[i].frame = frame;
- _npcinfo[i].cframe = cframe;
+ _npcInfo[i].frame = frame;
+ _npcInfo[i].cframe = cframe;
}
// spriteset1 specific
- if (_npcinfo[i].spriteset == kMonsterBabyDragon && _npcinfo[i].attackattempt < _ticks) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) {
- npx = _npcinfo[i].x;
- npy = _npcinfo[i].y;
+ if (_npcInfo[i].spriteset == kMonsterBabyDragon && _npcInfo[i].attackattempt < _ticks) {
+ if (_npcInfo[i].attacknext < _ticks && _npcInfo[i].pause < _ticks && !_npcInfo[i].attacking) {
+ npx = _npcInfo[i].x;
+ npy = _npcInfo[i].y;
xdif = _player.px - npx;
ydif = _player.py - npy;
if (abs(xdif) < 20 && abs(ydif) < 20) {
- _npcinfo[i].attackattempt = _ticks + 100;
+ _npcInfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
if (config.effects) {
int snd = playSound(_sfx[kSndEnemyHit]);
setChannelVolume(snd, config.effectsvol);
}
- _npcinfo[i].attacking = true;
- _npcinfo[i].attackframe = 0;
+ _npcInfo[i].attacking = true;
+ _npcInfo[i].attackframe = 0;
}
}
}
@@ -552,10 +552,10 @@ void GriffonEngine::updateNPCs() {
bool dospell = false;
// onewing specific
- if (_npcinfo[i].spriteset == kMonsterOneWing) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) {
- npx = _npcinfo[i].x;
- npy = _npcinfo[i].y;
+ if (_npcInfo[i].spriteset == kMonsterOneWing) {
+ if (_npcInfo[i].attacknext < _ticks && _npcInfo[i].pause < _ticks && !_npcInfo[i].attacking) {
+ npx = _npcInfo[i].x;
+ npy = _npcInfo[i].y;
xdif = _player.px - npx;
ydif = _player.py - npy;
@@ -569,11 +569,11 @@ void GriffonEngine::updateNPCs() {
setChannelVolume(snd, config.effectsvol);
}
- _npcinfo[i].attacking = true;
- _npcinfo[i].attackframe = 0;
+ _npcInfo[i].attacking = true;
+ _npcInfo[i].attackframe = 0;
- _npcinfo[i].headtargetx[0] = _player.px + 12;
- _npcinfo[i].headtargety[0] = _player.py - 4;
+ _npcInfo[i].headtargetx[0] = _player.px + 12;
+ _npcInfo[i].headtargety[0] = _player.py - 4;
}
}
@@ -581,87 +581,87 @@ void GriffonEngine::updateNPCs() {
dospell = false;
- if (!_npcinfo[i].attacking && _npcinfo[i].castpause < _ticks) {
- _npcinfo[i].swayspd = _npcinfo[i].swayspd + _npcinfo[i].swayspd / 200 * _fpsr;
- if (_npcinfo[i].swayspd > 15) {
+ if (!_npcInfo[i].attacking && _npcInfo[i].castpause < _ticks) {
+ _npcInfo[i].swayspd = _npcInfo[i].swayspd + _npcInfo[i].swayspd / 200 * _fpsr;
+ if (_npcInfo[i].swayspd > 15) {
dospell = true;
- _npcinfo[i].swayspd = 1;
+ _npcInfo[i].swayspd = 1;
}
// sway code
- _npcinfo[i].swayangle = _npcinfo[i].swayangle + _npcinfo[i].swayspd * _fpsr;
- if (_npcinfo[i].swayangle >= 360)
- _npcinfo[i].swayangle = _npcinfo[i].swayangle - 360;
+ _npcInfo[i].swayangle = _npcInfo[i].swayangle + _npcInfo[i].swayspd * _fpsr;
+ if (_npcInfo[i].swayangle >= 360)
+ _npcInfo[i].swayangle = _npcInfo[i].swayangle - 360;
- _npcinfo[i].headtargetx[0] = _npcinfo[i].x + (24 - _npcinfo[i].swayspd / 2) * sin(3.14159 / 180 * _npcinfo[i].swayangle) + 12;
- _npcinfo[i].headtargety[0] = _npcinfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * _npcinfo[i].swayangle);
+ _npcInfo[i].headtargetx[0] = _npcInfo[i].x + (24 - _npcInfo[i].swayspd / 2) * sin(3.14159 / 180 * _npcInfo[i].swayangle) + 12;
+ _npcInfo[i].headtargety[0] = _npcInfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * _npcInfo[i].swayangle);
}
if (dospell) {
- _npcinfo[i].pause = _ticks + 3000;
- _npcinfo[i].attacknext = _ticks + 4500;
- _npcinfo[i].castpause = _ticks + 4500;
+ _npcInfo[i].pause = _ticks + 3000;
+ _npcInfo[i].attacknext = _ticks + 4500;
+ _npcInfo[i].castpause = _ticks + 4500;
- castSpell(3, _npcinfo[i].x, _npcinfo[i].y, _npcinfo[i].x, _npcinfo[i].y, i);
+ castSpell(3, _npcInfo[i].x, _npcInfo[i].y, _npcInfo[i].x, _npcInfo[i].y, i);
- _npcinfo[i].headtargetx[0] = _npcinfo[i].x;
- _npcinfo[i].headtargety[0] = _npcinfo[i].y - 36 + 16;
+ _npcInfo[i].headtargetx[0] = _npcInfo[i].x;
+ _npcInfo[i].headtargety[0] = _npcInfo[i].y - 36 + 16;
}
// targethead code
- xdif = _npcinfo[i].bodysection[7].x - _npcinfo[i].headtargetx[0];
- ydif = _npcinfo[i].bodysection[7].y - _npcinfo[i].headtargety[0];
+ xdif = _npcInfo[i].bodysection[7].x - _npcInfo[i].headtargetx[0];
+ ydif = _npcInfo[i].bodysection[7].y - _npcInfo[i].headtargety[0];
- _npcinfo[i].bodysection[7].x = _npcinfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
- _npcinfo[i].bodysection[7].y = _npcinfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
+ _npcInfo[i].bodysection[7].x = _npcInfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
+ _npcInfo[i].bodysection[7].y = _npcInfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
- _npcinfo[i].bodysection[0].x = _npcinfo[i].x + 12;
- _npcinfo[i].bodysection[0].y = _npcinfo[i].y + 12;
+ _npcInfo[i].bodysection[0].x = _npcInfo[i].x + 12;
+ _npcInfo[i].bodysection[0].y = _npcInfo[i].y + 12;
for (int f = 6; f >= 1; f--) {
- xdif = _npcinfo[i].bodysection[f + 1].x - _npcinfo[i].bodysection[f - 1].x;
- ydif = _npcinfo[i].bodysection[f + 1].y - _npcinfo[i].bodysection[f - 1].y;
+ xdif = _npcInfo[i].bodysection[f + 1].x - _npcInfo[i].bodysection[f - 1].x;
+ ydif = _npcInfo[i].bodysection[f + 1].y - _npcInfo[i].bodysection[f - 1].y;
- float tx = _npcinfo[i].bodysection[f - 1].x + xdif / 2;
- float ty = _npcinfo[i].bodysection[f - 1].y + ydif / 2;
+ float tx = _npcInfo[i].bodysection[f - 1].x + xdif / 2;
+ float ty = _npcInfo[i].bodysection[f - 1].y + ydif / 2;
- _npcinfo[i].bodysection[f].x = _npcinfo[i].bodysection[f].x - (_npcinfo[i].bodysection[f].x - tx) / 3;
- _npcinfo[i].bodysection[f].y = _npcinfo[i].bodysection[f].y - (_npcinfo[i].bodysection[f].y - ty) / 3;
+ _npcInfo[i].bodysection[f].x = _npcInfo[i].bodysection[f].x - (_npcInfo[i].bodysection[f].x - tx) / 3;
+ _npcInfo[i].bodysection[f].y = _npcInfo[i].bodysection[f].y - (_npcInfo[i].bodysection[f].y - ty) / 3;
}
}
// boss1 specific and blackknight
- if (_npcinfo[i].spriteset == kMonsterBoss1 || _npcinfo[i].spriteset == kMonsterBlackKnight) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) {
- _npcinfo[i].attacking = true;
- _npcinfo[i].attackframe = 0;
+ if (_npcInfo[i].spriteset == kMonsterBoss1 || _npcInfo[i].spriteset == kMonsterBlackKnight) {
+ if (_npcInfo[i].attacknext < _ticks && _npcInfo[i].pause < _ticks && !_npcInfo[i].attacking) {
+ _npcInfo[i].attacking = true;
+ _npcInfo[i].attackframe = 0;
- castSpell(1, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i);
+ castSpell(1, _npcInfo[i].x, _npcInfo[i].y, _player.px, _player.py, i);
}
- if (_npcinfo[i].castpause < _ticks) {
- castSpell(6, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i);
- _npcinfo[i].castpause = _ticks + 12000;
+ if (_npcInfo[i].castpause < _ticks) {
+ castSpell(6, _npcInfo[i].x, _npcInfo[i].y, _player.px, _player.py, i);
+ _npcInfo[i].castpause = _ticks + 12000;
}
}
// firehydra specific
- if (_npcinfo[i].spriteset == kMonsterFireHydra) {
- _npcinfo[i].swayspd = 4;
+ if (_npcInfo[i].spriteset == kMonsterFireHydra) {
+ _npcInfo[i].swayspd = 4;
// sway code
- _npcinfo[i].swayangle = _npcinfo[i].swayangle + _npcinfo[i].swayspd * _fpsr;
- if (_npcinfo[i].swayangle >= 360)
- _npcinfo[i].swayangle = _npcinfo[i].swayangle - 360;
+ _npcInfo[i].swayangle = _npcInfo[i].swayangle + _npcInfo[i].swayspd * _fpsr;
+ if (_npcInfo[i].swayangle >= 360)
+ _npcInfo[i].swayangle = _npcInfo[i].swayangle - 360;
for (int ff = 0; ff <= 2; ff++) {
- if (_npcinfo[i].hp > 10 * ff * 20) {
- if (_npcinfo[i].pause < _ticks && _npcinfo[i].attacking2[ff] == 0 && _npcinfo[i].attacknext2[ff] < _ticks) {
- npx = _npcinfo[i].x;
- npy = _npcinfo[i].y;
+ if (_npcInfo[i].hp > 10 * ff * 20) {
+ if (_npcInfo[i].pause < _ticks && _npcInfo[i].attacking2[ff] == 0 && _npcInfo[i].attacknext2[ff] < _ticks) {
+ npx = _npcInfo[i].x;
+ npy = _npcInfo[i].y;
xdif = _player.px - npx;
ydif = _player.py - npy;
@@ -675,53 +675,53 @@ void GriffonEngine::updateNPCs() {
setChannelVolume(snd, config.effectsvol);
}
- _npcinfo[i].attacking = true;
- _npcinfo[i].attacking2[ff] = 1;
- _npcinfo[i].attackframe2[ff] = 0;
+ _npcInfo[i].attacking = true;
+ _npcInfo[i].attacking2[ff] = 1;
+ _npcInfo[i].attackframe2[ff] = 0;
- _npcinfo[i].headtargetx[ff] = _player.px + 12;
- _npcinfo[i].headtargety[ff] = _player.py - 4;
+ _npcInfo[i].headtargetx[ff] = _player.px + 12;
+ _npcInfo[i].headtargety[ff] = _player.py - 4;
- _npcinfo[i].swayangle = 0;
+ _npcInfo[i].swayangle = 0;
}
}
}
- if (_npcinfo[i].attacking2[ff] == 0) {
- _npcinfo[i].headtargetx[ff] = _npcinfo[i].x + 38 * sin(3.14159 / 180 * (_npcinfo[i].swayangle + 120 * ff)) + 12;
- _npcinfo[i].headtargety[ff] = _npcinfo[i].y - 46 + 16 + 16 * sin(3.14159 * 2 / 180 * (_npcinfo[i].swayangle + 120 * ff));
+ if (_npcInfo[i].attacking2[ff] == 0) {
+ _npcInfo[i].headtargetx[ff] = _npcInfo[i].x + 38 * sin(3.14159 / 180 * (_npcInfo[i].swayangle + 120 * ff)) + 12;
+ _npcInfo[i].headtargety[ff] = _npcInfo[i].y - 46 + 16 + 16 * sin(3.14159 * 2 / 180 * (_npcInfo[i].swayangle + 120 * ff));
}
// targethead code
- xdif = _npcinfo[i].bodysection[10 * ff + 9].x - _npcinfo[i].headtargetx[ff];
- ydif = _npcinfo[i].bodysection[10 * ff + 9].y - _npcinfo[i].headtargety[ff];
+ xdif = _npcInfo[i].bodysection[10 * ff + 9].x - _npcInfo[i].headtargetx[ff];
+ ydif = _npcInfo[i].bodysection[10 * ff + 9].y - _npcInfo[i].headtargety[ff];
- _npcinfo[i].bodysection[10 * ff + 9].x = _npcinfo[i].bodysection[10 * ff + 9].x - xdif * 0.4 * _fpsr;
- _npcinfo[i].bodysection[10 * ff + 9].y = _npcinfo[i].bodysection[10 * ff + 9].y - ydif * 0.4 * _fpsr;
+ _npcInfo[i].bodysection[10 * ff + 9].x = _npcInfo[i].bodysection[10 * ff + 9].x - xdif * 0.4 * _fpsr;
+ _npcInfo[i].bodysection[10 * ff + 9].y = _npcInfo[i].bodysection[10 * ff + 9].y - ydif * 0.4 * _fpsr;
- _npcinfo[i].bodysection[10 * ff].x = _npcinfo[i].x + 12 + 8 * cos(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
- _npcinfo[i].bodysection[10 * ff].y = _npcinfo[i].y + 12 + 8 * sin(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
+ _npcInfo[i].bodysection[10 * ff].x = _npcInfo[i].x + 12 + 8 * cos(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
+ _npcInfo[i].bodysection[10 * ff].y = _npcInfo[i].y + 12 + 8 * sin(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
for (int f = 8; f >= 1; f--) {
- xdif = _npcinfo[i].bodysection[ff * 10 + f + 1].x - _npcinfo[i].bodysection[ff * 10 + f - 1].x;
- ydif = _npcinfo[i].bodysection[ff * 10 + f + 1].y - _npcinfo[i].bodysection[ff * 10 + f - 1].y;
+ xdif = _npcInfo[i].bodysection[ff * 10 + f + 1].x - _npcInfo[i].bodysection[ff * 10 + f - 1].x;
+ ydif = _npcInfo[i].bodysection[ff * 10 + f + 1].y - _npcInfo[i].bodysection[ff * 10 + f - 1].y;
- float tx = _npcinfo[i].bodysection[ff * 10 + f - 1].x + xdif / 2;
- float ty = _npcinfo[i].bodysection[ff * 10 + f - 1].y + ydif / 2;
+ float tx = _npcInfo[i].bodysection[ff * 10 + f - 1].x + xdif / 2;
+ float ty = _npcInfo[i].bodysection[ff * 10 + f - 1].y + ydif / 2;
- _npcinfo[i].bodysection[ff * 10 + f].x = _npcinfo[i].bodysection[ff * 10 + f].x - (_npcinfo[i].bodysection[ff * 10 + f].x - tx) / 3;
- _npcinfo[i].bodysection[ff * 10 + f].y = _npcinfo[i].bodysection[ff * 10 + f].y - (_npcinfo[i].bodysection[ff * 10 + f].y - ty) / 3;
+ _npcInfo[i].bodysection[ff * 10 + f].x = _npcInfo[i].bodysection[ff * 10 + f].x - (_npcInfo[i].bodysection[ff * 10 + f].x - tx) / 3;
+ _npcInfo[i].bodysection[ff * 10 + f].y = _npcInfo[i].bodysection[ff * 10 + f].y - (_npcInfo[i].bodysection[ff * 10 + f].y - ty) / 3;
}
}
}
}
// spriteset6 specific
- if (_npcinfo[i].spriteset == kMonsterRedDragon && _npcinfo[i].attackattempt < _ticks) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) {
- npx = _npcinfo[i].x;
- npy = _npcinfo[i].y;
+ if (_npcInfo[i].spriteset == kMonsterRedDragon && _npcInfo[i].attackattempt < _ticks) {
+ if (_npcInfo[i].attacknext < _ticks && _npcInfo[i].pause < _ticks && !_npcInfo[i].attacking) {
+ npx = _npcInfo[i].x;
+ npy = _npcInfo[i].y;
xdif = _player.px - npx;
ydif = _player.py - npy;
@@ -733,10 +733,10 @@ void GriffonEngine::updateNPCs() {
pass = 2;
if (pass > 0) {
- _npcinfo[i].attackattempt = _ticks + 100;
+ _npcInfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
- _npcinfo[i].attacking = true;
- _npcinfo[i].attackframe = 0;
+ _npcInfo[i].attacking = true;
+ _npcInfo[i].attackframe = 0;
float nnxa = 0, nnya = 0, nnxb = 0, nnyb = 0;
if (pass == 1 && xdif < 0) {
@@ -768,15 +768,15 @@ void GriffonEngine::updateNPCs() {
}
// wizard1 specific
- if (_npcinfo[i].spriteset == kMonsterPriest) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) {
- _npcinfo[i].attacking = true;
- _npcinfo[i].attackframe = 0;
+ if (_npcInfo[i].spriteset == kMonsterPriest) {
+ if (_npcInfo[i].attacknext < _ticks && _npcInfo[i].pause < _ticks && !_npcInfo[i].attacking) {
+ _npcInfo[i].attacking = true;
+ _npcInfo[i].attackframe = 0;
- castSpell(9, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i);
+ castSpell(9, _npcInfo[i].x, _npcInfo[i].y, _player.px, _player.py, i);
}
- if (_npcinfo[i].castpause < _ticks) {
+ if (_npcInfo[i].castpause < _ticks) {
// castSpell 6, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i
// _npcinfo[i].castpause = _ticks + 12000
}
@@ -784,10 +784,10 @@ void GriffonEngine::updateNPCs() {
}
// spriteset6 specific
- if (_npcinfo[i].spriteset == kMonsterYellowDragon && _npcinfo[i].attackattempt < _ticks) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) {
- npx = _npcinfo[i].x;
- npy = _npcinfo[i].y;
+ if (_npcInfo[i].spriteset == kMonsterYellowDragon && _npcInfo[i].attackattempt < _ticks) {
+ if (_npcInfo[i].attacknext < _ticks && _npcInfo[i].pause < _ticks && !_npcInfo[i].attacking) {
+ npx = _npcInfo[i].x;
+ npy = _npcInfo[i].y;
xdif = _player.px - npx;
ydif = _player.py - npy;
@@ -799,10 +799,10 @@ void GriffonEngine::updateNPCs() {
pass = 2;
if (pass > 0) {
- _npcinfo[i].attackattempt = _ticks + 100;
+ _npcInfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
- _npcinfo[i].attacking = true;
- _npcinfo[i].attackframe = 0;
+ _npcInfo[i].attacking = true;
+ _npcInfo[i].attackframe = 0;
float nnxa = 0, nnya = 0, nnxb = 0, nnyb = 0;
if (pass == 1 && xdif < 0) {
@@ -810,25 +810,25 @@ void GriffonEngine::updateNPCs() {
nnya = npy + 4;
nnxb = npx - 56 - 8;
nnyb = npy + 4;
- _npcinfo[i].walkdir = 2;
+ _npcInfo[i].walkdir = 2;
} else if (pass == 1 && xdif > 0) {
nnxa = npx + 16;
nnya = npy + 4;
nnxb = npx + 16 + 56;
nnyb = npy + 4;
- _npcinfo[i].walkdir = 3;
+ _npcInfo[i].walkdir = 3;
} else if (pass == 2 && ydif < 0) {
nnya = npy;
nnxa = npx + 4;
nnyb = npy - 56;
nnxb = npx + 4;
- _npcinfo[i].walkdir = 0;
+ _npcInfo[i].walkdir = 0;
} else if (pass == 2 && ydif > 0) {
nnya = npy + 20;
nnxa = npx + 4;
nnyb = npy + 20 + 56;
nnxb = npx + 4;
- _npcinfo[i].walkdir = 1;
+ _npcInfo[i].walkdir = 1;
}
castSpell(7, nnxa, nnya, nnxb, nnyb, i);
@@ -838,10 +838,10 @@ void GriffonEngine::updateNPCs() {
}
// twowing specific
- if (_npcinfo[i].spriteset == kMonsterTwoWing) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) {
- npx = _npcinfo[i].bodysection[7].x;
- npy = _npcinfo[i].bodysection[7].y;
+ if (_npcInfo[i].spriteset == kMonsterTwoWing) {
+ if (_npcInfo[i].attacknext < _ticks && _npcInfo[i].pause < _ticks && !_npcInfo[i].attacking) {
+ npx = _npcInfo[i].bodysection[7].x;
+ npy = _npcInfo[i].bodysection[7].y;
xdif = _player.px - npx;
ydif = _player.py - npy;
@@ -855,82 +855,82 @@ void GriffonEngine::updateNPCs() {
setChannelVolume(snd, config.effectsvol);
}
- _npcinfo[i].attacking = true;
- _npcinfo[i].attackframe = 0;
+ _npcInfo[i].attacking = true;
+ _npcInfo[i].attackframe = 0;
- _npcinfo[i].headtargetx[0] = _player.px + 12;
- _npcinfo[i].headtargety[0] = _player.py - 4;
+ _npcInfo[i].headtargetx[0] = _player.px + 12;
+ _npcInfo[i].headtargety[0] = _player.py - 4;
}
}
}
- if (!_npcinfo[i].attacking && _npcinfo[i].castpause < _ticks) {
- _npcinfo[i].swayspd = 4;
+ if (!_npcInfo[i].attacking && _npcInfo[i].castpause < _ticks) {
+ _npcInfo[i].swayspd = 4;
// sway code
- _npcinfo[i].swayangle = _npcinfo[i].swayangle + _npcinfo[i].swayspd * _fpsr;
- if (_npcinfo[i].swayangle >= 360)
- _npcinfo[i].swayangle = _npcinfo[i].swayangle - 360;
+ _npcInfo[i].swayangle = _npcInfo[i].swayangle + _npcInfo[i].swayspd * _fpsr;
+ if (_npcInfo[i].swayangle >= 360)
+ _npcInfo[i].swayangle = _npcInfo[i].swayangle - 360;
- _npcinfo[i].headtargetx[0] = _npcinfo[i].x + (24 - _npcinfo[i].swayspd / 2) * sin(3.14159 / 180 * _npcinfo[i].swayangle) + 12;
- _npcinfo[i].headtargety[0] = _npcinfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * _npcinfo[i].swayangle);
+ _npcInfo[i].headtargetx[0] = _npcInfo[i].x + (24 - _npcInfo[i].swayspd / 2) * sin(3.14159 / 180 * _npcInfo[i].swayangle) + 12;
+ _npcInfo[i].headtargety[0] = _npcInfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * _npcInfo[i].swayangle);
}
if (dospell) {
- _npcinfo[i].pause = _ticks + 3000;
- _npcinfo[i].attacknext = _ticks + 5000;
- _npcinfo[i].castpause = _ticks + 3000;
+ _npcInfo[i].pause = _ticks + 3000;
+ _npcInfo[i].attacknext = _ticks + 5000;
+ _npcInfo[i].castpause = _ticks + 3000;
- castSpell(3, _npcinfo[i].x, _npcinfo[i].y, _npcinfo[i].x, _npcinfo[i].y, i);
+ castSpell(3, _npcInfo[i].x, _npcInfo[i].y, _npcInfo[i].x, _npcInfo[i].y, i);
- _npcinfo[i].headtargetx[0] = _npcinfo[i].x;
- _npcinfo[i].headtargety[0] = _npcinfo[i].y - 36 + 16;
+ _npcInfo[i].headtargetx[0] = _npcInfo[i].x;
+ _npcInfo[i].headtargety[0] = _npcInfo[i].y - 36 + 16;
}
// targethead code
- xdif = _npcinfo[i].bodysection[7].x - _npcinfo[i].headtargetx[0];
- ydif = _npcinfo[i].bodysection[7].y - _npcinfo[i].headtargety[0];
+ xdif = _npcInfo[i].bodysection[7].x - _npcInfo[i].headtargetx[0];
+ ydif = _npcInfo[i].bodysection[7].y - _npcInfo[i].headtargety[0];
- _npcinfo[i].bodysection[7].x = _npcinfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
- _npcinfo[i].bodysection[7].y = _npcinfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
+ _npcInfo[i].bodysection[7].x = _npcInfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
+ _npcInfo[i].bodysection[7].y = _npcInfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
- _npcinfo[i].bodysection[0].x = _npcinfo[i].x + 12;
- _npcinfo[i].bodysection[0].y = _npcinfo[i].y + 12;
+ _npcInfo[i].bodysection[0].x = _npcInfo[i].x + 12;
+ _npcInfo[i].bodysection[0].y = _npcInfo[i].y + 12;
for (int f = 6; f >= 1; f--) {
- xdif = _npcinfo[i].bodysection[f + 1].x - _npcinfo[i].bodysection[f - 1].x;
- ydif = _npcinfo[i].bodysection[f + 1].y - _npcinfo[i].bodysection[f - 1].y;
+ xdif = _npcInfo[i].bodysection[f + 1].x - _npcInfo[i].bodysection[f - 1].x;
+ ydif = _npcInfo[i].bodysection[f + 1].y - _npcInfo[i].bodysection[f - 1].y;
- float tx = _npcinfo[i].bodysection[f - 1].x + xdif / 2;
- float ty = _npcinfo[i].bodysection[f - 1].y + ydif / 2;
+ float tx = _npcInfo[i].bodysection[f - 1].x + xdif / 2;
+ float ty = _npcInfo[i].bodysection[f - 1].y + ydif / 2;
- _npcinfo[i].bodysection[f].x = _npcinfo[i].bodysection[f].x - (_npcinfo[i].bodysection[f].x - tx) / 3;
- _npcinfo[i].bodysection[f].y = _npcinfo[i].bodysection[f].y - (_npcinfo[i].bodysection[f].y - ty) / 3;
+ _npcInfo[i].bodysection[f].x = _npcInfo[i].bodysection[f].x - (_npcInfo[i].bodysection[f].x - tx) / 3;
+ _npcInfo[i].bodysection[f].y = _npcInfo[i].bodysection[f].y - (_npcInfo[i].bodysection[f].y - ty) / 3;
}
}
// dragon2 specific
- if (_npcinfo[i].spriteset == kMonsterDragon2 && _npcinfo[i].attackattempt < _ticks) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) {
- npx = _npcinfo[i].x;
- npy = _npcinfo[i].y;
+ if (_npcInfo[i].spriteset == kMonsterDragon2 && _npcInfo[i].attackattempt < _ticks) {
+ if (_npcInfo[i].attacknext < _ticks && _npcInfo[i].pause < _ticks && !_npcInfo[i].attacking) {
+ npx = _npcInfo[i].x;
+ npy = _npcInfo[i].y;
xdif = _player.px - npx;
ydif = _player.py - npy;
if (abs(xdif) < 32 && abs(ydif) < 32) {
- _npcinfo[i].attackattempt = _ticks + 100;
+ _npcInfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
if (config.effects) {
int snd = playSound(_sfx[kSndEnemyHit]);
setChannelVolume(snd, config.effectsvol);
}
- _npcinfo[i].attacking = true;
- _npcinfo[i].attackframe = 0;
+ _npcInfo[i].attacking = true;
+ _npcInfo[i].attackframe = 0;
}
}
}
@@ -938,23 +938,23 @@ void GriffonEngine::updateNPCs() {
// endboss specific
- if (_npcinfo[i].spriteset == kMonsterFinalBoss && _npcinfo[i].attackattempt < _ticks) {
- if (_npcinfo[i].attacknext < _ticks && _npcinfo[i].pause < _ticks && !_npcinfo[i].attacking) {
- npx = _npcinfo[i].x;
- npy = _npcinfo[i].y;
+ if (_npcInfo[i].spriteset == kMonsterFinalBoss && _npcInfo[i].attackattempt < _ticks) {
+ if (_npcInfo[i].attacknext < _ticks && _npcInfo[i].pause < _ticks && !_npcInfo[i].attacking) {
+ npx = _npcInfo[i].x;
+ npy = _npcInfo[i].y;
xdif = _player.px - npx;
ydif = _player.py - npy;
if (abs(xdif) < 38 && abs(ydif) < 38) {
- _npcinfo[i].attackattempt = _ticks + 100;
+ _npcInfo[i].attackattempt = _ticks + 100;
if ((int)(RND() * 2) == 0) {
if (config.effects) {
int snd = playSound(_sfx[kSndIce]);
setChannelVolume(snd, config.effectsvol);
}
- _npcinfo[i].attacking = true;
- _npcinfo[i].attackframe = 0;
+ _npcInfo[i].attacking = true;
+ _npcInfo[i].attackframe = 0;
}
}
}
@@ -962,8 +962,8 @@ void GriffonEngine::updateNPCs() {
}
- float npx = _npcinfo[i].x;
- float npy = _npcinfo[i].y;
+ float npx = _npcInfo[i].x;
+ float npy = _npcInfo[i].y;
int xp = (npx / 2 + 6);
int yp = (npy / 2 + 10);
@@ -973,15 +973,15 @@ void GriffonEngine::updateNPCs() {
rcSrc.setWidth(3);
rcSrc.setHeight(3);
- if (_npcinfo[i].pause < _ticks)
+ if (_npcInfo[i].pause < _ticks)
_clipBg->fillRect(rcSrc, i);
pass = 0;
- if (_npcinfo[i].attacking)
+ if (_npcInfo[i].attacking)
pass = 1;
- if (_npcinfo[i].spriteset == kMonsterFireHydra) {
- if (_npcinfo[i].attacking2[0] || _npcinfo[i].attacking2[1] || _npcinfo[i].attacking2[2])
+ if (_npcInfo[i].spriteset == kMonsterFireHydra) {
+ if (_npcInfo[i].attacking2[0] || _npcInfo[i].attacking2[1] || _npcInfo[i].attacking2[2])
pass = 1;
}
@@ -989,18 +989,18 @@ void GriffonEngine::updateNPCs() {
int dist;
float damage;
// spriteset1 specific
- if (_npcinfo[i].spriteset == kMonsterBabyDragon) {
- _npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
- if (_npcinfo[i].attackframe >= 16) {
- _npcinfo[i].attackframe = 0;
- _npcinfo[i].attacking = false;
- _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
+ if (_npcInfo[i].spriteset == kMonsterBabyDragon) {
+ _npcInfo[i].attackframe = _npcInfo[i].attackframe + _npcInfo[i].attackspd * _fpsr;
+ if (_npcInfo[i].attackframe >= 16) {
+ _npcInfo[i].attackframe = 0;
+ _npcInfo[i].attacking = false;
+ _npcInfo[i].attacknext = _ticks + _npcInfo[i].attackdelay;
}
- _npcinfo[i].cattackframe = (int)(_npcinfo[i].attackframe);
+ _npcInfo[i].cattackframe = (int)(_npcInfo[i].attackframe);
- npx = _npcinfo[i].x;
- npy = _npcinfo[i].y;
+ npx = _npcInfo[i].x;
+ npy = _npcInfo[i].y;
float xdif = _player.px - npx;
float ydif = _player.py - npy;
@@ -1008,50 +1008,50 @@ void GriffonEngine::updateNPCs() {
dist = 10;
if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
- _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
+ _npcInfo[i].attacknext = _ticks + _npcInfo[i].attackdelay;
// _npcinfo[i].attackframe = 0;
// _npcinfo[i].attacking = false;
- damage = (float)_npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
+ damage = (float)_npcInfo[i].attackdamage * (0.5 + RND() * 1.0);
if (_player.hp > 0)
damagePlayer(damage);
}
}
- if (_npcinfo[i].spriteset == kMonsterOneWing) {
+ if (_npcInfo[i].spriteset == kMonsterOneWing) {
// targethead code
- float xdif = _npcinfo[i].bodysection[7].x - _npcinfo[i].headtargetx[0];
- float ydif = _npcinfo[i].bodysection[7].y - _npcinfo[i].headtargety[0];
+ float xdif = _npcInfo[i].bodysection[7].x - _npcInfo[i].headtargetx[0];
+ float ydif = _npcInfo[i].bodysection[7].y - _npcInfo[i].headtargety[0];
- _npcinfo[i].bodysection[7].x = _npcinfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
- _npcinfo[i].bodysection[7].y = _npcinfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
+ _npcInfo[i].bodysection[7].x = _npcInfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
+ _npcInfo[i].bodysection[7].y = _npcInfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
- _npcinfo[i].bodysection[0].x = _npcinfo[i].x + 12;
- _npcinfo[i].bodysection[0].y = _npcinfo[i].y + 12;
+ _npcInfo[i].bodysection[0].x = _npcInfo[i].x + 12;
+ _npcInfo[i].bodysection[0].y = _npcInfo[i].y + 12;
for (int f = 6; f >= 1; f--) {
- xdif = _npcinfo[i].bodysection[f + 1].x - _npcinfo[i].bodysection[f - 1].x;
- ydif = _npcinfo[i].bodysection[f + 1].y - _npcinfo[i].bodysection[f - 1].y;
+ xdif = _npcInfo[i].bodysection[f + 1].x - _npcInfo[i].bodysection[f - 1].x;
+ ydif = _npcInfo[i].bodysection[f + 1].y - _npcInfo[i].bodysection[f - 1].y;
- float tx = _npcinfo[i].bodysection[f - 1].x + xdif / 2;
- float ty = _npcinfo[i].bodysection[f - 1].y + ydif / 2;
+ float tx = _npcInfo[i].bodysection[f - 1].x + xdif / 2;
+ float ty = _npcInfo[i].bodysection[f - 1].y + ydif / 2;
- _npcinfo[i].bodysection[f].x = _npcinfo[i].bodysection[f].x - (_npcinfo[i].bodysection[f].x - tx);
- _npcinfo[i].bodysection[f].y = _npcinfo[i].bodysection[f].y - (_npcinfo[i].bodysection[f].y - ty);
+ _npcInfo[i].bodysection[f].x = _npcInfo[i].bodysection[f].x - (_npcInfo[i].bodysection[f].x - tx);
+ _npcInfo[i].bodysection[f].y = _npcInfo[i].bodysection[f].y - (_npcInfo[i].bodysection[f].y - ty);
}
- _npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
- if (_npcinfo[i].attackframe >= 16) {
- _npcinfo[i].attackframe = 0;
- _npcinfo[i].attacking = false;
- _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
+ _npcInfo[i].attackframe = _npcInfo[i].attackframe + _npcInfo[i].attackspd * _fpsr;
+ if (_npcInfo[i].attackframe >= 16) {
+ _npcInfo[i].attackframe = 0;
+ _npcInfo[i].attacking = false;
+ _npcInfo[i].attacknext = _ticks + _npcInfo[i].attackdelay;
}
- _npcinfo[i].cattackframe = (int)(_npcinfo[i].attackframe);
+ _npcInfo[i].cattackframe = (int)(_npcInfo[i].attackframe);
- npx = _npcinfo[i].bodysection[7].x;
- npy = (_npcinfo[i].bodysection[7].y + 16);
+ npx = _npcInfo[i].bodysection[7].x;
+ npy = (_npcInfo[i].bodysection[7].y + 16);
xdif = (_player.px + 12) - npx;
ydif = (_player.py + 12) - npy;
@@ -1059,10 +1059,10 @@ void GriffonEngine::updateNPCs() {
dist = 8;
if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
- _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
+ _npcInfo[i].attacknext = _ticks + _npcInfo[i].attackdelay;
// _npcinfo[i].attackframe = 0
// _npcinfo[i].attacking = false
- damage = (float)_npcinfo[i].attackdamage * (1.0 + (RND() * 0.5));
+ damage = (float)_npcInfo[i].attackdamage * (1.0 + (RND() * 0.5));
if (_player.hp > 0)
damagePlayer(damage);
}
@@ -1070,40 +1070,40 @@ void GriffonEngine::updateNPCs() {
// firehydra
- if (_npcinfo[i].spriteset == kMonsterFireHydra) {
+ if (_npcInfo[i].spriteset == kMonsterFireHydra) {
for (int ff = 0; ff <= 2; ff++) {
- if (_npcinfo[i].attacking2[ff]) {
- float xdif = _npcinfo[i].bodysection[10 * ff + 9].x - _npcinfo[i].headtargetx[ff];
- float ydif = _npcinfo[i].bodysection[10 * ff + 9].y - _npcinfo[i].headtargety[ff];
+ if (_npcInfo[i].attacking2[ff]) {
+ float xdif = _npcInfo[i].bodysection[10 * ff + 9].x - _npcInfo[i].headtargetx[ff];
+ float ydif = _npcInfo[i].bodysection[10 * ff + 9].y - _npcInfo[i].headtargety[ff];
- _npcinfo[i].bodysection[10 * ff + 9].x = _npcinfo[i].bodysection[10 * ff + 9].x - xdif * .2 * _fpsr;
- _npcinfo[i].bodysection[10 * ff + 9].y = _npcinfo[i].bodysection[10 * ff + 9].y - ydif * .2 * _fpsr;
+ _npcInfo[i].bodysection[10 * ff + 9].x = _npcInfo[i].bodysection[10 * ff + 9].x - xdif * .2 * _fpsr;
+ _npcInfo[i].bodysection[10 * ff + 9].y = _npcInfo[i].bodysection[10 * ff + 9].y - ydif * .2 * _fpsr;
- _npcinfo[i].bodysection[10 * ff].x = _npcinfo[i].x + 12 + 8 * cos(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
- _npcinfo[i].bodysection[10 * ff].y = _npcinfo[i].y + 12 + 8 * sin(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
+ _npcInfo[i].bodysection[10 * ff].x = _npcInfo[i].x + 12 + 8 * cos(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
+ _npcInfo[i].bodysection[10 * ff].y = _npcInfo[i].y + 12 + 8 * sin(3.141592 * 2 * (_itemyloc / 16 + ff * 120 / 360));
for (int f = 8; f >= 1; f--) {
- xdif = _npcinfo[i].bodysection[ff * 10 + f + 1].x - _npcinfo[i].bodysection[ff * 10 + f - 1].x;
- ydif = _npcinfo[i].bodysection[ff * 10 + f + 1].y - _npcinfo[i].bodysection[ff * 10 + f - 1].y;
+ xdif = _npcInfo[i].bodysection[ff * 10 + f + 1].x - _npcInfo[i].bodysection[ff * 10 + f - 1].x;
+ ydif = _npcInfo[i].bodysection[ff * 10 + f + 1].y - _npcInfo[i].bodysection[ff * 10 + f - 1].y;
- float tx = _npcinfo[i].bodysection[ff * 10 + f - 1].x + xdif / 2;
- float ty = _npcinfo[i].bodysection[ff * 10 + f - 1].y + ydif / 2;
+ float tx = _npcInfo[i].bodysection[ff * 10 + f - 1].x + xdif / 2;
+ float ty = _npcInfo[i].bodysection[ff * 10 + f - 1].y + ydif / 2;
- _npcinfo[i].bodysection[ff * 10 + f].x = _npcinfo[i].bodysection[ff * 10 + f].x - (_npcinfo[i].bodysection[ff * 10 + f].x - tx) / 3;
- _npcinfo[i].bodysection[ff * 10 + f].y = _npcinfo[i].bodysection[ff * 10 + f].y - (_npcinfo[i].bodysection[ff * 10 + f].y - ty) / 3;
+ _npcInfo[i].bodysection[ff * 10 + f].x = _npcInfo[i].bodysection[ff * 10 + f].x - (_npcInfo[i].bodysection[ff * 10 + f].x - tx) / 3;
+ _npcInfo[i].bodysection[ff * 10 + f].y = _npcInfo[i].bodysection[ff * 10 + f].y - (_npcInfo[i].bodysection[ff * 10 + f].y - ty) / 3;
}
- _npcinfo[i].attackframe2[ff] = _npcinfo[i].attackframe2[ff] + _npcinfo[i].attackspd * _fpsr;
- if (_npcinfo[i].attackframe2[ff] >= 16) {
- _npcinfo[i].attackframe2[ff] = 0;
- _npcinfo[i].attacking2[ff] = false;
- _npcinfo[i].attacknext2[ff] = _ticks + _npcinfo[i].attackdelay;
+ _npcInfo[i].attackframe2[ff] = _npcInfo[i].attackframe2[ff] + _npcInfo[i].attackspd * _fpsr;
+ if (_npcInfo[i].attackframe2[ff] >= 16) {
+ _npcInfo[i].attackframe2[ff] = 0;
+ _npcInfo[i].attacking2[ff] = false;
+ _npcInfo[i].attacknext2[ff] = _ticks + _npcInfo[i].attackdelay;
}
- _npcinfo[i].cattackframe = (int)(_npcinfo[i].attackframe);
+ _npcInfo[i].cattackframe = (int)(_npcInfo[i].attackframe);
- npx = _npcinfo[i].bodysection[10 * ff + 9].x;
- npy = (_npcinfo[i].bodysection[10 * ff + 9].y + 16);
+ npx = _npcInfo[i].bodysection[10 * ff + 9].x;
+ npy = (_npcInfo[i].bodysection[10 * ff + 9].y + 16);
xdif = (_player.px + 12) - npx;
ydif = (_player.py + 12) - npy;
@@ -1111,10 +1111,10 @@ void GriffonEngine::updateNPCs() {
dist = 8;
if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
- _npcinfo[i].attacknext2[ff] = _ticks + _npcinfo[i].attackdelay;
+ _npcInfo[i].attacknext2[ff] = _ticks + _npcInfo[i].attackdelay;
// _npcinfo[i].attackframe2(ff) = 0
// _npcinfo[i].attacking2(ff) = false
- damage = (float)_npcinfo[i].attackdamage * (1.0 + RND() * 0.5);
+ damage = (float)_npcInfo[i].attackdamage * (1.0 + RND() * 0.5);
if (_player.hp > 0)
damagePlayer(damage);
}
@@ -1124,39 +1124,39 @@ void GriffonEngine::updateNPCs() {
}
// twowing specific
- if (_npcinfo[i].spriteset == kMonsterTwoWing) {
+ if (_npcInfo[i].spriteset == kMonsterTwoWing) {
// targethead code
- float xdif = _npcinfo[i].bodysection[7].x - _npcinfo[i].headtargetx[0];
- float ydif = _npcinfo[i].bodysection[7].y - _npcinfo[i].headtargety[0];
+ float xdif = _npcInfo[i].bodysection[7].x - _npcInfo[i].headtargetx[0];
+ float ydif = _npcInfo[i].bodysection[7].y - _npcInfo[i].headtargety[0];
- _npcinfo[i].bodysection[7].x = _npcinfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
- _npcinfo[i].bodysection[7].y = _npcinfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
+ _npcInfo[i].bodysection[7].x = _npcInfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
+ _npcInfo[i].bodysection[7].y = _npcInfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
- _npcinfo[i].bodysection[0].x = _npcinfo[i].x + 12;
- _npcinfo[i].bodysection[0].y = _npcinfo[i].y + 12;
+ _npcInfo[i].bodysection[0].x = _npcInfo[i].x + 12;
+ _npcInfo[i].bodysection[0].y = _npcInfo[i].y + 12;
for (int f = 6; f >= 1; f--) {
- xdif = _npcinfo[i].bodysection[f + 1].x - _npcinfo[i].bodysection[f - 1].x;
- ydif = _npcinfo[i].bodysection[f + 1].y - _npcinfo[i].bodysection[f - 1].y;
+ xdif = _npcInfo[i].bodysection[f + 1].x - _npcInfo[i].bodysection[f - 1].x;
+ ydif = _npcInfo[i].bodysection[f + 1].y - _npcInfo[i].bodysection[f - 1].y;
- float tx = _npcinfo[i].bodysection[f - 1].x + xdif / 2;
- float ty = _npcinfo[i].bodysection[f - 1].y + ydif / 2;
+ float tx = _npcInfo[i].bodysection[f - 1].x + xdif / 2;
+ float ty = _npcInfo[i].bodysection[f - 1].y + ydif / 2;
- _npcinfo[i].bodysection[f].x = _npcinfo[i].bodysection[f].x - (_npcinfo[i].bodysection[f].x - tx);
- _npcinfo[i].bodysection[f].y = _npcinfo[i].bodysection[f].y - (_npcinfo[i].bodysection[f].y - ty);
+ _npcInfo[i].bodysection[f].x = _npcInfo[i].bodysection[f].x - (_npcInfo[i].bodysection[f].x - tx);
+ _npcInfo[i].bodysection[f].y = _npcInfo[i].bodysection[f].y - (_npcInfo[i].bodysection[f].y - ty);
}
- _npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
- if (_npcinfo[i].attackframe >= 16) {
- _npcinfo[i].attackframe = 0;
- _npcinfo[i].attacking = false;
- _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
+ _npcInfo[i].attackframe = _npcInfo[i].attackframe + _npcInfo[i].attackspd * _fpsr;
+ if (_npcInfo[i].attackframe >= 16) {
+ _npcInfo[i].attackframe = 0;
+ _npcInfo[i].attacking = false;
+ _npcInfo[i].attacknext = _ticks + _npcInfo[i].attackdelay;
}
- _npcinfo[i].cattackframe = (int)(_npcinfo[i].attackframe);
+ _npcInfo[i].cattackframe = (int)(_npcInfo[i].attackframe);
- npx = _npcinfo[i].bodysection[7].x;
- npy = (_npcinfo[i].bodysection[7].y + 16);
+ npx = _npcInfo[i].bodysection[7].x;
+ npy = (_npcInfo[i].bodysection[7].y + 16);
xdif = (_player.px + 12) - npx;
ydif = (_player.py + 12) - npy;
@@ -1164,58 +1164,58 @@ void GriffonEngine::updateNPCs() {
dist = 8;
if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
- _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
+ _npcInfo[i].attacknext = _ticks + _npcInfo[i].attackdelay;
// _npcinfo[i].attackframe = 0
// _npcinfo[i].attacking = false
- damage = (float)_npcinfo[i].attackdamage * (1.0 + RND() * 0.5);
+ damage = (float)_npcInfo[i].attackdamage * (1.0 + RND() * 0.5);
if (_player.hp > 0)
damagePlayer(damage);
}
}
// dragon 2 specific
- if (_npcinfo[i].spriteset == kMonsterDragon2) {
+ if (_npcInfo[i].spriteset == kMonsterDragon2) {
- _npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
- if (_npcinfo[i].attackframe >= 16) {
- _npcinfo[i].attackframe = 0;
- _npcinfo[i].attacking = false;
- _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
+ _npcInfo[i].attackframe = _npcInfo[i].attackframe + _npcInfo[i].attackspd * _fpsr;
+ if (_npcInfo[i].attackframe >= 16) {
+ _npcInfo[i].attackframe = 0;
+ _npcInfo[i].attacking = false;
+ _npcInfo[i].attacknext = _ticks + _npcInfo[i].attackdelay;
}
- _npcinfo[i].cattackframe = (int)(_npcinfo[i].attackframe);
+ _npcInfo[i].cattackframe = (int)(_npcInfo[i].attackframe);
- npx = _npcinfo[i].x;
- npy = _npcinfo[i].y;
+ npx = _npcInfo[i].x;
+ npy = _npcInfo[i].y;
float xdif = _player.px - npx;
float ydif = _player.py - npy;
- dist = 16 + _npcinfo[i].attackframe;
+ dist = 16 + _npcInfo[i].attackframe;
if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
- _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
+ _npcInfo[i].attacknext = _ticks + _npcInfo[i].attackdelay;
// _npcinfo[i].attackframe = 0
// _npcinfo[i].attacking = false
- damage = (float)_npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
+ damage = (float)_npcInfo[i].attackdamage * (0.5 + RND() * 1.0);
if (_player.hp > 0)
damagePlayer(damage);
}
}
// endboss specific
- if (_npcinfo[i].spriteset == kMonsterFinalBoss) {
- _npcinfo[i].attackframe = _npcinfo[i].attackframe + _npcinfo[i].attackspd * _fpsr;
- if (_npcinfo[i].attackframe >= 16) {
- _npcinfo[i].attackframe = 0;
- _npcinfo[i].attacking = false;
- _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
+ if (_npcInfo[i].spriteset == kMonsterFinalBoss) {
+ _npcInfo[i].attackframe = _npcInfo[i].attackframe + _npcInfo[i].attackspd * _fpsr;
+ if (_npcInfo[i].attackframe >= 16) {
+ _npcInfo[i].attackframe = 0;
+ _npcInfo[i].attacking = false;
+ _npcInfo[i].attacknext = _ticks + _npcInfo[i].attackdelay;
}
- _npcinfo[i].cattackframe = (int)(_npcinfo[i].attackframe);
+ _npcInfo[i].cattackframe = (int)(_npcInfo[i].attackframe);
- npx = _npcinfo[i].x;
- npy = _npcinfo[i].y;
+ npx = _npcInfo[i].x;
+ npy = _npcInfo[i].y;
float xdif = _player.px - npx;
float ydif = _player.py - npy;
@@ -1223,10 +1223,10 @@ void GriffonEngine::updateNPCs() {
dist = 36;
if (abs(xdif) < dist && abs(ydif) < dist && _player.pause < _ticks) {
- _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay;
+ _npcInfo[i].attacknext = _ticks + _npcInfo[i].attackdelay;
// _npcinfo[i].attackframe = 0
// _npcinfo[i].attacking = false
- damage = (float)_npcinfo[i].attackdamage * (0.5 + RND() * 1.0);
+ damage = (float)_npcInfo[i].attackdamage * (0.5 + RND() * 1.0);
if (_player.hp > 0)
damagePlayer(damage);
}
@@ -1241,12 +1241,12 @@ void GriffonEngine::updateSpells() {
float xloc = 0, yloc = 0;
for (int i = 0; i < kMaxSpell; i++) {
- if (spellinfo[i].frame > 0) {
- int spellnum = spellinfo[i].spellnum;
+ if (_spellInfo[i].frame > 0) {
+ int spellnum = _spellInfo[i].spellnum;
// water
if (spellnum == 0 && !_forcePause) {
- float fr = (32 - spellinfo[i].frame);
+ float fr = (32 - _spellInfo[i].frame);
int ll[4][2];
ll[0][0] = -2;
@@ -1269,8 +1269,8 @@ void GriffonEngine::updateSpells() {
rcSrc.setWidth(16);
rcSrc.setHeight(16);
- xloc = spellinfo[i].enemyx + 12 + ll[f][0] * 16;
- yloc = spellinfo[i].enemyy + 16 + ll[f][1] * 16;
+ xloc = _spellInfo[i].enemyx + 12 + ll[f][0] * 16;
+ yloc = _spellInfo[i].enemyy + 16 + ll[f][1] * 16;
rcDest.left = xloc;
rcDest.top = yloc;
@@ -1290,11 +1290,11 @@ void GriffonEngine::updateSpells() {
rcSrc.setWidth(16);
rcSrc.setHeight(16);
- float xst = spellinfo[i].enemyx + 12 + ll[f][0] * 16;
- float yst = spellinfo[i].enemyy + 16 + ll[f][1] * 16;
+ float xst = _spellInfo[i].enemyx + 12 + ll[f][0] * 16;
+ float yst = _spellInfo[i].enemyy + 16 + ll[f][1] * 16;
- float xi = (spellinfo[i].enemyx - xst) * 2 / 8;
- float yi = (spellinfo[i].enemyy - yst) * 2 / 8;
+ float xi = (_spellInfo[i].enemyx - xst) * 2 / 8;
+ float yi = (_spellInfo[i].enemyy - yst) * 2 / 8;
float fl = (fr - f * 4 - 8) / 2;
xloc = xst + xi * fl * fl;
@@ -1311,15 +1311,15 @@ void GriffonEngine::updateSpells() {
_spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
_spellImg->setAlpha(255, true);
- if (spellinfo[i].damagewho == 0) {
- for (int e = 1; e <= _lastnpc; e++) {
- float xdif = (xloc + 16) - (_npcinfo[e].x + 12);
- float ydif = (yloc + 16) - (_npcinfo[e].y + 12);
+ if (_spellInfo[i].damagewho == 0) {
+ for (int e = 1; e <= _lastNpc; e++) {
+ float xdif = (xloc + 16) - (_npcInfo[e].x + 12);
+ float ydif = (yloc + 16) - (_npcInfo[e].y + 12);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- float damage = (float)_player.spellDamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
+ float damage = (float)_player.spellDamage * (1.0 + RND() * 0.5) * (float)_spellInfo[i].strength;
- if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
+ if (_npcInfo[e].hp > 0 && _npcInfo[e].pause < _ticks) {
damageNPC(e, damage, 1);
if (config.effects) {
int snd = playSound(_sfx[kSndIce]);
@@ -1331,13 +1331,13 @@ void GriffonEngine::updateSpells() {
}
// check for post damage
- if (nposts > 0) {
- for (int e = 0; e <= nposts - 1; e++) {
+ if (_postInfoNbr > 0) {
+ for (int e = 0; e <= _postInfoNbr - 1; e++) {
float xdif = (xloc + 16) - (_postInfo[e][0] + 8);
float ydif = (yloc + 16) - (_postInfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- _objmapf[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1;
+ _objectMapFull[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1;
_objectMap[(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = -1;
rcSrc.left = _postInfo[e][0] / 2;
@@ -1363,20 +1363,20 @@ void GriffonEngine::updateSpells() {
// metal
if (spellnum == 1 && !_forcePause) {
- int fr = (int)((32 - spellinfo[i].frame) * 4) % 3;
+ int fr = (int)((32 - _spellInfo[i].frame) * 4) % 3;
rcSrc.left = fr * 48;
rcSrc.top = 0;
rcSrc.setWidth(48);
rcSrc.setHeight(48);
- float c1 = (32 - spellinfo[i].frame) / 16;
+ float c1 = (32 - _spellInfo[i].frame) / 16;
- float halfx = (spellinfo[i].homex - 12) + ((spellinfo[i].enemyx - 12) - (spellinfo[i].homex - 12)) / 2;
- float halfy = (spellinfo[i].homey - 12) + ((spellinfo[i].enemyy - 12) - (spellinfo[i].homey - 12)) / 2;
+ float halfx = (_spellInfo[i].homex - 12) + ((_spellInfo[i].enemyx - 12) - (_spellInfo[i].homex - 12)) / 2;
+ float halfy = (_spellInfo[i].homey - 12) + ((_spellInfo[i].enemyy - 12) - (_spellInfo[i].homey - 12)) / 2;
- float wdth = (halfx - spellinfo[i].homex) * 1.2;
- float hight = (halfy - spellinfo[i].homey) * 1.2;
+ float wdth = (halfx - _spellInfo[i].homex) * 1.2;
+ float hight = (halfy - _spellInfo[i].homey) * 1.2;
xloc = halfx + wdth * cos(3.14159 + 3.14159 * 2 * c1);
yloc = halfy + hight * sin(3.14159 + 3.14159 * 2 * c1);
@@ -1386,19 +1386,19 @@ void GriffonEngine::updateSpells() {
_spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- spellinfo[i].frame = spellinfo[i].frame - 0.2 * _fpsr;
- if (spellinfo[i].frame < 0)
- spellinfo[i].frame = 0;
+ _spellInfo[i].frame = _spellInfo[i].frame - 0.2 * _fpsr;
+ if (_spellInfo[i].frame < 0)
+ _spellInfo[i].frame = 0;
- if (spellinfo[i].damagewho == 0) {
- for (int e = 1; e <= _lastnpc; e++) {
- float xdif = (xloc + 24) - (_npcinfo[e].x + 12);
- float ydif = (yloc + 24) - (_npcinfo[e].y + 12);
+ if (_spellInfo[i].damagewho == 0) {
+ for (int e = 1; e <= _lastNpc; e++) {
+ float xdif = (xloc + 24) - (_npcInfo[e].x + 12);
+ float ydif = (yloc + 24) - (_npcInfo[e].y + 12);
if ((abs(xdif) < 24 && abs(ydif) < 24)) {
- float damage = (float)_player.spellDamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
+ float damage = (float)_player.spellDamage * (1.0 + RND() * 0.5) * (float)_spellInfo[i].strength;
- if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
+ if (_npcInfo[e].hp > 0 && _npcInfo[e].pause < _ticks) {
damageNPC(e, damage, 1);
if (config.effects) {
int snd = playSound(_sfx[kSndMetalHit]);
@@ -1409,26 +1409,26 @@ void GriffonEngine::updateSpells() {
}
}
- if (spellinfo[i].damagewho == 1) {
+ if (_spellInfo[i].damagewho == 1) {
// --------- boss 1 specific
- if (ABS(spellinfo[i].frame) < 0 && _npcinfo[spellinfo[i].npc].spriteset == kMonsterBoss1) {
- int npc = spellinfo[i].npc;
- _npcinfo[npc].attackframe = 0;
- _npcinfo[npc].attacking = false;
+ if (ABS(_spellInfo[i].frame) < 0 && _npcInfo[_spellInfo[i].npc].spriteset == kMonsterBoss1) {
+ int npc = _spellInfo[i].npc;
+ _npcInfo[npc].attackframe = 0;
+ _npcInfo[npc].attacking = false;
- _npcinfo[npc].pause = _ticks + 1000;
- _npcinfo[npc].attacknext = _ticks + 4000;
+ _npcInfo[npc].pause = _ticks + 1000;
+ _npcInfo[npc].attacknext = _ticks + 4000;
}
// ---------------
// --------- blackknight specific
- if (ABS(spellinfo[i].frame) < 0 && _npcinfo[spellinfo[i].npc].spriteset == kMonsterBlackKnight) {
- int npc = spellinfo[i].npc;
- _npcinfo[npc].attackframe = 0;
- _npcinfo[npc].attacking = false;
+ if (ABS(_spellInfo[i].frame) < 0 && _npcInfo[_spellInfo[i].npc].spriteset == kMonsterBlackKnight) {
+ int npc = _spellInfo[i].npc;
+ _npcInfo[npc].attackframe = 0;
+ _npcInfo[npc].attacking = false;
- _npcinfo[npc].pause = _ticks + 1000;
- _npcinfo[npc].attacknext = _ticks + 3500;
+ _npcInfo[npc].pause = _ticks + 1000;
+ _npcInfo[npc].attacknext = _ticks + 3500;
}
// ---------------
@@ -1436,7 +1436,7 @@ void GriffonEngine::updateSpells() {
float ydif = (yloc + 24) - (_player.py + 12);
if ((abs(xdif) < 24 && abs(ydif) < 24) && _player.pause < _ticks) {
- float damage = (float)_npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
+ float damage = (float)_npcInfo[_spellInfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
damagePlayer(damage);
@@ -1450,13 +1450,13 @@ void GriffonEngine::updateSpells() {
// check for(int post damage
- if (nposts > 0) {
- for (int e = 0; e <= nposts - 1; e++) {
+ if (_postInfoNbr > 0) {
+ for (int e = 0; e <= _postInfoNbr - 1; e++) {
float xdif = (xloc + 24) - (_postInfo[e][0] + 8);
float ydif = (yloc + 24) - (_postInfo[e][1] + 8);
if ((abs(xdif) < 24 && abs(ydif) < 24)) {
- _objmapf[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1;
+ _objectMapFull[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1;
_objectMap[(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = -1;
rcSrc.left = _postInfo[e][0] / 2;
@@ -1479,27 +1479,27 @@ void GriffonEngine::updateSpells() {
// earth
if (spellnum == 2 && !_forcePause) {
- float hght = 240 - spellinfo[i].enemyy;
+ float hght = 240 - _spellInfo[i].enemyy;
for (int f = 8; f >= 0; f--) {
- float fr = (32 - spellinfo[i].frame);
+ float fr = (32 - _spellInfo[i].frame);
if (fr > f && fr < f + 16) {
- rcSrc.left = 32 * spellinfo[i].rockimg[f];
+ rcSrc.left = 32 * _spellInfo[i].rockimg[f];
rcSrc.top = 48;
rcSrc.setWidth(32);
rcSrc.setHeight(32);
bool scatter = false;
if (fr < 8 + f) {
- xloc = spellinfo[i].enemyx - 4;
- yloc = spellinfo[i].enemyy * (1 - cos(3.14159 / 2 * (fr - f) / 8)); // ^ 2;
+ xloc = _spellInfo[i].enemyx - 4;
+ yloc = _spellInfo[i].enemyy * (1 - cos(3.14159 / 2 * (fr - f) / 8)); // ^ 2;
yloc *= yloc;
} else {
scatter = true;
- xloc = spellinfo[i].enemyx - 4 - spellinfo[i].rockdeflect[f] * sin(3.14159 / 2 * ((fr - f) - 8) / 8);
- yloc = spellinfo[i].enemyy + hght * (1 - cos(3.14159 / 2 * ((fr - f) - 8) / 8));
+ xloc = _spellInfo[i].enemyx - 4 - _spellInfo[i].rockdeflect[f] * sin(3.14159 / 2 * ((fr - f) - 8) / 8);
+ yloc = _spellInfo[i].enemyy + hght * (1 - cos(3.14159 / 2 * ((fr - f) - 8) / 8));
}
rcDest.left = xloc;
@@ -1509,15 +1509,15 @@ void GriffonEngine::updateSpells() {
_spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
if (scatter) {
- if (spellinfo[i].damagewho == 0) {
- for (int e = 1; e <= _lastnpc; e++) {
- float xdif = (xloc + 16) - (_npcinfo[e].x + 12);
- float ydif = (yloc + 16) - (_npcinfo[e].y + 12);
+ if (_spellInfo[i].damagewho == 0) {
+ for (int e = 1; e <= _lastNpc; e++) {
+ float xdif = (xloc + 16) - (_npcInfo[e].x + 12);
+ float ydif = (yloc + 16) - (_npcInfo[e].y + 12);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- float damage = (float)_player.spellDamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
+ float damage = (float)_player.spellDamage * (1.0 + RND() * 0.5) * (float)_spellInfo[i].strength;
- if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
+ if (_npcInfo[e].hp > 0 && _npcInfo[e].pause < _ticks) {
damageNPC(e, damage, 1);
if (config.effects) {
int snd = playSound(_sfx[kSndRocks]);
@@ -1530,13 +1530,13 @@ void GriffonEngine::updateSpells() {
// check for(int post damage
- if (nposts > 0) {
- for (int e = 0; e <= nposts - 1; e++) {
+ if (_postInfoNbr > 0) {
+ for (int e = 0; e <= _postInfoNbr - 1; e++) {
float xdif = (xloc + 16) - (_postInfo[e][0] + 8);
float ydif = (yloc + 16) - (_postInfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- _objmapf[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1;
+ _objectMapFull[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1;
_objectMap[(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = -1;
rcSrc.left = _postInfo[e][0] / 2;
@@ -1560,16 +1560,16 @@ void GriffonEngine::updateSpells() {
}
}
- spellinfo[i].frame = spellinfo[i].frame - 0.2 * _fpsr;
- if (spellinfo[i].frame < 0)
- spellinfo[i].frame = 0;
+ _spellInfo[i].frame = _spellInfo[i].frame - 0.2 * _fpsr;
+ if (_spellInfo[i].frame < 0)
+ _spellInfo[i].frame = 0;
}
// crystal
if (spellnum == 5) {
- float fra = (32 - spellinfo[i].frame);
- int fr = (int)((spellinfo[i].frame) * 2) % 8;
+ float fra = (32 - _spellInfo[i].frame);
+ int fr = (int)((_spellInfo[i].frame) * 2) % 8;
rcSrc.left = fr * 32;
rcSrc.top = 96 + 48;
@@ -1589,9 +1589,9 @@ void GriffonEngine::updateSpells() {
_spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
_spellImg->setAlpha(255, true);
- spellinfo[i].frame = spellinfo[i].frame - 0.3 * _fpsr;
- if (spellinfo[i].frame < 0) {
- spellinfo[i].frame = 0;
+ _spellInfo[i].frame = _spellInfo[i].frame - 0.3 * _fpsr;
+ if (_spellInfo[i].frame < 0) {
+ _spellInfo[i].frame = 0;
_forcePause = false;
float npx = _player.px + 12;
@@ -1666,8 +1666,8 @@ void GriffonEngine::updateSpells() {
// room fireballs
if (spellnum == 6 && !_forcePause) {
- if (spellinfo[i].frame > 16) {
- float fr = (32 - spellinfo[i].frame);
+ if (_spellInfo[i].frame > 16) {
+ float fr = (32 - _spellInfo[i].frame);
_spellImg->setAlpha(192 * sin(3.14159 * fr / 4), true);
@@ -1676,10 +1676,10 @@ void GriffonEngine::updateSpells() {
rcSrc.setWidth(16);
rcSrc.setHeight(16);
- for (int ff = 0; ff <= spellinfo[i].nfballs - 1; ff++) {
+ for (int ff = 0; ff <= _spellInfo[i].nfballs - 1; ff++) {
- xloc = spellinfo[i].fireballs[ff][0] + (int)(RND() * 3) - 1;
- yloc = spellinfo[i].fireballs[ff][1] + (int)(RND() * 3) - 1;
+ xloc = _spellInfo[i].fireballs[ff][0] + (int)(RND() * 3) - 1;
+ yloc = _spellInfo[i].fireballs[ff][1] + (int)(RND() * 3) - 1;
rcDest.left = xloc;
rcDest.top = yloc;
@@ -1696,9 +1696,9 @@ void GriffonEngine::updateSpells() {
rcSrc.setWidth(16);
rcSrc.setHeight(16);
- for (int ff = 0; ff <= spellinfo[i].nfballs - 1; ff++) {
- float ax = spellinfo[i].fireballs[ff][0];
- float ay = spellinfo[i].fireballs[ff][1];
+ for (int ff = 0; ff <= _spellInfo[i].nfballs - 1; ff++) {
+ float ax = _spellInfo[i].fireballs[ff][0];
+ float ay = _spellInfo[i].fireballs[ff][1];
float bx = _player.px + 4;
float by = _player.py + 4;
float d = sqrt((bx - ax) * (bx - ax) + (by - ay) * (by - ay));
@@ -1706,15 +1706,15 @@ void GriffonEngine::updateSpells() {
float tx = (bx - ax) / d;
float ty = (by - ay) / d;
- spellinfo[i].fireballs[ff][2] += tx * 1.2 * _fpsr;
- spellinfo[i].fireballs[ff][3] += ty * 1.2 * _fpsr;
+ _spellInfo[i].fireballs[ff][2] += tx * 1.2 * _fpsr;
+ _spellInfo[i].fireballs[ff][3] += ty * 1.2 * _fpsr;
- if (spellinfo[i].ballon[ff] == 1) {
- spellinfo[i].fireballs[ff][0] = ax + spellinfo[i].fireballs[ff][2] * 0.2 * _fpsr;
- spellinfo[i].fireballs[ff][1] = ay + spellinfo[i].fireballs[ff][3] * 0.2 * _fpsr;
+ if (_spellInfo[i].ballon[ff] == 1) {
+ _spellInfo[i].fireballs[ff][0] = ax + _spellInfo[i].fireballs[ff][2] * 0.2 * _fpsr;
+ _spellInfo[i].fireballs[ff][1] = ay + _spellInfo[i].fireballs[ff][3] * 0.2 * _fpsr;
- xloc = spellinfo[i].fireballs[ff][0] + (int)(RND() * 3) - 1;
- yloc = spellinfo[i].fireballs[ff][1] + (int)(RND() * 3) - 1;
+ xloc = _spellInfo[i].fireballs[ff][0] + (int)(RND() * 3) - 1;
+ yloc = _spellInfo[i].fireballs[ff][1] + (int)(RND() * 3) - 1;
rcDest.left = xloc;
rcDest.top = yloc;
@@ -1723,27 +1723,27 @@ void GriffonEngine::updateSpells() {
}
if (xloc < -1 || yloc < -1 || xloc > 304 || yloc > 224)
- spellinfo[i].ballon[ff] = 0;
+ _spellInfo[i].ballon[ff] = 0;
}
_spellImg->setAlpha(255, true);
}
- spellinfo[i].frame = spellinfo[i].frame - 0.2 * _fpsr;
- if (spellinfo[i].frame < 0)
- spellinfo[i].frame = 0;
+ _spellInfo[i].frame = _spellInfo[i].frame - 0.2 * _fpsr;
+ if (_spellInfo[i].frame < 0)
+ _spellInfo[i].frame = 0;
- if (spellinfo[i].damagewho == 1) {
- for (int ff = 0; ff <= spellinfo[i].nfballs - 1; ff++) {
- if (spellinfo[i].ballon[ff] == 1) {
- xloc = spellinfo[i].fireballs[ff][0] + (int)(RND() * 3) - 1;
- yloc = spellinfo[i].fireballs[ff][1] + (int)(RND() * 3) - 1;
+ if (_spellInfo[i].damagewho == 1) {
+ for (int ff = 0; ff <= _spellInfo[i].nfballs - 1; ff++) {
+ if (_spellInfo[i].ballon[ff] == 1) {
+ xloc = _spellInfo[i].fireballs[ff][0] + (int)(RND() * 3) - 1;
+ yloc = _spellInfo[i].fireballs[ff][1] + (int)(RND() * 3) - 1;
float xdif = (xloc + 8) - (_player.px + 12);
float ydif = (yloc + 8) - (_player.py + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
- float damage = _npcinfo[spellinfo[i].npc].spelldamage * (1 + RND() * 0.5) / 3;
+ float damage = _npcInfo[_spellInfo[i].npc].spelldamage * (1 + RND() * 0.5) / 3;
if (_player.hp > 0)
damagePlayer(damage);
@@ -1791,28 +1791,28 @@ void GriffonEngine::updateSpells() {
orn = rn;
- if (spellinfo[i].damagewho == 0) {
- for (int e = 1; e <= _lastnpc; e++) {
- float xdif = (x + 16) - (_npcinfo[e].x + 12);
- float ydif = (y + 16) - (_npcinfo[e].y + 12);
+ if (_spellInfo[i].damagewho == 0) {
+ for (int e = 1; e <= _lastNpc; e++) {
+ float xdif = (x + 16) - (_npcInfo[e].x + 12);
+ float ydif = (y + 16) - (_npcInfo[e].y + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = 30 * (1 + RND() * 0.5);
- if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks)
+ if (_npcInfo[e].hp > 0 && _npcInfo[e].pause < _ticks)
damageNPC(e, damage, 1);
}
}
}
// check for post damage
- if (nposts > 0) {
- for (int e = 0; e <= nposts - 1; e++) {
+ if (_postInfoNbr > 0) {
+ for (int e = 0; e <= _postInfoNbr - 1; e++) {
float xdif = (xloc + 16) - (_postInfo[e][0] + 8);
float ydif = (yloc + 16) - (_postInfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- _objmapf[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1;
+ _objectMapFull[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1;
_objectMap[(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = -1;
rcSrc.left = _postInfo[e][0] / 2;
@@ -1848,28 +1848,28 @@ void GriffonEngine::updateSpells() {
orn = rn;
- if (spellinfo[i].damagewho == 0) {
- for (int e = 1; e <= _lastnpc; e++) {
- float xdif = (x + 16) - (_npcinfo[e].x + 12);
- float ydif = (y + 16) - (_npcinfo[e].y + 12);
+ if (_spellInfo[i].damagewho == 0) {
+ for (int e = 1; e <= _lastNpc; e++) {
+ float xdif = (x + 16) - (_npcInfo[e].x + 12);
+ float ydif = (y + 16) - (_npcInfo[e].y + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = 30 * (1 + RND() * 0.5);
- if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks)
+ if (_npcInfo[e].hp > 0 && _npcInfo[e].pause < _ticks)
damageNPC(e, damage, 1);
}
}
}
// check for post damage
- if (nposts > 0) {
- for (int e = 0; e <= nposts - 1; e++) {
+ if (_postInfoNbr > 0) {
+ for (int e = 0; e <= _postInfoNbr - 1; e++) {
float xdif = (xloc + 16) - (_postInfo[e][0] + 8);
float ydif = (yloc + 16) - (_postInfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- _objmapf[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1;
+ _objectMapFull[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1;
_objectMap[(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = -1;
rcSrc.left = _postInfo[e][0] / 2;
@@ -1905,28 +1905,28 @@ void GriffonEngine::updateSpells() {
orn = rn;
- if (spellinfo[i].damagewho == 0) {
- for (int e = 1; e <= _lastnpc; e++) {
- float xdif = (x + 16) - (_npcinfo[e].x + 12);
- float ydif = (y + 16) - (_npcinfo[e].y + 12);
+ if (_spellInfo[i].damagewho == 0) {
+ for (int e = 1; e <= _lastNpc; e++) {
+ float xdif = (x + 16) - (_npcInfo[e].x + 12);
+ float ydif = (y + 16) - (_npcInfo[e].y + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = 30 * (1 + RND() * 0.5);
- if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks)
+ if (_npcInfo[e].hp > 0 && _npcInfo[e].pause < _ticks)
damageNPC(e, damage, 1);
}
}
}
// check for post damage
- if (nposts > 0) {
- for (int e = 0; e <= nposts - 1; e++) {
+ if (_postInfoNbr > 0) {
+ for (int e = 0; e <= _postInfoNbr - 1; e++) {
float xdif = (xloc + 16) - (_postInfo[e][0] + 8);
float ydif = (yloc + 16) - (_postInfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- _objmapf[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1;
+ _objectMapFull[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1;
_objectMap[(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = -1;
rcSrc.left = _postInfo[e][0] / 2;
@@ -1962,28 +1962,28 @@ void GriffonEngine::updateSpells() {
orn = rn;
- if (spellinfo[i].damagewho == 0) {
- for (int e = 1; e <= _lastnpc; e++) {
- float xdif = (x + 16) - (_npcinfo[e].x + 12);
- float ydif = (y + 16) - (_npcinfo[e].y + 12);
+ if (_spellInfo[i].damagewho == 0) {
+ for (int e = 1; e <= _lastNpc; e++) {
+ float xdif = (x + 16) - (_npcInfo[e].x + 12);
+ float ydif = (y + 16) - (_npcInfo[e].y + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
float damage = 30 * (1 + RND() * 0.5);
- if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks)
+ if (_npcInfo[e].hp > 0 && _npcInfo[e].pause < _ticks)
damageNPC(e, damage, 1);
}
}
}
// check for post damage
- if (nposts > 0) {
- for (int e = 0; e <= nposts - 1; e++) {
+ if (_postInfoNbr > 0) {
+ for (int e = 0; e <= _postInfoNbr - 1; e++) {
float xdif = (xloc + 16) - (_postInfo[e][0] + 8);
float ydif = (yloc + 16) - (_postInfo[e][1] + 8);
if ((abs(xdif) < 16 && abs(ydif) < 16)) {
- _objmapf[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1;
+ _objectMapFull[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1;
_objectMap[(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = -1;
rcSrc.left = _postInfo[e][0] / 2;
@@ -2000,9 +2000,9 @@ void GriffonEngine::updateSpells() {
}
}
- spellinfo[i].frame -= 0.5 * _fpsr;
- if (spellinfo[i].frame < 0) {
- spellinfo[i].frame = 0;
+ _spellInfo[i].frame -= 0.5 * _fpsr;
+ if (_spellInfo[i].frame < 0) {
+ _spellInfo[i].frame = 0;
_forcePause = false;
}
}
@@ -2013,8 +2013,8 @@ void GriffonEngine::updateSpells() {
long cl2 = _videoBuffer->format.RGBToColor(142, 173, 191);
long cl3 = _videoBuffer->format.RGBToColor(240, 240, 240);
- int px = spellinfo[i].enemyx + 12;
- int py = spellinfo[i].enemyy + 24;
+ int px = _spellInfo[i].enemyx + 12;
+ int py = _spellInfo[i].enemyy + 24;
int apx = px + (int)(RND() * 20 - 10);
int apy = py + (int)(RND() * 20 - 10);
@@ -2040,7 +2040,7 @@ void GriffonEngine::updateSpells() {
orn = rn;
- if (spellinfo[i].damagewho == 1) {
+ if (_spellInfo[i].damagewho == 1) {
float xdif = (x + 8) - (_player.px + 12);
float ydif = (y + 8) - (_player.py + 12);
@@ -2049,7 +2049,7 @@ void GriffonEngine::updateSpells() {
if (damage < 5)
damage = 5;
- if ((_npcinfo[spellinfo[i].npc].spriteset == kMonsterBatKitty) && (damage < 50))
+ if ((_npcInfo[_spellInfo[i].npc].spriteset == kMonsterBatKitty) && (damage < 50))
damage = 40 + (int)(RND() * 40);
if (_player.hp > 0)
@@ -2059,12 +2059,12 @@ void GriffonEngine::updateSpells() {
}
}
- spellinfo[i].frame -= 0.5 * _fpsr;
- if (spellinfo[i].frame < 0) {
- spellinfo[i].frame = 0;
+ _spellInfo[i].frame -= 0.5 * _fpsr;
+ if (_spellInfo[i].frame < 0) {
+ _spellInfo[i].frame = 0;
- _npcinfo[spellinfo[i].npc].attacking = false;
- _npcinfo[spellinfo[i].npc].attacknext = _ticks + _npcinfo[spellinfo[i].npc].attackdelay;
+ _npcInfo[_spellInfo[i].npc].attacking = false;
+ _npcInfo[_spellInfo[i].npc].attacknext = _ticks + _npcInfo[_spellInfo[i].npc].attackdelay;
}
}
}
@@ -2076,21 +2076,21 @@ void GriffonEngine::updateSpellsUnder() {
return;
for (int i = 0; i < kMaxSpell; i++) {
- if (spellinfo[i].frame > 0) {
- int spellnum = spellinfo[i].spellnum;
+ if (_spellInfo[i].frame > 0) {
+ int spellnum = _spellInfo[i].spellnum;
// water
if (spellnum == 0) {
- int fra = (32 - spellinfo[i].frame);
- int fr = (int)((32 - spellinfo[i].frame) * 2) % 4;
+ int fra = (32 - _spellInfo[i].frame);
+ int fr = (int)((32 - _spellInfo[i].frame) * 2) % 4;
rcSrc.left = fr * 48;
rcSrc.top = 96;
rcSrc.setWidth(48);
rcSrc.setHeight(48);
- rcDest.left = spellinfo[i].enemyx - 12;
- rcDest.top = spellinfo[i].enemyy - 8;
+ rcDest.left = _spellInfo[i].enemyx - 12;
+ rcDest.top = _spellInfo[i].enemyy - 8;
int f = 160;
if (fra < 8)
@@ -2102,14 +2102,14 @@ void GriffonEngine::updateSpellsUnder() {
_spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
_spellImg->setAlpha(255, true);
- spellinfo[i].frame = spellinfo[i].frame - 0.2 * _fpsr;
- if (spellinfo[i].frame < 0)
- spellinfo[i].frame = 0;
+ _spellInfo[i].frame = _spellInfo[i].frame - 0.2 * _fpsr;
+ if (_spellInfo[i].frame < 0)
+ _spellInfo[i].frame = 0;
- for (f = 1; f <= _lastnpc; f++) {
- int xdif = spellinfo[i].enemyx - _npcinfo[f].x;
- int ydif = spellinfo[i].enemyy - _npcinfo[f].y;
+ for (f = 1; f <= _lastNpc; f++) {
+ int xdif = _spellInfo[i].enemyx - _npcInfo[f].x;
+ int ydif = _spellInfo[i].enemyy - _npcInfo[f].y;
float dist = sqrt((float)(xdif * xdif + ydif * ydif));
@@ -2119,8 +2119,8 @@ void GriffonEngine::updateSpellsUnder() {
if (dist > 5) {
float ratio = (1 - dist / 25);
- float newx = _npcinfo[f].x + ratio * xdif / 3 * _fpsr;
- float newy = _npcinfo[f].y + ratio * ydif / 3 * _fpsr;
+ float newx = _npcInfo[f].x + ratio * xdif / 3 * _fpsr;
+ float newy = _npcInfo[f].y + ratio * ydif / 3 * _fpsr;
int sx = (newx / 2 + 6);
int sy = (newy / 2 + 10);
@@ -2129,15 +2129,15 @@ void GriffonEngine::updateSpellsUnder() {
unsigned int dq = *temp;
if (dq == 0) {
- _npcinfo[f].x = newx;
- _npcinfo[f].y = newy;
+ _npcInfo[f].x = newx;
+ _npcInfo[f].y = newy;
// _npcinfo[f].castpause = _ticks + 200;
} else {
int xpass = 0;
int ypass = 0;
sx = (newx / 2 + 6);
- sy = (_npcinfo[f].y / 2 + 10);
+ sy = (_npcInfo[f].y / 2 + 10);
temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
dq = *temp;
@@ -2145,7 +2145,7 @@ void GriffonEngine::updateSpellsUnder() {
xpass = 1;
- sx = (_npcinfo[f].x / 2 + 6);
+ sx = (_npcInfo[f].x / 2 + 6);
sy = (newy / 2 + 10);
temp = (uint32 *)_clipBg->getBasePtr(sx, sy);
dq = *temp;
@@ -2154,14 +2154,14 @@ void GriffonEngine::updateSpellsUnder() {
ypass = 1;
if (ypass == 1) {
- newx = _npcinfo[f].x;
+ newx = _npcInfo[f].x;
} else if (xpass == 1) {
- newy = _npcinfo[f].y;
+ newy = _npcInfo[f].y;
}
if (xpass == 1 || ypass == 1) {
- _npcinfo[f].x = newx;
- _npcinfo[f].y = newy;
+ _npcInfo[f].x = newx;
+ _npcInfo[f].y = newy;
// _npcinfo[f].castpause = _ticks + 200;
}
}
@@ -2171,7 +2171,7 @@ void GriffonEngine::updateSpellsUnder() {
// fire
if (spellnum == 3) {
- float fr = (32 - spellinfo[i].frame);
+ float fr = (32 - _spellInfo[i].frame);
fr = fr * fr * (1 - cos(3.14159 / 4 + 3.14159 / 4 * fr / 32));
@@ -2179,14 +2179,14 @@ void GriffonEngine::updateSpellsUnder() {
fr = 32;
float s = 8;
- if (spellinfo[i].frame < 8)
- s = spellinfo[i].frame;
+ if (_spellInfo[i].frame < 8)
+ s = _spellInfo[i].frame;
int fra = (int)fr;
for (int f = 0; f <= 4; f++) {
for (int x = 0; x <= fra; x += 2) {
- if (spellinfo[i].legalive[f] >= x) {
+ if (_spellInfo[i].legalive[f] >= x) {
_spellImg->setAlpha(192 * sin(3.14159 * x / 32) * s / 8, true);
float an = 360 / 5 * f + x / 32 * 180;
@@ -2196,8 +2196,8 @@ void GriffonEngine::updateSpellsUnder() {
rcSrc.setWidth(16);
rcSrc.setHeight(16);
- float xloc = (float)(spellinfo[i].enemyx + 4 + x * 2 * cos(3.14159 / 180 * an) + (int)(RND() * 3) - 1);
- float yloc = (float)(spellinfo[i].enemyy + 4 + x * 2 * sin(3.14159 / 180 * an) + (int)(RND() * 3) - 1);
+ float xloc = (float)(_spellInfo[i].enemyx + 4 + x * 2 * cos(3.14159 / 180 * an) + (int)(RND() * 3) - 1);
+ float yloc = (float)(_spellInfo[i].enemyy + 4 + x * 2 * sin(3.14159 / 180 * an) + (int)(RND() * 3) - 1);
rcDest.left = (int)xloc;
rcDest.top = (int)yloc;
@@ -2211,21 +2211,21 @@ void GriffonEngine::updateSpellsUnder() {
unsigned int dq = *temp;
if (dq > 1000 && x > 4)
- spellinfo[i].legalive[f] = x;
+ _spellInfo[i].legalive[f] = x;
- if (spellinfo[i].damagewho == 0) {
- for (int e = 1; e <= _lastnpc; e++) {
- float xdif = (xloc + 8) - (_npcinfo[e].x + 12);
- float ydif = (yloc + 8) - (_npcinfo[e].y + 12);
+ if (_spellInfo[i].damagewho == 0) {
+ for (int e = 1; e <= _lastNpc; e++) {
+ float xdif = (xloc + 8) - (_npcInfo[e].x + 12);
+ float ydif = (yloc + 8) - (_npcInfo[e].y + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
- float damage = (float)_player.spellDamage * (1.0 + RND() * 0.5) * (float)spellinfo[i].strength;
+ float damage = (float)_player.spellDamage * (1.0 + RND() * 0.5) * (float)_spellInfo[i].strength;
- if (_npcinfo[e].spriteset == kMonsterFireHydra)
+ if (_npcInfo[e].spriteset == kMonsterFireHydra)
damage = -damage;
- if (_npcinfo[e].spriteset == kMonsterFinalBoss)
+ if (_npcInfo[e].spriteset == kMonsterFinalBoss)
damage = -damage;
- if (_npcinfo[e].hp > 0 && _npcinfo[e].pause < _ticks) {
+ if (_npcInfo[e].hp > 0 && _npcInfo[e].pause < _ticks) {
damageNPC(e, damage, 1);
if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
@@ -2236,12 +2236,12 @@ void GriffonEngine::updateSpellsUnder() {
}
}
- if (spellinfo[i].damagewho == 1) {
+ if (_spellInfo[i].damagewho == 1) {
float xdif = (xloc + 8) - (_player.px + 12);
float ydif = (yloc + 8) - (_player.py + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
- float damage = (float)_npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
+ float damage = (float)_npcInfo[_spellInfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
damagePlayer(damage);
@@ -2255,13 +2255,13 @@ void GriffonEngine::updateSpellsUnder() {
}
// check for post damage
- if (nposts > 0) {
- for (int e = 0; e <= nposts - 1; e++) {
+ if (_postInfoNbr > 0) {
+ for (int e = 0; e <= _postInfoNbr - 1; e++) {
float xdif = (xloc + 8) - (_postInfo[e][0] + 8);
float ydif = (yloc + 8) - (_postInfo[e][1] + 8);
if ((abs(xdif) < 8 && abs(ydif) < 8)) {
- _objmapf[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1;
+ _objectMapFull[_curMap][(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = 1;
_objectMap[(int)_postInfo[e][0] / 16][(int)_postInfo[e][1] / 16] = -1;
rcSrc.left = _postInfo[e][0] / 2;
@@ -2287,9 +2287,9 @@ void GriffonEngine::updateSpellsUnder() {
_spellImg->setAlpha(255, true);
- spellinfo[i].frame = spellinfo[i].frame - 0.2 * _fpsr;
- if (spellinfo[i].frame < 0)
- spellinfo[i].frame = 0;
+ _spellInfo[i].frame = _spellInfo[i].frame - 0.2 * _fpsr;
+ if (_spellInfo[i].frame < 0)
+ _spellInfo[i].frame = 0;
}
@@ -2297,9 +2297,9 @@ void GriffonEngine::updateSpellsUnder() {
// sprite 6 spitfire
if (spellnum == 7) {
- float xspan = spellinfo[i].enemyx - spellinfo[i].homex;
- float yspan = spellinfo[i].enemyy - spellinfo[i].homey;
- float fr = (32 - spellinfo[i].frame);
+ float xspan = _spellInfo[i].enemyx - _spellInfo[i].homex;
+ float yspan = _spellInfo[i].enemyy - _spellInfo[i].homey;
+ float fr = (32 - _spellInfo[i].frame);
for (int f = 0; f <= 7; f++) {
int alpha = 0;
@@ -2320,8 +2320,8 @@ void GriffonEngine::updateSpellsUnder() {
rcSrc.setWidth(16);
rcSrc.setHeight(16);
- float xloc = spellinfo[i].homex + xspan / 7 * f;
- float yloc = spellinfo[i].homey + yspan / 7 * f - yy;
+ float xloc = _spellInfo[i].homex + xspan / 7 * f;
+ float yloc = _spellInfo[i].homey + yspan / 7 * f - yy;
rcDest.left = xloc;
rcDest.top = yloc;
@@ -2329,12 +2329,12 @@ void GriffonEngine::updateSpellsUnder() {
if (xloc > -16 && xloc < 320 && yloc > -16 && yloc < 240) {
_spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- if (spellinfo[i].damagewho == 1) {
+ if (_spellInfo[i].damagewho == 1) {
float xdif = (xloc + 8) - (_player.px + 12);
float ydif = (yloc + 8) - (_player.py + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks && alpha > 64) {
- float damage = (float)_npcinfo[spellinfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
+ float damage = (float)_npcInfo[_spellInfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
damagePlayer(damage);
@@ -2352,13 +2352,13 @@ void GriffonEngine::updateSpellsUnder() {
}
_spellImg->setAlpha(255, true);
- spellinfo[i].frame = spellinfo[i].frame - 0.5 * _fpsr;
- if (spellinfo[i].frame < 0)
- spellinfo[i].frame = 0;
+ _spellInfo[i].frame = _spellInfo[i].frame - 0.5 * _fpsr;
+ if (_spellInfo[i].frame < 0)
+ _spellInfo[i].frame = 0;
- if (ABS(spellinfo[i].frame) < kEpsilon) {
- _npcinfo[spellinfo[i].npc].attacking = false;
- _npcinfo[spellinfo[i].npc].attacknext = _ticks + _npcinfo[spellinfo[i].npc].attackdelay;
+ if (ABS(_spellInfo[i].frame) < kEpsilon) {
+ _npcInfo[_spellInfo[i].npc].attacking = false;
+ _npcInfo[_spellInfo[i].npc].attacknext = _ticks + _npcInfo[_spellInfo[i].npc].attackdelay;
}
}
}
diff --git a/engines/griffon/resources.cpp b/engines/griffon/resources.cpp
index e881845..6f5b7e0 100644
--- a/engines/griffon/resources.cpp
+++ b/engines/griffon/resources.cpp
@@ -55,7 +55,7 @@ namespace Griffon {
void GriffonEngine::initialize() {
// init char *_floatstri[kMaxFloat]
for (int i = 0; i < kMaxFloat; i++)
- _floatstri[i] = (char *)malloc(64); // 64 bytes each string (should be enough)
+ _floatStr[i] = (char *)malloc(64); // 64 bytes each string (should be enough)
_video = new Graphics::TransparentSurface;
_video->create(320, 240, g_system->getScreenFormat());
@@ -79,8 +79,8 @@ void GriffonEngine::initialize() {
mapImg[i] = loadImage(name, true);
}
- cloudimg = loadImage("art/clouds.bmp", true);
- cloudimg->setAlpha(96, true);
+ _cloudImg = loadImage("art/clouds.bmp", true);
+ _cloudImg->setAlpha(96, true);
_saveLoadImg = loadImage("art/saveloadnew.bmp", true);
@@ -191,7 +191,7 @@ void GriffonEngine::loadMap(int mapnum) {
mapnum = mapnum + 100;
for (int i = 0; i < kMaxSpell; i++)
- spellinfo[i].frame = 0;
+ _spellInfo[i].frame = 0;
_roomLock = false;
@@ -215,7 +215,7 @@ void GriffonEngine::loadMap(int mapnum) {
for (int x = 0; x <= 319; x++) {
for (int y = 0; y <= 239; y++)
- _triggerloc[x][y] = -1;
+ _triggerLoc[x][y] = -1;
}
// read *.trg file
@@ -226,16 +226,16 @@ void GriffonEngine::loadMap(int mapnum) {
if (!file.isOpen())
error("Cannot open file %s", name);
- INPUT("%i", &_ntriggers);
+ INPUT("%i", &_triggerNbr);
- for (int i = 0; i < _ntriggers; i++) {
+ for (int i = 0; i < _triggerNbr; i++) {
int mapx, mapy, trig;
INPUT("%i", &mapx);
INPUT("%i", &mapy);
INPUT("%i", &trig);
- _triggerloc[mapx][mapy] = trig;
+ _triggerLoc[mapx][mapy] = trig;
}
file.close();
@@ -255,7 +255,7 @@ void GriffonEngine::loadMap(int mapnum) {
}
if (_scriptFlag[kScriptFindShield][0] == 1 && _curMap == 4) {
- _triggerloc[9][7] = 5004;
+ _triggerLoc[9][7] = 5004;
tempmap[9][7] = 41;
tempmap[9][7 + 40] = 0;
}
@@ -387,10 +387,10 @@ void GriffonEngine::loadMap(int mapnum) {
}
_lastObj = 0;
- _lastnpc = 0;
+ _lastNpc = 0;
for (int i = 0; i < kMaxNPC; i++)
- _npcinfo[i].onmap = false;
+ _npcInfo[i].onmap = false;
for (int x = 0; x <= 19; x++) {
for (int y = 0; y <= 19; y++) {
@@ -412,7 +412,7 @@ void GriffonEngine::loadMap(int mapnum) {
int o = tempmap[5 * 40 + x][y];
- if (_objmapf[_curMap][x][y] == 0) {
+ if (_objectMapFull[_curMap][x][y] == 0) {
_objectMap[x][y] = o;
if (_objectInfo[o][0] > 1) {
@@ -437,25 +437,25 @@ void GriffonEngine::loadMap(int mapnum) {
if (npc == 1) {
int o = tempmap[4 * 40 + x][y];
- if (o > _lastnpc)
- _lastnpc = o;
+ if (o > _lastNpc)
+ _lastNpc = o;
- _npcinfo[o].x = x * 16 - 4;
- _npcinfo[o].y = y * 16 - 5;
+ _npcInfo[o].x = x * 16 - 4;
+ _npcInfo[o].y = y * 16 - 5;
- _npcinfo[o].walkdir = 1;
- _npcinfo[o].onmap = true;
+ _npcInfo[o].walkdir = 1;
+ _npcInfo[o].onmap = true;
}
}
}
if (_curMap == 62 && _scriptFlag[kScriptGardenMasterKey][0] > 0)
- _lastnpc = 0;
+ _lastNpc = 0;
if (_curMap == 73 && _scriptFlag[kScriptArmourChest][0] > 0)
- _lastnpc = 0;
+ _lastNpc = 0;
if (_curMap == 81 && _scriptFlag[kScriptCitadelMasterKey][0] > 0)
- _lastnpc = 0;
+ _lastNpc = 0;
if (_curMap == 73 && _scriptFlag[kScriptArmourChest][0] == 0)
_roomLock = true;
@@ -475,262 +475,262 @@ void GriffonEngine::loadMap(int mapnum) {
error("Cannot open file %s", name);
for (int i = 0; i < kMaxNPC; i++) {
- INPUT("%i", &_npcinfo[i].spriteset);
- INPUT("%i", &_npcinfo[i].x1);
- INPUT("%i", &_npcinfo[i].y1);
- INPUT("%i", &_npcinfo[i].x2);
- INPUT("%i", &_npcinfo[i].y2);
- INPUT("%i", &_npcinfo[i].movementmode);
- INPUT("%i", &_npcinfo[i].hp);
- INPUT("%i", &_npcinfo[i].item1);
- INPUT("%i", &_npcinfo[i].item2);
- INPUT("%i", &_npcinfo[i].item3);
- INPUT("%i", &_npcinfo[i].script);
+ INPUT("%i", &_npcInfo[i].spriteset);
+ INPUT("%i", &_npcInfo[i].x1);
+ INPUT("%i", &_npcInfo[i].y1);
+ INPUT("%i", &_npcInfo[i].x2);
+ INPUT("%i", &_npcInfo[i].y2);
+ INPUT("%i", &_npcInfo[i].movementmode);
+ INPUT("%i", &_npcInfo[i].hp);
+ INPUT("%i", &_npcInfo[i].item1);
+ INPUT("%i", &_npcInfo[i].item2);
+ INPUT("%i", &_npcInfo[i].item3);
+ INPUT("%i", &_npcInfo[i].script);
// baby dragon
- if (_npcinfo[i].spriteset == kMonsterBabyDragon) {
- _npcinfo[i].hp = 12;
- _npcinfo[i].attackdelay = 2000;
+ if (_npcInfo[i].spriteset == kMonsterBabyDragon) {
+ _npcInfo[i].hp = 12;
+ _npcInfo[i].attackdelay = 2000;
- _npcinfo[i].attackdamage = 2;
- _npcinfo[i].spelldamage = 0;
+ _npcInfo[i].attackdamage = 2;
+ _npcInfo[i].spelldamage = 0;
- _npcinfo[i].walkspd = 1;
+ _npcInfo[i].walkspd = 1;
if (RND() * 5 == 0)
- _npcinfo[i].hp = 0;
+ _npcInfo[i].hp = 0;
}
// onewing
- if (_npcinfo[i].spriteset == kMonsterOneWing) {
- _npcinfo[i].hp = 200;
- _npcinfo[i].attackdelay = 2000;
- _npcinfo[i].swayspd = 1;
+ if (_npcInfo[i].spriteset == kMonsterOneWing) {
+ _npcInfo[i].hp = 200;
+ _npcInfo[i].attackdelay = 2000;
+ _npcInfo[i].swayspd = 1;
- _npcinfo[i].attackdamage = 24;
- _npcinfo[i].spelldamage = 30;
+ _npcInfo[i].attackdamage = 24;
+ _npcInfo[i].spelldamage = 30;
- _npcinfo[i].walkspd = 1.4f;
- _npcinfo[i].castpause = _ticks;
+ _npcInfo[i].walkspd = 1.4f;
+ _npcInfo[i].castpause = _ticks;
}
// boss1
- if (_npcinfo[i].spriteset == kMonsterBoss1) {
- _npcinfo[i].hp = 300;
- _npcinfo[i].attackdelay = 2200;
+ if (_npcInfo[i].spriteset == kMonsterBoss1) {
+ _npcInfo[i].hp = 300;
+ _npcInfo[i].attackdelay = 2200;
- _npcinfo[i].attackdamage = 0;
- _npcinfo[i].spelldamage = 30;
+ _npcInfo[i].attackdamage = 0;
+ _npcInfo[i].spelldamage = 30;
- _npcinfo[i].walkspd = 1.2f;
+ _npcInfo[i].walkspd = 1.2f;
}
// black knights
- if (_npcinfo[i].spriteset == kMonsterBlackKnight) {
- _npcinfo[i].hp = 200;
- _npcinfo[i].attackdelay = 2800;
+ if (_npcInfo[i].spriteset == kMonsterBlackKnight) {
+ _npcInfo[i].hp = 200;
+ _npcInfo[i].attackdelay = 2800;
- _npcinfo[i].attackdamage = 0;
- _npcinfo[i].spelldamage = 30;
+ _npcInfo[i].attackdamage = 0;
+ _npcInfo[i].spelldamage = 30;
- _npcinfo[i].walkspd = 1;
+ _npcInfo[i].walkspd = 1;
}
// boss2 firehydra
- if (_npcinfo[i].spriteset == kMonsterFireHydra) {
- _npcinfo[i].hp = 600;
- _npcinfo[i].attackdelay = 2200;
+ if (_npcInfo[i].spriteset == kMonsterFireHydra) {
+ _npcInfo[i].hp = 600;
+ _npcInfo[i].attackdelay = 2200;
- _npcinfo[i].attackdamage = 50;
- _npcinfo[i].spelldamage = 30;
+ _npcInfo[i].attackdamage = 50;
+ _npcInfo[i].spelldamage = 30;
- _npcinfo[i].walkspd = 1.3f;
+ _npcInfo[i].walkspd = 1.3f;
- _npcinfo[i].swayangle = 0;
+ _npcInfo[i].swayangle = 0;
}
// baby fire dragon
- if (_npcinfo[i].spriteset == kMonsterRedDragon) {
- _npcinfo[i].hp = 20;
- _npcinfo[i].attackdelay = 1500;
+ if (_npcInfo[i].spriteset == kMonsterRedDragon) {
+ _npcInfo[i].hp = 20;
+ _npcInfo[i].attackdelay = 1500;
- _npcinfo[i].attackdamage = 0;
- _npcinfo[i].spelldamage = 12;
+ _npcInfo[i].attackdamage = 0;
+ _npcInfo[i].spelldamage = 12;
- _npcinfo[i].walkspd = 1;
+ _npcInfo[i].walkspd = 1;
if (RND() * 5 == 0)
- _npcinfo[i].hp = 0;
+ _npcInfo[i].hp = 0;
}
// priest1
- if (_npcinfo[i].spriteset == kMonsterPriest) {
- _npcinfo[i].hp = 40;
- _npcinfo[i].attackdelay = 5000;
+ if (_npcInfo[i].spriteset == kMonsterPriest) {
+ _npcInfo[i].hp = 40;
+ _npcInfo[i].attackdelay = 5000;
- _npcinfo[i].attackdamage = 0;
- _npcinfo[i].spelldamage = 8;
+ _npcInfo[i].attackdamage = 0;
+ _npcInfo[i].spelldamage = 8;
- _npcinfo[i].walkspd = 1;
+ _npcInfo[i].walkspd = 1;
if (RND() * 8 == 0)
- _npcinfo[i].hp = 0;
+ _npcInfo[i].hp = 0;
}
// yellow fire dragon
- if (_npcinfo[i].spriteset == kMonsterYellowDragon) {
- _npcinfo[i].hp = 100;
- _npcinfo[i].attackdelay = 1500;
+ if (_npcInfo[i].spriteset == kMonsterYellowDragon) {
+ _npcInfo[i].hp = 100;
+ _npcInfo[i].attackdelay = 1500;
- _npcinfo[i].attackdamage = 0;
- _npcinfo[i].spelldamage = 24;
+ _npcInfo[i].attackdamage = 0;
+ _npcInfo[i].spelldamage = 24;
- _npcinfo[i].walkspd = 1;
+ _npcInfo[i].walkspd = 1;
if (RND() * 5 == 0)
- _npcinfo[i].hp = 0;
+ _npcInfo[i].hp = 0;
}
// twowing
- if (_npcinfo[i].spriteset == kMonsterTwoWing) {
- _npcinfo[i].hp = 140;
- _npcinfo[i].attackdelay = 2000;
- _npcinfo[i].swayspd = 1;
+ if (_npcInfo[i].spriteset == kMonsterTwoWing) {
+ _npcInfo[i].hp = 140;
+ _npcInfo[i].attackdelay = 2000;
+ _npcInfo[i].swayspd = 1;
- _npcinfo[i].attackdamage = 30;
- _npcinfo[i].spelldamage = 0;
+ _npcInfo[i].attackdamage = 30;
+ _npcInfo[i].spelldamage = 0;
- _npcinfo[i].walkspd = 1;
+ _npcInfo[i].walkspd = 1;
- _npcinfo[i].castpause = 0;
+ _npcInfo[i].castpause = 0;
}
// dragon2
- if (_npcinfo[i].spriteset == kMonsterDragon2) {
- _npcinfo[i].hp = 80;
- _npcinfo[i].attackdelay = 1500;
+ if (_npcInfo[i].spriteset == kMonsterDragon2) {
+ _npcInfo[i].hp = 80;
+ _npcInfo[i].attackdelay = 1500;
- _npcinfo[i].attackdamage = 24;
- _npcinfo[i].spelldamage = 0;
+ _npcInfo[i].attackdamage = 24;
+ _npcInfo[i].spelldamage = 0;
- _npcinfo[i].walkspd = 1;
+ _npcInfo[i].walkspd = 1;
- _npcinfo[i].floating = RND() * 16;
+ _npcInfo[i].floating = RND() * 16;
}
// end boss
- if (_npcinfo[i].spriteset == kMonsterFinalBoss) {
- _npcinfo[i].hp = 1200;
- _npcinfo[i].attackdelay = 2000;
+ if (_npcInfo[i].spriteset == kMonsterFinalBoss) {
+ _npcInfo[i].hp = 1200;
+ _npcInfo[i].attackdelay = 2000;
- _npcinfo[i].attackdamage = 100;
- _npcinfo[i].spelldamage = 60;
+ _npcInfo[i].attackdamage = 100;
+ _npcInfo[i].spelldamage = 60;
- _npcinfo[i].walkspd = 1;
+ _npcInfo[i].walkspd = 1;
- _npcinfo[i].floating = RND() * 16;
+ _npcInfo[i].floating = RND() * 16;
}
// bat kitty
- if (_npcinfo[i].spriteset == kMonsterBatKitty) {
- _npcinfo[i].hp = 800;
- _npcinfo[i].attackdelay = 2000;
+ if (_npcInfo[i].spriteset == kMonsterBatKitty) {
+ _npcInfo[i].hp = 800;
+ _npcInfo[i].attackdelay = 2000;
- _npcinfo[i].attackdamage = 100;
- _npcinfo[i].spelldamage = 50;
+ _npcInfo[i].attackdamage = 100;
+ _npcInfo[i].spelldamage = 50;
- _npcinfo[i].walkspd = 1;
+ _npcInfo[i].walkspd = 1;
- _npcinfo[i].floating = RND() * 16;
+ _npcInfo[i].floating = RND() * 16;
}
- if (!_npcinfo[i].onmap)
- _npcinfo[i].hp = 0;
-
- _npcinfo[i].maxhp = _npcinfo[i].hp;
-
- _npcinfo[i].attacking = false;
- _npcinfo[i].attackframe = 0;
- _npcinfo[i].cattackframe = 0;
- _npcinfo[i].attackspd = 1.5;
- _npcinfo[i].attacknext = _ticks + _npcinfo[i].attackdelay * (1 + RND() * 2);
-
- if (_npcinfo[i].spriteset == kMonsterOneWing || _npcinfo[i].spriteset == kMonsterTwoWing) {
- _npcinfo[i].bodysection[0].sprite = 0;
- _npcinfo[i].bodysection[1].sprite = 1;
- _npcinfo[i].bodysection[2].sprite = 2;
- _npcinfo[i].bodysection[3].sprite = 3;
- _npcinfo[i].bodysection[4].sprite = 4;
- _npcinfo[i].bodysection[5].sprite = 3;
- _npcinfo[i].bodysection[6].sprite = 3;
- _npcinfo[i].bodysection[7].sprite = 5;
-
- _npcinfo[i].bodysection[0].bonelength = 8;
- _npcinfo[i].bodysection[1].bonelength = 7;
- _npcinfo[i].bodysection[2].bonelength = 6;
- _npcinfo[i].bodysection[3].bonelength = 4;
- _npcinfo[i].bodysection[4].bonelength = 4;
- _npcinfo[i].bodysection[5].bonelength = 4;
- _npcinfo[i].bodysection[6].bonelength = 4;
+ if (!_npcInfo[i].onmap)
+ _npcInfo[i].hp = 0;
+
+ _npcInfo[i].maxhp = _npcInfo[i].hp;
+
+ _npcInfo[i].attacking = false;
+ _npcInfo[i].attackframe = 0;
+ _npcInfo[i].cattackframe = 0;
+ _npcInfo[i].attackspd = 1.5;
+ _npcInfo[i].attacknext = _ticks + _npcInfo[i].attackdelay * (1 + RND() * 2);
+
+ if (_npcInfo[i].spriteset == kMonsterOneWing || _npcInfo[i].spriteset == kMonsterTwoWing) {
+ _npcInfo[i].bodysection[0].sprite = 0;
+ _npcInfo[i].bodysection[1].sprite = 1;
+ _npcInfo[i].bodysection[2].sprite = 2;
+ _npcInfo[i].bodysection[3].sprite = 3;
+ _npcInfo[i].bodysection[4].sprite = 4;
+ _npcInfo[i].bodysection[5].sprite = 3;
+ _npcInfo[i].bodysection[6].sprite = 3;
+ _npcInfo[i].bodysection[7].sprite = 5;
+
+ _npcInfo[i].bodysection[0].bonelength = 8;
+ _npcInfo[i].bodysection[1].bonelength = 7;
+ _npcInfo[i].bodysection[2].bonelength = 6;
+ _npcInfo[i].bodysection[3].bonelength = 4;
+ _npcInfo[i].bodysection[4].bonelength = 4;
+ _npcInfo[i].bodysection[5].bonelength = 4;
+ _npcInfo[i].bodysection[6].bonelength = 4;
for (int f = 0; f <= 7; f++) {
- _npcinfo[i].bodysection[f].x = _npcinfo[i].x + 12;
- _npcinfo[i].bodysection[f].y = _npcinfo[i].y + 14;
+ _npcInfo[i].bodysection[f].x = _npcInfo[i].x + 12;
+ _npcInfo[i].bodysection[f].y = _npcInfo[i].y + 14;
}
- _npcinfo[i].headtargetx[0] = _npcinfo[i].x + 12;
- _npcinfo[i].headtargety[0] = _npcinfo[i].y + 14;
+ _npcInfo[i].headtargetx[0] = _npcInfo[i].x + 12;
+ _npcInfo[i].headtargety[0] = _npcInfo[i].y + 14;
}
- if (_npcinfo[i].spriteset == kMonsterFireHydra) {
+ if (_npcInfo[i].spriteset == kMonsterFireHydra) {
for (int f = 0; f <= 29; f++) {
- _npcinfo[i].bodysection[f].x = _npcinfo[i].x + 12;
- _npcinfo[i].bodysection[f].y = _npcinfo[i].y + 14;
+ _npcInfo[i].bodysection[f].x = _npcInfo[i].x + 12;
+ _npcInfo[i].bodysection[f].y = _npcInfo[i].y + 14;
}
for (int f = 0; f <= 2; f++) {
- _npcinfo[i].headtargetx[f] = _npcinfo[i].x + 12;
- _npcinfo[i].headtargety[f] = _npcinfo[i].y + 14;
+ _npcInfo[i].headtargetx[f] = _npcInfo[i].x + 12;
+ _npcInfo[i].headtargety[f] = _npcInfo[i].y + 14;
- _npcinfo[i].attacking2[f] = false;
- _npcinfo[i].attackframe2[f] = 0;
+ _npcInfo[i].attacking2[f] = false;
+ _npcInfo[i].attackframe2[f] = 0;
}
}
- if (_npcinfo[i].script == kScriptMasterKey) {
+ if (_npcInfo[i].script == kScriptMasterKey) {
_roomLock = true;
if (_scriptFlag[kScriptMasterKey][0] > 0) {
_roomLock = false;
- _npcinfo[i].hp = 0;
+ _npcInfo[i].hp = 0;
}
}
- if (_npcinfo[i].script == kScriptFindCrystal) {
+ if (_npcInfo[i].script == kScriptFindCrystal) {
_roomLock = true;
if (_scriptFlag[kScriptFindCrystal][0] > 0) {
_roomLock = false;
- _npcinfo[i].hp = 0;
+ _npcInfo[i].hp = 0;
}
}
- if (_npcinfo[i].script == kScriptFindSword) {
+ if (_npcInfo[i].script == kScriptFindSword) {
_roomLock = true;
if (_scriptFlag[kScriptFindSword][0] > 0) {
_roomLock = false;
- _npcinfo[i].hp = 0;
+ _npcInfo[i].hp = 0;
}
}
- if (_npcinfo[i].script == kScriptGetSword3) {
+ if (_npcInfo[i].script == kScriptGetSword3) {
_roomLock = true;
if (_scriptFlag[kScriptGetSword3][0] > 0) {
_roomLock = false;
- _npcinfo[i].hp = 0;
+ _npcInfo[i].hp = 0;
}
}
- _npcinfo[i].pause = _ticks;
+ _npcInfo[i].pause = _ticks;
}
file.close();
@@ -967,92 +967,92 @@ void GriffonEngine::loadAnims() {
_anims[2] = loadImage("art/anims2.bmp", true);
// huge
- _animset2[0].xofs = 8;
- _animset2[0].yofs = 7;
- _animset2[0].x = 123;
- _animset2[0].y = 0;
- _animset2[0].w = 18;
- _animset2[0].h = 16;
+ _animSet2[0].xofs = 8;
+ _animSet2[0].yofs = 7;
+ _animSet2[0].x = 123;
+ _animSet2[0].y = 0;
+ _animSet2[0].w = 18;
+ _animSet2[0].h = 16;
// big
- _animset2[1].xofs = 7;
- _animset2[1].yofs = 7;
- _animset2[1].x = 107;
- _animset2[1].y = 0;
- _animset2[1].w = 16;
- _animset2[1].h = 14;
+ _animSet2[1].xofs = 7;
+ _animSet2[1].yofs = 7;
+ _animSet2[1].x = 107;
+ _animSet2[1].y = 0;
+ _animSet2[1].w = 16;
+ _animSet2[1].h = 14;
// med
- _animset2[2].xofs = 6;
- _animset2[2].yofs = 6;
- _animset2[2].x = 93;
- _animset2[2].y = 0;
- _animset2[2].w = 14;
- _animset2[2].h = 13;
+ _animSet2[2].xofs = 6;
+ _animSet2[2].yofs = 6;
+ _animSet2[2].x = 93;
+ _animSet2[2].y = 0;
+ _animSet2[2].w = 14;
+ _animSet2[2].h = 13;
// small
- _animset2[3].xofs = 4;
- _animset2[3].yofs = 4;
- _animset2[3].x = 83;
- _animset2[3].y = 0;
- _animset2[3].w = 10;
- _animset2[3].h = 10;
+ _animSet2[3].xofs = 4;
+ _animSet2[3].yofs = 4;
+ _animSet2[3].x = 83;
+ _animSet2[3].y = 0;
+ _animSet2[3].w = 10;
+ _animSet2[3].h = 10;
// wing
- _animset2[4].xofs = 4;
- _animset2[4].yofs = 20;
- _animset2[4].x = 42;
- _animset2[4].y = 0;
- _animset2[4].w = 41;
- _animset2[4].h = 33;
+ _animSet2[4].xofs = 4;
+ _animSet2[4].yofs = 20;
+ _animSet2[4].x = 42;
+ _animSet2[4].y = 0;
+ _animSet2[4].w = 41;
+ _animSet2[4].h = 33;
// head
- _animset2[5].xofs = 20;
- _animset2[5].yofs = 18;
- _animset2[5].x = 0;
- _animset2[5].y = 0;
- _animset2[5].w = 42;
- _animset2[5].h = 36;
+ _animSet2[5].xofs = 20;
+ _animSet2[5].yofs = 18;
+ _animSet2[5].x = 0;
+ _animSet2[5].y = 0;
+ _animSet2[5].w = 42;
+ _animSet2[5].h = 36;
_anims[9] = loadImage("art/anims9.bmp", true);
// huge
- _animset9[0].xofs = 8;
- _animset9[0].yofs = 7;
- _animset9[0].x = 154;
- _animset9[0].y = 0;
- _animset9[0].w = 18;
- _animset9[0].h = 16;
+ _animSet9[0].xofs = 8;
+ _animSet9[0].yofs = 7;
+ _animSet9[0].x = 154;
+ _animSet9[0].y = 0;
+ _animSet9[0].w = 18;
+ _animSet9[0].h = 16;
// big
- _animset9[1].xofs = 7;
- _animset9[1].yofs = 7;
- _animset9[1].x = 138;
- _animset9[1].y = 0;
- _animset9[1].w = 16;
- _animset9[1].h = 14;
+ _animSet9[1].xofs = 7;
+ _animSet9[1].yofs = 7;
+ _animSet9[1].x = 138;
+ _animSet9[1].y = 0;
+ _animSet9[1].w = 16;
+ _animSet9[1].h = 14;
// med
- _animset9[2].xofs = 6;
- _animset9[2].yofs = 6;
- _animset9[2].x = 93 + 31;
- _animset9[2].y = 0;
- _animset9[2].w = 14;
- _animset9[2].h = 13;
+ _animSet9[2].xofs = 6;
+ _animSet9[2].yofs = 6;
+ _animSet9[2].x = 93 + 31;
+ _animSet9[2].y = 0;
+ _animSet9[2].w = 14;
+ _animSet9[2].h = 13;
// small
- _animset9[3].xofs = 4;
- _animset9[3].yofs = 4;
- _animset9[3].x = 83 + 31;
- _animset9[3].y = 0;
- _animset9[3].w = 10;
- _animset9[3].h = 10;
+ _animSet9[3].xofs = 4;
+ _animSet9[3].yofs = 4;
+ _animSet9[3].x = 83 + 31;
+ _animSet9[3].y = 0;
+ _animSet9[3].w = 10;
+ _animSet9[3].h = 10;
// wing
- _animset9[4].xofs = 36;
- _animset9[4].yofs = 20;
- _animset9[4].x = 42;
- _animset9[4].y = 0;
- _animset9[4].w = 72;
- _animset9[4].h = 33;
+ _animSet9[4].xofs = 36;
+ _animSet9[4].yofs = 20;
+ _animSet9[4].x = 42;
+ _animSet9[4].y = 0;
+ _animSet9[4].w = 72;
+ _animSet9[4].h = 33;
// head
- _animset9[5].xofs = 20;
- _animset9[5].yofs = 18;
- _animset9[5].x = 0;
- _animset9[5].y = 0;
- _animset9[5].w = 42;
- _animset9[5].h = 36;
+ _animSet9[5].xofs = 20;
+ _animSet9[5].yofs = 18;
+ _animSet9[5].x = 0;
+ _animSet9[5].y = 0;
+ _animSet9[5].w = 42;
+ _animSet9[5].h = 36;
_anims[3] = loadImage("art/anims3.bmp", true);
_anims[4] = loadImage("art/anims4.bmp", true);
diff --git a/engines/griffon/saveload.cpp b/engines/griffon/saveload.cpp
index aab7bcb..42abff0 100644
--- a/engines/griffon/saveload.cpp
+++ b/engines/griffon/saveload.cpp
@@ -111,7 +111,7 @@ int GriffonEngine::loadState(int slotnum) {
for (int a = 0; a <= 999; a++) {
for (int b = 0; b <= 20; b++) {
for (int c = 0; c <= 14; c++) {
- INPUT("%i", &_objmapf[a][b][c]);
+ INPUT("%i", &_objectMapFull[a][b][c]);
}
}
}
@@ -236,7 +236,7 @@ int GriffonEngine::saveState(int slotnum) {
for (int a = 0; a <= 999; a++) {
for (int b = 0; b <= 20; b++) {
for (int c = 0; c <= 14; c++) {
- PRINT("%i", _objmapf[a][b][c]);
+ PRINT("%i", _objectMapFull[a][b][c]);
}
}
}
Commit: 8438b9c9bbd52841ee8ef35e42dd660f0ab88e1a
https://github.com/scummvm/scummvm/commit/8438b9c9bbd52841ee8ef35e42dd660f0ab88e1a
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Some more renaming
Changed paths:
engines/griffon/combat.cpp
engines/griffon/config.cpp
engines/griffon/config.h
engines/griffon/cutscenes.cpp
engines/griffon/dialogs.cpp
engines/griffon/draw.cpp
engines/griffon/engine.cpp
engines/griffon/griffon.cpp
engines/griffon/griffon.h
engines/griffon/input.cpp
engines/griffon/logic.cpp
engines/griffon/sound.cpp
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp
index ee76536..c469b02 100644
--- a/engines/griffon/combat.cpp
+++ b/engines/griffon/combat.cpp
@@ -71,7 +71,7 @@ void GriffonEngine::attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
if (_objectInfo[o][4] == 1)
@@ -81,7 +81,7 @@ void GriffonEngine::attack() {
} else {
if (config.effects) {
int snd = playSound(_sfx[kSndChest]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
eventText("Cannot Carry any more Flasks!");
@@ -105,7 +105,7 @@ void GriffonEngine::attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
if (_objectInfo[o][4] == 1)
@@ -120,7 +120,7 @@ void GriffonEngine::attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
if (_objectInfo[o][4] == 1)
@@ -139,7 +139,7 @@ void GriffonEngine::attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
if (_objectInfo[o][4] == 1)
@@ -160,7 +160,7 @@ void GriffonEngine::attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
if (_objectInfo[o][4] == 1)
@@ -181,7 +181,7 @@ void GriffonEngine::attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
_objectMapFull[_curMap][lx][ly - 1] = 1;
@@ -194,7 +194,7 @@ void GriffonEngine::attack() {
} else {
if (config.effects) {
int snd = playSound(_sfx[kSndChest]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
eventText("Cannot Carry Any More Keys");
@@ -209,7 +209,7 @@ void GriffonEngine::attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
if (_objectInfo[o][4] == 1)
@@ -219,7 +219,7 @@ void GriffonEngine::attack() {
} else {
if (config.effects) {
int snd = playSound(_sfx[kSndChest]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
eventText("Cannot Carry any more Mega Flasks!");
@@ -237,7 +237,7 @@ void GriffonEngine::attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
if (_objectInfo[o][4] == 1)
@@ -247,7 +247,7 @@ void GriffonEngine::attack() {
} else {
if (config.effects) {
int snd = playSound(_sfx[kSndChest]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
eventText("Cannot Carry any more Mega Flasks!");
@@ -264,7 +264,7 @@ void GriffonEngine::attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
if (_objectInfo[o][4] == 1)
@@ -274,7 +274,7 @@ void GriffonEngine::attack() {
} else {
if (config.effects) {
int snd = playSound(_sfx[kSndChest]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
eventText("Cannot Carry any more Lightning Bombs!");
@@ -290,7 +290,7 @@ void GriffonEngine::attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
if (_objectInfo[o][4] == 1)
@@ -307,26 +307,26 @@ void GriffonEngine::attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndLever]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
} else if (_curMap == 58 && _scriptFlag[kScriptLever][0] > 0) {
if (config.effects) {
int snd = playSound(_sfx[kSndDoor]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
eventText("It's stuck!");
} else if (_curMap == 54 && _scriptFlag[kScriptLever][0] == 1) {
if (config.effects) {
int snd = playSound(_sfx[kSndLever]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
_scriptFlag[kScriptLever][0] = 2;
} else if (_curMap == 54 && _scriptFlag[kScriptLever][0] > 1) {
if (config.effects) {
int snd = playSound(_sfx[kSndDoor]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
eventText("It's stuck!");
@@ -342,7 +342,7 @@ void GriffonEngine::attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
if (_objectInfo[o][4] == 1)
@@ -360,7 +360,7 @@ void GriffonEngine::attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
if (_objectInfo[o][4] == 1)
@@ -378,7 +378,7 @@ void GriffonEngine::attack() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
if (_objectInfo[o][4] == 1)
@@ -438,7 +438,7 @@ void GriffonEngine::castSpell(int spellnum, float homex, float homey, float enem
case 1:
if (config.effects) {
int snd = playSound(_sfx[kSndThrow]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
break;
case 2:
@@ -458,7 +458,7 @@ void GriffonEngine::castSpell(int spellnum, float homex, float homey, float enem
case 5:
if (config.effects) {
int snd = playSound(_sfx[kSndCrystal]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
break;
case 6: {
@@ -487,7 +487,7 @@ void GriffonEngine::castSpell(int spellnum, float homex, float homey, float enem
case 9:
if (config.effects) {
int snd = playSound(_sfx[kSndLightning]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
break;
default:
@@ -538,7 +538,7 @@ void GriffonEngine::checkHit() {
if (hit) {
if (config.effects) {
int snd = playSound(_sfx[kSndSwordHit]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
damageNPC(i, damage, 0);
diff --git a/engines/griffon/config.cpp b/engines/griffon/config.cpp
index 58ee59d..5b9b396 100644
--- a/engines/griffon/config.cpp
+++ b/engines/griffon/config.cpp
@@ -41,7 +41,7 @@ namespace Griffon {
CONFIG config;
-void config_load(CONFIG *config) {
+void loadConfig(CONFIG *config) {
bool mute = false;
config->music = config->effects = false;
@@ -53,16 +53,16 @@ void config_load(CONFIG *config) {
config->effects = !ConfMan.getBool("sfx_mute");
}
- config->musicvol = ConfMan.getInt("music_volume");
- config->effectsvol = ConfMan.getInt("sfx_volume");
+ config->musicVol = ConfMan.getInt("music_volume");
+ config->effectsVol = ConfMan.getInt("sfx_volume");
}
-void config_save(CONFIG *config) {
- ConfMan.setBool("mute", !(config->music || config->effectsvol));
+void saveConfig(CONFIG *config) {
+ ConfMan.setBool("mute", !(config->music || config->effectsVol));
ConfMan.setBool("music_mute", !config->music);
ConfMan.setBool("sfx_mute", !config->effects);
- ConfMan.setInt("music_volume", config->musicvol);
- ConfMan.setInt("sfx_volume", config->effectsvol);
+ ConfMan.setInt("music_volume", config->musicVol);
+ ConfMan.setInt("sfx_volume", config->effectsVol);
ConfMan.flushToDisk();
}
diff --git a/engines/griffon/config.h b/engines/griffon/config.h
index 686b8ef..0c46e62 100644
--- a/engines/griffon/config.h
+++ b/engines/griffon/config.h
@@ -41,15 +41,15 @@ namespace Griffon {
struct CONFIG {
bool music;
- int musicvol;
+ int musicVol;
bool effects;
- int effectsvol;
+ int effectsVol;
};
extern CONFIG config;
-void config_load(CONFIG *config);
-void config_save(CONFIG *config);
+void loadConfig(CONFIG *config);
+void saveConfig(CONFIG *config);
} // end of namespace Griffon
diff --git a/engines/griffon/cutscenes.cpp b/engines/griffon/cutscenes.cpp
index 994fcad..f97b284 100644
--- a/engines/griffon/cutscenes.cpp
+++ b/engines/griffon/cutscenes.cpp
@@ -182,7 +182,7 @@ void GriffonEngine::intro() {
if (config.music) {
haltSoundChannel(-1);
- _musicChannel = playSound(_mendofgame, true);
+ _musicChannel = playSound(_musicEndOfGame, true);
setChannelVolume(_musicChannel, 0);
}
@@ -197,11 +197,11 @@ void GriffonEngine::intro() {
Common::Rect rc;
ld += 4 * _fpsr;
- if ((int)ld > config.musicvol)
- ld = config.musicvol;
+ if ((int)ld > config.musicVol)
+ ld = config.musicVol;
if (!ldstop) {
setChannelVolume(_musicChannel, (int)ld);
- if ((int)ld == config.musicvol)
+ if ((int)ld == config.musicVol)
ldstop = true;
}
@@ -276,7 +276,7 @@ void GriffonEngine::endOfGame() {
if (config.music) {
haltSoundChannel(-1);
- _musicChannel = playSound(_mendofgame, true);
+ _musicChannel = playSound(_musicEndOfGame, true);
setChannelVolume(_musicChannel, 0);
}
@@ -292,11 +292,11 @@ void GriffonEngine::endOfGame() {
do {
ld = ld + 4 * _fpsr;
- if (ld > config.musicvol)
- ld = config.musicvol;
+ if (ld > config.musicVol)
+ ld = config.musicVol;
if (!ldstop) {
setChannelVolume(_musicChannel, (int)ld);
- if ((int)ld == config.musicvol)
+ if ((int)ld == config.musicVol)
ldstop = true;
}
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 7d09d0e..fbcabc7 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -72,8 +72,8 @@ void GriffonEngine::title(int mode) {
setChannelVolume(_musicChannel, 0);
pauseSoundChannel(_musicChannel);
- _menuChannel = playSound(_mmenu, true);
- setChannelVolume(_menuChannel, config.musicvol);
+ _menuChannel = playSound(_musicMenu, true);
+ setChannelVolume(_menuChannel, config.musicVol);
_pmenu = true;
}
@@ -84,11 +84,11 @@ void GriffonEngine::title(int mode) {
Common::Rect rc;
ld += 4.0 * _fpsr;
- if (ld > config.musicvol)
- ld = config.musicvol;
+ if (ld > config.musicVol)
+ ld = config.musicVol;
if (!ldstop) {
setChannelVolume(_menuChannel, (int)ld);
- if ((int)ld == config.musicvol)
+ if ((int)ld == config.musicVol)
ldstop = true;
}
@@ -221,7 +221,7 @@ void GriffonEngine::title(int mode) {
if (config.music) {
haltSoundChannel(_menuChannel);
resumeSoundChannel(_musicChannel);
- setChannelVolume(_musicChannel, config.musicvol);
+ setChannelVolume(_musicChannel, config.musicVol);
_pmenu = false;
}
}
@@ -299,7 +299,7 @@ void GriffonEngine::configMenu() {
else if (i == 13 && !config.effects)
destColumn = 0;
else if (i == 15 || i == 17) {
- int vol = (i == 15 ? config.musicvol : config.effectsvol) * 9 / 255;
+ int vol = (i == 15 ? config.musicVol : config.effectsVol) * 9 / 255;
vol = CLIP(vol, 0, 9);
strcpy(line, "[----------]");
@@ -373,36 +373,36 @@ void GriffonEngine::configMenu() {
if (_event.kbd.keycode == Common::KEYCODE_LEFT) {
if (cursel == 11) {
- config.musicvol = CLIP(config.musicvol - 25, 0, 255);
- setChannelVolume(_musicChannel, config.musicvol);
- setChannelVolume(_menuChannel, config.musicvol);
+ config.musicVol = CLIP(config.musicVol - 25, 0, 255);
+ setChannelVolume(_musicChannel, config.musicVol);
+ setChannelVolume(_menuChannel, config.musicVol);
} else if (cursel == 12) {
- config.effectsvol = CLIP(config.effectsvol - 25, 0, 255);
- setChannelVolume(-1, config.effectsvol);
- setChannelVolume(_musicChannel, config.musicvol);
- setChannelVolume(_menuChannel, config.musicvol);
+ config.effectsVol = CLIP(config.effectsVol - 25, 0, 255);
+ setChannelVolume(-1, config.effectsVol);
+ setChannelVolume(_musicChannel, config.musicVol);
+ setChannelVolume(_menuChannel, config.musicVol);
if (config.effects) {
int snd = playSound(_sfx[kSndDoor]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
}
}
if (_event.kbd.keycode == Common::KEYCODE_RIGHT) {
if (cursel == 11) {
- config.musicvol = CLIP(config.musicvol + 25, 0, 255);
- setChannelVolume(_musicChannel, config.musicvol);
- setChannelVolume(_menuChannel, config.musicvol);
+ config.musicVol = CLIP(config.musicVol + 25, 0, 255);
+ setChannelVolume(_musicChannel, config.musicVol);
+ setChannelVolume(_menuChannel, config.musicVol);
} else if (cursel == 12) {
- config.effectsvol = CLIP(config.effectsvol + 25, 0, 255);
+ config.effectsVol = CLIP(config.effectsVol + 25, 0, 255);
- setChannelVolume(-1, config.effectsvol);
- setChannelVolume(_musicChannel, config.musicvol);
- setChannelVolume(_menuChannel, config.musicvol);
+ setChannelVolume(-1, config.effectsVol);
+ setChannelVolume(_musicChannel, config.musicVol);
+ setChannelVolume(_menuChannel, config.musicVol);
if (config.effects) {
int snd = playSound(_sfx[kSndDoor]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
}
}
@@ -423,8 +423,8 @@ void GriffonEngine::configMenu() {
case 7:
if (!config.music) {
config.music = true;
- _menuChannel = playSound(_mmenu, true);
- setChannelVolume(_menuChannel, config.musicvol);
+ _menuChannel = playSound(_musicMenu, true);
+ setChannelVolume(_menuChannel, config.musicVol);
}
break;
case 8:
@@ -438,7 +438,7 @@ void GriffonEngine::configMenu() {
if (!config.effects) {
config.effects = true;
int snd = playSound(_sfx[kSndDoor]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
break;
case 10:
@@ -446,7 +446,7 @@ void GriffonEngine::configMenu() {
config.effects = false;
break;
case 13:
- config_save(&config);
+ saveConfig(&config);
// no break on purpose
case 14:
exitMenu = true;
diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp
index 70fb073..6575e0e 100644
--- a/engines/griffon/draw.cpp
+++ b/engines/griffon/draw.cpp
@@ -839,7 +839,7 @@ void GriffonEngine::drawNPCs(int mode) {
damagePlayer(damage);
if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
}
@@ -865,7 +865,7 @@ void GriffonEngine::drawNPCs(int mode) {
damagePlayer(damage);
if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
}
}
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 9aa1c1b..2a8c865 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -170,7 +170,7 @@ void GriffonEngine::updateEngine() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
}
@@ -232,7 +232,7 @@ void GriffonEngine::updateEngine() {
_player.hpflashb = 0;
if (config.effects && _player.hpflashb == 0 && _player.hp < _player.maxHp / 4) {
int snd = playSound(_sfx[kSndBeep]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
}
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index ad9b665..653c899 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -65,7 +65,7 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
// Synchronize the sound settings from ScummVM
syncSoundSettings();
- config_load(&config);
+ loadConfig(&config);
}
GriffonEngine::~GriffonEngine() {
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 556a701..366dda2 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -485,7 +485,7 @@ private:
int _lastNpc;
// music info
- DataChunk *_mgardens, *_mgardens2, *_mgardens3, *_mgardens4, *_mboss, *_mmenu, *_mendofgame;
+ DataChunk *_musicGardens1, *_musicGardens2, *_musicGardens3, *_musicGardens4, *_musicBoss, *_musicMenu, *_musicEndOfGame;
int _musicChannel, _menuChannel;
bool _playingBoss, _playingGardens;
diff --git a/engines/griffon/input.cpp b/engines/griffon/input.cpp
index 7f8f599..5d66b65 100644
--- a/engines/griffon/input.cpp
+++ b/engines/griffon/input.cpp
@@ -104,7 +104,7 @@ void GriffonEngine::checkInputs() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
_itemSelOn = false;
@@ -130,7 +130,7 @@ void GriffonEngine::checkInputs() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
_itemSelOn = false;
@@ -556,7 +556,7 @@ void GriffonEngine::handleWalking() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
}
@@ -570,7 +570,7 @@ void GriffonEngine::handleWalking() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
}
@@ -586,7 +586,7 @@ void GriffonEngine::handleWalking() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
}
@@ -601,7 +601,7 @@ void GriffonEngine::handleWalking() {
if (config.effects) {
int snd = playSound(_sfx[kSndPowerUp]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
}
@@ -672,7 +672,7 @@ void GriffonEngine::processTrigger(int trignum) {
if (tmap > 0) {
if (config.effects) {
int snd = playSound(_sfx[kSndDoor]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
loadMap(tmap);
diff --git a/engines/griffon/logic.cpp b/engines/griffon/logic.cpp
index 1918cc3..81133e2 100644
--- a/engines/griffon/logic.cpp
+++ b/engines/griffon/logic.cpp
@@ -539,7 +539,7 @@ void GriffonEngine::updateNPCs() {
if ((int)(RND() * 2) == 0) {
if (config.effects) {
int snd = playSound(_sfx[kSndEnemyHit]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
_npcInfo[i].attacking = true;
@@ -566,7 +566,7 @@ void GriffonEngine::updateNPCs() {
if ((dist) < 24) {
if (config.effects) {
int snd = playSound(_sfx[kSndBite]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
_npcInfo[i].attacking = true;
@@ -672,7 +672,7 @@ void GriffonEngine::updateNPCs() {
if ((dist) < 36) {
if (config.effects) {
int snd = playSound(_sfx[kSndBite]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
_npcInfo[i].attacking = true;
@@ -852,7 +852,7 @@ void GriffonEngine::updateNPCs() {
if ((dist) < 24) {
if (config.effects) {
int snd = playSound(_sfx[kSndBite]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
_npcInfo[i].attacking = true;
@@ -926,7 +926,7 @@ void GriffonEngine::updateNPCs() {
if ((int)(RND() * 2) == 0) {
if (config.effects) {
int snd = playSound(_sfx[kSndEnemyHit]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
_npcInfo[i].attacking = true;
@@ -951,7 +951,7 @@ void GriffonEngine::updateNPCs() {
if ((int)(RND() * 2) == 0) {
if (config.effects) {
int snd = playSound(_sfx[kSndIce]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
_npcInfo[i].attacking = true;
_npcInfo[i].attackframe = 0;
@@ -1323,7 +1323,7 @@ void GriffonEngine::updateSpells() {
damageNPC(e, damage, 1);
if (config.effects) {
int snd = playSound(_sfx[kSndIce]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
}
}
@@ -1351,7 +1351,7 @@ void GriffonEngine::updateSpells() {
if (config.effects) {
int snd = playSound(_sfx[kSndIce]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
}
}
@@ -1402,7 +1402,7 @@ void GriffonEngine::updateSpells() {
damageNPC(e, damage, 1);
if (config.effects) {
int snd = playSound(_sfx[kSndMetalHit]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
}
}
@@ -1442,7 +1442,7 @@ void GriffonEngine::updateSpells() {
damagePlayer(damage);
if (config.effects) {
int snd = playSound(_sfx[kSndMetalHit]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
}
}
@@ -1470,7 +1470,7 @@ void GriffonEngine::updateSpells() {
if (config.effects) {
int snd = playSound(_sfx[kSndMetalHit]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
}
}
@@ -1521,7 +1521,7 @@ void GriffonEngine::updateSpells() {
damageNPC(e, damage, 1);
if (config.effects) {
int snd = playSound(_sfx[kSndRocks]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
}
}
@@ -1550,7 +1550,7 @@ void GriffonEngine::updateSpells() {
if (config.effects) {
int snd = playSound(_sfx[kSndRocks]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
}
}
@@ -1750,7 +1750,7 @@ void GriffonEngine::updateSpells() {
if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
}
}
@@ -2229,7 +2229,7 @@ void GriffonEngine::updateSpellsUnder() {
damageNPC(e, damage, 1);
if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
}
}
@@ -2248,7 +2248,7 @@ void GriffonEngine::updateSpellsUnder() {
if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
}
}
@@ -2273,7 +2273,7 @@ void GriffonEngine::updateSpellsUnder() {
if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
addFloatIcon(99, _postInfo[e][0], _postInfo[e][1]);
@@ -2340,7 +2340,7 @@ void GriffonEngine::updateSpellsUnder() {
damagePlayer(damage);
if (config.effects) {
int snd = playSound(_sfx[kSndFire]);
- setChannelVolume(snd, config.effectsvol);
+ setChannelVolume(snd, config.effectsVol);
}
}
diff --git a/engines/griffon/sound.cpp b/engines/griffon/sound.cpp
index 2e79320..b0e75fc 100644
--- a/engines/griffon/sound.cpp
+++ b/engines/griffon/sound.cpp
@@ -143,19 +143,19 @@ void GriffonEngine::setupAudio() {
rcDest.top = 116 + 12 + 12;
rcDest.setHeight(8);
- _mboss = cacheSound("music/boss.ogg");
+ _musicBoss = cacheSound("music/boss.ogg");
drawProgress(1, 21);
- _mgardens = cacheSound("music/gardens.ogg");
+ _musicGardens1 = cacheSound("music/gardens.ogg");
drawProgress(2, 21);
- _mgardens2 = cacheSound("music/gardens2.ogg");
+ _musicGardens2 = cacheSound("music/gardens2.ogg");
drawProgress(3, 21);
- _mgardens3 = cacheSound("music/gardens3.ogg");
+ _musicGardens3 = cacheSound("music/gardens3.ogg");
drawProgress(4, 21);
- _mgardens4 = cacheSound("music/gardens4.ogg");
+ _musicGardens4 = cacheSound("music/gardens4.ogg");
drawProgress(5, 21);
- _mendofgame = cacheSound("music/endofgame.ogg");
+ _musicEndOfGame = cacheSound("music/endofgame.ogg");
drawProgress(6, 21);
- _mmenu = cacheSound("music/menu.ogg");
+ _musicMenu = cacheSound("music/menu.ogg");
drawProgress(7, 21);
_sfx[kSndBite] = cacheSound("sfx/bite.ogg");
@@ -197,23 +197,23 @@ void GriffonEngine::updateMusic() {
if (config.music) {
// if(_curmap > 5 && _curmap < 42) iplaysound = macademy;
// if(_curmap > 47) iplaysound = _mgardens;
- iplaysound = _mgardens;
+ iplaysound = _musicGardens1;
if (_roomLock)
- iplaysound = _mboss;
+ iplaysound = _musicBoss;
- if (iplaysound == _mboss && _playingBoss)
+ if (iplaysound == _musicBoss && _playingBoss)
iplaysound = NULL;
- if (iplaysound == _mgardens && _playingGardens)
+ if (iplaysound == _musicGardens1 && _playingGardens)
iplaysound = NULL;
if (iplaysound != NULL) {
haltSoundChannel(_musicChannel);
- _playingBoss = (iplaysound == _mboss);
- _playingGardens = (iplaysound == _mgardens);
+ _playingBoss = (iplaysound == _musicBoss);
+ _playingGardens = (iplaysound == _musicGardens1);
_musicChannel = playSound(iplaysound, true);
- setChannelVolume(_musicChannel, config.musicvol);
+ setChannelVolume(_musicChannel, config.musicVol);
} else {
if (!isSoundChannelPlaying(_musicChannel)) {
loopseta += 1;
@@ -225,23 +225,23 @@ void GriffonEngine::updateMusic() {
if (_playingGardens) {
switch (loopseta) {
case 0:
- playSound(_mgardens);
+ playSound(_musicGardens1);
break;
case 1:
- playSound(_mgardens2);
+ playSound(_musicGardens2);
break;
case 2:
- playSound(_mgardens3);
+ playSound(_musicGardens3);
break;
case 3:
- playSound(_mgardens4);
+ playSound(_musicGardens4);
default:
break;
}
}
}
- setChannelVolume(_musicChannel, config.musicvol);
+ setChannelVolume(_musicChannel, config.musicVol);
}
}
}
Commit: 78d2dc32b21094922eee5cd2bab787767d19bd42
https://github.com/scummvm/scummvm/commit/78d2dc32b21094922eee5cd2bab787767d19bd42
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Introduce some new structures and refactoring, more renaming
Changed paths:
engines/griffon/combat.cpp
engines/griffon/cutscenes.cpp
engines/griffon/draw.cpp
engines/griffon/engine.cpp
engines/griffon/gfx.cpp
engines/griffon/griffon.h
engines/griffon/input.cpp
engines/griffon/logic.cpp
engines/griffon/resources.cpp
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp
index c469b02..9ec4c59 100644
--- a/engines/griffon/combat.cpp
+++ b/engines/griffon/combat.cpp
@@ -402,7 +402,7 @@ void GriffonEngine::attack() {
for (int i = 0; i <= 15; i++) {
for (int a = 0; a <= 3; a++) {
- _playerattackofs[a][i][2] = 0;
+ _playerAttackOfs[a][i].completed = false;
}
}
}
diff --git a/engines/griffon/cutscenes.cpp b/engines/griffon/cutscenes.cpp
index f97b284..0a0556e 100644
--- a/engines/griffon/cutscenes.cpp
+++ b/engines/griffon/cutscenes.cpp
@@ -495,8 +495,8 @@ void GriffonEngine::endOfGame() {
void GriffonEngine::theEnd() {
for (int i = 0; i < kMaxFloat; i++) {
- _floatText[i][0] = 0;
- _floatIcon[i][0] = 0;
+ _floatText[i].framesLeft = 0;
+ _floatIcon[i].framesLeft = 0;
}
for (float y = 0; y < 100; y += _fpsr) {
diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp
index 6575e0e..54eab5c 100644
--- a/engines/griffon/draw.cpp
+++ b/engines/griffon/draw.cpp
@@ -189,8 +189,8 @@ void GriffonEngine::drawHud() {
game_fillrect(_videoBuffer2, 0, 0, 320, 240, 0);
for (int i = 0; i < kMaxFloat; i++) {
- if (_floatText[i][0] > 0) {
- int fc = (int)_floatText[i][3];
+ if (_floatText[i].framesLeft > 0) {
+ int fc = _floatText[i].col;
int c = fc, c2 = 3;
if (fc == 4)
@@ -201,19 +201,19 @@ void GriffonEngine::drawHud() {
c2 = 2;
if (fc != 0) {
- drawString(_videoBuffer, _floatStr[i], (int)(_floatText[i][1]) + 0, (int)(_floatText[i][2]) - 1, c2);
- drawString(_videoBuffer, _floatStr[i], (int)(_floatText[i][1]) + 0, (int)(_floatText[i][2]) + 1, c2);
- drawString(_videoBuffer, _floatStr[i], (int)(_floatText[i][1]) - 1, (int)(_floatText[i][2]) + 0, c2);
- drawString(_videoBuffer, _floatStr[i], (int)(_floatText[i][1]) + 1, (int)(_floatText[i][2]) + 0, c2);
+ drawString(_videoBuffer, _floatText[i].text, (int)(_floatText[i].x) + 0, (int)(_floatText[i].y) - 1, c2);
+ drawString(_videoBuffer, _floatText[i].text, (int)(_floatText[i].x) + 0, (int)(_floatText[i].y) + 1, c2);
+ drawString(_videoBuffer, _floatText[i].text, (int)(_floatText[i].x) - 1, (int)(_floatText[i].y) + 0, c2);
+ drawString(_videoBuffer, _floatText[i].text, (int)(_floatText[i].x) + 1, (int)(_floatText[i].y) + 0, c2);
}
- drawString(_videoBuffer, _floatStr[i], (int)(_floatText[i][1]), (int)(_floatText[i][2]), c);
+ drawString(_videoBuffer, _floatText[i].text, (int)(_floatText[i].x), (int)(_floatText[i].y), c);
}
- if (_floatIcon[i][0] > 0) {
- int ico = _floatIcon[i][3];
- int ix = _floatIcon[i][1];
- int iy = _floatIcon[i][2];
+ if (_floatIcon[i].framesLeft > 0) {
+ int ico = _floatIcon[i].ico;
+ int ix = _floatIcon[i].x;
+ int iy = _floatIcon[i].y;
rcDest.left = ix;
rcDest.top = iy;
@@ -833,7 +833,7 @@ void GriffonEngine::drawNPCs(int mode) {
int ydif = (yloc + 8) - (_player.py + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
- float damage = (float)_npcInfo[i].spelldamage * (1.0 + RND() * 0.5);
+ float damage = (float)_npcInfo[i].spellDamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
damagePlayer(damage);
@@ -859,7 +859,7 @@ void GriffonEngine::drawNPCs(int mode) {
ydif = (yloc + 8) - (_player.py + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
- float damage = (float)_npcInfo[i].spelldamage * (1.0 + RND() * 0.5);
+ float damage = (float)_npcInfo[i].spellDamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
damagePlayer(damage);
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 2a8c865..3dea927 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -108,14 +108,14 @@ void GriffonEngine::updateEngine() {
int pa = (int)(_player.attackFrame);
for (int i = 0; i <= pa; i++) {
- if (ABS(_playerattackofs[_player.walkDir][i][2]) < kEpsilon) {
- _playerattackofs[_player.walkDir][i][2] = 1;
+ if (!_playerAttackOfs[_player.walkDir][i].completed) {
+ _playerAttackOfs[_player.walkDir][i].completed = true;
float opx = _player.px;
float opy = _player.py;
- _player.px = _player.px + _playerattackofs[_player.walkDir][i][0];
- _player.py = _player.py + _playerattackofs[_player.walkDir][i][1];
+ _player.px += _playerAttackOfs[_player.walkDir][i].x;
+ _player.py += _playerAttackOfs[_player.walkDir][i].y;
int sx = (int)(_player.px / 2 + 6);
int sy = (int)(_player.py / 2 + 10);
@@ -135,20 +135,20 @@ void GriffonEngine::updateEngine() {
}
for (int i = 0; i < kMaxFloat; i++) {
- if (_floatText[i][0] > 0) {
+ if (_floatText[i].framesLeft > 0) {
float spd = 0.5 * _fpsr;
- _floatText[i][0] = _floatText[i][0] - spd;
- _floatText[i][2] = _floatText[i][2] - spd;
- if (_floatText[i][0] < 0)
- _floatText[i][0] = 0;
+ _floatText[i].framesLeft -= spd;
+ _floatText[i].y -= spd;
+ if (_floatText[i].framesLeft < 0)
+ _floatText[i].framesLeft = 0;
}
- if (_floatIcon[i][0] > 0) {
+ if (_floatIcon[i].framesLeft > 0) {
float spd = 0.5 * _fpsr;
- _floatIcon[i][0] = _floatIcon[i][0] - spd;
- _floatIcon[i][2] = _floatIcon[i][2] - spd;
- if (_floatIcon[i][0] < 0)
- _floatIcon[i][0] = 0;
+ _floatIcon[i].framesLeft -= spd;
+ _floatIcon[i].y -= spd;
+ if (_floatIcon[i].framesLeft < 0)
+ _floatIcon[i].framesLeft = 0;
}
}
@@ -236,7 +236,7 @@ void GriffonEngine::updateEngine() {
}
}
- // cloudson = false
+ // _cloudsOn = false
if (_itemSelOn)
_player.itemselshade = _player.itemselshade + 2 * _fpsr;
diff --git a/engines/griffon/gfx.cpp b/engines/griffon/gfx.cpp
index de28eba..c4cbaea 100644
--- a/engines/griffon/gfx.cpp
+++ b/engines/griffon/gfx.cpp
@@ -42,11 +42,11 @@ namespace Griffon {
void GriffonEngine::addFloatIcon(int ico, float xloc, float yloc) {
for (int i = 0; i < kMaxFloat; i++) {
- if (ABS(_floatIcon[i][0]) < kEpsilon) {
- _floatIcon[i][0] = 32;
- _floatIcon[i][1] = xloc;
- _floatIcon[i][2] = yloc;
- _floatIcon[i][3] = ico;
+ if (ABS(_floatIcon[i].framesLeft) < kEpsilon) {
+ _floatIcon[i].framesLeft = 32;
+ _floatIcon[i].x = xloc;
+ _floatIcon[i].y = yloc;
+ _floatIcon[i].ico = ico;
return;
}
}
@@ -54,12 +54,12 @@ void GriffonEngine::addFloatIcon(int ico, float xloc, float yloc) {
void GriffonEngine::addFloatText(const char *stri, float xloc, float yloc, int col) {
for (int i = 0; i < kMaxFloat; i++) {
- if (ABS(_floatText[i][0]) < kEpsilon) {
- _floatText[i][0] = 32;
- _floatText[i][1] = xloc;
- _floatText[i][2] = yloc;
- _floatText[i][3] = col;
- strcpy(_floatStr[i], stri);
+ if (ABS(_floatText[i].framesLeft) < kEpsilon) {
+ _floatText[i].framesLeft = 32;
+ _floatText[i].x = xloc;
+ _floatText[i].y = yloc;
+ _floatText[i].col = col;
+ strcpy(_floatText[i].text, stri);
return;
}
}
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 366dda2..dc6867b 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -179,8 +179,8 @@ struct BodySection {
};
struct NPC {
- float x;
- float y;
+ float x;
+ float y;
int spriteset;
int x1; // patrol area
int y1;
@@ -194,10 +194,10 @@ struct NPC {
int item2;
int item3;
int script;
- float frame;
- float frame2; // end boss specific
+ float frame;
+ float frame2; // end boss specific
int cframe;
- bool onmap; // is this npc set to be genned in the mapfile
+ bool onMap; // is this npc set to be genned in the mapfile
int ticks;
int pause;
@@ -205,7 +205,7 @@ struct NPC {
int movementmode;
int walkdir;
- float walkspd;
+ float walkspd;
int movingdir;
bool moving;
@@ -217,17 +217,17 @@ struct NPC {
int attacknext;
int attackattempt;
- int spelldamage;
- int attackdamage;
+ int spellDamage;
+ int attackDamage;
// one wing and firehydra specific
BodySection bodysection[31];
- float swayangle;
- float swayspd;
- float headtargetx[4];
- float headtargety[4];
- int castpause;
+ float swayAngle;
+ float swaySpeed;
+ float headTargetX[4];
+ float headTargetY[4];
+ int castPause;
// firehydra specific
int attacknext2[4];
@@ -281,6 +281,27 @@ struct DataChunk {
int size;
};
+struct FloatTextStruct {
+ float framesLeft;
+ float x;
+ float y;
+ int col;
+ char *text;
+};
+
+struct FloatIconStruct {
+ float framesLeft;
+ float x;
+ float y;
+ int ico;
+};
+
+struct AttackOffsetStruct {
+ float x;
+ float y;
+ bool completed;
+};
+
class GriffonEngine : public Engine {
public:
GriffonEngine(OSystem *syst);
@@ -451,12 +472,10 @@ private:
// id number 0&1 = players
Graphics::TransparentSurface *_animsAttack[100];
// attack anims
- float _playerattackofs[4][16][3];
- // [dir] [frame] [x,y ofs, completed(0/1)]
+ AttackOffsetStruct _playerAttackOfs[4][16];
- float _floatText[kMaxFloat][4]; // [id] [framesleft, x, y, col]
- char *_floatStr[kMaxFloat];
- float _floatIcon[kMaxFloat][4]; // [id] [framesleft, x, y, ico]
+ FloatTextStruct _floatText[kMaxFloat];
+ FloatIconStruct _floatIcon[kMaxFloat];
// special for animset2
AnimSet _animSet2[7], _animSet9[7];
diff --git a/engines/griffon/input.cpp b/engines/griffon/input.cpp
index 5d66b65..9683242 100644
--- a/engines/griffon/input.cpp
+++ b/engines/griffon/input.cpp
@@ -682,8 +682,8 @@ void GriffonEngine::processTrigger(int trignum) {
}
for (int i = 0; i < kMaxFloat; i++) {
- _floatText[i][0] = 0;
- _floatIcon[i][0] = 0;
+ _floatText[i].framesLeft = 0;
+ _floatIcon[i].framesLeft = 0;
}
}
diff --git a/engines/griffon/logic.cpp b/engines/griffon/logic.cpp
index 81133e2..79ed593 100644
--- a/engines/griffon/logic.cpp
+++ b/engines/griffon/logic.cpp
@@ -166,7 +166,7 @@ void GriffonEngine::updateNPCs() {
if (_npcInfo[i].pause > _ticks)
mode = -1;
- if (_npcInfo[i].spriteset == kMonsterOneWing && _npcInfo[i].castpause > _ticks)
+ if (_npcInfo[i].spriteset == kMonsterOneWing && _npcInfo[i].castPause > _ticks)
mode = -1;
if (mode == 3) {
@@ -572,8 +572,8 @@ void GriffonEngine::updateNPCs() {
_npcInfo[i].attacking = true;
_npcInfo[i].attackframe = 0;
- _npcInfo[i].headtargetx[0] = _player.px + 12;
- _npcInfo[i].headtargety[0] = _player.py - 4;
+ _npcInfo[i].headTargetX[0] = _player.px + 12;
+ _npcInfo[i].headTargetY[0] = _player.py - 4;
}
}
@@ -581,36 +581,36 @@ void GriffonEngine::updateNPCs() {
dospell = false;
- if (!_npcInfo[i].attacking && _npcInfo[i].castpause < _ticks) {
- _npcInfo[i].swayspd = _npcInfo[i].swayspd + _npcInfo[i].swayspd / 200 * _fpsr;
- if (_npcInfo[i].swayspd > 15) {
+ if (!_npcInfo[i].attacking && _npcInfo[i].castPause < _ticks) {
+ _npcInfo[i].swaySpeed = _npcInfo[i].swaySpeed + _npcInfo[i].swaySpeed / 200 * _fpsr;
+ if (_npcInfo[i].swaySpeed > 15) {
dospell = true;
- _npcInfo[i].swayspd = 1;
+ _npcInfo[i].swaySpeed = 1;
}
// sway code
- _npcInfo[i].swayangle = _npcInfo[i].swayangle + _npcInfo[i].swayspd * _fpsr;
- if (_npcInfo[i].swayangle >= 360)
- _npcInfo[i].swayangle = _npcInfo[i].swayangle - 360;
+ _npcInfo[i].swayAngle = _npcInfo[i].swayAngle + _npcInfo[i].swaySpeed * _fpsr;
+ if (_npcInfo[i].swayAngle >= 360)
+ _npcInfo[i].swayAngle = _npcInfo[i].swayAngle - 360;
- _npcInfo[i].headtargetx[0] = _npcInfo[i].x + (24 - _npcInfo[i].swayspd / 2) * sin(3.14159 / 180 * _npcInfo[i].swayangle) + 12;
- _npcInfo[i].headtargety[0] = _npcInfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * _npcInfo[i].swayangle);
+ _npcInfo[i].headTargetX[0] = _npcInfo[i].x + (24 - _npcInfo[i].swaySpeed / 2) * sin(3.14159 / 180 * _npcInfo[i].swayAngle) + 12;
+ _npcInfo[i].headTargetY[0] = _npcInfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * _npcInfo[i].swayAngle);
}
if (dospell) {
_npcInfo[i].pause = _ticks + 3000;
_npcInfo[i].attacknext = _ticks + 4500;
- _npcInfo[i].castpause = _ticks + 4500;
+ _npcInfo[i].castPause = _ticks + 4500;
castSpell(3, _npcInfo[i].x, _npcInfo[i].y, _npcInfo[i].x, _npcInfo[i].y, i);
- _npcInfo[i].headtargetx[0] = _npcInfo[i].x;
- _npcInfo[i].headtargety[0] = _npcInfo[i].y - 36 + 16;
+ _npcInfo[i].headTargetX[0] = _npcInfo[i].x;
+ _npcInfo[i].headTargetY[0] = _npcInfo[i].y - 36 + 16;
}
// targethead code
- xdif = _npcInfo[i].bodysection[7].x - _npcInfo[i].headtargetx[0];
- ydif = _npcInfo[i].bodysection[7].y - _npcInfo[i].headtargety[0];
+ xdif = _npcInfo[i].bodysection[7].x - _npcInfo[i].headTargetX[0];
+ ydif = _npcInfo[i].bodysection[7].y - _npcInfo[i].headTargetY[0];
_npcInfo[i].bodysection[7].x = _npcInfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
@@ -641,21 +641,21 @@ void GriffonEngine::updateNPCs() {
castSpell(1, _npcInfo[i].x, _npcInfo[i].y, _player.px, _player.py, i);
}
- if (_npcInfo[i].castpause < _ticks) {
+ if (_npcInfo[i].castPause < _ticks) {
castSpell(6, _npcInfo[i].x, _npcInfo[i].y, _player.px, _player.py, i);
- _npcInfo[i].castpause = _ticks + 12000;
+ _npcInfo[i].castPause = _ticks + 12000;
}
}
// firehydra specific
if (_npcInfo[i].spriteset == kMonsterFireHydra) {
- _npcInfo[i].swayspd = 4;
+ _npcInfo[i].swaySpeed = 4;
// sway code
- _npcInfo[i].swayangle = _npcInfo[i].swayangle + _npcInfo[i].swayspd * _fpsr;
- if (_npcInfo[i].swayangle >= 360)
- _npcInfo[i].swayangle = _npcInfo[i].swayangle - 360;
+ _npcInfo[i].swayAngle = _npcInfo[i].swayAngle + _npcInfo[i].swaySpeed * _fpsr;
+ if (_npcInfo[i].swayAngle >= 360)
+ _npcInfo[i].swayAngle = _npcInfo[i].swayAngle - 360;
for (int ff = 0; ff <= 2; ff++) {
if (_npcInfo[i].hp > 10 * ff * 20) {
@@ -679,23 +679,23 @@ void GriffonEngine::updateNPCs() {
_npcInfo[i].attacking2[ff] = 1;
_npcInfo[i].attackframe2[ff] = 0;
- _npcInfo[i].headtargetx[ff] = _player.px + 12;
- _npcInfo[i].headtargety[ff] = _player.py - 4;
+ _npcInfo[i].headTargetX[ff] = _player.px + 12;
+ _npcInfo[i].headTargetY[ff] = _player.py - 4;
- _npcInfo[i].swayangle = 0;
+ _npcInfo[i].swayAngle = 0;
}
}
}
if (_npcInfo[i].attacking2[ff] == 0) {
- _npcInfo[i].headtargetx[ff] = _npcInfo[i].x + 38 * sin(3.14159 / 180 * (_npcInfo[i].swayangle + 120 * ff)) + 12;
- _npcInfo[i].headtargety[ff] = _npcInfo[i].y - 46 + 16 + 16 * sin(3.14159 * 2 / 180 * (_npcInfo[i].swayangle + 120 * ff));
+ _npcInfo[i].headTargetX[ff] = _npcInfo[i].x + 38 * sin(3.14159 / 180 * (_npcInfo[i].swayAngle + 120 * ff)) + 12;
+ _npcInfo[i].headTargetY[ff] = _npcInfo[i].y - 46 + 16 + 16 * sin(3.14159 * 2 / 180 * (_npcInfo[i].swayAngle + 120 * ff));
}
// targethead code
- xdif = _npcInfo[i].bodysection[10 * ff + 9].x - _npcInfo[i].headtargetx[ff];
- ydif = _npcInfo[i].bodysection[10 * ff + 9].y - _npcInfo[i].headtargety[ff];
+ xdif = _npcInfo[i].bodysection[10 * ff + 9].x - _npcInfo[i].headTargetX[ff];
+ ydif = _npcInfo[i].bodysection[10 * ff + 9].y - _npcInfo[i].headTargetY[ff];
_npcInfo[i].bodysection[10 * ff + 9].x = _npcInfo[i].bodysection[10 * ff + 9].x - xdif * 0.4 * _fpsr;
_npcInfo[i].bodysection[10 * ff + 9].y = _npcInfo[i].bodysection[10 * ff + 9].y - ydif * 0.4 * _fpsr;
@@ -776,7 +776,7 @@ void GriffonEngine::updateNPCs() {
castSpell(9, _npcInfo[i].x, _npcInfo[i].y, _player.px, _player.py, i);
}
- if (_npcInfo[i].castpause < _ticks) {
+ if (_npcInfo[i].castPause < _ticks) {
// castSpell 6, _npcinfo[i].x, _npcinfo[i].y, _player.px, _player.py, i
// _npcinfo[i].castpause = _ticks + 12000
}
@@ -858,39 +858,39 @@ void GriffonEngine::updateNPCs() {
_npcInfo[i].attacking = true;
_npcInfo[i].attackframe = 0;
- _npcInfo[i].headtargetx[0] = _player.px + 12;
- _npcInfo[i].headtargety[0] = _player.py - 4;
+ _npcInfo[i].headTargetX[0] = _player.px + 12;
+ _npcInfo[i].headTargetY[0] = _player.py - 4;
}
}
}
- if (!_npcInfo[i].attacking && _npcInfo[i].castpause < _ticks) {
- _npcInfo[i].swayspd = 4;
+ if (!_npcInfo[i].attacking && _npcInfo[i].castPause < _ticks) {
+ _npcInfo[i].swaySpeed = 4;
// sway code
- _npcInfo[i].swayangle = _npcInfo[i].swayangle + _npcInfo[i].swayspd * _fpsr;
- if (_npcInfo[i].swayangle >= 360)
- _npcInfo[i].swayangle = _npcInfo[i].swayangle - 360;
+ _npcInfo[i].swayAngle = _npcInfo[i].swayAngle + _npcInfo[i].swaySpeed * _fpsr;
+ if (_npcInfo[i].swayAngle >= 360)
+ _npcInfo[i].swayAngle = _npcInfo[i].swayAngle - 360;
- _npcInfo[i].headtargetx[0] = _npcInfo[i].x + (24 - _npcInfo[i].swayspd / 2) * sin(3.14159 / 180 * _npcInfo[i].swayangle) + 12;
- _npcInfo[i].headtargety[0] = _npcInfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * _npcInfo[i].swayangle);
+ _npcInfo[i].headTargetX[0] = _npcInfo[i].x + (24 - _npcInfo[i].swaySpeed / 2) * sin(3.14159 / 180 * _npcInfo[i].swayAngle) + 12;
+ _npcInfo[i].headTargetY[0] = _npcInfo[i].y - 36 + 16 + 8 * sin(3.14159 * 2 / 180 * _npcInfo[i].swayAngle);
}
if (dospell) {
_npcInfo[i].pause = _ticks + 3000;
_npcInfo[i].attacknext = _ticks + 5000;
- _npcInfo[i].castpause = _ticks + 3000;
+ _npcInfo[i].castPause = _ticks + 3000;
castSpell(3, _npcInfo[i].x, _npcInfo[i].y, _npcInfo[i].x, _npcInfo[i].y, i);
- _npcInfo[i].headtargetx[0] = _npcInfo[i].x;
- _npcInfo[i].headtargety[0] = _npcInfo[i].y - 36 + 16;
+ _npcInfo[i].headTargetX[0] = _npcInfo[i].x;
+ _npcInfo[i].headTargetY[0] = _npcInfo[i].y - 36 + 16;
}
// targethead code
- xdif = _npcInfo[i].bodysection[7].x - _npcInfo[i].headtargetx[0];
- ydif = _npcInfo[i].bodysection[7].y - _npcInfo[i].headtargety[0];
+ xdif = _npcInfo[i].bodysection[7].x - _npcInfo[i].headTargetX[0];
+ ydif = _npcInfo[i].bodysection[7].y - _npcInfo[i].headTargetY[0];
_npcInfo[i].bodysection[7].x = _npcInfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
@@ -1012,7 +1012,7 @@ void GriffonEngine::updateNPCs() {
// _npcinfo[i].attackframe = 0;
// _npcinfo[i].attacking = false;
- damage = (float)_npcInfo[i].attackdamage * (0.5 + RND() * 1.0);
+ damage = (float)_npcInfo[i].attackDamage * (0.5 + RND() * 1.0);
if (_player.hp > 0)
damagePlayer(damage);
@@ -1021,8 +1021,8 @@ void GriffonEngine::updateNPCs() {
if (_npcInfo[i].spriteset == kMonsterOneWing) {
// targethead code
- float xdif = _npcInfo[i].bodysection[7].x - _npcInfo[i].headtargetx[0];
- float ydif = _npcInfo[i].bodysection[7].y - _npcInfo[i].headtargety[0];
+ float xdif = _npcInfo[i].bodysection[7].x - _npcInfo[i].headTargetX[0];
+ float ydif = _npcInfo[i].bodysection[7].y - _npcInfo[i].headTargetY[0];
_npcInfo[i].bodysection[7].x = _npcInfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
_npcInfo[i].bodysection[7].y = _npcInfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
@@ -1062,7 +1062,7 @@ void GriffonEngine::updateNPCs() {
_npcInfo[i].attacknext = _ticks + _npcInfo[i].attackdelay;
// _npcinfo[i].attackframe = 0
// _npcinfo[i].attacking = false
- damage = (float)_npcInfo[i].attackdamage * (1.0 + (RND() * 0.5));
+ damage = (float)_npcInfo[i].attackDamage * (1.0 + (RND() * 0.5));
if (_player.hp > 0)
damagePlayer(damage);
}
@@ -1073,8 +1073,8 @@ void GriffonEngine::updateNPCs() {
if (_npcInfo[i].spriteset == kMonsterFireHydra) {
for (int ff = 0; ff <= 2; ff++) {
if (_npcInfo[i].attacking2[ff]) {
- float xdif = _npcInfo[i].bodysection[10 * ff + 9].x - _npcInfo[i].headtargetx[ff];
- float ydif = _npcInfo[i].bodysection[10 * ff + 9].y - _npcInfo[i].headtargety[ff];
+ float xdif = _npcInfo[i].bodysection[10 * ff + 9].x - _npcInfo[i].headTargetX[ff];
+ float ydif = _npcInfo[i].bodysection[10 * ff + 9].y - _npcInfo[i].headTargetY[ff];
_npcInfo[i].bodysection[10 * ff + 9].x = _npcInfo[i].bodysection[10 * ff + 9].x - xdif * .2 * _fpsr;
_npcInfo[i].bodysection[10 * ff + 9].y = _npcInfo[i].bodysection[10 * ff + 9].y - ydif * .2 * _fpsr;
@@ -1114,7 +1114,7 @@ void GriffonEngine::updateNPCs() {
_npcInfo[i].attacknext2[ff] = _ticks + _npcInfo[i].attackdelay;
// _npcinfo[i].attackframe2(ff) = 0
// _npcinfo[i].attacking2(ff) = false
- damage = (float)_npcInfo[i].attackdamage * (1.0 + RND() * 0.5);
+ damage = (float)_npcInfo[i].attackDamage * (1.0 + RND() * 0.5);
if (_player.hp > 0)
damagePlayer(damage);
}
@@ -1126,8 +1126,8 @@ void GriffonEngine::updateNPCs() {
// twowing specific
if (_npcInfo[i].spriteset == kMonsterTwoWing) {
// targethead code
- float xdif = _npcInfo[i].bodysection[7].x - _npcInfo[i].headtargetx[0];
- float ydif = _npcInfo[i].bodysection[7].y - _npcInfo[i].headtargety[0];
+ float xdif = _npcInfo[i].bodysection[7].x - _npcInfo[i].headTargetX[0];
+ float ydif = _npcInfo[i].bodysection[7].y - _npcInfo[i].headTargetY[0];
_npcInfo[i].bodysection[7].x = _npcInfo[i].bodysection[7].x - xdif * 0.4 * _fpsr;
_npcInfo[i].bodysection[7].y = _npcInfo[i].bodysection[7].y - ydif * 0.4 * _fpsr;
@@ -1167,7 +1167,7 @@ void GriffonEngine::updateNPCs() {
_npcInfo[i].attacknext = _ticks + _npcInfo[i].attackdelay;
// _npcinfo[i].attackframe = 0
// _npcinfo[i].attacking = false
- damage = (float)_npcInfo[i].attackdamage * (1.0 + RND() * 0.5);
+ damage = (float)_npcInfo[i].attackDamage * (1.0 + RND() * 0.5);
if (_player.hp > 0)
damagePlayer(damage);
}
@@ -1197,7 +1197,7 @@ void GriffonEngine::updateNPCs() {
_npcInfo[i].attacknext = _ticks + _npcInfo[i].attackdelay;
// _npcinfo[i].attackframe = 0
// _npcinfo[i].attacking = false
- damage = (float)_npcInfo[i].attackdamage * (0.5 + RND() * 1.0);
+ damage = (float)_npcInfo[i].attackDamage * (0.5 + RND() * 1.0);
if (_player.hp > 0)
damagePlayer(damage);
}
@@ -1226,7 +1226,7 @@ void GriffonEngine::updateNPCs() {
_npcInfo[i].attacknext = _ticks + _npcInfo[i].attackdelay;
// _npcinfo[i].attackframe = 0
// _npcinfo[i].attacking = false
- damage = (float)_npcInfo[i].attackdamage * (0.5 + RND() * 1.0);
+ damage = (float)_npcInfo[i].attackDamage * (0.5 + RND() * 1.0);
if (_player.hp > 0)
damagePlayer(damage);
}
@@ -1436,7 +1436,7 @@ void GriffonEngine::updateSpells() {
float ydif = (yloc + 24) - (_player.py + 12);
if ((abs(xdif) < 24 && abs(ydif) < 24) && _player.pause < _ticks) {
- float damage = (float)_npcInfo[_spellInfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
+ float damage = (float)_npcInfo[_spellInfo[i].npc].spellDamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
damagePlayer(damage);
@@ -1743,7 +1743,7 @@ void GriffonEngine::updateSpells() {
float ydif = (yloc + 8) - (_player.py + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
- float damage = _npcInfo[_spellInfo[i].npc].spelldamage * (1 + RND() * 0.5) / 3;
+ float damage = _npcInfo[_spellInfo[i].npc].spellDamage * (1 + RND() * 0.5) / 3;
if (_player.hp > 0)
damagePlayer(damage);
@@ -2241,7 +2241,7 @@ void GriffonEngine::updateSpellsUnder() {
float ydif = (yloc + 8) - (_player.py + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks) {
- float damage = (float)_npcInfo[_spellInfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
+ float damage = (float)_npcInfo[_spellInfo[i].npc].spellDamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
damagePlayer(damage);
@@ -2334,7 +2334,7 @@ void GriffonEngine::updateSpellsUnder() {
float ydif = (yloc + 8) - (_player.py + 12);
if ((abs(xdif) < 8 && abs(ydif) < 8) && _player.pause < _ticks && alpha > 64) {
- float damage = (float)_npcInfo[_spellInfo[i].npc].spelldamage * (1.0 + RND() * 0.5);
+ float damage = (float)_npcInfo[_spellInfo[i].npc].spellDamage * (1.0 + RND() * 0.5);
if (_player.hp > 0) {
damagePlayer(damage);
diff --git a/engines/griffon/resources.cpp b/engines/griffon/resources.cpp
index 6f5b7e0..a67b292 100644
--- a/engines/griffon/resources.cpp
+++ b/engines/griffon/resources.cpp
@@ -55,7 +55,7 @@ namespace Griffon {
void GriffonEngine::initialize() {
// init char *_floatstri[kMaxFloat]
for (int i = 0; i < kMaxFloat; i++)
- _floatStr[i] = (char *)malloc(64); // 64 bytes each string (should be enough)
+ _floatText[i].text = (char *)malloc(64); // 64 bytes each string (should be enough)
_video = new Graphics::TransparentSurface;
_video->create(320, 240, g_system->getScreenFormat());
@@ -107,17 +107,17 @@ void GriffonEngine::initialize() {
_nextTicks = _ticks + 1000;
for (int i = 0; i <= 15; i++) {
- _playerattackofs[0][i][0] = 0; // -1// -(i + 1)
- _playerattackofs[0][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2 - 1;
+ _playerAttackOfs[0][i].x = 0; // -1// -(i + 1)
+ _playerAttackOfs[0][i].y = -sin(3.14159 * 2 * (i + 1) / 16) * 2 - 1;
- _playerattackofs[1][i][0] = 0; // i + 1
- _playerattackofs[1][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2 + 1;
+ _playerAttackOfs[1][i].x = 0; // i + 1
+ _playerAttackOfs[1][i].y = -sin(3.14159 * 2 * (i + 1) / 16) * 2 + 1;
- _playerattackofs[2][i][0] = -1; // -(i + 1)
- _playerattackofs[2][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2;
+ _playerAttackOfs[2][i].x = -1; // -(i + 1)
+ _playerAttackOfs[2][i].y = -sin(3.14159 * 2 * (i + 1) / 16) * 2;
- _playerattackofs[3][i][0] = 1; // i + 1
- _playerattackofs[3][i][1] = -sin(3.14159 * 2 * (i + 1) / 16) * 2;
+ _playerAttackOfs[3][i].x = 1; // i + 1
+ _playerAttackOfs[3][i].y = -sin(3.14159 * 2 * (i + 1) / 16) * 2;
}
setupAudio();
@@ -390,7 +390,7 @@ void GriffonEngine::loadMap(int mapnum) {
_lastNpc = 0;
for (int i = 0; i < kMaxNPC; i++)
- _npcInfo[i].onmap = false;
+ _npcInfo[i].onMap = false;
for (int x = 0; x <= 19; x++) {
for (int y = 0; y <= 19; y++) {
@@ -444,7 +444,7 @@ void GriffonEngine::loadMap(int mapnum) {
_npcInfo[o].y = y * 16 - 5;
_npcInfo[o].walkdir = 1;
- _npcInfo[o].onmap = true;
+ _npcInfo[o].onMap = true;
}
}
}
@@ -492,8 +492,8 @@ void GriffonEngine::loadMap(int mapnum) {
_npcInfo[i].hp = 12;
_npcInfo[i].attackdelay = 2000;
- _npcInfo[i].attackdamage = 2;
- _npcInfo[i].spelldamage = 0;
+ _npcInfo[i].attackDamage = 2;
+ _npcInfo[i].spellDamage = 0;
_npcInfo[i].walkspd = 1;
@@ -505,13 +505,13 @@ void GriffonEngine::loadMap(int mapnum) {
if (_npcInfo[i].spriteset == kMonsterOneWing) {
_npcInfo[i].hp = 200;
_npcInfo[i].attackdelay = 2000;
- _npcInfo[i].swayspd = 1;
+ _npcInfo[i].swaySpeed = 1;
- _npcInfo[i].attackdamage = 24;
- _npcInfo[i].spelldamage = 30;
+ _npcInfo[i].attackDamage = 24;
+ _npcInfo[i].spellDamage = 30;
_npcInfo[i].walkspd = 1.4f;
- _npcInfo[i].castpause = _ticks;
+ _npcInfo[i].castPause = _ticks;
}
// boss1
@@ -519,8 +519,8 @@ void GriffonEngine::loadMap(int mapnum) {
_npcInfo[i].hp = 300;
_npcInfo[i].attackdelay = 2200;
- _npcInfo[i].attackdamage = 0;
- _npcInfo[i].spelldamage = 30;
+ _npcInfo[i].attackDamage = 0;
+ _npcInfo[i].spellDamage = 30;
_npcInfo[i].walkspd = 1.2f;
}
@@ -530,8 +530,8 @@ void GriffonEngine::loadMap(int mapnum) {
_npcInfo[i].hp = 200;
_npcInfo[i].attackdelay = 2800;
- _npcInfo[i].attackdamage = 0;
- _npcInfo[i].spelldamage = 30;
+ _npcInfo[i].attackDamage = 0;
+ _npcInfo[i].spellDamage = 30;
_npcInfo[i].walkspd = 1;
}
@@ -541,12 +541,12 @@ void GriffonEngine::loadMap(int mapnum) {
_npcInfo[i].hp = 600;
_npcInfo[i].attackdelay = 2200;
- _npcInfo[i].attackdamage = 50;
- _npcInfo[i].spelldamage = 30;
+ _npcInfo[i].attackDamage = 50;
+ _npcInfo[i].spellDamage = 30;
_npcInfo[i].walkspd = 1.3f;
- _npcInfo[i].swayangle = 0;
+ _npcInfo[i].swayAngle = 0;
}
// baby fire dragon
@@ -554,8 +554,8 @@ void GriffonEngine::loadMap(int mapnum) {
_npcInfo[i].hp = 20;
_npcInfo[i].attackdelay = 1500;
- _npcInfo[i].attackdamage = 0;
- _npcInfo[i].spelldamage = 12;
+ _npcInfo[i].attackDamage = 0;
+ _npcInfo[i].spellDamage = 12;
_npcInfo[i].walkspd = 1;
@@ -568,8 +568,8 @@ void GriffonEngine::loadMap(int mapnum) {
_npcInfo[i].hp = 40;
_npcInfo[i].attackdelay = 5000;
- _npcInfo[i].attackdamage = 0;
- _npcInfo[i].spelldamage = 8;
+ _npcInfo[i].attackDamage = 0;
+ _npcInfo[i].spellDamage = 8;
_npcInfo[i].walkspd = 1;
@@ -582,8 +582,8 @@ void GriffonEngine::loadMap(int mapnum) {
_npcInfo[i].hp = 100;
_npcInfo[i].attackdelay = 1500;
- _npcInfo[i].attackdamage = 0;
- _npcInfo[i].spelldamage = 24;
+ _npcInfo[i].attackDamage = 0;
+ _npcInfo[i].spellDamage = 24;
_npcInfo[i].walkspd = 1;
@@ -595,14 +595,14 @@ void GriffonEngine::loadMap(int mapnum) {
if (_npcInfo[i].spriteset == kMonsterTwoWing) {
_npcInfo[i].hp = 140;
_npcInfo[i].attackdelay = 2000;
- _npcInfo[i].swayspd = 1;
+ _npcInfo[i].swaySpeed = 1;
- _npcInfo[i].attackdamage = 30;
- _npcInfo[i].spelldamage = 0;
+ _npcInfo[i].attackDamage = 30;
+ _npcInfo[i].spellDamage = 0;
_npcInfo[i].walkspd = 1;
- _npcInfo[i].castpause = 0;
+ _npcInfo[i].castPause = 0;
}
// dragon2
@@ -610,8 +610,8 @@ void GriffonEngine::loadMap(int mapnum) {
_npcInfo[i].hp = 80;
_npcInfo[i].attackdelay = 1500;
- _npcInfo[i].attackdamage = 24;
- _npcInfo[i].spelldamage = 0;
+ _npcInfo[i].attackDamage = 24;
+ _npcInfo[i].spellDamage = 0;
_npcInfo[i].walkspd = 1;
@@ -623,8 +623,8 @@ void GriffonEngine::loadMap(int mapnum) {
_npcInfo[i].hp = 1200;
_npcInfo[i].attackdelay = 2000;
- _npcInfo[i].attackdamage = 100;
- _npcInfo[i].spelldamage = 60;
+ _npcInfo[i].attackDamage = 100;
+ _npcInfo[i].spellDamage = 60;
_npcInfo[i].walkspd = 1;
@@ -636,15 +636,15 @@ void GriffonEngine::loadMap(int mapnum) {
_npcInfo[i].hp = 800;
_npcInfo[i].attackdelay = 2000;
- _npcInfo[i].attackdamage = 100;
- _npcInfo[i].spelldamage = 50;
+ _npcInfo[i].attackDamage = 100;
+ _npcInfo[i].spellDamage = 50;
_npcInfo[i].walkspd = 1;
_npcInfo[i].floating = RND() * 16;
}
- if (!_npcInfo[i].onmap)
+ if (!_npcInfo[i].onMap)
_npcInfo[i].hp = 0;
_npcInfo[i].maxhp = _npcInfo[i].hp;
@@ -678,8 +678,8 @@ void GriffonEngine::loadMap(int mapnum) {
_npcInfo[i].bodysection[f].y = _npcInfo[i].y + 14;
}
- _npcInfo[i].headtargetx[0] = _npcInfo[i].x + 12;
- _npcInfo[i].headtargety[0] = _npcInfo[i].y + 14;
+ _npcInfo[i].headTargetX[0] = _npcInfo[i].x + 12;
+ _npcInfo[i].headTargetY[0] = _npcInfo[i].y + 14;
}
@@ -690,8 +690,8 @@ void GriffonEngine::loadMap(int mapnum) {
}
for (int f = 0; f <= 2; f++) {
- _npcInfo[i].headtargetx[f] = _npcInfo[i].x + 12;
- _npcInfo[i].headtargety[f] = _npcInfo[i].y + 14;
+ _npcInfo[i].headTargetX[f] = _npcInfo[i].x + 12;
+ _npcInfo[i].headTargetY[f] = _npcInfo[i].y + 14;
_npcInfo[i].attacking2[f] = false;
_npcInfo[i].attackframe2[f] = 0;
Commit: 3112d2e7d96d5294875bdd2c72e6a563a634db50
https://github.com/scummvm/scummvm/commit/3112d2e7d96d5294875bdd2c72e6a563a634db50
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix namespace comment
Changed paths:
engines/griffon/console.cpp
diff --git a/engines/griffon/console.cpp b/engines/griffon/console.cpp
index e055bc2..f8c51f7 100644
--- a/engines/griffon/console.cpp
+++ b/engines/griffon/console.cpp
@@ -43,4 +43,4 @@ bool Console::Cmd_godMode(int argc, const char** argv) {
return true;
}
-} // End of namespace Plumbers
+} // End of namespace Griffon
Commit: 2eec117a5cf9f33cd14f581f01d1c615d837b9df
https://github.com/scummvm/scummvm/commit/2eec117a5cf9f33cd14f581f01d1c615d837b9df
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Get rid of config.h/cpp
Changed paths:
R engines/griffon/config.cpp
R engines/griffon/config.h
engines/griffon/dialogs.cpp
engines/griffon/griffon.cpp
engines/griffon/griffon.h
engines/griffon/module.mk
diff --git a/engines/griffon/config.cpp b/engines/griffon/config.cpp
deleted file mode 100644
index 5b9b396..0000000
--- a/engines/griffon/config.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- *
- * Originally written by Syn9 in FreeBASIC with SDL
- * http://syn9.thehideoutgames.com/index_backup.php
- *
- * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
- * http://github.com/dmitrysmagin/griffon_legend
- *
- *
- * Programming/Graphics: Daniel "Syn9" Kennedy
- * Music/Sound effects: David Turner
- *
- * Beta testing and gameplay design help:
- * Deleter, Cha0s, Aether Fox, and Kiz
- *
- */
-
-#include "griffon/config.h"
-#include "common/config-manager.h"
-
-namespace Griffon {
-
-CONFIG config;
-
-void loadConfig(CONFIG *config) {
- bool mute = false;
- config->music = config->effects = false;
-
- if (ConfMan.hasKey("mute"))
- mute = ConfMan.getBool("mute");
-
- if (!mute) {
- config->music = !ConfMan.getBool("music_mute");
- config->effects = !ConfMan.getBool("sfx_mute");
- }
-
- config->musicVol = ConfMan.getInt("music_volume");
- config->effectsVol = ConfMan.getInt("sfx_volume");
-}
-
-void saveConfig(CONFIG *config) {
- ConfMan.setBool("mute", !(config->music || config->effectsVol));
- ConfMan.setBool("music_mute", !config->music);
- ConfMan.setBool("sfx_mute", !config->effects);
- ConfMan.setInt("music_volume", config->musicVol);
- ConfMan.setInt("sfx_volume", config->effectsVol);
-
- ConfMan.flushToDisk();
-}
-
-} // end of namespace Griffon
diff --git a/engines/griffon/config.h b/engines/griffon/config.h
deleted file mode 100644
index 0c46e62..0000000
--- a/engines/griffon/config.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- *
- * Originally written by Syn9 in FreeBASIC with SDL
- * http://syn9.thehideoutgames.com/index_backup.php
- *
- * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
- * http://github.com/dmitrysmagin/griffon_legend
- *
- *
- * Programming/Graphics: Daniel "Syn9" Kennedy
- * Music/Sound effects: David Turner
- *
- * Beta testing and gameplay design help:
- * Deleter, Cha0s, Aether Fox, and Kiz
- *
- */
-
-#ifndef GRIFFON_CONFIG_H
-#define GRIFFON_CONFIG_H
-
-namespace Griffon {
-
-struct CONFIG {
- bool music;
- int musicVol;
- bool effects;
- int effectsVol;
-};
-
-extern CONFIG config;
-
-void loadConfig(CONFIG *config);
-void saveConfig(CONFIG *config);
-
-} // end of namespace Griffon
-
-#endif
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index fbcabc7..da42494 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -446,7 +446,7 @@ void GriffonEngine::configMenu() {
config.effects = false;
break;
case 13:
- saveConfig(&config);
+ saveConfig();
// no break on purpose
case 14:
exitMenu = true;
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index 653c899..b5460f8 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -65,7 +65,6 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
// Synchronize the sound settings from ScummVM
syncSoundSettings();
- loadConfig(&config);
}
GriffonEngine::~GriffonEngine() {
@@ -74,6 +73,30 @@ GriffonEngine::~GriffonEngine() {
void GriffonEngine::syncSoundSettings() {
Engine::syncSoundSettings();
+
+ bool mute = false;
+ config.music = config.effects = false;
+
+ if (ConfMan.hasKey("mute"))
+ mute = ConfMan.getBool("mute");
+
+ if (!mute) {
+ config.music = !ConfMan.getBool("music_mute");
+ config.effects = !ConfMan.getBool("sfx_mute");
+ }
+
+ config.musicVol = ConfMan.getInt("music_volume");
+ config.effectsVol = ConfMan.getInt("sfx_volume");
+}
+
+void GriffonEngine::saveConfig() {
+ ConfMan.setBool("mute", !(config.music || config.effectsVol));
+ ConfMan.setBool("music_mute", !config.music);
+ ConfMan.setBool("sfx_mute", !config.effects);
+ ConfMan.setInt("music_volume", config.musicVol);
+ ConfMan.setInt("sfx_volume", config.effectsVol);
+
+ ConfMan.flushToDisk();
}
Common::Error GriffonEngine::run() {
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index dc6867b..cfdbd62 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -302,6 +302,13 @@ struct AttackOffsetStruct {
bool completed;
};
+struct CONFIG {
+ bool music;
+ int musicVol;
+ bool effects;
+ int effectsVol;
+};
+
class GriffonEngine : public Engine {
public:
GriffonEngine(OSystem *syst);
@@ -520,11 +527,13 @@ private:
bool _saidLocked;
bool _saidJammed;
-
// ysort
int _ysort[2401], _lasty, _firsty;
bool _pmenu;
+
+ CONFIG config;
+ void saveConfig();
};
}
diff --git a/engines/griffon/module.mk b/engines/griffon/module.mk
index 857fcd7..0c6edeb 100644
--- a/engines/griffon/module.mk
+++ b/engines/griffon/module.mk
@@ -2,7 +2,6 @@ MODULE := engines/griffon
MODULE_OBJS := \
combat.o \
- config.o \
console.o \
cutscenes.o \
detection.o \
Commit: 473f253e49ec3df55906910d1d8c1ff4ff28d7b6
https://github.com/scummvm/scummvm/commit/473f253e49ec3df55906910d1d8c1ff4ff28d7b6
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix compilation
Changed paths:
engines/griffon/combat.cpp
engines/griffon/cutscenes.cpp
engines/griffon/dialogs.cpp
engines/griffon/draw.cpp
engines/griffon/engine.cpp
engines/griffon/griffon.cpp
engines/griffon/input.cpp
engines/griffon/logic.cpp
engines/griffon/sound.cpp
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp
index 9ec4c59..3ee185f 100644
--- a/engines/griffon/combat.cpp
+++ b/engines/griffon/combat.cpp
@@ -35,7 +35,6 @@
*/
#include "griffon/griffon.h"
-#include "griffon/config.h"
#include "griffon/console.h"
namespace Griffon {
diff --git a/engines/griffon/cutscenes.cpp b/engines/griffon/cutscenes.cpp
index 0a0556e..2ffa333 100644
--- a/engines/griffon/cutscenes.cpp
+++ b/engines/griffon/cutscenes.cpp
@@ -37,7 +37,6 @@
#include "common/system.h"
#include "griffon/griffon.h"
-#include "griffon/config.h"
namespace Griffon {
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index da42494..be8a7db 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -38,7 +38,6 @@
#include "common/config-manager.h"
#include "griffon/griffon.h"
-#include "griffon/config.h"
namespace Griffon {
diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp
index 54eab5c..6517821 100644
--- a/engines/griffon/draw.cpp
+++ b/engines/griffon/draw.cpp
@@ -37,7 +37,6 @@
#include "common/system.h"
#include "griffon/griffon.h"
-#include "griffon/config.h"
namespace Griffon {
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 3dea927..f7e89bb 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -35,7 +35,6 @@
*/
#include "griffon/griffon.h"
-#include "griffon/config.h"
#include "griffon/console.h"
#include "common/system.h"
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index b5460f8..5eb5643 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -32,7 +32,6 @@
#include "engines/util.h"
#include "griffon/griffon.h"
-#include "griffon/config.h"
#include "griffon/console.h"
namespace Griffon {
diff --git a/engines/griffon/input.cpp b/engines/griffon/input.cpp
index 9683242..d2ac4a6 100644
--- a/engines/griffon/input.cpp
+++ b/engines/griffon/input.cpp
@@ -37,7 +37,6 @@
#include "common/system.h"
#include "griffon/griffon.h"
-#include "griffon/config.h"
#include "griffon/console.h"
namespace Griffon {
diff --git a/engines/griffon/logic.cpp b/engines/griffon/logic.cpp
index 79ed593..07fcd30 100644
--- a/engines/griffon/logic.cpp
+++ b/engines/griffon/logic.cpp
@@ -35,7 +35,6 @@
*/
#include "griffon/griffon.h"
-#include "griffon/config.h"
namespace Griffon {
diff --git a/engines/griffon/sound.cpp b/engines/griffon/sound.cpp
index b0e75fc..e3f2230 100644
--- a/engines/griffon/sound.cpp
+++ b/engines/griffon/sound.cpp
@@ -42,7 +42,6 @@
#include "common/system.h"
#include "griffon/griffon.h"
-#include "griffon/config.h"
namespace Griffon {
Commit: 0bc9ee6389e1c2d1f51f81dd7f3301ef5ed097bf
https://github.com/scummvm/scummvm/commit/0bc9ee6389e1c2d1f51f81dd7f3301ef5ed097bf
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Some refactoring in saveLoadNew(), som renaming
Changed paths:
engines/griffon/dialogs.cpp
engines/griffon/draw.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index be8a7db..be7dfae 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -477,8 +477,8 @@ void GriffonEngine::saveLoadNew() {
_videoBuffer->setAlpha(255);
_saveLoadImg->setAlpha(192, true);
- int currow = 0;
- int curcol = 0;
+ int curRow = 0;
+ int curCol = 0;
bool lowerLock = false;
_ticks = g_system->getMillis();
@@ -522,46 +522,40 @@ void GriffonEngine::saveLoadNew() {
_itemTicks = _ticks + 220;
if (_event.kbd.keycode == Common::KEYCODE_RETURN) {
- // QUIT - non existent :)
- if (currow == 0 && curcol == 4) {
- _shouldQuit = true;
- return;
- }
- // RETURN
- if (currow == 0 && curcol == 3) {
- // reset keys to avoid returning
- // keys[SDLK_RETURN] = keys[SDLK_SPACE] = 0; // FIXME
- return;
- }
- // NEW GAME
- if (currow == 0 && curcol == 0)
- newGame();
-
- // LOAD GAME
- if (currow == 0 && curcol == 1) {
- lowerLock = true;
- currow = 1 + _saveSlot;
- tickpause = _ticks + 125;
- }
- // SAVE GAME
- if (currow == 0 && curcol == 2) {
- lowerLock = true;
- currow = 1;
- tickpause = _ticks + 125;
- }
+ if (curRow == 0) {
+ if (curCol == 0) {
+ // NEW GAME
+ newGame();
+ } else if (curCol == 1) {
+ // LOAD GAME
+ lowerLock = true;
+ curRow = 1 + _saveSlot;
+ tickpause = _ticks + 125;
+ } else if (curCol == 2) {
+ // SAVE GAME
+ lowerLock = true;
+ curRow = 1;
+ tickpause = _ticks + 125;
+ } else if (curCol == 3) {
+ // RETURN
+ // reset keys to avoid returning
+ // keys[SDLK_RETURN] = keys[SDLK_SPACE] = 0; // FIXME
+ return;
+ } else if (curCol == 4) {
+ // QUIT - non existent :)
+ _shouldQuit = true;
+ return;
+ }
+ }
- if (lowerLock && curcol == 1 && tickpause < _ticks) {
- if (saveState(currow - 1)) {
+ if (lowerLock && tickpause < _ticks) {
+ if ((curCol == 1) && saveState(curRow - 1)) {
_secStart += _secsingame;
_secsingame = 0;
lowerLock = false;
- _saveSlot = currow - 1;
- currow = 0;
- }
- }
-
- if (lowerLock && curcol == 2 && tickpause < _ticks) {
- if (loadState(currow - 1)) {
+ _saveSlot = curRow - 1;
+ curRow = 0;
+ } else if ((curCol == 2) && loadState(curRow - 1)) {
_player.walkSpeed = 1.1f;
_animSpeed = 0.5f;
_attacking = false;
@@ -573,7 +567,7 @@ void GriffonEngine::saveLoadNew() {
haltSoundChannel(-1);
_secsingame = 0;
- _saveSlot = currow - 1;
+ _saveSlot = curRow - 1;
loadMap(_curMap);
mainLoop();
}
@@ -587,41 +581,41 @@ void GriffonEngine::saveLoadNew() {
if (!lowerLock)
return;
lowerLock = false;
- currow = 0;
+ curRow = 0;
tickpause = _ticks + 125;
break;
case Common::KEYCODE_DOWN:
if (lowerLock) {
- ++currow;
- if (currow == 5)
- currow = 1;
+ ++curRow;
+ if (curRow == 5)
+ curRow = 1;
tickpause = _ticks + 125;
}
break;
case Common::KEYCODE_UP:
if (lowerLock) {
- --currow;
- if (currow == 0)
- currow = 4;
+ --curRow;
+ if (curRow == 0)
+ curRow = 4;
tickpause = _ticks + 125;
}
break;
case Common::KEYCODE_LEFT:
if (!lowerLock) {
- --curcol;
- if (curcol == -1)
- curcol = 3;
+ --curCol;
+ if (curCol == -1)
+ curCol = 3;
tickpause = _ticks + 125;
}
break;
case Common::KEYCODE_RIGHT:
if (!lowerLock) {
- ++curcol;
- if (curcol == 4)
- curcol = 0;
+ ++curCol;
+ if (curCol == 4)
+ curCol = 0;
tickpause = _ticks + 125;
}
break;
@@ -653,7 +647,7 @@ void GriffonEngine::saveLoadNew() {
sprintf(line, "Game Time: %02i:%02i:%02i", h, m, s);
drawString(_videoBuffer, line, 160 - strlen(line) * 4, sy, 0);
- sx = 12;
+ sx = 12;
sy += 11;
int cc = 0;
@@ -705,9 +699,9 @@ void GriffonEngine::saveLoadNew() {
// ------------------------------------------
- if (currow == 0) {
+ if (curRow == 0) {
rcDest.top = 18;
- switch(curcol) {
+ switch(curCol) {
case 0:
rcDest.left = 10;
break;
@@ -726,9 +720,9 @@ void GriffonEngine::saveLoadNew() {
rcDest.left += (int16)(2 + 2 * sin(2 * PI * _itemyloc / 16));
}
- if (currow > 0) {
+ if (curRow > 0) {
rcDest.left = (int16)(0 + 2 * sin(2 * PI * _itemyloc / 16));
- rcDest.top = (int16)(53 + (currow - 1) * 48);
+ rcDest.top = (int16)(53 + (curRow - 1) * 48);
}
_itemImg[15]->blit(*_videoBuffer, rcDest.left, rcDest.top);
@@ -736,9 +730,9 @@ void GriffonEngine::saveLoadNew() {
if (lowerLock) {
rcDest.top = 18;
- if (curcol == 1)
+ if (curCol == 1)
rcDest.left = 108;
- else if (curcol == 2)
+ else if (curCol == 2)
rcDest.left = 170;
// CHECKME: Useless code? or temporary commented?
@@ -756,7 +750,6 @@ void GriffonEngine::saveLoadNew() {
_videoBuffer->setAlpha((int)yy);
g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
g_system->updateScreen();
-
g_system->getEventManager()->pollEvent(_event);
_ticksPassed = _ticks;
diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp
index 6517821..73785df 100644
--- a/engines/griffon/draw.cpp
+++ b/engines/griffon/draw.cpp
@@ -106,8 +106,7 @@ void GriffonEngine::drawAnims(int Layer) {
int y1 = (sy + y) * 16;
if (_objectTile[o][cframe][x][y][1] == Layer) {
- int c = _objectTile[o][cframe][x][y][0];
- c = c - 1;
+ int c = _objectTile[o][cframe][x][y][0] - 1;
int curtilel = 3;
int curtilex = c % 20;
int curtiley = (c - curtilex) / 20;
@@ -176,7 +175,7 @@ void GriffonEngine::drawAnims(int Layer) {
int hud_recalc(int a, int b, int c) {
int result = a * b / c;
- return result > b ? b : result;
+ return MIN(result, b);
}
#define RGB(R, G, B) (_videoBuffer->format.RGBToColor((R), (G), (B)))
@@ -263,10 +262,7 @@ void GriffonEngine::drawHud() {
}
if (_selEnemyOn == false) {
- rcDest.left = 0;
- rcDest.top = 0;
- rcDest.right = 320;
- rcDest.bottom = 240;
+ rcDest = Common::Rect(320, 240);
_videoBuffer2->fillRect(rcDest, 0);
_videoBuffer2->setAlpha((int)(_player.itemselshade * 4)); // FIXME
_videoBuffer2->blit(*_videoBuffer);
Commit: 138d364e24a9b5d380e75645374c5b703b0b69c8
https://github.com/scummvm/scummvm/commit/138d364e24a9b5d380e75645374c5b703b0b69c8
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix a bug introduced in the original C conversion
Changed paths:
engines/griffon/cutscenes.cpp
diff --git a/engines/griffon/cutscenes.cpp b/engines/griffon/cutscenes.cpp
index 2ffa333..4936460 100644
--- a/engines/griffon/cutscenes.cpp
+++ b/engines/griffon/cutscenes.cpp
@@ -188,7 +188,7 @@ void GriffonEngine::intro() {
_secsingame = 0;
_secStart = 0;
- bool ldstop = false;
+ bool ldStop = false;
int cnt = 0;
float xofs = 0.0;
float ld = 0.0;
@@ -198,10 +198,10 @@ void GriffonEngine::intro() {
ld += 4 * _fpsr;
if ((int)ld > config.musicVol)
ld = config.musicVol;
- if (!ldstop) {
+ if (!ldStop) {
setChannelVolume(_musicChannel, (int)ld);
if ((int)ld == config.musicVol)
- ldstop = true;
+ ldStop = true;
}
rc.left = -xofs;
@@ -226,7 +226,7 @@ void GriffonEngine::intro() {
drawString(_videoBuffer, story[i], x, yy, 4);
}
- if (yy < 10 && i == 47)
+ if (yy < 10 && i == 37)
return;
}
Commit: 008fbcab5b3683e03437fe136b1e72be95bcec9f
https://github.com/scummvm/scummvm/commit/008fbcab5b3683e03437fe136b1e72be95bcec9f
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Introduce ObjectInfoStruct, some refactoring
Changed paths:
engines/griffon/combat.cpp
engines/griffon/cutscenes.cpp
engines/griffon/draw.cpp
engines/griffon/griffon.cpp
engines/griffon/griffon.h
engines/griffon/input.cpp
engines/griffon/logic.cpp
engines/griffon/resources.cpp
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp
index 3ee185f..f140674 100644
--- a/engines/griffon/combat.cpp
+++ b/engines/griffon/combat.cpp
@@ -55,11 +55,11 @@ void GriffonEngine::attack() {
o2 = _objectMap[lx][ly - 2];
// cst
- if ((_objectInfo[o][4] == 1 && (o == 0 || o > 4)) || (_objectInfo[o2][4] == 0 && o2 == 10)) {
+ if ((_objectInfo[o].type == 1 && (o == 0 || o > 4)) || (_objectInfo[o2].type == 0 && o2 == 10)) {
if (o2 == 10)
o = 10;
- int oscript = _objectInfo[o][5];
+ int oscript = _objectInfo[o].script;
switch (oscript) {
case kScriptFlask:
if (_player.inventory[kInvFlask] < 9) {
@@ -73,7 +73,7 @@ void GriffonEngine::attack() {
setChannelVolume(snd, config.effectsVol);
}
- if (_objectInfo[o][4] == 1)
+ if (_objectInfo[o].type == 1)
_objectMap[lx][ly - 1] = 3;
eventText("Found Flask!");
@@ -107,7 +107,7 @@ void GriffonEngine::attack() {
setChannelVolume(snd, config.effectsVol);
}
- if (_objectInfo[o][4] == 1)
+ if (_objectInfo[o].type == 1)
_objectMap[lx][ly - 1] = 3;
eventText("Found the Temple Key!");
return;
@@ -122,7 +122,7 @@ void GriffonEngine::attack() {
setChannelVolume(snd, config.effectsVol);
}
- if (_objectInfo[o][4] == 1)
+ if (_objectInfo[o].type == 1)
_objectMap[lx][ly - 1] = 3;
eventText("Found the Infinite Crystal!");
@@ -141,7 +141,7 @@ void GriffonEngine::attack() {
setChannelVolume(snd, config.effectsVol);
}
- if (_objectInfo[o][4] == 1)
+ if (_objectInfo[o].type == 1)
_objectMap[lx][ly - 1] = 3;
eventText("Found the Obsidian Shield!");
@@ -162,7 +162,7 @@ void GriffonEngine::attack() {
setChannelVolume(snd, config.effectsVol);
}
- if (_objectInfo[o][4] == 1)
+ if (_objectInfo[o].type == 1)
_objectMap[lx][ly - 1] = 3;
eventText("Found the Fidelis Sword!");
return;
@@ -185,7 +185,7 @@ void GriffonEngine::attack() {
_objectMapFull[_curMap][lx][ly - 1] = 1;
- if (_objectInfo[o][4] == 1)
+ if (_objectInfo[o].type == 1)
_objectMap[lx][ly - 1] = 3;
eventText("Found Key");
@@ -211,7 +211,7 @@ void GriffonEngine::attack() {
setChannelVolume(snd, config.effectsVol);
}
- if (_objectInfo[o][4] == 1)
+ if (_objectInfo[o].type == 1)
_objectMap[lx][ly - 1] = 3;
eventText("Found Mega Flask!");
@@ -239,7 +239,7 @@ void GriffonEngine::attack() {
setChannelVolume(snd, config.effectsVol);
}
- if (_objectInfo[o][4] == 1)
+ if (_objectInfo[o].type == 1)
_objectMap[lx][ly - 1] = 3;
eventText("Found Mega Flask!");
@@ -266,7 +266,7 @@ void GriffonEngine::attack() {
setChannelVolume(snd, config.effectsVol);
}
- if (_objectInfo[o][4] == 1)
+ if (_objectInfo[o].type == 1)
_objectMap[lx][ly - 1] = 3;
eventText("Found Lightning Bomb!");
@@ -292,7 +292,7 @@ void GriffonEngine::attack() {
setChannelVolume(snd, config.effectsVol);
}
- if (_objectInfo[o][4] == 1)
+ if (_objectInfo[o].type == 1)
_objectMap[lx][ly - 1] = 3;
eventText("Found the Fidelis Mail!");
@@ -344,7 +344,7 @@ void GriffonEngine::attack() {
setChannelVolume(snd, config.effectsVol);
}
- if (_objectInfo[o][4] == 1)
+ if (_objectInfo[o].type == 1)
_objectMap[lx][ly - 1] = 3;
eventText("Found the Blood Sword!");
_objectMapFull[4][1][2] = 1;
@@ -362,7 +362,7 @@ void GriffonEngine::attack() {
setChannelVolume(snd, config.effectsVol);
}
- if (_objectInfo[o][4] == 1)
+ if (_objectInfo[o].type == 1)
_objectMap[lx][ly - 1] = 3;
eventText("Found the Entropy Shield!");
_objectMapFull[4][1][2] = 1;
@@ -380,7 +380,7 @@ void GriffonEngine::attack() {
setChannelVolume(snd, config.effectsVol);
}
- if (_objectInfo[o][4] == 1)
+ if (_objectInfo[o].type == 1)
_objectMap[lx][ly - 1] = 3;
eventText("Found the Rubyscale Armour!");
_objectMapFull[4][1][2] = 1;
diff --git a/engines/griffon/cutscenes.cpp b/engines/griffon/cutscenes.cpp
index 4936460..8e67eb6 100644
--- a/engines/griffon/cutscenes.cpp
+++ b/engines/griffon/cutscenes.cpp
@@ -290,7 +290,7 @@ void GriffonEngine::endOfGame() {
bool ldstop = false; // CHECKME: Check if actually used
do {
- ld = ld + 4 * _fpsr;
+ ld += 4 * _fpsr;
if (ld > config.musicVol)
ld = config.musicVol;
if (!ldstop) {
@@ -413,8 +413,7 @@ void GriffonEngine::endOfGame() {
if (_ticks < ticks1 + 1500) {
y1 = 255 * (_ticks - ticks1) / 1500;
y1 = CLIP(y1, 0, 255);
- }
- else
+ } else
break;
_videoBuffer->fillRect(Common::Rect(0, 0, _videoBuffer->w, _videoBuffer->h), 0);
diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp
index 73785df..3fd968f 100644
--- a/engines/griffon/draw.cpp
+++ b/engines/griffon/draw.cpp
@@ -96,8 +96,8 @@ void GriffonEngine::drawAnims(int Layer) {
int o = _objectMap[sx][sy];
if (o > -1) {
- int xtiles = _objectInfo[o][1];
- int ytiles = _objectInfo[o][2];
+ int xtiles = _objectInfo[o].xTiles;
+ int ytiles = _objectInfo[o].yTiles;
int cframe = _objectFrame[o][1];
for (int x = 0; x <= xtiles - 1; x++) {
@@ -174,7 +174,6 @@ void GriffonEngine::drawAnims(int Layer) {
int hud_recalc(int a, int b, int c) {
int result = a * b / c;
-
return MIN(result, b);
}
@@ -371,13 +370,13 @@ void GriffonEngine::drawHud() {
rcSrc.top = sy;
if (i == 0)
_itemImg[6]->blit(*_videoBuffer, rcSrc.left, rcSrc.top);
- if (i == 1)
+ else if (i == 1)
_itemImg[12]->blit(*_videoBuffer, rcSrc.left, rcSrc.top);
- if (i == 2)
+ else if (i == 2)
_itemImg[17]->blit(*_videoBuffer, rcSrc.left, rcSrc.top);
- if (i == 3)
+ else if (i == 3)
_itemImg[16]->blit(*_videoBuffer, rcSrc.left, rcSrc.top);
- if (i == 4)
+ else if (i == 4)
_itemImg[14]->blit(*_videoBuffer, rcSrc.left, rcSrc.top);
sprintf(line, "x%i", _player.inventory[i]);
@@ -408,9 +407,7 @@ void GriffonEngine::drawHud() {
rcDest.left = (float)(243 - 12 + 3 * sin(3.141592 * 2 * _itemyloc / 16));
rcDest.top = 67 + 24 * i;
_itemImg[15]->blit(*_videoBuffer, rcDest.left, rcDest.top);
- }
-
- if (_curItem == i) {
+ } else if (_curItem == i) {
rcDest.left = (float)(189 - 12 + 3 * sin(3.141592 * 2 * _itemyloc / 16));
rcDest.top = 70 + 24 * i;
_itemImg[15]->blit(*_videoBuffer, rcDest.left, rcDest.top);
@@ -1193,7 +1190,7 @@ void GriffonEngine::swash() {
y = 0;
do {
- y = y + 1 * _fpsr;
+ y += _fpsr;
_videoBuffer->setAlpha((int)(y * 25));
_mapBg->blit(*_videoBuffer);
@@ -1230,9 +1227,7 @@ void GriffonEngine::swash() {
while (_cloudAngle >= 360)
_cloudAngle -= 360;
- if (y > 10)
- break;
- } while (1);
+ } while (y <= 10);
_videoBuffer->setAlpha(255);
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index 5eb5643..b921e74 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -53,8 +53,14 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
_cloudAngle = 0.0f;
for (int i = 0; i < 33; ++i) {
- for (int j = 0; j < 6; ++j)
- _objectInfo[i][j] = 0;
+ for (int j = 0; j < 6; ++j) {
+ _objectInfo[i].nFrames = 0;
+ _objectInfo[i].xTiles = 0;
+ _objectInfo[i].yTiles = 0;
+ _objectInfo[i].speed = 0;
+ _objectInfo[i].type = 0;
+ _objectInfo[i].script = 0;
+ }
}
for (int i = 0; i < 256; ++i) {
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index cfdbd62..e7b9c82 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -302,13 +302,22 @@ struct AttackOffsetStruct {
bool completed;
};
-struct CONFIG {
+struct Config {
bool music;
int musicVol;
bool effects;
int effectsVol;
};
+struct ObjectInfoStruct {
+ int nFrames;
+ int xTiles;
+ int yTiles;
+ int speed;
+ int type;
+ int script;
+};
+
class GriffonEngine : public Engine {
public:
GriffonEngine(OSystem *syst);
@@ -491,8 +500,8 @@ private:
float _objectFrame[256][2];
int _lastObj;
// frame!, curframe
- int _objectInfo[33][6];
- // nframes,xtiles,ytiles,speed,type,script, update?
+ ObjectInfoStruct _objectInfo[33];
+
int _objectTile[33][9][3][3][2];
// [objnum] [frame] [x] [y] [tile/layer]
int _objectMap[21][15];
@@ -532,7 +541,7 @@ private:
bool _pmenu;
- CONFIG config;
+ Config config;
void saveConfig();
};
diff --git a/engines/griffon/input.cpp b/engines/griffon/input.cpp
index d2ac4a6..4b2ea5c 100644
--- a/engines/griffon/input.cpp
+++ b/engines/griffon/input.cpp
@@ -56,7 +56,7 @@ void GriffonEngine::checkInputs() {
for (int x = 0; x <= 19; x++) {
for (int y = 0; y <= 14; y++) {
int o = _objectMap[x][y];
- if (_objectInfo[o][4] == 3) {
+ if (_objectInfo[o].type == 3) {
_postInfo[_postInfoNbr][0] = x * 16;
_postInfo[_postInfoNbr][1] = y * 16;
_postInfoNbr = _postInfoNbr + 1;
@@ -545,7 +545,7 @@ void GriffonEngine::handleWalking() {
if (o > -1) {
// fsk
- if (_objectInfo[o][4] == 2 && _player.inventory[kInvFlask] < 9) {
+ if (_objectInfo[o].type == 2 && _player.inventory[kInvFlask] < 9) {
_objectMap[lx][ly] = -1;
_player.inventory[kInvFlask]++;
@@ -559,7 +559,7 @@ void GriffonEngine::handleWalking() {
}
}
- if (_objectInfo[o][5] == 7 && _player.inventory[kInvDoubleFlask] < 9) {
+ if (_objectInfo[o].script == 7 && _player.inventory[kInvDoubleFlask] < 9) {
_objectMap[lx][ly] = -1;
_player.inventory[kInvDoubleFlask]++;
@@ -573,7 +573,7 @@ void GriffonEngine::handleWalking() {
}
}
- if (_objectInfo[o][5] == 9 && _player.inventory[kInvShock] < 9 && (_curMap == 41 && _scriptFlag[kScriptLightningBomb][1] == 0)) {
+ if (_objectInfo[o].script == 9 && _player.inventory[kInvShock] < 9 && (_curMap == 41 && _scriptFlag[kScriptLightningBomb][1] == 0)) {
_objectMap[lx][ly] = -1;
_player.inventory[kInvShock]++;
@@ -590,7 +590,7 @@ void GriffonEngine::handleWalking() {
}
- if (_objectInfo[o][5] == 9 && _player.inventory[kInvShock] < 9) {
+ if (_objectInfo[o].script == 9 && _player.inventory[kInvShock] < 9) {
_objectMap[lx][ly] = -1;
_player.inventory[kInvShock]++;
diff --git a/engines/griffon/logic.cpp b/engines/griffon/logic.cpp
index 07fcd30..d41b352 100644
--- a/engines/griffon/logic.cpp
+++ b/engines/griffon/logic.cpp
@@ -76,15 +76,14 @@ const int elementmap[15][20] = {
void GriffonEngine::updateAnims() {
for (int i = 0; i <= _lastObj; i++) {
- int nframes = _objectInfo[i][0];
- int o_animspd = _objectInfo[i][3];
+ int nFrames = _objectInfo[i].nFrames;
+ int objAnimSpeed = _objectInfo[i].speed;
float frame = _objectFrame[i][0];
- // _objectinfo[i][6] = 0; // ?? out of bounds
- if (nframes > 1) {
- frame += o_animspd / 50 * _fpsr;
- while (frame >= nframes)
- frame -= nframes;
+ if (nFrames > 1) {
+ frame += objAnimSpeed / 50 * _fpsr;
+ while (frame >= nFrames)
+ frame -= nFrames;
int cframe = (int)frame; // truncate fractional part
if (cframe < 0)
@@ -1628,7 +1627,7 @@ void GriffonEngine::updateSpells() {
int o = _objectMap[sx][sy];
if (o > -1) {
- if (_objectInfo[o][4] == 1)
+ if (_objectInfo[o].type == 1)
foundel[2] = true;
if (o == 1 || o == 2) {
foundel[2] = true;
diff --git a/engines/griffon/resources.cpp b/engines/griffon/resources.cpp
index a67b292..e0da5c1 100644
--- a/engines/griffon/resources.cpp
+++ b/engines/griffon/resources.cpp
@@ -415,7 +415,7 @@ void GriffonEngine::loadMap(int mapnum) {
if (_objectMapFull[_curMap][x][y] == 0) {
_objectMap[x][y] = o;
- if (_objectInfo[o][0] > 1) {
+ if (_objectInfo[o].nFrames > 1) {
if (o > _lastObj)
_lastObj = o;
}
@@ -428,9 +428,9 @@ void GriffonEngine::loadMap(int mapnum) {
rcDest.setWidth(8);
rcDest.setHeight(8);
- if (_objectInfo[o][4] == 1)
+ if (_objectInfo[o].type == 1)
_clipBg->fillRect(rcDest, ccc);
- if (_objectInfo[o][4] == 3)
+ if (_objectInfo[o].type == 3)
_clipBg->fillRect(rcDest, ccc);
}
}
@@ -1144,9 +1144,12 @@ void GriffonEngine::loadObjectDB() {
error("Cannot open file objectdb.dat");
for (int a = 0; a <= 32; a++) {
- for (int b = 0; b <= 5; b++) {
- INPUT("%i", &_objectInfo[a][b]);
- }
+ INPUT("%i", &_objectInfo[a].nFrames);
+ INPUT("%i", &_objectInfo[a].xTiles);
+ INPUT("%i", &_objectInfo[a].yTiles);
+ INPUT("%i", &_objectInfo[a].speed);
+ INPUT("%i", &_objectInfo[a].type);
+ INPUT("%i", &_objectInfo[a].script);
for (int b = 0; b <= 8; b++) {
for (int c = 0; c <= 2; c++) {
Commit: 972a1474af7de718f71a88af8545b905de54cefd
https://github.com/scummvm/scummvm/commit/972a1474af7de718f71a88af8545b905de54cefd
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Remove recursiveness of the main menu
Changed paths:
engines/griffon/dialogs.cpp
engines/griffon/griffon.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index be7dfae..09aae2c 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -186,10 +186,11 @@ void GriffonEngine::title(int mode) {
case Common::KEYCODE_RETURN:
switch(cursel) {
case 0:
- saveLoadNew();
_ticks = g_system->getMillis();
keypause = _ticks + 150;
ticks1 = _ticks;
+
+ exitTitle = true;
break;
case 1:
configMenu();
@@ -546,7 +547,7 @@ void GriffonEngine::saveLoadNew() {
_shouldQuit = true;
return;
}
- }
+ }
if (lowerLock && tickpause < _ticks) {
if ((curCol == 1) && saveState(curRow - 1)) {
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index b921e74..42659ff 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -117,12 +117,13 @@ Common::Error GriffonEngine::run() {
if (_shouldQuit)
return Common::kNoError;
- title(0);
+ while (!_shouldQuit) {
+ title(0);
- if (_shouldQuit)
- return Common::kNoError;
+ if (!_shouldQuit)
- saveLoadNew();
+ saveLoadNew();
+ }
return Common::kNoError;
}
Commit: 7b2e103ea3fad04d3719a3fd78c9a645582bb50d
https://github.com/scummvm/scummvm/commit/7b2e103ea3fad04d3719a3fd78c9a645582bb50d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: FIx config window drawing
Changed paths:
engines/griffon/dialogs.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 09aae2c..cc01787 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -282,7 +282,7 @@ void GriffonEngine::configMenu() {
_cloudImg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
_cloudImg->setAlpha(64, true);
- _videoBuffer->copyRectToSurface(configwindow->getPixels(), configwindow->pitch, 0, 0, configwindow->w, configwindow->h);
+ configwindow->blit(*_videoBuffer);
int sy = SY;
Commit: 651e7ef9f0f7c49064b886095f31977f141f21e6
https://github.com/scummvm/scummvm/commit/651e7ef9f0f7c49064b886095f31977f141f21e6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fixed sluggishness of the main menu and config menu
Changed paths:
engines/griffon/dialogs.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index cc01787..6f02a31 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -64,7 +64,6 @@ void GriffonEngine::title(int mode) {
_videoBuffer->blit(*_videoBuffer2);
int cursel = 0;
- int keypause = _ticks + 220;
int ticks1 = _ticks;
if (config.music) {
@@ -159,56 +158,50 @@ void GriffonEngine::title(int mode) {
while (_itemyloc >= 16)
_itemyloc = _itemyloc - 16;
- g_system->getEventManager()->pollEvent(_event);
-
- if (_event.type == Common::EVENT_QUIT)
- _shouldQuit = true;
+ if (g_system->getEventManager()->pollEvent(_event)) {
+ if (_event.type == Common::EVENT_QUIT)
+ _shouldQuit = true;
- if (keypause < _ticks) {
if (_event.type == Common::EVENT_KEYDOWN) {
- keypause = _ticks + 150;
+ switch(_event.kbd.keycode) {
+ case Common::KEYCODE_ESCAPE:
+ if (mode == 1)
+ exitTitle = true;
+ break;
+ case Common::KEYCODE_UP:
+ cursel--;
+ if (cursel < 0)
+ cursel = (mode == 1 ? 3 : 2);
+ break;
+ case Common::KEYCODE_DOWN:
+ cursel++;
+ if (cursel >= (mode == 1 ? 4 : 3))
+ cursel = 0;
+ break;
+ case Common::KEYCODE_RETURN:
+ switch(cursel) {
+ case 0:
+ _ticks = g_system->getMillis();
+ ticks1 = _ticks;
- switch(_event.kbd.keycode){
- case Common::KEYCODE_ESCAPE:
- if (mode == 1)
- exitTitle = true;
+ exitTitle = true;
break;
- case Common::KEYCODE_UP:
- cursel--;
- if (cursel < 0)
- cursel = (mode == 1 ? 3 : 2);
+ case 1:
+ configMenu();
+ _ticks = g_system->getMillis();
+ ticks1 = _ticks;
break;
- case Common::KEYCODE_DOWN:
- cursel++;
- if (cursel >= (mode == 1 ? 4 : 3))
- cursel = 0;
- break;
- case Common::KEYCODE_RETURN:
- switch(cursel) {
- case 0:
- _ticks = g_system->getMillis();
- keypause = _ticks + 150;
- ticks1 = _ticks;
-
- exitTitle = true;
- break;
- case 1:
- configMenu();
- _ticks = g_system->getMillis();
- keypause = _ticks + 150;
- ticks1 = _ticks;
- break;
- case 2:
- _shouldQuit = true;
- break;
- case 3:
- exitTitle = true;
- default:
- break;
- }
+ case 2:
+ _shouldQuit = true;
break;
+ case 3:
+ exitTitle = true;
default:
break;
+ }
+ break;
+ default:
+ break;
}
}
}
@@ -251,10 +244,7 @@ void GriffonEngine::configMenu() {
int cursel = MINCURSEL;
bool exitMenu = false;
- int tickwait = 1000 / 60;
-
_ticks = g_system->getMillis();
- int keypause = _ticks + tickwait;
Graphics::TransparentSurface *configwindow = loadImage("art/configwindow.bmp", true);
configwindow->setAlpha(160, true);
@@ -338,9 +328,6 @@ void GriffonEngine::configMenu() {
_videoBuffer->setAlpha((int)yy);
g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
- g_system->updateScreen();
-
- g_system->getEventManager()->pollEvent(_event);
_ticksPassed = _ticks;
_ticks = g_system->getMillis();
@@ -359,15 +346,11 @@ void GriffonEngine::configMenu() {
while (_itemyloc >= 16)
_itemyloc -= 16;
- if (keypause < _ticks) {
- g_system->getEventManager()->pollEvent(_event);
-
+ while (g_system->getEventManager()->pollEvent(_event)) {
if (_event.type == Common::EVENT_QUIT)
_shouldQuit = true;
if (_event.type == Common::EVENT_KEYDOWN) {
- keypause = _ticks + tickwait;
-
if (_event.kbd.keycode == Common::KEYCODE_ESCAPE)
break;
@@ -461,6 +444,7 @@ void GriffonEngine::configMenu() {
while (_cloudAngle >= 360)
_cloudAngle -= 360;
+ g_system->updateScreen();
g_system->delayMillis(10);
} while (!_shouldQuit && !exitMenu);
Commit: 98216d97388e2504003ac7ada783ca5918d60bb1
https://github.com/scummvm/scummvm/commit/98216d97388e2504003ac7ada783ca5918d60bb1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fixed rendering of config menu
Changed paths:
engines/griffon/dialogs.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 6f02a31..25aada0 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -251,6 +251,8 @@ void GriffonEngine::configMenu() {
int ticks1 = _ticks;
+ _cloudImg->setAlpha(128, true);
+
do {
_videoBuffer->fillRect(Common::Rect(0, 0, _videoBuffer->w, _videoBuffer->h), 0);
@@ -259,18 +261,14 @@ void GriffonEngine::configMenu() {
rcDest.setWidth(320);
rcDest.setHeight(240);
- _cloudImg->setAlpha(128, true);
_cloudImg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
- _cloudImg->setAlpha(64, true);
rcDest.left = 256;
rcDest.top = 192;
rcDest.setWidth(320);
rcDest.setHeight(240);
- _cloudImg->setAlpha(128, true);
_cloudImg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
- _cloudImg->setAlpha(64, true);
configwindow->blit(*_videoBuffer);
@@ -327,7 +325,8 @@ void GriffonEngine::configMenu() {
}
_videoBuffer->setAlpha((int)yy);
- g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
+ _videoBuffer->blit(*_videoBuffer2);
+ g_system->copyRectToScreen(_videoBuffer2->getPixels(), _videoBuffer2->pitch, 0, 0, _videoBuffer2->w, _videoBuffer2->h);
_ticksPassed = _ticks;
_ticks = g_system->getMillis();
@@ -450,8 +449,6 @@ void GriffonEngine::configMenu() {
configwindow->free();
_itemTicks = _ticks + 210;
-
- _cloudImg->setAlpha(64, true);
}
void GriffonEngine::saveLoadNew() {
Commit: 623686382decfe03bf742f2797d6dbc441a6b019
https://github.com/scummvm/scummvm/commit/623686382decfe03bf742f2797d6dbc441a6b019
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fixed config menu fade-in
Changed paths:
engines/griffon/dialogs.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 25aada0..f7d6b14 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -255,6 +255,7 @@ void GriffonEngine::configMenu() {
do {
_videoBuffer->fillRect(Common::Rect(0, 0, _videoBuffer->w, _videoBuffer->h), 0);
+ _videoBuffer2->fillRect(Common::Rect(0, 0, _videoBuffer2->w, _videoBuffer2->h), 0);
rcDest.left = 256 + 256 * cos(PI / 180 * _cloudAngle * 40);
rcDest.top = 192 + 192 * sin(PI / 180 * _cloudAngle * 40);
@@ -322,9 +323,10 @@ void GriffonEngine::configMenu() {
if (_ticks < ticks1 + 1000) {
yy = 255.0 * ((float)(_ticks - ticks1) / 1000.0);
yy = CLIP<float>(yy, 0.0, 255.0);
+
+ _videoBuffer->setAlpha((int)yy);
}
- _videoBuffer->setAlpha((int)yy);
_videoBuffer->blit(*_videoBuffer2);
g_system->copyRectToScreen(_videoBuffer2->getPixels(), _videoBuffer2->pitch, 0, 0, _videoBuffer2->w, _videoBuffer2->h);
Commit: ce0f0f62e9ce7756b55f40254cad7d525580dd8a
https://github.com/scummvm/scummvm/commit/ce0f0f62e9ce7756b55f40254cad7d525580dd8a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Optimized transparent blitting
Changed paths:
engines/griffon/dialogs.cpp
engines/griffon/resources.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index f7d6b14..0e3e67b 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -449,6 +449,8 @@ void GriffonEngine::configMenu() {
g_system->delayMillis(10);
} while (!_shouldQuit && !exitMenu);
+ _cloudImg->setAlpha(64, true);
+
configwindow->free();
_itemTicks = _ticks + 210;
}
@@ -458,9 +460,6 @@ void GriffonEngine::saveLoadNew() {
_cloudAngle = 0;
- _videoBuffer->setAlpha(255);
- _saveLoadImg->setAlpha(192, true);
-
int curRow = 0;
int curCol = 0;
bool lowerLock = false;
@@ -469,6 +468,8 @@ void GriffonEngine::saveLoadNew() {
int ticks1 = _ticks;
int tickpause = _ticks + 150;
+ _cloudImg->setAlpha(128, true);
+
do {
_videoBuffer->fillRect(Common::Rect(0, 0, _videoBuffer->w, _videoBuffer->h), 0);
@@ -479,18 +480,14 @@ void GriffonEngine::saveLoadNew() {
rcDest.setWidth(320);
rcDest.setHeight(240);
- _cloudImg->setAlpha(128, true);
_cloudImg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
- _cloudImg->setAlpha(64, true);
rcDest.left = 256;
rcDest.top = 192;
rcDest.setWidth(320);
rcDest.setHeight(240);
- _cloudImg->setAlpha(128, true);
_cloudImg->blit(*_videoBuffer, 0, 0, Graphics::FLIP_NONE, &rcDest);
- _cloudImg->setAlpha(64, true);
_saveLoadImg->blit(*_videoBuffer);
@@ -729,9 +726,10 @@ void GriffonEngine::saveLoadNew() {
if (_ticks < ticks1 + 1000) {
yy = 255 * (_ticks - ticks1) / 1000;
yy = CLIP(yy, 0, 255);
+
+ _videoBuffer->setAlpha((int)yy);
}
- _videoBuffer->setAlpha((int)yy);
g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(_event);
diff --git a/engines/griffon/resources.cpp b/engines/griffon/resources.cpp
index e0da5c1..5ff8aa6 100644
--- a/engines/griffon/resources.cpp
+++ b/engines/griffon/resources.cpp
@@ -80,11 +80,10 @@ void GriffonEngine::initialize() {
}
_cloudImg = loadImage("art/clouds.bmp", true);
- _cloudImg->setAlpha(96, true);
-
+ _cloudImg->setAlpha(64, true);
_saveLoadImg = loadImage("art/saveloadnew.bmp", true);
- _saveLoadImg->setAlpha(160, true);
+ _saveLoadImg->setAlpha(192, true);
_titleImg = loadImage("art/titleb.bmp");
_titleImg2 = loadImage("art/titlea.bmp", true);
Commit: 16386016efa08fa77fbcd40d29184eb23f61b1b0
https://github.com/scummvm/scummvm/commit/16386016efa08fa77fbcd40d29184eb23f61b1b0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: More alpha blitting optimizations
Changed paths:
engines/griffon/draw.cpp
engines/griffon/logic.cpp
diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp
index 3fd968f..ed58783 100644
--- a/engines/griffon/draw.cpp
+++ b/engines/griffon/draw.cpp
@@ -229,8 +229,6 @@ void GriffonEngine::drawHud() {
rcDest.top = iy;
_spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
-
- _spellImg->setAlpha(255, true);
}
}
}
@@ -590,7 +588,6 @@ void GriffonEngine::drawNPCs(int mode) {
x = 255;
_spellImg->setAlpha(x, true);
_spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- _spellImg->setAlpha(255, true);
for (int f = 1; f <= 8; f++) {
rcSrc.left = 16 * (int)(RND() * 2);
@@ -606,7 +603,6 @@ void GriffonEngine::drawNPCs(int mode) {
x = 255;
_spellImg->setAlpha(x, true);
_spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- _spellImg->setAlpha(255, true);
}
rcSrc.left = 0;
@@ -619,7 +615,6 @@ void GriffonEngine::drawNPCs(int mode) {
_spellImg->setAlpha(192, true);
_anims[5]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- _spellImg->setAlpha(255, true);
}
}
@@ -864,8 +859,6 @@ void GriffonEngine::drawNPCs(int mode) {
}
}
- _spellImg->setAlpha(255, true);
-
if (!_npcInfo[i].attacking) {
int cframe = (int)(frame);
rcSrc.left = 0;
diff --git a/engines/griffon/logic.cpp b/engines/griffon/logic.cpp
index d41b352..063c5be 100644
--- a/engines/griffon/logic.cpp
+++ b/engines/griffon/logic.cpp
@@ -1307,7 +1307,6 @@ void GriffonEngine::updateSpells() {
if (xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
_spellImg->setAlpha(alf, true);
_spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- _spellImg->setAlpha(255, true);
if (_spellInfo[i].damagewho == 0) {
for (int e = 1; e <= _lastNpc; e++) {
@@ -1382,6 +1381,7 @@ void GriffonEngine::updateSpells() {
rcDest.left = xloc;
rcDest.top = yloc;
+ _spellImg->setAlpha(255, true);
_spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
_spellInfo[i].frame = _spellInfo[i].frame - 0.2 * _fpsr;
@@ -1504,6 +1504,7 @@ void GriffonEngine::updateSpells() {
rcDest.top = yloc;
if (xloc > -16 && xloc < 304 && yloc > -16 && yloc < 224) {
+ _spellImg->setAlpha(255, true);
_spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
if (scatter) {
@@ -1585,7 +1586,6 @@ void GriffonEngine::updateSpells() {
_spellImg->setAlpha(f, true);
_spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- _spellImg->setAlpha(255, true);
_spellInfo[i].frame = _spellInfo[i].frame - 0.3 * _fpsr;
if (_spellInfo[i].frame < 0) {
@@ -1684,8 +1684,6 @@ void GriffonEngine::updateSpells() {
_spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
}
-
- _spellImg->setAlpha(255, true);
} else {
_spellImg->setAlpha(192, true);
@@ -1723,8 +1721,6 @@ void GriffonEngine::updateSpells() {
if (xloc < -1 || yloc < -1 || xloc > 304 || yloc > 224)
_spellInfo[i].ballon[ff] = 0;
}
-
- _spellImg->setAlpha(255, true);
}
_spellInfo[i].frame = _spellInfo[i].frame - 0.2 * _fpsr;
@@ -2098,7 +2094,6 @@ void GriffonEngine::updateSpellsUnder() {
_spellImg->setAlpha(f, true);
_spellImg->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- _spellImg->setAlpha(255, true);
_spellInfo[i].frame = _spellInfo[i].frame - 0.2 * _fpsr;
if (_spellInfo[i].frame < 0)
@@ -2283,8 +2278,6 @@ void GriffonEngine::updateSpellsUnder() {
}
}
- _spellImg->setAlpha(255, true);
-
_spellInfo[i].frame = _spellInfo[i].frame - 0.2 * _fpsr;
if (_spellInfo[i].frame < 0)
_spellInfo[i].frame = 0;
@@ -2349,7 +2342,6 @@ void GriffonEngine::updateSpellsUnder() {
}
- _spellImg->setAlpha(255, true);
_spellInfo[i].frame = _spellInfo[i].frame - 0.5 * _fpsr;
if (_spellInfo[i].frame < 0)
_spellInfo[i].frame = 0;
Commit: 4d97f9c65426185f362ebdb0918fd857548c46f8
https://github.com/scummvm/scummvm/commit/4d97f9c65426185f362ebdb0918fd857548c46f8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Optimized even handling in cutscenes
Changed paths:
engines/griffon/cutscenes.cpp
diff --git a/engines/griffon/cutscenes.cpp b/engines/griffon/cutscenes.cpp
index 8e67eb6..1be0433 100644
--- a/engines/griffon/cutscenes.cpp
+++ b/engines/griffon/cutscenes.cpp
@@ -143,10 +143,10 @@ void GriffonEngine::showLogos() {
g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
g_system->updateScreen();
- g_system->getEventManager()->pollEvent(_event);
-
- if (_event.type == Common::EVENT_QUIT)
- _shouldQuit = true;
+ if (g_system->getEventManager()->pollEvent(_event)) {
+ if (_event.type == Common::EVENT_QUIT)
+ _shouldQuit = true;
+ }
_ticksPassed = _ticks;
_ticks = g_system->getMillis();
@@ -253,15 +253,16 @@ void GriffonEngine::intro() {
if (xofs >= 320)
xofs -= 320;
- g_system->getEventManager()->pollEvent(_event);
+ if (g_system->getEventManager()->pollEvent(_event)) {
- if (_event.type == Common::EVENT_KEYDOWN)
- cnt = 6;
- if (_event.kbd.keycode == Common::KEYCODE_ESCAPE)
- return;
+ if (_event.type == Common::EVENT_KEYDOWN)
+ cnt = 6;
+ if (_event.kbd.keycode == Common::KEYCODE_ESCAPE)
+ return;
- if (_event.type == Common::EVENT_QUIT)
- _shouldQuit = true;
+ if (_event.type == Common::EVENT_QUIT)
+ _shouldQuit = true;
+ }
g_system->delayMillis(10);
} while (!_shouldQuit);
@@ -369,10 +370,6 @@ void GriffonEngine::endOfGame() {
_videoBuffer->setAlpha(ya);
g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
- g_system->updateScreen();
-
- g_system->getEventManager()->pollEvent(_event);
- g_system->delayMillis(10);
_ticksPassed = _ticks;
_ticks = g_system->getMillis();
@@ -394,13 +391,18 @@ void GriffonEngine::endOfGame() {
if (xofs >= 320)
xofs -= 320;
- if (_event.type == Common::EVENT_KEYDOWN)
- spd = 1.0f;
- if (_event.type == Common::EVENT_KEYUP)
- spd = 0.2f;
+ if (g_system->getEventManager()->pollEvent(_event)) {
+ if (_event.type == Common::EVENT_KEYDOWN)
+ spd = 1.0f;
+ if (_event.type == Common::EVENT_KEYUP)
+ spd = 0.2f;
- if (_event.kbd.keycode == Common::KEYCODE_ESCAPE)
- break;
+ if (_event.kbd.keycode == Common::KEYCODE_ESCAPE)
+ break;
+ }
+
+ g_system->updateScreen();
+ g_system->delayMillis(10);
} while (1);
@@ -477,10 +479,10 @@ void GriffonEngine::endOfGame() {
_fp = 0;
}
- g_system->getEventManager()->pollEvent(_event);
-
- if (_event.type == Common::EVENT_KEYDOWN && keywait < _ticks)
- break;
+ if (g_system->getEventManager()->pollEvent(_event)) {
+ if (_event.type == Common::EVENT_KEYDOWN && keywait < _ticks)
+ break;
+ }
} while (1);
@@ -488,7 +490,6 @@ void GriffonEngine::endOfGame() {
_videoBuffer3->fillRect(Common::Rect(0, 0, _videoBuffer3->w, _videoBuffer3->h), 0);
theEnd();
-
}
void GriffonEngine::theEnd() {
Commit: f6da6210081d2f272c37fb1bda13931345f27967
https://github.com/scummvm/scummvm/commit/f6da6210081d2f272c37fb1bda13931345f27967
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Removed recursiveness on end game
Changed paths:
engines/griffon/combat.cpp
engines/griffon/cutscenes.cpp
engines/griffon/dialogs.cpp
engines/griffon/engine.cpp
engines/griffon/griffon.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp
index f140674..59814ef 100644
--- a/engines/griffon/combat.cpp
+++ b/engines/griffon/combat.cpp
@@ -612,7 +612,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
}
}
- if (_npcInfo[npcnum].spriteset == kMonsterOneWing || _npcInfo[npcnum].spriteset == kMonsterTwoWing ||
+ if (_npcInfo[npcnum].spriteset == kMonsterOneWing || _npcInfo[npcnum].spriteset == kMonsterTwoWing ||
_npcInfo[npcnum].spriteset == kMonsterBlackKnight || _npcInfo[npcnum].spriteset == kMonsterFireHydra) {
int ff = (int)(RND() * _player.level);
if (ff == 0) {
@@ -1001,7 +1001,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
}
if (_npcInfo[npcnum].script == kScriptEndOfGame)
- endOfGame();
+ _gameEnd = true;
}
}
diff --git a/engines/griffon/cutscenes.cpp b/engines/griffon/cutscenes.cpp
index 1be0433..f615db4 100644
--- a/engines/griffon/cutscenes.cpp
+++ b/engines/griffon/cutscenes.cpp
@@ -520,8 +520,6 @@ void GriffonEngine::theEnd() {
_fp = 0;
}
}
-
- title(0);
}
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 0e3e67b..21d54a0 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -507,6 +507,9 @@ void GriffonEngine::saveLoadNew() {
if (curCol == 0) {
// NEW GAME
newGame();
+
+ if (_shouldQuit || _gameEnd)
+ return;
} else if (curCol == 1) {
// LOAD GAME
lowerLock = true;
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index f7e89bb..c90b9a0 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -75,7 +75,7 @@ void GriffonEngine::mainLoop() {
_console->onFrame();
updateEngine();
- } while (!_shouldQuit);
+ } while (!_shouldQuit && !_gameEnd);
}
void GriffonEngine::updateEngine() {
@@ -131,6 +131,9 @@ void GriffonEngine::updateEngine() {
_player.opy = _player.py;
checkHit();
+
+ if (_gameEnd)
+ return;
}
for (int i = 0; i < kMaxFloat; i++) {
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index 42659ff..0263f89 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -46,6 +46,7 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
_mixer = nullptr;
_shouldQuit = false;
+ _gameEnd = false;
_musicChannel = -1;
_menuChannel = -1;
@@ -118,11 +119,15 @@ Common::Error GriffonEngine::run() {
return Common::kNoError;
while (!_shouldQuit) {
+ _gameEnd = false;
+
title(0);
- if (!_shouldQuit)
+ if (!_shouldQuit && !_gameEnd)
+ saveLoadNew();
- saveLoadNew();
+ if (_gameEnd)
+ endOfGame();
}
return Common::kNoError;
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index e7b9c82..c6abe7f 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -329,6 +329,7 @@ public:
private:
Common::RandomSource *_rnd;
bool _shouldQuit;
+ bool _gameEnd;
Console *_console;
Commit: 7b05a02a97b4614b0f8eac9ff056dc9cb1045f86
https://github.com/scummvm/scummvm/commit/7b05a02a97b4614b0f8eac9ff056dc9cb1045f86
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fixed music stopping
Changed paths:
engines/griffon/sound.cpp
diff --git a/engines/griffon/sound.cpp b/engines/griffon/sound.cpp
index e3f2230..a8c6c04 100644
--- a/engines/griffon/sound.cpp
+++ b/engines/griffon/sound.cpp
@@ -85,7 +85,12 @@ void GriffonEngine::pauseSoundChannel(int channel) {
}
void GriffonEngine::haltSoundChannel(int channel) {
- _mixer->stopHandle(_handles[channel]);
+ if (channel == -1) {
+ for (int i = 0; i < kSoundHandles; i++)
+ _mixer->stopHandle(_handles[i]);
+ } else {
+ _mixer->stopHandle(_handles[channel]);
+ }
}
void GriffonEngine::resumeSoundChannel(int channel) {
Commit: 6409c3804eedf44ca5b6109d9e728c853b148fe4
https://github.com/scummvm/scummvm/commit/6409c3804eedf44ca5b6109d9e728c853b148fe4
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Implement quitting from the endgame
Changed paths:
engines/griffon/cutscenes.cpp
diff --git a/engines/griffon/cutscenes.cpp b/engines/griffon/cutscenes.cpp
index f615db4..b96e469 100644
--- a/engines/griffon/cutscenes.cpp
+++ b/engines/griffon/cutscenes.cpp
@@ -283,9 +283,7 @@ void GriffonEngine::endOfGame() {
int ticks1 = _ticks;
int ya = 0;
- _videoBuffer2->fillRect(Common::Rect(0, 0, _videoBuffer2->w, _videoBuffer2->h), 0);
- _videoBuffer3->fillRect(Common::Rect(0, 0, _videoBuffer3->w, _videoBuffer3->h), 0);
- _videoBuffer2->copyRectToSurface(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
+ _videoBuffer->copyRectToSurface(_videoBuffer2->getPixels(), _videoBuffer2->pitch, 0, 0, _videoBuffer2->w, _videoBuffer2->h);
float ld = 0;
bool ldstop = false; // CHECKME: Check if actually used
@@ -308,15 +306,19 @@ void GriffonEngine::endOfGame() {
break;
_videoBuffer->fillRect(Common::Rect(0, 0, _videoBuffer->w, _videoBuffer->h), 0);
+ _videoBuffer2->setAlpha(ya);
+ _videoBuffer2->blit(*_videoBuffer);
- _videoBuffer->setAlpha(ya);
- _videoBuffer3->copyRectToSurface(_videoBuffer2->getPixels(), _videoBuffer2->pitch, 0, 0, _videoBuffer2->w, _videoBuffer2->h);
- _videoBuffer3->copyRectToSurface(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
+ g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
- g_system->copyRectToScreen(_videoBuffer3->getPixels(), _videoBuffer3->pitch, 0, 0, _videoBuffer3->w, _videoBuffer3->h);
- g_system->updateScreen();
+ if (g_system->getEventManager()->pollEvent(_event)) {
+ if (_event.type == Common::EVENT_QUIT) {
+ _shouldQuit = true;
+ return;
+ }
+ }
- g_system->getEventManager()->pollEvent(_event);
+ g_system->updateScreen();
g_system->delayMillis(10);
_ticksPassed = _ticks;
@@ -399,6 +401,11 @@ void GriffonEngine::endOfGame() {
if (_event.kbd.keycode == Common::KEYCODE_ESCAPE)
break;
+
+ if (_event.type == Common::EVENT_QUIT) {
+ _shouldQuit = true;
+ return;
+ }
}
g_system->updateScreen();
@@ -427,7 +434,13 @@ void GriffonEngine::endOfGame() {
g_system->copyRectToScreen(_videoBuffer3->getPixels(), _videoBuffer3->pitch, 0, 0, _videoBuffer3->w, _videoBuffer3->h);
g_system->updateScreen();
- g_system->getEventManager()->pollEvent(_event);
+ if (g_system->getEventManager()->pollEvent(_event)) {
+ if (_event.type == Common::EVENT_QUIT) {
+ _shouldQuit = true;
+ return;
+ }
+ }
+
g_system->delayMillis(10);
_ticksPassed = _ticks;
@@ -480,6 +493,11 @@ void GriffonEngine::endOfGame() {
}
if (g_system->getEventManager()->pollEvent(_event)) {
+ if (_event.type == Common::EVENT_QUIT) {
+ _shouldQuit = true;
+ return;
+ }
+
if (_event.type == Common::EVENT_KEYDOWN && keywait < _ticks)
break;
}
@@ -504,7 +522,13 @@ void GriffonEngine::theEnd() {
g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
g_system->updateScreen();
- g_system->getEventManager()->pollEvent(_event);
+ if (g_system->getEventManager()->pollEvent(_event)) {
+ if (_event.type == Common::EVENT_QUIT) {
+ _shouldQuit = true;
+ return;
+ }
+ }
+
g_system->delayMillis(10);
_ticksPassed = _ticks;
Commit: dfadc426b74f23d49654b969e7408978aa0d3786
https://github.com/scummvm/scummvm/commit/dfadc426b74f23d49654b969e7408978aa0d3786
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Made theEnd() work properly
Changed paths:
engines/griffon/combat.cpp
engines/griffon/engine.cpp
engines/griffon/griffon.cpp
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp
index 59814ef..2daafd2 100644
--- a/engines/griffon/combat.cpp
+++ b/engines/griffon/combat.cpp
@@ -1000,8 +1000,10 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
}
}
- if (_npcInfo[npcnum].script == kScriptEndOfGame)
+ if (_npcInfo[npcnum].script == kScriptEndOfGame) {
+ endOfGame();
_gameEnd = true;
+ }
}
}
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index c90b9a0..291076cd 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -212,9 +212,14 @@ void GriffonEngine::updateEngine() {
while (_itemyloc >= 16)
_itemyloc -= 16;
- if (_player.hp <= 0)
+ if (_player.hp <= 0) {
theEnd();
+ _gameEnd = true;
+
+ return;
+ }
+
if (_roomLock) {
_roomLock = false;
for (int i = 1; i <= _lastNpc; i++)
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index 0263f89..dd95969 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -125,9 +125,6 @@ Common::Error GriffonEngine::run() {
if (!_shouldQuit && !_gameEnd)
saveLoadNew();
-
- if (_gameEnd)
- endOfGame();
}
return Common::kNoError;
Commit: dadd6e4cf0f3a70fbd1740b48cf8cac35464bbd5
https://github.com/scummvm/scummvm/commit/dadd6e4cf0f3a70fbd1740b48cf8cac35464bbd5
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fixed endgame fadeouts
Changed paths:
engines/griffon/cutscenes.cpp
diff --git a/engines/griffon/cutscenes.cpp b/engines/griffon/cutscenes.cpp
index b96e469..e98b265 100644
--- a/engines/griffon/cutscenes.cpp
+++ b/engines/griffon/cutscenes.cpp
@@ -283,8 +283,6 @@ void GriffonEngine::endOfGame() {
int ticks1 = _ticks;
int ya = 0;
- _videoBuffer->copyRectToSurface(_videoBuffer2->getPixels(), _videoBuffer2->pitch, 0, 0, _videoBuffer2->w, _videoBuffer2->h);
-
float ld = 0;
bool ldstop = false; // CHECKME: Check if actually used
@@ -305,11 +303,11 @@ void GriffonEngine::endOfGame() {
} else
break;
- _videoBuffer->fillRect(Common::Rect(0, 0, _videoBuffer->w, _videoBuffer->h), 0);
- _videoBuffer2->setAlpha(ya);
- _videoBuffer2->blit(*_videoBuffer);
+ _videoBuffer2->fillRect(Common::Rect(0, 0, _videoBuffer2->w, _videoBuffer2->h), 0);
+ _videoBuffer->setAlpha(255 - ya);
+ _videoBuffer->blit(*_videoBuffer2);
- g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
+ g_system->copyRectToScreen(_videoBuffer2->getPixels(), _videoBuffer2->pitch, 0, 0, _videoBuffer2->w, _videoBuffer2->h);
if (g_system->getEventManager()->pollEvent(_event)) {
if (_event.type == Common::EVENT_QUIT) {
@@ -517,9 +515,11 @@ void GriffonEngine::theEnd() {
}
for (float y = 0; y < 100; y += _fpsr) {
- _videoBuffer->setAlpha((int)y);
- _videoBuffer->fillRect(Common::Rect(0, 0, _videoBuffer->w, _videoBuffer->h), 0);
- g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
+ _videoBuffer2->fillRect(Common::Rect(0, 0, _videoBuffer2->w, _videoBuffer2->h), 0);
+ _videoBuffer->setAlpha((int)((100.0 - y) / 100 * 255));
+ _videoBuffer->blit(*_videoBuffer2);
+
+ g_system->copyRectToScreen(_videoBuffer2->getPixels(), _videoBuffer2->pitch, 0, 0, _videoBuffer2->w, _videoBuffer2->h);
g_system->updateScreen();
if (g_system->getEventManager()->pollEvent(_event)) {
Commit: 04cc6a15189ef79e5fc210d3d0b985ad55f584dd
https://github.com/scummvm/scummvm/commit/04cc6a15189ef79e5fc210d3d0b985ad55f584dd
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix TheEnd screen fadeout
Changed paths:
engines/griffon/cutscenes.cpp
diff --git a/engines/griffon/cutscenes.cpp b/engines/griffon/cutscenes.cpp
index e98b265..58c7c6e 100644
--- a/engines/griffon/cutscenes.cpp
+++ b/engines/griffon/cutscenes.cpp
@@ -471,10 +471,13 @@ void GriffonEngine::endOfGame() {
}
_videoBuffer->setAlpha(y1);
- g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
- g_system->updateScreen();
- g_system->getEventManager()->pollEvent(_event);
+ _videoBuffer2->fillRect(Common::Rect(0, 0, _videoBuffer2->w, _videoBuffer2->h), 0);
+ _videoBuffer->blit(*_videoBuffer2);
+
+ g_system->copyRectToScreen(_videoBuffer2->getPixels(), _videoBuffer2->pitch, 0, 0, _videoBuffer2->w, _videoBuffer2->h);
+
+ g_system->updateScreen();
g_system->delayMillis(10);
_ticksPassed = _ticks;
Commit: fc1e3f62be27e03c526288f78c094afebc37c25c
https://github.com/scummvm/scummvm/commit/fc1e3f62be27e03c526288f78c094afebc37c25c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Load savestate info only once
Changed paths:
engines/griffon/dialogs.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 21d54a0..93f8b87 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -470,6 +470,77 @@ void GriffonEngine::saveLoadNew() {
_cloudImg->setAlpha(128, true);
+ // savestates---------------------------------
+ _videoBuffer2->fillRect(Common::Rect(0, 0, _videoBuffer2->w, _videoBuffer2->h), 0);
+
+ for (int ff = 0; ff <= 3; ff++) {
+ loadPlayer(ff);
+
+ if (_playera.level > 0) {
+ int sx = 8;
+ int sy = 57 + ff * 48;
+
+ // time
+ int ase = _asecstart;
+ int h = ((ase - (ase % 3600)) / 3600);
+ ase = (ase - h * 3600);
+ int m = ((ase - (ase % 60)) / 60);
+ int s = (ase - m * 60);
+
+ char line[256];
+ sprintf(line, "Game Time: %02i:%02i:%02i", h, m, s);
+ drawString(_videoBuffer2, line, 160 - strlen(line) * 4, sy, 0);
+
+ sx = 12;
+ sy += 11;
+ int cc = 0;
+
+ sprintf(line, "Health: %i/%i", _playera.hp, _playera.maxHp);
+ drawString(_videoBuffer2, line, sx, sy, cc);
+
+ if (_playera.level == 22)
+ strcpy(line, "Level: MAX");
+ else
+ sprintf(line, "Level: %i", _playera.level);
+
+ drawString(_videoBuffer2, line, sx, sy + 11, 0);
+
+ rcSrc.left = sx + 15 * 8 + 24;
+ rcSrc.top = sy + 1;
+
+ int ss = (_playera.sword - 1) * 3;
+ if (_playera.sword == 3)
+ ss = 18;
+ _itemImg[ss]->blit(*_videoBuffer2, rcSrc.left, rcSrc.top);
+
+ rcSrc.left += 16;
+ ss = (_playera.shield - 1) * 3 + 1;
+ if (_playera.shield == 3)
+ ss = 19;
+ _itemImg[ss]->blit(*_videoBuffer2, rcSrc.left, rcSrc.top);
+
+ rcSrc.left += 16;
+ ss = (_playera.armour - 1) * 3 + 2;
+ if (_playera.armour == 3)
+ ss = 20;
+ _itemImg[ss]->blit(*_videoBuffer2, rcSrc.left, rcSrc.top);
+
+ int nx = rcSrc.left + 13 + 3 * 8;
+ rcSrc.left = nx - 17;
+
+ if (_playera.foundSpell[0]) {
+ for (int i = 0; i < 5; i++) {
+ rcSrc.left += 17;
+ if (_playera.foundSpell[i])
+ _itemImg[7 + i]->blit(*_videoBuffer2, rcSrc.left, rcSrc.top);
+ }
+ }
+ } else {
+ int sy = 57 + ff * 48;
+ drawString(_videoBuffer2, "Empty", 160 - 5 * 4, sy, 0);
+ }
+ }
+
do {
_videoBuffer->fillRect(Common::Rect(0, 0, _videoBuffer->w, _videoBuffer->h), 0);
@@ -609,80 +680,11 @@ void GriffonEngine::saveLoadNew() {
}
}
+ // Render savestates
+ _videoBuffer2->blit(*_videoBuffer);
- // savestates---------------------------------
- // read it only when needed!
-
- for (int ff = 0; ff <= 3; ff++) {
- loadPlayer(ff);
-
- if (_playera.level > 0) {
- int sx = 8;
- int sy = 57 + ff * 48;
-
- // time
- int ase = _asecstart;
- int h = ((ase - (ase % 3600)) / 3600);
- ase = (ase - h * 3600);
- int m = ((ase - (ase % 60)) / 60);
- int s = (ase - m * 60);
-
- char line[256];
- sprintf(line, "Game Time: %02i:%02i:%02i", h, m, s);
- drawString(_videoBuffer, line, 160 - strlen(line) * 4, sy, 0);
-
- sx = 12;
- sy += 11;
- int cc = 0;
-
- sprintf(line, "Health: %i/%i", _playera.hp, _playera.maxHp);
- drawString(_videoBuffer, line, sx, sy, cc);
-
- if (_playera.level == 22)
- strcpy(line, "Level: MAX");
- else
- sprintf(line, "Level: %i", _playera.level);
-
- drawString(_videoBuffer, line, sx, sy + 11, 0);
-
- rcSrc.left = sx + 15 * 8 + 24;
- rcSrc.top = sy + 1;
-
- int ss = (_playera.sword - 1) * 3;
- if (_playera.sword == 3)
- ss = 18;
- _itemImg[ss]->blit(*_videoBuffer, rcSrc.left, rcSrc.top);
-
- rcSrc.left += 16;
- ss = (_playera.shield - 1) * 3 + 1;
- if (_playera.shield == 3)
- ss = 19;
- _itemImg[ss]->blit(*_videoBuffer, rcSrc.left, rcSrc.top);
-
- rcSrc.left += 16;
- ss = (_playera.armour - 1) * 3 + 2;
- if (_playera.armour == 3)
- ss = 20;
- _itemImg[ss]->blit(*_videoBuffer, rcSrc.left, rcSrc.top);
-
- int nx = rcSrc.left + 13 + 3 * 8;
- rcSrc.left = nx - 17;
-
- if (_playera.foundSpell[0]) {
- for (int i = 0; i < 5; i++) {
- rcSrc.left += 17;
- if (_playera.foundSpell[i])
- _itemImg[7 + i]->blit(*_videoBuffer, rcSrc.left, rcSrc.top);
- }
- }
- } else {
- int sy = 57 + ff * 48;
- drawString(_videoBuffer, "Empty", 160 - 5 * 4, sy, 0);
- }
- }
// ------------------------------------------
-
if (curRow == 0) {
rcDest.top = 18;
switch(curCol) {
Commit: 57922cde6710f7419514fb9fc5c43ae8a59626b3
https://github.com/scummvm/scummvm/commit/57922cde6710f7419514fb9fc5c43ae8a59626b3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix saveload menu fadein
Changed paths:
engines/griffon/dialogs.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 93f8b87..5cc1e7f 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -735,7 +735,10 @@ void GriffonEngine::saveLoadNew() {
_videoBuffer->setAlpha((int)yy);
}
- g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
+ _videoBuffer3->fillRect(Common::Rect(0, 0, _videoBuffer3->w, _videoBuffer3->h), 0);
+ _videoBuffer->blit(*_videoBuffer3);
+
+ g_system->copyRectToScreen(_videoBuffer3->getPixels(), _videoBuffer3->pitch, 0, 0, _videoBuffer3->w, _videoBuffer3->h);
g_system->updateScreen();
g_system->getEventManager()->pollEvent(_event);
Commit: 0a21e646fd2e08cff51c189116fb3ec4c622a606
https://github.com/scummvm/scummvm/commit/0a21e646fd2e08cff51c189116fb3ec4c622a606
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix newgame menu sluggishnes and simplify code
Changed paths:
engines/griffon/dialogs.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 5cc1e7f..286bd9c 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -462,11 +462,9 @@ void GriffonEngine::saveLoadNew() {
int curRow = 0;
int curCol = 0;
- bool lowerLock = false;
_ticks = g_system->getMillis();
int ticks1 = _ticks;
- int tickpause = _ticks + 150;
_cloudImg->setAlpha(128, true);
@@ -541,6 +539,7 @@ void GriffonEngine::saveLoadNew() {
}
}
+ // Main menu loop
do {
_videoBuffer->fillRect(Common::Rect(0, 0, _videoBuffer->w, _videoBuffer->h), 0);
@@ -562,14 +561,12 @@ void GriffonEngine::saveLoadNew() {
_saveLoadImg->blit(*_videoBuffer);
- g_system->getEventManager()->pollEvent(_event);
-
- if (_event.type == Common::EVENT_QUIT) {
- _shouldQuit = true;
- return;
- }
+ if (g_system->getEventManager()->pollEvent(_event)) {
+ if (_event.type == Common::EVENT_QUIT) {
+ _shouldQuit = true;
+ return;
+ }
- if (tickpause < _ticks) {
if (_event.type == Common::EVENT_KEYDOWN) {
_itemTicks = _ticks + 220;
@@ -583,14 +580,10 @@ void GriffonEngine::saveLoadNew() {
return;
} else if (curCol == 1) {
// LOAD GAME
- lowerLock = true;
curRow = 1 + _saveSlot;
- tickpause = _ticks + 125;
} else if (curCol == 2) {
// SAVE GAME
- lowerLock = true;
curRow = 1;
- tickpause = _ticks + 125;
} else if (curCol == 3) {
// RETURN
// reset keys to avoid returning
@@ -601,13 +594,10 @@ void GriffonEngine::saveLoadNew() {
_shouldQuit = true;
return;
}
- }
-
- if (lowerLock && tickpause < _ticks) {
+ } else {
if ((curCol == 1) && saveState(curRow - 1)) {
_secStart += _secsingame;
_secsingame = 0;
- lowerLock = false;
_saveSlot = curRow - 1;
curRow = 0;
} else if ((curCol == 2) && loadState(curRow - 1)) {
@@ -627,51 +617,43 @@ void GriffonEngine::saveLoadNew() {
mainLoop();
}
}
-
- tickpause = _ticks + 125;
}
switch (_event.kbd.keycode) {
case Common::KEYCODE_ESCAPE:
- if (!lowerLock)
+ if (curRow == 0)
return;
- lowerLock = false;
curRow = 0;
- tickpause = _ticks + 125;
break;
case Common::KEYCODE_DOWN:
- if (lowerLock) {
+ if (curRow != 0) {
++curRow;
if (curRow == 5)
curRow = 1;
- tickpause = _ticks + 125;
}
break;
case Common::KEYCODE_UP:
- if (lowerLock) {
+ if (curRow != 0) {
--curRow;
if (curRow == 0)
curRow = 4;
- tickpause = _ticks + 125;
}
break;
case Common::KEYCODE_LEFT:
- if (!lowerLock) {
+ if (curRow == 0) {
--curCol;
if (curCol == -1)
curCol = 3;
- tickpause = _ticks + 125;
}
break;
case Common::KEYCODE_RIGHT:
- if (!lowerLock) {
+ if (curRow == 0) {
++curCol;
if (curCol == 4)
curCol = 0;
- tickpause = _ticks + 125;
}
break;
default:
@@ -713,8 +695,7 @@ void GriffonEngine::saveLoadNew() {
_itemImg[15]->blit(*_videoBuffer, rcDest.left, rcDest.top);
-
- if (lowerLock) {
+ if (curRow != 0) {
rcDest.top = 18;
if (curCol == 1)
rcDest.left = 108;
@@ -740,7 +721,6 @@ void GriffonEngine::saveLoadNew() {
g_system->copyRectToScreen(_videoBuffer3->getPixels(), _videoBuffer3->pitch, 0, 0, _videoBuffer3->w, _videoBuffer3->h);
g_system->updateScreen();
- g_system->getEventManager()->pollEvent(_event);
_ticksPassed = _ticks;
_ticks = g_system->getMillis();
Commit: 29b3a58f047cfc887273cf86d173d2e792eaae9d
https://github.com/scummvm/scummvm/commit/29b3a58f047cfc887273cf86d173d2e792eaae9d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Resolve todo
Changed paths:
engines/griffon/dialogs.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 286bd9c..5f26638 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -702,9 +702,6 @@ void GriffonEngine::saveLoadNew() {
else if (curCol == 2)
rcDest.left = 170;
- // CHECKME: Useless code? or temporary commented?
- // rcDest.left = rcDest.left; // + 2 + 2 * sin(-2 * PI * _itemyloc / 16)
-
_itemImg[15]->blit(*_videoBuffer, rcDest.left, rcDest.top);
}
Commit: 7d594e0fb62c406491a81969754acb374284151b
https://github.com/scummvm/scummvm/commit/7d594e0fb62c406491a81969754acb374284151b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Refactored config menu to switch statements
Changed paths:
engines/griffon/dialogs.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 5f26638..44b7140 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -348,14 +348,18 @@ void GriffonEngine::configMenu() {
_itemyloc -= 16;
while (g_system->getEventManager()->pollEvent(_event)) {
- if (_event.type == Common::EVENT_QUIT)
+ switch (_event.type) {
+ case Common::EVENT_QUIT:
_shouldQuit = true;
+ break;
- if (_event.type == Common::EVENT_KEYDOWN) {
- if (_event.kbd.keycode == Common::KEYCODE_ESCAPE)
+ case Common::EVENT_KEYDOWN:
+ switch (_event.kbd.keycode) {
+ case Common::KEYCODE_ESCAPE:
+ exitMenu = true;
break;
- if (_event.kbd.keycode == Common::KEYCODE_LEFT) {
+ case Common::KEYCODE_LEFT:
if (cursel == 11) {
config.musicVol = CLIP(config.musicVol - 25, 0, 255);
setChannelVolume(_musicChannel, config.musicVol);
@@ -371,8 +375,9 @@ void GriffonEngine::configMenu() {
setChannelVolume(snd, config.effectsVol);
}
}
- }
- if (_event.kbd.keycode == Common::KEYCODE_RIGHT) {
+ break;
+
+ case Common::KEYCODE_RIGHT:
if (cursel == 11) {
config.musicVol = CLIP(config.musicVol + 25, 0, 255);
setChannelVolume(_musicChannel, config.musicVol);
@@ -389,55 +394,63 @@ void GriffonEngine::configMenu() {
setChannelVolume(snd, config.effectsVol);
}
}
- }
+ break;
- if (_event.kbd.keycode == Common::KEYCODE_UP) {
+ case Common::KEYCODE_UP:
cursel--;
if (cursel < MINCURSEL)
cursel = MAXCURSEL;
- }
- if (_event.kbd.keycode == Common::KEYCODE_DOWN) {
+ break;
+
+ case Common::KEYCODE_DOWN:
++cursel;
if (cursel > MAXCURSEL)
cursel = MINCURSEL;
- }
+ break;
- if (_event.kbd.keycode == Common::KEYCODE_RETURN) {
+ case Common::KEYCODE_RETURN:
switch (cursel) {
- case 7:
- if (!config.music) {
- config.music = true;
- _menuChannel = playSound(_musicMenu, true);
- setChannelVolume(_menuChannel, config.musicVol);
- }
- break;
- case 8:
- if (config.music) {
- config.music = false;
- haltSoundChannel(_musicChannel);
- haltSoundChannel(_menuChannel);
- }
- break;
- case 9:
- if (!config.effects) {
- config.effects = true;
- int snd = playSound(_sfx[kSndDoor]);
- setChannelVolume(snd, config.effectsVol);
- }
- break;
- case 10:
- if (config.effects)
- config.effects = false;
- break;
- case 13:
- saveConfig();
- // no break on purpose
- case 14:
- exitMenu = true;
- default:
- break;
+ case 7:
+ if (!config.music) {
+ config.music = true;
+ _menuChannel = playSound(_musicMenu, true);
+ setChannelVolume(_menuChannel, config.musicVol);
+ }
+ break;
+ case 8:
+ if (config.music) {
+ config.music = false;
+ haltSoundChannel(_musicChannel);
+ haltSoundChannel(_menuChannel);
+ }
+ break;
+ case 9:
+ if (!config.effects) {
+ config.effects = true;
+ int snd = playSound(_sfx[kSndDoor]);
+ setChannelVolume(snd, config.effectsVol);
+ }
+ break;
+ case 10:
+ if (config.effects)
+ config.effects = false;
+ break;
+ case 13:
+ saveConfig();
+ // no break on purpose
+ case 14:
+ exitMenu = true;
+ default:
+ break;
}
+ break;
+
+ default:
+ break;
}
+
+ default:
+ break;
}
}
Commit: d4bdfa185347de969f67bc2608e126437e335ad9
https://github.com/scummvm/scummvm/commit/d4bdfa185347de969f67bc2608e126437e335ad9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Remove obsolete FIXMEs
Changed paths:
engines/griffon/dialogs.cpp
engines/griffon/draw.cpp
engines/griffon/sound.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 44b7140..870de81 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -599,8 +599,6 @@ void GriffonEngine::saveLoadNew() {
curRow = 1;
} else if (curCol == 3) {
// RETURN
- // reset keys to avoid returning
- // keys[SDLK_RETURN] = keys[SDLK_SPACE] = 0; // FIXME
return;
} else if (curCol == 4) {
// QUIT - non existent :)
diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp
index ed58783..399b9f8 100644
--- a/engines/griffon/draw.cpp
+++ b/engines/griffon/draw.cpp
@@ -261,7 +261,7 @@ void GriffonEngine::drawHud() {
if (_selEnemyOn == false) {
rcDest = Common::Rect(320, 240);
_videoBuffer2->fillRect(rcDest, 0);
- _videoBuffer2->setAlpha((int)(_player.itemselshade * 4)); // FIXME
+ _videoBuffer2->setAlpha((int)(_player.itemselshade * 4));
_videoBuffer2->blit(*_videoBuffer);
int sy = 202;
diff --git a/engines/griffon/sound.cpp b/engines/griffon/sound.cpp
index a8c6c04..8d3af94 100644
--- a/engines/griffon/sound.cpp
+++ b/engines/griffon/sound.cpp
@@ -118,12 +118,6 @@ DataChunk *cacheSound(const char *name) {
}
void GriffonEngine::setupAudio() {
- // FIXME
- //Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 1024);
-
- //atexit(Mix_Quit);
- //atexit(Mix_CloseAudio);
-
const char *stri = "Loading...";
drawString(_videoBuffer, stri, 160 - 4 * strlen(stri), 116, 0);
Commit: e52d6c96f00da6c9361e8044101ff915595c077d
https://github.com/scummvm/scummvm/commit/e52d6c96f00da6c9361e8044101ff915595c077d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
JANITORIAL: Indentation fixes
Changed paths:
engines/griffon/sound.cpp
diff --git a/engines/griffon/sound.cpp b/engines/griffon/sound.cpp
index 8d3af94..36d80d7 100644
--- a/engines/griffon/sound.cpp
+++ b/engines/griffon/sound.cpp
@@ -222,19 +222,19 @@ void GriffonEngine::updateMusic() {
haltSoundChannel(_musicChannel);
if (_playingGardens) {
switch (loopseta) {
- case 0:
- playSound(_musicGardens1);
- break;
- case 1:
- playSound(_musicGardens2);
- break;
- case 2:
- playSound(_musicGardens3);
- break;
- case 3:
- playSound(_musicGardens4);
- default:
- break;
+ case 0:
+ playSound(_musicGardens1);
+ break;
+ case 1:
+ playSound(_musicGardens2);
+ break;
+ case 2:
+ playSound(_musicGardens3);
+ break;
+ case 3:
+ playSound(_musicGardens4);
+ default:
+ break;
}
}
}
Commit: 84e6e1b8c506970ff7351515057e30313b013b43
https://github.com/scummvm/scummvm/commit/84e6e1b8c506970ff7351515057e30313b013b43
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix sluggishness in the inventory menu
Changed paths:
engines/griffon/engine.cpp
engines/griffon/input.cpp
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 291076cd..5c0a28d 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -80,7 +80,6 @@ void GriffonEngine::mainLoop() {
void GriffonEngine::updateEngine() {
g_system->updateScreen();
- g_system->getEventManager()->pollEvent(_event);
_ticksPassed = _ticks;
_ticks = g_system->getMillis();
diff --git a/engines/griffon/input.cpp b/engines/griffon/input.cpp
index 4b2ea5c..cc6a48d 100644
--- a/engines/griffon/input.cpp
+++ b/engines/griffon/input.cpp
@@ -43,8 +43,10 @@ namespace Griffon {
void GriffonEngine::checkInputs() {
int ntickdelay = 175;
+ bool _keyPressed = false;
- g_system->getEventManager()->pollEvent(_event);
+ if (g_system->getEventManager()->pollEvent(_event))
+ _keyPressed = true;
_postInfoNbr = 0;
@@ -307,7 +309,7 @@ __exit_do:
_curEnemy = _lastNpc + _postInfoNbr;
}
} else {
- if (_itemTicks < _ticks) {
+ if (_keyPressed && _event.type == Common::EVENT_KEYDOWN) {
if (_event.kbd.keycode == Common::KEYCODE_UP) {
_curItem = _curItem - 1;
_itemTicks = _ticks + ntickdelay;
Commit: 85918451d1e044d52ffc886abc4fa753b00495e3
https://github.com/scummvm/scummvm/commit/85918451d1e044d52ffc886abc4fa753b00495e3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix warning
Changed paths:
engines/griffon/combat.cpp
engines/griffon/engine.cpp
engines/griffon/griffon.h
engines/griffon/logic.cpp
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp
index 2daafd2..e23596f 100644
--- a/engines/griffon/combat.cpp
+++ b/engines/griffon/combat.cpp
@@ -112,7 +112,7 @@ void GriffonEngine::attack() {
eventText("Found the Temple Key!");
return;
case kScriptFindCrystal:
- _player.foundSpell[0] = true;
+ _player.foundSpell[0] = 1;
_player.spellCharge[0] = 0;
addFloatIcon(7, lx * 16, (ly - 1) * 16);
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 5c0a28d..7a27031 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -278,7 +278,7 @@ void GriffonEngine::newGame() {
_player.shield = 0;
_player.armour = 0;
for (int i = 0; i < 5; i++) {
- _player.foundSpell[i] = false;
+ _player.foundSpell[i] = 0;
_player.spellCharge[i] = 0;
_player.inventory[i] = 0;
}
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index c6abe7f..6973387 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -152,7 +152,7 @@ struct Player {
int sword;
int shield;
int armour;
- bool foundSpell[5];
+ int foundSpell[5];
float spellCharge[5];
int inventory[5];
float attackStrength;
diff --git a/engines/griffon/logic.cpp b/engines/griffon/logic.cpp
index 063c5be..f30de80 100644
--- a/engines/griffon/logic.cpp
+++ b/engines/griffon/logic.cpp
@@ -1643,7 +1643,7 @@ void GriffonEngine::updateSpells() {
for (int f1 = 0; f1 < 5; f1++) {
if (foundel[f1] && !_player.foundSpell[f1]) {
- _player.foundSpell[f1] = true;
+ _player.foundSpell[f1] = 1;
_player.spellCharge[f1] = 0;
if (f1 == 1)
strcpy(line, "Found... Water Essence");
Commit: fe78429fc76f681e3832b6641e5440ee05a7c3e1
https://github.com/scummvm/scummvm/commit/fe78429fc76f681e3832b6641e5440ee05a7c3e1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Mark engine as 16bit
Changed paths:
engines/griffon/configure.engine
diff --git a/engines/griffon/configure.engine b/engines/griffon/configure.engine
index fedaef3..fd18105 100644
--- a/engines/griffon/configure.engine
+++ b/engines/griffon/configure.engine
@@ -1,3 +1,3 @@
# This file is included from the main "configure" script
# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
-add_engine griffon "The Griffon Legend" no
+add_engine griffon "The Griffon Legend" no "" "" "16bit"
Commit: b85b7fec08c8234341fa96c56bede0ffe7d3e349
https://github.com/scummvm/scummvm/commit/b85b7fec08c8234341fa96c56bede0ffe7d3e349
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Added copyright reference
Changed paths:
engines/griffon/griffon.cpp
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index dd95969..3cab278 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -18,6 +18,19 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
+ * Originally written by Syn9 in FreeBASIC with SDL
+ * http://syn9.thehideoutgames.com/index_backup.php
+ *
+ * Ported to plain C for GCW-Zero handheld by Dmitry Smagin
+ * http://github.com/dmitrysmagin/griffon_legend
+ *
+ *
+ * Programming/Graphics: Daniel "Syn9" Kennedy
+ * Music/Sound effects: David Turner
+ *
+ * Beta testing and gameplay design help:
+ * Deleter, Cha0s, Aether Fox, and Kiz
+ *
*/
#include "common/config-manager.h"
Commit: 24c52e32aef31123d44a53dcfc6af561208d67a2
https://github.com/scummvm/scummvm/commit/24c52e32aef31123d44a53dcfc6af561208d67a2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Initialize variable
Changed paths:
engines/griffon/griffon.cpp
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index 3cab278..6bf6b2f 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -66,6 +66,8 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
_cloudAngle = 0.0f;
+ _dontDrawOver = false;
+
for (int i = 0; i < 33; ++i) {
for (int j = 0; j < 6; ++j) {
_objectInfo[i].nFrames = 0;
Commit: 8ad0a0fd6aa436803a57f7e2219aa328c1f073d1
https://github.com/scummvm/scummvm/commit/8ad0a0fd6aa436803a57f7e2219aa328c1f073d1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Use smaller data type for static array
Changed paths:
engines/griffon/logic.cpp
diff --git a/engines/griffon/logic.cpp b/engines/griffon/logic.cpp
index f30de80..d1c3d8c 100644
--- a/engines/griffon/logic.cpp
+++ b/engines/griffon/logic.cpp
@@ -55,7 +55,7 @@ namespace Griffon {
*/
// element tile locations
-const int elementmap[15][20] = {
+const int8 elementmap[15][20] = {
{ 2, 2, 2, 2, -1, -1, -1, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1 },
{ 2, -1, -1, -1, -1, -1, -1, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1 },
{ 2, -1, 2, 2, -1, -1, -1, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1 },
Commit: 356e4014a7f7deb07d540d38bdfa5e31dd6e2090
https://github.com/scummvm/scummvm/commit/356e4014a7f7deb07d540d38bdfa5e31dd6e2090
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Implemented Player::reset()
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 7a27031..6dfb422 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -41,6 +41,36 @@
namespace Griffon {
+void Player::reset() {
+ px = 0;
+ py = 0;
+ opx = 0;
+ opy = 0;
+ walkDir = 0;
+ walkFrame = 0;
+ walkSpeed = 0;
+ attackFrame = 0;
+ attackSpeed = 0;
+ hp = 0;
+ maxHp = 0;
+ hpflash = 0;
+ level = 0;
+ maxLevel = 0;
+ sword = 0;
+ shield = 0;
+ armour = 0;
+ for (int i = 0; i < 5; i++) {
+ foundSpell[i] = 0;
+ spellCharge[i] = 0;
+ inventory[i] = 0;
+ }
+ attackStrength = 0;
+ spellDamage = 0;
+ swordDamage = 0;
+ exp = 0;
+ nextLevel = 0;
+}
+
// copypaste from hRnd_CRT()
float GriffonEngine::RND() {
/* return between 0 and 1 (but never 1) */
@@ -260,33 +290,8 @@ void GriffonEngine::newGame() {
if (_shouldQuit)
return;
- _player.px = 0;
- _player.py = 0;
- _player.opx = 0;
- _player.opy = 0;
- _player.walkDir = 0;
- _player.walkFrame = 0;
- _player.walkSpeed = 0;
- _player.attackFrame = 0;
- _player.attackSpeed = 0;
- _player.hp = 0;
- _player.maxHp = 0;
- _player.hpflash = 0;
- _player.level = 0;
- _player.maxLevel = 0;
- _player.sword = 0;
- _player.shield = 0;
- _player.armour = 0;
- for (int i = 0; i < 5; i++) {
- _player.foundSpell[i] = 0;
- _player.spellCharge[i] = 0;
- _player.inventory[i] = 0;
- }
- _player.attackStrength = 0;
- _player.spellDamage = 0;
- _player.swordDamage = 0;
- _player.exp = 0;
- _player.nextLevel = 0;
+ _player.reset();
+ _playera.reset();
memset(_scriptFlag, 0, sizeof(_scriptFlag));
memset(_objectMapFull, 0, sizeof(_objectMapFull));
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 6973387..ab70030 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -167,6 +167,8 @@ struct Player {
float itemselshade;
int ysort;
+
+ void reset();
};
struct BodySection {
Commit: 4f98377ee0cf7bb2ca7bc276e4ec9809ecd0c7c9
https://github.com/scummvm/scummvm/commit/4f98377ee0cf7bb2ca7bc276e4ec9809ecd0c7c9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: cleanup
Changed paths:
engines/griffon/draw.cpp
diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp
index 399b9f8..30e32c3 100644
--- a/engines/griffon/draw.cpp
+++ b/engines/griffon/draw.cpp
@@ -665,23 +665,8 @@ void GriffonEngine::drawNPCs(int mode) {
rcDest.top = rcDest.top + (int)(RND() * 3) - 1;
}
_anims[sprite]->blit(*_videoBuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- // } else {
- //cframe = _npcinfo[i].cattackframe;
-
- //rcSrc.left = (int)(cframe / 4) * 24;
- //rcSrc.top = wdir * 24;
- //rcSrc.setWidth(24);
- //rcSrc.setHeight(24);
-
- //rcDest.left = npx;
- //rcDest.top = npy;
- //rcDest.setWidth(24);
- //rcDest.setHeight(24);
- // _animsa(sprite)->blit(*_videobuffer, rcDest.left, rcDest.top, Graphics::FLIP_NONE, &rcSrc);
- // }
}
-
// yellow dragon
if (_npcInfo[i].spriteset == kMonsterYellowDragon) {
int cframe = _npcInfo[i].cframe;
Commit: d45e0362215bfa8f46bf550ba3ef52fb2c9cbd1b
https://github.com/scummvm/scummvm/commit/d45e0362215bfa8f46bf550ba3ef52fb2c9cbd1b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Simplified quit event handling
Changed paths:
engines/griffon/cutscenes.cpp
diff --git a/engines/griffon/cutscenes.cpp b/engines/griffon/cutscenes.cpp
index 58c7c6e..6077e24 100644
--- a/engines/griffon/cutscenes.cpp
+++ b/engines/griffon/cutscenes.cpp
@@ -40,6 +40,18 @@
namespace Griffon {
+#define POLL_AND_CHECK_QUIT() if (g_system->getEventManager()->pollEvent(_event)) { \
+ if (_event.type == Common::EVENT_QUIT) { \
+ _shouldQuit = true; \
+ return; \
+ } \
+ }
+
+#define CHECK_QUIT() if (_event.type == Common::EVENT_QUIT) { \
+ _shouldQuit = true; \
+ return; \
+ }
+
const char *story[48] = {
"The Griffon Legend",
"http://syn9.thehideoutgames.com/",
@@ -143,10 +155,7 @@ void GriffonEngine::showLogos() {
g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);
g_system->updateScreen();
- if (g_system->getEventManager()->pollEvent(_event)) {
- if (_event.type == Common::EVENT_QUIT)
- _shouldQuit = true;
- }
+ POLL_AND_CHECK_QUIT();
_ticksPassed = _ticks;
_ticks = g_system->getMillis();
@@ -260,8 +269,7 @@ void GriffonEngine::intro() {
if (_event.kbd.keycode == Common::KEYCODE_ESCAPE)
return;
- if (_event.type == Common::EVENT_QUIT)
- _shouldQuit = true;
+ CHECK_QUIT();
}
g_system->delayMillis(10);
@@ -309,12 +317,7 @@ void GriffonEngine::endOfGame() {
g_system->copyRectToScreen(_videoBuffer2->getPixels(), _videoBuffer2->pitch, 0, 0, _videoBuffer2->w, _videoBuffer2->h);
- if (g_system->getEventManager()->pollEvent(_event)) {
- if (_event.type == Common::EVENT_QUIT) {
- _shouldQuit = true;
- return;
- }
- }
+ POLL_AND_CHECK_QUIT();
g_system->updateScreen();
g_system->delayMillis(10);
@@ -400,10 +403,7 @@ void GriffonEngine::endOfGame() {
if (_event.kbd.keycode == Common::KEYCODE_ESCAPE)
break;
- if (_event.type == Common::EVENT_QUIT) {
- _shouldQuit = true;
- return;
- }
+ CHECK_QUIT();
}
g_system->updateScreen();
@@ -432,12 +432,7 @@ void GriffonEngine::endOfGame() {
g_system->copyRectToScreen(_videoBuffer3->getPixels(), _videoBuffer3->pitch, 0, 0, _videoBuffer3->w, _videoBuffer3->h);
g_system->updateScreen();
- if (g_system->getEventManager()->pollEvent(_event)) {
- if (_event.type == Common::EVENT_QUIT) {
- _shouldQuit = true;
- return;
- }
- }
+ POLL_AND_CHECK_QUIT();
g_system->delayMillis(10);
@@ -494,10 +489,7 @@ void GriffonEngine::endOfGame() {
}
if (g_system->getEventManager()->pollEvent(_event)) {
- if (_event.type == Common::EVENT_QUIT) {
- _shouldQuit = true;
- return;
- }
+ CHECK_QUIT();
if (_event.type == Common::EVENT_KEYDOWN && keywait < _ticks)
break;
@@ -525,12 +517,7 @@ void GriffonEngine::theEnd() {
g_system->copyRectToScreen(_videoBuffer2->getPixels(), _videoBuffer2->pitch, 0, 0, _videoBuffer2->w, _videoBuffer2->h);
g_system->updateScreen();
- if (g_system->getEventManager()->pollEvent(_event)) {
- if (_event.type == Common::EVENT_QUIT) {
- _shouldQuit = true;
- return;
- }
- }
+ POLL_AND_CHECK_QUIT();
g_system->delayMillis(10);
Commit: 417678ce41e658a6bcd73c4d0054fcfdc3fa88a4
https://github.com/scummvm/scummvm/commit/417678ce41e658a6bcd73c4d0054fcfdc3fa88a4
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fixes for engineId changes
Changed paths:
engines/griffon/detection.cpp
diff --git a/engines/griffon/detection.cpp b/engines/griffon/detection.cpp
index b67241c..1341f31 100644
--- a/engines/griffon/detection.cpp
+++ b/engines/griffon/detection.cpp
@@ -49,7 +49,10 @@ static const ADGameDescription gameDescriptions[] = {
class GriffonMetaEngine: public AdvancedMetaEngine {
public:
GriffonMetaEngine() : AdvancedMetaEngine(Griffon::gameDescriptions, sizeof(ADGameDescription), griffonGames) {
- _singleId = "griffon";
+ }
+
+ virtual const char *getEngineId() const {
+ return "gnap";
}
virtual const char *getName() const {
Commit: a4ffe2cf559cef835ca267d02018c48376857393
https://github.com/scummvm/scummvm/commit/a4ffe2cf559cef835ca267d02018c48376857393
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Reduce the scope of two variables
Changed paths:
engines/griffon/dialogs.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 870de81..7c83639 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -319,12 +319,11 @@ void GriffonEngine::configMenu() {
_itemImg[15]->blit(*_videoBuffer, rc.left, rc.top);
- float yy = 255.0;
if (_ticks < ticks1 + 1000) {
- yy = 255.0 * ((float)(_ticks - ticks1) / 1000.0);
+ float yy = 255.0 * ((float)(_ticks - ticks1) / 1000.0);
yy = CLIP<float>(yy, 0.0, 255.0);
- _videoBuffer->setAlpha((int)yy);
+ _videoBuffer->setAlpha((uint8)yy);
}
_videoBuffer->blit(*_videoBuffer2);
@@ -716,12 +715,11 @@ void GriffonEngine::saveLoadNew() {
_itemImg[15]->blit(*_videoBuffer, rcDest.left, rcDest.top);
}
- int yy = 255;
if (_ticks < ticks1 + 1000) {
- yy = 255 * (_ticks - ticks1) / 1000;
+ int yy = 255 * (_ticks - ticks1) / 1000;
yy = CLIP(yy, 0, 255);
- _videoBuffer->setAlpha((int)yy);
+ _videoBuffer->setAlpha((uint8)yy);
}
_videoBuffer3->fillRect(Common::Rect(0, 0, _videoBuffer3->w, _videoBuffer3->h), 0);
Commit: 6e7260c3f898d28d96d70c6df070b6073c19277c
https://github.com/scummvm/scummvm/commit/6e7260c3f898d28d96d70c6df070b6073c19277c
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix regressions in newsaveload function
Changed paths:
engines/griffon/dialogs.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 7c83639..ca402d8 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -475,6 +475,8 @@ void GriffonEngine::saveLoadNew() {
int curRow = 0;
int curCol = 0;
+ bool lowerlock = false;
+
_ticks = g_system->getMillis();
int ticks1 = _ticks;
@@ -592,9 +594,11 @@ void GriffonEngine::saveLoadNew() {
return;
} else if (curCol == 1) {
// LOAD GAME
+ lowerlock = true;
curRow = 1 + _saveSlot;
} else if (curCol == 2) {
// SAVE GAME
+ lowerlock = true;
curRow = 1;
} else if (curCol == 3) {
// RETURN
@@ -604,10 +608,12 @@ void GriffonEngine::saveLoadNew() {
_shouldQuit = true;
return;
}
- } else {
+ }
+ if (lowerlock && curRow == 1) {
if ((curCol == 1) && saveState(curRow - 1)) {
_secStart += _secsingame;
_secsingame = 0;
+ lowerlock = false;
_saveSlot = curRow - 1;
curRow = 0;
} else if ((curCol == 2) && loadState(curRow - 1)) {
@@ -633,10 +639,11 @@ void GriffonEngine::saveLoadNew() {
case Common::KEYCODE_ESCAPE:
if (curRow == 0)
return;
+ lowerlock = false;
curRow = 0;
break;
case Common::KEYCODE_DOWN:
- if (curRow != 0) {
+ if (lowerlock) {
++curRow;
if (curRow == 5)
curRow = 1;
@@ -644,7 +651,7 @@ void GriffonEngine::saveLoadNew() {
break;
case Common::KEYCODE_UP:
- if (curRow != 0) {
+ if (lowerlock) {
--curRow;
if (curRow == 0)
curRow = 4;
@@ -652,7 +659,7 @@ void GriffonEngine::saveLoadNew() {
break;
case Common::KEYCODE_LEFT:
- if (curRow == 0) {
+ if (!lowerlock) {
--curCol;
if (curCol == -1)
curCol = 3;
@@ -660,7 +667,7 @@ void GriffonEngine::saveLoadNew() {
break;
case Common::KEYCODE_RIGHT:
- if (curRow == 0) {
+ if (!lowerlock) {
++curCol;
if (curCol == 4)
curCol = 0;
Commit: 7384a8c35e97870e654aebbf6378b7250bb205ad
https://github.com/scummvm/scummvm/commit/7384a8c35e97870e654aebbf6378b7250bb205ad
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Initialize variables
Changed paths:
engines/griffon/griffon.cpp
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index 6bf6b2f..86b3b3c 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -68,6 +68,9 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
_dontDrawOver = false;
+ _firsty = 0;
+ _lasty = 0;
+
for (int i = 0; i < 33; ++i) {
for (int j = 0; j < 6; ++j) {
_objectInfo[i].nFrames = 0;
Commit: 417ce00577a9dec033271b7ef08daefe667ac3b9
https://github.com/scummvm/scummvm/commit/417ce00577a9dec033271b7ef08daefe667ac3b9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix engine id
Changed paths:
engines/griffon/detection.cpp
diff --git a/engines/griffon/detection.cpp b/engines/griffon/detection.cpp
index 1341f31..99eab52 100644
--- a/engines/griffon/detection.cpp
+++ b/engines/griffon/detection.cpp
@@ -52,7 +52,7 @@ public:
}
virtual const char *getEngineId() const {
- return "gnap";
+ return "griffon";
}
virtual const char *getName() const {
Commit: d89e3f8176dca2e892d3e2bc849b659338dafc64
https://github.com/scummvm/scummvm/commit/d89e3f8176dca2e892d3e2bc849b659338dafc64
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix misleading comments
Changed paths:
engines/griffon/dialogs.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index ca402d8..82e8882 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -593,11 +593,11 @@ void GriffonEngine::saveLoadNew() {
if (_shouldQuit || _gameEnd)
return;
} else if (curCol == 1) {
- // LOAD GAME
+ // SAVE GAME
lowerlock = true;
curRow = 1 + _saveSlot;
} else if (curCol == 2) {
- // SAVE GAME
+ // LOAD GAME
lowerlock = true;
curRow = 1;
} else if (curCol == 3) {
Commit: 1b2e826e7122db8cfd0ea9bde626653d3a8d086b
https://github.com/scummvm/scummvm/commit/1b2e826e7122db8cfd0ea9bde626653d3a8d086b
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix unitialize variable breaking the save screen
Changed paths:
engines/griffon/griffon.cpp
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index 86b3b3c..118ff0e 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -70,6 +70,7 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
_firsty = 0;
_lasty = 0;
+ _saveSlot = 0;
for (int i = 0; i < 33; ++i) {
for (int j = 0; j < 6; ++j) {
Commit: 3e1431d4eaa12156018d214d53edc76f06e76a65
https://github.com/scummvm/scummvm/commit/3e1431d4eaa12156018d214d53edc76f06e76a65
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix save screen
Changed paths:
engines/griffon/dialogs.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 82e8882..c5a4703 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -479,6 +479,7 @@ void GriffonEngine::saveLoadNew() {
_ticks = g_system->getMillis();
int ticks1 = _ticks;
+ int tickpause = _ticks + 150;
_cloudImg->setAlpha(128, true);
@@ -581,7 +582,7 @@ void GriffonEngine::saveLoadNew() {
return;
}
- if (_event.type == Common::EVENT_KEYDOWN) {
+ if (tickpause < _ticks && _event.type == Common::EVENT_KEYDOWN) {
_itemTicks = _ticks + 220;
if (_event.kbd.keycode == Common::KEYCODE_RETURN) {
@@ -596,10 +597,12 @@ void GriffonEngine::saveLoadNew() {
// SAVE GAME
lowerlock = true;
curRow = 1 + _saveSlot;
+ tickpause = _ticks + 125;
} else if (curCol == 2) {
// LOAD GAME
lowerlock = true;
curRow = 1;
+ tickpause = _ticks + 125;
} else if (curCol == 3) {
// RETURN
return;
@@ -609,7 +612,7 @@ void GriffonEngine::saveLoadNew() {
return;
}
}
- if (lowerlock && curRow == 1) {
+ if (lowerlock && tickpause < _ticks) {
if ((curCol == 1) && saveState(curRow - 1)) {
_secStart += _secsingame;
_secsingame = 0;
@@ -632,6 +635,7 @@ void GriffonEngine::saveLoadNew() {
loadMap(_curMap);
mainLoop();
}
+ tickpause = _ticks + 125;
}
}
@@ -641,12 +645,14 @@ void GriffonEngine::saveLoadNew() {
return;
lowerlock = false;
curRow = 0;
+ tickpause = _ticks + 125;
break;
case Common::KEYCODE_DOWN:
if (lowerlock) {
++curRow;
if (curRow == 5)
curRow = 1;
+ tickpause = _ticks + 125;
}
break;
@@ -655,6 +661,7 @@ void GriffonEngine::saveLoadNew() {
--curRow;
if (curRow == 0)
curRow = 4;
+ tickpause = _ticks + 125;
}
break;
@@ -663,6 +670,7 @@ void GriffonEngine::saveLoadNew() {
--curCol;
if (curCol == -1)
curCol = 3;
+ tickpause = _ticks + 125;
}
break;
@@ -671,6 +679,7 @@ void GriffonEngine::saveLoadNew() {
++curCol;
if (curCol == 4)
curCol = 0;
+ tickpause = _ticks + 125;
}
break;
default:
Commit: 87d46434e3c95f5d82a5d3d81e2eaaeefa55709c
https://github.com/scummvm/scummvm/commit/87d46434e3c95f5d82a5d3d81e2eaaeefa55709c
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Some renaming
Changed paths:
engines/griffon/cutscenes.cpp
engines/griffon/dialogs.cpp
engines/griffon/draw.cpp
engines/griffon/engine.cpp
engines/griffon/griffon.h
engines/griffon/saveload.cpp
diff --git a/engines/griffon/cutscenes.cpp b/engines/griffon/cutscenes.cpp
index 6077e24..c4612d4 100644
--- a/engines/griffon/cutscenes.cpp
+++ b/engines/griffon/cutscenes.cpp
@@ -194,7 +194,7 @@ void GriffonEngine::intro() {
setChannelVolume(_musicChannel, 0);
}
- _secsingame = 0;
+ _secsInGame = 0;
_secStart = 0;
bool ldStop = false;
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index c5a4703..4b0fbc6 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -475,11 +475,11 @@ void GriffonEngine::saveLoadNew() {
int curRow = 0;
int curCol = 0;
- bool lowerlock = false;
+ bool lowerLock = false;
_ticks = g_system->getMillis();
int ticks1 = _ticks;
- int tickpause = _ticks + 150;
+ int tickPause = _ticks + 150;
_cloudImg->setAlpha(128, true);
@@ -582,7 +582,7 @@ void GriffonEngine::saveLoadNew() {
return;
}
- if (tickpause < _ticks && _event.type == Common::EVENT_KEYDOWN) {
+ if (tickPause < _ticks && _event.type == Common::EVENT_KEYDOWN) {
_itemTicks = _ticks + 220;
if (_event.kbd.keycode == Common::KEYCODE_RETURN) {
@@ -595,14 +595,14 @@ void GriffonEngine::saveLoadNew() {
return;
} else if (curCol == 1) {
// SAVE GAME
- lowerlock = true;
+ lowerLock = true;
curRow = 1 + _saveSlot;
- tickpause = _ticks + 125;
+ tickPause = _ticks + 125;
} else if (curCol == 2) {
// LOAD GAME
- lowerlock = true;
+ lowerLock = true;
curRow = 1;
- tickpause = _ticks + 125;
+ tickPause = _ticks + 125;
} else if (curCol == 3) {
// RETURN
return;
@@ -612,11 +612,11 @@ void GriffonEngine::saveLoadNew() {
return;
}
}
- if (lowerlock && tickpause < _ticks) {
+ if (lowerLock && tickPause < _ticks) {
if ((curCol == 1) && saveState(curRow - 1)) {
- _secStart += _secsingame;
- _secsingame = 0;
- lowerlock = false;
+ _secStart += _secsInGame;
+ _secsInGame = 0;
+ lowerLock = false;
_saveSlot = curRow - 1;
curRow = 0;
} else if ((curCol == 2) && loadState(curRow - 1)) {
@@ -630,12 +630,12 @@ void GriffonEngine::saveLoadNew() {
haltSoundChannel(-1);
- _secsingame = 0;
+ _secsInGame = 0;
_saveSlot = curRow - 1;
loadMap(_curMap);
mainLoop();
}
- tickpause = _ticks + 125;
+ tickPause = _ticks + 125;
}
}
@@ -643,43 +643,43 @@ void GriffonEngine::saveLoadNew() {
case Common::KEYCODE_ESCAPE:
if (curRow == 0)
return;
- lowerlock = false;
+ lowerLock = false;
curRow = 0;
- tickpause = _ticks + 125;
+ tickPause = _ticks + 125;
break;
case Common::KEYCODE_DOWN:
- if (lowerlock) {
+ if (lowerLock) {
++curRow;
if (curRow == 5)
curRow = 1;
- tickpause = _ticks + 125;
+ tickPause = _ticks + 125;
}
break;
case Common::KEYCODE_UP:
- if (lowerlock) {
+ if (lowerLock) {
--curRow;
if (curRow == 0)
curRow = 4;
- tickpause = _ticks + 125;
+ tickPause = _ticks + 125;
}
break;
case Common::KEYCODE_LEFT:
- if (!lowerlock) {
+ if (!lowerLock) {
--curCol;
if (curCol == -1)
curCol = 3;
- tickpause = _ticks + 125;
+ tickPause = _ticks + 125;
}
break;
case Common::KEYCODE_RIGHT:
- if (!lowerlock) {
+ if (!lowerLock) {
++curCol;
if (curCol == 4)
curCol = 0;
- tickpause = _ticks + 125;
+ tickPause = _ticks + 125;
}
break;
default:
diff --git a/engines/griffon/draw.cpp b/engines/griffon/draw.cpp
index 30e32c3..0e6b348 100644
--- a/engines/griffon/draw.cpp
+++ b/engines/griffon/draw.cpp
@@ -329,7 +329,7 @@ void GriffonEngine::drawHud() {
ABS(_player.spellStrength - 100) < kEpsilon ? RGB(224, 0, 0) : RGB(128, 0, 224));
// time
- int ase = _secStart + _secsingame;
+ int ase = _secStart + _secsInGame;
int h = ((ase - (ase % 3600)) / 3600);
ase -= h * 3600;
int m = ((ase - (ase % 60)) / 60);
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 6dfb422..8c0b511 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -122,7 +122,7 @@ void GriffonEngine::updateEngine() {
_nextTicks = _ticks + 1000;
_fps = _fp;
_fp = 0;
- _secsingame = _secsingame + 1;
+ _secsInGame = _secsInGame + 1;
}
if (_attacking) {
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index ab70030..f202437 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -451,7 +451,7 @@ private:
// timer related - move to local later
int _ticks, _ticksPassed, _nextTicks;
float _fp, _fps, _fpsr; // CHECKME: _fp and _fps seems to be integers
- int _secsingame, _secStart;
+ int _secsInGame, _secStart;
Graphics::TransparentSurface *mapImg[4];
diff --git a/engines/griffon/saveload.cpp b/engines/griffon/saveload.cpp
index 42abff0..7285e21 100644
--- a/engines/griffon/saveload.cpp
+++ b/engines/griffon/saveload.cpp
@@ -194,7 +194,7 @@ int GriffonEngine::saveState(int slotnum) {
PRINT("%i", _player.level);
if (_player.level > 0) {
- PRINT("%i", (_secStart + _secsingame));
+ PRINT("%i", (_secStart + _secsInGame));
PRINT("%s", "a");
PRINT("%f", _player.px);
Commit: a28bf11ca62e1b2171f5c4898be7c8598c84dbde
https://github.com/scummvm/scummvm/commit/a28bf11ca62e1b2171f5c4898be7c8598c84dbde
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Initial code for game modes
Changed paths:
engines/griffon/combat.cpp
engines/griffon/dialogs.cpp
engines/griffon/engine.cpp
engines/griffon/griffon.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp
index e23596f..ffd07f3 100644
--- a/engines/griffon/combat.cpp
+++ b/engines/griffon/combat.cpp
@@ -1002,7 +1002,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
if (_npcInfo[npcnum].script == kScriptEndOfGame) {
endOfGame();
- _gameEnd = true;
+ _gameMode = kGameModeEnd;
}
}
}
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 4b0fbc6..d149a8d 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -184,7 +184,11 @@ void GriffonEngine::title(int mode) {
_ticks = g_system->getMillis();
ticks1 = _ticks;
- exitTitle = true;
+ saveLoadNew();
+
+ if (_gameMode == kGameModeNewGame) {
+ exitTitle = true;
+ }
break;
case 1:
configMenu();
@@ -589,10 +593,9 @@ void GriffonEngine::saveLoadNew() {
if (curRow == 0) {
if (curCol == 0) {
// NEW GAME
- newGame();
+ _gameMode = kGameModeNewGame;
- if (_shouldQuit || _gameEnd)
- return;
+ return;
} else if (curCol == 1) {
// SAVE GAME
lowerLock = true;
@@ -611,7 +614,7 @@ void GriffonEngine::saveLoadNew() {
_shouldQuit = true;
return;
}
- }
+ }
if (lowerLock && tickPause < _ticks) {
if ((curCol == 1) && saveState(curRow - 1)) {
_secStart += _secsInGame;
@@ -620,20 +623,11 @@ void GriffonEngine::saveLoadNew() {
_saveSlot = curRow - 1;
curRow = 0;
} else if ((curCol == 2) && loadState(curRow - 1)) {
- _player.walkSpeed = 1.1f;
- _animSpeed = 0.5f;
- _attacking = false;
- _player.attackSpeed = 1.5f;
-
- _playingGardens = false;
- _playingBoss = false;
+ _saveSlot = curRow - 1;
- haltSoundChannel(-1);
+ _gameMode = kGameModeLoadGame;
- _secsInGame = 0;
- _saveSlot = curRow - 1;
- loadMap(_curMap);
- mainLoop();
+ return;
}
tickPause = _ticks + 125;
}
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 8c0b511..b23dae9 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -105,7 +105,7 @@ void GriffonEngine::mainLoop() {
_console->onFrame();
updateEngine();
- } while (!_shouldQuit && !_gameEnd);
+ } while (!_shouldQuit && _gameMode != kGameModeEnd);
}
void GriffonEngine::updateEngine() {
@@ -161,7 +161,7 @@ void GriffonEngine::updateEngine() {
checkHit();
- if (_gameEnd)
+ if (_gameMode == kGameModeEnd)
return;
}
@@ -244,7 +244,7 @@ void GriffonEngine::updateEngine() {
if (_player.hp <= 0) {
theEnd();
- _gameEnd = true;
+ _gameMode = kGameModeEnd;
return;
}
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index 118ff0e..264d0f0 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -59,7 +59,7 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
_mixer = nullptr;
_shouldQuit = false;
- _gameEnd = false;
+ _gameMode = kGameModeIntro;
_musicChannel = -1;
_menuChannel = -1;
@@ -138,11 +138,27 @@ Common::Error GriffonEngine::run() {
return Common::kNoError;
while (!_shouldQuit) {
- _gameEnd = false;
-
title(0);
- if (!_shouldQuit && !_gameEnd)
+ if (_gameMode == kGameModeNewGame) {
+ newGame();
+ } else if (_gameMode == kGameModeLoadGame) {
+ _player.walkSpeed = 1.1f;
+ _animSpeed = 0.5f;
+ _attacking = false;
+ _player.attackSpeed = 1.5f;
+
+ _playingGardens = false;
+ _playingBoss = false;
+
+ haltSoundChannel(-1);
+
+ _secsInGame = 0;
+ loadMap(_curMap);
+ mainLoop();
+ }
+
+ if (!_shouldQuit && _gameMode != kGameModeEnd)
saveLoadNew();
}
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index f202437..f766b9d 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -320,6 +320,14 @@ struct ObjectInfoStruct {
int script;
};
+enum {
+ kGameModeIntro,
+ kGameModeEnd,
+ kGameModeSaveLoad,
+ kGameModeNewGame,
+ kGameModeLoadGame
+};
+
class GriffonEngine : public Engine {
public:
GriffonEngine(OSystem *syst);
@@ -331,7 +339,7 @@ public:
private:
Common::RandomSource *_rnd;
bool _shouldQuit;
- bool _gameEnd;
+ int _gameMode;
Console *_console;
Commit: f1eabe26f5d20e31c29d90f16a3002f8395b5b85
https://github.com/scummvm/scummvm/commit/f1eabe26f5d20e31c29d90f16a3002f8395b5b85
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: More work on game states
Changed paths:
engines/griffon/dialogs.cpp
engines/griffon/griffon.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index d149a8d..094d887 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -186,7 +186,7 @@ void GriffonEngine::title(int mode) {
saveLoadNew();
- if (_gameMode == kGameModeNewGame) {
+ if (_gameMode == kGameModeNewGame || _gameMode == kGameModeLoadGame) {
exitTitle = true;
}
break;
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index 264d0f0..74517b4 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -157,9 +157,6 @@ Common::Error GriffonEngine::run() {
loadMap(_curMap);
mainLoop();
}
-
- if (!_shouldQuit && _gameMode != kGameModeEnd)
- saveLoadNew();
}
return Common::kNoError;
Commit: 97451785c40fedb495944a56b62c60a2e6312977
https://github.com/scummvm/scummvm/commit/97451785c40fedb495944a56b62c60a2e6312977
Author: D G Turner (digitall at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix GCC Compiler Warnings
Changed paths:
engines/griffon/combat.cpp
engines/griffon/dialogs.cpp
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp
index ffd07f3..aad5ddb 100644
--- a/engines/griffon/combat.cpp
+++ b/engines/griffon/combat.cpp
@@ -387,6 +387,8 @@ void GriffonEngine::attack() {
return;
}
break;
+ default:
+ break;
}
}
}
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 094d887..06026eb 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -440,9 +440,10 @@ void GriffonEngine::configMenu() {
break;
case 13:
saveConfig();
- // no break on purpose
+ // fall through
case 14:
exitMenu = true;
+ break;
default:
break;
}
Commit: 6827277eb0937b6a3fe050f7df17ed1fd8fc91e1
https://github.com/scummvm/scummvm/commit/6827277eb0937b6a3fe050f7df17ed1fd8fc91e1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Render savestates after save
Changed paths:
engines/griffon/dialogs.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 06026eb..2153773 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -472,23 +472,7 @@ void GriffonEngine::configMenu() {
_itemTicks = _ticks + 210;
}
-void GriffonEngine::saveLoadNew() {
- float y = 0.0;
-
- _cloudAngle = 0;
-
- int curRow = 0;
- int curCol = 0;
-
- bool lowerLock = false;
-
- _ticks = g_system->getMillis();
- int ticks1 = _ticks;
- int tickPause = _ticks + 150;
-
- _cloudImg->setAlpha(128, true);
-
- // savestates---------------------------------
+void GriffonEngine::renderSaveStates() {
_videoBuffer2->fillRect(Common::Rect(0, 0, _videoBuffer2->w, _videoBuffer2->h), 0);
for (int ff = 0; ff <= 3; ff++) {
@@ -558,6 +542,25 @@ void GriffonEngine::saveLoadNew() {
drawString(_videoBuffer2, "Empty", 160 - 5 * 4, sy, 0);
}
}
+}
+
+void GriffonEngine::saveLoadNew() {
+ float y = 0.0;
+
+ _cloudAngle = 0;
+
+ int curRow = 0;
+ int curCol = 0;
+
+ bool lowerLock = false;
+
+ _ticks = g_system->getMillis();
+ int ticks1 = _ticks;
+ int tickPause = _ticks + 150;
+
+ _cloudImg->setAlpha(128, true);
+
+ renderSaveStates();
// Main menu loop
do {
@@ -623,6 +626,8 @@ void GriffonEngine::saveLoadNew() {
lowerLock = false;
_saveSlot = curRow - 1;
curRow = 0;
+
+ renderSaveStates();
} else if ((curCol == 2) && loadState(curRow - 1)) {
_saveSlot = curRow - 1;
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index f766b9d..6206c91 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -362,6 +362,7 @@ private:
void title(int mode);
void configMenu();
void saveLoadNew();
+ void renderSaveStates();
// draw.cpp
void drawAnims(int Layer);
Commit: 6116ed3a250ec0e6facb97164c4f21de722e22f6
https://github.com/scummvm/scummvm/commit/6116ed3a250ec0e6facb97164c4f21de722e22f6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Added 'nodamage' console command
Changed paths:
engines/griffon/combat.cpp
engines/griffon/console.cpp
engines/griffon/console.h
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp
index aad5ddb..ebd5876 100644
--- a/engines/griffon/combat.cpp
+++ b/engines/griffon/combat.cpp
@@ -515,7 +515,7 @@ void GriffonEngine::checkHit() {
ps *= 0.75;
float damage = (float)_player.swordDamage * (1.0 + RND() * 1.0) * _player.attackStrength / 100.0 * ps;
- if (_console->_godMode)
+ if (_console->_godMode == kGodModeAll)
damage = 1000;
if (ABS(_player.attackStrength - 100) < kEpsilon)
@@ -1012,8 +1012,10 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
void GriffonEngine::damagePlayer(int damage) {
char line[256];
- if (!_console->_godMode)
- _player.hp -= damage;
+ if (_console->_godMode != kGodModeNone)
+ damage = 0;
+
+ _player.hp -= damage;
if (_player.hp < 0)
_player.hp = 0;
diff --git a/engines/griffon/console.cpp b/engines/griffon/console.cpp
index f8c51f7..4ceb3f8 100644
--- a/engines/griffon/console.cpp
+++ b/engines/griffon/console.cpp
@@ -27,8 +27,9 @@
namespace Griffon {
Console::Console() {
- _godMode = false;
+ _godMode = kGodModeNone;
registerCmd("godmode", WRAP_METHOD(Console, Cmd_godMode));
+ registerCmd("nodamage", WRAP_METHOD(Console, Cmd_noDamage));
}
bool Console::Cmd_godMode(int argc, const char** argv) {
@@ -38,8 +39,28 @@ bool Console::Cmd_godMode(int argc, const char** argv) {
return true;
}
- _godMode ^= true;
- debugPrintf("God mode is now %s\n", _godMode ? "Enabled" : "Disabled");
+ if (_godMode != kGodModeNone)
+ _godMode = kGodModeNone;
+ else
+ _godMode = kGodModeAll;
+
+ debugPrintf("God mode is now %s\n", _godMode == kGodModeAll ? "Invincibility/Damage" : "Disabled");
+ return true;
+}
+
+bool Console::Cmd_noDamage(int argc, const char** argv) {
+ if (argc != 1) {
+ debugPrintf("Usage: %s\n", argv[0]);
+ debugPrintf("Enables/Disables invincibility\n");
+ return true;
+ }
+
+ if (_godMode != kGodModeNone)
+ _godMode = kGodModeNone;
+ else
+ _godMode = kGodModeNoDamage;
+
+ debugPrintf("God mode is now %s\n", _godMode ? "Invincibility" : "Disabled");
return true;
}
diff --git a/engines/griffon/console.h b/engines/griffon/console.h
index 4709b7e..471c414 100644
--- a/engines/griffon/console.h
+++ b/engines/griffon/console.h
@@ -27,14 +27,21 @@
namespace Griffon {
+enum {
+ kGodModeNone = 0,
+ kGodModeAll = 1,
+ kGodModeNoDamage = 2
+};
+
class Console : public GUI::Debugger {
public:
- bool _godMode;
+ int _godMode;
explicit Console();
virtual ~Console(void) {}
bool Cmd_godMode(int argc, const char** argv);
+ bool Cmd_noDamage(int argc, const char** argv);
};
}
Commit: 477e12c1e1ccf529fdee9d4339b618fcd8b24160
https://github.com/scummvm/scummvm/commit/477e12c1e1ccf529fdee9d4339b618fcd8b24160
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: More work on game modes
Changed paths:
engines/griffon/engine.cpp
engines/griffon/griffon.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index b23dae9..19519bb 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -85,6 +85,8 @@ void GriffonEngine::mainLoop() {
_pmenu = false;
}
+ _gameMode = kGameModePlay;
+
do {
if (!_forcePause) {
updateAnims();
@@ -105,7 +107,7 @@ void GriffonEngine::mainLoop() {
_console->onFrame();
updateEngine();
- } while (!_shouldQuit && _gameMode != kGameModeEnd);
+ } while (!_shouldQuit && _gameMode != kGameModeEnd && _gameMode != kGameModeNewGame);
}
void GriffonEngine::updateEngine() {
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index 74517b4..85e1e36 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -138,7 +138,8 @@ Common::Error GriffonEngine::run() {
return Common::kNoError;
while (!_shouldQuit) {
- title(0);
+ if (_gameMode != kGameModeNewGame)
+ title(0);
if (_gameMode == kGameModeNewGame) {
newGame();
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 6206c91..611ecc8d 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -325,7 +325,8 @@ enum {
kGameModeEnd,
kGameModeSaveLoad,
kGameModeNewGame,
- kGameModeLoadGame
+ kGameModeLoadGame,
+ kGameModePlay
};
class GriffonEngine : public Engine {
Commit: 93be6abf58c902bcbe33b6d7f535ea477b6e6afc
https://github.com/scummvm/scummvm/commit/93be6abf58c902bcbe33b6d7f535ea477b6e6afc
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix the menu logic. Finally!
Changed paths:
engines/griffon/combat.cpp
engines/griffon/engine.cpp
engines/griffon/griffon.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/combat.cpp b/engines/griffon/combat.cpp
index ebd5876..a21ce7f 100644
--- a/engines/griffon/combat.cpp
+++ b/engines/griffon/combat.cpp
@@ -1004,7 +1004,7 @@ void GriffonEngine::damageNPC(int npcnum, int damage, int spell) {
if (_npcInfo[npcnum].script == kScriptEndOfGame) {
endOfGame();
- _gameMode = kGameModeEnd;
+ _gameMode = kGameModeIntro;
}
}
}
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp
index 19519bb..a1eb513 100644
--- a/engines/griffon/engine.cpp
+++ b/engines/griffon/engine.cpp
@@ -107,7 +107,7 @@ void GriffonEngine::mainLoop() {
_console->onFrame();
updateEngine();
- } while (!_shouldQuit && _gameMode != kGameModeEnd && _gameMode != kGameModeNewGame);
+ } while (!_shouldQuit && _gameMode == kGameModePlay);
}
void GriffonEngine::updateEngine() {
@@ -163,7 +163,7 @@ void GriffonEngine::updateEngine() {
checkHit();
- if (_gameMode == kGameModeEnd)
+ if (_gameMode != kGameModePlay)
return;
}
@@ -246,7 +246,7 @@ void GriffonEngine::updateEngine() {
if (_player.hp <= 0) {
theEnd();
- _gameMode = kGameModeEnd;
+ _gameMode = kGameModeIntro;
return;
}
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index 85e1e36..7632623 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -137,13 +137,20 @@ Common::Error GriffonEngine::run() {
if (_shouldQuit)
return Common::kNoError;
+ _gameMode = kGameModeIntro;
+
while (!_shouldQuit) {
- if (_gameMode != kGameModeNewGame)
+ switch (_gameMode) {
+ case kGameModeIntro:
+ case kGameModePlay:
title(0);
+ break;
- if (_gameMode == kGameModeNewGame) {
+ case kGameModeNewGame:
newGame();
- } else if (_gameMode == kGameModeLoadGame) {
+ break;
+
+ case kGameModeLoadGame:
_player.walkSpeed = 1.1f;
_animSpeed = 0.5f;
_attacking = false;
@@ -157,6 +164,10 @@ Common::Error GriffonEngine::run() {
_secsInGame = 0;
loadMap(_curMap);
mainLoop();
+ break;
+
+ default:
+ error("Bad game mode: %d", _gameMode);
}
}
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 611ecc8d..f2e397e 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -322,11 +322,9 @@ struct ObjectInfoStruct {
enum {
kGameModeIntro,
- kGameModeEnd,
- kGameModeSaveLoad,
+ kGameModePlay,
kGameModeNewGame,
- kGameModeLoadGame,
- kGameModePlay
+ kGameModeLoadGame
};
class GriffonEngine : public Engine {
Commit: 8f492cf877a1dc1f2b00f0d7addd8e4ea6325e2a
https://github.com/scummvm/scummvm/commit/8f492cf877a1dc1f2b00f0d7addd8e4ea6325e2a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Hide 'save' item from menu when there is nothing to save
Changed paths:
engines/griffon/dialogs.cpp
engines/griffon/resources.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 2153773..38da696 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -562,6 +562,14 @@ void GriffonEngine::saveLoadNew() {
renderSaveStates();
+ delete _saveLoadImg;
+
+ _saveLoadImg = loadImage("art/saveloadnew.bmp", true);
+ if (_gameMode == kGameModeIntro) {
+ _saveLoadImg->fillRect(Common::Rect(125, 15, 160, 33), _videoBuffer->format.ARGBToColor(0, 0, 0, 0));
+ }
+ _saveLoadImg->setAlpha(192, true);
+
// Main menu loop
do {
_videoBuffer->fillRect(Common::Rect(0, 0, _videoBuffer->w, _videoBuffer->h), 0);
diff --git a/engines/griffon/resources.cpp b/engines/griffon/resources.cpp
index 5ff8aa6..40f9822 100644
--- a/engines/griffon/resources.cpp
+++ b/engines/griffon/resources.cpp
@@ -82,8 +82,7 @@ void GriffonEngine::initialize() {
_cloudImg = loadImage("art/clouds.bmp", true);
_cloudImg->setAlpha(64, true);
- _saveLoadImg = loadImage("art/saveloadnew.bmp", true);
- _saveLoadImg->setAlpha(192, true);
+ _saveLoadImg = nullptr;
_titleImg = loadImage("art/titleb.bmp");
_titleImg2 = loadImage("art/titlea.bmp", true);
Commit: 1911d459df8df6ca2a7fba3342caa702d369b85b
https://github.com/scummvm/scummvm/commit/1911d459df8df6ca2a7fba3342caa702d369b85b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix color fill for hidden 'save', and skip it in the navigation
Changed paths:
engines/griffon/dialogs.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 38da696..c000d58 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -566,7 +566,8 @@ void GriffonEngine::saveLoadNew() {
_saveLoadImg = loadImage("art/saveloadnew.bmp", true);
if (_gameMode == kGameModeIntro) {
- _saveLoadImg->fillRect(Common::Rect(125, 15, 160, 33), _videoBuffer->format.ARGBToColor(0, 0, 0, 0));
+ uint32 color = *(uint32 *)_saveLoadImg->getBasePtr(120, 10);
+ _saveLoadImg->fillRect(Common::Rect(125, 15, 160, 33), color);
}
_saveLoadImg->setAlpha(192, true);
@@ -678,6 +679,10 @@ void GriffonEngine::saveLoadNew() {
--curCol;
if (curCol == -1)
curCol = 3;
+
+ if (curCol == 1 && _gameMode == kGameModeIntro)
+ curCol = 0;
+
tickPause = _ticks + 125;
}
break;
@@ -687,6 +692,10 @@ void GriffonEngine::saveLoadNew() {
++curCol;
if (curCol == 4)
curCol = 0;
+
+ if (curCol == 1 && _gameMode == kGameModeIntro)
+ curCol = 2;
+
tickPause = _ticks + 125;
}
break;
Commit: 4fbf91e829c3466e7fe6f1032220db8e1279ddaa
https://github.com/scummvm/scummvm/commit/4fbf91e829c3466e7fe6f1032220db8e1279ddaa
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
ENGINES: Extend MetaEngine class with ExtendedSaves support
Changed paths:
A engines/metaengine.cpp
engines/metaengine.h
engines/module.mk
diff --git a/engines/metaengine.cpp b/engines/metaengine.cpp
new file mode 100644
index 0000000..46a5f12
--- /dev/null
+++ b/engines/metaengine.cpp
@@ -0,0 +1,226 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "engines/metaengine.h"
+
+#include "common/savefile.h"
+#include "common/system.h"
+
+#include "graphics/thumbnail.h"
+
+const char *MetaEngine::getSavegameFile(int saveGameIdx, const char *target) const {
+ static char buffer[100];
+
+ snprintf(buffer, 200, "%s.s%02d", target == nullptr ? getEngineId() : target, saveGameIdx);
+
+ return buffer;
+}
+
+const char *MetaEngine::getSavegamePattern(const char *target) const {
+ static char buffer[100];
+
+ snprintf(buffer, 200, "%s.s##", target == nullptr ? getEngineId() : target);
+
+ return buffer;
+}
+
+void MetaEngine::appendExtendedSave(Common::OutSaveFile *saveFile, uint32 playtime, Common::String desc) {
+ ExtendedSavegameHeader header;
+
+ uint headerPos = saveFile->pos();
+
+ strcpy(header.id, "SVMCR");
+ header.version = EXTENDED_SAVE_VERSION;
+
+ TimeDate curTime;
+ g_system->getTimeAndDate(curTime);
+
+ header.date = ((curTime.tm_mday & 0xFF) << 24) | (((curTime.tm_mon + 1) & 0xFF) << 16) | ((curTime.tm_year + 1900) & 0xFFFF);
+ header.time = ((curTime.tm_hour & 0xFF) << 8) | ((curTime.tm_min) & 0xFF);
+
+ saveFile->write(header.id, 6);
+ saveFile->writeByte(header.version);
+ saveFile->writeUint32LE(header.date);
+ saveFile->writeUint16LE(header.time);
+ saveFile->writeUint32LE(playtime);
+
+ saveFile->writeByte(desc.size());
+ saveFile->writeString(desc);
+
+ Graphics::saveThumbnail(*saveFile); // FIXME. Render proper screen
+
+ saveFile->writeUint32LE(headerPos); // Store where the header starts
+
+ saveFile->finalize();
+}
+
+void MetaEngine::parseSavegameHeader(ExtendedSavegameHeader *header, SaveStateDescriptor *desc) {
+ int day = (header->date >> 24) & 0xFF;
+ int month = (header->date >> 16) & 0xFF;
+ int year = header->date & 0xFFFF;
+ desc->setSaveDate(year, month, day);
+ int hour = (header->time >> 8) & 0xFF;
+ int minutes = header->time & 0xFF;
+ desc->setSaveTime(hour, minutes);
+ desc->setPlayTime(header->playtime * 1000);
+
+ desc->setDescription(header->description);
+}
+
+void MetaEngine::fillDummyHeader(ExtendedSavegameHeader *header) {
+ // This is wrong header, perhaps it is original savegame. Thus fill out dummy values
+ header->date = (20 << 24) | (9 << 16) | 2016;
+ header->time = (9 << 8) | 56;
+ header->playtime = 0;
+}
+
+WARN_UNUSED_RESULT bool MetaEngine::readSavegameHeader(Common::InSaveFile *in, ExtendedSavegameHeader *header, bool skipThumbnail) {
+ uint oldPos = in->pos();
+
+ in->seek(-4, SEEK_END);
+
+ int headerOffset = in->readUint32LE();
+
+ // Sanity check
+ if (headerOffset >= in->pos() || headerOffset == 0) {
+ in->seek(oldPos, SEEK_SET); // Rewind the file
+ fillDummyHeader(header);
+ return false;
+ }
+
+ in->seek(headerOffset, SEEK_SET);
+
+ in->read(header->id, 6);
+
+ // Validate the header Id
+ if (strcmp(header->id, "SVMCR")) {
+ in->seek(oldPos, SEEK_SET); // Rewind the file
+ fillDummyHeader(header);
+ return false;
+ }
+
+ header->version = in->readByte();
+ header->date = in->readUint32LE();
+ header->time = in->readUint16LE();
+ header->playtime = in->readUint32LE();
+
+ if (header->version > 1)
+ header->description = in->readPascalString();
+
+ // Generate savename
+ SaveStateDescriptor desc;
+
+ parseSavegameHeader(header, &desc);
+
+ header->saveName = Common::String::format("%s %s", desc.getSaveDate().c_str(), desc.getSaveTime().c_str());
+
+ if (header->description.empty())
+ header->description = header->saveName;
+
+ // Get the thumbnail
+ if (!Graphics::loadThumbnail(*in, header->thumbnail, skipThumbnail)) {
+ in->seek(oldPos, SEEK_SET); // Rewind the file
+ return false;
+ }
+
+ in->seek(oldPos, SEEK_SET); // Rewind the file
+
+ return true;
+}
+
+
+///////////////////////////////////////
+// MetaEngine default implementations
+///////////////////////////////////////
+
+SaveStateList MetaEngine::listSaves(const char *target) const {
+ if (!hasFeature(kSavesUseExtendedFormat))
+ return SaveStateList();
+
+ Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
+ Common::StringArray filenames;
+ Common::String pattern(getSavegamePattern());
+
+ filenames = saveFileMan->listSavefiles(pattern);
+
+ SaveStateList saveList;
+ for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
+ // Obtain the last 2 digits of the filename, since they correspond to the save slot
+ int slotNum = atoi(file->c_str() + file->size() - 2);
+
+ if (slotNum >= 0 && slotNum <= getMaximumSaveSlot()) {
+ Common::ScopedPtr<Common::InSaveFile> in(saveFileMan->openForLoading(*file));
+ if (in) {
+ ExtendedSavegameHeader header;
+ if (!readSavegameHeader(in.get(), &header)) {
+ continue;
+ }
+
+ SaveStateDescriptor desc;
+
+ parseSavegameHeader(&header, &desc);
+
+ desc.setSaveSlot(slotNum);
+
+ saveList.push_back(desc);
+ }
+ }
+ }
+
+ // Sort saves based on slot number.
+ Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
+ return saveList;
+}
+
+void MetaEngine::removeSaveState(const char *target, int slot) const {
+ if (!hasFeature(kSavesUseExtendedFormat))
+ return;
+
+ g_system->getSavefileManager()->removeSavefile(getSavegameFile(slot, target));
+}
+
+SaveStateDescriptor MetaEngine::querySaveMetaInfos(const char *target, int slot) const {
+ if (!hasFeature(kSavesUseExtendedFormat))
+ return SaveStateDescriptor();
+
+ Common::ScopedPtr<Common::InSaveFile> f(g_system->getSavefileManager()->openForLoading(
+ getSavegameFile(slot)));
+
+ if (f) {
+ ExtendedSavegameHeader header;
+ if (!readSavegameHeader(f.get(), &header, false)) {
+ return SaveStateDescriptor();
+ }
+
+ // Create the return descriptor
+ SaveStateDescriptor desc;
+
+ parseSavegameHeader(&header, &desc);
+
+ desc.setSaveSlot(slot);
+ desc.setThumbnail(header.thumbnail);
+
+ return desc;
+ }
+
+ return SaveStateDescriptor();
+}
diff --git a/engines/metaengine.h b/engines/metaengine.h
index 8853d65..dfe882a 100644
--- a/engines/metaengine.h
+++ b/engines/metaengine.h
@@ -37,7 +37,14 @@ class OSystem;
namespace Common {
class FSList;
+class OutSaveFile;
class String;
+
+typedef SeekableReadStream InSaveFile;
+}
+
+namespace Graphics {
+struct Surface;
}
/**
@@ -53,6 +60,28 @@ struct ExtraGuiOption {
typedef Common::Array<ExtraGuiOption> ExtraGuiOptions;
+#define EXTENDED_SAVE_VERSION 3
+
+struct ExtendedSavegameHeader {
+ char id[6];
+ uint8 version;
+ Common::String saveName;
+ Common::String description;
+ uint32 date;
+ uint16 time;
+ uint32 playtime;
+ Graphics::Surface *thumbnail;
+
+ ExtendedSavegameHeader() {
+ memset(id, 0, 6);
+ version = 0;
+ date = 0;
+ time = 0;
+ playtime = 0;
+ thumbnail = nullptr;
+ }
+};
+
/**
* A meta engine is essentially a factory for Engine instances with the
* added ability of listing and detecting supported games.
@@ -114,9 +143,7 @@ public:
* @param target name of a config manager target
* @return a list of save state descriptors
*/
- virtual SaveStateList listSaves(const char *target) const {
- return SaveStateList();
- }
+ virtual SaveStateList listSaves(const char *target) const;
/**
* Return a list of extra GUI options for the specified target.
@@ -161,7 +188,7 @@ public:
* @param target name of a config manager target
* @param slot slot number of the save state to be removed
*/
- virtual void removeSaveState(const char *target, int slot) const {}
+ virtual void removeSaveState(const char *target, int slot) const;
/**
* Returns meta infos from the specified save state.
@@ -172,9 +199,22 @@ public:
* @param target name of a config manager target
* @param slot slot number of the save state
*/
- virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const {
- return SaveStateDescriptor();
- }
+ virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
+
+ /**
+ * Returns name of the save file for given slot and optional target.
+ *
+ * @param saveGameIdx index of the save
+ * @param target game target. If omitted, then the engine id is used
+ */
+ virtual const char *getSavegameFile(int saveGameIdx, const char *target = nullptr) const;
+
+ /**
+ * Returns pattern for save files.
+ *
+ * @param target game target. If omitted, then the engine id is used
+ */
+ virtual const char *getSavegamePattern(const char *target = nullptr) const;
/** @name MetaEngineFeature flags */
//@{
@@ -251,7 +291,16 @@ public:
* unavailable. In that case Save/Load dialog for engine's
* games is locked during cloud saves sync.
*/
- kSimpleSavesNames
+ kSimpleSavesNames,
+
+ /**
+ * Uses default implementation of save header and thumbnail
+ * appended to the save.
+ * This flag requires the following flags to be set:
+ * kSavesSupportMetaInfo, kSavesSupportThumbnail, kSavesSupportCreationDate,
+ * kSavesSupportPlayTime
+ */
+ kSavesUseExtendedFormat
};
/**
@@ -262,6 +311,11 @@ public:
return false;
}
+ static void appendExtendedSave(Common::OutSaveFile *saveFile, uint32 playtime, Common::String desc);
+ static void parseSavegameHeader(ExtendedSavegameHeader *header, SaveStateDescriptor *desc);
+ static void fillDummyHeader(ExtendedSavegameHeader *header);
+ static WARN_UNUSED_RESULT bool readSavegameHeader(Common::InSaveFile *in, ExtendedSavegameHeader *header, bool skipThumbnail = true);
+
//@}
};
diff --git a/engines/module.mk b/engines/module.mk
index 7849c2f..e729d0b 100644
--- a/engines/module.mk
+++ b/engines/module.mk
@@ -5,6 +5,7 @@ MODULE_OBJS := \
dialogs.o \
engine.o \
game.o \
+ metaengine.o \
obsolete.o \
savestate.o
Commit: 50f964770c17880993aff1af9342f5111d75bc07
https://github.com/scummvm/scummvm/commit/50f964770c17880993aff1af9342f5111d75bc07
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Added support for extended saves
Changed paths:
engines/griffon/detection.cpp
engines/griffon/saveload.cpp
diff --git a/engines/griffon/detection.cpp b/engines/griffon/detection.cpp
index 99eab52..e19530b 100644
--- a/engines/griffon/detection.cpp
+++ b/engines/griffon/detection.cpp
@@ -59,6 +59,8 @@ public:
return "Griffon Engine";
}
+ virtual int getMaximumSaveSlot() const { return 3; }
+
virtual const char *getOriginalCopyright() const {
return "The Griffon Legend (c) 2005 Syn9 (Daniel Kennedy)";
}
@@ -68,7 +70,15 @@ public:
};
bool GriffonMetaEngine::hasFeature(MetaEngineFeature f) const {
- return false;
+ return
+ (f == kSupportsListSaves) ||
+ (f == kSupportsDeleteSave) ||
+ (f == kSavesSupportMetaInfo) ||
+ (f == kSavesSupportThumbnail) ||
+ (f == kSavesSupportCreationDate) ||
+ (f == kSavesSupportPlayTime) ||
+ (f == kSupportsLoadingDuringStartup) ||
+ (f == kSavesUseExtendedFormat);
}
bool GriffonMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
diff --git a/engines/griffon/saveload.cpp b/engines/griffon/saveload.cpp
index 7285e21..ff0ffbf 100644
--- a/engines/griffon/saveload.cpp
+++ b/engines/griffon/saveload.cpp
@@ -37,6 +37,7 @@
#include "griffon/griffon.h"
#include "common/savefile.h"
+#include "engines/metaengine.h"
namespace Griffon {
@@ -55,7 +56,7 @@ namespace Griffon {
} while(0)
Common::String GriffonEngine::makeSaveGameName(int slot) {
- return (_targetName + Common::String::format(".%02d", slot));
+ return (_targetName + Common::String::format(".s%02d", slot));
}
int GriffonEngine::loadState(int slotnum) {
@@ -248,6 +249,12 @@ int GriffonEngine::saveState(int slotnum) {
PRINT("%f", _player.spellStrength);
}
+ drawView();
+
+ Common::String desc = Common::String::format("Level: %d Map: %d", _player.level, _curMap);
+
+ MetaEngine::appendExtendedSave(file, (_secStart + _secsInGame) * 1000, desc);
+
file->finalize();
return 1; // success
Commit: 06909eb32098662a77cadd6b6ec3f19282ee8762
https://github.com/scummvm/scummvm/commit/06909eb32098662a77cadd6b6ec3f19282ee8762
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Implemented loading from launcher
Changed paths:
engines/griffon/detection.cpp
engines/griffon/griffon.cpp
engines/griffon/griffon.h
diff --git a/engines/griffon/detection.cpp b/engines/griffon/detection.cpp
index e19530b..dae37f2 100644
--- a/engines/griffon/detection.cpp
+++ b/engines/griffon/detection.cpp
@@ -81,6 +81,13 @@ bool GriffonMetaEngine::hasFeature(MetaEngineFeature f) const {
(f == kSavesUseExtendedFormat);
}
+bool Griffon::GriffonEngine::hasFeature(EngineFeature f) const {
+ return
+ (f == kSupportsRTL) ||
+ (f == kSupportsLoadingDuringRuntime) ||
+ (f == kSupportsSavingDuringRuntime);
+}
+
bool GriffonMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
if (desc)
*engine = new Griffon::GriffonEngine(syst);
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index 7632623..879b0ef 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -132,13 +132,20 @@ Common::Error GriffonEngine::run() {
_console = new Console();
initialize();
- showLogos();
+
+ if (ConfMan.hasKey("save_slot")) {
+ _saveSlot = ConfMan.getInt("save_slot");
+ loadGameState(_saveSlot);
+
+ _gameMode = kGameModeLoadGame;
+ } else {
+ showLogos();
+ _gameMode = kGameModeIntro;
+ }
if (_shouldQuit)
return Common::kNoError;
- _gameMode = kGameModeIntro;
-
while (!_shouldQuit) {
switch (_gameMode) {
case kGameModeIntro:
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index f2e397e..40d7de8 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -37,6 +37,7 @@
#define GRIFFON_GRIFFON_H
#include "common/scummsys.h"
+#include "common/error.h"
#include "common/events.h"
#include "common/random.h"
#include "engines/engine.h"
@@ -428,6 +429,17 @@ private:
void setupAudio();
void updateMusic();
+ Common::Error loadGameState(int slot) {
+ return loadPlayer(slot) ? Common::kNoError : Common::kUnknownError;
+ }
+ Common::Error saveGameState(int slot, const Common::String &description) {
+ return saveState(slot) ? Common::kNoError : Common::kUnknownError;
+ }
+
+ virtual bool canLoadGameStateCurrently() { return true; }
+ virtual bool canSaveGameStateCurrently() { return _gameMode == kGameModePlay; }
+ virtual bool hasFeature(EngineFeature f) const;
+
private:
Graphics::TransparentSurface *_video, *_videoBuffer, *_videoBuffer2, *_videoBuffer3;
Commit: 3457f67e9afc2dc6954db9d9ea1b90325762a283
https://github.com/scummvm/scummvm/commit/3457f67e9afc2dc6954db9d9ea1b90325762a283
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix loading from launcher
Changed paths:
engines/griffon/griffon.h
diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h
index 40d7de8..febc9e6 100644
--- a/engines/griffon/griffon.h
+++ b/engines/griffon/griffon.h
@@ -430,7 +430,7 @@ private:
void updateMusic();
Common::Error loadGameState(int slot) {
- return loadPlayer(slot) ? Common::kNoError : Common::kUnknownError;
+ return loadState(slot) ? Common::kNoError : Common::kUnknownError;
}
Common::Error saveGameState(int slot, const Common::String &description) {
return saveState(slot) ? Common::kNoError : Common::kUnknownError;
Commit: cc9d8b030a9ae01a358b2205dc5bc26dd3233a53
https://github.com/scummvm/scummvm/commit/cc9d8b030a9ae01a358b2205dc5bc26dd3233a53
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix random loading time
Changed paths:
engines/griffon/griffon.cpp
diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index 879b0ef..2383150 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -72,6 +72,8 @@ GriffonEngine::GriffonEngine(OSystem *syst) : Engine(syst) {
_lasty = 0;
_saveSlot = 0;
+ _ticks = g_system->getMillis();
+
for (int i = 0; i < 33; ++i) {
for (int j = 0; j < 6; ++j) {
_objectInfo[i].nFrames = 0;
Commit: 3d6e22ec37f6fc7ca98eff857da0db8a78c2bf0c
https://github.com/scummvm/scummvm/commit/3d6e22ec37f6fc7ca98eff857da0db8a78c2bf0c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix loading from GMM
Changed paths:
engines/griffon/dialogs.cpp
engines/griffon/saveload.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index c000d58..89c487c 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -638,9 +638,6 @@ void GriffonEngine::saveLoadNew() {
renderSaveStates();
} else if ((curCol == 2) && loadState(curRow - 1)) {
- _saveSlot = curRow - 1;
-
- _gameMode = kGameModeLoadGame;
return;
}
diff --git a/engines/griffon/saveload.cpp b/engines/griffon/saveload.cpp
index ff0ffbf..3052005 100644
--- a/engines/griffon/saveload.cpp
+++ b/engines/griffon/saveload.cpp
@@ -123,6 +123,9 @@ int GriffonEngine::loadState(int slotnum) {
INPUT("%f", &_player.spellStrength);
+ _saveSlot = slotnum;
+ _gameMode = kGameModeLoadGame;
+
return 1; // success
}
Commit: 7772850f300a41209c007c3d6bf577e0df50fc0d
https://github.com/scummvm/scummvm/commit/7772850f300a41209c007c3d6bf577e0df50fc0d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-13T22:07:08+01:00
Commit Message:
GRIFFON: Fix GMM loading from options and title
Changed paths:
engines/griffon/dialogs.cpp
diff --git a/engines/griffon/dialogs.cpp b/engines/griffon/dialogs.cpp
index 89c487c..847377a 100644
--- a/engines/griffon/dialogs.cpp
+++ b/engines/griffon/dialogs.cpp
@@ -211,7 +211,7 @@ void GriffonEngine::title(int mode) {
}
g_system->delayMillis(10);
- } while (!_shouldQuit && !exitTitle);
+ } while (!_shouldQuit && !exitTitle && _gameMode != kGameModeNewGame && _gameMode != kGameModeLoadGame);
_itemTicks = _ticks + 210;
@@ -464,7 +464,7 @@ void GriffonEngine::configMenu() {
g_system->updateScreen();
g_system->delayMillis(10);
- } while (!_shouldQuit && !exitMenu);
+ } while (!_shouldQuit && !exitMenu && _gameMode != kGameModeNewGame && _gameMode != kGameModeLoadGame);
_cloudImg->setAlpha(64, true);
More information about the Scummvm-git-logs
mailing list