Created
October 20, 2022 08:03
-
-
Save JuniorDjjr/900c72052fd385fab4512a840acfcf0d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SCRIPT_START | |
{ | |
LVAR_INT scplayer pPlayer i j k p iCol2RowsCount iCol iCol2Row pBuffer iCol1Row iModel lItems lObjs lObjsNew hObj pCurrEnex iObjsListIndex iFlags | |
LVAR_TEXT_LABEL tBuffer | |
LVAR_FLOAT guiPosX guiSizX f g x y objX objY objZ arX | |
CONST_INT FILE_VERSION 1 | |
CONST_INT CAT_NONE -1 | |
CONST_INT CAT_TABLE 0 | |
CONST_INT CAT_CHAIR 1 | |
CONST_INT CAT_COUCH 2 | |
CONST_INT CAT_CABINET 3 | |
CONST_INT CAT_KITCHEN 4 | |
CONST_INT CAT_LIGHT 5 | |
CONST_INT CAT_FRAME 6 | |
CONST_INT CAT_APPLIANCE 7 | |
CONST_INT CAT_BATHROOM 8 | |
CONST_INT CAT_BED 9 | |
CONST_INT CAT_FLOOR 10 | |
CONST_INT CAT_LIFE 11 | |
CONST_INT CAT_MISC 12 | |
CONST_INT CAT_CUSTOM 13 | |
CONST_INT CAT_MAX 14 | |
CONST_INT MENU_ADD 0 | |
CONST_INT MENU_MANAGE 1 | |
CONST_INT MENU_SAVE 2 | |
CONST_INT MENU_RESET 3 | |
CONST_INT MENU_MAX 4 | |
CONST_INT OFFSET_MODEL 0 | |
CONST_INT OFFSET_PRICE 4 | |
CONST_INT TOTAL_SIZE 8 | |
CONST_INT FLAG_HELP_SHOWN 0 | |
CONST_INT FLAG_INITIALIZED 1 | |
CONST_INT FLAG_FORCE_REACTIVATE 2 | |
CONST_INT FLAG_NEVER_SHOW_HELP 3 | |
CONST_INT FLAG_SANDBOX_MODE 4 | |
CONST_INT FLAG_ANY_EDIT 5 | |
WAIT 0 | |
WAIT 0 | |
GET_PLAYER_CHAR 0 scplayer | |
CREATE_LIST DATATYPE_INT lObjs | |
CREATE_LIST DATATYPE_INT lObjsNew | |
GET_PED_POINTER scplayer (pPlayer) | |
SET_SCRIPT_EVENT_SAVE_CONFIRMATION ON OnSaveConfirmation i | |
GET_LABEL_POINTER Buffer (pBuffer) | |
GET_LABEL_POINTER OldSaveSlot (i) | |
GET_CURRENT_SAVE_SLOT (j) | |
WRITE_MEMORY i 1 j FALSE | |
//SET_CHAR_COORDINATES scplayer 315.6956 -1771.2313 4.1 | |
SET_LOCAL_VAR_BIT_CONST iFlags FLAG_HELP_SHOWN // to not show everytime when entering into the game if saved inside an interior | |
READ_INT_FROM_INI_FILE "CLEO\Furniture Mod.ini" "Settings" "ShowHelpBox" (i) | |
IF i = FALSE | |
SET_LOCAL_VAR_BIT_CONST iFlags FLAG_NEVER_SHOW_HELP | |
ENDIF | |
READ_INT_FROM_INI_FILE "CLEO\Furniture Mod.ini" "Settings" "SandboxMode" (i) | |
IF i = TRUE | |
SET_LOCAL_VAR_BIT_CONST iFlags FLAG_SANDBOX_MODE | |
ENDIF | |
WHILE TRUE | |
GOSUB Process | |
IF GOSUB Activate | |
IF NOT IS_LOCAL_VAR_BIT_SET_CONST iFlags FLAG_INITIALIZED | |
SET_LOCAL_VAR_BIT_CONST iFlags FLAG_INITIALIZED | |
CLEO_CALL InitCategoryList 0 ()() | |
CLEO_CALL ReadConfig 0 ()() | |
ENDIF | |
GOSUB Init | |
GOSUB FirstMenu | |
CLEAR_LOCAL_VAR_BIT_CONST iFlags FLAG_HELP_SHOWN | |
ENDIF | |
ENDWHILE | |
Activate: | |
IF IS_LOCAL_VAR_BIT_SET_CONST iFlags FLAG_FORCE_REACTIVATE | |
CLEAR_LOCAL_VAR_BIT_CONST iFlags FLAG_FORCE_REACTIVATE | |
RETURN_TRUE | |
RETURN | |
ENDIF | |
IF NOT pCurrEnex = 0 | |
IF IS_LOCAL_VAR_BIT_SET_CONST iFlags FLAG_SANDBOX_MODE | |
GOTO Activate_CheckOk | |
ENDIF | |
i = 0 | |
WHILE GET_ANY_OBJECT_NO_SAVE_RECURSIVE i (i hObj) | |
IF DOES_OBJECT_HAVE_THIS_MODEL hObj 1277 | |
GET_CHAR_COORDINATES scplayer (x y f) | |
IF LOCATE_OBJECT_DISTANCE_TO_COORDINATES hObj x y f 10.0 | |
GET_OBJECT_COORDINATES hObj (objX objY objZ) | |
IF IS_LINE_OF_SIGHT_CLEAR objX objY objZ x y f (TRUE FALSE FALSE FALSE FALSE) | |
IF NOT IS_LOCAL_VAR_BIT_SET_CONST iFlags FLAG_HELP_SHOWN | |
AND timerb > 3000 | |
AND NOT IS_LOCAL_VAR_BIT_SET_CONST iFlags FLAG_NEVER_SHOW_HELP | |
GET_LIST_SIZE lObjs (j) | |
IF j > 0 | |
PRINT_HELP fuinf4 | |
ELSE | |
PRINT_HELP fuinf3 | |
ENDIF | |
SET_LOCAL_VAR_BIT_CONST iFlags FLAG_HELP_SHOWN | |
ENDIF | |
Activate_CheckOk: | |
IF TEST_CHEAT FUR | |
RETURN_TRUE | |
RETURN | |
ENDIF | |
BREAK | |
ENDIF | |
ENDIF | |
ENDIF | |
ENDWHILE | |
ENDIF | |
RETURN_FALSE | |
RETURN | |
Process: | |
WAIT 0 | |
Process_AfterWait: | |
GET_LIST_SIZE lObjs (j) | |
IF j > 0 | |
i = 0 | |
WHILE i < j | |
GET_LIST_VALUE_BY_INDEX lObjs i (p) | |
IF NOT DOES_OBJECT_EXIST p | |
LIST_REMOVE_VALUE lObjs p | |
// the list size was changed, it's safer to restart iteration | |
GOTO Process_AfterWait | |
ENDIF | |
++i | |
ENDWHILE | |
ENDIF | |
READ_STRUCT_OFFSET pPlayer 0x78C 4 (p) | |
IF NOT pCurrEnex = p | |
IF NOT p = 0 | |
IF pCurrEnex = 0 | |
pCurrEnex = p | |
CLEO_CALL BuildEnexFilename 0 (p pBuffer) | |
IF DOES_FILE_EXIST $pBuffer | |
CLEO_CALL LoadObjectsFromFile 0 (pBuffer lObjs)() | |
ENDIF | |
timerb = 0 | |
ENDIF | |
ELSE | |
CLEAR_LOCAL_VAR_BIT_CONST iFlags FLAG_HELP_SHOWN | |
Process_Reset: | |
CLEO_CALL RemoveObjects 0 (lObjs)() | |
CLEO_CALL RemoveObjects 0 (lObjsNew)() | |
pCurrEnex = 0 | |
RETURN_TRUE | |
RETURN | |
ENDIF | |
ENDIF | |
RETURN_FALSE | |
RETURN | |
Init: | |
CLEO_CALL IdentityTempQuaternion 0 ()(i) | |
CLEO_CALL InitOrbitMouseCamera 0 (20.0 20.0 2.5 2.5 0.2)() | |
CLEAR_LOCAL_VAR_BIT_CONST iFlags FLAG_ANY_EDIT | |
GET_CHAR_COORDINATES scplayer objX objY objZ | |
objZ += 0.5 | |
GET_LABEL_POINTER Buffer (pBuffer) | |
SET_PLAYER_CONTROL 0 OFF | |
DISPLAY_RADAR OFF | |
SET_CHAR_COLLISION scplayer OFF | |
FREEZE_CHAR_POSITION scplayer ON | |
CLEO_CALL ToggleCharVisibility 0 (scplayer 0)() | |
RETURN | |
Release: | |
SET_PLAYER_CONTROL 0 ON | |
SET_CHAR_COLLISION scplayer ON | |
FREEZE_CHAR_POSITION scplayer OFF | |
CLEO_CALL ToggleCharVisibility 0 (scplayer 1)() | |
DISPLAY_RADAR ON | |
RESTORE_CAMERA_JUMPCUT | |
RETURN | |
FirstMenu: | |
iCol1Row = 0 | |
iCol = 0 | |
iCol2Row = 0 | |
CLEO_CALL IdentityTempQuaternion 0 ()(i) | |
GET_LIST_SIZE lObjs (iCol2RowsCount) | |
WHILE TRUE | |
IF IS_BUTTON_JUST_PRESSED PAD1 TRIANGLE | |
BREAK | |
ENDIF | |
IF iCol1Row = MENU_MANAGE | |
AND iCol = 1 | |
GOSUB UpdateManageObjectIfNeeded | |
GOSUB ShowCurObjectInfos | |
GOSUB UpdateObjectMovement | |
ELSE | |
GOSUB ClearCurrentObjectNoDelete | |
ENDIF | |
IF IS_KEY_PRESSED VK_LSHIFT | |
OR IS_KEY_PRESSED VK_RSHIFT | |
j = 10 | |
ELSE | |
j = 1 | |
ENDIF | |
//IF IS_KEY_JUST_PRESSED VK_LCONTROL | |
IF IS_KEY_JUST_PRESSED VK_DOWN | |
IF iCol = 0 | |
iCol1Row += 1 | |
IF iCol1Row >= MENU_MAX | |
iCol1Row = 0 | |
ENDIF | |
GOSUB UpdateSelectedMenu | |
ENDIF | |
IF iCol = 1 | |
iCol2Row += j | |
WHILE iCol2Row >= iCol2RowsCount | |
iCol2Row -= iCol2RowsCount | |
ENDWHILE | |
ENDIF | |
ENDIF | |
//IF IS_KEY_JUST_PRESSED VK_LSHIFT | |
IF IS_KEY_JUST_PRESSED VK_UP | |
IF iCol = 0 | |
iCol1Row -= 1 | |
IF iCol1Row < 0 | |
iCol1Row = MENU_MAX - 1 | |
ENDIF | |
GOSUB UpdateSelectedMenu | |
ENDIF | |
IF iCol = 1 | |
iCol2Row -= j | |
WHILE iCol2Row < 0 | |
iCol2Row += iCol2RowsCount | |
ENDWHILE | |
ENDIF | |
ENDIF | |
// force col 1 if there is no items on col 2, every frame since some object may stop existing in the list anytime | |
IF iCol1Row = MENU_MANAGE | |
GET_LIST_SIZE lObjs (i) | |
iCol2RowsCount = i | |
GET_LIST_SIZE lObjsNew (i) | |
iCol2RowsCount += i | |
IF iCol2RowsCount = 0 | |
iCol = 0 | |
ENDIF | |
ENDIF | |
IF DOES_OBJECT_EXIST hObj | |
GET_OBJECT_POINTER hObj (i) | |
ELSE | |
i = -1 | |
ENDIF | |
IF IS_KEY_PRESSED VK_MBUTTON | |
OR IS_KEY_PRESSED VK_LBUTTON | |
OR IS_KEY_PRESSED VK_RBUTTON | |
CLEO_CALL UpdateOrbitMouseCamera 0 (i 0 0.5)() | |
ELSE | |
CLEO_CALL UpdateOrbitMouseCamera 0 (i 1 0.5)() | |
ENDIF | |
GET_FIXED_XY_ASPECT_RATIO 1.0 1.0 (arX f) | |
GOSUB DrawFirstMenu | |
IF iCol1Row = MENU_MANAGE | |
GOSUB DrawManageItems | |
ENDIF | |
GOSUB DrawTotalPrice | |
GOSUB DrawRowIndicator | |
GOSUB DrawHeader | |
IF GOSUB Process | |
BREAK | |
ENDIF | |
//IF IS_KEY_JUST_PRESSED 109 | |
IF IS_KEY_JUST_PRESSED VK_LEFT | |
OR IS_KEY_JUST_PRESSED VK_RETURN | |
OR IS_KEY_JUST_PRESSED VK_BACK | |
IF iCol = 0 | |
GET_LIST_SIZE lObjsNew (i) | |
IF i = 0 | |
AND NOT IS_LOCAL_VAR_BIT_SET_CONST iFlags FLAG_ANY_EDIT | |
BREAK // if no objs added or edit, just exit it | |
ENDIF | |
CLEO_CALL CountTotalPrice 0 (lObjsNew)(i) | |
IF CLEO_CALL TwoOptionsScreen 0 (3 2 1 i) | |
GOSUB Save | |
ENDIF | |
BREAK | |
ELSE | |
iCol = 0 | |
GOSUB ClearCurrentObjectNoDelete | |
ENDIF | |
ENDIF | |
//IF IS_KEY_JUST_PRESSED 107 | |
IF IS_KEY_JUST_PRESSED VK_RIGHT | |
SWITCH iCol1Row | |
CASE MENU_ADD | |
GOSUB SecondMenu | |
GOTO FirstMenu | |
BREAK | |
CASE MENU_MANAGE | |
iCol = 1 | |
BREAK | |
CASE MENU_SAVE | |
CLEO_CALL CountTotalPrice 0 (lObjsNew)(i) | |
IF CLEO_CALL TwoOptionsScreen 0 (1 1 1 i) | |
GOSUB Save | |
ENDIF | |
BREAK | |
CASE MENU_RESET | |
IF CLEO_CALL TwoOptionsScreen 0 (2 1 0 0) | |
SET_LOCAL_VAR_BIT_CONST iFlags FLAG_FORCE_REACTIVATE | |
REPORT_MISSION_AUDIO_EVENT_AT_POSITION 0.0 0.0 0.0 SOUND_SHOP_BUY | |
GOTO Process_Reset | |
ENDIF | |
BREAK | |
ENDSWITCH | |
ENDIF | |
ENDWHILE | |
WHILE IS_KEY_PRESSED VK_LEFT | |
GOSUB Process | |
ENDWHILE | |
GOSUB Release | |
RETURN | |
Save: | |
CLEO_CALL CountTotalPrice 0 (lObjsNew)(i) | |
IF i > 0 | |
CHANGE_PLAYER_MONEY 0 CHANGE_MONEY_REMOVE i | |
ENDIF | |
CLEO_CALL BuildEnexFilename 0 (pCurrEnex pBuffer) | |
CLEO_CALL SaveObjectsToFile 0 (pBuffer lObjs lObjsNew)() | |
REPORT_MISSION_AUDIO_EVENT_AT_POSITION 0.0 0.0 0.0 SOUND_SHOP_BUY | |
CLEAR_LOCAL_VAR_BIT_CONST iFlags FLAG_ANY_EDIT | |
RETURN | |
DrawTotalPrice: | |
CLEO_CALL CountTotalPrice 0 (lObjsNew)(i) | |
// draw total price | |
STRING_FORMAT pBuffer "Total: $%i" i | |
guiPosX = arX * 5.0 | |
STORE_SCORE 0 (j) | |
j -= i | |
IF j >= 0 | |
DRAW_STRING_EXT $pBuffer DRAW_EVENT_BEFORE_HUD (guiPosX 425.0 0.25 0.6) TRUE FONT_SUBTITLES (TRUE ALIGN_LEFT 640.0 TRUE) (50 255 0 255) 1 0 (0 0 0 255) (0 0 0 0 0) | |
ELSE | |
DRAW_STRING_EXT $pBuffer DRAW_EVENT_BEFORE_HUD (guiPosX 425.0 0.25 0.6) TRUE FONT_SUBTITLES (TRUE ALIGN_LEFT 640.0 TRUE) (255 50 0 255) 1 0 (0 0 0 255) (0 0 0 0 0) | |
ENDIF | |
RETURN | |
DrawFirstMenu: | |
IF iCol1Row = MENU_MANAGE | |
//bg | |
guiSizX = arX * 220.0 | |
guiPosX = guiSizX * 0.5 | |
DRAW_TEXTURE_PLUS 0 DRAW_EVENT_BEFORE_HUD (guiPosX 224.0 guiSizX 448.0) 0.0 0.0 FALSE 0 0 (0 0 0 100) | |
ELSE | |
//bg | |
guiSizX = arX * 81.0 | |
guiPosX = guiSizX * 0.5 | |
DRAW_TEXTURE_PLUS 0 DRAW_EVENT_BEFORE_HUD (guiPosX 224.0 guiSizX 448.0) 0.0 0.0 FALSE 0 0 (0 0 0 100) | |
ENDIF | |
IF iCol = 1 | |
//selected | |
DRAW_TEXTURE_PLUS 0 DRAW_EVENT_BEFORE_HUD (guiPosX 230.0 guiSizX 10.0) 0.0 0.0 FALSE 0 0 (0 0 0 255) | |
ENDIF | |
guiSizX = arX * 82.0 | |
guiPosX = guiSizX * 0.5 | |
//selected | |
DRAW_TEXTURE_PLUS 0 DRAW_EVENT_BEFORE_HUD (guiPosX 230.0 guiSizX 10.0) 0.0 0.0 FALSE 0 0 (0 0 0 255) | |
// col | |
guiPosX = arX * 82.0 | |
guiSizX = arX * 2.0 | |
DRAW_TEXTURE_PLUS 0 DRAW_EVENT_BEFORE_HUD (guiPosX 224.0 guiSizX 448.0) 0.0 0.0 FALSE 0 0 (0 0 0 100) | |
y = 4.0 | |
f = 0.0 | |
i = 0 | |
j = iCol1Row | |
j -= 22 // 45 / 2 | |
WHILE i < 45 | |
// process text fade (simple ease) | |
f += 4.0 // 180 / 45 | |
SIN f (g) | |
g *= 255.0 | |
p =# g | |
// draw option name | |
IF j >= 0 | |
AND j < MENU_MAX | |
STRING_FORMAT tBuffer "fumen%i" $j | |
GET_TEXT_LABEL_STRING $tBuffer (timera) | |
DRAW_STRING_EXT $timera DRAW_EVENT_BEFORE_HUD (10.0 y 0.25 0.6) TRUE FONT_SUBTITLES (TRUE ALIGN_LEFT 640.0 TRUE) (255 255 255 p) 1 0 (0 0 0 p) (0 0 0 0 0) | |
ENDIF | |
// next item | |
y += 10.0 // 448 / 45 | |
++i | |
++j | |
ENDWHILE | |
RETURN | |
DrawManageItems: | |
y = 5.0 | |
f = 0.0 | |
GET_LIST_SIZE lObjs (i) | |
iCol2RowsCount = i | |
GET_LIST_SIZE lObjsNew (i) | |
iCol2RowsCount += i | |
i = 0 | |
IF iCol2RowsCount > 0 | |
j = iCol2RowsCount | |
j -= 22 // 45 / 2 | |
j += iCol2Row | |
//PRINT_FORMATTED_NOW "%i max %i" 1000 j iCol2RowsCount | |
WHILE i < 45 | |
// scroll loop | |
WHILE j >= iCol2RowsCount | |
j -= iCol2RowsCount | |
ENDWHILE | |
WHILE j < 0 | |
j += iCol2RowsCount | |
ENDWHILE | |
// get current item | |
GET_LIST_SIZE lObjs (k) | |
IF j >= k | |
timera = j - k | |
GET_LIST_VALUE_BY_INDEX lObjsNew timera (k) | |
guiPosX = arX * 215.0 | |
y += 5.0 | |
DRAW_TEXTURE_PLUS 0 DRAW_EVENT_BEFORE_HUD (guiPosX y 3.0 3.0) 45.0 0.0 TRUE 0 0 (50 255 0 255) | |
y -= 5.0 | |
ELSE | |
GET_LIST_VALUE_BY_INDEX lObjs j (k) | |
ENDIF | |
// process text fade (simple ease) | |
f += 4.0 // 180 / 45 | |
SIN f (g) | |
g *= 255.0 | |
p =# g | |
// draw model name | |
GET_OBJECT_MODEL k (iModel) | |
CLEO_CALL GetModelDisplayName 0 (iModel pBuffer)(timera) | |
guiPosX = arX * 96.0 | |
DRAW_STRING_EXT $timera DRAW_EVENT_BEFORE_HUD (guiPosX y 0.2 0.55) TRUE FONT_SUBTITLES (TRUE ALIGN_LEFT 640.0 TRUE) (255 255 255 p) 1 0 (0 0 0 p) (0 0 0 0 0) | |
// draw order | |
IF j = 0 | |
guiPosX = arX * 82.0 | |
guiSizX = arX * 138.0 | |
g = guiSizX * 0.5 | |
guiPosX += g | |
DRAW_TEXTURE_PLUS 0 DRAW_EVENT_BEFORE_HUD (guiPosX y guiSizX 1.5) 0.0 0.0 FALSE 0 0 (80 80 80 255) | |
guiSizX = arX * 250.0 | |
ENDIF | |
STRING_FORMAT tBuffer "%i" $j | |
guiPosX = arX * 85.0 | |
y += 1.5 | |
p /= 2 | |
IF j > 99 | |
guiSizX = 0.15 | |
ELSE | |
guiSizX = 0.2 | |
ENDIF | |
DRAW_STRING_EXT $tBuffer DRAW_EVENT_BEFORE_HUD (guiPosX y guiSizX 0.4) TRUE FONT_SUBTITLES (TRUE ALIGN_LEFT 640.0 TRUE) (255 255 255 p) 1 0 (0 0 0 p) (0 0 0 0 0) | |
y -= 1.5 | |
// next item | |
y += 10.0 // 448 / 45 | |
++i | |
++j | |
ENDWHILE | |
ELSE | |
guiPosX = arX * 90.0 | |
GET_TEXT_LABEL_STRING fuinf0 (timera) | |
DRAW_STRING_EXT $timera DRAW_EVENT_BEFORE_HUD (guiPosX 224.0 0.2 0.55) TRUE FONT_SUBTITLES (TRUE ALIGN_LEFT 640.0 TRUE) (255 255 255 80) 1 0 (0 0 0 80) (0 0 0 0 0) | |
ENDIF | |
RETURN | |
UpdateSelectedMenu: | |
GET_LIST_SIZE lObjs (i) | |
iCol2RowsCount = i | |
GET_LIST_SIZE lObjsNew (i) | |
iCol2RowsCount += i | |
iCol2Row = 0 | |
RETURN | |
UpdateManageObjectIfNeeded: | |
IF DOES_OBJECT_EXIST hObj | |
GET_TEXT_LABEL_STRING fucmd12 (timera) | |
DRAW_STRING_EXT $timera DRAW_EVENT_BEFORE_HUD (320.0 400.0 0.4 0.8) TRUE FONT_SUBTITLES TRUE ALIGN_CENTER 300.0 TRUE (255 255 255 255) 1 0 (0 0 0 255) FALSE (0 0 0 0) | |
IF IS_KEY_JUST_PRESSED VK_DELETE | |
REPORT_MISSION_AUDIO_EVENT_AT_POSITION 0.0 0.0 0.0 SOUND_SHOP_BUY_DENIED | |
SET_LOCAL_VAR_BIT_CONST iFlags FLAG_ANY_EDIT | |
GOSUB ClearCurrentObject | |
ENDIF | |
ENDIF | |
GET_LIST_SIZE lObjs (k) | |
IF iCol2Row >= k | |
timera = iCol2Row - k | |
GET_LIST_VALUE_BY_INDEX lObjsNew timera (p) | |
ELSE | |
GET_LIST_VALUE_BY_INDEX lObjs iCol2Row (p) | |
ENDIF | |
IF DOES_OBJECT_EXIST p | |
IF NOT p = hObj | |
hObj = p | |
GET_OBJECT_COORDINATES hObj objX objY objZ | |
ENDIF | |
GET_OBJECT_MODEL hObj (i) | |
//PRINT_FORMATTED_NOW "model id %i" 1000 iModel | |
ENDIF | |
RETURN | |
SecondMenu: | |
hObj = 0 | |
iCol1Row = CAT_TABLE | |
iCol = 0 | |
iCol2Row = 0 | |
GET_CHAR_COORDINATES scplayer objX objY objZ | |
CLEO_CALL IdentityTempQuaternion 0 ()(i) | |
CLEO_CALL GetCategoryList 0 (iCol1Row)(lItems) | |
GET_LIST_SIZE lItems (iCol2RowsCount) | |
WHILE TRUE | |
GOSUB UpdateAddObjectIfNeeded | |
GOSUB ShowCurObjectInfos | |
GOSUB UpdateObjectMovement | |
IF IS_KEY_PRESSED VK_LSHIFT | |
OR IS_KEY_PRESSED VK_RSHIFT | |
j = 10 | |
ELSE | |
j = 1 | |
ENDIF | |
IF IS_KEY_JUST_PRESSED VK_DOWN | |
//IF IS_KEY_JUST_PRESSED VK_LCONTROL | |
IF iCol = 0 | |
iCol1Row += 1 | |
IF iCol1Row >= CAT_MAX | |
iCol1Row = 0 | |
ENDIF | |
GOSUB UpdateSelectedCategory | |
ENDIF | |
IF iCol = 1 | |
iCol2Row += j | |
WHILE iCol2Row >= iCol2RowsCount | |
iCol2Row -= iCol2RowsCount | |
ENDWHILE | |
ENDIF | |
ENDIF | |
IF IS_KEY_JUST_PRESSED VK_UP | |
//IF IS_KEY_JUST_PRESSED VK_LSHIFT | |
IF iCol = 0 | |
iCol1Row -= 1 | |
IF iCol1Row < 0 | |
iCol1Row = CAT_MAX - 1 | |
ENDIF | |
GOSUB UpdateSelectedCategory | |
ENDIF | |
IF iCol = 1 | |
iCol2Row -= j | |
WHILE iCol2Row < 0 | |
iCol2Row += iCol2RowsCount | |
ENDWHILE | |
ENDIF | |
ENDIF | |
// force col 1 if there is no items on col 2, every frame since some object may stop existing in the list anytime | |
CLEO_CALL GetCategoryList 0 (iCol1Row)(lItems) | |
GET_LIST_SIZE lItems (iCol2RowsCount) | |
IF iCol2RowsCount = 0 | |
iCol = 0 | |
ENDIF | |
IF DOES_OBJECT_EXIST hObj | |
GET_OBJECT_POINTER hObj (i) | |
IF IS_KEY_PRESSED VK_MBUTTON | |
OR IS_KEY_PRESSED VK_LBUTTON | |
OR IS_KEY_PRESSED VK_RBUTTON | |
CLEO_CALL UpdateOrbitMouseCamera 0 (i 0 0.5)() | |
ELSE | |
CLEO_CALL UpdateOrbitMouseCamera 0 (i 1 0.5)() | |
ENDIF | |
ENDIF | |
GET_FIXED_XY_ASPECT_RATIO 1.0 1.0 (arX f) | |
GOSUB DrawCategories | |
GOSUB DrawItems | |
GOSUB DrawTotalPrice | |
GOSUB DrawHeader | |
GOSUB DrawRowIndicator | |
IF GOSUB Process | |
BREAK | |
ENDIF | |
//IF IS_KEY_JUST_PRESSED 109 | |
IF IS_KEY_JUST_PRESSED VK_LEFT | |
OR IS_KEY_JUST_PRESSED VK_RETURN | |
OR IS_KEY_JUST_PRESSED VK_BACK | |
IF iCol = 0 | |
BREAK | |
ENDIF | |
iCol = 0 | |
ENDIF | |
//IF IS_KEY_JUST_PRESSED 107 | |
IF IS_KEY_JUST_PRESSED VK_RIGHT | |
iCol = 1 | |
ENDIF | |
ENDWHILE | |
GOSUB ClearCurrentObject | |
RETURN | |
ClearCurrentObject: | |
IF DOES_OBJECT_EXIST hObj | |
LIST_REMOVE_VALUE lObjs hObj | |
LIST_REMOVE_VALUE lObjsNew hObj | |
DELETE_OBJECT hObj | |
ENDIF | |
hObj = -1 | |
RETURN | |
ClearCurrentObjectNoDelete: | |
hObj = -1 | |
RETURN | |
UpdateObjectMovement: | |
IF DOES_OBJECT_EXIST hObj | |
k = FALSE | |
GOSUB DrawMovementCommands | |
IF IS_KEY_PRESSED VK_LSHIFT | |
OR IS_KEY_PRESSED VK_RSHIFT | |
f = 0.1 | |
ELSE | |
IF IS_KEY_PRESSED VK_LCONTROL | |
OR IS_KEY_PRESSED VK_RCONTROL | |
f = 0.003 | |
ELSE | |
f = 0.015 | |
ENDIF | |
ENDIF | |
IF IS_KEY_PRESSED VK_KEY_W | |
CLEO_CALL MoveInCameraDirection 0 (f objX objY objZ 0.0 -1.0 0.0)(objX objY objZ) | |
k = TRUE | |
ENDIF | |
IF IS_KEY_PRESSED VK_KEY_S | |
CLEO_CALL MoveInCameraDirection 0 (f objX objY objZ 0.0 1.0 0.0)(objX objY objZ) | |
k = TRUE | |
ENDIF | |
IF IS_KEY_PRESSED VK_KEY_A | |
CLEO_CALL MoveInCameraDirection 0 (f objX objY objZ -1.0 0.0 0.0)(objX objY objZ) | |
k = TRUE | |
ENDIF | |
IF IS_KEY_PRESSED VK_KEY_D | |
CLEO_CALL MoveInCameraDirection 0 (f objX objY objZ 1.0 0.0 0.0)(objX objY objZ) | |
k = TRUE | |
ENDIF | |
f *= 0.5 | |
IF IS_KEY_PRESSED VK_KEY_Q | |
objZ -=@ f | |
k = TRUE | |
ENDIF | |
IF IS_KEY_PRESSED VK_KEY_E | |
objZ +=@ f | |
k = TRUE | |
ENDIF | |
IF IS_KEY_PRESSED VK_MBUTTON | |
OR IS_KEY_PRESSED VK_LBUTTON | |
OR IS_KEY_PRESSED VK_RBUTTON | |
GET_PC_MOUSE_MOVEMENT (x y) | |
GET_MOUSE_SENSIBILITY (f) | |
IF NOT IS_MOUSE_USING_VERTICAL_INVERSION | |
f *= -1.0 | |
ENDIF | |
x *= f | |
y *= f | |
x *= 40.0 | |
y *= 40.0 | |
CLEO_CALL StoreObjectQuaternion 0 (hObj)(p) | |
IF IS_KEY_PRESSED VK_RBUTTON | |
ROTATE_QUAT_ON_AXIS p 1.0 0.0 0.0 x RWCOMBINE_PRECONCAT | |
ROTATE_QUAT_ON_AXIS p 1.0 0.0 0.0 y RWCOMBINE_PRECONCAT | |
ENDIF | |
IF IS_KEY_PRESSED VK_MBUTTON | |
ROTATE_QUAT_ON_AXIS p 0.0 1.0 0.0 x RWCOMBINE_PRECONCAT | |
ROTATE_QUAT_ON_AXIS p 0.0 1.0 0.0 y RWCOMBINE_PRECONCAT | |
ENDIF | |
IF IS_KEY_PRESSED VK_LBUTTON | |
ROTATE_QUAT_ON_AXIS p 0.0 0.0 1.0 x RWCOMBINE_PRECONCAT | |
ROTATE_QUAT_ON_AXIS p 0.0 0.0 1.0 y RWCOMBINE_PRECONCAT | |
ENDIF | |
CLEO_CALL SetObjectQuaternionByPointer 0 (hObj p)() | |
k = TRUE | |
ENDIF | |
IF IS_KEY_JUST_PRESSED VK_KEY_Z | |
OR IS_KEY_JUST_PRESSED VK_KEY_C | |
CLEO_CALL StoreObjectQuaternion 0 (hObj)(p) | |
IF IS_KEY_JUST_PRESSED VK_KEY_Z | |
ROTATE_QUAT_ON_AXIS p 0.0 0.0 1.0 30.0 RWCOMBINE_PRECONCAT | |
ENDIF | |
IF IS_KEY_JUST_PRESSED VK_KEY_C | |
ROTATE_QUAT_ON_AXIS p 0.0 0.0 1.0 -30.0 RWCOMBINE_PRECONCAT | |
ENDIF | |
CLEO_CALL SetObjectQuaternionByPointer 0 (hObj p)() | |
k = TRUE | |
ENDIF | |
IF IS_KEY_PRESSED VK_KEY_R | |
CLEO_CALL IdentityTempQuaternion 0 ()(p) | |
CLEO_CALL SetObjectQuaternionByPointer 0 (hObj p)() | |
k = TRUE | |
ENDIF | |
SET_OBJECT_COORDINATES hObj objX objY objZ | |
IF k = TRUE | |
IF iCol1Row = MENU_MANAGE | |
AND iCol = 1 | |
SET_LOCAL_VAR_BIT_CONST iFlags FLAG_ANY_EDIT | |
ENDIF | |
ENDIF | |
ENDIF | |
RETURN | |
UpdateAddObjectIfNeeded: | |
CLEO_CALL GetCategoryList 0 (iCol1Row)(lItems) | |
GET_LIST_VALUE_BY_INDEX lItems iCol2Row (p) | |
IF p > 0 | |
READ_STRUCT_OFFSET p OFFSET_MODEL 4 (iModel) | |
k = 0 | |
IF DOES_OBJECT_EXIST hObj | |
GET_OBJECT_MODEL hObj (i) | |
IF i = iModel | |
iModel = -1 //don't update | |
ENDIF | |
ENDIF | |
IF iModel > 0 | |
GOSUB ClearCurrentObject | |
REQUEST_MODEL iModel | |
LOAD_ALL_MODELS_NOW | |
CREATE_OBJECT_NO_SAVE iModel objX objY objZ TRUE FALSE hObj | |
MARK_MODEL_AS_NO_LONGER_NEEDED iModel | |
READ_STRUCT_OFFSET p OFFSET_PRICE 4 (j) | |
INIT_EXTENDED_OBJECT_VARS hObj AUTO 5 //1-4 is quaternion | |
SET_EXTENDED_OBJECT_VAR hObj AUTO 5 j | |
GET_LABEL_POINTER TempQuaternion (k) //use last quat | |
CLEO_CALL SetObjectQuaternionByPointer 0 (hObj k)() | |
ENDIF | |
//PRINT_FORMATTED_NOW "model id %i" 1000 iModel | |
ENDIF | |
IF DOES_OBJECT_EXIST hObj | |
GET_TEXT_LABEL_STRING fucmd11 (timera) | |
DRAW_STRING_EXT $timera DRAW_EVENT_BEFORE_HUD (320.0 400.0 0.4 0.8) TRUE FONT_SUBTITLES TRUE ALIGN_CENTER 300.0 TRUE (255 255 255 255) 1 0 (0 0 0 255) FALSE (0 0 0 0) | |
IF IS_KEY_JUST_PRESSED VK_KEY_Y | |
IF CLEO_CALL AddObjectToListSafe 0 (lObjsNew hObj) | |
REPORT_MISSION_AUDIO_EVENT_AT_POSITION 0.0 0.0 0.0 SOUND_SHOP_BUY | |
SET_LOCAL_VAR_BIT_CONST iFlags FLAG_ANY_EDIT | |
CLEO_CALL StoreObjectQuaternion 0 (hObj)(k) //store to temp quat | |
GOSUB ClearCurrentObjectNoDelete | |
ENDIF | |
ENDIF | |
ENDIF | |
RETURN | |
UpdateSelectedCategory: | |
CLEO_CALL GetCategoryList 0 (iCol1Row)(lItems) | |
GET_LIST_SIZE lItems (iCol2RowsCount) | |
iCol2Row = 0 | |
RETURN | |
DrawCategories: | |
guiSizX = arX * 82.0 | |
guiPosX = guiSizX * 0.5 | |
//selected | |
DRAW_TEXTURE_PLUS 0 DRAW_EVENT_BEFORE_HUD (guiPosX 230.0 guiSizX 10.0) 0.0 0.0 FALSE 0 0 (0 0 0 255) | |
// col | |
guiPosX = arX * 82.0 | |
guiSizX = arX * 2.0 | |
DRAW_TEXTURE_PLUS 0 DRAW_EVENT_BEFORE_HUD (guiPosX 224.0 guiSizX 448.0) 0.0 0.0 FALSE 0 0 (0 0 0 100) | |
y = 4.0 | |
f = 0.0 | |
i = 0 | |
j = iCol1Row | |
j -= 22 // 45 / 2 | |
WHILE i < 45 | |
// process text fade (simple ease) | |
f += 4.0 // 180 / 45 | |
SIN f (g) | |
g *= 255.0 | |
p =# g | |
// draw cat name | |
IF j >= 0 | |
AND j < CAT_MAX | |
STRING_FORMAT tBuffer "fucat%i" $j | |
GET_TEXT_LABEL_STRING $tBuffer (timera) | |
DRAW_STRING_EXT $timera DRAW_EVENT_BEFORE_HUD (5.0 y 0.25 0.6) TRUE FONT_SUBTITLES (TRUE ALIGN_LEFT 640.0 TRUE) (255 255 255 p) 1 0 (0 0 0 p) (0 0 0 0 0) | |
ENDIF | |
// next item | |
y += 10.0 // 448 / 45 | |
++i | |
++j | |
ENDWHILE | |
RETURN | |
DrawItems: | |
//bg | |
guiSizX = arX * 250.0 | |
guiPosX = guiSizX * 0.5 | |
DRAW_TEXTURE_PLUS 0 DRAW_EVENT_BEFORE_HUD (guiPosX 224.0 guiSizX 448.0) 0.0 0.0 FALSE 0 0 (0 0 0 100) | |
IF iCol = 1 | |
//selected | |
DRAW_TEXTURE_PLUS 0 DRAW_EVENT_BEFORE_HUD (guiPosX 230.0 guiSizX 10.0) 0.0 0.0 FALSE 0 0 (0 0 0 255) | |
ENDIF | |
y = 5.0 | |
f = 0.0 | |
i = 0 | |
CLEO_CALL GetCategoryList 0 (iCol1Row)(lItems) | |
GET_LIST_SIZE lItems (iCol2RowsCount) | |
IF iCol2RowsCount > 0 | |
j = iCol2RowsCount | |
j -= 22 // 45 / 2 | |
j += iCol2Row | |
//PRINT_FORMATTED_NOW "%i max %i" 1000 j iCol2RowsCount | |
WHILE i < 45 | |
// scroll loop | |
WHILE j >= iCol2RowsCount | |
j -= iCol2RowsCount | |
ENDWHILE | |
WHILE j < 0 | |
j += iCol2RowsCount | |
ENDWHILE | |
// get current item | |
CLEO_CALL GetCategoryList 0 (iCol1Row)(lItems) | |
GET_LIST_VALUE_BY_INDEX lItems j (k) | |
// process text fade (simple ease) | |
f += 4.0 // 180 / 45 | |
SIN f (g) | |
g *= 255.0 | |
p =# g | |
// draw model name | |
READ_STRUCT_OFFSET k OFFSET_MODEL 4 (iModel) | |
CLEO_CALL GetModelDisplayName 0 (iModel pBuffer)(timera) | |
guiPosX = arX * 96.0 | |
DRAW_STRING_EXT $timera DRAW_EVENT_BEFORE_HUD (guiPosX y 0.2 0.55) TRUE FONT_SUBTITLES (TRUE ALIGN_LEFT 640.0 TRUE) (255 255 255 p) 1 0 (0 0 0 p) (0 0 0 0 0) | |
// draw price | |
READ_STRUCT_OFFSET k OFFSET_PRICE 4 (k) | |
STRING_FORMAT tBuffer "$%i" $k | |
guiPosX = arX * 248.0 | |
DRAW_STRING_EXT $tBuffer DRAW_EVENT_BEFORE_HUD (guiPosX y 0.2 0.55) TRUE FONT_SUBTITLES (TRUE ALIGN_RIGHT 0.0 TRUE) (255 255 255 p) 1 0 (0 0 0 p) (0 0 0 0 0) | |
// draw order | |
IF j = 0 | |
guiPosX = arX * 83.0 | |
guiSizX = arX * 167.0 | |
g = guiSizX * 0.5 | |
guiPosX += g | |
DRAW_TEXTURE_PLUS 0 DRAW_EVENT_BEFORE_HUD (guiPosX y guiSizX 1.5) 0.0 0.0 FALSE 0 0 (80 80 80 255) | |
guiSizX = arX * 250.0 | |
ENDIF | |
STRING_FORMAT tBuffer "%i" $j | |
guiPosX = arX * 85.0 | |
y += 1.5 | |
p /= 2 | |
IF j > 99 | |
guiSizX = 0.15 | |
ELSE | |
guiSizX = 0.2 | |
ENDIF | |
DRAW_STRING_EXT $tBuffer DRAW_EVENT_BEFORE_HUD (guiPosX y guiSizX 0.4) TRUE FONT_SUBTITLES (TRUE ALIGN_LEFT 640.0 TRUE) (255 255 255 p) 1 0 (0 0 0 p) (0 0 0 0 0) | |
y -= 1.5 | |
// next item | |
y += 10.0 // 448 / 45 | |
++i | |
++j | |
ENDWHILE | |
ELSE | |
guiPosX = arX * 90.0 | |
GET_TEXT_LABEL_STRING fuinf0 (timera) | |
DRAW_STRING_EXT $timera DRAW_EVENT_BEFORE_HUD (guiPosX 224.0 0.2 0.55) TRUE FONT_SUBTITLES (TRUE ALIGN_LEFT 640.0 TRUE) (255 255 255 80) 1 0 (0 0 0 80) (0 0 0 0 0) | |
ENDIF | |
RETURN | |
DrawRowIndicator: | |
// selected indicator | |
IF iCol > 0 | |
guiPosX = arX * 82.0 | |
guiSizX = arX * 2.0 | |
DRAW_TEXTURE_PLUS 0 DRAW_EVENT_BEFORE_HUD (guiPosX 230.0 guiSizX 10.0) 0.0 0.0 FALSE 0 0 (255 255 255 255) | |
ELSE | |
guiPosX = arX * 1.0 | |
guiSizX = arX * 2.0 | |
DRAW_TEXTURE_PLUS 0 DRAW_EVENT_BEFORE_HUD (guiPosX 230.0 guiSizX 10.0) 0.0 0.0 FALSE 0 0 (255 255 255 255) | |
ENDIF | |
RETURN | |
DrawHeader: | |
guiPosX = arX * 40.0 | |
guiSizX = arX * 80.0 | |
DRAW_STRING_EXT "Furniture" DRAW_EVENT_BEFORE_HUD (guiPosX 10.0 0.55 1.1) TRUE FONT_GOTHIC TRUE ALIGN_CENTER guiSizX FALSE (255 255 255 255) 0 0 (0 0 0 0) FALSE (0 0 0 0) | |
DRAW_STRING_EXT "Mod" DRAW_EVENT_BEFORE_HUD (guiPosX 25.0 0.55 1.1) TRUE FONT_GOTHIC TRUE ALIGN_CENTER guiSizX FALSE (255 255 255 255) 0 0 (0 0 0 0) FALSE (0 0 0 0) | |
DRAW_STRING_EXT "MixMods.com.br" DRAW_EVENT_BEFORE_HUD (guiPosX 50.0 0.2 0.4) TRUE FONT_SUBTITLES TRUE ALIGN_CENTER guiSizX FALSE (180 120 255 180) 0 0 (0 0 0 0) FALSE (0 0 0 0) | |
GET_TEXT_LABEL_STRING fuinf2 (timera) | |
DRAW_STRING_EXT $timera DRAW_EVENT_BEFORE_HUD (5.0 60.0 0.2 0.4) TRUE FONT_SUBTITLES TRUE ALIGN_LEFT guiSizX FALSE (255 255 255 255) 0 0 (0 0 0 0) FALSE (0 0 0 0) | |
RETURN | |
DrawMovementCommands: | |
CONST_FLOAT DRAW_MOVE_COMMANDS_ROW 10.0 | |
CONST_FLOAT DRAW_MOVE_COMMANDS_ROW_SMALL 5.0 | |
y = 300.0 | |
GET_TEXT_LABEL_STRING fucmd1 (timera) | |
GOSUB DrawMovementCommands_DrawThis | |
GET_TEXT_LABEL_STRING fucmd2 (timera) | |
GOSUB DrawMovementCommands_DrawThis | |
y += DRAW_MOVE_COMMANDS_ROW_SMALL | |
GET_TEXT_LABEL_STRING fucmd3 (timera) | |
GOSUB DrawMovementCommands_DrawThis | |
GET_TEXT_LABEL_STRING fucmd4 (timera) | |
GOSUB DrawMovementCommands_DrawThis | |
y += DRAW_MOVE_COMMANDS_ROW_SMALL | |
GET_TEXT_LABEL_STRING fucmd5 (timera) | |
GOSUB DrawMovementCommands_DrawThis | |
GET_TEXT_LABEL_STRING fucmd6 (timera) | |
GOSUB DrawMovementCommands_DrawThis | |
y += DRAW_MOVE_COMMANDS_ROW | |
GET_TEXT_LABEL_STRING fucmd7 (timera) | |
GOSUB DrawMovementCommands_DrawThis | |
GET_TEXT_LABEL_STRING fucmd8 (timera) | |
GOSUB DrawMovementCommands_DrawThis | |
GET_TEXT_LABEL_STRING fucmd9 (timera) | |
GOSUB DrawMovementCommands_DrawThis | |
GET_TEXT_LABEL_STRING fucmd10 (timera) | |
GOSUB DrawMovementCommands_DrawThis | |
RETURN | |
DrawMovementCommands_DrawThis: | |
DRAW_STRING_EXT $timera DRAW_EVENT_BEFORE_HUD (630.0 y 0.3 0.6) TRUE FONT_SUBTITLES TRUE ALIGN_RIGHT 0.0 FALSE (255 255 255 255) 1 0 (0 0 0 255) FALSE (0 0 0 0) | |
y += DRAW_MOVE_COMMANDS_ROW | |
RETURN | |
ShowCurObjectInfos: | |
IF DOES_OBJECT_EXIST hObj | |
GET_OBJECT_MODEL hObj (i) | |
IF CLEO_CALL IsModelWithCollision 0 (i)() | |
GET_TEXT_LABEL_STRING fuinf5 (timera) | |
ELSE | |
GET_TEXT_LABEL_STRING fuinf6 (timera) | |
ENDIF | |
DRAW_STRING_EXT $timera DRAW_EVENT_BEFORE_HUD (320.0 425.0 0.25 0.5) TRUE FONT_SUBTITLES TRUE ALIGN_CENTER 640.0 FALSE (255 255 255 255) 1 0 (0 0 0 255) FALSE (0 0 0 0) | |
STRING_FORMAT pBuffer "ID %i" i | |
DRAW_STRING_EXT $pBuffer DRAW_EVENT_BEFORE_HUD (320.0 435.0 0.25 0.5) TRUE FONT_SUBTITLES TRUE ALIGN_CENTER 640.0 FALSE (255 255 255 180) 1 0 (0 0 0 180) FALSE (0 0 0 0) | |
ENDIF | |
RETURN | |
OnSaveConfirmation: | |
//COPY_DIRECTORY and DELETE_DIRECTORY can't receive string pointers, so we need to: | |
//1- get 2 pet bottles | |
//2- make 1 hole in each | |
//3- blow | |
GET_LABEL_POINTER OldSaveSlot (j) | |
READ_MEMORY j 1 FALSE (j) | |
IF j > 0 | |
AND j <= 8 | |
AND NOT j = i | |
GET_LABEL_POINTER DeleteDirectory_Gambiarra (timera) | |
i += 48 //to ascii | |
WRITE_STRUCT_OFFSET timera 27 1 i | |
GOSUB DeleteDirectory_Gambiarra | |
j += 48 //to ascii | |
GET_LABEL_POINTER CopyDirectory_Gambiarra (timera) | |
WRITE_STRUCT_OFFSET timera 27 1 j | |
WRITE_STRUCT_OFFSET timera 53 1 i | |
IF GOSUB CopyDirectory_Gambiarra | |
ELSE | |
PRINT_NOW fuinf7 5000 1 | |
ENDIF | |
ENDIF | |
RETURN_SCRIPT_EVENT | |
DeleteDirectory_Gambiarra: | |
DELETE_DIRECTORY "CLEO\Furniture Mod\Save0" 0 //offset 27 | |
RETURN | |
CopyDirectory_Gambiarra: | |
COPY_DIRECTORY "CLEO\Furniture Mod\Save0" "CLEO\Furniture Mod\Save0" //offsets 27 53 | |
RETURN | |
} | |
SCRIPT_END | |
{ | |
LVAR_INT iModel //In | |
LVAR_INT i j pModelInfo pColModel pColData | |
IsModelWithCollision: | |
GET_MODEL_INFO iModel (pModelInfo) | |
IF NOT pModelInfo = 0 | |
READ_STRUCT_OFFSET pModelInfo 0x14 4 (pColModel) | |
IF NOT pColModel = 0 | |
READ_STRUCT_OFFSET pColModel 0x2C 4 (pColData) | |
IF NOT pColData = 0 | |
READ_STRUCT_OFFSET pColModel 0x4 2 (i) //m_wNumTriangles | |
IF i > 0 | |
RETURN_TRUE | |
CLEO_RETURN 0 () | |
ENDIF | |
READ_STRUCT_OFFSET pColModel 0x2 2 (i) //m_wNumBoxes | |
IF i > 0 | |
RETURN_TRUE | |
CLEO_RETURN 0 () | |
ENDIF | |
READ_STRUCT_OFFSET pColModel 0x0 2 (i) //m_wNumSpheres | |
IF i > 0 | |
RETURN_TRUE | |
CLEO_RETURN 0 () | |
ENDIF | |
ENDIF | |
ENDIF | |
ENDIF | |
RETURN_FALSE | |
CLEO_RETURN 0 () | |
} | |
{ | |
LVAR_INT lObjsNew //In | |
LVAR_INT i iSize hObj iPrice iTotalPrice | |
CountTotalPrice: | |
GET_LIST_SIZE lObjsNew (iSize) | |
WHILE i < iSize | |
GET_LIST_VALUE_BY_INDEX lObjsNew i (hObj) | |
GET_EXTENDED_OBJECT_VAR hObj AUTO 5 (iPrice) | |
IF iPrice > 0 | |
iTotalPrice += iPrice | |
ENDIF | |
++i | |
ENDWHILE | |
CLEO_RETURN 0 (iTotalPrice) | |
} | |
{ | |
LVAR_INT iQuestionGxtId iOptionsId bYes iTotalPrice //In | |
LVAR_INT pText i bCanConfirm pBuffer | |
LVAR_FLOAT arX f guiPosX guiSizX | |
LVAR_TEXT_LABEL tBuffer | |
TwoOptionsScreen: | |
GET_LABEL_POINTER Buffer (pBuffer) | |
WHILE TRUE | |
WAIT 0 | |
IF IS_KEY_JUST_PRESSED VK_KEY_Y | |
OR IS_BUTTON_JUST_PRESSED PAD1 CROSS | |
BREAK | |
ENDIF | |
IF IS_KEY_JUST_PRESSED VK_BACK | |
OR IS_KEY_JUST_PRESSED VK_KEY_N | |
bYes = FALSE | |
BREAK | |
ENDIF | |
IF bCanConfirm = TRUE | |
IF IS_KEY_JUST_PRESSED VK_LEFT | |
bYes = TRUE | |
ENDIF | |
IF IS_KEY_JUST_PRESSED VK_RIGHT | |
bYes = FALSE | |
ENDIF | |
ENDIF | |
GET_FIXED_XY_ASPECT_RATIO 1.0 1.0 (arX f) | |
DRAW_TEXTURE_PLUS 0 DRAW_EVENT_BEFORE_HUD (320.0 230.0 200.0 80.0) 0.0 0.0 TRUE 0 0 (0 0 0 180) | |
STRING_FORMAT tBuffer "fuque%i" $iQuestionGxtId | |
GET_TEXT_LABEL_STRING $tBuffer (pText) | |
DRAW_STRING_EXT $pText DRAW_EVENT_AFTER_HUD 320.0 205.0 0.3 0.6 TRUE FONT_SUBTITLES TRUE ALIGN_CENTER 200.0 FALSE 255 255 255 255 1 0 0 0 0 255 0 0 0 0 0 | |
bCanConfirm = TRUE | |
IF iTotalPrice > 0 | |
STRING_FORMAT pBuffer "$%i" $iTotalPrice | |
STORE_SCORE 0 (i) | |
i -= iTotalPrice | |
IF i >= 0 | |
DRAW_STRING_EXT $pBuffer DRAW_EVENT_AFTER_HUD 320.0 220.0 0.3 0.6 TRUE FONT_SUBTITLES TRUE ALIGN_CENTER 200.0 FALSE 50 255 0 255 1 0 0 0 0 255 0 0 0 0 0 | |
ELSE | |
DRAW_STRING_EXT $pBuffer DRAW_EVENT_AFTER_HUD 320.0 220.0 0.3 0.6 TRUE FONT_SUBTITLES TRUE ALIGN_CENTER 200.0 FALSE 255 50 0 255 1 0 0 0 0 255 0 0 0 0 0 | |
GET_TEXT_LABEL_STRING fuinf1 (pText) //You don't have enough money! | |
DRAW_STRING_EXT $pText DRAW_EVENT_AFTER_HUD 320.0 270.0 0.3 0.6 TRUE FONT_SUBTITLES TRUE ALIGN_CENTER 200.0 FALSE 255 50 0 255 1 0 0 0 0 255 0 0 0 0 0 | |
bCanConfirm = FALSE | |
bYes = FALSE | |
ENDIF | |
ENDIF | |
IF iOptionsId = 1 | |
GET_TEXT_LABEL_STRING fuqueA (pText) //OK | |
ELSE | |
GET_TEXT_LABEL_STRING fuqueC (pText) //Confirm | |
ENDIF | |
guiPosX = -50.0 * arX | |
guiPosX += 320.0 | |
DRAW_STRING_EXT $pText DRAW_EVENT_AFTER_HUD guiPosX 240.0 0.4 0.8 TRUE FONT_SUBTITLES TRUE ALIGN_CENTER 50.0 FALSE 255 255 255 255 0 0 0 0 0 255 bYes 80 80 80 255 | |
IF iOptionsId = 1 | |
GET_TEXT_LABEL_STRING fuqueB (pText) //Back | |
ELSE | |
GET_TEXT_LABEL_STRING fuqueD (pText) //Cancel | |
ENDIF | |
guiPosX = 50.0 * arX | |
guiPosX += 320.0 | |
BIT_XOR bYes 1 (i) | |
DRAW_STRING_EXT $pText DRAW_EVENT_AFTER_HUD guiPosX 240.0 0.4 0.8 TRUE FONT_SUBTITLES TRUE ALIGN_CENTER 50.0 FALSE 255 255 255 255 0 0 0 0 0 255 i 80 80 80 255 | |
ENDWHILE | |
IS_THING_EQUAL_TO_THING bYes 1 | |
CLEO_RETURN 0 () | |
} | |
{ | |
LVAR_INT hObj //In | |
LVAR_INT pQuat pX | |
LVAR_FLOAT x y z w f | |
GetObjectQuaternionSafe: | |
IF NOT GET_EXTENDED_OBJECT_VAR hObj AUTO 1 (f) | |
CLEO_RETURN 0 (0.0 0.0 0.0 1.0) | |
ENDIF | |
GET_EXTENDED_OBJECT_VAR hObj AUTO 1 (x) | |
GET_EXTENDED_OBJECT_VAR hObj AUTO 2 (y) | |
GET_EXTENDED_OBJECT_VAR hObj AUTO 3 (z) | |
GET_EXTENDED_OBJECT_VAR hObj AUTO 4 (w) | |
CLEO_RETURN 0 (x y z w) | |
} | |
{ | |
LVAR_INT pQuat | |
IdentityTempQuaternion: | |
GET_LABEL_POINTER TempQuaternion (pQuat) | |
WRITE_STRUCT_PARAM pQuat 0 0.0 | |
WRITE_STRUCT_PARAM pQuat 1 0.0 | |
WRITE_STRUCT_PARAM pQuat 2 0.0 | |
WRITE_STRUCT_PARAM pQuat 3 1.0 | |
CLEO_RETURN 0 (pQuat) | |
} | |
{ | |
LVAR_INT hObj //In | |
LVAR_INT pQuat pX | |
LVAR_FLOAT x y z w | |
StoreObjectQuaternion: | |
GET_LABEL_POINTER TempQuaternion (pQuat) | |
CLEO_CALL GetObjectQuaternionSafe 0 (hObj)(x y z w) | |
WRITE_STRUCT_PARAM pQuat 0 x | |
WRITE_STRUCT_PARAM pQuat 1 y | |
WRITE_STRUCT_PARAM pQuat 2 z | |
WRITE_STRUCT_PARAM pQuat 3 w | |
CLEO_RETURN 0 (pQuat) | |
} | |
{ | |
LVAR_INT hObj //In | |
LVAR_FLOAT x y z w //In | |
LVAR_FLOAT f | |
SetObjectQuaternion: | |
SET_OBJECT_QUATERNION hObj x y z w | |
IF NOT GET_EXTENDED_OBJECT_VAR hObj AUTO 1 (f) | |
INIT_EXTENDED_OBJECT_VARS hObj AUTO 5 | |
ENDIF | |
SET_EXTENDED_OBJECT_VAR hObj AUTO 1 (x) | |
SET_EXTENDED_OBJECT_VAR hObj AUTO 2 (y) | |
SET_EXTENDED_OBJECT_VAR hObj AUTO 3 (z) | |
SET_EXTENDED_OBJECT_VAR hObj AUTO 4 (w) | |
CLEO_RETURN 0 () | |
} | |
{ | |
LVAR_INT hObj pQuat //In | |
LVAR_FLOAT x y z w f | |
SetObjectQuaternionByPointer: | |
READ_STRUCT_OFFSET_MULTI pQuat 0x0 4 4 (x y z w) | |
CLEO_CALL SetObjectQuaternion 0 (hObj x y z w) | |
CLEO_RETURN 0 () | |
} | |
{ | |
LVAR_INT lObjs hObj //In | |
LVAR_INT i iSize hOldObj iModel | |
AddObjectToListSafe: | |
IF DOES_OBJECT_EXIST hObj | |
// avoid duplicating | |
GET_OBJECT_MODEL hObj (iModel) | |
GET_LIST_SIZE lObjs (iSize) | |
WHILE i < iSize | |
GET_LIST_VALUE_BY_INDEX lObjs i (hOldObj) | |
IF DOES_OBJECT_EXIST hOldObj | |
IF LOCATE_OBJECT_DISTANCE_TO_OBJECT hObj hOldObj 0.01 | |
AND DOES_OBJECT_HAVE_THIS_MODEL hOldObj iModel | |
RETURN_FALSE | |
CLEO_RETURN 0 () | |
ENDIF | |
ENDIF | |
++i | |
ENDWHILE | |
LIST_ADD lObjs hObj | |
RETURN_TRUE | |
CLEO_RETURN 0 () | |
ENDIF | |
RETURN_FALSE | |
CLEO_RETURN 0 () | |
} | |
{ | |
LVAR_INT lObjs //In | |
LVAR_INT i iSize hObj | |
RemoveObjects: | |
//PRINT_FORMATTED_NOW "Removing objects" 1000 | |
GET_LIST_SIZE lObjs (iSize) | |
WHILE i < iSize | |
GET_LIST_VALUE_BY_INDEX lObjs i (hObj) | |
DELETE_OBJECT hObj | |
++i | |
ENDWHILE | |
RESET_LIST lObjs | |
CLEO_RETURN 0 () | |
} | |
{ | |
LVAR_INT pBuffer lList //In | |
LVAR_INT hFile hObj iModel i iArea pQuat iVersion | |
LVAR_FLOAT x y z rotX rotY rotZ rotW | |
LoadObjectsFromFile: | |
IF OPEN_FILE $pBuffer 0x72 (hFile) | |
//PRINT_FORMATTED_NOW "Opened '%s'" 2000 $pBuffer | |
//WAIT 1000 | |
WHILE TRUE | |
IF IS_END_OF_FILE_REACHED hFile | |
BREAK | |
ENDIF | |
IF READ_STRING_FROM_FILE hFile pBuffer 127 | |
IF NOT IS_STRING_COMMENT $pBuffer | |
IF iVersion = 0 | |
IF IS_STRING_EQUAL $pBuffer "version" 7 FALSE "" | |
i = pBuffer + 8 | |
SCAN_STRING $i "%i" (i) iVersion | |
CONTINUE | |
ENDIF | |
ENDIF | |
i = 0 | |
SCAN_STRING $pBuffer "%i %i %f %f %f %f %f %f %f" (i) iModel iArea x y z rotX rotY rotZ rotW | |
IF i = 9 | |
//PRINT_FORMATTED_NOW "'%s' version %i" 2000 $pBuffer iVersion | |
//WAIT 1000 | |
REQUEST_MODEL iModel | |
LOAD_ALL_MODELS_NOW | |
CREATE_OBJECT_NO_SAVE iModel x y z FALSE FALSE hObj | |
// fix bad quaternion (otherwise they can't be rotated) | |
IF rotX = 0.0 | |
AND rotY = 0.0 | |
AND rotZ = 0.0 | |
AND rotW = 0.0 | |
rotW = 1.0 | |
ENDIF | |
CLEO_CALL SetObjectQuaternion 0 (hObj rotX rotY rotZ rotW) | |
SET_OBJECT_COORDINATES hObj x y z //force update quat | |
SET_OBJECT_AREA_VISIBLE hObj iArea | |
LIST_ADD lList hObj | |
MARK_MODEL_AS_NO_LONGER_NEEDED iModel | |
ENDIF | |
ENDIF | |
ENDIF | |
//WAIT 500 | |
ENDWHILE | |
ELSE | |
PRINT_FORMATTED_NOW "~r~Furniture Mod: Can't open '%s' to load." 2000 $pBuffer | |
ENDIF | |
CLOSE_FILE hFile | |
CLEO_RETURN 0 () | |
} | |
{ | |
LVAR_INT pBuffer lObjs lObjsNew //In | |
LVAR_INT hFile hObj iModel i iArea iSize pObj | |
LVAR_FLOAT x y z rotX rotY rotZ rotW | |
SaveObjectsToFile: | |
IF OPEN_FILE $pBuffer 0x2b77 (hFile) //w+ | |
//PRINT_FORMATTED_NOW "Opened '%s'" 2000 $pBuffer | |
//WAIT 1000 | |
i = FILE_VERSION | |
WRITE_FORMATTED_STRING_TO_FILE hFile "version %i" i | |
CLEO_CALL WriteNewLineToFile 0 (hFile)() | |
// move new list to old | |
GET_LIST_SIZE lObjsNew (iSize) | |
i = 0 | |
WHILE i < iSize | |
GET_LIST_VALUE_BY_INDEX lObjsNew i (hObj) | |
LIST_ADD lObjs hObj | |
++i | |
ENDWHILE | |
RESET_LIST lObjsNew | |
GET_LIST_SIZE lObjs (iSize) | |
i = 0 | |
WHILE i < iSize | |
GET_LIST_VALUE_BY_INDEX lObjs i (hObj) | |
GET_OBJECT_MODEL hObj (iModel) | |
GET_OBJECT_POINTER hObj (pObj) | |
READ_STRUCT_OFFSET pObj 0x2F 1 (iArea) | |
GET_OBJECT_COORDINATES hObj (x y z) | |
CLEO_CALL GetObjectQuaternionSafe 0 (hObj)(rotX rotY rotZ rotW) | |
//PRINT_FORMATTED_NOW "write %f" 1000 rotW | |
//WAIT 500 | |
IF rotX = 0.0 | |
AND rotY = 0.0 | |
AND rotZ = 0.0 | |
AND rotW = 1.0 | |
WRITE_FORMATTED_STRING_TO_FILE hFile "%i %i %.5f %.5f %.5f 0.0 0.0 0.0 1.0" iModel iArea x y z | |
ELSE | |
WRITE_FORMATTED_STRING_TO_FILE hFile "%i %i %.5f %.5f %.5f %.5f %.5f %.5f %.5f" iModel iArea x y z rotX rotY rotZ rotW | |
ENDIF | |
CLEO_CALL WriteNewLineToFile 0 (hFile)() | |
++i | |
ENDWHILE | |
//PRINT_FORMATTED_NOW "~y~Saved to '%s'." 1000 $pBuffer | |
//WAIT 1000 | |
ELSE | |
PRINT_FORMATTED_NOW "~r~Furniture Mod: Can't open '%s' to save." 2000 $pBuffer | |
ENDIF | |
CLOSE_FILE hFile | |
CLEO_RETURN 0 () | |
} | |
{ | |
LVAR_INT hFile //In | |
LVAR_INT pBuffer | |
WriteNewLineToFile: | |
GET_LABEL_POINTER Buffer (pBuffer) | |
WRITE_STRUCT_OFFSET pBuffer 0 1 0x0A | |
WRITE_STRUCT_OFFSET pBuffer 1 1 0x00 | |
WRITE_STRING_TO_FILE hFile $pBuffer | |
CLEO_RETURN 0 () | |
} | |
{ | |
LVAR_INT pEnex pBuffer //In | |
LVAR_FLOAT f | |
LVAR_INT iX iY iZ iSaveSlot | |
BuildEnexFilename: | |
GET_CURRENT_SAVE_SLOT (iSaveSlot) | |
IF pEnex = 0 | |
STRING_FORMAT pBuffer "CLEO\Furniture Mod\Save%i\exterior.dat" iSaveSlot | |
CLEO_RETURN 0 () | |
ENDIF | |
READ_STRUCT_OFFSET pEnex 0x8 4 (f) //x | |
iX =# f | |
READ_STRUCT_OFFSET pEnex 0xC 4 (f) //y | |
iY =# f | |
READ_STRUCT_OFFSET pEnex 0x18 4 (f) //z | |
iZ =# f | |
STRING_FORMAT pBuffer "CLEO\Furniture Mod\Save%i\%i,%i,%i.dat" iSaveSlot iX iY iZ | |
CLEO_RETURN 0 () | |
} | |
{ | |
LVAR_FLOAT fSpeed fSourceX fSourceY fSourceZ fOffsetX fOffsetY fOffsetZ //In | |
LVAR_FLOAT fDiffX fDiffY fDiffZ fCamX fCamY fCamZ | |
MoveInCameraDirection: | |
GET_OFFSET_FROM_CAMERA_IN_WORLD_COORDS fOffsetX fOffsetY fOffsetZ (fCamX fCamY fCamZ) | |
GET_OFFSET_FROM_CAMERA_IN_WORLD_COORDS 0.0 0.0 0.0 (fDiffX fDiffY fDiffZ) | |
fDiffX -= fCamX | |
fDiffY -= fCamY | |
//fDiffZ -= fCamZ | |
fDiffX *= fSpeed | |
fDiffY *= fSpeed | |
//fDiffZ *= fSpeed | |
fSourceX +=@ fDiffX | |
fSourceY +=@ fDiffY | |
//fSourceZ +=@ fDiffZ | |
CLEO_RETURN 0 (fSourceX fSourceY fSourceZ) | |
} | |
{ | |
LVAR_INT iCol1Row p lList | |
InitCategoryList: | |
GET_LABEL_POINTER Lists (p) | |
WHILE iCol1Row < CAT_MAX | |
CREATE_LIST DATATYPE_INT (lList) | |
WRITE_STRUCT_PARAM p iCol1Row lList | |
++iCol1Row | |
ENDWHILE | |
CLEO_RETURN 0 () | |
} | |
{ | |
LVAR_INT iCol1Row //In | |
LVAR_INT p lList | |
GetCategoryList: | |
GET_LABEL_POINTER Lists (p) | |
READ_STRUCT_PARAM p iCol1Row lList | |
CLEO_RETURN 0 (lList) | |
} | |
{ | |
LVAR_FLOAT fMouseCamXY fMouseCamZ fMouseCamDistXY fMouseCamDistZ fMouseCamDistZoomSpeed //In | |
LVAR_INT p | |
InitOrbitMouseCamera: | |
GET_LABEL_POINTER MouseCamLastXY (p) | |
WRITE_MEMORY p 4 fMouseCamXY FALSE | |
GET_LABEL_POINTER MouseCamLastZ (p) | |
WRITE_MEMORY p 4 fMouseCamZ FALSE | |
fMouseCamDistXY *= -1.0 | |
GET_LABEL_POINTER MouseCamDistXY (p) | |
WRITE_MEMORY p 4 fMouseCamDistXY FALSE | |
GET_LABEL_POINTER MouseCamDistZ (p) | |
WRITE_MEMORY p 4 fMouseCamDistZ FALSE | |
GET_LABEL_POINTER MouseCamDistZoomSpeed (p) | |
WRITE_MEMORY p 4 fMouseCamDistZoomSpeed FALSE | |
CLEO_RETURN 0 () | |
} | |
{ | |
LVAR_INT pEntity bControl //In | |
LVAR_FLOAT zCamOffset //In | |
LVAR_INT i j p | |
LVAR_FLOAT f g x y z fCurrMouseCamXY fCurrMouseCamZ fAngle fMoveX fMoveY fMouseCamDistXY fMouseCamDistZ fFinalX fFinalY fFinalZ fMouseCamDistZoomSpeed | |
UpdateOrbitMouseCamera: | |
GET_LABEL_POINTER MouseCamLastXY (p) | |
READ_MEMORY p 4 FALSE (fCurrMouseCamXY) | |
GET_LABEL_POINTER MouseCamLastZ (p) | |
READ_MEMORY p 4 FALSE (fCurrMouseCamZ) | |
GET_LABEL_POINTER MouseCamDistXY (p) | |
READ_MEMORY p 4 FALSE (fMouseCamDistXY) | |
GET_LABEL_POINTER MouseCamDistZ (p) | |
READ_MEMORY p 4 FALSE (fMouseCamDistZ) | |
GET_LABEL_POINTER MouseCamDistZoomSpeed (p) | |
READ_MEMORY p 4 FALSE (fMouseCamDistZoomSpeed) | |
IF pEntity = 0 | |
OR pEntity = -1 | |
GET_PLAYER_CHAR 0 (i) | |
GET_PED_POINTER i (pEntity) | |
ENDIF | |
GET_ENTITY_COORDINATES pEntity x y z | |
z += zCamOffset | |
IF bControl = TRUE | |
IF GOSUB UpdateOrbitMouseCamera_ValidToScroll | |
IF IS_MOUSE_WHEEL_UP | |
fMouseCamDistXY += fMouseCamDistZoomSpeed | |
fMouseCamDistZ -= fMouseCamDistZoomSpeed | |
GOSUB UpdateOrbitMouseCamera_SetCurrTimeScroll | |
ENDIF | |
IF IS_MOUSE_WHEEL_DOWN | |
fMouseCamDistXY -= fMouseCamDistZoomSpeed | |
fMouseCamDistZ += fMouseCamDistZoomSpeed | |
GOSUB UpdateOrbitMouseCamera_SetCurrTimeScroll | |
ENDIF | |
ENDIF | |
GET_PC_MOUSE_MOVEMENT fMoveX fMoveY | |
GET_MOUSE_SENSIBILITY f | |
f *= 80.0 //sensibility | |
fMoveX *= f | |
fMoveY *= f | |
IF IS_MOUSE_USING_VERTICAL_INVERSION | |
fMoveY *= -1.0 | |
ENDIF | |
fCurrMouseCamXY += fMoveX | |
fCurrMouseCamZ += fMoveY | |
ENDIF | |
IF fCurrMouseCamZ > 60.0 | |
fCurrMouseCamZ = 60.0 | |
ENDIF | |
IF fCurrMouseCamZ < -50.0 | |
fCurrMouseCamZ = -50.0 | |
ENDIF | |
LIMIT_ANGLE fCurrMouseCamXY (fAngle) | |
SIN fAngle (f) | |
f *= fMouseCamDistXY | |
fFinalX = f + x | |
COS fAngle (f) | |
f *= fMouseCamDistXY | |
fFinalY = f + y | |
LIMIT_ANGLE fCurrMouseCamZ (fAngle) | |
SIN fAngle (f) | |
COS fAngle (g) | |
f /= g | |
f *= fMouseCamDistZ | |
fFinalZ = f + z | |
SET_FIXED_CAMERA_POSITION fFinalX fFinalY fFinalZ 0.0 0.0 0.0 | |
POINT_CAMERA_AT_POINT x y z 2 | |
GET_LABEL_POINTER MouseCamLastXY (p) | |
WRITE_MEMORY p 4 fCurrMouseCamXY FALSE | |
GET_LABEL_POINTER MouseCamLastZ (p) | |
WRITE_MEMORY p 4 fCurrMouseCamZ FALSE | |
GET_LABEL_POINTER MouseCamDistXY (p) | |
WRITE_MEMORY p 4 fMouseCamDistXY FALSE | |
GET_LABEL_POINTER MouseCamDistZ (p) | |
WRITE_MEMORY p 4 fMouseCamDistZ FALSE | |
CLEO_RETURN 0 () | |
UpdateOrbitMouseCamera_ValidToScroll: | |
GET_LABEL_POINTER MouseCamLastScrollTime (p) | |
READ_MEMORY p 4 FALSE (i) | |
GET_GAME_TIMER j | |
j -= i | |
IS_THING_GREATER_THAN_THING j 40 //ms | |
RETURN | |
UpdateOrbitMouseCamera_SetCurrTimeScroll: | |
GET_LABEL_POINTER MouseCamLastScrollTime (p) | |
GET_GAME_TIMER j | |
WRITE_MEMORY p 4 j FALSE | |
RETURN | |
} | |
{ | |
LVAR_INT iModel pBuffer //In | |
LVAR_INT pText i | |
LVAR_TEXT_LABEL tBuffer | |
GetModelDisplayName: | |
STRING_FORMAT tBuffer "fu%i" $iModel | |
GET_TEXT_LABEL_STRING $tBuffer (pText) | |
IF NOT pText = 0 | |
GET_STRING_LENGTH $pText (i) | |
IF i > 1 | |
CLEO_RETURN 0 (pText) | |
ENDIF | |
ENDIF | |
STRING_FORMAT pBuffer "ID %i" $iModel | |
CLEO_RETURN 0 (pBuffer) | |
} | |
{ | |
LVAR_INT iModel pModelName //In | |
LVAR_INT pText i | |
LVAR_TEXT_LABEL tBuffer | |
BuildDisplayNameIfNotExist: | |
STRING_FORMAT tBuffer "fu%i" $iModel | |
GET_TEXT_LABEL_STRING $tBuffer (pText) | |
IF NOT pText = 0 | |
GET_STRING_LENGTH $pText (i) | |
IF i > 0 | |
CLEO_RETURN 0 () | |
ENDIF | |
ENDIF | |
ADD_TEXT_LABEL $tBuffer $pModelName | |
CLEO_RETURN 0 () | |
} | |
{ | |
LVAR_INT hChar bToggle //In | |
LVAR_INT pChar iFlags | |
ToggleCharVisibility: | |
GET_PED_POINTER hChar (pChar) | |
READ_STRUCT_OFFSET pChar 0x474 4 (iFlags) | |
IF bToggle = FALSE | |
SET_LOCAL_VAR_BIT_CONST iFlags 1 | |
SET_LOCAL_VAR_BIT_CONST iFlags 2 | |
ELSE | |
CLEAR_LOCAL_VAR_BIT_CONST iFlags 1 | |
CLEAR_LOCAL_VAR_BIT_CONST iFlags 2 | |
ENDIF | |
WRITE_STRUCT_OFFSET pChar 0x474 4 iFlags | |
CLEO_RETURN 0 () | |
} | |
{ | |
LVAR_INT pBuffer pBuffer2 hFileFind iCat hFile lItems i j iModel iPrice piPrice iCountItemsCantBeLoaded iDefaultPrice iMultiplyPrice | |
ReadConfig: | |
GET_LABEL_POINTER Buffer (pBuffer) | |
GET_LABEL_POINTER Buffer2 (pBuffer2) | |
IF FIND_FIRST_FILE "CLEO\Furniture Mod\Items\*.dat" hFileFind pBuffer2 | |
IF NOT READ_INT_FROM_INI_FILE "CLEO\Furniture Mod.ini" "Settings" "DefaultPrice" (iDefaultPrice) | |
iDefaultPrice = 0 | |
ENDIF | |
IF NOT READ_INT_FROM_INI_FILE "CLEO\Furniture Mod.ini" "Settings" "MultiplyPrice" (iMultiplyPrice) | |
iMultiplyPrice = 1 | |
ENDIF | |
WHILE TRUE | |
STRING_FORMAT pBuffer "CLEO\Furniture Mod\Items\%s" $pBuffer2 | |
IF OPEN_FILE $pBuffer 0x72 (hFile) | |
iCat = CAT_NONE | |
WHILE TRUE | |
READ_STRING_FROM_FILE hFile pBuffer 127 | |
IF NOT IS_STRING_COMMENT $pBuffer | |
SET_STRING_LOWER pBuffer | |
IF NOT iCat = CAT_NONE | |
IF IS_STRING_EQUAL $pBuffer "end" 3 FALSE "" | |
iCat = CAT_NONE | |
ELSE | |
iPrice = iDefaultPrice | |
SCAN_STRING $pBuffer "%i %i" (i) iModel iPrice | |
IF i > 0 | |
IF IS_MODEL_AVAILABLE iModel | |
ReadConfig_AddItem: | |
iPrice *= iMultiplyPrice | |
//PRINT_FORMATTED_NOW "model %i price %i" 1000 iModel iPrice | |
ALLOCATE_MEMORY TOTAL_SIZE (i) | |
WRITE_STRUCT_OFFSET i OFFSET_MODEL 4 iModel | |
WRITE_STRUCT_OFFSET i OFFSET_PRICE 4 iPrice | |
CLEO_CALL GetCategoryList 0 (iCat)(lItems) | |
LIST_ADD lItems i | |
ELSE | |
++iCountItemsCantBeLoaded | |
ENDIF | |
ELSE | |
iPrice = iDefaultPrice | |
//sscanf because SCAN_STRING doesn't work on current gta3script version | |
GET_VAR_POINTER iPrice (piPrice) | |
CALL_FUNCTION_RETURN 0x8220AD 4 4 (piPrice pBuffer2 "%s%i" pBuffer)(i) | |
IF i > 0 | |
//PRINT_FORMATTED_NOW "trying to find '%s'" 2000 $pBuffer2 | |
//WAIT 1000 | |
IF GET_MODEL_BY_NAME $pBuffer2 (iModel) | |
CLEO_CALL BuildDisplayNameIfNotExist 0 (iModel pBuffer2)() | |
GOTO ReadConfig_AddItem | |
ELSE | |
++iCountItemsCantBeLoaded | |
ENDIF | |
ENDIF | |
ENDIF | |
ENDIF | |
ELSE | |
IF IS_STRING_EQUAL $pBuffer "table" 15 TRUE "" | |
iCat = CAT_TABLE | |
ENDIF | |
IF IS_STRING_EQUAL $pBuffer "chair" 15 TRUE "" | |
iCat = CAT_CHAIR | |
ENDIF | |
IF IS_STRING_EQUAL $pBuffer "couch" 15 TRUE "" | |
iCat = CAT_COUCH | |
ENDIF | |
IF IS_STRING_EQUAL $pBuffer "cabinet" 15 TRUE "" | |
iCat = CAT_CABINET | |
ENDIF | |
IF IS_STRING_EQUAL $pBuffer "kitchen" 15 TRUE "" | |
iCat = CAT_KITCHEN | |
ENDIF | |
IF IS_STRING_EQUAL $pBuffer "light" 15 TRUE "" | |
iCat = CAT_LIGHT | |
ENDIF | |
IF IS_STRING_EQUAL $pBuffer "frame" 15 TRUE "" | |
iCat = CAT_FRAME | |
ENDIF | |
IF IS_STRING_EQUAL $pBuffer "appliance" 15 TRUE "" | |
iCat = CAT_APPLIANCE | |
ENDIF | |
IF IS_STRING_EQUAL $pBuffer "bathroom" 15 TRUE "" | |
iCat = CAT_BATHROOM | |
ENDIF | |
IF IS_STRING_EQUAL $pBuffer "bed" 15 TRUE "" | |
iCat = CAT_BED | |
ENDIF | |
IF IS_STRING_EQUAL $pBuffer "floor" 15 TRUE "" | |
iCat = CAT_FLOOR | |
ENDIF | |
IF IS_STRING_EQUAL $pBuffer "life" 15 TRUE "" | |
iCat = CAT_LIFE | |
ENDIF | |
IF IS_STRING_EQUAL $pBuffer "misc" 15 TRUE "" | |
iCat = CAT_MISC | |
ENDIF | |
IF IS_STRING_EQUAL $pBuffer "custom" 15 TRUE "" | |
iCat = CAT_CUSTOM | |
ENDIF | |
ENDIF | |
ENDIF | |
IF IS_END_OF_FILE_REACHED hFile | |
BREAK | |
ENDIF | |
ENDWHILE | |
ELSE | |
PRINT_FORMATTED_NOW "~r~Furniture Mod: Can't open file '%s'" 1000 $pBuffer | |
WAIT 2000 | |
ENDIF | |
CLOSE_FILE hFile | |
IF NOT FIND_NEXT_FILE hFileFind pBuffer2 | |
BREAK | |
ENDIF | |
ENDWHILE | |
ENDIF | |
IF iCountItemsCantBeLoaded > 0 | |
PRINT_FORMATTED_NOW "~r~Fail to find %i models." 2000 iCountItemsCantBeLoaded | |
ENDIF | |
CLEO_RETURN 0 () | |
} | |
MouseCamLastXY: | |
DUMP | |
00 00 00 00 | |
ENDDUMP | |
MouseCamLastZ: | |
DUMP | |
00 00 00 00 | |
ENDDUMP | |
MouseCamDistXY: | |
DUMP | |
00 00 00 00 | |
ENDDUMP | |
MouseCamDistZ: | |
DUMP | |
00 00 00 00 | |
ENDDUMP | |
MouseCamLastScrollTime: | |
DUMP | |
00 00 00 00 | |
ENDDUMP | |
MouseCamDistZoomSpeed: | |
DUMP | |
00 00 00 00 | |
ENDDUMP | |
TempQuaternion: | |
DUMP | |
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
ENDDUMP | |
Lists: | |
DUMP | |
// must be at least CAT_MAX | |
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 //8 | |
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 //16 | |
ENDDUMP | |
Buffer: | |
DUMP | |
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
ENDDUMP | |
Buffer2: | |
DUMP | |
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
ENDDUMP | |
NewSaveFolder: | |
DUMP | |
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
ENDDUMP | |
OldSaveSlot: | |
DUMP | |
00 | |
ENDDUMP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment