Browse Source

Merge remote-tracking branch 'refs/remotes/upstream/development' into development

capnlove 12 years ago
parent
commit
8a3498c

+ 0 - 1
engine/source/2d/experimental/composites/WaveComposite.cc

@@ -152,7 +152,6 @@ void WaveComposite::copyTo(SimObject* object)
     pComposite->setAmplitude( getAmplitude() );
 }
 
-
 //-----------------------------------------------------------------------------
 
 void WaveComposite::scenePrepareRender( const SceneRenderState* pSceneRenderState, SceneRenderQueue* pSceneRenderQueue )

+ 3 - 3
engine/source/2d/scene/SceneRenderState.h

@@ -46,7 +46,7 @@ struct SceneRenderState
         U32 renderGroupMask,
         const Vector2& renderScale,
         DebugStats* pDebugStats,
-        GuiControl* pGuiControl )
+        SimObject* pRenderHost )
     {
         mRenderArea       = renderArea;
         mRenderAABB       = CoreMath::mRectFtoAABB( renderArea );
@@ -56,7 +56,7 @@ struct SceneRenderState
         mRenderLayerMask  = renderLayerMask;
         mRenderGroupMask  = renderGroupMask;
         mpDebugStats      = pDebugStats;
-        mpGuiControl      = pGuiControl;
+        mpRenderHost      = pRenderHost;
     }
 
     RectF           mRenderArea;
@@ -67,7 +67,7 @@ struct SceneRenderState
     U32             mRenderGroupMask;
     Vector2         mRenderScale;
     DebugStats*     mpDebugStats;
-    GuiControl*     mpGuiControl;
+    SimObject*      mpRenderHost;
 
 
 };

+ 0 - 1
engine/source/2d/sceneobject/Sprite.h

@@ -60,7 +60,6 @@ public:
 protected:
     static bool writeFlipX( void* obj, StringTableEntry pFieldName )        { return static_cast<Sprite*>(obj)->getFlipX() == true; }
     static bool writeFlipY( void* obj, StringTableEntry pFieldName )        { return static_cast<Sprite*>(obj)->getFlipY() == true; }
-
 };
 
 #endif // _SPRITE_H_

+ 7 - 8
modules/DeathBallToy/1/main.cs

@@ -217,11 +217,11 @@ function Deathball::updateRollAnimation(%this)
 {
     %this.rollSchedule = "";
 
-    %velocity = %this.getLinearVelocity();
-    %scaledVelocity = (mAbs(getWord(%velocity, 0))) + mAbs(getWord(%velocity, 1)) / 50;
+    %velocity = %this.getLinearVelocity();    
+    %scaledVelocity = VectorLen(%velocity); // (mAbs(getWord(%velocity, 0))) + mAbs(getWord(%velocity, 1)) / 50;
     %flooredVelocity = mFloatLength(%scaledVelocity, 1);
 
-    %this.setAnimationTimeScale(%flooredVelocity / 15);
+    %this.setAnimationTimeScale(%flooredVelocity / 20);
 
     %this.rollSchedule = %this.schedule(100, updateRollAnimation);
 }
@@ -469,11 +469,10 @@ function DeathBallToy::onTouchUp(%this, %touchID, %worldPosition)
 {
     %origin = Deathball.getPosition();
     %angle = -mRadToDeg( mAtan( getWord(%worldPosition,0)-getWord(%origin,0), getWord(%worldPosition,1)-getWord(%origin,1) ) );
-
-    Deathball.RotateTo( %angle, DeathBallToy.rotateSpeed );
-
-    %adjustedSpeed = (DeathBallToy.ballSpeed / DeathBallToy.maxBallSpeed) * 3000;
-
+    
+    // Since the speed is used instead of time, we can use the current velocity to set it's speed.
+    %adjustedSpeed = VectorLen(DeathBall.getLinearVelocity());// (DeathBallToy.ballSpeed / DeathBallToy.maxBallSpeed) * 3000;
+   
     Deathball.MoveTo( %worldPosition, %adjustedSpeed, true, false );
 }
 

+ 2 - 2
modules/DeathBallToy/1/scripts/dealsDamageBehavior.cs

@@ -61,9 +61,9 @@ function DealsDamageBehavior::explode(%this, %position)
 
 //-----------------------------------------------------------------------------
 
