2011-08-24 14:14:44 +02:00
|
|
|
/*
|
|
|
|
Copyright (C) 2003 Parallel Realities
|
2015-03-01 21:37:32 +01:00
|
|
|
Copyright (C) 2011, 2012, 2013 Guus Sliepen
|
2016-01-02 22:59:48 +01:00
|
|
|
Copyright (C) 2015, 2016 onpon4 <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
|
|
|
*/
|
|
|
|
|
2011-08-26 21:29:04 +02:00
|
|
|
#include "Starfighter.h"
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
void clearInfoLines()
|
|
|
|
{
|
|
|
|
for (int i = 0 ; i < 4 ; i++)
|
|
|
|
{
|
2016-01-04 04:39:16 +01:00
|
|
|
gfx_textSprites[i].life = 0;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// from a to b
|
2015-05-28 12:51:45 +02:00
|
|
|
void copyInfoLine(int a, int b)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2016-01-04 04:39:16 +01:00
|
|
|
gfx_createTextObject(b, gfx_textSprites[a].text, -1, 0, gfx_textSprites[a].fontColor);
|
|
|
|
gfx_textSprites[b].life = gfx_textSprites[a].life;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
Sets one of the three information lines on the screen. The accepts the
|
|
|
|
string and colors. It will set the information to the first free infoline
|
|
|
|
it finds (top to bottom). If it doesn't find any free ones, it will push
|
|
|
|
all the other info lines down one and add itself to the top.
|
|
|
|
*/
|
2011-08-24 14:42:59 +02:00
|
|
|
void setInfoLine(const char *in, int color)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
int index = -1;
|
|
|
|
|
2015-12-31 16:47:27 +01:00
|
|
|
for (int i = 0 ; i < MAX_INFOLINES ; i++)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2016-01-04 04:39:16 +01:00
|
|
|
if ((gfx_textSprites[i].life == 0) && (index == -1))
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
|
|
|
index = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Bump down
|
|
|
|
if (index == -1)
|
|
|
|
{
|
2015-12-31 16:47:27 +01:00
|
|
|
index = MAX_INFOLINES - 1;
|
|
|
|
for (int i = 1 ; i < MAX_INFOLINES ; i++)
|
|
|
|
{
|
|
|
|
copyInfoLine(i, i - 1);
|
|
|
|
}
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
2015-12-31 16:47:27 +01:00
|
|
|
gfx_createTextObject(index, in, -1, 0, color);
|
2016-01-04 04:39:16 +01:00
|
|
|
gfx_textSprites[index].life = 240;
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
Sets a radio message that appears at the top of the screen. Used for
|
|
|
|
script events, etc. We send a message priority too, since we don't want
|
|
|
|
Phoebe or Ursula's banter to interrupt an important message
|
|
|
|
*/
|
2016-01-04 15:01:54 +01:00
|
|
|
void setRadioMessage(int face, const char *in, int priority)
|
2011-08-24 14:14:44 +02:00
|
|
|
{
|
2016-01-04 15:01:54 +01:00
|
|
|
SDL_Surface *faceShape = NULL;
|
|
|
|
|
2016-01-04 04:39:16 +01:00
|
|
|
if ((gfx_textSprites[TS_RADIO].life > 0) && (priority == 0))
|
2011-08-24 14:14:44 +02:00
|
|
|
return;
|
|
|
|
|
2015-12-31 16:47:27 +01:00
|
|
|
gfx_createTextObject(TS_RADIO, in, -1, 50, FONT_WHITE);
|
2016-01-04 04:39:16 +01:00
|
|
|
gfx_textSprites[TS_RADIO].life = 240;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
if (face > -1)
|
2016-01-04 15:01:54 +01:00
|
|
|
faceShape = gfx_faceSprites[face];
|
2011-08-24 14:14:44 +02:00
|
|
|
|
2016-01-02 22:59:48 +01:00
|
|
|
gfx_createMessageBox(faceShape, in, 1);
|
2011-08-24 14:14:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void resetLists()
|
|
|
|
{
|
|
|
|
object *ob, *ob2;
|
|
|
|
collectables *c1, *c2;
|
|
|
|
bRect *r1, *r2;
|
|
|
|
|
|
|
|
ob = engine.bulletHead->next;
|
|
|
|
while(ob != NULL)
|
|
|
|
{
|
|
|
|
ob2 = ob;
|
|
|
|
ob = ob->next;
|
|
|
|
delete ob2;
|
|
|
|
}
|
|
|
|
engine.bulletHead->next = NULL;
|
|
|
|
engine.bulletTail = engine.bulletHead;
|
|
|
|
|
|
|
|
ob = engine.explosionHead->next;
|
|
|
|
while(ob != NULL)
|
|
|
|
{
|
|
|
|
ob2 = ob;
|
|
|
|
ob = ob->next;
|
|
|
|
delete ob2;
|
|
|
|
}
|
|
|
|
engine.explosionHead->next = NULL;
|
|
|
|
engine.explosionTail = engine.explosionHead;
|
|
|
|
|
|
|
|
c1 = engine.collectableHead->next;
|
|
|
|
while (c1 != NULL)
|
|
|
|
{
|
|
|
|
c2 = c1;
|
|
|
|
c1 = c1->next;
|
|
|
|
delete c2;
|
|
|
|
}
|
|
|
|
|
|
|
|
engine.collectableHead->next = NULL;
|
|
|
|
engine.collectableTail = engine.collectableHead;
|
|
|
|
|
2015-11-02 23:53:05 +01:00
|
|
|
r1 = screen_bufferHead->next;
|
2011-08-24 14:14:44 +02:00
|
|
|
while (r1 != NULL)
|
|
|
|
{
|
|
|
|
r2 = r1;
|
|
|
|
r1 = r1->next;
|
|
|
|
delete r2;
|
|
|
|
}
|
|
|
|
|
2015-11-02 23:53:05 +01:00
|
|
|
screen_bufferHead->next = NULL;
|
|
|
|
screen_bufferTail = screen_bufferHead;
|
2011-08-24 14:14:44 +02:00
|
|
|
|
|
|
|
ob = engine.debrisHead->next;
|
|
|
|
while(ob != NULL)
|
|
|
|
{
|
|
|
|
ob2 = ob;
|
|
|
|
ob = ob->next;
|
|
|
|
delete ob2;
|
|
|
|
}
|
|
|
|
engine.debrisHead->next = NULL;
|
|
|
|
engine.debrisTail = engine.debrisHead;
|
|
|
|
}
|
|
|
|
|
|
|
|
|