コード例 #1
0
static int ldo (int (*f)(char *), char *name) {
    int res;
    handler h = lreset();
    res = f(name);  /* dostring | dofile */
    signal(SIGINT, h);  /* restore old action */
    return res;
}
コード例 #2
0
ファイル: city.c プロジェクト: albert-wang/OmegaRPG
/* fixes up the jail in case it has been munged by player action */
void repair_jail(void)
{
    int i,j;
    for(i=0; i<11; i++)
        for(j=0; j<5; j++) {
            switch(jail[j][i]) {
            case '#':
                City->site[i+35][j+52].locchar = WALL;
                City->site[i+35][j+52].p_locf = L_NO_OP;
                City->site[i+35][j+52].aux = NOCITYMOVE;
                break;
            case '*':
                City->site[i+35][j+52].locchar = WALL;
                City->site[i+35][j+52].p_locf = L_NO_OP;
                City->site[i+35][j+52].aux = 10;
                break;
            case 'T':
                City->site[i+35][j+52].locchar = FLOOR;
                City->site[i+35][j+52].p_locf = L_PORTCULLIS_TRAP;
                City->site[i+35][j+52].aux = NOCITYMOVE;
                break;
            case '7':
                City->site[i+35][j+52].locchar = FLOOR;
                City->site[i+35][j+52].p_locf = L_PORTCULLIS;
                City->site[i+35][j+52].aux = NOCITYMOVE;
                break;
            case 'R':
                City->site[i+35][j+52].locchar = FLOOR;
                City->site[i+35][j+52].p_locf = L_RAISE_PORTCULLIS;
                City->site[i+35][j+52].aux = NOCITYMOVE;
                break;
            }
            lreset(i+35, j+52, CHANGED);
        }
}
コード例 #3
0
ファイル: aux1.cpp プロジェクト: Geozop/OmegaRPG
/* search once particular spot */
void searchat(int x, int y)
{
    int i;
    if (inbounds(x,y) && (random_range(3) || Player.status[ALERT])) {
        if (loc_statusp(x,y,SECRET)) {
            lreset(x,y,SECRET);
            lset(x, y, CHANGED);
            if ((Level->site[x][y].locchar==OPEN_DOOR) ||
                    (Level->site[x][y].locchar==CLOSED_DOOR)) {
                mprint("You find a secret door!");
                for(i=0; i<=8; i++) { /* FIXED! 12/25/98 */
                    lset(x+Dirs[0][i],y+Dirs[1][i],STOPS);
                    lset(x+Dirs[0][i], y+Dirs[1][i], CHANGED);
                }
            }
            else mprint("You find a secret passage!");
            drawvision(Player.x,Player.y);
        }
        if ((Level->site[x][y].p_locf >= TRAP_BASE) &&
                (Level->site[x][y].locchar != TRAP) &&
                (Level->site[x][y].p_locf <= TRAP_BASE+NUMTRAPS)) {
            Level->site[x][y].locchar = TRAP;
            lset(x, y, CHANGED);
            mprint("You find a trap!");
            drawvision(Player.x,Player.y);
            State.setFastMove(false);
        }
    }
}
コード例 #4
0
ファイル: gen.c プロジェクト: berkus/lang-e
/* begin emitting asm */
void v_begin(v_code *i) { 
	if(elock)
		v_fatal("do not support concurrent v_lambda calls.\n");
	elock = 1;
	v_ip = i; 
	v_calls = 0;
	register_reset() ;
	lreset();
}
コード例 #5
0
static int ldo (lua_State *lua_state, int (*f)(lua_State *,const char *), char *name) {
  int res;
  global_lua_state = lua_state;
  handler h = lreset();
  res = f(lua_state, name);  /* dostring | dofile */
  signal(SIGINT, h);  /* restore old action */
  global_lua_state = NULL;
  return res;
}
コード例 #6
0
ファイル: scr.c プロジェクト: anylonen/omega
/* write a blank to a spot if it is floor */
void blankoutspot(int i, int j)
{
  if (inbounds(i,j)) {
    lreset(i,j,LIT);
    lset(i, j, CHANGED);
    if (Level->site[i][j].locchar == FLOOR)  {
      Level->site[i][j].showchar = SPACE;
      putspot(i,j,SPACE);
    }
  }
}
コード例 #7
0
ファイル: scr.c プロジェクト: anylonen/omega
/* blank out a spot regardless */
void blotspot(int i, int j)
{
  if (inbounds(i,j)) {
    lreset(i,j,SEEN);
    Level->site[i][j].showchar = SPACE;
    if (! offscreen(i,j)) {
      wmove(Levelw,screenmody(j),screenmodx(i));
      wattrset(Levelw, CHARATTR(SPACE));
      waddch(Levelw, SPACE&0xff);
    }
  }
}
コード例 #8
0
ファイル: colua.c プロジェクト: neechbear/colloquy
static int ldo (int (*f)(lua_State *l, const char *), const char *name) {
  int res;
  handler h = lreset();
  int top = lua_gettop(L);
  res = f(L, name);  /* dostring | dofile */
  lua_settop(L, top);  /* remove eventual results */
  signal(SIGINT, h);  /* restore old action */
  /* Lua gives no message in such cases, so lua.c provides one */
  if (res == LUA_ERRMEM) {
    fprintf(stderr, "colua: memory allocation error\n");
  }
  else if (res == LUA_ERRERR)
    fprintf(stderr, "colua: error in error message\n");
  return res;
}
コード例 #9
0
ファイル: gen.c プロジェクト: berkus/lang-e
void v_begin_incremental(v_code *ip, int nbytes) {
        extern v_label_type v_epilogue_l;

	v_incremental = 1;
        frag_begin = ip;
        frag_bytes = nbytes;

	if(elock)
		v_fatal("do not support concurrent v_lambda calls.\n");
	elock = 1;
	v_ip = ip; 
	lreset();

        if(!v_labeleq(v_genlabel(), v_epilogue_l))
                v_fatal("v_begin_incremental: Bogus epilogue label");
}
コード例 #10
0
ファイル: city.c プロジェクト: albert-wang/OmegaRPG
void mazesite(char site, int i, int j, int populate)
{
    switch(site) {
    case '"':
        Level->site[i][j].locchar = HEDGE;
        if (random_range(10))
            Level->site[i][j].p_locf = L_HEDGE;
        else
            Level->site[i][j].p_locf = L_TRIFID;
        break;
    case '-':
        Level->site[i][j].locchar = CLOSED_DOOR;
        break;
    case '.':
        Level->site[i][j].locchar = FLOOR;
        break;
    case '>':
        Level->site[i][j].locchar = STAIRS_DOWN;
        Level->site[i][j].p_locf = L_SEWER;
        CitySiteList[L_SEWER-CITYSITEBASE][1] = i;
        CitySiteList[L_SEWER-CITYSITEBASE][2] = j;
        break;
    case 'z':
        Level->site[i][j].locchar = FLOOR;
        Level->site[i][j].p_locf = L_MAZE;
        break;
    case 'O':
        Level->site[i][j].locchar = OPEN_DOOR;
        Level->site[i][j].p_locf = L_ORACLE;
        CitySiteList[L_ORACLE-CITYSITEBASE][1] = i;
        CitySiteList[L_ORACLE-CITYSITEBASE][2] = j;
        break;
    case '?':
        randommazesite(i,j,populate);
        break;
    }
    lreset(i,j,SEEN);
}
コード例 #11
0
static void lstop (void) {
    lua_setlinehook(old_linehook);
    lua_setcallhook(old_callhook);
    lreset();
    lua_error("interrupted!");
}
コード例 #12
0
static void lstop (lua_State *lua_state, lua_Debug *ar) {
  lua_setlinehook(lua_state, old_linehook);
  lua_setcallhook(lua_state, old_callhook);
  lreset();
  make_lua_error(lua_state, "interrupted!");
}
コード例 #13
0
ファイル: guild1.cpp プロジェクト: B-Rich/OmegaRPG
void l_castle(void)
{
    Object* o;
    int x, y;

    if (Player.level < 3) {
        print1("You can't possibly enter the castle, you nobody!");
        print2("Come back when you are famous.");
    }
    else {
        print1("You are ushered into the castle.");
        if (Player.rank[NOBILITY]<DUKE) {
            print2("His Grace, ");
            nprint2(Duke);
            nprint2("-- Duke of Rampart! <fanfare>");
            morewait();
            clearmsg();
        }
        if (Player.rank[NOBILITY]==0) {
            print1("Well, sirrah, wouldst embark on a quest? [yn] ");
            if (ynq1() == 'y') {
                print2("Splendid. Bring me the head of the Goblin King.");
                Player.rank[NOBILITY]=COMMONER;
            }
            else {
                print1("You scoundrel! Guards! Take this blackguard away!");
                morewait();
                p_damage(Player.maxhp / 2, UNSTOPPABLE, "castle guards for lese majeste");
                send_to_jail();
            }
        }
        else if (Player.rank[NOBILITY]==COMMONER) {
            if (find_and_remove_item(CORPSEID,GOBLIN_KING)) {
                print1("Good job, sirrah! I promote you to the rank of esquire.");
                Player.rank[NOBILITY]=ESQUIRE;
                gain_experience(100);
                print2("Now that you have proved yourself true, another quest!");
                morewait();
                print1("Bring to me a Holy Defender!");
                print2("One is said to be in the possession of the Great Wyrm");
                morewait();
                clearmsg();
                print1("in the depths of the sewers below the city.");
            }
            else print2("Do not return until you achieve the quest, caitiff!");
        }
        else if (Player.rank[NOBILITY]==ESQUIRE) {
            if (find_and_remove_item(OB_DEFENDER,-1)) {
                print1("My thanks, squire. In return, I dub thee knight!");
                Player.rank[NOBILITY]=KNIGHT;
                gain_experience(1000);
                print2("If thou wouldst please me further...");
                morewait();
                print1("Bring me a suit of dragonscale armor.");
                print2("You might have to kill a dragon to get one....");
            }
            else print2("Greetings, squire. My sword? What, you don't have it?");
        }
        else if (Player.rank[NOBILITY]==KNIGHT) {
            if (find_and_remove_item(OB_DRAGONSCALE,-1)) {
                print1("Thanks, good sir knight.");
                print2("Here are letters patent to a peerage!");
                Player.rank[NOBILITY]=LORD;
                gain_experience(10000);
                morewait();
                print1("If you would do me a final service...");
                print2("I require the Orb of Mastery. If you would be so kind...");
                morewait();
                print1("By the way, you might find the Orb in the possession");
                print2("Of the Elemental Master on the Astral Plane");
            }
            else print2("Your quest is not yet complete, sir knight.");
        }
        else if (Player.rank[NOBILITY]==LORD) {
            if (find_item(&o,OB_ORB_MASTERY,-1)) {
                print1("My sincerest thanks, my lord.");
                print2("You have proved yourself a true paragon of chivalry");
                morewait();
                print1("I abdicate the Duchy in your favor....");
                print2("Oh, you can keep the Orb, by the way....");
                Player.rank[NOBILITY]=DUKE;
                gain_experience(10000);
                strcpy(Duke,Player.name);
                morewait();
                Dukebehavior = fixnpc(4);
                save_hiscore_npc(12);
                for (y = 52; y < 63; y++)
                    for (x = 2; x < 52; x++) {
                        if (Level->site[x][y].p_locf == L_TRAP_SIREN) {
                            Level->site[x][y].p_locf = L_NO_OP;
                            lset(x, y, CHANGED);
                        }
                        if (x >= 12 && loc_statusp(x, y, SECRET)) {
                            lreset(x, y, SECRET);
                            lset(x, y, CHANGED);
                        }
                        if (x >= 20 && x <= 23 && y == 56) {
                            Level->site[x][y].locchar = FLOOR;
                            lset(x, y, CHANGED);
                        }
                    }

            }
            else print2("I didn't really think you were up to the task....");
        }
    }
}
コード例 #14
0
ファイル: gen.c プロジェクト: berkus/lang-e
void v_init(void) {
	v_calls = 0;
	register_reset() ;
	lreset();
}