Guest User

st_1 doc ST_ variables c++.txt

a guest
May 9th, 2015
299
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Full documentation on the new changes to add new variables to the sequence in order
  2. to tag them for: sprite and triggery.
  3.  
  4. isSprite()
  5. isTriggery()
  6.  
  7. 1.----------------------------------------------------------------------
  8. The first file to change is: Engine/source/ts/tsShapeConstruct.h
  9. inside "enum eCommandType" locate the line
  10. CmdSetSequenceCyclic,
  11. After that line we add these new eCommandType:
  12.  
  13. CmdSetSequenceSprite, ///irei1as_ STsequences
  14. CmdSetSequenceTriggery, ///irei1as_ STsequences
  15.  
  16. 2.----------------------------------------------------------------------
  17. (File: Engine/source/ts/tsShapeConstruct.h)
  18. After the line
  19. bool addCmd_setSequenceCyclic( const Command& newCmd );
  20. We add:
  21.  
  22. bool addCmd_setSequenceSprite( const Command& newCmd ); ///irei1as_ STsequences
  23. bool addCmd_setSequenceTriggery( const Command& newCmd ); ///irei1as_ STsequences
  24.  
  25. 3.----------------------------------------------------------------------
  26. (File: Engine/source/ts/tsShapeConstruct.h)
  27. After lines
  28. bool getSequenceCyclic( const char* name );
  29. bool setSequenceCyclic( const char* name, bool cyclic );
  30. We add:
  31.  
  32. bool getSequenceSprite( const char* name ); ///irei1as_ STsequences
  33. bool setSequenceSprite( const char* name, bool cyclic ); ///irei1as_ STsequences
  34. bool getSequenceTriggery( const char* name ); ///irei1as_ STsequences
  35. bool setSequenceTriggery( const char* name, bool cyclic ); ///irei1as_ STsequences
  36.  
  37.  
  38.  
  39.  
  40. 4.----------------------------------------------------------------------
  41. The second file to change is: Engine/source/ts/tsShapeConstruct.cpp
  42. Locate
  43. DefineTSShapeConstructorMethod( getSequenceCyclic, bool, ( const char* name ),,
  44. and after all its definition (after the "}}" that closes this DefineTSShapeConstructorMethod) we add:
  45.  
  46. ///irei1as_ STsequences start "get" DefineTSShapeConstructorMethod
  47. DefineTSShapeConstructorMethod( getSequenceSprite, bool, ( const char* name ),,
  48. ( name ), false,
  49. "Check if this sequence is sprite (no animation interpolation).\n"
  50. "@param name name of the sequence to query\n"
  51. "@return true if this sequence is sprite, false if not\n\n"
  52. "@tsexample\n"
  53. "if ( !%this.getSequenceSprite( \"ambient\" ) )\n"
  54. " error( \"ambient sequence is not sprite!\" );\n"
  55. "@endtsexample\n" )
  56. {
  57. GET_SEQUENCE( getSequenceSprite, seq, name, false );
  58. return seq->isSprite();
  59. }}
  60. DefineTSShapeConstructorMethod( getSequenceTriggery, bool, ( const char* name ),,
  61. ( name ), false,
  62. "Check if this sequence has special animation Triggers.\n"
  63. "@param name name of the sequence to query\n"
  64. "@return true if this sequence has special animation Triggers, false if not\n\n"
  65. "@tsexample\n"
  66. "if ( !%this.getSequenceTriggery( \"ambient\" ) )\n"
  67. " error( \"ambient sequence is not checked for Triggers!\" );\n"
  68. "@endtsexample\n" )
  69. {
  70. GET_SEQUENCE( getSequenceTriggery, seq, name, false );
  71. return seq->isTriggery();
  72. }}
  73. ///irei1as_ STsequences end "get" DefineTSShapeConstructorMethod
  74.  
  75. 5.----------------------------------------------------------------------
  76. (File: Engine/source/ts/tsShapeConstruct.cpp)
  77. Locate
  78. DefineTSShapeConstructorMethod( setSequenceCyclic, bool, ( const char* name, bool cyclic ),,
  79. and after all its definition (after the "}}" that closes this DefineTSShapeConstructorMethod) we add:
  80.  
  81. ///irei1as_ STsequences start "set" DefineTSShapeConstructorMethod
  82. DefineTSShapeConstructorMethod( setSequenceSprite, bool, ( const char* name, bool sprite ),,
  83. ( name, sprite ), false,
  84. "Mark a sequence as sprite or non-sprite.\n"
  85. "@param name name of the sequence to modify\n"
  86. "@param sprite true to make the sequence sprite, false for non-sprite\n"
  87. "@return true if successful, false otherwise\n\n"
  88. "@tsexample\n"
  89. "%this.setSequenceSprite( \"ambient\", true );\n"
  90. "%this.setSequenceSprite( \"shoot\", false );\n"
  91. "@endtsexample\n" )
  92. {
  93. GET_SEQUENCE( setSequenceSprite, seq, name, false );
  94.  
  95. // update sprite flag
  96. if (sprite != seq->isSprite())
  97. {
  98. if (sprite && !seq->isSprite())
  99. seq->flags |= TSShape::Sprite;
  100. else if (!sprite && seq->isSprite())
  101. seq->flags &= (~(TSShape::Sprite));
  102.  
  103. ADD_TO_CHANGE_SET();
  104. }
  105. return true;
  106. }}
  107. DefineTSShapeConstructorMethod( setSequenceTriggery, bool, ( const char* name, bool triggery ),,
  108. ( name, triggery ), false,
  109. "Mark a sequence as triggery or non-triggery.\n"
  110. "@param name name of the sequence to modify\n"
  111. "@param triggery true to make the sequence triggery, false for non-triggery\n"
  112. "@return true if successful, false otherwise\n\n"
  113. "@tsexample\n"
  114. "%this.setSequenceTriggery( \"ambient\", true );\n"
  115. "%this.setSequenceTriggery( \"shoot\", false );\n"
  116. "@endtsexample\n" )
  117. {
  118. GET_SEQUENCE( setSequenceTriggery, seq, name, false );
  119.  
  120. // update triggery flag
  121. if (triggery != seq->isTriggery())
  122. {
  123. if (triggery && !seq->isTriggery())
  124. seq->flags |= TSShape::Triggery;
  125. else if (!triggery && seq->isTriggery())
  126. seq->flags &= (~(TSShape::Triggery));
  127.  
  128. ADD_TO_CHANGE_SET();
  129. }
  130. return true;
  131. }}
  132. ///irei1as_ STsequences end "set" DefineTSShapeConstructorMethod
  133.  
  134. 6.----------------------------------------------------------------------
  135. (File: Engine/source/ts/tsShapeConstruct.cpp)
  136. Locate
  137. else RETURN_IF_MATCH(SetSequenceCyclic);
  138. and add these after it:
  139.  
  140. else RETURN_IF_MATCH(SetSequenceSprite); ///irei1as_ STsequences
  141. else RETURN_IF_MATCH(SetSequenceTriggery); ///irei1as_ STsequences
  142.  
  143. 7.----------------------------------------------------------------------
  144. (File: Engine/source/ts/tsShapeConstruct.cpp)
  145. Locate
  146. case CmdSetSequenceCyclic: addCommand = addCmd_setSequenceCyclic( cmd ); break;
  147. and add these after it:
  148.  
  149. case CmdSetSequenceSprite: addCommand = addCmd_setSequenceSprite( cmd ); break; ///irei1as_ STsequences
  150. case CmdSetSequenceTriggery: addCommand = addCmd_setSequenceTriggery( cmd ); break; ///irei1as_ STsequences
  151.  
  152. 8.----------------------------------------------------------------------
  153. (File: Engine/source/ts/tsShapeConstruct.cpp)
  154. Locate
  155. bool TSShapeConstructor::ChangeSet::addCmd_addSequence( TSShapeConstructor::ChangeSet::Command& newCmd )
  156. inside that look for
  157. case CmdSetSequenceCyclic:
  158. and after that add:
  159.  
  160. case CmdSetSequenceSprite: ///irei1as_ STsequences
  161. case CmdSetSequenceTriggery: ///irei1as_ STsequences
  162.  
  163. 9.----------------------------------------------------------------------
  164. (File: Engine/source/ts/tsShapeConstruct.cpp)
  165. Find
  166. bool TSShapeConstructor::ChangeSet::addCmd_setSequenceCyclic( const TSShapeConstructor::ChangeSet::Command& newCmd )
  167. and after all its definition (after the "}" that closes it) add:
  168.  
  169. ///irei1as_ STsequences start "ChangeSet::addCmd_setSequence" TSShapeConstructor::
  170. bool TSShapeConstructor::ChangeSet::addCmd_setSequenceSprite( const TSShapeConstructor::ChangeSet::Command& newCmd )
  171. {
  172. // Replace any previous setSequenceSprite command, but stop if the
  173. // sequence is used as a source for addSequence (since the priority is
  174. // copied).
  175.  
  176. for ( S32 index = mCommands.size()-1; index >= 0; index-- )
  177. {
  178. Command& cmd = mCommands[index];
  179. switch ( cmd.type )
  180. {
  181. case CmdSetSequenceSprite:
  182. if ( namesEqual( cmd.argv[0], newCmd.argv[0] ) &&
  183. dAtob( cmd.argv[1] ) != dAtob( newCmd.argv[1] ) )
  184. {
  185. mCommands.erase(index); // ignore both setSprite commands (1 undoes the other)
  186. return false;
  187. }
  188. break;
  189.  
  190. case CmdAddSequence:
  191. if ( namesEqual( cmd.argv[1], newCmd.argv[0] ) )
  192. return true; // Sequence is used as source => cannot go back further
  193. break;
  194.  
  195. default:
  196. break;
  197. }
  198. }
  199.  
  200. return true;
  201. }
  202. bool TSShapeConstructor::ChangeSet::addCmd_setSequenceTriggery( const TSShapeConstructor::ChangeSet::Command& newCmd )
  203. {
  204. // Replace any previous setSequenceTriggery command, but stop if the
  205. // sequence is used as a source for addSequence (since the priority is
  206. // copied).
  207.  
  208. for ( S32 index = mCommands.size()-1; index >= 0; index-- )
  209. {
  210. Command& cmd = mCommands[index];
  211. switch ( cmd.type )
  212. {
  213. case CmdSetSequenceTriggery:
  214. if ( namesEqual( cmd.argv[0], newCmd.argv[0] ) &&
  215. dAtob( cmd.argv[1] ) != dAtob( newCmd.argv[1] ) )
  216. {
  217. mCommands.erase(index); // ignore both setTriggery commands (1 undoes the other)
  218. return false;
  219. }
  220. break;
  221.  
  222. case CmdAddSequence:
  223. if ( namesEqual( cmd.argv[1], newCmd.argv[0] ) )
  224. return true; // Sequence is used as source => cannot go back further
  225. break;
  226.  
  227. default:
  228. break;
  229. }
  230. }
  231.  
  232. return true;
  233. }
  234. ///irei1as_ STsequences end "ChangeSet::addCmd_setSequence" TSShapeConstructor::
  235.  
  236. 10.---------------------------------------------------------------------
  237. (File: Engine/source/ts/tsShapeConstruct.cpp)
  238. Locate
  239. bool TSShapeConstructor::ChangeSet::addCmd_renameSequence( const TSShapeConstructor::ChangeSet::Command& newCmd )
  240. inside there's
  241. case CmdSetSequenceCyclic:
  242. add these lines after that:
  243.  
  244. case CmdSetSequenceSprite: ///irei1as_ STsequences
  245. case CmdSetSequenceTriggery: ///irei1as_ STsequences
  246.  
  247. 11.---------------------------------------------------------------------
  248. (File: Engine/source/ts/tsShapeConstruct.cpp)
  249. Locate
  250. bool TSShapeConstructor::ChangeSet::addCmd_removeSequence( const TSShapeConstructor::ChangeSet::Command& newCmd )
  251. inside there's
  252. case CmdSetSequenceCyclic:
  253. add these lines after that:
  254.  
  255. case CmdSetSequenceSprite: ///irei1as_ STsequences
  256. case CmdSetSequenceTriggery: ///irei1as_ STsequences
  257.  
  258. 12.---------------------------------------------------------------------
  259. The third file to change is: Engine/source/ts/tsShape.h
  260. Just after "class TSShape" There's an enum of flags BIT( x ) like
  261. Cyclic = BIT(4),
  262. After the line
  263. HasTranslucency= BIT(6),
  264. we add:
  265.  
  266. Sprite = BIT(7), ///irei1as_ STsequences
  267. Triggery = BIT(8), ///irei1as_ STsequences
  268.  
  269. 13.---------------------------------------------------------------------
  270. (File: Engine/source/ts/tsShape.h)
  271. We locate
  272. bool isCyclic() const { return testFlags(Cyclic); }
  273. and add after it:
  274.  
  275. bool isSprite() const { return testFlags(Sprite); } ///irei1as_ STsequences
  276. bool isTriggery() const { return testFlags(Triggery); } ///irei1as_ STsequences
  277.  
  278. 14.---------------------------------------------------------------------
  279. For completeness...
  280. Within the file Engine/source/ts/tsDump.cpp locate
  281. mShape->sequences[i].isCyclic() ? " (cyclic)" : "",
  282. and add after it:
  283.  
  284. mShape->sequences[i].isSprite() ? " (sprite)" : "", ///irei1as_ STsequences
  285. mShape->sequences[i].isTriggery() ? " (triggery)" : "", ///irei1as_ STsequences
  286.  
  287. 15.---------------------------------------------------------------------
  288. That's the end of setting the variables for C++.
RAW Paste Data