<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.lumasworkshop.com/w/index.php?action=history&amp;feed=atom&amp;title=SMG1_to_SMG2_Code_Changes</id>
	<title>SMG1 to SMG2 Code Changes - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.lumasworkshop.com/w/index.php?action=history&amp;feed=atom&amp;title=SMG1_to_SMG2_Code_Changes"/>
	<link rel="alternate" type="text/html" href="https://www.lumasworkshop.com/w/index.php?title=SMG1_to_SMG2_Code_Changes&amp;action=history"/>
	<updated>2026-06-04T06:18:29Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://www.lumasworkshop.com/w/index.php?title=SMG1_to_SMG2_Code_Changes&amp;diff=771&amp;oldid=prev</id>
		<title>Shibboleet: Created page with &quot;Between the game &#039;&#039;Super Mario Galaxy&#039;&#039; and &#039;&#039;Super Mario Galaxy 2&#039;&#039;, a few changes were made under the hood to make things easier to work with in the codebase. This page will be listing those changes that the developers made.  == NameObj == &#039;&#039;NameObj&#039;&#039; is the most basic form of an object in the game. It contains an executor index, the execution flags, and the name of the object. &lt;pre&gt; class NameObj { public:   NameObj(const char *pName);    virtual ~NameObj();   virtual...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.lumasworkshop.com/w/index.php?title=SMG1_to_SMG2_Code_Changes&amp;diff=771&amp;oldid=prev"/>
		<updated>2024-12-17T01:48:51Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Between the game &amp;#039;&amp;#039;Super Mario Galaxy&amp;#039;&amp;#039; and &amp;#039;&amp;#039;Super Mario Galaxy 2&amp;#039;&amp;#039;, a few changes were made under the hood to make things easier to work with in the codebase. This page will be listing those changes that the developers made.  == NameObj == &amp;#039;&amp;#039;NameObj&amp;#039;&amp;#039; is the most basic form of an object in the game. It contains an executor index, the execution flags, and the name of the object. &amp;lt;pre&amp;gt; class NameObj { public:   NameObj(const char *pName);    virtual ~NameObj();   virtual...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Between the game &amp;#039;&amp;#039;Super Mario Galaxy&amp;#039;&amp;#039; and &amp;#039;&amp;#039;Super Mario Galaxy 2&amp;#039;&amp;#039;, a few changes were made under the hood to make things easier to work with in the codebase. This page will be listing those changes that the developers made.&lt;br /&gt;
&lt;br /&gt;
== NameObj ==&lt;br /&gt;
&amp;#039;&amp;#039;NameObj&amp;#039;&amp;#039; is the most basic form of an object in the game. It contains an executor index, the execution flags, and the name of the object.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class NameObj {&lt;br /&gt;
public:&lt;br /&gt;
  NameObj(const char *pName);&lt;br /&gt;
&lt;br /&gt;
  virtual ~NameObj();&lt;br /&gt;
  virtual void init(const JMapInfoIter &amp;amp;rIter);&lt;br /&gt;
  virtual void initAfterPlacement();&lt;br /&gt;
  virtual void movement();&lt;br /&gt;
  virtual void draw() const;&lt;br /&gt;
  virtual void calcAnim();&lt;br /&gt;
  virtual void calcViewAndEntry();&lt;br /&gt;
&lt;br /&gt;
  /* 0x4 */ const char *mName;&lt;br /&gt;
  /* 0x8 */ volatile u16 mFlags;&lt;br /&gt;
  /* 0xA */ s16 mExecutorIdx; &lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, &amp;#039;&amp;#039;Super Mario Galaxy 2&amp;#039;&amp;#039; changes the base object a little. It adds a &amp;#039;&amp;#039;JMapLinkInfo&amp;#039;&amp;#039; instance to the NameObj for easier linking using the new &amp;#039;&amp;#039;LinkID&amp;#039;&amp;#039; attribute introduced in the JMap. It also introduces two new virtual functions, &amp;#039;&amp;#039;NameObj::startMovement&amp;#039;&amp;#039; and &amp;#039;&amp;#039;NameObj::endMovement&amp;#039;&amp;#039; which are called before and after a movement is executed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class NameObj {&lt;br /&gt;
public:&lt;br /&gt;
    NameObj(const char *);&lt;br /&gt;
&lt;br /&gt;
    virtual ~NameObj();&lt;br /&gt;
    virtual void init(const JMapInfoIter &amp;amp;);&lt;br /&gt;
    virtual void initAfterPlacement();&lt;br /&gt;
    virtual void movement();&lt;br /&gt;
    virtual void draw() const;&lt;br /&gt;
    virtual void calcAnim();&lt;br /&gt;
    virtual void calcViewAndEntry();&lt;br /&gt;
    virtual void startMovement();&lt;br /&gt;
    virtual void endMovement();&lt;br /&gt;
&lt;br /&gt;
    const char* mName;          // 0x04&lt;br /&gt;
    vu16 mFlags;                // 0x08&lt;br /&gt;
    s16 mExecutorIdx;           // 0x0A&lt;br /&gt;
    JMapLinkInfo mLinkInfo;     // 0x0C&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== StageSwitchContainer ==&lt;br /&gt;
&amp;#039;&amp;#039;StageSwitchContainer&amp;#039;&amp;#039; is the class that controls the switches for a specific galaxy. They are very similar in both games, with a small change (mainly for code cleanliness) made to how it works.&lt;br /&gt;
&lt;br /&gt;
In &amp;#039;&amp;#039;Super Mario Galaxy&amp;#039;&amp;#039;, the &amp;#039;&amp;#039;StageSwitchContainer&amp;#039;&amp;#039; class stores an array of &amp;#039;&amp;#039;StageSwitch::ContainerSwitch&amp;#039;&amp;#039; instances that contained &amp;quot;data&amp;quot; (which is the Zone ID it is contained in) and the &amp;#039;&amp;#039;ZoneSwitch&amp;#039;&amp;#039; pointer which contained the actual switch data itself.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class StageSwitchContainer : public NameObj {&lt;br /&gt;
public:&lt;br /&gt;
    struct ContainerSwitch {&lt;br /&gt;
        s32 mData;              // 0x0&lt;br /&gt;
        ZoneSwitch* mSwitch;    // 0x4&lt;br /&gt;
    };&lt;br /&gt;
    ContainerSwitch mSwitches[20];  // 0xC&lt;br /&gt;
    s32 mCount;                     // 0xAC&lt;br /&gt;
    ZoneSwitch* mGlobalSwitches;    // 0xB0&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The developers probably realized that the zone ID here does not need to be stored in conjunction with the switch, it can just be stored &amp;#039;&amp;#039;inside&amp;#039;&amp;#039; of the switch instance. So, they added the Zone ID attribute into &amp;#039;&amp;#039;ZoneSwitch&amp;#039;&amp;#039; and made the array smaller, as well as making it a pointer array of &amp;#039;&amp;#039;ZoneSwitch&amp;#039;&amp;#039; instances.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class StageSwitchContainer : public NameObj {&lt;br /&gt;
public:&lt;br /&gt;
    ZoneSwitch* mZoneSwitches[0x10];     // 0x14&lt;br /&gt;
    s32 mSwitchCount;                   // 0x54&lt;br /&gt;
    ZoneSwitch* mParentZone;            // 0x58&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Shibboleet</name></author>
	</entry>
</feed>