/***************************************************************************** ** Macros that should make coding special events a little easier. ** ** This is just for backward compatibility with the older pdirt versions *****************************************************************************/ #ifndef _SPECIAL_CODE_ #define _SPECIAL_CODE_ /* For non C freaks */ #define catch_say if (event == E_ONSAY) #define catch_wield if (event == E_ONWIELD) #define catch_examine if (event == E_ONEXAMINE) #define catch_tie if (event == E_ONTIE) #define catch_untie if (event == E_ONUNTIE) #define catch_put if (event == E_ONPUT) #define catch_after_put if (event == E_AFTERPUT) #define catch_move if (event == E_ONMOVE) #define catch_before_entry if (event == E_ONENTRY) #define catch_after_entry if (event == E_AFTERENTRY) #define catch_throw if (event == E_ONTHROW) #define catch_drink if (event == E_ONCONSUME) #define catch_eat if (event == E_ONCONSUME) #define catch_timer if (event == E_ONTIMER) #define catch_kill if (event == E_ONKILL) #define catch_break if (event == E_ONKILL) #define catch_movement if (event == E_ONMOVE) #define catch_give if (event == E_ONGIVE) #define catch_get if (event == E_ONGET) #define catch_dig if (event == E_ONDIG) #define catch_lock if (event == E_ONLOCK) #define catch_unlock if (event == E_ONUNLOCK) #define catch_open if (event == E_ONOPEN) #define catch_close if (event == E_ONCLOSE) #define catch_push if (event == E_ONPUSH) #define catch_jump if (event == E_ONJUMP) #define catch_while_fighting if (event == E_WHILEFIGHT) #define catch_wave if (event == E_ONMISC && param_s.misc == VERB_WAVE) #define catch_sit if (event == E_ONMISC && param_s.misc == VERB_SIT) #define catch_pray if (event == E_ONMISC && param_s.misc == VERB_PRAY) #define catch_sleep if (event == E_ONREST) #define catch_trance if (event == E_ONREST) #define catch_tell if (event == E_ONCOMM) #define catch_death if (event == E_ONKILLED) #define catch_light if (event == E_ONLIGHT) #define catch_cut if (event == E_ONMISC && param_s.misc == VERB_CUT) #define catch_bite if (event == E_ONACTION && EQ(param_s.buf,"bite")) #define catch_eet if (event == E_ONCONSUME && (plev(THIS_PLAYER) = 10000)) #define catch_init if (event == E_ONINIT) #define catch_special_exit if (event == E_SPECIALEXIT) /***************************************************************************** ** COMMUNICATION ** send_to_room_but_player: send to all players in current room, except ** current player, message S. This message can be ** viewed using mode M. ** M can be MODE_BLIND, MODE_DEAF, MODE_COLOR, ** or more complex ones. ** send_room : send to all players in the same room as player. ** send_player : send to the player only. *****************************************************************************/ #define send_room_but_player(M,S) send_msg(ploc(param_s.plx),M,pvis(param_s.plx)\ ,LVL_MAX,param_s.plx,NOBODY,S) #define send_with_name(M,S) send_msg(ploc(param_s.plx),M,pvis(param_s.plx)\ ,LVL_MAX,param_s.plx,NOBODY,S,pname(param_s.plx)) #define send_room(S) sendf(ploc(param_s.plx),S) #define send_player(S) sendf(param_s.plx,S) #define send_to(P,S) sendf(P,S) /****************************************************************************** ** OBJECT MANIPULATION ** place_object_in_room : Place object O in room L. ** place object_in_inv : Place object in inventory of mobile/player. ** create_object : recreate a destroyed object. ** armor_class : the armor class of an object. *****************************************************************************/ #define place_object_in_room(O,L) setoloc((O),(L),IN_ROOM) #define place_object_in_inv(O,P) setoloc((O),(P),CARRIED_BY) #define create_object(O) oclrbit((O),OFL_DESTROYED) #define armor_class(O) oarmor((O)) /***************************************************************************** ** PLAYER MANIPULATION ** trans_player_to : Place player in location L, and do a look. ** player_strength : Strength of player P ** start_fight : Start a fight. A is the attacker, V is the victim ** mobile : player is a mobile. (for MOB_XX_YY conversion) *****************************************************************************/ #define trans_player_to(L) trapch((L)) #define player_strength(P) pstr((P)) #define start_fight(A,V) setpfighting((A),(V)); #define mobile(M) (M + max_players) #define MOBILE(M) (M + max_players) #define mobnum(M) (M - max_players) #define addscore(M,S) setpscore(M,pscore(M) + (S)) /**************************************************************************** ** VARIOUS ** death_trap : kick player off the game, like in a death room. Send ** the player message S. ** do_not_continue: Stop command processing and give player a prompt. *****************************************************************************/ #define death_trap(S) p_crapup(param_s.plx,S,CRAP_SAVE|CRAP_RETURN) #define fail(E) param_s.ret = (E); return #define do_not_continue param_s.ret = (-1) #define succeed() param_s.ret = 1; return #define THIS_PLAYER param_s.plx #define THIS_OBJECT param_s.ob #define THIS_LOCATION param_s.loc #define MISC param_s.misc #define SECOND_CHAR param_s.pl #endif