C/C++ Programming Help Thread
This is a discussion on C/C++ Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; Zitat von Waterbottle Can't you just call rand() every time you want a new random value...? If you look on ...
-
02-21-2007, 12:47 PM #2881QJ Gamer Green
- Registriert seit
- Apr 2006
- Ort
- England ~¦¦¦|+|¦¦¦~
- Beiträge
- 1.112
- Points
- 9.165
- Level
- 64
- My Mood
-
- Downloads
- 0
- Uploads
- 0
If you look on page 289, BlackShark shows the method that im currently using for random numbers, its good but it gets chosen every second, even if i type GetRandomNumber(no1, no2) again, it doesnt do it until the next second is up...
Zitat von Waterbottle
Heres what BlackShark wrote:
Zitat von BlackShark
...Just Returned To The Scene...
-
02-21-2007, 12:48 PM #2882QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
um just wanted to make sure my prob hasn't got lost also don't think i've just stopped after posting i've been trying other ways of course to no avail
Zitat von slicer4ever
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
02-21-2007, 12:55 PM #2883Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
That function is one I wrote.
Zitat von JaSo PsP
If it's taking a second to execute, you're doing something else wrong, post up your code.
You should never expect an answer either as you did, the ratio between people asking questions and the people knowledgable enough to answer them is sided very much toward the askers.
Check out my homebrew & C tutorials at http://insomniac.0x89.org/
Coder formerly known as Insomniac197
tshirtz: what is irshell ??
Atarian_: it's where people who work for the IRS go when they die
-
02-21-2007, 01:01 PM #2884QJ Gamer Silver

- Registriert seit
- Oct 2006
- Ort
- Pimp'en in the US F#
- Beiträge
- 1.254
- Points
- 7.278
- Level
- 56
- Downloads
- 0
- Uploads
- 0
yes that is IWN's function, I just got it from one of his Tuts (Awesome tuts by the way IWN, helped me alot)
NEWMy New BLOG!NEWThe Wentire Worls in two Sectors....When did I get dev statz?
Spoiler for my PSP homebrewReleases:Spoiler for Great Quotes:
-
02-21-2007, 01:01 PM #2885QJ Gamer Green
- Registriert seit
- Apr 2006
- Ort
- England ~¦¦¦|+|¦¦¦~
- Beiträge
- 1.112
- Points
- 9.165
- Level
- 64
- My Mood
-
- Downloads
- 0
- Uploads
- 0
My code is:
Zitat von Insert_Witty_Name
Spoiler for Code:...Just Returned To The Scene...
-
02-21-2007, 01:05 PM #2886Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
This code:
Is a function, and should be before your main function, not inside it.Code:int GetRandomNum(int lo, int hi) { SceKernelUtilsMt19937Context ctx; sceKernelUtilsMt19937Init(&ctx, time(NULL)); //SEED TO TIME u32 rand_val = sceKernelUtilsMt19937UInt(&ctx); rand_val = lo + rand_val % hi; return (int)rand_val; }
That must have given you warnings when compiling... Never ignore warnings.
Link to the tutorial previously mentioned: http://www.psp-programming.com/forum...hp?topic=961.0
Check out my homebrew & C tutorials at http://insomniac.0x89.org/
Coder formerly known as Insomniac197
tshirtz: what is irshell ??
Atarian_: it's where people who work for the IRS go when they die
-
02-21-2007, 01:12 PM #2887QJ Gamer Green
- Registriert seit
- Apr 2006
- Ort
- England ~¦¦¦|+|¦¦¦~
- Beiträge
- 1.112
- Points
- 9.165
- Level
- 64
- My Mood
-
- Downloads
- 0
- Uploads
- 0
nope, cygwin didnt give any warnings. And yeah, i shouldve noticed that, too much code confuses me...
Zitat von Insert_Witty_Name
...Just Returned To The Scene...
-
02-21-2007, 01:34 PM #2888QJ Gamer Silver

- Registriert seit
- Oct 2006
- Ort
- Pimp'en in the US F#
- Beiträge
- 1.254
- Points
- 7.278
- Level
- 56
- Downloads
- 0
- Uploads
- 0
Zitat von BlackShark
That probably would have been it,
any way, Does any body know how I can set up a for directional bullet system?NEWMy New BLOG!NEWThe Wentire Worls in two Sectors....When did I get dev statz?
Spoiler for my PSP homebrewReleases:Spoiler for Great Quotes:
-
02-21-2007, 02:14 PM #2889QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
@blackshark simple create a var to contain the direction of your bullet then a simple if statement telling if it is this direction then move this way
i still need help on:
-= Double Post =-
Zitat von slicer4ever
nvm i got it working now i can finally continue with my game=-)Geändert von slicer4ever (02-21-2007 um 02:53 PM Uhr) Grund: Automerged Doublepost
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
02-21-2007, 06:25 PM #2890
Consider this "Half-full"+ or "Half-Empty"-. That's up to you, IMHonestO I think it's fair to come up with generic question but not with ones that are specific to gameplay, becz that's what makes it unique
Zitat von BlackShark

