Fradera - Snowing Ride

If a level is not working or is having errors then please report that here.

Moderators: Main Administator, Global Moderator, Moderator

Post Reply
User avatar
Leg-Spinner 77
Administrator
Administrator
Posts: 702
Joined: Thu Sep 15, 2011 12:31 pm
Location: Perth, Australia

Fradera - Snowing Ride

Post by Leg-Spinner 77 » Tue Feb 19, 2013 1:42 am

This is a level known to be unplayable without modifications, can something be done please? [smilie=row2_16.gif]
"Soli Deo honor et gloria."
Member of Team Grimmie \|/


Other nicks: Standecni, Vandette (and all other Vandette names), MotR, Science & Progress, Man on the Run.

shmo
Administrator
Administrator
Posts: 548
Joined: Fri Nov 16, 2012 4:55 pm

Re: Fradera - Snowing Ride

Post by shmo » Tue Feb 19, 2013 4:06 am

I have the same problem. I made it work by changing the level name and id and then deleting the script entirely.
Did you know that the tip of a lighter flame smells like burnt nose hair?

User avatar
Cigam
Administrator
Administrator
Posts: 384
Joined: Wed Dec 17, 2008 4:44 pm
Location: USA
Contact:

Re: Fradera - Snowing Ride

Post by Cigam » Tue Feb 19, 2013 4:13 am

The script is needed though for what the level is. its just a feature I think got removed from xmoto so the script causes it to fail. I will be testing it later hopefully.

User avatar
tumo
Administrator
Administrator
Posts: 15
Joined: Wed Apr 11, 2012 8:45 am

Re: Fradera - Snowing Ride

Post by tumo » Mon Feb 25, 2013 12:58 am

I think the same script effect is used in Fradera - clouds of rain. And when I once tried adding this script it worked well, but with different values. And the problems I had when trying this were mostly due to the number of raindrops I tried to make, if I recall correctly.
I may not always be right,
but I'm never wrong.

mecka
Xmoto Player
Xmoto Player
Posts: 1
Joined: Sat May 04, 2013 3:41 pm

Re: Fradera - Snowing Ride

Post by mecka » Sat May 04, 2013 3:46 pm

I have created a patch for xmoto 0.5.10 to not crash while playing this level. However, the snowing effect is still broken. Anyone have any idea what scripting features used by this level are no longer supported? Here's the complete level script:

Code: Select all

-- Sprite vectors that store snow sprites initial positions
snowspritex = { }
snowspritey = { }

-- Counters
i=0
actTrans=0

-- Number of snow sprites
NsnowSpriteS=80

-- Duration in ms of snow animation
duration=16000

-- X axis and Y axis distance the snow sprites will move
distx=80*16
disty=160*16

-- Random number
aleo=0

-- PLayer X and Y
plx=0
ply=0

-- Initial player
plxini = 0
plyini = 0
bright=0

-- Timer tick count
tick=0

-- Auxiliar variable to store snow sprite position
Blocksnowspritex=0
Blocksnowspritey=0

-- Max. number of animations
MAXTRANSLATIONS=1

-- Initalize 'waterfall' like snow translation
-- Modify the movement' a little randomly (aleo variable)

function OnLoad()
  i=0
  plxini, plyini, bright = Game.GetPlayerPosition()
  while( i< NsnowSpriteS ) do
     snowspritex[i], snowspritey[i] = Game.GetBlockPos("block"..i) 
     snowspritex[i] = snowspritex[i] - plxini
     snowspritey[i] = snowspritey[i] - plyini
     aleo = math.random(0,2)
     actTrans=0
     while(actTrans < MAXTRANSLATIONS ) do  
        if( aleo == 0 ) then
           Game.SetDynamicBlockTranslation("block"..i, -distx, -disty, duration*20, (actTrans*duration), (actTrans+1)*duration)
        end
        if( aleo == 1 ) then
           Game.SetDynamicBlockTranslation("block"..i, -1.5*distx, -disty, duration*20, (actTrans*duration), (actTrans+1)*duration)
        end
        if( aleo == 2 ) then
           Game.SetDynamicBlockTranslation("block"..i, -distx, -1.3*disty, duration*20, (actTrans*duration), (actTrans+1)*duration)
        end
        actTrans=actTrans+1
     end
     i = i + 1
  end
  return true
