Kaynağa Gözat

Einiege Game Objekte können jetzt gezeichnet werden

Kolja Strohm 4 yıl önce
ebeveyn
işleme
88ac0de867

+ 1 - 1
StickmanWorldOnline/Aktionen.cpp

@@ -860,7 +860,7 @@ GeschossNeu::GeschossNeu( RCArray< Aktion > *subActions )
 
 void GeschossNeu::run( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
 {
-    Geschoss *g = new Geschoss( zSpiel->getNextId(), 0,
+    Geschoss *g = new Geschoss( zSpiel->zResources(), zSpiel->getNextId(), 0,
                                 getGeschossTypFromString( ( (String *)zParam( 2 ) )->getValue() ),
                                 getRichtungFromString( ( (String *)zParam( 3 ) )->getValue() ),
                                 ( (Integer *)zParam( 0 ) )->getValue(),

+ 32 - 1
StickmanWorldOnline/Bariere.cpp

@@ -3,7 +3,7 @@
 #include "Ereignis.h"
 
 
-Bariere::Bariere( int id, int x, int y, int breite, int height, int style, int verschiebungWeite, int autoSchaltungMaxTime, Team *team )
+Bariere::Bariere( ResourceRegistry *zResources, int id, int x, int y, int breite, int height, int style, int verschiebungWeite, int autoSchaltungMaxTime, Team *team )
     : GameObject( BARIERE, x, y, breite, height )
 {
     this->id = id;
@@ -15,12 +15,23 @@ Bariere::Bariere( int id, int x, int y, int breite, int height, int style, int v
     verschiebungAnzahl = 0;
     schaltungAnzahl = 0;
     this->team = team;
+    this->resources = zResources->getThis();
+    if( breite > height )
+        this->textur = resources->zResource( R_BARIERE, team ? team->getFarbe() : 0 )->getImages()->getThis();
+    else
+    {
+        Bild *r = resources->zResource( R_BARIERE, team ? team->getFarbe() : 0 )->getImages();
+        this->textur = new Bild();
+        this->textur->neuBild( r->getHeight(), r->getBreite(), 0 );
+        this->textur->drawBild90( 0, 0, r->getHeight(), r->getBreite(), *r );
+    }
 }
 
 Bariere::~Bariere()
 {
     if( team )
         team->release();
+    resources->release();
 }
 
 void Bariere::setStyle( int style, bool add, Spiel *zSpiel )
@@ -75,6 +86,17 @@ void Bariere::setTeam( Team *team )
     if( this->team )
         this->team->release();
     this->team = team;
+    if( this->textur )
+        this->textur->release();
+    if( w > h )
+        this->textur = resources->zResource( R_BARIERE, team ? team->getFarbe() : 0 )->getImages();
+    else
+    {
+        Bild *r = resources->zResource( R_BARIERE, team ? team->getFarbe() : 0 )->getImages();
+        this->textur = new Bild();
+        this->textur->neuBild( r->getHeight(), r->getBreite(), 0 );
+        this->textur->drawBild90( 0, 0, r->getHeight(), r->getBreite(), *r );
+    }
 }
 
 void Bariere::tick( double time, Spiel *zSpiel )
@@ -124,6 +146,15 @@ void Bariere::tick( double time, Spiel *zSpiel )
     }
 }
 
+void Bariere::render( Bild &rObj )
+{
+    if( !hatStyle( Style::Aktiv ) )
+        rObj.setAlpha( 0x77 );
+    GameObject::render( rObj );
+    if( !hatStyle( Style::Aktiv ) )
+        rObj.releaseAlpha();
+}
+
 bool Bariere::hatStyle( int style ) const
 {
     return ( this->style | style ) == this->style;

+ 4 - 1
StickmanWorldOnline/Bariere.h

@@ -3,6 +3,7 @@
 #include "GameObject.h"
 #include "Team.h"
 #include "Timer.h"
+#include "Resource.h"
 
 class Spiel;
 
@@ -30,9 +31,10 @@ private:
     int schaltungAnzahl;
     int id;
     Team *team;
+    ResourceRegistry *resources;
 
 public:
-    Bariere( int id, int x, int y, int breite, int height, int style, int verschiebungWeite = 0, int autoSchaltungMaxTime = 0, Team * team = 0 );
+    Bariere( ResourceRegistry *zResources, int id, int x, int y, int breite, int height, int style, int verschiebungWeite = 0, int autoSchaltungMaxTime = 0, Team * team = 0 );
     ~Bariere();
     void setStyle( int style, bool add, Spiel *zSpiel );
     void setAutoVerschiebungWeite( int pixel );
@@ -41,6 +43,7 @@ public:
     void startAutoSchaltung( Spiel *zSpiel );
     void setTeam( Team *team );
     void tick( double time, Spiel *zSpiel );
+    void render( Bild &rObj ) override;
     bool hatStyle( int style ) const;
     int getVerschiebungAnzahl() const;
     int getSchaltungAnzahl() const;

+ 8 - 1
StickmanWorldOnline/Base.cpp

@@ -3,7 +3,7 @@
 #include "Ereignis.h"
 
 
-Base::Base( int id, int x, int y, int width, int height, int maxTime, Team *team )
+Base::Base( ResourceRegistry *zResources, int id, int x, int y, int width, int height, int maxTime, Team *team )
     : GameObject( BASE, x, y, width, height )
 {
     this->id = id;
@@ -12,6 +12,9 @@ Base::Base( int id, int x, int y, int width, int height, int maxTime, Team *team
     inChange = 0;
     nextTeam = 0;
     leftTime = (float)maxTime;
+    resources = zResources->getThis();
+    this->textur = resources->zResource( R_BASE, team ? team->getFarbe() : 0 )->getImages()->getThis();
+    texturScale = 1;
 }
 
 Base::~Base()
@@ -20,6 +23,7 @@ Base::~Base()
         team->release();
     if( nextTeam )
         nextTeam->release();
+    resources->release();
 }
 
 void Base::setTeam( Team *team, Spiel *zSpiel )
@@ -27,6 +31,9 @@ void Base::setTeam( Team *team, Spiel *zSpiel )
     if( this->team )
         this->team->release();
     this->team = team;
+    if( textur )
+        textur->release();
+    textur = resources->zResource( R_BASE, team ? team->getFarbe() : 0 )->getImages()->getThis();
     zSpiel->setLastTeamChangedBase( (Base *)getThis() );
 }
 

+ 3 - 1
StickmanWorldOnline/Base.h

@@ -2,6 +2,7 @@
 
 #include "GameObject.h"
 #include "Team.h"
+#include "Resource.h"
 
 class Spiel;
 
@@ -14,9 +15,10 @@ private:
     bool inChange;
     Team *nextTeam;
     float leftTime;
+    ResourceRegistry *resources;
 
 public:
-    Base( int id, int x, int y, int width, int height, int maxTime = 10, Team * team = 0 );
+    Base( ResourceRegistry *zResources, int id, int x, int y, int width, int height, int maxTime = 10, Team * team = 0 );
     ~Base();
     void setTeam( Team *team, Spiel *zSpiel );
     void startChange( Team *team );

+ 1 - 1
StickmanWorldOnline/Drop.cpp

@@ -67,7 +67,7 @@ void Drop::doDrop( Spiel *zSpiel )
         int x = (int)( zSpiel->getRand() * ( maxX - minX - 100 ) + minX + 50 );
         int y = (int)( zSpiel->getRand() * ( maxY - minY - 100 ) + minY + 50 );
         if( x >= minX + 50 && x < maxX - 50 && y >= minY + 50 && y < maxY - 50 )
-            zSpiel->addGegenstand( new Gegenstand( zSpiel->getNextId(), (GegenstandTyp)typ, x, y ) );
+            zSpiel->addGegenstand( new Gegenstand( zSpiel->zResources(), zSpiel->getNextId(), (GegenstandTyp)typ, x, y ) );
     }
     Ereignis *e = new Ereignis( DROP_AKTION );
     e->addParameter( "Betroffener Drop", getThis() );

+ 2 - 1
StickmanWorldOnline/GameObject.h

@@ -11,11 +11,12 @@ class GameObject : public Variable
 {
 protected:
     float x, y, w, h;
-    Bild *zTextur;
+    Bild *textur;
     bool texturScale;
 
 public:
     GameObject( VariableTyp typ, int x, int y, int width, int height );
+    virtual ~GameObject();
     void setX( float x );
     void setY( float y );
     void setWidth( float width );

+ 12 - 6
StickmanWorldOnline/GameObjekt.cpp

@@ -9,10 +9,16 @@ GameObject::GameObject( VariableTyp typ, int x, int y, int width, int height )
     this->y = (float)y;
     w = (float)width;
     h = (float)height;
-    zTextur = 0;
+    textur = 0;
     texturScale = 0;
 }
 
+GameObject::~GameObject()
+{
+    if( textur )
+        textur->release();
+}
+
 void GameObject::setX( float x )
 {
     this->x = x;
@@ -40,18 +46,18 @@ bool GameObject::intersectsWith( GameObject *zObj )
 
 void GameObject::render( Bild &rObj )
 {
-    if( zTextur )
+    if( textur )
     {
         if( rObj.setDrawOptions( (int)x, (int)y, (int)w, (int)h ) )
         {
             if( texturScale )
-                rObj.alphaBildSkall( (int)x, (int)y, (int)w, (int)h, *zTextur );
+                rObj.alphaBildSkall( (int)x, (int)y, (int)w, (int)h, *textur );
             else
             {
-                for( int xx = (int)x; xx < x + w; x += zTextur->getBreite() )
+                for( int xx = (int)x; xx < x + w; x += textur->getBreite() )
                 {
-                    for( int yy = (int)y; yy < y + h; y += zTextur->getHeight() )
-                        rObj.alphaBild( xx, yy, zTextur->getBreite(), zTextur->getHeight(), *zTextur );
+                    for( int yy = (int)y; yy < y + h; y += textur->getHeight() )
+                        rObj.alphaBild( xx, yy, textur->getBreite(), textur->getHeight(), *textur );
                 }
             }
             rObj.releaseDrawOptions();

+ 58 - 1
StickmanWorldOnline/Gegenstand.cpp

@@ -106,11 +106,68 @@ GegenstandTyp GegenstandTypVar::getValue() const
 }
 
 
-Gegenstand::Gegenstand( int id, GegenstandTyp typ, int x, int y, int w, int h )
+Gegenstand::Gegenstand( ResourceRegistry *zResources, int id, GegenstandTyp typ, int x, int y, int w, int h )
     : GameObject( GEGENSTAND, x, y, w, h )
 {
     this->id = id;
     this->typ = typ;
+    texturScale = 1;
+    switch( typ )
+    {
+    case PFEIL:
+        this->textur = zResources->zResource( R_PFEIL, 0 )->getImages()->getThis();
+        break;
+    case LEBEN:
+        this->textur = zResources->zResource( R_LEBEN, 0 )->getImages()->getThis();
+        break;
+    case SCHILD:
+        this->textur = zResources->zResource( R_SCHILD, 0 )->getImages()->getThis();
+        break;
+    case SCHUH:
+        this->textur = zResources->zResource( R_SCHUH, 0 )->getImages()->getThis();
+        break;
+    case GEIST:
+        this->textur = zResources->zResource( R_GEIST, 0 )->getImages()->getThis();
+        break;
+    case KUGEL:
+        this->textur = zResources->zResource( R_KUGEL, 0 )->getImages()->getThis();
+        break;
+    case ROLLE:
+        this->textur = zResources->zResource( R_ROLLE, 0 )->getImages()->getThis();
+        break;
+    case STURM:
+        this->textur = zResources->zResource( R_STURM, 0 )->getImages()->getThis();
+        break;
+    case DRACHENAUGE:
+        this->textur = zResources->zResource( R_DRACHENAUGE, 0 )->getImages()->getThis();
+        break;
+    case FEUERBALL:
+        this->textur = zResources->zResource( R_FEUERBALL, 0 )->getImages()->getThis();
+        break;
+    case ENTERHAKEN:
+        this->textur = zResources->zResource( R_ENTERHAKEN_ITEM, 0 )->getImages()->getThis();
+        break;
+    case MINE:
+        this->textur = zResources->zResource( R_MINE, 0 )->getImages()->getThis();
+        break;
+    case RWEISHEIT:
+        this->textur = zResources->zResource( R_RWEISHEIT, 0 )->getImages()->getThis();
+        break;
+    case RSTRENGTH:
+        this->textur = zResources->zResource( R_RSTRENGTH, 0 )->getImages()->getThis();
+        break;
+    case RBOSHEIT:
+        this->textur = zResources->zResource( R_RBOSHEIT, 0 )->getImages()->getThis();
+        break;
+    case RLEBEN:
+        this->textur = zResources->zResource( R_RLEBEN, 0 )->getImages()->getThis();
+        break;
+    case RTEMPO:
+        this->textur = zResources->zResource( R_RTEMPO, 0 )->getImages()->getThis();
+        break;
+    default:
+        break;
+    }
 }
 
 int Gegenstand::getId() const

+ 2 - 1
StickmanWorldOnline/Gegenstand.h

@@ -1,6 +1,7 @@
 #pragma once
 
 #include "GameObject.h"
+#include "Resource.h"
 
 enum GegenstandTyp
 {
@@ -51,7 +52,7 @@ private:
     int id;
 
 public:
-    Gegenstand( int id, GegenstandTyp typ, int x = 0, int y = 0, int w = 50, int h = 50 );
+    Gegenstand( ResourceRegistry *zResources, int id, GegenstandTyp typ, int x = 0, int y = 0, int w = 50, int h = 50 );
     int getId() const;
     GegenstandTyp getTyp() const;
 };

+ 66 - 21
StickmanWorldOnline/Geschoss.cpp

@@ -2,42 +2,27 @@
 #include "Spiel.h"
 
 
-Geschoss::Geschoss( int id, float speed, GeschossTyp typ, Richtung r, int x, int y, Spieler *besitzer )
+Geschoss::Geschoss( ResourceRegistry *zResources, int id, float speed, GeschossTyp typ, Richtung r, int x, int y, Spieler *besitzer )
     : GameObject( GESCHOSS, x, y, 15, 15 )
 {
-    if( typ == GESCHOSS_PFEIL )
-    {
-        if( r == OBEN || r == UNTEN )
-        {
-            setWidth( 7 );
-            setHeight( 30 );
-        }
-        else
-        {
-            setWidth( 30 );
-            setHeight( 7 );
-        }
-    }
-    else if( typ == FEUERBALL )
-    {
-        setWidth( 20 );
-        setHeight( 20 );
-    }
     this->speed = speed;
     this->richtung = richtung;
     this->besitzer = besitzer;
-    this->typ = typ;
+    resources = zResources->getThis();
     tunnelBenutzt = 0;
     umgelenkt = 0;
     geschosseGetroffen = 0;
     schalter = 0;
+    texturScale = 1;
     this->id = id;
+    setTyp( typ );
 }
 
 Geschoss::~Geschoss()
 {
     if( besitzer )
         besitzer->release();
+    resources->release();
 }
 
 void Geschoss::invertDirection()
@@ -82,9 +67,30 @@ void Geschoss::setBesitzer( Spieler *besitzer )
 
 void Geschoss::setTyp( GeschossTyp typ )
 {
+    if( textur )
+        textur->release();
     this->typ = typ;
     if( typ == GESCHOSS_PFEIL )
     {
+        if( richtung == RECHTS )
+            textur = resources->zResource( R_PFEIL_GESCHOSS, 0 )->getImages()->getThis();
+        else if( richtung == LINKS )
+        {
+            Bild *r = resources->zResource( R_PFEIL_GESCHOSS, 0 )->getImages();
+            this->textur = new Bild();
+            this->textur->neuBild( r->getBreite(), r->getHeight(), 0 );
+            this->textur->drawBild180( 0, 0, r->getBreite(), r->getHeight(), *r );
+        }
+        else
+        {
+            Bild *r = resources->zResource( R_PFEIL_GESCHOSS, 0 )->getImages();
+            this->textur = new Bild();
+            this->textur->neuBild( r->getHeight(), r->getBreite(), 0 );
+            if( richtung == UNTEN )
+                this->textur->drawBild90( 0, 0, r->getHeight(), r->getBreite(), *r );
+            else
+                this->textur->drawBild270( 0, 0, r->getHeight(), r->getBreite(), *r );
+        }
         if( richtung == OBEN || richtung == UNTEN )
         {
             setWidth( 7 );
@@ -96,15 +102,28 @@ void Geschoss::setTyp( GeschossTyp typ )
             setHeight( 7 );
         }
     }
-    else if( typ == FEUERBALL )
+    else if( typ == GESCHOSS_FEUERBALL )
     {
         setWidth( 20 );
         setHeight( 20 );
+        currentImage = 0;
+        nextImage = 0.075;
+        textur = resources->zResource( R_FEUERBALL_GESCHOSS, 0 )->getImages()->getThis();
     }
     else
     {
         setWidth( 15 );
         setHeight( 15 );
+        if( typ == GESCHOSS_DRACHENAUGE )
+        {
+            currentImage = 0;
+            nextImage = 0.075;
+            textur = resources->zResource( R_DRACHENAUGE_GESCHOSS, 0 )->getImages()->getThis();
+        }
+        if( typ == GESCHOSS_KUGEL )
+            textur = resources->zResource( R_KUGEL_GESCHOSS, 0 )->getImages()->getThis();
+        if( typ == GESCHOSS_MINE )
+            textur = resources->zResource( R_MINE_GESCHOSS, 0 )->getImages()->getThis();
     }
 }
 
@@ -132,6 +151,32 @@ void Geschoss::tick( double zeit )
     default:
         break;
     }
+    if( typ == GESCHOSS_FEUERBALL )
+    {
+        nextImage -= zeit;
+        if( nextImage <= 0 )
+        {
+            nextImage += 0.075;
+            currentImage++;
+            if( resources->zResource( R_FEUERBALL_GESCHOSS, 0 )->getImageCount() >= currentImage )
+                currentImage = 0;
+            textur->release();
+            textur = resources->zResource( R_FEUERBALL_GESCHOSS, 0 )->getImage( currentImage );
+        }
+    }
+    if( typ == GESCHOSS_DRACHENAUGE )
+    {
+        nextImage -= zeit;
+        if( nextImage <= 0 )
+        {
+            nextImage += 0.075;
+            currentImage++;
+            if( resources->zResource( R_DRACHENAUGE_GESCHOSS, 0 )->getImageCount() >= currentImage )
+                currentImage = 0;
+            textur->release();
+            textur = resources->zResource( R_DRACHENAUGE_GESCHOSS, 0 )->getImage( currentImage );
+        }
+    }
 }
 
 GeschossTyp Geschoss::getTyp() const

+ 4 - 1
StickmanWorldOnline/Geschoss.h

@@ -19,10 +19,13 @@ private:
     int umgelenkt;
     int geschosseGetroffen;
     int schalter;
+    int currentImage;
+    double nextImage;
     int id;
+    ResourceRegistry *resources;
 
 public:
-    Geschoss( int id, float speed, GeschossTyp typ, Richtung r, int x, int y, Spieler *besitzer );
+    Geschoss( ResourceRegistry *zResources, int id, float speed, GeschossTyp typ, Richtung r, int x, int y, Spieler *besitzer );
     ~Geschoss();
     void invertDirection();
     void addUmlenkung( Spiel *zSpiel );

+ 6 - 6
StickmanWorldOnline/Reader.cpp

@@ -652,7 +652,7 @@ void MapReader::ladeKarte( Spiel *zSpiel )
         mapFile.lese( (char *)& verschiebungWeite, 4 );
         mapFile.lese( (char *)& autoSchaltungMaxTime, 4 );
         mapFile.lese( (char *)& team, 4 );
-        zSpiel->addBariere( new Bariere( zSpiel->getNextId(), x, y, breite, height, style, verschiebungWeite, autoSchaltungMaxTime, zSpiel->getTeam( team ) ) );
+        zSpiel->addBariere( new Bariere( zSpiel->zResources(), zSpiel->getNextId(), x, y, breite, height, style, verschiebungWeite, autoSchaltungMaxTime, zSpiel->getTeam( team ) ) );
     }
     // Basen
     mapFile.lese( (char *)& anz, 4 );
@@ -670,7 +670,7 @@ void MapReader::ladeKarte( Spiel *zSpiel )
         mapFile.lese( (char *)& height, 4 );
         mapFile.lese( (char *)& maxTime, 4 );
         mapFile.lese( (char *)& team, 4 );
-        zSpiel->addBase( new Base( zSpiel->getNextId(), x, y, breite, height, maxTime, zSpiel->getTeam( team ) ) );
+        zSpiel->addBase( new Base( zSpiel->zResources(), zSpiel->getNextId(), x, y, breite, height, maxTime, zSpiel->getTeam( team ) ) );
     }
     // Drops
     mapFile.lese( (char *)& anz, 4 );