Btw, how's the progress goin?Geändert von Mr305 (02-21-2007 um 06:39 PM Uhr)
-
02-21-2007, 06:32 PM #2891Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Zitat von Insert_Witty_Name
does it work with negatives? as in:
GetRandomNum(-10, 10);
would that work?--------------------------------------------------------------------------------------
-
02-21-2007, 09:49 PM #2892QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
math prob:
how do i find the angle of an object compared fto another object
e.g. my object is sitting in a position i click somewhere now i need to find the current angle of the clicked position and my objects position...how?1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
02-21-2007, 10:04 PM #2893QJ Gamer Bronze

- Registriert seit
- Jul 2006
- Beiträge
- 90
- Points
- 4.912
- Level
- 44
- Downloads
- 0
- Uploads
- 0
use the atan2f function.
example:
You may have to switch the object and clicked positions depending on from which position you want the angle to be measured.Code:float theta = atan2f(objecty - clickedy, objectx - clickedx);
-
02-21-2007, 10:17 PM #2894QJ Gamer Silver

- Registriert seit
- Oct 2006
- Ort
- Pimp'en in the US F#
- Beiträge
- 1.254
- Points
- 7.278
- Level
- 56
- Downloads
- 0
- Uploads
- 0
Ok so far, definetly a learning experience, working on AI now, (still no bullet system) Id give you a screen shot of the menu (pretty much done) and the game but I can't do screen shots yet. maybe later!
Zitat von Mr305
NEWMy New BLOG!NEWThe Wentire Worls in two Sectors....When did I get dev statz?
Spoiler for my PSP homebrewReleases:Spoiler for Great Quotes:
-
02-21-2007, 10:19 PM #2895QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
@nataku i did that but i forgot to remove another part of the script which reset the angle before it was rotated thats y i asked but now it's all fixed anywyas can i ask whats the diffrence between atan and atan2?(always wondered)
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
02-21-2007, 10:46 PM #2896QJ Gamer Bronze

- Registriert seit
- Jul 2006
- Beiträge
- 90
- Points
- 4.912
- Level
- 44
- Downloads
- 0
- Uploads
- 0
atan2 is able to return an angle from -pi to pi, while atan can only return -pi/2 to pi/2
-
02-21-2007, 10:50 PM #2897QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
o i see
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
02-22-2007, 07:33 PM #2898I'm Baaaack!

- Registriert seit
- May 2006
- Ort
- Nowhere
- Beiträge
- 2.186
- Points
- 17.067
- Level
- 83
- Downloads
- 0
- Uploads
- 0
Would someone mind posting a code for scanning a directory? I have researched quite a bit, including looking though th SDK includes, but I just can't get it right. I just need to know the files in a directory, and whether or not they are files or folders.

-
02-22-2007, 08:52 PM #2899likes kittens....awww....
- Registriert seit
- Sep 2006
- Ort
- Detroit
- Beiträge
- 628
- Points
- 6.975
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Im trying to compile a id3 lib but it just wont work:
Code:[email protected] /cygdrive/c/projects/pxs $ cd c:/projects/id3lib-5 [email protected] /cygdrive/c/projects/id3lib-5 $ ./configure --prefix=/home/luser checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... gawk checking whether make sets ${MAKE}... yes checking for style of include used by make... GNU checking for gcc... gcc checking for C compiler default output... configure: error: C compiler cannot cr eate executables
-
02-22-2007, 09:44 PM #2900words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
If you are using that PSPDev Win32 thing, it wotn work.

...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
02-22-2007, 10:41 PM #2901likes kittens....awww....
- Registriert seit
- Sep 2006
- Ort
- Detroit
- Beiträge
- 628
- Points
- 6.975
- Level
- 55
- Downloads
- 0
- Uploads
- 0
im re-installing cygwin now...
-
02-22-2007, 10:54 PM #2902words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
Uhm, good for you?

