diff options
| author | XaviDCR92 <xavi.dcr@gmail.com> | 2017-05-31 06:57:06 +0200 |
|---|---|---|
| committer | XaviDCR92 <xavi.dcr@gmail.com> | 2017-05-31 06:57:06 +0200 |
| commit | f5d1b4415c3bc8f145a84b8fd00d04629eb6e218 (patch) | |
| tree | 7cc987e598a65f8f365ecc41ba4704b7b674e168 /Source/Gfx.c | |
| parent | 30b18fd262038f3ffaf24ad9884e1e121850019b (diff) | |
| download | airport-f5d1b4415c3bc8f145a84b8fd00d04629eb6e218.tar.gz | |
* Aircraft 0 was incorrectly being removed because indexes 0 to GAME_MAX_AIRCRAFT were being read instead of 0 to ptrPlayer->ActiveAircraft.
* Solved issues with linked list overflow. A detection mechanism has also been added.
* New state STATE_ENTERING_RWY.
* GameGuiActiveAircraftList has been moved from GameGui to Game module.
* Active aircraft list for each player is now updated each time that a new flight either appears or disappears.
* Other minor fixes.
Diffstat (limited to 'Source/Gfx.c')
| -rw-r--r-- | Source/Gfx.c | 51 |
1 files changed, 40 insertions, 11 deletions
diff --git a/Source/Gfx.c b/Source/Gfx.c index 1b4612a..3f9c81d 100644 --- a/Source/Gfx.c +++ b/Source/Gfx.c @@ -8,7 +8,7 @@ * Defines * *************************************/ -#define PRIMITIVE_LIST_SIZE 0x800 +#define PRIMITIVE_LIST_SIZE 0x1000 #define DOUBLE_BUFFERING_SWAP_Y 256 #define UPLOAD_IMAGE_FLAG 1 #define MAX_LUMINANCE 0xFF @@ -76,18 +76,47 @@ static bool one_second_show; void GfxSwapBuffers(void) { + // Consistency check +#if PSXSDK_DEBUG + + if(GsListPos() >= PRIMITIVE_LIST_SIZE) + { + dprintf("Linked list iterator overflow!\n"); + while(1); + } + + if( (DrawEnv.h != Y_SCREEN_RESOLUTION) + || + ( (DrawEnv.w != X_SCREEN_RESOLUTION) + && + (DrawEnv.w != X_SCREEN_RESOLUTION >> 1) ) + || + ( (DispEnv.y != DOUBLE_BUFFERING_SWAP_Y) + && + (DispEnv.y != 0) ) ) + { + dprintf("What the hell is happening?\n"); + DEBUG_PRINT_VAR(DispEnv.x); + DEBUG_PRINT_VAR(DispEnv.y); + DEBUG_PRINT_VAR(DrawEnv.x); + DEBUG_PRINT_VAR(DrawEnv.y); + + while(1); + } +#endif // PSXSDK_DEBUG + if(DrawEnv.h == Y_SCREEN_RESOLUTION) { - if(DispEnv.y == 0) - { - DispEnv.y = DOUBLE_BUFFERING_SWAP_Y; - DrawEnv.y = 0; - } - else if(DispEnv.y == DOUBLE_BUFFERING_SWAP_Y) - { - DispEnv.y = 0; - DrawEnv.y = DOUBLE_BUFFERING_SWAP_Y; - } + if(DispEnv.y == 0) + { + DispEnv.y = DOUBLE_BUFFERING_SWAP_Y; + DrawEnv.y = 0; + } + else if(DispEnv.y == DOUBLE_BUFFERING_SWAP_Y) + { + DispEnv.y = 0; + DrawEnv.y = DOUBLE_BUFFERING_SWAP_Y; + } GsSetDispEnv_DMA(&DispEnv); GsSetDrawEnv_DMA(&DrawEnv); |
