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.280 by root, Sat Oct 16 22:51:52 2010 UTC vs.
Revision 1.286 by root, Wed May 4 19:04:45 2011 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992 Frank Tore Johansen 6 * Copyright (©) 1992 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 9 * the terms of the Affero GNU General Public License as published by the
22 * The authors can be reached via e-mail to <support@deliantra.net> 22 * The authors can be reached via e-mail to <support@deliantra.net>
23 */ 23 */
24 24
25//+GPL 25//+GPL
26 26
27#include <algorithm>
28#include <functional>
29
27#include <global.h> 30#include <global.h>
28#include <sproto.h> 31#include <sproto.h>
29#include <sounds.h> 32#include <sounds.h>
30#include <living.h> 33#include <living.h>
31#include <object.h> 34#include <object.h>
32#include <spells.h> 35#include <spells.h>
33#include <skills.h> 36#include <skills.h>
34
35#include <algorithm>
36#include <functional>
37 37
38playervec players; 38playervec players;
39 39
40/* This loads the first map an puts the player on it. */ 40/* This loads the first map an puts the player on it. */
41static void 41static void
1870 } 1870 }
1871 1871
1872 /* no monster == player tries to move into a wall or so */ 1872 /* no monster == player tries to move into a wall or so */
1873 if (!mon) 1873 if (!mon)
1874 { 1874 {
1875 if (op->contr->ns->bumpmsg)
1876 {
1877 op->play_sound (sound_find ("bump_wall"));
1878
1879 for (object *ob = m->at (nx, ny).top; ob; ob = ob->below) 1875 for (object *ob = m->at (nx, ny).top; ob; ob = ob->below)
1880 if (op->move_type & ob->move_block) 1876 if (op->move_type & ob->move_block)
1877 {
1878 if (ob->move_block == MOVE_ALL)
1879 move_into_wall (op, ob);
1880 else
1881 { 1881 {
1882 if (ob->invisible) 1882 if (op->contr->ns->bumpmsg)
1883 op->statusmsg ("You bump into something.");
1884 else 1883 {
1885 op->statusmsg (format ("You bump into the %s.", query_name (ob))); 1884 op->play_sound (sound_find ("blocked_move"));
1886 1885
1886 op->statusmsg (ob->invisible
1887 ? "Something blocks you."
1888 : format ("Something blocks you from entering the %s.", query_name (ob))
1889 );
1887 break; 1890 }
1888 } 1891 }
1892
1893 break;
1889 } 1894 }
1890 1895
1891 return false; 1896 return false;
1892 } 1897 }
1893 1898
1894 mon = mon->head_ (); 1899 mon = mon->head_ ();
2012} 2017}
2013 2018
2014bool 2019bool
2015move_player (object *op, int dir) 2020move_player (object *op, int dir)
2016{ 2021{
2017 if (!op->map || op->map->in_memory != MAP_ACTIVE) 2022 if (!op->map || op->map->state != MAP_ACTIVE)
2018 return 0; 2023 return 0;
2019 2024
2020 /* Sanity check: make sure dir is valid */ 2025 /* Sanity check: make sure dir is valid */
2021 if (dir < 0 || dir > 8) 2026 if (dir < 0 || dir > 8)
2022 { 2027 {
2178 op->invisible = 1000; 2183 op->invisible = 1000;
2179 /* the socket code flashes the player visible/invisible 2184 /* the socket code flashes the player visible/invisible
2180 * depending on the value of invisible, so we need to 2185 * depending on the value of invisible, so we need to
2181 * alternate it here for it to work correctly. 2186 * alternate it here for it to work correctly.
2182 */ 2187 */
2183 if (pticks & 2) 2188 if (server_tick & 2)
2184 op->invisible--; 2189 op->invisible--;
2185 } 2190 }
2186 else if (op->invisible && !(op->flag [FLAG_MAKE_INVIS])) 2191 else if (op->invisible && !(op->flag [FLAG_MAKE_INVIS]))
2187 { 2192 {
2188 if (!op->invisible--) 2193 if (!op->invisible--)
2677 if (will_kill_again) 2682 if (will_kill_again)
2678 { 2683 {
2679 object *force; 2684 object *force;
2680 int at; 2685 int at;
2681 2686
2682 force = get_archetype (FORCE_NAME); 2687 force = archetype::get (FORCE_NAME);
2683 /* 50 ticks should be enough time for the spell to abate */ 2688 /* 50 ticks should be enough time for the spell to abate */
2684 force->speed_left = -5.f; 2689 force->speed_left = -5.f;
2685 force->set_speed (0.1f); 2690 force->set_speed (0.1f);
2686 force->set_flag (FLAG_APPLIED); 2691 force->set_flag (FLAG_APPLIED);
2687 2692

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines