bool forceWalkingPerson (int x, int y, int objNum, loadedFunction * func, int di) { if (x == 0 && y == 0) return false; onScreenPerson * moveMe = findPerson (objNum); if (! moveMe) return false; if (moveMe -> continueAfterWalking) abortFunction (moveMe -> continueAfterWalking); moveMe -> walking = true; moveMe -> continueAfterWalking = NULL; moveMe -> directionWhenDoneWalking = di; moveMe -> walkToX = x; moveMe -> walkToY = y; // Let's pretend the start and end points are both in the same // polygon (which one isn't important) moveMe -> inPoly = 0; moveMe -> walkToPoly = 0; doBorderStuff (moveMe); if (walkMe (moveMe) || moveMe -> spinning) { moveMe -> continueAfterWalking = func; return true; } else { return false; } }
bool makeWalkingPerson (int x, int y, int objNum, loadedFunction * func, int di) { if (x == 0 && y == 0) return false; if (currentFloor -> numPolygons == 0) return false; onScreenPerson * moveMe = findPerson (objNum); if (! moveMe) return false; if (moveMe -> continueAfterWalking) abortFunction (moveMe -> continueAfterWalking); moveMe -> continueAfterWalking = NULL; moveMe -> walking = true; moveMe -> directionWhenDoneWalking = di; moveMe -> walkToX = x; moveMe -> walkToY = y; moveMe -> walkToPoly = inFloor (x, y); if (moveMe -> walkToPoly == -1) { if (! handleClosestPoint (moveMe -> walkToX, moveMe -> walkToY, moveMe -> walkToPoly)) return false; } moveMe -> inPoly = inFloor (moveMe -> x, moveMe -> y); if (moveMe -> inPoly == -1) { int xxx = moveMe -> x, yyy = moveMe -> y; if (! handleClosestPoint (xxx, yyy, moveMe -> inPoly)) return false; } doBorderStuff (moveMe); if (walkMe (moveMe, false) || moveMe -> spinning) { moveMe -> continueAfterWalking = func; return true; } else { return false; } }
void setPersonTransparency (int ob, unsigned char x) { onScreenPerson * moveMe = findPerson (ob); if (! moveMe) return; if (x > 254) x = 254; moveMe->transparency = x; }
bool setCharacterWalkSpeed (int f, int objNum) { if (f <= 0) return false; onScreenPerson * moveMe = findPerson (objNum); if (! moveMe) return false; moveMe -> walkSpeed = f; return true; }
void setPersonColourise (int ob, unsigned char r, unsigned char g, unsigned char b, unsigned char colourmix) { onScreenPerson * moveMe = findPerson (ob); if (! moveMe) return; moveMe->r = r; moveMe->g = g; moveMe->b = b; moveMe->colourmix = colourmix; }
bool setPersonExtra (int thisNum, int extra) { onScreenPerson * thisPerson = findPerson (thisNum); if (thisPerson) { thisPerson -> extra = extra; if (extra & EXTRA_NOSCALE) thisPerson -> scale = 1; return true; } return false; }
void animatePerson (int obj, personaAnimation * fram) { // Set a new SINGLE animation onScreenPerson * moveMe = findPerson (obj); if (moveMe) { if (moveMe -> continueAfterWalking) abortFunction (moveMe -> continueAfterWalking); moveMe -> continueAfterWalking = NULL; moveMe -> walking = false; moveMe -> spinning = false; moveMe -> myAnim = fram; } }
void jumpPerson (int x, int y, int objNum) { if (x == 0 && y == 0) return; onScreenPerson * moveMe = findPerson (objNum); if (! moveMe) return; if (moveMe -> continueAfterWalking) abortFunction (moveMe -> continueAfterWalking); moveMe -> continueAfterWalking = NULL; moveMe -> walking = false; moveMe -> spinning = false; moveAndScale (* moveMe, x, y); }
bool stopPerson (int o) { onScreenPerson * moveMe = findPerson (o); if (moveMe) if (moveMe -> continueAfterWalking) { abortFunction (moveMe -> continueAfterWalking); moveMe -> continueAfterWalking = NULL; moveMe -> walking = false; moveMe -> spinning = false; setFrames (* moveMe, ANI_STAND); return true; } return false; }
bool turnPersonToFace (int thisNum, int direc) { onScreenPerson * thisPerson = findPerson (thisNum); if (thisPerson) { if (thisPerson -> continueAfterWalking) abortFunction (thisPerson -> continueAfterWalking); thisPerson -> continueAfterWalking = NULL; thisPerson -> walking = false; thisPerson -> spinning = false; turnMeAngle (thisPerson, direc); setFrames (* thisPerson, (thisPerson == speech->currentTalker) ? ANI_TALK : ANI_STAND); return true; } return false; }
/* * PersonExists() * * This function will check to see if the given name is valid for mail. * * This includes special processing for "Sysop" and "Citadel". */ int PersonExists(char *name) { int result; logBuffer temp; if ((strCmpU("Citadel", name) == SAMESTRING && HalfSysop()) || strCmpU("sysop", name) == SAMESTRING) return cfg.MAXLOGTAB; /* signals special string */ initLogBuf(&temp); result = findPerson(name, &temp); if (result != ERROR) strCpy(name, temp.lbname); killLogBuf(&temp); return result; }
void animatePerson (int obj, persona * per) { // Set a new costume onScreenPerson * moveMe = findPerson (obj); if (moveMe) { // if (moveMe -> continueAfterWalking) abortFunction (moveMe -> continueAfterWalking); // moveMe -> continueAfterWalking = NULL; // moveMe -> walking = false; moveMe -> spinning = false; moveMe -> myPersona = per; rethinkAngle (moveMe); if (moveMe-> walking) { setFrames (* moveMe, ANI_WALK); } else { setFrames (* moveMe, ANI_STAND); } } }
void removeOneCharacter (int i) { onScreenPerson * p = findPerson (i); if (p) { if (overRegion == &personRegion && overRegion->thisType == p->thisType) { overRegion = NULL; } if (p -> continueAfterWalking) abortFunction (p -> continueAfterWalking); p -> continueAfterWalking = NULL; onScreenPerson * * killPeople; for (killPeople = & allPeople; * killPeople != p; killPeople = & ((* killPeople) -> next)) {;} * killPeople = p -> next; removeObjectType (p -> thisType); delete p; } }
/* -------------------------------------------------------------------- */ void killuser(void) { label who; int logno; getNormStr("who", who, NAMESIZE, ECHO); logno = findPerson(who, &lBuf); if (logno == ERROR || !strlen(who)) { mPrintf("No \'%s\' known. \n ", who); return; } if (strcmpi(logBuf.lbname, who) == SAMESTRING) { mPrintf("Cannot kill your own account, log out first.\n"); return; } if (!getYesNo(confirm, 0)) return; mPrintf( "\'%s\' terminated.\n ", who); /* trap it */ sprintf(msgBuf->mbtext, "User %s terminated", who); trap(msgBuf->mbtext, T_SYSOP); lBuf.lbname[0] = '\0'; lBuf.lbin[ 0] = '\0'; lBuf.lbpw[ 0] = '\0'; lBuf.lbflags.L_INUSE = FALSE; lBuf.lbflags.PERMANENT = FALSE; putLog(&lBuf, logno); }
bool floatCharacter (int f, int objNum) { onScreenPerson * moveMe = findPerson (objNum); if (! moveMe) return false; moveMe -> floaty = f; return true; }
/* -------------------------------------------------------------------- */ void groupfunc(void) { label who; label groupname; int groupslot, logNo; getString("group", groupname, NAMESIZE, FALSE, ECHO, ""); groupslot = partialgroup(groupname); if (groupslot != ERROR) { if ( grpBuf.group[groupslot].lockout && !sysop ) groupslot = ERROR; if( grpBuf.group[groupslot].hidden && !ingroup(groupslot) && !onConsole ) groupslot = ERROR; } if ( groupslot == ERROR || !strlen(groupname) ) { mPrintf("\n No such group."); return; } getNormStr("who", who, NAMESIZE, ECHO); logNo = findPerson(who, &lBuf); if (logNo == ERROR || !strlen(who) ) { mPrintf("No \'%s\' known. \n ", who); return; } if (lBuf.groups[groupslot] == grpBuf.group[groupslot].groupgen) { if (getYesNo("Remove from group", 0)) { lBuf.groups[groupslot] = (uchar)((grpBuf.group[groupslot].groupgen + (MAXGROUPGEN - 1)) % MAXGROUPGEN); sprintf(msgBuf->mbtext, "%s kicked out of group %s by %s", lBuf.lbname, grpBuf.group[groupslot].groupname, logBuf.lbname ); trap(msgBuf->mbtext, T_AIDE); aideMessage(); } } else if (getYesNo("Add to group", 0)) { lBuf.groups[groupslot] = grpBuf.group[groupslot].groupgen; sprintf(msgBuf->mbtext, "%s added to group %s by %s", lBuf.lbname, grpBuf.group[groupslot].groupname, logBuf.lbname ); trap(msgBuf->mbtext, T_AIDE); aideMessage(); } putLog(&lBuf, logNo); /* see if it is us: */ if (loggedIn && strcmpi(logBuf.lbname, who) == SAMESTRING) { logBuf.groups[groupslot] = lBuf.groups[groupslot]; } }
/* -------------------------------------------------------------------- */ void globaluser(void) { label who; int groupslot, yn, logNo; getNormStr("who", who, NAMESIZE, ECHO); logNo = findPerson(who, &lBuf); if (logNo == ERROR || !strlen(who) ) { mPrintf("No \'%s\' known. \n ", who); return; } for(groupslot=0; groupslot < MAXGROUPS; groupslot++) { if (grpBuf.group[groupslot].g_inuse && ( !grpBuf.group[groupslot].lockout || sysop ) && ( !grpBuf.group[groupslot].hidden || ingroup(groupslot) ) ) { mPrintf(" %s", grpBuf.group[groupslot].groupname); if (lBuf.groups[groupslot] == grpBuf.group[groupslot].groupgen) { if ((yn = getYesNo("Remove from group", 3)) != 0 /*NULL*/) { if (yn == 2) { SaveAideMess(); return; } lBuf.groups[groupslot] = (uchar)((grpBuf.group[groupslot].groupgen + (MAXGROUPGEN - 1)) % MAXGROUPGEN); sprintf(msgBuf->mbtext, "%s kicked out of group %s by %s", lBuf.lbname, grpBuf.group[groupslot].groupname, logBuf.lbname ); trap(msgBuf->mbtext, T_AIDE); amPrintf(" %s\n", msgBuf->mbtext); } } else { if ((yn = getYesNo("Add to group", 3)) != /* NULL */ 0) { if (yn == 2) { SaveAideMess(); return; } lBuf.groups[groupslot] = grpBuf.group[groupslot].groupgen; sprintf(msgBuf->mbtext, "%s added to group %s by %s", lBuf.lbname, grpBuf.group[groupslot].groupname, logBuf.lbname ); trap(msgBuf->mbtext, T_SYSOP); amPrintf(" %s\n",msgBuf->mbtext); } } putLog(&lBuf, logNo); /* see if it is us: */ if (loggedIn && strcmpi(logBuf.lbname, who) == SAMESTRING) { logBuf.groups[groupslot] = lBuf.groups[groupslot]; } } } SaveAideMess(); }
/************************************************************************ * main() Initialize & start citadel ************************************************************************/ void main(int argc, char *argv[]) { int i, cfg_ctdl = FALSE; long b; char init_baud; static char prompt[92]; char *envprompt; cfg.bios = 1; cit_init_timer(); /* initialize cit_time() and cit_timer() */ cfg.attr = 7; /* logo gets white letters */ setscreen(); /* initialize screen system */ memset(&parm,0,sizeof(parm)); for (i = 1; i < argc; i++) { if (argv[i][0] == '/' || argv[i][0] == '-') { switch (tolower(argv[i][1])) { #ifndef ATARI_ST case 'd': /* DesqView/TopView */ parm.dv = 1; cPrintf("DesqView/TopView mode\n"); break; case 'b': /* baud rate (for shell) */ if (argv[i + 1]) { b = atol(argv[++i]); for (init_baud = 0; bauds[init_baud]; ++init_baud) if (bauds[init_baud] == b) { parm.baud = init_baud; cPrintf("Initial baud rate fixed at %ld\n", b); break; } } break; case 'm': parm.memcheck = !parm.memcheck; break; #endif case 'c': /* Configure system */ cfg_ctdl = TRUE; break; case 'p': /* pace output */ if (argv[i + 1]) { parm.pace = atoi(argv[++i]); cPrintf("Output pacing %d\n", parm.pace); } break; case 's': /* run in shell from another BBS (door). */ cPrintf("Shell mode\n"); parm.door = TRUE; break; /*#ifndef ATARI_ST*/ #ifndef FLOPPY case 'e': /* use EMS */ if (_OvrInitEms(0, 0, 0)) { cPrintf("EMS memory initialization failed!\n"); parm.ems = 1; } break; #endif /*#endif*/ case 'v': /* just do events */ parm.events = 1; break; /*#ifndef ATARI_ST*/ #ifndef FLOPPY case 'x': /* use exteneded memory */ if (_OvrInitExt(0, 0)) cPrintf("Extended memory initialization failed!\n"); parm.ext = 1; break; #endif /*#endif*/ case 'l': /* log in user */ if (argv[i + 1]) { parm.login = argv[++i]; cPrintf("Auto-login\n"); } break; case 'u': /* log in user */ if (argv[i + 1]) { parm.user = argv[++i]; cPrintf("Auto-login %s\n", parm.user); } break; default: cPrintf("\nUnknown commandline switch '%s'.\n", argv[i]); cPrintf("Valid DOS command line switches:\n"); cPrintf(" -b baud Starting baud rate (300-19200)\n"); cPrintf(" -c Read configuration files\n"); cPrintf(" -d DesqView/TopView\n"); #ifndef FLOPPY cPrintf(" -e Use EMS memory for overlays\n"); #endif cPrintf(" -l str Log in using initials;password in str\n"); cPrintf(" -m Memory check during idle time, start\n"); cPrintf(" -p num Set output pacing to num\n"); cPrintf(" -s Run as a shell from another BBS\n"); cPrintf(" -u 'name' Log in using specifed user name"); cPrintf(" -v Just run cron events\n"); #ifndef FLOPPY cPrintf(" -x Use extended memory for overlays (386/486 only!)\n"); #endif exit(1); } } } if (cfg_ctdl) /* force reconfigure? */ unlink("etc.tab"); logo(); /* prints out system logo */ if (cit_time() < 607415813L) { cPrintf("\n\nPlease set your time and date!\n"); exit(1); } /* set prompt for shells */ envprompt = getenv("PROMPT"); if (!envprompt) envprompt = "$p$g"; sprintf(prompt, "PROMPT=\r\nType EXIT to return to FredCit\r\n%s", envprompt); if (putenv(prompt)) { cPrintf("\n\nCan not set DOS prompt!\n"); delay (5000); } /* initialize citadel */ initCitadel(); if (parm.baud) { cfg.initbaud = parm.baud; baud(cfg.initbaud); } if (parm.door) { detectflag = 1; // carrier(); // if (haveCarrier) { // carrdetect(); // newCarrier = 1; /* make hello blurb show up */ // } } greeting(); sysReq = FALSE; if (cfg.f6pass[0]) ConLock = TRUE; if (parm.dv) { cfg.bios = 1; directvideo = 0; } if (parm.login) { normalizeString(parm.login); /* normalize string in environment */ login(parm.login,NULL); } else if (parm.user && !loggedIn) { normalizeString(parm.user); /* normalize string in environment */ if (findPerson(parm.user, &lBuf) != ERROR) login(lBuf.lbin,lBuf.lbpw); } /* read in door interface files */ if (parm.door) { readDoorFiles(0); } /* update25(); */ do_idle(0); /* install critical error handler */ harderr(cit_herror_handler); /* execute main command loop */ if (!parm.events) command_loop(); else { do_cron_loop(); } exitcitadel(); }
/* -------------------------------------------------------------------- */ void forwardaddr(void) { char name[NAMESIZE+NAMESIZE+2]; label forward; label rnode; label rregion; label rcountry; label temp; int logno; doCR(); getNormStr("forwarding name", name, NAMESIZE+NAMESIZE+1, ECHO); doCR(); if( !strlen(name) ) { logBuf.FORtOnODE = 0; mPrintf("Exclusive messages now routed to you"); doCR(); logBuf.forward[0] = '\0'; } else { parseNetAddress(name, forward, rnode, rregion, rcountry); if (!*rnode) /* if not forwarding to a node */ { logno = findPerson(name, lBuf2); if (logno == ERROR) { mPrintf("No '%s' known.", name); doCR(); return; } logBuf.FORtOnODE = 0; mPrintf("Exclusive messages now forwarded to %s", lBuf2->lbname); doCR(); strcpy(logBuf.forward, lBuf2->lbname); } else /* forwarding to node */ { alias(rnode); /* logno = findPerson(rnode, lBuf2); */ /* if (logno == ERROR) */ /* { */ strcpy(temp, rnode); route(temp); if (!getnode(temp)) { if (!*rregion) { mPrintf("Don't know how to reach '%s'", rnode); return; } } else { strcpy(logBuf.forward, forward); strcpy(logBuf.forward_node, rnode); logBuf.FORtOnODE = 1; mPrintf("Exclusive messages now forwarded to %s @ %s", logBuf.forward, logBuf.forward_node); doCR(); } /* } */ } } }
/* -------------------------------------------------------------------- */ void doLogin(char moreYet) { int foundIt; char InitPw[NAMESIZE+NAMESIZE+2]; char password[NAMESIZE+NAMESIZE+2]; char initials[NAMESIZE+NAMESIZE+2]; char *semicolon; Mflush(); if (!CARRIER) return; if (login_user || login_pw) /* handle command line log-ins */ { if (!modStat) if (cfg.offhook) offhook(); /* login using initials and pw */ if (login_pw) { normalizepw(cmd_login, initials, password); login_pw = FALSE; } else if (login_user) { normalizeString(cmd_login); if (findPerson(cmd_login, &logBuf) != ERROR) { strcpy(initials, logBuf.lbin); strcpy(password, logBuf.lbpw); } login_user = FALSE; } } else /* ask user for initials and password */ { if (moreYet == 2) moreYet = FALSE; else { /* dont print Login when hitting 'L' from console mode */ if (!(!moreYet && !loggedIn && !modStat)) { mPrintf("Login "); } } if (loggedIn) { mPrintf("\n Already logged in!\n "); return; } if (!modStat) if (cfg.offhook) offhook(); getNormStr((moreYet) ? "" : "your initials", InitPw, NAMESIZE+NAMESIZE+1, NO_ECHO); if (!CARRIER) return; dospCR(); semicolon = strchr(InitPw, ';'); if (!semicolon) { strcpy(initials, InitPw); getNormStr( "password", password, NAMESIZE, NO_ECHO); dospCR(); } else { normalizepw(InitPw, initials, password); } /* dont allow anything over 19 characters */ initials[NAMESIZE] = '\0'; } /* reset transmitted & received */ transmitted = 0l; received = 0l; /* reset read & entered */ mread = 0; entered = 0; foundIt = ((pwslot(initials, password)) != ERROR); if (foundIt && *password) { loggedIn = TRUE; update25(); /* trap it */ if (!logBuf.lbflags.NODE) { sprintf( msgBuf->mbtext, "Login %s", logBuf.lbname); if (onConsole) strcat(msgBuf->mbtext, " (Console)"); trap(msgBuf->mbtext, T_LOGIN); } else { sprintf( msgBuf->mbtext, "NetLogin %s", logBuf.lbname); trap(msgBuf->mbtext, T_NETWORK); } } else { loginNew(initials, password); } if (!loggedIn) return; heldMessage = FALSE; setsysconfig(); setgroupgen(); setroomgen(); setlbvisit(); slideLTab(thisSlot); /* cant log in now. */ if (cfg.accounting && !logBuf.lbflags.NOACCOUNT) { negotiate(); logincrement(); if (!logincheck()) { Hangup(); return; } } /* can't log in now. */ if (logBuf.VERIFIED && !onConsole) { tutorial("verified.blb"); Hangup(); return; } if (logBuf.lbflags.NODE) { #ifdef TRASH if (debug) { readnode(); cPrintf("Node: \"%s\" \"%s\"", node.ndname, node.ndregion); doccr(); cPrintf("Phone: \"%s\" %d", node.ndphone, node.nddialto); doccr(); cPrintf("Login: \"%s\" %d", node.ndlogin, node.ndwaitto); doccr(); cPrintf("Baud: %d Protocol: \"%s\"\n ", node.ndbaud, node.ndprotocol); cPrintf("Expire:%d Waitout: %d", node.ndexpire, node.ndwaitto); doccr(); cPrintf("Network: %d ZIP: %s UNZIP: %s", node.network, node.zip, node.unzip); doccr(); } #endif time(&logtimestamp); return; } if (logBuf.PSYCHO) { backout = TRUE; } /* reverse engineering Minibin?!?! */ if (logBuf.MINIBIN) { minibin(); } changedir(cfg.helppath); if ( filexists("bulletin.blb") ) { tutorial("bulletin.blb"); } gotodefaulthall(); roomtalley(); mf.mfLim = 0; /* just to make sure. */ mf.mfMai = 0; mf.mfPub = 0; mf.mfUser[0]=0; nochat(TRUE); /* reset chats */ /* verbose = FALSE; */ verbose = logBuf.VERBOSE; /* hmmm... where to put this */ if (roomBuf.rbflags.APLIC && roomBuf.rbflags.AUTOAPP ) ExeAplic(); showMessages(NEWoNLY, FALSE); verbose = FALSE; if (expert) listRooms(NEWRMS, FALSE); else listRooms(OLDNEW, FALSE); outFlag = OUTOK; setio(whichIO, echo, outFlag); /* record login time, date */ time(&logtimestamp); cfg.callno++; storeLog(); }
void movePerson (int x, int y, int objNum) { onScreenPerson * moveMe = findPerson (objNum); if (moveMe) moveAndScale (* moveMe, x, y); }
void setShown (bool h, int ob) { onScreenPerson * moveMe = findPerson (ob); if (moveMe) moveMe -> show = h; }
void setDrawMode (int h, int ob) { onScreenPerson * moveMe = findPerson (ob); if (! moveMe) return; setMyDrawMode (moveMe, h); }