Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-05-12 10:57:38 +0000
committerStijn Buys <ingar@osirion.org>2008-05-12 10:57:38 +0000
commit24c695e83947d3457dbd1f5d696fa09b4ef953c0 (patch)
treea666996d17bf611ffbec4fa364f258b00e7adef4
parentd2e93235b9ccd37bf8c8fb7c4376ab1911c83639 (diff)
light offset bugfix, console word wrapping
-rw-r--r--osirion.kdevelop2
-rw-r--r--osirion.kdevelop.pcsbin655559 -> 659521 bytes
-rw-r--r--osirion.kdevses13
-rw-r--r--src/client/console.cc54
-rw-r--r--src/render/draw.cc2
5 files changed, 49 insertions, 22 deletions
diff --git a/osirion.kdevelop b/osirion.kdevelop
index c65b0a6..58a8bfc 100644
--- a/osirion.kdevelop
+++ b/osirion.kdevelop
@@ -21,7 +21,7 @@
</general>
<kdevautoproject>
<general>
- <activetarget>src/model/libmodel.la</activetarget>
+ <activetarget>src/client/libclient.la</activetarget>
<useconfiguration>debug</useconfiguration>
</general>
<run>
diff --git a/osirion.kdevelop.pcs b/osirion.kdevelop.pcs
index 6bf305e..65b692f 100644
--- a/osirion.kdevelop.pcs
+++ b/osirion.kdevelop.pcs
Binary files differ
diff --git a/osirion.kdevses b/osirion.kdevses
index 97be539..cd13d45 100644
--- a/osirion.kdevses
+++ b/osirion.kdevses
@@ -1,19 +1,10 @@
<?xml version = '1.0' encoding = 'UTF-8'?>
<!DOCTYPE KDevPrjSession>
<KDevPrjSession>
- <DocsAndViews NumberOfDocuments="4" >
+ <DocsAndViews NumberOfDocuments="1" >
<Doc0 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/console.cc" >
- <View0 Encoding="" line="193" Type="Source" />
+ <View0 Encoding="" line="187" Type="Source" />
</Doc0>
- <Doc1 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/view.cc" >
- <View0 Encoding="" line="149" Type="Source" />
- </Doc1>
- <Doc2 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/chat.cc" >
- <View0 Encoding="" line="94" Type="Source" />
- </Doc2>
- <Doc3 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/README" >
- <View0 Encoding="" line="101" Type="Source" />
- </Doc3>
</DocsAndViews>
<pluginList>
<kdevdebugger>
diff --git a/src/client/console.cc b/src/client/console.cc
index fae402c..914d32f 100644
--- a/src/client/console.cc
+++ b/src/client/console.cc
@@ -171,17 +171,52 @@ void draw()
std::deque<std::string> lines;
for (std::deque<std::string>::iterator it = text.begin(); it != text.end() && current_line < bottom; it++) {
if (current_line >= bottom - height) {
- std::string line(*it);
- line.erase(0,2);
-
- while (line.size() > width) {
- lines.push_back(line.substr(0, width));
- line.erase(0, width);
+ std::string linedata(*it);
+ linedata += '\n';
+
+ std::string word;
+ std::string line;
+ const char *c = linedata.c_str();
+
+ while (*c) {
+ // new word, wrap if necessary
+ if ((*c == '\n' ) || ( *c == ' ')) {
+
+ if (line.size() + word.size() > width) {
+ if (line.size()) {
+ lines.push_back(line);
+ line.clear();
+ }
+ }
+
+ line.append(word);
+ word.clear();
+
+ // force break words longer than width
+ while (line.size() > width) {
+ lines.push_back(line.substr(0, width));
+ line.erase(0, width);
+ }
+
+ // new line
+ if (*c == '\n' ) {
+ lines.push_back(line);
+ line.clear();
+ // new word
+ } else if (*c == ' ' ) {
+ line += ' ';
+ }
+ // new character
+ } else {
+
+ word += *c;
+ }
+
+ c++;
}
- if (line.size())
- lines.push_back(line);
+
}
- current_line++;
+ current_line++;
}
float y = video::height*con_height-2*Text::fontheight()-4;
@@ -387,6 +422,7 @@ void Console::flush()
{
console::flush();
}
+
std::ostream & Console::messagestream()
{
return (buffer << ". ");
diff --git a/src/render/draw.cc b/src/render/draw.cc
index e2037e2..7c35bf3 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -428,7 +428,7 @@ void draw_pass_model_fx()
// strobe frequency
t = 1.0f;
if ((*lit)->strobe())
- t = (core::application()->time() + entity->state()->fuzz() + (*lit)->offset()) * (*lit)->frequency();
+ t = (core::application()->time() + entity->state()->fuzz() - (*lit)->offset()) * (*lit)->frequency();
if (!(*lit)->strobe() || (( t - floorf(t)) <= (*lit)->time())) {
math::Vector3f location = entity->state()->location() + (entity->axis() * (*lit)->location());