From 7ef71a98c28e7c58299eb51f9c4d953099b5ac5c Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 28 Dec 2018 18:10:12 +0100 Subject: GRIFFON: Get rid of engine.h --- engines/griffon/config.h | 4 +- engines/griffon/engine.cpp | 111 ++++++++--------- engines/griffon/engine.h | 281 -------------------------------------------- engines/griffon/griffon.cpp | 1 - engines/griffon/griffon.h | 250 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 304 insertions(+), 343 deletions(-) delete mode 100644 engines/griffon/engine.h (limited to 'engines') diff --git a/engines/griffon/config.h b/engines/griffon/config.h index 776591837f..78a7b1bd17 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 03864b0404..07e1424854 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 23ef832fb3..0000000000 --- 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 ba60fdbcac..e31c7a3249 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 dc250fdffb..3704d321bb 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(); }; } -- cgit v1.2.3