[Super-tux-commit] supertux/src badguy.cpp,1.108,1.109 badguy.h,1.56,1.57 gameobjs.cpp,1.41,1.42 gam
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-07-01 13:39:36
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26502/src Modified Files: badguy.cpp badguy.h gameobjs.cpp gameobjs.h menu.cpp sprite.h Log Message: Changes: - testing for existing sector in badguy; - made flying object and trampoline's gfx accessible; - added sprite and badguys surface pointer return func. Index: menu.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/menu.cpp,v retrieving revision 1.81 retrieving revision 1.82 diff -u -d -r1.81 -r1.82 --- menu.cpp 28 Jun 2004 17:12:34 -0000 1.81 +++ menu.cpp 1 Jul 2004 13:39:25 -0000 1.82 @@ -553,7 +553,7 @@ { context.draw_text_center(gray_text, pitem.text, Vector(0, y_pos - int(blue_text->get_height()/2)), - LAYER_FOREGROUND1); + LAYER_GUI); break; } @@ -564,16 +564,16 @@ int y = y_pos - 12 - effect_offset; /* Draw a horizontal line with a little 3d effect */ context.draw_filled_rect(Vector(x, y + 6), - Vector(menu_width, 4), Color(150,200,255,225), LAYER_FOREGROUND1); + Vector(menu_width, 4), Color(150,200,255,225), LAYER_GUI); context.draw_filled_rect(Vector(x, y + 6), - Vector(menu_width, 2), Color(255,255,255,255), LAYER_FOREGROUND1); + Vector(menu_width, 2), Color(255,255,255,255), LAYER_GUI); break; } case MN_LABEL: { context.draw_text_center(white_big_text, pitem.text, Vector(0, y_pos - int(white_big_text->get_height()/2)), - LAYER_FOREGROUND1); + LAYER_GUI); break; } case MN_TEXTFIELD: @@ -588,11 +588,11 @@ context.draw_filled_rect( Vector(input_pos - 5, y_pos - 10), Vector(input_width + 10, 20), - Color(255,255,255,255), LAYER_FOREGROUND1-5); + Color(255,255,255,255), LAYER_GUI-5); context.draw_filled_rect( Vector(input_pos - 4, y_pos - 9), Vector(input_width + 8, 18), - Color(0,0,0,128), LAYER_FOREGROUND1-4); + Color(0,0,0,128), LAYER_GUI-4); if(pitem.kind == MN_CONTROLFIELD_KB) get_controlfield_key_into_input(&pitem); @@ -605,21 +605,21 @@ context.draw_text(gold_text, pitem.get_input_with_symbol(true), Vector(input_pos, y_pos - int(gold_text->get_height()/2)), - LAYER_FOREGROUND1); + LAYER_GUI); else context.draw_text(gold_text, pitem.get_input_with_symbol(false), Vector(input_pos, y_pos - int(gold_text->get_height()/2)), - LAYER_FOREGROUND1); + LAYER_GUI); } else context.draw_text(gold_text, pitem.input, Vector(input_pos, y_pos - int(gold_text->get_height()/2)), - LAYER_FOREGROUND1); + LAYER_GUI); context.draw_text(text_font, pitem.text, Vector(text_pos, y_pos - int(text_font->get_height()/2)), - LAYER_FOREGROUND1); + LAYER_GUI); break; } case MN_STRINGSELECT: @@ -631,37 +631,37 @@ /* Draw arrows */ context.draw_surface(arrow_left, Vector(x_pos - list_pos + text_pos - 17, y_pos - 8), - LAYER_FOREGROUND1); + LAYER_GUI); context.draw_surface(arrow_right, Vector(x_pos - list_pos + text_pos - 1 + list_pos_2, y_pos - 8), - LAYER_FOREGROUND1); + LAYER_GUI); /* Draw input background */ context.draw_filled_rect( Vector(x_pos - list_pos + text_pos - 1, y_pos - 10), Vector(list_pos_2 + 2, 20), - Color(255,255,255,255), LAYER_FOREGROUND1 - 4); + Color(255,255,255,255), LAYER_GUI - 4); context.draw_filled_rect( Vector(x_pos - list_pos + text_pos, y_pos - 9), Vector(list_pos_2, 18), - Color(0,0,0,128), LAYER_FOREGROUND1 - 5); + Color(0,0,0,128), LAYER_GUI - 5); context.draw_text_center(text_font, string_list_active(pitem.list), Vector(text_pos, y_pos - int(text_font->get_height()/2)), - LAYER_FOREGROUND1); + LAYER_GUI); context.draw_text_center(text_font, pitem.text, Vector(list_pos_2/2, y_pos - int(text_font->get_height()/2)), - LAYER_FOREGROUND1); + LAYER_GUI); break; } case MN_BACK: { context.draw_text_center(text_font, pitem.text, Vector(0, y_pos - int(text_font->get_height()/2)), - LAYER_FOREGROUND1); + LAYER_GUI); context.draw_surface(back, Vector(x_pos + text_width/2 + 16, y_pos - 8), - LAYER_FOREGROUND1); + LAYER_GUI); break; } @@ -669,28 +669,28 @@ { context.draw_text_center(text_font, pitem.text, Vector(0, y_pos - (text_font->get_height()/2)), - LAYER_FOREGROUND1); + LAYER_GUI); if(pitem.toggled) context.draw_surface(checkbox_checked, Vector(x_pos + (text_width+16)/2, y_pos - 8), - LAYER_FOREGROUND1 + 1); + LAYER_GUI + 1); else context.draw_surface(checkbox, Vector(x_pos + (text_width+16)/2, y_pos - 8), - LAYER_FOREGROUND1 + 1); + LAYER_GUI + 1); break; } case MN_ACTION: context.draw_text_center(text_font, pitem.text, Vector(0, y_pos - int(text_font->get_height()/2)), - LAYER_FOREGROUND1); + LAYER_GUI); break; case MN_GOTO: context.draw_text_center(text_font, pitem.text, Vector(0, y_pos - int(text_font->get_height()/2)), - LAYER_FOREGROUND1); + LAYER_GUI); break; } } @@ -730,7 +730,7 @@ context.draw_filled_rect( Vector(pos_x - menu_width/2, pos_y - 24*item.size()/2 - 10), Vector(menu_width,menu_height + 20), - Color(150,180,200,125), LAYER_FOREGROUND1-10); + Color(150,180,200,125), LAYER_GUI-10); for(unsigned int i = 0; i < item.size(); ++i) { Index: sprite.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sprite.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- sprite.h 14 Jun 2004 22:45:23 -0000 1.14 +++ sprite.h 1 Jul 2004 13:39:26 -0000 1.15 @@ -67,6 +67,10 @@ std::string get_name() const { return name; } int get_width() const; int get_height() const; + + Surface* get_frame(unsigned int frame) + { if(frame < surfaces.size()) return surfaces[frame]; + else return surfaces[0]; } }; #endif /*SUPERTUX_SPRITE_H*/ Index: badguy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v retrieving revision 1.108 retrieving revision 1.109 diff -u -d -r1.108 -r1.109 --- badguy.cpp 14 Jun 2004 21:39:57 -0000 1.108 +++ badguy.cpp 1 Jul 2004 13:39:24 -0000 1.109 @@ -206,6 +206,7 @@ timer.init(true); // if we're in a solid tile at start correct that now + if(Sector::current()) { if(kind != BAD_FLAME && kind != BAD_FISH && collision_object_map(base)) { std::cout << "Warning: badguy started in wall: kind: " << badguykind_to_string(kind) @@ -214,7 +215,7 @@ --base.y; } - if(Sector::current() && Sector::current()->camera) { + if(Sector::current()->camera) { Vector scroll = Sector::current()->camera->get_translation(); if(start_position.x > scroll.x - X_OFFSCREEN_DISTANCE && @@ -223,7 +224,7 @@ start_position.y < scroll.y + screen->h + Y_OFFSCREEN_DISTANCE) { activate(LEFT); } - } else { + } } else { if(start_position.x > 0 && start_position.x <= screen->w && start_position.y > 0 && start_position.y <= screen->h) activate(LEFT); Index: badguy.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.h,v retrieving revision 1.56 retrieving revision 1.57 diff -u -d -r1.56 -r1.57 --- badguy.h 29 Jun 2004 13:00:41 -0000 1.56 +++ badguy.h 1 Jul 2004 13:39:25 -0000 1.57 @@ -139,6 +139,9 @@ /** initializes the badguy (when he appears on screen) */ void activate(Direction direction); // should only be used by BadGuy's objects + Surface* get_image() + { return sprite_left->get_frame(0); } + private: void init(); Index: gameobjs.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameobjs.cpp,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- gameobjs.cpp 14 Jun 2004 22:45:23 -0000 1.41 +++ gameobjs.cpp 1 Jul 2004 13:39:25 -0000 1.42 @@ -137,7 +137,6 @@ /* Trampoline */ -#define TRAMPOLINE_FRAMES 4 Sprite *img_trampoline[TRAMPOLINE_FRAMES]; Trampoline::Trampoline(LispReader& reader) @@ -154,6 +153,19 @@ physic.reset(); } +Trampoline::Trampoline(float x, float y) +{ + base.x = x; + base.y = y; + base.width = 32; + base.height = 32; + power = 7.5; + + frame = 0; + mode = M_NORMAL; + physic.reset(); +} + void Trampoline::write(LispWriter& writer) { @@ -301,6 +313,14 @@ frame = 0; } +FlyingPlatform::FlyingPlatform(int x, int y) +{ +base.x = x; +base.y = y; +point = 0; +move = false; +} + void FlyingPlatform::write(LispWriter& writer) { Index: gameobjs.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameobjs.h,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- gameobjs.h 14 Jun 2004 22:45:23 -0000 1.28 +++ gameobjs.h 1 Jul 2004 13:39:25 -0000 1.29 @@ -37,6 +37,8 @@ #define NO_BOUNCE 0 #define BOUNCE 1 +class Sprite; + struct TileId; class BouncyDistro : public GameObject @@ -101,10 +103,14 @@ Timer timer; }; +#define TRAMPOLINE_FRAMES 4 +extern Sprite *img_trampoline[TRAMPOLINE_FRAMES]; + class Trampoline : public MovingObject, public Serializable { public: Trampoline(LispReader& reader); + Trampoline(float x, float y); virtual void write(LispWriter& writer); virtual void action(float frame_ratio); @@ -121,10 +127,13 @@ unsigned int frame; }; +extern Sprite *img_flying_platform; + class FlyingPlatform : public MovingObject, public Serializable { public: FlyingPlatform(LispReader& reader); + FlyingPlatform(int x, int y); virtual void write(LispWriter& writer); virtual void action(float frame_ratio); |