1 | /* |
1 | /* |
2 | * This file is part of Crossfire TRT, the Multiplayer Online Role Playing Game. |
2 | * This file is part of Crossfire TRT, the Roguelike Realtime MORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team |
4 | * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Crossfire TRT is free software; you can redistribute it and/or modify it |
8 | * Crossfire TRT is free software: you can redistribute it and/or modify |
9 | * under the terms of the GNU General Public License as published by the Free |
9 | * it under the terms of the GNU General Public License as published by |
10 | * Software Foundation; either version 2 of the License, or (at your option) |
10 | * the Free Software Foundation, either version 3 of the License, or |
11 | * any later version. |
11 | * (at your option) any later version. |
12 | * |
12 | * |
13 | * This program is distributed in the hope that it will be useful, but |
13 | * This program is distributed in the hope that it will be useful, |
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * for more details. |
16 | * GNU General Public License for more details. |
17 | * |
17 | * |
18 | * You should have received a copy of the GNU General Public License along |
18 | * You should have received a copy of the GNU General Public License |
19 | * with Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51 |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
|
21 | * |
20 | * |
22 | * The authors can be reached via e-mail to <crossfire@schmorp.de> |
21 | * The authors can be reached via e-mail to <crossfire@schmorp.de> |
23 | */ |
22 | */ |
24 | |
23 | |
25 | /* This file contains code relevant to the BOOKS hack -- designed |
24 | /* This file contains code relevant to the BOOKS hack -- designed |
… | |
… | |
1592 | |
1591 | |
1593 | book->msg = retbuf; |
1592 | book->msg = retbuf; |
1594 | } |
1593 | } |
1595 | } |
1594 | } |
1596 | |
1595 | |
|
|
1596 | #define DESCRIBE_PATH(retbuf, variable, name) \ |
|
|
1597 | if(variable) { \ |
|
|
1598 | int i,j=0; \ |
|
|
1599 | strcat(retbuf,"(" name ": "); \ |
|
|
1600 | for(i=0; i<NRSPELLPATHS; i++) \ |
|
|
1601 | if(variable & (1<<i)) { \ |
|
|
1602 | if (j) \ |
|
|
1603 | strcat(retbuf,", "); \ |
|
|
1604 | else \ |
|
|
1605 | j = 1; \ |
|
|
1606 | strcat(retbuf, spellpathnames[i]); \ |
|
|
1607 | } \ |
|
|
1608 | strcat(retbuf,")"); \ |
|
|
1609 | } |
|
|
1610 | |
1597 | /* god_info_msg() - generate a message detailing the properties |
1611 | /* god_info_msg() - generate a message detailing the properties |
1598 | * of a random god. Used by the book hack. b.t. |
1612 | * of a random god. Used by the book hack. b.t. |
1599 | */ |
1613 | */ |
1600 | const char * |
1614 | const char * |
1601 | god_info_msg (int level, int booksize) |
1615 | god_info_msg (int level, int booksize) |
… | |
… | |
1629 | |
1643 | |
1630 | /* Information about the god is random, and based on the level of the |
1644 | /* Information about the god is random, and based on the level of the |
1631 | * 'book'. Probably there is a more intellegent way to implement |
1645 | * 'book'. Probably there is a more intellegent way to implement |
1632 | * this ... |
1646 | * this ... |
1633 | */ |
1647 | */ |
1634 | |
|
|
1635 | while (level > 0) |
1648 | while (level > 0) |
1636 | { |
1649 | { |
1637 | sprintf (buf, " "); |
1650 | sprintf (buf, " "); |
1638 | if (level == 2 && RANDOM () % 2) |
1651 | if (level == 2 && RANDOM () % 2) |
1639 | { /* enemy god */ |
1652 | { /* enemy god */ |
… | |
… | |
1843 | * 2) make sure there is an entry in max_titles[] array. |
1856 | * 2) make sure there is an entry in max_titles[] array. |
1844 | * 3) make sure there are entries for your case in new_text_title() |
1857 | * 3) make sure there are entries for your case in new_text_title() |
1845 | * and add_authour(). |
1858 | * and add_authour(). |
1846 | * 4) you may want separate authour/book name arrays in read.h |
1859 | * 4) you may want separate authour/book name arrays in read.h |
1847 | */ |
1860 | */ |
1848 | |
|
|
1849 | msg_type = msg_type > 0 ? msg_type : (RANDOM () % 6); |
1861 | msg_type = msg_type > 0 ? msg_type : (RANDOM () % 8); |
1850 | switch (msg_type) |
1862 | switch (msg_type) |
1851 | { |
1863 | { |
1852 | case 1: /* monster attrib */ |
1864 | case 1: /* monster attrib */ |
1853 | strcpy (msgbuf, mon_info_msg (level, book_buf_size)); |
1865 | strcpy (msgbuf, mon_info_msg (level, book_buf_size)); |
1854 | break; |
1866 | break; |