[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src console.cxx,1.4,1.5 console.hxx,1.4,1
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src console.cxx,1.4,1.5 console.hxx,1.4,1.5 global_event.cxx,1.4,1.5 pingu.cxx,1.12,1.13 xml_helper.cxx,1.6,1.7 |
Date: |
26 Jun 2002 16:49:35 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv1308
Modified Files:
console.cxx console.hxx global_event.cxx pingu.cxx
xml_helper.cxx
Log Message:
- some fixes for the console (its still buggy)
- some non-fixes for bomber-floater interaction, a floater doesn't turn into a
floater even if the action looks correctly activated
Index: console.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/console.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- console.cxx 21 Jun 2002 07:45:35 -0000 1.4
+++ console.cxx 26 Jun 2002 16:49:33 -0000 1.5
@@ -112,7 +112,7 @@
is_init = false;
is_visible = false;
current_pos = 0;
- number_of_lines = 10;
+ number_of_lines = 12;
}
Console::~Console()
@@ -138,34 +138,29 @@
{
assert(is_init);
- int i,j;
- int start_index;
- bool draw_current_line = !current_line.empty();
+ /** Callculate the position of the first line on the screen */
int start_y_pos =
CL_Display::get_height() - (font->get_height() * (number_of_lines + 3));
- if (draw_current_line)
- start_index = Math::max(0, current_pos - number_of_lines);
- else
- start_index = Math::max(0, current_pos - number_of_lines-1);
-
+ // The background of the console
CL_Display::fill_rect(0, start_y_pos,
CL_Display::get_width(),
CL_Display::get_height(),
0.0, 0.0, 0.0, 0.5);
- std::vector<std::string>* output_buffer = streambuf.get_buffer ();
- for(i = start_index, j=1;
- i < (int)output_buffer->size();
- ++i, ++j)
+ std::vector<std::string>* buffer = streambuf.get_buffer ();
+
+ int window_start = Math::max(0, (int)(buffer->size ()) - number_of_lines);
+
+ for (int i = 0;
+ i < number_of_lines
+ && i + window_start < int(buffer->size ());
+ ++i)
{
font->print_left(10,
- start_y_pos + j * font->get_height(),
- (*output_buffer)[i].c_str());
+ start_y_pos + (i * (font->get_height() + 2)),
+ (*buffer)[i + window_start].c_str());
}
- if (draw_current_line)
- font->print_left(10, start_y_pos + j * font->get_height(),
- current_line.c_str());
}
void
@@ -184,15 +179,15 @@
void
Console::scroll_up()
{
- /* if (current_pos - number_of_lines > 0)
- --current_pos;*/
+ if (current_pos - number_of_lines > 0)
+ --current_pos;
}
void
Console::scroll_down()
{
- /*if (current_pos - number_of_lines < (int)output_buffer.size())
- ++current_pos;*/
+ if (current_pos - number_of_lines < (int)streambuf.get_buffer ()->size())
+ ++current_pos;
}
void
Index: console.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/console.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- console.hxx 24 Jun 2002 22:52:54 -0000 1.4
+++ console.hxx 26 Jun 2002 16:49:33 -0000 1.5
@@ -27,14 +27,12 @@
class CL_Font;
-#define CONSOLE_BUFFER_SIZE 100
+#define CONSOLE_BUFFER_SIZE 1024
class ConsoleBuffer :
public std::streambuf
{
private:
- std::string current_line;
- //bool continue_last;
std::vector<std::string> buffer;
char char_buffer[CONSOLE_BUFFER_SIZE];
@@ -60,7 +58,8 @@
CL_Font* font;
bool is_init;
int current_pos;
- std::string current_line;
+
+ /** number of lines which will get displayed on the screen */
int number_of_lines;
void draw();
public:
Index: global_event.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/global_event.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- global_event.cxx 25 Jun 2002 17:05:25 -0000 1.4
+++ global_event.cxx 26 Jun 2002 16:49:33 -0000 1.5
@@ -43,22 +43,22 @@
{
// F1 is the general console modifer key...
case CL_KEY_PAGEUP:
- if (CL_Keyboard::get_keycode(CL_KEY_F1))
+ if (CL_Keyboard::get_keycode(PINGUS_CL_KEY_HELP))
console.increase_lines();
break;
case CL_KEY_PAGEDOWN:
- if (CL_Keyboard::get_keycode(CL_KEY_F1))
+ if (CL_Keyboard::get_keycode(PINGUS_CL_KEY_HELP))
console.decrease_lines();
break;
case CL_KEY_UP:
- if (CL_Keyboard::get_keycode(CL_KEY_F1))
+ if (CL_Keyboard::get_keycode(PINGUS_CL_KEY_HELP))
console.scroll_up();
break;
case CL_KEY_DOWN:
- if (CL_Keyboard::get_keycode(CL_KEY_F1))
+ if (CL_Keyboard::get_keycode(PINGUS_CL_KEY_HELP))
console.scroll_down();
break;
Index: pingu.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu.cxx,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- pingu.cxx 25 Jun 2002 18:15:18 -0000 1.12
+++ pingu.cxx 26 Jun 2002 16:49:33 -0000 1.13
@@ -111,6 +111,8 @@
// Set the action of the pingu (bridger, blocker, bomber, etc.)
// This function is used by external stuff, like the ButtonPanel, etc
+// When you select a function on the button panel and click on a
+// pingu, this action will be called with the action name
bool
Pingu::set_action(PinguAction* act)
{
@@ -168,14 +170,14 @@
return true;
}
else
- { // Use the activation time, given by t
+ {
if (countdown_action && countdown_action->get_name() ==
act->get_name())
- {
+ { // We skip the action, since it is already set
return false;
}
+ // We set the action and start the countdown
action_time = act->activation_time();
countdown_action = act;
- //PingusSound::play_sound("sounds/ohno.wav");
}
return true;
}
@@ -281,13 +283,19 @@
return;
}
+ // if an countdown action is set, update the countdown time
if (action_time > -1)
--action_time;
- if ( !action_time && countdown_action)
+ if (action_time == 0 && countdown_action)
{
- action = countdown_action;
- action->set_pingu(this);
+ std::cout << "COUNTDOWNACTIAN SET: " << countdown_action->get_name () <<
std::endl;
+
+ set_paction(countdown_action);
+ // Reset the countdown action handlers
+ countdown_action = 0;
+ action_time = -1;
+ return;
}
if ( !action || action->is_finished)
@@ -321,6 +329,9 @@
if (action_time != -1)
{
+ // FIXME: some people preffer a 5-0 or a 9-0 countdown, not sure
+ // FIXME: about that got used to the 50-0 countdown [counting is
+ // FIXME: in ticks, should probally be in seconds]
sprintf(str, "%d", action_time);
if (s == 1.0)
Index: xml_helper.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/xml_helper.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- xml_helper.cxx 26 Jun 2002 11:23:54 -0000 1.6
+++ xml_helper.cxx 26 Jun 2002 16:49:33 -0000 1.7
@@ -181,6 +181,12 @@
desc.type = ResDescriptor::RD_RESOURCE;
while (ccur != NULL)
{
+ if (xmlIsBlankNode(cur))
+ {
+ cur = cur->next;
+ continue;
+ }
+
if (strcmp((char*)ccur->name, "resource-file") == 0)
{
char* filename = (char*)xmlNodeListGetString(doc,
ccur->children, 1);
@@ -261,7 +267,7 @@
}
else
{
- std::cout << "XMLHelper:parse_surface: unhandled " <<
ccur->name << std::endl;
+ std::cout << "XMLHelper:parse_surface2: unhandled " <<
ccur->name << std::endl;
}
ccur = ccur->next;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src console.cxx,1.4,1.5 console.hxx,1.4,1.5 global_event.cxx,1.4,1.5 pingu.cxx,1.12,1.13 xml_helper.cxx,1.6,1.7,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/actions floater.cxx,1.3,1.4
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/traps fake_exit.cxx,1.2,1.3 hammer.cxx,1.2,1.3 laser_exit.cxx,1.2,1.3 smasher.cxx,1.3,1.4
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/actions floater.cxx,1.3,1.4
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/traps fake_exit.cxx,1.2,1.3 hammer.cxx,1.2,1.3 laser_exit.cxx,1.2,1.3 smasher.cxx,1.3,1.4
- Index(es):