1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
|
/* $Id: title.c,v 1.4 1998/05/11 06:52:59 mrogre Exp $ */
/* Copyright (c) 1998 Joe Rumsey (mrogre@mediaone.net) */
#include "copyright.h"
#include <config.h>
#include <stdio.h>
#include "Wlib.h"
#include "defs.h"
#include "images.h"
#include "data.h"
#include "struct.h"
#include "proto.h"
W_Image *pauseImage, *titleImage;
int pausex, pausey, pauseyspeed=1;
void undo_pause()
{
W_CacheClearArea(baseWin, pausex-(pauseImage->width/2), pausey-(pauseImage->height/2),
pauseImage->width, pauseImage->height);
}
void do_pause()
{
if((pausey < pauseImage->height/2) || ((pausey+(pauseImage->height/2)) >= WINHEIGHT))
pauseyspeed = -pauseyspeed;
pausey+=pauseyspeed;
W_DrawImage(baseWin, pausex-(pauseImage->width/2), pausey-(pauseImage->height/2), 0, pauseImage, W_White);
}
void
center_text(char *text, int y, W_Color color)
{
/*
W_MaskText(baseWin, WINWIDTH/2 - ((strlen(text)*W_Textwidth)/2)-1, y+1, W_Black,
text, strlen(text), W_RegularFont);
*/
W_MaskText(baseWin, WINWIDTH/2 - ((strlen(text)*W_Textwidth)/2), y, color,
text, strlen(text), W_RegularFont);
}
#if 0 /* ships vary from level to level now */
static void show_points()
{
int i, ty;
int a_images[6] = {
I_ALIEN1,
I_ALIEN2,
I_ALIEN3,
I_ALIEN4,
I_ALIEN5,
I_ALIEN6
};
char buf[40];
for (i=0;i<6;i++) {
W_DrawImage(baseWin, WINWIDTH/2 - 30, 220+i*21,
0, getImage(a_images[5-i]), W_Red);
if(i < 5)
sprintf(buf, "- %d", (i+1)*100);
else
sprintf(buf, "- ???");
W_MaskText(baseWin, WINWIDTH/2, 225+i*21,
W_Yellow, buf, strlen(buf), W_RegularFont);
}
ty = 220+i*21;
center_text("Ships in convoy are worth 50 points", ty, W_Green); ty += W_Textheight;
center_text("Bonus ships at 20,000, 50,000, then every 50,000.", ty, W_Green);
}
#endif
static void show_help()
{
int top = 270;
center_text(" Keyboard controls ", top, W_Red);
center_text(" left/right arrow move ", top+10, W_Yellow);
center_text(" space bar fire ", top+20, W_Yellow);
center_text(" p pause ", top+30, W_Cyan);
center_text(" q end game ", top+40, W_Cyan);
center_text(" Q quick quit ", top+50, W_Cyan);
center_text(" k keyboard control", top+60, W_Cyan);
center_text(" m mouse control ", top+70, W_Cyan);
#ifndef ORIGINAL_XGALAGA
center_text(" x toggle shields ", top+80, W_Cyan);
#endif
#ifdef SOUND
center_text(" s toggle sound ", top+90, W_Cyan);
#endif
center_text("Bonus ships at 20,000, 50,000, then every 50,000.", top+120, W_Green);
center_text("XGalaga Home page: http://rumsey.org/xgal.html",
top+150, W_Cyan);
}
void do_title()
{
int ty;
char vbuf[10];
W_DrawImage(baseWin, WINWIDTH/2 - titleImage->width/2, 50, 0, titleImage, W_Red);
sprintf(vbuf, "v%s", VERSION);
center_text(vbuf, 40+titleImage->height, W_Yellow);
ty = 60 + titleImage->height;
if(getting_name)
title_page = 0;
switch(title_page) {
case 0:
center_text("Copyright (c) 1995-1998 Joe Rumsey", ty, W_Green); ty+= W_Textheight;
center_text("<mrogre@mediaone.net>", ty, W_Green); ty+= 2*W_Textheight;
#ifndef ORIGINAL_XGALAGA
center_text("XGalaga: Hyperspace 0.9", ty, W_Green); ty+= W_Textheight;
center_text("Modifications by:", ty, W_Green); ty+= W_Textheight;
center_text("Bryce Wagner - John Strickland - David Enderson", ty, W_Green); ty+= 2*W_Textheight;
#endif
center_text("This game is free software, covered by the GPL", ty, W_Yellow); ty += W_Textheight;
center_text("If you enjoy it, visit http://www.gnu.org and help", ty, W_Yellow); ty+= W_Textheight;
center_text("support the Free Software Foundation", ty, W_Yellow);ty+= W_Textheight;
if(!getting_name) {
show_help();
}
break;
case 1:
default:
show_scores();
break;
}
#ifdef __linux__
if (js_device)
center_text("Press k for keyboard or joystick control, m for mouse", WINHEIGHT - 2*W_Textheight, W_Yellow);
else /* no joystick, so use message below */
#endif
center_text("Press k for keyboard control, m for mouse", WINHEIGHT - 2*W_Textheight, W_Yellow);
center_text("Or q to quit", WINHEIGHT - W_Textheight, W_Yellow);
pagetimer--;
if(!pagetimer) {
W_ClearWindow(baseWin);
title_page++;
if(title_page > 1)
title_page = 0;
pagetimer = 300;
}
}
void init_titles()
{
titleImage = getImage(I_TITLE);
pauseImage = getImage(I_PAUSE);
pausex = WINWIDTH/2;
pausey = WINHEIGHT/2;
pauseyspeed = 3;
}
|