...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
02-23-2007, 12:02 AM #2903
meh stop spamming the thread psp
12 ,please.
Access_Denied : I think when you scan a directory, the sub-folders end with a / , if it ends by / , youre sure that it's not a file. I can't provide you my code, it's bugged as hell ^^
-
02-23-2007, 12:27 AM #2904Mushroom Man
- Registriert seit
- Sep 2005
- Ort
- UK
- Beiträge
- 318
- Points
- 7.283
- Level
- 56
- Downloads
- 0
- Uploads
- 0
Do you need to scan all sub-directories as well? I have my resource loading function for Traveller that scans a directory and loads all PNG files found into the resource holder, however it is not recursive, although that would not involve much modification. If this could be of help I'll clean it up and post it for you :)
Zitat von Access_Denied
-
02-23-2007, 07:20 AM #2905Developer

- Registriert seit
- Oct 2005
- Ort
- Dubuque
- Beiträge
- 423
- Points
- 12.154
- Level
- 72
- My Mood
-
- Downloads
- 1
- Uploads
- 0
http://www.psp-programming.com/forum...ic,1333.0.html
Zitat von Access_Denied
-
02-23-2007, 11:33 AM #2906
- Registriert seit
- Sep 2006
- Beiträge
- 484
- Points
- 8.718
- Level
- 62
- Downloads
- 0
- Uploads
- 0
How can I make a code that says some thin like if the power switch is pressed up then do whatever i want. how would i do that?
-
02-23-2007, 02:00 PM #2907I'm Baaaack!

- Registriert seit
- May 2006
- Ort
- Nowhere
- Beiträge
- 2.186
- Points
- 17.067
- Level
- 83
- Downloads
- 0
- Uploads
- 0
Check out C:/cygwin/usr/local/pspdev/psp/sdk/include/pspctrl.h

-
02-23-2007, 02:44 PM #2908QJ Gamer Silver
- Registriert seit
- Sep 2006
- Ort
- Finland
- Beiträge
- 752
- Points
- 7.385
- Level
- 57
- Downloads
- 0
- Uploads
- 0
Or the docs, at /usr/local/pspdev/psp/sdk/doc/html/index.html :)
Zitat von Access_Denied
wheeee =:D
-
02-23-2007, 02:45 PM #2909
- Registriert seit
- Sep 2006
- Beiträge
- 484
- Points
- 8.718
- Level
- 62
- Downloads
- 0
- Uploads
- 0
Which one of these would be the power switch:
Code:/** Select button. */ PSP_CTRL_SELECT = 0x000001, /** Start button. */ PSP_CTRL_START = 0x000008, /** Up D-Pad button. */ PSP_CTRL_UP = 0x000010, /** Right D-Pad button. */ PSP_CTRL_RIGHT = 0x000020, /** Down D-Pad button. */ PSP_CTRL_DOWN = 0x000040, /** Left D-Pad button. */ PSP_CTRL_LEFT = 0x000080, /** Left trigger. */ PSP_CTRL_LTRIGGER = 0x000100, /** Right trigger. */ PSP_CTRL_RTRIGGER = 0x000200, /** Triangle button. */ PSP_CTRL_TRIANGLE = 0x001000, /** Circle button. */ PSP_CTRL_CIRCLE = 0x002000, /** Cross button. */ PSP_CTRL_CROSS = 0x004000, /** Square button. */ PSP_CTRL_SQUARE = 0x008000, /** Home button. */ PSP_CTRL_HOME = 0x010000, /** Hold button. */ PSP_CTRL_HOLD = 0x020000, /** Music Note button. */ PSP_CTRL_NOTE = 0x800000, /** Screen button. */ PSP_CTRL_SCREEN = 0x400000, /** Volume up button. */ PSP_CTRL_VOLUP = 0x100000, /** Volume down button. */ PSP_CTRL_VOLDOWN = 0x200000, /** Wlan switch up. */ PSP_CTRL_WLAN_UP = 0x040000, /** Remote hold position. */ PSP_CTRL_REMOTE = 0x080000, /** Disc present. */ PSP_CTRL_DISC = 0x1000000, /** Memory stick present. */ PSP_CTRL_MS = 0x2000000, };
-
02-23-2007, 02:56 PM #2910
The power switch is in the psppower.h file. Look at the PSPSDK sample on how to use it.
(lol @ access_denied suggesting pspctrl)牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth


LinkBack URL
About LinkBacks
Mit Zitat antworten

Hello everyone I am new here and I am glad to be part of this amazing community and I think there...
New to forum