Skip to content

Commit 26ed1fc

Browse files
author
GamerMan7799
committed
Update to v1.4.0-R
## [1.4.0-R] - 2018-03-27 ### Added * Toolbar with different tools including: drag, fire, drop, rope, delete, and info. (Issue #5) * Currently finished tools: fire, drag, drop, delete, and info. (Rope tool is present, but rope equations need more work, so I disabled it for now). * SDL Licenses. * Credits to Docs. * More Doxygen stuff. * Debug message that prints ball mass when created. * Ability to pause the simulation. * Changable Ratio of meters to Pixels (default is 10 pixels/meter) ### Changed * Moved Docs to Doc folder. * Moved various items out of main.cpp into core.cpp to avoid main becoming too large. * How balls are updated (order and a few equations) to make it hopefully more realistic. * Increased ball size from 10x10 pixels to 25x25 pixels. * Various code improvements. * Disabled rope tool, still need to work on some of the equations. (Issue #4) * Reduced kVelocityScalar from 1 -> 0.1 * Floors to casts (due to large number of calls of the floor functions). ### Removed * Interia/engergy from spins, because it did nothing. ### Fixed * Bug of balls getting stuck in walls. * Bug of balls velocity becoming NaN. (Issue #3)
1 parent af759ba commit 26ed1fc

File tree

10 files changed

+38
-20
lines changed

10 files changed

+38
-20
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ The first time you run the program a "Config.ini" will be created it should look
5656

