Just some refactoring

master
Eduardo Bart 12 years ago
parent 29a4d467af
commit 73769c62e4

@ -21,7 +21,6 @@ set(framework_SOURCES ${framework_SOURCES}
${CMAKE_CURRENT_LIST_DIR}/pch.h
${CMAKE_CURRENT_LIST_DIR}/luafunctions.cpp
${CMAKE_CURRENT_LIST_DIR}/util/boolean.h
${CMAKE_CURRENT_LIST_DIR}/util/color.cpp
${CMAKE_CURRENT_LIST_DIR}/util/color.h
${CMAKE_CURRENT_LIST_DIR}/util/crypt.cpp
@ -33,7 +32,6 @@ set(framework_SOURCES ${framework_SOURCES}
${CMAKE_CURRENT_LIST_DIR}/util/rsa.cpp
${CMAKE_CURRENT_LIST_DIR}/util/rsa.h
${CMAKE_CURRENT_LIST_DIR}/util/size.h
${CMAKE_CURRENT_LIST_DIR}/util/attribstorage.h
# stdext
${CMAKE_CURRENT_LIST_DIR}/stdext/cast.h
@ -46,6 +44,8 @@ set(framework_SOURCES ${framework_SOURCES}
${CMAKE_CURRENT_LIST_DIR}/stdext/string.h
${CMAKE_CURRENT_LIST_DIR}/stdext/time.h
${CMAKE_CURRENT_LIST_DIR}/stdext/types.h
${CMAKE_CURRENT_LIST_DIR}/stdext/attrib_storage.h
${CMAKE_CURRENT_LIST_DIR}/stdext/shared_object.h
# core
${CMAKE_CURRENT_LIST_DIR}/core/application.cpp
@ -127,11 +127,11 @@ endif()
# gcc compile flags
set(WARNS_FLAGS "-Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unused-variable")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNS_FLAGS} ${ARCH_FLAGS} -std=gnu++0x -pipe")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNS_FLAGS} ${ARCH_FLAGS} -std=c++11 -pipe")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O1 -g -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
set(CMAKE_CXX_FLAGS_PERFORMANCE "-Ofast -mmxx -msee -msee2")
set(CMAKE_CXX_FLAGS_PERFORMANCE "-Ofast -mmmx -msse -msse2")
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os")
# process options

@ -68,9 +68,9 @@ protected:
std::string m_appCompactName;
std::string m_appVersion;
std::string m_startupOptions;
Boolean<false> m_running;
Boolean<false> m_stopping;
Boolean<false> m_terminated;
bool m_running = false;
bool m_stopping = false;
stdext::boolean<false> m_terminated;
};
#ifdef FW_GRAPHICS

@ -40,7 +40,7 @@ public:
private:
std::list<EventPtr> m_eventList;
int m_pollEventsSize;
Boolean<false> m_disabled;
bool m_disabled = false;
std::priority_queue<ScheduledEventPtr, std::vector<ScheduledEventPtr>, lessScheduledEvent> m_scheduledEventList;
};

@ -60,8 +60,8 @@ protected:
void inputEvent(const InputEvent& event);
private:
Boolean<false> m_onInputEvent;
Boolean<false> m_mustRepaint;
bool m_onInputEvent = false;
bool m_mustRepaint = false;
AdaptativeFrameCounter m_backgroundFrameCounter;
AdaptativeFrameCounter m_foregroundFrameCounter;
TexturePtr m_foreground;

@ -63,10 +63,10 @@ protected:
friend class ModuleManager;
private:
Boolean<false> m_loaded;
Boolean<false> m_autoLoad;
Boolean<false> m_reloadable;
Boolean<false> m_sandboxed;
bool m_loaded = false;
bool m_autoLoad = false;
bool m_reloadable = false;
bool m_sandboxed = false;
int m_autoLoadPriority;
int m_sandboxEnv;
std::tuple<std::string, std::string> m_onLoadFunc;

@ -72,7 +72,7 @@ public:
private:
std::string m_workDir;
std::string m_writeDir;
Boolean<false> m_hasSearchPath;
bool m_hasSearchPath = false;
std::deque<std::string> m_searchPaths;
};

