Draw and blink a white rectangle around the message box speaker.
This commit is contained in:
parent
4fb7d90584
commit
e196752efa
Binary file not shown.
After Width: | Height: | Size: 457 KiB |
|
@ -485,6 +485,17 @@ static void drawTargetRects(Entity *e)
|
||||||
SDL_SetRenderDrawColor(app.renderer, 0, 255, 0, 255);
|
SDL_SetRenderDrawColor(app.renderer, 0, 255, 0, 255);
|
||||||
SDL_RenderDrawRect(app.renderer, &r);
|
SDL_RenderDrawRect(app.renderer, &r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (e == battle.messageSpeaker && battle.stats[STAT_TIME] % 60 < 40)
|
||||||
|
{
|
||||||
|
r.x = e->x - (size / 2) - battle.camera.x;
|
||||||
|
r.y = e->y - (size / 2) - battle.camera.y;
|
||||||
|
r.w = size;
|
||||||
|
r.h = size;
|
||||||
|
|
||||||
|
SDL_SetRenderDrawColor(app.renderer, 255, 255, 255, 255);
|
||||||
|
SDL_RenderDrawRect(app.renderer, &r);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void activateEntities(char *names)
|
void activateEntities(char *names)
|
||||||
|
|
|
@ -330,7 +330,7 @@ static void drawPlayerTargeter(void)
|
||||||
float angle;
|
float angle;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
if (player->target || battle.missionTarget || jumpgateEnabled())
|
if (player->target || battle.missionTarget || jumpgateEnabled() || battle.messageSpeaker)
|
||||||
{
|
{
|
||||||
if (player->target)
|
if (player->target)
|
||||||
{
|
{
|
||||||
|
@ -340,6 +340,10 @@ static void drawPlayerTargeter(void)
|
||||||
{
|
{
|
||||||
SDL_SetTextureColorMod(targetCircle, 0, 255, 0);
|
SDL_SetTextureColorMod(targetCircle, 0, 255, 0);
|
||||||
}
|
}
|
||||||
|
else if (battle.messageSpeaker)
|
||||||
|
{
|
||||||
|
SDL_SetTextureColorMod(targetCircle, 255, 255, 255);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SDL_SetTextureColorMod(targetCircle, 255, 255, 0);
|
SDL_SetTextureColorMod(targetCircle, 255, 255, 0);
|
||||||
|
@ -389,6 +393,20 @@ static void drawPlayerTargeter(void)
|
||||||
|
|
||||||
blitRotated(targetPointer, x - battle.camera.x, y - battle.camera.y, angle);
|
blitRotated(targetPointer, x - battle.camera.x, y - battle.camera.y, angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (battle.messageSpeaker)
|
||||||
|
{
|
||||||
|
angle = getAngle(player->x, player->y, battle.messageSpeaker->x, battle.messageSpeaker->y);
|
||||||
|
x = player->x;
|
||||||
|
y = player->y;
|
||||||
|
|
||||||
|
x += sin(TO_RAIDANS(angle)) * 45;
|
||||||
|
y += -cos(TO_RAIDANS(angle)) * 45;
|
||||||
|
|
||||||
|
SDL_SetTextureColorMod(targetPointer, 255, 255, 255);
|
||||||
|
|
||||||
|
blitRotated(targetPointer, x - battle.camera.x, y - battle.camera.y, angle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawNumFighters(void)
|
static void drawNumFighters(void)
|
||||||
|
|
|
@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "messageBox.h"
|
#include "messageBox.h"
|
||||||
|
|
||||||
static void calculateMessageBoxHeight(MessageBox *msg);
|
static void calculateMessageBoxHeight(MessageBox *msg);
|
||||||
|
static void nextMessage(void);
|
||||||
|
|
||||||
static MessageBox head;
|
static MessageBox head;
|
||||||
static MessageBox *tail;
|
static MessageBox *tail;
|
||||||
|
@ -34,12 +35,10 @@ void initMessageBox(void)
|
||||||
void addMessageBox(char *title, char *body, int important)
|
void addMessageBox(char *title, char *body, int important)
|
||||||
{
|
{
|
||||||
MessageBox *msg;
|
MessageBox *msg;
|
||||||
|
int isFirst;
|
||||||
float time;
|
float time;
|
||||||
|
|
||||||
if (tail == &head)
|
isFirst = (tail == &head);
|
||||||
{
|
|
||||||
playSound(SND_RADIO);
|
|
||||||
}
|
|
||||||
|
|
||||||
msg = malloc(sizeof(MessageBox));
|
msg = malloc(sizeof(MessageBox));
|
||||||
memset(msg, 0, sizeof(MessageBox));
|
memset(msg, 0, sizeof(MessageBox));
|
||||||
|
@ -53,6 +52,11 @@ void addMessageBox(char *title, char *body, int important)
|
||||||
STRNCPY(msg->body, body, MAX_DESCRIPTION_LENGTH);
|
STRNCPY(msg->body, body, MAX_DESCRIPTION_LENGTH);
|
||||||
msg->time = time * FPS;
|
msg->time = time * FPS;
|
||||||
msg->important = important;
|
msg->important = important;
|
||||||
|
|
||||||
|
if (isFirst)
|
||||||
|
{
|
||||||
|
nextMessage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void doMessageBox(void)
|
void doMessageBox(void)
|
||||||
|
@ -74,9 +78,11 @@ void doMessageBox(void)
|
||||||
free(msg);
|
free(msg);
|
||||||
msg = &head;
|
msg = &head;
|
||||||
|
|
||||||
|
battle.messageSpeaker = NULL;
|
||||||
|
|
||||||
if (head.next)
|
if (head.next)
|
||||||
{
|
{
|
||||||
playSound(SND_RADIO);
|
nextMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,6 +145,22 @@ void drawMessageBox(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void nextMessage(void)
|
||||||
|
{
|
||||||
|
Entity *e;
|
||||||
|
|
||||||
|
playSound(SND_RADIO);
|
||||||
|
|
||||||
|
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||||
|
{
|
||||||
|
if (strcmp(e->name, head.next->title) == 0)
|
||||||
|
{
|
||||||
|
battle.messageSpeaker = e;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void resetMessageBox(void)
|
void resetMessageBox(void)
|
||||||
{
|
{
|
||||||
MessageBox *messageBox;
|
MessageBox *messageBox;
|
||||||
|
|
|
@ -26,4 +26,5 @@ extern void limitTextWidth(int width);
|
||||||
extern void playSound(int sound);
|
extern void playSound(int sound);
|
||||||
|
|
||||||
extern App app;
|
extern App app;
|
||||||
|
extern Battle battle;
|
||||||
extern Colors colors;
|
extern Colors colors;
|
||||||
|
|
|
@ -344,6 +344,7 @@ typedef struct {
|
||||||
int numObjectivesComplete, numObjectivesTotal, numConditions;
|
int numObjectivesComplete, numObjectivesTotal, numConditions;
|
||||||
Entity *missionTarget;
|
Entity *missionTarget;
|
||||||
Entity *jumpgate;
|
Entity *jumpgate;
|
||||||
|
Entity *messageSpeaker;
|
||||||
SDL_Texture *background, *planetTexture;
|
SDL_Texture *background, *planetTexture;
|
||||||
PointF planet;
|
PointF planet;
|
||||||
int planetWidth, planetHeight;
|
int planetWidth, planetHeight;
|
||||||
|
|
Loading…
Reference in New Issue