More cleanup.
This commit is contained in:
parent
651a7f55fb
commit
ce94477b70
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 gfx.o init.o intermission.o loadSave.o messages.o misc.o missions.o player.o renderer.o resources.o screen.o script.o ship.o shop.o Starfighter.o title.o weapons.o window.o
|
||||
OBJS = alien.o audio.o bullet.o cargo.o collectable.o colors.o engine.o explosion.o game.o gfx.o intermission.o loadSave.o messages.o misc.o missions.o player.o renderer.o resources.o screen.o script.o ship.o shop.o Starfighter.o title.o weapons.o window.o
|
||||
|
||||
VERSION = 1.4.1-dev
|
||||
PROG = starfighter
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Project: Starfighter
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015, 2016 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -78,10 +78,10 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
atexit(cleanUp);
|
||||
atexit(engine_cleanup);
|
||||
|
||||
gfx_init();
|
||||
initSystem(); // Opens video mode and sound
|
||||
engine_setMode();
|
||||
loadFont();
|
||||
|
||||
if (cheatAttempt && !engine.cheat)
|
||||
|
@ -96,11 +96,19 @@ int main(int argc, char **argv)
|
|||
SDL_Delay(500);
|
||||
}
|
||||
|
||||
freeGraphics();
|
||||
gfx_free();
|
||||
audio_loadSounds();
|
||||
|
||||
initWeapons();
|
||||
initVars();
|
||||
|
||||
srand(time(NULL));
|
||||
|
||||
if (engine.useAudio)
|
||||
{
|
||||
Mix_Volume(-1, 100);
|
||||
Mix_VolumeMusic(engine.musicVolume);
|
||||
}
|
||||
|
||||
alien_defs_init();
|
||||
|
||||
colors_init();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015, 2016 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -45,7 +45,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "explosion.h"
|
||||
#include "game.h"
|
||||
#include "gfx.h"
|
||||
#include "init.h"
|
||||
#include "intermission.h"
|
||||
#include "loadSave.h"
|
||||
#include "messages.h"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012 Guus Sliepen
|
||||
Copyright (C) 2012, 2015 Julian Marchant
|
||||
Copyright (C) 2012, 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -732,7 +732,7 @@ void aliens_init()
|
|||
break;
|
||||
|
||||
if (placeAttempt > 1000)
|
||||
showErrorAndExit(2, "");
|
||||
engine_showError(2, "");
|
||||
}
|
||||
|
||||
if (game.area == MISN_CERADSE)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012, 2013 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012 Guus Sliepen
|
||||
Copyright (C) 2012, 2015 Julian Marchant
|
||||
Copyright (C) 2012, 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
237
src/engine.cpp
237
src/engine.cpp
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012, 2013 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015, 2016 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -19,6 +19,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#include "Starfighter.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
Engine engine;
|
||||
|
||||
void engine_init()
|
||||
|
@ -69,3 +74,233 @@ void engine_init()
|
|||
engine.cheatAmmo = false;
|
||||
engine.cheatCash = false;
|
||||
}
|
||||
|
||||
/*
|
||||
Something went wrong. This stops the game, present the error message and
|
||||
prompts the user to press space or ctrl to exit the game. This is unlikely to
|
||||
be seen by people unless something really stoopid happens!
|
||||
*/
|
||||
void engine_showError(int errorId, const char *name)
|
||||
{
|
||||
screen_clear(black);
|
||||
|
||||
if (errorId != 2)
|
||||
{
|
||||
screen_renderString("A file error has occurred", -1, 200, FONT_RED);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Couldn't create or write to directory '%s'\n", name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
char string[255];
|
||||
|
||||
switch(errorId)
|
||||
{
|
||||
case 0:
|
||||
sprintf(string, "%s was not found in the Starfighter data package", name);
|
||||
screen_renderString(string, -1, 250, FONT_WHITE);
|
||||
screen_renderString("Please try again. If this error persists, contact the authors", -1, 275, FONT_WHITE);
|
||||
screen_renderString("or reinstall the game", -1, 300, FONT_WHITE);
|
||||
break;
|
||||
case 1:
|
||||
screen_renderString("Project: Starfighter encountered an error whilst", -1, 250, FONT_WHITE);
|
||||
screen_renderString("attempting to load game data. Please try running", -1, 275, FONT_WHITE);
|
||||
screen_renderString("the game again. If the errors persist, reinstall the game", -1, 300, FONT_WHITE);
|
||||
break;
|
||||
case 2:
|
||||
screen_renderString("Project: Starfighter encountered a critical error", -1, 250, FONT_WHITE);
|
||||
screen_renderString("while attempting to perform a required program function.", -1, 275, FONT_WHITE);
|
||||
screen_renderString("Please contact the authors with details.", -1, 300, FONT_WHITE);
|
||||
break;
|
||||
}
|
||||
|
||||
screen_renderString("Project: Starfighter will now exit", -1, 450, FONT_WHITE);
|
||||
screen_renderString("Press Space to continue", -1, 475, FONT_WHITE);
|
||||
|
||||
renderer_update();
|
||||
|
||||
engine.keyState[KEY_ALTFIRE] = 0;
|
||||
|
||||
while (!engine.keyState[KEY_ALTFIRE])
|
||||
{
|
||||
getPlayerInput();
|
||||
game_delayFrame();
|
||||
}
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
This gets the user's home directory, then creates the .parallelrealities
|
||||
and .parallelrealities/starfighter directories so that saves and
|
||||
temporary data files can be written there.
|
||||
*/
|
||||
void engine_setupConfigDirectory()
|
||||
{
|
||||
const char *userHome;
|
||||
|
||||
if ((userHome = getenv("HOME")) == NULL)
|
||||
userHome = getpwuid(getuid())->pw_dir;
|
||||
|
||||
char dir[PATH_MAX];
|
||||
strcpy(dir, "");
|
||||
|
||||
sprintf(dir, "%s/.parallelrealities", userHome);
|
||||
if ((mkdir(dir, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH) != 0) && (errno != EEXIST))
|
||||
engine_showError(2, dir);
|
||||
|
||||
sprintf(dir, "%s/.parallelrealities/starfighter", userHome);
|
||||
if ((mkdir(dir, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH) != 0) && (errno != EEXIST))
|
||||
engine_showError(2, dir);
|
||||
|
||||
sprintf(engine.configDirectory, "%s/.parallelrealities/starfighter/", userHome);
|
||||
}
|
||||
|
||||
/*
|
||||
This sets up the video and sound system, and creates Starfighter's window.
|
||||
*/
|
||||
void engine_setMode()
|
||||
{
|
||||
strcpy(engine.configDirectory, "");
|
||||
|
||||
engine_setupConfigDirectory();
|
||||
|
||||
/* Initialize the SDL library */
|
||||
if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO|SDL_INIT_JOYSTICK) < 0)
|
||||
{
|
||||
printf("Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
char filename[PATH_MAX];
|
||||
int fullScreen = 0;
|
||||
int useSound = 1;
|
||||
int useMusic = 1;
|
||||
int autoPause = 0;
|
||||
|
||||
FILE *fp;
|
||||
sprintf(filename, "%sconf", engine.configDirectory);
|
||||
fp = fopen(filename, "rb");
|
||||
|
||||
if (fp != NULL)
|
||||
{
|
||||
if (fscanf(fp, "%d %d %d %d", &fullScreen, &useSound, &useMusic, &autoPause) < 4)
|
||||
printf("Warning: Config file \"%s\" is not correctly formatted\n", filename);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
engine.fullScreen = fullScreen;
|
||||
engine.useSound = useSound;
|
||||
engine.useMusic = useMusic;
|
||||
engine.autoPause = autoPause;
|
||||
|
||||
screen = SDL_CreateRGBSurface(0, screenWidth, screenHeight, 32, 0xff0000, 0xff00, 0xff, 0xff000000);
|
||||
|
||||
if (!screen)
|
||||
{
|
||||
printf("Couldn't create %ix%ix32 surface: %s\n", screenWidth, screenHeight, SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
window = SDL_CreateWindow("Project: Starfighter", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, screen->w, screen->h, 0);
|
||||
|
||||
if (window == NULL)
|
||||
{
|
||||
printf("Could not create window: %s\n", SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
SDL_SetWindowIcon(window, gfx_loadImage("gfx/alienDevice.png"));
|
||||
SDL_SetWindowFullscreen(window, engine.fullScreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
|
||||
|
||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
||||
|
||||
if (!renderer)
|
||||
{
|
||||
printf("Could not create renderer: %s\n", SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
SDL_RenderSetLogicalSize(renderer, screen->w, screen->h);
|
||||
|
||||
renderer_texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, screen->w, screen->h);
|
||||
|
||||
if (!renderer_texture)
|
||||
{
|
||||
printf("Couldn't create %ix%ix32 texture: %s\n", screen->w, screen->h, SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (engine.useAudio)
|
||||
{
|
||||
if (Mix_OpenAudio(44100, AUDIO_S16, engine.useAudio * 2, 1024) < 0)
|
||||
{
|
||||
printf("Warning: Couldn't set 44100 Hz 16-bit stereo audio - Reason:\n%s\n", Mix_GetError());
|
||||
printf("Sound and Music will be disabled\n");
|
||||
engine.useAudio = false;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
SDL_EventState(SDL_MOUSEMOTION, SDL_DISABLE);
|
||||
|
||||
SDL_JoystickEventState(SDL_ENABLE);
|
||||
SDL_JoystickOpen(0);
|
||||
}
|
||||
|
||||
/*
|
||||
Removes [hopefully] all the resources that has been
|
||||
loaded and created during the game. This is called by
|
||||
atexit();
|
||||
*/
|
||||
void engine_cleanup()
|
||||
{
|
||||
gfx_free();
|
||||
SDL_FreeSurface(gfx_background);
|
||||
audio_free();
|
||||
resetLists();
|
||||
delete(engine.bulletHead);
|
||||
delete(engine.explosionHead);
|
||||
delete(engine.collectableHead);
|
||||
delete(screen_bufferHead);
|
||||
|
||||
for (int i = 0 ; i < MAX_FONTSHAPES ; i++)
|
||||
{
|
||||
if (fontShape[i] != NULL)
|
||||
SDL_FreeSurface(fontShape[i]);
|
||||
}
|
||||
|
||||
char filename[PATH_MAX];
|
||||
strcpy(filename, "");
|
||||
|
||||
sprintf(filename, "%smusic.mod", engine.configDirectory);
|
||||
remove(filename);
|
||||
|
||||
sprintf(filename, "%smusic.s3m", engine.configDirectory);
|
||||
remove(filename);
|
||||
|
||||
if (engine.useAudio)
|
||||
{
|
||||
Mix_CloseAudio();
|
||||
}
|
||||
|
||||
// Save the config using current settings
|
||||
FILE *fp;
|
||||
sprintf(filename, "%sconf", engine.configDirectory);
|
||||
fp = fopen(filename, "wb");
|
||||
if (fp != NULL)
|
||||
{
|
||||
fprintf(fp, "%d %d %d %d\n", engine.fullScreen, engine.useSound,
|
||||
engine.useMusic, engine.autoPause);
|
||||
fclose(fp);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Error saving config\n");
|
||||
}
|
||||
|
||||
SDL_Quit();
|
||||
printf("Thank You for playing Starfighter\n");
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015, 2016 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -20,8 +20,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#ifndef GLOBALS_H
|
||||
#define GLOBALS_H
|
||||
|
||||
#include "structs.h"
|
||||
|
||||
extern Engine engine;
|
||||
|
||||
void engine_init();
|
||||
void engine_showError(int errorId, const char *name);
|
||||
void engine_setupConfigDirectory();
|
||||
void engine_setMode();
|
||||
void engine_cleanup();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012, 2013 Guus Sliepen
|
||||
Copyright (C) 2012, 2014, 2015 Julian Marchant
|
||||
Copyright (C) 2012, 2014, 2015, 2016 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -185,8 +185,8 @@ void game_doStars()
|
|||
/* Lock the screen for direct access to the pixels */
|
||||
if (SDL_MUSTLOCK(screen))
|
||||
{
|
||||
if (SDL_LockSurface(screen) < 0 )
|
||||
showErrorAndExit(2, "");
|
||||
if (SDL_LockSurface(screen) < 0)
|
||||
engine_showError(2, "");
|
||||
}
|
||||
|
||||
int color = 0;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
83
src/gfx.cpp
83
src/gfx.cpp
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012, 2013 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015, 2016 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -66,13 +66,13 @@ SDL_Surface *gfx_setTransparent(SDL_Surface *sprite)
|
|||
|
||||
void gfx_blit(SDL_Surface *image, int x, int y, SDL_Surface *dest)
|
||||
{
|
||||
SDL_Rect blitRect;
|
||||
|
||||
// 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)
|
||||
return;
|
||||
|
||||
// Set up a rectangle to draw to
|
||||
SDL_Rect blitRect;
|
||||
|
||||
blitRect.x = x;
|
||||
blitRect.y = y;
|
||||
blitRect.w = image->w;
|
||||
|
@ -82,7 +82,7 @@ void gfx_blit(SDL_Surface *image, int x, int y, SDL_Surface *dest)
|
|||
if (SDL_BlitSurface(image, NULL, dest, &blitRect) < 0)
|
||||
{
|
||||
printf("BlitSurface error: %s\n", SDL_GetError());
|
||||
showErrorAndExit(2, "");
|
||||
engine_showError(2, "");
|
||||
}
|
||||
|
||||
// Only if it is to the screen, mark the region as damaged
|
||||
|
@ -121,7 +121,7 @@ static int gfx_renderStringBase(const char *in, int x, int y, int fontColor, sig
|
|||
if (SDL_BlitSurface(fontShape[fontColor], &letter, dest, &area) < 0)
|
||||
{
|
||||
printf("BlitSurface error: %s\n", SDL_GetError());
|
||||
showErrorAndExit(2, "");
|
||||
engine_showError(2, "");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ static int gfx_renderStringBase(const char *in, int x, int y, int fontColor, sig
|
|||
if (SDL_BlitSurface(fontShape[fontColor], &letter, dest, &area) < 0)
|
||||
{
|
||||
printf("BlitSurface error: %s\n", SDL_GetError());
|
||||
showErrorAndExit(2, "");
|
||||
engine_showError(2, "");
|
||||
}
|
||||
area.y += 16;
|
||||
area.x = x;
|
||||
|
@ -231,7 +231,7 @@ void gfx_drawLine(SDL_Surface *dest, int x1, int y1, int x2, int y2, int col)
|
|||
if ( SDL_LockSurface(dest) < 0 )
|
||||
{
|
||||
printf("Can't lock screen: %s\n", SDL_GetError());
|
||||
showErrorAndExit(2, "");
|
||||
engine_showError(2, "");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -263,8 +263,10 @@ mailing list... I didn't write it myself.
|
|||
*/
|
||||
void gfx_drawCircle(int xc, int yc, int R, SDL_Surface *PIX, int col)
|
||||
{
|
||||
int x = 0, xx = 0;
|
||||
int y = R, yy = 2 * R;
|
||||
int x = 0;
|
||||
int xx = 0;
|
||||
int y = R;
|
||||
int yy = 2 * R;
|
||||
int p = 1 - R;
|
||||
|
||||
gfx_putPixel(PIX, xc, yc - y, col);
|
||||
|
@ -337,7 +339,7 @@ SDL_Surface *gfx_createSurface(int width, int height)
|
|||
|
||||
if (surface == NULL) {
|
||||
printf("CreateRGBSurface failed: %s\n", SDL_GetError());
|
||||
showErrorAndExit(2, "");
|
||||
engine_showError(2, "");
|
||||
}
|
||||
|
||||
return surface;
|
||||
|
@ -377,7 +379,7 @@ void gfx_createTextObject(int index, const char *inString, int x, int y, int fon
|
|||
gfx_text[index].x = (screen->w - gfx_text[index].image->w) / 2;
|
||||
}
|
||||
|
||||
SDL_Surface *alphaRect(int width, int height, Uint8 red, Uint8 green, Uint8 blue)
|
||||
SDL_Surface *gfx_createAlphaRect(int width, int height, Uint8 red, Uint8 green, Uint8 blue)
|
||||
{
|
||||
SDL_Surface *surface = gfx_createSurface(width, height);
|
||||
|
||||
|
@ -388,8 +390,10 @@ SDL_Surface *alphaRect(int width, int height, Uint8 red, Uint8 green, Uint8 blue
|
|||
return surface;
|
||||
}
|
||||
|
||||
void createMessageBox(SDL_Surface *face, const char *message, signed char transparent)
|
||||
void gfx_createMessageBox(SDL_Surface *face, const char *message, signed char transparent)
|
||||
{
|
||||
int x = 60;
|
||||
|
||||
if (messageBox != NULL)
|
||||
{
|
||||
SDL_FreeSurface(messageBox);
|
||||
|
@ -397,12 +401,10 @@ void createMessageBox(SDL_Surface *face, const char *message, signed char transp
|
|||
}
|
||||
|
||||
if (transparent)
|
||||
messageBox = alphaRect(550, 60, 0x00, 0x00, 0x00);
|
||||
messageBox = gfx_createAlphaRect(550, 60, 0x00, 0x00, 0x00);
|
||||
else
|
||||
messageBox = gfx_createSurface(550, 60);
|
||||
|
||||
signed char x = 60;
|
||||
|
||||
if (face != NULL)
|
||||
{
|
||||
gfx_drawRect(messageBox, 0, 0, messageBox->w - 1, messageBox->h - 1, 0x00, 0x00, 0xaa);
|
||||
|
@ -417,7 +419,31 @@ void createMessageBox(SDL_Surface *face, const char *message, signed char transp
|
|||
gfx_renderString(message, x, 5, FONT_WHITE, 1, messageBox);
|
||||
}
|
||||
|
||||
void freeGraphics()
|
||||
SDL_Surface *gfx_loadImage(const char *filename)
|
||||
{
|
||||
SDL_Surface *image, *newImage;
|
||||
|
||||
image = IMG_Load(filename);
|
||||
|
||||
if (image == NULL) {
|
||||
printf("Couldn't load %s: %s\n", filename, SDL_GetError());
|
||||
engine_showError(0, filename);
|
||||
}
|
||||
|
||||
newImage = SDL_ConvertSurface(image, screen->format, 0);
|
||||
if ( newImage ) {
|
||||
SDL_FreeSurface(image);
|
||||
}
|
||||
else
|
||||
{
|
||||
// This happens when we are loading the window icon image
|
||||
newImage = image;
|
||||
}
|
||||
|
||||
return gfx_setTransparent(newImage);
|
||||
}
|
||||
|
||||
void gfx_free()
|
||||
{
|
||||
for (int i = 0 ; i < MAX_SHAPES ; i++)
|
||||
{
|
||||
|
@ -461,28 +487,3 @@ void freeGraphics()
|
|||
messageBox = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SDL_Surface *loadImage(const char *filename)
|
||||
{
|
||||
SDL_Surface *image, *newImage;
|
||||
|
||||
image = IMG_Load(filename);
|
||||
|
||||
if (image == NULL) {
|
||||
printf("Couldn't load %s: %s\n", filename, SDL_GetError());
|
||||
showErrorAndExit(0, filename);
|
||||
}
|
||||
|
||||
newImage = SDL_ConvertSurface(image, screen->format, 0);
|
||||
if ( newImage ) {
|
||||
SDL_FreeSurface(image);
|
||||
}
|
||||
else
|
||||
{
|
||||
// This happens when we are loading the window icon image
|
||||
newImage = image;
|
||||
}
|
||||
|
||||
return gfx_setTransparent(newImage);
|
||||
}
|
||||
|
|
11
src/gfx.h
11
src/gfx.h
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015, 2016 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -42,10 +42,9 @@ void gfx_drawRect(SDL_Surface *dest, int x, int y, int w, int h, Uint8 red, Uint
|
|||
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);
|
||||
extern SDL_Surface *alphaRect(int width, int height, Uint8 red, Uint8 green, Uint8 blue);
|
||||
extern void createMessageBox(SDL_Surface *face, const char *message, signed char transparent);
|
||||
extern void freeGraphics();
|
||||
|
||||
extern SDL_Surface *loadImage(const char *filename);
|
||||
SDL_Surface *gfx_createAlphaRect(int width, int height, Uint8 red, Uint8 green, Uint8 blue);
|
||||
void gfx_createMessageBox(SDL_Surface *face, const char *message, signed char transparent);
|
||||
SDL_Surface *gfx_loadImage(const char *filename);
|
||||
void gfx_free();
|
||||
|
||||
#endif
|
||||
|
|
271
src/init.cpp
271
src/init.cpp
|
@ -1,271 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012, 2013 Guus Sliepen
|
||||
Copyright (C) 2012, 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 "Starfighter.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
/*
|
||||
Initalises a whole load of variables
|
||||
*/
|
||||
void initVars()
|
||||
{
|
||||
srand(time(NULL));
|
||||
|
||||
if (engine.useAudio)
|
||||
{
|
||||
Mix_Volume(-1, 100);
|
||||
Mix_VolumeMusic(engine.musicVolume);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Something went wrong. This stops the game, present the error message and
|
||||
prompts the user to press space or ctrl to exit the game. This is unlikely to
|
||||
be seen by people unless something really stoopid happens!
|
||||
*/
|
||||
void showErrorAndExit(int errorId, const char *name)
|
||||
{
|
||||
screen_clear(black);
|
||||
|
||||
if (errorId != 2)
|
||||
{
|
||||
screen_renderString("A file error has occurred", -1, 200, FONT_RED);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Couldn't create or write to directory '%s'\n", name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
char string[255];
|
||||
|
||||
switch(errorId)
|
||||
{
|
||||
case 0:
|
||||
sprintf(string, "%s was not found in the Starfighter data package", name);
|
||||
screen_renderString(string, -1, 250, FONT_WHITE);
|
||||
screen_renderString("Please try again. If this error persists, contact the authors", -1, 275, FONT_WHITE);
|
||||
screen_renderString("or reinstall the game", -1, 300, FONT_WHITE);
|
||||
break;
|
||||
case 1:
|
||||
screen_renderString("Project: Starfighter encountered an error whilst", -1, 250, FONT_WHITE);
|
||||
screen_renderString("attempting to load game data. Please try running", -1, 275, FONT_WHITE);
|
||||
screen_renderString("the game again. If the errors persist, reinstall the game", -1, 300, FONT_WHITE);
|
||||
break;
|
||||
case 2:
|
||||
screen_renderString("Project: Starfighter encountered a critical error", -1, 250, FONT_WHITE);
|
||||
screen_renderString("while attempting to perform a required program function.", -1, 275, FONT_WHITE);
|
||||
screen_renderString("Please contact the authors with details.", -1, 300, FONT_WHITE);
|
||||
break;
|
||||
}
|
||||
|
||||
screen_renderString("Project: Starfighter will now exit", -1, 450, FONT_WHITE);
|
||||
screen_renderString("Press Space to continue", -1, 475, FONT_WHITE);
|
||||
|
||||
renderer_update();
|
||||
|
||||
engine.keyState[KEY_ALTFIRE] = 0;
|
||||
|
||||
while (!engine.keyState[KEY_ALTFIRE])
|
||||
{
|
||||
getPlayerInput();
|
||||
game_delayFrame();
|
||||
}
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
This gets the user's home directory, then creates the .parallelrealities
|
||||
and .parallelrealities/starfighter directories so that saves and
|
||||
temporary data files can be written there.
|
||||
*/
|
||||
static void setupUserHomeDirectory()
|
||||
{
|
||||
const char *userHome;
|
||||
|
||||
if ((userHome = getenv("HOME")) == NULL)
|
||||
userHome = getpwuid(getuid())->pw_dir;
|
||||
|
||||
char dir[PATH_MAX];
|
||||
strcpy(dir, "");
|
||||
|
||||
sprintf(dir, "%s/.parallelrealities", userHome);
|
||||
if ((mkdir(dir, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH) != 0) && (errno != EEXIST))
|
||||
showErrorAndExit(2, dir);
|
||||
|
||||
sprintf(dir, "%s/.parallelrealities/starfighter", userHome);
|
||||
if ((mkdir(dir, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH) != 0) && (errno != EEXIST))
|
||||
showErrorAndExit(2, dir);
|
||||
|
||||
sprintf(engine.userHomeDirectory, "%s/.parallelrealities/starfighter/", userHome);
|
||||
}
|
||||
|
||||
/*
|
||||
Chugg chugg chugg.... brrr... chugg chugg chugg...brrrrrr... chugg ch..
|
||||
BRRRRRRRRRRRRRRRRRMMMMMMMMMMMMMMMMMMM!! Well, hopefully anyway! ;)
|
||||
*/
|
||||
void initSystem()
|
||||
{
|
||||
strcpy(engine.userHomeDirectory, "");
|
||||
|
||||
setupUserHomeDirectory();
|
||||
|
||||
/* Initialize the SDL library */
|
||||
if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO|SDL_INIT_JOYSTICK) < 0)
|
||||
{
|
||||
printf("Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
char filename[PATH_MAX];
|
||||
int fullScreen = 0;
|
||||
int useSound = 1;
|
||||
int useMusic = 1;
|
||||
int autoPause = 0;
|
||||
|
||||
FILE *fp;
|
||||
sprintf(filename, "%sconf", engine.userHomeDirectory);
|
||||
fp = fopen(filename, "rb");
|
||||
|
||||
if (fp != NULL)
|
||||
{
|
||||
if (fscanf(fp, "%d %d %d %d", &fullScreen, &useSound, &useMusic, &autoPause) < 4)
|
||||
printf("Warning: Config file \"%s\" is not correctly formatted\n", filename);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
engine.fullScreen = fullScreen;
|
||||
engine.useSound = useSound;
|
||||
engine.useMusic = useMusic;
|
||||
engine.autoPause = autoPause;
|
||||
|
||||
screen = SDL_CreateRGBSurface(0, screenWidth, screenHeight, 32, 0xff0000, 0xff00, 0xff, 0xff000000);
|
||||
|
||||
if (!screen)
|
||||
{
|
||||
printf("Couldn't create %ix%ix32 surface: %s\n", screenWidth, screenHeight, SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
window = SDL_CreateWindow("Project: Starfighter", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, screen->w, screen->h, 0);
|
||||
|
||||
if (window == NULL)
|
||||
{
|
||||
printf("Could not create window: %s\n", SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
SDL_SetWindowIcon(window, loadImage("gfx/alienDevice.png"));
|
||||
SDL_SetWindowFullscreen(window, engine.fullScreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
|
||||
|
||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
||||
|
||||
if (!renderer)
|
||||
{
|
||||
printf("Could not create renderer: %s\n", SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
SDL_RenderSetLogicalSize(renderer, screen->w, screen->h);
|
||||
|
||||
renderer_texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, screen->w, screen->h);
|
||||
|
||||
if (!renderer_texture)
|
||||
{
|
||||
printf("Couldn't create %ix%ix32 texture: %s\n", screen->w, screen->h, SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (engine.useAudio)
|
||||
{
|
||||
if (Mix_OpenAudio(44100, AUDIO_S16, engine.useAudio * 2, 1024) < 0)
|
||||
{
|
||||
printf("Warning: Couldn't set 44100 Hz 16-bit stereo audio - Reason:\n%s\n", Mix_GetError());
|
||||
printf("Sound and Music will be disabled\n");
|
||||
engine.useAudio = false;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
SDL_EventState(SDL_MOUSEMOTION, SDL_DISABLE);
|
||||
|
||||
SDL_JoystickEventState(SDL_ENABLE);
|
||||
SDL_JoystickOpen(0);
|
||||
}
|
||||
|
||||
/*
|
||||
Removes [hopefully] all the resources that has been
|
||||
loaded and created during the game. This is called by
|
||||
atexit();
|
||||
*/
|
||||
void cleanUp()
|
||||
{
|
||||
freeGraphics();
|
||||
SDL_FreeSurface(gfx_background);
|
||||
audio_free();
|
||||
resetLists();
|
||||
delete(engine.bulletHead);
|
||||
delete(engine.explosionHead);
|
||||
delete(engine.collectableHead);
|
||||
delete(screen_bufferHead);
|
||||
|
||||
for (int i = 0 ; i < MAX_FONTSHAPES ; i++)
|
||||
{
|
||||
if (fontShape[i] != NULL)
|
||||
SDL_FreeSurface(fontShape[i]);
|
||||
}
|
||||
|
||||
char filename[PATH_MAX];
|
||||
strcpy(filename, "");
|
||||
|
||||
sprintf(filename, "%smusic.mod", engine.userHomeDirectory);
|
||||
remove(filename);
|
||||
|
||||
sprintf(filename, "%smusic.s3m", engine.userHomeDirectory);
|
||||
remove(filename);
|
||||
|
||||
if (engine.useAudio)
|
||||
{
|
||||
Mix_CloseAudio();
|
||||
}
|
||||
|
||||
// Save the config using current settings
|
||||
FILE *fp;
|
||||
sprintf(filename, "%sconf", engine.userHomeDirectory);
|
||||
fp = fopen(filename, "wb");
|
||||
if (fp != NULL)
|
||||
{
|
||||
fprintf(fp, "%d %d %d %d\n", engine.fullScreen, engine.useSound,
|
||||
engine.useMusic, engine.autoPause);
|
||||
fclose(fp);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Error saving config\n");
|
||||
}
|
||||
|
||||
SDL_Quit();
|
||||
printf("Thank You for playing Starfighter\n");
|
||||
}
|
||||
|
28
src/init.h
28
src/init.h
|
@ -1,28 +0,0 @@
|
|||
/*
|
||||
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 INIT_H
|
||||
#define INIT_H
|
||||
|
||||
extern void initVars();
|
||||
extern void showErrorAndExit(int errorId, const char *name);
|
||||
extern void initSystem();
|
||||
extern void cleanUp();
|
||||
|
||||
#endif
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012, 2013 Guus Sliepen
|
||||
Copyright (C) 2012, 2015 Julian Marchant
|
||||
Copyright (C) 2012, 2015, 2016 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -567,7 +567,7 @@ selected an icon.
|
|||
*/
|
||||
int intermission()
|
||||
{
|
||||
freeGraphics();
|
||||
gfx_free();
|
||||
|
||||
checkForBossMission(); // double check just to make sure!
|
||||
|
||||
|
@ -587,33 +587,33 @@ int intermission()
|
|||
|
||||
engine.cursor_x = screen->w / 2;
|
||||
engine.cursor_y = screen->h / 2;
|
||||
shape[0] = loadImage("gfx/cursor.png");
|
||||
shape[0] = gfx_loadImage("gfx/cursor.png");
|
||||
|
||||
// Icons 1 - 29
|
||||
for (int i = 0 ; i < 26 ; i++)
|
||||
{
|
||||
sprintf(string, "gfx/icon%d.png", (i + 1));
|
||||
shape[i + 1] = loadImage(string);
|
||||
shape[i + 1] = gfx_loadImage(string);
|
||||
}
|
||||
|
||||
shape[27] = loadImage("gfx/buyIcon.png");
|
||||
shape[28] = loadImage("gfx/sellIcon.png");
|
||||
shape[29] = loadImage("gfx/firefly1.png");
|
||||
shape[27] = gfx_loadImage("gfx/buyIcon.png");
|
||||
shape[28] = gfx_loadImage("gfx/sellIcon.png");
|
||||
shape[29] = gfx_loadImage("gfx/firefly1.png");
|
||||
|
||||
// Planets 30 - 39
|
||||
shape[30] = loadImage("gfx/planet_sun.png");
|
||||
shape[31] = loadImage("gfx/planet_green.png");
|
||||
shape[32] = loadImage("gfx/planet_blue.png");
|
||||
shape[33] = loadImage("gfx/planet_red.png");
|
||||
shape[34] = loadImage("gfx/planet_orange.png");
|
||||
shape[30] = gfx_loadImage("gfx/planet_sun.png");
|
||||
shape[31] = gfx_loadImage("gfx/planet_green.png");
|
||||
shape[32] = gfx_loadImage("gfx/planet_blue.png");
|
||||
shape[33] = gfx_loadImage("gfx/planet_red.png");
|
||||
shape[34] = gfx_loadImage("gfx/planet_orange.png");
|
||||
|
||||
// Faces (as defines)
|
||||
shape[FACE_CHRIS] = loadImage("gfx/face_chris.png");
|
||||
shape[FACE_SID] = loadImage("gfx/face_sid.png");
|
||||
shape[FACE_KRASS] = loadImage("gfx/face_krass.png");
|
||||
shape[FACE_PHOEBE] = loadImage("gfx/face_phoebe.png");
|
||||
shape[FACE_URSULA] = loadImage("gfx/face_ursula.png");
|
||||
shape[FACE_KLINE] = loadImage("gfx/face_kline.png");
|
||||
shape[FACE_CHRIS] = gfx_loadImage("gfx/face_chris.png");
|
||||
shape[FACE_SID] = gfx_loadImage("gfx/face_sid.png");
|
||||
shape[FACE_KRASS] = gfx_loadImage("gfx/face_krass.png");
|
||||
shape[FACE_PHOEBE] = gfx_loadImage("gfx/face_phoebe.png");
|
||||
shape[FACE_URSULA] = gfx_loadImage("gfx/face_ursula.png");
|
||||
shape[FACE_KLINE] = gfx_loadImage("gfx/face_kline.png");
|
||||
|
||||
engine.done = 0;
|
||||
engine.keyState[KEY_FIRE] = 0;
|
||||
|
@ -629,7 +629,7 @@ int intermission()
|
|||
initShop();
|
||||
intermission_setSystemPlanets();
|
||||
|
||||
SDL_Surface *statsSurface = alphaRect(600, 330, 0x00, 0x00, 0x99);
|
||||
SDL_Surface *statsSurface = gfx_createAlphaRect(600, 330, 0x00, 0x00, 0x99);
|
||||
SDL_Surface *savesSurface = gfx_createSurface(350, 300);
|
||||
SDL_Surface *optionsSurface = gfx_createSurface(320, 240);
|
||||
SDL_Surface *commsSurface = gfx_createSurface(450, 400);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012, 2013 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -42,7 +42,7 @@ int initSaveSlots()
|
|||
//READ SAVE GAME DATA
|
||||
for (int i = 0 ; i <= 5 ; i++)
|
||||
{
|
||||
sprintf(fileName, "%ssave%.2d.dat", engine.userHomeDirectory, i);
|
||||
sprintf(fileName, "%ssave%.2d.dat", engine.configDirectory, i);
|
||||
|
||||
fp = fopen(fileName, "rb");
|
||||
if (fp == NULL)
|
||||
|
@ -96,7 +96,7 @@ bool loadGame(int slot)
|
|||
{
|
||||
char filename[PATH_MAX];
|
||||
FILE *fp;
|
||||
sprintf(filename, "%ssave%.2d.dat", engine.userHomeDirectory, slot);
|
||||
sprintf(filename, "%ssave%.2d.dat", engine.configDirectory, slot);
|
||||
|
||||
fp = fopen(filename, "rb");
|
||||
|
||||
|
@ -139,7 +139,7 @@ void saveGame(int slot)
|
|||
return;
|
||||
}
|
||||
|
||||
sprintf(fileName, "%ssave%.2d.dat", engine.userHomeDirectory, slot);
|
||||
sprintf(fileName, "%ssave%.2d.dat", engine.configDirectory, slot);
|
||||
fp = fopen(fileName, "wb");
|
||||
|
||||
game.saveFormat = 3;
|
||||
|
@ -265,7 +265,7 @@ int showSaveSlots(SDL_Surface *savesSurface, signed char saveSlot)
|
|||
365, 100, 25))
|
||||
{
|
||||
char filename[PATH_MAX];
|
||||
sprintf(filename, "%ssave%.2d.dat", engine.userHomeDirectory,
|
||||
sprintf(filename, "%ssave%.2d.dat", engine.configDirectory,
|
||||
saveSlot);
|
||||
remove(filename);
|
||||
initSaveSlots();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012 Guus Sliepen
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012, 2013 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015, 2016 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -83,7 +83,7 @@ void setRadioMessage(signed char face, const char *in, int priority)
|
|||
if (face > -1)
|
||||
faceShape = shape[face];
|
||||
|
||||
createMessageBox(faceShape, in, 1);
|
||||
gfx_createMessageBox(faceShape, in, 1);
|
||||
}
|
||||
|
||||
static const char *faces[] = {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012, 2013 Guus Sliepen
|
||||
Copyright (C) 2012, 2015 Julian Marchant
|
||||
Copyright (C) 2012, 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012, 2013 Guus Sliepen
|
||||
Copyright (C) 2012, 2015 Julian Marchant
|
||||
Copyright (C) 2012, 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012, 2013 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012, 2013 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015, 2016 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -26,7 +26,7 @@ void loadBackground(const char *filename)
|
|||
SDL_FreeSurface(gfx_background);
|
||||
gfx_background = NULL;
|
||||
}
|
||||
gfx_background = loadImage(filename);
|
||||
gfx_background = gfx_loadImage(filename);
|
||||
SDL_SetColorKey(gfx_background, 0, 0);
|
||||
}
|
||||
|
||||
|
@ -39,10 +39,10 @@ void loadGameGraphics()
|
|||
Uint16 *p16;
|
||||
Uint8 *p8;
|
||||
|
||||
freeGraphics();
|
||||
gfx_free();
|
||||
|
||||
shipShape[0] = loadImage("gfx/firefly1.png");
|
||||
shipShape[1] = loadImage("gfx/firefly2.png");
|
||||
shipShape[0] = gfx_loadImage("gfx/firefly1.png");
|
||||
shipShape[1] = gfx_loadImage("gfx/firefly2.png");
|
||||
|
||||
switch(game.system)
|
||||
{
|
||||
|
@ -67,7 +67,7 @@ void loadGameGraphics()
|
|||
|
||||
while (fscanf(fp, "%d %s", &index, string) == 2)
|
||||
{
|
||||
shipShape[index] = loadImage(string);
|
||||
shipShape[index] = gfx_loadImage(string);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
@ -131,7 +131,7 @@ void loadGameGraphics()
|
|||
|
||||
while (fscanf(fp, "%d %s", &index, string) == 2)
|
||||
{
|
||||
shape[index] = loadImage(string);
|
||||
shape[index] = gfx_loadImage(string);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012, 2013 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -21,8 +21,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#include "SDL.h"
|
||||
|
||||
#include "engine.h"
|
||||
#include "gfx.h"
|
||||
#include "init.h"
|
||||
#include "structs.h"
|
||||
|
||||
SDL_Surface *screen;
|
||||
|
@ -102,7 +102,7 @@ void screen_unBuffer()
|
|||
if (SDL_BlitSurface(gfx_background, &blitRect, screen, &blitRect) < 0)
|
||||
{
|
||||
printf("BlitSurface error: %s\n", SDL_GetError());
|
||||
showErrorAndExit(2, "");
|
||||
engine_showError(2, "");
|
||||
}
|
||||
|
||||
prevRect->next = rect->next;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012, 2013 Guus Sliepen
|
||||
Copyright (C) 2012, 2015 Julian Marchant
|
||||
Copyright (C) 2012, 2015, 2016 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -199,7 +199,7 @@ void doCutscene(int scene)
|
|||
engine.smy = 0;
|
||||
|
||||
screen_flushBuffer();
|
||||
freeGraphics();
|
||||
gfx_free();
|
||||
resetLists();
|
||||
loadGameGraphics();
|
||||
|
||||
|
@ -294,7 +294,7 @@ void doCutscene(int scene)
|
|||
face = NULL;
|
||||
if (cutMessage[currentMessage].face != -1)
|
||||
face = shape[cutMessage[currentMessage].face];
|
||||
createMessageBox(face, cutMessage[currentMessage].message, 0);
|
||||
gfx_createMessageBox(face, cutMessage[currentMessage].message, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -311,7 +311,7 @@ void doCutscene(int scene)
|
|||
}
|
||||
|
||||
screen_flushBuffer();
|
||||
freeGraphics();
|
||||
gfx_free();
|
||||
screen_clear(black);
|
||||
renderer_update();
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012, 2013 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015, 2016 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -161,7 +161,7 @@ static void drawShop()
|
|||
gfx_drawRect(shopSurface[i], 0, 0, 245, 20, 0x00, 0x00, 0x99);
|
||||
}
|
||||
|
||||
shopSurface[4] = alphaRect(601, 101, 0x00, 0x00, 0x00);
|
||||
shopSurface[4] = gfx_createAlphaRect(601, 101, 0x00, 0x00, 0x00);
|
||||
gfx_drawRect(shopSurface[4], 0, 0, 600, 100, 0x00, 0x00, 0x33);
|
||||
|
||||
switch (shopSelectedItem)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012, 2013 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -303,7 +303,7 @@ struct Engine {
|
|||
bool fullScreen;
|
||||
bool autoPause;
|
||||
|
||||
char userHomeDirectory[1024];
|
||||
char configDirectory[1024];
|
||||
|
||||
char keyState[KEY_LAST];
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012, 2013 Guus Sliepen
|
||||
Copyright (C) 2012, 2015 Julian Marchant
|
||||
Copyright (C) 2012, 2015, 2016 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -181,7 +181,7 @@ int doTitle()
|
|||
engine.gameSection = SECTION_TITLE;
|
||||
|
||||
screen_flushBuffer();
|
||||
freeGraphics();
|
||||
gfx_free();
|
||||
resetLists();
|
||||
|
||||
// required to stop the title screen crashing
|
||||
|
@ -199,8 +199,8 @@ int doTitle()
|
|||
loadBackground("gfx/spirit.jpg");
|
||||
|
||||
SDL_Surface *prlogo, *sflogo;
|
||||
prlogo = loadImage("gfx/prlogo.png");
|
||||
sflogo = loadImage("gfx/sflogo.png");
|
||||
prlogo = gfx_loadImage("gfx/prlogo.png");
|
||||
sflogo = gfx_loadImage("gfx/sflogo.png");
|
||||
|
||||
int prx = ((screen->w - prlogo->w) / 2);
|
||||
int pry = ((screen->h - prlogo->h) / 2);
|
||||
|
@ -569,7 +569,7 @@ Scrolls the intro text up the screen and nothing else.
|
|||
*/
|
||||
void showStory()
|
||||
{
|
||||
freeGraphics();
|
||||
gfx_free();
|
||||
|
||||
int y = screen->h + 20;
|
||||
|
||||
|
@ -634,13 +634,13 @@ The game over screen :(
|
|||
void gameover()
|
||||
{
|
||||
screen_flushBuffer();
|
||||
freeGraphics();
|
||||
gfx_free();
|
||||
SDL_FillRect(gfx_background, NULL, black);
|
||||
|
||||
engine.keyState[KEY_FIRE] = engine.keyState[KEY_ALTFIRE] = 0;
|
||||
engine.gameSection = SECTION_INTERMISSION;
|
||||
|
||||
SDL_Surface *gameover = loadImage("gfx/gameover.png");
|
||||
SDL_Surface *gameover = gfx_loadImage("gfx/gameover.png");
|
||||
|
||||
screen_clear(black);
|
||||
renderer_update();
|
||||
|
@ -683,7 +683,7 @@ void doCredits()
|
|||
{
|
||||
loadBackground("gfx/credits.jpg");
|
||||
screen_flushBuffer();
|
||||
freeGraphics();
|
||||
gfx_free();
|
||||
|
||||
FILE *fp;
|
||||
int lastCredit = -1;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2013 Guus Sliepen
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012, 2013 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011 Guus Sliepen
|
||||
Copyright (C) 2015 Julian Marchant
|
||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
Loading…
Reference in New Issue