1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-27 16:31:31 +00:00

Made sprite placement consistent at least. Not necessarily yet correct.

This commit is contained in:
Thomas Harte 2016-05-18 22:07:24 -04:00
parent e61392d3fb
commit 40600b4bcb
2 changed files with 11 additions and 11 deletions

View File

@ -117,9 +117,9 @@ void Machine::update_upcoming_events()
// in which case the counter reset (and hence the start of drawing) will occur in 4/5 cycles // in which case the counter reset (and hence the start of drawing) will occur in 4/5 cycles
uint8_t repeatMask = _playerAndMissileSize[c&1] & 7; uint8_t repeatMask = _playerAndMissileSize[c&1] & 7;
if( if(
( _objectCounter[c] == 12 && ((repeatMask == 1) || (repeatMask == 3)) ) || ( _objectCounter[c] == 16 && ((repeatMask == 1) || (repeatMask == 3)) ) ||
( _objectCounter[c] == 28 && ((repeatMask == 2) || (repeatMask == 3) || (repeatMask == 6)) ) || ( _objectCounter[c] == 32 && ((repeatMask == 2) || (repeatMask == 3) || (repeatMask == 6)) ) ||
( _objectCounter[c] == 60 && ((repeatMask == 4) || (repeatMask == 6)) ) ( _objectCounter[c] == 64 && ((repeatMask == 4) || (repeatMask == 6)) )
) )
{ {
unsigned int actionSlot = (c < 2) ? upcomingEventsPointerPlus5 : upcomingEventsPointerPlus4; unsigned int actionSlot = (c < 2) ? upcomingEventsPointerPlus5 : upcomingEventsPointerPlus4;

View File

@ -51,7 +51,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
- (void)drawAtTime:(const CVTimeStamp *)now frequency:(double)frequency - (void)drawAtTime:(const CVTimeStamp *)now frequency:(double)frequency
{ {
const uint32_t processingMask = 0x01; const uint32_t processingMask = 0x01;
const uint32_t drawingMask = 0x02; // const uint32_t drawingMask = 0x02;
// Always post a -openGLView:didUpdateToTime:. This is the hook upon which the substantial processing occurs. // Always post a -openGLView:didUpdateToTime:. This is the hook upon which the substantial processing occurs.
if(!OSAtomicTestAndSet(processingMask, &_updateIsOngoing)) if(!OSAtomicTestAndSet(processingMask, &_updateIsOngoing))
@ -69,13 +69,13 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
// Draw the display only if a previous draw is not still ongoing. -drawViewOnlyIfDirty: is guaranteed // Draw the display only if a previous draw is not still ongoing. -drawViewOnlyIfDirty: is guaranteed
// to be safe to call concurrently with -openGLView:updateToTime: so there's no need to worry about // to be safe to call concurrently with -openGLView:updateToTime: so there's no need to worry about
// the above interrupting the below or vice versa. // the above interrupting the below or vice versa.
if(_hasSkipped && !OSAtomicTestAndSet(drawingMask, &_updateIsOngoing)) // if(_hasSkipped && !OSAtomicTestAndSet(drawingMask, &_updateIsOngoing))
{ // {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ // dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
[self drawViewOnlyIfDirty:YES]; // [self drawViewOnlyIfDirty:YES];
OSAtomicTestAndClear(drawingMask, &_updateIsOngoing); // OSAtomicTestAndClear(drawingMask, &_updateIsOngoing);
}); // });
} // }
} }
- (void)invalidate - (void)invalidate