Difference between revisions of "Menu Asset (MW3)"

From COD Engine Research
Jump to: navigation, search
m
Line 268: Line 268:
 
   int speed;
 
   int speed;
 
   int spacing;
 
   int spacing;
 +
};
 +
 +
struct textScrollDef_s
 +
{
 +
  int startTime;
 
};
 
};
  

Revision as of 19:45, 6 January 2015

Notice Ghosts didn't change a single thing in this asset because Ghosts uses LuaFiles for it's menus now and so this is basically an unused asset now.

struct MenuEventHandlerSet;
struct Statement_s;
 
struct UIFunctionList
{
  int totalFunctions;
  Statement_s **functions;
};
 
struct StaticDvar
{
  dvar_t *dvar;
  char *dvarName;
};
 
struct StaticDvarList
{
  int numStaticDvars;
  StaticDvar **staticDvars;
};
 
struct StringList
{
  int totalStrings;
  const char **strings;
};
 
struct ExpressionSupportingData
{
  UIFunctionList uifunctions;
  StaticDvarList staticDvarList;
  StringList uiStrings;
};
 
enum expDataType
{
  VAL_INT = 0x0,
  VAL_FLOAT = 0x1,
  VAL_STRING = 0x2,
  NUM_INTERNAL_DATATYPES = 0x3,
  VAL_FUNCTION = 0x3,
  NUM_DATATYPES = 0x4,
};
 
struct ExpressionString
{
  const char *string;
};
 
union operandInternalDataUnion
{
  int intVal;
  float floatVal;
  ExpressionString stringVal;
  Statement_s *function;
};
 
struct Operand
{
  operandInternalDataUnion internals;
  expDataType dataType;
};
 
union entryInternalData
{
  operationEnum op;
  Operand operand;
};
 
// TODO: something is different
struct expressionEntry
{
  int type;
  entryInternalData data;
};
 
struct ExpressionPersistentState
{
  int flags;
  int playerDataKey[4];
  int lastExecuteTime[4];
  Operand lastResult[4];
};
 
struct Statement_s
{
  int numEntries;
  expressionEntry *entries;
  ExpressionSupportingData *supportingData;
  ExpressionPersistentState persistentState;
};
 
struct SetLocalVarData
{
  const char *localVarName;
  Statement_s *expression;
};
 
struct ConditionalScript
{
  MenuEventHandlerSet *eventHandlerSet;
  Statement_s *eventExpression; // loads this first
};
 
union EventData
{
  const char *unconditionalScript;
  ConditionalScript *conditionalScript;
  MenuEventHandlerSet *elseScript;
  SetLocalVarData *setLocalVarData;
};
 
#pragma pack(push, 4)
struct MenuEventHandler
{
  EventData eventData;
  char eventType;
};
#pragma pack(pop)
 
struct MenuEventHandlerSet
{
  int eventHandlerCount;
  MenuEventHandler **eventHandlers;
}
 
struct ItemKeyHandler
{
  int key;
  MenuEventHandlerSet *action;
  ItemKeyHandler *next;
};
 
#pragma pack(push, 4)
struct rectDef_s
{
  float x;
  float y;
  float w;
  float h;
  char horzAlign;
  char vertAlign;
};
#pragma pack(pop)
 
// sizeof = 0xB0
struct windowDef_t
{
  const char *name;
  rectDef_s rect;
  rectDef_s rectClient;
  const char *group;
  int style;
  int border;
  int ownerDraw;
  int ownerDrawFlags;
  float borderSize;
  int staticFlags;
#ifdef PC
  int dynamicFlags[1];
#else
  int dynamicFlags[4];
#endif
  int nextTime;
  float foreColor[4];
  float backColor[4];
  float borderColor[4];
  float outlineColor[4];
  float disableColor[4];
  Material *background;
};
 
enum ItemFloatExpressionTarget
{
  ITEM_FLOATEXP_TGT_RECT_X = 0x0,
  ITEM_FLOATEXP_TGT_RECT_Y = 0x1,
  ITEM_FLOATEXP_TGT_RECT_W = 0x2,
  ITEM_FLOATEXP_TGT_RECT_H = 0x3,
  ITEM_FLOATEXP_TGT_FORECOLOR_R = 0x4,
  ITEM_FLOATEXP_TGT_FORECOLOR_G = 0x5,
  ITEM_FLOATEXP_TGT_FORECOLOR_B = 0x6,
  ITEM_FLOATEXP_TGT_FORECOLOR_RGB = 0x7,
  ITEM_FLOATEXP_TGT_FORECOLOR_A = 0x8,
  ITEM_FLOATEXP_TGT_GLOWCOLOR_R = 0x9,
  ITEM_FLOATEXP_TGT_GLOWCOLOR_G = 0xA,
  ITEM_FLOATEXP_TGT_GLOWCOLOR_B = 0xB,
  ITEM_FLOATEXP_TGT_GLOWCOLOR_RGB = 0xC,
  ITEM_FLOATEXP_TGT_GLOWCOLOR_A = 0xD,
  ITEM_FLOATEXP_TGT_BACKCOLOR_R = 0xE,
  ITEM_FLOATEXP_TGT_BACKCOLOR_G = 0xF,
  ITEM_FLOATEXP_TGT_BACKCOLOR_B = 0x10,
  ITEM_FLOATEXP_TGT_BACKCOLOR_RGB = 0x11,
  ITEM_FLOATEXP_TGT_BACKCOLOR_A = 0x12,
  ITEM_FLOATEXP_TGT__COUNT = 0x13,
};
 