@@ -713,7 +713,7 @@ void MapReader::ladeKarte( Spiel *zSpiel )
         mapFile.lese( (char *)& breite, 4 );
         mapFile.lese( (char *)& height, 4 );
         mapFile.lese( (char *)& aktive, 1 );
-        zSpiel->addSchalter( new Schalter( zSpiel->getNextId(), x, y, breite, height, aktive ) );
+        zSpiel->addSchalter( new Schalter( zSpiel->zResources(), zSpiel->getNextId(), x, y, breite, height, aktive ) );
     }
     // Schiene
     mapFile.lese( (char *)& anz, 4 );
@@ -727,7 +727,7 @@ void MapReader::ladeKarte( Spiel *zSpiel )
         mapFile.lese( (char *)& y, 4 );
         mapFile.lese( (char *)& breite, 4 );
         mapFile.lese( (char *)& height, 4 );
-        zSpiel->addSchiene( new Schiene( zSpiel->getNextId(), x, y, breite, height ) );
+        zSpiel->addSchiene( new Schiene( zSpiel->zResources(), zSpiel->getNextId(), x, y, breite, height ) );
     }
     // Timer
     mapFile.lese( (char *)& anz, 4 );
@@ -773,7 +773,7 @@ void MapReader::ladeKarte( Spiel *zSpiel )
         mapFile.lese( (char *)& zielX, 4 );
         mapFile.lese( (char *)& zielY, 4 );
         mapFile.lese( (char *)& aktiv, 1 );
