Cool concept, following this project :) Keep on the good work ..
/// Add36k does nearly the same as 'subbp' or 'add21k', exept that it does not
/// only free 21kb of memory (one std. workbench plane), but in fact 36kb of
/// memory (that is one plane and 250 lines of the others).
/// Original code by Alexander Rawass
VOID add36k(struct IntuitionBase *ibase)
{
long pl0,pl1,plb,ple;
struct Screen *scr;
struct BitMap *bm;
struct Window *win;
ULONG origheight;
if (ibase != NULL)
{
scr = ibase->ActiveScreen;
win = ibase->ActiveWindow;
origheight=scr->Height;
SizeWindow(win,0,-150);
Delay(1*50);
scr->Height=50;
scr->Depth=1;
bm=&scr->BitMap;
bm->Rows=50;
bm->Depth=1;
pl0=bm->Planes[0];
pl1=bm->Planes[1];
bm->Planes[1]=NULL;
plb=pl0+(640*50/8);
ple=pl1+(640*origheight/8);
RemakeDisplay();
FreeMem(plb,ple-plb);
}
}
void __inline gui_update_fx(void)
{
// Shake
if (fx_shake >= 0)
{
int x_screen, easing;
x_screen = (sintab32[(fx_shake << 7) & 0x3FF] * fx_shake) >> 14;
rpage_video_scroll(x_screen, 0);
fx_shake--;
if (fx_shake == 0)
rpage_input_enable(TRUE);
}
}
void __inline rpage_video_scroll(short x, short y)
{
if ((scr_x_offset != x) || (scr_y_offset != y))
{
main_screen->screen->ViewPort.DxOffset = x;
main_screen->screen->ViewPort.DyOffset = y;
ScrollVPort(&(main_screen->screen->ViewPort));
}
scr_x_offset = x;
scr_y_offset = y;
}
void free_allocated_bitmap(struct BitMap *allocated_bitmap)
{
if (allocated_bitmap)
{
UWORD i;
if (allocated_bitmap->Planes[0] != NULL)
FreeMem(allocated_bitmap->Planes[0], RASSIZE(allocated_bitmap->BytesPerRow << 3, allocated_bitmap->Rows) * allocated_bitmap->Depth);
else
printf("free_allocated_bitmap() error, plane ptr should not be NULL!\n");
for (i = 0; i < allocated_bitmap->Depth; i++)
{
if (allocated_bitmap->Planes[i] != NULL)
allocated_bitmap->Planes[i] = NULL;
}
if (allocated_bitmap != NULL)
{
FreeMem(allocated_bitmap, (LONG)sizeof(struct BitMap));
allocated_bitmap = NULL;
}
}
}
void gui_draw_3d_button(rect *_r, BOOL hilite)
{
rect r, r2;
short col_black = 0,
col_med = 14,
col_light = 20,
col_white = 19;
if (!hilite)
{
col_med = 12;
col_light = 17;
col_white = 29;
}
memcpy(&r, _r, sizeof(rect));
rpage_video_fill_rect(&r, col_black);
rect_shrink(&r, 1);
rpage_video_fill_rect(&r, col_med);
memcpy(&r2, &r, sizeof(rect));
r2.sy = (r2.sy + r2.ey) / 2;
rpage_video_fill_rect(&r2, col_med - 2);
rpage_video_draw_rect(&r, col_light);
rpage_video_set_pixel(r.sx, r.sy, col_white);
rpage_video_set_pixel(r.ex, r.ey, col_white);
}