Some optimizations
authorunc0rr
Fri, 08 Oct 2010 22:46:05 +0400
changeset 3938 033114a6a960
parent 3937 494221b5950e
child 3939 e6fddcb04dc2
Some optimizations
hedgewars/uConsole.pas
hedgewars/uStore.pas
--- a/hedgewars/uConsole.pas	Fri Oct 08 17:47:00 2010 +0200
+++ b/hedgewars/uConsole.pas	Fri Oct 08 22:46:05 2010 +0400
@@ -216,6 +216,9 @@
     for i:= 0 to Pred(cLinesCount) do
         PByte(@ConsoleLines[i])^:= 0;
 
+    // NOTE: please, keep most frequently used commands on bottom
+    RegisterVariable('flag'    , vtCommand, @chFlag         , false);
+    RegisterVariable('script'  , vtCommand, @chScript       , false);
     RegisterVariable('proto'   , vtCommand, @chCheckProto   , true );
     RegisterVariable('spectate', vtBoolean, @fastUntilLag   , false);
     RegisterVariable('capture' , vtCommand, @chCapture      , true );
@@ -303,8 +306,6 @@
     RegisterVariable('-cur_l'  , vtCommand, @chCurL_m       , true );
     RegisterVariable('+cur_r'  , vtCommand, @chCurR_p       , true );
     RegisterVariable('-cur_r'  , vtCommand, @chCurR_m       , true );
-    RegisterVariable('flag'    , vtCommand, @chFlag         , false);
-    RegisterVariable('script'  , vtCommand, @chScript       , false);
 end;
 
 procedure freeModule;
--- a/hedgewars/uStore.pas	Fri Oct 08 17:47:00 2010 +0200
+++ b/hedgewars/uStore.pas	Fri Oct 08 22:46:05 2010 +0400
@@ -558,9 +558,9 @@
     VertexBuffer, TextureBuffer: array [0..3] of TVertex2f;
 begin
 // don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs)
-if (abs(X) > W) and ((abs(X + dir * OffsetX) - W / 2) > cScreenWidth / cScaleFactor) then
+if (abs(X) > W) and ((abs(X + dir * OffsetX) - W / 2) * cScaleFactor > cScreenWidth) then
     exit;
-if (abs(Y) > H) and ((abs(Y + OffsetY - (0.5 * cScreenHeight)) - W / 2) > cScreenHeight / cScaleFactor) then
+if (abs(Y) > H) and ((abs(Y + OffsetY - (0.5 * cScreenHeight)) - W / 2) * cScaleFactor > cScreenHeight) then
     exit;
 
 glPushMatrix;
@@ -749,9 +749,9 @@
     TextureBuffer: array [0..3] of TVertex2f;
 begin
 // don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs)
-if (abs(X) > 32) and ((abs(X) - 16)> cScreenWidth / cScaleFactor) then
+if (abs(X) > 32) and ((abs(X) - 16) * cScaleFactor > cScreenWidth) then
     exit;
-if (abs(Y) > 32) and ((abs(Y - 0.5 * cScreenHeight) - 16) > cScreenHeight / cScaleFactor) then
+if (abs(Y) > 32) and ((abs(Y - 0.5 * cScreenHeight) - 16) * cScaleFactor > cScreenHeight) then
     exit;
 
 t:= Pos * 32 / HHTexture^.h;
@@ -794,9 +794,9 @@
 var VertexBuffer: array [0..3] of TVertex2f;
 begin
 // don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs)
-if (abs(r.x) > r.w) and ((abs(r.x + r.w / 2) - r.w / 2) > cScreenWidth / cScaleFactor) then
+if (abs(r.x) > r.w) and ((abs(r.x + r.w / 2) - r.w / 2) * cScaleFactor > cScreenWidth) then
     exit;
-if (abs(r.y) > r.h) and ((abs(r.y + r.h / 2 - (0.5 * cScreenHeight)) - r.h / 2) > cScreenHeight / cScaleFactor) then
+if (abs(r.y) > r.h) and ((abs(r.y + r.h / 2 - (0.5 * cScreenHeight)) - r.h / 2) * cScaleFactor > cScreenHeight) then
     exit;
 
 glDisable(GL_TEXTURE_2D);