end

-- If the snow sprites are under the player, move them to initial position
-- to create the 'snowing' effect
-- The 'snow cloud' will follow the player
function Tick()

if( tick == NsnowSpriteS ) then
   tick = 0
   i=0
   plx, ply, bright = Game.GetPlayerPosition()
   while( i < NsnowSpriteS ) do
      Blocksnowspritex, Blocksnowspritey = Game.GetBlockPos("block"..i) 
      if( (Blocksnowspritey - plyini < 20) or (Blocksnowspritex - plx  < 80) ) then
         Game.SetBlockPos("block"..i, plx + snowspritex[i], ply + snowspritey[i]) 
      end

      i = i + 1
   end
else
   tick = tick + 1
end

return true

end
Also, the patch (pretty simple):

Code: Select all

--- xmoto-0.5.10.orig_prep/src/Collision.cpp	2011-10-11 13:18:35.000000000 -0700
+++ xmoto-0.5.10/src/Collision.cpp	2013-05-04 08:18:37.234561882 -0700
@@ -888,58 +888,64 @@
     m_widthDivisor  = (float)(m_gridWidth)  / (m_max.x - m_min.x);
     m_heightDivisor = (float)(m_gridHeight) / (m_max.y - m_min.y);
 
     m_pGrid = new GridCell[m_gridWidth * m_gridHeight];    
   }
 
   template <class T> struct ColElement<T>* ElementHandler<T>::addElement(T* id)
   {
     struct ColElement<T>* pNewElem = new struct ColElement<T>;
     pNewElem->id = id;
     m_ColElements.push_back(pNewElem);
 
     _addColElementInCells(pNewElem);
     return pNewElem;      
   }
 
   template <class T> void
   ElementHandler<T>::removeElement(T* id)
   {
     struct ColElement<T>* pColElem = _getAndRemoveColElement(id);
-    _removeColElementFromCells(pColElem);
 
-    delete pColElem;
+    if (pColElem != 0) {
+      _removeColElementFromCells(pColElem);
+      delete pColElem;
+    }
   }
 
   template <class T> void
   ElementHandler<T>::moveElement(T* id)
   {
     struct ColElement<T>* pColElem = _getColElement(id);
-    _removeColElementFromCells(pColElem);
-    _addColElementInCells(pColElem);
+    if (pColElem != 0) {
+      _removeColElementFromCells(pColElem);
+      _addColElementInCells(pColElem);
+    }
   }
 
   template <class T> void
   ElementHandler<T>::moveElement(struct ColElement<T>* pColElem)
   {
-    _removeColElementFromCells(pColElem);
-    _addColElementInCells(pColElem);
+    if (pColElem != 0) {
+      _removeColElementFromCells(pColElem);
+      _addColElementInCells(pColElem);
+    }
   }
 
 
 
   inline int my_floor(float x) {
     int ix = (int)x;
     return (ix >= 0) ? ix : ix-1;
   }
 
 
 
   template <class T> std::vector<T*>&
   ElementHandler<T>::getElementsNearPosition(AABB& BBox)
   {
     m_returnedElements.clear();
     Vector2f BMin = BBox.getBMin();
     Vector2f BMax = BBox.getBMax();
 
     /* grid coordonates */
     int nMinCX = my_floor(((BMin.x - m_min.x - CD_EPSILON) * m_widthDivisor));

Post Reply

Return to “Problems with Levels”

Who is online

Users browsing this forum: No registered users and 1 guest