Antarctica 1
antarctica
-255
+100
Mortimers_chipdisko.mod
arctis.png
128
375
......cdef......2.........................................cdef.........................................................CDEF.....................................cdedef..........................................................CDEF........................................................................cdef..............cf....................................................cde
.......................................................................................................................cdef.....................................................................................................cdef...................................................................................................................................................
-......................CDEF........................................CDEF.......................................................................CDEF....................................CDEF.......................................................................................................CDEDEF................................................................[.........*......
-......................cdef........................................cdef.......................................................................cdef.............................$......cdef.......................................................................................................cdedef...............................................................[#........\|......
-....................................CDEDEF.................................................................................................................................$....$.............................................................................................CDEF.....................................................0............................[##.........|......
-....................................cdedef...................................................CDEF................0..............................................................CDEF............................................................CDEF..........................cdef............................................###.###..#...........................[###.........|......
-...........................A.................................................................cdef............YYYYYYYY...YYYYYA....................A....................$........cdef............................................................cdef....................................A.....................................#...#.#..#..........................[####.........|.....C
-....................................................................................................................................................................$...0.........$...........................................................................................................................................#.#.#.#............................[#####.........|.....c
-.................................................................................................................................................................$...0###.....................................................................................................................................................#.#.#.#.CDEF......................[######EF.......|......
-..............................................................................................................................................................$...0######...............................[==]................[==...]...........................................................................................###.###.c#ef.....................[#######ef.......|......
-.....................A...XBXAX...........................................[=].................[=]..........XBX................x.........A!......A..A..A.........0#########...........$..................[####]..............[###...#].................XAXXBX....................................$.$.$.$1.......................................................[########.........|......
-............................................................[=]..........###.................###.............................................................############.............................[######]............[####...##]...........###...........###......................[=]....#########....[=]...............................................[#########.........|......
+......................CD#F.#......................................CDEF.......................................................................CDEF....................................CDEF.......................................................................................................CDEDEF................................................................[.........*......
+............XXXX......cdef.##.....................................cdef.......................................................................cdef.............................$......cdef.......................................................................................................cdedef...............................................................[#........\|......
+...XX.XXXXX.....X...................CDEDEF.................................................................................................................................$....$.............................................................................................CDEF.....................................................0............................[##.........|......
+...X.....a.......XX.................cdedef...................................................CDEF................0..............................................................CDEF............................................................CDEF..........................cdef............................................###.###..#...........................[###.........|......
+..X......aaaaa.....X.......A.................................................................cdef............YYYYYYYY...YYYYYA....................A....................$........cdef............................................................cdef....................................A.....................................#...#.#..#..........................[####.........|.....C
+....X........a......XXX.............................................................................................................................................$...0.........$...........................................................................................................................................#.#.#.#............................[#####.........|.....c
+.......A.....aa..................................................................................................................................................$...0###.....................................................................................................................................................#.#.#.#.CDEF......................[######EF.......|......
+..BB.....BB...aa........##....................................................................................................................................$...0######.....0.........................[==]................[==...]...........................................................................................###.###.c#ef.....................[#######ef.......|......
+...........!...a.....A...#####...........................................[=].................[=]..........XBX................x.........A!......A..A..A.........0#########..yyyyy....$..................[####]..............[###...#].................XAXXBX....................................$.$.$.$1.......................................................[########.........|......
+......................#.#.##................................[=]..........###.................###.............................................................############.............................[######]............[####...##]...........###...........###......................[=]....#########....[=]...............................................[#########.........|......
.....................................GHJ..........[=]......G###..........###....GHIJ.........###.............................................................############............................[########]HIJ.......[#####...###]..........###...........###......................###.................###................GHIJ.......................GHI[##########.........|......
..GHIJ...........................0...ghj..........###......g###..GHIJ 0..###....ghij.0.0.0...###.......................GHIJ.........0.0..1.........0.0.......############.............$....0.0.0....[##########]ij......[######...####]...GHIJ..###........0.0###HIJ......1....0.0.0...###...0.0.0.........###................ghij.......................gh[###########==========]^^^^^
===================================================================================================]...[=====########..g######===============================############^^^^^^^^^^#######=============================]#######...#####[=================================================]#################[===============================================#######################&&&&&
case 1:
savegame();
break;
- case 2:
- loadgame(NULL);
- break;
case 4:
done = 1;
break;
intro.c
Super Tux - Intro Screen
-
+
by Bill Kendrick
bill@newbreedsoftware.com
http://www.newbreedsoftware.com/supertux/
++scene;
/* Helicopter begins to fly in: */
- erasecenteredtext(intro_text[0], 454, &bkgd, NO_UPDATE, 1);
+ erasecenteredtext(&white_text, intro_text[0], 454, &bkgd, NO_UPDATE, 1);
text_drawf(&white_text, intro_text[1], 0,-8, A_HMIDDLE, A_BOTTOM, 0, NO_UPDATE);
}
texture_draw(&tux_upset, 270, 400, UPDATE);
- erasecenteredtext(intro_text[1], 454, &bkgd, UPDATE, 1);
+ erasecenteredtext(&white_text, intro_text[1], 454, &bkgd, UPDATE, 1);
text_drawf(&white_text, intro_text[2], 0,-8, A_HMIDDLE, A_BOTTOM, 0, NO_UPDATE);
}
texture_draw(&tux_mad, 270, 400, UPDATE);
- erasecenteredtext(intro_text[2], 454, &bkgd, UPDATE, 1);
+ erasecenteredtext(&white_text, intro_text[2], 454, &bkgd, UPDATE, 1);
text_drawf(&white_text, intro_text[3], 0,-8, A_HMIDDLE, A_BOTTOM, 0, NO_UPDATE);
}
int menuaction;
int show_menu;
int menu_change;
-texture_type checkbox, checkbox_checked;
+texture_type checkbox, checkbox_checked, back;
-menu_type main_menu, game_menu, options_menu, leveleditor_menu, highscore_menu;
+menu_type main_menu, game_menu, options_menu, leveleditor_menu, highscore_menu, load_game_menu;
menu_type* current_menu, * last_menu;
/* input implementation variables */
if(pmenu->item[pmenu->active_item].kind == MN_TEXTFIELD)
{
if(pmenu->item[pmenu->active_item].input != NULL)
- {
+ {
i = strlen(pmenu->item[pmenu->active_item].input);
pmenu->item[pmenu->active_item].input = (char*) realloc(pmenu->item[pmenu->active_item].input,sizeof(char)*(i + 2));
pmenu->item[pmenu->active_item].input[i] = mn_input_char;
break;
}
}
-
- menuaction = -1;
- if(pmenu->item[pmenu->active_item].kind == MN_DEACTIVE)
- menu_action(pmenu);
+ if(pmenu->item[pmenu->active_item].kind == MN_DEACTIVE || pmenu->item[pmenu->active_item].kind == MN_LABEL)
+ {
+ if(menuaction != MN_UP && menuaction != MN_DOWN)
+ menuaction = MN_DOWN;
+
+ if(pmenu->num_items > 1)
+ menu_action(pmenu);
+ }
+
}
/* Check, if the value of the active menu item has changed. */
menu_width = 0;
for(i = 0; i < pmenu->num_items; ++i)
{
- y = strlen(pmenu->item[i].text) + (pmenu->item[i].input ? strlen(pmenu->item[i].input) : 0);
+ y = strlen(pmenu->item[i].text) + (pmenu->item[i].input ? strlen(pmenu->item[i].input) : 0);
if( y > menu_width )
{
menu_width = y;
}
menu_width = menu_width * 16 + 48;
menu_height = (pmenu->num_items) * 24;
-
+
/* Draw a transparent background */
fillrect(screen->w/2 - menu_width/2,screen->h/2-(((pmenu->num_items)*24)/2),menu_width,menu_height,150,150,150,100);
{
text_drawf(&black_text,pmenu->item[i].text,0,(i)*24 - menu_height/2 + 10,A_HMIDDLE, A_VMIDDLE,2,NO_UPDATE);
}
+ else if(pmenu->item[i].kind == MN_LABEL)
+ {
+ text_drawf(&gold_text,pmenu->item[i].text,0,(i)*24 - menu_height/2 + 10,A_HMIDDLE, A_VMIDDLE,2,NO_UPDATE);
+ fillrect(screen->w/2 - menu_width/2,(i)*24 - menu_height/2 + 28,menu_width,2,150,150,150,100);
+ }
else if(pmenu->item[i].kind == MN_TEXTFIELD)
{
text_drawf(&gold_text,pmenu->item[i].input,(strlen(pmenu->item[i].text) * 16)/2,(i)*24 - menu_height/2 + 10,A_HMIDDLE, A_VMIDDLE,2,NO_UPDATE);
else
texture_draw(&checkbox,screen->w / 2 + (strlen(pmenu->item[i].text) * 16)/2 + 16,(i)*24 - menu_height/2 + 10 + screen->h / 2 - 8,NO_UPDATE);
}
+ else if(pmenu->item[i].kind == MN_BACK)
+ {
+ texture_draw(&back,screen->w / 2 + (strlen(pmenu->item[i].text) * 16)/2 + 16,(i)*24 - menu_height/2 + 10 + screen->h / 2 -8,NO_UPDATE);
+ }
}
}
}
else
{
- mn_input_char = '\0';
- }
+ mn_input_char = '\0';
+ }
break;
}
MN_TOGGLE,
MN_BACK,
MN_DEACTIVE,
- MN_TEXTFIELD
+ MN_TEXTFIELD,
+ MN_LABEL
};
/* Action done on the menu */
extern int menuaction;
extern int show_menu;
extern int menu_change;
-extern texture_type checkbox, checkbox_checked;
+extern texture_type checkbox, checkbox_checked, back;
-extern menu_type main_menu, game_menu, options_menu, leveleditor_menu, highscore_menu;
+extern menu_type main_menu, game_menu, options_menu, leveleditor_menu, highscore_menu, load_game_menu;
extern menu_type* current_menu, * last_menu;
/* input implementation variables */
#include "timer.h"
enum {
- PH_VT, /* Vertical throw.*/
+ PH_VT /* Vertical throw.*/
};
/* Physic type: */
if (!pplayer->dying)
{
/* FIXME: this code is COMPLETLY broken!!! */
- if (issolid(pplayer->base.x, pplayer->base.y + 31) &&
+ /* if (issolid(pplayer->base.x, pplayer->base.y + 31) &&
!issolid(pplayer->base.x- pplayer->base.xm, pplayer->base.y + 31))
{
while (issolid(pplayer->base.x, pplayer->base.y + 31))
}
pplayer->base.xm = 0;
- }
+ }*/
- if (issolid(pplayer->base.x, pplayer->base.y) &&
+ /*if (issolid(pplayer->base.x, pplayer->base.y) &&
!issolid(pplayer->base.x- pplayer->base.xm, pplayer->base.y))
{
while (issolid(pplayer->base.x, (pplayer->base.y)))
}
pplayer->base.xm = 0;
- }
+ }*/
if (issolid(pplayer->base.x, pplayer->base.y + 31))
{
pplayer->base.ym = 0;
}
- if ((!issolid(pplayer->base.x - pplayer->base.xm * frame_ratio, pplayer->base.y) && (issolid(pplayer->base.x, pplayer->base.y) || issolid(pplayer->base.x+32, pplayer->base.y))
- /*(pplayer->size == SMALL || pplayer->duck ||
- !issolid(pplayer->base.x- pplayer->base.xm, pplayer->base.y - 32))*/) || ( pplayer->size == BIG && (
- (!issolid(pplayer->base.x - pplayer->base.xm * frame_ratio, pplayer->base.y+32) && (issolid(pplayer->base.x, pplayer->base.y+32) || issolid(pplayer->base.x+32, pplayer->base.y+32))
+ if (((issolid(pplayer->base.x, pplayer->base.y) || issolid(pplayer->base.x+32, pplayer->base.y)) && (!issolid(pplayer->base.x - pplayer->base.xm * frame_ratio, pplayer->base.y))
/*(pplayer->size == SMALL || pplayer->duck ||
- !issolid(pplayer->base.x- pplayer->base.xm, pplayer->base.y - 32))*/))))
+ !issolid(pplayer->base.x- pplayer->base.xm, pplayer->base.y - 32))*/) ||
+ (!issolid(pplayer->base.x - pplayer->base.xm * frame_ratio, pplayer->base.y+pplayer->base.height) && (issolid(pplayer->base.x, pplayer->base.y+pplayer->base.height) || issolid(pplayer->base.x +32, pplayer->base.y+pplayer->base.height))))
{
- pplayer->base.x = pplayer->base.x- pplayer->base.xm * frame_ratio;
+ pplayer->base.x = pplayer->base.x- pplayer->base.xm * frame_ratio;
pplayer->base.xm = 0;
}
SDL_UpdateRect(scr, x, y, w, h);
}
-
-/* --- ERASE TEXT: --- */
-
-void erasetext(char * text, int x, int y, texture_type * ptexture, int update, int shadowsize)
-{
- SDL_Rect dest;
-
-
- dest.x = x;
- dest.y = y;
- dest.w = strlen(text) * 16 + shadowsize;
- dest.h = 17;
-
- if (dest.w > screen->w)
- dest.w = screen->w;
-
- texture_draw_part(ptexture,dest.x,dest.y,dest.x,dest.y,dest.w,dest.h,update);
-
- if (update == UPDATE)
- update_rect(screen, dest.x, dest.y, dest.w, dest.h);
-}
-
-
-/* --- ERASE CENTERED TEXT: --- */
-
-void erasecenteredtext(char * text, int y, texture_type * ptexture, int update, int shadowsize)
-{
- erasetext(text, screen->w / 2 - (strlen(text) * 8), y, ptexture, update, shadowsize);
-}
void updatescreen(void);
void flipscreen(void);
SDL_Surface * load_image(char * file, int use_alpha);
-void erasetext(char * text, int x, int y, texture_type * surf, int update, int shadowsize);
-void erasecenteredtext(char * text, int y, texture_type * surf, int update, int shadowsize);
void update_rect(SDL_Surface *scr, Sint32 x, Sint32 y, Sint32 w, Sint32 h);
#endif /*SUPERTUX_SCREEN_H*/
void free_strings(char **strings, int num)
{
-int i;
-for(i=0; i < num; ++i)
-free(strings[i]);
+ int i;
+ for(i=0; i < num; ++i)
+ free(strings[i]);
}
/* --- SETUP --- */
menu_init(&main_menu);
menu_additem(&main_menu,menu_item_create(MN_ACTION,"Start Game",0,0));
- menu_additem(&main_menu,menu_item_create(MN_ACTION,"Load Game",0,0));
+ menu_additem(&main_menu,menu_item_create(MN_GOTO,"Load Game",0,&load_game_menu));
menu_additem(&main_menu,menu_item_create(MN_GOTO,"Options",0,&options_menu));
menu_additem(&main_menu,menu_item_create(MN_ACTION,"Level editor",0,0));
menu_additem(&main_menu,menu_item_create(MN_ACTION,"Quit",0,0));
menu_additem(&leveleditor_menu,menu_item_create(MN_ACTION,"Save Level",0,0));
menu_additem(&leveleditor_menu,menu_item_create(MN_ACTION,"Quit Level Editor",0,0));
+ menu_init(&load_game_menu);
+ menu_additem(&load_game_menu,menu_item_create(MN_LABEL,"Load Game",0,0));
+
menu_init(&game_menu);
menu_additem(&game_menu,menu_item_create(MN_ACTION,"Return To Game",0,0));
menu_additem(&game_menu,menu_item_create(MN_ACTION,"Save Game",0,0));
- menu_additem(&game_menu,menu_item_create(MN_ACTION,"Load Game",0,0));
+ menu_additem(&game_menu,menu_item_create(MN_GOTO,"Load Game",0,&load_game_menu));
menu_additem(&game_menu,menu_item_create(MN_GOTO,"Options",0,&options_menu));
menu_additem(&game_menu,menu_item_create(MN_ACTION,"Quit Game",0,0));
/* Load GUI/menu images: */
texture_load(&checkbox, DATA_PREFIX "/images/status/checkbox.png", USE_ALPHA);
texture_load(&checkbox_checked, DATA_PREFIX "/images/status/checkbox-checked.png", USE_ALPHA);
-
+ texture_load(&back, DATA_PREFIX "/images/status/back.png", USE_ALPHA);
+
/* Set icon image: */
seticon();
text_free(&white_text);
text_free(&blue_text);
text_free(&red_text);
- text_free(&white_small_text);
-
+ text_free(&white_small_text);
+
/* Free GUI/menu images: */
texture_free(&checkbox);
texture_free(&checkbox_checked);
-
+ texture_free(&back);
+
/* Free menus */
menu_free(&main_menu);
if(kind == TEXT_TEXT)
{
- ptext->chars = (texture_type*) malloc(sizeof(texture_type) * 79);
- ptext->shadow_chars = (texture_type*) malloc(sizeof(texture_type) * 79);
mx = 26;
my = 3;
}
else if(kind == TEXT_NUM)
{
- ptext->chars = (texture_type*) malloc(sizeof(texture_type) * 10);
- ptext->shadow_chars = (texture_type*) malloc(sizeof(texture_type) * 10);
mx = 10;
my = 1;
}
else
{
- ptext->chars = NULL;
- ptext->shadow_chars = NULL;
mx = 0;
my = 0;
}
ptext->w = w;
ptext->h = h;
- for(y = 0; y < my ; ++y)
- {
- for(x = 0; x < mx ; ++x)
- {
- texture_load_part(&ptext->chars[y*mx+x],file,x*w,y*h,w,h, USE_ALPHA);
- }
- }
+texture_load(&ptext->chars, file, USE_ALPHA);
/* Load shadow font. */
- for(y = 0; y < my ; ++y)
- {
- for(x = 0; x < mx ; ++x)
- {
int pixels;
int i;
- conv = SDL_DisplayFormatAlpha(ptext->chars[y*mx+x].sdl_surface);
+ conv = SDL_DisplayFormatAlpha(ptext->chars.sdl_surface);
pixels = conv->w * conv->h;
SDL_LockSurface(conv);
for(i = 0; i < pixels; ++i)
}
SDL_UnlockSurface(conv);
SDL_SetAlpha(conv, SDL_SRCALPHA, 128);
- texture_from_sdl_surface(&ptext->shadow_chars[y*mx+x],conv,USE_ALPHA);
- }
- }
+ texture_from_sdl_surface(&ptext->shadow_chars,conv,USE_ALPHA);
+SDL_FreeSurface(conv);
}
void text_draw(text_type* ptext, char* text, int x, int y, int shadowsize, int update)
if(text != NULL)
{
if(shadowsize != 0)
- text_draw_chars(ptext,&ptext->shadow_chars[0], text,x+shadowsize,y+shadowsize, update);
+ text_draw_chars(ptext,&ptext->shadow_chars, text,x+shadowsize,y+shadowsize, update);
- text_draw_chars(ptext,ptext->chars, text,x,y, update);
+ text_draw_chars(ptext,&ptext->chars, text,x,y, update);
}
}
void text_draw_chars(text_type* ptext, texture_type* pchars, char* text, int x, int y, int update)
{
int i,len;
+int w, h;
len = strlen(text);
+ w = ptext->w; h = ptext->h;
if(ptext->kind == TEXT_TEXT)
{
for( i = 0; i < len; ++i)
{
if( text[i] >= 'A' && text[i] <= 'Z')
- {
- texture_draw(&pchars[(int)(text[i] - 'A')],x+i*ptext->w,y,update);
- }
+ texture_draw_part(pchars, (int)(text[i] - 'A')*w, 0, x+(i*w), y, ptext->w, ptext->h, update);
else if( text[i] >= 'a' && text[i] <= 'z')
- {
- texture_draw(&pchars[(int)(text[i] - 'a') + 26],x+i*ptext->w,y,update);
- }
+ texture_draw_part(pchars, (int)(text[i] - 'a')*w, h, x+(i*w), y, ptext->w, ptext->h, update);
else if ( text[i] >= '!' && text[i] <= '9')
- {
- texture_draw(&pchars[(int)(text[i] - '!') + 52],x+i*ptext->w,y,update);
- }
+ texture_draw_part(pchars, (int)(text[i] - '!')*w, h*2, x+(i*w), y, ptext->w, ptext->h, update);
else if ( text[i] == '?')
- {
- texture_draw(&pchars[77],x+i*ptext->w,y,update);
- }
+ texture_draw_part(pchars, 25*w, h*2, x+(i*w), y, ptext->w, ptext->h, update);
else if ( text[i] == '\n')
{
y += ptext->h + 2;
for( i = 0; i < len; ++i)
{
if ( text[i] >= '0' && text[i] <= '9')
- {
- texture_draw(&pchars[(int)(text[i] - '0')],x+i*ptext->w,y,update);
- }
+ texture_draw_part(pchars, (int)(text[i] - '0')*w, 0, x+(i*w), y, w, h, update);
else if ( text[i] == '\n')
{
y += ptext->h + 2;
{
int c;
if(ptext->kind == TEXT_TEXT)
- {
- for( c = 0; c < 78; ++c)
- texture_free(&ptext->chars[c]);
- }
+ texture_free(&ptext->chars);
else if(ptext->kind == TEXT_NUM)
- {
- for( c = 0; c < 10; ++c)
- texture_free(&ptext->chars[c]);
- }
+ texture_free(&ptext->chars);
+}
+
+/* --- ERASE TEXT: --- */
+
+void erasetext(text_type* ptext, char * text, int x, int y, texture_type * ptexture, int update, int shadowsize)
+{
+ SDL_Rect dest;
+
+
+ dest.x = x;
+ dest.y = y;
+ dest.w = strlen(text) * ptext->w + shadowsize;
+ dest.h = ptext->h;
+
+ if (dest.w > screen->w)
+ dest.w = screen->w;
+
+ texture_draw_part(ptexture,dest.x,dest.y,dest.x,dest.y,dest.w,dest.h,update);
+
+ if (update == UPDATE)
+ update_rect(screen, dest.x, dest.y, dest.w, dest.h);
+}
+
+
+/* --- ERASE CENTERED TEXT: --- */
+
+void erasecenteredtext(text_type* ptext, char * text, int y, texture_type * ptexture, int update, int shadowsize)
+{
+ erasetext(ptext, text, screen->w / 2 - (strlen(text) * 8), y, ptexture, update, shadowsize);
}
/* Text type */
typedef struct text_type
{
- texture_type* chars;
- texture_type* shadow_chars;
+ texture_type chars;
+ texture_type shadow_chars;
int kind;
int w;
int h;
void text_draw_chars(text_type* ptext, texture_type* pchars, char* text, int x, int y, int update);
void text_drawf(text_type* ptext, char* text, int x, int y, int halign, int valign, int shadowsize, int update);
void text_free(text_type* ptext);
+void erasetext(text_type* ptext, char * text, int x, int y, texture_type * surf, int update, int shadowsize);
+void erasecenteredtext(text_type* ptext, char * text, int y, texture_type * surf, int update, int shadowsize);
#endif /*SUPERTUX_TEXT_H*/
sprintf(str, "by %s", hs_name);
text_drawf(&gold_text, str, 0, -20, A_HMIDDLE, A_BOTTOM, 1, NO_UPDATE);
+ /* Animate title screen: */
+
+ pict = (frame / 5) % 3;
+
+ if (pict == 0)
+ texture_draw_part(&title, 560, 270, 560, 270, 80, 75, NO_UPDATE);
+ else if (pict == 1)
+ texture_draw(&anim1, 560, 270, NO_UPDATE);
+ else if (pict == 2)
+ texture_draw(&anim2, 560, 270, NO_UPDATE);
+
/* Don't draw menu, if quit is true */
if(show_menu && !quit)
menu_process_current();
{
process_options_menu();
}
- /* Animate title screen: */
-
- pict = (frame / 5) % 3;
-
- if (pict == 0)
- texture_draw_part(&title, 560, 270, 560, 270, 80, 75, NO_UPDATE);
- else if (pict == 1)
- texture_draw(&anim1, 560, 270, NO_UPDATE);
- else if (pict == 2)
- texture_draw(&anim2, 560, 270, NO_UPDATE);
flipscreen();