@ -41,7 +41,7 @@ public:
private:
ticks_t m_startTicks;
Boolean<false> m_stopped;
bool m_stopped = false;
};
#endif

@ -40,7 +40,6 @@
#include "util/rect.h"
#include "util/size.h"
#include "util/matrix.h"
#include "util/boolean.h"
// logger
#include "core/logger.h"

@ -48,7 +48,7 @@ private:
std::string m_text;
Size m_textSize;
Boolean<true> m_textMustRecache;
bool m_textMustRecache = true;
CoordsBuffer m_textCoordsBuffer;
Rect m_textCachedScreenCoords;
BitmapFontPtr m_font;

@ -61,8 +61,8 @@ private:
Size m_oldViewportSize;
uint m_fbo;
uint m_prevBoundFbo;
Boolean<true> m_backuping;
Boolean<true> m_smooth;
bool m_backuping = true;
bool m_smooth = true;
static uint boundFbo;
};

@ -77,16 +77,16 @@ private:
int m_maxTextureSize;
int m_alphaBits;
Boolean<false> m_ok;
Boolean<true> m_useDrawArrays;
Boolean<true> m_useFBO;
Boolean<false> m_useHardwareBuffers;
Boolean<true> m_useBilinearFiltering;
Boolean<true> m_useNonPowerOfTwoTextures;
Boolean<true> m_useMipmaps;
Boolean<true> m_useHardwareMipmaps;
Boolean<true> m_useClampToEdge;
Boolean<true> m_cacheBackbuffer;
bool m_ok = false;
bool m_useDrawArrays = true;
bool m_useFBO = true;
bool m_useHardwareBuffers = false;
bool m_useBilinearFiltering = true;
bool m_useNonPowerOfTwoTextures = true;
bool m_useMipmaps = true;
bool m_useHardwareMipmaps = true;
bool m_useClampToEdge = true;
bool m_cacheBackbuffer = true;
PainterEngine m_prefferedPainterEngine;
PainterEngine m_selectedPainterEngine;
};

@ -72,7 +72,7 @@ private:
void updateGlTextureState();
GLenum m_matrixMode;
Boolean<false> m_textureEnabled;
bool m_textureEnabled = false;
};
extern PainterOGL1 *g_painterOGL1;

@ -63,10 +63,10 @@ protected:
Size m_size;
Size m_glSize;
Matrix3 m_transformMatrix;
Boolean<false> m_hasMipmaps;
Boolean<false> m_smooth;
Boolean<false> m_upsideDown;
Boolean<false> m_repeat;
bool m_hasMipmaps = false;
bool m_smooth = false;
bool m_upsideDown = false;
bool m_repeat = false;
};
#endif

@ -99,7 +99,7 @@ protected:
void fireKeysPress();
std::map<int, Fw::Key> m_keyMap;
std::map<Fw::Key, Boolean<false>> m_keysState;
std::map<Fw::Key, stdext::boolean<false>> m_keysState;
std::map<Fw::Key, ticks_t> m_firstKeysPress;
std::map<Fw::Key, ticks_t> m_lastKeysPress;
Timer m_keyPressTimer;
@ -109,13 +109,13 @@ protected:
Size m_unmaximizedSize;
Point m_unmaximizedPos;
InputEvent m_inputEvent;
Boolean<false> m_mouseButtonStates[4];
stdext::boolean<false> m_mouseButtonStates[4];
Boolean<false> m_created;
Boolean<false> m_visible;
Boolean<false> m_focused;
Boolean<false> m_fullscreen;
Boolean<false> m_maximized;
bool m_created = false;
bool m_visible = false;
bool m_focused = false;
bool m_fullscreen = false;
bool m_maximized = false;
std::function<void()> m_onClose;
OnResizeCallback m_onResize;

