forked from adoptware/pinball
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Compiled on allegro (some texture are missing, fix it yourself)
config load/save : some fix on W32 bug fixed
- Loading branch information
rzr
committed
Jul 16, 2003
1 parent
f7c0055
commit c7a37f5
Showing
20 changed files
with
541 additions
and
497 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
//#ident "$Id: ColorBehavior.cpp,v 1.4 2003/07/16 20:02:02 rzr Exp $" | ||
/*************************************************************************** | ||
ColorBehavior.cpp - description | ||
------------------- | ||
begin : Tue Feb 15 2000 | ||
copyright : (C) 2000 by Henrik Enqvist | ||
email : [email protected] | ||
***************************************************************************/ | ||
***************************************************************************/ | ||
|
||
#include "Private.h" | ||
#include "ColorBehavior.h" | ||
|
@@ -18,19 +19,18 @@ ColorBehavior::~ColorBehavior() { | |
} | ||
|
||
void ColorBehavior::onCollision(const Vertex3D &, const Vertex3D &, Group *) { | ||
EmAssert(this->getParent() != NULL, "ColorBehavior::onCollision parent NULL"); | ||
EM_COUT("ColorBehavior::onCollision()" << endl, 0); | ||
if (this->getParent() != NULL) { | ||
for (int a=0; a<this->getParent()->getShape3DSize(); a++) { | ||
this->getParent()->getShape3D(a)->setColor(1.0, 1.0, 0.0, 0.0); | ||
} | ||
} | ||
EmAssert(this->getParent() != NULL, "ColorBehavior::onCollision parent NULL"); | ||
EM_COUT("ColorBehavior::onCollision()" << endl, 0); | ||
if (this->getParent() != NULL) { | ||
for (int a=0; a<this->getParent()->getShape3DSize(); a++) { | ||
this->getParent()->getShape3D(a)->setColor(1.f, 1.f, 0.f, 0.f); | ||
} | ||
} | ||
} | ||
|
||
void ColorBehavior::onTick() { | ||
EmAssert(this->getParent() != NULL, "ColorBehavior::onTick parent NULL"); | ||
for (int a=0; a<this->getParent()->getShape3DSize(); a++) { | ||
this->getParent()->getShape3D(a)->setColor(1.0, 0.0, 0.0, 1.0); | ||
} | ||
EmAssert(this->getParent() != NULL, "ColorBehavior::onTick parent NULL"); | ||
for (int a=0; a<this->getParent()->getShape3DSize(); a++) { | ||
this->getParent()->getShape3D(a)->setColor(1.f, 0.f, 0.f, 1.f); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
//#ident "$Id: Group.h,v 1.10 2003/07/16 20:02:04 rzr Exp $" | ||
/*************************************************************************** | ||
Group.h - description | ||
------------------- | ||
begin : Wed Jan 26 2000 | ||
copyright : (C) 2000 by Henrik Enqvist | ||
email : [email protected] | ||
***************************************************************************/ | ||
***************************************************************************/ | ||
|
||
#ifndef GROUP_H | ||
#define GROUP_H | ||
|
@@ -68,7 +69,7 @@ class BillBoard; | |
** Animation -- lwGroup rwGroup -- Animation | ||
** </pre> */ | ||
class Group : public Node { | ||
public: | ||
public: | ||
Group(); | ||
virtual ~Group(); | ||
void setName(const char * name); | ||
|
@@ -78,9 +79,9 @@ class Group : public Node { | |
/** Removes the group from the tree. You must call 'delete group' after | ||
* this function if you wish to deallocate the group. */ | ||
void removeGroup(Group * g); | ||
// void addBehavior(Behavior * b, bool signal=true); | ||
// void addBehavior(Behavior * b, bool signal=true); | ||
void setBehavior(Behavior * b, bool signal = true); | ||
// void removeBehavior(Behavior * b); | ||
// void removeBehavior(Behavior * b); | ||
void addShape3D(Shape3D * s); | ||
/** Removes the shape from the tree. You must call 'delete shape' after | ||
* this function if you wish to deallocate the shape. */ | ||
|
@@ -90,9 +91,9 @@ class Group : public Node { | |
void setLight(Light * l); | ||
void setCollisionBounds(CollisionBounds * cb); | ||
void setSound(Sound * s); | ||
// int getBehaviorSize(); | ||
int getShape3DSize(); | ||
// Behavior * getBehavior(int i); | ||
// int getBehaviorSize(); | ||
int getShape3DSize() const; | ||
// Behavior * getBehavior(int i); | ||
Behavior * getBehavior(); | ||
Group * getGroup(int i); | ||
Shape3D * getShape3D(int i); | ||
|
@@ -115,10 +116,10 @@ class Group : public Node { | |
void unsetPropertyRecursive(int p); | ||
void unsetUserProperty(int p); | ||
|
||
inline int getCollisionGroup() { return m_iCollisionGroup; }; | ||
inline void setCollisionGroup(int c) { m_iCollisionGroup = c; }; | ||
inline int getCollisionGroup() { return m_iCollisionGroup; }; | ||
inline void setCollisionGroup(int c) { m_iCollisionGroup = c; }; | ||
|
||
private: | ||
private: | ||
friend class BehaviorVisitor; | ||
friend class AlignVisitor; | ||
friend class AllegroVisitor; | ||
|
@@ -144,16 +145,16 @@ class Group : public Node { | |
Group* p_Parent; | ||
vector<Group*> m_vChildren; | ||
vector<Shape3D*> m_vShape3D; | ||
// vector<Behavior*> m_vBehavior; | ||
// vector<Behavior*> m_vBehavior; | ||
Behavior * p_Behavior; | ||
|
||
char m_Name[256]; | ||
char m_Name[256]; //todo: replace with string | ||
|
||
int m_iProperties; | ||
int m_iUserProperties; | ||
int m_iCollisionGroup; | ||
int m_iCollisionGroup; | ||
|
||
// void propagateSignal(int signal, Group* sender); | ||
// void propagateSignal(int signal, Group* sender); | ||
void setParent(Group* g); | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
//#ident "$Id: Keyboard.h,v 1.9 2003/07/16 20:02:04 rzr Exp $" | ||
/*************************************************************************** | ||
Keyboard.h - description | ||
------------------- | ||
begin : Thu Feb 1 2001 | ||
copyright : (C) 2001 by Henrik Enqvist | ||
email : [email protected] | ||
***************************************************************************/ | ||
***************************************************************************/ | ||
|
||
|
||
#ifndef KEYBOARD_H | ||
|
@@ -101,14 +102,14 @@ | |
#define SDLK_RCTRL KEY_RCONTROL | ||
#define SDLK_COMPOSE KEY_ALTGR | ||
|
||
#define SDLK_F1 KEY_F1 | ||
#define SDLK_F1 KEY_F1 //!rzr+ bug fixed | ||
#define SDLK_F2 KEY_F2 | ||
#define SDLK_F3 KEY_F3 | ||
#define SDLK_F3 KEY_F4 | ||
#define SDLK_F1 KEY_F5 | ||
#define SDLK_F2 KEY_F6 | ||
#define SDLK_F3 KEY_F7 | ||
#define SDLK_F3 KEY_F8 | ||
#define SDLK_F4 KEY_F4 | ||
#define SDLK_F5 KEY_F5 | ||
#define SDLK_F6 KEY_F6 | ||
#define SDLK_F7 KEY_F7 | ||
#define SDLK_F8 KEY_F8 //!rzr- | ||
|
||
#endif // EM_USE_ALLEGRO | ||
|
||
|
@@ -119,15 +120,15 @@ | |
/** @author Henrik Enqvist */ | ||
|
||
class Keyboard { | ||
public: | ||
public: | ||
Keyboard(); | ||
~Keyboard(); | ||
static void clear(); | ||
static void poll(); | ||
static bool isKeyDown(int piKey); | ||
static EMKey waitForKey(); | ||
#if EM_USE_SDL | ||
private: | ||
private: | ||
static bool m_abKey[KEY_MAX]; | ||
#endif | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
//#ident "$Id: Shape3D.h,v 1.14 2003/05/27 11:53:25 rzr Exp $" | ||
//#ident "$Id: Shape3D.h,v 1.15 2003/07/16 20:02:04 rzr Exp $" | ||
/*************************************************************************** | ||
Shape3D.h - description | ||
------------------- | ||
begin : Wed Jan 26 2000 | ||
copyright : (C) 2000 by Henrik Enqvist | ||
email : [email protected] | ||
***************************************************************************/ | ||
***************************************************************************/ | ||
|
||
#ifndef SHAPE3D_H | ||
#define SHAPE3D_H | ||
|
@@ -20,11 +20,13 @@ | |
//#define EM_SHAPE3D_FLAT 16 | ||
//#define EM_SHAPE3D_DOUBLE 32 | ||
|
||
|
||
#include <vector> | ||
#include <string> | ||
|
||
#include "TextureUtil.h" | ||
#include "EMath.h" | ||
using namespace std; | ||
|
||
class Group; | ||
class Polygon3D; | ||
|
@@ -35,23 +37,28 @@ class Polygon3D; | |
* with the 'add(Polygon*)' method. The Shape3D is finished off by calling | ||
* countNormals(). | ||
* @see Polygon */ | ||
class Shape3D { | ||
public: | ||
class Shape3D | ||
{ | ||
public: | ||
Shape3D(int v = 6, int p = 2); | ||
virtual ~Shape3D(); | ||
/** Creates a new vertex and returns the index. The index is used when | ||
* creating polygons. @see Polygon */ | ||
int add(float x, float y, float z); | ||
int add(float x, float y, float z, float r, float g, float b, float a, float u, float v); | ||
int add(float x, float y, float z, float r, float g, float b, float a=1, | ||
float u=0, float v=0); | ||
int addAt(int index, float x, float y, float z, | ||
float r, float g, float b, float a, float u, float v); | ||
float r=1, float g=1, float b=1 , float a=1, | ||
float u=0, float v=0); | ||
/** Adds a polygon. @see Polygon */ | ||
void add(Polygon3D*); | ||
/** Counts the polygon normals used for lightning. This must be called when | ||
* all vertices and polygons are added to the shape. */ | ||
void countNormals(); | ||
/** Sets the color of all polygons to rgba. */ | ||
void setColor(float r, float g, float b, float a); | ||
void setColor(float r, float g, float b, float a=1.); | ||
void setColor(int index, float r, float g, float b, float a=1.); | ||
Color * getColor(int index); | ||
/** Applies a a property to all polygons. See Polygon class for | ||
* properties. @see Polygon */ | ||
void setPolygonProperty(int property); | ||
|
@@ -82,11 +89,10 @@ class Shape3D { | |
float getCollisionSize(); | ||
void setParent(Group*); | ||
Group * getParent() { return p_Parent; }; | ||
Color * getColor(int index); | ||
void setColor(int index, float r, float g, float b, float a); | ||
TexCoord * getTexCoord(int index); | ||
void setTexCoord(int index, float u, float v); | ||
|
||
|
||
public: | ||
vector<Polygon3D*> m_vPolygon; | ||
vector<Vertex3D> m_vVtxSrc; | ||
vector<Vertex3D> m_vVtxTrans; | ||
|
@@ -105,7 +111,8 @@ class Shape3D { | |
int m_iProperties; | ||
/// used for importing 3ds files //!rzr | ||
string m_sMaterialName; | ||
string m_sName; | ||
}; | ||
|
||
#endif // SHAPE3D_H | ||
//EOF $Id: Shape3D.h,v 1.14 2003/05/27 11:53:25 rzr Exp $ | ||
//EOF $Id: Shape3D.h,v 1.15 2003/07/16 20:02:04 rzr Exp $ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.