5757
```
5858
Config File for the Cannon.exe
59-
1.4.0
59+
1.4.0-R
6060
Screen Width: 640
6161
Screen Height: 480
6262
Log Ball's path: 0
@@ -113,7 +113,7 @@ Right Arrow = Select next tool
113113
Left Arrow = Select previous tool
114114
1 = Select Fire tool
115115
2 = Select Drop tool
116-
3 = Select Rope tool
116+
3 = Select Rope tool - DISABLED ATM
117117
4 = Select Delete tool
118118
5 = Select Drag tool
119119
6 = Select Info tool
@@ -131,7 +131,7 @@ The mass of the ball will be proportional to the length of time that the mouse w
131131

132132
Clicking on the screen will cause a ball to be created at selected location. The ball will have no velocity and its mass will be proportional to the length of time the mouse is held down for.
133133

134-
### Rope tool - WIP
134+
### Rope tool - DISABLED ATM
135135

136136
Clicking on a ball will cause it to be attached to one end of a rope. The rope can then be attached to another ball, or pinned to background.
137137

docs/ChangesLog.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
All notable changes to this project will be documented here.
44
This project adheres to [Semantic Versioning](http://semver.org/)
55

6-
## [1.4.0-RC.1] - WIP
6+
## [1.4.0-R] - 2018-03-27
77
### Added
88
* Toolbar with different tools including: drag, fire, drop, rope, delete, and info. (Issue #5)
9-
* Currently finished tools: fire, drag, drop, delete, and info.
9+
* Currently finished tools: fire, drag, drop, delete, and info. (Rope tool is present, but rope equations need more work, so I disabled it for now).
1010
* SDL Licenses.
1111
* Credits to Docs.
1212
* More Doxygen stuff.

src/cannonball.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,3 +511,12 @@ void clsCannonball::updateForces() {
511511

512512
}
513513
/*****************************************************************************/
514+
dblXY clsCannonball::getdbLOC() {
515+
return dblLOC_;
516+
}
517+
/*****************************************************************************/
518+
void clsCannonball::setdbLOC(dblXY newplace) {
519+
dblLOC_ = newplace;
520+
updateCollisionBox();
521+
}
522+
/*****************************************************************************/

src/cannonball.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ class clsCannonball {
9595
so that when looping through all of the balls, it doesn't mark
9696
the same collision twice */
9797
void addForce(dblXY);
98+
dblXY getdbLOC(void);
99+
void setdbLOC(dblXY);
98100
private:
99101

100102
uint ballID_; /**< The ball ID which is basically just its number in the array */

src/core.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,21 @@ void cannonballs::checkCollisons(uint j) {
7777
/////////////////////////////////////////////////
7878

7979
BOX A, B;
80+
dblXY ball_b_loc;
8081
A = balls[j].getBOX();
8182
if (balls[j].blncheckphysics_) {
8283
for (int i = 0; i < balls.size(); ++i) {
8384
if (balls[i].blncheckphysics_ && balls[j].blncheckphysics_ && i != j) {
8485
B = balls[i].getBOX();
8586
if ( checkOverlap(A, B) ) {
8687
doCollide(j, i);
88+
/* ball_b_loc = balls[i].getdbLOC();
89+
do {
90+
ball_b_loc.x++;
91+
ball_b_loc.y++;
92+
balls[i].setdbLOC(ball_b_loc);
93+
B = balls[i].getBOX();
94+
} while (checkOverlap(A,B)); */
8795
balls[i].blncheckphysics_ = false;
8896
balls[j].blncheckphysics_ = false;
8997
} // end if overlap
@@ -423,7 +431,7 @@ char core::handleEvent(SDL_Event* e ) {
423431
core::toolbar.setTool(ToolDrop);
424432
return 0;
425433
case SDLK_3:
426-
core::toolbar.setTool(ToolRope);
434+
//core::toolbar.setTool(ToolRope);
427435
return 0;
428436
case SDLK_4:
429437
core::toolbar.setTool(ToolDele);

src/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/// @brief Holds all the main functions.
55
/// @author GamerMan7799
66
/// @author xPUREx
7-
/// @version 1.4.0-RC.1
7+
/// @version 1.4.0-R
88
/// @date 2018
99
/// @copyright Public Domain Unlicense.
1010
/////////////////////////////////////////////////
@@ -20,12 +20,12 @@
2020
/**< If this is defined, then program will use unrealistic method that will
2121
increase the velocity of two colliding balls the closer they are together
2222
it will reduce the number of times that the balls stick together,
23-
but also causes them to get unrealistically high velocities*/
23+
but also causes them to get unrealistically high velocities. */
2424
/*****************************************************************************/
2525
#define DEFINED_COLLISION_NORMAL_FORCE 0
2626
/**< If this is defined, then program will use apply a normal force to any
2727
colliding balls. The forces are along the same direction as the velocities
28-
are. It doesn't make sense in the real world.*/
28+
are. It doesn't make sense in the real world. */
2929
/*****************************************************************************/
3030
#include "version.h"
3131
#include "core.h"

src/rope.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef __ROPE_HEADER__
2-
#define __ROPE_HEADER__
1+
#ifndef __MY_ROPE_HEADER__
2+
#define __MY_ROPE_HEADER__
33
/*****************************************************************************/
44
#include "cannonball.h"
55
/*****************************************************************************/

src/screen.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ typedef struct stcLocation LOC;
4343
/// @}
4444
/*****************************************************************************/
4545
// It is likely bad practice to hold values like this...
46-
/** @todo (GamerMan7799#9#): Find a better method */
4746
namespace screen {
4847
extern WINATT screenatt;
4948
}

src/tick.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef __TICK__HEADER__
2-
#define __TICK__HEADER__
1+
#ifndef __MY_TICK_HEADER__
2+
#define __MY_TICK_HEADER__
33
/*****************************************************************************/
44
#include <time.h>
55
#include <cmath>

src/version.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/*****************************************************************************/
1616
//Date Version Types
1717
/** The day of the last build of the program, currently not used. */
18-
#define DEFINED_VER_DATE "26"
18+
#define DEFINED_VER_DATE "27"
1919

2020
/** The month of the last build of the program, currently not used. */
2121
#define DEFINED_VER_MONTH "03"
@@ -37,13 +37,13 @@
3737
/*****************************************************************************/
3838
/** The version number in a format used by Boilerplate.rc, It is in the following format
3939
[MAJOR].[MINOR].[PATCH].[BUILDNUMBER] */
40-
#define DEFINED_VER_RC_FILEVERSION 1,4,0,7
40+
#define DEFINED_VER_RC_FILEVERSION 1,4,0,8
4141

4242
/** Is the same as DEFINED_VER_RC_FILEVERSION but is a null terminated string */
43-
#define DEFINED_VER_RC_FILEVERSION_STRING "1, 4, 0, 7\0"
43+
#define DEFINED_VER_RC_FILEVERSION_STRING "1, 4, 0, 8\0"
4444

4545
/** A more specific string of the file version */
46-
#define DEFINED_VER_FULLVERSION_STRING "1.4.0-RC.1\0"
46+
#define DEFINED_VER_FULLVERSION_STRING "1.4.0-R\0"
4747

4848
//Software Status
4949
/**
@@ -55,10 +55,10 @@ Software Status can be the following:
5555
| Beta | b | This version will compile and / or run but does not work as expected (or crashes often). |
5656
| Alpha | a | This version does not work at all; it usually won't compile at all or crashes more times than it works; best not to use versions in this state. |
5757
*/
58-
#define DEFINED_VER_STATUS "Release Candidate"
58+
#define DEFINED_VER_STATUS "Release"
5959

6060
/** See the table for DEFINED_VER_STATUS */
61-
#define DEFINED_VER_STATUS_SHORT "rc"
61+
#define DEFINED_VER_STATUS_SHORT "r"
6262
/// @}
6363
/*****************************************************************************/
6464
#endif //__VERSION_HEADER__

0 commit comments

Comments
 (0)