-        zSpiel->addTunnel( new Tunnel( zSpiel->getNextId(), x, y, breite, height, zielX, zielY, aktiv ) );
+        zSpiel->addTunnel( new Tunnel( zSpiel->zResources(), zSpiel->getNextId(), x, y, breite, height, zielX, zielY, aktiv ) );
     }
     // Umlenkungen
     mapFile.lese( (char *)& anz, 4 );
@@ -795,7 +795,7 @@ void MapReader::ladeKarte( Spiel *zSpiel )
         mapFile.lese( (char *)& maxAbklingzeit, 4 );
         mapFile.lese( (char *)& drehend, 1 );
         mapFile.lese( (char *)& aktiv, 1 );
-        zSpiel->addUmlenkung( new Umlenkung( zSpiel->getNextId(), x, y, breite, height, (Richtung)richtung, maxAbklingzeit, drehend, aktiv ) );
+        zSpiel->addUmlenkung( new Umlenkung( zSpiel->zResources(), zSpiel->getNextId(), x, y, breite, height, (Richtung)richtung, maxAbklingzeit, drehend, aktiv ) );
     }
     // Trigger
     mapFile.lese( (char *)& anz, 4 );

+ 15 - 0
StickmanWorldOnline/Resource.cpp

@@ -92,6 +92,21 @@ int Resource::getColor() const
     return color;
 }
 
