Added a new smoke-like effect to the GUI.
This commit is contained in:
@@ -55,7 +55,7 @@ WINDOSOBJ=${DOSDIR}/debug.o ${DOSDIR}/joy.o ${DOSDIR}/modemrtn.o ${DOSDIR}/vesa2
|
||||
|
||||
ZIPOBJ=${ZIPDIR}/zzip.o ${ZIPDIR}/unzip.o ${ZIPDIR}/zpng.o
|
||||
|
||||
MAINOBJ=cfgload.o endmem.o fixsin.o init.o ui.o vcache.o water.o
|
||||
MAINOBJ=cfgload.o endmem.o fixsin.o init.o ui.o vcache.o water.o smoke.o
|
||||
|
||||
OBJS=${CHIPSOBJ} ${CPUOBJ} ${WINOBJ} ${WINDOSOBJ} ${GUIOBJ} ${VIDEOBJ} ${ZIPOBJ} ${MAINOBJ}
|
||||
|
||||
@@ -80,6 +80,7 @@ ${ZIPDIR}/unzip.o: ${ZIPDIR}/unzip.c ${ZIPDIR}/unzip.h
|
||||
${ZIPDIR}/zzip.o: ${ZIPDIR}/zzip.c ${ZIPDIR}/unzip.h
|
||||
fixsin.o: fixsin.c
|
||||
water.o: water.c
|
||||
smoke.o: smoke.c
|
||||
${VIDEODIR}/procvid.o: ${VIDEODIR}/procvid.asm macros.mac ${VIDEODIR}/copyvid.inc ${VIDEODIR}/2xsaimmx.inc
|
||||
${CHIPDIR}/dsp1proc.o: ${CHIPDIR}/dsp1proc.asm macros.mac
|
||||
${CHIPDIR}/sa1regs.o: ${CHIPDIR}/sa1regs.asm macros.mac\
|
||||
|
||||
@@ -95,7 +95,7 @@ EXTSYM NextLineCache,VidStartDraw,ResetTripleBuf,GUINGVID
|
||||
EXTSYM ScanCodeListing,AdjustFrequency,GUISaveVars,Init_Mouse
|
||||
EXTSYM Get_MouseData,Set_MouseXMax,Set_MouseYMax,Set_MousePosition,Get_MousePositionDisplacement
|
||||
EXTSYM GUIInit,GUIDeInit,SpecialLine
|
||||
EXTSYM DrawWater,RemoteDisconnect,loadstate3
|
||||
EXTSYM DrawWater,DrawSmoke,RemoteDisconnect,loadstate3
|
||||
EXTSYM ModemClearBuffer,IPXSearchval
|
||||
EXTSYM ipxlookforconnect
|
||||
EXTSYM SA1Enable,SA1RAMArea
|
||||
@@ -2036,6 +2036,10 @@ NEWSYM StartGUI
|
||||
jne .nowater2
|
||||
call DrawWater
|
||||
.nowater2
|
||||
cmp byte[GUIEffect],4
|
||||
jne .nosmoke
|
||||
call DrawSmoke
|
||||
.nosmoke
|
||||
; call TestSent
|
||||
cmp byte[CNetType],20
|
||||
jne .noreceive
|
||||
|
||||
@@ -942,8 +942,12 @@ GUIGUIOptnsKeys:
|
||||
xor byte[JoyPad1Move],1
|
||||
.guioptn6
|
||||
cmp dh,'N'
|
||||
jne .guioptn7
|
||||
jne .guioptn6b
|
||||
GUIkeystoggleoptn byte[GUIEffect],1
|
||||
.guioptn6b
|
||||
cmp dh,'O'
|
||||
jne .guioptn7
|
||||
GUIkeystoggleoptn byte[GUIEffect],4
|
||||
.guioptn7
|
||||
cmp dh,'E'
|
||||
jne .guioptn7b
|
||||
|
||||
@@ -2779,6 +2779,7 @@ DisplayGUIOptnsClick:
|
||||
GUIClickCButton 12,63,byte[GUIClick]
|
||||
GUIClickCButton 12,73,byte[JoyPad1Move]
|
||||
GUIClickCButton6 12,83,byte[GUIEffect],1
|
||||
GUIClickCButton6 124,83,byte[GUIEffect],4
|
||||
GUIClickCButton6 12,93,byte[GUIEffect],2
|
||||
GUIClickCButton6 124,93,byte[GUIEffect],3
|
||||
GUIClickCButton 124,23,byte[GUIEnableTransp]
|
||||
|
||||
@@ -4877,10 +4877,16 @@ DisplayGUIOptns:
|
||||
GUIDisplayIconWin 10,12,73,[GUITemp]
|
||||
mov dword[GUITemp],GUIIconDataCheckBoxUC
|
||||
cmp byte[GUIEffect],1
|
||||
jne .nocheck6b
|
||||
mov dword[GUITemp],GUIIconDataCheckBoxC
|
||||
.nocheck6b
|
||||
GUIDisplayIconWin 10,12,83,[GUITemp]
|
||||
mov dword[GUITemp],GUIIconDataCheckBoxUC
|
||||
cmp byte[GUIEffect],4
|
||||
jne .nocheck7
|
||||
mov dword[GUITemp],GUIIconDataCheckBoxC
|
||||
.nocheck7
|
||||
GUIDisplayIconWin 10,12,83,[GUITemp]
|
||||
GUIDisplayIconWin 10,124,83,[GUITemp]
|
||||
mov dword[GUITemp],GUIIconDataCheckBoxUC
|
||||
cmp byte[GUIEffect],2
|
||||
jne .nocheck7b
|
||||
@@ -4958,6 +4964,7 @@ DisplayGUIOptns:
|
||||
GUIOuttextwin2 10,100,111,GUIGUIOptnsTextH
|
||||
GUIOuttextwin2 10,147,111,GUIGUIOptnsTextI
|
||||
GUIOuttextwin2u 10,26,88,GUIGUIOptnsTextB,1
|
||||
GUIOuttextwin2u 10,138,88,GUIGUIOptnsTextBb,2
|
||||
GUIOuttextwin2u 10,26,98,GUIGUIOptnsTextC,3
|
||||
GUIOuttextwin2u 10,138,98,GUIGUIOptnsTextCb,13
|
||||
GUIOuttextwin2u 10,138,28,GUIGUIOptnsTextJ,0
|
||||
@@ -4986,6 +4993,7 @@ DisplayGUIOptns:
|
||||
GUIOuttextwin2 10,99,110,GUIGUIOptnsTextH
|
||||
GUIOuttextwin2 10,146,110,GUIGUIOptnsTextI
|
||||
GUIOuttextwin2 10,25,87,GUIGUIOptnsTextB
|
||||
GUIOuttextwin2 10,137,87,GUIGUIOptnsTextBb
|
||||
GUIOuttextwin2 10,25,97,GUIGUIOptnsTextC
|
||||
GUIOuttextwin2 10,137,97,GUIGUIOptnsTextCb
|
||||
GUIOuttextwin2 10,137,27,GUIGUIOptnsTextJ
|
||||
@@ -5079,6 +5087,7 @@ GUIGUIOptnsText8 db 'CLICK ENTERS GUI',0
|
||||
GUIGUIOptnsText9 dd 0
|
||||
GUIGUIOptnsTextA db 'USE JOYPAD1',0
|
||||
GUIGUIOptnsTextB dd 'SNOW EFFECT',0
|
||||
GUIGUIOptnsTextBb dd 'SMOKE EFFECT',0
|
||||
GUIGUIOptnsTextC dd 'WATER EFFECT A',0
|
||||
GUIGUIOptnsTextCb dd 'WATER EFFECT B',0
|
||||
GUIGUIOptnsTextD dd 'MAIN WINDOW OPTIONS :',0
|
||||
|
||||
@@ -54,7 +54,7 @@ PREOBJ=${OBJDIR}/dosbuff.o ${OBJDIR}/ipx.o ${OBJDIR}/zipx.o
|
||||
|
||||
ZIPOBJ=${ZIPDIR}/zzip.o ${ZIPDIR}/unzip.o ${ZIPDIR}/zpng.o
|
||||
|
||||
MAINOBJ=cfgload.o endmem.o fixsin.o init.o ui.o vcache.o water.o
|
||||
MAINOBJ=cfgload.o endmem.o fixsin.o init.o ui.o vcache.o water.o smoke.o
|
||||
|
||||
|
||||
OBJS=${CHIPSOBJ} ${CPUOBJ} ${DOSOBJ} ${GUIOBJ} ${VIDEOBJ} ${PREOBJ} ${MAINOBJ} ${ZIPOBJ}
|
||||
@@ -90,6 +90,7 @@ zsnesd.exe: ${OBJS}
|
||||
${DOSDIR}/zloader.o: ${DOSDIR}/zloader.c
|
||||
fixsin.o: fixsin.c
|
||||
water.o: water.c
|
||||
smoke.o: smoke.c
|
||||
${DOSDIR}/zfile.o: ${DOSDIR}/zfile.c
|
||||
${ZIPDIR}/unzip.o: ${ZIPDIR}/unzip.c ${ZIPDIR}/unzip.h
|
||||
${ZIPDIR}/zzip.o: ${ZIPDIR}/zzip.c ${ZIPDIR}/unzip.h
|
||||
|
||||
@@ -63,7 +63,7 @@ PREOBJ=
|
||||
|
||||
ZIPOBJ=${ZIPDIR}/zzip.obj ${ZIPDIR}/unzip.obj ${ZIPDIR}/zpng.obj
|
||||
|
||||
MAINOBJ=cfgload.obj endmem.obj fixsin.obj init.obj ui.obj vcache.obj water.obj
|
||||
MAINOBJ=cfgload.obj endmem.obj fixsin.obj init.obj ui.obj vcache.obj water.obj smoke.obj
|
||||
|
||||
OBJS=${CHIPSOBJ} ${CPUOBJ} ${WINOBJ} ${GUIOBJ} ${VIDEOBJ} ${ZIPOBJ} ${MAINOBJ} ${WINDOSOBJ}
|
||||
LIBS=
|
||||
@@ -111,6 +111,7 @@ ${DOSDIR}/sw.o: ${DOSDIR}/sw.asm macros.mac
|
||||
${DOSDIR}/vesa12.o: ${DOSDIR}/vesa12.asm macros.mac
|
||||
fixsin.obj: fixsin.c
|
||||
water.obj: water.c
|
||||
smoke.obj: smoke.c
|
||||
${VIDEODIR}/2xsaiw.obj: ${VIDEODIR}/2xsaiw.asm macros.mac
|
||||
${VIDEODIR}/procvid.obj: ${VIDEODIR}/procvid.asm macros.mac ${VIDEODIR}/copyvid.inc ${VIDEODIR}/2xSaImmx.inc
|
||||
${CHIPDIR}/sa1regs.obj: ${CHIPDIR}/sa1regs.asm macros.mac\
|
||||
|
||||
159
zsnes/src/smoke.c
Normal file
159
zsnes/src/smoke.c
Normal file
@@ -0,0 +1,159 @@
|
||||
|
||||
|
||||
#ifdef __LINUX__
|
||||
# include "gblhdr.h"
|
||||
#else
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
#endif
|
||||
|
||||
|
||||
// Ripped from an Allegro example (exflame.c). :P
|
||||
// Should be fire, but looks more like smoke in ZSNES.
|
||||
|
||||
#define MIN(x,y) \
|
||||
(((x) < (y)) ? (x) : (y))
|
||||
|
||||
#define ABS(x) \
|
||||
(((x) >= 0) ? (x) : ( - (x)))
|
||||
|
||||
|
||||
#define FIRE_HOTSPOTS 80
|
||||
|
||||
static int fire_hotspot [FIRE_HOTSPOTS];
|
||||
|
||||
|
||||
extern char * vidbuffer;
|
||||
|
||||
|
||||
#define SCRW 288
|
||||
|
||||
#define SCRH 224
|
||||
|
||||
|
||||
static unsigned char fire_line [SCRW];
|
||||
|
||||
static unsigned char fire_buffer [SCRW * SCRH];
|
||||
|
||||
|
||||
static int fire_init_flag;
|
||||
|
||||
|
||||
static void draw_bottom_line_of_fire (void)
|
||||
{
|
||||
int count, count2;
|
||||
|
||||
memset (&fire_line, 0, SCRW);
|
||||
|
||||
for (count = 0; count < FIRE_HOTSPOTS; count ++)
|
||||
{
|
||||
for (count2 = (fire_hotspot [count] - 20);
|
||||
count2 < (fire_hotspot [count] + 20); count2 ++)
|
||||
{
|
||||
if ((count2 >= 0) && (count2 < SCRW))
|
||||
{
|
||||
fire_line [count2] =
|
||||
MIN((fire_line [count2] + 20) -
|
||||
ABS(fire_hotspot [count] - count2), 256);
|
||||
}
|
||||
}
|
||||
|
||||
fire_hotspot [count] += ((rand () & 7) - 3);
|
||||
|
||||
if (fire_hotspot [count] < 0)
|
||||
{
|
||||
fire_hotspot [count] += SCRW;
|
||||
}
|
||||
else if (fire_hotspot [count] >= SCRW)
|
||||
{
|
||||
fire_hotspot [count] -= SCRW;
|
||||
}
|
||||
}
|
||||
|
||||
for (count = 0; count < SCRW; count ++)
|
||||
{
|
||||
fire_buffer [((SCRH - 1) *
|
||||
(SCRW)) + count] = fire_line [count];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void InitFire (void)
|
||||
{
|
||||
int x, y, pixel, count;
|
||||
|
||||
for (count = 0; count < FIRE_HOTSPOTS; count ++)
|
||||
{
|
||||
fire_hotspot [count] = (rand () % SCRW);
|
||||
}
|
||||
|
||||
for (count = 0; count < SCRH; count ++)
|
||||
{
|
||||
draw_bottom_line_of_fire ();
|
||||
|
||||
for (y = 0; y < (SCRH - 1); y ++)
|
||||
{
|
||||
for (x = 0; x < SCRW; x ++)
|
||||
{
|
||||
pixel = fire_buffer [((y + 1) * SCRW) + x];
|
||||
|
||||
if (pixel > 0)
|
||||
{
|
||||
pixel --;
|
||||
}
|
||||
|
||||
fire_buffer [(y * SCRW) + x] = pixel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fire_init_flag = 1;
|
||||
}
|
||||
|
||||
|
||||
// void DrawFire (void)
|
||||
void DrawSmoke (void)
|
||||
{
|
||||
int x, y, pixel, pixel2;
|
||||
|
||||
if (fire_init_flag != 1)
|
||||
{
|
||||
InitFire ();
|
||||
}
|
||||
|
||||
draw_bottom_line_of_fire ();
|
||||
|
||||
for (y = 0; y < (SCRH - 1); y ++)
|
||||
{
|
||||
for (x = 0; x < SCRW; x ++)
|
||||
{
|
||||
pixel = fire_buffer [((y + 1) * SCRW) + x];
|
||||
|
||||
if (pixel > 0)
|
||||
{
|
||||
pixel --;
|
||||
}
|
||||
|
||||
fire_buffer [(y * SCRW) + x] = pixel;
|
||||
}
|
||||
}
|
||||
|
||||
for (y = 0; y < SCRH; y ++)
|
||||
{
|
||||
for (x = 0; x < SCRW; x ++)
|
||||
{
|
||||
pixel = vidbuffer [(y * SCRW) + x];
|
||||
|
||||
pixel2 = (fire_buffer [(y * SCRW) + x] / 8);
|
||||
|
||||
if (pixel2 > pixel)
|
||||
{
|
||||
vidbuffer [(y * SCRW) + x] = pixel2;
|
||||
}
|
||||
else
|
||||
{
|
||||
vidbuffer [(y * SCRW) + x] = (pixel | pixel2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user