 
General Info
Main Page
Latest News
Schedule
What is it?
About Matt
About This Site
Duke Enhancements
Latest Features
Older Features
Cheat Codes
Duke Insider
Language Basics
Compile Time
Room over Room
Player Structures
UserDef Explanations
More Information
Features Database
E Duke Forum
WW2GI Enhancements
Variables
Weapon Changes
Weapon Settings
System Variables
Events
All
|

Enhanced Duke Nukem Ideas
Copyright (C) 2000, Matt Saettler. All Rights Reserved.
Criteria:
|
| IdeaID is 110 |
| No Sorting |
Ranking |
Name |
Thinker |
500 |
Array compares, I think :) |
Veldrik |
Difficulty Not Set by Matt |
Description |
Another feature that would be really handy for us all is this (forgive my coding, I haven't writen (forgot the name) of this style of code for ages -
refering to "< | {" stuff in code, the advanced pseudo code thing).
ifvaror |value|
what this will do is something like this (you may be using return characters, but I'll use int anyway)
this uses the "var" as a reference to a location in an array of a struct which I wil ldefine so you can understand what I am getting at.
struct _user_vars {
int value; // the value in it, -32767 to 32767
char type; // type of thing it is, 0 - global, 1 - perplayer, 2 - peractor
}user_vars[32768];
int ifvaror(int numval,int var,int *value)
{
while (numval>0
{
numval--;
if(user_vars.value==value[numval])
return 1;
}
return 0;
}
What this basically does is allow the player to compare the variable with a list of values, and then if one or more of them is the same, it returns true.
You can probably do a smiliar thing for a NOR instead of OR, or maybe a NAND. Just by making it return true if any of them are NOT EQUAL to it
if(user_vars.value!=value[numval])
I should have given an example before of the following (ifvaror)
I have moved word wrap so it shouldn't garble the code
define WOD1_TEXTURE 749
define WOD2_TEXTURE 902
define WOD3_TEXTURE 903
define WOD4_TEXTURE 1025
define LEA1_TEXTURE 803
define LEA2_TEXTURE 804
define GRA1_TEXTURE 1219
define GRA2_TEXTURE 3005
define GRA3_TEXTURE 3006
define RUG1_TEXTURE 706
define RUG2_TEXTURE 890
define RUG3_TEXTURE 899
define MET1_TEXTURE 350
define MET2_TEXTURE 472
define MET3_TEXTURE 578
define MET4_TEXTURE 4276
define MET5_TEXTURE 4277
state foot_fall
gettexturefloor
ifvare TEXTURE WOD1_TEXTURE sound FOOT_FALL_WOOD
else ifvare TEXTURE WOD2_TEXTURE sound FOOT_FALL_WOOD
else ifvare TEXTURE WOD3_TEXTURE sound FOOT_FALL_WOOD
else ifvare TEXTURE WOD4_TEXTURE sound FOOT_FALL_WOOD
else ifvare TEXTURE MET1_TEXTURE sound FOOT_PACE_METAL
else ifvare TEXTURE MET2_TEXTURE sound FOOT_PACE_METAL
else ifvare TEXTURE MET3_TEXTURE sound FOOT_PACE_METAL
else ifvare TEXTURE MET4_TEXTURE sound FOOT_PACE_METAL
else ifvare TEXTURE GRA1_TEXTURE sound FOOT_FALL_GRASS
else ifvare TEXTURE GRA2_TEXTURE sound FOOT_FALL_GRASS
else ifvare TEXTURE GRA3_TEXTURE sound FOOT_FALL_GRASS
else ifvare TEXTURE LEA1_TEXTURE sound FOOT_FALL_LEAVES
else ifvare TEXTURE LEA2_TEXTURE sound FOOT_FALL_LEAVES
else ifvare TEXTURE RUG1_TEXTURE sound FOOT_FALL_PADDED
else ifvare TEXTURE RUG2_TEXTURE sound FOOT_FALL_PADDED
else ifvare TEXTURE RUG3_TEXTURE sound FOOT_FALL_PADDED
else sound FOOT_FALL_SOLID
ends
instead of this, we could cut it down to
state foot_fall
gettexturefloor
ifvaror 4 TEXTURE WOD1_TEXTURE WOD2_TEXTURE WOD3_TEXTURE WOD4_TEXTURE sound FOOT_FALL_WOOD
else ifvaror 4 TEXTURE MET1_TEXTURE MET2_TEXTURE MET3_TEXTURE MET4_TEXTURE sound FOOT_FALL_METAL
else ifvaror 3 TEXTURE GRA1_TEXTURE GRA2_TEXTURE GRA3_TEXTURE sound FOOT_FALL_GRASS
else ifvaror 2 TEXTURE LEA1_TEXTURE LEA2_TEXTURE sound FOOT_FALL_LEAVES
else ifvaror 3 TEXTURE RUG1_TEXTURE RUG2_TEXTURE RUG3_TEXTURE sound FOOT_FALL_PADDED
else sound FOOT_FALL_SOLID
ends
The first paramater might just make it easier for the compiler to read in
the script, incase some moron added "sound" or some other statement to
the define list. This way the program knows exactly how many of the
paramters to read in.
Oh yeah, the last email shoud have been ifvarnor, not ifvarnand for the
additional function. |
Matt's Comments |
|
|