Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5253 mario79 1
;---------------------------------------------------------------------
2
actions_for_all_cell:
3
;;        DEBUGF  1, "actions_for_all\n"
4
	; set start coordinates
5
	mov	ebx,LEVEL_MAP_SIZE_Y
6
	mov	ecx,plan_level+(LEVEL_MAP_SIZE_Y*LEVEL_MAP_SIZE_X*4)-4
7
;--------------------------------------
8
.new_y:
9
	mov	eax,LEVEL_MAP_SIZE_X
10
;--------------------------------------
11
.new_x:
12
	push	eax ebx ecx
13
	mov	[action_cell_x],eax
14
	mov	[action_cell_y],ebx
15
	mov	edx,[ecx]
16
	mov	[current_cell_NPC],dh
17
	test	dh,dh	; empty
18
	jz	.end_processing_sell
19
;	mov	ebp,ecx
20
;	sub	ebp,plan_level
21
;        DEBUGF  1, "Y : %x X: %x cell: %x ebp: %x\n",ebx,eax,edx,ebp
22
	ror	edx,16
23
	test	dh,dh
24
	jnz	.end_processing_sell
25
 
26
	test	dl,dl
27
	jz	.end_processing_sell
28
 
29
;	call	processing_NPC_route
30
;        DEBUGF  1, "new cell: %x\n",edx
31
 
32
	cmp	[current_cell_NPC],OBJECT_FINAL_MONSTER
33
	ja	@f
34
 
35
	call	processing_npc_action
36
	jmp	.end_processing_sell
37
;--------------------------------------
38
@@:
39
	cmp	[current_cell_NPC],OBJECT_PROTAGONIST
40
	jne	@f
41
 
42
	call	processing_protagonist_action
43
	jmp	.end_processing_sell
44
;--------------------------------------
45
@@:
46
	cmp	[current_cell_NPC],OBJECT_WHITE_BRICK
47
	jne	.end_processing_sell
48
 
49
	call	processing_white_brick
50
;--------------------------------------
51
.end_processing_sell:
52
	pop	ecx ebx eax
53
 
54
	sub	ecx,4
55
	dec	eax
56
	jnz	.new_x
57
 
58
	dec	ebx
59
	jnz	.new_y
60
;;        DEBUGF  1, "actions_for_all END\n"
61
	ret
62
;---------------------------------------------------------------------
63
action_stop:
64
;        DEBUGF  1, "action_stop\n"
65
	mov	dx,0x0100
66
	rol	edx,16
67
	mov	[ecx],edx
68
	ret
69
;---------------------------------------------------------------------
70
object_death:
71
	mov	dx,0x01
72
	shl	edx,24
73
	mov	[ecx],edx
74
	ret
75
;---------------------------------------------------------------------
76
save_route_to_current_position:
77
	ror	eax,16
78
	mov	ax,si
79
	rol	eax,16
80
	rol	edx,16
81
	mov	ax,dx
82
	mov	[ecx],eax ; new route for unit
83
	ret
84
;---------------------------------------------------------------------
85
save_new_and_clear_old_position:
86
;        DEBUGF  1, "save_new_and_clear_old_position\n"
87
	ror	eax,16
88
	mov	ax,si
89
	rol	eax,16
90
	rol	edx,16
91
	mov	ah,dh
92
	mov	[edi],eax ; new cell for unit
93
	and	edx,0xff
94
	add	edx,0x01000000	; clear old cell and show
95
	mov	[ecx],edx
96
; copy object id
97
	mov	eax,[ecx+LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y*4]
98
	mov	[edi+LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y*4],eax
99
	xor	eax,eax
100
	mov	[ecx+LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y*4],eax
101
	ret
102
;---------------------------------------------------------------------
103
harvest_of_death:
5292 mario79 104
	xor	eax,eax
105
	mov	[death_of_protagonist],al
106
	mov	[npc_alive],al
5253 mario79 107
	mov	esi,plan_level
108
	mov	ecx,LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y
109
	cld
110
;--------------------------------------
111
.loop:
112
	lodsd
113
 
114
	test	ah,ah
115
	jz	.counter
116
 
117
	cmp	al,BASE_LAVA
118
	je	.base_lava
119
 
120
	cmp	al,BASE_WATER
121
	je	.base_water
5292 mario79 122
 
123
	cmp	ah,OBJECT_FINAL_MONSTER
124
	ja	.counter
125
 
126
	mov	[npc_alive],1
5253 mario79 127
;--------------------------------------
128
.counter:
129
	dec	ecx
130
	jnz	.loop
131
 
132
	ret
133
;--------------------------------------
134
.base_water:
135
	cmp	ah,OBJECT_PROTAGONIST
136
	jne	.kill_object
137
;--------------------------------------
138
.kill_protagonist:
139
	mov	[death_of_protagonist],1
140
	jmp	.kill_object
141
;--------------------------------------
142
.base_lava:
143
	cmp	ah,OBJECT_PROTAGONIST
144
	je	.kill_protagonist
145
 
146
	cmp	ah,OBJECT_SKELETON
147
	ja	.counter
148
;--------------------------------------
149
.kill_object:
150
;        DEBUGF  1, "kill_object\n"
151
	and	eax,0x000000ff
152
	add	eax,0x01000000
153
	mov	[esi-4],eax
154
	xor	eax,eax
155
	mov	[esi-4-plan_level+objects_id],eax
156
	jmp	.counter
157
;---------------------------------------------------------------------