struct ItemFloatExpression
{
  ItemFloatExpressionTarget target;
  Statement_s *expression;
};
 
struct editFieldDef_s
{
  float minVal;
  float maxVal;
  float stepVal;
  float range;
  int maxChars;
  int maxCharsGotoNext;
  int maxPaintChars;
  int paintOffset;
};
 
struct multiDef_s
{
  const char *dvarList[32];
  const char *dvarStr[32];
  float dvarValue[32];
  int count;
  int strDef;
};
 
struct columnInfo_s
{
  int xpos;
  int ypos;
  int width;
  int height;
  int maxChars;
  int alignment;
};
 
// TODO: 4 bytes missing somewhere
struct listBoxDef_s
{
#ifdef PC
  int startPos[1];
  int endPos[1];
#else
  int startPos[4];
  int endPos[4];
#endif
  int drawPadding;
  float elementWidth;
  float elementHeight;
  int elementStyle;
  int numColumns;
  columnInfo_s columnInfo[16];
  MenuEventHandlerSet *onDoubleClick;
  int notselectable;
  int noScrollBars;
  int usePaging;
  float selectBorder[4];
  Material *selectIcon;
  Statement_s *elementHeightExp;
};
 
struct newsTickerDef_s
{
  int feedId;
  int speed;
  int spacing;
};
 
struct textScrollDef_s
{
  int startTime;
};
 
union itemDefData_t
{
  listBoxDef_s *listBox;
  editFieldDef_s *editField;
  multiDef_s *multi;
  const char *enumDvarName;
  newsTickerDef_s *ticker;
  textScrollDef_s *scroll;
  void *data;
};
 
struct itemDef_t
{
  windowDef_t window;
#ifdef PC
  rectDef_s textRect[1];
#else
  rectDef_s textRect[4];
#endif
  int type;
  int dataType;
  int alignment;
  int fontEnum;
  int textAlignMode;
  float textalignx;
  float textaligny;
  float textscale;
  int textStyle;
  int gameMsgWindowIndex;
  int gameMsgWindowMode;
  const char *text;
  int itemFlags;
  menuDef_t *parent;
  MenuEventHandlerSet *mouseEnterText;
  MenuEventHandlerSet *mouseExitText;
  MenuEventHandlerSet *mouseEnter;
  MenuEventHandlerSet *mouseExit;
  MenuEventHandlerSet *action;
  MenuEventHandlerSet *accept;
  MenuEventHandlerSet *onFocus;
  MenuEventHandlerSet *hasFocus;
  MenuEventHandlerSet *leaveFocus;
  const char *dvar;
  const char *dvarTest;
  ItemKeyHandler *onKey;
  const char *enableDvar;
  const char *localVar;
  int dvarFlags;
  snd_alias_list_t *focusSound;
  float special;
#ifdef PC
  int cursorPos[1];
#else
  int cursorPos[4];
#endif
  itemDefData_t typeData;
  int floatExpressionCount;
  ItemFloatExpression *floatExpressions;
  Statement_s *visibleExp;
  Statement_s *disabledExp;
  Statement_s *textExp;
  Statement_s *materialExp;
  float glowColor[4];
  bool decayActive;
  int fxBirthTime;
  int fxLetterTime;
  int fxDecayStartTime;
  int fxDecayDuration;
  int lastSoundPlayedTime;
  Statement_s *textAlignYExp;
};
 
struct menuTransition
{
  int transitionType;
  int startTime;
  float startVal;
  float endVal;
  float time;
  int endTriggerType;
};
 
struct menuData_t
{
  int fullScreen;
  int fadeCycle;
  float fadeClamp;
  float fadeAmount;
  float fadeInAmount;
  float blurRadius;
  MenuEventHandlerSet *onOpen;
  MenuEventHandlerSet *onCloseRequest;
  MenuEventHandlerSet *onClose;
  MenuEventHandlerSet *onESC;
  MenuEventHandlerSet *onFocusDueToClose;
  ItemKeyHandler *onKey;
  Statement_s *visibleExp;
  const char *allowedBinding;
  const char *soundName;
  float focusColor[4];
  Statement_s *rectXExp;
  Statement_s *rectYExp;
  Statement_s *rectWExp;
  Statement_s *rectHExp;
  Statement_s *openSoundExp;
  Statement_s *closeSoundExp;
  Statement_s *soundLoopExp;
#ifdef PC
  int cursorItem[1];
#else
  int cursorItem[4];
#endif
  menuTransition scaleTransition[1];
  menuTransition alphaTransition[1];
  menuTransition xTransition[1];
  menuTransition yTransition[1];
  ExpressionSupportingData *expressionData;
  char priority;
};
 
struct menuDef_t
{
  menuData_t *data;
  windowDef_t window;
  int itemCount;
  itemDef_t **items;
};