@ -61,8 +61,8 @@ private:
SoundSourcePtr m_musicSource;
ALCdevice *m_device;
ALCcontext *m_context;
Boolean<false> m_musicEnabled;
Boolean<false> m_soundEnabled;
bool m_musicEnabled = false;
bool m_soundEnabled = false;
std::string m_currentMusic;
};

@ -56,7 +56,7 @@ private:
SoundFilePtr m_soundFile;
std::array<SoundBufferPtr,STREAM_FRAGMENTS> m_buffers;
DownMix m_downMix;
Boolean<false> m_looping;
bool m_looping = false;
};
#endif

@ -20,21 +20,21 @@
* THE SOFTWARE.
*/
#ifndef ATTRIBSTORAGE_H
#define ATTRIBSTORAGE_H
#ifndef STDEXT_ATTRIBSTORAGE_H
#define STDEXT_ATTRIBSTORAGE_H
#include "../stdext/types.h"
#include "types.h"
#include <tuple>
#include <boost/any.hpp>
#pragma pack(push,1) // disable memory alignment
// disable memory alignment
#pragma pack(push,1)
// this class was designed to use less memory as possible
class AttribStorage {
namespace stdext {
class attrib_storage {
public:
AttribStorage() : m_attribs(nullptr), m_size(0) { }
~AttribStorage() { if(m_attribs) delete[] m_attribs; }
~attrib_storage() { if(m_attribs) delete[] m_attribs; }
template<typename T>
void set(uint8 id, T value) {
@ -72,10 +72,15 @@ public:
return true;
return false;
}
private:
std::tuple<uint8, boost::any>* m_attribs;
uint8 m_size;
std::tuple<uint8, boost::any>* m_attribs = nullptr;
uint8 m_size = 0;
};
// restore memory alignment
#pragma pack(pop)
}
#endif

@ -23,10 +23,11 @@
#ifndef BOOLEAN_H
#define BOOLEAN_H
/// Boolean with default value
namespace stdext {
template<bool def>
struct Boolean {
Boolean() : v(def) { }
struct boolean {
boolean() : v(def) { }
operator bool &() { return v; }
operator bool const &() const { return v; }
bool& operator=(const bool& o) { v = o; return v; }
@ -34,4 +35,6 @@ private:
bool v;
};
}
#endif

@ -27,8 +27,8 @@
// clang is supported
#undef _GLIBCXX_USE_FLOAT128
#elif defined(__GNUC__)
#if !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#error "Sorry, you need gcc 4.6 or greater to compile."
#if !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
#error "Sorry, you need gcc 4.7 or greater to compile."
#endif
#else
#error "Compiler not supported."

@ -0,0 +1,80 @@
/*
* Copyright (c) 2010-2012 OTClient <https://github.com/edubart/otclient>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef STDEXT_SHARED_OBJECT_H
#define STDEXT_SHARED_OBJECT_H
#include <boost/checked_delete.hpp>
#include <boost/intrusive_ptr.hpp>
namespace stdext {
template<typename T>
using shared_object_ptr = boost::intrusive_ptr<T>;
class shared_object
{
public:
shared_object() : m_refs(0) { }
virtual ~shared_object() { }
void add_ref() { ++m_refs; assert(m_refs != 0xffffffff); }
void dec_ref() {
if(--m_refs == 0)
boost::checked_delete(this);
}
bool is_unique_ref() { return m_refs == 1; }
unsigned long ref_count() { return m_refs; }
template<typename T>
shared_object_ptr<T> self_cast() { return shared_object_ptr<T>(static_cast<T*>(this)); }
template<typename T>
shared_object_ptr<T> dynamic_self_cast() { return shared_object_ptr<T>(dynamic_cast<T*>(this)); }
private:
unsigned int m_refs;
};
template<class T, typename... Args>
shared_object_ptr<T> make_shared_object(Args... args) { return shared_object_ptr<T>(new T(args...)); }
}
namespace std {
template<typename T>
struct hash<boost::intrusive_ptr<T>> : public __hash_base<size_t, boost::intrusive_ptr<T>> {
size_t operator()(const boost::intrusive_ptr<T>& p) const noexcept { return std::hash<T*>()(p.get()); }
};
}
template<typename T>
struct remove_const_ref {
typedef typename std::remove_const<typename std::remove_reference<T>::type>::type type;
};
template<typename T>
void intrusive_ptr_add_ref(T* p) { (static_cast<stdext::shared_object*>(p))->add_ref(); }
template<typename T>
void intrusive_ptr_release(T* p) { (static_cast<stdext::shared_object*>(p))->dec_ref(); }
#endif

@ -33,5 +33,7 @@
#include "dumper.h"
#include "time.h"
#include "shared_object.h"
#include "attrib_storage.h"
#include "boolean.h"
#endif

@ -35,6 +35,17 @@ inline ticks_t micros() { return std::chrono::duration_cast<std::chrono::microse
inline void millisleep(uint32 ms) { usleep(ms * 1000); };
inline void microsleep(uint32 us) { usleep(us); };
struct timer {
public:
timer() { restart(); }
float elapsed_seconds() { return (stdext::micros() - m_start)/1000000.0; }
ticks_t elapsed_millis() { return (stdext::micros() - m_start)/1000; }
ticks_t elapsed_micros() { return stdext::micros() - m_start; }
void restart() { m_start = stdext::micros(); }
private:
ticks_t m_start;
};
}
#endif

@ -39,6 +39,19 @@ typedef int32_t int32;
typedef int16_t int16;
typedef int8_t int8;
typedef unsigned char fast_uchar;
typedef unsigned long fast_ushort;
typedef unsigned long fast_uint;
typedef unsigned long fast_ulong;
typedef uint_fast64_t fast_uint64;
typedef uint_fast32_t fast_uint32;
typedef uint_fast16_t fast_uint16;
typedef uint_fast8_t fast_uint8;
typedef int_fast64_t fast_int64;
typedef int_fast32_t fast_int32;
typedef int_fast16_t fast_int16;
typedef int_fast8_t fast_int8;
typedef int64_t ticks_t;
#endif

@ -41,7 +41,7 @@ public:
bool isUIBoxLayout() { return true; }
protected:
Boolean<false> m_fitChildren;
bool m_fitChildren = false;
int m_spacing;
};

@ -55,9 +55,9 @@ private:
int m_cellSpacing;
int m_numColumns;
int m_numLines;
Boolean<false> m_autoSpacing;
Boolean<false> m_fitChildren;
Boolean<false> m_flow;
bool m_autoSpacing = false;
bool m_fitChildren = false;
bool m_flow = false;
};
#endif

@ -39,7 +39,7 @@ public:
protected:
bool internalUpdate();
Boolean<false> m_alignRight;
bool m_alignRight = false;
};
#endif

@ -58,8 +58,8 @@ protected:
virtual bool internalUpdate() = 0;
int m_updateDisabled;
Boolean<false> m_updating;
Boolean<false> m_updateScheduled;
bool m_updating = false;
bool m_updateScheduled = false;
UIWidgetPtr m_parentWidget;
};

@ -82,8 +82,8 @@ private:
UIWidgetPtr m_draggingWidget;
UIWidgetPtr m_hoveredWidget;
UIWidgetPtr m_pressedWidget;
Boolean<false> m_hoverUpdateScheduled;
Boolean<false> m_drawDebugBoxes;
bool m_hoverUpdateScheduled = false;
bool m_drawDebugBoxes = false;
std::unordered_map<std::string, OTMLNodePtr> m_styles;
UIWidgetList m_destroyedWidgets;
ScheduledEventPtr m_checkEvent;

@ -40,7 +40,7 @@ public:
protected:
bool internalUpdate();
Boolean<false> m_alignBottom;
stdext::boolean<false> m_alignBottom;
};
#endif

@ -61,14 +61,14 @@ protected:
std::string m_id;
Rect m_rect;
Point m_virtualOffset;
Boolean<true> m_enabled;
Boolean<true> m_visible;
Boolean<true> m_focusable;
Boolean<false> m_fixedSize;
Boolean<false> m_phantom;
Boolean<false> m_dragable;
Boolean<false> m_destroyed;
Boolean<false> m_clipping;
stdext::boolean<true> m_enabled;
stdext::boolean<true> m_visible;
stdext::boolean<true> m_focusable;
stdext::boolean<false> m_fixedSize;
stdext::boolean<false> m_phantom;
stdext::boolean<false> m_dragable;
stdext::boolean<false> m_destroyed;
stdext::boolean<false> m_clipping;
UILayoutPtr m_layout;
UIWidgetPtr m_parent;
UIWidgetList m_children;
@ -155,8 +155,8 @@ public:
UIWidgetPtr backwardsGetWidgetById(const std::string& id);
private:
Boolean<false> m_updateEventScheduled;
Boolean<false> m_loadingStyle;
stdext::boolean<false> m_updateEventScheduled;
stdext::boolean<false> m_loadingStyle;
// state managment
@ -171,8 +171,8 @@ private:
void updateChildrenIndexStates();
void updateStyle();
Boolean<false> m_updateStyleScheduled;
Boolean<true> m_firstOnStyle;
stdext::boolean<false> m_updateStyleScheduled;
stdext::boolean<true> m_firstOnStyle;
OTMLNodePtr m_stateStyle;
int m_states;
@ -394,8 +394,8 @@ private:
CoordsBuffer m_imageCoordsBuffer;
Rect m_imageCachedScreenCoords;
Boolean<true> m_imageMustRecache;
Boolean<false> m_imageBordered;
stdext::boolean<true> m_imageMustRecache;
stdext::boolean<false> m_imageBordered;
protected:
void drawImage(const Rect& screenCoords);
@ -404,9 +404,9 @@ protected:
Rect m_imageClipRect;
Rect m_imageRect;
Color m_imageColor;
Boolean<false> m_imageFixedRatio;
Boolean<false> m_imageRepeated;
Boolean<false> m_imageSmooth;
stdext::boolean<false> m_imageFixedRatio;
stdext::boolean<false> m_imageRepeated;
stdext::boolean<false> m_imageSmooth;
EdgeGroup<int> m_imageBorder;
public:
@ -451,7 +451,7 @@ private:
void updateText();
void parseTextStyle(const OTMLNodePtr& styleNode);
Boolean<true> m_textMustRecache;
stdext::boolean<true> m_textMustRecache;
CoordsBuffer m_textCoordsBuffer;
Rect m_textCachedScreenCoords;
@ -465,8 +465,8 @@ protected:
std::string m_drawText;
Fw::AlignmentFlag m_textAlign;
Point m_textOffset;
Boolean<false> m_textWrap;
Boolean<false> m_textAutoResize;
stdext::boolean<false> m_textWrap;
stdext::boolean<false> m_textAutoResize;
BitmapFontPtr m_font;
public:

@ -121,14 +121,14 @@ protected:
TexturePtr m_skullTexture;
TexturePtr m_shieldTexture;
TexturePtr m_emblemTexture;
Boolean<true> m_showShieldTexture;
Boolean<false> m_shieldBlink;
Boolean<false> m_passable;
stdext::boolean<true> m_showShieldTexture;
stdext::boolean<false> m_shieldBlink;
stdext::boolean<false> m_passable;
Color m_timedSquareColor;
Color m_staticSquareColor;
Boolean<false> m_showTimedSquare;
Boolean<false> m_showStaticSquare;
Boolean<false> m_removed;
stdext::boolean<false> m_showTimedSquare;
stdext::boolean<false> m_showStaticSquare;
stdext::boolean<false> m_removed;
CachedText m_nameCache;
Color m_informationColor;
@ -140,8 +140,8 @@ protected:
TilePtr m_walkingTile;
int m_walkInterval;
int m_walkAnimationInterval;
Boolean<false> m_walking;
Boolean<false> m_footStepDrawn;
stdext::boolean<false> m_walking;
stdext::boolean<false> m_footStepDrawn;
ScheduledEventPtr m_walkUpdateEvent;
Point m_walkOffset;
Otc::Direction m_walkTurnDirection;

@ -25,7 +25,6 @@
#include "declarations.h"
#include <framework/luaengine/luaobject.h>
#include <framework/util/attribstorage.h>
#include "outfit.h"
enum CreatureAttr : uint8
@ -51,7 +50,7 @@ public:
int getSpawnTime() { return m_attribs.get<int>(CreatureAttrSpawnTime); }
private:
AttribStorage m_attribs;
stdext::attrib_storage m_attribs;
};
class Creatures
@ -72,7 +71,7 @@ protected:
private:
std::vector<CreatureTypePtr> m_creatures;
Boolean<false> m_loaded;
stdext::boolean<false> m_loaded;
};
#endif

@ -27,7 +27,6 @@
#include "tile.h"
#include <framework/luaengine/luaobject.h>
#include <framework/util/attribstorage.h>
enum HouseAttr : uint8
{
@ -64,9 +63,9 @@ protected:
void save(TiXmlElement &elem) { } // TODO
private:
AttribStorage m_attribs;
stdext::attrib_storage m_attribs;
TileMap m_tiles;
Boolean<false> m_isGuildHall;
stdext::boolean<false> m_isGuildHall;
friend class Houses;
};

@ -24,7 +24,6 @@
#define ITEM_H
#include <framework/global.h>
#include <framework/util/attribstorage.h>
#include "thing.h"
#include "itemtype.h"
@ -125,7 +124,7 @@ private:
uint16 m_id;
uint16 m_otbId;
uint8 m_countOrSubType;
AttribStorage m_attribs;
stdext::attrib_storage m_attribs;
};
#pragma pack(pop)

@ -27,7 +27,6 @@
#include <framework/core/declarations.h>
#include <framework/luaengine/luaobject.h>
#include <framework/xml/tinyxml.h>
#include <framework/util/attribstorage.h>
enum ItemCategory {
ItemCategoryInvalid = 0,
@ -102,9 +101,9 @@ public:
private:
ItemCategory m_category;
Boolean<true> m_null;
stdext::boolean<true> m_null;
AttribStorage m_attribs;
stdext::attrib_storage m_attribs;
};
#endif

@ -430,6 +430,7 @@ bool Map::loadOtcm(const std::string& fileName)
if(!fin)
stdext::throw_exception("unable to open file");
stdext::timer loadTimer;
fin->cache();
uint32 signature = fin->getU32();
@ -491,6 +492,7 @@ bool Map::loadOtcm(const std::string& fileName)
fin->close();
g_logger.debug(stdext::format("Otcm load time: %.2f seconds", loadTimer.elapsed_seconds()));
return true;
} catch(stdext::exception& e) {
g_logger.error(stdext::format("failed to load OTCM map: %s", e.what()));

@ -31,7 +31,6 @@
#include "statictext.h"
#include <framework/core/clock.h>
#include <framework/util/attribstorage.h>
enum OTBM_ItemAttr
{
@ -268,7 +267,7 @@ private:
Position m_centralPosition;
Rect m_tilesRect;
AttribStorage m_attribs;
stdext::attrib_storage m_attribs;
Houses m_houses;
Towns m_towns;
Creatures m_creatures;

@ -35,6 +35,18 @@
#include <framework/core/eventdispatcher.h>
#include <framework/core/application.h>
enum {
// 3840x2160 => 1080p optimized
// 2560x1440 => 720p optimized
// 1728x972 => 480p optimized
NEAR_VIEW_AREA = 32*32,
MID_VIEW_AREA = 64*64,
FAR_VIEW_AREA = 128*128,
MAX_TILE_DRAWS = NEAR_VIEW_AREA*7
};
MapView::MapView()
{
m_viewMode = NEAR_VIEW;

@ -32,17 +32,6 @@
// @bindclass
class MapView : public LuaObject
{
enum {
// 3840x2160 => 1080p optimized
// 2560x1440 => 720p optimized
// 1728x972 => 480p optimized
NEAR_VIEW_AREA = 32*32,
MID_VIEW_AREA = 64*64,
FAR_VIEW_AREA = 128*128,
MAX_TILE_DRAWS = NEAR_VIEW_AREA*7
};
public:
enum ViewMode {
NEAR_VIEW,
@ -135,16 +124,16 @@ private:
Point m_virtualCenterOffset;
Point m_visibleCenterOffset;
Position m_customCameraPosition;
Boolean<true> m_mustUpdateVisibleTilesCache;
Boolean<true> m_mustDrawVisibleTilesCache;
Boolean<true> m_mustCleanFramebuffer;
Boolean<true> m_multifloor;
Boolean<true> m_animated;
Boolean<true> m_autoViewMode;
Boolean<true> m_drawTexts;
Boolean<true> m_smooth;
Boolean<false> m_drawMinimapColors;
Boolean<true> m_follow;
stdext::boolean<true> m_mustUpdateVisibleTilesCache;
stdext::boolean<true> m_mustDrawVisibleTilesCache;
stdext::boolean<true> m_mustCleanFramebuffer;
stdext::boolean<true> m_multifloor;
stdext::boolean<true> m_animated;
stdext::boolean<true> m_autoViewMode;
stdext::boolean<true> m_drawTexts;
stdext::boolean<true> m_smooth;
stdext::boolean<false> m_drawMinimapColors;
stdext::boolean<true> m_follow;
std::vector<TilePtr> m_cachedVisibleTiles;
std::vector<CreaturePtr> m_cachedFloorVisibleCreatures;
CreaturePtr m_followingCreature;

@ -36,7 +36,7 @@ struct MinimapArea
ImagePtr img;
TexturePtr tex;
uint8 colors[MINIMAP_AREA_SIZE][MINIMAP_AREA_SIZE];
Boolean<true> mustUpdate;
stdext::boolean<true> mustUpdate;
};
class Minimap

@ -214,8 +214,8 @@ public:
Position getPosition(const InputMessagePtr& msg);
private:
Boolean<false> m_enableSendExtendedOpcode;
Boolean<false> m_gameInitialized;
stdext::boolean<false> m_enableSendExtendedOpcode;
stdext::boolean<false> m_gameInitialized;
std::string m_accountName;
std::string m_accountPassword;
std::string m_characterName;

@ -44,7 +44,7 @@ public:
bool isLoaded() { return m_loaded; }
private:
Boolean<false> m_loaded;
stdext::boolean<false> m_loaded;
uint32 m_signature;
int m_spritesCount;
int m_spritesOffset;

@ -51,7 +51,7 @@ private:
void scheduleUpdate();
void compose();
Boolean<false> m_yell;
stdext::boolean<false> m_yell;
std::deque<std::pair<std::string, ticks_t>> m_messages;
std::string m_name;
Otc::MessageMode m_mode;

@ -57,7 +57,7 @@ public:
private:
uint32 m_signature;
Boolean<false> m_loaded;
stdext::boolean<false> m_loaded;
ThingTypeList m_things[LastCategory];
static ThingType m_emptyThingType;
};

@ -29,7 +29,6 @@
#include <framework/graphics/coordsbuffer.h>
#include <framework/luaengine/luaobject.h>
#include <framework/net/server.h>
#include <framework/util/attribstorage.h>
enum ThingCategory : uint8 {
ThingCategoryItem = 0,
@ -180,7 +179,7 @@ private:
ThingCategory m_category;
uint16 m_id;
bool m_null;
AttribStorage m_attribs;
stdext::attrib_storage m_attribs;
Size m_size;
Point m_displacement;

@ -42,7 +42,7 @@ protected:
void onStyleApply(const std::string& styleName, const OTMLNodePtr& styleNode);
CreaturePtr m_creature;
Boolean<false> m_fixedCreatureSize;
stdext::boolean<false> m_fixedCreatureSize;
};
#endif

@ -50,7 +50,7 @@ protected:
void onStyleApply(const std::string& styleName, const OTMLNodePtr& styleNode);
ItemPtr m_item;
Boolean<false> m_virtual;
stdext::boolean<false> m_virtual;
};
#endif

Loading…
Cancel
Save