3
Dodgin' Diamond 2, a shot'em up arcade
4
Copyright (C) 2003,2004 Juan J. Martinez <jjm@usebox.net>
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License Version 2 as
8
published by the Free Software Foundation.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
31
b=SDL_DisplayFormat(a);
40
writeNumber(SDL_Surface *src, SDL_Surface *dst, int x, int y, int number, int padd)
43
char buffer[32],fmt[16];
46
sprintf(fmt,"%%.%ii",padd);
47
sprintf(buffer,fmt,number);
55
for(i=0;i<strlen(buffer);i++) {
57
b.x=101+(buffer[i]-'0')*9;
58
SDL_BlitSurface(src, &b, dst, &a);
63
drawPanel(SDL_Surface *src, SDL_Surface *dst, pDesc *player)
75
SDL_BlitSurface(src, &b, dst, &a);
80
SDL_BlitSurface(src, &b, dst, &a);
83
if(!player[0].shield && !player[1].shield) {
90
SDL_BlitSurface(src, &b, dst, &a);
99
switch(player[i].weapon) {
118
writeNumber(src,dst,a.x-10,a.y-1,player[i].level+1,1);
119
writeNumber(src,dst,a.x-15,a.y+14,player[i].score,6);
121
writeNumber(src,dst,a.x+b.w+2,a.y-1,player[i].level+1,1);
122
writeNumber(src,dst,2,a.y+14,player[i].score,6);
125
SDL_BlitSurface(src, &b, dst, &a);
128
b.w=(player[i].shield*38)/10;
133
a.x=SCREENW-(54+38)+(38-b.w);
138
SDL_BlitSurface(src, &b, dst, &a);
143
/* x,y, w,h for each leter */
144
static const struct font_descr_struct {
150
{ 'a', { 288,0,12,17 } }, /* a */
151
{ 'b', { 302,0,11,17 } }, /* b */
152
{ 'c', { 314,0,11,17 } }, /* c */
153
{ 'd', { 327,0,11,17 } }, /* d */
154
{ 'e', { 340,0,11,17 } }, /* e */
155
{ 'f', { 354,0,7,17 } }, /* f */
156
{ 'g', { 362,0,11,17 } }, /* g */
157
{ 'h', { 376,0,10,17 } }, /* h */
158
{ 'i', { 389,0,6,17 } }, /* i */
159
{ 'j', { 396,0,9,17 } }, /* j */
160
{ 'k', { 408,0,11,17 } }, /* k */
161
{ 'l', { 421,0,6,17 } }, /* l */
162
{ 'm', { 430,0,14,17 } }, /* m */
163
{ 'n', { 446,0,10,17 } }, /* n */
164
{ 'o', { 458,0,11,17 } }, /* o */
165
{ 'p', { 472,0,11,17 } }, /* p */
166
{ 'q', { 484,0,11,17 } }, /* q */
167
{ 'r', { 498,0,7,17 } }, /* r */
168
{ 's', { 506,0,9,17 } }, /* s */
169
{ 't', { 517,0,7,17 } }, /* t */
170
{ 'u', { 527,0,10,17 } }, /* u */
171
{ 'v', { 539,0,10,17 } }, /* v */
172
{ 'w', { 550,0,14,17 } }, /* w */
173
{ 'x', { 566,0,10,17 } }, /* x */
174
{ 'y', { 579,0,10,17 } }, /* y */
175
{ 'z', { 591,0,11,17 } }, /* z */
176
{ '0', { 604,0,13,17 } }, /* 0 */
177
{ '1', { 620,0,6,17 } }, /* 1 */
178
{ '2', { 628,0,9,17 } }, /* 2 */
179
{ '3', { 640,0,8,17 } }, /* 3 */
180
{ '4', { 651,0,10,17 } }, /* 4 */
181
{ '5', { 663,0,8,17 } }, /* 5 */
182
{ '6', { 674,0,10,17 } }, /* 6 */
183
{ '7', { 686,0,9,17 } }, /* 7 */
184
{ '8', { 698,0,9,17 } }, /* 8 */
185
{ '9', { 709,0,11,17 } }, /* 9 */
186
{ '+', { 722,0,9,17 } }, /* HUD */
187
{ '.', { 437,39,9,17 } }, /* . */
192
/* ONLY supports lowcase letters */
194
writeCString(SDL_Surface *src, SDL_Surface *dst, int x, int y, char *str, int color)
199
/* that's damn slow, but portable to different character sets */
200
for(i=0,a.x=x,a.y=y;i<strlen(str);i++) {
201
for(j=0; font_descr[j].key && j!=-1; j++) {
202
if(font_descr[j].key==str[i]) {
203
b=font_descr[j].font_rect;
206
SDL_BlitSurface(src, &b, dst, &a);
219
/* ugly!!!! needs review */