[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netPanzer-CVS] netpanzer ./ChangeLog ./TODO src/Lib/2D/Surface...
From: |
Matthias Braun |
Subject: |
[netPanzer-CVS] netpanzer ./ChangeLog ./TODO src/Lib/2D/Surface... |
Date: |
Sun, 12 Oct 2003 18:09:36 -0400 |
CVSROOT: /cvsroot/netpanzer
Module name: netpanzer
Branch:
Changes by: Matthias Braun <address@hidden> 03/10/12 18:09:36
Modified files:
. : ChangeLog TODO
src/Lib/2D : Surface.cpp Surface.hpp
src/Lib/View : View.cpp View.hpp
src/NetPanzer/Interfaces: MiniMapInterface.cpp
src/NetPanzer/Views/Game: GameView.cpp MiniMapView.cpp
ProgressView.cpp
VehicleSelectionView.cpp
Log message:
-fixed a series of bugs where I accidently passed a Surface pointer
instead of a
Surface to the blit functions. C++ was evil enough to use the
Surface::Surface(bool) constructor to create a new Surface instead of
getting
me an error.
Patches:
Index: netpanzer/ChangeLog
diff -u netpanzer/ChangeLog:1.10 netpanzer/ChangeLog:1.11
--- netpanzer/ChangeLog:1.10 Sun Oct 12 16:47:01 2003
+++ netpanzer/ChangeLog Sun Oct 12 18:09:34 2003
@@ -5,6 +5,10 @@
crashes.
-add signal handlers to make it abort more nicely in error case (don't stay in
mouse/keyboard grab mode)
+-fixed a series of bugs where I accidently passed a Surface pointer instead of
a
+ Surface to the blit functions. C++ was evil enough to use the
+ Surface::Surface(bool) constructor to create a new Surface instead of getting
+ me an error.
11-Oct-2003 by Matthias Braun
-added a release script
Index: netpanzer/TODO
diff -u netpanzer/TODO:1.5 netpanzer/TODO:1.6
--- netpanzer/TODO:1.5 Sun Oct 12 17:22:49 2003
+++ netpanzer/TODO Sun Oct 12 18:09:34 2003
@@ -1,7 +1,8 @@
-Improve userinterface:
* Make usual shortcuts (known from other RTSes) work. Like
CTRL+number for defining groups, a possibility to set spawnpoint
- of units, scroll map with right mouse, ...
+ of units, scroll map with right mouse, scrolling map with cursor keys
+ ...
* Create a nice static! skin which is at the bottom of the screen
and combines a map, statusdisplay of selected units and outpost
buildmenu
Index: netpanzer/src/Lib/2D/Surface.cpp
diff -u netpanzer/src/Lib/2D/Surface.cpp:1.33
netpanzer/src/Lib/2D/Surface.cpp:1.34
--- netpanzer/src/Lib/2D/Surface.cpp:1.33 Sun Oct 12 15:22:12 2003
+++ netpanzer/src/Lib/2D/Surface.cpp Sun Oct 12 18:09:34 2003
@@ -176,20 +176,6 @@
totalByteCount += sizeof(Surface);
} // end Surface::Surface
-//---------------------------------------------------------------------------
-Surface::Surface(bool nMyMem)
-{
- assert(this != 0);
-
- reset();
- myMem = nMyMem;
- doesExist = true;
-
- totalSurfaceCount++;
- totalByteCount += sizeof(Surface);
-
-} // end Surface::Surface
-
// Surface
//---------------------------------------------------------------------------
Surface::Surface(const iXY &nPix, int nStride, int nFrameCount)
@@ -512,6 +498,8 @@
assert(getDoesExist());
assert(dest.getDoesExist());
assert(this != 0);
+ assert(mem != 0);
+ assert(dest.mem != 0);
// Add in the offset factor.
min += offset;
@@ -523,16 +511,8 @@
iXY max;
max = min + pix;
- //int x2 = x1 + pix.x;
- //int y2 = y1 + pix.y;
- if (max.x <= 0) return;
- if (max.y <= 0) return;
-
- // Something is overlapping, so we need to verify that both
- // surfaces are valid.
- assert(mem != 0);
- assert(dest.mem != 0);
- if (mem == 0 || dest.mem == 0) return;
+ if (max.x < 0) return;
+ if (max.y < 0) return;
int pixelsPerRow = pix.x;
int numRows = pix.y;
@@ -574,10 +554,8 @@
// to draw. I should - because I checked for trivial
// rejection first. These asserts just make sure
// my clipping is working...
- if (signed(pixelsPerRow) <= 0) return;
- if (signed(numRows) <= 0) return;
- assert(signed(pixelsPerRow) > 0);
- assert(signed(numRows) > 0);
+ assert(pixelsPerRow > 0);
+ assert(numRows > 0);
// Now blt the sucker! But first, see if we can do it in one
// big blt, without doing each row individually...
@@ -603,6 +581,8 @@
assert(getDoesExist());
assert(dest.getDoesExist());
assert(this != 0);
+ assert(mem != 0);
+ assert(dest.mem != 0);
// Add in the offset factor.
min += offset;
@@ -616,14 +596,8 @@
max = min + pix;
//int x2 = x1 + pix.x;
//int y2 = y1 + pix.y;
- if (max.x <= 0) return;
- if (max.y <= 0) return;
-
- // Something is overlapping, so we need to verify that both
- // surfaces are valid.
- assert(mem != 0);
- assert(dest.mem != 0);
- if (mem == 0 || dest.mem == 0) return;
+ if (max.x < 0) return;
+ if (max.y < 0) return;
int pixelsPerRow = pix.x;
int numRows = pix.y;
@@ -665,10 +639,8 @@
// to draw. I should - because I checked for trivial
// rejection first. These asserts just make sure
// my clipping is working...
- if (signed(pixelsPerRow) <= 0) return;
- if (signed(numRows) <= 0) return;
- assert(signed(pixelsPerRow) > 0);
- assert(signed(numRows) > 0);
+ assert(pixelsPerRow > 0);
+ assert(numRows > 0);
int srcAdjustment = stride - pixelsPerRow;
int destAdjustment = dest.stride - pixelsPerRow;
@@ -698,6 +670,8 @@
assert(getDoesExist());
assert(dest.getDoesExist());
assert(this != 0);
+ assert(mem != 0);
+ assert(dest.mem != 0);
// Add in the offset factor.
min += offset;
@@ -709,16 +683,8 @@
iXY max;
max = min + pix;
- //int x2 = x1 + pix.x;
- //int y2 = y1 + pix.y;
- if (max.x <= 0) return;
- if (max.y <= 0) return;
-
- // Something is overlapping, so we need to verify that both
- // surfaces are valid.
- assert(mem != 0);
- assert(dest.mem != 0);
- if (mem == 0 || dest.mem == 0) return;
+ if (max.x < 0) return;
+ if (max.y < 0) return;
int pixelsPerRow = pix.x;
int numRows = pix.y;
@@ -760,10 +726,8 @@
// to draw. I should - because I checked for trivial
// rejection first. These asserts just make sure
// my clipping is working...
- if (signed(pixelsPerRow) <= 0) return;
- if (signed(numRows) <= 0) return;
- assert(signed(pixelsPerRow) > 0);
- assert(signed(numRows) > 0);
+ assert(pixelsPerRow > 0);
+ assert(numRows > 0);
int srcAdjustment = stride - pixelsPerRow;
int destAdjustment = dest.stride - pixelsPerRow;
@@ -1663,25 +1627,21 @@
{
assert(getDoesExist());
assert(this != 0);
+ assert(mem != 0);
iXY min = destRect.min + offset;
-
if (min.x >= pix.x) return;
if (min.y >= pix.y) return;
iXY max = destRect.max + offset;
-
- if (max.x <= 0) return;
- if (max.y <= 0) return;
+ if (max.x < 0) return;
+ if (max.y < 0) return;
// Clip destination rectangle
-
if (min.x < 0) min.x = 0;
if (min.y < 0) min.y = 0;
- if (max.x > pix.x) max.x = pix.x;
- if (max.y > pix.y) max.y = pix.y;
-
- assert(mem != 0);
+ if (max.x >= pix.x) max.x = pix.x;
+ if (max.y >= pix.y) max.y = pix.y;
size_t pixelsPerRow = max.x - min.x;
size_t numRows = max.y - min.y;
@@ -2093,98 +2053,6 @@
} // end Surface::bltBrightness
-/*
-// bltBrightness
-void Surface::bltBrightness(const Surface &dest, const iXY pos, ColorTable
&colorTable)
-{
- assert(getDoesExist());
- assert(dest.getDoesExist());
- assert(this != 0);
- assert(colorTable.getColorCount() == 256 * 100);
-
- iXY min(pos);
-
- min += offset;
-
- if (min.x >= dest.pix.x) return;
- if (min.y >= dest.pix.y) return;
-
- iXY max(min + pix);
- if (max.x <= 0) return;
- if (max.y <= 0) return;
-
- // Something is overlapping, so we need to verify that both
- // surfaces are valid.
- assert(mem != 0);
- assert(dest.mem != 0);
-
- int pixelsPerRow = pix.x;
- int numRows = pix.y;
- const PIX *sRow = mem; // Pointer to the this (source)
Surface
- PIX *dRow = dest.mem; // Pointer to the dest Surface
-
- // CLIP LEFT
- if (min.x < 0)
- {
- pixelsPerRow += min.x;
- sRow -= min.x;
- } else
- {
- dRow += min.x;
- }
-
- // CLIP RIGHT
- if (max.x > dest.pix.x) { pixelsPerRow -= max.x - dest.pix.x; }
-
- // CLIP TOP
- if (min.y < 0)
- {
- numRows += min.y;
- sRow -= (min.y * stride);
- } else
- {
- dRow += (min.y * dest.stride);
- }
-
- // CLIP BOTTOM
- if (max.y > dest.pix.y) { numRows -= max.y - dest.pix.y; }
-
- // Check to make sure the clipping is working.
- //if (signed(pixelsPerRow) <= 0) return;
- //if (signed(numRows) <= 0) return;
- assert(signed(pixelsPerRow) > 0);
- assert(signed(numRows) > 0);
-
- PIX *d;
- int xCount;
- int sc;
- int dc;
-
- for (int yCount = 0 ; yCount < numRows ; yCount++)
- {
- const PIX *s = sRow;
- d = dRow;
- xCount = pixelsPerRow;
-
- while (xCount > 0)
- {
- sc = *s;
- dc = *d;
-
- assert(dc + ((Palette::brightness256[sc]) << 8) < 256 *
100);
-
- *d = colorTable[dc + ((Palette::brightness256[sc]) <<
8)];
-
- xCount--;
- s++;
- d++;
- }
-
- sRow += stride;
- dRow += dest.stride;
- }
-} // end bltBrightness*/
-
static uint8_t quickHack[65536];
static void bltLightDarkSpan(int n, PIX *d, const uint8_t *i, const PIX *s)
@@ -3136,6 +3004,5 @@
// Right
r = iRect(pix.x - 1, 0, pix.x, pix.y - 1);
bltLookup(r, table);
-
} // end Surface::drawLookupBorder
Index: netpanzer/src/Lib/2D/Surface.hpp
diff -u netpanzer/src/Lib/2D/Surface.hpp:1.14
netpanzer/src/Lib/2D/Surface.hpp:1.15
--- netpanzer/src/Lib/2D/Surface.hpp:1.14 Fri Oct 3 10:44:59 2003
+++ netpanzer/src/Lib/2D/Surface.hpp Sun Oct 12 18:09:35 2003
@@ -209,11 +209,9 @@
public:
Surface();
- Surface(bool nMyMem);
Surface(const iXY &nPix, int nStride, int nFrameCount);
Surface(int xPix, int yPix, int nStride, int nFrameCount);
Surface(const Surface &source, const iXY &min, const iXY &max, bool
doGrab);
- //Surface(const Surface &source, int x1, int y1, int x2, int y2, bool
doGrab);
Surface(void *nFrame0, const iXY &nPix, int nStride, int nFrameCount);
virtual ~Surface();
Index: netpanzer/src/Lib/View/View.cpp
diff -u netpanzer/src/Lib/View/View.cpp:1.18
netpanzer/src/Lib/View/View.cpp:1.19
--- netpanzer/src/Lib/View/View.cpp:1.18 Sun Oct 12 15:22:12 2003
+++ netpanzer/src/Lib/View/View.cpp Sun Oct 12 18:09:35 2003
@@ -595,12 +595,11 @@
assert(this != 0);
if (getBordered()) {
- return iXY( pos.x - (min.x + borderSize),
+ return iXY( pos.x - (min.x + borderSize),
pos.y - (min.y + borderSize + moveAreaHeight));
}
return getScreenToViewPos(pos);
-
} // end View::getScreenToClientPos
// getScreenToViewPos
@@ -614,7 +613,6 @@
assert(this != 0);
return iXY(pos.x - min.x, pos.y - min.y);
-
} // end getScreenToViewPos
// getViewArea
@@ -626,18 +624,12 @@
assert(this != 0);
iRect rect(min, max);
- return Surface(dest, rect.min, rect.max, false);
-} // end View::getViewArea
+ Surface surface(dest, rect.min, rect.max, false);
-// getViewRect
-//---------------------------------------------------------------------------
-// Purpose: Returns an iRect of the view's dimensions.
-//---------------------------------------------------------------------------
-iRect View::getViewRect() const
-{
- return iRect(0, 0, getSizeX(), getSizeY());
-
-} // end getViewRect
+ assert(surface.mem != 0);
+
+ return surface;
+} // end View::getViewArea
#if 0
// getClientArea
@@ -669,12 +661,14 @@
Surface View::getClientArea(Surface& dest)
{
if (getBordered()) {
- return Surface( getViewArea(dest),
- iXY(borderSize,
- borderSize + moveAreaHeight),
+ Surface surface(getViewArea(dest),
+ iXY(borderSize, borderSize+moveAreaHeight),
iXY(getSizeX() - borderSize,
- getSizeY() - borderSize),
- false);
+ getSizeY() - borderSize), false);
+
+ assert(surface.mem != 0);
+
+ return surface;
}
return getViewArea(dest);
Index: netpanzer/src/Lib/View/View.hpp
diff -u netpanzer/src/Lib/View/View.hpp:1.9 netpanzer/src/Lib/View/View.hpp:1.10
--- netpanzer/src/Lib/View/View.hpp:1.9 Sun Oct 5 09:50:11 2003
+++ netpanzer/src/Lib/View/View.hpp Sun Oct 12 18:09:36 2003
@@ -361,9 +361,7 @@
virtual int getMouseActions(const iXY &p) const;
- iRect getViewRect() const;
iRect getClientRect() const;
-}
-; // end View
+};
#endif // end __View_hpp__
Index: netpanzer/src/NetPanzer/Interfaces/MiniMapInterface.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/MiniMapInterface.cpp:1.8
netpanzer/src/NetPanzer/Interfaces/MiniMapInterface.cpp:1.9
--- netpanzer/src/NetPanzer/Interfaces/MiniMapInterface.cpp:1.8 Sun Oct 12
15:22:12 2003
+++ netpanzer/src/NetPanzer/Interfaces/MiniMapInterface.cpp Sun Oct 12
18:09:36 2003
@@ -27,9 +27,9 @@
#include "ObjectiveInterface.hpp"
#include "GameConfig.hpp"
-fXY MiniMapInterface::scale_factor;
+fXY MiniMapInterface::scale_factor;
iXY MiniMapInterface::mini_map_size;
-bool MiniMapInterface::pathing_debug_mode = false;
+bool MiniMapInterface::pathing_debug_mode = false;
PIX MiniMapInterface::player_unit_color;
PIX MiniMapInterface::allie_unit_color;
@@ -44,10 +44,10 @@
TimerFrameBase MiniMapInterface::show_enemy_radar_timer;
bool MiniMapInterface::show_enemy_radar_flag;
-iRect MiniMapInterface::getWorldWindow( void )
+iRect MiniMapInterface::getWorldWindow()
{
iRect world_win;
- WorldViewInterface::getViewWindow( &world_win );
+ WorldViewInterface::getViewWindow(&world_win);
world_win.min.x = int(float(world_win.min.x) / scale_factor.x);
world_win.min.y = int(float(world_win.min.y) / scale_factor.y);
Index: netpanzer/src/NetPanzer/Views/Game/GameView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/GameView.cpp:1.9
netpanzer/src/NetPanzer/Views/Game/GameView.cpp:1.10
--- netpanzer/src/NetPanzer/Views/Game/GameView.cpp:1.9 Fri Oct 3 10:45:14 2003
+++ netpanzer/src/NetPanzer/Views/Game/GameView.cpp Sun Oct 12 18:09:36 2003
@@ -104,7 +104,7 @@
SPRITE_SORTER.blitLists(screen);
- VehicleSelectionView::drawMiniProductionStatus(screen);
+ VehicleSelectionView::drawMiniProductionStatus(*screen);
COMMAND_PROCESSOR.updateControls();
Index: netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp:1.16
netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp:1.17
--- netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp:1.16 Sun Oct 12
16:06:29 2003
+++ netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp Sun Oct 12 18:09:36 2003
@@ -178,23 +178,14 @@
viewArea.drawLookupBorder(Palette::darkGray256.getColorArray());
// Draw the world view box.
- clientArea.bltLookup(MiniMapInterface::getWorldWindow(),
Palette::darkGray256.getColorArray());
-
+ iRect boxpos = MiniMapInterface::getWorldWindow();
+ boxpos.translate(iXY(1,1));
+
+ clientArea.bltLookup(boxpos, Palette::darkGray256.getColorArray());
// Draw the units and such on the minimap.
MiniMapInterface::annotateMiniMap((Surface &) clientArea);
-
// Draw the world view box corners.
- iRect boxpos = MiniMapInterface::getWorldWindow();
- boxpos.translate(iXY(1,1));
clientArea.drawBoxCorners(boxpos, 5, Color::white);
-
- // Draw an inner black rect inside the outer white rect, for visibility
reasons.
- //iRect innerRect(MiniMapInterface::getWorldWindow());
- //
- //innerRect.min += 1;
- //innerRect.max -= 1;
- //
- //clientArea.drawBoxCorners(innerRect, 4, Color::black);
// If the mouse is over the client area, then change the cursor.
if (getClientRect().contains(getScreenToClientPos(mouse.getScreenPos()))) {
Index: netpanzer/src/NetPanzer/Views/Game/ProgressView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/ProgressView.cpp:1.13
netpanzer/src/NetPanzer/Views/Game/ProgressView.cpp:1.14
--- netpanzer/src/NetPanzer/Views/Game/ProgressView.cpp:1.13 Fri Oct 3
10:45:15 2003
+++ netpanzer/src/NetPanzer/Views/Game/ProgressView.cpp Sun Oct 12 18:09:36 2003
@@ -152,7 +152,7 @@
loadBackgroundSurface();
}
- backgroundSurface.blt(screen);
+ backgroundSurface.blt(*screen);
tempSurface.copy(background);
@@ -166,7 +166,7 @@
Surface::getFontHeight(), Color::black);
background.bltString(0, background.getPix().y - Surface::getFontHeight() -
1, text, Color::white);
- background.blt(screen, 179, 153);
+ background.blt(*screen, 179, 153);
screen->unlock();
screen->copyToVideoFlip();
Index: netpanzer/src/NetPanzer/Views/Game/VehicleSelectionView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/VehicleSelectionView.cpp:1.17
netpanzer/src/NetPanzer/Views/Game/VehicleSelectionView.cpp:1.18
--- netpanzer/src/NetPanzer/Views/Game/VehicleSelectionView.cpp:1.17 Sun Oct
12 16:06:30 2003
+++ netpanzer/src/NetPanzer/Views/Game/VehicleSelectionView.cpp Sun Oct 12
18:09:36 2003
@@ -716,7 +716,8 @@
//pos.y = (miniProductionRect.getSizeY() - CHAR_YPIX) / 2
+ miniProductionRect.min.y;
// Objective is off.
- dest.bltLookup(miniProductionRect,
Palette::darkGray256.getColorArray());
+ // XXX
+ //dest.bltLookup(miniProductionRect,
Palette::darkGray256.getColorArray());
dest.bltString(pos, outpostNameBuf, Color::white);
pos.y += 16;
@@ -750,7 +751,8 @@
% 60);
checkMiniProductionRect(timeLeftBuf);
- dest.bltLookup(miniProductionRect,
Palette::darkGray256.getColorArray());
+ // XXX
+ // dest.bltLookup(miniProductionRect,
Palette::darkGray256.getColorArray());
dest.bltString(pos, outpostNameBuf, Color::white);
pos.y += 16;
@@ -799,7 +801,8 @@
}
checkMiniProductionRect(outpostNameBuf);
- dest.bltLookup(miniProductionRect,
Palette::darkGray256.getColorArray());
+ // XXX
+ //dest.bltLookup(miniProductionRect,
Palette::darkGray256.getColorArray());
dest.bltString(pos, outpostNameBuf, Color::white);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [netPanzer-CVS] netpanzer ./ChangeLog ./TODO src/Lib/2D/Surface...,
Matthias Braun <=