diff options
author | peter1138 <peter1138@openttd.org> | 2006-05-04 03:38:09 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2006-05-04 03:38:09 +0000 |
commit | c768bfbba59b70ffb73fc5c5879a933609f0ae8c (patch) | |
tree | 18fde53cbbcff832e6c0a662792c99e13e6c25a2 | |
parent | ac18c6063aa04843848097a73bccd6f11354edef (diff) | |
download | openttd-c768bfbba59b70ffb73fc5c5879a933609f0ae8c.tar.xz |
(svn r4733) - NewGRF: remove remnants of old resolver code.
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | sprite.c | 99 | ||||
-rw-r--r-- | sprite.h | 16 |
3 files changed, 0 insertions, 116 deletions
@@ -669,7 +669,6 @@ SRCS += ship_gui.c SRCS += signs.c SRCS += smallmap_gui.c SRCS += sound.c -SRCS += sprite.c SRCS += spritecache.c SRCS += station_cmd.c SRCS += station_gui.c diff --git a/sprite.c b/sprite.c deleted file mode 100644 index c22489830..000000000 --- a/sprite.c +++ /dev/null @@ -1,99 +0,0 @@ -/* $Id$ */ - -#include "stdafx.h" -#include "openttd.h" -#include "sprite.h" -#include "variables.h" -#include "debug.h" - - -SpriteGroup *EvalDeterministicSpriteGroup(const DeterministicSpriteGroup *dsg, int value) -{ - int i; - - value >>= dsg->adjusts[0].shift_num; // This should bring us to the byte range. - value &= dsg->adjusts[0].and_mask; - - if (dsg->adjusts[0].operation != DSGA_TYPE_NONE) - value += (signed char) dsg->adjusts[0].add_val; - - switch (dsg->adjusts[0].type) { - case DSGA_TYPE_DIV: - value /= (signed char) dsg->adjusts[0].divmod_val; - break; - case DSGA_TYPE_MOD: - value %= (signed char) dsg->adjusts[0].divmod_val; - break; - case DSGA_TYPE_NONE: - break; - } - - for (i = 0; i < dsg->num_ranges; i++) { - DeterministicSpriteGroupRange *range = &dsg->ranges[i]; - - if (range->low <= (uint32)value && (uint32)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; - } -} - -SpriteGroup *EvalRandomizedSpriteGroup(const RandomizedSpriteGroup *rsg, byte random_bits) -{ - byte mask; - byte index; - - /* Noone likes mangling with bits, but you don't get around it here. - * Sorry. --pasky */ - // rsg->num_groups is always power of 2 - mask = (rsg->num_groups - 1) << rsg->lowest_randbit; - index = (random_bits & mask) >> rsg->lowest_randbit; - assert(index < rsg->num_groups); - return rsg->groups[index]; -} - -byte RandomizedSpriteGroupTriggeredBits(const RandomizedSpriteGroup *rsg, - byte triggers, byte *waiting_triggers) -{ - byte match = rsg->triggers & (*waiting_triggers | triggers); - bool res; - - if (rsg->cmp_mode == RSG_CMP_ANY) { - res = (match != 0); - } else { /* RSG_CMP_ALL */ - res = (match == rsg->triggers); - } - - if (!res) { - *waiting_triggers |= triggers; - return 0; - } - - *waiting_triggers &= ~match; - - return (rsg->num_groups - 1) << rsg->lowest_randbit; -} @@ -45,20 +45,4 @@ typedef struct DrawBuildingsTileStruct { #include "newgrf_spritegroup.h" -/* This takes value (probably of the variable specified in the group) and - * chooses corresponding SpriteGroup accordingly to the given - * DeterministicSpriteGroup. */ -SpriteGroup *EvalDeterministicSpriteGroup(const DeterministicSpriteGroup *dsg, int value); -/* Get value of a common deterministic SpriteGroup variable. */ -int GetDeterministicSpriteValue(byte var); - -/* This takes randomized bitmask (probably associated with - * vehicle/station/whatever) and chooses corresponding SpriteGroup - * accordingly to the given RandomizedSpriteGroup. */ -SpriteGroup *EvalRandomizedSpriteGroup(const RandomizedSpriteGroup *rsg, byte random_bits); -/* Triggers given RandomizedSpriteGroup with given bitmask and returns and-mask - * of random bits to be reseeded, or zero if there were no triggers matched - * (then they are |ed to @waiting_triggers instead). */ -byte RandomizedSpriteGroupTriggeredBits(const RandomizedSpriteGroup *rsg, byte triggers, byte *waiting_triggers); - #endif /* SPRITE_H */ |