• What do you need help with? Version 5
    5,752 replies, posted
I could be wrong about any of this. I'm an admin on the Wolfenstein Wiki and I'm trying to make animated GIFs of all the enemies moving from extracted sprites. This file seems to give the time for each sprite: [url]https://github.com/id-Software/wolf3d/blob/master/WOLFSRC/WL_ACT2.C[/url] example [code]statetype s_willstand = {false,SPR_WILL_W1,0,T_Stand,NULL,&s_willstand}; statetype s_willchase1 = {false,SPR_WILL_W1,10,T_Will,NULL,&s_willchase1s}; statetype s_willchase1s = {false,SPR_WILL_W1,3,NULL,NULL,&s_willchase2}; statetype s_willchase2 = {false,SPR_WILL_W2,8,T_Will,NULL,&s_willchase3}; statetype s_willchase3 = {false,SPR_WILL_W3,10,T_Will,NULL,&s_willchase3s}; statetype s_willchase3s = {false,SPR_WILL_W3,3,NULL,NULL,&s_willchase4}; statetype s_willchase4 = {false,SPR_WILL_W4,8,T_Will,NULL,&s_willchase1}; statetype s_willdeathcam = {false,SPR_WILL_W1,1,NULL,NULL,&s_willdie1}; statetype s_willdie1 = {false,SPR_WILL_W1,1,NULL,A_DeathScream,&s_willdie2}; statetype s_willdie2 = {false,SPR_WILL_W1,10,NULL,NULL,&s_willdie3}; statetype s_willdie3 = {false,SPR_WILL_DIE1,10,NULL,NULL,&s_willdie4}; statetype s_willdie4 = {false,SPR_WILL_DIE2,10,NULL,NULL,&s_willdie5}; statetype s_willdie5 = {false,SPR_WILL_DIE3,10,NULL,NULL,&s_willdie6}; statetype s_willdie6 = {false,SPR_WILL_DEAD,20,NULL,NULL,&s_willdie6}; statetype s_willshoot1 = {false,SPR_WILL_SHOOT1,30,NULL,NULL,&s_willshoot2}; statetype s_willshoot2 = {false,SPR_WILL_SHOOT2,10,NULL,T_Launch,&s_willshoot3}; statetype s_willshoot3 = {false,SPR_WILL_SHOOT3,10,NULL,T_Shoot,&s_willshoot4}; statetype s_willshoot4 = {false,SPR_WILL_SHOOT4,10,NULL,T_Shoot,&s_willshoot5}; statetype s_willshoot5 = {false,SPR_WILL_SHOOT3,10,NULL,T_Shoot,&s_willshoot6}; statetype s_willshoot6 = {false,SPR_WILL_SHOOT4,10,NULL,T_Shoot,&s_willchase1}; [/code] I interpret the third thing after the equals as a number of units of time. Assuming the unit is one centisecond, it seems too fast! Other files have said things about 70 Hertz. I might try that, but it's a weird ass number. [editline]21st July 2012[/editline] I shall perform an experiment with 50Hz bases, 60Hz bases, and 70Hz bases to see which is the most fitting to Wolfenstein 3D. [editline]21st July 2012[/editline] 70Hz seems to fit. Jesus, what an odd number.
Is there any way to simplify this regex? I'm trying to verify an identifier that's 4 characters long A-Z and allow for padding only at the end with the "." character. The regex string: [code]([A-Z]{4})|([A-Z]{3}\.{1})|([A-Z]{2}\.{2})|([A-Z]{1}\.{3})[/code] Valid: [code] TEST TES. TE.. T... [/code] Invalid: [code] test TESt TEst Test tEST teST tesT T..T T.S. .E.T .EST ..ST ...T .... [/code]
Is there an API somewhere for getting current sales tax for my state? [editline]21st July 2012[/editline] (I live in the US in case you don't have Overv's Flagdog script for some reason)
Your other icons you've got down there make anything seem dubious you know
[QUOTE=Elecbullet;36881538]Your other icons you've got down there make anything seem dubious you know[/QUOTE] i don't get it
[QUOTE=Elecbullet;36876895]70Hz seems to fit. Jesus, what an odd number.[/QUOTE] Are you sure it's not 75Hz? That was the usual refresh rate of CRTs back in the day.
dickwhacking bagslut
[QUOTE=robmaister12;36877576]Is there any way to simplify this regex? I'm trying to verify an identifier that's 4 characters long A-Z and allow for padding only at the end with the "." character. The regex string: [code]([A-Z]{4})|([A-Z]{3}\.{1})|([A-Z]{2}\.{2})|([A-Z]{1}\.{3})[/code] Valid: [code] TEST TES. TE.. T... [/code] Invalid: [code] test TESt TEst Test tEST teST tesT T..T T.S. .E.T .EST ..ST ...T .... [/code][/QUOTE] ^([A-Z]+)(\.*)$
[QUOTE=ECrownofFire;36900710]^([A-Z]+)(\.*)$[/QUOTE] Matches TESTER, which is wrong.
Also matches EFEXISAPRETTYCOOLGUY
I'm learning Java on Android by making a very simple game, but my touch isn't working correctly. It only registers the ACTION_DOWN event and nothing else. Ideas? MainActivity: [code] package com.novaember.blockrunner; import android.app.*; import android.os.*; import android.util.*; import android.view.*; import android.widget.*; public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(new MainGamePanel(this)); } @Override public void onBackPressed() { return; } } [/code] MainGamePanel: [code] package com.novaember.blockrunner; import android.app.*; import android.content.*; import android.graphics.*; import android.os.*; import android.util.*; import android.view.*; import android.widget.*; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class MainGamePanel extends SurfaceView implements SurfaceHolder.Callback { private String avgFps; public void setAvgFps(String avgFps) { this.avgFps = avgFps; } private MainThread thread;; private Player player; private Map map; private Menu menu; public MainGamePanel(Context context) { super(context); // adding the callback (this) to the surface holder to intercept events getHolder().addCallback(this); player = new Player(BitmapFactory.decodeResource(getResources(), R.drawable.player), 50, 50); menu = new MainMenu(); this.thread = new MainThread(getHolder(), this); // make the GamePanel focusable so it can handle events setFocusable(true); } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { } @Override public void surfaceCreated(SurfaceHolder holder) { thread.setRunning(true); thread.start(); } @Override public void surfaceDestroyed(SurfaceHolder holder) { boolean retry = true; while (retry) { try { thread.join(); retry = false; } catch (InterruptedException e) { // try again shutting down the thread } } }; @Override public boolean onTouchEvent(MotionEvent event) { boolean ret = super.onTouchEvent(event); int action = event.getAction() & MotionEvent.ACTION_MASK; float ex = event.getX(); float ey = event.getY(); Log.d("BR", "Coords: x=" + ex + ",y=" + ey + ",action=" + event.getAction()); switch (action) { case MotionEvent.ACTION_DOWN: // thread.setRunning(false); // ((Activity) getContext()).finish(); try { for(Iterator i = menu.getButtons().iterator(); i.hasNext();) { Button btn = (Button) i.next(); Rect rect = btn.getRect(); if(rect.contains((int) ex, (int) ey)) { if(!btn.isDown()) { btn.touchDown(); } } } } catch (Exception e) { } break; case MotionEvent.ACTION_UP: try { for(Iterator i = menu.getButtons().iterator(); i.hasNext();) { Button btn = (Button) i.next(); Rect rect = btn.getRect(); //if(!rect.contains((int) ex, (int) ey)) { if(btn.isDown()) { btn.touchUp(); } //} } } catch (Exception e) { } break; } return ret; } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { try { } catch(Exception e) { } return super.onKeyDown(keyCode, event); } @Override public boolean onKeyUp(int keyCode, KeyEvent event) { Log.d("BR", "Key "+keyCode); try { } catch(Exception e) { } return super.onKeyUp(keyCode, event); } @Override protected void onDraw(Canvas canvas) { canvas.drawColor(Color.BLACK); } public void update() { } public void render(Canvas canvas) { canvas.drawColor(Color.BLACK); player.draw(canvas); menu.draw(canvas); displayFps(canvas, avgFps); } private void displayFps(Canvas canvas, String fps) { if (canvas != null && fps != null) { Paint paint = new Paint(); paint.setARGB(255, 255, 255, 255); canvas.drawText(fps, this.getWidth() - 50, 20, paint); } } } [/code] Also, some critique on the code in general would be welcome as I'm still learning it.
This question has probably been asked to death already, but what would be the best combination of libraries/toolkits for a 2d clone of tron for Linux/Windows. I made a couple of small applications with GTK+, and I just started into GLFW but I realized quickly that I was in over my head with OpenGL and before I knew it I was already doing everything bass ackwards (in that deprecated sort of way). Should I just make a simple gui within glfw and forgo trying to integrate GTK with it? Should I look into any other OpenGL helper libraries? And what would be the best place to learn the most up-to-date OpenGL? I have already written a version of the game with NCurses so I just need to translate that to a more graphical interface.
[QUOTE=Rayjingstorm;36905618]This question has probably been asked to death already, but what would be the best combination of libraries/toolkits for a 2d clone of tron for Linux/Windows. I made a couple of small applications with GTK+, and I just started into GLFW but I realized quickly that I was in over my head with OpenGL and before I knew it I was already doing everything bass ackwards (in that deprecated sort of way).[/QUOTE] Try SFML 2.
[QUOTE=robmaister12;36877576]Is there any way to simplify this regex? I'm trying to verify an identifier that's 4 characters long A-Z and allow for padding only at the end with the "." character. The regex string: [code]([A-Z]{4})|([A-Z]{3}\.{1})|([A-Z]{2}\.{2})|([A-Z]{1}\.{3})[/code] [/QUOTE] Regex is not really designed to solve that type of problem. You can only specify the number of times a certain atom can repeat, so you would only be able to check whether a given character is A-Z or a period. If you were to pre-process the string to verify that it only has 4 characters, then you could use the regex that ECrownofFire gave. Otherwise you can't simplify it.
[QUOTE=ShaunOfTheLive;36905722]Regex is not really designed to solve that type of problem. You can only specify the number of times a certain atom can repeat, so you would only be able to check whether a given character is A-Z or a period. If you were to pre-process the string to verify that it only has 4 characters, then you could use the regex that ECrownofFire gave. Otherwise you can't simplify it.[/QUOTE] Yeah, it's probably better to check length and use a simple regex than it is to have a large, hard to read regex that probably takes longer to match than the length check. I'll go with ECrownofFire's regex. Thanks, guys.
Hello I am an amatuer c++programmer and i would like to know if anyone knows of a good compiler other than dev-c++ and codeblocks because neither seam to work very well.
[QUOTE=Dhuple;36907774]Hello I am an amatuer c++programmer and i would like to know if anyone knows of a good compiler other than dev-c++ and codeblocks because neither seam to work very well.[/QUOTE] Explain how they don't [B]seem[/B] to work very well. And also, dev-c++ and codeblocks are not compilers, they are IDE (Integrated Development Environments).
[QUOTE=Topgamer7;36907947]Explain how they don't [B]seem[/B] to work very well. And also, dev-c++ and codeblocks are not compilers, they are IDE (Integrated Development Environments).[/QUOTE] Well codeblocks shuts down on its own after a while and dev-c++ just doesnt operate properly. I am sure it is just my computer becayse my friend was formating files off of my computer one nite and jacked up a bunch of stuff. Some how he managed to get rid of my audio driver which is extremely annoying. So i woul like to know of any good c++ comiler. P.S. I am going to be getting a new computer.
[quote]computer becayse my friend was formating files off of my computer[/quote] This makes no sense whatsoever. Was he formatting a hard drive? And codeblocks shuts off after what? When you run a compiled program? And how does dev-c++ not operate properly... Please learn correct grammar. And as I stated before, these are not compilers, these are not required to write programs, you could download a compiler like gcc or ibm's c++ compiler, and run them from the command line. If you want you could try Eclipse.
[QUOTE=Rayjingstorm;36905618]This question has probably been asked to death already, but what would be the best combination of libraries/toolkits for a 2d clone of tron for Linux/Windows?[/quote] [url=https://love2d.org/]LÖVE[/url]? [QUOTE=Rayjingstorm;36905618] I made a couple of small applications with GTK+, and I just started into GLFW but I realized quickly that I was in over my head with OpenGL and before I knew it I was already doing everything bass ackwards (in that deprecated sort of way). Should I just make a simple gui within glfw and forgo trying to integrate GTK with it? Should I look into any other OpenGL helper libraries?[/quote] About that one I am not sure but [url=http://www.libsdl.org/]SDL[/url] or [url=http://www.sfml-dev.org/index.php]SFML[/url] should do the job. [QUOTE=Rayjingstorm;36905618]And what would be the best place to learn the most up-to-date OpenGL?[/QUOTE] Overvs title
[QUOTE=Dhuple;36907774]Hello I am an amatuer c++programmer and i would like to know if anyone knows of a good compiler other than dev-c++ and codeblocks because neither seam to work very well.[/QUOTE] Microsoft Visual C++.
Thanks for the suggestions. Is SFML easy to use in C as apposed to C++? Or should I go with SDL? I've seen a lot of cool stuff written using LOVE but again I'd rather write in C.
You're better off using SDL with C. You can technically use SFML with C, but all the tutorials and documentation are written for C++ (SFML is heavily class based, with a C API tacked on as an after thought)
[QUOTE=ShaunOfTheLive;36912364]You're better off using SDL with C. You can technically use SFML with C, but all the tutorials and documentation are written for C++ (SFML is heavily class based, with a C API tacked on as an after thought)[/QUOTE] Thanks for all the help guys, if I hit any road-blocks I know where to turn :v:
[QUOTE=ShaunOfTheLive;36912364]You're better off using SDL with C. You can technically use SFML with C, but all the tutorials and documentation are written for C++ (SFML is heavily class based, with a C API tacked on as an after thought)[/QUOTE] glfw is C as well.
[QUOTE=Overv;36916423]glfw is C as well.[/QUOTE] I just started into using glfw, but that leaves me with two options: Learn openGL or find a library which abstracts it away. In my original question I was trying to ask for either or both, and I would still appreciate a resource for openGL.
[QUOTE=Rayjingstorm;36917146]I just started into using glfw, but that leaves me with two options: Learn openGL or find a library which abstracts it away. In my original question I was trying to ask for either or both, and I would still appreciate a resource for openGL.[/QUOTE] [QUOTE=vombatus;36910426]Overvs title[/QUOTE]
[QUOTE=Overv;36918320][/QUOTE] I completely missed the third part of his answer :suicide: Thanks again guys.
So I'm starting out in AS3 and it's been pretty sweet. Using books and youtube videos and articles to get into the swing of everything. Ran into a problem though; I'm trying to get a system set up where pressing the right arrow key moves the box to the right, and releasing the arrow key stops it. In order to get this motion smooth and give it some inertia, I've been trying to add acceleration and deceleration. The acceleration works alright (apart from the issue of key repeat delay but I've got a fix for that). The deceleration is a bigger issue however. Basically, I set a boolean value to determine whether or not the key is pressed down. This value is supposed to determine whether or not the deceleration of the rightwards motion is applied. However, this doesn't work. By tracing the state of KeyUp and also CharacterVelocityX I can see that KeyUp fluctuates between true and false while the key is pressed down, and the value of CharacterVelocityX changes between 0 and 1. Motion on other axis (that have not been coded with any deceleration yet) accelerate and travel perfectly. Here's my code; [CODE]package { import flash.display.MovieClip; import flash.events.KeyboardEvent; import flash.events.Event; import flash.ui.Keyboard; public class DocumentMain extends MovieClip { public var Char1:character = new character(); public var CharVelocityX:Number; public var CharPositionX:Number; public var CharVelocityY:Number; public var CharPositionY:Number; public var KeyUp:Boolean; public function DocumentMain() { CharVelocityX = 0; CharVelocityY = 0; KeyUp = true; this.addChild(Char1); stage.addEventListener(Event.ENTER_FRAME, enterFrameHandler); stage.addEventListener(Event.ENTER_FRAME, CharDeceleration); stage.addEventListener(KeyboardEvent.KEY_DOWN, KeyDownHandler); stage.addEventListener(KeyboardEvent.KEY_UP, KeyUpHandler); } public function KeyDownHandler(e:KeyboardEvent) { KeyUp = false; if (e.keyCode == Keyboard.RIGHT) { if (CharVelocityX <= 10) { CharVelocityX = CharVelocityX += 2; } } if (e.keyCode == Keyboard.LEFT) { if (CharVelocityX >=-10) { CharVelocityX = CharVelocityX -= 2; } } if (e.keyCode == Keyboard.DOWN) { if (CharVelocityY <= 10) { CharVelocityY = CharVelocityY += 2; } } if (e.keyCode == Keyboard.UP) { if (CharVelocityY >=-10) { CharVelocityY = CharVelocityY -= 2; } } } public function KeyUpHandler(e:KeyboardEvent) { KeyUp = true; if (e.keyCode == Keyboard.RIGHT) { CharDeceleration(null); } } public function CharDeceleration(e:Event) { if (KeyUp = true) { if (CharVelocityX > 0) { CharVelocityX -= 1; } } } public function enterFrameHandler(e:Event) { trace(KeyUp) trace(CharVelocityX); Char1.x += CharVelocityX; Char1.y += CharVelocityY; } } } [/code] Any ideas? I realise it's probably something quite basic but being quite new to all this I'm stumped. Could it be to do with the keyboard input system firing a regular series of quick 'on'/'off' signals instead of a constant 'on' signal when held down? Side note; The CharPositionX(/Y) variables are unused. For some reason (holler if you know why) the Char1.x and y values wont change if I refer to them by their variable name (CharPositionX or Y) in that final enterFrameHandler.
Any ideas how I would store a Hexagon tile map? (Settlers of Catan style)
Sorry, you need to Log In to post a reply to this thread.