some refactorings for cleanup

This commit is contained in:
Wei-ju Wu
2016-06-14 13:14:05 -07:00
parent 5fa6e76d1a
commit 2f8620b020
4 changed files with 22 additions and 41 deletions
+2 -1
View File
@@ -6,4 +6,5 @@ graphics1
ham1
intuition1
openwin
ostest
ostest
main
+1 -1
View File
@@ -2,7 +2,7 @@ ASM=vasmm68k_mot
ASM_FLAGS = -Fhunk -devpac
.SUFFIXES = .o .asm .c
CC=vc +kick13
CC=vc +aos68k
CFLAGS=-c99 -I$(NDK_INC) -DDEBUG
all: main
+7 -3
View File
@@ -1,9 +1,13 @@
# Scrolling Tricks
This is a project to rework the Aminet Scrolling Tricks by Georg Steger into a
version that works on all Amiga OS releases from 1.3 and has
higher reuse. The ScrollingTricks tutorial has tremendous learning
value, but requires at least AmigaOS3.0 to run
version that has higher internal reuse, is smaller and compiles with
VBCC. The purpose is mainly to better understand the algorithms
# System Requirements
This software requires V39 libraries and therefore only runs on the
3.x releases or greater of AmigaOS
## Original source
+12 -36
View File
@@ -107,35 +107,12 @@ struct FetchInfo
/********************* COMPATIBILITY ***********************/
/*
* AllocBitMap() is V39, provide a version here, that works on all AmigaOS versions
* Older releases, unfortunately have to do the initialization in a more lengthy way
*/
struct BitMap *alloc_bitmap(ULONG sizex, ULONG sizey, ULONG depth, ULONG flags,
struct BitMap *friend_bitmap)
{
return AllocBitMap(sizex, sizey, depth, flags, friend_bitmap);
}
/* FreeBitMap() is V39, provide a version here that works on all AmigaOS versions */
void free_bitmap(struct BitMap *bitmap)
{
FreeBitMap(bitmap);
}
/*
GetBitMapAttr() is V39, provide a version here that works on all AmigaOS versions
On older revisions, we simply read the bitmap structure
*/
ULONG is_bitmap_interleaved(struct BitMap *bitmap)
{
return (GetBitMapAttr(bitmap, BMA_FLAGS) & BMF_INTERLEAVED) == BMF_INTERLEAVED;
}
/* Encapsulation of the FindDisplayInfo()/GetDisplayInfo() functions which
don't exist in 1.x OS releases, in that case, we can simply return INVALID_ID
*/
static ULONG get_mode_id_os3()
static ULONG get_mode_id_os3(void)
{
ULONG modeid = INVALID_ID;
struct DimensionInfo diminfo;
@@ -149,7 +126,7 @@ static ULONG get_mode_id_os3()
return modeid;
}
ULONG get_mode_id()
ULONG get_mode_id(void)
{
ULONG modeid;
@@ -182,12 +159,12 @@ static void Cleanup(char *msg)
if (ScreenBitmap) {
WaitBlit();
free_bitmap(ScreenBitmap);
FreeBitMap(ScreenBitmap);
}
if (BlocksBitmap) {
WaitBlit();
free_bitmap(BlocksBitmap);
FreeBitMap(BlocksBitmap);
}
if (Map) free(Map);
@@ -254,11 +231,11 @@ static void OpenBlocks(void)
{
LONG l;
if (!(BlocksBitmap = alloc_bitmap(BLOCKSWIDTH,
BLOCKSHEIGHT,
BLOCKSDEPTH,
BMF_STANDARD | BMF_INTERLEAVED,
0))) {
if (!(BlocksBitmap = AllocBitMap(BLOCKSWIDTH,
BLOCKSHEIGHT,
BLOCKSDEPTH,
BMF_STANDARD | BMF_INTERLEAVED,
0))) {
Cleanup("Can't alloc blocks bitmap!");
}
@@ -282,14 +259,13 @@ static void OpenBlocks(void)
blocksbuffer = BlocksBitmap->Planes[0];
}
// V36: OpenScreenTags()
static void OpenDisplay(void)
{
ULONG modeid;
LONG bmflags;
if (!(ScreenBitmap = alloc_bitmap(BITMAPWIDTH,BITMAPHEIGHT + 3,BLOCKSDEPTH,
BMF_STANDARD | BMF_INTERLEAVED | BMF_CLEAR,0))) {
if (!(ScreenBitmap = AllocBitMap(BITMAPWIDTH,BITMAPHEIGHT + 3,BLOCKSDEPTH,
BMF_STANDARD | BMF_INTERLEAVED | BMF_CLEAR,0))) {
Cleanup("Can't alloc screen bitmap!");
}
frontbuffer = ScreenBitmap->Planes[0];
@@ -379,7 +355,7 @@ static void InitCopperlist(void)
/******************* SCROLLING **********************/
static void DrawBlock(LONG x,LONG y,LONG mapx,LONG mapy)
static void DrawBlock(LONG x, LONG y, LONG mapx, LONG mapy)
{
UBYTE block;