Difference between revisions of "0x006A"

From SimsWiki
Jump to: navigation, search
(Operand 4)
(Use: Not hurryable behavior documented)
 
(24 intermediate revisions by 8 users not shown)
Line 1: Line 1:
=Animate Sim (0x006A)=
+
{{Primitive
==The Basics==
+
|name=Animate Sim
(note: This was written by someone with the original sims 2 ONLY. I have no idea if it's any different in the expansions.)
+
|opcode=0x006A
 +
|expansion=The Sims 2
 +
}}
  
0x006A is the Animate Sim primitive BHAV. Basically, any time a sim moves, it uses this function.  
+
==Overview==
 +
This is the Animate Sim [[Primitives|primitive]]. Any time a sim moves, it uses this function.  
  
Animate Sim uses at least 12 of the 16 operands, and can use 4 (that I know of) variables from the calling BHAV as well. It must call an ANIM file, and can call another BHAV file as well. So yeah, it's fairly complex, and I'm not arrogant enough to say I understand how it works. These are some generalizations I've made from quite a few tests, and may not be correct. If they aren't, and you know it, there is an edit tab up at the top, calling you.
+
Animate Sim finds the necessary animation (stored in an ANIM resource) which is referred to by placing the name in a text string and referring to the string by number, and can also call another BHAV file as well. Then it applies any changes made in the relevant operands to the animation, and plays it. Animate Sim is a fairly complex primitive, and this article (as of now) doesn't explain it all.
  
I used SimPE to find all this, by the way. The screenshot is from SimPE, too.
+
==Use==
==The Details==
+
There is an instruction wizard for this instruction, but several parts of it don't work, so the following table details the meaning of each of the operands allowing you to edit the instruction by hand instead.
Like all BHAVs, Animate sim is called in it's own line, and is passed certain info from the operand list. Just for clarity, this is how I numbered the operands:
+
<br /><center>
+
[[Image:Opcode-definer.png|A lovely screenshot]]</center>
+
  
Animate Sim basically works like this: When called, it always finds the animation (stored in an ANIM resource) by looking in a STR# (text list) file, gets the animation name out of there, and finds the animation with the right name. Then it applies any changes made in the relevant operands to the animation, and plays it.
+
{| class="wikitable"
 
+
|-
Okay: I am not going to cover the Operands in order, because it's too much of a pain (they all interrelate so much).
+
!Operand!!Description!!colspan="2"|Operand Values
 +
|-
 +
|0 & 1||colspan="2"|Variable number used for '''Animation'''. See operand 2 - bit 3 for clarification on what it refers to.||rowspan="3"|[[Image:BHAVoperands.JPG|thumb|300px|right|Operand editing]]
 +
|-
 +
|2 - bit 1||Controls "Flip Flag"||off: False - the animation plays as normal<br>on: True - the animation is, well, flipped, along a plane dividing the sim into left and right.  The best example is the bed. If a sim gets in on one side, the animation plays normally. If the sim gets in on the other, the animation is flipped.<br>Over-riden by operand 8 - bit 1
 +
|-
 +
|2 - bit 2||Controls "Anim Speed"||off: Animation speed is contained in Operand 3<br>on:Temp 0x0002
 +
|-
 +
|2 - bit 3||Controls animation number||colspan="2"|off: Literal, operands 0 and 1 give the [[Byte Order|low and high order byte]] respectively.<br>on: Param, operands 0 and 1 give the [[Byte Order|low and high order byte]] respectively.
 +
|-
 +
|2 - bit 4||Controls "Interuptable"||colspan="2"|off: False<br>on: True
 +
|-
 +
|2 - bit 5||Controls "Start at tag"||colspan="2"|off: --<br>on:Temp 0x0000 - This forces the animation to play from a starting point mid-way through the animation. If selected, the animation will begin at the event tag referred to by the value in Temp 0x0000. Event tags are defined in the original ANIM file, and so this option will not work on all animations.
 +
|-
 +
|2 - bit 6||Controls "Trans to Idle"||colspan="2"|off: False<br>on: True
 +
|-
 +
|2 - bit 7||Controls "Blend out"||colspan="2"|off: True<br>on: False<br>i.e. opposite way around from normal
 +
|-
 +
|2 - bit 8||Controls "Blend in"||colspan="2"|off: True<br>on: False<br>i.e. opposite way around from normal
 +
|-
 +
|3||colspan="3"|'''Animation speed'''<br>This operand controls the speed of the animation. The default value is 0x20, but it can be set to anything between 0x01 and 0xFF (0x00 results in an error). Values from 0x01 to 0x7F make the animation play forward, with the higher the number, the faster the animation. HOWEVER: Values above 0x7F (or from 0x80 to 0xFF) make the animation run ''Backwards'', with larger numbers making the animation ''slower''. So 0x7F would make a fast, forward animation, and 0x80 would make a fast, backward animation. For the technically minded, this value is stored in a fixed point format (1 sign bit, 3 integer bits, 4 fractional bits). Consequently, 0x20 represents a speed multiplier of 1 (the normal rate), and 0xE0 represents a speed multiplier of -1 (normal rate played backwards). Note, that in SimPE's textual display of this operand, nothing changes the display away from ---.
 +
|-
 +
|4 & 5||colspan="3"|Event tree [[BHAV]] to run while the animation is playing, [[Byte Order|low and high order bytes]] respectively.
 +
|-
 +
|6||colspan="3"|Reference a specific '''Animation''' string set by instance ID (or specifically by the last byte of the instance ID). The choices are any of the [[STR#STR.23|String Resources]] that represent animations, for example 0x81 refers to AdultAnims (which has an instance ID of 0x00000081). More details in [[How SimAntics chooses and Animations]]. Operands 0 and 1 give the [[Byte Order|low and high order byte]] respectively of the animation string within that animation set.
 +
|-
 +
|7||The "scope" of event tree specified in operands 4 & 5||colspan="2"|00: private<br>01: semiglobal<br>02: global
 +
|-
 +
|8 - bit 1||Controls "Flip Flag"||colspan="2"|off: See operand 2 - bit 1<br>on: Temp 0x0003 - It should be noted that the global function 0x0151 loads the Sim's handedness into temp 3, so that animations with a handedness preference (i.e. - writing left or right handed) can use this flag to play the correctly flipped version of this animation.
 +
|-
 +
|8 - bit 2||Controls "Sync to last anim||colspan="2"|off: False<br>on: True
 +
|-
 +
|8 - bits 3 & 4||colspan="3"|Unused?
 +
|-
 +
|8 - bit 5||Controls "Use controlling object as anim source"||colspan="2"|off: False<br>on: True
 +
|-
 +
|8 - bit 6||Controls "Not hurryable"||colspan="2"|off: False - Animation will play about twice as fast if the Sim is in the middle of an emergency (i.e - there's a fire on the lot)<br>on: True
 +
|-
 +
|9||Plain and simple, it defines the IK (inverse kinematic) object. IK objects, as far as I understand, deal with aligning sim animations to objects. For example: when a sim opens a fridge, an IK object deals with making the sims hand grab the handle. And that's about all I know.
 +
|-
 +
|10 & 11||Yes, yet another 4-digit hexadecimal number, dealing with the IK object identifier. Since I know almost nothing about IK objects, I know nothing about the identifiers.
 +
|-
 +
|12||Priority||colspan="2"|00: low<br>01: medium<br>02: high<br>03: max - Overrides carrying animations<br>I'm assuming these priorities control what overlays and background animations are overriden by this primitive
 +
|-
 +
|13 thru 15||colspan="2"|Unused
 +
|}
  
So, we'll start with
+
==See also==
===Operand 7===
+
*[[Primitives]]
Operand 7 contains the last two digits of the instance number of the default STR# file. (the one it finds the ANIM name in)
+
*[[SimAntics]]
 
+
instance number 0x00000081 is the most commonly-used STR#. It contains all the names of the ANIMs that adults can perform relative to the object. At runtime, sims 2 looks for this STR# in the same group as the calling object; if not found there, it "fallsback" and looks in the object's semi-globals.
+
 
+
STR# instances 82 (ChildAnims), 89 (ToddlerAnims), 8A (TeenAnims), and 8B (ElderAnims) all work exactly the same way, and one needs to exist for every age group that can use the object.
+
Note: There doesn't need to be a call to Animate Sim for every age group. Animate Sim
+
will find the appropriate STR# file for the age of the sim it applies to.
+
 
+
Instance number 0x00000080 APPARENTLY looks in globals. I don't know whether it actually looks for an STR# there, or if it just looks for the ANIM matching Operands 1 & 2.
+
 
+
Instance number 84 does something really weird, too. As far as I can tell, it fallsback all the way to globals, and reads the LocoAnims text file.
+
 
+
Any other instance number (including 00), if not found in the group, fallsback to the semiglobals, and looks in the ObjectAnims STR# 86.  Obviously, object animations cannot apply to sims, and Animate Sim will throw an error and immediately stop whatever the sim was doing.
+
 
+
 
+
So: On to
+
===Operands 2 & 1===
+
 
+
Why 2 and 1? Why not 1 and 2? Because, like anything else in BHAVs, all 4 digit numbers are stored with the tens and ones first, then the thousands and hundreds.  Example: the hex number 1234 would be stored in two BHAVs as 34 12.
+
  
Anyways: Operands 2 & 1 can be two things. Either they define the line in the STR# file (defined in opcode 7) that has the desired animation's name, or they define the parameter that has the number that defines the line in the STR# file. (try saying that three times fast!)
 
  
Whether these numbers refer to the actual text line, or the parameter, depends on the next operand.
 
  
===Operand 3===
 
  
This is THE operand. It defines so much stuff it's easier if I make a graphic.
 
<br /><center>[[Image:Opcode-3.png]]</center>
 
Basically, anything highlighted in red is decided by this opcode.
 
  
 +
===Operand 2===
 
Going through them one by one....
 
Going through them one by one....
<ol>
 
<li> <u>Flipped</u>. If flipped is false, the animation plays as normal. If flipped is true, the animation is, well, flipped, along a plane dividing the sim into left and right.  The best example is the bed. If a sim gets in on one side, the animation plays normally. If the sim gets in on the other, the animation is flipped.</li>
 
<li> <u>Anim Speed in temp 2:</u>  Normally, the animation speed is contained in Operand 4 (more on this later). When this is true, however, the animation speed is called from temporary 0x0002. This is usually not useful if you're modding the original Maxis stuff, since temp 2 is often used for something else.</li>
 
<li> <u>[parameters 0x0000]</u>. As mentioned in opcodes 2 & 1, this defines whether 2&1 refer to the literal number of the needed text line, or to the parameter that contains the text line.</li>
 
<li> <u>Interruptible.</u> When true, the animation can be interrupted, and the BHAV continues on to the next line. I haven't seen this used much, probably because it only interrupts this one animation. If you cancel an action in the middle, and this is true, the animation will be stopped, but nothing else in the calling BHAV will be.</li>
 
<li> <u>Start at tag in temp 0.</u>  To be honest, I don't know. My only theory is that it might use the value in temp 0 as the starting frame of the animation. But this is just a hopeful guess; I really have no idea.</li>
 
<li> <u>Trans to idle.</u> Same as above, I have no idea. I <i>think</i> it means the animation finishes by blending the end of the animation into the idle pose, but this is only a hopeful guess.</li>
 
<li> <u>No Blend Out.</u> First, my conjectures on blending: when an animation is blended with the one before or after, Animate Sim treats them as one long animation, and meshes them together, producing a smoother overall movement. This seems to be supported by what I saw in the game, but keep in mind, I found out all this stuff by changing a file, then watching it in-game, so it could just be my eyes. But I think it is blending the animations.</li>
 
<li> <u>No Blend In.</u> Same as above. Another note: I have seen a few animations (somewhere, I lost them) that looked like blending animations. For all I know, maybe these tags refer to them.</li>
 
</ol>
 
  
 +
# '''Anim Speed in temp 2'''  Normally, the animation speed is contained in Operand 4 (more on this later). When this is true, however, the animation speed is called from temporary 0x0002. This is usually not useful if you're modding the original Maxis stuff, since temp 2 is often used for something else.
 +
# '''[parameters 0x0000]''' As mentioned in opcodes 2 & 1, this defines whether 2&1 refer to the literal number of the needed text line, or to the parameter that contains the text line.
 +
# '''Interruptible''' When true, the animation can be interrupted, and the BHAV continues on to the next line. I haven't seen this used much, probably because it only interrupts this one animation. If you cancel an action in the middle, and this is true, the animation will be stopped, but nothing else in the calling BHAV will be.
 +
# '''Start at tag in temp 0'''  This forces some animations to play from a starting point mid-way through the animation. If selected, the animation will begin at the event tag refered to by the value in temp 0. Event tags are defined in the original anim file, and so this option may not work on all animations.
 +
# '''Trans to idle''' Same as above, I have no idea. I ''think'' it means the animation finishes by blending the end of the animation into the idle pose, but this is only a hopeful guess.
 +
# '''No Blend Out''' First, my conjectures on blending: when an animation is blended with the one before or after, Animate Sim treats them as one long animation, and meshes them together, producing a smoother overall movement. This seems to be supported by what I saw in the game, but keep in mind, I found out all this stuff by changing a file, then watching it in-game, so it could just be my eyes. But I think it is blending the animations.
 +
# '''No Blend In''' Same as above. Another note: I have seen a few animations (somewhere, I lost them) that looked like blending animations. For all I know, maybe these tags refer to them.
  
So that's what they do. How they're all contained in one number is a bit complicated. Basically, 00 starts with all the above false (and reading operands 2&1 as the literal text line). Starting at the top and going down, each increment defines another permutation of the possible values. Like so:
+
 
{|
+
So that's what they do. How they're all contained is in flags, which use the binary number. In short, when this number is translated into binary, a 1 means true, a 0 means false. Using the above list, a 1 in the ones place means flipped is true. a 1 in the tens (or is it twos?) place means anim speed in temp 2 is true. And so on, throughout the list. Since that can be a bit confusing, here's a table of a few of the first values.
 +
{| class="wikitable" style="text-align:center"
 
|-
 
|-
 
! Operand
 
! Operand
Line 168: Line 188:
 
|}
 
|}
  
And so on, and so forth, throughout all the possible values from 00 to FF (can you blame me for cutting the table short?)
+
And so on, and so forth, throughout all the possible values from 00 to FF. And I know, the table is confusing too. Sorry.
 +
 
 +
===Operand 8===
 +
Operand 8 is like operand 2: it's several flags in one.
 +
 
 +
# '''Flip flag in temp 3''' This states that the flip flag can be found in temp 3 (and not in operand 3). It should be noted that the global function 0x0151 loads the sim's handedness into temp 3, so that animations with a handedness preference (ie - writing left or right handed) can use this flag to play the correctly flipped version of this animation.
 +
# '''Synch to last anim''' I ''presume'' this means to synchronize this animation with the previous one. Since most in-game objects that involve object-sim interactions have the object animation right before the sim animation, this makes sense.
 +
# '''Use controlling object as anim source''' Don't know, to be honest.
 +
# '''Not hurryable''' Also don't know.
  
Now that you're well confused, on to
+
Unfortunately, these flags aren't as simple as operand 3. Flip in temp 3 and Synch are in the expected places in the binary (bits one and two respectively),  but Anim resource is bit 16, and Not hurryable is bit 32!  This leaves two flags in the middle that don't seem to do anything. I don't know if this is just an oversight in SimPE, or an unusual anomaly in the program itself. More testing would be appreciated.
===Operand 4===
+
This operand controls the speed of the animation. The default value is 20. If set to 0 it will cause an error. Use a smaller value to make the animation run slower and a larger to make it run faster. This value will be ignored if you set operand 3 to look for the animation speed.
+
  
=See also=
+
==See also==
 
*[[Primitives]]
 
*[[Primitives]]
 
*[[SimAntics]]
 
*[[SimAntics]]
  
[[Category:Modding]]
+
[[Category:Sims 2 Modding]]
 +
[[Category:Primitives]]

Latest revision as of 22:20, 31 January 2019

Animate Sim
OpCode:0x006A
Game Version:The Sims 2


Contents

[edit] Overview

This is the Animate Sim primitive. Any time a sim moves, it uses this function.

Animate Sim finds the necessary animation (stored in an ANIM resource) which is referred to by placing the name in a text string and referring to the string by number, and can also call another BHAV file as well. Then it applies any changes made in the relevant operands to the animation, and plays it. Animate Sim is a fairly complex primitive, and this article (as of now) doesn't explain it all.

[edit] Use

There is an instruction wizard for this instruction, but several parts of it don't work, so the following table details the meaning of each of the operands allowing you to edit the instruction by hand instead.

Operand Description Operand Values
0 & 1 Variable number used for Animation. See operand 2 - bit 3 for clarification on what it refers to.
Operand editing
2 - bit 1 Controls "Flip Flag" off: False - the animation plays as normal
on: True - the animation is, well, flipped, along a plane dividing the sim into left and right. The best example is the bed. If a sim gets in on one side, the animation plays normally. If the sim gets in on the other, the animation is flipped.
Over-riden by operand 8 - bit 1
2 - bit 2 Controls "Anim Speed" off: Animation speed is contained in Operand 3
on:Temp 0x0002
2 - bit 3 Controls animation number off: Literal, operands 0 and 1 give the low and high order byte respectively.
on: Param, operands 0 and 1 give the low and high order byte respectively.
2 - bit 4 Controls "Interuptable" off: False
on: True
2 - bit 5 Controls "Start at tag" off: --
on:Temp 0x0000 - This forces the animation to play from a starting point mid-way through the animation. If selected, the animation will begin at the event tag referred to by the value in Temp 0x0000. Event tags are defined in the original ANIM file, and so this option will not work on all animations.
2 - bit 6 Controls "Trans to Idle" off: False
on: True
2 - bit 7 Controls "Blend out" off: True
on: False
i.e. opposite way around from normal
2 - bit 8 Controls "Blend in" off: True
on: False
i.e. opposite way around from normal
3 Animation speed
This operand controls the speed of the animation. The default value is 0x20, but it can be set to anything between 0x01 and 0xFF (0x00 results in an error). Values from 0x01 to 0x7F make the animation play forward, with the higher the number, the faster the animation. HOWEVER: Values above 0x7F (or from 0x80 to 0xFF) make the animation run Backwards, with larger numbers making the animation slower. So 0x7F would make a fast, forward animation, and 0x80 would make a fast, backward animation. For the technically minded, this value is stored in a fixed point format (1 sign bit, 3 integer bits, 4 fractional bits). Consequently, 0x20 represents a speed multiplier of 1 (the normal rate), and 0xE0 represents a speed multiplier of -1 (normal rate played backwards). Note, that in SimPE's textual display of this operand, nothing changes the display away from ---.
4 & 5 Event tree BHAV to run while the animation is playing, low and high order bytes respectively.
6 Reference a specific Animation string set by instance ID (or specifically by the last byte of the instance ID). The choices are any of the String Resources that represent animations, for example 0x81 refers to AdultAnims (which has an instance ID of 0x00000081). More details in How SimAntics chooses and Animations. Operands 0 and 1 give the low and high order byte respectively of the animation string within that animation set.
7 The "scope" of event tree specified in operands 4 & 5 00: private
01: semiglobal
02: global
8 - bit 1 Controls "Flip Flag" off: See operand 2 - bit 1
on: Temp 0x0003 - It should be noted that the global function 0x0151 loads the Sim's handedness into temp 3, so that animations with a handedness preference (i.e. - writing left or right handed) can use this flag to play the correctly flipped version of this animation.
8 - bit 2 Controls "Sync to last anim off: False
on: True
8 - bits 3 & 4 Unused?
8 - bit 5 Controls "Use controlling object as anim source" off: False
on: True
8 - bit 6 Controls "Not hurryable" off: False - Animation will play about twice as fast if the Sim is in the middle of an emergency (i.e - there's a fire on the lot)
on: True
9 Plain and simple, it defines the IK (inverse kinematic) object. IK objects, as far as I understand, deal with aligning sim animations to objects. For example: when a sim opens a fridge, an IK object deals with making the sims hand grab the handle. And that's about all I know.
10 & 11 Yes, yet another 4-digit hexadecimal number, dealing with the IK object identifier. Since I know almost nothing about IK objects, I know nothing about the identifiers.
12 Priority 00: low
01: medium
02: high
03: max - Overrides carrying animations
I'm assuming these priorities control what overlays and background animations are overriden by this primitive
13 thru 15 Unused

[edit] See also



[edit] Operand 2

Going through them one by one....

  1. Anim Speed in temp 2 Normally, the animation speed is contained in Operand 4 (more on this later). When this is true, however, the animation speed is called from temporary 0x0002. This is usually not useful if you're modding the original Maxis stuff, since temp 2 is often used for something else.
  2. [parameters 0x0000] As mentioned in opcodes 2 & 1, this defines whether 2&1 refer to the literal number of the needed text line, or to the parameter that contains the text line.
  3. Interruptible When true, the animation can be interrupted, and the BHAV continues on to the next line. I haven't seen this used much, probably because it only interrupts this one animation. If you cancel an action in the middle, and this is true, the animation will be stopped, but nothing else in the calling BHAV will be.
  4. Start at tag in temp 0 This forces some animations to play from a starting point mid-way through the animation. If selected, the animation will begin at the event tag refered to by the value in temp 0. Event tags are defined in the original anim file, and so this option may not work on all animations.
  5. Trans to idle Same as above, I have no idea. I think it means the animation finishes by blending the end of the animation into the idle pose, but this is only a hopeful guess.
  6. No Blend Out First, my conjectures on blending: when an animation is blended with the one before or after, Animate Sim treats them as one long animation, and meshes them together, producing a smoother overall movement. This seems to be supported by what I saw in the game, but keep in mind, I found out all this stuff by changing a file, then watching it in-game, so it could just be my eyes. But I think it is blending the animations.
  7. No Blend In Same as above. Another note: I have seen a few animations (somewhere, I lost them) that looked like blending animations. For all I know, maybe these tags refer to them.


So that's what they do. How they're all contained is in flags, which use the binary number. In short, when this number is translated into binary, a 1 means true, a 0 means false. Using the above list, a 1 in the ones place means flipped is true. a 1 in the tens (or is it twos?) place means anim speed in temp 2 is true. And so on, throughout the list. Since that can be a bit confusing, here's a table of a few of the first values.

Operand Flipped Anim speed Parameter Interruptible
00 F F F F
01 T F F F
02 F T F F
03 T T F F
04 F F T F
05 T F T F
06 F T T F
07 T T T F
08 F F F T
09 T F F T
0A F T F T
0B T T F T
0C F F T T
0D T F T T
0E F T T T
0F T T T T

And so on, and so forth, throughout all the possible values from 00 to FF. And I know, the table is confusing too. Sorry.

[edit] Operand 8

Operand 8 is like operand 2: it's several flags in one.

  1. Flip flag in temp 3 This states that the flip flag can be found in temp 3 (and not in operand 3). It should be noted that the global function 0x0151 loads the sim's handedness into temp 3, so that animations with a handedness preference (ie - writing left or right handed) can use this flag to play the correctly flipped version of this animation.
  2. Synch to last anim I presume this means to synchronize this animation with the previous one. Since most in-game objects that involve object-sim interactions have the object animation right before the sim animation, this makes sense.
  3. Use controlling object as anim source Don't know, to be honest.
  4. Not hurryable Also don't know.

Unfortunately, these flags aren't as simple as operand 3. Flip in temp 3 and Synch are in the expected places in the binary (bits one and two respectively), but Anim resource is bit 16, and Not hurryable is bit 32! This leaves two flags in the middle that don't seem to do anything. I don't know if this is just an oversight in SimPE, or an unusual anomaly in the program itself. More testing would be appreciated.

[edit] See also

Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox