1 #ifndef __XLAT_H 2 #define __XLAT_H 3 4 #include "doomtype.h" 5 #include "tarray.h" 6 7 enum ELineTransArgOp 8 { 9 ARGOP_Const, 10 ARGOP_Tag, 11 ARGOP_Expr, 12 13 TAGOP_NUMBITS = 2, 14 TAGOP_MASK = (1 << TAGOP_NUMBITS) - 1 15 }; 16 17 enum 18 { 19 LINETRANS_MAXARGS = 5, 20 LINETRANS_TAGSHIFT = 30 - LINETRANS_MAXARGS * TAGOP_NUMBITS, 21 }; 22 23 enum 24 { 25 XEXP_Const, 26 XEXP_Tag, 27 XEXP_Add, 28 XEXP_Sub, 29 XEXP_Mul, 30 XEXP_Div, 31 XEXP_Mod, 32 XEXP_And, 33 XEXP_Or, 34 XEXP_Xor, 35 XEXP_Neg, 36 37 XEXP_COUNT 38 }; 39 40 struct FLineTrans 41 { 42 int special; 43 int flags; 44 int args[5]; 45 FLineTransFLineTrans46 FLineTrans() 47 { 48 special = flags = args[0] = args[1] = args[2] = args[3] = args[4] = 0; 49 } FLineTransFLineTrans50 FLineTrans(int _special, int _flags, int arg1, int arg2, int arg3, int arg4, int arg5) 51 { 52 special = _special; 53 flags = _flags; 54 args[0] = arg1; 55 args[1] = arg2; 56 args[2] = arg3; 57 args[3] = arg4; 58 args[4] = arg5; 59 } 60 }; 61 62 63 #define MAX_BOOMISH 16 64 65 struct FBoomArg 66 { 67 bool bOrExisting; 68 bool bUseConstant; 69 BYTE ListSize; 70 BYTE ArgNum; 71 BYTE ConstantValue; 72 WORD AndValue; 73 WORD ResultFilter[15]; 74 BYTE ResultValue[15]; 75 }; 76 77 struct FBoomTranslator 78 { 79 WORD FirstLinetype; 80 WORD LastLinetype; 81 BYTE NewSpecial; 82 TArray<FBoomArg> Args; 83 } ; 84 85 struct FSectorTrans 86 { 87 int newtype; 88 bool bitmask_allowed; 89 90 FSectorTrans(int t=0, bool bitmask = false) 91 { 92 newtype = t; 93 bitmask_allowed = bitmask; 94 } 95 }; 96 97 struct FSectorMask 98 { 99 int mask; 100 int op; 101 int shift; 102 }; 103 104 struct FLineFlagTrans 105 { 106 int newvalue; 107 bool ismask; 108 }; 109 110 struct FXlatExprState 111 { 112 int linetype; 113 int tag; 114 bool bIsConstant; 115 }; 116 117 118 extern TAutoGrowArray<FLineTrans> SimpleLineTranslations; 119 extern TArray<int> XlatExpressions; 120 extern FBoomTranslator Boomish[MAX_BOOMISH]; 121 extern int NumBoomish; 122 extern TAutoGrowArray<FSectorTrans> SectorTranslations; 123 extern TArray<FSectorMask> SectorMasks; 124 extern FLineFlagTrans LineFlagTranslations[16]; 125 extern const int* (*XlatExprEval[XEXP_COUNT])(int *dest, const int *xnode, FXlatExprState *state); 126 127 #endif 128