Simple Question
Moderator: InsideQC Admins
15 posts
• Page 1 of 1
Simple Question
OK, so i'm new to engine programming, and i want to design a HUD for my mod, even if it won't be functional for the time being.
Can someone please tell me how to draw a picture on-screen?

Can someone please tell me how to draw a picture on-screen?
- DusterdooSmock
- Posts: 170
- Joined: Thu Aug 19, 2010 9:58 pm
Open up sbar.c,
Scroll down this this Function:
add a new qpic_t, and don't forget to add the * so it can be used in other functions.(Correct me if I am wrong, That is just something I noticed)
Then scroll down, and right after this:
Do something like this:
life = Draw_CachePic ("gfx/life.lmp");
M_DrawPic ( (324-life->width)/2, 16, life);
And that draws an image on the screen.
Scroll down this this Function:
- Code: Select all
/*
===============
Sbar_DrawFace
===============
*/
void Sbar_DrawFace (void)
add a new qpic_t, and don't forget to add the * so it can be used in other functions.(Correct me if I am wrong, That is just something I noticed)
Then scroll down, and right after this:
- Code: Select all
if (cl.items & IT_INVULNERABILITY)
{
if (kurok)
Sbar_DrawPic (8, 0, sb_face_invuln);
else
Sbar_DrawPic (112, 0, sb_face_invuln);
return;
}
}
Do something like this:
life = Draw_CachePic ("gfx/life.lmp");
M_DrawPic ( (324-life->width)/2, 16, life);
And that draws an image on the screen.
-

Mexicouger - Posts: 514
- Joined: Sat May 01, 2010 10:12 pm
OK, so i get this part:
But, what is a "qpic_t" ?

- Code: Select all
life = Draw_CachePic ("gfx/life.lmp");
M_DrawPic ( (324-life->width)/2, 16, life);
But, what is a "qpic_t" ?
- DusterdooSmock
- Posts: 170
- Joined: Thu Aug 19, 2010 9:58 pm
Mexicouger wrote:Look at some of the lines of code that use qpic_t, and connect the dots.
OK, will do.
Thanks.
- DusterdooSmock
- Posts: 170
- Joined: Thu Aug 19, 2010 9:58 pm
Please use meaningful titles.
Improve Quaddicted, send me a pull request: https://github.com/SpiritQuaddicted/Quaddicted-reviews
- Spirit
- Posts: 1031
- Joined: Sat Nov 20, 2004 9:00 pm
DusterdooSmock wrote:OK, so i get this part:
- Code: Select all
life = Draw_CachePic ("gfx/life.lmp");
M_DrawPic ( (324-life->width)/2, 16, life);
But, what is a "qpic_t" ?
qpic_t is a data structure. In this case, a data structure used to store 2D images.
Looks like you're completely new to any programming, not only engine programming. I'd suggest you to grab a couple of books about programming (data structures and algorithms first, then a good C/C++ book - there are a lot of references around the internet, and even here in other threads) before diving in something so complex as the Quake engine.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)
-

frag.machine - Posts: 2090
- Joined: Sat Nov 25, 2006 1:49 pm
frag.machine wrote:
qpic_t is a data structure. In this case, a data structure used to store 2D images.
Looks like you're completely new to any programming, not only engine programming. I'd suggest you to grab a couple of books about programming (data structures and algorithms first, then a good C/C++ book - there are a lot of references around the internet, and even here in other threads) before diving in something so complex as the Quake engine.
Well, i'm a beginner in QuakeC (I understand it a little; enough to do basic stuff), but i figured that i should try some simple stuff in the engine too..
- DusterdooSmock
- Posts: 170
- Joined: Thu Aug 19, 2010 9:58 pm
DusterdooSmock wrote:frag.machine wrote:
qpic_t is a data structure. In this case, a data structure used to store 2D images.
Looks like you're completely new to any programming, not only engine programming. I'd suggest you to grab a couple of books about programming (data structures and algorithms first, then a good C/C++ book - there are a lot of references around the internet, and even here in other threads) before diving in something so complex as the Quake engine.
Well, i'm a beginner in QuakeC (I understand it a little; enough to do basic stuff), but i figured that i should try some simple stuff in the engine too..
It's okay to do simple tutorials, as long as you have a grasp about what are you doing. That's why I recommend you to read some basic books so you can figure out things like "what's qpic_t" by yourself. Just copy & paste without any idea of what's going on won't teach you much and actually tends to have an opposite effect: in the first failure, you'll very likely get frustrated and give up.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)
-

frag.machine - Posts: 2090
- Joined: Sat Nov 25, 2006 1:49 pm
frag.machine wrote:DusterdooSmock wrote:frag.machine wrote:
qpic_t is a data structure. In this case, a data structure used to store 2D images.
Looks like you're completely new to any programming, not only engine programming. I'd suggest you to grab a couple of books about programming (data structures and algorithms first, then a good C/C++ book - there are a lot of references around the internet, and even here in other threads) before diving in something so complex as the Quake engine.
Well, i'm a beginner in QuakeC (I understand it a little; enough to do basic stuff), but i figured that i should try some simple stuff in the engine too..
It's okay to do simple tutorials, as long as you have a grasp about what are you doing. That's why I recommend you to read some basic books so you can figure out things like "what's qpic_t" by yourself. Just copy & paste without any idea of what's going on won't teach you much and actually tends to have an opposite effect: in the first failure, you'll very likely get frustrated and give up.
Well, i have a few books on c/c++, i've just never finished reading them..
- DusterdooSmock
- Posts: 170
- Joined: Thu Aug 19, 2010 9:58 pm
I am reading the book called "The C Programming Launguage". It is a very good book, And I feel like I am learning alot. Highly recommend it.
-

Mexicouger - Posts: 514
- Joined: Sat May 01, 2010 10:12 pm
Mexicouger wrote:I am reading the book called "The C Programming Launguage". It is a very good book, And I feel like I am learning alot. Highly recommend it.
Would you mind telling me what store you purchased it at?
- DusterdooSmock
- Posts: 170
- Joined: Thu Aug 19, 2010 9:58 pm
DusterdooSmock wrote:Mexicouger wrote:I am reading the book called "The C Programming Launguage". It is a very good book, And I feel like I am learning alot. Highly recommend it.
Would you mind telling me what store you purchased it at?
I got it on Ebay for like 10 dollars. It is a quality book, However, I can't really do the exercises because I don't know a compiler for it.
-

Mexicouger - Posts: 514
- Joined: Sat May 01, 2010 10:12 pm
On Windows there's bloodshed devc++. It's an ide with gcc included.Mexicouger wrote:I got it on Ebay for like 10 dollars. It is a quality book, However, I can't really do the exercises because I don't know a compiler for it.
Ken Thompson wrote:One of my most productive days was throwing away 1000 lines of code.
Get off my lawn!
-

dreadlorde - Posts: 268
- Joined: Tue Nov 24, 2009 2:20 am
15 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
