More cleanup.
This commit is contained in:
parent
0f10c6d5c7
commit
c68cb3f920
2
Makefile
2
Makefile
|
@ -1,7 +1,7 @@
|
|||
CXXFLAGS ?= -O2 -Wall -g
|
||||
CXXFLAGS += `pkg-config --cflags sdl2 SDL2_image SDL2_mixer`
|
||||
LIBS = `pkg-config --libs sdl2 SDL2_image SDL2_mixer`
|
||||
OBJS = alien.o audio.o bullet.o cargo.o collectable.o colors.o engine.o explosion.o game.o graphics.o init.o intermission.o loadSave.o messages.o misc.o missions.o player.o resources.o script.o ship.o shop.o Starfighter.o title.o weapons.o
|
||||
OBJS = alien.o audio.o bullet.o cargo.o collectable.o colors.o engine.o explosion.o game.o gfx.o init.o intermission.o loadSave.o messages.o misc.o missions.o player.o resources.o screen.o script.o ship.o shop.o Starfighter.o title.o weapons.o
|
||||
|
||||
VERSION = 1.4.1-dev
|
||||
PROG = starfighter
|
||||
|
|
|
@ -80,7 +80,7 @@ int main(int argc, char **argv)
|
|||
|
||||
atexit(cleanUp);
|
||||
|
||||
initGraphics();
|
||||
gfx_init();
|
||||
initSystem(); // Opens video mode and sound
|
||||
loadFont();
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "engine.h"
|
||||
#include "explosion.h"
|
||||
#include "game.h"
|
||||
#include "graphics.h"
|
||||
#include "gfx.h"
|
||||
#include "init.h"
|
||||
#include "intermission.h"
|
||||
#include "loadSave.h"
|
||||
|
@ -53,6 +53,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "missions.h"
|
||||
#include "player.h"
|
||||
#include "resources.h"
|
||||
#include "screen.h"
|
||||
#include "script.h"
|
||||
#include "ship.h"
|
||||
#include "shop.h"
|
||||
|
|
32
src/game.cpp
32
src/game.cpp
|
@ -211,7 +211,7 @@ void game_doStars()
|
|||
r.w = 1;
|
||||
r.h = 1;
|
||||
|
||||
addBuffer(r.x, r.y, r.w, r.h);
|
||||
gfx_addBuffer(r.x, r.y, r.w, r.h);
|
||||
}
|
||||
|
||||
if (SDL_MUSTLOCK(screen))
|
||||
|
@ -244,7 +244,7 @@ static void game_doCollectables()
|
|||
(collectable->x < screen->w) &&
|
||||
(collectable->y + collectable->image->h > 0) &&
|
||||
(collectable->y < screen->h))
|
||||
blit(collectable->image, (int)collectable->x, (int)collectable->y);
|
||||
screen_blit(collectable->image, (int)collectable->x, (int)collectable->y);
|
||||
|
||||
collectable->x += engine.ssx + engine.smx;
|
||||
collectable->y += engine.ssy + engine.smy;
|
||||
|
@ -528,7 +528,7 @@ static void game_doBullets()
|
|||
|
||||
if ((bullet->flags & WF_AIMED))
|
||||
{
|
||||
blit(bullet->image[0], (int)(bullet->x - bullet->dx),
|
||||
screen_blit(bullet->image[0], (int)(bullet->x - bullet->dx),
|
||||
(int)(bullet->y - bullet->dy));
|
||||
}
|
||||
|
||||
|
@ -540,13 +540,13 @@ static void game_doBullets()
|
|||
charger_num = bullet->damage * 2;
|
||||
|
||||
for (int i = 0 ; i < charger_num ; i++)
|
||||
blit(bullet->image[0],
|
||||
screen_blit(bullet->image[0],
|
||||
(int)(bullet->x - RANDRANGE(
|
||||
-(charger_num / 6), charger_num / 6)),
|
||||
(int)(bullet->y + RANDRANGE(-3, 3)));
|
||||
}
|
||||
|
||||
blit(bullet->image[0], (int)bullet->x, (int)bullet->y);
|
||||
screen_blit(bullet->image[0], (int)bullet->x, (int)bullet->y);
|
||||
bullet->x += bullet->dx;
|
||||
bullet->y += bullet->dy;
|
||||
|
||||
|
@ -1083,7 +1083,7 @@ static void game_doAliens()
|
|||
(aliens[i].classDef != CD_ASTEROID2))
|
||||
explosion_addEngine(&aliens[i]);
|
||||
if ((!(aliens[i].flags & FL_ISCLOAKED)) || (aliens[i].hit > 0))
|
||||
blit(shipShape[shapeToUse], (int)aliens[i].x,
|
||||
screen_blit(shipShape[shapeToUse], (int)aliens[i].x,
|
||||
(int)aliens[i].y);
|
||||
if (aliens[i].flags & FL_DISABLED)
|
||||
{
|
||||
|
@ -1103,7 +1103,7 @@ static void game_doAliens()
|
|||
if ((aliens[i].x > 0) && (aliens[i].x < screen->w) &&
|
||||
(aliens[i].y > 0) && (aliens[i].y < screen->h))
|
||||
{
|
||||
blit(aliens[i].image[aliens[i].face], (int)aliens[i].x,
|
||||
screen_blit(aliens[i].image[aliens[i].face], (int)aliens[i].x,
|
||||
(int)aliens[i].y);
|
||||
explosion_add(aliens[i].x + (rand() % aliens[i].image[0]->w),
|
||||
aliens[i].y + (rand() % aliens[i].image[0]->h),
|
||||
|
@ -1393,7 +1393,7 @@ static void game_doPlayer()
|
|||
|
||||
LIMIT_ADD(player.hit, -1, 0, 100);
|
||||
|
||||
blit(shipShape[shapeToUse], (int)player.x, (int)player.y);
|
||||
screen_blit(shipShape[shapeToUse], (int)player.x, (int)player.y);
|
||||
if ((player.maxShield > 1) && (player.shield <= engine.lowShield) &&
|
||||
(rand() % 5 < 1))
|
||||
explosion_add(player.x + RANDRANGE(-10, 10),
|
||||
|
@ -1463,7 +1463,7 @@ static void game_doCargo()
|
|||
continue;
|
||||
}
|
||||
|
||||
blit(cargo[i].image[0], (int)cargo[i].x, (int)cargo[i].y);
|
||||
screen_blit(cargo[i].image[0], (int)cargo[i].x, (int)cargo[i].y);
|
||||
|
||||
cargo[i].x += engine.ssx + engine.smx;
|
||||
cargo[i].y += engine.ssy + engine.smy;
|
||||
|
@ -1479,7 +1479,7 @@ static void game_doCargo()
|
|||
// draw the chain link line
|
||||
for (int j = 0 ; j < 10 ; j++)
|
||||
{
|
||||
blit(shape[30], (int)chainX, (int)chainY);
|
||||
screen_blit(shape[30], (int)chainX, (int)chainY);
|
||||
chainX -= dx;
|
||||
chainY -= dy;
|
||||
}
|
||||
|
@ -1545,7 +1545,7 @@ void game_doExplosions()
|
|||
explosion->x += engine.ssx + engine.smx;
|
||||
explosion->y += engine.ssy + engine.smy;
|
||||
|
||||
blit(explosion->image[0], (int)explosion->x, (int)explosion->y);
|
||||
screen_blit(explosion->image[0], (int)explosion->x, (int)explosion->y);
|
||||
|
||||
if(rand() % 7 == 0)
|
||||
{
|
||||
|
@ -1610,7 +1610,7 @@ static void game_doArrow(int i)
|
|||
y -= y > screen->h / 2 ? shape[arrow]->h : 0;
|
||||
}
|
||||
|
||||
blit(shape[arrow], x, y);
|
||||
screen_blit(shape[arrow], x, y);
|
||||
|
||||
if (i != engine.targetIndex)
|
||||
return;
|
||||
|
@ -1626,7 +1626,7 @@ static void game_doArrow(int i)
|
|||
y -= y > screen->h / 2 ? 5 + shape[44]->h : -5 - shape[arrow]->h;
|
||||
}
|
||||
|
||||
blit(shape[44], x, y);
|
||||
screen_blit(shape[44], x, y);
|
||||
}
|
||||
|
||||
static void game_doHud()
|
||||
|
@ -1636,8 +1636,8 @@ static void game_doHud()
|
|||
signed char fontColor;
|
||||
char text[25];
|
||||
|
||||
addBuffer(0, 20, 800, 25);
|
||||
addBuffer(0, 550, 800, 34);
|
||||
gfx_addBuffer(0, 20, 800, 25);
|
||||
gfx_addBuffer(0, 550, 800, 34);
|
||||
|
||||
if (engine.minutes > -1)
|
||||
{
|
||||
|
@ -1785,7 +1785,7 @@ static void game_doHud()
|
|||
// Show the radio message if there is one
|
||||
if (textShape[3].life > 0)
|
||||
{
|
||||
blit(messageBox, (800 - messageBox->w) / 2, 50);
|
||||
screen_blit(messageBox, (800 - messageBox->w) / 2, 50);
|
||||
textShape[3].life--;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ static int thirds;
|
|||
SDL_Window *window;
|
||||
SDL_Renderer *renderer;
|
||||
SDL_Texture *texture;
|
||||
SDL_Surface *screen, *background;
|
||||
SDL_Surface *background;
|
||||
SDL_Surface *shape[MAX_SHAPES];
|
||||
SDL_Surface *shipShape[MAX_SHIPSHAPES];
|
||||
SDL_Surface *fontShape[MAX_FONTSHAPES];
|
||||
|
@ -37,7 +37,7 @@ bRect *bufferTail;
|
|||
textObject textShape[MAX_TEXTSHAPES];
|
||||
SDL_Surface *messageBox;
|
||||
|
||||
void initGraphics()
|
||||
void gfx_init()
|
||||
{
|
||||
bufferHead = new bRect;
|
||||
bufferHead->next = NULL;
|
||||
|
@ -66,13 +66,13 @@ void initGraphics()
|
|||
screen = NULL;
|
||||
}
|
||||
|
||||
SDL_Surface *setTransparent(SDL_Surface *sprite)
|
||||
SDL_Surface *gfx_setTransparent(SDL_Surface *sprite)
|
||||
{
|
||||
SDL_SetColorKey(sprite, SDL_TRUE, SDL_MapRGB(sprite->format, 0, 0, 0));
|
||||
return sprite;
|
||||
}
|
||||
|
||||
void addBuffer(int x, int y, int w, int h)
|
||||
void gfx_addBuffer(int x, int y, int w, int h)
|
||||
{
|
||||
bRect *rect = new bRect;
|
||||
|
||||
|
@ -86,7 +86,7 @@ void addBuffer(int x, int y, int w, int h)
|
|||
bufferTail = rect;
|
||||
}
|
||||
|
||||
void blit(SDL_Surface *image, int x, int y, SDL_Surface *dest)
|
||||
void gfx_blit(SDL_Surface *image, int x, int y, SDL_Surface *dest)
|
||||
{
|
||||
// Exit early if image is not on dest at all
|
||||
if (x + image->w < 0 || x >= dest->w || y + image->h < 0 || y >= dest->h)
|
||||
|
@ -109,17 +109,12 @@ void blit(SDL_Surface *image, int x, int y, SDL_Surface *dest)
|
|||
|
||||
// Only if it is to the screen, mark the region as damaged
|
||||
if (dest == screen)
|
||||
addBuffer(blitRect.x, blitRect.y, blitRect.w, blitRect.h);
|
||||
}
|
||||
|
||||
void blit(SDL_Surface *image, int x, int y)
|
||||
{
|
||||
blit(image, x, y, screen);
|
||||
gfx_addBuffer(blitRect.x, blitRect.y, blitRect.w, blitRect.h);
|
||||
}
|
||||
|
||||
void blitText(int i)
|
||||
{
|
||||
blit(textShape[i].image, (int)textShape[i].x, (int)textShape[i].y, screen);
|
||||
screen_blit(textShape[i].image, (int)textShape[i].x, (int)textShape[i].y);
|
||||
}
|
||||
|
||||
void flushBuffer()
|
||||
|
@ -278,7 +273,7 @@ Draws the background surface that has been loaded
|
|||
*/
|
||||
void drawBackGround()
|
||||
{
|
||||
blit(background, 0, 0, screen);
|
||||
screen_blit(background, 0, 0);
|
||||
}
|
||||
|
||||
void clearScreen(Uint32 color)
|
||||
|
@ -496,7 +491,7 @@ SDL_Surface *textSurface(const char *inString, int color)
|
|||
|
||||
drawString(inString, 1, 1, color, surface);
|
||||
|
||||
return setTransparent(surface);
|
||||
return gfx_setTransparent(surface);
|
||||
}
|
||||
|
||||
void textSurface(int index, const char *inString, int x, int y, int fontColor)
|
||||
|
@ -552,7 +547,7 @@ void createMessageBox(SDL_Surface *face, const char *message, signed char transp
|
|||
if (face != NULL)
|
||||
{
|
||||
blevelRect(messageBox, 0, 0, messageBox->w - 1, messageBox->h - 1, 0x00, 0x00, 0xaa);
|
||||
blit(face, 5, 5, messageBox);
|
||||
gfx_blit(face, 5, 5, messageBox);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -628,5 +623,5 @@ SDL_Surface *loadImage(const char *filename)
|
|||
newImage = image;
|
||||
}
|
||||
|
||||
return setTransparent(newImage);
|
||||
return gfx_setTransparent(newImage);
|
||||
}
|
|
@ -17,13 +17,15 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRAPHICS_H
|
||||
#define GRAPHICS_H
|
||||
#ifndef GFX_H
|
||||
#define GFX_H
|
||||
|
||||
#include "Starfighter.h"
|
||||
|
||||
extern SDL_Window *window;
|
||||
extern SDL_Renderer *renderer;
|
||||
extern SDL_Texture *texture;
|
||||
extern SDL_Surface *screen, *background;
|
||||
extern SDL_Surface *background;
|
||||
extern SDL_Surface *shape[MAX_SHAPES];
|
||||
extern SDL_Surface *shipShape[MAX_SHIPSHAPES];
|
||||
extern SDL_Surface *fontShape[MAX_FONTSHAPES];
|
||||
|
@ -34,11 +36,10 @@ extern textObject textShape[MAX_TEXTSHAPES];
|
|||
extern SDL_Surface *messageBox;
|
||||
|
||||
|
||||
extern void initGraphics();
|
||||
extern SDL_Surface *setTransparent(SDL_Surface *sprite);
|
||||
extern void addBuffer(int x, int y, int w, int h);
|
||||
extern void blit(SDL_Surface *image, int x, int y, SDL_Surface *dest);
|
||||
extern void blit(SDL_Surface *image, int x, int y);
|
||||
void gfx_init();
|
||||
SDL_Surface *gfx_setTransparent(SDL_Surface *sprite);
|
||||
void gfx_addBuffer(int x, int y, int w, int h);
|
||||
void gfx_blit(SDL_Surface *image, int x, int y, SDL_Surface *dest);
|
||||
extern void blitText(int i);
|
||||
extern void flushBuffer();
|
||||
extern void unBuffer();
|
|
@ -28,7 +28,7 @@ static void intermission_doCursor()
|
|||
|
||||
LIMIT(engine.cursor_x, 10, screen->w - 10 - shape[0]->w);
|
||||
LIMIT(engine.cursor_y, 10, screen->h - 10 - shape[0]->h);
|
||||
blit(shape[0], engine.cursor_x, engine.cursor_y);
|
||||
screen_blit(shape[0], engine.cursor_x, engine.cursor_y);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -247,7 +247,7 @@ static bool intermission_showSystem(float x, float y, bool selectable)
|
|||
bool rtn = false;
|
||||
|
||||
// Blit the sun
|
||||
blit(shape[30], 370, 220);
|
||||
screen_blit(shape[30], 370, 220);
|
||||
|
||||
for (int i = 50 ; i < 300 ; i+= planetSpace)
|
||||
{
|
||||
|
@ -263,7 +263,7 @@ static bool intermission_showSystem(float x, float y, bool selectable)
|
|||
|
||||
r.x -= (systemPlanet[planet].image->w / 2);
|
||||
r.y -= (systemPlanet[planet].image->h / 2);
|
||||
blit(systemPlanet[planet].image, r.x, r.y);
|
||||
screen_blit(systemPlanet[planet].image, r.x, r.y);
|
||||
|
||||
if (selectable &&
|
||||
game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6,
|
||||
|
@ -316,7 +316,7 @@ static void intermission_showStatus(SDL_Surface *infoSurface)
|
|||
else if(engine.keyState[KEY_UP])
|
||||
speed = -1;
|
||||
|
||||
blit(infoSurface, 100, 80);
|
||||
screen_blit(infoSurface, 100, 80);
|
||||
|
||||
for (int i = 0 ; i < 22 ; i++)
|
||||
{
|
||||
|
@ -353,7 +353,7 @@ static void intermission_updateCommsSurface(SDL_Surface *comms)
|
|||
char string[255];
|
||||
|
||||
blevelRect(comms, 0, 10, comms->w - 1, 55, 0x00, 0x22, 0x00);
|
||||
blit(shape[FACE_CHRIS], 20, 15, comms);
|
||||
gfx_blit(shape[FACE_CHRIS], 20, 15, comms);
|
||||
drawString("Chris Bainfield", 80, 15, FONT_WHITE, comms);
|
||||
sprintf(string, "Current Location: %s", systemPlanet[game.stationedPlanet].name);
|
||||
drawString(string, 80, 35, FONT_WHITE, comms);
|
||||
|
@ -375,7 +375,7 @@ static void intermission_createCommsSurface(SDL_Surface *comms)
|
|||
{
|
||||
yOffset = systemPlanet[i].messageSlot * 60;
|
||||
blevelRect(comms, 0, 105 + yOffset, comms->w - 1, 55, 0x00, 0x00, 0x77);
|
||||
blit(shape[systemPlanet[i].faceImage], 20, 110 + yOffset, comms);
|
||||
gfx_blit(shape[systemPlanet[i].faceImage], 20, 110 + yOffset, comms);
|
||||
drawString(systemPlanet[i].from, 80, 110 + yOffset, FONT_WHITE, comms);
|
||||
drawString(systemPlanet[i].subject, 80, 130 + yOffset, FONT_CYAN, comms);
|
||||
drawString("INCOMPLETE", 350, 110 + yOffset, FONT_RED, comms);
|
||||
|
@ -426,7 +426,7 @@ static void intermission_createMissionDetailSurface(SDL_Surface *comms, int miss
|
|||
faceNumber = getFace(string);
|
||||
if (faceNumber > -1)
|
||||
{
|
||||
blit(shape[faceNumber], 10, y, comms);
|
||||
gfx_blit(shape[faceNumber], 10, y, comms);
|
||||
col = FONT_WHITE;
|
||||
}
|
||||
else
|
||||
|
@ -758,7 +758,7 @@ int intermission()
|
|||
engine.ssy /= 100;
|
||||
}
|
||||
|
||||
blit(iconInfo[8].image, (int)iconInfo[8].x, 15);
|
||||
screen_blit(iconInfo[8].image, (int)iconInfo[8].x, 15);
|
||||
|
||||
switch(section)
|
||||
{
|
||||
|
@ -823,9 +823,9 @@ int intermission()
|
|||
}
|
||||
}
|
||||
|
||||
blit(iconInfo[9].image, 90, 450);
|
||||
screen_blit(iconInfo[9].image, 90, 450);
|
||||
if ((game.system > 0) && (game.stationedPlanet != game.destinationPlanet))
|
||||
blit(iconInfo[10].image, 550, 450);
|
||||
screen_blit(iconInfo[10].image, 550, 450);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
@ -833,7 +833,7 @@ int intermission()
|
|||
break;
|
||||
|
||||
case 3:
|
||||
blit(savesSurface, 200, 100);
|
||||
screen_blit(savesSurface, 200, 100);
|
||||
saveSlot = showSaveSlots(savesSurface, saveSlot);
|
||||
break;
|
||||
|
||||
|
@ -842,12 +842,12 @@ int intermission()
|
|||
break;
|
||||
|
||||
case 5:
|
||||
blit(commsSurface, 170, 70);
|
||||
screen_blit(commsSurface, 170, 70);
|
||||
intermission_doComms(commsSurface);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
blit(optionsSurface, 230, 130);
|
||||
screen_blit(optionsSurface, 230, 130);
|
||||
intermission_doOptions(optionsSurface);
|
||||
break;
|
||||
|
||||
|
@ -859,10 +859,10 @@ int intermission()
|
|||
case 8:
|
||||
intermission_showSystem(sinX, cosY, false);
|
||||
|
||||
blit(systemPlanet[game.stationedPlanet].image, 150, 450);
|
||||
blit(iconInfo[9].image, 135, 480);
|
||||
blit(systemPlanet[game.destinationPlanet].image, 650, 450);
|
||||
blit(iconInfo[10].image, 635, 480);
|
||||
screen_blit(systemPlanet[game.stationedPlanet].image, 150, 450);
|
||||
screen_blit(iconInfo[9].image, 135, 480);
|
||||
screen_blit(systemPlanet[game.destinationPlanet].image, 650, 450);
|
||||
screen_blit(iconInfo[10].image, 635, 480);
|
||||
|
||||
destRect.w += distance;
|
||||
SDL_FillRect(screen, &destRect, red);
|
||||
|
@ -897,7 +897,7 @@ int intermission()
|
|||
break;
|
||||
}
|
||||
|
||||
addBuffer(300, 545, 200, 15);
|
||||
gfx_addBuffer(300, 545, 200, 15);
|
||||
|
||||
if (section != 8)
|
||||
{
|
||||
|
@ -911,27 +911,27 @@ int intermission()
|
|||
(systemPlanet[game.stationedPlanet].missionCompleted != 0))
|
||||
continue;
|
||||
else if (game.stationedPlanet == game.destinationPlanet)
|
||||
blit(shape[1], 80 + (i * 90), 500);
|
||||
screen_blit(shape[1], 80 + (i * 90), 500);
|
||||
else if (game.stationedPlanet != game.destinationPlanet)
|
||||
blit(shape[26], 80 + (i * 90), 500);
|
||||
screen_blit(shape[26], 80 + (i * 90), 500);
|
||||
}
|
||||
else
|
||||
{
|
||||
blit(shape[i + 1], 80 + (i * 90), 500);
|
||||
screen_blit(shape[i + 1], 80 + (i * 90), 500);
|
||||
}
|
||||
|
||||
if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 80 + (i * 90), 500, 32, 32))
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
blit(iconInfo[i].image, (int)iconInfo[i].x, 545);
|
||||
screen_blit(iconInfo[i].image, (int)iconInfo[i].x, 545);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (game.stationedPlanet == game.destinationPlanet)
|
||||
blit(iconInfo[0].image, (int)iconInfo[i].x, 545);
|
||||
screen_blit(iconInfo[0].image, (int)iconInfo[i].x, 545);
|
||||
else
|
||||
blit(iconInfo[11].image, (int)iconInfo[i].x, 545);
|
||||
screen_blit(iconInfo[11].image, (int)iconInfo[i].x, 545);
|
||||
}
|
||||
|
||||
if ((engine.keyState[KEY_FIRE]))
|
||||
|
|
|
@ -82,7 +82,7 @@ void loadGameGraphics()
|
|||
shipShape[i] = createSurface(shipShape[i - SHIP_HIT_INDEX]->w,
|
||||
shipShape[i - SHIP_HIT_INDEX]->h);
|
||||
SDL_SetSurfaceBlendMode(shipShape[i - SHIP_HIT_INDEX], SDL_BLENDMODE_NONE);
|
||||
blit(shipShape[i - SHIP_HIT_INDEX], 0, 0, shipShape[i]);
|
||||
gfx_blit(shipShape[i - SHIP_HIT_INDEX], 0, 0, shipShape[i]);
|
||||
SDL_SetSurfaceBlendMode(shipShape[i - SHIP_HIT_INDEX], SDL_BLENDMODE_BLEND);
|
||||
|
||||
switch (shipShape[i]->format->BitsPerPixel)
|
||||
|
@ -191,7 +191,7 @@ void loadFont()
|
|||
|
||||
newImage = SDL_ConvertSurface(image, screen->format, 0);
|
||||
|
||||
fontShape[i] = setTransparent(newImage);
|
||||
fontShape[i] = gfx_setTransparent(newImage);
|
||||
|
||||
SDL_FreeSurface(image);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012, 2013 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
|
||||
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 3
|
||||
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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
#include "gfx.h"
|
||||
|
||||
SDL_Surface *screen;
|
||||
|
||||
void screen_blit(SDL_Surface *image, int x, int y)
|
||||
{
|
||||
gfx_blit(image, x, y, screen);
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
|
||||
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 3
|
||||
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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SCREEN_H
|
||||
#define SCREEN_H
|
||||
|
||||
extern SDL_Surface *screen;
|
||||
|
||||
void screen_blit(SDL_Surface *image, int x, int y);
|
||||
|
||||
#endif
|
|
@ -262,7 +262,7 @@ void doCutscene(int scene)
|
|||
aliens[i].x += aliens[i].dx;
|
||||
aliens[i].y += aliens[i].dy;
|
||||
aliens[i].x += engine.ssx + engine.smx;
|
||||
blit(aliens[i].image[0], (int)aliens[i].x, (int)aliens[i].y);
|
||||
screen_blit(aliens[i].image[0], (int)aliens[i].x, (int)aliens[i].y);
|
||||
if (aliens[i].x > (screen->w + 50))
|
||||
{
|
||||
aliens[i].x = -50;
|
||||
|
@ -299,7 +299,7 @@ void doCutscene(int scene)
|
|||
}
|
||||
|
||||
if ((showMessage) && (messageBox != NULL))
|
||||
blit(messageBox, (screen->w - messageBox->w) / 2, screen->h - 100);
|
||||
screen_blit(messageBox, (screen->w - messageBox->w) / 2, screen->h - 100);
|
||||
|
||||
drawString("Press [Escape] to skip", -1, 580, FONT_WHITE);
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ void ship_fireRay(object *ship)
|
|||
|
||||
int red = SDL_MapRGB(screen->format, rand() % 256, 0x00, 0x00);
|
||||
SDL_FillRect(screen, &ray, red);
|
||||
addBuffer(ray.x, ray.y, ray.w, ray.h);
|
||||
gfx_addBuffer(ray.x, ray.y, ray.w, ray.h);
|
||||
|
||||
if (ship != &player)
|
||||
{
|
||||
|
|
20
src/shop.cpp
20
src/shop.cpp
|
@ -246,7 +246,7 @@ static void drawShop()
|
|||
|
||||
for (int i = 0 ; i < icons ; i++)
|
||||
{
|
||||
blit(shape[shopItems[i].image], shopItems[i].x - 90,
|
||||
gfx_blit(shape[shopItems[i].image], shopItems[i].x - 90,
|
||||
shopItems[i].y - 178, shopSurface[3]);
|
||||
}
|
||||
|
||||
|
@ -1016,20 +1016,20 @@ static void sell(int i)
|
|||
|
||||
void showShop()
|
||||
{
|
||||
blit(shopSurface[0], 20, 395);
|
||||
blit(shopSurface[1], 275, 395);
|
||||
blit(shopSurface[2], 530, 395);
|
||||
blit(shopSurface[3], 100, 180);
|
||||
blit(shopSurface[4], 100, 50);
|
||||
blit(shopSurface[5], 100, 320);
|
||||
screen_blit(shopSurface[0], 20, 395);
|
||||
screen_blit(shopSurface[1], 275, 395);
|
||||
screen_blit(shopSurface[2], 530, 395);
|
||||
screen_blit(shopSurface[3], 100, 180);
|
||||
screen_blit(shopSurface[4], 100, 50);
|
||||
screen_blit(shopSurface[5], 100, 320);
|
||||
|
||||
if (shopSelectedItem > -1)
|
||||
{
|
||||
blit(shape[27], 60, 350);
|
||||
blit(shape[28], 710, 350);
|
||||
screen_blit(shape[27], 60, 350);
|
||||
screen_blit(shape[28], 710, 350);
|
||||
}
|
||||
|
||||
blit(shape[29], (int)player.x, (int)player.y);
|
||||
screen_blit(shape[29], (int)player.x, (int)player.y);
|
||||
|
||||
signed char icons = MAX_SHOPITEMS;
|
||||
|
||||
|
|
|
@ -288,7 +288,7 @@ int doTitle()
|
|||
{
|
||||
explosion_addEngine(&aliens[i]);
|
||||
aliens[i].x += aliens[i].dx;
|
||||
blit(aliens[i].image[0], (int)aliens[i].x, (int)aliens[i].y);
|
||||
screen_blit(aliens[i].image[0], (int)aliens[i].x, (int)aliens[i].y);
|
||||
if (aliens[i].x > 830)
|
||||
{
|
||||
aliens[i].x = -40;
|
||||
|
@ -299,7 +299,7 @@ int doTitle()
|
|||
|
||||
if ((now - then > 2000) && (now - then < 8000) && (!skip))
|
||||
{
|
||||
blit(prlogo, prx, pry);
|
||||
screen_blit(prlogo, prx, pry);
|
||||
}
|
||||
else if ((now - then > 9000) && (now - then < 15000) && (!skip))
|
||||
{
|
||||
|
@ -311,11 +311,11 @@ int doTitle()
|
|||
}
|
||||
else if ((now - then > 25500) || (skip))
|
||||
{
|
||||
blit(sflogo, sfx, sfy);
|
||||
screen_blit(sflogo, sfx, sfy);
|
||||
|
||||
if ((now - then >= 27500) || (skip))
|
||||
{
|
||||
addBuffer(0, 0, screen->w, screen->h);
|
||||
gfx_addBuffer(0, 0, screen->w, screen->h);
|
||||
|
||||
blevelRect(optionRec.x, optionRec.y, optionRec.w, optionRec.h, redGlow, 0x00, 0x00);
|
||||
|
||||
|
@ -371,7 +371,7 @@ int doTitle()
|
|||
drawString("Copyright Parallel Realities 2003", 5, 560, FONT_WHITE, background);
|
||||
drawString("Copyright Guus Sliepen, Astrid S. de Wijn and others 2012", 5, 580, FONT_WHITE, background);
|
||||
drawString(buildVersion, 794 - strlen(buildVersion) * 9, 580, FONT_WHITE, background);
|
||||
addBuffer(0, 560, 800, 40);
|
||||
gfx_addBuffer(0, 560, 800, 40);
|
||||
skip = true;
|
||||
}
|
||||
}
|
||||
|
@ -393,7 +393,7 @@ int doTitle()
|
|||
drawString("Copyright Parallel Realities 2003", 5, 560, FONT_WHITE, background);
|
||||
drawString("Copyright Guus Sliepen, Astrid S. de Wijn and others 2012", 5, 580, FONT_WHITE, background);
|
||||
drawString(buildVersion, 794 - strlen(buildVersion) * 9, 580, FONT_WHITE, background);
|
||||
addBuffer(0, 560, 800, 40);
|
||||
gfx_addBuffer(0, 560, 800, 40);
|
||||
skip = true;
|
||||
}
|
||||
else
|
||||
|
@ -586,7 +586,7 @@ void showStory()
|
|||
fclose(fp);
|
||||
|
||||
loadBackground("gfx/startUp.jpg");
|
||||
blit(background, 0, 0);
|
||||
drawBackGround();
|
||||
flushBuffer();
|
||||
|
||||
flushInput();
|
||||
|
@ -661,7 +661,7 @@ void gameover()
|
|||
unBuffer();
|
||||
x = ((screen->w - gameover->w) / 2) - RANDRANGE(-2, 2);
|
||||
y = ((screen->h - gameover->h) / 2) - RANDRANGE(-2, 2);
|
||||
blit(gameover, x, y);
|
||||
screen_blit(gameover, x, y);
|
||||
|
||||
delayFrame();
|
||||
}
|
||||
|
@ -738,7 +738,7 @@ void doCredits()
|
|||
for (i = 0 ; i <= lastCredit ; i++)
|
||||
{
|
||||
if ((credit[i].y > -10) && (credit[i].y < (screen->h + 10)))
|
||||
blit(credit[i].image, (int)credit[i].x, (int)credit[i].y);
|
||||
screen_blit(credit[i].image, (int)credit[i].x, (int)credit[i].y);
|
||||
if (speed > 0 && credit[lastCredit].y > ((screen->h / 2) + 100))
|
||||
credit[i].y -= speed;
|
||||
else if(speed < 0 && credit[0].y < screen->h)
|
||||
|
|
Loading…
Reference in New Issue