Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Full documentation on the new changes to add new variables to the sequence in order
- to tag them for: sprite and triggery.
- isSprite()
- isTriggery()
- 1.----------------------------------------------------------------------
- The first file to change is: Engine/source/ts/tsShapeConstruct.h
- inside "enum eCommandType" locate the line
- CmdSetSequenceCyclic,
- After that line we add these new eCommandType:
- CmdSetSequenceSprite, ///irei1as_ STsequences
- CmdSetSequenceTriggery, ///irei1as_ STsequences
- 2.----------------------------------------------------------------------
- (File: Engine/source/ts/tsShapeConstruct.h)
- After the line
- bool addCmd_setSequenceCyclic( const Command& newCmd );
- We add:
- bool addCmd_setSequenceSprite( const Command& newCmd ); ///irei1as_ STsequences
- bool addCmd_setSequenceTriggery( const Command& newCmd ); ///irei1as_ STsequences
- 3.----------------------------------------------------------------------
- (File: Engine/source/ts/tsShapeConstruct.h)
- After lines
- bool getSequenceCyclic( const char* name );
- bool setSequenceCyclic( const char* name, bool cyclic );
- We add:
- bool getSequenceSprite( const char* name ); ///irei1as_ STsequences
- bool setSequenceSprite( const char* name, bool cyclic ); ///irei1as_ STsequences
- bool getSequenceTriggery( const char* name ); ///irei1as_ STsequences
- bool setSequenceTriggery( const char* name, bool cyclic ); ///irei1as_ STsequences
- 4.----------------------------------------------------------------------
- The second file to change is: Engine/source/ts/tsShapeConstruct.cpp
- Locate
- DefineTSShapeConstructorMethod( getSequenceCyclic, bool, ( const char* name ),,
- and after all its definition (after the "}}" that closes this DefineTSShapeConstructorMethod) we add:
- ///irei1as_ STsequences start "get" DefineTSShapeConstructorMethod
- DefineTSShapeConstructorMethod( getSequenceSprite, bool, ( const char* name ),,
- ( name ), false,
- "Check if this sequence is sprite (no animation interpolation).\n"
- "@param name name of the sequence to query\n"
- "@return true if this sequence is sprite, false if not\n\n"
- "@tsexample\n"
- "if ( !%this.getSequenceSprite( \"ambient\" ) )\n"
- " error( \"ambient sequence is not sprite!\" );\n"
- "@endtsexample\n" )
- {
- GET_SEQUENCE( getSequenceSprite, seq, name, false );
- return seq->isSprite();
- }}
- DefineTSShapeConstructorMethod( getSequenceTriggery, bool, ( const char* name ),,
- ( name ), false,
- "Check if this sequence has special animation Triggers.\n"
- "@param name name of the sequence to query\n"
- "@return true if this sequence has special animation Triggers, false if not\n\n"
- "@tsexample\n"
- "if ( !%this.getSequenceTriggery( \"ambient\" ) )\n"
- " error( \"ambient sequence is not checked for Triggers!\" );\n"
- "@endtsexample\n" )
- {
- GET_SEQUENCE( getSequenceTriggery, seq, name, false );
- return seq->isTriggery();
- }}
- ///irei1as_ STsequences end "get" DefineTSShapeConstructorMethod
- 5.----------------------------------------------------------------------
- (File: Engine/source/ts/tsShapeConstruct.cpp)
- Locate
- DefineTSShapeConstructorMethod( setSequenceCyclic, bool, ( const char* name, bool cyclic ),,
- and after all its definition (after the "}}" that closes this DefineTSShapeConstructorMethod) we add:
- ///irei1as_ STsequences start "set" DefineTSShapeConstructorMethod
- DefineTSShapeConstructorMethod( setSequenceSprite, bool, ( const char* name, bool sprite ),,
- ( name, sprite ), false,
- "Mark a sequence as sprite or non-sprite.\n"
- "@param name name of the sequence to modify\n"
- "@param sprite true to make the sequence sprite, false for non-sprite\n"
- "@return true if successful, false otherwise\n\n"
- "@tsexample\n"
- "%this.setSequenceSprite( \"ambient\", true );\n"
- "%this.setSequenceSprite( \"shoot\", false );\n"
- "@endtsexample\n" )
- {
- GET_SEQUENCE( setSequenceSprite, seq, name, false );
- // update sprite flag
- if (sprite != seq->isSprite())
- {
- if (sprite && !seq->isSprite())
- seq->flags |= TSShape::Sprite;
- else if (!sprite && seq->isSprite())
- seq->flags &= (~(TSShape::Sprite));
- ADD_TO_CHANGE_SET();
- }
- return true;
- }}
- DefineTSShapeConstructorMethod( setSequenceTriggery, bool, ( const char* name, bool triggery ),,
- ( name, triggery ), false,
- "Mark a sequence as triggery or non-triggery.\n"
- "@param name name of the sequence to modify\n"
- "@param triggery true to make the sequence triggery, false for non-triggery\n"
- "@return true if successful, false otherwise\n\n"
- "@tsexample\n"
- "%this.setSequenceTriggery( \"ambient\", true );\n"
- "%this.setSequenceTriggery( \"shoot\", false );\n"
- "@endtsexample\n" )
- {
- GET_SEQUENCE( setSequenceTriggery, seq, name, false );
- // update triggery flag
- if (triggery != seq->isTriggery())
- {
- if (triggery && !seq->isTriggery())
- seq->flags |= TSShape::Triggery;
- else if (!triggery && seq->isTriggery())
- seq->flags &= (~(TSShape::Triggery));
- ADD_TO_CHANGE_SET();
- }
- return true;
- }}
- ///irei1as_ STsequences end "set" DefineTSShapeConstructorMethod
- 6.----------------------------------------------------------------------
- (File: Engine/source/ts/tsShapeConstruct.cpp)
- Locate
- else RETURN_IF_MATCH(SetSequenceCyclic);
- and add these after it:
- else RETURN_IF_MATCH(SetSequenceSprite); ///irei1as_ STsequences
- else RETURN_IF_MATCH(SetSequenceTriggery); ///irei1as_ STsequences
- 7.----------------------------------------------------------------------
- (File: Engine/source/ts/tsShapeConstruct.cpp)
- Locate
- case CmdSetSequenceCyclic: addCommand = addCmd_setSequenceCyclic( cmd ); break;
- and add these after it:
- case CmdSetSequenceSprite: addCommand = addCmd_setSequenceSprite( cmd ); break; ///irei1as_ STsequences
- case CmdSetSequenceTriggery: addCommand = addCmd_setSequenceTriggery( cmd ); break; ///irei1as_ STsequences
- 8.----------------------------------------------------------------------
- (File: Engine/source/ts/tsShapeConstruct.cpp)
- Locate
- bool TSShapeConstructor::ChangeSet::addCmd_addSequence( TSShapeConstructor::ChangeSet::Command& newCmd )
- inside that look for
- case CmdSetSequenceCyclic:
- and after that add:
- case CmdSetSequenceSprite: ///irei1as_ STsequences
- case CmdSetSequenceTriggery: ///irei1as_ STsequences
- 9.----------------------------------------------------------------------
- (File: Engine/source/ts/tsShapeConstruct.cpp)
- Find
- bool TSShapeConstructor::ChangeSet::addCmd_setSequenceCyclic( const TSShapeConstructor::ChangeSet::Command& newCmd )
- and after all its definition (after the "}" that closes it) add:
- ///irei1as_ STsequences start "ChangeSet::addCmd_setSequence" TSShapeConstructor::
- bool TSShapeConstructor::ChangeSet::addCmd_setSequenceSprite( const TSShapeConstructor::ChangeSet::Command& newCmd )
- {
- // Replace any previous setSequenceSprite command, but stop if the
- // sequence is used as a source for addSequence (since the priority is
- // copied).
- for ( S32 index = mCommands.size()-1; index >= 0; index-- )
- {
- Command& cmd = mCommands[index];
- switch ( cmd.type )
- {
- case CmdSetSequenceSprite:
- if ( namesEqual( cmd.argv[0], newCmd.argv[0] ) &&
- dAtob( cmd.argv[1] ) != dAtob( newCmd.argv[1] ) )
- {
- mCommands.erase(index); // ignore both setSprite commands (1 undoes the other)
- return false;
- }
- break;
- case CmdAddSequence:
- if ( namesEqual( cmd.argv[1], newCmd.argv[0] ) )
- return true; // Sequence is used as source => cannot go back further
- break;
- default:
- break;
- }
- }
- return true;
- }
- bool TSShapeConstructor::ChangeSet::addCmd_setSequenceTriggery( const TSShapeConstructor::ChangeSet::Command& newCmd )
- {
- // Replace any previous setSequenceTriggery command, but stop if the
- // sequence is used as a source for addSequence (since the priority is
- // copied).
- for ( S32 index = mCommands.size()-1; index >= 0; index-- )
- {
- Command& cmd = mCommands[index];
- switch ( cmd.type )
- {
- case CmdSetSequenceTriggery:
- if ( namesEqual( cmd.argv[0], newCmd.argv[0] ) &&
- dAtob( cmd.argv[1] ) != dAtob( newCmd.argv[1] ) )
- {
- mCommands.erase(index); // ignore both setTriggery commands (1 undoes the other)
- return false;
- }
- break;
- case CmdAddSequence:
- if ( namesEqual( cmd.argv[1], newCmd.argv[0] ) )
- return true; // Sequence is used as source => cannot go back further
- break;
- default:
- break;
- }
- }
- return true;
- }
- ///irei1as_ STsequences end "ChangeSet::addCmd_setSequence" TSShapeConstructor::
- 10.---------------------------------------------------------------------
- (File: Engine/source/ts/tsShapeConstruct.cpp)
- Locate
- bool TSShapeConstructor::ChangeSet::addCmd_renameSequence( const TSShapeConstructor::ChangeSet::Command& newCmd )
- inside there's
- case CmdSetSequenceCyclic:
- add these lines after that:
- case CmdSetSequenceSprite: ///irei1as_ STsequences
- case CmdSetSequenceTriggery: ///irei1as_ STsequences
- 11.---------------------------------------------------------------------
- (File: Engine/source/ts/tsShapeConstruct.cpp)
- Locate
- bool TSShapeConstructor::ChangeSet::addCmd_removeSequence( const TSShapeConstructor::ChangeSet::Command& newCmd )
- inside there's
- case CmdSetSequenceCyclic:
- add these lines after that:
- case CmdSetSequenceSprite: ///irei1as_ STsequences
- case CmdSetSequenceTriggery: ///irei1as_ STsequences
- 12.---------------------------------------------------------------------
- The third file to change is: Engine/source/ts/tsShape.h
- Just after "class TSShape" There's an enum of flags BIT( x ) like
- Cyclic = BIT(4),
- After the line
- HasTranslucency= BIT(6),
- we add:
- Sprite = BIT(7), ///irei1as_ STsequences
- Triggery = BIT(8), ///irei1as_ STsequences
- 13.---------------------------------------------------------------------
- (File: Engine/source/ts/tsShape.h)
- We locate
- bool isCyclic() const { return testFlags(Cyclic); }
- and add after it:
- bool isSprite() const { return testFlags(Sprite); } ///irei1as_ STsequences
- bool isTriggery() const { return testFlags(Triggery); } ///irei1as_ STsequences
- 14.---------------------------------------------------------------------
- For completeness...
- Within the file Engine/source/ts/tsDump.cpp locate
- mShape->sequences[i].isCyclic() ? " (cyclic)" : "",
- and add after it:
- mShape->sequences[i].isSprite() ? " (sprite)" : "", ///irei1as_ STsequences
- mShape->sequences[i].isTriggery() ? " (triggery)" : "", ///irei1as_ STsequences
- 15.---------------------------------------------------------------------
- That's the end of setting the variables for C++.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement