Added type to message box, to allow for Pandoran messages, using different font.

This commit is contained in:
Steve 2016-05-15 10:00:06 +01:00
parent 510f84ea24
commit b6513dc1f7
6 changed files with 20 additions and 11 deletions

View File

@ -48,7 +48,7 @@ extern char *getTranslatedString(char *string);
extern void addLargeExplosion(void);
extern char **toTypeArray(char *types, int *numTypes);
extern void updateCondition(char *name, int type);
extern void addMessageBox(char *title, char *body, int important);
extern void addMessageBox(char *title, char *body, int type);
extern Battle battle;
extern Entity *player;

View File

@ -35,7 +35,7 @@ void initMessageBox(void)
lastWingmate = NULL;
}
void addMessageBox(char *title, char *body, int important)
void addMessageBox(char *title, char *body, int type)
{
MessageBox *msg;
int isFirst;
@ -54,7 +54,7 @@ void addMessageBox(char *title, char *body, int important)
STRNCPY(msg->title, title, MAX_NAME_LENGTH);
STRNCPY(msg->body, body, MAX_DESCRIPTION_LENGTH);
msg->time = time * FPS;
msg->important = important;
msg->type = type;
if (isFirst)
{
@ -124,13 +124,13 @@ void drawMessageBox(void)
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
if (!msg->important)
if (msg->type == MB_IMPORTANT)
{
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128);
SDL_SetRenderDrawColor(app.renderer, 255, 0, 0, 64);
}
else
{
SDL_SetRenderDrawColor(app.renderer, 255, 0, 0, 64);
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128);
}
SDL_RenderFillRect(app.renderer, &r);
@ -142,7 +142,7 @@ void drawMessageBox(void)
limitTextWidth(575);
drawText(r.x + 10, r.y + 30, 18, TA_LEFT, (!msg->important) ? colors.white : colors.red, msg->body);
drawText(r.x + 10, r.y + 30, (msg->type == MB_PANDORAN) ? 0 : 18, TA_LEFT, (msg->type != MB_IMPORTANT) ? colors.white : colors.red, msg->body);
limitTextWidth(0);
}

View File

@ -228,12 +228,17 @@ static void executeNextLine(ScriptRunner *runner)
else if (strcmp(command, "MSG_BOX") == 0)
{
sscanf(line, "%*s %255[^;]%*c%255[^\n]", strParam[0], strParam[1]);
addMessageBox(strParam[0], _(strParam[1]), 0);
addMessageBox(strParam[0], _(strParam[1]), MB_NORMAL);
}
else if (strcmp(command, "IMPORTANT_MSG_BOX") == 0)
{
sscanf(line, "%*s %255[^;]%*c%255[^\n]", strParam[0], strParam[1]);
addMessageBox(strParam[0], _(strParam[1]), 1);
addMessageBox(strParam[0], _(strParam[1]), MB_IMPORTANT);
}
else if (strcmp(command, "PANDORAN_MSG_BOX") == 0)
{
sscanf(line, "%*s %255[^;]%*c%255[^\n]", strParam[0], strParam[1]);
addMessageBox(strParam[0], _(strParam[1]), MB_PANDORAN);
}
else if (strcmp(command, "WAIT") == 0)
{

View File

@ -27,7 +27,7 @@ extern void failMission(void);
extern void retreatEnemies(void);
extern void retreatAllies(void);
extern void addHudMessage(SDL_Color c, char *format, ...);
extern void addMessageBox(char *title, char *body, int important);
extern void addMessageBox(char *title, char *body, int type);
extern void activateEntities(char *name);
extern void activateEntityGroups(char *groupName);
extern void activateLocations(char *locations);

View File

@ -135,6 +135,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define BOOST_FINISHED_TIME (FPS * 0.75)
#define ECM_RECHARGE_TIME (FPS * 7)
#define MB_NORMAL 0
#define MB_IMPORTANT 1
#define MB_PANDORAN 2
enum
{
CONTROL_FIRE,

View File

@ -441,7 +441,7 @@ struct MessageBox {
char body[MAX_DESCRIPTION_LENGTH];
int time;
int height;
int important;
int type;
MessageBox *next;
};