mirror of
https://github.com/jeremysrand/BuGS.git
synced 2025-04-13 02:36:59 +00:00
Add some global data to have a bit mask of tiles which contain a centipede segment. This will allow the update code to figure out if centipede segments are colliding and if so, change direction. Still need to write some codegen for this global constant data rather than building it at runtime in C.
This commit is contained in:
parent
a9d3b12725
commit
c4902f486b
@ -86,7 +86,7 @@
|
||||
9DB1505024C3801100558B87 /* gameFlea.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gameFlea.s; sourceTree = "<group>"; };
|
||||
9DB1505124C6875C00558B87 /* gameScorpion.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gameScorpion.s; sourceTree = "<group>"; };
|
||||
9DB1505224C7495400558B87 /* globals.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = globals.s; sourceTree = "<group>"; };
|
||||
9DB1505324C9E54C00558B87 /* gameSpider.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gameSpider.s; sourceTree = "<group>"; };
|
||||
9DB1505324C9E54C00558B87 /* gameSpider.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gameSpider.s; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.asm.orcam; };
|
||||
9DB1505424D3BF6C00558B87 /* gameSegments.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gameSegments.s; sourceTree = "<group>"; };
|
||||
9DB1505524D3BFCE00558B87 /* global.macros */ = {isa = PBXFileReference; lastKnownFileType = text; path = global.macros; sourceTree = "<group>"; };
|
||||
9DC4D7BD24B7652100BACF4B /* ship.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = ship.s; sourceTree = "<group>"; };
|
||||
|
@ -7,7 +7,7 @@
|
||||
<key>Binary.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>1</integer>
|
||||
<integer>3</integer>
|
||||
</dict>
|
||||
<key>BuGS.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
@ -22,7 +22,7 @@
|
||||
<key>doNotBuild.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>3</integer>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
|
16
BuGS/tiles.c
16
BuGS/tiles.c
@ -55,6 +55,8 @@ tTileOffset tileAbove[TOTAL_NUM_TILES];
|
||||
tTileOffset tileBelow[TOTAL_NUM_TILES];
|
||||
tTileOffset tileLeft[TOTAL_NUM_TILES];
|
||||
tTileOffset tileRight[TOTAL_NUM_TILES];
|
||||
word tileBitOffset[NUM_GAME_TILES];
|
||||
word tileBitMask[NUM_GAME_TILES];
|
||||
|
||||
tTileOffset dirtyNonGameTiles[NUM_NON_GAME_TILES];
|
||||
word numDirtyNonGameTiles;
|
||||
@ -70,6 +72,8 @@ void initTiles(void)
|
||||
word tileY;
|
||||
word lastOffset;
|
||||
word tileIndex = 0;
|
||||
word bitOffset = 0;
|
||||
word bitMask = 1;
|
||||
word rhsTileIndex = RHS_FIRST_TILE;
|
||||
word lhsTileIndex = LHS_FIRST_TILE;
|
||||
|
||||
@ -113,6 +117,8 @@ void initTiles(void)
|
||||
tileDirty[tileIndex] = 0;
|
||||
tileScreenOffset[tileIndex] = lastOffset;
|
||||
tileType[tileIndex] = TILE_EMPTY;
|
||||
tileBitOffset[tileIndex] = bitOffset;
|
||||
tileBitMask[tileIndex] = bitMask;
|
||||
|
||||
if (tileY == 0)
|
||||
tileAbove[tileIndex] = INVALID_TILE_NUM;
|
||||
@ -136,6 +142,16 @@ void initTiles(void)
|
||||
|
||||
tileIndex++;
|
||||
|
||||
if ((tileIndex % (sizeof(word) * 2)) == 0)
|
||||
{
|
||||
bitOffset += sizeof(word);
|
||||
bitMask = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
bitMask <<= 1;
|
||||
}
|
||||
|
||||
lastOffset += 4;
|
||||
}
|
||||
|
||||
|
@ -112,6 +112,8 @@ extern tTileOffset tileAbove[TOTAL_NUM_TILES];
|
||||
extern tTileOffset tileBelow[TOTAL_NUM_TILES];
|
||||
extern tTileOffset tileLeft[TOTAL_NUM_TILES];
|
||||
extern tTileOffset tileRight[TOTAL_NUM_TILES];
|
||||
extern word tileBitOffset[NUM_GAME_TILES];
|
||||
extern word tileBitMask[NUM_GAME_TILES];
|
||||
|
||||
extern tTileOffset dirtyNonGameTiles[NUM_NON_GAME_TILES];
|
||||
extern word numDirtyNonGameTiles;
|
||||
|
Loading…
x
Reference in New Issue
Block a user