+Bild *Resource::zImage( int id ) const
+{
+    return images.z( id );
+}
+
+Bild *Resource::getImage( int id ) const
+{
+    return images.get( id );
+}
+
+int Resource::getImageCount() const
+{
+    return images.getEintragAnzahl();
+}
+
 Resource *Resource::getThis()
 {
     ref++;

+ 15 - 1
StickmanWorldOnline/Resource.h

@@ -77,8 +77,19 @@ enum ResourceIds
     R_SPIELER,
     R_SPIELER_RECHTS,
     R_SPIELER_LINKS,
+    R_BRAND,
+    R_EXPLOSION,
+    R_HEILUNG,
+    R_SCHADEN,
     R_TUNNEL,
-    R_UMLENKUNG
+    R_UMLENKUNG,
+    R_RWEISHEIT_EFFECT,
+    R_RBOSHEIT_EFFECT,
+    R_RLEBEN_EFFECT,
+    R_RTEMPO_EFFECT,
+    R_RSTRENGTH_EFFECT,
+    R_KUGEL_GESCHOSS,
+    R_KUGEL
 };
 
 class ResourceRegistry;
@@ -97,6 +108,9 @@ public:
     Iterator< Bild * > getImages() const;
     ResourceIds getId() const;
     int getColor() const;
