ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/player.C
(Generate patch)

Comparing deliantra/server/server/player.C (file contents):
Revision 1.205 by root, Thu Sep 25 04:09:57 2008 UTC vs.
Revision 1.209 by root, Thu Dec 18 05:13:38 2008 UTC

1578 } 1578 }
1579 1579
1580 /* this should not happen, but sometimes does */ 1580 /* this should not happen, but sometimes does */
1581 if (arrow->nrof == 0) 1581 if (arrow->nrof == 0)
1582 { 1582 {
1583 LOG (llevError | logBacktrace, "arrow (%s) has nrof 0\n", arrow->debug_desc ());
1583 arrow->destroy (); 1584 arrow->destroy ();
1584 return 0; 1585 return 0;
1585 } 1586 }
1586 1587
1587 left = arrow; /* these are arrows left to the player */ 1588 left = arrow; /* these are arrows left to the player */
1792bool 1793bool
1793fire (object *op, int dir) 1794fire (object *op, int dir)
1794{ 1795{
1795 int spellcost = 0; 1796 int spellcost = 0;
1796 1797
1797 /* check for loss of invisiblity/hide */
1798 if (action_makes_visible (op))
1799 make_visible (op);
1800
1801 player *pl = op->contr; 1798 player *pl = op->contr;
1802 1799
1803 if (pl->golem) 1800 if (pl->golem)
1804 { 1801 {
1805 control_golem (op->contr->golem, dir); 1802 control_golem (op->contr->golem, dir);
1807 } 1804 }
1808 1805
1809 object *ob = pl->ranged_ob; 1806 object *ob = pl->ranged_ob;
1810 1807
1811 if (!ob) 1808 if (!ob)
1812 return false;
1813
1814 if (!op->change_weapon (ob))
1815 return false; 1809 return false;
1816 1810
1817 if (op->speed_left > 0.f) 1811 if (op->speed_left > 0.f)
1818 --op->speed_left; 1812 --op->speed_left;
1819 else 1813 else
1820 return false; 1814 return false;
1815
1816 if (!op->change_weapon (ob))
1817 return false;
1818
1819 /* check for loss of invisiblity/hide */
1820 if (action_makes_visible (op))
1821 make_visible (op);
1821 1822
1822 switch (ob->type) 1823 switch (ob->type)
1823 { 1824 {
1824 case BOW: 1825 case BOW:
1825 player_fire_bow (op, dir); 1826 player_fire_bow (op, dir);
2070 --op->speed_left; 2071 --op->speed_left;
2071 2072
2072 op->play_sound (sound_find ("push_player")); 2073 op->play_sound (sound_find ("push_player"));
2073 push_ob (mon, dir, op); 2074 push_ob (mon, dir, op);
2074 2075
2075 if (op->contr->tmp_invis || op->hide) 2076 if (op->contr->tmp_invis || op->flag [FLAG_HIDDEN])
2076 make_visible (op); 2077 make_visible (op);
2077 2078
2078 return true; 2079 return true;
2079 } 2080 }
2080 else 2081 else
2102 push_ob (mon, dir, op); 2103 push_ob (mon, dir, op);
2103 } 2104 }
2104 else 2105 else
2105 op->statusmsg ("You withhold your attack"); 2106 op->statusmsg ("You withhold your attack");
2106 2107
2107 if (op->contr->tmp_invis || op->hide) 2108 if (op->contr->tmp_invis || op->flag [FLAG_HIDDEN])
2108 make_visible (op); 2109 make_visible (op);
2109 2110
2110 return true; 2111 return true;
2111 } 2112 }
2112 } 2113 }
2170 if (QUERY_FLAG (op, FLAG_CONFUSED) && dir) 2171 if (QUERY_FLAG (op, FLAG_CONFUSED) && dir)
2171 dir = absdir (dir + rndm (3) + rndm (3) - 2); 2172 dir = absdir (dir + rndm (3) + rndm (3) - 2);
2172 2173
2173 op->facing = dir; 2174 op->facing = dir;
2174 2175
2175 if (op->hide) 2176 if (op->flag [FLAG_HIDDEN])
2176 do_hidden_move (op); 2177 do_hidden_move (op);
2177 2178
2178 bool retval; 2179 bool retval;
2179 2180
2180 if (INVOKE_PLAYER (MOVE, op->contr, ARG_INT (dir))) 2181 if (INVOKE_PLAYER (MOVE, op->contr, ARG_INT (dir)))
3000} 3001}
3001 3002
3002void 3003void
3003make_visible (object *op) 3004make_visible (object *op)
3004{ 3005{
3005 op->hide = 0; 3006 op->flag [FLAG_HIDDEN] = 0;
3006 op->invisible = 0; 3007 op->invisible = 0;
3007 3008
3008 if (op->type == PLAYER) 3009 if (op->type == PLAYER)
3009 { 3010 {
3010 op->contr->tmp_invis = 0; 3011 op->contr->tmp_invis = 0;
3231 3232
3232 if (op->contr && op->contr->tmp_invis == 0) 3233 if (op->contr && op->contr->tmp_invis == 0)
3233 return 0; 3234 return 0;
3234 3235
3235 /* If monsters, they should become visible */ 3236 /* If monsters, they should become visible */
3236 if (op->hide || !op->contr || (op->contr && op->contr->tmp_invis)) 3237 if (op->flag [FLAG_HIDDEN] || !op->contr || (op->contr && op->contr->tmp_invis))
3237 { 3238 {
3238 new_draw_info_format (NDI_UNIQUE, 0, op, "You become %s!", op->hide ? "unhidden" : "visible"); 3239 new_draw_info_format (NDI_UNIQUE, 0, op, "You become %s!", op->flag [FLAG_HIDDEN] ? "unhidden" : "visible");
3239 return 1; 3240 return 1;
3240 } 3241 }
3241 } 3242 }
3242 3243
3243 return 0; 3244 return 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines