1 /*
2 ===========================================================================
3 Copyright (C) 2000 - 2013, Raven Software, Inc.
4 Copyright (C) 2001 - 2013, Activision, Inc.
5 Copyright (C) 2013 - 2015, OpenJK contributors
6
7 This file is part of the OpenJK source code.
8
9 OpenJK is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License version 2 as
11 published by the Free Software Foundation.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
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/>.
20 ===========================================================================
21 */
22
23 //g_objectives.cpp
24 //reads in ext_data\objectives.dat to objectives[]
25
26 #include "g_local.h"
27 #include "g_items.h"
28
29 #define G_OBJECTIVES_CPP
30
31 #include "objectives.h"
32 #include "qcommon/ojk_saved_game_helper.h"
33
34 qboolean missionInfo_Updated;
35
36
37 /*
38 ============
39 OBJ_SetPendingObjectives
40 ============
41 */
OBJ_SetPendingObjectives(gentity_t * ent)42 void OBJ_SetPendingObjectives(gentity_t *ent)
43 {
44 int i;
45
46 for (i=0;i<MAX_OBJECTIVES;++i)
47 {
48 if ((ent->client->sess.mission_objectives[i].status == OBJECTIVE_STAT_PENDING) &&
49 (ent->client->sess.mission_objectives[i].display))
50 {
51 ent->client->sess.mission_objectives[i].status = OBJECTIVE_STAT_FAILED;
52 }
53 }
54 }
55
56 /*
57 ============
58 OBJ_SaveMissionObjectives
59 ============
60 */
OBJ_SaveMissionObjectives(gclient_t * client)61 void OBJ_SaveMissionObjectives( gclient_t *client )
62 {
63 ojk::SavedGameHelper saved_game(
64 ::gi.saved_game);
65
66 saved_game.write_chunk(
67 INT_ID('O', 'B', 'J', 'T'),
68 client->sess.mission_objectives);
69 }
70
71
72 /*
73 ============
74 OBJ_SaveObjectiveData
75 ============
76 */
OBJ_SaveObjectiveData(void)77 void OBJ_SaveObjectiveData(void)
78 {
79 gclient_t *client;
80
81 client = &level.clients[0];
82
83 OBJ_SaveMissionObjectives( client );
84 }
85
86 /*
87 ============
88 OBJ_LoadMissionObjectives
89 ============
90 */
OBJ_LoadMissionObjectives(gclient_t * client)91 void OBJ_LoadMissionObjectives( gclient_t *client )
92 {
93 ojk::SavedGameHelper saved_game(
94 ::gi.saved_game);
95
96 saved_game.read_chunk(
97 INT_ID('O', 'B', 'J', 'T'),
98 client->sess.mission_objectives);
99 }
100
101
102 /*
103 ============
104 OBJ_LoadObjectiveData
105 ============
106 */
OBJ_LoadObjectiveData(void)107 void OBJ_LoadObjectiveData(void)
108 {
109 gclient_t *client;
110
111 client = &level.clients[0];
112
113 OBJ_LoadMissionObjectives( client );
114 }
115