-function DealsDamageBehavior::onCollision(%this, %object, %collisionDetails)
+function DealsDamageBehavior::onCollision(%this, %objectA, %objectB, %collisionDetails)
 {
-    %this.dealDamage(%this.strength, %object);
+    %this.dealDamage(%this.strength, %objectB);
    
     if (%this.deleteOnHit)
     {

+ 29 - 40
modules/ShapeVectorToy/1/main.cs

@@ -30,12 +30,11 @@ function ShapeVectorToy::create( %this )
 
     // Set the toy properties
 
-    // Shape determines the poly points for the ShapeVector
-    // "Square": Simple box
-    // "Triangle": Equilateral triangle
-    // "Circle": Simple circle
-    // "Complex": Shape with enough vertices to make an uncommon shape
-    ShapeVectorToy.shape = "Square";
+    // Shape determines the number of vertices for the ShapeVector
+    ShapeVectorToy.shape = 4;
+    
+    // Default shape is a polygon instead of a circle
+    ShapeVectorToy.circle = false;
 
     // Toggles filling the shape with color or leaving as an outline
     ShapeVectorToy.fillMode = true;
@@ -47,7 +46,8 @@ function ShapeVectorToy::create( %this )
     ShapeVectorToy.lineColor = "0.5 1 1 1";
 
     // Add custom controls for toy
-    addSelectionOption("Square,Triangle,Circle,Complex", "Shape", 4, "setShape", true, "Selects the shape to add to the scene");
+    addNumericOption("Vertices Count", 3, 20, 1, "setShape", ShapeVectorToy.shape, true, "Selects the shape to add to the scene based on the number of vertices");
+    addFlagOption("Make a Circle", "setCircle", ShapeVectorToy.circle, true, "Override the number of vertices to make a circle");
     addFlagOption("Fill mode", "setFillMode", ShapeVectorToy.fillMode, true, "Whether new shapes are filled in or not");
 
     // Reset the toy.
@@ -80,6 +80,13 @@ function ShapeVectorToy::setShape( %this, %value )
 
 //-----------------------------------------------------------------------------
 
+function ShapeVectorToy::setCircle(%this, %value)
+{
+    %this.circle = %value;
+}
+
+//-----------------------------------------------------------------------------
+
 function ShapeVectorToy::setFillMode( %this, %value)
 {
     %this.fillMode = %value;
@@ -89,41 +96,23 @@ function ShapeVectorToy::setFillMode( %this, %value)
 
 function ShapeVectorToy::generateShape( %this )
 {
-    // Start with default values
-    %points = "0 0 0 0 0 0";
-    %isCircle = false;
-    %radius = 0;
-    %size = "40";
-
-    // Create the poly point list based on the selected shape
-    switch$(%this.shape)
-    {
-        case "Square":
-            %points = "-0.5 -0.5 0.5 -0.5 0.5 0.5 -0.5 0.5";
-
-        case "Triangle":
-            %points = "-0.0025 0.5 0.5 -0.5 -0.5 -0.5";
-
-        case "Circle":
-            %radius = %size / 2;
-            %isCircle = true;
-
-        case "Complex":
-            %points = "-0.997 0.005 -0.737 -0.750 -0.010 -0.993 0.746 -0.750 0.997 0.005 0.742 0.740 0.005 0.998 -0.761 0.740";
-    }
-
     // Create the shape vector
-    %shape = new ShapeVector()
+    %shape = new ShapeVector();
+    %shape.setPosition("0 0");
+    %shape.setSize(20);
+    %shape.setLineColor(%this.lineColor);
+    %shape.setFillColor(%this.fillColor);
+    %shape.setFillMode(%this.fillMode);
+
+    // Check if circle, if not make an equiangular convex polygon with n number of sides
+    if (%this.circle)
+    {
+        %shape.setIsCircle(true);
+        %shape.setCircleRadius(20);
+    }else
     {
-        position = "0 0";
-        size = %size;
-        LineColor = %this.lineColor;
-        FillColor = %this.fillColor;
-        FillMode = %this.fillMode;
-        PolyList = %points;
-        isCircle = %isCircle;
-        circleRadius = %radius;
-    };
+        %shape.setPolyPrimitive(%this.shape);
+    }
 
     // Return the shape to be added to the scene
     return %shape;