summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-04-21 07:27:16 +0000
committerpeter1138 <peter1138@openttd.org>2007-04-21 07:27:16 +0000
commita112455db412179abe2bace93941ab447725db0a (patch)
tree5b5db094e6d209efdd6fdac082408c6d4169bd91 /src
parentcc001f112b1d26a536272e21a5990080f30b63b9 (diff)
downloadopenttd-a112455db412179abe2bace93941ab447725db0a.tar.xz
(svn r9707) -Codechange: Add some support for NewGRF var 7D, temporary storage array.
Diffstat (limited to 'src')
-rw-r--r--src/newgrf_spritegroup.cpp8
-rw-r--r--src/newgrf_spritegroup.h2
2 files changed, 10 insertions, 0 deletions
diff --git a/src/newgrf_spritegroup.cpp b/src/newgrf_spritegroup.cpp
index 2ee9951c4..2d12ce0c5 100644
--- a/src/newgrf_spritegroup.cpp
+++ b/src/newgrf_spritegroup.cpp
@@ -76,6 +76,8 @@ void InitializeSpriteGroupPool()
_spritegroup_count = 0;
}
+static uint32 _temp_store[0x110];
+
static inline uint32 GetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available)
{
@@ -96,6 +98,8 @@ static inline uint32 GetVariable(const ResolverObject *object, byte variable, by
case 0x1C: return object->last_value;
case 0x20: return _opt.landscape == LT_ARCTIC ? GetSnowLine() : 0xFF;
+ case 0x7D: return _temp_store[parameter];
+
/* Not a common variable, so evalute the feature specific variables */
default: return object->GetVariable(object, variable, parameter, available);
}
@@ -133,6 +137,10 @@ static U EvalAdjustT(const DeterministicSpriteGroupAdjust *adjust, U last_value,
case DSGA_OP_AND: return last_value & value;
case DSGA_OP_OR: return last_value | value;
case DSGA_OP_XOR: return last_value ^ value;
+ case DSGA_OP_STO:
+ if (value < lengthof(_temp_store)) _temp_store[value] = last_value;
+ return last_value;
+ case DSGA_OP_RST: return value;
default: return value;
}
}
diff --git a/src/newgrf_spritegroup.h b/src/newgrf_spritegroup.h
index e01bc2a9e..fc5fcb514 100644
--- a/src/newgrf_spritegroup.h
+++ b/src/newgrf_spritegroup.h
@@ -60,6 +60,8 @@ enum DeterministicSpriteGroupAdjustOperation {
DSGA_OP_AND, ///< a & b
DSGA_OP_OR, ///< a | b
DSGA_OP_XOR, ///< a ^ b
+ DSGA_OP_STO, ///< store a into temporary storage, indexed by b. return a
+ DSGA_OP_RST, ///< return b
};