((X1 - X0)*(x - X0) + (Y1 - Y0)*(y - Y0))/((X1 - X0)² + (Y1 - Y0)²)->a if (0<a and a<1 and ((x - X0 - a*(X1 - X0))² + (y - Y0 - a*(Y1 - Y0)))² <= colradius²) then ;react to collision end that should check if the player collides with the given line.
For some reason, the pixels on the edge between two texels are sometimes wrong. Does anybody knows how that can be fixed?
This is in basic, btw.
EDIT:
How could i have forgot the scource?
anyway, here it is. Sorry, it's the program itself, not just te code. I tried opening it with notepad, but all i got was a bunch of strange characters. So i hope you have an emulator to open it
btw: still no texture correction, and there are some bugs. If you try to change the coordinates: keep in mind that it only works when Y1 < Y2 < Y3 < Y4 , and there is also a bug when you try to draw a trapezoid with the paralel lines more vertical than horizontal.
EDIT2:
I found a converter. Here's the basic source code:
Back to Cretaceous is a java game which i'm working at with a few friends. The engines are almost done, so now we have to start working at the graphical part. There is still one problem: We can't agree on how the dinosaurs wil look like, so we decided to append a poll. There are three possibilities: - Scales: The dinosaurs will have a scaled skin, which will make them look like giant reptiles. This is how almost everybody thinks abouth dinosaurs. - Feathers: Te dinosaurs will have feathers, which will make them look more like birds. Recent investigation has proved that some small dinosaurs had feathers. Weather the big dinosaurs had feathers is still uncertain. - A mix of the two: small dinosours will have feathers (becouse that's proven) and the big ones will still look like giant reptiles (becouse that's how everybody thinks abouth dinosaurs).
I'm not saying which one I prefer becouse that could have influence on the results, which isn't fair, so please don't ask for it.
Depends of the type of adapter you use. I use an adapter with a tip with only 2 contact area's (one for the - and one for the signal), so you can't do right and left on that adapter, and if you would try this, it would sound horrible becouse it kinda works like an AND port (signal on when either lhe signal for left or right is on). This would totally mess up the frequency.
If you want to write a music composer for the calculator, you should limit it to beebs. You can make it sound realistic, but then you'll have to fill the entire memory with saved notes from different instruments.
You can do it like the ringtone composer of my celphone: every key stands for a tone and the two arrow keys are used to make tones longer/courter (my celphone only has 2 arrow keys). Ass the specs of my celphone are a lot worse than thespecs of an ti-83+ series calc, this should be perfectly doable.
You can make the adapter for usb yourself. here is described how to do it. (Sorry, it's in dutch. I don't know an english tutorial, but you can use google translate)
for sound, there is thrusound. Search for it on ticalc. You can buy an adapter for sound at some hardware shops.
EDIT: keep in mind: msd8x does not work with every usb flash drive.
is there any way to use an .avi file instaed of a .vwm and a .wav file? Is there a convertor for that?
btw: what I really would like to see in a future version is an option to select the quality so you can have more than 14 (on not SE calcs) or 45 (on SE calcs) secounds of video on it. What also would be great, but i doubt that it's possible, would be reading from an USB flash drive.
After placing ret's and jumps at some positions in the code and counting the bytes in the memory editor of wabbitemu, I found out that thi routine does anything but drawing a textured quad. Amost nothing of it is doing what it should do, so I decided to put this on hold, make an other game, and try again when i'm more used to asm.
So, does anybody have a good idea for a good 2D or wireframe 3D game?
Edit: I just noticed i tripple posted, but there is more than 6 hours between those posts, so it's ok, right?
many thanks to thepenguin77 and calc84 for helping me through omnomIRC.
But it still doesn't work. It gets stuck in a endless loop again.
I included the most recent scource code.
Spoiler For source code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;TexQuad ;in: x1, y1, u1, v1, x2, y2, u2, v2, x3, y3, u3, v3, x4, y4, u4, v4 ;out: textured quad is drawn to the buffer TexQuad: ld a, (y1) ld b, a ld a, (y2) sub b ld (temp), a ld a, (x1) ld b, a ld a, (x2) sub b ld h, a ld l, 0 ld de, (temp) ld e, 0 call DivFP ld (dx1), hl ld a, (y1) ld b, a ld a, (y3) sub b ld (temp), a ld a, (x1) ld b, a ld a, (x3) sub b ld h, a ld l, 0 ld a, (temp) ld d, a ld e, 0 call DivFP ld (dx2), hl ld a, (y2) ld b, a ld a, (y4) sub b ld (temp), a ld a, (x2) ld b, a ld a, (x4) sub b ld h, a ld l, 0 ld a, (temp) ld d, a ld e, 0 call DivFP ld (dx3), hl ld a, (y3) ld b, a ld a, (y4) sub b ld (temp), a ld a, (x3) ld b, a ld a, (x4) sub b ld h, a ld l, 0 ld a, (temp) ld d, a ld e, 0 call DivFP ld (dx4), hl ld a, (y1) ld b, a ld a, (y2) sub b ld (temp), a ld a, (u1) ld b, a ld a, (u2) sub b ld h, a ld l, 0 ld a, (temp) ld d, a ld e, 0 call DivFP ld (du1), hl ld a, (y1) ld b, a ld a, (y3) sub b ld (temp), a ld a, (u1) ld b, a ld a, (u3) sub b ld h, a ld l, 0 ld a, (temp) ld d, a ld e, 0 call DivFP ld (du2), hl ld a, (y2) ld b, a ld a, (y4) sub b ld (temp), a ld a, (u2) ld b, a ld a, (u4) sub b ld h, a ld l, 0 ld a, (temp) ld d, a ld e, 0 call DivFP ld (du3), hl ld a, (y3) ld b, a ld a, (y4) sub b ld (temp), a ld a, (u3) ld b, a ld a, (u4) sub b ld h, a ld l, 0 ld a, (temp) ld d, a ld e, 0 call DivFP ld (du4), hl ld a, (y1) ld b, a ld a, (y2) sub b ld (temp), a ld a, (v1) ld b, a ld a, (v2) sub b ld h, a ld l, 0 ld a, (temp) ld d, a ld e, 0 call DivFP ld (dv1), hl ld a, (y1) ld b, a ld a, (y3) sub b ld (temp), a ld a, (v1) ld b, a ld a, (v3) sub b ld h, a ld l, 0 ld a, (temp) ld d, a ld e, 0 call DivFP ld (dv2), hl ld a, (y2) ld b, a ld a, (y4) sub b ld (temp), a ld a, (v2) ld b, a ld a, (v4) sub b ld h, a ld l, 0 ld a, (temp) ld d, a ld e, 0 call DivFP ld (dv3), hl ld a, (y3) ld b, a ld a, (y4) sub b ld (temp), a ld a, (v3) ld b, a ld a, (v4) sub b ld h, a ld l, 0 ld a, (temp) ld d, a ld e, 0 call DivFP ld (dv4), hl ld a, (x1) ld h, a ld l, 0 ld (tx1), hl ld a, (x2) ld h, a ld l, 0 ld (tx2), hl ld a, (u1) ld h, a ld l, 0 ld (tu1), hl ld a, (v1) ld h, a ld l, 0 ld (tv1), hl ld a, (u2) ld h, a ld l, 0 ld (tu2), hl ld a, (v2) ld h, a ld l, 0 ld (tv2), hl ld a, (y1) ld (_ty), a
QuadDrawLoop1: ld a, (tx1) ld (temp), a ;i=temp
QuadPlotLoop1: ld a, (tx1) ld b, a ld a, (tx2) sub b ld c, a ld a, (tx1) ld d, a ld e, 0 ld a, (temp) sub b ld h, a ld l, 0 call DivFP ld a, h ld (temp+1), a ;tmp=temp+1 ld b, a ld a, 1 sub b ld d, a ld e, 0 ld a, (tu1) ld b, a ld c, 0 call MulFP push hl ld a, (temp+1) ld d, a ld e, 0 ld a, (tu2) ld b, a ld c, 0 call MulFP pop de add hl, de ld a, h ld (temp2), a ;u=temp2 ld a, (temp+1) ld b, a ld a, 1 sub b ld d, a ld e, 0 ld a, (tv1) ld b, a ld c, 0 call MulFP push hl ld a, (temp+1) ld d, a ld e, 0 ld a, (tv2) ld b, a ld c, 0 call MulFP pop de add hl, de ld a, h ld (temp2+1), a ;v=temp2+1 ;Get the pixel at (u,v) from the texture ld hl, (temp2+1) ld h, 0 ;1 byte smaller
ld de, texture add hl, de
ld a, (temp2) ld b, a inc b ld a, (hl) shiftLoop: rl c djnz shiftLoop ;the extra shift gets rid of the jr ;and pulls the bit out of carry
BitShiftDone: push af ;1 ld a, (_ty) ld l, a ld a, (temp) ld b, 94 cp b jr nc, ContDrawLoop1
getPixel: ld h, 0 ld d, h ld e, l
add hl, hl add hl, de add hl, hl add hl, hl
ld e, a srl e srl e srl e add hl, de
ld de, PlotSScreen add hl, de
and 7 ld b, a ld a, $80 jr z, PlotPixel
rrca djnz $-1
PlotPixel: pop af ;0 jr nc, ResPixel
SetPixel: or (hl) ld (hl), a jr EndPlot
ResPixel: cpl and (hl) ld (hl), a
EndPlot: ld a, (temp) ld b, 255 cp b jp z, ContDrawLoop1 ld hl, temp inc (hl) ld a, (tx2) cp (hl) jp nc, QuadPlotLoop1
ContDrawLoop1: ld hl, (tx1) ld de, (dx1) add hl, de ld (tx1), hl ld hl, (tx2) ld de, (dx2) add hl, de ld (tx2), hl ld hl, (tu1) ld de, (du1) add hl, de ld (tu1), hl ld hl, (tu2) ld de, (du2) add hl, de ld (tu2), hl ld hl, (tv1) ld de, (dv1) add hl, de ld (tv1), hl ld hl, (tv2) ld de, (dv2) add hl, de ld (tv2), hl ld hl, _ty inc (hl) ld a, (y2) cp (hl) jp nz, QuadDrawLoop1
ld a, (y2) ld (_ty), a
QuadDrawLoop2: ld a, (tx1) ld (temp), a ;i=temp
QuadPlotLoop2: ld a, (tx1) ld b, a ld a, (tx2) sub b ld c, a ld a, (tx1) ld d, a ld e, 0 ld a, (temp) sub b ld h, a ld l, 0 call DivFP ld a, h ld (temp+1), a ;tmp=temp+1 ld b, a ld a, 1 sub b ld d, a ld e, 0 ld a, (tu1) ld b, a ld c, 0 call MulFP push hl ld a, (temp+1) ld d, a ld e, 0 ld a, (tu2) ld b, a ld c, 0 call MulFP pop de add hl, de ld a, h ld (temp2), a ;u=temp2 ld a, (temp+1) ld b, a ld a, 1 sub b ld d, a ld e, 0 ld a, (tv1) ld b, a ld c, 0 call MulFP push hl ld a, (temp+1) ld d, a ld e, 0 ld a, (tv2) ld b, a ld c, 0 call MulFP pop de add hl, de ld a, h ld (temp2+1), a ;v=temp2+1 ;Get the pixel at (u,v) from the texture ld hl, (temp2+1) ld h, 0 ;1 byte smaller
ld de, texture add hl, de
ld a, (temp2) ld b, a inc b ld a, (hl) shiftLoop2: rl c djnz shiftLoop2 ;the extra shift gets rid of the jr ;and pulls the bit out of carry
BitShiftDone2: push af ;1 ld a, (_ty) ld l, a ld a, (temp)
ld hl, (tx1) ld de, (dx3) add hl, de ld (tx1), hl ld hl, (tx2) ld de, (dx2) add hl, de ld (tx2), hl ld hl, (tu1) ld de, (du3) add hl, de ld (tu1), hl ld hl, (tu2) ld de, (du2) add hl, de ld (tu2), hl ld hl, (tv1) ld de, (dv3) add hl, de ld (tv1), hl ld hl, (tv2) ld de, (dv2) add hl, de ld (tv2), hl ld hl, _ty inc (hl) ld a, (y2) cp (hl) jp nz, QuadDrawLoop2
QuadDrawLoop3: ld a, (tx1) ld (temp), a ;i=temp
QuadPlotLoop3: ld a, (tx1) ld b, a ld a, (tx2) sub b ld c, a ld a, (tx1) ld d, a ld e, 0 ld a, (temp) sub b ld h, a ld l, 0 call DivFP ld a, h ld (temp+1), a ;tmp=temp+1 ld b, a ld a, 1 sub b ld d, a ld e, 0 ld a, (tu1) ld b, a ld c, 0 call MulFP push hl ld de, (temp+1) ld e, 0 ld bc, (tu2) ld c, 0 call MulFP pop de add hl, de ld a, h ld (temp2), a ;u=temp2 ld a, (temp+1) ld b, a ld a, 1 sub b ld d, a ld e, 0 ld a, (tv1) ld b, a ld c, 0 call MulFP push hl ld a, (temp+1) ld d, a ld e, 0 ld a, (tv2) ld b, a ld c, 0 call MulFP pop de add hl, de ld a, h ld (temp2+1), a ;v=temp2+1 ;Get the pixel at (u,v) from the texture ld hl, (temp2+1) ld h, 0 ;1 byte smaller
ld de, texture add hl, de
ld a, (temp2) ld b, a inc b ld a, (hl) shiftLoop3: rl c djnz shiftLoop3 ;the extra shift gets rid of the jr ;and pulls the bit out of carry
BitShiftDone3: push af ;1 ld a, (_ty) ld l, a ld a, (temp)
Alright, thanks for all the great info everyone Ok, get myself a 84+SE, learn BASIC, ASM, and AXE. Hone my skills, then move on to a Casio Prizm when I feel I'm ready lol I kind of wanna paint the casing and add a backlit screen, is that a bad idea or no?
You can't do much wrong with paint, but for the backlight, I would suggest just taping some LED's at the side of the screen, outside of the calculator. This should give you enough light if you take bright LED's. Also remembr that soldering anything to the INSIDE of your calculator will void the warranty, and if you are using LED's for this, don't forget to use a resistor when you use the calc's 6v battery pack.
But anyway, i really think you should paste LED's or other lights to the front of the calculator, pointing at the screen. A screen that isn't made for use with a baklight has a mirror at the back, which usually isn't fully transparent (I tried it with an other kind of LCD some time ago, and only a rectangle in the middle was illuminated). And many other screens with baclight also have the light in front of the screen anyway.