summaryrefslogtreecommitdiff
path: root/sprite.c
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2004-11-14 20:53:34 +0000
committerdarkvater <darkvater@openttd.org>2004-11-14 20:53:34 +0000
commit051e094921f208f48f3239622f96078c528ef734 (patch)
tree59aacf7c4093a50c5115327628415a4024e35a21 /sprite.c
parentec434b208e6e67f98f7795f1a9d6154df888c6b2 (diff)
downloadopenttd-051e094921f208f48f3239622f96078c528ef734.tar.xz
(svn r611) -newgrf: Change GetCustomEngineSprite() calling convention (invisible to users of GetCustomVehicle*() wrappers). Needed for deterministic spritegroups support (pasky).
Diffstat (limited to 'sprite.c')
-rw-r--r--sprite.c124
1 files changed, 62 insertions, 62 deletions
diff --git a/sprite.c b/sprite.c
index f0a130d4e..23a21f1b1 100644
--- a/sprite.c
+++ b/sprite.c
@@ -1,62 +1,62 @@
-#include "stdafx.h"
-
-#include <stdarg.h>
-
-#include "ttd.h"
-#include "sprite.h"
-
-
-struct SpriteGroup *EvalDeterministicSpriteGroup(struct DeterministicSpriteGroup *dsg, int value)
-{
- int i;
-
- value >>= dsg->shift_num; // This should bring us to the byte range.
- value &= dsg->and_mask;
-
- if (dsg->operation != DSG_OP_NONE)
- value += (signed char) dsg->add_val;
-
- switch (dsg->operation) {
- case DSG_OP_DIV:
- value /= (signed char) dsg->divmod_val;
- break;
- case DSG_OP_MOD:
- value %= (signed char) dsg->divmod_val;
- break;
- case DSG_OP_NONE:
- break;
- }
-
- for (i = 0; i < dsg->num_ranges; i++) {
- struct DeterministicSpriteGroupRange *range = &dsg->ranges[i];
-
- if (range->low <= value && value <= range->high)
- return &range->group;
- }
-
- return dsg->default_group;
-}
-
-int GetDeterministicSpriteValue(byte var)
-{
- switch (var) {
- case 0x00:
- return _date;
- case 0x01:
- return _cur_year;
- case 0x02:
- return _cur_month;
- case 0x03:
- return _opt.landscape;
- case 0x09:
- return _date_fract;
- case 0x0A:
- return _tick_counter;
- case 0x0C:
- /* If we got here, it means there was no callback or
- * callbacks aren't supported on our callpath. */
- return 0;
- default:
- return -1;
- }
-}
+#include "stdafx.h"
+
+#include <stdarg.h>
+
+#include "ttd.h"
+#include "sprite.h"
+
+
+struct SpriteGroup *EvalDeterministicSpriteGroup(struct DeterministicSpriteGroup *dsg, int value)
+{
+ int i;
+
+ value >>= dsg->shift_num; // This should bring us to the byte range.
+ value &= dsg->and_mask;
+
+ if (dsg->operation != DSG_OP_NONE)
+ value += (signed char) dsg->add_val;
+
+ switch (dsg->operation) {
+ case DSG_OP_DIV:
+ value /= (signed char) dsg->divmod_val;
+ break;
+ case DSG_OP_MOD:
+ value %= (signed char) dsg->divmod_val;
+ break;
+ case DSG_OP_NONE:
+ break;
+ }
+
+ for (i = 0; i < dsg->num_ranges; i++) {
+ struct DeterministicSpriteGroupRange *range = &dsg->ranges[i];
+
+ if (range->low <= value && value <= range->high)
+ return &range->group;
+ }
+
+ return dsg->default_group;
+}
+
+int GetDeterministicSpriteValue(byte var)
+{
+ switch (var) {
+ case 0x00:
+ return _date;
+ case 0x01:
+ return _cur_year;
+ case 0x02:
+ return _cur_month;
+ case 0x03:
+ return _opt.landscape;
+ case 0x09:
+ return _date_fract;
+ case 0x0A:
+ return _tick_counter;
+ case 0x0C:
+ /* If we got here, it means there was no callback or
+ * callbacks aren't supported on our callpath. */
+ return 0;
+ default:
+ return -1;
+ }
+}