1 | /* |
1 | /* |
2 | * This file is part of Crossfire TRT, the Roguelike Realtime MORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
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 Deliantra 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 |
8 | * Deliantra is free software: you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
10 | * the Free Software Foundation, either version 3 of the License, or |
10 | * the Free Software Foundation, either version 3 of the License, or |
11 | * (at your option) 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, |
13 | * This program is distributed in the hope that it will be useful, |
… | |
… | |
16 | * GNU General Public License 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 |
18 | * You should have received a copy of the GNU General Public License |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | * |
20 | * |
21 | * The authors can be reached via e-mail to <crossfire@schmorp.de> |
21 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | */ |
22 | */ |
23 | |
23 | |
24 | /* This file contains code relevant to the BOOKS hack -- designed |
24 | /* This file contains code relevant to the BOOKS hack -- designed |
25 | * to allow randomly occuring messages in non-magical texts. |
25 | * to allow randomly occuring messages in non-magical texts. |
26 | */ |
26 | */ |
… | |
… | |
1591 | |
1591 | |
1592 | book->msg = retbuf; |
1592 | book->msg = retbuf; |
1593 | } |
1593 | } |
1594 | } |
1594 | } |
1595 | |
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 | |
1596 | /* god_info_msg() - generate a message detailing the properties |
1611 | /* god_info_msg() - generate a message detailing the properties |
1597 | * of a random god. Used by the book hack. b.t. |
1612 | * of a random god. Used by the book hack. b.t. |
1598 | */ |
1613 | */ |
1599 | const char * |
1614 | const char * |
1600 | god_info_msg (int level, int booksize) |
1615 | god_info_msg (int level, int booksize) |
… | |
… | |
1628 | |
1643 | |
1629 | /* 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 |
1630 | * 'book'. Probably there is a more intellegent way to implement |
1645 | * 'book'. Probably there is a more intellegent way to implement |
1631 | * this ... |
1646 | * this ... |
1632 | */ |
1647 | */ |
1633 | |
|
|
1634 | while (level > 0) |
1648 | while (level > 0) |
1635 | { |
1649 | { |
1636 | sprintf (buf, " "); |
1650 | sprintf (buf, " "); |
1637 | if (level == 2 && RANDOM () % 2) |
1651 | if (level == 2 && RANDOM () % 2) |
1638 | { /* enemy god */ |
1652 | { /* enemy god */ |
… | |
… | |
1842 | * 2) make sure there is an entry in max_titles[] array. |
1856 | * 2) make sure there is an entry in max_titles[] array. |
1843 | * 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() |
1844 | * and add_authour(). |
1858 | * and add_authour(). |
1845 | * 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 |
1846 | */ |
1860 | */ |
1847 | |
|
|
1848 | msg_type = msg_type > 0 ? msg_type : (RANDOM () % 6); |
1861 | msg_type = msg_type > 0 ? msg_type : (RANDOM () % 8); |
1849 | switch (msg_type) |
1862 | switch (msg_type) |
1850 | { |
1863 | { |
1851 | case 1: /* monster attrib */ |
1864 | case 1: /* monster attrib */ |
1852 | strcpy (msgbuf, mon_info_msg (level, book_buf_size)); |
1865 | strcpy (msgbuf, mon_info_msg (level, book_buf_size)); |
1853 | break; |
1866 | break; |