[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netPanzer-CVS] netpanzer/src ChangeLog Lib/FileSystem.cpp Lib/...
From: |
Matthias Braun |
Subject: |
[netPanzer-CVS] netpanzer/src ChangeLog Lib/FileSystem.cpp Lib/... |
Date: |
Tue, 16 Sep 2003 16:00:29 -0400 |
CVSROOT: /cvsroot/netpanzer
Module name: netpanzer
Branch:
Changes by: Matthias Braun <address@hidden> 03/09/16 16:00:28
Modified files:
src : ChangeLog
src/Lib : FileSystem.cpp FileSystem.hpp
src/Lib/View : Component.hpp Desktop.cpp Desktop.hpp
ScrollBar.hpp TextComponent.hpp View.cpp
View.hpp
src/NetPanzer/Interfaces: ConsoleInterface.cpp GameConfig.cpp
GameConfig.hpp GameManager.cpp
GameManager.hpp
src/NetPanzer/Views/Game: AreYouSureResignView.cpp ChatView.cpp
HelpScrollView.cpp HelpScrollView.hpp
ProgressView.cpp WinnerMesgView.cpp
src/NetPanzer/Views/MainMenu: HelpView.cpp HelpView.hpp
MenuTemplateView.cpp
MenuTemplateView.hpp
RMouseHackView.cpp
RMouseHackView.hpp
SpecialButtonView.hpp
src/NetPanzer/Views/MainMenu/Multi: FlagSelectionView.cpp
FlagSelectionView.hpp
HostJoinTemplateView.cpp
HostView.cpp
src/NetPanzer/Views/MainMenu/Options: SoundView.cpp
VisualsView.cpp
VisualsView.hpp
Added files:
src/Lib : NoCopy.hpp
src/Lib/View : StateChangedCallback.hpp
Removed files:
src/Lib/View : Cursor.cpp Cursor.hpp List.cpp List.hpp
TitledBorder.cpp TitledBorder.hpp
src/NetPanzer/Classes: KeyBinder.cpp KeyBinder.hpp
Log message:
-randomly fixed stuff in the very ugly libview code (also removed
several unused
files there)
-added a statechangedcallback to Choice and CheckBox components
-added the NoCopy class for cases where you want to forbid
assignment and copy-construction
-Started save/loading capabilities for GameConfig
-added a resolution and fullscreen setting to the Visual Options
Patches:
Index: netpanzer/src/ChangeLog
diff -u netpanzer/src/ChangeLog:1.25 netpanzer/src/ChangeLog:1.26
--- netpanzer/src/ChangeLog:1.25 Tue Sep 16 12:54:50 2003
+++ netpanzer/src/ChangeLog Tue Sep 16 16:00:26 2003
@@ -1,3 +1,12 @@
+16-Sep-2003 by Matthias Braun
+-randomly fixed stuff in the very ugly libview code (also removed several
unused
+ files there)
+-added a statechangedcallback to Choice and CheckBox components
+-added the NoCopy class for cases where you want to forbid
+ assignment and copy-construction
+-Started save/loading capabilities for GameConfig
+-added a resolution and fullscreen setting to the Visual Options
+
16-Sep-2003 by Ivo Danihelka
-Alt+Enter don't start chat now
-'d' display damage
Index: netpanzer/src/Lib/FileSystem.cpp
diff -u netpanzer/src/Lib/FileSystem.cpp:1.4
netpanzer/src/Lib/FileSystem.cpp:1.5
--- netpanzer/src/Lib/FileSystem.cpp:1.4 Sat Sep 13 18:52:33 2003
+++ netpanzer/src/Lib/FileSystem.cpp Tue Sep 16 16:00:26 2003
@@ -288,6 +288,14 @@
return 1;
}
+int8_t ReadFile::read8()
+{
+ int8_t val;
+ if(PHYSFS_read(file, &val, 1, 1) != 1)
+ throw Exception("read error: %s", PHYSFS_getLastError());
+ return val;
+}
+
int16_t ReadFile::readSLE16()
{
int16_t val;
@@ -394,6 +402,12 @@
int64_t WriteFile::write(const void* buffer, size_t objsize, size_t objcount)
{
return PHYSFS_write(file, buffer, objsize, objcount);
+}
+
+void WriteFile::write8(int8_t val)
+{
+ if(PHYSFS_write(file, &val, 1, 1) != 1)
+ throw Exception("couldn't write: %s", PHYSFS_getLastError());
}
void WriteFile::writeSLE16(int16_t val)
Index: netpanzer/src/Lib/FileSystem.hpp
diff -u netpanzer/src/Lib/FileSystem.hpp:1.4
netpanzer/src/Lib/FileSystem.hpp:1.5
--- netpanzer/src/Lib/FileSystem.hpp:1.4 Sat Sep 13 18:52:33 2003
+++ netpanzer/src/Lib/FileSystem.hpp Tue Sep 16 16:00:26 2003
@@ -56,6 +56,8 @@
public:
int64_t read(void* buffer, size_t objsize, size_t objcount);
+ int8_t read8();
+
int16_t readSLE16();
uint16_t readULE16();
int16_t readSBE16();
@@ -93,6 +95,8 @@
{
public:
int64_t write(const void* buffer, size_t objsize, size_t objcount);
+
+ void write8(int8_t val);
void writeSLE16(int16_t val);
void writeULE16(uint16_t val);
Index: netpanzer/src/Lib/View/Component.hpp
diff -u netpanzer/src/Lib/View/Component.hpp:1.3
netpanzer/src/Lib/View/Component.hpp:1.4
--- netpanzer/src/Lib/View/Component.hpp:1.3 Tue Sep 16 12:00:17 2003
+++ netpanzer/src/Lib/View/Component.hpp Tue Sep 16 16:00:27 2003
@@ -18,7 +18,6 @@
#ifndef __Component_hpp__
#define __Component_hpp__
-#include "Cursor.hpp"
#include "Color.hpp"
#include "Surface.hpp"
#include "iXY.hpp"
@@ -37,7 +36,6 @@
iXY size;
iXY min;
Surface surface;
- Cursor cursor;
String name;
bool enabled;
bool visible;
@@ -83,7 +81,6 @@
r.min = min;
r.max = min + size;
}
- inline const Cursor &getCursor() const { return cursor; }
inline BYTE getForeground() const { return foreground; }
inline Surface getGraphics() const { return surface; }
inline String getName() const { return name; }
@@ -101,7 +98,6 @@
size = r.getSize();
}
- void setCursor() {}
void setEnabled(bool enabled);
void setForeground(PIX foreground);
void setLocation(int x, int y);
Index: netpanzer/src/Lib/View/Desktop.cpp
diff -u netpanzer/src/Lib/View/Desktop.cpp:1.9
netpanzer/src/Lib/View/Desktop.cpp:1.10
--- netpanzer/src/Lib/View/Desktop.cpp:1.9 Sat Sep 13 21:03:15 2003
+++ netpanzer/src/Lib/View/Desktop.cpp Tue Sep 16 16:00:27 2003
@@ -29,7 +29,7 @@
float Desktop::totalMouseDownTime = 0.0;
float Desktop::currentMouseDownTime = 0.0;
-View *Desktop::top;
+std::vector<View*> Desktop::views;
View *Desktop::focus;
int Desktop::mouseActions;
iXY Desktop::lMouseDownPos;
@@ -58,7 +58,6 @@
//--------------------------------------------------------------------------
Desktop::Desktop()
{
- top = 0;
focus = 0;
mouseActions = 0;
prevButton = 0;
@@ -309,23 +308,6 @@
rMouseView = 0;
}
- //if (curButton & 2)
- //{
- // // Set off that a right single click was made
- // mouseView = findViewContaining(mousePos);
- // mouseView->rMouseDown(mouseView->getScreenToClientPos(mousePos));
- //} else
- // {
- // // The mouse button 2 is up.
- // mouseView = findViewContaining(mousePos);
- // mouseView->rMouseUp();
- // }
-
- // Send a message to the top (active) window of the position
- // of the mouse.
- //if (focus != 0)
- //focus->mouseMove(focus->getScreenToClientPos(prevMousePos),
focus->getScreenToClientPos(mousePos));
-
prevButton = curButton;
prevMousePos = mousePos;
@@ -335,120 +317,6 @@
effActions =
mouseView->getMouseActions(mousePos-mouseView->min);
}
- //Surface *pointer = &mouseArrow;
-
- //if (mouseView->status & View::STATUS_ALLOW_RESIZE &&
mouseView->status & View::STATUS_ACTIVE)
- //{
- // switch (effActions)
- // {
- // case (View::MA_RESIZE_TOP ): pointer =
&mouseResizeUD; break;
- // case (View::MA_RESIZE_BOTTOM): pointer =
&mouseResizeUD; break;
- // case (View::MA_RESIZE_LEFT ): pointer =
&mouseResizeLR; break;
- // case (View::MA_RESIZE_RIGHT ): pointer =
&mouseResizeLR; break;
-
- // case (View::MA_RESIZE_TOP +View::MA_RESIZE_RIGHT):
pointer = &mouseResizeTR; break;
- // case (View::MA_RESIZE_TOP +View::MA_RESIZE_LEFT ):
pointer = &mouseResizeTL; break;
- // case (View::MA_RESIZE_BOTTOM+View::MA_RESIZE_LEFT ):
pointer = &mouseResizeBL; break;
- // case (View::MA_RESIZE_BOTTOM+View::MA_RESIZE_RIGHT):
pointer = &mouseResizeBR; break;
- // }
-//}
-
-/* mouseMoveStatus = 0;
-
- const int moveGapSpace = 1;
- if (mousePos.x < moveGapSpace) mouseMoveStatus |=
MM_LEFT;
- else if (mousePos.x > SCREEN_XSIZE - moveGapSpace) mouseMoveStatus |=
MM_RIGHT;
- if (mousePos.y < moveGapSpace) mouseMoveStatus |=
MM_UP;
- else if (mousePos.y > SCREEN_YSIZE - moveGapSpace) mouseMoveStatus |=
MM_DOWN;
-
- switch(mouseMoveStatus)
- {
- // Check to see if the mouse if at the bounds of the world.
- case (MM_LEFT + MM_UP):
- {
- if (mainViewMin.x <= 0 && mainViewMin.y <= 0)
- {
- pointer = &mouseMoveUpLeftStop;
- } else pointer = &mouseMoveUpLeft;
- } break;
- case (MM_LEFT + MM_DOWN):
- {
- if (mainViewMin.x <= 0 &&
- mainViewMin.y + mainViewSize.y >=
mapLayers.getTotalPix().y - 1)
- {
- pointer = &mouseMoveDownLeftStop;
- } else pointer = &mouseMoveDownLeft;
- } break;
- case (MM_RIGHT + MM_UP):
- {
- if (mainViewMin.x + mainViewSize.x >=
mapLayers.getTotalPix().x - 1 &&
- mainViewMin.y <= 0)
- {
- pointer = &mouseMoveUpRightStop;
- } else pointer = &mouseMoveUpRight;
- } break;
- case (MM_RIGHT + MM_DOWN):
- {
- if (mainViewMin.x + mainViewSize.x >=
mapLayers.getTotalPix().x - 1 &&
- mainViewMin.y + mainViewSize.y >=
mapLayers.getTotalPix().y - 1)
- {
- pointer = &mouseMoveDownRightStop;
- } else pointer = &mouseMoveDownRight;
- } break;
- case (MM_LEFT):
- {
- if (mainViewMin.x <= 0)
- {
- pointer = &mouseMoveLeftStop;
- }
- else pointer = &mouseMoveLeft;
- } break;
- case (MM_RIGHT):
- {
- if (mainViewMin.x + mainViewSize.x >=
mapLayers.getTotalPix().x - 1)
- {
- pointer = &mouseMoveRightStop;
- }
- else pointer = &mouseMoveRight;
- } break;
- case (MM_UP):
- {
- if (mainViewMin.y <= 0)
- {
- pointer = &mouseMoveUpStop;
- }
- else pointer = &mouseMoveUp;
- } break;
- case (MM_DOWN):
- {
- if (mainViewMin.y + mainViewSize.y >=
mapLayers.getTotalPix().y - 1)
- {
- pointer = &mouseMoveDownStop;
- }
- else pointer = &mouseMoveDown;
- } break;
- default: break;
- }
-*/
-/* if (mousePos.x < moveGapSpace)
- {
- pointer = &mouseMoveLeft; mouse.setPointer(pointer);
- }
- else if (mousePos.y < moveGapSpace)
- {
- pointer = &mouseMoveUp; mouse.setPointer(pointer);
- }
- else if (mousePos.x > SCREEN_XSIZE - moveGapSpace)
- {
- pointer = &mouseMoveRight; mouse.setPointer(pointer);
- }
- else if (mousePos.y > SCREEN_YSIZE - moveGapSpace)
- {
- pointer = &mouseMoveDown; mouse.setPointer(pointer);
- }
-*/
- //mouse.setPointer(pointer);
-
if (focus != 0)
{
focus->processEvents();
@@ -463,49 +331,22 @@
//--------------------------------------------------------------------------
void Desktop::draw()
{
- const size_t MAX_WINDOWS = 512;
-
- size_t viewCount = 0;
- View *list[MAX_WINDOWS];
-
- for (View *w = top ; w != 0 ; w = w->next)
- {
- list[viewCount++] = w;
+ std::vector<View*>::reverse_iterator i;
+ for(i = views.rbegin(); i != views.rend(); i++) {
+ (*i)->draw();
}
-
- for (int n = viewCount-1 ; n >= 0 ; --n)
- {
- //LOG(("Window Name: %s", list[n]->getTitle()));
- list[n]->draw();
- }
-
- //if (mouseView != 0) mouseView->drawToolTip(screen);
} // end draw
// add
//--------------------------------------------------------------------------
// Purpose: Adds a new window to the end of the current window list.
//--------------------------------------------------------------------------
-void Desktop::add(View *view, bool autoActivate /* = true */)
+void Desktop::add(View *view, bool autoActivate)
{
- assert(view != 0);
-
- //printf("Initting Window: %s\n", view->getTitle());
-
- // First remove it from the list if we already have it somehow
- remove(view);
-
- // Insert the guy at the end of the list, while checking that the
window is
- // not inserted before some window which should always remain on the bottom.
- View **prevLink = ⊤
- while (*prevLink != 0 /*&& !((*prevLink)->status &
View::STATUS_ALWAYS_ON_BOTTOM)*/)
- prevLink = &(*prevLink)->next;
-
- *prevLink = view;
- view->next = 0;
-
- if (autoActivate) activate(view);
-
+ assert(view != 0);
+ views.push_back(view);
+ if (autoActivate)
+ activate(view);
} // end add
// activate
@@ -518,104 +359,49 @@
// If the top window equals the window to activate, then nothing needs
to
// be done.
- if (focus != view)
- {
- if (focus != 0)
- {
+ if (focus != view) {
+ if (focus != 0) {
focus->deactivate();
}
if (!(view->getAlwaysOnBottom()))
{
- // Remove the new to be top window from the window list.
- remove(view);
-
- // Set the current top window to the second wyindow in
the list.
- view->next = top;
-
- // Set the window to the top window.
- top = view;
-
- // Activate the new top window.
+ for(size_t i = 0; i<views.size(); i++) {
+ if(views[i] == view) {
+ for(size_t i2 = i; i2 >= 1; i2--)
+ views[i2] = views[i2-1];
+ views[0] = view;
+ break;
+ }
+ }
}
focus = view;
view->activate();
}
} // end activate
-// remove
-//---------------------------------------------------------------------------
-// Purpose:
-//---------------------------------------------------------------------------
-void Desktop::remove(View *view)
-{
- View **prevLink = ⊤
-
- while (*prevLink != 0)
- {
- if (*prevLink == view)
- {
- *prevLink = view->next;
- break;
- }
-
- prevLink = &(*prevLink)->next;
- }
-} // end remove
-
// findViewContaining
//--------------------------------------------------------------------------
View *Desktop::findViewContaining(iXY pos)
{
- for (View *view = top ; view != 0 ; view = view->next)
- {
- if (view->status & View::STATUS_VISIBLE)
- if (view->contains(pos)) return view;
+ std::vector<View*>::iterator i;
+ for(i = views.begin(); i != views.end(); i++) {
+ if((*i)->status & View::STATUS_VISIBLE)
+ if((*i)->contains(pos))
+ return *i;
}
return 0;
} // end findViewContaining
-// removeView
-//--------------------------------------------------------------------------
-// Purpose:
-//--------------------------------------------------------------------------
-bool Desktop::removeView(const char *searchName)
-{
- for (View *view = top; view != 0; view = view->next)
- {
- if (strcmp(view->searchName, searchName) == 0)
- {
- remove(view);
- return true;
- }
- }
- return false;
-} // end removeView
-
-// removeAllViewAlwaysOnBottom
-//--------------------------------------------------------------------------
-// Purpose:
-//--------------------------------------------------------------------------
-void Desktop::removeAllViewAlwaysOnBottom()
-{
- for (View *view = top; view != 0; view = view->next)
- {
- if (view->getAlwaysOnBottom())
- {
- remove(view);
- //delete view;
- }
- }
-} // end removeAllViewAlwaysOnBottom
-
// toggleVisibility
//--------------------------------------------------------------------------
// Purpose:
//--------------------------------------------------------------------------
void Desktop::toggleVisibility(const char *searchName)
{
- for (View *view = top; view != 0; view = view->next)
- {
+ std::vector<View*>::iterator i;
+ for(i = views.begin(); i != views.end(); i++) {
+ View* view = *i;
if (strcmp(view->searchName, searchName) == 0)
{
view->status ^= View::STATUS_VISIBLE;
@@ -640,11 +426,11 @@
//--------------------------------------------------------------------------
void Desktop::checkViewPositions()
{
- for (View *view = top; view != 0; view = view->next)
- {
+ std::vector<View*>::iterator i;
+ for(i = views.begin(); i != views.end(); i++) {
+ View* view = *i;
view->moveTo(view->min);
}
-
} // end Desktop::checkViewPositions
// toggleVisibilityNoDoAnything
@@ -654,8 +440,9 @@
//--------------------------------------------------------------------------
void Desktop::toggleVisibilityNoDoAnything(const char *searchName)
{
- for (View *view = top; view != 0; view = view->next)
- {
+ std::vector<View*>::iterator i;
+ for(i = views.begin(); i != views.end(); i++) {
+ View* view = *i;
if (strcmp(view->searchName, searchName) == 0)
{
view->status ^= View::STATUS_VISIBLE;
@@ -670,8 +457,9 @@
//--------------------------------------------------------------------------
void Desktop::setActiveView(const char *searchName)
{
- for (View *view = top; view != 0; view = view->next)
- {
+ std::vector<View*>::iterator i;
+ for(i = views.begin(); i != views.end(); i++) {
+ View* view = *i;
if (strcmp(view->searchName, searchName) == 0)
{
// If the view is not active set the view active.
@@ -687,10 +475,12 @@
} // end setActiveView
//--------------------------------------------------------------------------
-void Desktop::setActiveView(View *view)
+void Desktop::setActiveView(View *v)
{
- for (View *v = top; v != 0; v = v->next)
- {
+ std::vector<View*>::iterator i;
+ for(i = views.begin(); i != views.end(); i++) {
+ View* view = *i;
+
if (v == view)
{
// If the view is not active set the view active.
@@ -702,21 +492,6 @@
}
-
-// getPointerStatus
-//--------------------------------------------------------------------------
-unsigned Desktop::getPointerStatus(int mouseX, int mouseY)
-{
- iXY mouse(mouseX, mouseY);
-
- View *mouseView = findViewContaining(mouse);
- if (mouseView == 0) return 0;
-
- // Only let the top window be resized
- if (mouseView == top) return mouseView->getMouseActions(mouse);
- else return 0;
-} // end getPointerStatus
-
// doMouseActions
//--------------------------------------------------------------------------
// Purpose:
@@ -767,88 +542,15 @@
} // end Desktop::doMouseActions
-// getTopViewTitle
-//--------------------------------------------------------------------------
-// Purpose: Returns the title of the top window.
-//--------------------------------------------------------------------------
-char *Desktop::getTopViewTitle()
-{
- if (top != 0)
- {
- return top->title;
- }
-
- return "noTitle";
-
-} // end getTopViewTitle
-
-// getMouseViewTitle
-//--------------------------------------------------------------------------
-// Purpose: Returns the title of the window which contains the mouse.
-//--------------------------------------------------------------------------
-char *Desktop::getMouseViewTitle()
-{
- if (mouseView != 0)
- {
- return mouseView->title;
- }
-
- return "noTitle";
-
-} // end getMouseViewTitle
-
-// getMouseViewStatus
-//--------------------------------------------------------------------------
-// Purpose: Returns the status of the window which contains the mouse.
-//--------------------------------------------------------------------------
-unsigned Desktop::getMouseViewStatus()
-{
- if (mouseView != 0) return mouseView->status;
- else return 0;
-} // end getMouseViewStatus
-
// getViewCount
//--------------------------------------------------------------------------
// Purpose: Returns the number of windows in the window manager.
//--------------------------------------------------------------------------
int Desktop::getViewCount()
{
- const int MAX_WINDOWS = 512;
-
- int viewCount = 0;
- View *list[MAX_WINDOWS];
-
- for (View *view = top ; view != 0 ; view = view->next)
- {
- if (viewCount > MAX_WINDOWS) assert(false);
- list[viewCount++] = view;
- }
-
- return viewCount;
+ return views.size();
} // end getViewCount
-// getViewTitle
-//--------------------------------------------------------------------------
-// Purpose: Returns the title of the specified window.
-//--------------------------------------------------------------------------
-const char *Desktop::getViewTitle(int winNum)
-{
- assert(winNum < getViewCount());
-
- View *w = top;
-
- // Goes through the window list till we get the requested window.
- for (int num = 0; num < winNum; num++)
- {
- assert(w != 0);
- w = w->next;
- }
-
- // Returnthe requested windows title.
- return w->title;
-
-} // end getViewTitle
-
// getViewSearchName
//--------------------------------------------------------------------------
// Purpose: Returns the searchName of the specified window.
@@ -857,18 +559,8 @@
{
assert(winNum < getViewCount());
- View *w = top;
-
- // Goes through the window list till we get the requested window.
- for (int num = 0; num < winNum; num++)
- {
- assert(w != 0);
- w = w->next;
- }
-
// Returnthe requested windows searchName.
- return w->getSearchName();
-
+ return views[winNum]->searchName;
} // end getViewSearchName
// getViewStatus
@@ -877,8 +569,10 @@
//--------------------------------------------------------------------------
int Desktop::getViewStatus(const char *searchName)
{
- for (View *view = top; view != 0; view = view->next)
- {
+ std::vector<View*>::iterator i;
+ for(i = views.begin(); i != views.end(); i++) {
+ View* view = *i;
+
if (strcmp(view->searchName, searchName) == 0)
{
return view->status;
@@ -888,45 +582,16 @@
return 0;
} // end getViewStatus
-// closeView
-//--------------------------------------------------------------------------
-// Purpose: Closes the window of the specified name.
-//--------------------------------------------------------------------------
-bool Desktop::closeView(const char *searchName)
-{
- const int MAX_WINDOWS = 512;
-
- int viewCount = 0;
- View *list[MAX_WINDOWS];
-
- for (View *w = top ; w != 0 ; w = w->next)
- {
- // Bounds checking.
- if (viewCount > MAX_WINDOWS) assert(false);
-
- // If the window searchName is found, disable the windows
visibility.
- if (strcmp(w->searchName, searchName) == 0)
- {
- w->status &= ~View::STATUS_VISIBLE;
-
- return true;
- }
-
- list[viewCount++] = w;
- }
-
- return false;
-
-} // end closeView
-
// setVisibility
//--------------------------------------------------------------------------
// Purpose:
//--------------------------------------------------------------------------
void Desktop::setVisibility(const char *searchName, int isVisible)
{
- for (View *view = top; view != 0; view = view->next)
- {
+ std::vector<View*>::iterator i;
+ for(i = views.begin(); i != views.end(); i++) {
+ View* view = *i;
+
if (strcmp(view->searchName, searchName) == 0)
{
if (isVisible)
@@ -951,8 +616,10 @@
//--------------------------------------------------------------------------
void Desktop::setVisibilityNoDoAnything(const char *searchName, int isVisible)
{
- for (View *view = top; view != 0; view = view->next)
- {
+ std::vector<View*>::iterator i;
+ for(i = views.begin(); i != views.end(); i++) {
+ View* view = *i;
+
if (strcmp(view->searchName, searchName) == 0)
{
if (isVisible)
Index: netpanzer/src/Lib/View/Desktop.hpp
diff -u netpanzer/src/Lib/View/Desktop.hpp:1.3
netpanzer/src/Lib/View/Desktop.hpp:1.4
--- netpanzer/src/Lib/View/Desktop.hpp:1.3 Tue Sep 9 13:16:13 2003
+++ netpanzer/src/Lib/View/Desktop.hpp Tue Sep 16 16:00:27 2003
@@ -20,18 +20,12 @@
#ifndef __Desktop_hpp__
#define __Desktop_hpp__
-
-#if _MSC_VER > 1000
- #pragma once
-#endif
-
-
+#include <vector>
#include "LibTypes.hpp"
#include "Surface.hpp"
#include "View.hpp"
#include "cTimeStamp.hpp"
-
class Desktop
{
private: // Variables
@@ -43,7 +37,7 @@
static float totalMouseDownTime;
static float currentMouseDownTime;
- static View *top;
+ static std::vector<View*> views;
static View *focus;
static int mouseActions;
static iXY lMouseDownPos;
@@ -75,9 +69,6 @@
static unsigned isMouseOverResizeArea(int mouseX, int mouseY);
static bool isMouseOverMoveArea (int mouseX, int mouseY);
- //static View const &topWindow() const { assertTopWindowExist(); return
*top; }
- static View &topView() { assertTopViewExist(); return *top; }
- static void assertTopViewExist() { assert(top != 0); }
static bool isMouseInView(int mouseX, int mouseY);
static View *findViewContaining(iXY p);
static void doMouseActions(const iXY &mousePos);
@@ -87,28 +78,20 @@
static void manage(int mouseX, int mouseY, int curButton);
static void activate(View *view);
- static bool removeView(const char *viewitle);
- static void removeAllViewAlwaysOnBottom();
static void toggleVisibility(const char *viewName);
static void setVisibility(const char *viewName, int isVisible);
static void toggleVisibilityNoDoAnything(const char *viewName);
static void setVisibilityNoDoAnything(const char *viewName, int
isVisible);
static void add(View *view, bool autoActivate = true);
- static void remove(View *view);
static void draw();
- static unsigned getPointerStatus (int mouseX, int mouseY);
static iXY getMouseActionOffset () { return mouseActionOffset; }
static void resetMouseActionOffset() { mouseActionOffset = 0; }
- static char *getTopViewTitle();
- static char *getMouseViewTitle();
- static unsigned getMouseViewStatus();
static int getViewCount();
static const char *getViewTitle(int viewNum);
static const char *getViewSearchName(int viewNum);
static int getViewStatus(const char *searchName);
- static bool closeView(const char *searchName);
static void setActiveView(const char *viewitle);
static void setActiveView(View *view);
@@ -154,8 +137,10 @@
static View *getView(const char *searchName)
{
- for (View *view = top ; view != 0 ; view = view->next)
- {
+ std::vector<View*>::iterator i;
+ for(i = views.begin(); i != views.end(); i++) {
+ View* view = *i;
+
if (strcmp(view->searchName, searchName) == 0)
{
return view;
@@ -172,8 +157,6 @@
{
activate(view);
}
-
-
}; // end Desktop
class DesktopView : public View
Index: netpanzer/src/Lib/View/ScrollBar.hpp
diff -u netpanzer/src/Lib/View/ScrollBar.hpp:1.1
netpanzer/src/Lib/View/ScrollBar.hpp:1.2
--- netpanzer/src/Lib/View/ScrollBar.hpp:1.1 Sun Dec 1 12:51:46 2002
+++ netpanzer/src/Lib/View/ScrollBar.hpp Tue Sep 16 16:00:27 2003
@@ -15,20 +15,12 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
#ifndef __ScrollBar_hpp__
#define __ScrollBar_hpp__
-
-#if _MSC_VER > 1000
- #pragma once
-#endif
-
-
#include "Component.hpp"
#include "View.hpp"
#include "Button.hpp"
-
//--------------------------------------------------------------------------
class ScrollBar : public Component
Index: netpanzer/src/Lib/View/TextComponent.hpp
diff -u netpanzer/src/Lib/View/TextComponent.hpp:1.1
netpanzer/src/Lib/View/TextComponent.hpp:1.2
--- netpanzer/src/Lib/View/TextComponent.hpp:1.1 Sun Dec 1 12:51:46 2002
+++ netpanzer/src/Lib/View/TextComponent.hpp Tue Sep 16 16:00:27 2003
@@ -15,20 +15,12 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
#ifndef __TextComponent_hpp__
#define __TextComponent_hpp__
-
-#if _MSC_VER > 1000
- #pragma once
-#endif
-
-
#include "Component.hpp"
#include "String.hpp"
-
//--------------------------------------------------------------------------
class TextComponent : public Component
{
@@ -55,7 +47,6 @@
void setSelectionStart() {}
void setSelectionEnd() {}
void setText() {}
-
}; // end TextComponent
#endif // end __TextComponent_hpp__
Index: netpanzer/src/Lib/View/View.cpp
diff -u netpanzer/src/Lib/View/View.cpp:1.9 netpanzer/src/Lib/View/View.cpp:1.10
--- netpanzer/src/Lib/View/View.cpp:1.9 Sat Sep 13 21:03:15 2003
+++ netpanzer/src/Lib/View/View.cpp Tue Sep 16 16:00:27 2003
@@ -513,11 +513,10 @@
{
assert(this != 0);
- if (getVisible())
- {
- doDraw(getViewArea(), getClientArea());
- }
+ if (!getVisible())
+ return;
+ doDraw(getViewArea(), getClientArea());
} // end draw
// activate
@@ -601,7 +600,6 @@
}
//drawToolTip(clientArea);
-
} // end View::doDraw
// doActivate
@@ -626,7 +624,6 @@
actionPerformed(me);
}
}
-
} // end View::doActivate
// doDeactivate
@@ -646,7 +643,6 @@
actionPerformed(me);
}
-
} // end View::doDeactivate
// getMouseActions
@@ -1625,7 +1621,6 @@
s.bltString(pos, pos, statusText, Color::black);
}
-
} // end View::drawStatus
// findButtonContaining
@@ -1769,23 +1764,6 @@
max.y = min.y + oldSize.y;
} // end centerAbsolute
-// DRAW TOOL TIP
-//---------------------------------------------------------------------------
-// Purpose: Draws a tool tip associated with the currently highlighted
-// button.
-//---------------------------------------------------------------------------
-//void View::drawToolTip()
-//{
-// if (highlightedButton < 0) return;
-//
-// CHECK(strlen(buttons[highlightedButton].getToolTip()) < 80, "ERROR:
Tool tip text too long.");
-//
-// char strBuf[80];
-// sprintf(strBuf, "%s", buttons[highlightedButton].getToolTip());
-// bltString(screen, mouse.getScreenPos().x+1,
mouse.getScreenPos().y-10+1, strBuf, Color::black);
-// bltString(screen, mouse.getScreenPos().x, mouse.getScreenPos().y-10,
strBuf, pal.cBLUE);
-//} // end DRAW TOOL TIP
-
// RESIZE CLIENT AREA
//---------------------------------------------------------------------------
// Purpose: Resize the client area of the window. The window area will be
@@ -1819,7 +1797,6 @@
}
resize(destSize);
-
} // end View::resizeClientArea
// RESIZE
@@ -1996,8 +1973,7 @@
//---------------------------------------------------------------------------
void View::toggleView()
{
- Desktop::toggleVisibility(searchName);
-
+ Desktop::toggleVisibility(searchName);
} // end toggleView
// setAllowResize
Index: netpanzer/src/Lib/View/View.hpp
diff -u netpanzer/src/Lib/View/View.hpp:1.3 netpanzer/src/Lib/View/View.hpp:1.4
--- netpanzer/src/Lib/View/View.hpp:1.3 Tue Sep 16 12:00:17 2003
+++ netpanzer/src/Lib/View/View.hpp Tue Sep 16 16:00:27 2003
@@ -16,7 +16,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//---------------------------------------------------------------------------
-
#ifndef __View_hpp__
#define __View_hpp__
@@ -27,14 +26,11 @@
#include "cInputField.hpp"
#include "iRect.hpp"
#include "iXY.hpp"
-#include "List.hpp"
#include "Component.hpp"
#include "MouseEvent.hpp"
-
class PackedSurface;
-
enum { BLANK, MINI_MAP, IMAGE_TILES };
const int SNAPTO_TOLERANCE = 20;
@@ -57,26 +53,13 @@
class View : public iRect
{
friend class Desktop;
-
-private:
- View *next;
-
- void insert(Component *Component);
-
public:
- //void add(Component *component)
- //{
- // scrollBar = component;
- // scrollBar->setOwner(this);
- //}
void add(Component *Component);
//void remove(Component *Component);
void add(DEFAULT_VIEW_BUTTON button);
//cGrowList <Component> ComponentList;
-private:
- //Component *scrollBar;
public:
enum { MAX_COMPONENT_COUNT = 30 };
@@ -334,7 +317,6 @@
iRect getViewRect() const;
iRect getClientRect() const;
-
}; // end View
#endif // end __View_hpp__
Index: netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.cpp:1.9
netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.cpp:1.10
--- netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.cpp:1.9 Fri Sep 12
17:37:10 2003
+++ netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.cpp Tue Sep 16
16:00:28 2003
@@ -80,7 +80,7 @@
}
void ConsoleInterface::setToSurfaceSize( iXY pix )
- {
+{
surface_size = pix;
bounds.min.x = 5;
@@ -88,7 +88,7 @@
bounds.max = pix - 5;
max_char_per_line = (bounds.max.x - bounds.min.x) / CHAR_XPIX;
- }
+}
void ConsoleInterface::openLogFile( void )
{
Index: netpanzer/src/NetPanzer/Interfaces/GameConfig.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameConfig.cpp:1.5
netpanzer/src/NetPanzer/Interfaces/GameConfig.cpp:1.6
--- netpanzer/src/NetPanzer/Interfaces/GameConfig.cpp:1.5 Mon Sep 15
17:51:37 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameConfig.cpp Tue Sep 16 16:00:28 2003
@@ -16,86 +16,83 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <config.h>
-#include "GameConfig.hpp"
-
-//#include "lua.h"
-//#include "lualib.h"
-
- char GameConfig::UnitColor;
- char GameConfig::GameMode; //Skirmish or Multiplayer
- char GameConfig::GameType; //Objectives, FragLimit,
TimeLimit
- char GameConfig::HostOrJoin; // 1=host, 2=join
- char GameConfig::VehicleGeneration;
- short GameConfig::NumberPlayers = 8; //max = 25;
- short GameConfig::NumberUnits = 500; //max = 50;
- short GameConfig::NumberInitialUnits = 5;
-
- char GameConfig::PlayerName[64];
-
- short GameConfig::PlayerFlag;
-
- int GameConfig::NetworkConnectionType = _connection_tcpip;
- int GameConfig::TimeLimit = 50; //in minutes
- int GameConfig::FragLimit = 1000; //in frags;
-
- bool GameConfig::map_cycling_on_off = false;
- bool GameConfig::powerups_on_off = false;
-
- float GameConfig::objective_occupation_percentage = 100.0;
- bool GameConfig::allow_allies_on_off = true;
- int GameConfig::cloud_coverage;
- float GameConfig::wind_speed;
- unsigned int GameConfig::respawn_type =
_game_config_respawn_type_round_robin;
-
- char GameConfig::game_map_name[256];
-
- // ** Visuals Configuration **
- unsigned int GameConfig::screen_resolution_enum =
_game_config_standard_res_640x480;
-
- bool GameConfig::display_shadows_flag = true;
- bool GameConfig::display_unit_flags = false;
-
- bool GameConfig::radar_display_clouds_flag = false;
-
- int GameConfig::radar_player_unit_color = _color_aqua;
- int GameConfig::radar_allied_unit_color = _color_orange;
- int GameConfig::radar_player_outpost_color = _color_blue;
- int GameConfig::radar_allied_outpost_color = _color_orange;
- int GameConfig::radar_enemy_outpost_color = _color_red;
- int GameConfig::vehicle_selection_box_color = _color_blue;
- int GameConfig::console_text_color = _color_white;
-
- int GameConfig::mini_map_unit_size = _mini_map_unit_size_small;
- int GameConfig::unit_selection_box_draw_mode =
_unit_selection_box_draw_mode_rect_edges;
- bool GameConfig::draw_unit_damage = false;
- bool GameConfig::draw_unit_reload = true;
- int GameConfig::mini_map_objective_draw_mode =
_mini_map_objective_draw_mode_outline_rect;
- int GameConfig::unitInfoDrawLayer = 0;
-
- float GameConfig::console_test_delay = 10.0; // in seconds
- int GameConfig::console_text_usage = 25; // in lines
-
- int GameConfig::screen_gamma = 50; // 0..100
- float GameConfig::screen_brightness = 1.0f; // 0..100
-
- float GameConfig::scroll_rate = 1000; // in pixels/s
- int GameConfig::mini_map_resize_rate = 400; // in pixels/s
-
- // ** Input Configuration **
- bool GameConfig::input_joystick_state = false;
-
- // ** Sound Configuration **
- bool GameConfig::sound_on_off_flag = true;
- int GameConfig::sound_volume = 50;
-
- PlayerUnitConfig GameConfig::unit_spawn_config;
-
- int GameConfig::attackNotificationTime = 5;
- bool GameConfig::blendSmoke = true;
+#include "FileSystem.hpp"
+#include "Log.hpp"
+#include "Exception.hpp"
+#include "GameConfig.hpp"
-void GameConfig::initialize( void )
- {
+std::string GameConfig::configfile;
+char GameConfig::UnitColor;
+char GameConfig::GameMode; //Skirmish or Multiplayer
+char GameConfig::GameType; //Objectives, FragLimit, TimeLimit
+char GameConfig::HostOrJoin; // 1=host, 2=join
+char GameConfig::VehicleGeneration;
+short GameConfig::NumberPlayers = 8; //max = 25;
+short GameConfig::NumberUnits = 500; //max = 50;
+short GameConfig::NumberInitialUnits = 5;
+
+char GameConfig::PlayerName[64];
+
+short GameConfig::PlayerFlag;
+
+int GameConfig::NetworkConnectionType = _connection_tcpip;
+int GameConfig::TimeLimit = 50; //in minutes
+int GameConfig::FragLimit = 1000; //in frags;
+
+bool GameConfig::map_cycling_on_off = false;
+bool GameConfig::powerups_on_off = false;
+
+float GameConfig::objective_occupation_percentage = 100.0;
+bool GameConfig::allow_allies_on_off = true;
+int GameConfig::cloud_coverage;
+float GameConfig::wind_speed;
+unsigned int GameConfig::respawn_type = _game_config_respawn_type_round_robin;
+
+char GameConfig::game_map_name[256];
+
+// ** Visuals Configuration **
+unsigned int GameConfig::screen_resolution = 0;
+bool GameConfig::screen_fullscreen = true;
+
+bool GameConfig::display_shadows_flag = true;
+bool GameConfig::display_unit_flags = false;
+
+bool GameConfig::radar_display_clouds_flag = false;
+
+int GameConfig::radar_player_unit_color = _color_aqua;
+int GameConfig::radar_allied_unit_color = _color_orange;
+int GameConfig::radar_player_outpost_color = _color_blue;
+int GameConfig::radar_allied_outpost_color = _color_orange;
+int GameConfig::radar_enemy_outpost_color = _color_red;
+int GameConfig::vehicle_selection_box_color = _color_blue;
+int GameConfig::console_text_color = _color_white;
+
+int GameConfig::mini_map_unit_size = _mini_map_unit_size_small;
+int GameConfig::unit_selection_box_draw_mode =
_unit_selection_box_draw_mode_rect_edges;
+bool GameConfig::draw_unit_damage = false;
+bool GameConfig::draw_unit_reload = true;
+int GameConfig::mini_map_objective_draw_mode =
_mini_map_objective_draw_mode_outline_rect;
+int GameConfig::unitInfoDrawLayer = 0;
+
+float GameConfig::console_test_delay = 10.0; // in seconds
+int GameConfig::console_text_usage = 25; // in lines
+
+int GameConfig::screen_gamma = 50; // 0..100
+float GameConfig::screen_brightness = 1.0f; // 0..100
+
+float GameConfig::scroll_rate = 1000; // in pixels/s
+int GameConfig::mini_map_resize_rate = 400; // in pixels/s
+
+PlayerUnitConfig GameConfig::unit_spawn_config;
+
+int GameConfig::attackNotificationTime = 5;
+bool GameConfig::blendSmoke = true;
+
+
+void GameConfig::initialize(const char* newconfigfile)
+{
+ configfile = newconfigfile;
//UnitColor;
GameMode = _gamemode_multiplayer; //Skirmish or Multiplayer
GameType = _gametype_objective; //Objectives, FragLimit, TimeLimit
@@ -121,9 +118,6 @@
*/
respawn_type = _game_config_respawn_type_round_robin;
- // ** Visuals Configuration **
- screen_resolution_enum = _game_config_standard_res_640x480;
-
display_shadows_flag = true;
radar_display_clouds_flag = false;
@@ -143,14 +137,71 @@
scroll_rate = 1000; // in pixels/s
mini_map_resize_rate = 400; // in pixels/s
- // ** Input Configuration **
- input_joystick_state = false;
-
- // ** Sound Configuration **
- sound_on_off_flag = true;
- sound_volume = 50;
+ try {
+ loadConfig();
+ } catch(Exception e) {
+ LOG(("couldn't read game configuration: %s", e.getMessage()));
+ }
+}
+
+void GameConfig::shutdown()
+{
+ try {
+ saveConfig();
+ } catch(Exception e) {
+ LOG(("couldn't save game configuration: %s", e.getMessage()));
+ }
+}
+
+void GameConfig::loadConfig()
+{
+ ReadFile* file = FileSystem::openRead(configfile.c_str());
+
+ // XXX loadin/saving would be nicer in human readable form (XML?)
+
+ int configversion = file->readSLE16();
+ if(configversion != CONFIG_VERSION)
+ throw Exception("wrong config file version");
+
+ UnitColor = file->read8();
+ GameMode = file->read8();
+ GameType = file->read8();
+ NumberPlayers = file->readSLE16();
+ NumberUnits = file->readSLE16();
+ NumberInitialUnits = file->readSLE16();
+
+ // TODO lots of other stuff :)
+ screen_resolution = file->readSLE32();
+ screen_fullscreen = file->read8();
+ display_shadows_flag = file->read8();
+ display_unit_flags = file->read8();
+
+ // TODO lots of other stuff :)
+
+ delete file;
+}
+
+void GameConfig::saveConfig()
+{
+ WriteFile* file = FileSystem::openWrite(configfile.c_str());
+
+ file->writeSLE16(CONFIG_VERSION);
+
+ file->write8(UnitColor);
+ file->write8(GameMode);
+ file->write8(GameType);
+ file->writeSLE16(NumberPlayers);
+ file->writeSLE16(NumberUnits);
+ file->writeSLE16(NumberInitialUnits);
+
+ // TODO lots of other stuff :)
+ file->writeSLE32(screen_resolution);
+ file->write8(screen_fullscreen);
+ file->write8(display_shadows_flag);
+ file->write8(display_unit_flags);
- }
+ delete file;
+}
void GameConfig::setGameMapName( char *map_name )
{
@@ -160,44 +211,4 @@
char * GameConfig::getGameMapName( void )
{
return( game_map_name );
- }
-
-void GameConfig::loadConfigScript( void )
- {
- return;
-
- //int lua_return;
- //lua_Object envValue;
-
-
- // The LUA library is probably not compatible with
- // GPL so I'm commenting it out for now
- /*
- lua_return = lua_dofile( "Scripts/config.lua" );
- assert( lua_return == 0 );
-
- envValue = lua_getglobal( "envGameType" );
- SetGameType( (int) lua_getnumber( envValue ) );
-
- envValue = lua_getglobal( "envMaxPlayers" );
- SetNumberPlayers( (int) lua_getnumber( envValue ) );
-
- envValue = lua_getglobal( "envMaxUnits" );
- SetNumberUnits( (int) lua_getnumber( envValue ) );
-
- envValue = lua_getglobal( "envPlayerOrServerName" );
- SetPlayerName( lua_getstring( envValue ) );
-
- envValue = lua_getglobal( "envTimeLimit" );
- SetTimeLimit( (int) lua_getnumber( envValue ) );
-
- envValue = lua_getglobal( "envFragLimit" );
- SetFragLimit( (int) lua_getnumber( envValue ) );
-
- envValue = lua_getglobal( "envMapCycling" );
- setMapCycleState( (int) lua_getnumber( envValue ) );
-
- envValue = lua_getglobal( "envPowerUps" );
- setPowerUpState( (int) lua_getnumber( envValue ) );
- */
}
Index: netpanzer/src/NetPanzer/Interfaces/GameConfig.hpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameConfig.hpp:1.6
netpanzer/src/NetPanzer/Interfaces/GameConfig.hpp:1.7
--- netpanzer/src/NetPanzer/Interfaces/GameConfig.hpp:1.6 Tue Sep 16
12:54:50 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameConfig.hpp Tue Sep 16 16:00:28 2003
@@ -20,6 +20,7 @@
#include <assert.h>
#include <string.h>
+#include <string>
#include "Surface.hpp"
#include "Color.hpp"
@@ -129,18 +130,21 @@
#define _GAME_CONFIG_ATTACK_NOTIFICATION_TIME_LIMIT_UPPER 30
#define _GAME_CONFIG_ATTACK_NOTIFICATION_TIME_LIMIT_LOWER 2
+// Remember to change this, when the config changes!
+#define CONFIG_VERSION 000001
class GameConfig
{
- protected:
- static char UnitColor;
- static char GameMode; //Skirmish or Multiplayer
- static char GameType; //Objectives, FragLimit, TimeLimit
- static char HostOrJoin; //1=host, 2=join
- static char VehicleGeneration;
- static short NumberPlayers; //max = 25;
- static short NumberUnits; //max = 50;
- static short NumberInitialUnits; //max = 50;
+protected:
+ static std::string configfile;
+ static char UnitColor;
+ static char GameMode; //Skirmish or Multiplayer
+ static char GameType; //Objectives, FragLimit,
TimeLimit
+ static char HostOrJoin; //1=host, 2=join
+ static char VehicleGeneration;
+ static short NumberPlayers; //max = 25;
+ static short NumberUnits; //max = 50;
+ static short NumberInitialUnits; //max = 50;
static char PlayerName[64];
@@ -163,7 +167,8 @@
static char game_map_name[256];
// ** Visuals Configuration **
- static unsigned int screen_resolution_enum;
+ static unsigned int screen_resolution;
+ static bool screen_fullscreen;
static bool display_shadows_flag;
static bool display_unit_flags;
@@ -195,17 +200,8 @@
static float screen_brightness; // [-1.0 ... 1.0]
-
- // ** Input Configuration **
- static bool input_joystick_state;
-
- // ** Sound Configuration **
- static bool sound_on_off_flag;
- static int sound_volume;
-
- protected:
-
- static inline PIX colorEnumToPix( int color_enum )
+protected:
+ static inline PIX colorEnumToPix( int color_enum )
{
switch( color_enum )
{
@@ -231,10 +227,14 @@
return( Color::white );
}
- public:
+ static void loadConfig();
+ static void saveConfig();
+
+public:
static PlayerUnitConfig unit_spawn_config;
- static void initialize( void );
+ static void initialize(const char* configfile);
+ static void shutdown();
static inline void SetUnitColor(char unit_color)
{ UnitColor = unit_color;}
@@ -861,120 +861,25 @@
static inline bool getDisplayUnitFlags( void )
{ return( display_unit_flags ); }
- // ** Input Configuration Methods **
-
- static inline void setJoystickState( bool on_off )
- { input_joystick_state = on_off; }
-
- static inline bool getJoystickState( void )
- { return( input_joystick_state ); }
-
- static inline char * getJoystickStateString( void )
- {
- if ( input_joystick_state == true )
- { return( "On" ); }
- else
- { return( "Off" ); }
- }
-
-
- // ** Sound Configuration Methods **
-
- static inline void setSoundState( bool on_off )
- { sound_on_off_flag = on_off; }
-
- static inline bool getSoundState( void )
- { return( sound_on_off_flag ); }
-
- static inline char * getSoundStateString( void )
- {
- if ( sound_on_off_flag == true )
- { return( "On" ); }
- else
- { return( "Off" ); }
- }
-
- //***********************************************************
- static inline int getSoundVolume( void )
- {
- return( sound_volume );
- }
-
- static inline void setSoundVolume( int volume )
- {
- if ( volume < _GAME_CONFIG_SOUND_VOLUME_LIMIT_LOWER )
- { sound_volume = _GAME_CONFIG_SOUND_VOLUME_LIMIT_LOWER; }
- else
- if ( volume > _GAME_CONFIG_SOUND_VOLUME_LIMIT_UPPER )
- { sound_volume = _GAME_CONFIG_SOUND_VOLUME_LIMIT_UPPER; }
- else
- { sound_volume = volume; }
- }
-
- static inline int getSoundVolumeBoundsUpper( void )
- { return( _GAME_CONFIG_SOUND_VOLUME_LIMIT_UPPER); }
-
- static inline int getSoundVolumeBoundsLower( void )
- { return(_GAME_CONFIG_SOUND_VOLUME_LIMIT_UPPER); }
-
-
- static inline void setGameScreenResolution( unsigned int game_res_enum )
- {
- if ( (game_res_enum >= 0) && (game_res_enum <=
_game_config_standard_res_max) )
- {
- screen_resolution_enum = game_res_enum;
- }
- }
-
- static inline void setNextGameScreenResolution( void )
- {
- screen_resolution_enum = (screen_resolution_enum + 1) %
_game_config_standard_res_max;
- }
-
- static inline void setPreviousGameScreenResolution( void )
- {
- screen_resolution_enum = (screen_resolution_enum - 1) %
_game_config_standard_res_max;
- }
-
- static inline char * getGameScreenResolutionString( void )
- {
- switch(screen_resolution_enum)
- {
- case _game_config_standard_res_640x480 :
- return( "640x480" );
- break;
-
- case _game_config_standard_res_800x600 :
- return( "800x600" );
- break;
-
- case _game_config_standard_res_1024x768 :
- return( "1024x768" );
- break;
- }
-
- return( "Invalid Mode" );
- }
+ static void setScreenResolution(int newres)
+ {
+ screen_resolution = newres;
+ }
- static inline iXY getGameScreenResolutionSize( void )
- {
- switch(screen_resolution_enum)
- {
- case _game_config_standard_res_640x480 :
- return( iXY( 640, 480) );
- break;
+ static int getScreenResolution()
+ {
+ return screen_resolution;
+ }
- case _game_config_standard_res_800x600 :
- return( iXY( 800, 600) );
- break;
+ static void setFullscreen(bool fullscreen)
+ {
+ screen_fullscreen = fullscreen;
+ }
- case _game_config_standard_res_1024x768 :
- return( iXY(1024, 768) );
- break;
- }
-
- return( iXY( 640, 480) );
- }
+ static bool getFullscreen()
+ {
+ return screen_fullscreen;
+ }
//***********************************************************
static inline void increaseAttackNotificationTime()
@@ -1170,8 +1075,6 @@
else if ( unitInfoDrawLayer == 7 ) { return( "Top" ); }
return "Undefined value";
}
-
- static void loadConfigScript( void );
};
#endif // ** __GAMECONFIG_HPP
Index: netpanzer/src/NetPanzer/Interfaces/GameManager.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.41
netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.42
--- netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.41 Mon Sep 15
17:42:15 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameManager.cpp Tue Sep 16 16:00:28 2003
@@ -43,7 +43,6 @@
#include "Log.hpp"
#include "MouseInterface.hpp"
#include "KeyboardInterface.hpp"
-#include "KeyBinder.hpp"
#include "KeyActionEnum.hpp"
#include "DDHardSurface.hpp"
#include "GameConfig.hpp"
@@ -70,6 +69,7 @@
#include "PowerUpInterface.hpp"
#include "ChatInterface.hpp"
#include "Exception.hpp"
+#include "FileSystem.hpp"
// ** GVS Includes
#include "codewiz.hpp"
@@ -159,7 +159,7 @@
current_video_mode_res = iXY(640,480);
// don't go fullscreen for now
- setVideoMode(current_video_mode_res, false);
+ setVideoMode();
loadPalette("wads/netp.act");
}
@@ -265,12 +265,28 @@
}
// ******************************************************************
-void GameManager::setVideoMode(const iXY& mode_res, bool fullscreen)
+void GameManager::setVideoMode()
{
- if(!Screen->isDisplayModeAvailable( mode_res.x, mode_res.y, 8 ))
- throw Exception("desired Video mode not available.");
+ iXY mode_res;
+ bool fullscreen = GameConfig::getFullscreen();
+
+ int mode;
+ for(mode=GameConfig::getScreenResolution(); mode>=0; mode--) {
+ switch(mode) {
+ case 0: mode_res = iXY(640,480); break;
+ case 1: mode_res = iXY(800,600); break;
+ case 2: mode_res = iXY(1024,768); break;
+ case 3: mode_res = iXY(1280, 1024); break;
+ }
+
+ if(Screen->isDisplayModeAvailable( mode_res.x, mode_res.y, 8 ))
{
+ GameConfig::setScreenResolution(mode);
+ break;
+ }
+ }
+ if(mode<0)
+ throw Exception("couldn't find a usable video mode");
- previous_video_mode_res = current_video_mode_res;
current_video_mode_res = mode_res;
if (!Screen->setVideoMode(current_video_mode_res.x,
@@ -280,16 +296,18 @@
WorldViewInterface::setCameraSize( current_video_mode_res.x,
current_video_mode_res.y );
FRAME_BUFFER.create(current_video_mode_res.x, current_video_mode_res.y,
current_video_mode_res.x, 1 );
screen.createNoAlloc(current_video_mode_res);
- gameView.setSize( current_video_mode_res );
-}
+ gameView.setSize(current_video_mode_res);
-// ******************************************************************
+ Desktop::checkViewPositions();
+ //ConsoleInterface::setToSurfaceSize( current_video_mode_res );
-void GameManager::restorePreviousVideoMode()
-{
- setVideoMode(previous_video_mode_res, Screen->isFullScreen());
+ // reset palette
+ Palette pal;
+ Screen->setPalette(pal.color);
}
+// ******************************************************************
+
void GameManager::drawTextCenteredOnScreen(const char *string, PIX color)
{
FRAME_BUFFER.lock();
@@ -303,6 +321,7 @@
// ******************************************************************
+#if 0
void GameManager::increaseDisplayResolution()
{
iXY new_mode;
@@ -335,7 +354,7 @@
// ******************************************************************
void GameManager::decreaseDisplayResolution()
- {
+{
iXY new_mode;
drawTextCenteredOnScreen("Changing Resolution", Color::white);
@@ -362,6 +381,7 @@
ConsoleInterface::postMessage( "Screen Resolution : %d x %d",
current_video_mode_res.x, current_video_mode_res.y );
}
+#endif
// ******************************************************************
@@ -421,7 +441,6 @@
// ******************************************************************
void GameManager::initializeGameObjects()
{
- GameConfig::initialize();
MapsManager::initialize();
MapsManager::scanMaps();
@@ -533,24 +552,15 @@
void GameManager::setupKeyboardBindings()
{
- KeyBinder::staticInitialize();
- KEY_BINDER.initialize( 256 );
-
- KEY_BINDER.bindAction( _action_mini_map, "MiniMapView", SDLK_F8 );
- KEY_BINDER.lockKey( SDLK_F8 );
-
- // UNSUPPORTED VIEW
- KEY_BINDER.bindAction( _action_chat_view, "ChatView", SDLK_F7 );
- KEY_BINDER.lockKey( SDLK_F7 );
-
+#if 0
KEY_BINDER.bindAction( _action_rank_view, "RankView", SDLK_F6 );
- KEY_BINDER.lockKey( SDLK_F6 );
+ KEY_BINDER.bindAction( _action_chat_view, "ChatView", SDLK_F7 );
+ KEY_BINDER.bindAction( _action_mini_map, "MiniMapView", SDLK_F8 );
+#endif
}
void GameManager::processSystemKeys()
{
- int scan_code;
-
if (Desktop::getVisible("GameView"))
{
@@ -565,14 +575,11 @@
Desktop::toggleVisibility( "UnitColorView" );
}
-#if 0 // XXX need another key here, TILDE is not good, because on some
keybaords
- // (german ones) it's a composed char)
// Toggle unit damage bars.
- if (KeyboardInterface::getKeyPressed(SDLK_TILDE))
+ if (KeyboardInterface::getKeyPressed(SDLK_d))
{
GameConfig::toggleDrawUnitDamage();
}
-#endif
// Remove all selection.
if (KeyboardInterface::getKeyPressed(SDLK_ESCAPE))
@@ -628,87 +635,38 @@
if (Desktop::getView("GameView")->getVisible())
{
- scan_code = KEY_BINDER.getActionKey( _action_mini_map );
-
- if (KeyboardInterface::getKeyPressed( scan_code ))
+ if (KeyboardInterface::getKeyPressed(SDLK_F8))
{
Desktop::toggleVisibility( "MiniMapView" );
}
-
- scan_code = KEY_BINDER.getActionKey( _action_chat_view );
-
- if (KeyboardInterface::getKeyPressed( scan_code ))
+ if (KeyboardInterface::getKeyPressed(SDLK_F7))
{
Desktop::toggleVisibility( "ChatView" );
}
-
- scan_code = KEY_BINDER.getActionKey( _action_rank_view );
-
- if (KeyboardInterface::getKeyPressed( scan_code ))
+ if (KeyboardInterface::getKeyPressed(SDLK_F6))
{
Desktop::toggleVisibility( "RankView" );
}
-
- if (KeyboardInterface::getKeyPressed( SDLK_F3 ))
+ if (KeyboardInterface::getKeyPressed(SDLK_F3))
{
Desktop::toggleVisibility( "DesktopView" );
}
-
- if (KeyboardInterface::getKeyPressed( SDLK_TAB ))
+ if (KeyboardInterface::getKeyPressed(SDLK_TAB))
{
Desktop::toggleVisibility( "GameToolbarView" );
}
-
-
- if (KeyboardInterface::getKeyPressed( SDLK_F4 ))
+ if (KeyboardInterface::getKeyPressed(SDLK_F4))
{
Desktop::toggleVisibility( "CodeStatsView" );
}
-
if (KeyboardInterface::getKeyPressed(SDLK_F1))
{
Desktop::toggleVisibility( "HelpScrollView" );
}
- if ( KeyboardInterface::getKeyState( SDLK_LALT ) ||
- KeyboardInterface::getKeyState( SDLK_RALT ))
- {
-
- if (KeyboardInterface::getKeyPressed( SDLK_KP_PLUS ) ==
true)
- {
- if (Desktop::getView("MainView")->getVisible()
== false)
- {
- increaseDisplayResolution();
- }
- }
-
- if (KeyboardInterface::getKeyPressed( SDLK_KP_MINUS )
== true)
- {
- if (Desktop::getView("MainView")->getVisible()
== false)
- {
- decreaseDisplayResolution();
- }
- }
-
- if (KeyboardInterface::getKeyPressed( SDLK_RETURN ) ==
true)
- {
- setVideoMode(current_video_mode_res,
!Screen->isFullScreen());
-
- // TODO: put all this video mode change stuff
in an own function
- WorldViewInterface::setCameraSize(
current_video_mode_res.x, current_video_mode_res.y );
- FRAME_BUFFER.create(current_video_mode_res.x,
current_video_mode_res.y, current_video_mode_res.x, 1 );
- screen.createNoAlloc(current_video_mode_res);
- gameView.setSize( current_video_mode_res );
- Desktop::checkViewPositions();
- ConsoleInterface::setToSurfaceSize(
current_video_mode_res );
- loadPalette("wads/netp.act");
- ConsoleInterface::postMessage("Fullscreen : %s",
- Screen->isFullScreen() ? "yes"
: "no" );
- }
- }
-
if (KeyboardInterface::getKeyPressed(SDLK_F2))
{
+ printf("ShowMenu!\n");
if (Desktop::getView("GameView")->getVisible())
{
if
(!Desktop::getView("OptionsView")->getVisible() &&
@@ -718,98 +676,61 @@
!Desktop::getView("VisualsView")->getVisible())
{
View *v =
Desktop::getView("OptionsView");
-
- if (v != 0)
- {
- ((OptionsTemplateView
*)v)->initButtons();
- ((OptionsTemplateView
*)v)->setAlwaysOnBottom(false);
- } else
- {
- assert(false);
- }
+ assert(v != 0);
+ ((OptionsTemplateView
*)v)->initButtons();
+ ((OptionsTemplateView
*)v)->setAlwaysOnBottom(false);
v = Desktop::getView("SoundView");
- if (v != 0)
- {
- ((SoundView *)v)->initButtons();
- ((OptionsTemplateView
*)v)->setAlwaysOnBottom(false);
- } else
- {
- assert(false);
- }
+ assert(v != 0);
+ ((SoundView *)v)->initButtons();
+ ((OptionsTemplateView
*)v)->setAlwaysOnBottom(false);
v = Desktop::getView("ControlsView");
- if (v != 0)
- {
- ((ControlsView
*)v)->initButtons();
- ((OptionsTemplateView
*)v)->setAlwaysOnBottom(false);
- } else
- {
- assert(false);
- }
+ assert(v != 0);
+ ((ControlsView *)v)->initButtons();
+ ((OptionsTemplateView
*)v)->setAlwaysOnBottom(false);
v = Desktop::getView("VisualsView");
- if (v != 0)
- {
- ((VisualsView
*)v)->initButtons();
- ((OptionsTemplateView
*)v)->setAlwaysOnBottom(false);
- } else
- {
- assert(false);
- }
+ assert(v != 0);
+ ((VisualsView *)v)->initButtons();
+ ((OptionsTemplateView
*)v)->setAlwaysOnBottom(false);
v = Desktop::getView("InterfaceView");
- if (v != 0)
- {
- ((InterfaceView
*)v)->initButtons();
- ((OptionsTemplateView
*)v)->setAlwaysOnBottom(false);
- } else
- {
- assert(false);
- }
+ assert(v != 0);
+ ((InterfaceView *)v)->initButtons();
+ ((OptionsTemplateView
*)v)->setAlwaysOnBottom(false);
Desktop::setVisibility("OptionsView",
true);
Desktop::setActiveView("OptionsView");
- } else
- {
+ } else {
View *v =
Desktop::getView("OptionsView");
- if (v != 0)
- {
- ((OptionsTemplateView
*)v)->setAlwaysOnBottom(true);
- ((OptionsTemplateView
*)v)->setVisible(false);
- }
+ assert(v != 0);
+ ((OptionsTemplateView
*)v)->setAlwaysOnBottom(true);
+ ((OptionsTemplateView
*)v)->setVisible(false);
v = Desktop::getView("InterfaceView");
- if (v != 0)
- {
- ((OptionsTemplateView
*)v)->setAlwaysOnBottom(true);
- ((OptionsTemplateView
*)v)->setVisible(false);
- }
+ assert(v != 0);
+ ((OptionsTemplateView
*)v)->setAlwaysOnBottom(true);
+ ((OptionsTemplateView
*)v)->setVisible(false);
v = Desktop::getView("VisualsView");
- if (v != 0)
- {
- ((OptionsTemplateView
*)v)->setAlwaysOnBottom(true);
- ((OptionsTemplateView
*)v)->setVisible(false);
- }
+ assert(v != 0);
+ ((OptionsTemplateView
*)v)->setAlwaysOnBottom(true);
+ ((OptionsTemplateView
*)v)->setVisible(false);
v = Desktop::getView("SoundView");
- if (v != 0)
- {
- ((OptionsTemplateView
*)v)->setAlwaysOnBottom(true);
- ((OptionsTemplateView
*)v)->setVisible(false);
- }
+ assert(v != 0);
+ ((OptionsTemplateView
*)v)->setAlwaysOnBottom(true);
+ ((OptionsTemplateView
*)v)->setVisible(false);
v = Desktop::getView("ControlsView");
- if (v != 0)
- {
- ((OptionsTemplateView
*)v)->setAlwaysOnBottom(true);
- ((OptionsTemplateView
*)v)->setVisible(false);
- }
+ assert(v != 0);
+ ((OptionsTemplateView
*)v)->setAlwaysOnBottom(true);
+ ((OptionsTemplateView
*)v)->setVisible(false);
}
}
}
- } // ** if (Desktop::getView("GameView")->getVisible())
+ }
}
@@ -822,7 +743,6 @@
if(UNIT_FLAGS_SURFACE.getFrameCount() == 0)
throw Exception("Couldn't find any flag in pics/flags/.");
- GameConfig::loadConfigScript();
return true;
}
@@ -834,8 +754,6 @@
UNIT_FLAGS_SURFACE.loadAllBMPInDirectory("pics/flags/");
if(UNIT_FLAGS_SURFACE.getFrameCount() == 0)
throw Exception("Couldn't find any flag in pics/flags/.");
-
- GameConfig::loadConfigScript();
}
// ******************************************************************
@@ -936,6 +854,9 @@
void GameManager::bootStrap()
{
try {
+ if(!FileSystem::exists("config"))
+ FileSystem::mkdir("config");
+ GameConfig::initialize("config/netpanzer.cfg");
initializeSoundSubSystem();
initializeVideoSubSystem();
loadGameData();
@@ -955,6 +876,9 @@
void GameManager::dedicatedBootStrap()
{
try {
+ if(!FileSystem::exists("config"))
+ FileSystem::mkdir("config");
+ GameConfig::initialize("config/netpanzer-dedicated.cfg");
initializeSoundSubSystem(); // we load a dummy sound driver
dedicatedLoadGameData();
initializeGameObjects();
@@ -985,6 +909,7 @@
shutdownSoundSubSystem();
shutdownVideoSubSystem();
shutdownInputDevices();
+ GameConfig::shutdown();
}
void GameManager::dedicatedShutdown()
@@ -993,6 +918,7 @@
shutdownNetworkSubSystem();
shutdownInputDevices();
shutdownDedicatedConsole();
+ GameManager::shutdown();
}
// ******************************************************************
Index: netpanzer/src/NetPanzer/Interfaces/GameManager.hpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameManager.hpp:1.7
netpanzer/src/NetPanzer/Interfaces/GameManager.hpp:1.8
--- netpanzer/src/NetPanzer/Interfaces/GameManager.hpp:1.7 Thu Sep 11
13:35:47 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameManager.hpp Tue Sep 16 16:00:28 2003
@@ -179,12 +179,8 @@
static void processSystemMessage( NetMessage *message );
- static void setVideoMode(const iXY& newmode, bool fullscreen);
- static void restorePreviousVideoMode();
+ static void setVideoMode();
- static void increaseDisplayResolution();
- static void decreaseDisplayResolution();
-
static void loadPalette( char *palette_path );
static void drawTextCenteredOnScreen(const char *string, unsigned char
color);
Index: netpanzer/src/NetPanzer/Views/Game/AreYouSureResignView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/AreYouSureResignView.cpp:1.10
netpanzer/src/NetPanzer/Views/Game/AreYouSureResignView.cpp:1.11
--- netpanzer/src/NetPanzer/Views/Game/AreYouSureResignView.cpp:1.10 Mon Sep
15 17:22:14 2003
+++ netpanzer/src/NetPanzer/Views/Game/AreYouSureResignView.cpp Tue Sep 16
16:00:28 2003
@@ -48,7 +48,7 @@
//----------------------
// Swap to the menu resolution.
- GameManager::setVideoMode(iXY(640, 480), false);
+ //GameManager::setVideoMode(iXY(640, 480), false);
GameManager::drawTextCenteredOnScreen("Loading Main View...",
Color::white);
Index: netpanzer/src/NetPanzer/Views/Game/ChatView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/ChatView.cpp:1.4
netpanzer/src/NetPanzer/Views/Game/ChatView.cpp:1.5
--- netpanzer/src/NetPanzer/Views/Game/ChatView.cpp:1.4 Sun Sep 7 16:49:03 2003
+++ netpanzer/src/NetPanzer/Views/Game/ChatView.cpp Tue Sep 16 16:00:28 2003
@@ -36,13 +36,6 @@
// Button functions.
/////////////////////////////////////////////////////////////////////////////
-#if 0
-static void closeView()
-{
- Desktop::setVisibility("ChatView", false);
-}
-#endif
-
static void sendMessageAllPlayers()
{
ChatInterface::setMessageScopeAll();
Index: netpanzer/src/NetPanzer/Views/Game/HelpScrollView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/HelpScrollView.cpp:1.6
netpanzer/src/NetPanzer/Views/Game/HelpScrollView.cpp:1.7
--- netpanzer/src/NetPanzer/Views/Game/HelpScrollView.cpp:1.6 Wed Sep 10
07:26:10 2003
+++ netpanzer/src/NetPanzer/Views/Game/HelpScrollView.cpp Tue Sep 16
16:00:28 2003
@@ -167,7 +167,6 @@
//clientArea.bltStringCenter(strBuf, Color::red);
View::doDraw(viewArea, clientArea);
-
} // end HelpScrollView::doDraw
// drawHelpText
@@ -186,12 +185,12 @@
// maxView = scrollBar->getMaximum();
// }
//
- int curIndex = 0;
- for (int i = topViewableItem; i < topViewableItem +
maxViewableItems; i++)
- {
- dest.bltString(1, 6 + curIndex * (TEXT_GAP_SPACE +
CHAR_YPIX), text[i], color);
- curIndex++;
- }
+ int curIndex = 0;
+ for (int i = topViewableItem; i < topViewableItem + maxViewableItems;
i++)
+ {
+ dest.bltString(1, 6 + curIndex * (TEXT_GAP_SPACE + CHAR_YPIX),
text[i], color);
+ curIndex++;
+ }
//}
} // end HelpScrollView::drawHelpText
Index: netpanzer/src/NetPanzer/Views/Game/HelpScrollView.hpp
diff -u netpanzer/src/NetPanzer/Views/Game/HelpScrollView.hpp:1.1
netpanzer/src/NetPanzer/Views/Game/HelpScrollView.hpp:1.2
--- netpanzer/src/NetPanzer/Views/Game/HelpScrollView.hpp:1.1 Sun Dec 1
12:52:00 2002
+++ netpanzer/src/NetPanzer/Views/Game/HelpScrollView.hpp Tue Sep 16
16:00:28 2003
@@ -19,12 +19,6 @@
#ifndef __HelpScrollView_hpp__
#define __HelpScrollView_hpp__
-
-#if _MSC_VER > 1000
- #pragma once
-#endif
-
-
#include "SpecialButtonView.hpp"
#include "Surface.hpp"
#include "ScrollBar.hpp"
@@ -32,7 +26,6 @@
#include "cGrowList.hpp"
#include "Button.hpp"
-
//---------------------------------------------------------------------------
class HelpScrollView : public SpecialButtonView
{
@@ -66,7 +59,6 @@
virtual void processEvents();
virtual void actionPerformed(mMouseEvent me);
virtual void doActivate();
-
}; // end HelpScrollView
#endif // end __HelpScrollView_hpp__
Index: netpanzer/src/NetPanzer/Views/Game/ProgressView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/ProgressView.cpp:1.8
netpanzer/src/NetPanzer/Views/Game/ProgressView.cpp:1.9
--- netpanzer/src/NetPanzer/Views/Game/ProgressView.cpp:1.8 Mon Sep 8
11:32:05 2003
+++ netpanzer/src/NetPanzer/Views/Game/ProgressView.cpp Tue Sep 16 16:00:28 2003
@@ -199,19 +199,19 @@
}
void ProgressView::open()
- {
- if ( Desktop::getView("ProgressView")->getVisible() == false )
- {
- GameManager::setVideoMode(iXY(640, 480), false);
-
- GameManager::drawTextCenteredOnScreen("Sec...", Color::white);
-
- GameManager::loadPalette("wads/netpmenu.act");
-
- Desktop::setVisibilityAllWindows(false);
- Desktop::setVisibility("ProgressView", true);
- }
- }
+{
+ if ( Desktop::getView("ProgressView")->getVisible() == false )
+ {
+ //GameManager::setVideoMode(iXY(640, 480), false);
+
+ GameManager::drawTextCenteredOnScreen("Sec...", Color::white);
+
+ GameManager::loadPalette("wads/netpmenu.act");
+
+ Desktop::setVisibilityAllWindows(false);
+ Desktop::setVisibility("ProgressView", true);
+ }
+}
//---------------------------------------------------------------------------
@@ -222,7 +222,7 @@
reset();
GameManager::drawTextCenteredOnScreen("Sec...", Color::white);
- GameManager::restorePreviousVideoMode();
+ //GameManager::restorePreviousVideoMode();
Desktop::checkViewPositions();
GameManager::loadPalette("wads/netp.act");
@@ -240,7 +240,7 @@
backgroundSurface.free();
GameManager::drawTextCenteredOnScreen("Sec...", Color::white);
- GameManager::restorePreviousVideoMode();
+ //GameManager::restorePreviousVideoMode();
Desktop::checkViewPositions();
// Set the palette to the game palette.
Index: netpanzer/src/NetPanzer/Views/Game/WinnerMesgView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/WinnerMesgView.cpp:1.9
netpanzer/src/NetPanzer/Views/Game/WinnerMesgView.cpp:1.10
--- netpanzer/src/NetPanzer/Views/Game/WinnerMesgView.cpp:1.9 Mon Sep 15
17:22:14 2003
+++ netpanzer/src/NetPanzer/Views/Game/WinnerMesgView.cpp Tue Sep 16
16:00:28 2003
@@ -60,7 +60,7 @@
//----------------------
// Swap to the menu resolution.
- GameManager::setVideoMode(iXY(640, 480), false);
+ //GameManager::setVideoMode(iXY(640, 480), false);
GameManager::drawTextCenteredOnScreen("Loading Main View...",
Color::white);
@@ -223,7 +223,6 @@
const unsigned MAX_KILLS_CHARS = 9;
const unsigned MAX_LOSSES_CHARS = 10;
const unsigned MAX_POINTS_CHARS = 10;
- const unsigned MAX_OBJECTIVE_CHARS = 13;
for (int i = 0; i < numPlayers; i++)
{
Index: netpanzer/src/NetPanzer/Views/MainMenu/HelpView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/HelpView.cpp:1.4
netpanzer/src/NetPanzer/Views/MainMenu/HelpView.cpp:1.5
--- netpanzer/src/NetPanzer/Views/MainMenu/HelpView.cpp:1.4 Sat Sep 6
11:39:25 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/HelpView.cpp Tue Sep 16 16:00:28 2003
@@ -15,15 +15,13 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
-
#include <config.h>
+
#include "HelpView.hpp"
#include "Desktop.hpp"
#include "GameView.hpp"
#include "GameViewGlobals.hpp"
-
// HelpView
//---------------------------------------------------------------------------
HelpView::HelpView() : MenuTemplateView()
@@ -31,7 +29,6 @@
setSearchName("HelpView");
setTitle("Help Information");
setSubTitle("");
-
} // end HelpView::HelpView
// doDraw
Index: netpanzer/src/NetPanzer/Views/MainMenu/HelpView.hpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/HelpView.hpp:1.1
netpanzer/src/NetPanzer/Views/MainMenu/HelpView.hpp:1.2
--- netpanzer/src/NetPanzer/Views/MainMenu/HelpView.hpp:1.1 Sun Dec 1
12:52:00 2002
+++ netpanzer/src/NetPanzer/Views/MainMenu/HelpView.hpp Tue Sep 16 16:00:28 2003
@@ -15,21 +15,13 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
#ifndef __HelpView_hpp__
#define __HelpView_hpp__
-
-#if _MSC_VER > 1000
- #pragma once
-#endif
-
-
#include "View.hpp"
#include "Surface.hpp"
#include "MenuTemplateView.hpp"
-
//--------------------------------------------------------------------------
class HelpView : public MenuTemplateView
{
@@ -42,7 +34,6 @@
virtual void doDraw(const Surface &windowArea, const Surface
&clientArea);
virtual void doActivate();
virtual void doDeactivate();
-
}; // end HelpView
#endif // end __HelpView_hpp__
Index: netpanzer/src/NetPanzer/Views/MainMenu/MenuTemplateView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/MenuTemplateView.cpp:1.11
netpanzer/src/NetPanzer/Views/MainMenu/MenuTemplateView.cpp:1.12
--- netpanzer/src/NetPanzer/Views/MainMenu/MenuTemplateView.cpp:1.11 Mon Sep
15 17:22:14 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/MenuTemplateView.cpp Tue Sep 16
16:00:28 2003
@@ -97,26 +97,6 @@
Desktop::setVisibility("HelpView", true);
}
-// XXX never used
-#if 0
-static void bOrdering()
-{
- if (Desktop::getVisible("GameView"))
- {
- Desktop::setVisibility("ControlsView", false);
- Desktop::setVisibility("VisualsView", false);
- Desktop::setVisibility("InterfaceView", false);
- Desktop::setVisibility("SoundView", false);
- Desktop::setVisibility("OptionsView", false);
- } else
- {
- Desktop::setVisibilityAllWindows(false);
- }
-
- Desktop::setVisibility("OrderingView", true);
-}
-#endif
-
static void bExit()
{
GameManager::exitNetPanzer();
@@ -236,14 +216,11 @@
//---------------------------------------------------------------------------
void MenuTemplateView::initButtons()
{
- if (Desktop::getVisible("GameView"))
- {
+ if (Desktop::getVisible("GameView")) {
initInGameOptionButtons();
- } else
- {
+ } else {
initPreGameOptionButtons();
}
-
} // end MenuTemplateView::initButtons
// doDraw
Index: netpanzer/src/NetPanzer/Views/MainMenu/MenuTemplateView.hpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/MenuTemplateView.hpp:1.2
netpanzer/src/NetPanzer/Views/MainMenu/MenuTemplateView.hpp:1.3
--- netpanzer/src/NetPanzer/Views/MainMenu/MenuTemplateView.hpp:1.2 Mon Sep
1 16:24:21 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/MenuTemplateView.hpp Tue Sep 16
16:00:28 2003
@@ -15,7 +15,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
#ifndef __MenuTemplateView_hpp__
#define __MenuTemplateView_hpp__
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/FlagSelectionView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Multi/FlagSelectionView.cpp:1.10
netpanzer/src/NetPanzer/Views/MainMenu/Multi/FlagSelectionView.cpp:1.11
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/FlagSelectionView.cpp:1.10
Fri Sep 12 20:15:08 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/FlagSelectionView.cpp Tue Sep
16 16:00:28 2003
@@ -39,7 +39,8 @@
setVisible(false);
// The thirty is to give more room to the map selectior view.
- moveTo(bodyTextRect.min.x + bodyTextRect.getSizeX() / 2 + 10 + 30,
bodyTextRect.min.y + 50);
+ moveTo(bodyTextRect.min.x + bodyTextRect.getSizeX() / 2 + 10 + 30,
+ bodyTextRect.min.y + 50);
// Load the flag images.
//flags.loadAllBMPInDirectory("pics/flags/");
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/FlagSelectionView.hpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Multi/FlagSelectionView.hpp:1.1
netpanzer/src/NetPanzer/Views/MainMenu/Multi/FlagSelectionView.hpp:1.2
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/FlagSelectionView.hpp:1.1
Sun Dec 1 12:52:00 2002
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/FlagSelectionView.hpp Tue Sep
16 16:00:28 2003
@@ -15,25 +15,16 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
#ifndef __FlagSelectionView_hpp__
#define __FlagSelectionView_hpp__
-
-#if _MSC_VER > 1000
- #pragma once
-#endif
-
-
#include "RMouseHackView.hpp"
#include "Surface.hpp"
#include "ScrollBar.hpp"
-
extern Surface playerFlag;
extern int playerFlagSelected;
-
//---------------------------------------------------------------------------
class FlagSelectionView : public RMouseHackView
{
@@ -55,7 +46,6 @@
virtual void drawBorder(const Surface &windowArea) {}
void init();
-
}; // end FlagSelectionView
#endif // end __FlagSelectionView_hpp__
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp
diff -u
netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp:1.8
netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp:1.9
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp:1.8
Wed Sep 10 07:26:10 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp
Tue Sep 16 16:00:28 2003
@@ -36,13 +36,6 @@
#include "Client.hpp"
#include "Server.hpp"
-static int humveeCount = 0;
-static int lightTankCount = 0;
-static int mediumTankCount = 0;
-static int heavyTankCount = 0;
-static int missleLauncherCount = 0;
-static int selectionsRemaining = 10;
-
char HostJoinTemplateView::gameTypeBuf[256];
Surface playerColor;
@@ -55,41 +48,6 @@
/////////////////////////////////////////////////////////////////////////////
// Button functions.
/////////////////////////////////////////////////////////////////////////////
-
-static void bSetColorDarkBlue()
-{
- // Set the ready flag to false.
-
- playerColor.fill(cDarkBlue);
-}
-
-static void bSetColorLightBlue()
-{
- // Set the ready flag to false.
-
- playerColor.fill(cLightBlue);
-}
-
-static void bSetColorLightGreen()
-{
- // Set the ready flag to false.
-
- playerColor.fill(cLightGreen);
-}
-
-static void bSetColorRed()
-{
- // Set the ready flag to false.
-
- playerColor.fill(Color::red);
-}
-
-static void bSetColorOrange()
-{
- // Set the ready flag to false.
-
- playerColor.fill(cOrange);
-}
static void bBack()
{
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostView.cpp:1.5
netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostView.cpp:1.6
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostView.cpp:1.5 Sat Sep
6 11:39:25 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostView.cpp Tue Sep 16
16:00:28 2003
@@ -16,55 +16,16 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <config.h>
+
#include "HostView.hpp"
#include "GameConfig.hpp"
#include "GameViewGlobals.hpp"
#include "ParticleSystemGlobals.hpp"
#include "HostOptionsView.hpp"
-
-static char screenSurfacePathTIL[] = "pics/backgrounds/menus/multimb.til";
-
-
/////////////////////////////////////////////////////////////////////////////
// Buttons functions.
/////////////////////////////////////////////////////////////////////////////
-
-static void setGameTypeObjective()
-{
- sprintf(HostView::gameTypeBuf, "Objective");
-}
-
-static void setGameTypeFragLimit()
-{
- sprintf(HostView::gameTypeBuf, "Frag Limit");
-}
-
-static void setGameTypeTimeLimit()
-{
- sprintf(HostView::gameTypeBuf, "Time Limit");
-}
-
-static void increaseFragLimit()
-{
- GameConfig::SetFragLimit(GameConfig::GetFragLimit() + 5);
-}
-
-static void decreaseFragLimit()
-{
- GameConfig::SetFragLimit(GameConfig::GetFragLimit() - 5);
-}
-
-static void increaseTimeLimit()
-{
- GameConfig::SetTimeLimit(GameConfig::GetTimeLimit() + 2);
-}
-
-static void decreaseTimeLimit()
-{
- GameConfig::SetTimeLimit(GameConfig::GetTimeLimit() - 2);
-}
-
//---------------------------------------------------------------------------
HostView::HostView() : HostJoinTemplateView()
Index: netpanzer/src/NetPanzer/Views/MainMenu/Options/SoundView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Options/SoundView.cpp:1.4
netpanzer/src/NetPanzer/Views/MainMenu/Options/SoundView.cpp:1.5
--- netpanzer/src/NetPanzer/Views/MainMenu/Options/SoundView.cpp:1.4 Sat Sep
6 11:39:26 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Options/SoundView.cpp Tue Sep
16 16:00:28 2003
@@ -15,45 +15,12 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
-
#include <config.h>
+
#include "SoundView.hpp"
#include "GameConfig.hpp"
#include "GameViewGlobals.hpp"
#include "Desktop.hpp"
-
-
-static const char *getSoundState()
-{
- return GameConfig::getSoundStateString();
-}
-
-static int getSoundVolume()
-{
- return GameConfig::getSoundVolume();
-}
-
-static void bSetSoundStateOn()
-{
- GameConfig::setSoundState(true);
-}
-
-static void bSetSoundStateOff()
-{
- GameConfig::setSoundState(false);
-}
-
-static void bDecreaseSoundVolume()
-{
- GameConfig::setSoundVolume(GameConfig::getSoundVolume() - 1);
-}
-
-static void bIncreaseSoundVolume()
-{
- GameConfig::setSoundVolume(GameConfig::getSoundVolume() + 1);
-}
-
// SoundView
//---------------------------------------------------------------------------
Index: netpanzer/src/NetPanzer/Views/MainMenu/Options/VisualsView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Options/VisualsView.cpp:1.4
netpanzer/src/NetPanzer/Views/MainMenu/Options/VisualsView.cpp:1.5
--- netpanzer/src/NetPanzer/Views/MainMenu/Options/VisualsView.cpp:1.4 Sat Sep
6 11:39:26 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Options/VisualsView.cpp Tue Sep
16 16:00:28 2003
@@ -15,143 +15,16 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
-
#include <config.h>
+
#include "VisualsView.hpp"
#include "ParticleSystemGlobals.hpp"
#include "GameConfig.hpp"
#include "GameManager.hpp"
#include "GameViewGlobals.hpp"
+#include "UILib/UIDraw.hpp"
#include "Desktop.hpp"
-
-static String getDisplayShadows()
-{
- return GameConfig::getDisplayShadowsFlagString();
-}
-
-static String getResolution()
-{
- return GameConfig::getGameScreenResolutionString();
-}
-
-static int getGamma()
-{
- return GameConfig::getScreenGamma();
-}
-
-static int getBrightness()
-{
- return (int) GameConfig::getScreenBrightness();
-}
-
-static void bIncreaseResolution()
-{
- GameConfig::setNextGameScreenResolution();
-}
-
-static void bDecreaseResolution()
-{
- GameConfig::setPreviousGameScreenResolution();
-}
-
-static void bIncreaseGamma()
-{
- GameConfig::setScreenGamma(GameConfig::getScreenGamma() + 1);
-}
-
-static void bDecreaseGamma()
-{
- GameConfig::setScreenGamma(GameConfig::getScreenGamma() - 1);
-}
-
-static void bIncreaseBrightness()
-{
- GameConfig::setScreenBrightness(GameConfig::getScreenBrightness() +
0.1f);
-}
-
-static void bDecreaseBrightness()
-{
- GameConfig::setScreenBrightness(GameConfig::getScreenBrightness() -
0.1f);
-}
-
-static void bNextViewBackgroundMode()
-{
- if (++viewDrawBackgroundMode >= VIEW_BACKGROUND_COUNT)
- {
- viewDrawBackgroundMode = 0;
- }
-}
-
-static void bPreviousViewBackgroundMode()
-{
- if (--viewDrawBackgroundMode < 0)
- {
- viewDrawBackgroundMode = VIEW_BACKGROUND_COUNT - 1;
- }
-}
-
-static String getViewBackgroundMode()
-{
- if (viewDrawBackgroundMode == VIEW_BACKGROUND_DARK_GRAY_BLEND) { return
"Dark Gray Blend"; }
- else if (viewDrawBackgroundMode == VIEW_BACKGROUND_LIGHT_GRAY_BLEND) {
return "Light Gray Blend"; }
- else if (viewDrawBackgroundMode == VIEW_BACKGROUND_SOLID_BLACK) {
return "Solid Black"; }
- else if (viewDrawBackgroundMode == VIEW_BACKGROUND_TRANSPARENT) {
return "Transparent"; }
- else return "Unsupported Mode";
-}
-
-static String getBlendSmoke()
-{
- return GameConfig::getBlendSmokeString();
-}
-
-static void bPreviousObjectiveMiniMapDrawMode()
-{
- GameConfig::setPreviousMiniMapObjectiveDrawMode();
-}
-
-static void bNextObjectiveMiniMapDrawMode()
-{
- GameConfig::setNextMiniMapObjectiveDrawMode();
-}
-
-static String getObjectiveMiniMapDrawMode()
-{
- return GameConfig::getMiniMapObjectiveDrawModeString();
-}
-
-static void bPreviousMiniMapUnitSize()
-{
- GameConfig::setPreviousMiniMapUnitSize();
-}
-
-static void bNextMiniMapUnitSize()
-{
- GameConfig::setNextMiniMapUnitSize();
-}
-
-static void bPreviousUnitSelectionDrawMode()
-{
- GameConfig::setPreviousUnitSelectionBoxDrawMode();
-}
-
-static void bNextUnitSelectionDrawMode()
-{
- GameConfig::setNextUnitSelectionBoxDrawMode();
-}
-
-static void bSetUnitDrawLayerBottom()
-{
- GameConfig::toggleUnitInfoDrawLayer();
-}
-
-static void bSetUnitDrawLayerTop()
-{
- GameConfig::toggleUnitInfoDrawLayer();
-}
-
-
// VisualsView
//---------------------------------------------------------------------------
VisualsView::VisualsView() : OptionsTemplateView()
@@ -168,27 +41,26 @@
int x = xTextStart + 10;
int y = bodyTextRect.min.y;
int yOffset = 20;
- int buttonXSize = 90;
- int arrowButtonWidth = 16;
- const int textOffset = 30;
-
// Settings
//----------------------------------------------------------------------
int minWidth = 19 * CHAR_XPIX;
x = xTextStart + 10;
y = 100;
- //choiceResolution.setName("Resolution");
- //choiceResolution.addItemDefault("640x480");
- //choiceResolution.addItem("800x600");
- //choiceResolution.addItem("1024x768");
- //choiceResolution.setLocation(x, y);
- //choiceResolution.setMinWidth(minWidth);
- //y += yOffset;
- //y += yOffset;
+ choiceResolution.setName("Resolution");
+ choiceResolution.setStateChangedCallback(this);
+ choiceResolution.addItemDefault("640x480");
+ choiceResolution.addItem("800x600");
+ choiceResolution.addItem("1024x768");
+ choiceResolution.setLocation(x, y);
+ choiceResolution.select(GameConfig::getScreenResolution());
+ choiceResolution.setMinWidth(minWidth);
+ y += yOffset;
+ y += yOffset;
choiceGameViewBackgroundColor.setName("Game View Background Color");
+ choiceGameViewBackgroundColor.setStateChangedCallback(this);
choiceGameViewBackgroundColor.addItemDefault("Dark Gray Blend");
choiceGameViewBackgroundColor.addItem("Light Gray Blend");
choiceGameViewBackgroundColor.addItem("Solid Black");
@@ -199,6 +71,7 @@
y += yOffset;
choiceMiniMapObjectiveDrawMode.setName("Mini Map Objective Draw Mode");
+ choiceMiniMapObjectiveDrawMode.setStateChangedCallback(this);
choiceMiniMapObjectiveDrawMode.addItemDefault("Outlined");
choiceMiniMapObjectiveDrawMode.addItem("Solid");
choiceMiniMapObjectiveDrawMode.setLocation(x, y);
@@ -209,6 +82,7 @@
x = 300;
y = 100;
choiceMiniMapUnitSize.setName("Mini Map Unit Size");
+ choiceMiniMapUnitSize.setStateChangedCallback(this);
choiceMiniMapUnitSize.addItemDefault("Small");
choiceMiniMapUnitSize.addItem("Large");
choiceMiniMapUnitSize.setLocation(x, y);
@@ -217,6 +91,7 @@
y += yOffset;
choiceUnitSelectionDrawMode.setName("Unit Selection Draw Mode");
+ choiceUnitSelectionDrawMode.setStateChangedCallback(this);
choiceUnitSelectionDrawMode.addItemDefault("Rectangle Edges");
choiceUnitSelectionDrawMode.addItem("Rectangle Outline");
choiceUnitSelectionDrawMode.setLocation(x, y);
@@ -225,6 +100,7 @@
y += yOffset;
//choiceUnitInfoDrawLayer.setName("Unit Information Draw Layer");
+ //choiceUnitInfoDrawLayer.setStateChangedCallback(this);
//choiceUnitInfoDrawLayer.addItemDefault("Bottom");
//choiceUnitInfoDrawLayer.addItem("Top");
//choiceUnitInfoDrawLayer.setLocation(x, y);
@@ -251,6 +127,7 @@
x = xTextStart + 10;
y = 100 + 110;
choiceYourRadarUnit.setName("Your Radar Unit");
+ choiceYourRadarUnit.setStateChangedCallback(this);
choiceYourRadarUnit.addItem("Aqua");
choiceYourRadarUnit.addItem("Blue");
choiceYourRadarUnit.addItem("Dark Blue");
@@ -274,6 +151,7 @@
y += yOffset;
choiceAlliedRadarUnit.setName("Allied Radar Unit");
+ choiceAlliedRadarUnit.setStateChangedCallback(this);
choiceAlliedRadarUnit.copyItems(choiceYourRadarUnit);
choiceAlliedRadarUnit.setLocation(x, y);
choiceAlliedRadarUnit.setMinWidth(minWidth);
@@ -282,6 +160,7 @@
y += yOffset;
choiceYourRadarObjective.setName("Your Radar Objective");
+ choiceYourRadarObjective.setStateChangedCallback(this);
choiceYourRadarObjective.copyItems(choiceYourRadarUnit);
choiceYourRadarObjective.setLocation(x, y);
choiceYourRadarObjective.setMinWidth(minWidth);
@@ -290,6 +169,7 @@
y += yOffset;
choiceAlliedRadarObjective.setName("Allied Radar Objective");
+ choiceAlliedRadarObjective.setStateChangedCallback(this);
choiceAlliedRadarObjective.copyItems(choiceYourRadarUnit);
choiceAlliedRadarObjective.setLocation(x, y);
choiceAlliedRadarObjective.setMinWidth(minWidth);
@@ -300,6 +180,7 @@
x = 300;
y = 100 + 110;
choiceEnemyRadarObjective.setName("Enemy Radar Objective");
+ choiceEnemyRadarObjective.setStateChangedCallback(this);
choiceEnemyRadarObjective.copyItems(choiceYourRadarUnit);
choiceEnemyRadarObjective.setLocation(x, y);
choiceEnemyRadarObjective.setMinWidth(minWidth);
@@ -308,6 +189,7 @@
y += yOffset;
choiceVehicleSelectionBox.setName("Vehicle Selection Box");
+ choiceVehicleSelectionBox.setStateChangedCallback(this);
choiceVehicleSelectionBox.copyItems(choiceYourRadarUnit);
choiceVehicleSelectionBox.setLocation(x, y);
choiceVehicleSelectionBox.setMinWidth(minWidth);
@@ -316,6 +198,7 @@
y += yOffset;
choiceConsoleText.setName("Console Text");
+ choiceConsoleText.setStateChangedCallback(this);
choiceConsoleText.copyItems(choiceYourRadarUnit);
choiceConsoleText.setLocation(x, y);
choiceConsoleText.setMinWidth(minWidth);
@@ -327,18 +210,22 @@
y = 344;
checkBoxDrawAllShadows.setLabel("Draw All Shadows");
+ checkBoxDrawAllShadows.setStateChangedCallback(this);
checkBoxDrawAllShadows.setState(GameConfig::getDisplayShadowsFlag());
checkBoxDrawAllShadows.setLocation(x, y);
y += yOffset;
checkBoxBlendSmoke.setLabel("Blend Smoke");
+ checkBoxBlendSmoke.setStateChangedCallback(this);
checkBoxBlendSmoke.setState(GameConfig::getBlendSmoke());
checkBoxBlendSmoke.setLocation(x, y);
y += yOffset;
- //titledBorderColorSettings.setName("Color Settings");
- //titledBorderColorSettings.setBounds(bodyTextRect);
- //add(&titledBorderColorSettings);
+ checkBoxFullscreen.setLabel("Fullscreen");
+ checkBoxFullscreen.setStateChangedCallback(this);
+ checkBoxFullscreen.setState(Screen->isFullScreen());
+ checkBoxFullscreen.setLocation(x, y);
+ y += yOffset;
} // end VisualsView::VisualsView
// initButtons
@@ -349,7 +236,8 @@
add(&checkBoxDrawAllShadows);
add(&checkBoxBlendSmoke);
- //add(&choiceResolution);
+ add(&checkBoxFullscreen);
+ add(&choiceResolution);
add(&choiceGameViewBackgroundColor);
add(&choiceMiniMapObjectiveDrawMode);
add(&choiceMiniMapUnitSize);
@@ -398,20 +286,19 @@
void VisualsView::loadTitleSurface()
{
doLoadTitleSurface("pics/backgrounds/menus/menu/til/visualsTitle.til");
-
} // end VisualsView::loadTitleSurface
// actionPerformed
//---------------------------------------------------------------------------
-void VisualsView::actionPerformed(mMouseEvent me)
+void VisualsView::stateChanged(Component* source)
{
// Check Box Draw All Shadows
- if (me.getSource(checkBoxDrawAllShadows))
+ if (source == &checkBoxDrawAllShadows)
{
GameConfig::setDisplayShadowsFlag(checkBoxDrawAllShadows.getState());
}
// Check Box Blend Smoke
- else if (me.getSource(checkBoxBlendSmoke))
+ else if (source == &checkBoxBlendSmoke)
{
if (checkBoxBlendSmoke.getState())
{
@@ -421,12 +308,19 @@
GameConfig::setBlendSmokeFalse();
}
}
+ else if (source == &checkBoxFullscreen)
+ {
+ GameConfig::setFullscreen(checkBoxFullscreen.getState());
+ GameManager::setVideoMode();
+ }
// Choice Resolution
- //else if (me.getSource(choiceResolution))
- //{
- //}
+ else if (source == &choiceResolution)
+ {
+
GameConfig::setScreenResolution(choiceResolution.getSelectedIndex());
+ GameManager::setVideoMode();
+ }
// Choice Game View Background Color
- else if (me.getSource(choiceGameViewBackgroundColor))
+ else if (source == &choiceGameViewBackgroundColor)
{
if (choiceGameViewBackgroundColor.getSelectedIndex() == 0)
{
@@ -446,7 +340,7 @@
}
}
// Choice MiniMap Objective Draw Mode
- else if (me.getSource(choiceMiniMapObjectiveDrawMode))
+ else if (source == &choiceMiniMapObjectiveDrawMode)
{
if (choiceMiniMapObjectiveDrawMode.getSelectedIndex() == 0)
{
@@ -458,7 +352,7 @@
}
}
// Choice Mini Map Unit Size
- else if (me.getSource(choiceMiniMapUnitSize))
+ else if (source == &choiceMiniMapUnitSize)
{
if (choiceMiniMapUnitSize.getSelectedIndex() == 0)
{
@@ -470,7 +364,7 @@
}
}
// Choice Unit Selection Draw Mode
- else if (me.getSource(choiceUnitSelectionDrawMode))
+ else if (source == &choiceUnitSelectionDrawMode)
{
if (choiceUnitSelectionDrawMode.getSelectedIndex() == 0)
{
@@ -482,7 +376,7 @@
}
}
// Choice Unit Info Draw Layer
- //else if (me.getSource(choiceUnitInfoDrawLayer))
+ //else if (source == &choiceUnitInfoDrawLayer)
//{
// if (choiceUnitInfoDrawLayer.getSelectedIndex() == 0)
// {
@@ -493,5 +387,5 @@
// GameConfig::setUnitInfoDrawLayerTop();
// }
//}
+}
-} // end VisualsView::actionPerformed
Index: netpanzer/src/NetPanzer/Views/MainMenu/Options/VisualsView.hpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Options/VisualsView.hpp:1.1
netpanzer/src/NetPanzer/Views/MainMenu/Options/VisualsView.hpp:1.2
--- netpanzer/src/NetPanzer/Views/MainMenu/Options/VisualsView.hpp:1.1 Sun Dec
1 12:52:08 2002
+++ netpanzer/src/NetPanzer/Views/MainMenu/Options/VisualsView.hpp Tue Sep
16 16:00:28 2003
@@ -19,18 +19,11 @@
#ifndef __VisualsView_hpp__
#define __VisualsView_hpp__
-
-#if _MSC_VER > 1000
- #pragma once
-#endif
-
-
#include "View.hpp"
#include "OptionsTemplateView.hpp"
#include "CheckBox.hpp"
#include "Choice.hpp"
-#include "TitledBorder.hpp"
-
+#include "StateChangedCallback.hpp"
/////////////////////////////////////////////////////////////////////////////
// forward declarations
@@ -43,7 +36,7 @@
/////////////////////////////////////////////////////////////////////////////
//--------------------------------------------------------------------------
-class VisualsView : public OptionsTemplateView
+class VisualsView : public OptionsTemplateView, public StateChangedCallback
{
private:
int selectedColorStartY;
@@ -51,14 +44,16 @@
// Option check boxes.
CheckBox checkBoxDrawAllShadows;
CheckBox checkBoxBlendSmoke;
+ CheckBox checkBoxFullscreen;
//CheckBox drawUnitReload;
// Option choices.
- //Choice choiceResolution;
+ Choice choiceResolution;
Choice choiceGameViewBackgroundColor;
Choice choiceMiniMapObjectiveDrawMode;
Choice choiceMiniMapUnitSize;
Choice choiceUnitSelectionDrawMode;
+
//Choice choiceUnitInfoDrawLayer;
// Color choices.
@@ -70,8 +65,6 @@
Choice choiceVehicleSelectionBox;
Choice choiceConsoleText;
- TitledBorder titledBorderColorSettings;
-
virtual void loadTitleSurface();
public:
@@ -80,8 +73,7 @@
virtual void doDraw(const Surface &windowArea, const Surface
&clientArea);
virtual void processEvents();
virtual void initButtons();
- virtual void actionPerformed(mMouseEvent me);
-
+ virtual void stateChanged(Component* source);
}; // end VisualsView
#endif // end __VisualsView_hpp__
Index: netpanzer/src/NetPanzer/Views/MainMenu/RMouseHackView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/RMouseHackView.cpp:1.3
netpanzer/src/NetPanzer/Views/MainMenu/RMouseHackView.cpp:1.4
--- netpanzer/src/NetPanzer/Views/MainMenu/RMouseHackView.cpp:1.3 Fri Sep
5 22:01:20 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/RMouseHackView.cpp Tue Sep 16
16:00:28 2003
@@ -15,18 +15,16 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
-
#include <config.h>
+
#include "RMouseHackView.hpp"
#include "Desktop.hpp"
-
// rMouseDrag
//---------------------------------------------------------------------------
-void RMouseHackView::rMouseDrag(const iXY &downPos, const iXY &prevPos, const
iXY &newPos)
+void RMouseHackView::rMouseDrag(const iXY &downPos, const iXY &prevPos,
+ const iXY
&newPos)
{
lMouseDown(newPos);
lMouseUp(downPos, newPos);
-
} // end RMouseHackView::rMouseDrag
Index: netpanzer/src/NetPanzer/Views/MainMenu/RMouseHackView.hpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/RMouseHackView.hpp:1.1
netpanzer/src/NetPanzer/Views/MainMenu/RMouseHackView.hpp:1.2
--- netpanzer/src/NetPanzer/Views/MainMenu/RMouseHackView.hpp:1.1 Sun Dec
1 12:52:08 2002
+++ netpanzer/src/NetPanzer/Views/MainMenu/RMouseHackView.hpp Tue Sep 16
16:00:28 2003
@@ -15,27 +15,19 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
#ifndef __RMouseHackView_hpp__
#define __RMouseHackView_hpp__
-
-#if _MSC_VER > 1000
- #pragma once
-#endif
-
-
#include "View.hpp"
-
//--------------------------------------------------------------------------
class RMouseHackView : public View
{
public:
RMouseHackView() {}
- virtual void rMouseDrag(const iXY &downPos, const iXY &prevPos, const
iXY &newPos);
-
+ virtual void rMouseDrag(const iXY &downPos, const iXY &prevPos,
+ const iXY &newPos);
}; // end RMouseHackView
#endif // end __RMouseHackView_hpp__
Index: netpanzer/src/NetPanzer/Views/MainMenu/SpecialButtonView.hpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/SpecialButtonView.hpp:1.1
netpanzer/src/NetPanzer/Views/MainMenu/SpecialButtonView.hpp:1.2
--- netpanzer/src/NetPanzer/Views/MainMenu/SpecialButtonView.hpp:1.1 Sun Dec
1 12:52:08 2002
+++ netpanzer/src/NetPanzer/Views/MainMenu/SpecialButtonView.hpp Tue Sep
16 16:00:28 2003
@@ -15,19 +15,11 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
#ifndef __SpecialButtonView_hpp__
#define __SpecialButtonView_hpp__
-
-#if _MSC_VER > 1000
- #pragma once
-#endif
-
-
#include "RMouseHackView.hpp"
-
//--------------------------------------------------------------------------
class SpecialButtonView : public RMouseHackView
{
@@ -42,7 +34,6 @@
SpecialButtonView() : RMouseHackView() {}
virtual void mouseMove(const iXY & prevPos, const iXY &newPos);
virtual void doActivate();
-
}; // end SpecialButtonView
#endif // end __SpecialButtonView_hpp__
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [netPanzer-CVS] netpanzer/src ChangeLog Lib/FileSystem.cpp Lib/...,
Matthias Braun <=