I am trying to intialize an array of structures as follows...

TBMenuItemStruct struct DWORD
eMenuID DWORD 0
eMenuType DWORD 0
eMenuText DWORD 0
eMenuState DWORD 0
eMenuParent DWORD 0
eMenuVisible DWORD 0
eMenuRect RECT <0,0,0,0>
TBMenuItemStruct ENDS

mMainMenuItemsList TBMenuItemStruct\
< MENU_ITEM_GAME, MENU_TYPE_TOPLEVEL, MENU_ITEM_GAME_TEXT,\
MENU_ITEM_NONE, MENU_STATE_UNSELECTED, MENU_ITEM_VISIBLE, <0,0,44,44>>,\
< MENU_ITEM_SETTINGS, MENU_TYPE_TOPLEVEL, MENU_ITEM_SETTINGS_TEXT, \
MENU_ITEM_NONE, MENU_STATE_UNSELECTED, MENU_ITEM_VISIBLE, <0,0,44,44>>,\
< MENU_ITEM_NONE, MENU_TYPE_NONE, MENU_ITEM_NONE, MENU_STATE_NONE, MENU_ITEM_NONE, MENU_ITEM_NOT_VISIBLE, <0,0,0,0>>

But this line is already on the verge of being too long and it barely hass what all I want in it. Is there anyway around loading all the constant data into it programmitically at start?
Posted on 2001-10-16 19:10:03 by [=CC=]AMBUSH
How about:



.data
mMainMenuItemsList dd MENU_ITEM_GAME
dd MENU_TYPE_TOPLEVEL
dd MENU_ITEM_GAME_TEXT
dd MENU_ITEM_NONE
dd MENU_STATE_UNSELECTED
dd MENU_ITEM_VISIBLE
dd 0,0,44,44

dd MENU_ITEM_SETTINGS
dd MENU_TYPE_TOPLEVEL
dd MENU_ITEM_SETTINGS_TEXT
dd MENU_ITEM_NONE
dd MENU_STATE_UNSELECTED
dd MENU_ITEM_VISIBLE
dd 0,0,44,44

dd MENU_ITEM_NONE
dd MENU_TYPE_NONE
dd MENU_ITEM_NONE
dd MENU_STATE_NONE
dd MENU_ITEM_NONE
dd MENU_ITEM_NOT_VISIBLE
dd 0,0,0,0


No one says you must use the structure to DEFINE your data.. its only a tool to help you use your data. If your confident you know how the structures will reference data members, as per the structure itself, then you dont need to use it when declaring. Just dont forget anything, cause nothing will warn you if you do :)

Hope this helps...
:alright:
NaN
Posted on 2001-10-16 19:26:03 by NaN
NaN thx alot. That would work out just fine!!! All I would really need to do then is define one constant for the dist in bytes (or DWORDS) between each psuedo structure. THX!
Posted on 2001-10-16 19:29:02 by [=CC=]AMBUSH
Glad to help...

NaN
Posted on 2001-10-17 01:35:13 by NaN
How about...



mMainMenuItemsList TBMenuItemStruct\
< MENU_ITEM_GAME, MENU_TYPE_TOPLEVEL, MENU_ITEM_GAME_TEXT,\
MENU_ITEM_NONE, MENU_STATE_UNSELECTED, MENU_ITEM_VISIBLE, <0,0,44,44>>

TBMenuItemStruct < MENU_ITEM_SETTINGS, MENU_TYPE_TOPLEVEL, MENU_ITEM_SETTINGS_TEXT, \
MENU_ITEM_NONE, MENU_STATE_UNSELECTED, MENU_ITEM_VISIBLE, <0,0,44,44>>

TBMenuItemStruct < MENU_ITEM_NONE, MENU_TYPE_NONE, MENU_ITEM_NONE, \
MENU_STATE_NONE, MENU_ITEM_NONE, MENU_ITEM_NOT_VISIBLE, <0,0,0,0>>
Posted on 2001-10-17 06:07:41 by f0dder
Alternatively you can define text equates to split the long strings and then join them...
That's what I did when I was translating a couple of Petzolds c files...
fodders seems the simpler way though

the martial
Posted on 2001-10-17 06:13:58 by MArtial_Code
I think both ways are fairly good. Fooders would require a change to the least amount of code at this poin (always a good thing). Thank you all for taking the time to reply

[=CC=]AmBUSh
Posted on 2001-10-17 15:46:01 by [=CC=]AMBUSH