Core: match sizeof etc. syntax with C, Core RTS: Beautifying + animations
This commit is contained in:
@@ -36,10 +36,22 @@ MAP_AddActor :: (map: *MAP_Map, p: V2I): *MAP_Actor
|
||||
actor := GetLast(&MAP_CurrentMap.actors)
|
||||
return actor
|
||||
|
||||
MAP_ActorSetP :: (actor: *MAP_Actor, p: V2I)
|
||||
map := actor.map
|
||||
new_tile := map.data + p.x + p.y * map.x
|
||||
if *new_tile != 0 ;; return
|
||||
|
||||
tile := map.data + actor.p.x + actor.p.y * map.x
|
||||
Assert((*tile & MAP_TILE_ACTOR_IS_STANDING) != 0)
|
||||
*tile &= ~MAP_TILE_ACTOR_IS_STANDING
|
||||
|
||||
*new_tile |= MAP_TILE_ACTOR_IS_STANDING
|
||||
actor.p = p
|
||||
|
||||
MAP_Init :: ()
|
||||
MAP_CurrentMap.x = 60
|
||||
MAP_CurrentMap.y = 40
|
||||
bytes := SizeOf(MAP_Tile) * MAP_CurrentMap.x->U64 * MAP_CurrentMap.y->U64
|
||||
MAP_CurrentMap.x = WinX / RectX
|
||||
MAP_CurrentMap.y = WinY / RectY
|
||||
bytes := sizeof(MAP_Tile) * MAP_CurrentMap.x->U64 * MAP_CurrentMap.y->U64
|
||||
MAP_CurrentMap.data = malloc(bytes)
|
||||
memset(MAP_CurrentMap.data, 0, bytes)
|
||||
actor := MAP_AddActor(&MAP_CurrentMap, {4,4})
|
||||
@@ -109,7 +121,7 @@ MAP_MoveTowardsTarget :: (s: *MAP_Actor)
|
||||
MAP_PathFindStep :: (s: *MAP_Actor)
|
||||
if s.state == MAP_PATH_REACHED ;; return
|
||||
if s.open_paths.len == 0
|
||||
MAP_InsertOpenPath(s, s.p, s.target_p, ignore_blocks = true)
|
||||
MAP_InsertOpenPath(s, s.p, s.p, ignore_blocks = true)
|
||||
|
||||
it := Pop(&s.open_paths)
|
||||
Add(&s.close_paths, it)
|
||||
|
||||
Reference in New Issue
Block a user