2011-08-24 14:14:44 +02:00
|
|
|
/*
|
|
|
|
Copyright (C) 2003 Parallel Realities
|
2015-03-01 21:37:32 +01:00
|
|
|
Copyright (C) 2011 Guus Sliepen
|
2019-05-22 00:47:32 +02:00
|
|
|
Copyright (C) 2015-2019 Julie Marchant <onpon4@riseup.net>
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
2015-02-26 17:20:36 +01:00
|
|
|
as published by the Free Software Foundation; either version 3
|
2011-08-24 14:14:44 +02:00
|
|
|
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
|
2015-02-26 17:20:36 +01:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2015-02-26 17:20:36 +01:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2011-08-24 14:14:44 +02:00
|
|
|
*/
|
|
|
|
|
2015-09-26 14:49:21 +02:00
|
|
|
#ifndef GFX_H
|
|
|
|
#define GFX_H
|
|
|
|
|
2016-11-26 00:21:31 +01:00
|
|
|
#include "SDL.h"
|
|
|
|
|
2019-06-04 03:05:38 +02:00
|
|
|
#ifndef NOFONT
|
|
|
|
#include "SDL_ttf.h"
|
|
|
|
#endif
|
|
|
|
|
2016-11-26 00:21:31 +01:00
|
|
|
#include "defs.h"
|
|
|
|
#include "structs.h"
|
2015-03-04 15:11:04 +01:00
|
|
|
|
2019-05-30 22:46:55 +02:00
|
|
|
extern SDL_Surface *gfx_unscaledBackground;
|
2015-11-07 01:43:34 +01:00
|
|
|
extern SDL_Surface *gfx_background;
|
Fixed more magic numbers.
God, this one was definitely the biggest headache of all of the
magic number erasing. Never did I expect such cryptic problems.
The first problem was that the entirety of the player's weapon
struct was a part of the save file, *including the weapon's "image
indexes"*. Since the indexes have been changed, and the originally
used one is now unavailable when it's requested, this was causing
a segfault later on. Had to fix this by setting the image index
when the game is loaded.
The second problem was related to another bug I've been confused
about for years: the one that causes mobile rays to fire 5 green
shots. The entire reason those shots were green was because
the weapon's image indexes were undefined, and *that was causing
them to default to 0*. 0 was simply the index of green plasma.
Of course, though, now attempting to use that image causes a
segfault, so for now, I've fixed this by changing the image index
of the mobile rays to the red plasma bolts.
There are still some magic numbers left, related to the intermission
screen. But the hardest part is now done, thank God.
2016-01-06 04:12:29 +01:00
|
|
|
extern SDL_Surface *gfx_sprites[SP_MAX];
|
2016-01-04 15:07:30 +01:00
|
|
|
extern SDL_Surface *gfx_faceSprites[FS_MAX];
|
2016-01-04 22:34:29 +01:00
|
|
|
extern SDL_Surface *gfx_shipSprites[SS_MAX];
|
Fixed more magic numbers.
God, this one was definitely the biggest headache of all of the
magic number erasing. Never did I expect such cryptic problems.
The first problem was that the entirety of the player's weapon
struct was a part of the save file, *including the weapon's "image
indexes"*. Since the indexes have been changed, and the originally
used one is now unavailable when it's requested, this was causing
a segfault later on. Had to fix this by setting the image index
when the game is loaded.
The second problem was related to another bug I've been confused
about for years: the one that causes mobile rays to fire 5 green
shots. The entire reason those shots were green was because
the weapon's image indexes were undefined, and *that was causing
them to default to 0*. 0 was simply the index of green plasma.
Of course, though, now attempting to use that image causes a
segfault, so for now, I've fixed this by changing the image index
of the mobile rays to the red plasma bolts.
There are still some magic numbers left, related to the intermission
screen. But the hardest part is now done, thank God.
2016-01-06 04:12:29 +01:00
|
|
|
extern SDL_Surface *gfx_fontSprites[FONT_MAX];
|
2016-01-05 04:25:00 +01:00
|
|
|
extern SDL_Surface *gfx_shopSprites[SHOP_S_MAX];
|
2016-11-26 00:35:25 +01:00
|
|
|
extern TextObject gfx_textSprites[TS_MAX];
|
2016-01-04 04:39:16 +01:00
|
|
|
extern SDL_Surface *gfx_messageBox;
|
2011-08-26 23:53:46 +02:00
|
|
|
|
2019-06-04 03:05:38 +02:00
|
|
|
#ifndef NOFONT
|
|
|
|
extern TTF_Font *gfx_unicodeFont;
|
|
|
|
#endif
|
|
|
|
|
2015-09-26 14:49:21 +02:00
|
|
|
void gfx_init();
|
|
|
|
SDL_Surface *gfx_setTransparent(SDL_Surface *sprite);
|
|
|
|
void gfx_blit(SDL_Surface *image, int x, int y, SDL_Surface *dest);
|
2015-11-04 02:26:56 +01:00
|
|
|
int gfx_renderString(const char *in, int x, int y, int fontColor, int wrap, SDL_Surface *dest);
|
2019-06-04 03:05:38 +02:00
|
|
|
int gfx_renderUnicode(const char *in, int x, int y, int fontColor, int wrap, SDL_Surface *dest);
|
2015-11-07 03:35:07 +01:00
|
|
|
void gfx_putPixel(SDL_Surface *surface, int x, int y, Uint32 pixel);
|
2015-11-20 20:11:12 +01:00
|
|
|
void gfx_drawCircle(int xc, int yc, int R, SDL_Surface *PIX, int col);
|
2015-12-31 16:47:27 +01:00
|
|
|
void gfx_drawRect(SDL_Surface *dest, int x, int y, int w, int h, Uint8 red, Uint8 green, Uint8 blue);
|
|
|
|
SDL_Surface *gfx_createSurface(int width, int height);
|
|
|
|
SDL_Surface *gfx_createTextSurface(const char *inString, int color);
|
|
|
|
void gfx_createTextObject(int index, const char *inString, int x, int y, int fontColor);
|
2016-01-02 22:59:48 +01:00
|
|
|
SDL_Surface *gfx_createAlphaRect(int width, int height, Uint8 red, Uint8 green, Uint8 blue);
|
2016-01-07 02:35:37 +01:00
|
|
|
void gfx_createMessageBox(SDL_Surface *face, const char *message, int transparent);
|
2016-01-02 22:59:48 +01:00
|
|
|
SDL_Surface *gfx_loadImage(const char *filename);
|
|
|
|
void gfx_free();
|
2019-05-30 22:46:55 +02:00
|
|
|
void gfx_scaleBackground();
|
2016-11-25 18:50:32 +01:00
|
|
|
void gfx_loadBackground(const char *filename);
|
|
|
|
void gfx_loadSprites();
|
|
|
|
void gfx_loadFont();
|
2015-03-04 15:11:04 +01:00
|
|
|
|
|
|
|
#endif
|