![]() ![]() |
![]() ![]() Post #1 | |
![]() Actually living entity Posts: 143 From: Earth Joined: 15-January 11 ![]() | I was messing around with Wesser's CScriptEngine_update CLEO script (including ThirteenAG's fix for disappearing textures in a top-down view angle). What my edited version of this script does, is that if you move the camera to see the car or player from a near ground angle (from below), the Field Of View increases from 70.0 (default) to 100.0 (bug-free maximum) dependant on how low you move the camera (dynamic). Someone made a script (building effect) which continuously sets the FOV to a fixed value. That might look good for screenshots but I dont like to have that ingame all the time. So I edited CScriptEngine_update because ThirteenAG's version already uses some values needed to make things more dynamic.. I'm having problems with flickering FOV from certain view angles. Often happening in cinematic mode - so I disabled it for cinematic mode. This bug also happens in the stunt jumps camera view. Would be cool if a solution would be found without disabling this feature for those far-distance-views. Another thing that annoys me is, if you slowly move the camera back up, the view angle gets updated verry laggy.. The lowest "timelimit" value for 0922 opcode seems to be '40' wich is still too high to kill this bug by adjusting the timelimit parameter. And maybe someone knows what the last parameter of 0922 does? *updated* CODE { @Wesser & @ThirteenAG: Hope you don't mind and big thanks for your scripts / fixes.FUNCTIONS INCLUDED: - getLabelOffset Type: GET Description: Get a label offset. } {$CLEO} 0000: NOP // NOP CPad__update's call 0A8C: write_memory 0x53BEE6 size 4 value 0x90909090 virtual_protect 1 0A8C: write_memory 0x53BEEA size 1 value 0x90 virtual_protect 1 // Call CPad__update() by overwriting a NOP call 0A8C: write_memory 0x53C131 size 4 value 0x5C9AE8 virtual_protect 1 0A8C: write_memory 0x53C135 size 1 value 0x0 virtual_protect 1 // NOP CScriptEngine__process's call 0A8C: write_memory 0x53BFC7 size 4 value 0x90909090 virtual_protect 1 0A8C: write_memory 0x53BFCB size 1 value 0x90 virtual_protect 1 // Call CScriptEngine__process() by overwriting a NOP call 0A8C: write_memory 0x53C215 size 4 value 0xF2DDE6E8 virtual_protect 1 0A8C: write_memory 0x53C219 size 1 value 0xFF virtual_protect 1 0A8D: 1@ = read_memory 0x46A22F size 4 virtual_protect 1 1@ += 0x46A22E 1@ += 15 //_updateLoadingBar + 10 address in cleo.asi 1@ += 1 0A8D: 2@ = read_memory 1@ size 4 virtual_protect 1 1@ -= 1 0085: 3@ = 1@ // (int) 005A: 3@ += 2@ 3@ += 5 3@ -= 0x0053C215 3@ -= 5 0A8D: 5@ = read_memory 0x53C216 size 4 virtual_protect 1 if 5@ == 0x00066EF6 then 0A8C: write_memory 0x53C215 size 1 value 0xE8 virtual_protect 1 0A8C: write_memory 0x53C216 size 4 value 3@ virtual_protect 1 1@ += 1 0A8F: 4@ = 0x856C7C - 1@ // int 0A8C: write_memory 1@ size 4 value 4@ virtual_protect 1 end 0AB1: call_scm_func @getLabelOffset 1 label @CPadHook store_to 0@ 0@ -= 0x53BF9C 0A8C: write_memory 0x53BF98 size 4 value 0@ virtual_protect 1 //0A93: missing textures fix //0A8C: write_memory 0xBA6788 size 4 value 1.4 virtual_protect 0 //0A8C: write_memory 0x8CD800 size 4 value 1.4 virtual_protect 0 var 7@: float 8@: float 9@: float 11@: float 12@: float 13@: float 14@: float 15@: float end while true wait 0 0A8D: 10@ = read_memory 0x8CD800 size 4 virtual_protect 0 068D: get_camera_position_to 7@ 8@ 9@ 068E: get_camera_target_point_to 11@ 12@ 13@ 9@ -= 13@ //0AD1: show_formatted_text_highpriority "View axis: %f" 100 9@ if and 9@ > 0.96 9@ < 1.00 then if 10@ <> 0.9 then 0A8C: write_memory 0xBA6788 size 4 value 0.9 virtual_protect 0 0A8C: write_memory 0x8CD800 size 4 value 0.9 virtual_protect 0 end else if 10@ <> 1.4 then 0A8C: write_memory 0xBA6788 size 4 value 1.4 virtual_protect 0 0A8C: write_memory 0x8CD800 size 4 value 1.4 virtual_protect 0 end end // -- Dynamic FOV -- IF 816B: not fading jf continue if 06B9: cutscene_data_loaded then if 82E9: not cutscene_reached_end then continue end end if 844B: not actor $PLAYER_ACTOR on_foot then 0A39: get_vehicle_camera_mode_to 16@ if not 16@ == 0 // - Bumper view jf continue else IF 00E1: player 0 pressed_key 6 // - Aim Weapon THEN IF AND 82D8: not actor $PLAYER_ACTOR current_weapon == 43 // #camera 82D8: not actor $PLAYER_ACTOR current_weapon == 30 // #ak47 82D8: not actor $PLAYER_ACTOR current_weapon == 31 // #m4 //82D8: not actor $PLAYER_ACTOR current_weapon == 34 // #sniper JF continue END end 0801: get_camera_zoom_factor_to 14@ // float //0AD1: show_formatted_text_highpriority "View axis: %f - Zoom: %f" 100 9@ 14@ 15@ = 9@ 15@ *= -1.0 15@ *= 100.0 if 9@ > 0.0 then 15@ /= 9.0 else 15@ /= 2.333 end 15@ += 70.0 if 15@ > 100.0 then 15@ = 100.0 end if 15@ >= 14@ then 0922: set_camera_zoom_in_factor 15@ out_factor 15@ timelimit 50 mode 0 ELSE IF and 9@ < 0.0 044B: actor $PLAYER_ACTOR on_foot THEN 0922: set_camera_zoom_in_factor 15@ out_factor 14@ timelimit 50 mode 0 END end //0AD1: show_formatted_text_highpriority "FOV: %f - Zoom: %f" 100 15@ 14@ end :CPadHook hex B8 D01D5400 // mov eax, 541DD0h FFD0 // call eax B8 34C25300 // mov eax, 53C234h FFE0 // jmp eax end :getLabelOffset { Parameters: Passed: 0@ - label name Result: 1@ - label offset Example: 0AB1: call_scm_func @getLabelOffset 1 label @LABEL store_to 1@ } if 0@ <> 0 then 0A9F: 1@ = current_thread_pointer 1@ += 0x10 0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0 0062: 1@ -= 0@ else 1@ = 0 end 0AB2: ret 1 1@ This post has been edited by uokka: Apr 28 2012, 07:05 PM -------------------- |
![]() Post #2 | |
![]() Actually living entity Posts: 143 From: Earth Joined: 15-January 11 ![]() | OK, I got both glitches fixed. Now the camera moves smoothly. ![]() This post has been edited by uokka: Apr 21 2012, 09:20 PM -------------------- |
![]() Post #3 | |
![]() Actually living entity Posts: 143 From: Earth Joined: 15-January 11 ![]() | Updated again to not eliminate the Vertgio effect/speed related FOV when in a car. -------------------- |
![]() Post #4 | |
![]() Member Posts: 197 From: Liberty City, Shoreside Joined: 15-July 10 ![]() | So why didnt you make it as a new script? |
![]() Post #5 | |
![]() Actually living entity Posts: 143 From: Earth Joined: 15-January 11 ![]() | Well, I dunno.. It evolved from this script which is already using view angle values. World coords are still smoothly updated as Wesser's script was originaly intended to. Should I seperate it to save performance? I don't know much about that, I thought I would save performance by not using another thread.. ? CODE {$CLEO} 0000: NOP var 7@: float 8@: float 9@: float 11@: float 12@: float 13@: float 14@: float 15@: float end WHILE TRUE wait 0 // -- Dynamic FOV -- IF 816B: not fading jf continue if 06B9: cutscene_data_loaded then if 02E9: cutscene_reached_end JF continue end if 844B: not actor $PLAYER_ACTOR on_foot then 0A39: get_vehicle_camera_mode_to 16@ if not 16@ == 0 // - Bumper view jf continue else IF 00E1: player 0 pressed_key 6 // - Aim Weapon THEN IF AND 82D8: not actor $PLAYER_ACTOR current_weapon == 43 // #camera 82D8: not actor $PLAYER_ACTOR current_weapon == 30 // #ak47 82D8: not actor $PLAYER_ACTOR current_weapon == 31 // #m4 //82D8: not actor $PLAYER_ACTOR current_weapon == 34 // #sniper JF continue END end 068D: get_camera_position_to 7@ 8@ 9@ 068E: get_camera_target_point_to 11@ 12@ 13@ 9@ -= 13@ 0801: get_camera_zoom_factor_to 14@ // float //0AD1: show_formatted_text_highpriority "View axis: %f - Zoom: %f" 100 9@ 14@ 15@ = 9@ 15@ *= -1.0 15@ *= 100.0 if 9@ > 0.0 then 15@ /= 9.0 else 15@ /= 2.333 end 15@ += 70.0 if 15@ > 100.0 then 15@ = 100.0 end if 15@ >= 14@ then 0922: set_camera_zoom_in_factor 15@ out_factor 15@ timelimit 50 mode 0 ELSE IF and 9@ < 0.0 044B: actor $PLAYER_ACTOR on_foot THEN 0922: set_camera_zoom_in_factor 15@ out_factor 14@ timelimit 50 mode 0 END end END This post has been edited by uokka: Apr 29 2012, 02:35 PM -------------------- |
![]() Post #6 | |
![]() Coding like a Rockstar! ![]() Posts: 1,468 From: ??? Joined: 28-May 09 ![]() | You loose performance the more scripts there are. Only by a tiny bit, though. The script engine loops through all the running scripts individually. On each script it parses the code until a return is made (by wait 0 or select few other opcodes). To answer a previous question, the last parameter of 0922 I named in the v2 sascm.ini as "smooth_transition" and similar flags exist on many camera opcodes. When set to 1, the movement (in this case, the zoom speed) gradually increases until the middle of the transition, then slows down. Imagine a bell curve represents the speed. Otherwise it will be a fixed speed all the way through. -------------------- | CLEO 4.3.22 | A?i?a?o?3D | UI SDK | Black Market Mod 1.0.1 | GInput 0.3 | Cheat Keyboard | Tactile Cheat Activation | Stream Ini Extender 0.7 | SuperVars | ScrDebug | Vigilante Justice: San Andreas | |
![]() Post #7 | |
![]() Actually living entity Posts: 143 From: Earth Joined: 15-January 11 ![]() | Thanks for clarifying. I'm running from one bug into another.. Why doesn't this code prevent the script from working in the intro sceene? CODE IF 816B: not fading jf continue if 06B9: cutscene_data_loaded then if 02E9: cutscene_reached_end JF continue end -------------------- |
![]() Post #8 | |
![]() Member Posts: 197 From: Liberty City, Shoreside Joined: 15-July 10 ![]() | @Deji Did you researched database to make description for this opcode? ![]() This post has been edited by DK22: May 3 2012, 08:08 PM |
![]() ![]() |