+    Bild *zImage( int id ) const;
+    Bild *getImage( int id ) const;
+    int getImageCount() const;
     Resource *getThis();
     Resource *release();
     friend ResourceRegistry;

+ 12 - 1
StickmanWorldOnline/Schalter.cpp

@@ -2,12 +2,14 @@
 #include "Spiel.h"
 
 
-Schalter::Schalter( int id, int x, int y, int width, int height, bool aktive )
+Schalter::Schalter( ResourceRegistry *zResources, int id, int x, int y, int width, int height, bool aktive )
     : GameObject( SCHALTER, x, y, width, height )
 {
     this->id = id;
     this->aktiv = aktive;
     aktivierungen = 0;
+    texturScale = 1;
+    textur = zResources->zResource( R_SCHALTER, 0 )->getImages()->getThis();
 }
 
 void Schalter::setAktive( bool aktiv )
@@ -24,6 +26,15 @@ void Schalter::press( Spiel *zSpiel )
     zSpiel->throwEvent( e );
 }
 
+void Schalter::render( Bild &rObj )
+{
+    if( !aktiv )
+        rObj.setAlpha( 0x77 );
+    GameObject::render( rObj );
+    if( !aktiv )
+        rObj.releaseAlpha();
+}
+
 int Schalter::getAnzahlAktivierungen() const
 {
     return aktivierungen;

+ 3 - 1
StickmanWorldOnline/Schalter.h

@@ -1,6 +1,7 @@
 #pragma once
 
 #include "GameObject.h"
+#include "Resource.h"
 
 class Spiel;
 
@@ -12,9 +13,10 @@ private:
     int aktivierungen;
 
 public:
-    Schalter( int id, int x, int y, int width, int height, bool aktive );
+    Schalter( ResourceRegistry *zResources, int id, int x, int y, int width, int height, bool aktive );
     void setAktive( bool aktiv );
     void press( Spiel *zSpiel );
+    void render( Bild &rObj ) override;
     int getAnzahlAktivierungen() const;
     bool isAktive() const;
     int getId() const;

+ 10 - 1
StickmanWorldOnline/Schiene.cpp

@@ -1,9 +1,18 @@
 #include "Schiene.h"
 
-Schiene::Schiene( int id, int x, int y, int width, int height )
+Schiene::Schiene( ResourceRegistry *zResources, int id, int x, int y, int width, int height )
     : GameObject( SCHIENE, x, y, width, height )
 {
     this->id = id;
+    if( width > height )
+        this->textur = zResources->zResource( R_SCHIENE, 0 )->getImages()->getThis();
+    else
+    {
+        Bild *r = zResources->zResource( R_SCHIENE, 0 )->getImages();
+        this->textur = new Bild();
+        this->textur->neuBild( r->getHeight(), r->getBreite(), 0 );
+        this->textur->drawBild90( 0, 0, r->getHeight(), r->getBreite(), *r );
+    }
 }
 
 int Schiene::getId() const

+ 2 - 1
StickmanWorldOnline/Schiene.h

@@ -1,12 +1,13 @@
 #pragma once
 
 #include "GameObject.h"
+#include "Resource.h"
 
 class Schiene : public GameObject
 {
 private:
     int id;
 public:
-    Schiene( int id, int x, int y, int width, int height );
+    Schiene( ResourceRegistry *zResources, int id, int x, int y, int width, int height );
     int getId() const;
 };

+ 18 - 2
StickmanWorldOnline/Spiel.cpp

@@ -507,8 +507,19 @@ void Spiel::ladeDaten()
     resources->zResource( R_SPIELER, 0, new ColorMode(), "spiel:/bilder/textures.ltdb/spieler.png" );
     resources->zResource( R_SPIELER_RECHTS, 0, new ColorMode(), "spiel:/bilder/spielerrechts.ltdb" );
     resources->zResource( R_SPIELER_LINKS, 0, new ColorMode(), "spiel:/bilder/spielerlinks.ltdb" );
+    resources->zResource( R_BRAND, 0, new ColorMode(), "spiel:/bilder/brand.ltdb" );
+    resources->zResource( R_EXPLOSION, 0, new ColorMode(), "spiel:/bilder/explosion.ltdb" );
+    resources->zResource( R_HEILUNG, 0, new ColorMode(), "spiel:/bilder/heilung.ltdb" );
+    resources->zResource( R_SCHADEN, 0, new ColorMode(), "spiel:/bilder/schaden.ltdb" );
     resources->zResource( R_TUNNEL, 0, new ColorMode(), "spiel:/bilder/textures.ltdb/tunnel.png" );
     resources->zResource( R_UMLENKUNG, 0, new ColorMode(), "spiel:/bilder/textures.ltdb/umlenkung.png" );
+    resources->zResource( R_RWEISHEIT_EFFECT, 0, new ColorMode(), "spiel:/bilder/rweisheit.ltdb" );
+    resources->zResource( R_RBOSHEIT_EFFECT, 0, new ColorMode(), "spiel:/bilder/rbosheit.ltdb" );
+    resources->zResource( R_RLEBEN_EFFECT, 0, new ColorMode(), "spiel:/bilder/rleben.ltdb" );
+    resources->zResource( R_RTEMPO_EFFECT, 0, new ColorMode(), "spiel:/bilder/rtempo.ltdb" );
+    resources->zResource( R_RSTRENGTH_EFFECT, 0, new ColorMode(), "spiel:/bilder/rstrength.ltdb" );
+    resources->zResource( R_KUGEL_GESCHOSS, 0, new ColorMode(), "spiel:/bilder/textures.ltdb/kugelg.png" );
+    resources->zResource( R_KUGEL, 0, new ColorMode(), "spiel:/bilder/textures.ltdb/kugel.png" );
     spielKlient->setLadenProzent( 70 );
     // apply team color filters
     AlphaColorMode *alphaMode = new AlphaColorMode( 0x77 );
@@ -566,14 +577,14 @@ void Spiel::doTastaturEreignis( TastaturEreignis &te )
     {
         if( te.id == TE_Press && !tasten[ te.taste ] )
         {
-            char buff[ 2 ] = { 0, te.taste };
+            char buff[ 2 ] = { 0, (char)te.taste };
             spielKlient->spielNachricht( 2, buff );
             tasten[ te.taste ] = 1;
             te.verarbeitet = 1;
         }
         else if( te.id == TE_Release && tasten[ te.taste ] )
         {
-            char buff[ 2 ] = { 1, te.taste };
+            char buff[ 2 ] = { 1, (char)te.taste };
             spielKlient->spielNachricht( 2, buff );
             tasten[ te.taste ] = 0;
             te.verarbeitet = 1;
@@ -1502,6 +1513,11 @@ Umlenkung *Spiel::getUmlenkungZuletztBenutzt() const
     return zuletztBenutzteUmlenkung ? (Umlenkung *)zuletztBenutzteUmlenkung->getThis() : 0;
 }
 
+ResourceRegistry *Spiel::zResources() const
+{
+    return resources;
+}
+
 // Reference Counting 
 SpielV *Spiel::getThis()
 {

+ 2 - 3
StickmanWorldOnline/Spiel.h

@@ -21,9 +21,7 @@
 #include "DrachenAuge.h"
 #include "Brand.h"
 #include "Resource.h"
-
-class SpielerGUI;
-class DeadPlayer;
+#include "SpielerGUI.h"
 
 class Spiel : public SpielV
 {
@@ -241,6 +239,7 @@ public:
     Umlenkung *getRandomUmlenkung();
     void setUmlenkungZuletztBenutzt( Umlenkung *t );
     Umlenkung *getUmlenkungZuletztBenutzt() const;
+    ResourceRegistry *zResources() const;
     // constant
     int läuft() const override;
     // Reference Counting

+ 5 - 5
StickmanWorldOnline/Spieler.cpp

@@ -441,7 +441,7 @@ void Spieler::useItem( Spiel *zSpiel )
         case PFEIL:
             geschosseGeschossen++;
             zSpiel->setSpielerZuletztGeschossen( (Spieler *)getThis() );
-            zSpiel->addGeschoss( new Geschoss( zSpiel->getNextId(), geschossTempo, GESCHOSS_PFEIL, getAusrichtung(), (int)x, (int)y, (Spieler *)getThis() ) );
+            zSpiel->addGeschoss( new Geschoss( zSpiel->zResources(), zSpiel->getNextId(), geschossTempo, GESCHOSS_PFEIL, getAusrichtung(), (int)x, (int)y, (Spieler *)getThis() ) );
             break;
         case LEBEN:
             addEffekt( new LebenEffect( this ) );
@@ -458,7 +458,7 @@ void Spieler::useItem( Spiel *zSpiel )
         case KUGEL:
             geschosseGeschossen++;
             zSpiel->setSpielerZuletztGeschossen( (Spieler *)getThis() );
-            zSpiel->addGeschoss( new Geschoss( zSpiel->getNextId(), geschossTempo, GESCHOSS_KUGEL, getAusrichtung(), (int)x, (int)y, (Spieler *)getThis() ) );
+            zSpiel->addGeschoss( new Geschoss( zSpiel->zResources(), zSpiel->getNextId(), geschossTempo, GESCHOSS_KUGEL, getAusrichtung(), (int)x, (int)y, (Spieler *)getThis() ) );
             break;
         case ROLLE:
             addEffekt( new RolleEffect( this, getAusrichtung() ) );
@@ -469,12 +469,12 @@ void Spieler::useItem( Spiel *zSpiel )
         case DRACHENAUGE:
             geschosseGeschossen++;
             zSpiel->setSpielerZuletztGeschossen( (Spieler *)getThis() );
-            zSpiel->addGeschoss( new Geschoss( zSpiel->getNextId(), geschossTempo, GESCHOSS_DRACHENAUGE, getAusrichtung(), (int)x, (int)y, (Spieler *)getThis() ) );
+            zSpiel->addGeschoss( new Geschoss( zSpiel->zResources(), zSpiel->getNextId(), geschossTempo, GESCHOSS_DRACHENAUGE, getAusrichtung(), (int)x, (int)y, (Spieler *)getThis() ) );
             break;
         case FEUERBALL:
             geschosseGeschossen++;
             zSpiel->setSpielerZuletztGeschossen( (Spieler *)getThis() );
-            zSpiel->addGeschoss( new Geschoss( zSpiel->getNextId(), geschossTempo, GESCHOSS_FEUERBALL, getAusrichtung(), (int)x, (int)y, (Spieler *)getThis() ) );
+            zSpiel->addGeschoss( new Geschoss( zSpiel->zResources(), zSpiel->getNextId(), geschossTempo, GESCHOSS_FEUERBALL, getAusrichtung(), (int)x, (int)y, (Spieler *)getThis() ) );
             break;
         case ENTERHAKEN:
             addEffekt( new EnterhakenEffect( this, getAusrichtung() ) );
@@ -482,7 +482,7 @@ void Spieler::useItem( Spiel *zSpiel )
         case MINE:
             geschosseGeschossen++;
             zSpiel->setSpielerZuletztGeschossen( (Spieler *)getThis() );
-            zSpiel->addGeschoss( new Geschoss( zSpiel->getNextId(), 0, GESCHOSS_MINE, MITTE, (int)x, (int)y, (Spieler *)getThis() ) );
+            zSpiel->addGeschoss( new Geschoss( zSpiel->zResources(), zSpiel->getNextId(), 0, GESCHOSS_MINE, MITTE, (int)x, (int)y, (Spieler *)getThis() ) );
             break;
         default:
             break;

+ 8 - 0
StickmanWorldOnline/Spieler.h

@@ -159,4 +159,12 @@ public:
     int getGeschossen() const;
     GegenstandTyp getInventorySlot( int index ) const;
     const char *getName() const;
+};
+
+class DeadPlayer : public GameObject
+{
+
+public:
+
+    bool isFinished() const;
 };

+ 10 - 0
StickmanWorldOnline/SpielerGUI.h

@@ -0,0 +1,10 @@
+#pragma once
+
+#include <Zeichnung.h>
+
+using namespace Framework;
+
+class SpielerGUI : public Zeichnung
+{
+
+};

+ 1 - 0
StickmanWorldOnline/StickmanWorldOnline.vcxproj

@@ -98,6 +98,7 @@
     <ClInclude Include="SpielChat.h" />
     <ClInclude Include="Spiel.h" />
     <ClInclude Include="Spieler.h" />
+    <ClInclude Include="SpielerGUI.h" />
     <ClInclude Include="SpielStatistik.h" />
     <ClInclude Include="SpielStatistikDaten.h" />
     <ClInclude Include="StatistikChat.h" />

+ 3 - 0
StickmanWorldOnline/StickmanWorldOnline.vcxproj.filters

@@ -299,5 +299,8 @@
     <ClInclude Include="Resource.h">
       <Filter>Resources</Filter>
     </ClInclude>
+    <ClInclude Include="SpielerGUI.h">
+      <Filter>Spiel</Filter>
+    </ClInclude>
   </ItemGroup>
 </Project>

+ 12 - 1
StickmanWorldOnline/Tunnel.cpp

@@ -2,7 +2,7 @@
 #include "Spiel.h"
 
 
-Tunnel::Tunnel( int id, int x, int y, int width, int height, int zielX, int zielY, bool aktiv )
+Tunnel::Tunnel( ResourceRegistry *zResources, int id, int x, int y, int width, int height, int zielX, int zielY, bool aktiv )
     : GameObject( TUNNEL, x, y, width, height )
 {
     this->id = id;
@@ -10,6 +10,8 @@ Tunnel::Tunnel( int id, int x, int y, int width, int height, int zielX, int ziel
     benutzt = 0;
     this->zielX = zielX;
     this->zielY = zielY;
+    texturScale = 1;
+    textur = zResources->zResource( R_TUNNEL, 0 )->getImages()->getThis();
 }
 
 void Tunnel::setZielX( int x )
@@ -33,6 +35,15 @@ void Tunnel::setAktiv( bool aktiv )
     this->aktiv = aktiv;
 }
 
+void Tunnel::render( Bild &rObj )
+{
+    if( !aktiv )
+        rObj.setAlpha( 0x77 );
+    GameObject::render( rObj );
+    if( !aktiv )
+        rObj.releaseAlpha();
+}
+
 int Tunnel::getZielX() const
 {
     return zielX;

+ 3 - 1
StickmanWorldOnline/Tunnel.h

@@ -1,6 +1,7 @@
 #pragma once
 
 #include "GameObject.h"
+#include "Resource.h"
 
 class Spiel;
 
@@ -14,11 +15,12 @@ private:
     int zielY;
 
 public:
-    Tunnel( int id, int x, int y, int width, int height, int zielX, int zielY, bool aktiv );
+    Tunnel( ResourceRegistry *zResources, int id, int x, int y, int width, int height, int zielX, int zielY, bool aktiv );
     void setZielX( int x );
     void setZielY( int y );
     void addBenutzung( Spiel *zSpiel );
     void setAktiv( bool aktiv );
+    void render( Bild &rObj ) override;
     int getZielX() const;
     int getZielY() const;
     bool istAktiv() const;

+ 41 - 5
StickmanWorldOnline/Umlenkung.cpp

@@ -2,7 +2,7 @@
 #include "Spiel.h"
 
 
-Umlenkung::Umlenkung( int id, int x, int y, int breite, int height, Richtung richtung, int maxAbklingzeit, bool drehend, bool aktiv )
+Umlenkung::Umlenkung( ResourceRegistry *zResources, int id, int x, int y, int breite, int height, Richtung richtung, int maxAbklingzeit, bool drehend, bool aktiv )
     : GameObject( UMLENKUNG, x, y, breite, height )
 {
     this->id = id;
@@ -12,6 +12,12 @@ Umlenkung::Umlenkung( int id, int x, int y, int breite, int height, Richtung ric
     this->aktiv = aktiv;
     benutzt = 0;
     abklingzeitVerbleibend = 0;
+    this->resources = zResources->getThis();
+}
+
+Umlenkung::~Umlenkung()
+{
+    resources->release();
 }
 
 void Umlenkung::setMaxAbklingzeit( int sekunden )
@@ -32,6 +38,27 @@ void Umlenkung::setDrehend( bool drehend )
 void Umlenkung::setRichtung( Richtung r )
 {
     this->richtung = r;
+    if( textur )
+        textur->release();
+    if( richtung == RECHTS )
+        textur = resources->zResource( R_UMLENKUNG, 0 )->getImages()->getThis();
+    else if( richtung == LINKS )
+    {
+        Bild *r = resources->zResource( R_UMLENKUNG, 0 )->getImages();
+        this->textur = new Bild();
+        this->textur->neuBild( r->getBreite(), r->getHeight(), 0 );
+        this->textur->drawBild180( 0, 0, r->getBreite(), r->getHeight(), *r );
+    }
+    else
+    {
+        Bild *r = resources->zResource( R_UMLENKUNG, 0 )->getImages();
+        this->textur = new Bild();
+        this->textur->neuBild( r->getHeight(), r->getBreite(), 0 );
+        if( richtung == UNTEN )
+            this->textur->drawBild90( 0, 0, r->getHeight(), r->getBreite(), *r );
+        else
+            this->textur->drawBild270( 0, 0, r->getHeight(), r->getBreite(), *r );
+    }
 }
 
 void Umlenkung::addBenutzt( Spiel *zSpiel )
@@ -42,16 +69,16 @@ void Umlenkung::addBenutzt( Spiel *zSpiel )
         switch( richtung )
         {
         case OBEN:
-            richtung = RECHTS;
+            setRichtung( RECHTS );
             break;
         case RECHTS:
-            richtung = UNTEN;
+            setRichtung( UNTEN );
             break;
         case UNTEN:
-            richtung = LINKS;
+            setRichtung( LINKS );
             break;
         case LINKS:
-            richtung = OBEN;
+            setRichtung( OBEN );
             break;
         default:
             break;
@@ -71,6 +98,15 @@ void Umlenkung::tick( double time )
     }
 }
 
+void Umlenkung::render( Bild &rObj )
+{
+    if( !aktiv )
+        rObj.setAlpha( 0x77 );
+    GameObject::render( rObj );
+    if( !aktiv )
+        rObj.releaseAlpha();
+}
+
 bool Umlenkung::isAktive() const
 {
     return aktiv;

+ 5 - 1
StickmanWorldOnline/Umlenkung.h

@@ -1,6 +1,7 @@
 #pragma once
 
 #include "GameObject.h"
+#include "Resource.h"
 
 class Spiel;
 
@@ -14,15 +15,18 @@ private:
     int benutzt;
     int maxAbklingzeit;
     float abklingzeitVerbleibend;
+    ResourceRegistry *resources;
 
 public:
-    Umlenkung( int id, int x, int y, int breite, int height, Richtung richtung, int maxAbklingzeit, bool drehend, bool aktiv );
+    Umlenkung( ResourceRegistry *zResources, int id, int x, int y, int breite, int height, Richtung richtung, int maxAbklingzeit, bool drehend, bool aktiv );
+    ~Umlenkung();
     void setMaxAbklingzeit( int sekunden );
     void setAktiv( bool aktiv );
     void setDrehend( bool drehend );
     void setRichtung( Richtung r );
     void addBenutzt( Spiel *zSpiel );
     void tick( double time );
+    void render( Bild &rObj ) override;
     bool isAktive() const;
     bool hatAbklingzeit() const;
     bool istDrehend() const;

+ 9 - 9
StickmanWorldOnline/Variablen.cpp

@@ -46,17 +46,17 @@ Richtung getRichtungFromString( Text str )
 
 bool operator==( VariableTyp a, VariableTyp b )
 {
-    if( a == GAME_OBJEKT || b == GAME_OBJEKT )
+    if( a == (int)ALLE || b == (int)ALLE )
+        return 1;
+    if( a == (int)GAME_OBJEKT || b == (int)GAME_OBJEKT )
     {
-        return ( a == BARIERE || a == BASE || a == DROP || a == GEGENSTAND || a == GESCHOSS ||
-                 a == SCHALTER || a == SCHIENE || a == SPIELER || a == TIMER ||
-                 a == TUNNEL || a == UMLENKUNG || a == GAME_OBJEKT || a == ALLE ) &&
-                 ( b == BARIERE || b == BASE || b == DROP || b == GEGENSTAND || b == GESCHOSS ||
-                   b == SCHALTER || b == SCHIENE || b == SPIELER || b == TIMER || b == TUNNEL ||
-                   b == UMLENKUNG || b == GAME_OBJEKT || b == ALLE );
+        return ( a == (int)BARIERE || a == (int)BASE || a == (int)GEGENSTAND || a == (int)GESCHOSS ||
+                 a == (int)SCHALTER || a == (int)SCHIENE || a == (int)SPIELER || a == (int)TIMER ||
+                 a == (int)TUNNEL || a == (int)UMLENKUNG || a == (int)GAME_OBJEKT || a == (int)ALLE ) &&
+                 ( b == (int)BARIERE || b == (int)BASE || b == (int)GEGENSTAND || b == (int)GESCHOSS ||
+                   b == (int)SCHALTER || b == (int)SCHIENE || b == (int)SPIELER || b == (int)TIMER || b == (int)TUNNEL ||
+                   b == (int)UMLENKUNG || b == (int)GAME_OBJEKT || b == (int)ALLE );
     }
-    if( a == ALLE || b == ALLE )
-        return 1;
     return (int)a == (int)b;
 }