Add Shadow Field
This commit is contained in:
		
							parent
							
								
									313a97265f
								
							
						
					
					
						commit
						51283ae200
					
				|  | @ -6,29 +6,76 @@ INCLUDE "globals.asm" | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| SECTION "Field Variables", WRAM0 | SECTION "Field Variables", WRAM0 | ||||||
| wField:: ds (10*21) | wField:: ds (10*24) | ||||||
|  | wShadowField:: ds (14*26) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| SECTION "Field Functions", ROM0 | SECTION "Field Functions", ROM0 | ||||||
| FieldInit:: | FieldInit:: | ||||||
|     ld hl, wField |     ld hl, wField | ||||||
|     ld bc, 10*21 |     ld bc, 10*24 | ||||||
|     ld d, 1 |     ld d, 1 | ||||||
|     call UnsafeMemSet |     call UnsafeMemSet | ||||||
|  |     ld hl, wShadowField | ||||||
|  |     ld bc, 14*26 | ||||||
|  |     ld d, $FF | ||||||
|  |     call UnsafeMemSet | ||||||
|     ret |     ret | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| FieldClear:: | FieldClear:: | ||||||
|     ld hl, wField |     ld hl, wField | ||||||
|     ld bc, 10*21 |     ld bc, 10*24 | ||||||
|     ld d, TILE_FIELD_EMPTY |     ld d, TILE_FIELD_EMPTY | ||||||
|     call UnsafeMemSet |     call UnsafeMemSet | ||||||
|     ret |     ret | ||||||
| 
 | 
 | ||||||
|  | ToShadowField:: | ||||||
|  |     ld hl, wField | ||||||
|  |     ld de, wShadowField+2 | ||||||
|  |     ld c, 24 | ||||||
|  | .outer | ||||||
|  |     ld b, 10 | ||||||
|  | .inner | ||||||
|  |     ld a, [hl+] | ||||||
|  |     ld [de], a | ||||||
|  |     inc de | ||||||
|  |     dec b | ||||||
|  |     jr nz, .inner | ||||||
|  |     inc de | ||||||
|  |     inc de | ||||||
|  |     inc de | ||||||
|  |     inc de | ||||||
|  |     dec c | ||||||
|  |     jr nz, .outer | ||||||
|  |     ret | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | FromShadowField:: | ||||||
|  |     ld hl, wField | ||||||
|  |     ld de, wShadowField+2 | ||||||
|  |     ld c, 24 | ||||||
|  | .outer | ||||||
|  |     ld b, 10 | ||||||
|  | .inner | ||||||
|  |     ld a, [de] | ||||||
|  |     ld [hl+], a | ||||||
|  |     inc de | ||||||
|  |     dec b | ||||||
|  |     jr nz, .inner | ||||||
|  |     inc de | ||||||
|  |     inc de | ||||||
|  |     inc de | ||||||
|  |     inc de | ||||||
|  |     dec c | ||||||
|  |     jr nz, .outer | ||||||
|  |     ret | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|     ; This routine will copy wField onto the screen. |     ; This routine will copy wField onto the screen. | ||||||
| BlitField:: | BlitField:: | ||||||
|     ; What to copy |     ; What to copy | ||||||
|     ld de, wField + 10 |     ld de, wField + 40 | ||||||
|     ; Where to put it |     ; Where to put it | ||||||
|     ld hl, FIELD_TOP_LEFT |     ld hl, FIELD_TOP_LEFT | ||||||
|     ; How much to increment hl after each row |     ; How much to increment hl after each row | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue