Merge lp:~evigo-deactivatedaccount/deadends/evigo into lp:deadends

Proposed by Eugenio M. Vigo
Status: Merged
Merged at revision: not available
Proposed branch: lp:~evigo-deactivatedaccount/deadends/evigo
Merge into: lp:deadends
Diff against target: None lines
To merge this branch: bzr merge lp:~evigo-deactivatedaccount/deadends/evigo
Reviewer Review Type Date Requested Status
Jimi_Hendrix Pending
Review via email: mp+9871@code.launchpad.net

Commit message

To post a comment you must log in.
Revision history for this message
Eugenio M. Vigo (evigo-deactivatedaccount) wrote :

Several changes. Mainly:

* Fixed the compiler warnings.
* Created a new member for Player so it can in a future hold more than one Weapon.
* Created a new set of images for ShooterZombie, so it can be distinguished on play.
* Fixed the COPYRIGHT file to something much clearer, not touching the distribution terms. But, it lacks the permission and terms by Lazy Foo Productions, which you should include there (and destroy that CREDITS file, btw).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'COPYRIGHT'
2--- COPYRIGHT 2009-08-03 18:51:04 +0000
3+++ COPYRIGHT 2009-08-08 08:54:15 +0000
4@@ -1,39 +1,79 @@
5- Copyright (c) 2009 jimi_hendrix.
6- All rights reserved.
7-
8- Redistribution and use in source and binary forms, with or without
9- modification, are permitted provided that the following conditions
10- are met:
11- 1. Redistributions of source code must retain the above copyright
12- notice, this list of conditions and the following disclaimer.
13- 2. Redistributions in binary form must reproduce the above copyright
14- notice, this list of conditions and the following disclaimer in the
15- documentation and/or other materials provided with the distribution.
16- 3. Neither the name of the author(s) nor the names of the contributors
17- may be used to endorse or promote products derived from this software
18- without specific prior written permission.
19-
20- THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
24- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30- SUCH DAMAGE.
31-
32-
33-Boost Software License - Version 1.0 - August 17th, 2003
34-
35-Permission is hereby granted, free of charge, to any person or organization
36-obtaining a copy of the software and accompanying documentation covered by
37-this license (the "Software") to use, reproduce, display, distribute,
38-execute, and transmit the Software, and to prepare derivative works of the
39-Software, and to permit third-parties to whom the Software is furnished to
40-do so, all subject to the following:
41+Dead Ends:
42+
43+ Copyright (C) 2009 jimi_hendrix
44+ All rights reserved.
45+
46+ Redistribution and use in source and binary forms, with or without
47+ modification, are permitted provided that the following conditions
48+ are met:
49+ 1. Redistributions of source code must retain the above copyright
50+ notice, this list of conditions and the following disclaimer.
51+ 2. Redistributions in binary form must reproduce the above copyright
52+ notice, this list of conditions and the following disclaimer in the
53+ documentation and/or other materials provided with the distribution.
54+ 3. Neither the name of the author(s) nor the names of the contributors
55+ may be used to endorse or promote products derived from this software
56+ without specific prior written permission.
57+
58+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
59+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
60+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
61+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
62+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
63+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
64+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
65+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
66+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
67+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
68+ SUCH DAMAGE.
69+
70+This program uses software by Lazy Foo productions (http://lazyfoo.net), which are distributed under these terms:
71+
72+ <JIMI_HENDRIX, PLEASE COPY HERE THE PERMISSION YOU GOT FOR LAZY FOO.NET>
73+
74+Images Media/szombieu.png, Media/szombied.png, Media/szombiel.png,
75+Media/szombier.png are distributed under these terms:
76+
77+ Copyright (C) 2009 jimi_hendrix
78+ Copyright (C) 2009 Eugenio M. Vigo
79+ All rights reserved.
80+
81+ Redistribution and use in source and binary forms, with or without
82+ modification, are permitted provided that the following conditions
83+ are met:
84+ 1. Redistributions of source code must retain the above copyright
85+ notice, this list of conditions and the following disclaimer.
86+ 2. Redistributions in binary form must reproduce the above copyright
87+ notice, this list of conditions and the following disclaimer in the
88+ documentation and/or other materials provided with the distribution.
89+ 3. Neither the name of the author(s) nor the names of the contributors
90+ may be used to endorse or promote products derived from this software
91+ without specific prior written permission.
92+
93+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
94+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
95+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
96+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
97+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
98+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
99+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
100+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
101+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
102+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
103+ SUCH DAMAGE.
104+
105+
106+This program uses the Boost Library, which is distributed under the following
107+terms:
108+
109+ Boost Software License - Version 1.0 - August 17th, 2003
110+
111+ Permission is hereby granted, free of charge, to any person or organization
112+ obtaining a copy of the software and accompanying documentation covered by
113+ this license (the "Software") to use, reproduce, display, distribute,
114+ execute, and transmit the Software, and to prepare derivative works of the
115+ Software, and to permit third-parties to whom the Software is furnished to
116+ do so, all subject to the following:
117
118 The copyright notices in the Software and this entire statement, including
119 the above license grant, this restriction and the following disclaimer,
120
121=== modified file 'ChangeLog'
122--- ChangeLog 2009-08-04 00:57:27 +0000
123+++ ChangeLog 2009-08-08 08:54:15 +0000
124@@ -1,8 +1,59 @@
125-2009-8-3 jimi_hendrix <myspot40@gmail.com>
126+2009-08-03 jimi_hendrix <myspot40@gmail.com>
127 Initial Commit
128
129-2009-8-3 jimi_hendrix <myspot40@gmail.com>
130- * src/classes/Weapon.h - Added the BSD license header
131- * README - Added a few more lines including contact information
132- * arcade.cpp - Allowed for proper freeing so closing the window will not
133+2009-08-03 jimi_hendrix <myspot40@gmail.com>
134+ * src/classes/Weapon.h: Added the BSD license header.
135+
136+ * README: Added a few more lines including contact information.
137+
138+ * arcade.cpp: Allowed for proper freeing so closing the window will not
139 result in a segfault.
140+
141+2009-08-05 Eugenio M. Vigo <emvigo@gmail.com>
142+ * src/classes/Weapon.cpp (Weapon::Weapon): Changed interface for
143+ second constructor accordingly to the change above.
144+
145+ (Weapon::getClipsize): Also changed interface because of the
146+ above. Returning unsigned int.
147+
148+ * src/include/Weapon.h: Adjusted header to the changes above.
149+
150+ (Weapon.clipsize, Weapon.ammo): Changed to unsigned int.
151+
152+ * srr/arcade.cpp: Fixed comparisons between unsigned int and int.
153+
154+ * src/classes/ShooterZombie.cpp (ShooterZoombie::shoot): Fixed the
155+ placement of return statement...
156+
157+ * src/classes/Bullet.cpp (Bullet::~Bullet): Uncommented code that
158+ should be working flawlessly.
159+
160+2009-08-06 Eugenio M. Vigo <emvigo@gmail.com>
161+ * src/include/Player.h (Player.arms): Created a new public member
162+ that will allow the Player to hold more than one type of Weapon
163+ simultaneously in some future.
164+
165+ * src/classes/Bullet.cpp (Bullet::~Bullet): Ok, the last
166+ uncommenting created a memory corruption scenario because of
167+ freeing memory allocated at stack. Now corrected.
168+
169+ * Makefile: Introduced -ggdb flag for all compilation units. This
170+ should be kept until release or real security that our code is
171+ stable.
172+
173+ * ChangeLog: Corrected earlier entries to GNU style.
174+
175+ * Media/szombie*.png: Created a different image for shooting zombies.
176+
177+ * scr/arcade.cpp (arcade_s): Made ShooterZombies use the
178+ szombie*.png images.
179+
180+2009-08-08 Eugenio M. Vigo <emvigo@gmail.com>
181+ * COPYRIGHT: Added my licensing terms and copyright for the Media/
182+ stuff I created. As these were derived from jimi_hendrix's
183+ original images, I have to add his copyright and his license
184+ again. For convenience, although I would have prefered a different
185+ license (probably LGPLv3 for this case), I choose to use the same
186+ BSD license so the whole project has the same distribution terms.
187+
188+ Also, formatted the COPYRIGHT file to something a bit clearer.
189
190=== modified file 'Makefile'
191--- Makefile 2009-08-03 18:51:04 +0000
192+++ Makefile 2009-08-06 10:22:50 +0000
193@@ -1,5 +1,5 @@
194 CC=g++
195-FLAGS=-Wall
196+FLAGS=-Wall -ggdb
197 IFLAGS=-I./include
198 LIBS=-lSDL -lSDL_mixer -lSDL_image -lSDL_ttf
199 SRC=$(wildcard ./src/*.cpp wildcard ./src/classes/*.cpp)
200
201=== added file 'Media/szombied.png'
202Binary files Media/szombied.png 1970-01-01 00:00:00 +0000 and Media/szombied.png 2009-08-06 10:54:11 +0000 differ
203=== added file 'Media/szombiel.png'
204Binary files Media/szombiel.png 1970-01-01 00:00:00 +0000 and Media/szombiel.png 2009-08-06 10:54:11 +0000 differ
205=== added file 'Media/szombier.png'
206Binary files Media/szombier.png 1970-01-01 00:00:00 +0000 and Media/szombier.png 2009-08-06 10:54:11 +0000 differ
207=== added file 'Media/szombieu.png'
208Binary files Media/szombieu.png 1970-01-01 00:00:00 +0000 and Media/szombieu.png 2009-08-06 10:54:11 +0000 differ
209=== modified file 'include/Player.h'
210--- include/Player.h 2009-08-03 18:51:04 +0000
211+++ include/Player.h 2009-08-06 10:22:50 +0000
212@@ -33,6 +33,7 @@
213 #include "helpers.h"
214 #include "Weapon.h"
215 #include <string>
216+#include <vector>
217
218 class Player: public Object {
219 public:
220@@ -40,8 +41,9 @@
221 double movespeed;
222 bool canMove;
223 SDL_Surface *surface[4];
224- SDL_Surface* current;
225- Weapon gun;
226+ SDL_Surface *current;
227+ std::vector<Weapon *> arms;
228+ Weapon gun;
229 DIRECTION direction;
230
231 Player(std::string basefilename, double x, double y, double movespeed);
232
233=== modified file 'include/Weapon.h'
234--- include/Weapon.h 2009-08-04 00:57:27 +0000
235+++ include/Weapon.h 2009-08-05 17:43:51 +0000
236@@ -35,14 +35,15 @@
237
238 class Weapon: public Object {
239 public:
240- int clipsize;
241- int ammo, clips, damage;
242+ unsigned int clipsize;
243+ unsigned int ammo;
244+ int clips, damage;
245 std::vector<Bullet*> bullets;
246
247 Weapon();
248- Weapon(int clipsize, int clips, int damage, int cooldown);
249+ Weapon(unsigned int clipsize, int clips, int damage, int cooldown);
250 virtual ~Weapon();
251- int getClipsize();
252+ unsigned int getClipsize();
253 bool reload();
254 void update();
255 };
256
257=== modified file 'src/arcade.cpp'
258--- src/arcade.cpp 2009-08-03 18:51:04 +0000
259+++ src/arcade.cpp 2009-08-06 10:54:11 +0000
260@@ -246,7 +246,7 @@
261 SDL_FillRect(scr, &scr->clip_rect, SDL_MapRGB(scr->format, 0x0, 0x0, 0x0));
262 player->draw(scr);
263 //grid->draw(scr);
264- for (int i = 0; i < player->gun.bullets.size(); i++) {
265+ for (unsigned int i = 0; i < player->gun.bullets.size(); i++) {
266 player->gun.bullets[i]->move(scr);
267 // player->gun.bullets[i]->draw(scr);
268
269@@ -255,7 +255,7 @@
270 player->gun.bullets.erase(player->gun.bullets.begin() + i);
271 }
272
273- for (int j = 0; j < zombies.size(); j++) {
274+ for (unsigned int j = 0; j < zombies.size(); j++) {
275 if (zombies[j]->show) {
276 // std::cout<<player->gun.bullets[i]->rectangle.x<<",
277 if (SDL::check_collision(player->gun.bullets[i]->rectangle, zombies[j]->rectangle) && player->gun.bullets[i]->live) {
278@@ -268,7 +268,7 @@
279 }
280 }
281
282- for (int j = 0; j < szombies.size(); j++) {
283+ for (unsigned int j = 0; j < szombies.size(); j++) {
284 if (szombies[j]->show) {
285 if (SDL::check_collision(player->gun.bullets[i]->rectangle, szombies[j]->rectangle) && player->gun.bullets[i]->live) {
286 Mix_PlayChannel(-1, squish, 0);
287@@ -280,7 +280,7 @@
288 }
289 }
290
291- for (int j = 0; j < bzombies.size(); j++) {
292+ for (unsigned int j = 0; j < bzombies.size(); j++) {
293 if (bzombies[j]->show) {
294 // std::cout<<player->gun.bullets[i]->rectangle.x<<",
295 if (SDL::check_collision(player->gun.bullets[i]->rectangle, bzombies[j]->rectangle) && player->gun.bullets[i]->live) {
296@@ -298,7 +298,7 @@
297 }
298
299
300- for (int i = 0; i < zombieBullets.size(); i++) {
301+ for (unsigned int i = 0; i < zombieBullets.size(); i++) {
302
303 zombieBullets[i]->move(scr);
304 zombieBullets[i]->draw(scr);
305@@ -312,7 +312,7 @@
306 }
307 }
308
309- for (int i = 0; i < zombies.size(); i++) {
310+ for (unsigned int i = 0; i < zombies.size(); i++) {
311 //SDL_FillRect(scr, &objs[i]->surface->clip_rect, SDL_MapRGB(scr->format, 23, 56, 0));
312 zombies[i]->AI(player);
313 zombies[i]->draw(scr);
314@@ -320,7 +320,7 @@
315 //printf("Player rect: (%d, %d)\n", player->rectangle.x, player->rectangle.y);
316 }
317
318- for (int i = 0; i < szombies.size(); i++) {
319+ for (unsigned int i = 0; i < szombies.size(); i++) {
320 if (szombies[i]->show) {
321 szombies[i]->AI(player);
322 szombies[i]->draw(scr);
323@@ -338,7 +338,7 @@
324 }
325 }
326
327- for (int i = 0; i < bzombies.size(); i++) {
328+ for (unsigned int i = 0; i < bzombies.size(); i++) {
329 if (bzombies[i]->show) {
330 bzombies[i]->AI(player);
331 bzombies[i]->draw(scr);
332@@ -359,7 +359,7 @@
333 zombies.push_back(new Zombie("./Media/zombie", rand() % SCR_WIDTH, rand() % SCR_HEIGHT, 0.2, 1));
334
335 for (int i = 0; i < level / 5; i++) {
336- szombies.push_back(new ShooterZombie("./Media/zombie", rand() % SCR_WIDTH, rand() % SCR_HEIGHT, 0.2, 1));
337+ szombies.push_back(new ShooterZombie("./Media/szombie", rand() % SCR_WIDTH, rand() % SCR_HEIGHT, 0.2, 1));
338 liveZombies++;
339 }
340
341@@ -386,19 +386,19 @@
342
343 printf("live zombies: %d", liveZombies);
344
345- for (int i = 0; i < zombieBullets.size(); i++) {
346+ for (unsigned int i = 0; i < zombieBullets.size(); i++) {
347 delete zombieBullets[i];
348 }
349
350 zombieBullets.clear();
351
352- for (int i = 0; i < zombies.size(); i++) {
353+ for (unsigned int i = 0; i < zombies.size(); i++) {
354 zombies[i]->show = true;
355 //zombies[i]->x = rand() % SCR_WIDTH;
356 //zombies[i]->y = rand() % SCR_HEIGHT;
357 }
358
359- for (int i = 0; i < szombies.size(); i++)
360+ for (unsigned int i = 0; i < szombies.size(); i++)
361 szombies[i]->show = true;
362 }
363
364
365=== modified file 'src/classes/Bullet.cpp'
366--- src/classes/Bullet.cpp 2009-08-03 18:51:04 +0000
367+++ src/classes/Bullet.cpp 2009-08-06 10:22:50 +0000
368@@ -56,7 +56,7 @@
369 this->live = true;
370 }
371
372-/*Bullet::Bullet(/*Object *parentstd::string filename, double& x, double& y, double velocity, DIRECTION& dir) {
373+/*Bullet::Bullet(Object *parent, std::string filename, double& x, double& y, double velocity, DIRECTION& dir) {
374 this->parent = parent;
375 this->surface = SDL::load_image(filename);
376 this->x = this->y = 0;
377@@ -67,10 +67,8 @@
378 }*/
379
380 Bullet::~Bullet() {
381- //TODO: FREE THE SDL SURFACE!!!
382 //SDL_FreeSurface(this->surface);
383- //delete this->velocity;
384- //delete this->move;
385+
386 puts("bullet destroyed");
387 }
388
389
390=== modified file 'src/classes/ShooterZombie.cpp'
391--- src/classes/ShooterZombie.cpp 2009-08-03 18:51:04 +0000
392+++ src/classes/ShooterZombie.cpp 2009-08-05 17:43:51 +0000
393@@ -70,8 +70,9 @@
394 this->bullet = new Bullet((std::string) "./Media/bullet.png", tx, ty,
395 1.0, this->direction);
396
397- return this->bullet;
398- }
399+ }
400+
401+ return this->bullet;
402 }
403
404 bool ShooterZombie::facingPlayer(Player *player) {
405
406=== modified file 'src/classes/Weapon.cpp'
407--- src/classes/Weapon.cpp 2009-08-03 18:51:04 +0000
408+++ src/classes/Weapon.cpp 2009-08-05 17:43:51 +0000
409@@ -34,7 +34,7 @@
410 this->ammo = this->clipsize = this->clips = this->damage = 0;
411 }
412
413-Weapon::Weapon(int clipsize, int clips, int damage, int cooldown) {
414+Weapon::Weapon(unsigned int clipsize, int clips, int damage, int cooldown) {
415 this->ammo = clipsize;
416 this->clipsize = clipsize;
417 this->clips = clips;
418@@ -44,7 +44,7 @@
419 Weapon::~Weapon() {
420 }
421
422-int Weapon::getClipsize() {
423+unsigned int Weapon::getClipsize() {
424 return this->clipsize;
425 }
426

Subscribers

People subscribed via source and target branches

to all changes: