This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| functions:packshorts [2017/03/19 16:09] – created korshun | functions:packshorts [2017/04/17 17:48] (current) – korshun | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| ===== Description ===== | ===== Description ===== | ||
| - | Packs two short integers (-32768 to 32767) into one integer and returns the result. The short integers must be in the [-32768, 32767] range. | + | Packs two short integers (-32768 to 32767) into one integer and returns the result. |
| - | The packed values can be retrieved using [[UnpackShorts]]. | + | The packed values can be retrieved using [[UnpackShortX]]. |
| <note tip> | <note tip> | ||
| Line 17: | Line 17: | ||
| ===== Examples ===== | ===== Examples ===== | ||
| < | < | ||
| - | // Pack rounded 2D actor positioninto a single integer. | ||
| int packed = PackShorts(12345, | int packed = PackShorts(12345, | ||
| UnpackShort1(packed) -> 12345 | UnpackShort1(packed) -> 12345 | ||
| Line 29: | Line 28: | ||
| // Pack rounded 2D actor position into a single integer. | // Pack rounded 2D actor position into a single integer. | ||
| int pos = PackShorts(GetActorX(0)>> | int pos = PackShorts(GetActorX(0)>> | ||
| - | ACS_ExecuteAlways(somescript, | + | ACS_ExecuteAlways(somescript, |
| } | } | ||
| - | script somescript (int stuff, int stuff, int pos) | + | script somescript (int stuff1, int stuff2, int pos) |
| { | { | ||
| // Extract actor position | // Extract actor position | ||