Scribblenauts Remix

Unused Text
Instructions for how to add your own 'game' state, where I say 'game' to refer to actual states the game itself can be in at anytime (not to confuse that with I_GameState). As the state structure will also be used in the State Machine core used by game entities.

Steps required to add your own derived 'game' state:

-create the state files (interface and implementation) -statename.h -statename.cpp  // where statename = your states name -create your state class -derives from one of 4 base interfaces: -I_State:         basic state -I_StatePlus:     basic state with substate capabilities -C_StateManager:  basic state with state management abilities of the substates -I_GameState:     state with game settings (vram banks, BGs, palettes, etc) -I_GameStatePlus: state with game settings AND substate capabilities

NOTE: The M_StateManager is a C_StateManager and should be all we need for these kinds of states, so please think about it thoroughly before considering using another C_StateManager.

example)

// TEST STATE CLASS //

class C_Test : public I_GameStatePlus { public: C_Test; // ctor

// PUBLIC VIRTUAL FUNCTIONS //

virtual ~C_Test {}

// this function is pure virtual, so if you have a 'Plus' state, you MUST fill it out // virtual void InitStates;

// none of these functions are pure virtual, so it's up to you if you want to use them or not // virtual void Init; virtual void Unload;

virtual void Update(void); virtual void Render(void); virtual void Draw(void); virtual void CleanUp(void);

protected: // game settings have default settings, see C_GameState ctor in state.cpp // // setup your potential game state settings in the CONSTRUCTOR of your derived state //

}; // C_Test

-place files in proper system folder in a properly named game state folder

-in state_enums.h: -add your states enum under the proper system -if you are using a 'Plus' state (state management) -in the below substates field, add all your substates

example)

enum T_State {	STATE_MANAGER = -1,					// state manager itself is a state (see this as GAME_INIT)

//--| 	// Top-Level States (substates of M_StateManager)

STATE_TEST,				// NOTICE: All top-level states are substates of the //			M_StateManager itself. These MUST remain STATE_MENU,				//			side by side as they ARE indices into the //			I_StateMangement::pCa_SubStates_m array.

NUM_STATES, // ALWAYS KEEP THIS AT THE BOTTOM OF LIST OF SUBSTATES OF THE STATEMANAGER!

//--| 	// SubStates (substates of top-level states) DO NOT USE THESE AS AN INDEX INTO ANY ARRAY!

// TEST // STATE_TESTCREATE,		// Creation test system STATE_CREATEHERO,		// Create hero state STATE_NAMEHERO,			// Name hero state STATE_TESTPLAY,			// Play test state

// MENU // // no current substates (in this example)

//--|	// STATE FOR ALL TRANSITIONS, IGNORE THIS STATE_TRANSITION };

Note: Do not use your enum as an index into the substate array as the enums are used to distinguish which state the game is in at any moment, so they MUST be unique. The exception to this rule is obviously substates of the M_StateManager itself, which is why the enums are all above the underlying substate enums (above NUM_STATES).

-in statemanager.cpp (or in the state that is managing this state, see example2): -include the header of your newly created state -in M_StateManager::InitStates (or in YourMainState::InitStates, see example2) -add your state to the array of states, for example: pCa_SubStates_m[STATE_TYPE] = new C_SubStateName; -call InitStates if the substate is a 'Plus' state, for example: C_SubStateName* pC_newSubStateName = new C_SubStateName; pC_newSubStateName->InitStates; // call this ONLY if the state is a 'Plus' state

example) statemanager.cpp

// substates //
 * 1) include "test.h"			// C_Test
 * 2) include "menu.h"			// C_Menu

void M_StateManager::InitStates(void) {	// create the major systems' states //

pCa_SubStates_m = new C_State*[NUM_STATES]; // allocate array to known size of substates

// TEST SYSTEM // C_Test *pC_testState = new C_Test; pC_testState->InitStates; // call this ONLY if the state is a 'Plus' state pCa_SubStates_m[STATE_TEST] = pC_testState;

// MENU STATE // pCa_SubStates_m[MENU_STATE] = new C_Menu; }

example2) test.cpp

// substates //
 * 1) include "testcreate.h"		// C_TestCreate
 * 2) include "testplay.h"		// C_TestPlay

void C_Test::InitStates(void) {	pCa_SubStates_m = new C_State*[NUM_TESTSTATES]; // allocate array to known size of substates

// TEST CREATE SYSTEM // C_TestCreate *pC_testSubState = new C_TestCreate; pC_testSubState->InitStates; // call this ONLY if the sub state is a 'Plus' state pCa_SubStates_m[TESTSTATE_CREATE] = pC_testSubState;

// TEST PLAY STATE // pCa_SubStates_m[TESTSTATE_PLAY] = new C_TestPlay; }

So for example 2, in the "test.h" header, you would define a new state type enum specific to test states that will contain TESTSTATE_CREATE, TESTSTATE_PLAY and NUM_TESTSTATES at bottom. These enums will be used to index into your substate array. The state enums that you defined for these states in the normal T_State enumeration will be used just to distinquish unique states from others and to know exactly which we are in at any given point in time.

Note that also in example 2, you would be defining C_TestCreate::InitStates in testcreate.cpp, as it has it's own system of substates, meaning testcreate.h would have yet another state type enumeration table.

This is stored in AddState_ReadMe.txt and is some instructions on how to add a game state.

/***************************************************************************/ /*! @file		svnRevision.tmpl template file used by SubWCRev/RevisionUpdater tool @file		svnRevision.h autogenerated header  @author		Gene Siew @note		Copyright 2003-2009 5TH Cell Media LLC. 555 116th Ave NE #242, Bellevue, WA, 98004 All rights reserved. This software is the confidential and proprietary information of 5TH Cell Media LLC. Use and disclosure of this software and source code is limited to the conditions of the license agreement and/or confidentiality agreement you have entered into with 5TH Cell Media LLC. If you have not entered into any such agreements with 5TH Cell Media LLC for this software, you must immediately delete this software and source code. @brief Svn Revision information, the tmpl file is used to create the header. /***************************************************************************/
 * 1) ifndef SVN_REVISION
 * 2) define SVN_REVISION


 * 1) define SVN_REVISION_NUMBER $WCREV$
 * 2) define STRINGIFY(x) #x
 * 3) define TOSTRING(x) STRINGIFY(x)
 * 4) define SVN_VERSION_STR "REV. " TOSTRING(SVN_REVISION_NUMBER)


 * 1) endif

This is stored in svnRevision.tmpl and it appears to be some C code related to SVN revisions. Interestingly, the copyright goes back before Scribblenauts was released.

Choice GameLevelOver GameMainMenu GameOptions GamePause GameStart GameTitle Tally

This is stored in test.txt. Its purpose is unknown.