diff options
author | Lars Persson | 2005-07-09 23:07:46 +0000 |
---|---|---|
committer | Lars Persson | 2005-07-09 23:07:46 +0000 |
commit | b3aac821fd57389eff367ea8f7e55ed5a03a2531 (patch) | |
tree | 60b7d02ffc024100047a65ae0732529ff015451e /saga | |
parent | 02d28a96ceb5c8c60aea82166b1ad92f83d660d2 (diff) | |
download | scummvm-rg350-b3aac821fd57389eff367ea8f7e55ed5a03a2531.tar.gz scummvm-rg350-b3aac821fd57389eff367ea8f7e55ed5a03a2531.tar.bz2 scummvm-rg350-b3aac821fd57389eff367ea8f7e55ed5a03a2531.zip |
1. Fixed divide by zero defect (exception on my symbian target, Windows just return max val)
2. Fixed so Saga compiles for VC6.
3. Added GCC_PACK & pragma pack to gfx.h
svn-id: r18527
Diffstat (limited to 'saga')
-rw-r--r-- | saga/actor.cpp | 4 | ||||
-rw-r--r-- | saga/events.cpp | 11 | ||||
-rw-r--r-- | saga/gfx.h | 9 | ||||
-rw-r--r-- | saga/ite_introproc.cpp | 4 | ||||
-rw-r--r-- | saga/list.h | 19 |
5 files changed, 29 insertions, 18 deletions
diff --git a/saga/actor.cpp b/saga/actor.cpp index e7ddb291b1..d8394c505d 100644 --- a/saga/actor.cpp +++ b/saga/actor.cpp @@ -279,8 +279,8 @@ Actor::Actor(SagaEngine *vm) : _vm(vm) { } } else { - // TODO. - static ActorData dummyActor; + // TODO. This is causing problems for SYMBIAN os as it does n't like a static class here + ActorData dummyActor; dummyActor.frames = NULL; dummyActor.walkStepsPoints = NULL; diff --git a/saga/events.cpp b/saga/events.cpp index 0ac071bb5d..5bc603751d 100644 --- a/saga/events.cpp +++ b/saga/events.cpp @@ -127,8 +127,11 @@ int Events::handleContinuous(EVENT *event) { Surface *backGroundSurface; BGInfo bgInfo; Rect rect; - + if(event->duration != 0) { event_pc = ((double)event->duration - event->time) / event->duration; + } else { + event_pc = 1.0; + } if (event_pc >= 1.0) { // Cap percentage to 100 @@ -205,7 +208,13 @@ int Events::handleImmediate(EVENT *event) { double event_pc = 0.0; // Event completion percentage bool event_done = false; + // Duration might be 0 so dont do division then + if(event->duration != 0) { event_pc = ((double)event->duration - event->time) / event->duration; + } else { + // Just make sure that event_pc is 1.0 so event_done is true + event_pc = 1.0; + } if (event_pc >= 1.0) { // Cap percentage to 100 diff --git a/saga/gfx.h b/saga/gfx.h index 8e6a94c1c1..3be73e8471 100644 --- a/saga/gfx.h +++ b/saga/gfx.h @@ -32,6 +32,7 @@ namespace Saga { using Common::Point; using Common::Rect; +#pragma START_PACK_STRUCTS struct ClipData { // input members @@ -70,20 +71,20 @@ struct ClipData { return true; } -}; +}GCC_PACK; struct PalEntry { byte red; byte green; byte blue; -}; +}GCC_PACK; struct Color { int red; int green; int blue; int alpha; -}; +}GCC_PACK; struct Surface : Graphics::Surface { @@ -110,7 +111,7 @@ struct Surface : Graphics::Surface { } } }; - +#pragma END_PACK_STRUCTS #define PAL_ENTRIES 256 diff --git a/saga/ite_introproc.cpp b/saga/ite_introproc.cpp index 322a88e4a5..7f3b0cd3ba 100644 --- a/saga/ite_introproc.cpp +++ b/saga/ite_introproc.cpp @@ -292,8 +292,7 @@ int Scene::ITEIntroAnimProc(int param) { EVENT *q_event; switch (param) { - case SCENE_BEGIN: - + case SCENE_BEGIN:{ // Background for intro scene is the first frame of the // intro animation; display it and set the palette event.type = ONESHOT_EVENT; @@ -352,6 +351,7 @@ int Scene::ITEIntroAnimProc(int param) { event.time = 0; q_event = _vm->_events->chain(q_event, &event); + } break; case SCENE_END: break; diff --git a/saga/list.h b/saga/list.h index 17106bdfcd..03cc7e5cd4 100644 --- a/saga/list.h +++ b/saga/list.h @@ -33,7 +33,8 @@ public: typedef typename Common::List<T>::iterator iterator; typedef typename Common::List<T>::const_iterator const_iterator; - + typedef typename Common::List<T> Common_List; + public: iterator pushFront(const T& element) { @@ -41,20 +42,20 @@ public: } iterator pushBack(const T& element) { - return insert(Common::List<T>::end(), element); + return insert(Common_List::end(), element); } iterator insert(iterator pos, const T& element) { - Common::List<T>::insert(pos, element); + Common_List::insert(pos, element); return --pos; } iterator pushFront() { - return insert(Common::List<T>::begin()); + return insert(Common_List::begin()); } iterator pushBack() { - return insert(Common::List<T>::end()); + return insert(Common_List::end()); } iterator insert(iterator pos) { @@ -67,13 +68,13 @@ public: } iterator pushBack(const T& element, CompareFunction compareFunction) { - return insert(Common::List<T>::end(), element, compareFunction); + return insert(Common_List::end(), element, compareFunction); } iterator insert(iterator pos, const T& element, CompareFunction compareFunction) { int res; - for (iterator i = Common::List<T>::begin(); i != Common::List<T>::end(); ++i) { + for (iterator i = Common_List::begin(); i != Common_List::end(); ++i) { res = compareFunction(element, i.operator*()); if (res < 0) { return insert(i, element); @@ -120,7 +121,7 @@ public: } iterator eraseAndPrev(iterator pos) { - assert(pos != Common::List<T>::end()); + assert(pos != Common_List::end()); iterator res(pos); --res; @@ -129,7 +130,7 @@ public: } void remove(const T* val) { - for (iterator i = Common::List<T>::begin(); i != Common::List<T>::end(); ++i) + for (iterator i = Common_List::begin(); i != Common_List::end(); ++i) if (val == i.operator->()) { erase(i); return; |