- 33
- 7
- Версия SA-MP
-
- 0.3.7 (R1)
Недавно вернулся в САшку (увы но ламповых фулл/медрп в пятёрке пока нормальных нет) и начал играть со skygfx, но его графика слишком жрёт глаза, да и капли при дожде меня там особо не устраивают (их всего две вариации, как и в приведённом ниже скрипте), потому я пару месяцев назад вспомнил о старом скрипте Droplets. Но увы, из-за того, что я не работал с клео уже лет 300 пока не сидел в СА — у меня не получилось адекватно переделать данный клео, дабы добавлять больше вариаций капель + нормально увеличить их количество на экране. Может сможет кто глянуть эту шляпу? Стандартный его код:
Мб возможно не криво (потому что у меня не вышло) разобрать эти пол тысячи строчек и увеличить количество капель дождя до 4-5 + примерно в 2 раза увеличить общее количество капель на экране?
CLEO:
{$CLEO .cs}
0000:
wait 0
32@ = 0 // Timer for droplets' small 'shacking'.
{
Memory struct:
[INT] Exists? = 1 byte
[INT] Timer of (dis)appearing = 2 bytes
[INT] Type = 1 byte
[FLOAT] Size = 4 bytes
[FLOAT] Pos Õ = 4 bytes
[FLOAT] Pos Ó = 4 bytes
[FLOAT] Speed Õ = 4 bytes
[FLOAT] Speed Ó = 4 bytes
Totally:
8 (droplets' count) * (1 + 2 + 1 + 4 + 4 + 4 + 4 + 4) = 8 * 24 = 192
16 (blood droplets' count) * (1 + 2 + 1 + 4 + 4 + 4 + 4 + 4) = 16 * 24 = 384
}
0AC8: 0@ = allocate_memory_size 192
0AC8: 21@ = allocate_memory_size 384
0390: load_txd_dictionary 'vcRainR'
038F: load_texture "raindrop1" as 1
038F: load_texture "raindrop2" as 2
038F: load_texture "raindropb1" as 3
038F: load_texture "raindropb2" as 4
//0ADF: add_dynamic_GXT_entry "_TEST" text "Hydrant"
//0ADF: add_dynamic_GXT_entry "_TEST2" text "Ped"
//0ADF: add_dynamic_GXT_entry "_TEST3" text "CAR"
{
Variables:
... - didn't used
0@ droplets' data buffer
1@ FOR cycle. Shows current droplet that is on queue.
2@ pointer to 0@ or 21@. Need for easy calculation
3@ just an integer var for work
4@ just a float var for work
5@-6@ player's coord
7@ ...
8@ droplet's X-size
9@ droplet's type
10@ droplet's X-size
11@ droplet's X-pos
12@ remembered memory address for droplet's X-pos
13@ droplet's Y-pos
14@ remembered memory address for droplet's Y-pos
15@ droplet's X-speed
16@ droplet's Y-speed
17@ one more float var for work
18@ ...
19@ The player is in the boat and driving? It's like one more integer var for work
20@ ...
21@ droplets' data buffer
22@ Player is using chainsaw? = It's allowed to create blood droplets?
23@ Check for different timers in @DrawAndSet (bloods are faster disappear than droplets).
24@ ...
25@ ...
26@ Event1
27@ ...
28@ Event2
29@ var for 'forallcars' included FOR cycle
30@ var for 'forallcars' included FOR cycle
31@ var for 'forallcars' included FOR cycle
32@ timer
}
while true // MAIN CYCLE. IT'S ENDLESS
wait 0
26@ = 0
28@ = 0
22@ = 0
if
32@ > 128
then
32@ = 0
end
if and
0256: player $PLAYER_CHAR defined
056D: actor $PLAYER_ACTOR defined
then
gosub @ObjectsInfo
gosub @PedsInfo
gosub @CarsInfo
0085: 2@ = 0@ // 2@ is an pointer to a 0@ buffer.
0004: 23@ = 0
for 1@ = 0 to 7 step 1
0A8D: 3@ = read_memory 2@ size 1 virtual_protect 0
2@ += 1
if
3@ == 1 // Droplet exists?
then
gosub @DrawAndSet
else
0A8D: 3@ = read_memory 2@ size 2 virtual_protect 0 // Does not. Let's see the timer.
if
3@ == 0 // It's null?
then
0209: 3@ = random_int_in_ranges 2 1001 // Okay, let's fill the timer by ome value.
0A8C: write_memory 2@ size 2 value 3@ virtual_protect 0
end
gosub @PossibleDroplets
0A8D: 3@ = read_memory 2@ size 2 virtual_protect 0 // Check a timer one more time.
if
not 3@ > 1 // It's time for a new droplet.
then
gosub @ChooseSettings
else
2@ += 23 // Just jump to next memory part (Next droplet).
end
end
end
0085: 2@ = 21@ // 2@ is an pointer to a 21@ buffer.
23@ = 1
for 1@ = 0 to 15 step 1
0A8D: 3@ = read_memory 2@ size 1 virtual_protect 0
2@ += 1
if
3@ == 1
then
gosub @DrawAndSet
else
0A8D: 3@ = read_memory 2@ size 2 virtual_protect 0 // Does not. Let's see the timer.
if
3@ == 0 // It's null?
then
0209: 3@ = random_int_in_ranges 2 11 // Okay, let's fill the timer by ome value.
0A8C: write_memory 2@ size 2 value 3@ virtual_protect 0
end
if
22@ == 1
then
3@--
end
0A8C: write_memory 2@ size 2 value 3@ virtual_protect 0
if
not 3@ > 1 // It's time for a new droplet.
then
gosub @ChooseBloodSettings
else
2@ += 23 // Just jump to next memory part (Next droplet).
end
end
end
end
end
:ObjectsInfo // Just checking all objects. If some object is a fire hydrant AND it's damaged AND the player is near THEN let Event1 to 1.
{$I forallobjs}
if
03CA: object obj exists
then
if and
0366: object obj damaged
Object.Model(obj) == 1211
then
0A98: 2@ = object obj struct
2@ += 16
0A8D: 3@ = read_memory 2@ size 1 virtual_protect 0
if
3@ == 0
then
0A8C: write_memory 2@ size 1 value 1 virtual_protect 0 // Let the code to write the number to the obj's struct to exclude it from check in future. The value will reset when obj is recreated.
if
0474: actor $PLAYER_ACTOR near_object_in_cube obj radius 10.0 10.0 10.0 sphere 0
then
26@ = 1
//00BC: show_text_highpriority GXT '_TEST' time 750 flag 1
end
end
end
end
{$I for_end}
return
:PedsInfo // Just checking all peds. If some ped is in water AND the player is near THEN let Event1 to 1.
{$I forallpeds}
if
056D: ped
then
0470: 3@ = actor $PLAYER_ACTOR current_weapon
if and
3@ == 9
044B: actor $PLAYER_ACTOR on_foot
00E1: player 0 pressed_key 17
051A: actor ped damaged_by_actor $PLAYER_ACTOR
0104: actor $PLAYER_ACTOR near_actor ped radius 1.0 1.0 1.0 sphere 0
then
22@ = 1
end
0A96: 2@ = actor ped struct
2@ += 16
0A8D: 3@ = read_memory 2@ size 1 virtual_protect 0
if
3@ == 0
then
if
04AD: actor ped in_water
then
0A8C: write_memory 2@ size 1 value 1 virtual_protect 0 // Let the code to write the number to the ped's struct to exclude it from check in future. The value will reset when ped is not in water.
if
0104: actor $PLAYER_ACTOR near_actor ped radius 10.0 10.0 10.0 sphere 0
then
26@ = 1
//00BC: show_text_highpriority GXT '_TEST2' time 750 flag 1
end
end
else
if
84AD: not actor ped in_water
then
0A8C: write_memory 2@ size 1 value 0 virtual_protect 0
end
end
end
{$I for_end}
return
:CarsInfo // Just checking all cars. If some car is in water AND the player is near THEN let Event2 to 1.
{$I forallcars}
if
056E: car veh defined
then
0A97: 2@ = car veh struct
2@ += 14
0A8D: 3@ = read_memory 2@ size 1 virtual_protect 0
if
3@ == 0
then
if
02BF: car veh sunk
then
0A8C: write_memory 2@ size 1 value 1 virtual_protect 0 // Let the code to write the number to the car's struct to exclude it from check in future. The value will reset when car is not in water.
if
0205: actor $PLAYER_ACTOR near_car veh radius 10.0 10.0 10.0 flag 0
then
28@ = 1
//00BC: show_text_highpriority GXT '_TEST3' time 750 flag 1
end
end
else
if
82BF: not car veh sunk
then
0A8C: write_memory 2@ size 1 value 0 virtual_protect 0
end
end
end
{$I for_end}
return
:PossibleDroplets
// Long Events (will happen when droplet's personal timer will accept that)
// Check for boats:
19@ = 0
06AC: 4@ = actor $PLAYER_ACTOR movement_speed
if and
04A7: actor $PLAYER_ACTOR driving_boat
4@ >= 10.0
not 1@ > 3 //Only for first 4 droplets (counting is always beginnig from 0).
then
19@ = 1 // The player is in the boat and driving. In VC there are some droplets can appear.
end
//
// Timer in any droplet
077E: get_active_interior_to $ACTIVE_INTERIOR
Actor.StorePos($PLAYER_ACTOR, 4@, 5@, 6@)
if and
06BD: no_obstacles_between 4@ 5@ 6@ and 4@ 5@ 500.0 solid 1 car 0 actor 0 object 0 particle 0
$ACTIVE_INTERIOR == 0
then
0A8D: 3@ = read_memory 0xC81320 size 2 virtual_protect 0 // The weather
if or
3@ == 8
3@ == 16
19@ == 1
then
0A8D: 3@ = read_memory 2@ size 2 virtual_protect 0
3@--
0A8C: write_memory 2@ size 2 value 3@ virtual_protect 0
end
else
if
19@ == 1
then
0A8D: 3@ = read_memory 2@ size 2 virtual_protect 0
3@--
0A8C: write_memory 2@ size 2 value 3@ virtual_protect 0
end
end
//
// Events that can happen NOW (75%):
if and
26@ == 1 // Event1. Ped in water or hydrant destroyed
not 1@ > 1 // Only for two droplets
then
0209: 3@ = random_int_in_ranges 1 101
if
not 3@ > 75
then
3@ = 1 // The timer is 1. When 1 or lower the droplet will appear.
0A8C: write_memory 2@ size 2 value 1 virtual_protect 0
end
end
if and
28@ == 1 // Event2. Car in water
not 1@ > 3 // Only for four droplets
then
0209: 3@ = random_int_in_ranges 1 101
if
not 3@ > 75
then
3@ = 1 // The timer is 1. When 1 or lower the droplet will appear.
0A8C: write_memory 2@ size 2 value 1 virtual_protect 0
end
end
return
:ChooseSettings
2@ -= 1
0A8C: write_memory 2@ size 1 value 1 virtual_protect 0
2@ += 1
0209: 3@ = random_int_in_ranges 500 1001
0A8C: write_memory 2@ size 2 value 3@ virtual_protect 0
2@ += 2
0209: 3@ = random_int_in_ranges 1 3
0A8C: write_memory 2@ size 1 value 3@ virtual_protect 0
2@ += 1
0208: 4@ = random_float_in_ranges 7.5 20.0
0A8C: write_memory 2@ size 4 value 4@ virtual_protect 0
2@ += 4
0208: 4@ = random_float_in_ranges 40.0 600.0
0A8C: write_memory 2@ size 4 value 4@ virtual_protect 0
2@ += 4
0208: 4@ = random_float_in_ranges 40.0 408.0
0A8C: write_memory 2@ size 4 value 4@ virtual_protect 0
2@ += 4
0208: 4@ = random_float_in_ranges -0.25 0.25
0A8C: write_memory 2@ size 4 value 4@ virtual_protect 0
2@ += 4
0208: 4@ = random_float_in_ranges 0.25 1.0
0A8C: write_memory 2@ size 4 value 4@ virtual_protect 0
2@ += 4
return
:ChooseBloodSettings
2@ -= 1
0A8C: write_memory 2@ size 1 value 1 virtual_protect 0
2@ += 1
0209: 3@ = random_int_in_ranges 150 171
0A8C: write_memory 2@ size 2 value 3@ virtual_protect 0
2@ += 2
0209: 3@ = random_int_in_ranges 3 5
0A8C: write_memory 2@ size 1 value 3@ virtual_protect 0
2@ += 1
0208: 4@ = random_float_in_ranges 14.0 16.0
0A8C: write_memory 2@ size 4 value 4@ virtual_protect 0
2@ += 4
0208: 4@ = random_float_in_ranges 40.0 600.0
0A8C: write_memory 2@ size 4 value 4@ virtual_protect 0
2@ += 4
0208: 4@ = random_float_in_ranges 40.0 408.0
0A8C: write_memory 2@ size 4 value 4@ virtual_protect 0
2@ += 4
0208: 4@ = random_float_in_ranges -0.05 0.05
0A8C: write_memory 2@ size 4 value 4@ virtual_protect 0
2@ += 4
0208: 4@ = random_float_in_ranges 0.01 0.025
0A8C: write_memory 2@ size 4 value 4@ virtual_protect 0
2@ += 4
return
:DrawAndSet // Drawing droplet and calculating it's position and time to kill
0A8D: 3@ = read_memory 2@ size 2 virtual_protect 0
3@ -= 1
if
not 3@ > 1 // Time is over?
then
2@ -= 1
0A8C: write_memory 2@ size 1 value 0 virtual_protect 0 //Destroying the droplet
2@ += 1
if
23@ == 1
then
0209: 3@ = random_int_in_ranges 2 11
else
0209: 3@ = random_int_in_ranges 2 1001 // New timer
end
0A8C: write_memory 2@ size 2 value 3@ virtual_protect 0
2@ += 23 // Just jump to next droplet, skipping current droplet's parameters
else
0A8C: write_memory 2@ size 2 value 3@ virtual_protect 0
2@ += 2
0A8D: 9@ = read_memory 2@ size 1 virtual_protect 0
2@ += 1
0A8D: 10@ = read_memory 2@ size 4 virtual_protect 0
0085: 8@ = 10@
2@ += 4
0A8D: 11@ = read_memory 2@ size 4 virtual_protect 0
0085: 12@ = 2@
2@ += 4
0A8D: 13@ = read_memory 2@ size 4 virtual_protect 0
0085: 14@ = 2@
2@ += 4
0A8D: 15@ = read_memory 2@ size 4 virtual_protect 0
2@ += 4
0A8D: 16@ = read_memory 2@ size 4 virtual_protect 0
2@ += 4
005B: 11@ += 15@ // Adding speed to position and updating memory data (because it's a new position)
0A8C: write_memory 12@ size 4 value 11@ virtual_protect 0
005B: 13@ += 16@
0A8C: write_memory 14@ size 4 value 13@ virtual_protect 0
gosub @CalculateSize
03F0: enable_text_draw 1
038D: draw_texture 9@ position 11@ 13@ size 8@ 10@ RGBA 255 255 255 255
end
return
:CalculateSize // Small 'Shaking' + Calculating size for the screen corners (droplet 'compression' like in VC)
if and
32@ >= 0
not 32@ > 64
then
8@ += 0.5
end
if and
32@ >= 32
not 32@ > 96
then
10@ += 0.5
end
0087: 17@ = 13@
0087: 4@ = 10@
4@ /= 2.0
005B: 17@ += 4@
if
17@ >= 448.0
then
10@ = 448.0
0063: 10@ -= 13@
10@ *= 2.0
end
0087: 17@ = 11@
0087: 4@ = 8@
4@ /= 2.0
005B: 17@ += 4@
if
17@ >= 640.0
then
8@ = 640.0
0063: 8@ -= 11@
8@ *= 2.0
end
0087: 17@ = 11@
0087: 4@ = 8@
4@ /= 2.0
0063: 17@ -= 4@
if
not 17@ > 0.0
then
8@ = 0.0
005B: 8@ += 11@
8@ *= 2.0
end
if
not 8@ > 0.0
then
8@ = 0.0
end
if
not 10@ > 0.0
then
10@ = 0.0
end
return
Мб возможно не криво (потому что у меня не вышло) разобрать эти пол тысячи строчек и увеличить количество капель дождя до 4-5 + примерно в 2 раза увеличить общее количество капель на экране?