Amiga: drop #if 0 dead-code blocks

Includes a dead amii_player_selection / RandomWindow pair (~280 lines),
eraseall / CopyFile in amidos.c, and smaller fragments.
This commit is contained in:
Ingo Paschke
2026-05-11 20:30:45 +02:00
parent 00433c7998
commit e90a297021
6 changed files with 0 additions and 456 deletions
-68
View File
@@ -256,74 +256,6 @@ filesize(char *file)
return size;
}
#if 0
void
void
eraseall(const char *path, const char *files)
{
BPTR dirLock, dirLock2;
struct FileInfoBlock *fibp;
int chklen;
#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
if(files != g.alllevels)panic("eraseall");
#endif
chklen=(int)index(files,'*')-(int)files;
if (dirLock = Lock( (char *)path ,SHARED_LOCK)) {
dirLock2=DupLock(dirLock);
dirLock2= CurrentDir(dirLock2);
fibp=AllocMem(sizeof(struct FileInfoBlock),0);
if(fibp){
if(Examine(dirLock,fibp)){
while(ExNext(dirLock,fibp)){
if(!strncmp(fibp->fib_FileName,files,chklen)){
DeleteFile(fibp->fib_FileName);
}
}
}
FreeMem(fibp,sizeof(struct FileInfoBlock));
}
UnLock(dirLock);
UnLock(CurrentDir(dirLock2));
}
}
#endif
/* This size makes that most files can be copied with two Read()/Write()s */
#if 0 /* Unused */
#define COPYSIZE 4096
char *CopyFile(const char *from, const char *to)
{
BPTR fromFile, toFile;
char *buffer;
long size;
char *error = NULL;
buffer = (char *) alloc(COPYSIZE);
if (fromFile = Open( (char *)from, MODE_OLDFILE)) {
if (toFile = Open( (char *)to, MODE_NEWFILE)) {
while (size = Read(fromFile, buffer, (long)COPYSIZE)) {
if (size == -1){
error = "Read error";
break;
}
if (size != Write(toFile, buffer, size)) {
error = "Write error";
break;
}
}
Close(toFile);
} else
error = "Cannot open destination";
Close(fromFile);
} else
error = "Cannot open source (this should not occur)";
free(buffer);
return error;
}
#endif
#ifdef MFLOPPY
/* this should be replaced */
-7
View File
@@ -445,13 +445,6 @@ DoMenuScroll(int win, int blocking, int how, menu_item **retmip)
morc = 0;
oidx = -1;
#if 0
/* Make sure there are no selections left over from last time. */
/* XXX potential problem for preselection if this is really needed */
for( amip = cw->menu.items; amip; amip = amip->next )
amip->selected = 0;
#endif
DisplayData(win, topidx);
/* Make the prop gadget the right size and place */
-301
View File
@@ -408,290 +408,6 @@ amii_askname(void)
/* Get the player selection character */
#if 0 /* New function at the bottom */
void
amii_player_selection(void)
{
struct Window *cwin;
struct IntuiMessage *imsg;
int aredone = 0;
struct Gadget *gd;
static int once = 0;
long class, code;
amii_clear_nhwindow( WIN_BASE );
if (validrole(flags.initrole))
return;
else {
flags.initrole = randrole(FALSE);
return;
}
#if 0 /* Don't query the user ... instead give random character -jhsa */
#if 0 /* OBSOLETE */
if( *svp.pl_character ){
svp.pl_character[ 0 ] = toupper( svp.pl_character[ 0 ] );
if( strchr( pl_classes, svp.pl_character[ 0 ] ) )
return;
}
#endif
if( !once ){
if( bigscreen ){
Type_NewWindowStructure1.TopEdge =
(HackScreen->Height/2) - (Type_NewWindowStructure1.Height/2);
}
for( gd = Type_NewWindowStructure1.FirstGadget; gd;
gd = gd->NextGadget )
{
if( gd->GadgetID != 0 )
SetBorder( gd );
}
once = 1;
}
if( WINVERS_AMIV )
{
Type_NewWindowStructure1.Extension = wintags;
Type_NewWindowStructure1.Flags |= WFLG_NW_EXTENDED;
fillhook.h_Entry = (void *) &LayerFillHook;
fillhook.h_Data = (void *)-2;
fillhook.h_SubEntry = 0;
}
Type_NewWindowStructure1.Screen = HackScreen;
if( ( cwin = OpenShWindow( (void *)&Type_NewWindowStructure1 ) ) == NULL )
{
return;
}
#if 0
WindowToFront( cwin );
#endif
while( !aredone )
{
WaitPort( cwin->UserPort );
while( ( imsg = (void *) GetMsg( cwin->UserPort ) ) != NULL )
{
class = imsg->Class;
code = imsg->Code;
gd = (struct Gadget *)imsg->IAddress;
ReplyMsg( (struct Message *)imsg );
switch( class )
{
case VANILLAKEY:
if( strchr( pl_classes, toupper( code ) ) )
{
svp.pl_character[0] = toupper( code );
aredone = 1;
}
else if( code == ' ' || code == '\n' || code == '\r' )
{
flags.initrole = randrole(FALSE);
#if 0 /* OBSOLETE */
strcpy( svp.pl_character, roles[ rnd( 11 ) ] );
#endif
aredone = 1;
amii_clear_nhwindow( WIN_BASE );
CloseShWindow( cwin );
RandomWindow( svp.pl_character );
return;
}
else if( code == 'q' || code == 'Q' )
{
CloseShWindow( cwin );
clearlocks();
exit_nhwindows(NULL);
nh_terminate(0);
}
else
DisplayBeep( NULL );
break;
case GADGETUP:
switch( gd->GadgetID )
{
case 1: /* Random Character */
flags.initrole = randrole(FALSE);
#if 0 /* OBSOLETE */
strcpy( svp.pl_character, roles[ rnd( 11 ) ] );
#endif
amii_clear_nhwindow( WIN_BASE );
CloseShWindow( cwin );
RandomWindow( svp.pl_character );
return;
default:
svp.pl_character[0] = gd->GadgetID;
break;
}
aredone = 1;
break;
case CLOSEWINDOW:
CloseShWindow( cwin );
clearlocks();
exit_nhwindows(NULL);
nh_terminate(0);
break;
}
}
}
amii_clear_nhwindow( WIN_BASE );
CloseShWindow( cwin );
#endif /* Do not query user ... -jhsa */
}
#endif /* Function elsewhere */
#if 0 /* Unused ... -jhsa */
#include "NH:sys/amiga/randwin.c"
void
RandomWindow(char *name)
{
struct MsgPort *tport;
struct timerequest *trq;
static int once = 0;
struct Gadget *gd;
struct Window *w;
struct IntuiMessage *imsg;
int ticks = 0, aredone = 0, timerdone = 0;
long mask, got;
tport = CreateMsgPort();
trq = (struct timerequest *)CreateIORequest( tport, sizeof( *trq ) );
if( tport == NULL || trq == NULL )
{
allocerr:
if( tport ) DeleteMsgPort( tport );
if( trq ) DeleteIORequest( (struct IORequest *)trq );
Delay( 8 * 50 );
return;
}
if( OpenDevice( TIMERNAME, UNIT_VBLANK, (struct IORequest *)trq, 0L ) != 0 )
goto allocerr;
trq->tr_node.io_Command = TR_ADDREQUEST;
trq->tr_time.tv_secs = 8;
trq->tr_time.tv_micro = 0;
SendIO( (struct IORequest *)trq );
/* Place the name in the center of the screen */
Rnd_IText5.IText = name;
Rnd_IText6.LeftEdge = Rnd_IText4.LeftEdge +
(strlen(Rnd_IText4.IText)+1)*8;
Rnd_NewWindowStructure1.Width = (
(strlen( Rnd_IText2.IText )+1) * 8 ) +
HackScreen->WBorLeft + HackScreen->WBorRight;
Rnd_IText5.LeftEdge = (Rnd_NewWindowStructure1.Width -
(strlen(name)*8))/2;
gd = Rnd_NewWindowStructure1.FirstGadget;
gd->LeftEdge = (Rnd_NewWindowStructure1.Width - gd->Width)/2;
/* Chose correct modifier */
Rnd_IText6.IText = "a";
switch( *name )
{
case 'a': case 'e': case 'i': case 'o':
case 'u': case 'A': case 'E': case 'I':
case 'O': case 'U':
Rnd_IText6.IText = "an";
break;
}
if( !once )
{
if( bigscreen )
{
Rnd_NewWindowStructure1.TopEdge =
(HackScreen->Height/2) - (Rnd_NewWindowStructure1.Height/2);
}
for( gd = Rnd_NewWindowStructure1.FirstGadget; gd; gd = gd->NextGadget )
{
if( gd->GadgetID != 0 )
SetBorder( gd );
}
Rnd_NewWindowStructure1.IDCMPFlags |= VANILLAKEY;
once = 1;
}
if( WINVERS_AMIV )
{
Rnd_NewWindowStructure1.Extension = wintags;
Rnd_NewWindowStructure1.Flags |= WFLG_NW_EXTENDED;
fillhook.h_Entry = (void *) &LayerFillHook;
fillhook.h_Data = (void *)-2;
fillhook.h_SubEntry = 0;
}
Rnd_NewWindowStructure1.Screen = HackScreen;
if( ( w = OpenShWindow( (void *)&Rnd_NewWindowStructure1 ) ) == NULL )
{
AbortIO( (struct IORequest *)trq );
WaitIO( (struct IORequest *)trq );
CloseDevice( (struct IORequest *)trq );
DeleteIORequest( (struct IORequest *) trq );
DeleteMsgPort( tport );
Delay( 50 * 8 );
return;
}
PrintIText( w->RPort, &Rnd_IntuiTextList1, 0, 0 );
mask = (1L << tport->mp_SigBit)|(1L << w->UserPort->mp_SigBit);
while( !aredone )
{
got = Wait( mask );
if( got & (1L << tport->mp_SigBit ) )
{
aredone = 1;
timerdone = 1;
GetMsg( tport );
}
while( w && ( imsg = (struct IntuiMessage *) GetMsg( w->UserPort ) ) )
{
switch( (long)imsg->Class )
{
/* Must be up for a little while... */
case INACTIVEWINDOW:
if( ticks >= 40 )
aredone = 1;
break;
case INTUITICKS:
++ticks;
break;
case GADGETUP:
aredone = 1;
break;
case VANILLAKEY:
if(imsg->Code=='\n' || imsg->Code==' ' || imsg->Code=='\r')
aredone = 1;
break;
}
ReplyMsg( (struct Message *)imsg );
}
}
if( !timerdone )
{
AbortIO( (struct IORequest *)trq );
WaitIO( (struct IORequest *)trq );
}
CloseDevice( (struct IORequest *)trq );
DeleteIORequest( (struct IORequest *) trq );
DeleteMsgPort( tport );
if(w) CloseShWindow( w );
}
#endif /* Discarded randwin ... -jhsa */
/* this should probably not be needed (or be renamed)
void
@@ -992,23 +708,6 @@ amii_yn_function(const char *query, const char *resp, char def)
cursor_on(WIN_MESSAGE);
q = lowc(WindowGetchar());
cursor_off(WIN_MESSAGE);
#if 0
/* fix for PL2 */
if (q == '\020') { /* ctrl-P */
if(!doprev)
(void) tty_doprev_message(); /* need two initially */
(void) tty_doprev_message();
q = (char)0;
doprev = 1;
continue;
} else if (doprev) {
tty_clear_nhwindow(WIN_MESSAGE);
cw->maxcol = cw->maxrow;
doprev = 0;
amii_addtopl(prompt);
continue;
}
#endif /*0*/
digit_ok = allow_num && isdigit(q);
if (q == '\033') {
if (strchr(resp, 'q'))
-56
View File
@@ -732,26 +732,6 @@ int foreg[AMII_MAXCOLORS] = {
int backg[AMII_MAXCOLORS] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 4, 1, 6, 5, 3, 0
};
#if 0
#define CLR_BLACK 0
#define CLR_RED 1
#define CLR_GREEN 2
#define CLR_BROWN 3 /* on IBM, low-intensity yellow is brown */
#define CLR_BLUE 4
#define CLR_MAGENTA 5
#define CLR_CYAN 6
#define CLR_GRAY 7 /* low-intensity white */
#define NO_COLOR 8
#define CLR_ORANGE 9
#define CLR_BRIGHT_GREEN 10
#define CLR_YELLOW 11
#define CLR_BRIGHT_BLUE 12
#define CLR_BRIGHT_MAGENTA 13
#define CLR_BRIGHT_CYAN 14
#define CLR_WHITE 15
#define CLR_MAX 16
#endif
/*
* Begin Revamped Text display routines
*
@@ -934,42 +914,6 @@ amii_start_glyphout(winid window)
cw->wflags |= FLMAP_INGLYPH;
}
#if 0
/*
* General cleanup routine -- flushes and restores cursor
*/
void
amii_end_glyphout(window)
winid window;
{
struct amii_WinDesc *cw;
struct Window *w;
if( ( cw = amii_wins[ window ] ) == (struct amii_WinDesc *)NULL )
panic("bad window id %d in amii_end_glyphout()", window );
if( ( cw->wflags & FLMAP_INGLYPH ) == 0 )
return;
cw->wflags &= ~(FLMAP_INGLYPH);
if( !(w = cw->win ) )
panic( "bad winid %d, no window ptr set", window );
/*
* Clean up whatever is left in the buffer
*/
iflags.use_color = usecolor;
/*
* Reset internal data structs
*/
SetAPen(w->RPort, apensave);
SetBPen(w->RPort, bpensave);
SetDrMd(w->RPort, modesave);
Move(w->RPort, xsave, ysave);
}
#endif
#endif
#ifdef OPT_DISPMAP
-18
View File
@@ -1106,10 +1106,6 @@ amii_init_nhwindows(int *argcp, char **argv)
PATCHLEVEL);
NewHackScreen.DefaultTitle = fname;
}
#if 0
NewHackScreen.BlockPen = C_BLACK;
NewHackScreen.DetailPen = C_WHITE;
#endif
if (IntuitionBase->LibNode.lib_Version >= 37) {
int i;
struct DimensionInfo dims;
@@ -1687,11 +1683,6 @@ amii_curs(winid window, int x, int y)
if (WINVERS_AMIV) {
if (cw->type == NHW_MAP) {
if (Is_rogue_level(&u.uz)) {
#if 0
int qqx= (x * w->RPort->TxWidth) + w->BorderLeft;
int qqy= w->BorderTop + ( (y+1) * w->RPort->TxHeight ) + 1;
printf("pos: (%d,%d)->(%d,%d)\n",x,y,qqx,qqy);
#endif
SetAPen(w->RPort,
C_WHITE); /* XXX should be elsewhere (was 4)*/
Move(rp, (x * w->RPort->TxWidth) + w->BorderLeft,
@@ -2038,15 +2029,6 @@ amii_print_glyph(winid win, coordxy x, coordxy y,
panic(winpanicstr, win, "amii_print_glyph");
}
#if 0
{
static int x=-1;
if(u.uz.dlevel != x){
fprintf(stderr,"lvlchg: %d (%d)\n",u.uz.dlevel,Is_rogue_level(&u.uz));
x = u.uz.dlevel;
}
}
#endif
if (WINVERS_AMIV && !Is_rogue_level(&u.uz)) {
amii_curs(win, x, y);
amiga_print_glyph(win, 0, glyph);
-6
View File
@@ -144,12 +144,6 @@ amii_putstr(winid window, int attr, const char *str)
p++;
str = p;
#if 0
if( str != ostr ) {
outsubstr( cw, "+", 1, fudge );
cw->curx+=2;
}
#endif
if (*str)
amii_scrollmsg(w, cw);
amii_cl_end(cw, cw->curx);