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 |
… | |
… | |
181 | player::set_object (object *op) |
181 | player::set_object (object *op) |
182 | { |
182 | { |
183 | ob = observe = viewpoint = op; |
183 | ob = observe = viewpoint = op; |
184 | ob->contr = this; /* this aren't yet in archetype */ |
184 | ob->contr = this; /* this aren't yet in archetype */ |
185 | |
185 | |
186 | ob->set_speed (1.0f); |
186 | ob->speed = 1.0f; // object still inactive, keep it that way |
187 | ob->speed_left = 0.5f; |
187 | ob->speed_left = 0.5f; |
188 | |
188 | |
189 | ob->direction = 5; /* So player faces south */ |
189 | ob->direction = 5; /* So player faces south */ |
190 | } |
190 | } |
191 | |
191 | |
… | |
… | |
1867 | || mon->flag [FLAG_CAN_ROLL]) |
1867 | || mon->flag [FLAG_CAN_ROLL]) |
1868 | && mon != op) |
1868 | && mon != op) |
1869 | break; |
1869 | break; |
1870 | } |
1870 | } |
1871 | |
1871 | |
1872 | if (!mon) /* This happens anytime the player tries to move */ |
1872 | /* no monster == player tries to move into a wall or so */ |
1873 | return false; /* into a wall */ |
1873 | if (!mon) |
|
|
1874 | { |
|
|
1875 | if (op->contr->ns->bumpmsg) |
|
|
1876 | for (object *ob = m->at (nx, ny).top; ob; ob = ob->below) |
|
|
1877 | if (op->move_type & ob->move_block) |
|
|
1878 | { |
|
|
1879 | if (ob->move_block == MOVE_ALL) |
|
|
1880 | { |
|
|
1881 | op->play_sound (sound_find ("bump_wall")); |
|
|
1882 | |
|
|
1883 | op->statusmsg (ob->invisible |
|
|
1884 | ? "You bump into something." |
|
|
1885 | : format ("You bump into the %s.", query_name (ob)) |
|
|
1886 | ); |
|
|
1887 | } |
|
|
1888 | else |
|
|
1889 | { |
|
|
1890 | op->play_sound (sound_find ("blocked_move")); |
|
|
1891 | |
|
|
1892 | op->statusmsg (ob->invisible |
|
|
1893 | ? "Something blocks you." |
|
|
1894 | : format ("Something blocks you from entering the %s.", query_name (ob)) |
|
|
1895 | ); |
|
|
1896 | } |
|
|
1897 | |
|
|
1898 | break; |
|
|
1899 | } |
|
|
1900 | |
|
|
1901 | return false; |
|
|
1902 | } |
1874 | |
1903 | |
1875 | mon = mon->head_ (); |
1904 | mon = mon->head_ (); |
1876 | |
1905 | |
1877 | if ((mon->type == DOOR && mon->stats.hp >= 0) || (mon->type == LOCKED_DOOR)) |
1906 | if ((mon->type == DOOR && mon->stats.hp >= 0) || (mon->type == LOCKED_DOOR)) |
1878 | if (op->contr->weapon_sp_left > 0.f) |
1907 | if (op->contr->weapon_sp_left > 0.f) |